├── addequipment.cpp ├── addequipment.h ├── basetableitem.cpp ├── basetableitem.h ├── basetablewidget.cpp ├── basetablewidget.h ├── config └── ChinesePinyin ├── customplotwidget.cpp ├── customplotwidget.h ├── database └── plantManager.db ├── equipmentinfothread.cpp ├── equipmentinfothread.h ├── ffmpeg ├── include │ ├── avcodec.h │ ├── avformat.h │ ├── avio.h │ ├── libavcodec │ │ ├── avcodec.h │ │ ├── opt.h │ │ ├── vdpau.h │ │ └── xvmc.h │ ├── libavdevice │ │ └── avdevice.h │ ├── libavformat │ │ ├── avformat.h │ │ └── avio.h │ ├── libavutil │ │ ├── adler32.h │ │ ├── avstring.h │ │ ├── avutil.h │ │ ├── base64.h │ │ ├── common.h │ │ ├── crc.h │ │ ├── fifo.h │ │ ├── intfloat_readwrite.h │ │ ├── log.h │ │ ├── lzo.h │ │ ├── mathematics.h │ │ ├── md5.h │ │ ├── mem.h │ │ ├── pixfmt.h │ │ ├── random.h │ │ ├── rational.h │ │ └── sha1.h │ ├── libpng12 │ │ ├── png.h │ │ └── pngconf.h │ ├── libswscale │ │ └── swscale.h │ ├── libyasm-stdint.h │ ├── libyasm.h │ ├── libyasm │ │ ├── arch.h │ │ ├── assocdat.h │ │ ├── bitvect.h │ │ ├── bytecode.h │ │ ├── compat-queue.h │ │ ├── coretype.h │ │ ├── dbgfmt.h │ │ ├── errwarn.h │ │ ├── expr.h │ │ ├── file.h │ │ ├── floatnum.h │ │ ├── hamt.h │ │ ├── insn.h │ │ ├── intnum.h │ │ ├── inttree.h │ │ ├── linemap.h │ │ ├── listfmt.h │ │ ├── md5.h │ │ ├── module.h │ │ ├── objfmt.h │ │ ├── parser.h │ │ ├── phash.h │ │ ├── preproc.h │ │ ├── section.h │ │ ├── symrec.h │ │ ├── valparam.h │ │ └── value.h │ ├── png.h │ ├── pngconf.h │ ├── swscale.h │ ├── x264.h │ ├── x264_config.h │ ├── xvid.h │ ├── zconf.h │ └── zlib.h └── lib │ ├── libavcodec.so │ ├── libavcodec.so.52 │ ├── libavcodec.so.52.20.1 │ ├── libavdevice.so │ ├── libavdevice.so.52 │ ├── libavdevice.so.52.1.0 │ ├── libavformat.so │ ├── libavformat.so.52 │ ├── libavformat.so.52.31.0 │ ├── libavutil.so │ ├── libavutil.so.49 │ ├── libavutil.so.49.15.0 │ ├── libpng.a │ ├── libpng.la │ ├── libpng.so │ ├── libpng.so.3 │ ├── libpng.so.3.18.0 │ ├── libpng12.a │ ├── libpng12.la │ ├── libpng12.so │ ├── libpng12.so.0 │ ├── libpng12.so.0.18.0 │ ├── libswscale.so │ ├── libswscale.so.0 │ ├── libswscale.so.0.7.1 │ ├── libx264.a │ ├── libx264.so │ ├── libx264.so.115 │ ├── libxvidcore.a │ ├── libxvidcore.so.4.3 │ ├── libyasm.a │ ├── libz.so │ ├── libz.so.1 │ ├── libz.so.1.2.3 │ ├── pkgconfig │ ├── libavcodec.pc │ ├── libavdevice.pc │ ├── libavformat.pc │ ├── libavutil.pc │ ├── libpng.pc │ ├── libpng12.pc │ ├── libswscale.pc │ └── x264.pc │ └── vhook │ ├── fish.so │ ├── null.so │ ├── ppm.so │ └── watermark.so ├── globalvar.h ├── images.qrc ├── images ├── WIFI_OFF.ico ├── WIFI_OFF1.ico ├── WIFI_ON.ico ├── WIFI_ON1.ico ├── add.png └── refresh.ico ├── infocollectwidget.cpp ├── infocollectwidget.h ├── infoshowwidget.cpp ├── infoshowwidget.h ├── main.cpp ├── mainwidget.cpp ├── mainwidget.h ├── messagebox.cpp.autosave ├── messagebox.h.autosave ├── mymessagebox.cpp ├── mymessagebox.h ├── networkingwidget.cpp ├── networkingwidget.h ├── plantMonitorSys.pro ├── plantglobalwidget.cpp ├── plantglobalwidget.h ├── qcustomplot ├── qcustomplot.cpp └── qcustomplot.h ├── readme.md ├── screenshot ├── 1.png ├── 10.png ├── 11.png ├── 12.png ├── 13.png ├── 2.png ├── 3.png ├── 4.png ├── 5.png ├── 6.png ├── 7.png ├── 8.png └── 9.png ├── softkeyboard ├── ChinesePinyin ├── softkeyboard.cpp └── softkeyboard.h ├── videocapture.cpp ├── videocapture.h ├── videoencode.cpp ├── videoencode.h ├── videomonitorwidget.cpp ├── videomonitorwidget.h ├── wificonndialog.cpp └── wificonndialog.h /addequipment.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | *@file: addequipment.cpp 3 | *@author: 缪庆瑞 4 | *@date: 2017.3.31 5 | *@brief: 添加设备按钮的对话框 6 | */ 7 | #include "addequipment.h" 8 | #include 9 | #include 10 | 11 | AddEquipment::AddEquipment(QWidget *parent): 12 | QDialog(parent) 13 | { 14 | this->resize(360,300); 15 | this->setModal(true);//将对话框设置为模态,默认为应用模态:阻塞所有的窗口输入 16 | //窗口模态,仅阻塞父窗口及以上的窗口,以免阻塞对话框的子窗口-软键盘无法输入 17 | this->setWindowModality(Qt::WindowModal); 18 | this->setFont(QFont("msyh",20)); 19 | QLabel *equipmentNoLabel = new QLabel(tr("设 备 号:")); 20 | equipmentNoEdit = new QLineEdit(this); 21 | equipmentNoEdit->setFixedHeight(45); 22 | equipmentNoEdit->installEventFilter(this);//lineEdit部件在该对象上安装事件过滤器 23 | QLabel *equipmentNameLabel = new QLabel(tr("设备名称:")); 24 | equipmentNameEdit = new QLineEdit(this); 25 | equipmentNameEdit->setFixedHeight(45); 26 | equipmentNameEdit->installEventFilter(this); 27 | QLabel *equipmentAddrLabel = new QLabel(tr("设备地址:")); 28 | equipmentAddrEdit = new QLineEdit(this); 29 | equipmentAddrEdit->setFixedHeight(45); 30 | equipmentAddrEdit->installEventFilter(this); 31 | QLabel *equipmentPresetVLabel = new QLabel(tr("给定电压:")); 32 | equipmentPresetVEdit = new QLineEdit(this); 33 | equipmentPresetVEdit->setFixedHeight(45); 34 | equipmentPresetVEdit->installEventFilter(this); 35 | QLabel *equipmentPresetALabel = new QLabel(tr("给定电流:")); 36 | equipmentPresetAEdit = new QLineEdit(this); 37 | equipmentPresetAEdit->setFixedHeight(45); 38 | equipmentPresetAEdit->installEventFilter(this); 39 | 40 | QGridLayout *gridLayout = new QGridLayout(); 41 | gridLayout->setSpacing(5); 42 | gridLayout->addWidget(equipmentNoLabel,0,0,1,1); 43 | gridLayout->addWidget(equipmentNoEdit,0,1,1,2); 44 | gridLayout->addWidget(equipmentNameLabel,1,0,1,1); 45 | gridLayout->addWidget(equipmentNameEdit,1,1,1,2); 46 | gridLayout->addWidget(equipmentAddrLabel,2,0,1,1); 47 | gridLayout->addWidget(equipmentAddrEdit,2,1,1,2); 48 | gridLayout->addWidget(equipmentPresetVLabel,3,0,1,1); 49 | gridLayout->addWidget(equipmentPresetVEdit,3,1,1,2); 50 | gridLayout->addWidget(equipmentPresetALabel,4,0,1,1); 51 | gridLayout->addWidget(equipmentPresetAEdit,4,1,1,2); 52 | 53 | okBtn = new QPushButton(tr("确定"),this); 54 | okBtn->setFixedHeight(55); 55 | okBtn->setStyleSheet("QPushButton{outline:none;font: 20px \"msyh\";}" 56 | "QPushButton:pressed{background-color: orange;}"); 57 | cancelBtn = new QPushButton(tr("取消"),this); 58 | cancelBtn->setFixedHeight(55); 59 | cancelBtn->setStyleSheet("QPushButton{outline:none;font: 22px \"msyh\";}" 60 | "QPushButton:pressed{background-color: orange;}"); 61 | connect(okBtn,SIGNAL(clicked()),this,SLOT(okSlot())); 62 | connect(cancelBtn,SIGNAL(clicked()),this,SLOT(cancelSlot())); 63 | QGridLayout *gridLayout1 = new QGridLayout(this); 64 | gridLayout1->setContentsMargins(9,5,9,4); 65 | gridLayout1->addLayout(gridLayout,0,0,1,2); 66 | gridLayout1->addWidget(cancelBtn,1,0,1,1); 67 | gridLayout1->addWidget(okBtn,1,1,1,1); 68 | 69 | } 70 | 71 | AddEquipment::~AddEquipment() 72 | { 73 | 74 | } 75 | /* 76 | *@brief: 设置设备所在区域 77 | *@author: 缪庆瑞 78 | *@date: 2017.3.31 79 | */ 80 | void AddEquipment::setArea(QString Area) 81 | { 82 | this->Area = Area; 83 | } 84 | /* 85 | *@brief: 确定按钮响应槽,对输入的数据格式判断,并对比数据库新增设备是否冲突 86 | *@author: 缪庆瑞 87 | *@date: 2017.3.31 88 | */ 89 | void AddEquipment::okSlot() 90 | { 91 | bool ok=true; 92 | QString equipmentNo = equipmentNoEdit->text(); 93 | QString equipmentName = equipmentNameEdit->text(); 94 | QString equipmentIpAddr = equipmentAddrEdit->text(); 95 | double presetV; 96 | int presetA; 97 | if(equipmentNo.isEmpty()) 98 | { 99 | MyMessageBox::myInformation(this,"infomation",tr("设备号不能为空")); 100 | //QMessageBox::information(this,"infomation",tr("设备号不能为空")); 101 | return; 102 | } 103 | QStringList ipAddrSegment = equipmentIpAddr.split(".");//按点分割ip地址段 104 | if(ipAddrSegment.size()!=4) 105 | { 106 | MyMessageBox::myInformation(this,"infomation",tr("ip地址格式不符合规范")); 107 | //QMessageBox::information(this,"infomation",tr("ip地址格式不符合规范")); 108 | return; 109 | } 110 | else 111 | { 112 | for(int i=0;i<4;i++) 113 | { 114 | int ip = ipAddrSegment.at(i).toInt(&ok); 115 | if(!ok||ip<0||ip>255) 116 | { 117 | MyMessageBox::myInformation(this,"infomation",tr("ip地址格式不符合规范2")); 118 | //QMessageBox::information(this,"infomation",tr("ip地址格式不符合规范2")); 119 | return; 120 | } 121 | } 122 | } 123 | presetV = equipmentPresetVEdit->text().toDouble(&ok); 124 | if(!ok||presetV>60||presetV<=0) 125 | { 126 | MyMessageBox::myInformation(this,"infomation",tr("给定电压应在\n0-60.0V范围内")); 127 | //QMessageBox::information(this,"infomation",tr("给定电压应在\n0-60.0V范围内")); 128 | return; 129 | } 130 | presetA = equipmentPresetAEdit->text().toInt(&ok); 131 | if(!ok||presetA>600||presetA<=0) 132 | { 133 | MyMessageBox::myInformation(this,"information",tr("给定电流应在\n0-600A范围内")); 134 | //QMessageBox::information(this,"information",tr("给定电流应在\n0-600A范围内")); 135 | return; 136 | } 137 | //通过连接名获取在车间总况界面连接的数据库,即共用一个数据库连接 138 | db = QSqlDatabase::database("connection1"); 139 | QSqlQuery query(db); 140 | if(!query.exec("select * from equipmentInfo where No='"+equipmentNoEdit->text()+"'")) 141 | { 142 | qDebug()<clear(); 177 | equipmentNameEdit->clear(); 178 | equipmentAddrEdit->clear(); 179 | equipmentPresetVEdit->clear(); 180 | equipmentPresetAEdit->clear(); 181 | this->close();//默认只是隐藏界面,并不delete对象 182 | } 183 | /* 184 | *@brief: 软键盘信号处理槽 185 | *@author: 缪庆瑞 186 | *@date: 2017.5.5 187 | *@param: text:软键盘输入的文本 188 | */ 189 | void AddEquipment::keyboardSlot(QString text) 190 | { 191 | tempEdit->setText(text);//将软键盘输入的内容填入点击的edit上 192 | } 193 | /* 194 | *@brief: 事件过滤器处理函数 195 | *@author: 缪庆瑞 196 | *@date: 2017.5.5 197 | *@param: obj:产生事件的对象 198 | *@param: event:产生的事件 199 | */ 200 | bool AddEquipment::eventFilter(QObject *obj, QEvent *event) 201 | { 202 | if(event->type()==QEvent::MouseButtonRelease)//只处理鼠标释放事件 203 | { 204 | tempEdit = qobject_cast(obj); 205 | /*因为将softKeyboard改成了全局对象,可能会导致同一个对象的信号引起多个槽响应,出现段错误 206 | 所以每一次先断开全局对象的所有连接,再连接一次*/ 207 | disconnect(softKeyboard,0,0,0);//断开软键盘对象的所有信号与槽的连接 208 | //连接软键盘信号 209 | connect(softKeyboard,SIGNAL(sendText(QString)),this,SLOT(keyboardSlot(QString))); 210 | softKeyboard->setInputText(tempEdit->text()); 211 | //softKeyboard->showFullScreen(); 212 | softKeyboard->show(); 213 | } 214 | return QDialog::eventFilter(obj,event); 215 | } 216 | 217 | -------------------------------------------------------------------------------- /addequipment.h: -------------------------------------------------------------------------------- 1 | /* 2 | *@file: addequipment.h 3 | *@author: 缪庆瑞 4 | *@date: 2017.3.31 5 | *@brief: 添加设备按钮的对话框 6 | */ 7 | #ifndef ADDEQUIPMENT_H 8 | #define ADDEQUIPMENT_H 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include "mymessagebox.h" 19 | #include "globalvar.h" 20 | 21 | class AddEquipment : public QDialog 22 | { 23 | Q_OBJECT 24 | public: 25 | AddEquipment(QWidget *parent = 0); 26 | ~AddEquipment(); 27 | void setArea(QString Area); 28 | 29 | signals: 30 | void addSuccessSignal(); 31 | 32 | public slots: 33 | void okSlot(); 34 | void cancelSlot(); 35 | void keyboardSlot(QString text);//处理软键盘信号的槽 36 | 37 | protected: 38 | virtual bool eventFilter(QObject *obj,QEvent *event); 39 | 40 | private: 41 | QString Area;//标示设备区域 42 | QLineEdit *tempEdit;//用来记录当前引发事件过滤器处理的edit部件 43 | QLineEdit *equipmentNoEdit;//设备号 44 | QLineEdit *equipmentNameEdit;//设备名 45 | QLineEdit *equipmentAddrEdit;//设备ip 46 | QLineEdit *equipmentPresetVEdit;//设备给定电压 47 | QLineEdit *equipmentPresetAEdit;//设备给定电流 48 | QPushButton *okBtn;//确定按钮 49 | QPushButton *cancelBtn;//取消 50 | 51 | /*定义数据库对象,此时是无效的,通过静态方法database(connectionName)获取已有的数据库连接 52 | 操作同一数据库*/ 53 | QSqlDatabase db; 54 | }; 55 | 56 | #endif // ADDEQUIPMENT_H 57 | -------------------------------------------------------------------------------- /basetableitem.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2016 Aotai Electric Co.,LTD 山东奥太电气有限公司 4 | ** All rights reserved. 5 | ** 6 | ****************************************************************************/ 7 | /* 8 | *@file: basetableitem.cpp 9 | *@author: 缪庆瑞 10 | *@date: 2016.8.8 11 | *@brief: 存放item单元格数据 12 | */ 13 | #include "basetableitem.h" 14 | 15 | /* 16 | *@brief: 定义存放item信息的类 17 | *@author: 缪庆瑞 18 | *@date: 2016.8.8 19 | *@param: ItemContentType:item的类型 20 | *@param: text:item的显示文本 21 | *@param: iconAddr:图标文件的路径 22 | *@param: widget1:控件1 23 | *@param: widget2:控件2 24 | */ 25 | BaseTableItem::BaseTableItem(ItemContentType itemContentType,QString text,QString iconAddr,QWidget *widget1,QWidget *widget2) 26 | { 27 | this->text=text;//由参数对item对象传递数据 28 | this->iconAddr=iconAddr; 29 | this->widget1=widget1; 30 | this->widget2=widget2; 31 | this->itemContentType=itemContentType; 32 | } 33 | 34 | BaseTableItem::BaseTableItem() 35 | { 36 | 37 | } 38 | -------------------------------------------------------------------------------- /basetableitem.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2016 Aotai Electric Co.,LTD 山东奥太电气有限公司 4 | ** All rights reserved. 5 | ** 6 | ****************************************************************************/ 7 | /* 8 | *@file: basetableitem.h 9 | *@author: 缪庆瑞 10 | *@date: 2016.8.8 11 | *@brief: basetableitem的头文件 12 | */ 13 | #ifndef BASETABLEITEM_H 14 | #define BASETABLEITEM_H 15 | #include 16 | #include 17 | 18 | class BaseTableItem 19 | { 20 | public: 21 | enum ItemContentType{ 22 | TEXT, //只设置文本 23 | CHECKBOX_TEXT, //带复选框的文本 24 | ICON_TEXT, //带图标的文本 25 | WIDGET, //设置一个控件 26 | WIDGET_WIDGET //设置两个控件 27 | }; 28 | BaseTableItem(); 29 | BaseTableItem(ItemContentType itemContentType,QString text,QString iconAddr=NULL,QWidget *widget1=NULL,QWidget *widget2=NULL); 30 | 31 | QString text;//存放单元格显示文本 32 | QString iconAddr;//存放图标路径 33 | QWidget *widget1;//存放部件 34 | QWidget *widget2; 35 | ItemContentType itemContentType;//存放item类型 36 | 37 | }; 38 | 39 | #endif // BASETABLEITEM_H 40 | -------------------------------------------------------------------------------- /basetablewidget.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2016 Aotai Electric Co.,LTD 山东奥太电气有限公司 4 | ** All rights reserved. 5 | ** 6 | ****************************************************************************/ 7 | /* 8 | *@file: basetablewidget.h 9 | *@author: 缪庆瑞 10 | *@date: 2016.8.1 11 | *@brief: basetablewidget的头文件 12 | *@update: 2016.9.12修改 对于单元格控件对象不再用数组单独保存,省去删除操作所带来的数组移动时间,对于控件的获取直接用cellwidget()多个部件使用findchild() 13 | */ 14 | #ifndef BASETABLEWIDGET_H 15 | #define BASETABLEWIDGET_H 16 | //#define EVENTROW 100 //定义存放对应行列单元格item的二维数组行数 17 | 18 | #include "basetableitem.h" 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | 25 | class BaseTableItem;//类的前置声明,下面要使用 26 | 27 | class BaseTableWidget : public QTableWidget 28 | { 29 | Q_OBJECT 30 | public: 31 | explicit BaseTableWidget(QWidget *parent=0); 32 | explicit BaseTableWidget(int rowNum,int columnNum,QList items,bool rowInit=true,QWidget *parent = 0);//构造指定行数和列数的table,并按顺序初始化单元格 33 | //explicit 声明为显式构造 不能在隐式转换中使用,规定只传一个参数的构造函数会定义一个隐式转换,隐式转换常带来逻辑错误,所以尽量声明显式 34 | ~BaseTableWidget(); 35 | 36 | void setItemContent(int row,int column,BaseTableItem *item);//设置Item内容的函数 37 | void setItemValue(int row,int column,QString text);//设置item文本 38 | void setColWidthRowHeight(int columnWidth,int rowHeight);//设置表格的列宽和行高,所有行列都一致 39 | 40 | void setNormalPressStyle(QString backgroundColor,QString border,QString textColor);//设置鼠标按下前的样式 41 | void setPressStyle(QString backgroundColor,QString border,QString textColor);//设置鼠标按下的样式 42 | void setPressStyle(QString style);//设置按下的样式 43 | void setReleaseStyle(QString backgroundColor,QString border,QString textColor);//设置鼠标释放后的设置 44 | void setReleaseStyle(QString style);//设置释放的样式 45 | 46 | void setSelectRow(int row=0,int column=0);//设置默认选择单元格 47 | 48 | //void deleteRow(int row);//删除指定行 49 | 50 | //BaseTableItem *itemsRowCol[EVENTROW][20];//存放对应行列单元格的项,主要是为了给控件加事件过滤监听,不初始化默认各元素为空 51 | 52 | protected: 53 | virtual void mousePressEvent(QMouseEvent *e);//鼠标按下事件处理函数 54 | virtual void mouseReleaseEvent(QMouseEvent *e);//鼠标释放事件处理函数 55 | 56 | bool eventFilter(QObject *, QEvent *);//事件过滤器处理函数 57 | 58 | signals: 59 | void pressedSignal();//鼠标按下发出的信号 60 | void releasedSignal(); 61 | 62 | public slots: 63 | QString getItemText(int row,int column);//获取选中行指定列值 64 | QWidget *getItemWidget(int row,int column,int num=1);//获取选中行指定列控件 65 | int getRowNo();//获取当前行号 66 | int getColumnNo();//获取当前列号 67 | 68 | void tablePress();//鼠标按下事件发射信号的响应槽 69 | void tableRelease();//鼠标释放事件发射信号的响应槽 70 | void itemChangedSlot(QTableWidgetItem *item);//changed 信号的响应槽 71 | 72 | private: 73 | QString pressStyle;//存放设置的鼠标按下的样式 74 | QString releaseStyle;//存放设置的鼠标释放的样式 75 | 76 | //QList eventRows;//存放安装事件监听的控件所在行号 77 | //QList eventCols; 78 | 79 | }; 80 | 81 | #endif // BASETABLEWIDGET_H 82 | -------------------------------------------------------------------------------- /customplotwidget.h: -------------------------------------------------------------------------------- 1 | /* 2 | *@file: customplotwidget.h 3 | *@author: 缪庆瑞 4 | *@date: 2017.4.10 5 | *@brief: 绘制图表的类,该类主要调用QCustomPlot曲线组件类的方法绘图 6 | */ 7 | #ifndef CUSTOMPLOTWIDGET_H 8 | #define CUSTOMPLOTWIDGET_H 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include "qcustomplot/qcustomplot.h" 26 | #include "mymessagebox.h" 27 | 28 | class CustomPlotWidget : public QWidget 29 | { 30 | Q_OBJECT 31 | public: 32 | explicit CustomPlotWidget(QWidget *parent = 0); 33 | ~CustomPlotWidget(); 34 | 35 | void setHashData(QString equipmentNo,QStringList graphDataList);//设置hash键值对 36 | void graphing(QString equipmentNo);//根据当前设备号绘制实时曲线图 37 | void setEquipmentNo(QString equipmentNo);//设置当前的设备号,并刷新实时显示 38 | 39 | private: 40 | void initCustomPlot();//初始化曲线组件QCustomPlot类对象 41 | void initOtherWidget();//初始化曲线绘制界面的其他控制及显示类部件 42 | void initHistoryQueryWidget();//初始化历史数据曲线查询的部件 43 | 44 | signals: 45 | 46 | public slots: 47 | void refreshTime();//实时数据曲线刷新 48 | void voltageSliderValueChanged(int value);//滑动条改变的响应槽 49 | void currentSliderValueChanged(int value); 50 | void realtimeOrHistoryChanged(int id);//实时数据与历史数据切换 51 | void queryHistoryDataSlot();//查询指定的历史数据 52 | 53 | private: 54 | QCustomPlot *customPlot;//绘图组件类对象 55 | QTimer *timer;//定时器 定时刷新实时数据曲线的横坐标(时间) 56 | bool realtimeFlag;//标记曲线图的实时状态 57 | QString equipmentNo;//标记当前的设备号 58 | //图表信息哈希表,键为设备号,值为图表信息的一个列表(电压,电流,时间) 59 | QHash > > graphInfoHash; 60 | 61 | //图表绘制界面的其他部件 62 | QLabel *voltageLabel; 63 | QLabel *currentLabel; 64 | QButtonGroup *buttonGroup;//管理实时和历史按钮 65 | QRadioButton *realtimeBtn;//实时 66 | QRadioButton *historyBtn;//历史 67 | QSlider *voltageSlider;//控制电压的范围range 68 | QSlider *currentSlider;//控制电流的范围 69 | 70 | //历史数据曲线查询的相关部件 71 | QWidget *historyQueryWidget; 72 | //QLabel *startTimeLable;//起始时间label 73 | QComboBox *yearBox; 74 | QComboBox *monthBox; 75 | QComboBox *dayBox; 76 | QComboBox *hourBox; 77 | QComboBox *minuteBox; 78 | QLabel *timeIntervalLabel;//时间间隔label 79 | QComboBox *timeIntervalBox; 80 | QPushButton *queryBtn; 81 | 82 | }; 83 | 84 | #endif // CUSTOMPLOTWIDGET_H 85 | -------------------------------------------------------------------------------- /database/plantManager.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justdoit-mqr/plantMonitorSys/7ecb02b3e404b2f9f11a9e7d674c34bad5f09ee6/database/plantManager.db -------------------------------------------------------------------------------- /equipmentinfothread.h: -------------------------------------------------------------------------------- 1 | /* 2 | *@file: equipmentinfothread.h 3 | *@author: 缪庆瑞 4 | *@date: 2017.3.16 5 | *@brief: 获取设备信息参数的线程,实际该类是一个继承QObject实现TCPServer 6 | *的子类,使用movetothread()使其运行在子线程中。关于线程的使用方法可参考 7 | *网络上“QT开发者关于QThread的咆哮”文章,讲述了QThread实际应该怎么用。 8 | */ 9 | #ifndef EQUIPMENTINFOTHREAD_H 10 | #define EQUIPMENTINFOTHREAD_H 11 | 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | class EquipmentInfoThread : public QObject 18 | { 19 | Q_OBJECT 20 | public: 21 | explicit EquipmentInfoThread(QObject *parent = 0); 22 | ~EquipmentInfoThread(); 23 | //初始化服务器定时向连接的客户端发送请求数据的指令包,指令数据相同 24 | void initRequestData(); 25 | //数据在网络传输中,通过公司内部的HDLC协议对其处理 26 | QByteArray dataToHDLC(QByteArray rawData); 27 | void HDLCToData(QByteArray &encipheredData); 28 | QStringList convertReceiveMessage(QByteArray &array); 29 | 30 | signals: 31 | void equipmentDataSignal(QStringList); 32 | void disconnectSignal(QString ipAddr);//客户端断开连接信号 33 | 34 | public slots: 35 | void getClientSocket();//获取连接到服务器的QTcpSocket 即客户端创建的套接字 36 | void receiveMessage();//服务器接收客户端的消息 37 | void sendMessage();//服务器发送请求数据的消息 38 | void sendMessageData(QStringList list);//服务器回复数据 39 | void disconnectSlot();//对客户端断开连接的信号处理 40 | 41 | private: 42 | QTcpServer *tcpServer; 43 | QList clientConnectionList;//客户端创建的套接字链表,因为可能多个客户端同时连接 44 | QTimer *timer;//定时器,用来让服务器定时向客户端请求数据 45 | quint8 nextBlockSize; 46 | QByteArray requestData; 47 | }; 48 | 49 | #endif // EQUIPMENTINFOTHREAD_H 50 | -------------------------------------------------------------------------------- /ffmpeg/include/libavcodec/opt.h: -------------------------------------------------------------------------------- 1 | /* 2 | * AVOptions 3 | * copyright (c) 2005 Michael Niedermayer 4 | * 5 | * This file is part of FFmpeg. 6 | * 7 | * FFmpeg is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * FFmpeg is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with FFmpeg; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | #ifndef AVCODEC_OPT_H 23 | #define AVCODEC_OPT_H 24 | 25 | /** 26 | * @file libavcodec/opt.h 27 | * AVOptions 28 | */ 29 | 30 | #include "libavutil/rational.h" 31 | #include "avcodec.h" 32 | 33 | enum AVOptionType{ 34 | FF_OPT_TYPE_FLAGS, 35 | FF_OPT_TYPE_INT, 36 | FF_OPT_TYPE_INT64, 37 | FF_OPT_TYPE_DOUBLE, 38 | FF_OPT_TYPE_FLOAT, 39 | FF_OPT_TYPE_STRING, 40 | FF_OPT_TYPE_RATIONAL, 41 | FF_OPT_TYPE_BINARY, ///< offset must point to a pointer immediately followed by an int for the length 42 | FF_OPT_TYPE_CONST=128, 43 | }; 44 | 45 | /** 46 | * AVOption 47 | */ 48 | typedef struct AVOption { 49 | const char *name; 50 | 51 | /** 52 | * short English help text 53 | * @todo What about other languages? 54 | */ 55 | const char *help; 56 | 57 | /** 58 | * The offset relative to the context structure where the option 59 | * value is stored. It should be 0 for named constants. 60 | */ 61 | int offset; 62 | enum AVOptionType type; 63 | 64 | /** 65 | * the default value for scalar options 66 | */ 67 | double default_val; 68 | double min; ///< minimum valid value for the option 69 | double max; ///< maximum valid value for the option 70 | 71 | int flags; 72 | #define AV_OPT_FLAG_ENCODING_PARAM 1 ///< a generic parameter which can be set by the user for muxing or encoding 73 | #define AV_OPT_FLAG_DECODING_PARAM 2 ///< a generic parameter which can be set by the user for demuxing or decoding 74 | #define AV_OPT_FLAG_METADATA 4 ///< some data extracted or inserted into the file like title, comment, ... 75 | #define AV_OPT_FLAG_AUDIO_PARAM 8 76 | #define AV_OPT_FLAG_VIDEO_PARAM 16 77 | #define AV_OPT_FLAG_SUBTITLE_PARAM 32 78 | //FIXME think about enc-audio, ... style flags 79 | 80 | /** 81 | * The logical unit to which the option belongs. Non-constant 82 | * options and corresponding named constants share the same 83 | * unit. May be NULL. 84 | */ 85 | const char *unit; 86 | } AVOption; 87 | 88 | 89 | /** 90 | * Looks for an option in \p obj. Looks only for the options which 91 | * have the flags set as specified in \p mask and \p flags (that is, 92 | * for which it is the case that opt->flags & mask == flags). 93 | * 94 | * @param[in] obj a pointer to a struct whose first element is a 95 | * pointer to an AVClass 96 | * @param[in] name the name of the option to look for 97 | * @param[in] unit the unit of the option to look for, or any if NULL 98 | * @return a pointer to the option found, or NULL if no option 99 | * has been found 100 | */ 101 | const AVOption *av_find_opt(void *obj, const char *name, const char *unit, int mask, int flags); 102 | 103 | #if LIBAVCODEC_VERSION_MAJOR < 53 104 | /** 105 | * @see av_set_string2() 106 | */ 107 | attribute_deprecated const AVOption *av_set_string(void *obj, const char *name, const char *val); 108 | 109 | /** 110 | * @return a pointer to the AVOption corresponding to the field set or 111 | * NULL if no matching AVOption exists, or if the value \p val is not 112 | * valid 113 | * @see av_set_string3() 114 | */ 115 | attribute_deprecated const AVOption *av_set_string2(void *obj, const char *name, const char *val, int alloc); 116 | #endif 117 | 118 | /** 119 | * Sets the field of obj with the given name to value. 120 | * 121 | * @param[in] obj A struct whose first element is a pointer to an 122 | * AVClass. 123 | * @param[in] name the name of the field to set 124 | * @param[in] val The value to set. If the field is not of a string 125 | * type, then the given string is parsed. 126 | * SI postfixes and some named scalars are supported. 127 | * If the field is of a numeric type, it has to be a numeric or named 128 | * scalar. Behavior with more than one scalar and +- infix operators 129 | * is undefined. 130 | * If the field is of a flags type, it has to be a sequence of numeric 131 | * scalars or named flags separated by '+' or '-'. Prefixing a flag 132 | * with '+' causes it to be set without affecting the other flags; 133 | * similarly, '-' unsets a flag. 134 | * @param[out] o_out if non-NULL put here a pointer to the AVOption 135 | * found 136 | * @param alloc when 1 then the old value will be av_freed() and the 137 | * new av_strduped() 138 | * when 0 then no av_free() nor av_strdup() will be used 139 | * @return 0 if the value has been set, an AVERROR* error code if no 140 | * matching option exists, or if the value \p val is not valid 141 | */ 142 | int av_set_string3(void *obj, const char *name, const char *val, int alloc, const AVOption **o_out); 143 | 144 | const AVOption *av_set_double(void *obj, const char *name, double n); 145 | const AVOption *av_set_q(void *obj, const char *name, AVRational n); 146 | const AVOption *av_set_int(void *obj, const char *name, int64_t n); 147 | double av_get_double(void *obj, const char *name, const AVOption **o_out); 148 | AVRational av_get_q(void *obj, const char *name, const AVOption **o_out); 149 | int64_t av_get_int(void *obj, const char *name, const AVOption **o_out); 150 | const char *av_get_string(void *obj, const char *name, const AVOption **o_out, char *buf, int buf_len); 151 | const AVOption *av_next_option(void *obj, const AVOption *last); 152 | int av_opt_show(void *obj, void *av_log_obj); 153 | void av_opt_set_defaults(void *s); 154 | void av_opt_set_defaults2(void *s, int mask, int flags); 155 | 156 | #endif /* AVCODEC_OPT_H */ 157 | -------------------------------------------------------------------------------- /ffmpeg/include/libavcodec/vdpau.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The Video Decode and Presentation API for UNIX (VDPAU) is used for 3 | * hardware-accelerated decoding of MPEG-1/2, H.264 and VC-1. 4 | * 5 | * Copyright (C) 2008 NVIDIA 6 | * 7 | * This file is part of FFmpeg. 8 | * 9 | * FFmpeg is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * FFmpeg is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU Lesser General Public 20 | * License along with FFmpeg; if not, write to the Free Software 21 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 22 | */ 23 | 24 | #ifndef AVCODEC_VDPAU_H 25 | #define AVCODEC_VDPAU_H 26 | 27 | /** 28 | * \defgroup Decoder VDPAU Decoder and Renderer 29 | * 30 | * VDPAU hardware acceleration has two modules 31 | * - VDPAU decoding 32 | * - VDPAU presentation 33 | * 34 | * The VDPAU decoding module parses all headers using FFmpeg 35 | * parsing mechanisms and uses VDPAU for the actual decoding. 36 | * 37 | * As per the current implementation, the actual decoding 38 | * and rendering (API calls) are done as part of the VDPAU 39 | * presentation (vo_vdpau.c) module. 40 | * 41 | * @{ 42 | * \defgroup VDPAU_Decoding VDPAU Decoding 43 | * \ingroup Decoder 44 | * @{ 45 | */ 46 | 47 | #include 48 | #include 49 | 50 | /** \brief The videoSurface is used for rendering. */ 51 | #define FF_VDPAU_STATE_USED_FOR_RENDER 1 52 | 53 | /** 54 | * \brief The videoSurface is needed for reference/prediction. 55 | * The codec manipulates this. 56 | */ 57 | #define FF_VDPAU_STATE_USED_FOR_REFERENCE 2 58 | 59 | /** 60 | * \brief This structure is used as a callback between the FFmpeg 61 | * decoder (vd_) and presentation (vo_) module. 62 | * This is used for defining a video frame containing surface, 63 | * picture parameter, bitstream information etc which are passed 64 | * between the FFmpeg decoder and its clients. 65 | */ 66 | struct vdpau_render_state { 67 | VdpVideoSurface surface; ///< Used as rendered surface, never changed. 68 | 69 | int state; ///< Holds FF_VDPAU_STATE_* values. 70 | 71 | /** picture parameter information for all supported codecs */ 72 | union VdpPictureInfo { 73 | VdpPictureInfoH264 h264; 74 | VdpPictureInfoMPEG1Or2 mpeg; 75 | VdpPictureInfoVC1 vc1; 76 | } info; 77 | 78 | /** Describe size/location of the compressed video data. */ 79 | int bitstream_buffers_allocated; 80 | int bitstream_buffers_used; 81 | VdpBitstreamBuffer *bitstream_buffers; 82 | }; 83 | 84 | /* @}*/ 85 | 86 | #endif /* AVCODEC_VDPAU_H */ 87 | -------------------------------------------------------------------------------- /ffmpeg/include/libavcodec/xvmc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2003 Ivan Kalvachev 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVCODEC_XVMC_H 22 | #define AVCODEC_XVMC_H 23 | 24 | #include 25 | 26 | #include "avcodec.h" 27 | 28 | #if LIBAVCODEC_VERSION_MAJOR < 53 29 | #define AV_XVMC_STATE_DISPLAY_PENDING 1 /** the surface should be shown, the video driver manipulates this */ 30 | #define AV_XVMC_STATE_PREDICTION 2 /** the surface is needed for prediction, the codec manipulates this */ 31 | #define AV_XVMC_STATE_OSD_SOURCE 4 /** the surface is needed for subpicture rendering */ 32 | #endif 33 | #define AV_XVMC_ID 0x1DC711C0 /**< special value to ensure that regular pixel routines haven't corrupted the struct 34 | the number is 1337 speak for the letters IDCT MCo (motion compensation) */ 35 | 36 | struct xvmc_pix_fmt { 37 | /** The field contains the special constant value AV_XVMC_ID. 38 | It is used as a test that the application correctly uses the API, 39 | and that there is no corruption caused by pixel routines. 40 | - application - set during initialization 41 | - libavcodec - unchanged 42 | */ 43 | int xvmc_id; 44 | 45 | /** Pointer to the block array allocated by XvMCCreateBlocks(). 46 | The array has to be freed by XvMCDestroyBlocks(). 47 | Each group of 64 values represents one data block of differential 48 | pixel information (in MoCo mode) or coefficients for IDCT. 49 | - application - set the pointer during initialization 50 | - libavcodec - fills coefficients/pixel data into the array 51 | */ 52 | short* data_blocks; 53 | 54 | /** Pointer to the macroblock description array allocated by 55 | XvMCCreateMacroBlocks() and freed by XvMCDestroyMacroBlocks(). 56 | - application - set the pointer during initialization 57 | - libavcodec - fills description data into the array 58 | */ 59 | XvMCMacroBlock* mv_blocks; 60 | 61 | /** Number of macroblock descriptions that can be stored in the mv_blocks 62 | array. 63 | - application - set during initialization 64 | - libavcodec - unchanged 65 | */ 66 | int allocated_mv_blocks; 67 | 68 | /** Number of blocks that can be stored at once in the data_blocks array. 69 | - application - set during initialization 70 | - libavcodec - unchanged 71 | */ 72 | int allocated_data_blocks; 73 | 74 | /** Indicates that the hardware would interpret data_blocks as IDCT 75 | coefficients and perform IDCT on them. 76 | - application - set during initialization 77 | - libavcodec - unchanged 78 | */ 79 | int idct; 80 | 81 | /** In MoCo mode it indicates that intra macroblocks are assumed to be in 82 | unsigned format; same as the XVMC_INTRA_UNSIGNED flag. 83 | - application - set during initialization 84 | - libavcodec - unchanged 85 | */ 86 | int unsigned_intra; 87 | 88 | /** Pointer to the surface allocated by XvMCCreateSurface(). 89 | It has to be freed by XvMCDestroySurface() on application exit. 90 | It identifies the frame and its state on the video hardware. 91 | - application - set during initialization 92 | - libavcodec - unchanged 93 | */ 94 | XvMCSurface* p_surface; 95 | 96 | /** Set by the decoder before calling ff_draw_horiz_band(), 97 | needed by the XvMCRenderSurface function. */ 98 | //@{ 99 | /** Pointer to the surface used as past reference 100 | - application - unchanged 101 | - libavcodec - set 102 | */ 103 | XvMCSurface* p_past_surface; 104 | 105 | /** Pointer to the surface used as future reference 106 | - application - unchanged 107 | - libavcodec - set 108 | */ 109 | XvMCSurface* p_future_surface; 110 | 111 | /** top/bottom field or frame 112 | - application - unchanged 113 | - libavcodec - set 114 | */ 115 | unsigned int picture_structure; 116 | 117 | /** XVMC_SECOND_FIELD - 1st or 2nd field in the sequence 118 | - application - unchanged 119 | - libavcodec - set 120 | */ 121 | unsigned int flags; 122 | //}@ 123 | 124 | /** Number of macroblock descriptions in the mv_blocks array 125 | that have already been passed to the hardware. 126 | - application - zeroes it on get_buffer(). 127 | A successful ff_draw_horiz_band() may increment it 128 | with filled_mb_block_num or zero both. 129 | - libavcodec - unchanged 130 | */ 131 | int start_mv_blocks_num; 132 | 133 | /** Number of new macroblock descriptions in the mv_blocks array (after 134 | start_mv_blocks_num) that are filled by libavcodec and have to be 135 | passed to the hardware. 136 | - application - zeroes it on get_buffer() or after successful 137 | ff_draw_horiz_band(). 138 | - libavcodec - increment with one of each stored MB 139 | */ 140 | int filled_mv_blocks_num; 141 | 142 | /** Number of the the next free data block; one data block consists of 143 | 64 short values in the data_blocks array. 144 | All blocks before this one are already claimed by filling their number 145 | into the corresponding blocks description structure field, 146 | that are hold in mv_blocks array. 147 | - application - zeroes it on get_buffer(). 148 | A successful ff_draw_horiz_band() may zero it together 149 | with start_mb_blocks_num. 150 | - libavcodec - each decoded macroblock increases it by the number 151 | of coded blocks it contains. 152 | */ 153 | int next_free_data_block_num; 154 | 155 | /** extensions may be placed here */ 156 | #if LIBAVCODEC_VERSION_MAJOR < 53 157 | //@{ 158 | /** State flags used to work around limitations in the MPlayer video system. 159 | 0 - Surface is not used. 160 | 1 - Surface is still held in application to be displayed or is 161 | still visible. 162 | 2 - Surface is still held in libavcodec buffer for prediction. 163 | */ 164 | int state; 165 | 166 | /** pointer to the surface where the subpicture is rendered */ 167 | void* p_osd_target_surface_render; 168 | //}@ 169 | #endif 170 | }; 171 | 172 | #endif /* AVCODEC_XVMC_H */ 173 | -------------------------------------------------------------------------------- /ffmpeg/include/libavdevice/avdevice.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of FFmpeg. 3 | * 4 | * FFmpeg is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * FFmpeg is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with FFmpeg; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #ifndef AVDEVICE_AVDEVICE_H 20 | #define AVDEVICE_AVDEVICE_H 21 | 22 | #define LIBAVDEVICE_VERSION_MAJOR 52 23 | #define LIBAVDEVICE_VERSION_MINOR 1 24 | #define LIBAVDEVICE_VERSION_MICRO 0 25 | 26 | #define LIBAVDEVICE_VERSION_INT AV_VERSION_INT(LIBAVDEVICE_VERSION_MAJOR, \ 27 | LIBAVDEVICE_VERSION_MINOR, \ 28 | LIBAVDEVICE_VERSION_MICRO) 29 | #define LIBAVDEVICE_VERSION AV_VERSION(LIBAVDEVICE_VERSION_MAJOR, \ 30 | LIBAVDEVICE_VERSION_MINOR, \ 31 | LIBAVDEVICE_VERSION_MICRO) 32 | #define LIBAVDEVICE_BUILD LIBAVDEVICE_VERSION_INT 33 | 34 | /** 35 | * Returns the LIBAVDEVICE_VERSION_INT constant. 36 | */ 37 | unsigned avdevice_version(void); 38 | 39 | /** 40 | * Initialize libavdevice and register all the input and output devices. 41 | * @warning This function is not thread safe. 42 | */ 43 | void avdevice_register_all(void); 44 | 45 | #endif /* AVDEVICE_AVDEVICE_H */ 46 | 47 | -------------------------------------------------------------------------------- /ffmpeg/include/libavutil/adler32.h: -------------------------------------------------------------------------------- 1 | /* 2 | * copyright (c) 2006 Mans Rullgard 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVUTIL_ADLER32_H 22 | #define AVUTIL_ADLER32_H 23 | 24 | #include 25 | #include "common.h" 26 | 27 | unsigned long av_adler32_update(unsigned long adler, const uint8_t *buf, 28 | unsigned int len) av_pure; 29 | 30 | #endif /* AVUTIL_ADLER32_H */ 31 | -------------------------------------------------------------------------------- /ffmpeg/include/libavutil/avstring.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2007 Mans Rullgard 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVUTIL_AVSTRING_H 22 | #define AVUTIL_AVSTRING_H 23 | 24 | #include 25 | 26 | /** 27 | * Return non-zero if pfx is a prefix of str. If it is, *ptr is set to 28 | * the address of the first character in str after the prefix. 29 | * 30 | * @param str input string 31 | * @param pfx prefix to test 32 | * @param ptr updated if the prefix is matched inside str 33 | * @return non-zero if the prefix matches, zero otherwise 34 | */ 35 | int av_strstart(const char *str, const char *pfx, const char **ptr); 36 | 37 | /** 38 | * Return non-zero if pfx is a prefix of str independent of case. If 39 | * it is, *ptr is set to the address of the first character in str 40 | * after the prefix. 41 | * 42 | * @param str input string 43 | * @param pfx prefix to test 44 | * @param ptr updated if the prefix is matched inside str 45 | * @return non-zero if the prefix matches, zero otherwise 46 | */ 47 | int av_stristart(const char *str, const char *pfx, const char **ptr); 48 | 49 | /** 50 | * Copy the string src to dst, but no more than size - 1 bytes, and 51 | * null-terminate dst. 52 | * 53 | * This function is the same as BSD strlcpy(). 54 | * 55 | * @param dst destination buffer 56 | * @param src source string 57 | * @param size size of destination buffer 58 | * @return the length of src 59 | */ 60 | size_t av_strlcpy(char *dst, const char *src, size_t size); 61 | 62 | /** 63 | * Append the string src to the string dst, but to a total length of 64 | * no more than size - 1 bytes, and null-terminate dst. 65 | * 66 | * This function is similar to BSD strlcat(), but differs when 67 | * size <= strlen(dst). 68 | * 69 | * @param dst destination buffer 70 | * @param src source string 71 | * @param size size of destination buffer 72 | * @return the total length of src and dst 73 | */ 74 | size_t av_strlcat(char *dst, const char *src, size_t size); 75 | 76 | /** 77 | * Append output to a string, according to a format. Never write out of 78 | * the destination buffer, and and always put a terminating 0 within 79 | * the buffer. 80 | * @param dst destination buffer (string to which the output is 81 | * appended) 82 | * @param size total size of the destination buffer 83 | * @param fmt printf-compatible format string, specifying how the 84 | * following parameters are used 85 | * @return the length of the string that would have been generated 86 | * if enough space had been available 87 | */ 88 | size_t av_strlcatf(char *dst, size_t size, const char *fmt, ...); 89 | 90 | #endif /* AVUTIL_AVSTRING_H */ 91 | -------------------------------------------------------------------------------- /ffmpeg/include/libavutil/avutil.h: -------------------------------------------------------------------------------- 1 | /* 2 | * copyright (c) 2006 Michael Niedermayer 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVUTIL_AVUTIL_H 22 | #define AVUTIL_AVUTIL_H 23 | 24 | /** 25 | * @file libavutil/avutil.h 26 | * external API header 27 | */ 28 | 29 | 30 | #define AV_STRINGIFY(s) AV_TOSTRING(s) 31 | #define AV_TOSTRING(s) #s 32 | 33 | #define AV_VERSION_INT(a, b, c) (a<<16 | b<<8 | c) 34 | #define AV_VERSION_DOT(a, b, c) a ##.## b ##.## c 35 | #define AV_VERSION(a, b, c) AV_VERSION_DOT(a, b, c) 36 | 37 | #define LIBAVUTIL_VERSION_MAJOR 49 38 | #define LIBAVUTIL_VERSION_MINOR 15 39 | #define LIBAVUTIL_VERSION_MICRO 0 40 | 41 | #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ 42 | LIBAVUTIL_VERSION_MINOR, \ 43 | LIBAVUTIL_VERSION_MICRO) 44 | #define LIBAVUTIL_VERSION AV_VERSION(LIBAVUTIL_VERSION_MAJOR, \ 45 | LIBAVUTIL_VERSION_MINOR, \ 46 | LIBAVUTIL_VERSION_MICRO) 47 | #define LIBAVUTIL_BUILD LIBAVUTIL_VERSION_INT 48 | 49 | #define LIBAVUTIL_IDENT "Lavu" AV_STRINGIFY(LIBAVUTIL_VERSION) 50 | 51 | /** 52 | * Returns the LIBAVUTIL_VERSION_INT constant. 53 | */ 54 | unsigned avutil_version(void); 55 | 56 | #include "common.h" 57 | #include "mathematics.h" 58 | #include "rational.h" 59 | #include "intfloat_readwrite.h" 60 | #include "log.h" 61 | #include "pixfmt.h" 62 | 63 | #endif /* AVUTIL_AVUTIL_H */ 64 | -------------------------------------------------------------------------------- /ffmpeg/include/libavutil/base64.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2006 Ryan Martell. (rdm4@martellventures.com) 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVUTIL_BASE64_H 22 | #define AVUTIL_BASE64_H 23 | 24 | #include 25 | 26 | /** 27 | * Decodes the base64-encoded string in \p in and puts the decoded 28 | * data in \p out. 29 | * 30 | * @param out_size size in bytes of the \p out buffer, it should be at 31 | * least 3/4 of the length of \p in 32 | * @return the number of bytes written, or a negative value in case of 33 | * error 34 | */ 35 | int av_base64_decode(uint8_t *out, const char *in, int out_size); 36 | 37 | /** 38 | * Encodes in base64 the data in \p in and puts the resulting string 39 | * in \p out. 40 | * 41 | * @param out_size size in bytes of the \p out string, it should be at 42 | * least ((\p in_size + 2) / 3) * 4 + 1 43 | * @param in_size size in bytes of the \p in buffer 44 | * @return the string containing the encoded data, or NULL in case of 45 | * error 46 | */ 47 | char *av_base64_encode(char *out, int out_size, const uint8_t *in, int in_size); 48 | 49 | #endif /* AVUTIL_BASE64_H */ 50 | -------------------------------------------------------------------------------- /ffmpeg/include/libavutil/crc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * copyright (c) 2006 Michael Niedermayer 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVUTIL_CRC_H 22 | #define AVUTIL_CRC_H 23 | 24 | #include 25 | #include 26 | #include "common.h" 27 | 28 | typedef uint32_t AVCRC; 29 | 30 | typedef enum { 31 | AV_CRC_8_ATM, 32 | AV_CRC_16_ANSI, 33 | AV_CRC_16_CCITT, 34 | AV_CRC_32_IEEE, 35 | AV_CRC_32_IEEE_LE, /*< reversed bitorder version of AV_CRC_32_IEEE */ 36 | AV_CRC_MAX, /*< Not part of public API! Do not use outside libavutil. */ 37 | }AVCRCId; 38 | 39 | int av_crc_init(AVCRC *ctx, int le, int bits, uint32_t poly, int ctx_size); 40 | const AVCRC *av_crc_get_table(AVCRCId crc_id); 41 | uint32_t av_crc(const AVCRC *ctx, uint32_t start_crc, const uint8_t *buffer, size_t length) av_pure; 42 | 43 | #endif /* AVUTIL_CRC_H */ 44 | 45 | -------------------------------------------------------------------------------- /ffmpeg/include/libavutil/fifo.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of FFmpeg. 3 | * 4 | * FFmpeg is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * FFmpeg is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with FFmpeg; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | /** 20 | * @file libavutil/fifo.h 21 | * a very simple circular buffer FIFO implementation 22 | */ 23 | 24 | #ifndef AVUTIL_FIFO_H 25 | #define AVUTIL_FIFO_H 26 | 27 | #include 28 | #include "avutil.h" 29 | #include "common.h" 30 | 31 | typedef struct AVFifoBuffer { 32 | uint8_t *buffer; 33 | uint8_t *rptr, *wptr, *end; 34 | } AVFifoBuffer; 35 | 36 | /** 37 | * Initializes an AVFifoBuffer. 38 | * @param *f AVFifoBuffer to initialize 39 | * @param size of FIFO 40 | * @return <0 for failure >=0 otherwise 41 | */ 42 | int av_fifo_init(AVFifoBuffer *f, unsigned int size); 43 | 44 | /** 45 | * Frees an AVFifoBuffer. 46 | * @param *f AVFifoBuffer to free 47 | */ 48 | void av_fifo_free(AVFifoBuffer *f); 49 | 50 | /** 51 | * Returns the amount of data in bytes in the AVFifoBuffer, that is the 52 | * amount of data you can read from it. 53 | * @param *f AVFifoBuffer to read from 54 | * @return size 55 | */ 56 | int av_fifo_size(AVFifoBuffer *f); 57 | 58 | /** 59 | * Reads data from an AVFifoBuffer. 60 | * @param *f AVFifoBuffer to read from 61 | * @param *buf data destination 62 | * @param buf_size number of bytes to read 63 | */ 64 | int av_fifo_read(AVFifoBuffer *f, uint8_t *buf, int buf_size); 65 | 66 | /** 67 | * Feeds data from an AVFifoBuffer to a user-supplied callback. 68 | * @param *f AVFifoBuffer to read from 69 | * @param buf_size number of bytes to read 70 | * @param *func generic read function 71 | * @param *dest data destination 72 | */ 73 | int av_fifo_generic_read(AVFifoBuffer *f, int buf_size, void (*func)(void*, void*, int), void* dest); 74 | 75 | #if LIBAVUTIL_VERSION_MAJOR < 50 76 | /** 77 | * Writes data into an AVFifoBuffer. 78 | * @param *f AVFifoBuffer to write to 79 | * @param *buf data source 80 | * @param size data size 81 | */ 82 | attribute_deprecated void av_fifo_write(AVFifoBuffer *f, const uint8_t *buf, int size); 83 | #endif 84 | 85 | /** 86 | * Feeds data from a user-supplied callback to an AVFifoBuffer. 87 | * @param *f AVFifoBuffer to write to 88 | * @param *src data source 89 | * @param size number of bytes to write 90 | * @param *func generic write function; the first parameter is src, 91 | * the second is dest_buf, the third is dest_buf_size. 92 | * func must return the number of bytes written to dest_buf, or <= 0 to 93 | * indicate no more data available to write. 94 | * If func is NULL, src is interpreted as a simple byte array for source data. 95 | * @return the number of bytes written to the FIFO 96 | */ 97 | int av_fifo_generic_write(AVFifoBuffer *f, void *src, int size, int (*func)(void*, void*, int)); 98 | 99 | #if LIBAVUTIL_VERSION_MAJOR < 50 100 | /** 101 | * Resizes an AVFifoBuffer. 102 | * @param *f AVFifoBuffer to resize 103 | * @param size new AVFifoBuffer size in bytes 104 | * @see av_fifo_realloc2() 105 | */ 106 | attribute_deprecated void av_fifo_realloc(AVFifoBuffer *f, unsigned int size); 107 | #endif 108 | 109 | /** 110 | * Resizes an AVFifoBuffer. 111 | * @param *f AVFifoBuffer to resize 112 | * @param size new AVFifoBuffer size in bytes 113 | * @return <0 for failure, >=0 otherwise 114 | */ 115 | int av_fifo_realloc2(AVFifoBuffer *f, unsigned int size); 116 | 117 | /** 118 | * Reads and discards the specified amount of data from an AVFifoBuffer. 119 | * @param *f AVFifoBuffer to read from 120 | * @param size amount of data to read in bytes 121 | */ 122 | void av_fifo_drain(AVFifoBuffer *f, int size); 123 | 124 | static inline uint8_t av_fifo_peek(AVFifoBuffer *f, int offs) 125 | { 126 | uint8_t *ptr = f->rptr + offs; 127 | if (ptr >= f->end) 128 | ptr -= f->end - f->buffer; 129 | return *ptr; 130 | } 131 | #endif /* AVUTIL_FIFO_H */ 132 | -------------------------------------------------------------------------------- /ffmpeg/include/libavutil/intfloat_readwrite.h: -------------------------------------------------------------------------------- 1 | /* 2 | * copyright (c) 2005 Michael Niedermayer 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVUTIL_INTFLOAT_READWRITE_H 22 | #define AVUTIL_INTFLOAT_READWRITE_H 23 | 24 | #include 25 | #include "common.h" 26 | 27 | /* IEEE 80 bits extended float */ 28 | typedef struct AVExtFloat { 29 | uint8_t exponent[2]; 30 | uint8_t mantissa[8]; 31 | } AVExtFloat; 32 | 33 | double av_int2dbl(int64_t v) av_const; 34 | float av_int2flt(int32_t v) av_const; 35 | double av_ext2dbl(const AVExtFloat ext) av_const; 36 | int64_t av_dbl2int(double d) av_const; 37 | int32_t av_flt2int(float d) av_const; 38 | AVExtFloat av_dbl2ext(double d) av_const; 39 | 40 | #endif /* AVUTIL_INTFLOAT_READWRITE_H */ 41 | -------------------------------------------------------------------------------- /ffmpeg/include/libavutil/log.h: -------------------------------------------------------------------------------- 1 | /* 2 | * copyright (c) 2006 Michael Niedermayer 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVUTIL_LOG_H 22 | #define AVUTIL_LOG_H 23 | 24 | #include 25 | #include "avutil.h" 26 | 27 | /** 28 | * Describes the class of an AVClass context structure. That is an 29 | * arbitrary struct of which the first field is a pointer to an 30 | * AVClass struct (e.g. AVCodecContext, AVFormatContext etc.). 31 | */ 32 | typedef struct AVCLASS AVClass; 33 | struct AVCLASS { 34 | /** 35 | * The name of the class; usually it is the same name as the 36 | * context structure type to which the AVClass is associated. 37 | */ 38 | const char* class_name; 39 | 40 | /** 41 | * A pointer to a function which returns the name of a context 42 | * instance \p ctx associated with the class. 43 | */ 44 | const char* (*item_name)(void* ctx); 45 | 46 | /** 47 | * a pointer to the first option specified in the class if any or NULL 48 | * 49 | * @see av_set_default_options() 50 | */ 51 | const struct AVOption *option; 52 | }; 53 | 54 | /* av_log API */ 55 | 56 | #if LIBAVUTIL_VERSION_INT < (50<<16) 57 | #define AV_LOG_QUIET -1 58 | #define AV_LOG_FATAL 0 59 | #define AV_LOG_ERROR 0 60 | #define AV_LOG_WARNING 1 61 | #define AV_LOG_INFO 1 62 | #define AV_LOG_VERBOSE 1 63 | #define AV_LOG_DEBUG 2 64 | #else 65 | #define AV_LOG_QUIET -8 66 | 67 | /** 68 | * Something went really wrong and we will crash now. 69 | */ 70 | #define AV_LOG_PANIC 0 71 | 72 | /** 73 | * Something went wrong and recovery is not possible. 74 | * For example, no header was found for a format which depends 75 | * on headers or an illegal combination of parameters is used. 76 | */ 77 | #define AV_LOG_FATAL 8 78 | 79 | /** 80 | * Something went wrong and cannot losslessly be recovered. 81 | * However, not all future data is affected. 82 | */ 83 | #define AV_LOG_ERROR 16 84 | 85 | /** 86 | * Something somehow does not look correct. This may or may not 87 | * lead to problems. An example would be the use of '-vstrict -2'. 88 | */ 89 | #define AV_LOG_WARNING 24 90 | 91 | #define AV_LOG_INFO 32 92 | #define AV_LOG_VERBOSE 40 93 | 94 | /** 95 | * Stuff which is only useful for libav* developers. 96 | */ 97 | #define AV_LOG_DEBUG 48 98 | #endif 99 | 100 | #if LIBAVUTIL_VERSION_INT < (50<<16) 101 | extern int av_log_level; 102 | #endif 103 | 104 | /** 105 | * Sends the specified message to the log if the level is less than or equal 106 | * to the current av_log_level. By default, all logging messages are sent to 107 | * stderr. This behavior can be altered by setting a different av_vlog callback 108 | * function. 109 | * 110 | * @param avcl A pointer to an arbitrary struct of which the first field is a 111 | * pointer to an AVClass struct. 112 | * @param level The importance level of the message, lower values signifying 113 | * higher importance. 114 | * @param fmt The format string (printf-compatible) that specifies how 115 | * subsequent arguments are converted to output. 116 | * @see av_vlog 117 | */ 118 | #ifdef __GNUC__ 119 | void av_log(void*, int level, const char *fmt, ...) __attribute__ ((__format__ (__printf__, 3, 4))); 120 | #else 121 | void av_log(void*, int level, const char *fmt, ...); 122 | #endif 123 | 124 | void av_vlog(void*, int level, const char *fmt, va_list); 125 | int av_log_get_level(void); 126 | void av_log_set_level(int); 127 | void av_log_set_callback(void (*)(void*, int, const char*, va_list)); 128 | void av_log_default_callback(void* ptr, int level, const char* fmt, va_list vl); 129 | 130 | #endif /* AVUTIL_LOG_H */ 131 | -------------------------------------------------------------------------------- /ffmpeg/include/libavutil/lzo.h: -------------------------------------------------------------------------------- 1 | /* 2 | * LZO 1x decompression 3 | * copyright (c) 2006 Reimar Doeffinger 4 | * 5 | * This file is part of FFmpeg. 6 | * 7 | * FFmpeg is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * FFmpeg is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with FFmpeg; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | #ifndef AVUTIL_LZO_H 23 | #define AVUTIL_LZO_H 24 | 25 | #include 26 | 27 | /** \defgroup errflags Error flags returned by av_lzo1x_decode 28 | * \{ */ 29 | //! end of the input buffer reached before decoding finished 30 | #define AV_LZO_INPUT_DEPLETED 1 31 | //! decoded data did not fit into output buffer 32 | #define AV_LZO_OUTPUT_FULL 2 33 | //! a reference to previously decoded data was wrong 34 | #define AV_LZO_INVALID_BACKPTR 4 35 | //! a non-specific error in the compressed bitstream 36 | #define AV_LZO_ERROR 8 37 | /** \} */ 38 | 39 | #define AV_LZO_INPUT_PADDING 8 40 | #define AV_LZO_OUTPUT_PADDING 12 41 | 42 | /** 43 | * \brief Decodes LZO 1x compressed data. 44 | * \param out output buffer 45 | * \param outlen size of output buffer, number of bytes left are returned here 46 | * \param in input buffer 47 | * \param inlen size of input buffer, number of bytes left are returned here 48 | * \return 0 on success, otherwise a combination of the error flags above 49 | * 50 | * Make sure all buffers are appropriately padded, in must provide 51 | * AV_LZO_INPUT_PADDING, out must provide AV_LZO_OUTPUT_PADDING additional bytes. 52 | */ 53 | int av_lzo1x_decode(void *out, int *outlen, const void *in, int *inlen); 54 | 55 | /** 56 | * \brief deliberately overlapping memcpy implementation 57 | * \param dst destination buffer; must be padded with 12 additional bytes 58 | * \param back how many bytes back we start (the initial size of the overlapping window) 59 | * \param cnt number of bytes to copy, must be >= 0 60 | * 61 | * cnt > back is valid, this will copy the bytes we just copied, 62 | * thus creating a repeating pattern with a period length of back. 63 | */ 64 | void av_memcpy_backptr(uint8_t *dst, int back, int cnt); 65 | 66 | #endif /* AVUTIL_LZO_H */ 67 | -------------------------------------------------------------------------------- /ffmpeg/include/libavutil/mathematics.h: -------------------------------------------------------------------------------- 1 | /* 2 | * copyright (c) 2005 Michael Niedermayer 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVUTIL_MATHEMATICS_H 22 | #define AVUTIL_MATHEMATICS_H 23 | 24 | #include 25 | #include 26 | #include "common.h" 27 | #include "rational.h" 28 | 29 | #ifndef M_E 30 | #define M_E 2.7182818284590452354 /* e */ 31 | #endif 32 | #ifndef M_LN2 33 | #define M_LN2 0.69314718055994530942 /* log_e 2 */ 34 | #endif 35 | #ifndef M_LN10 36 | #define M_LN10 2.30258509299404568402 /* log_e 10 */ 37 | #endif 38 | #ifndef M_PI 39 | #define M_PI 3.14159265358979323846 /* pi */ 40 | #endif 41 | #ifndef M_SQRT1_2 42 | #define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */ 43 | #endif 44 | 45 | enum AVRounding { 46 | AV_ROUND_ZERO = 0, ///< Round toward zero. 47 | AV_ROUND_INF = 1, ///< Round away from zero. 48 | AV_ROUND_DOWN = 2, ///< Round toward -infinity. 49 | AV_ROUND_UP = 3, ///< Round toward +infinity. 50 | AV_ROUND_NEAR_INF = 5, ///< Round to nearest and halfway cases away from zero. 51 | }; 52 | 53 | int64_t av_const av_gcd(int64_t a, int64_t b); 54 | 55 | /** 56 | * Rescales a 64-bit integer with rounding to nearest. 57 | * A simple a*b/c isn't possible as it can overflow. 58 | */ 59 | int64_t av_rescale(int64_t a, int64_t b, int64_t c) av_const; 60 | 61 | /** 62 | * Rescales a 64-bit integer with specified rounding. 63 | * A simple a*b/c isn't possible as it can overflow. 64 | */ 65 | int64_t av_rescale_rnd(int64_t a, int64_t b, int64_t c, enum AVRounding) av_const; 66 | 67 | /** 68 | * Rescales a 64-bit integer by 2 rational numbers. 69 | */ 70 | int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq) av_const; 71 | 72 | #endif /* AVUTIL_MATHEMATICS_H */ 73 | -------------------------------------------------------------------------------- /ffmpeg/include/libavutil/md5.h: -------------------------------------------------------------------------------- 1 | /* 2 | * copyright (c) 2006 Michael Niedermayer 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVUTIL_MD5_H 22 | #define AVUTIL_MD5_H 23 | 24 | #include 25 | 26 | extern const int av_md5_size; 27 | 28 | struct AVMD5; 29 | 30 | void av_md5_init(struct AVMD5 *ctx); 31 | void av_md5_update(struct AVMD5 *ctx, const uint8_t *src, const int len); 32 | void av_md5_final(struct AVMD5 *ctx, uint8_t *dst); 33 | void av_md5_sum(uint8_t *dst, const uint8_t *src, const int len); 34 | 35 | #endif /* AVUTIL_MD5_H */ 36 | 37 | -------------------------------------------------------------------------------- /ffmpeg/include/libavutil/mem.h: -------------------------------------------------------------------------------- 1 | /* 2 | * copyright (c) 2006 Michael Niedermayer 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | /** 22 | * @file libavutil/mem.h 23 | * memory handling functions 24 | */ 25 | 26 | #ifndef AVUTIL_MEM_H 27 | #define AVUTIL_MEM_H 28 | 29 | #include "common.h" 30 | 31 | #if AV_GCC_VERSION_AT_LEAST(3,1) 32 | #define av_malloc_attrib __attribute__((__malloc__)) 33 | #else 34 | #define av_malloc_attrib 35 | #endif 36 | 37 | #if (!defined(__ICC) || __ICC > 1100) && AV_GCC_VERSION_AT_LEAST(4,3) 38 | #define av_alloc_size(n) __attribute__((alloc_size(n))) 39 | #else 40 | #define av_alloc_size(n) 41 | #endif 42 | 43 | /** 44 | * Allocates a block of \p size bytes with alignment suitable for all 45 | * memory accesses (including vectors if available on the CPU). 46 | * @param size Size in bytes for the memory block to be allocated. 47 | * @return Pointer to the allocated block, NULL if the block cannot 48 | * be allocated. 49 | * @see av_mallocz() 50 | */ 51 | void *av_malloc(unsigned int size) av_malloc_attrib av_alloc_size(1); 52 | 53 | /** 54 | * Allocates or reallocates a block of memory. 55 | * If \p ptr is NULL and \p size > 0, allocates a new block. If \p 56 | * size is zero, frees the memory block pointed to by \p ptr. 57 | * @param size Size in bytes for the memory block to be allocated or 58 | * reallocated. 59 | * @param ptr Pointer to a memory block already allocated with 60 | * av_malloc(z)() or av_realloc() or NULL. 61 | * @return Pointer to a newly reallocated block or NULL if the block 62 | * cannot be reallocated or the function is used to free the memory block. 63 | * @see av_fast_realloc() 64 | */ 65 | void *av_realloc(void *ptr, unsigned int size) av_alloc_size(2); 66 | 67 | /** 68 | * Frees a memory block which has been allocated with av_malloc(z)() or 69 | * av_realloc(). 70 | * @param ptr Pointer to the memory block which should be freed. 71 | * @note ptr = NULL is explicitly allowed. 72 | * @note It is recommended that you use av_freep() instead. 73 | * @see av_freep() 74 | */ 75 | void av_free(void *ptr); 76 | 77 | /** 78 | * Allocates a block of \p size bytes with alignment suitable for all 79 | * memory accesses (including vectors if available on the CPU) and 80 | * zeroes all the bytes of the block. 81 | * @param size Size in bytes for the memory block to be allocated. 82 | * @return Pointer to the allocated block, NULL if it cannot be allocated. 83 | * @see av_malloc() 84 | */ 85 | void *av_mallocz(unsigned int size) av_malloc_attrib av_alloc_size(1); 86 | 87 | /** 88 | * Duplicates the string \p s. 89 | * @param s string to be duplicated 90 | * @return Pointer to a newly allocated string containing a 91 | * copy of \p s or NULL if the string cannot be allocated. 92 | */ 93 | char *av_strdup(const char *s) av_malloc_attrib; 94 | 95 | /** 96 | * Frees a memory block which has been allocated with av_malloc(z)() or 97 | * av_realloc() and set the pointer pointing to it to NULL. 98 | * @param ptr Pointer to the pointer to the memory block which should 99 | * be freed. 100 | * @see av_free() 101 | */ 102 | void av_freep(void *ptr); 103 | 104 | #endif /* AVUTIL_MEM_H */ 105 | -------------------------------------------------------------------------------- /ffmpeg/include/libavutil/pixfmt.h: -------------------------------------------------------------------------------- 1 | /* 2 | * copyright (c) 2006 Michael Niedermayer 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVUTIL_PIXFMT_H 22 | #define AVUTIL_PIXFMT_H 23 | 24 | /** 25 | * @file libavutil/pixfmt.h 26 | * pixel format definitions 27 | * 28 | * @warning This file has to be considered an internal but installed 29 | * header, so it should not be directly included in your projects. 30 | */ 31 | 32 | /** 33 | * Pixel format. Notes: 34 | * 35 | * PIX_FMT_RGB32 is handled in an endian-specific manner. An RGBA 36 | * color is put together as: 37 | * (A << 24) | (R << 16) | (G << 8) | B 38 | * This is stored as BGRA on little-endian CPU architectures and ARGB on 39 | * big-endian CPUs. 40 | * 41 | * When the pixel format is palettized RGB (PIX_FMT_PAL8), the palettized 42 | * image data is stored in AVFrame.data[0]. The palette is transported in 43 | * AVFrame.data[1], is 1024 bytes long (256 4-byte entries) and is 44 | * formatted the same as in PIX_FMT_RGB32 described above (i.e., it is 45 | * also endian-specific). Note also that the individual RGB palette 46 | * components stored in AVFrame.data[1] should be in the range 0..255. 47 | * This is important as many custom PAL8 video codecs that were designed 48 | * to run on the IBM VGA graphics adapter use 6-bit palette components. 49 | * 50 | * For all the 8bit per pixel formats, an RGB32 palette is in data[1] like 51 | * for pal8. This palette is filled in automatically by the function 52 | * allocating the picture. 53 | * 54 | * Note, make sure that all newly added big endian formats have pix_fmt&1==1 55 | * and that all newly added little endian formats have pix_fmt&1==0 56 | * this allows simpler detection of big vs little endian. 57 | */ 58 | enum PixelFormat { 59 | PIX_FMT_NONE= -1, 60 | PIX_FMT_YUV420P, ///< planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples) 61 | PIX_FMT_YUYV422, ///< packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr 62 | PIX_FMT_RGB24, ///< packed RGB 8:8:8, 24bpp, RGBRGB... 63 | PIX_FMT_BGR24, ///< packed RGB 8:8:8, 24bpp, BGRBGR... 64 | PIX_FMT_YUV422P, ///< planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples) 65 | PIX_FMT_YUV444P, ///< planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples) 66 | PIX_FMT_RGB32, ///< packed RGB 8:8:8, 32bpp, (msb)8A 8R 8G 8B(lsb), in CPU endianness 67 | PIX_FMT_YUV410P, ///< planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples) 68 | PIX_FMT_YUV411P, ///< planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) 69 | PIX_FMT_RGB565, ///< packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), in CPU endianness 70 | PIX_FMT_RGB555, ///< packed RGB 5:5:5, 16bpp, (msb)1A 5R 5G 5B(lsb), in CPU endianness, most significant bit to 0 71 | PIX_FMT_GRAY8, ///< Y , 8bpp 72 | PIX_FMT_MONOWHITE, ///< Y , 1bpp, 0 is white, 1 is black 73 | PIX_FMT_MONOBLACK, ///< Y , 1bpp, 0 is black, 1 is white 74 | PIX_FMT_PAL8, ///< 8 bit with PIX_FMT_RGB32 palette 75 | PIX_FMT_YUVJ420P, ///< planar YUV 4:2:0, 12bpp, full scale (JPEG) 76 | PIX_FMT_YUVJ422P, ///< planar YUV 4:2:2, 16bpp, full scale (JPEG) 77 | PIX_FMT_YUVJ444P, ///< planar YUV 4:4:4, 24bpp, full scale (JPEG) 78 | PIX_FMT_XVMC_MPEG2_MC,///< XVideo Motion Acceleration via common packet passing 79 | PIX_FMT_XVMC_MPEG2_IDCT, 80 | PIX_FMT_UYVY422, ///< packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1 81 | PIX_FMT_UYYVYY411, ///< packed YUV 4:1:1, 12bpp, Cb Y0 Y1 Cr Y2 Y3 82 | PIX_FMT_BGR32, ///< packed RGB 8:8:8, 32bpp, (msb)8A 8B 8G 8R(lsb), in CPU endianness 83 | PIX_FMT_BGR565, ///< packed RGB 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), in CPU endianness 84 | PIX_FMT_BGR555, ///< packed RGB 5:5:5, 16bpp, (msb)1A 5B 5G 5R(lsb), in CPU endianness, most significant bit to 1 85 | PIX_FMT_BGR8, ///< packed RGB 3:3:2, 8bpp, (msb)2B 3G 3R(lsb) 86 | PIX_FMT_BGR4, ///< packed RGB 1:2:1, 4bpp, (msb)1B 2G 1R(lsb) 87 | PIX_FMT_BGR4_BYTE, ///< packed RGB 1:2:1, 8bpp, (msb)1B 2G 1R(lsb) 88 | PIX_FMT_RGB8, ///< packed RGB 3:3:2, 8bpp, (msb)2R 3G 3B(lsb) 89 | PIX_FMT_RGB4, ///< packed RGB 1:2:1, 4bpp, (msb)1R 2G 1B(lsb) 90 | PIX_FMT_RGB4_BYTE, ///< packed RGB 1:2:1, 8bpp, (msb)1R 2G 1B(lsb) 91 | PIX_FMT_NV12, ///< planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 for UV 92 | PIX_FMT_NV21, ///< as above, but U and V bytes are swapped 93 | 94 | PIX_FMT_RGB32_1, ///< packed RGB 8:8:8, 32bpp, (msb)8R 8G 8B 8A(lsb), in CPU endianness 95 | PIX_FMT_BGR32_1, ///< packed RGB 8:8:8, 32bpp, (msb)8B 8G 8R 8A(lsb), in CPU endianness 96 | 97 | PIX_FMT_GRAY16BE, ///< Y , 16bpp, big-endian 98 | PIX_FMT_GRAY16LE, ///< Y , 16bpp, little-endian 99 | PIX_FMT_YUV440P, ///< planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples) 100 | PIX_FMT_YUVJ440P, ///< planar YUV 4:4:0 full scale (JPEG) 101 | PIX_FMT_YUVA420P, ///< planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples) 102 | PIX_FMT_VDPAU_H264,///< H.264 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers 103 | PIX_FMT_VDPAU_MPEG1,///< MPEG-1 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers 104 | PIX_FMT_VDPAU_MPEG2,///< MPEG-2 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers 105 | PIX_FMT_VDPAU_WMV3,///< WMV3 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers 106 | PIX_FMT_VDPAU_VC1, ///< VC-1 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers 107 | PIX_FMT_RGB48BE, ///< packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, big-endian 108 | PIX_FMT_RGB48LE, ///< packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, little-endian 109 | PIX_FMT_VAAPI_MOCO, ///< HW acceleration through VA API at motion compensation entry-point, Picture.data[0] contains a vaapi_render_state struct which contains macroblocks as well as various fields extracted from headers 110 | PIX_FMT_VAAPI_IDCT, ///< HW acceleration through VA API at IDCT entry-point, Picture.data[0] contains a vaapi_render_state struct which contains fields extracted from headers 111 | PIX_FMT_VAAPI_VLD, ///< HW decoding through VA API, Picture.data[0] contains a vaapi_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers 112 | PIX_FMT_NB, ///< number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of formats might differ between versions 113 | }; 114 | 115 | #ifdef WORDS_BIGENDIAN 116 | #define PIX_FMT_RGBA PIX_FMT_RGB32_1 117 | #define PIX_FMT_BGRA PIX_FMT_BGR32_1 118 | #define PIX_FMT_ARGB PIX_FMT_RGB32 119 | #define PIX_FMT_ABGR PIX_FMT_BGR32 120 | #define PIX_FMT_GRAY16 PIX_FMT_GRAY16BE 121 | #define PIX_FMT_RGB48 PIX_FMT_RGB48BE 122 | #else 123 | #define PIX_FMT_RGBA PIX_FMT_BGR32 124 | #define PIX_FMT_BGRA PIX_FMT_RGB32 125 | #define PIX_FMT_ARGB PIX_FMT_BGR32_1 126 | #define PIX_FMT_ABGR PIX_FMT_RGB32_1 127 | #define PIX_FMT_GRAY16 PIX_FMT_GRAY16LE 128 | #define PIX_FMT_RGB48 PIX_FMT_RGB48LE 129 | #endif 130 | 131 | #if LIBAVUTIL_VERSION_INT < (50<<16) 132 | #define PIX_FMT_UYVY411 PIX_FMT_UYYVYY411 133 | #define PIX_FMT_RGBA32 PIX_FMT_RGB32 134 | #define PIX_FMT_YUV422 PIX_FMT_YUYV422 135 | #endif 136 | 137 | #endif /* AVUTIL_PIXFMT_H */ 138 | -------------------------------------------------------------------------------- /ffmpeg/include/libavutil/random.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Mersenne Twister PRNG algorithm 3 | * Copyright (c) 2006 Ryan Martell 4 | * Based on a C program for MT19937, with initialization improved 2002/1/26. 5 | * Coded by Takuji Nishimura and Makoto Matsumoto. 6 | * 7 | * This file is part of FFmpeg. 8 | * 9 | * FFmpeg is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * FFmpeg is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU Lesser General Public 20 | * License along with FFmpeg; if not, write to the Free Software 21 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 22 | */ 23 | 24 | #ifndef AVUTIL_RANDOM_H 25 | #define AVUTIL_RANDOM_H 26 | 27 | #define AV_RANDOM_N 624 28 | 29 | #include "avutil.h" 30 | #include "common.h" 31 | 32 | typedef struct { 33 | unsigned int mt[AV_RANDOM_N]; ///< the array for the state vector 34 | int index; ///< Current untempered value we use as the base. 35 | } AVRandomState; 36 | 37 | 38 | #if LIBAVUTIL_VERSION_MAJOR < 50 39 | attribute_deprecated void av_init_random(unsigned int seed, AVRandomState *state); 40 | #endif 41 | void av_random_init(AVRandomState *state, unsigned int seed); ///< To be inlined, the struct must be visible. So it does not make sense to try and keep it opaque with malloc/free-like calls. 42 | void av_random_generate_untempered_numbers(AVRandomState *state); ///< Regenerate the untempered numbers (must be done every 624 iterations, or it will loop). 43 | 44 | /** 45 | * Generates a random number from the interval [0,0xffffffff]. 46 | * 47 | * Please do NOT use the Mersenne Twister, it is slow. Use the random number 48 | * generator from lfg.c/h or a simple LCG like state = state*1664525+1013904223. 49 | * If you still choose to use MT, expect that you will have to provide 50 | * some evidence that it makes a difference for the case where you use it. 51 | */ 52 | static inline unsigned int av_random(AVRandomState *state) 53 | { 54 | unsigned int y; 55 | 56 | // Regenerate the untempered numbers if we should... 57 | if (state->index >= AV_RANDOM_N) 58 | av_random_generate_untempered_numbers(state); 59 | 60 | // Grab one... 61 | y = state->mt[state->index++]; 62 | 63 | /* Now temper (Mersenne Twister coefficients). The coefficients for MT19937 are.. */ 64 | y ^= (y >> 11); 65 | y ^= (y << 7) & 0x9d2c5680; 66 | y ^= (y << 15) & 0xefc60000; 67 | y ^= (y >> 18); 68 | 69 | return y; 70 | } 71 | 72 | /** Returns a random number in the range [0-1] as double. */ 73 | static inline double av_random_real1(AVRandomState *state) 74 | { 75 | /* divided by 2^32-1 */ 76 | return av_random(state) * (1.0 / 4294967296.0); 77 | } 78 | 79 | #endif /* AVUTIL_RANDOM_H */ 80 | -------------------------------------------------------------------------------- /ffmpeg/include/libavutil/rational.h: -------------------------------------------------------------------------------- 1 | /* 2 | * rational numbers 3 | * Copyright (c) 2003 Michael Niedermayer 4 | * 5 | * This file is part of FFmpeg. 6 | * 7 | * FFmpeg is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * FFmpeg is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with FFmpeg; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | /** 23 | * @file libavutil/rational.h 24 | * rational numbers 25 | * @author Michael Niedermayer 26 | */ 27 | 28 | #ifndef AVUTIL_RATIONAL_H 29 | #define AVUTIL_RATIONAL_H 30 | 31 | #include 32 | #include "common.h" 33 | 34 | /** 35 | * rational number numerator/denominator 36 | */ 37 | typedef struct AVRational{ 38 | int num; ///< numerator 39 | int den; ///< denominator 40 | } AVRational; 41 | 42 | /** 43 | * Compares two rationals. 44 | * @param a first rational 45 | * @param b second rational 46 | * @return 0 if a==b, 1 if a>b and -1 if a>63)|1; 52 | else return 0; 53 | } 54 | 55 | /** 56 | * Converts rational to double. 57 | * @param a rational to convert 58 | * @return (double) a 59 | */ 60 | static inline double av_q2d(AVRational a){ 61 | return a.num / (double) a.den; 62 | } 63 | 64 | /** 65 | * Reduces a fraction. 66 | * This is useful for framerate calculations. 67 | * @param dst_num destination numerator 68 | * @param dst_den destination denominator 69 | * @param num source numerator 70 | * @param den source denominator 71 | * @param max the maximum allowed for dst_num & dst_den 72 | * @return 1 if exact, 0 otherwise 73 | */ 74 | int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max); 75 | 76 | /** 77 | * Multiplies two rationals. 78 | * @param b first rational 79 | * @param c second rational 80 | * @return b*c 81 | */ 82 | AVRational av_mul_q(AVRational b, AVRational c) av_const; 83 | 84 | /** 85 | * Divides one rational by another. 86 | * @param b first rational 87 | * @param c second rational 88 | * @return b/c 89 | */ 90 | AVRational av_div_q(AVRational b, AVRational c) av_const; 91 | 92 | /** 93 | * Adds two rationals. 94 | * @param b first rational 95 | * @param c second rational 96 | * @return b+c 97 | */ 98 | AVRational av_add_q(AVRational b, AVRational c) av_const; 99 | 100 | /** 101 | * Subtracts one rational from another. 102 | * @param b first rational 103 | * @param c second rational 104 | * @return b-c 105 | */ 106 | AVRational av_sub_q(AVRational b, AVRational c) av_const; 107 | 108 | /** 109 | * Converts a double precision floating point number to a rational. 110 | * @param d double to convert 111 | * @param max the maximum allowed numerator and denominator 112 | * @return (AVRational) d 113 | */ 114 | AVRational av_d2q(double d, int max) av_const; 115 | 116 | /** 117 | * @return 1 if \q1 is nearer to \p q than \p q2, -1 if \p q2 is nearer 118 | * than \p q1, 0 if they have the same distance. 119 | */ 120 | int av_nearer_q(AVRational q, AVRational q1, AVRational q2); 121 | 122 | /** 123 | * Finds the nearest value in \p q_list to \p q. 124 | * @param q_list an array of rationals terminated by {0, 0} 125 | * @return the index of the nearest value found in the array 126 | */ 127 | int av_find_nearest_q_idx(AVRational q, const AVRational* q_list); 128 | 129 | #endif /* AVUTIL_RATIONAL_H */ 130 | -------------------------------------------------------------------------------- /ffmpeg/include/libavutil/sha1.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 Michael Niedermayer 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVUTIL_SHA1_H 22 | #define AVUTIL_SHA1_H 23 | 24 | #include 25 | 26 | extern const int av_sha1_size; 27 | 28 | struct AVSHA1; 29 | 30 | void av_sha1_init(struct AVSHA1* context); 31 | void av_sha1_update(struct AVSHA1* context, const uint8_t* data, unsigned int len); 32 | void av_sha1_final(struct AVSHA1* context, uint8_t digest[20]); 33 | 34 | #endif /* AVUTIL_SHA1_H */ 35 | -------------------------------------------------------------------------------- /ffmpeg/include/libyasm-stdint.h: -------------------------------------------------------------------------------- 1 | #ifndef _YASM_LIBYASM_STDINT_H 2 | #define _YASM_LIBYASM_STDINT_H 1 3 | #ifndef _GENERATED_STDINT_H 4 | #define _GENERATED_STDINT_H "yasm 0.7.2" 5 | /* generated using arm-arago-linux-gnueabi-gcc -std=gnu99 */ 6 | #define _STDINT_HAVE_STDINT_H 1 7 | #include 8 | #endif 9 | #endif 10 | -------------------------------------------------------------------------------- /ffmpeg/include/libyasm.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file libyasm.h 3 | * \brief YASM library primary header file. 4 | * 5 | * \rcs 6 | * $Id: libyasm.h 1895 2007-07-14 05:31:08Z peter $ 7 | * \endrcs 8 | * 9 | * \license 10 | * Copyright (C) 2003-2007 Peter Johnson 11 | * 12 | * Redistribution and use in source and binary forms, with or without 13 | * modification, are permitted provided that the following conditions 14 | * are met: 15 | * - Redistributions of source code must retain the above copyright 16 | * notice, this list of conditions and the following disclaimer. 17 | * - Redistributions in binary form must reproduce the above copyright 18 | * notice, this list of conditions and the following disclaimer in the 19 | * documentation and/or other materials provided with the distribution. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND OTHER CONTRIBUTORS ``AS IS'' 22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR OTHER CONTRIBUTORS BE 25 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 | * POSSIBILITY OF SUCH DAMAGE. 32 | * \endlicense 33 | */ 34 | #ifndef YASM_LIB_H 35 | #define YASM_LIB_H 36 | 37 | #ifdef YASM_PYXELATOR 38 | typedef struct __FILE FILE; 39 | typedef struct __va_list va_list; 40 | typedef unsigned long size_t; 41 | typedef unsigned long uintptr_t; 42 | #else 43 | #include 44 | #include 45 | #include 46 | #endif 47 | 48 | #include 49 | 50 | #include 51 | #include 52 | 53 | #include 54 | 55 | #include 56 | #include 57 | #include 58 | #include 59 | #include 60 | #include 61 | 62 | #include 63 | #include 64 | #include 65 | 66 | #include 67 | #include 68 | #include 69 | #include 70 | #include 71 | #include 72 | 73 | #include 74 | #include 75 | 76 | #include 77 | #include 78 | 79 | #endif 80 | -------------------------------------------------------------------------------- /ffmpeg/include/libyasm/assocdat.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file assocdat.h 3 | * \brief YASM associated data storage (libyasm internal use) 4 | * 5 | * \rcs 6 | * $Id: assocdat.h 1827 2007-04-22 05:09:49Z peter $ 7 | * \endrcs 8 | * 9 | * \license 10 | * Copyright (C) 2003-2007 Peter Johnson 11 | * 12 | * Redistribution and use in source and binary forms, with or without 13 | * modification, are permitted provided that the following conditions 14 | * are met: 15 | * - Redistributions of source code must retain the above copyright 16 | * notice, this list of conditions and the following disclaimer. 17 | * - Redistributions in binary form must reproduce the above copyright 18 | * notice, this list of conditions and the following disclaimer in the 19 | * documentation and/or other materials provided with the distribution. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND OTHER CONTRIBUTORS ``AS IS'' 22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR OTHER CONTRIBUTORS BE 25 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 | * POSSIBILITY OF SUCH DAMAGE. 32 | * \endlicense 33 | */ 34 | #ifndef YASM_ASSOCDAT_H 35 | #define YASM_ASSOCDAT_H 36 | 37 | /** Associated data container. */ 38 | typedef struct yasm__assoc_data yasm__assoc_data; 39 | 40 | /** Create an associated data container. */ 41 | /*@only@*/ yasm__assoc_data *yasm__assoc_data_create(void); 42 | 43 | /** Get associated data for a data callback. 44 | * \param assoc_data container of associated data 45 | * \param callback callback used when adding data 46 | * \return Associated data (NULL if none). 47 | */ 48 | /*@dependent@*/ /*@null@*/ void *yasm__assoc_data_get 49 | (/*@null@*/ yasm__assoc_data *assoc_data, 50 | const yasm_assoc_data_callback *callback); 51 | 52 | /** Add associated data to a associated data container. 53 | * \attention Deletes any existing associated data for that data callback. 54 | * \param assoc_data container of associated data 55 | * \param callback callback 56 | * \param data data to associate 57 | */ 58 | /*@only@*/ yasm__assoc_data *yasm__assoc_data_add 59 | (/*@null@*/ /*@only@*/ yasm__assoc_data *assoc_data, 60 | const yasm_assoc_data_callback *callback, 61 | /*@only@*/ /*@null@*/ void *data); 62 | 63 | /** Destroy all associated data in a container. */ 64 | void yasm__assoc_data_destroy 65 | (/*@null@*/ /*@only@*/ yasm__assoc_data *assoc_data); 66 | 67 | /** Print all associated data in a container. */ 68 | void yasm__assoc_data_print(const yasm__assoc_data *assoc_data, FILE *f, 69 | int indent_level); 70 | 71 | #endif 72 | -------------------------------------------------------------------------------- /ffmpeg/include/libyasm/dbgfmt.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file libyasm/dbgfmt.h 3 | * \brief YASM debug format interface. 4 | * 5 | * \rcs 6 | * $Id: dbgfmt.h 1827 2007-04-22 05:09:49Z peter $ 7 | * \endrcs 8 | * 9 | * \license 10 | * Copyright (C) 2002-2007 Peter Johnson 11 | * 12 | * Redistribution and use in source and binary forms, with or without 13 | * modification, are permitted provided that the following conditions 14 | * are met: 15 | * - Redistributions of source code must retain the above copyright 16 | * notice, this list of conditions and the following disclaimer. 17 | * - Redistributions in binary form must reproduce the above copyright 18 | * notice, this list of conditions and the following disclaimer in the 19 | * documentation and/or other materials provided with the distribution. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND OTHER CONTRIBUTORS ``AS IS'' 22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR OTHER CONTRIBUTORS BE 25 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 | * POSSIBILITY OF SUCH DAMAGE. 32 | * \endlicense 33 | */ 34 | #ifndef YASM_DBGFMT_H 35 | #define YASM_DBGFMT_H 36 | 37 | #ifndef YASM_DOXYGEN 38 | /** Base #yasm_dbgfmt structure. Must be present as the first element in any 39 | * #yasm_dbgfmt implementation. 40 | */ 41 | typedef struct yasm_dbgfmt_base { 42 | /** #yasm_dbgfmt_module implementation for this debug format. */ 43 | const struct yasm_dbgfmt_module *module; 44 | } yasm_dbgfmt_base; 45 | #endif 46 | 47 | /** Debug format module interface. */ 48 | struct yasm_dbgfmt_module { 49 | /** One-line description of the debug format. */ 50 | const char *name; 51 | 52 | /** Keyword used to select debug format. */ 53 | const char *keyword; 54 | 55 | /** NULL-terminated list of directives. NULL if none. */ 56 | /*@null@*/ const yasm_directive *directives; 57 | 58 | /** Create debug format. 59 | * Module-level implementation of yasm_dbgfmt_create(). 60 | * The filenames are provided solely for informational purposes. 61 | * \param object object 62 | * \return NULL if object format does not provide needed support. 63 | */ 64 | /*@null@*/ /*@only@*/ yasm_dbgfmt * (*create) (yasm_object *object); 65 | 66 | /** Module-level implementation of yasm_dbgfmt_destroy(). 67 | * Call yasm_dbgfmt_destroy() instead of calling this function. 68 | */ 69 | void (*destroy) (/*@only@*/ yasm_dbgfmt *dbgfmt); 70 | 71 | /** Module-level implementation of yasm_dbgfmt_generate(). 72 | * Call yasm_dbgfmt_generate() instead of calling this function. 73 | */ 74 | void (*generate) (yasm_object *object, yasm_linemap *linemap, 75 | yasm_errwarns *errwarns); 76 | }; 77 | 78 | /** Get the keyword used to select a debug format. 79 | * \param dbgfmt debug format 80 | * \return keyword 81 | */ 82 | const char *yasm_dbgfmt_keyword(const yasm_dbgfmt *dbgfmt); 83 | 84 | /** Initialize debug output for use. Must call before any other debug 85 | * format functions. The filenames are provided solely for informational 86 | * purposes. 87 | * \param module debug format module 88 | * \param object object to generate debugging information for 89 | * \return NULL if object format does not provide needed support. 90 | */ 91 | /*@null@*/ /*@only@*/ yasm_dbgfmt *yasm_dbgfmt_create 92 | (const yasm_dbgfmt_module *module, yasm_object *object); 93 | 94 | /** Cleans up any allocated debug format memory. 95 | * \param dbgfmt debug format 96 | */ 97 | void yasm_dbgfmt_destroy(/*@only@*/ yasm_dbgfmt *dbgfmt); 98 | 99 | /** Generate debugging information bytecodes. 100 | * \param object object 101 | * \param linemap virtual/physical line mapping 102 | * \param errwarns error/warning set 103 | * \note Errors and warnings are stored into errwarns. 104 | */ 105 | void yasm_dbgfmt_generate(yasm_object *object, yasm_linemap *linemap, 106 | yasm_errwarns *errwarns); 107 | 108 | #ifndef YASM_DOXYGEN 109 | 110 | /* Inline macro implementations for dbgfmt functions */ 111 | 112 | #define yasm_dbgfmt_keyword(dbgfmt) \ 113 | (((yasm_dbgfmt_base *)dbgfmt)->module->keyword) 114 | 115 | #define yasm_dbgfmt_create(module, object) \ 116 | module->create(object) 117 | 118 | #define yasm_dbgfmt_destroy(dbgfmt) \ 119 | ((yasm_dbgfmt_base *)dbgfmt)->module->destroy(dbgfmt) 120 | #define yasm_dbgfmt_generate(object, linemap, ews) \ 121 | ((yasm_dbgfmt_base *)((object)->dbgfmt))->module->generate \ 122 | (object, linemap, ews) 123 | 124 | #endif 125 | 126 | #endif 127 | -------------------------------------------------------------------------------- /ffmpeg/include/libyasm/floatnum.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file libyasm/floatnum.h 3 | * \brief YASM floating point (IEEE) interface. 4 | * 5 | * \rcs 6 | * $Id: floatnum.h 1827 2007-04-22 05:09:49Z peter $ 7 | * \endrcs 8 | * 9 | * \license 10 | * Copyright (C) 2001-2007 Peter Johnson 11 | * 12 | * Based on public-domain x86 assembly code by Randall Hyde (8/28/91). 13 | * 14 | * Redistribution and use in source and binary forms, with or without 15 | * modification, are permitted provided that the following conditions 16 | * are met: 17 | * - Redistributions of source code must retain the above copyright 18 | * notice, this list of conditions and the following disclaimer. 19 | * - Redistributions in binary form must reproduce the above copyright 20 | * notice, this list of conditions and the following disclaimer in the 21 | * documentation and/or other materials provided with the distribution. 22 | * 23 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND OTHER CONTRIBUTORS ``AS IS'' 24 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 25 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR OTHER CONTRIBUTORS BE 27 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 28 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 29 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 30 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 31 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 32 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 33 | * POSSIBILITY OF SUCH DAMAGE. 34 | * \endlicense 35 | */ 36 | #ifndef YASM_FLOATNUM_H 37 | #define YASM_FLOATNUM_H 38 | 39 | /** Initialize floatnum internal data structures. */ 40 | void yasm_floatnum_initialize(void); 41 | 42 | /** Clean up internal floatnum allocations. */ 43 | void yasm_floatnum_cleanup(void); 44 | 45 | /** Create a new floatnum from a decimal string. The input string must be in 46 | * standard C representation ([+-]123.456e[-+]789). 47 | * \param str floating point decimal string 48 | * \return Newly allocated floatnum. 49 | */ 50 | /*@only@*/ yasm_floatnum *yasm_floatnum_create(const char *str); 51 | 52 | /** Duplicate a floatnum. 53 | * \param flt floatnum 54 | * \return Newly allocated floatnum with the same value as flt. 55 | */ 56 | /*@only@*/ yasm_floatnum *yasm_floatnum_copy(const yasm_floatnum *flt); 57 | 58 | /** Destroy (free allocated memory for) a floatnum. 59 | * \param flt floatnum 60 | */ 61 | void yasm_floatnum_destroy(/*@only@*/ yasm_floatnum *flt); 62 | 63 | /** Floating point calculation function: acc = acc op operand. 64 | * \note Not all operations in yasm_expr_op may be supported; unsupported 65 | * operations will result in an error. 66 | * \param acc floatnum accumulator 67 | * \param op operation 68 | * \param operand floatnum operand 69 | * \return Nonzero on error. 70 | */ 71 | int yasm_floatnum_calc(yasm_floatnum *acc, yasm_expr_op op, 72 | yasm_floatnum *operand); 73 | 74 | /** Convert a floatnum to single-precision and return as 32-bit value. 75 | * The 32-bit value is a "standard" C value (eg, of unknown endian). 76 | * \param flt floatnum 77 | * \param ret_val pointer to storage for 32-bit output 78 | * \return Nonzero if flt can't fit into single precision: -1 if underflow 79 | * occurred, 1 if overflow occurred. 80 | */ 81 | int yasm_floatnum_get_int(const yasm_floatnum *flt, 82 | /*@out@*/ unsigned long *ret_val); 83 | 84 | /** Output a #yasm_floatnum to buffer in little-endian or big-endian. Puts the 85 | * value into the least significant bits of the destination, or may be shifted 86 | * into more significant bits by the shift parameter. The destination bits are 87 | * cleared before being set. [0] should be the first byte output to the file. 88 | * \note Not all sizes are valid. Currently, only 32 (single-precision), 64 89 | * (double-precision), and 80 (extended-precision) are valid sizes. 90 | * Use yasm_floatnum_check_size() to check for supported sizes. 91 | * \param flt floatnum 92 | * \param ptr pointer to storage for size bytes of output 93 | * \param destsize destination size (in bytes) 94 | * \param valsize size (in bits) 95 | * \param shift left shift (in bits) 96 | * \param bigendian endianness (nonzero=big, zero=little) 97 | * \param warn enables standard overflow/underflow warnings 98 | * \return Nonzero if flt can't fit into the specified precision: -1 if 99 | * underflow occurred, 1 if overflow occurred. 100 | */ 101 | int yasm_floatnum_get_sized(const yasm_floatnum *flt, unsigned char *ptr, 102 | size_t destsize, size_t valsize, size_t shift, 103 | int bigendian, int warn); 104 | 105 | /** Basic check to see if size is valid for flt conversion (using 106 | * yasm_floatnum_get_sized()). Doesn't actually check for underflow/overflow 107 | * but rather checks for size=32,64,80 108 | * (at present). 109 | * \param flt floatnum 110 | * \param size number of bits of output space 111 | * \return 1 if valid size, 0 if invalid size. 112 | */ 113 | int yasm_floatnum_check_size(const yasm_floatnum *flt, size_t size); 114 | 115 | /** Print various representations of a floatnum. For debugging purposes only. 116 | * \param f file 117 | * \param flt floatnum 118 | */ 119 | void yasm_floatnum_print(const yasm_floatnum *flt, FILE *f); 120 | 121 | #endif 122 | -------------------------------------------------------------------------------- /ffmpeg/include/libyasm/hamt.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file libyasm/hamt.h 3 | * \brief Hash Array Mapped Trie (HAMT) functions. 4 | * 5 | * \rcs 6 | * $Id: hamt.h 1827 2007-04-22 05:09:49Z peter $ 7 | * \endrcs 8 | * 9 | * \license 10 | * Copyright (C) 2001-2007 Peter Johnson 11 | * 12 | * Redistribution and use in source and binary forms, with or without 13 | * modification, are permitted provided that the following conditions 14 | * are met: 15 | * 1. Redistributions of source code must retain the above copyright 16 | * notice, this list of conditions and the following disclaimer. 17 | * 2. Redistributions in binary form must reproduce the above copyright 18 | * notice, this list of conditions and the following disclaimer in the 19 | * documentation and/or other materials provided with the distribution. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND OTHER CONTRIBUTORS ``AS IS'' 22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR OTHER CONTRIBUTORS BE 25 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 | * POSSIBILITY OF SUCH DAMAGE. 32 | * \endlicense 33 | */ 34 | #ifndef YASM_HAMT_H 35 | #define YASM_HAMT_H 36 | 37 | /** Hash array mapped trie data structure (opaque type). */ 38 | typedef struct HAMT HAMT; 39 | /** Hash array mapped trie entry (opaque type). */ 40 | typedef struct HAMTEntry HAMTEntry; 41 | 42 | /** Create new, empty, HAMT. error_func() is called when an internal error is 43 | * encountered--it should NOT return to the calling function. 44 | * \param nocase nonzero if HAMT should be case-insensitive 45 | * \param error_func function called on internal error 46 | * \return New, empty, hash array mapped trie. 47 | */ 48 | HAMT *HAMT_create(int nocase, /*@exits@*/ void (*error_func) 49 | (const char *file, unsigned int line, const char *message)); 50 | 51 | /** Delete HAMT and all data associated with it. Uses deletefunc() to delete 52 | * each data item. 53 | * \param hamt Hash array mapped trie 54 | * \param deletefunc Data deletion function 55 | */ 56 | void HAMT_destroy(/*@only@*/ HAMT *hamt, 57 | void (*deletefunc) (/*@only@*/ void *data)); 58 | 59 | /** Insert key into HAMT, associating it with data. 60 | * If the key is not present in the HAMT, inserts it, sets *replace to 1, and 61 | * returns the data passed in. 62 | * If the key is already present and *replace is 0, deletes the data passed 63 | * in using deletefunc() and returns the data currently associated with the 64 | * key. 65 | * If the key is already present and *replace is 1, deletes the data currently 66 | * associated with the key using deletefunc() and replaces it with the data 67 | * passed in. 68 | * \param hamt Hash array mapped trie 69 | * \param str Key 70 | * \param data Data to associate with key 71 | * \param replace See above description 72 | * \param deletefunc Data deletion function if data is replaced 73 | * \return Data now associated with key. 74 | */ 75 | /*@dependent@*/ void *HAMT_insert(HAMT *hamt, /*@dependent@*/ const char *str, 76 | /*@only@*/ void *data, int *replace, 77 | void (*deletefunc) (/*@only@*/ void *data)); 78 | 79 | /** Search for the data associated with a key in the HAMT. 80 | * \param hamt Hash array mapped trie 81 | * \param str Key 82 | * \return NULL if key/data not present in HAMT, otherwise associated data. 83 | */ 84 | /*@dependent@*/ /*@null@*/ void *HAMT_search(HAMT *hamt, const char *str); 85 | 86 | /** Traverse over all keys in HAMT, calling function on each data item. 87 | * \param hamt Hash array mapped trie 88 | * \param d Data to pass to each call to func. 89 | * \param func Function to call 90 | * \return Stops early (and returns func's return value) if func returns a 91 | * nonzero value; otherwise 0. 92 | */ 93 | int HAMT_traverse(HAMT *hamt, /*@null@*/ void *d, 94 | int (*func) (/*@dependent@*/ /*@null@*/ void *node, 95 | /*@null@*/ void *d)); 96 | 97 | /** Get the first entry in a HAMT. 98 | * \param hamt Hash array mapped trie 99 | * \return First entry in HAMT, or NULL if HAMT is empty. 100 | */ 101 | const HAMTEntry *HAMT_first(const HAMT *hamt); 102 | 103 | /** Get the next entry in a HAMT. 104 | * \param prev Previous entry in HAMT 105 | * \return Next entry in HAMT, or NULL if no more entries. 106 | */ 107 | /*@null@*/ const HAMTEntry *HAMT_next(const HAMTEntry *prev); 108 | 109 | /** Get the corresponding data for a HAMT entry. 110 | * \param entry HAMT entry (as returned by HAMT_first() and HAMT_next()) 111 | * \return Corresponding data item. 112 | */ 113 | void *HAMTEntry_get_data(const HAMTEntry *entry); 114 | 115 | #endif 116 | -------------------------------------------------------------------------------- /ffmpeg/include/libyasm/inttree.h: -------------------------------------------------------------------------------- 1 | /* $Id: inttree.h 1825 2007-04-22 03:32:46Z peter $ */ 2 | #ifndef YASM_INTTREE_H 3 | #define YASM_INTTREE_H 4 | 5 | /* The interval_tree.h and interval_tree.cc files contain code for 6 | * interval trees implemented using red-black-trees as described in 7 | * the book _Introduction_To_Algorithms_ by Cormen, Leisserson, 8 | * and Rivest. 9 | */ 10 | 11 | typedef struct IntervalTreeNode { 12 | struct IntervalTreeNode *left, *right, *parent; 13 | void *data; 14 | long low; 15 | long high; 16 | long maxHigh; 17 | int red; /* if red=0 then the node is black */ 18 | } IntervalTreeNode; 19 | 20 | typedef struct it_recursion_node { 21 | /* This structure stores the information needed when we take the 22 | * right branch in searching for intervals but possibly come back 23 | * and check the left branch as well. 24 | */ 25 | IntervalTreeNode *start_node; 26 | unsigned int parentIndex; 27 | int tryRightBranch; 28 | } it_recursion_node; 29 | 30 | typedef struct IntervalTree { 31 | /* A sentinel is used for root and for nil. These sentinels are 32 | * created when ITTreeCreate is called. root->left should always 33 | * point to the node which is the root of the tree. nil points to a 34 | * node which should always be black but has aribtrary children and 35 | * parent and no key or info. The point of using these sentinels is so 36 | * that the root and nil nodes do not require special cases in the code 37 | */ 38 | IntervalTreeNode *root; 39 | IntervalTreeNode *nil; 40 | 41 | /*private:*/ 42 | unsigned int recursionNodeStackSize; 43 | it_recursion_node * recursionNodeStack; 44 | unsigned int currentParent; 45 | unsigned int recursionNodeStackTop; 46 | } IntervalTree; 47 | 48 | IntervalTree *IT_create(void); 49 | void IT_destroy(IntervalTree *); 50 | void IT_print(const IntervalTree *); 51 | void *IT_delete_node(IntervalTree *, IntervalTreeNode *, long *low, 52 | long *high); 53 | IntervalTreeNode *IT_insert(IntervalTree *, long low, long high, void *data); 54 | IntervalTreeNode *IT_get_predecessor(const IntervalTree *, IntervalTreeNode *); 55 | IntervalTreeNode *IT_get_successor(const IntervalTree *, IntervalTreeNode *); 56 | void IT_enumerate(IntervalTree *, long low, long high, void *cbd, 57 | void (*callback) (IntervalTreeNode *node, void *cbd)); 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /ffmpeg/include/libyasm/linemap.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file libyasm/linemap.h 3 | * \brief YASM virtual line mapping interface. 4 | * 5 | * \rcs 6 | * $Id: linemap.h 1827 2007-04-22 05:09:49Z peter $ 7 | * \endrcs 8 | * 9 | * \license 10 | * Copyright (C) 2002-2007 Peter Johnson 11 | * 12 | * Redistribution and use in source and binary forms, with or without 13 | * modification, are permitted provided that the following conditions 14 | * are met: 15 | * 1. Redistributions of source code must retain the above copyright 16 | * notice, this list of conditions and the following disclaimer. 17 | * 2. Redistributions in binary form must reproduce the above copyright 18 | * notice, this list of conditions and the following disclaimer in the 19 | * documentation and/or other materials provided with the distribution. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND OTHER CONTRIBUTORS ``AS IS'' 22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR OTHER CONTRIBUTORS BE 25 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 | * POSSIBILITY OF SUCH DAMAGE. 32 | * \endlicense 33 | */ 34 | #ifndef YASM_LINEMAP_H 35 | #define YASM_LINEMAP_H 36 | 37 | /** Create a new line mapping repository. 38 | * \return New repository. 39 | */ 40 | yasm_linemap *yasm_linemap_create(void); 41 | 42 | /** Clean up any memory allocated for a repository. 43 | * \param linemap line mapping repository 44 | */ 45 | void yasm_linemap_destroy(yasm_linemap *linemap); 46 | 47 | /** Get the current line position in a repository. 48 | * \param linemap line mapping repository 49 | * \return Current virtual line. 50 | */ 51 | unsigned long yasm_linemap_get_current(yasm_linemap *linemap); 52 | 53 | /** Get bytecode and source line information, if any, for a virtual line. 54 | * \param linemap line mapping repository 55 | * \param line virtual line 56 | * \param bcp pointer to return bytecode into 57 | * \param sourcep pointer to return source code line pointer into 58 | * \return Zero if source line information available for line, nonzero if not. 59 | * \note If source line information is not available, bcp and sourcep targets 60 | * are set to NULL. 61 | */ 62 | int yasm_linemap_get_source(yasm_linemap *linemap, unsigned long line, 63 | /*@null@*/ yasm_bytecode **bcp, 64 | const char **sourcep); 65 | 66 | /** Add bytecode and source line information to the current virtual line. 67 | * \attention Deletes any existing bytecode and source line information for 68 | * the current virtual line. 69 | * \param linemap line mapping repository 70 | * \param bc bytecode (if any) 71 | * \param source source code line 72 | * \note The source code line pointer is NOT kept, it is strdup'ed. 73 | */ 74 | void yasm_linemap_add_source(yasm_linemap *linemap, 75 | /*@null@*/ yasm_bytecode *bc, 76 | const char *source); 77 | 78 | /** Go to the next line (increments the current virtual line). 79 | * \param linemap line mapping repository 80 | * \return The current (new) virtual line. 81 | */ 82 | unsigned long yasm_linemap_goto_next(yasm_linemap *linemap); 83 | 84 | /** Set a new file/line physical association starting point at the current 85 | * virtual line. line_inc indicates how much the "real" line is incremented 86 | * by for each virtual line increment (0 is perfectly legal). 87 | * \param linemap line mapping repository 88 | * \param filename physical file name (if NULL, not changed) 89 | * \param file_line physical line number 90 | * \param line_inc line increment 91 | */ 92 | void yasm_linemap_set(yasm_linemap *linemap, /*@null@*/ const char *filename, 93 | unsigned long file_line, unsigned long line_inc); 94 | 95 | /** Poke a single file/line association, restoring the original physical 96 | * association starting point. Caution: increments the current virtual line 97 | * twice. 98 | * \param linemap line mapping repository 99 | * \param filename physical file name (if NULL, not changed) 100 | * \param file_line physical line number 101 | * \return The virtual line number of the poked association. 102 | */ 103 | unsigned long yasm_linemap_poke(yasm_linemap *linemap, 104 | /*@null@*/ const char *filename, 105 | unsigned long file_line); 106 | 107 | /** Look up the associated physical file and line for a virtual line. 108 | * \param linemap line mapping repository 109 | * \param line virtual line 110 | * \param filename physical file name (output) 111 | * \param file_line physical line number (output) 112 | */ 113 | void yasm_linemap_lookup(yasm_linemap *linemap, unsigned long line, 114 | /*@out@*/ const char **filename, 115 | /*@out@*/ unsigned long *file_line); 116 | 117 | /** Traverses all filenames used in a linemap, calling a function on each 118 | * filename. 119 | * \param linemap line mapping repository 120 | * \param d data pointer passed to func on each call 121 | * \param func function 122 | * \return Stops early (and returns func's return value) if func returns a 123 | * nonzero value; otherwise 0. 124 | */ 125 | int yasm_linemap_traverse_filenames 126 | (yasm_linemap *linemap, /*@null@*/ void *d, 127 | int (*func) (const char *filename, void *d)); 128 | 129 | #endif 130 | -------------------------------------------------------------------------------- /ffmpeg/include/libyasm/listfmt.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file libyasm/listfmt.h 3 | * \brief YASM list format interface. 4 | * 5 | * \rcs 6 | * $Id: listfmt.h 1827 2007-04-22 05:09:49Z peter $ 7 | * \endrcs 8 | * 9 | * \license 10 | * Copyright (C) 2004-2007 Peter Johnson 11 | * 12 | * Redistribution and use in source and binary forms, with or without 13 | * modification, are permitted provided that the following conditions 14 | * are met: 15 | * - Redistributions of source code must retain the above copyright 16 | * notice, this list of conditions and the following disclaimer. 17 | * - Redistributions in binary form must reproduce the above copyright 18 | * notice, this list of conditions and the following disclaimer in the 19 | * documentation and/or other materials provided with the distribution. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND OTHER CONTRIBUTORS ``AS IS'' 22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR OTHER CONTRIBUTORS BE 25 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 | * POSSIBILITY OF SUCH DAMAGE. 32 | * \endlicense 33 | */ 34 | #ifndef YASM_LISTFMT_H 35 | #define YASM_LISTFMT_H 36 | 37 | #ifndef YASM_DOXYGEN 38 | /** Base #yasm_listfmt structure. Must be present as the first element in any 39 | * #yasm_listfmt implementation. 40 | */ 41 | typedef struct yasm_listfmt_base { 42 | /** #yasm_listfmt_module implementation for this list format. */ 43 | const struct yasm_listfmt_module *module; 44 | } yasm_listfmt_base; 45 | #endif 46 | 47 | /** YASM list format module interface. */ 48 | typedef struct yasm_listfmt_module { 49 | /** One-line description of the list format. */ 50 | const char *name; 51 | 52 | /** Keyword used to select list format. */ 53 | const char *keyword; 54 | 55 | /** Create list format. 56 | * Module-level implementation of yasm_listfmt_create(). 57 | * The filenames are provided solely for informational purposes. 58 | * \param in_filename primary input filename 59 | * \param obj_filename object filename 60 | * \return NULL if unable to initialize. 61 | */ 62 | /*@null@*/ /*@only@*/ yasm_listfmt * (*create) 63 | (const char *in_filename, const char *obj_filename); 64 | 65 | /** Module-level implementation of yasm_listfmt_destroy(). 66 | * Call yasm_listfmt_destroy() instead of calling this function. 67 | */ 68 | void (*destroy) (/*@only@*/ yasm_listfmt *listfmt); 69 | 70 | /** Module-level implementation of yasm_listfmt_output(). 71 | * Call yasm_listfmt_output() instead of calling this function. 72 | */ 73 | void (*output) (yasm_listfmt *listfmt, FILE *f, yasm_linemap *linemap, 74 | yasm_arch *arch); 75 | } yasm_listfmt_module; 76 | 77 | /** Get the keyword used to select a list format. 78 | * \param listfmt list format 79 | * \return keyword 80 | */ 81 | const char *yasm_listfmt_keyword(const yasm_listfmt *listfmt); 82 | 83 | /** Initialize list format for use. Must call before any other list 84 | * format functions. The filenames are provided solely for informational 85 | * purposes. 86 | * \param module list format module 87 | * \param in_filename primary input filename 88 | * \param obj_filename object filename 89 | * \return NULL if object format does not provide needed support. 90 | */ 91 | /*@null@*/ /*@only@*/ yasm_listfmt *yasm_listfmt_create 92 | (const yasm_listfmt_module *module, const char *in_filename, 93 | const char *obj_filename); 94 | 95 | /** Cleans up any allocated list format memory. 96 | * \param listfmt list format 97 | */ 98 | void yasm_listfmt_destroy(/*@only@*/ yasm_listfmt *listfmt); 99 | 100 | /** Write out list to the list file. 101 | * This function may call all read-only yasm_* functions as necessary. 102 | * \param listfmt list format 103 | * \param f output list file 104 | * \param linemap line mapping repository 105 | * \param arch architecture 106 | */ 107 | void yasm_listfmt_output(yasm_listfmt *listfmt, FILE *f, 108 | yasm_linemap *linemap, yasm_arch *arch); 109 | 110 | #ifndef YASM_DOXYGEN 111 | 112 | /* Inline macro implementations for listfmt functions */ 113 | 114 | #define yasm_listfmt_keyword(listfmt) \ 115 | (((yasm_listfmt_base *)listfmt)->module->keyword) 116 | 117 | #define yasm_listfmt_create(module, in_filename, obj_filename) \ 118 | module->create(in_filename, obj_filename) 119 | 120 | #define yasm_listfmt_destroy(listfmt) \ 121 | ((yasm_listfmt_base *)listfmt)->module->destroy(listfmt) 122 | 123 | #define yasm_listfmt_output(listfmt, f, linemap, a) \ 124 | ((yasm_listfmt_base *)listfmt)->module->output(listfmt, f, linemap, a) 125 | 126 | #endif 127 | 128 | #endif 129 | -------------------------------------------------------------------------------- /ffmpeg/include/libyasm/md5.h: -------------------------------------------------------------------------------- 1 | /* See md5.c for explanation and copyright information. */ 2 | 3 | /* 4 | * $Id: md5.h 1825 2007-04-22 03:32:46Z peter $ 5 | */ 6 | 7 | #ifndef YASM_MD5_H 8 | #define YASM_MD5_H 9 | 10 | /* Unlike previous versions of this code, uint32 need not be exactly 11 | 32 bits, merely 32 bits or more. Choosing a data type which is 32 12 | bits instead of 64 is not important; speed is considerably more 13 | important. ANSI guarantees that "unsigned long" will be big enough, 14 | and always using it seems to have few disadvantages. */ 15 | 16 | typedef struct yasm_md5_context { 17 | unsigned long buf[4]; 18 | unsigned long bits[2]; 19 | unsigned char in[64]; 20 | } yasm_md5_context; 21 | 22 | void yasm_md5_init(yasm_md5_context *context); 23 | void yasm_md5_update(yasm_md5_context *context, unsigned char const *buf, 24 | unsigned long len); 25 | void yasm_md5_final(unsigned char digest[16], yasm_md5_context *context); 26 | void yasm_md5_transform(unsigned long buf[4], const unsigned char in[64]); 27 | 28 | #endif /* !YASM_MD5_H */ 29 | -------------------------------------------------------------------------------- /ffmpeg/include/libyasm/module.h: -------------------------------------------------------------------------------- 1 | /* $Id: module.h 1827 2007-04-22 05:09:49Z peter $ 2 | * YASM module loader header file 3 | * 4 | * Copyright (C) 2002-2007 Peter Johnson 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND OTHER CONTRIBUTORS ``AS IS'' 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR OTHER CONTRIBUTORS BE 19 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | * POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | #ifndef YASM_MODULE_H 28 | #define YASM_MODULE_H 29 | 30 | typedef enum yasm_module_type { 31 | YASM_MODULE_ARCH = 0, 32 | YASM_MODULE_DBGFMT, 33 | YASM_MODULE_OBJFMT, 34 | YASM_MODULE_LISTFMT, 35 | YASM_MODULE_PARSER, 36 | YASM_MODULE_PREPROC 37 | } yasm_module_type; 38 | 39 | /*@dependent@*/ /*@null@*/ void *yasm_load_module 40 | (yasm_module_type type, const char *keyword); 41 | 42 | #define yasm_load_arch(keyword) \ 43 | yasm_load_module(YASM_MODULE_ARCH, keyword) 44 | #define yasm_load_dbgfmt(keyword) \ 45 | yasm_load_module(YASM_MODULE_DBGFMT, keyword) 46 | #define yasm_load_objfmt(keyword) \ 47 | yasm_load_module(YASM_MODULE_OBJFMT, keyword) 48 | #define yasm_load_listfmt(keyword) \ 49 | yasm_load_module(YASM_MODULE_LISTFMT, keyword) 50 | #define yasm_load_parser(keyword) \ 51 | yasm_load_module(YASM_MODULE_PARSER, keyword) 52 | #define yasm_load_preproc(keyword) \ 53 | yasm_load_module(YASM_MODULE_PREPROC, keyword) 54 | 55 | void yasm_list_modules 56 | (yasm_module_type type, 57 | void (*printfunc) (const char *name, const char *keyword)); 58 | 59 | #define yasm_list_arch(func) \ 60 | yasm_list_modules(YASM_MODULE_ARCH, func) 61 | #define yasm_list_dbgfmt(func) \ 62 | yasm_list_modules(YASM_MODULE_DBGFMT, func) 63 | #define yasm_list_objfmt(func) \ 64 | yasm_list_modules(YASM_MODULE_OBJFMT, func) 65 | #define yasm_list_listfmt(func) \ 66 | yasm_list_modules(YASM_MODULE_LISTFMT, func) 67 | #define yasm_list_parser(func) \ 68 | yasm_list_modules(YASM_MODULE_PARSER, func) 69 | #define yasm_list_preproc(func) \ 70 | yasm_list_modules(YASM_MODULE_PREPROC, func) 71 | 72 | #endif 73 | -------------------------------------------------------------------------------- /ffmpeg/include/libyasm/objfmt.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file libyasm/objfmt.h 3 | * \brief YASM object format module interface. 4 | * 5 | * \rcs 6 | * $Id: objfmt.h 2035 2008-02-09 03:35:07Z peter $ 7 | * \endrcs 8 | * 9 | * \license 10 | * Copyright (C) 2001-2007 Peter Johnson 11 | * 12 | * Redistribution and use in source and binary forms, with or without 13 | * modification, are permitted provided that the following conditions 14 | * are met: 15 | * - Redistributions of source code must retain the above copyright 16 | * notice, this list of conditions and the following disclaimer. 17 | * - Redistributions in binary form must reproduce the above copyright 18 | * notice, this list of conditions and the following disclaimer in the 19 | * documentation and/or other materials provided with the distribution. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND OTHER CONTRIBUTORS ``AS IS'' 22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR OTHER CONTRIBUTORS BE 25 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 | * POSSIBILITY OF SUCH DAMAGE. 32 | * \endlicense 33 | */ 34 | #ifndef YASM_OBJFMT_H 35 | #define YASM_OBJFMT_H 36 | 37 | #ifndef YASM_DOXYGEN 38 | /** Base #yasm_objfmt structure. Must be present as the first element in any 39 | * #yasm_objfmt implementation. 40 | */ 41 | typedef struct yasm_objfmt_base { 42 | /** #yasm_objfmt_module implementation for this object format. */ 43 | const struct yasm_objfmt_module *module; 44 | } yasm_objfmt_base; 45 | #endif 46 | 47 | /** Object format module interface. */ 48 | struct yasm_objfmt_module { 49 | /** One-line description of the object format. */ 50 | const char *name; 51 | 52 | /** Keyword used to select object format. */ 53 | const char *keyword; 54 | 55 | /** Default output file extension (without the '.'). 56 | * NULL means no extension, with no '.', while "" includes the '.'. 57 | */ 58 | /*@null@*/ const char *extension; 59 | 60 | /** Default (starting) x86 BITS setting. This only appies to the x86 61 | * architecture; other architectures ignore this setting. 62 | */ 63 | const unsigned char default_x86_mode_bits; 64 | 65 | /** NULL-terminated list of debug format (yasm_dbgfmt) keywords that are 66 | * valid to use with this object format. The null debug format 67 | * (null_dbgfmt, "null") should always be in this list so it's possible to 68 | * have no debug output. 69 | */ 70 | const char **dbgfmt_keywords; 71 | 72 | /** Default debug format keyword (set even if there's only one available to 73 | * use). 74 | */ 75 | const char *default_dbgfmt_keyword; 76 | 77 | /** NULL-terminated list of directives. NULL if none. */ 78 | /*@null@*/ const yasm_directive *directives; 79 | 80 | /** Create object format. 81 | * Module-level implementation of yasm_objfmt_create(). 82 | * Call yasm_objfmt_create() instead of calling this function. 83 | * \param object object 84 | * \param a architecture in use 85 | * \return NULL if architecture/machine combination not supported. 86 | */ 87 | /*@null@*/ /*@only@*/ yasm_objfmt * (*create) (yasm_object *object); 88 | 89 | /** Module-level implementation of yasm_objfmt_output(). 90 | * Call yasm_objfmt_output() instead of calling this function. 91 | */ 92 | void (*output) (yasm_object *o, FILE *f, int all_syms, 93 | yasm_errwarns *errwarns); 94 | 95 | /** Module-level implementation of yasm_objfmt_destroy(). 96 | * Call yasm_objfmt_destroy() instead of calling this function. 97 | */ 98 | void (*destroy) (/*@only@*/ yasm_objfmt *objfmt); 99 | 100 | /** Module-level implementation of yasm_objfmt_add_default_section(). 101 | * Call yasm_objfmt_add_default_section() instead of calling this function. 102 | */ 103 | yasm_section * (*add_default_section) (yasm_object *object); 104 | 105 | /** Module-level implementation of yasm_objfmt_section_switch(). 106 | * Call yasm_objfmt_section_switch() instead of calling this function. 107 | */ 108 | /*@observer@*/ /*@null@*/ yasm_section * 109 | (*section_switch)(yasm_object *object, yasm_valparamhead *valparams, 110 | /*@null@*/ yasm_valparamhead *objext_valparams, 111 | unsigned long line); 112 | 113 | /** Module-level implementation of yasm_objfmt_get_special_sym(). 114 | * Call yasm_objfmt_get_special_sym() instead of calling this function. 115 | */ 116 | /*@observer@*/ /*@null@*/ yasm_symrec * 117 | (*get_special_sym)(yasm_object *object, const char *name, 118 | const char *parser); 119 | }; 120 | 121 | /** Create object format. 122 | * \param module object format module 123 | * \param object object 124 | * \return NULL if architecture/machine combination not supported. 125 | */ 126 | /*@null@*/ /*@only@*/ yasm_objfmt *yasm_objfmt_create 127 | (const yasm_objfmt_module *module, yasm_object *object); 128 | 129 | /** Write out (post-optimized) sections to the object file. 130 | * This function may call yasm_symrec_* functions as necessary (including 131 | * yasm_symrec_traverse()) to retrieve symbolic information. 132 | * \param object object 133 | * \param f output object file 134 | * \param all_syms if nonzero, all symbols should be included in 135 | * the object file 136 | * \param errwarns error/warning set 137 | * \note Errors and warnings are stored into errwarns. 138 | */ 139 | void yasm_objfmt_output(yasm_object *object, FILE *f, int all_syms, 140 | yasm_errwarns *errwarns); 141 | 142 | /** Cleans up any allocated object format memory. 143 | * \param objfmt object format 144 | */ 145 | void yasm_objfmt_destroy(/*@only@*/ yasm_objfmt *objfmt); 146 | 147 | /** Add a default section to an object. 148 | * \param object object 149 | * \return Default section. 150 | */ 151 | yasm_section *yasm_objfmt_add_default_section(yasm_object *object); 152 | 153 | /** Switch object file sections. The first val of the valparams should 154 | * be the section name. Calls yasm_object_get_general() to actually get 155 | * the section. 156 | * \param object object 157 | * \param valparams value/parameters 158 | * \param objext_valparams object format-specific value/parameters 159 | * \param line virtual line (from yasm_linemap) 160 | * \return NULL on error, otherwise new section. 161 | */ 162 | /*@observer@*/ /*@null@*/ yasm_section *yasm_objfmt_section_switch 163 | (yasm_object *object, yasm_valparamhead *valparams, 164 | /*@null@*/ yasm_valparamhead *objext_valparams, unsigned long line); 165 | 166 | /** Get a special symbol. Special symbols are generally used to generate 167 | * special relocation types via the WRT mechanism. 168 | * \param object object 169 | * \param name symbol name (not including any parser-specific prefix) 170 | * \param parser parser keyword 171 | * \return NULL if unrecognized, otherwise special symbol. 172 | */ 173 | /*@observer@*/ /*@null@*/ yasm_symrec *yasm_objfmt_get_special_sym 174 | (yasm_object *object, const char *name, const char *parser); 175 | 176 | #ifndef YASM_DOXYGEN 177 | 178 | /* Inline macro implementations for objfmt functions */ 179 | 180 | #define yasm_objfmt_create(module, object) module->create(object) 181 | 182 | #define yasm_objfmt_output(object, f, all_syms, ews) \ 183 | ((yasm_objfmt_base *)((object)->objfmt))->module->output \ 184 | (object, f, all_syms, ews) 185 | #define yasm_objfmt_destroy(objfmt) \ 186 | ((yasm_objfmt_base *)objfmt)->module->destroy(objfmt) 187 | #define yasm_objfmt_section_switch(object, vpms, oe_vpms, line) \ 188 | ((yasm_objfmt_base *)((object)->objfmt))->module->section_switch \ 189 | (object, vpms, oe_vpms, line) 190 | #define yasm_objfmt_add_default_section(object) \ 191 | ((yasm_objfmt_base *)((object)->objfmt))->module->add_default_section \ 192 | (object) 193 | #define yasm_objfmt_get_special_sym(object, name, parser) \ 194 | ((yasm_objfmt_base *)((object)->objfmt))->module->get_special_sym \ 195 | (object, name, parser) 196 | 197 | #endif 198 | 199 | #endif 200 | -------------------------------------------------------------------------------- /ffmpeg/include/libyasm/parser.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file libyasm/parser.h 3 | * \brief YASM parser module interface. 4 | * 5 | * \rcs 6 | * $Id: parser.h 1966 2007-09-20 03:54:36Z peter $ 7 | * \endrcs 8 | * 9 | * \license 10 | * Copyright (C) 2001-2007 Peter Johnson 11 | * 12 | * Redistribution and use in source and binary forms, with or without 13 | * modification, are permitted provided that the following conditions 14 | * are met: 15 | * 1. Redistributions of source code must retain the above copyright 16 | * notice, this list of conditions and the following disclaimer. 17 | * 2. Redistributions in binary form must reproduce the above copyright 18 | * notice, this list of conditions and the following disclaimer in the 19 | * documentation and/or other materials provided with the distribution. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND OTHER CONTRIBUTORS ``AS IS'' 22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR OTHER CONTRIBUTORS BE 25 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 | * POSSIBILITY OF SUCH DAMAGE. 32 | * \endlicense 33 | */ 34 | #ifndef YASM_PARSER_H 35 | #define YASM_PARSER_H 36 | 37 | /** YASM parser module interface. The "front end" of the assembler. */ 38 | typedef struct yasm_parser_module { 39 | /** One-line description of the parser */ 40 | const char *name; 41 | 42 | /** Keyword used to select parser on the command line */ 43 | const char *keyword; 44 | 45 | /** NULL-terminated list of preprocessors that are valid to use with this 46 | * parser. The raw preprocessor (raw_preproc) should always be in this 47 | * list so it's always possible to have no preprocessing done. 48 | */ 49 | const char **preproc_keywords; 50 | 51 | /** Default preprocessor. */ 52 | const char *default_preproc_keyword; 53 | 54 | /** Parse a source file into an object. 55 | * \param object object to parse into (already created) 56 | * \param pp preprocessor 57 | * \param save_input nonzero if the parser should save the original 58 | * lines of source into the object's linemap (via 59 | * yasm_linemap_add_data()). 60 | * \param errwarns error/warning set 61 | * \note Parse errors and warnings are stored into errwarns. 62 | */ 63 | void (*do_parse) 64 | (yasm_object *object, yasm_preproc *pp, int save_input, 65 | yasm_linemap *linemap, yasm_errwarns *errwarns); 66 | } yasm_parser_module; 67 | 68 | #endif 69 | -------------------------------------------------------------------------------- /ffmpeg/include/libyasm/phash.h: -------------------------------------------------------------------------------- 1 | /* Modified for use with yasm by Peter Johnson. 2 | * $Id: phash.h 1825 2007-04-22 03:32:46Z peter $ 3 | */ 4 | /* 5 | ------------------------------------------------------------------------------ 6 | By Bob Jenkins, September 1996. 7 | lookupa.h, a hash function for table lookup, same function as lookup.c. 8 | Use this code in any way you wish. Public Domain. It has no warranty. 9 | Source is http://burtleburtle.net/bob/c/lookupa.h 10 | ------------------------------------------------------------------------------ 11 | */ 12 | 13 | unsigned long phash_lookup(const char *k, size_t length, 14 | unsigned long level); 15 | void phash_checksum(const char *k, size_t length, unsigned long *state); 16 | -------------------------------------------------------------------------------- /ffmpeg/include/libyasm/preproc.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file libyasm/preproc.h 3 | * \brief YASM preprocessor module interface. 4 | * 5 | * \rcs 6 | * $Id: preproc.h 2008 2007-11-03 04:37:44Z peter $ 7 | * \endrcs 8 | * 9 | * \license 10 | * Copyright (C) 2001-2007 Peter Johnson 11 | * 12 | * Redistribution and use in source and binary forms, with or without 13 | * modification, are permitted provided that the following conditions 14 | * are met: 15 | * 1. Redistributions of source code must retain the above copyright 16 | * notice, this list of conditions and the following disclaimer. 17 | * 2. Redistributions in binary form must reproduce the above copyright 18 | * notice, this list of conditions and the following disclaimer in the 19 | * documentation and/or other materials provided with the distribution. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND OTHER CONTRIBUTORS ``AS IS'' 22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR OTHER CONTRIBUTORS BE 25 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 | * POSSIBILITY OF SUCH DAMAGE. 32 | * \endlicense 33 | */ 34 | #ifndef YASM_PREPROC_H 35 | #define YASM_PREPROC_H 36 | 37 | #ifndef YASM_DOXYGEN 38 | /** Base #yasm_preproc structure. Must be present as the first element in any 39 | * #yasm_preproc implementation. 40 | */ 41 | typedef struct yasm_preproc_base { 42 | /** #yasm_preproc_module implementation for this preprocessor. */ 43 | const struct yasm_preproc_module *module; 44 | } yasm_preproc_base; 45 | #endif 46 | 47 | /** YASM preprocesor module interface. */ 48 | typedef struct yasm_preproc_module { 49 | /** One-line description of the preprocessor. */ 50 | const char *name; 51 | 52 | /** Keyword used to select preprocessor on the command line. */ 53 | const char *keyword; 54 | 55 | /** Create preprocessor. 56 | * Module-level implementation of yasm_preproc_create(). 57 | * Call yasm_preproc_create() instead of calling this function. 58 | * 59 | * \param in_filename initial starting filename, or "-" to read from 60 | * stdin 61 | * \param symtab symbol table (may be NULL if none) 62 | * \param lm line mapping repository 63 | * \param errwarns error/warnning set. 64 | * \return New preprocessor. 65 | * 66 | * \note Any preprocessor errors and warnings are stored into errwarns. 67 | */ 68 | /*@only@*/ yasm_preproc * (*create) (const char *in_filename, 69 | yasm_symtab *symtab, 70 | yasm_linemap *lm, 71 | yasm_errwarns *errwarns); 72 | 73 | /** Module-level implementation of yasm_preproc_destroy(). 74 | * Call yasm_preproc_destroy() instead of calling this function. 75 | */ 76 | void (*destroy) (/*@only@*/ yasm_preproc *preproc); 77 | 78 | /** Module-level implementation of yasm_preproc_get_line(). 79 | * Call yasm_preproc_get_line() instead of calling this function. 80 | */ 81 | char * (*get_line) (yasm_preproc *preproc); 82 | 83 | /** Module-level implementation of yasm_preproc_get_included_file(). 84 | * Call yasm_preproc_get_included_file() instead of calling this function. 85 | */ 86 | size_t (*get_included_file) (yasm_preproc *preproc, /*@out@*/ char *buf, 87 | size_t max_size); 88 | 89 | /** Module-level implementation of yasm_preproc_add_include_file(). 90 | * Call yasm_preproc_add_include_file() instead of calling this function. 91 | */ 92 | void (*add_include_file) (yasm_preproc *preproc, const char *filename); 93 | 94 | /** Module-level implementation of yasm_preproc_predefine_macro(). 95 | * Call yasm_preproc_predefine_macro() instead of calling this function. 96 | */ 97 | void (*predefine_macro) (yasm_preproc *preproc, const char *macronameval); 98 | 99 | /** Module-level implementation of yasm_preproc_undefine_macro(). 100 | * Call yasm_preproc_undefine_macro() instead of calling this function. 101 | */ 102 | void (*undefine_macro) (yasm_preproc *preproc, const char *macroname); 103 | 104 | /** Module-level implementation of yasm_preproc_builtin_define(). 105 | * Call yasm_preproc_builtin_define() instead of calling this function. 106 | */ 107 | void (*define_builtin) (yasm_preproc *preproc, const char *macronameval); 108 | } yasm_preproc_module; 109 | 110 | /** Initialize preprocessor. 111 | * The preprocessor needs access to the object format module to find out 112 | * any output format specific macros. 113 | * \param module preprocessor module 114 | * \param in_filename initial starting filename, or "-" to read from stdin 115 | * \param symtab symbol table (may be NULL if none) 116 | * \param lm line mapping repository 117 | * \param errwarns error/warning set 118 | * \return New preprocessor. 119 | * \note Errors/warnings are stored into errwarns. 120 | */ 121 | /*@only@*/ yasm_preproc *yasm_preproc_create 122 | (yasm_preproc_module *module, const char *in_filename, 123 | yasm_symtab *symtab, yasm_linemap *lm, yasm_errwarns *errwarns); 124 | 125 | /** Cleans up any allocated preproc memory. 126 | * \param preproc preprocessor 127 | */ 128 | void yasm_preproc_destroy(/*@only@*/ yasm_preproc *preproc); 129 | 130 | /** Gets a single line of preprocessed source code. 131 | * \param preproc preprocessor 132 | * \return Allocated line of code, without the trailing \n. 133 | */ 134 | char *yasm_preproc_get_line(yasm_preproc *preproc); 135 | 136 | /** Get the next filename included by the source code. 137 | * \param preproc preprocessor 138 | * \param buf destination buffer for filename 139 | * \param max_size maximum number of bytes that can be returned in buf 140 | * \return Actual number of bytes returned in buf. 141 | */ 142 | size_t yasm_preproc_get_included_file(yasm_preproc *preproc, 143 | /*@out@*/ char *buf, size_t max_size); 144 | 145 | /** Pre-include a file. 146 | * \param preproc preprocessor 147 | * \param filename filename 148 | */ 149 | void yasm_preproc_add_include_file(yasm_preproc *preproc, 150 | const char *filename); 151 | 152 | /** Pre-define a macro. 153 | * \param preproc preprocessor 154 | * \param macronameval "name=value" string 155 | */ 156 | void yasm_preproc_predefine_macro(yasm_preproc *preproc, 157 | const char *macronameval); 158 | 159 | /** Un-define a macro. 160 | * \param preproc preprocessor 161 | * \param macroname macro name 162 | */ 163 | void yasm_preproc_undefine_macro(yasm_preproc *preproc, const char *macroname); 164 | 165 | /** Define a builtin macro, preprocessed before the "standard" macros. 166 | * \param preproc preprocessor 167 | * \param macronameval "name=value" string 168 | */ 169 | void yasm_preproc_define_builtin(yasm_preproc *preproc, 170 | const char *macronameval); 171 | 172 | #ifndef YASM_DOXYGEN 173 | 174 | /* Inline macro implementations for preproc functions */ 175 | 176 | #define yasm_preproc_create(module, in_filename, symtab, lm, ews) \ 177 | module->create(in_filename, symtab, lm, ews) 178 | 179 | #define yasm_preproc_destroy(preproc) \ 180 | ((yasm_preproc_base *)preproc)->module->destroy(preproc) 181 | #define yasm_preproc_get_line(preproc) \ 182 | ((yasm_preproc_base *)preproc)->module->get_line(preproc) 183 | #define yasm_preproc_get_included_file(preproc, buf, max_size) \ 184 | ((yasm_preproc_base *)preproc)->module->get_included_file(preproc, buf, max_size) 185 | #define yasm_preproc_add_include_file(preproc, filename) \ 186 | ((yasm_preproc_base *)preproc)->module->add_include_file(preproc, filename) 187 | #define yasm_preproc_predefine_macro(preproc, macronameval) \ 188 | ((yasm_preproc_base *)preproc)->module->predefine_macro(preproc, \ 189 | macronameval) 190 | #define yasm_preproc_undefine_macro(preproc, macroname) \ 191 | ((yasm_preproc_base *)preproc)->module->undefine_macro(preproc, macroname) 192 | #define yasm_preproc_define_builtin(preproc, macronameval) \ 193 | ((yasm_preproc_base *)preproc)->module->define_builtin(preproc, \ 194 | macronameval) 195 | 196 | #endif 197 | 198 | #endif 199 | -------------------------------------------------------------------------------- /ffmpeg/include/libyasm/value.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file libyasm/value.h 3 | * \brief YASM value interface. 4 | * 5 | * \rcs 6 | * $Id: value.h 1827 2007-04-22 05:09:49Z peter $ 7 | * \endrcs 8 | * 9 | * \license 10 | * Copyright (C) 2006-2007 Peter Johnson 11 | * 12 | * Redistribution and use in source and binary forms, with or without 13 | * modification, are permitted provided that the following conditions 14 | * are met: 15 | * - Redistributions of source code must retain the above copyright 16 | * notice, this list of conditions and the following disclaimer. 17 | * - Redistributions in binary form must reproduce the above copyright 18 | * notice, this list of conditions and the following disclaimer in the 19 | * documentation and/or other materials provided with the distribution. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND OTHER CONTRIBUTORS ``AS IS'' 22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR OTHER CONTRIBUTORS BE 25 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 | * POSSIBILITY OF SUCH DAMAGE. 32 | * \endlicense 33 | */ 34 | #ifndef YASM_VALUE_H 35 | #define YASM_VALUE_H 36 | 37 | /** Initialize a #yasm_value with just an expression. No processing is 38 | * performed, the expression is simply stuck into value.abs and the other 39 | * fields are initialized. Use yasm_expr_extract_value() to perform "smart" 40 | * processing into a #yasm_value. This function is intended for use during 41 | * parsing simply to ensure all fields of the value are initialized; after 42 | * the parse is complete, yasm_value_extract() should be called to finalize 43 | * the value. The value defaults to unsigned. 44 | * \param value value to be initialized 45 | * \param e expression (kept) 46 | * \param size value size (in bits) 47 | */ 48 | void yasm_value_initialize(/*@out@*/ yasm_value *value, 49 | /*@null@*/ /*@kept@*/ yasm_expr *e, 50 | unsigned int size); 51 | 52 | /** Initialize a #yasm_value with just a symrec. No processing is performed, 53 | * the symrec is simply stuck into value.rel and the other fields are 54 | * initialized. 55 | * \param value value to be initialized 56 | * \param sym symrec 57 | * \param size value size (in bits) 58 | */ 59 | void yasm_value_init_sym(/*@out@*/ yasm_value *value, 60 | /*@null@*/ yasm_symrec *sym, unsigned int size); 61 | 62 | /** Initialize a #yasm_value as a copy of another yasm_value. Any expressions 63 | * within orig are copied, so it's safe to delete the copy. 64 | * \param value value (copy to create) 65 | * \param orig original value 66 | */ 67 | void yasm_value_init_copy(yasm_value *value, const yasm_value *orig); 68 | 69 | /** Frees any memory inside value; does not free value itself. 70 | * \param value value 71 | */ 72 | void yasm_value_delete(yasm_value *value); 73 | 74 | /** Set a value to be relative to the current assembly position rather than 75 | * relative to the section start. 76 | * \param value value 77 | * \param bc bytecode containing value 78 | * \param ip_rel if nonzero, indicates IP-relative data relocation, 79 | * sometimes used to generate special relocations 80 | * \note If value is just an absolute value, will get an absolute symrec to 81 | * reference to (via bc's symbol table). 82 | */ 83 | void yasm_value_set_curpos_rel(yasm_value *value, yasm_bytecode *bc, 84 | unsigned int ip_rel); 85 | 86 | /** Perform yasm_value_finalize_expr() on a value that already exists from 87 | * being initialized with yasm_value_initialize(). 88 | * \param value value 89 | * \param precbc previous bytecode to bytecode containing value 90 | * \return Nonzero if value could not be split. 91 | */ 92 | int yasm_value_finalize(yasm_value *value, /*@null@*/ yasm_bytecode *precbc); 93 | 94 | /** Break a #yasm_expr into a #yasm_value constituent parts. Extracts 95 | * the relative portion of the value, SEG and WRT portions, and top-level 96 | * right shift, if any. Places the remaining expr into the absolute 97 | * portion of the value. Essentially a combination of yasm_value_initialize() 98 | * and yasm_value_finalize(). First expands references to symrecs in 99 | * absolute sections by expanding with the absolute section start plus the 100 | * symrec offset within the absolute section. 101 | * \param value value to store split portions into 102 | * \param e expression input 103 | * \param precbc previous bytecode to bytecode containing expression 104 | * \param size value size (in bits) 105 | * \return Nonzero if the expr could not be split into a value for some 106 | * reason (e.g. the relative portion was not added, but multiplied, 107 | * etc). 108 | * \warning Do not use e after this call. Even if an error is returned, e 109 | * is stored into value. 110 | * \note This should only be called after the parse is complete. Calling 111 | * before the parse is complete will usually result in an error return. 112 | */ 113 | int yasm_value_finalize_expr(/*@out@*/ yasm_value *value, 114 | /*@null@*/ /*@kept@*/ yasm_expr *e, 115 | /*@null@*/ yasm_bytecode *precbc, 116 | unsigned int size); 117 | 118 | /** Get value if absolute or PC-relative section-local relative. Returns NULL 119 | * otherwise. 120 | * \param value value 121 | * \param bc current bytecode (for PC-relative calculation); if 122 | * NULL, NULL is returned for PC-relative values. 123 | * \param calc_bc_dist if nonzero, calculates bytecode distances in absolute 124 | * portion of value 125 | * \note Adds in value.rel (correctly) if PC-relative and in the same section 126 | * as bc (and there is no WRT or SEG). 127 | * \return Intnum if can be resolved to integer value, otherwise NULL. 128 | */ 129 | /*@null@*/ /*@only@*/ yasm_intnum *yasm_value_get_intnum 130 | (yasm_value *value, /*@null@*/ yasm_bytecode *bc, int calc_bc_dist); 131 | 132 | /** Output value if constant or PC-relative section-local. This should be 133 | * used from objfmt yasm_output_value_func() functions. 134 | * functions. 135 | * \param value value 136 | * \param buf buffer for byte representation 137 | * \param destsize destination size (in bytes) 138 | * \param bc current bytecode (usually passed into higher-level 139 | * calling function) 140 | * \param warn enables standard warnings: zero for none; 141 | * nonzero for overflow/underflow floating point and 142 | * integer warnings 143 | * \param arch architecture 144 | * \note Adds in value.rel (correctly) if PC-relative and in the same section 145 | * as bc (and there is no WRT or SEG); if this is not the desired 146 | * behavior, e.g. a reloc is needed in this case, don't use this 147 | * function! 148 | * \return 0 if no value output due to value needing relocation; 149 | * 1 if value output; -1 if error. 150 | */ 151 | int yasm_value_output_basic 152 | (yasm_value *value, /*@out@*/ unsigned char *buf, size_t destsize, 153 | yasm_bytecode *bc, int warn, yasm_arch *arch); 154 | 155 | /** Print a value. For debugging purposes. 156 | * \param value value 157 | * \param indent_level indentation level 158 | * \param f file 159 | */ 160 | void yasm_value_print(const yasm_value *value, FILE *f, int indent_level); 161 | 162 | #endif 163 | -------------------------------------------------------------------------------- /ffmpeg/include/png.h: -------------------------------------------------------------------------------- 1 | libpng12/png.h -------------------------------------------------------------------------------- /ffmpeg/include/pngconf.h: -------------------------------------------------------------------------------- 1 | libpng12/pngconf.h -------------------------------------------------------------------------------- /ffmpeg/include/x264_config.h: -------------------------------------------------------------------------------- 1 | #define X264_BIT_DEPTH 8 2 | #define X264_GPL 1 3 | -------------------------------------------------------------------------------- /ffmpeg/lib/libavcodec.so: -------------------------------------------------------------------------------- 1 | libavcodec.so.52.20.1 -------------------------------------------------------------------------------- /ffmpeg/lib/libavcodec.so.52: -------------------------------------------------------------------------------- 1 | libavcodec.so.52.20.1 -------------------------------------------------------------------------------- /ffmpeg/lib/libavcodec.so.52.20.1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justdoit-mqr/plantMonitorSys/7ecb02b3e404b2f9f11a9e7d674c34bad5f09ee6/ffmpeg/lib/libavcodec.so.52.20.1 -------------------------------------------------------------------------------- /ffmpeg/lib/libavdevice.so: -------------------------------------------------------------------------------- 1 | libavdevice.so.52.1.0 -------------------------------------------------------------------------------- /ffmpeg/lib/libavdevice.so.52: -------------------------------------------------------------------------------- 1 | libavdevice.so.52.1.0 -------------------------------------------------------------------------------- /ffmpeg/lib/libavdevice.so.52.1.0: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justdoit-mqr/plantMonitorSys/7ecb02b3e404b2f9f11a9e7d674c34bad5f09ee6/ffmpeg/lib/libavdevice.so.52.1.0 -------------------------------------------------------------------------------- /ffmpeg/lib/libavformat.so: -------------------------------------------------------------------------------- 1 | libavformat.so.52.31.0 -------------------------------------------------------------------------------- /ffmpeg/lib/libavformat.so.52: -------------------------------------------------------------------------------- 1 | libavformat.so.52.31.0 -------------------------------------------------------------------------------- /ffmpeg/lib/libavformat.so.52.31.0: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justdoit-mqr/plantMonitorSys/7ecb02b3e404b2f9f11a9e7d674c34bad5f09ee6/ffmpeg/lib/libavformat.so.52.31.0 -------------------------------------------------------------------------------- /ffmpeg/lib/libavutil.so: -------------------------------------------------------------------------------- 1 | libavutil.so.49.15.0 -------------------------------------------------------------------------------- /ffmpeg/lib/libavutil.so.49: -------------------------------------------------------------------------------- 1 | libavutil.so.49.15.0 -------------------------------------------------------------------------------- /ffmpeg/lib/libavutil.so.49.15.0: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justdoit-mqr/plantMonitorSys/7ecb02b3e404b2f9f11a9e7d674c34bad5f09ee6/ffmpeg/lib/libavutil.so.49.15.0 -------------------------------------------------------------------------------- /ffmpeg/lib/libpng.a: -------------------------------------------------------------------------------- 1 | libpng12.a -------------------------------------------------------------------------------- /ffmpeg/lib/libpng.la: -------------------------------------------------------------------------------- 1 | libpng12.la -------------------------------------------------------------------------------- /ffmpeg/lib/libpng.so: -------------------------------------------------------------------------------- 1 | libpng12.so -------------------------------------------------------------------------------- /ffmpeg/lib/libpng.so.3: -------------------------------------------------------------------------------- 1 | libpng.so.3.18.0 -------------------------------------------------------------------------------- /ffmpeg/lib/libpng.so.3.18.0: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justdoit-mqr/plantMonitorSys/7ecb02b3e404b2f9f11a9e7d674c34bad5f09ee6/ffmpeg/lib/libpng.so.3.18.0 -------------------------------------------------------------------------------- /ffmpeg/lib/libpng12.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justdoit-mqr/plantMonitorSys/7ecb02b3e404b2f9f11a9e7d674c34bad5f09ee6/ffmpeg/lib/libpng12.a -------------------------------------------------------------------------------- /ffmpeg/lib/libpng12.la: -------------------------------------------------------------------------------- 1 | # libpng12.la - a libtool library file 2 | # Generated by ltmain.sh - GNU libtool 1.5.22 (1.1220.2.365 2005/12/18 22:14:06) 3 | # 4 | # Please DO NOT delete this file! 5 | # It is necessary for linking the library. 6 | 7 | # The name that we can dlopen(3). 8 | dlname='libpng12.so.0' 9 | 10 | # Names of this library. 11 | library_names='libpng12.so.0.18.0 libpng12.so.0 libpng12.so' 12 | 13 | # The name of the static archive. 14 | old_library='libpng12.a' 15 | 16 | # Libraries that this one depends upon. 17 | dependency_libs=' -L/home/qy/3354EK/ffmpeg/lib -lz -lm' 18 | 19 | # Version information for libpng12. 20 | current=18 21 | age=18 22 | revision=0 23 | 24 | # Is this an already installed library? 25 | installed=yes 26 | 27 | # Should we warn about portability when linking against -modules? 28 | shouldnotlink=no 29 | 30 | # Files to dlopen/dlpreopen 31 | dlopen='' 32 | dlpreopen='' 33 | 34 | # Directory that this library needs to be installed in: 35 | libdir='/home/qy/3354EK/ffmpeg/lib' 36 | -------------------------------------------------------------------------------- /ffmpeg/lib/libpng12.so: -------------------------------------------------------------------------------- 1 | libpng12.so.0.18.0 -------------------------------------------------------------------------------- /ffmpeg/lib/libpng12.so.0: -------------------------------------------------------------------------------- 1 | libpng12.so.0.18.0 -------------------------------------------------------------------------------- /ffmpeg/lib/libpng12.so.0.18.0: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justdoit-mqr/plantMonitorSys/7ecb02b3e404b2f9f11a9e7d674c34bad5f09ee6/ffmpeg/lib/libpng12.so.0.18.0 -------------------------------------------------------------------------------- /ffmpeg/lib/libswscale.so: -------------------------------------------------------------------------------- 1 | libswscale.so.0.7.1 -------------------------------------------------------------------------------- /ffmpeg/lib/libswscale.so.0: -------------------------------------------------------------------------------- 1 | libswscale.so.0.7.1 -------------------------------------------------------------------------------- /ffmpeg/lib/libswscale.so.0.7.1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justdoit-mqr/plantMonitorSys/7ecb02b3e404b2f9f11a9e7d674c34bad5f09ee6/ffmpeg/lib/libswscale.so.0.7.1 -------------------------------------------------------------------------------- /ffmpeg/lib/libx264.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justdoit-mqr/plantMonitorSys/7ecb02b3e404b2f9f11a9e7d674c34bad5f09ee6/ffmpeg/lib/libx264.a -------------------------------------------------------------------------------- /ffmpeg/lib/libx264.so: -------------------------------------------------------------------------------- 1 | libx264.so.115 -------------------------------------------------------------------------------- /ffmpeg/lib/libx264.so.115: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justdoit-mqr/plantMonitorSys/7ecb02b3e404b2f9f11a9e7d674c34bad5f09ee6/ffmpeg/lib/libx264.so.115 -------------------------------------------------------------------------------- /ffmpeg/lib/libxvidcore.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justdoit-mqr/plantMonitorSys/7ecb02b3e404b2f9f11a9e7d674c34bad5f09ee6/ffmpeg/lib/libxvidcore.a -------------------------------------------------------------------------------- /ffmpeg/lib/libxvidcore.so.4.3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justdoit-mqr/plantMonitorSys/7ecb02b3e404b2f9f11a9e7d674c34bad5f09ee6/ffmpeg/lib/libxvidcore.so.4.3 -------------------------------------------------------------------------------- /ffmpeg/lib/libyasm.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justdoit-mqr/plantMonitorSys/7ecb02b3e404b2f9f11a9e7d674c34bad5f09ee6/ffmpeg/lib/libyasm.a -------------------------------------------------------------------------------- /ffmpeg/lib/libz.so: -------------------------------------------------------------------------------- 1 | libz.so.1.2.3 -------------------------------------------------------------------------------- /ffmpeg/lib/libz.so.1: -------------------------------------------------------------------------------- 1 | libz.so.1.2.3 -------------------------------------------------------------------------------- /ffmpeg/lib/libz.so.1.2.3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justdoit-mqr/plantMonitorSys/7ecb02b3e404b2f9f11a9e7d674c34bad5f09ee6/ffmpeg/lib/libz.so.1.2.3 -------------------------------------------------------------------------------- /ffmpeg/lib/pkgconfig/libavcodec.pc: -------------------------------------------------------------------------------- 1 | prefix=/home/qy/3354EK/ffmpeg 2 | exec_prefix=${prefix} 3 | libdir=${prefix}/lib 4 | includedir=${prefix}/include 5 | 6 | Name: libavcodec 7 | Description: FFmpeg codec library 8 | Version: 52.20.1 9 | Requires: 10 | Requires.private: libavutil = 49.15.0 11 | Conflicts: 12 | Libs: -L${libdir} -lavcodec 13 | Libs.private: -lz -lbz2 -pthread -lm -lx264 -lm -lxvidcore -lasound -ldl -ldl -lasound -lasound 14 | Cflags: -I${includedir} 15 | -------------------------------------------------------------------------------- /ffmpeg/lib/pkgconfig/libavdevice.pc: -------------------------------------------------------------------------------- 1 | prefix=/home/qy/3354EK/ffmpeg 2 | exec_prefix=${prefix} 3 | libdir=${prefix}/lib 4 | includedir=${prefix}/include 5 | 6 | Name: libavdevice 7 | Description: FFmpeg device handling library 8 | Version: 52.1.0 9 | Requires: 10 | Requires.private: libavformat = 52.31.0 11 | Conflicts: 12 | Libs: -L${libdir} -lavdevice 13 | Libs.private: -lz -lbz2 -pthread -lm -lx264 -lm -lxvidcore -lasound -ldl -ldl -lasound -lasound 14 | Cflags: -I${includedir} 15 | -------------------------------------------------------------------------------- /ffmpeg/lib/pkgconfig/libavformat.pc: -------------------------------------------------------------------------------- 1 | prefix=/home/qy/3354EK/ffmpeg 2 | exec_prefix=${prefix} 3 | libdir=${prefix}/lib 4 | includedir=${prefix}/include 5 | 6 | Name: libavformat 7 | Description: FFmpeg container format library 8 | Version: 52.31.0 9 | Requires: 10 | Requires.private: libavcodec = 52.20.1 11 | Conflicts: 12 | Libs: -L${libdir} -lavformat 13 | Libs.private: -lz -lbz2 -pthread -lm -lx264 -lm -lxvidcore -lasound -ldl -ldl -lasound -lasound 14 | Cflags: -I${includedir} 15 | -------------------------------------------------------------------------------- /ffmpeg/lib/pkgconfig/libavutil.pc: -------------------------------------------------------------------------------- 1 | prefix=/home/qy/3354EK/ffmpeg 2 | exec_prefix=${prefix} 3 | libdir=${prefix}/lib 4 | includedir=${prefix}/include 5 | 6 | Name: libavutil 7 | Description: FFmpeg utility library 8 | Version: 49.15.0 9 | Requires: 10 | Requires.private: 11 | Conflicts: 12 | Libs: -L${libdir} -lavutil 13 | Libs.private: 14 | Cflags: -I${includedir} 15 | -------------------------------------------------------------------------------- /ffmpeg/lib/pkgconfig/libpng.pc: -------------------------------------------------------------------------------- 1 | libpng12.pc -------------------------------------------------------------------------------- /ffmpeg/lib/pkgconfig/libpng12.pc: -------------------------------------------------------------------------------- 1 | prefix=/home/qy/3354EK/ffmpeg 2 | exec_prefix=${prefix} 3 | libdir=${exec_prefix}/lib 4 | includedir=${prefix}/include/libpng12 5 | 6 | Name: libpng 7 | Description: Loads and saves PNG files 8 | Version: 1.2.18 9 | Libs: -L${libdir} -lpng12 10 | Cflags: -I${includedir} 11 | -------------------------------------------------------------------------------- /ffmpeg/lib/pkgconfig/libswscale.pc: -------------------------------------------------------------------------------- 1 | prefix=/home/qy/3354EK/ffmpeg 2 | exec_prefix=${prefix} 3 | libdir=${prefix}/lib 4 | includedir=${prefix}/include 5 | 6 | Name: libswscale 7 | Description: FFmpeg image rescaling library 8 | Version: 0.7.1 9 | Requires: 10 | Requires.private: libavutil = 49.15.0 11 | Conflicts: 12 | Libs: -L${libdir} -lswscale 13 | Libs.private: 14 | Cflags: -I${includedir} 15 | -------------------------------------------------------------------------------- /ffmpeg/lib/pkgconfig/x264.pc: -------------------------------------------------------------------------------- 1 | prefix=/home/qy/3354EK/ffmpeg 2 | exec_prefix=${prefix} 3 | libdir=${exec_prefix}/lib 4 | includedir=${prefix}/include 5 | 6 | Name: x264 7 | Description: H.264 (MPEG4 AVC) encoder library 8 | Version: 0.115.x 9 | Libs: -L${exec_prefix}/lib -lx264 -lpthread 10 | Cflags: -I${prefix}/include 11 | -------------------------------------------------------------------------------- /ffmpeg/lib/vhook/fish.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justdoit-mqr/plantMonitorSys/7ecb02b3e404b2f9f11a9e7d674c34bad5f09ee6/ffmpeg/lib/vhook/fish.so -------------------------------------------------------------------------------- /ffmpeg/lib/vhook/null.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justdoit-mqr/plantMonitorSys/7ecb02b3e404b2f9f11a9e7d674c34bad5f09ee6/ffmpeg/lib/vhook/null.so -------------------------------------------------------------------------------- /ffmpeg/lib/vhook/ppm.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justdoit-mqr/plantMonitorSys/7ecb02b3e404b2f9f11a9e7d674c34bad5f09ee6/ffmpeg/lib/vhook/ppm.so -------------------------------------------------------------------------------- /ffmpeg/lib/vhook/watermark.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justdoit-mqr/plantMonitorSys/7ecb02b3e404b2f9f11a9e7d674c34bad5f09ee6/ffmpeg/lib/vhook/watermark.so -------------------------------------------------------------------------------- /globalvar.h: -------------------------------------------------------------------------------- 1 | /* 2 | *@file: globalvar.h 3 | *@author: 缪庆瑞 4 | *@date: 2017.5.5 5 | *@brief: 全局变量声明头文件 6 | */ 7 | #ifndef GLOBALVAR_H 8 | #define GLOBALVAR_H 9 | #include "softkeyboard/softkeyboard.h" 10 | 11 | /*声明可以在不同文件使用的全局变量,头文件中用extern 声明,但不可以定义。 12 | 在.cpp文件中包含头文件,并在类外定义或者声明(例如类对象声明一次,在类内定义) 13 | 一次全局变量,之后直接使用,这样在其他任何包含头文件的文件中都可以使用该全局变量*/ 14 | extern SoftKeyboard *softKeyboard;//全局的软键盘对象 15 | 16 | #endif // GLOBALVAR_H 17 | 18 | -------------------------------------------------------------------------------- /images.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | images/add.png 4 | images/refresh.ico 5 | images/WIFI_OFF.ico 6 | images/WIFI_ON.ico 7 | 8 | 9 | -------------------------------------------------------------------------------- /images/WIFI_OFF.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justdoit-mqr/plantMonitorSys/7ecb02b3e404b2f9f11a9e7d674c34bad5f09ee6/images/WIFI_OFF.ico -------------------------------------------------------------------------------- /images/WIFI_OFF1.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justdoit-mqr/plantMonitorSys/7ecb02b3e404b2f9f11a9e7d674c34bad5f09ee6/images/WIFI_OFF1.ico -------------------------------------------------------------------------------- /images/WIFI_ON.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justdoit-mqr/plantMonitorSys/7ecb02b3e404b2f9f11a9e7d674c34bad5f09ee6/images/WIFI_ON.ico -------------------------------------------------------------------------------- /images/WIFI_ON1.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justdoit-mqr/plantMonitorSys/7ecb02b3e404b2f9f11a9e7d674c34bad5f09ee6/images/WIFI_ON1.ico -------------------------------------------------------------------------------- /images/add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justdoit-mqr/plantMonitorSys/7ecb02b3e404b2f9f11a9e7d674c34bad5f09ee6/images/add.png -------------------------------------------------------------------------------- /images/refresh.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justdoit-mqr/plantMonitorSys/7ecb02b3e404b2f9f11a9e7d674c34bad5f09ee6/images/refresh.ico -------------------------------------------------------------------------------- /infocollectwidget.h: -------------------------------------------------------------------------------- 1 | /* 2 | *@file: infocollectwidget.h 3 | *@author: 缪庆瑞 4 | *@date: 2017.4.23 5 | *@brief: 信息汇总界面,包括设备状态、运行时长、报警信息等统计信息 6 | */ 7 | #ifndef INFOCOLLECTWIDGET_H 8 | #define INFOCOLLECTWIDGET_H 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include "basetablewidget.h" 22 | #include "mymessagebox.h" 23 | 24 | class InfoCollectWidget : public QWidget 25 | { 26 | Q_OBJECT 27 | public: 28 | explicit InfoCollectWidget(QWidget *parent = 0); 29 | ~InfoCollectWidget(); 30 | void initStatusBox();//初始化设备状态汇总区域 31 | void initRuntimesBox();//初始化运行时长汇总区域 32 | void initWarningBox();//初始化警报信息汇总区域 33 | 34 | void initEquipmentNoBox();//根据数据库初始化设备号列表 35 | 36 | signals: 37 | 38 | public slots: 39 | void setStatusCount(int all,int offline,int standby,int run,int warning); 40 | void updateEqmNoBox(QStringList list);//更新设备号列表 41 | void refreshRunTimesSlot();//刷新运行(待机)时长显示 42 | void queryWarningInfoSlot();//查询指定的报警信息 43 | 44 | private: 45 | //设备状态汇总区 46 | QGroupBox *equipmentStatusBox; 47 | QLabel *allCountLabel;//所有设备数 48 | QLabel *allCount; 49 | QLabel *offLineCountLabel;//离线设备数 50 | QLabel *offLineCount; 51 | QLabel *standByCountLabel;//待机设备数 52 | QLabel *standByCount; 53 | QLabel *runCountLabel;//运行设备数 54 | QLabel *runCount; 55 | QLabel *warningCountLabel;//报警设备数 56 | QLabel *warningCount; 57 | //设备运行时长汇总区 58 | QGroupBox *equipmentRunTimesBox; 59 | QLabel *equipmentNoLabel;//设备号 60 | QComboBox *equipmentNoBox; 61 | QPushButton *refreshBtn;//刷新 62 | QLabel *standByTimesOfDayLabel;//日待机时长 63 | QLabel *standByTimesOfDay; 64 | QLabel *runTimesOfDayLabel;//日运行时长 65 | QLabel *runTimesOfDay; 66 | //设备警报信息汇总区 67 | QGroupBox *equipmentWarningBox; 68 | QWidget *historyQueryWidget;//查询指定日期/设备的部件 69 | QLabel *dateLable;//日期 70 | QComboBox *yearBox; 71 | QComboBox *monthBox; 72 | QComboBox *dayBox; 73 | QLabel *equipmentNoLabel2; 74 | QComboBox *equipmentNoBox2; 75 | QPushButton *queryBtn; 76 | BaseTableWidget *warningTableWidget;//警报信息展示表格 77 | 78 | /*定义数据库对象,此时是无效的,通过静态方法database(connectionName)获取已有的数据库连接 79 | 操作同一数据库*/ 80 | QSqlDatabase db; 81 | }; 82 | 83 | #endif // INFOCOLLECTWIDGET_H 84 | -------------------------------------------------------------------------------- /infoshowwidget.h: -------------------------------------------------------------------------------- 1 | /* 2 | *@file: infoshowwidget.h 3 | *@author: 缪庆瑞 4 | *@date: 2017.3.20 5 | *@brief: 信息展示界面,包括设备参数,视频监控等 6 | */ 7 | #ifndef INFOSHOWWIDGET_H 8 | #define INFOSHOWWIDGET_H 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include "customplotwidget.h" 25 | #include "mymessagebox.h" 26 | #include "videomonitorwidget.h" 27 | #include "globalvar.h" 28 | 29 | class InfoShowWidget : public QWidget 30 | { 31 | Q_OBJECT 32 | public: 33 | explicit InfoShowWidget(QWidget *parent = 0); 34 | ~InfoShowWidget(); 35 | void initEquipmentParamArea();//初始化设备参数区域 36 | void initTabWidget();//初始化曲线绘制与视频监控区域 37 | void initEquipmentNoBox();//初始化设备号组 38 | void changeComboBoxIndex(QString equipmentNo);//根据文本改变comboBox当前index值 39 | 40 | void setEquipmentStatus(QStringList &list);//设置设备运行状态/电压/电流参数 41 | 42 | protected: 43 | virtual bool eventFilter(QObject *obj, QEvent *event); 44 | 45 | signals: 46 | void updateTableBtnName(QString equipmentNo); 47 | 48 | public slots: 49 | void updateEquipmentNoBox(QStringList equipmentNoList);//更新设备号组 50 | void setHashData(QString equipmentNo,QStringList equipmentDataList);//设置hash键值对 51 | void refreshDisplay(QString equipmentNo);//根据设备号刷新界面参数显示 52 | 53 | void alterParamSlot();//修改参数 54 | void updateParamSlot();//更新参数 55 | 56 | void keyboardSlot(QString text);//处理软键盘信号的槽 57 | 58 | private: 59 | //QString equipmentNo;//设备号 整个界面的信息都是根据对应的设备号从数据库和客户端获取的 60 | QStringList equipmentNoList;//设备号组 61 | //设备信息哈希表,键为设备号,值为设备信息的一个列表(运行状态,电压,电流等) 62 | QHash equipmentInfoHash; 63 | //设备参数部件 64 | QLineEdit *tempEdit;//用来记录当前引发事件过滤器处理的edit部件 65 | QGroupBox *equipmentParamBox;//设备参数部件容器 66 | QLabel *titleLabel;//显示名字 67 | QPushButton *alterParamBtn;//修改设备参数 参数可编辑 68 | QPushButton *updateParamBtn;//更新设备参数到数据库 69 | 70 | QPushButton *equipmentNoBtn;//设备号 71 | QComboBox *equipmentNoBox; 72 | QPushButton *equipmentNameBtn;//设备名 73 | QLineEdit *equipmentNameEdit; 74 | QPushButton *equipmentAddrBtn;//设备ip地址 75 | QLineEdit *equipmentAddrEdit; 76 | QPushButton *equipmentStatusBtn;//状态 77 | QLineEdit *equipmentStatusEdit; 78 | QPushButton *equipmentPresetVBtn;//预置电压 79 | QLineEdit *equipmentPresetVEdit; 80 | QPushButton *equipmentVoltageBtn;//电压 81 | QLineEdit *equipmentVoltageEdit; 82 | QPushButton *equipmentPresetABtn;//预置电流 83 | QLineEdit *equipmentPresetAEdit; 84 | QPushButton *equipmentCurrentBtn;//电流 85 | QLineEdit *equipmentCurrentEdit; 86 | 87 | //曲线绘制与视频监控部件 88 | QTabWidget *tabWidget;//将曲线绘制与视频监控放在同一页面,使用选项卡部件的切换 89 | CustomPlotWidget *customPlotWidget;//曲线绘制界面 90 | VideoMonitorWidget *videoMonitorWidget;//视频监控界面 91 | 92 | /*定义数据库对象,此时是无效的,通过静态方法database(connectionName)获取已有的数据库连接 93 | 操作同一数据库*/ 94 | QSqlDatabase db; 95 | }; 96 | 97 | #endif // INFOSHOWWIDGET_H 98 | -------------------------------------------------------------------------------- /main.cpp: -------------------------------------------------------------------------------- 1 | #include "mainwidget.h" 2 | #include 3 | #include 4 | 5 | int main(int argc, char *argv[]) 6 | { 7 | QApplication a(argc, argv); 8 | //QTextCodec::setCodecForTr(QTextCodec::codecForName("utf-8")); 9 | MainWidget w; 10 | w.resize(800,480); 11 | w.show(); 12 | 13 | //w.showFullScreen(); 14 | 15 | return a.exec(); 16 | } 17 | -------------------------------------------------------------------------------- /mainwidget.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | *@file: mianwidget.cpp 3 | *@author: 缪庆瑞 4 | *@date: 2017.3.16 5 | *@brief: 项目主界面 6 | */ 7 | #include "mainwidget.h" 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | //声明全局变量,因为是Qt类,无法再为全局对象申请空间,但至少要声明一次 14 | SoftKeyboard *softKeyboard; 15 | 16 | MainWidget::MainWidget(QWidget *parent) 17 | : QWidget(parent) 18 | { 19 | softKeyboard = new SoftKeyboard();//为全局变量对象申请空间 20 | //初始化标题label 21 | titleLabel = new QLabel(this); 22 | titleLabel->setText(tr("车间设备监测与控制系统")); 23 | titleLabel->setFixedHeight(42);//固定高度 24 | titleLabel->setAlignment(Qt::AlignCenter); 25 | titleLabel->setFont(QFont("msyh",26)); 26 | titleLabel->setFocus();//焦点设置在标题上 27 | 28 | //初始化时间按钮 29 | timeBtn = new QPushButton(this); 30 | connect(timeBtn,SIGNAL(clicked()),this,SLOT(shotScreen())); 31 | timeBtn->setEnabled(false);//需要截图时再设置使能 32 | timeBtn->setFlat(true);//无边界 33 | timeBtn->setFont(QFont("msyh",18)); 34 | timeBtn->setStyleSheet("padding: -1px;border: -1px;");//消除边框及虚线框 35 | //timeBtn->setStyleSheet("outline:none;");//消除边框及虚线框 和上一句都可以但略有差别 36 | timeBtn->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Preferred); 37 | QString dateTime = QDateTime::currentDateTime().toString("hh:mm\nyyyy-MM-dd"); 38 | timeBtn->setText(dateTime); 39 | timeTimer = new QTimer(this); 40 | connect(timeTimer,SIGNAL(timeout()),this,SLOT(refreshTimeSlot())); 41 | timeTimer->start(10000);//界面不展示秒,所以不用刷新太快 42 | //初始化tabwidget 43 | initTabWidget(); 44 | //整体界面布局 45 | QHBoxLayout *hBoxLayout = new QHBoxLayout(); 46 | hBoxLayout->setContentsMargins(1,3,1,4); 47 | hBoxLayout->addWidget(titleLabel,0,Qt::AlignLeft); 48 | hBoxLayout->addWidget(timeBtn); 49 | QGridLayout *gridLayout = new QGridLayout(this); 50 | gridLayout->setContentsMargins(1,1,1,1); 51 | gridLayout->setSpacing(0); 52 | gridLayout->addLayout(hBoxLayout,0,0,1,1); 53 | gridLayout->addWidget(tabWidget,1,0,1,1); 54 | 55 | } 56 | 57 | MainWidget::~MainWidget() 58 | { 59 | 60 | } 61 | /* 62 | *@brief: 初始化选项卡tabWidget界面 63 | *@author: 缪庆瑞 64 | *@date: 2017.3.16 65 | */ 66 | void MainWidget::initTabWidget() 67 | { 68 | tabWidget = new QTabWidget(this); 69 | tabWidget->setFocusPolicy(Qt::NoFocus);//不设置焦点,避免虚线框 70 | tabWidget->setTabPosition(QTabWidget::South);//设置选项在下方 71 | tabWidget->setFont(QFont("msyh",16)); 72 | plantGlobalWidget = new PlantGlobalWidget(this); 73 | tabWidget->addTab(plantGlobalWidget,tr("车间总况")); 74 | infoShowWidget = new InfoShowWidget(this); 75 | tabWidget->addTab(infoShowWidget,tr("信息展示")); 76 | infoCollectWidget = new InfoCollectWidget(this); 77 | tabWidget->addTab(infoCollectWidget,tr("信息汇总")); 78 | networkingWidget = new NetworkingWidget(this); 79 | tabWidget->addTab(networkingWidget,tr("网络设置")); 80 | 81 | connect(plantGlobalWidget,SIGNAL(sendEquipmentNoList(QStringList)),infoShowWidget,SLOT(updateEquipmentNoBox(QStringList))); 82 | connect(plantGlobalWidget,SIGNAL(sendEquipmentNoList(QStringList)),infoCollectWidget,SLOT(updateEqmNoBox(QStringList))); 83 | connect(plantGlobalWidget,SIGNAL(sendEquipmentData(QString,QStringList)),infoShowWidget,SLOT(setHashData(QString,QStringList))); 84 | connect(plantGlobalWidget,SIGNAL(currentTabChange(QString)),this,SLOT(changeTabSlot(QString))); 85 | connect(plantGlobalWidget,SIGNAL(sendEqmCount(int,int,int,int,int)),infoCollectWidget,SLOT(setStatusCount(int,int,int,int,int))); 86 | connect(infoShowWidget,SIGNAL(updateTableBtnName(QString)),plantGlobalWidget,SLOT(updateTableBtnName(QString))); 87 | plantGlobalWidget->getEqmStatusCount();//等待信息汇总界面申请空间并关联信号槽后,总况界面获取一次各状态设备数量并发送 88 | //设置tab选项卡按钮的样式 89 | tabWidget->setStyleSheet("::tab{" 90 | "background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1," 91 | "stop: 0 #E1E1E1, stop: 0.4 #DDDDDD,stop: 0.5 #D8D8D8, stop: 1.0 #D3D3D3); " 92 | "font: 21px \"mysh\";" 93 | "width: 100px;"//选项卡按钮宽度 94 | "border-style: solid;"//边框样式 95 | "border-color: #a3a3a3;"//边框颜色 96 | "border-width: 2px 2px 3px 1px;"//边框宽度 上右下左 97 | "border-bottom-color: #C2C7CB; " 98 | "padding: 14px;}" 99 | "::tab:selected{"//选项卡被选中时的状态 100 | "background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1," 101 | "stop: 0 #fafafa, stop: 0.4 #f4f4f4,stop: 0.5 #e7e7e7, stop: 1.0 #fafafa);" 102 | "font-size: 23px;"//字体加2号,体现选中的感觉 103 | "border-top-width: 0px;"//不显示边框上边框 104 | "border-bottom-color: red;" 105 | "color:red;}");//红色前景 106 | //qDebug()<styleSheet(); 107 | } 108 | /* 109 | *@brief: 定时刷新时间显示 110 | *@author: 缪庆瑞 111 | *@date: 2017.3.16 112 | */ 113 | void MainWidget::refreshTimeSlot() 114 | { 115 | QString dateTime = QDateTime::currentDateTime().toString("hh:mm\nyyyy-MM-dd"); 116 | timeBtn->setText(dateTime); 117 | } 118 | /* 119 | *@brief: 响应主页车间总况界面的信号,切换选项卡界面 120 | *@author: 缪庆瑞 121 | *@date: 2017.3.28 122 | *@param: equipmentNo:表示某区域的设备号,进而展示对应的信息 123 | */ 124 | void MainWidget::changeTabSlot(QString equipmentNo) 125 | { 126 | tabWidget->setCurrentIndex(1);//切换选项卡界面 127 | infoShowWidget->changeComboBoxIndex(equipmentNo);//根据点击的按钮设置展示的设备号 128 | } 129 | /* 130 | *@brief: 实现屏幕截图 131 | *@author: 缪庆瑞 132 | *@date: 2017.5.31 133 | */ 134 | void MainWidget::shotScreen() 135 | { 136 | QPixmap savePix = QPixmap::grabWindow(QApplication::desktop()->winId()); 137 | //当前日期时间 138 | QString dateTimeStr = QDateTime::currentDateTime().toString("yyyyMMdd_hhmmss"); 139 | /*这里的路径主要针对linux系统平台,如果在windows平台运行,‘/’对应程序所在 140 | * 磁盘的根目录*/ 141 | QString dirStr = "/mnt/works/images/"; 142 | QDir dir(dirStr); 143 | if(!dir.exists())//目录不存在则创建目录 144 | { 145 | qDebug()<<"create dir:"< 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include "plantglobalwidget.h" 18 | #include "infoshowwidget.h" 19 | #include "infocollectwidget.h" 20 | #include "networkingwidget.h" 21 | #include "globalvar.h" 22 | 23 | class MainWidget : public QWidget 24 | { 25 | Q_OBJECT 26 | 27 | public: 28 | MainWidget(QWidget *parent = 0); 29 | ~MainWidget(); 30 | void initTabWidget(); 31 | 32 | signals: 33 | 34 | public slots: 35 | void refreshTimeSlot();//刷新时间 36 | void changeTabSlot(QString equipmentNo);//响应主页选项卡界面的信号,切换选项卡 37 | void shotScreen();//截图 38 | 39 | private: 40 | QLabel *titleLabel;//系统名称 41 | QPushButton *timeBtn;//系统时间 42 | QTimer *timeTimer;//刷新时间的定时器 43 | QTabWidget *tabWidget;//实现选项卡式切换界面 44 | PlantGlobalWidget *plantGlobalWidget;//第一个选项卡界面,车间总况 45 | InfoShowWidget *infoShowWidget;//第二个选项卡界面,信息展示 46 | InfoCollectWidget *infoCollectWidget;//第三个选项卡界面,信息汇总 47 | NetworkingWidget *networkingWidget;//第四个选项卡界面,网络设置 48 | 49 | }; 50 | 51 | #endif // MAINWIDGET_H 52 | -------------------------------------------------------------------------------- /messagebox.cpp.autosave: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2016 Aotai Electric Co.,LTD 山东奥太电气有限公司 4 | ** All rights reserved. 5 | ** 6 | ****************************************************************************/ 7 | /* 8 | *@file: messagebox.h 9 | *@author: 缪庆瑞 10 | *@date: 2017.5.4 11 | *@brief: 消息弹出窗,在QMessageBox上封装,方便自由的调整弹出框部件大小及样式 12 | */ 13 | #include "messagebox.h" 14 | 15 | MyMessageBox::MyMessageBox() 16 | { 17 | 18 | } 19 | 20 | MyMessageBox::~MyMessageBox() 21 | { 22 | 23 | } 24 | 25 | -------------------------------------------------------------------------------- /messagebox.h.autosave: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2016 Aotai Electric Co.,LTD 山东奥太电气有限公司 4 | ** All rights reserved. 5 | ** 6 | ****************************************************************************/ 7 | /* 8 | *@file: messagebox.h 9 | *@author: 缪庆瑞 10 | *@date: 2017.5.4 11 | *@brief: 消息弹出窗,在QMessageBox上封装,方便自由的调整弹出框部件大小及样式 12 | */ 13 | #ifndef MYMESSAGEBOX_H 14 | #define MYMESSAGEBOX_H 15 | 16 | #include 17 | #include 18 | 19 | class MyMessageBox : public QMessageBox 20 | { 21 | Q_OBJECT 22 | 23 | public: 24 | MyMessageBox(); 25 | ~MyMessageBox(); 26 | 27 | static StandardButton myInfomation(); 28 | }; 29 | 30 | #endif // MYMESSAGEBOX_H 31 | -------------------------------------------------------------------------------- /mymessagebox.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | *@file: mymessagebox.h 3 | *@author: 缪庆瑞 4 | *@date: 2017.5.4 5 | *@brief: 消息弹出窗,在QMessageBox上封装,方便自由的调整弹出框部件大小及样式 6 | */ 7 | #include "mymessagebox.h" 8 | 9 | MyMessageBox::MyMessageBox() 10 | { 11 | 12 | } 13 | 14 | MyMessageBox::~MyMessageBox() 15 | { 16 | 17 | } 18 | /* 19 | *@brief: information提示框封装,改变字体和部件大小 20 | *@author: 缪庆瑞 21 | *@date: 2017.5.4 22 | *@param: parent:父对象 23 | *@param: title:标题 24 | *@param: text:展示文本 25 | *@param: fontSize:对话框字体大小 26 | *@param: button:默认添加的标准按钮 ok 27 | */ 28 | QMessageBox::StandardButton MyMessageBox::myInformation(QWidget *parent, const QString &title, const QString &text, int fontSize, QMessageBox::StandardButton button) 29 | { 30 | QMessageBox messageBox(parent); 31 | messageBox.setFont(QFont("msyh",fontSize));//字体 32 | messageBox.setWindowTitle(title);//标题 33 | messageBox.setText(text);//展示文本 34 | QPushButton *btn; 35 | btn = messageBox.addButton(button);//交互按钮 36 | btn->setFont(QFont("msyh",fontSize)); 37 | btn->setFixedSize(100,40); 38 | messageBox.setIcon(QMessageBox::Information);//设置系统的information图片 39 | messageBox.exec();//模态阻塞执行,直到窗口被关闭,或者按钮被点击 40 | return button; 41 | } 42 | /* 43 | *@brief: critical危险提示框封装,改变字体和窗体大小 44 | *@author: 缪庆瑞 45 | *@date: 2017.5.4 46 | *@param: parent:父对象 47 | *@param: title:标题 48 | *@param: text:展示文本 49 | *@param: fontSize:对话框字体大小 50 | *@param: button:默认添加的标准按钮 cancel 51 | */ 52 | QMessageBox::StandardButton MyMessageBox::myCritical(QWidget *parent, const QString &title, const QString &text, int fontSize, QMessageBox::StandardButton button) 53 | { 54 | QMessageBox messageBox(parent); 55 | messageBox.setFont(QFont("msyh",fontSize));//字体 56 | messageBox.setWindowTitle(title);//标题 57 | messageBox.setText(text);//展示文本 58 | QPushButton *btn; 59 | btn = messageBox.addButton(button);//交互按钮 60 | btn->setFont(QFont("msyh",fontSize)); 61 | btn->setFixedSize(100,40); 62 | messageBox.setIcon(QMessageBox::Critical);//设置系统的critical图片 63 | messageBox.exec();//模态阻塞执行,直到窗口被关闭,或者按钮被点击 64 | return button; 65 | } 66 | 67 | 68 | -------------------------------------------------------------------------------- /mymessagebox.h: -------------------------------------------------------------------------------- 1 | /* 2 | *@file: mymessagebox.h 3 | *@author: 缪庆瑞 4 | *@date: 2017.5.4 5 | *@brief: 消息弹出窗,在QMessageBox上封装,方便自由的调整弹出框部件大小及样式 6 | */ 7 | #ifndef MYMESSAGEBOX_H 8 | #define MYMESSAGEBOX_H 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | class MyMessageBox : public QMessageBox 16 | { 17 | Q_OBJECT 18 | 19 | public: 20 | MyMessageBox(); 21 | ~MyMessageBox(); 22 | //该方法类似于information()静态方法,只是修改了下字体和按钮大小 23 | static StandardButton myInformation(QWidget * parent, const QString & title, const QString & text, int fontSize=20,StandardButton button = Ok); 24 | //该方法类似于critical()静态方法,只是修改了下字体和按钮大小 25 | static StandardButton myCritical(QWidget * parent, const QString & title, const QString & text, int fontSize=20,StandardButton button = Cancel); 26 | protected: 27 | //void showEvent(QShowEvent *event);//QMessageBox默认不能自定义大小,由showevent()强制改变成QT认为合适的大小 28 | }; 29 | 30 | #endif // MYMESSAGEBOX_H 31 | -------------------------------------------------------------------------------- /networkingwidget.h: -------------------------------------------------------------------------------- 1 | /* 2 | *@file: networkingWidget.h 3 | *@author: 缪庆瑞 4 | *@date: 2017.5.22 5 | *@brief: 配置网络连接的界面 6 | */ 7 | #ifndef NETWORKINGWIDGET_H 8 | #define NETWORKINGWIDGET_H 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include "basetablewidget.h" 23 | #include "wificonndialog.h" 24 | #include "globalvar.h" 25 | #include "mymessagebox.h" 26 | 27 | class NetworkingWidget : public QWidget 28 | { 29 | Q_OBJECT 30 | public: 31 | explicit NetworkingWidget(QWidget *parent = 0); 32 | ~NetworkingWidget(); 33 | void initTabWidget(); 34 | 35 | void initWirelessWidget();//初始化无线设置界面 36 | void initLeftConnectionBox();//初始化无线设置界面左侧区域 37 | void initRightPropertyBox();//初始化无线设置界面右侧区域 38 | 39 | signals: 40 | 41 | public slots: 42 | void wifiSwitchSlot();//切换wifi开关 43 | void staticipOrDHCPSlot(int id);//切换DHCP或静态ip设置 44 | void scanWifi();//扫描无线网络 45 | void connectWifi(bool reconfig);//连接无线网络 46 | void getConnectStatus();//获取连接状态 47 | 48 | void selectWifi(int row,int column);//选择列表中的wifi连接 49 | void configWifi(QString wifiName,QString wifiPasswd); 50 | 51 | void keyboardSlot(QString text);//处理软键盘信号的槽 52 | void saveSlot();//保存静态ip设置 53 | 54 | protected: 55 | virtual bool eventFilter(QObject *obj,QEvent *event); 56 | 57 | private: 58 | QTabWidget *tabWidget;//实现选项卡式切换界面 无线-有线设置 59 | 60 | QWidget *wirelessWidget;//无线设置界面 61 | QVBoxLayout *vBoxLayout;//左侧布局 62 | QVBoxLayout *vBoxLayout2;//右侧布局 63 | QLineEdit *tempEdit;//用来记录当前引发事件过滤器处理的edit部件 64 | //左侧连接界面 65 | QGroupBox *connectionBox; 66 | QLabel *swicthLabel; 67 | QPushButton *switchBtn;//无线开关切换 68 | bool isWifiOn;//标记wifi开启/关闭状态 69 | BaseTableWidget *currentConnection;//当前连接的wifi 70 | QLabel *selectableConnectionLabel; 71 | QPushButton *scanBtn;//扫描按钮 72 | BaseTableWidget *selectableConnection;//可选的连接 73 | //右侧属性界面 74 | QGroupBox *propertyBox; 75 | QButtonGroup *buttonGroup; 76 | QRadioButton *DHCPBtn;//动态获取ip 77 | QRadioButton *staticBtn;//静态设置ip等 78 | bool isDHCPOn;//标记DHCP/静态ip 状态 79 | QPushButton *saveBtn;//保存静态ip设置 80 | QFrame *staticFrame; 81 | QLabel *ipAddrLabel; 82 | QLabel *subMaskLabel; 83 | QLabel *defaultGatewayLabel; 84 | QLabel *DNSServerLabel1; 85 | QLabel *DNSServerLabel2; 86 | QLineEdit *ipAddr;//ip地址 87 | QLineEdit *subMask;//子网掩码 88 | QLineEdit *defaultGateway;//默认网关 89 | QLineEdit *DNSServer1;//首选DNS服务器 90 | QLineEdit *DNSServer2;//备用DNS服务器 91 | 92 | }; 93 | 94 | #endif // NETWORKINGWIDGET_H 95 | -------------------------------------------------------------------------------- /plantMonitorSys.pro: -------------------------------------------------------------------------------- 1 | #------------------------------------------------- 2 | # 3 | # Project created by QtCreator 2017-03-16T13:53:28 4 | # 5 | #------------------------------------------------- 6 | 7 | QT += core gui network sql 8 | 9 | greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport 10 | 11 | TARGET = plantMonitorSys 12 | TEMPLATE = app 13 | 14 | #imx6ul的qt5.6.2环境下没有gl3的头文件和库,而qcustomplot.h会通过 15 | #----最终包含"qopengl.h",在该头文件默认会 16 | #包含gl3.h,导致找不到头文件编译失败。所以这里定义宏声明不使用ES_3,这样默认会用ES_2就没问题了 17 | DEFINES += QT_NO_OPENGL_ES_3#imx6ul qcustomplot 18 | #DEFINES += VIDEO_CAPTURE #视频采集功能开启,使用linux的v4l2采集 19 | #DEFINES += VIDEO_ENCODE_SAVE #视频编码保存功能开启,需要特定平台的库,并开启视频采集功能 20 | 21 | SOURCES += main.cpp\ 22 | mainwidget.cpp \ 23 | plantglobalwidget.cpp \ 24 | equipmentinfothread.cpp \ 25 | infoshowwidget.cpp \ 26 | basetableitem.cpp \ 27 | basetablewidget.cpp \ 28 | addequipment.cpp \ 29 | customplotwidget.cpp \ 30 | qcustomplot/qcustomplot.cpp \ 31 | infocollectwidget.cpp \ 32 | mymessagebox.cpp \ 33 | softkeyboard/softkeyboard.cpp \ 34 | videomonitorwidget.cpp \ 35 | networkingwidget.cpp \ 36 | wificonndialog.cpp 37 | 38 | HEADERS += mainwidget.h \ 39 | plantglobalwidget.h \ 40 | equipmentinfothread.h \ 41 | infoshowwidget.h \ 42 | basetableitem.h \ 43 | basetablewidget.h \ 44 | addequipment.h \ 45 | customplotwidget.h \ 46 | qcustomplot/qcustomplot.h \ 47 | infocollectwidget.h \ 48 | mymessagebox.h \ 49 | softkeyboard/softkeyboard.h \ 50 | globalvar.h \ 51 | videomonitorwidget.h \ 52 | networkingwidget.h \ 53 | wificonndialog.h 54 | 55 | RESOURCES += \ 56 | images.qrc 57 | 58 | #视频采集功能相关文件 59 | if(contains(DEFINES,VIDEO_CAPTURE)){ 60 | HEADERS += videocapture.h 61 | SOURCES += videocapture.cpp 62 | } 63 | 64 | #视频编码保存功能相关文件 65 | if(contains(DEFINES,VIDEO_ENCODE_SAVE)){ 66 | HEADERS += videoencode.h 67 | SOURCES += videoencode.cpp 68 | 69 | LIBS += -L./ffmpeg/lib -lavcodec 70 | LIBS += -L./ffmpeg/lib -lavformat 71 | LIBS += -L./ffmpeg/lib -lavutil 72 | LIBS += -L./ffmpeg/lib -lx264 73 | } 74 | -------------------------------------------------------------------------------- /plantglobalwidget.h: -------------------------------------------------------------------------------- 1 | /* 2 | *@file: plantglobalwidget.h 3 | *@author: 缪庆瑞 4 | *@date: 2017.3.17 5 | *@brief: 车间概况总汇部件,通过按钮表示设备,通过颜色表示状态 6 | */ 7 | #ifndef PLANTGLOBALWIDGET_H 8 | #define PLANTGLOBALWIDGET_H 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include "basetablewidget.h" 20 | #include "equipmentinfothread.h" 21 | #include "addequipment.h" 22 | #include "mymessagebox.h" 23 | 24 | class PlantGlobalWidget : public QWidget 25 | { 26 | Q_OBJECT 27 | public: 28 | explicit PlantGlobalWidget(QWidget *parent = 0); 29 | ~PlantGlobalWidget(); 30 | void initEquipmentNoBtn();//初始化设备号按钮 31 | void initStatusGroupAreaC();//初始化设备状态展示组C区 32 | bool createConnection(QString databaseName,QString connectionName);//创建数据库连接 33 | void saveDataToDb(QString tableNameSuffix,QString date,QString time,double voltage,int current);//保存实时数据到数据库 34 | void getEqmStatusCount();//获取各个状态的设备数量 35 | 36 | signals: 37 | //以下信号都是为了实现车间总况和信息展示页面的交流 38 | void currentTabChange(QString equipmentNo);//改变选项卡界面的信号,参数对应区域的设备号 39 | void sendEquipmentNoList(QStringList equipmentNoList);//发送从数据库读到的所有设备号 40 | void sendEquipmentData(QString equipmentNo,QStringList equipmentDataList);//发送设备实时数据到展示页 41 | //该信号是关联车间总况页面与设备信息采集线程 42 | void replyDataToClient(QStringList);//告诉服务器线程向客户端回复数据,模拟控制 43 | //该信号是为了实现车间总况与信息汇总页面的交流 44 | void sendEqmCount(int all,int offline,int standby,int run,int warning);//向信息汇总界面发送各状态设备数量 45 | 46 | public slots: 47 | void getEquipmentInfoSlot(); 48 | void addEquipmentASlot(); 49 | void addEquipmentBSlot(); 50 | void updateTable();//重新读取数据库更新表格 51 | void handleEquipmentInfoSlot(QStringList infoList);//处理线程发来的设备信息 52 | void disconnectSlot(QString ipAddr);//客户端断开连接的处理槽 53 | 54 | void updateTableBtnName(QString equipmentNo);//更新设备的显示名字 55 | 56 | private: 57 | QPushButton *addBtnA;//添加A区设备按钮 58 | QPushButton *addBtnB;//添加B区设备按钮 59 | //A区 60 | QGroupBox *plantAreaA;//车间A区 61 | QHBoxLayout *hBoxLayoutA;//A区上的布局 62 | BaseTableWidget *tableWidgetA;//自定义的表格部件,存放区域设备按钮 63 | QList itemsA;//存放当前表格中的按钮序列 64 | //B区 65 | QGroupBox *plantAreaB;//车间B区 66 | QHBoxLayout *hBoxLayoutB;//B区上的布局 67 | BaseTableWidget *tableWidgetB; 68 | QList itemsB; 69 | //C区 70 | QWidget *statusGroupAreaC;//设备状态展示组C区 71 | QStringList statusColor;//存储一组对应不同状态的颜色 按钮 72 | QStringList editStatusColor;//存储一组对应不同状态的颜色 编辑框 73 | QPushButton *statusBtn[4]; 74 | QLabel *statusLabel[4]; 75 | 76 | EquipmentInfoThread *equipmentInfothread;//运行在子线程中的对象 77 | QThread *threadA;//开启子线程 78 | 79 | /*数据库管理对象 不需要将数据库crud操作封装成类,因为QsqlQuery本身使用就比较方便, 80 | 且封装成类对select操作的返回值还需处理,有点多余,故直接用数据库对象创建连接后,通过 81 | QsqlQuery执行sql命令*/ 82 | QSqlDatabase db; 83 | 84 | AddEquipment *addEquipmentDialog;//添加设备的对话框 85 | }; 86 | 87 | #endif // PLANTGLOBALWIDGET_H 88 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # plantMonitorSys 2 | 这是个人本科毕业设计作品的主程序,运行在嵌入式终端,采用C/S通信模式,作为服务器工作,监测和控制车间设备的运行。 3 | ## 功能概述: 4 | 本设计推出了一种基于WIFI网络的车间设备监测与控制系统。 5 | 硬件上采用德州仪器公司Cortex-A8架构的ARM处理器作为主控芯片,选用了IAC-335X-Kit开发板进行系统设计,外接USB摄像头模块和WIFI无线模块进行视频采集和数据传输。软件上以嵌入式Linux系统作为软件平台,通过WIFI无线网络技术连接车间的各个设备。将生产数据精确、客观的收集,并对其统计分析,以提升企业的生产管理效率。同时系统使用QT开发上位机软件GUI界面,提供良好的人机交互,供企业管理者对车间设备集中式监测与控制,为打造数字化工厂奠定基础。本设计相较于基于有线网络的监测控制系统,采用WIFI 网络更加便捷、灵活,减小了传统网络布线的实施限制和维护费用,降低了企业的成本投资。 6 | ## 运行截图: 7 | ![1.png](./screenshot/1.png "1.png") 8 | ![2.png](./screenshot/2.png "2.png") 9 | ![3.png](./screenshot/3.png "3.png") 10 | ![4.png](./screenshot/4.png "4.png") 11 | ![5.png](./screenshot/5.png "5.png") 12 | ![6.png](./screenshot/6.png "6.png") 13 | ![7.png](./screenshot/7.png "7.png") 14 | ![8.png](./screenshot/8.png "8.png") 15 | ![9.png](./screenshot/9.png "9.png") 16 | ![10.png](./screenshot/10.png "10.png") 17 | ![11.png](./screenshot/11.png "11.png") 18 | ![12.png](./screenshot/12.png "12.png") 19 | ![13.png](./screenshot/13.png "14.png") 20 | ## 作者联系方式 21 | **邮箱:justdoit_mqr@163.com** 22 | **新浪微博:@为-何-而来** 23 | -------------------------------------------------------------------------------- /screenshot/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justdoit-mqr/plantMonitorSys/7ecb02b3e404b2f9f11a9e7d674c34bad5f09ee6/screenshot/1.png -------------------------------------------------------------------------------- /screenshot/10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justdoit-mqr/plantMonitorSys/7ecb02b3e404b2f9f11a9e7d674c34bad5f09ee6/screenshot/10.png -------------------------------------------------------------------------------- /screenshot/11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justdoit-mqr/plantMonitorSys/7ecb02b3e404b2f9f11a9e7d674c34bad5f09ee6/screenshot/11.png -------------------------------------------------------------------------------- /screenshot/12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justdoit-mqr/plantMonitorSys/7ecb02b3e404b2f9f11a9e7d674c34bad5f09ee6/screenshot/12.png -------------------------------------------------------------------------------- /screenshot/13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justdoit-mqr/plantMonitorSys/7ecb02b3e404b2f9f11a9e7d674c34bad5f09ee6/screenshot/13.png -------------------------------------------------------------------------------- /screenshot/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justdoit-mqr/plantMonitorSys/7ecb02b3e404b2f9f11a9e7d674c34bad5f09ee6/screenshot/2.png -------------------------------------------------------------------------------- /screenshot/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justdoit-mqr/plantMonitorSys/7ecb02b3e404b2f9f11a9e7d674c34bad5f09ee6/screenshot/3.png -------------------------------------------------------------------------------- /screenshot/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justdoit-mqr/plantMonitorSys/7ecb02b3e404b2f9f11a9e7d674c34bad5f09ee6/screenshot/4.png -------------------------------------------------------------------------------- /screenshot/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justdoit-mqr/plantMonitorSys/7ecb02b3e404b2f9f11a9e7d674c34bad5f09ee6/screenshot/5.png -------------------------------------------------------------------------------- /screenshot/6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justdoit-mqr/plantMonitorSys/7ecb02b3e404b2f9f11a9e7d674c34bad5f09ee6/screenshot/6.png -------------------------------------------------------------------------------- /screenshot/7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justdoit-mqr/plantMonitorSys/7ecb02b3e404b2f9f11a9e7d674c34bad5f09ee6/screenshot/7.png -------------------------------------------------------------------------------- /screenshot/8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justdoit-mqr/plantMonitorSys/7ecb02b3e404b2f9f11a9e7d674c34bad5f09ee6/screenshot/8.png -------------------------------------------------------------------------------- /screenshot/9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justdoit-mqr/plantMonitorSys/7ecb02b3e404b2f9f11a9e7d674c34bad5f09ee6/screenshot/9.png -------------------------------------------------------------------------------- /softkeyboard/softkeyboard.h: -------------------------------------------------------------------------------- 1 | /* 2 | *@file: softkeyboard.h 3 | *@author: 缪庆瑞 4 | *@date: 2016.12.25 5 | *@brief: 软键盘部件,实现中英文输入 6 | */ 7 | #ifndef SOFTKEYBOARD_H 8 | #define SOFTKEYBOARD_H 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | 22 | class SoftKeyboard : public QWidget 23 | { 24 | Q_OBJECT 25 | public: 26 | explicit SoftKeyboard(QWidget *parent = 0); 27 | ~SoftKeyboard(); 28 | void readDictionary();//读拼音字典,将汉字与拼音的对应存放到hash表中 29 | void splitPhrase(QString phrase,QString chinese);//拆分拼音词组 30 | void initStyleSheet();//初始化可选样式表,用于不同的皮肤展示 31 | void initFirstArea();//初始化第一部分 输入缓存,确定 退出 32 | void initSecondArea();//初始化第二部分 输入显示区域 33 | void initThirdArea();//初始化第三部分 按键区域 34 | 35 | void initNumberLetterBtn();//初始化数字字母按键,分配空间,连接信号与槽 36 | void initSpecialBtn();//初始化特殊功能按键,诸如大小写切换,删除按键等 37 | void initKeyboardStyle(int num);//初始化键盘样式 38 | 39 | void setLetterLow();//设置小写字母显示 40 | void setLetterUpper();//设置大写字母显示 41 | void setSymbolsEN();//设置符号(英文状态) 42 | void setSymbolsCH();//设置符号(中文状态) 43 | 44 | void matchChinese(QString pinyin);//根据输入的拼音匹配中文 45 | void displayCandidateWord(int page);//显示指定页的候选词 46 | 47 | void setInputText(QString inputText);//设置输入缓冲区行编辑框文本 48 | 49 | signals: 50 | void sendText(QString text);//以信号的形式将输入文本发出去 51 | public slots: 52 | void numberLetterBtnSlot();//数字字母(符号)按键被点击的响应槽 53 | 54 | void candidateLetterChangedSlot(QString text);//候选字母改变响应槽 55 | void candidateWordBtnSlot();//候选词被点击的响应槽 56 | void candidateWordPrePageSlot();//候选词向前翻页 57 | void candidateWordNextPageSlot();//候选词向后翻页 58 | void hideInputDiaplayArea();//隐藏输入显示区域 59 | 60 | void changeUpperLowerSlot();//切换大小写,也可以切换数字字母与符号界面 61 | void deleteTextSlot();//删除输入 62 | void closeDelTimer();//关闭连续删除的定时器 63 | void changeSkinSlot();//切换皮肤 64 | void changeLetterSymbolSlot();//数字字母与字符切换 65 | void spaceSlot();//空格被按下时的响应槽 66 | void changeChEnSlot();//中英文切换 67 | void enterSlot();//回车被按下的响应槽 68 | 69 | void quitBtnSlot();//退出按钮的响应槽 70 | void okBtnSlot();//确定按钮的响应槽 71 | 72 | private: 73 | QMultiHash chinesePinyin;//使用哈希表来存放拼音汉字的键值对 可以一键多值 74 | QList hanzi;//存储匹配的汉字词 75 | int pageCount;//候选词当前页 76 | bool isENInput;//中英文输入模式 77 | bool isLetterInput;//数字字母或符号输入模式 78 | bool isLetterLower;//大小写模式 79 | int skinNum;//标记当前皮肤编号 80 | 81 | QTimer *delTimer;//实现长按删除键 删除定时 82 | 83 | QVBoxLayout *globalVLayout; 84 | //第一部分 输入缓存区 85 | QWidget *textBufferArea;//键盘的输入缓存区 86 | QLineEdit *lineEdit; 87 | QPushButton *okBtn; 88 | QPushButton *quitBtn; 89 | //第二部分 输入显示区域 中文输入特有区域 90 | QWidget *inputDisplayArea;//键盘的输入显示区域 91 | QLineEdit *candidateLetter;//中文输入时对应的字母显示 92 | QWidget *candidateWordArea;//候选词区域 在上面布局中有六个候选词和翻页按钮 93 | QPushButton *candidateWordBtn[6];//中文输入时的候选词 94 | QPushButton *prePageBtn;//前一页 95 | QPushButton *nextPageBtn;//后一页 96 | //第三部分 键盘按键区域 97 | QWidget *keyBoardArea;//键盘的按键区域 98 | QPushButton *numberLetterBtn[36];//10个数字按键,26个字母按键,同时可以显示符号 99 | //特殊功能按键 100 | QPushButton *upperOrLowerBtn;//大小写转换按键 101 | QPushButton *deleteBtn;//删除按键 102 | QPushButton *skinBtn;//切换皮肤 103 | QPushButton *letterOrSymbolBtn;//数字字母与符号切换按键 104 | QPushButton *commaBtn;//逗号按键 105 | QPushButton *spaceBtn;//空格按键 106 | QPushButton *periodBtn;//句号按键 107 | QPushButton *chOrEnBtn;//中英文切换按键 108 | QPushButton *enterBtn;//回车按键 109 | //按键以及整个键盘的样式 110 | QStringList keyAndCandidateAreaStyle;//按键和候选词widget区域样式 111 | QStringList commonKeyStyle;//普通按键的样式 112 | QStringList specialKeyStyle;//特殊按键的样式 113 | }; 114 | 115 | #endif // SOFTKEYBOARD_H 116 | -------------------------------------------------------------------------------- /videocapture.h: -------------------------------------------------------------------------------- 1 | /*视频采集捕获处理类*/ 2 | #ifndef VIDEOCAPTURE_H 3 | #define VIDEOCAPTURE_H 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include //v4l2驱动程序的头文件 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include //用于线程的互斥锁 23 | #include 24 | 25 | #ifdef VIDEO_ENCODE_SAVE 26 | /*该头文件用于视频保存操作,只需要实时显示不保存文件的话就不需要,因为视频保存操作 27 | 涉及帧的编码操作,需要一些库的支持*/ 28 | #include "videoencode.h" 29 | #endif 30 | 31 | #define IMAGEWIDTH (320) 32 | #define IMAGEHEIGHT (240) 33 | 34 | #define BUFFERCOUNT (3)//缓冲区的数量,视频帧按队列顺序刷新,太多的话可能会造成视频有延迟 35 | typedef unsigned int uint; 36 | typedef unsigned char uchar; 37 | 38 | class VideoCapture:public QObject 39 | { 40 | Q_OBJECT 41 | public: 42 | //视频采集相关函数 43 | VideoCapture(); 44 | ~VideoCapture(); 45 | bool initGlobal();//对视频采集的整体初始化 46 | bool openDevice(); 47 | void initDevice(); 48 | void initMmap(); 49 | void start(); 50 | void stop(); 51 | void getFrame(void *rgbFrameAddr); 52 | void unGetFrame(); 53 | void unInitMmap(); 54 | void closeDevice(); 55 | 56 | bool getVideoEqmExistStatus(); 57 | 58 | //视频帧格式转换 59 | int convert_yuv_to_rgb_pixel(int y,int u,int v); 60 | void convert_yuv_to_rgb_buffer(uchar *yuv,uchar *rgb,uint width,uint height); 61 | 62 | bool unMmap;//表示是否需要主线程卸载内存映射 63 | 64 | public slots: 65 | #ifdef VIDEO_ENCODE_SAVE 66 | //视频保存相关函数 67 | void getAndSaveFrame(); 68 | void startRecord(); 69 | void stopRecord(); 70 | #endif 71 | 72 | void hotplugSlot(); 73 | 74 | private: 75 | /*定义结构体来映射每一个缓冲帧*/ 76 | struct buffer 77 | { 78 | void * addr;//缓冲帧映射到内存中的起始地址 79 | uint length;//缓冲帧映射到内存中的长度 80 | }*bufPtr; 81 | int fd;//设备文件描述符 82 | uint numBuf;//缓冲帧序号 83 | int index;//标记缓冲区序号 84 | 85 | void *yuvFrameAddr; 86 | 87 | QTimer *hotplugTimer;//定时获取采集设备的状态,实现热插拔 88 | bool videoEqmExist;//标记设备是否存在 89 | char videoEqmName[30];//视频设备文件名称及路径 90 | #ifdef VIDEO_ENCODE_SAVE 91 | //视频保存 92 | VideoEncode *videoEncode;//视频编码操作保存文件的对象 93 | QTimer *timer;//定时编码保存视频帧 94 | #endif 95 | 96 | void *yuv422Frame; 97 | QMutex mutex; 98 | }; 99 | #endif //VIDEOCAPTURE_H 100 | 101 | -------------------------------------------------------------------------------- /videoencode.h: -------------------------------------------------------------------------------- 1 | /* 2 | *@file: videoencode.h 3 | *@author: 缪庆瑞 4 | *@date: 2017.5.12 5 | *@brief: 通过ffmpeg相关视频编解码库实现对原始数据帧的编码,输出视频文件,使用了avcodec 6 | * 等相关的视频编解码库,需要包含相关的头文件,编译时也要在pro文件中添加相应的库,例、 7 | * LIBS += -L./ffmpeg/lib -lavcodec 8 | */ 9 | #ifndef VIDEOENCODE_H 10 | #define VIDEOENCODE_H 11 | 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | /*编解码库的头文件,以C语言引入,避免因为C与C++ 编译后的函数名不一致,无法 18 | 链接*/ 19 | extern "C" 20 | { 21 | #include "ffmpeg/include/avcodec.h" 22 | #include "ffmpeg/include/avformat.h" 23 | #include "ffmpeg/include/swscale.h" 24 | } 25 | 26 | class VideoEncode : public QObject 27 | { 28 | Q_OBJECT 29 | public: 30 | explicit VideoEncode(QObject *parent = 0); 31 | ~VideoEncode(); 32 | //转换yuyv422格式帧为yuv420p 33 | void YUYV422ToYUV420P(uchar *YUV422, uchar *YUV420, int width, int height); 34 | //初始化保存视频的相关处理 35 | void initVideoProcess(QByteArray filename); 36 | //编码保存视频帧 37 | void videoProcess(uchar *YUV420); 38 | //结束视频保存 39 | void finishVideoProcess(); 40 | 41 | private: 42 | //转换yuyv422格式帧为yuv420p  该函数仅供YUYV422ToYUV420P()内部调用 43 | void yuyv422_to_yuv420p(AVFrame *dst, const AVFrame *src,int width, int height); 44 | 45 | signals: 46 | 47 | public slots: 48 | 49 | private: 50 | AVCodecContext *codecContext;//描述编解码器上下文 51 | AVFormatContext *formatContext;//解封装 52 | AVStream *stream;//存储视频流信息 53 | AVFrame *rawFrame;//存储原始数据信息 54 | 55 | uchar *rawFrame_buf;//原始帧内存地址 56 | uchar *video_outbuf;//转换格式后的原始帧的输出缓冲区 57 | int video_outbuf_size;//申请的输出缓冲区空间大小 58 | 59 | //YUYV422ToYUV420P()转换函数中的变量 60 | uint8_t *data_srcBuf;//原yuyv422数据帧内存地址 61 | uint8_t *data_dstBuf;//转换后的yuv420p数据帧内存地址 62 | AVFrame *srcBuf ;//原视频帧,除了包含采集的数据帧(data_srcBuf)还有其他信息 63 | AVFrame *dstBuf;//转换后的视频帧 64 | 65 | }; 66 | 67 | #endif // VIDEOENCODE_H 68 | -------------------------------------------------------------------------------- /videomonitorwidget.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | *@file: videomonitorwidget.h 3 | *@author: 缪庆瑞 4 | *@date: 2017.5.10 5 | *@brief: 显示实时监控视频的类,该类主要调用VideoCapture类的方法完成视频帧的采集,然后 6 | * 对采集到的帧格式处理成图片显示。 7 | */ 8 | #include "videomonitorwidget.h" 9 | #include 10 | #include 11 | 12 | #define IMAGEFORMAT QImage::Format_RGB888 13 | 14 | VideoMonitorWidget::VideoMonitorWidget(QWidget *parent) : QWidget(parent) 15 | { 16 | #ifdef VIDEO_CAPTURE 17 | videoCapture = new VideoCapture();//视频采集对象 18 | threadB = new QThread();//视频采集保存单开一个线程 19 | videoCapture->moveToThread(threadB);//通过该操作将videoCapture对象的操作放在了子线程中 20 | //qDebug()<<"sub thread:"<thread(); 21 | #ifdef VIDEO_ENCODE_SAVE 22 | connect(this,SIGNAL(startRecordSignal()),videoCapture,SLOT(startRecord())); 23 | connect(this,SIGNAL(stopRecordSignal()),videoCapture,SLOT(stopRecord())); 24 | #endif 25 | threadB->start(); 26 | initStatus = false;//视频设备初始化状态 27 | 28 | rgbFrame = (uchar *)malloc(IMAGEWIDTH*IMAGEHEIGHT*3*sizeof(char));//为图像分配内存空间 29 | image = new QImage(rgbFrame,IMAGEWIDTH,IMAGEHEIGHT,IMAGEFORMAT);//根据内存空间创建图像 30 | 31 | timer = new QTimer(this);//定时获取视频帧 32 | connect(timer,SIGNAL(timeout()),this,SLOT(getFrameSlot())); 33 | timer->start(100); 34 | #endif 35 | 36 | videoOutput = new QLabel();//展示视频画面 37 | videoOutput->setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Preferred); 38 | videoOutput->setFont(QFont("msyh",30)); 39 | videoOutput->setAlignment(Qt::AlignCenter); 40 | videoOutput->setScaledContents(true);//按照label的大小放缩视频 41 | videoOutput->setStyleSheet("border:2px solid black;"); 42 | QString styleSheetString("font: 20px \"msyh\";"); 43 | startRecordVideoBtn = new QPushButton(tr("开始录制"),this); 44 | startRecordVideoBtn->setStyleSheet(styleSheetString); 45 | startRecordVideoBtn->setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Preferred); 46 | startRecordVideoBtn->setEnabled(false); 47 | connect(startRecordVideoBtn,SIGNAL(clicked()),this,SLOT(startRecordSlot())); 48 | stopRecordVideoBtn = new QPushButton(tr("结束录制"),this); 49 | stopRecordVideoBtn->setStyleSheet(styleSheetString); 50 | stopRecordVideoBtn->setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Preferred); 51 | stopRecordVideoBtn->setEnabled(false); 52 | connect(stopRecordVideoBtn,SIGNAL(clicked()),this,SLOT(stopRecordSlot())); 53 | 54 | QGridLayout *gridLayout = new QGridLayout(this); 55 | gridLayout->setMargin(1); 56 | gridLayout->addWidget(videoOutput,0,0,5,3); 57 | gridLayout->addWidget(startRecordVideoBtn,1,3,1,1); 58 | gridLayout->addWidget(stopRecordVideoBtn,3,3,1,1); 59 | } 60 | 61 | VideoMonitorWidget::~VideoMonitorWidget() 62 | { 63 | #ifdef VIDEO_CAPTURE 64 | threadB->quit(); 65 | threadB->deleteLater(); 66 | videoCapture->deleteLater(); 67 | #endif 68 | } 69 | /* 70 | *@brief: 绘图事件处理函数,这里用来对视频采集设备进行初始化 71 | *@author: 缪庆瑞 72 | *@date: 2017.5.10 73 | *@param: event:绘图事件 74 | */ 75 | void VideoMonitorWidget::paintEvent(QPaintEvent *event) 76 | { 77 | #ifdef VIDEO_CAPTURE 78 | //qDebug()<<"paintevent"<getVideoEqmExistStatus()) 81 | { 82 | if(videoCapture->unMmap)//判断是否需要主线程卸载视频采集设备的内存映射 83 | { 84 | videoCapture->unInitMmap(); 85 | videoCapture->unMmap = false; 86 | } 87 | initStatus = false; 88 | } 89 | if(!initStatus)//设备尚未初始化 90 | { 91 | if(!videoCapture->initGlobal())//设备初始化失败 92 | { 93 | videoOutput->setText(tr("未检测到\n视频采集设备!!")); 94 | startRecordVideoBtn->setEnabled(false); 95 | stopRecordVideoBtn->setEnabled(false); 96 | return; 97 | } 98 | else //设备初始化完成 99 | { 100 | initStatus = true; 101 | videoCapture->start();//开启视频采集 102 | startRecordVideoBtn->setEnabled(true); 103 | stopRecordVideoBtn->setEnabled(false); 104 | } 105 | } 106 | #else 107 | videoOutput->setText(tr("视频采集\n功能已禁用!!")); 108 | startRecordVideoBtn->setEnabled(false); 109 | stopRecordVideoBtn->setEnabled(false); 110 | #endif 111 | QWidget::paintEvent(event); 112 | } 113 | /* 114 | * 115 | *@brief: 开始视频录制 116 | *@author: 缪庆瑞 117 | *@date: 2017.5.12 118 | */ 119 | void VideoMonitorWidget::startRecordSlot() 120 | { 121 | QDir dir("/mnt/mtd/video");//视频的保存路径,这里使用网络挂载 122 | //system("umount /mnt/mtd");//先卸载挂载 123 | if(system("ping 192.168.43.112 -w 2"))//测试网络是否通,-w 2表示两秒后自动退出,通返回0 124 | { 125 | MyMessageBox::myInformation(this,"Information",tr("请确定已成功挂载\n外部存储介质?")); 126 | return; 127 | } 128 | system("mount -t nfs -o nolock 192.168.43.112:/root /mnt/mtd");//执行成功返回0 129 | if(!dir.exists())//视频路径不存在,即没挂载上 130 | { 131 | MyMessageBox::myInformation(this,"Information",tr("请确定已成功挂载\n外部存储介质?")); 132 | return; 133 | } 134 | startRecordVideoBtn->setText(tr("正在录制...")); 135 | startRecordVideoBtn->setEnabled(false); 136 | stopRecordVideoBtn->setEnabled(true); 137 | /*此时videoCapture对象的操作在子线程中进行,但如果在主线程中通过对象直接调用方法(此处 138 | 为startRecord()),那么该方法实际是在主线程中执行的,所以就会遇到一个问题:即videoCapture中 139 | 有一个QTimer定时器,连接了信号与槽。因为videoCapture在子线程中,自然QTimer也在子线程中 140 | 但如果通过此处直接调用startRecord(),会发生在主线程中启动定时器,这样在子线程中的槽函数就不会 141 | 响应*/ 142 | //videoCapture->startRecord(); 143 | //通过发送信号的形式,激发子线程的槽函数,这样槽函数也是在子线程中执行的 144 | emit startRecordSignal(); 145 | } 146 | /* 147 | *@brief: 停止视频录制 148 | *@author: 缪庆瑞 149 | *@date: 2017.5.12 150 | */ 151 | void VideoMonitorWidget::stopRecordSlot() 152 | { 153 | stopRecordVideoBtn->setEnabled(false); 154 | startRecordVideoBtn->setText(tr("开始录制")); 155 | startRecordVideoBtn->setEnabled(true); 156 | //videoCapture->stopRecord(); 157 | emit stopRecordSignal(); 158 | } 159 | #ifdef VIDEO_CAPTURE 160 | /* 161 | *@brief: 获取采集的视频帧 162 | *@author: 缪庆瑞 163 | *@date: 2017.5.12 164 | */ 165 | void VideoMonitorWidget::getFrameSlot() 166 | { 167 | //qDebug()<<"getFrame:"<isVisible())//仅当设备完成初始化且当前界面被展示才获取界面 169 | { 170 | videoCapture->getFrame((void *)rgbFrame);//获取一帧RGB格式图片流 171 | image->loadFromData((uchar *)rgbFrame,IMAGEWIDTH*IMAGEHEIGHT*3*sizeof(char));//rgb格式图片流生成QImage图片 172 | videoOutput->setPixmap(QPixmap::fromImage(*image));//屏幕显示 173 | update();//刷新显示 174 | } 175 | //刷新显示放在if条件之外可以不断的执行paintEvent(),自动的探测采集设备的插拔状态 176 | //update(); 177 | } 178 | #endif 179 | -------------------------------------------------------------------------------- /videomonitorwidget.h: -------------------------------------------------------------------------------- 1 | /* 2 | *@file: videomonitorwidget.h 3 | *@author: 缪庆瑞 4 | *@date: 2017.5.10 5 | *@brief: 显示实时监控视频的类,该类主要调用VideoCapture类的方法完成视频帧的采集,然后 6 | * 对采集到的帧格式处理成图片显示。 7 | */ 8 | #ifndef VIDEOMONITORWIDGET_H 9 | #define VIDEOMONITORWIDGET_H 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include "mymessagebox.h" 20 | 21 | #ifdef VIDEO_CAPTURE 22 | #include "videocapture.h"//视频采集处理类 23 | #endif 24 | 25 | class VideoMonitorWidget : public QWidget 26 | { 27 | Q_OBJECT 28 | public: 29 | explicit VideoMonitorWidget(QWidget *parent = 0); 30 | ~VideoMonitorWidget(); 31 | 32 | protected: 33 | virtual void paintEvent(QPaintEvent *event); 34 | 35 | signals: 36 | /*开始与结束录制的信号 用来关联子线程videoCapture的槽,这样视频编码保存的处理均在 37 | * 子线程中完成。如果直接在主线程调用videoCapture编码保存视频的方法,那么即便videoCapture 38 | * 被move到子线程,编码保存处理还是在主线程,引起界面卡顿。 39 | */ 40 | void startRecordSignal(); 41 | void stopRecordSignal(); 42 | 43 | public slots: 44 | void startRecordSlot();//开始录制 会进行视频编码操作保存成文件 45 | void stopRecordSlot();//停止录制 46 | #ifdef VIDEO_CAPTURE 47 | void getFrameSlot();//获取采集的视频帧 48 | #endif 49 | 50 | private: 51 | #ifdef VIDEO_CAPTURE 52 | QThread *threadB;//视频采集放在线程中进行 53 | VideoCapture *videoCapture;//视频采集对象 54 | bool initStatus;//视频设备初始化状态 55 | uchar *rgbFrame;//RGB格式图像的起始地址 56 | QImage *image;//QImage图像 57 | QTimer *timer;//定时获取视频帧,同时也用来定时检测usb摄像设备的插拔状态 58 | #endif 59 | 60 | QLabel *videoOutput;//展示视频画面 61 | QPushButton *startRecordVideoBtn;//开始录制视频的按钮 62 | QPushButton *stopRecordVideoBtn;//停止录制 63 | 64 | }; 65 | 66 | #endif // VIDEOMONITORWIDGET_H 67 | -------------------------------------------------------------------------------- /wificonndialog.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | *@file: wificonndialog.cpp 3 | *@author: 缪庆瑞 4 | *@date: 2017.5.24 5 | *@brief: 连接wifi输入密码的界面 6 | */ 7 | #include "wificonndialog.h" 8 | #include 9 | #include 10 | 11 | WifiConnDialog::WifiConnDialog(QString name, QWidget *parent): 12 | QDialog(parent) 13 | { 14 | QFont font("msyh",20); 15 | this->setFont(font); 16 | this->setWindowTitle(tr("连接WIFI......")); 17 | this->resize(320,200); 18 | this->setModal(true);//将对话框设置为模态,默认为应用模态:阻塞所有的窗口输入 19 | //窗口模态,仅阻塞父窗口及以上的窗口,以免阻塞对话框的子窗口-软键盘无法输入 20 | this->setWindowModality(Qt::WindowModal); 21 | QLabel *wifiNameLabel = new QLabel(tr("无线名称:")); 22 | wifiNameLabel->setFont(font); 23 | wifiName = new QLineEdit(this); 24 | wifiName->setFont(font); 25 | wifiName->setText(name); 26 | wifiName->setEnabled(false); 27 | wifiName->setFixedHeight(45); 28 | QLabel *wifiPasswdLabel = new QLabel(tr("无线密码:")); 29 | wifiPasswdLabel->setFont(font); 30 | wifiPasswd = new QLineEdit(this); 31 | wifiPasswd->setFont(font); 32 | wifiPasswd->setFixedHeight(45); 33 | wifiPasswd->installEventFilter(this);//lineEdit部件在该对象上安装事件过滤器 34 | okBtn = new QPushButton(tr("确定"),this); 35 | okBtn->setFixedHeight(50); 36 | okBtn->setStyleSheet("QPushButton{outline:none;font: 20px \"msyh\";}" 37 | "QPushButton:pressed{background-color: orange;}"); 38 | cancelBtn = new QPushButton(tr("取消"),this); 39 | cancelBtn->setFixedHeight(50); 40 | cancelBtn->setStyleSheet("QPushButton{outline:none;font: 22px \"msyh\";}" 41 | "QPushButton:pressed{background-color: orange;}"); 42 | connect(okBtn,SIGNAL(clicked()),this,SLOT(okSlot())); 43 | connect(cancelBtn,SIGNAL(clicked()),this,SLOT(cancelSlot())); 44 | QHBoxLayout *hBoxLayout = new QHBoxLayout(); 45 | hBoxLayout->setMargin(1); 46 | hBoxLayout->addWidget(cancelBtn); 47 | hBoxLayout->addWidget(okBtn); 48 | 49 | QGridLayout *gridLayout = new QGridLayout(this); 50 | gridLayout->setSpacing(5); 51 | gridLayout->addWidget(wifiNameLabel,0,0,1,1); 52 | gridLayout->addWidget(wifiName,0,1,1,1); 53 | gridLayout->addWidget(wifiPasswdLabel,1,0,1,1); 54 | gridLayout->addWidget(wifiPasswd,1,1,1,1); 55 | gridLayout->addLayout(hBoxLayout,2,0,1,2); 56 | } 57 | 58 | WifiConnDialog::~WifiConnDialog() 59 | { 60 | 61 | } 62 | /* 63 | *@brief: 确定按钮响应槽,将对应的wifi及密码写入配置文件 64 | *@author: 缪庆瑞 65 | *@date: 2017.5.24 66 | */ 67 | void WifiConnDialog::okSlot() 68 | { 69 | QString name = wifiName->text(); 70 | QString passwd = wifiPasswd->text(); 71 | if(passwd.size()<8) 72 | { 73 | MyMessageBox::myInformation(this,"information",tr("密码长度不够,至少8位!!!")); 74 | return; 75 | } 76 | emit connectingSignal(name,passwd); 77 | cancelSlot(); 78 | } 79 | /* 80 | *@brief: 取消连接wifi 81 | *@author: 缪庆瑞 82 | *@date: 2017.5.24 83 | */ 84 | void WifiConnDialog::cancelSlot() 85 | { 86 | this->close(); 87 | this->deleteLater(); 88 | } 89 | /* 90 | *@brief: 处理软键盘发来的文本 91 | *@author: 缪庆瑞 92 | *@date: 2017.5.24 93 | */ 94 | void WifiConnDialog::keyboardSlot(QString text) 95 | { 96 | tempEdit->setText(text);//将软键盘输入的内容填入点击的edit上 97 | } 98 | /* 99 | *@brief: 事件过滤器处理函数 100 | *@author: 缪庆瑞 101 | *@date: 2017.5.24 102 | *@param: obj:产生事件的对象 103 | *@param: event:产生的事件 104 | */ 105 | bool WifiConnDialog::eventFilter(QObject *obj, QEvent *event) 106 | { 107 | if(event->type()==QEvent::MouseButtonRelease)//只处理鼠标释放事件 108 | { 109 | tempEdit = qobject_cast(obj); 110 | /*因为将softKeyboard改成了全局对象,可能会导致同一个对象的信号引起多个槽响应,出现段错误 111 | 所以每一次先断开全局对象的所有连接,再连接一次*/ 112 | disconnect(softKeyboard,0,0,0);//断开软键盘对象的所有信号与槽的连接 113 | //连接软键盘信号 114 | connect(softKeyboard,SIGNAL(sendText(QString)),this,SLOT(keyboardSlot(QString))); 115 | softKeyboard->setInputText(tempEdit->text()); 116 | //softKeyboard->showFullScreen(); 117 | softKeyboard->show(); 118 | } 119 | return QDialog::eventFilter(obj,event); 120 | } 121 | 122 | -------------------------------------------------------------------------------- /wificonndialog.h: -------------------------------------------------------------------------------- 1 | /* 2 | *@file: wificonndialog.h 3 | *@author: 缪庆瑞 4 | *@date: 2017.5.24 5 | *@brief: 连接wifi输入密码的界面 6 | */ 7 | #ifndef WIFICONNDIALOG_H 8 | #define WIFICONNDIALOG_H 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include "globalvar.h" 16 | #include "mymessagebox.h" 17 | 18 | class WifiConnDialog : public QDialog 19 | { 20 | Q_OBJECT 21 | public: 22 | WifiConnDialog(QString name,QWidget *parent); 23 | ~WifiConnDialog(); 24 | 25 | public slots: 26 | void okSlot(); 27 | void cancelSlot(); 28 | void keyboardSlot(QString text);//处理软键盘信号的槽 29 | 30 | signals: 31 | void connectingSignal(QString wifiName,QString wifiPasswd); 32 | 33 | protected: 34 | virtual bool eventFilter(QObject *obj,QEvent *event); 35 | 36 | private: 37 | QLineEdit *tempEdit;//用来记录当前引发事件过滤器处理的edit部件 38 | QLineEdit *wifiName; 39 | QLineEdit *wifiPasswd; 40 | QPushButton *okBtn;//确定按钮 41 | QPushButton *cancelBtn;//取消 42 | }; 43 | 44 | #endif // WIFICONNDIALOG_H 45 | --------------------------------------------------------------------------------