qt_demoe/video/playffmpeg/widget.cpp

39 lines
1.2 KiB
C++
Raw Normal View History

2020-04-22 06:36:41 +00:00
#pragma execution_character_set("utf-8")
#include "widget.h"
#include "ui_widget.h"
2020-08-27 07:38:19 +00:00
Widget::Widget(QWidget *parent) : QWidget(parent), ui(new Ui::Widget)
2020-04-22 06:36:41 +00:00
{
ui->setupUi(this);
QStringList urls;
2021-11-17 07:33:19 +00:00
urls << "https://hls01open.ys7.com/openlive/6e0b2be040a943489ef0b9bb344b96b8.hd.m3u8";
2020-04-22 06:36:41 +00:00
urls << "rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov";
2021-11-03 06:13:56 +00:00
urls << "rtsp://admin:Admin123456@192.168.0.64:554/Streaming/Channels/102?transportmode=unicast&profile=Profile_2";
2020-04-22 06:36:41 +00:00
urls << "rtsp://192.168.1.108:554/cam/realmonitor?channel=1&subtype=0&unicast=true&proto=Onvif";
urls << "rtsp://192.168.1.15:554/media/video1";
urls << "rtsp://192.168.1.15:554/media/video2";
urls << "rtsp://192.168.1.247:554/av0_0";
urls << "rtsp://192.168.1.247:554/av0_1";
ui->cboxUrl->addItems(urls);
2021-11-17 07:33:19 +00:00
ui->cboxUrl->setCurrentIndex(0);
2020-04-22 06:36:41 +00:00
}
Widget::~Widget()
{
delete ui;
}
void Widget::on_btnOpen_clicked()
{
if (ui->btnOpen->text() == "打开") {
ui->btnOpen->setText("关闭");
QString url = ui->cboxUrl->currentText().trimmed();
2020-08-27 07:38:19 +00:00
ui->playWidget->setUrl(url);
ui->playWidget->open();
2020-04-22 06:36:41 +00:00
} else {
ui->btnOpen->setText("打开");
2020-08-27 07:38:19 +00:00
ui->playWidget->close();
2020-04-22 06:36:41 +00:00
}
}