更新代码
parent
8be5fbc548
commit
593a5a1763
|
@ -27,7 +27,7 @@ int main(int argc, char *argv[])
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Widget w;
|
Widget w;
|
||||||
w.setWindowTitle("存款计算器 (QQ: 517216493 WX: feiyangqingyun)");
|
w.setWindowTitle("存款/贷款 计算器 (QQ: 517216493 WX: feiyangqingyun)");
|
||||||
w.show();
|
w.show();
|
||||||
|
|
||||||
return a.exec();
|
return a.exec();
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
Widget::Widget(QWidget *parent) : QWidget(parent), ui(new Ui::Widget)
|
Widget::Widget(QWidget *parent) : QWidget(parent), ui(new Ui::Widget)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
this->initForm();
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget::~Widget()
|
Widget::~Widget()
|
||||||
|
@ -15,7 +16,14 @@ Widget::~Widget()
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Widget::on_btnOk_clicked()
|
void Widget::initForm()
|
||||||
|
{
|
||||||
|
QDateTime now = QDateTime::currentDateTime();
|
||||||
|
ui->dateStart->setDate(now.date());
|
||||||
|
ui->dateEnd->setDate(now.date().addYears(1));
|
||||||
|
}
|
||||||
|
|
||||||
|
void Widget::on_btnCalc_clicked()
|
||||||
{
|
{
|
||||||
//当前多少钱
|
//当前多少钱
|
||||||
int moneyCurrent = ui->txtMoneyCurrent->text().toInt();
|
int moneyCurrent = ui->txtMoneyCurrent->text().toInt();
|
||||||
|
@ -65,3 +73,16 @@ void Widget::on_btnOk_clicked()
|
||||||
ui->txtValue->setText(QString::number(value));
|
ui->txtValue->setText(QString::number(value));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Widget::on_btnCalc2_clicked()
|
||||||
|
{
|
||||||
|
//计算天数
|
||||||
|
QDateTime dateStart = ui->dateStart->dateTime();
|
||||||
|
QDateTime dateEnd = ui->dateEnd->dateTime();
|
||||||
|
int day = dateStart.daysTo(dateEnd);
|
||||||
|
int money = ui->txtMoney2->text().toInt();
|
||||||
|
float rate = ui->txtRate2->text().toFloat();
|
||||||
|
int result = money * rate * day;
|
||||||
|
ui->txtResult2->setText(QString::number(result));
|
||||||
|
qDebug() << day;
|
||||||
|
}
|
||||||
|
|
|
@ -15,11 +15,13 @@ public:
|
||||||
explicit Widget(QWidget *parent = 0);
|
explicit Widget(QWidget *parent = 0);
|
||||||
~Widget();
|
~Widget();
|
||||||
|
|
||||||
private slots:
|
|
||||||
void on_btnOk_clicked();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::Widget *ui;
|
Ui::Widget *ui;
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void initForm();
|
||||||
|
void on_btnCalc_clicked();
|
||||||
|
void on_btnCalc2_clicked();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // WIDGET_H
|
#endif // WIDGET_H
|
||||||
|
|
|
@ -13,180 +13,189 @@
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>存款计算器</string>
|
<string>存款计算器</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_2">
|
<layout class="QGridLayout" name="gridLayout_3">
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QWidget" name="widget" native="true">
|
<widget class="QGroupBox" name="groupBox">
|
||||||
<property name="maximumSize">
|
<property name="title">
|
||||||
<size>
|
<string>存款计算</string>
|
||||||
<width>600</width>
|
|
||||||
<height>16777215</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
<property name="leftMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item row="2" column="3">
|
|
||||||
<widget class="QLineEdit" name="txtMoneyAll"/>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QLabel" name="labYear">
|
|
||||||
<property name="text">
|
|
||||||
<string>期限</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="2">
|
|
||||||
<widget class="QLabel" name="labRate">
|
|
||||||
<property name="text">
|
|
||||||
<string>利率</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="1">
|
|
||||||
<widget class="QComboBox" name="cboxType">
|
|
||||||
<property name="currentIndex">
|
|
||||||
<number>1</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>单利</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>复利</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="6">
|
|
||||||
<widget class="QLineEdit" name="txtValue"/>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="1">
|
|
||||||
<widget class="QLineEdit" name="txtMoneyCurrent">
|
|
||||||
<property name="text">
|
|
||||||
<string>1000000</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="4" rowspan="3">
|
|
||||||
<widget class="QPushButton" name="btnOk">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>计算</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="6">
|
|
||||||
<widget class="QLineEdit" name="txtValue1"/>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QLabel" name="labMoneyCurrent">
|
<widget class="QWidget" name="widget" native="true">
|
||||||
<property name="text">
|
<property name="maximumSize">
|
||||||
<string>本金</string>
|
<size>
|
||||||
|
<width>600</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
</item>
|
<property name="leftMargin">
|
||||||
<item row="1" column="1">
|
<number>0</number>
|
||||||
<widget class="QComboBox" name="cboxYear">
|
|
||||||
<property name="currentIndex">
|
|
||||||
<number>1</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>1年</string>
|
|
||||||
</property>
|
</property>
|
||||||
</item>
|
<property name="topMargin">
|
||||||
<item>
|
<number>0</number>
|
||||||
<property name="text">
|
|
||||||
<string>3年</string>
|
|
||||||
</property>
|
</property>
|
||||||
</item>
|
<property name="rightMargin">
|
||||||
<item>
|
<number>0</number>
|
||||||
<property name="text">
|
|
||||||
<string>5年</string>
|
|
||||||
</property>
|
</property>
|
||||||
</item>
|
<property name="bottomMargin">
|
||||||
</widget>
|
<number>0</number>
|
||||||
</item>
|
</property>
|
||||||
<item row="1" column="2">
|
<item row="2" column="3">
|
||||||
<widget class="QLabel" name="labYears">
|
<widget class="QLineEdit" name="txtMoneyAll"/>
|
||||||
<property name="text">
|
</item>
|
||||||
<string>年限</string>
|
<item row="1" column="0">
|
||||||
</property>
|
<widget class="QLabel" name="labYear">
|
||||||
</widget>
|
<property name="text">
|
||||||
</item>
|
<string>期限</string>
|
||||||
<item row="2" column="0">
|
</property>
|
||||||
<widget class="QLabel" name="labType">
|
</widget>
|
||||||
<property name="text">
|
</item>
|
||||||
<string>方式</string>
|
<item row="0" column="2">
|
||||||
</property>
|
<widget class="QLabel" name="labRate">
|
||||||
</widget>
|
<property name="text">
|
||||||
</item>
|
<string>利率</string>
|
||||||
<item row="1" column="5">
|
</property>
|
||||||
<widget class="QRadioButton" name="rbtn2">
|
</widget>
|
||||||
<property name="text">
|
</item>
|
||||||
<string>总计2</string>
|
<item row="2" column="1">
|
||||||
</property>
|
<widget class="QComboBox" name="cboxType">
|
||||||
</widget>
|
<property name="currentIndex">
|
||||||
</item>
|
<number>1</number>
|
||||||
<item row="1" column="6">
|
</property>
|
||||||
<widget class="QLineEdit" name="txtValue2"/>
|
<item>
|
||||||
</item>
|
<property name="text">
|
||||||
<item row="0" column="3">
|
<string>单利</string>
|
||||||
<widget class="QLineEdit" name="txtRate">
|
</property>
|
||||||
<property name="text">
|
</item>
|
||||||
<string>0.04125</string>
|
<item>
|
||||||
</property>
|
<property name="text">
|
||||||
</widget>
|
<string>复利</string>
|
||||||
</item>
|
</property>
|
||||||
<item row="0" column="5">
|
</item>
|
||||||
<widget class="QRadioButton" name="rbtn1">
|
</widget>
|
||||||
<property name="text">
|
</item>
|
||||||
<string>总计1</string>
|
<item row="2" column="6">
|
||||||
</property>
|
<widget class="QLineEdit" name="txtValue"/>
|
||||||
<property name="checked">
|
</item>
|
||||||
<bool>true</bool>
|
<item row="0" column="1">
|
||||||
</property>
|
<widget class="QLineEdit" name="txtMoneyCurrent">
|
||||||
</widget>
|
<property name="text">
|
||||||
</item>
|
<string>1000000</string>
|
||||||
<item row="2" column="2">
|
</property>
|
||||||
<widget class="QLabel" name="labMoneyAll">
|
</widget>
|
||||||
<property name="text">
|
</item>
|
||||||
<string>总计</string>
|
<item row="0" column="4" rowspan="3">
|
||||||
</property>
|
<widget class="QPushButton" name="btnCalc">
|
||||||
</widget>
|
<property name="sizePolicy">
|
||||||
</item>
|
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
|
||||||
<item row="2" column="5">
|
<horstretch>0</horstretch>
|
||||||
<widget class="QLabel" name="labValue">
|
<verstretch>0</verstretch>
|
||||||
<property name="text">
|
</sizepolicy>
|
||||||
<string>总计差额</string>
|
</property>
|
||||||
</property>
|
<property name="text">
|
||||||
<property name="alignment">
|
<string>计算</string>
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
</property>
|
||||||
</property>
|
</widget>
|
||||||
</widget>
|
</item>
|
||||||
</item>
|
<item row="0" column="6">
|
||||||
<item row="1" column="3">
|
<widget class="QLineEdit" name="txtValue1"/>
|
||||||
<widget class="QLineEdit" name="txtYears">
|
</item>
|
||||||
<property name="text">
|
<item row="0" column="0">
|
||||||
<string>30</string>
|
<widget class="QLabel" name="labMoneyCurrent">
|
||||||
</property>
|
<property name="text">
|
||||||
|
<string>本金</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QComboBox" name="cboxYear">
|
||||||
|
<property name="currentIndex">
|
||||||
|
<number>1</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>1年</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>3年</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>5年</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="2">
|
||||||
|
<widget class="QLabel" name="labYears">
|
||||||
|
<property name="text">
|
||||||
|
<string>年限</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QLabel" name="labType">
|
||||||
|
<property name="text">
|
||||||
|
<string>方式</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="5">
|
||||||
|
<widget class="QRadioButton" name="rbtn2">
|
||||||
|
<property name="text">
|
||||||
|
<string>总计2</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="6">
|
||||||
|
<widget class="QLineEdit" name="txtValue2"/>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="3">
|
||||||
|
<widget class="QLineEdit" name="txtRate">
|
||||||
|
<property name="text">
|
||||||
|
<string>0.04125</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="5">
|
||||||
|
<widget class="QRadioButton" name="rbtn1">
|
||||||
|
<property name="text">
|
||||||
|
<string>总计1</string>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="2">
|
||||||
|
<widget class="QLabel" name="labMoneyAll">
|
||||||
|
<property name="text">
|
||||||
|
<string>总计</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="5">
|
||||||
|
<widget class="QLabel" name="labValue">
|
||||||
|
<property name="text">
|
||||||
|
<string>总计差额</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="3">
|
||||||
|
<widget class="QLineEdit" name="txtYears">
|
||||||
|
<property name="text">
|
||||||
|
<string>30</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
@ -206,6 +215,140 @@
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
<item row="1" column="0">
|
||||||
|
<widget class="QGroupBox" name="groupBox_2">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>200</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="title">
|
||||||
|
<string>贷款计算</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_4">
|
||||||
|
<item row="1" column="2">
|
||||||
|
<widget class="QLabel" name="labRate2">
|
||||||
|
<property name="text">
|
||||||
|
<string>贷款利率</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="2">
|
||||||
|
<widget class="QLabel" name="labMoney2">
|
||||||
|
<property name="text">
|
||||||
|
<string>贷款金额</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="6" rowspan="2">
|
||||||
|
<widget class="QPushButton" name="btnCalc2">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>计算</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="5">
|
||||||
|
<widget class="QLineEdit" name="txtRate3">
|
||||||
|
<property name="text">
|
||||||
|
<string>0.0003</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="labEnd">
|
||||||
|
<property name="text">
|
||||||
|
<string>到期日期</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="4">
|
||||||
|
<widget class="QLabel" name="labRate3">
|
||||||
|
<property name="text">
|
||||||
|
<string>逾期利率</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="5">
|
||||||
|
<widget class="QLineEdit" name="txtRate4">
|
||||||
|
<property name="text">
|
||||||
|
<string>0.0003</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QDateEdit" name="dateStart">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="displayFormat">
|
||||||
|
<string>yyyy-MM-dd</string>
|
||||||
|
</property>
|
||||||
|
<property name="calendarPopup">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QDateEdit" name="dateEnd">
|
||||||
|
<property name="displayFormat">
|
||||||
|
<string>yyyy-MM-dd</string>
|
||||||
|
</property>
|
||||||
|
<property name="calendarPopup">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="3">
|
||||||
|
<widget class="QLineEdit" name="txtMoney2">
|
||||||
|
<property name="text">
|
||||||
|
<string>100000</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="3">
|
||||||
|
<widget class="QLineEdit" name="txtRate2">
|
||||||
|
<property name="text">
|
||||||
|
<string>0.0003</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="labStart">
|
||||||
|
<property name="text">
|
||||||
|
<string>贷款日期</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="4">
|
||||||
|
<widget class="QLabel" name="labRate4">
|
||||||
|
<property name="text">
|
||||||
|
<string>复利利率</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QLabel" name="labValue2">
|
||||||
|
<property name="text">
|
||||||
|
<string>贷款利息</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<widget class="QLineEdit" name="txtResult2"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
<spacer name="verticalSpacer">
|
<spacer name="verticalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Vertical</enum>
|
<enum>Qt::Vertical</enum>
|
||||||
|
@ -228,7 +371,7 @@
|
||||||
<tabstop>txtYears</tabstop>
|
<tabstop>txtYears</tabstop>
|
||||||
<tabstop>cboxType</tabstop>
|
<tabstop>cboxType</tabstop>
|
||||||
<tabstop>txtMoneyAll</tabstop>
|
<tabstop>txtMoneyAll</tabstop>
|
||||||
<tabstop>btnOk</tabstop>
|
<tabstop>btnCalc</tabstop>
|
||||||
<tabstop>rbtn1</tabstop>
|
<tabstop>rbtn1</tabstop>
|
||||||
<tabstop>txtValue1</tabstop>
|
<tabstop>txtValue1</tabstop>
|
||||||
<tabstop>rbtn2</tabstop>
|
<tabstop>rbtn2</tabstop>
|
||||||
|
|
|
@ -231,6 +231,7 @@ bool FFmpegThread::init()
|
||||||
|
|
||||||
void FFmpegThread::run()
|
void FFmpegThread::run()
|
||||||
{
|
{
|
||||||
|
qint64 startTime = av_gettime();
|
||||||
while (!stopped) {
|
while (!stopped) {
|
||||||
//根据标志位执行初始化操作
|
//根据标志位执行初始化操作
|
||||||
if (isPlay) {
|
if (isPlay) {
|
||||||
|
@ -270,16 +271,25 @@ void FFmpegThread::run()
|
||||||
emit receiveImage(image);
|
emit receiveImage(image);
|
||||||
}
|
}
|
||||||
|
|
||||||
msleep(1);
|
usleep(1);
|
||||||
}
|
}
|
||||||
|
#if 1
|
||||||
|
//延时(不然文件会立即全部播放完)
|
||||||
|
AVRational timeBase = {1, AV_TIME_BASE};
|
||||||
|
int64_t ptsTime = av_rescale_q(avPacket->dts, avFormatContext->streams[videoStreamIndex]->time_base, timeBase);
|
||||||
|
int64_t nowTime = av_gettime() - startTime;
|
||||||
|
if (ptsTime > nowTime) {
|
||||||
|
av_usleep(ptsTime - nowTime);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
} else if (index == audioStreamIndex) {
|
} else if (index == audioStreamIndex) {
|
||||||
//解码音频流,这里暂不处理,以后交给sdl播放
|
//解码音频流,自行处理
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
av_packet_unref(avPacket);
|
av_packet_unref(avPacket);
|
||||||
av_freep(avPacket);
|
av_freep(avPacket);
|
||||||
msleep(1);
|
usleep(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
//线程结束后释放资源
|
//线程结束后释放资源
|
||||||
|
|
|
@ -9,7 +9,7 @@ Widget::Widget(QWidget *parent) : QWidget(parent), ui(new Ui::Widget)
|
||||||
//本示例支持的是rtsp视频流(其他的一概不支持/没有做音视频同步)
|
//本示例支持的是rtsp视频流(其他的一概不支持/没有做音视频同步)
|
||||||
QStringList urls;
|
QStringList urls;
|
||||||
urls << "http://vfx.mtime.cn/Video/2021/11/16/mp4/211116131456748178.mp4";
|
urls << "http://vfx.mtime.cn/Video/2021/11/16/mp4/211116131456748178.mp4";
|
||||||
urls << "rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov";
|
urls << "http://vd3.bdstatic.com/mda-jennyc5ci1ugrxzi/mda-jennyc5ci1ugrxzi.mp4";
|
||||||
urls << "rtsp://admin:Admin123456@192.168.0.15:554/media/video1";
|
urls << "rtsp://admin:Admin123456@192.168.0.15:554/media/video1";
|
||||||
ui->cboxUrl->addItems(urls);
|
ui->cboxUrl->addItems(urls);
|
||||||
ui->cboxUrl->setCurrentIndex(0);
|
ui->cboxUrl->setCurrentIndex(0);
|
||||||
|
|
Loading…
Reference in New Issue