标签:经纬 百度 int() gb28181 ber 自动播放 end 响应 显示
远程回放有两种处理方式,一种是采用NVR厂家提供的SDK开发包来登录到NVR上,然后根据SDK的函数接口指定的视频文件,当然也有接口查询视频文件列表等;一种是采用视频监控行业的国标GB28181协议,来注册到NVR上然后查询和播放视频文件。两种处理方式各有优缺点,用SDK的话,接口比较丰富,有很多特殊的处理都在SDK的函数中可以看到,相对来说速度和清晰度会更快一点,操作的友好性高,毕竟是自家的SDK,肯定对自家的设备支持非常好,缺点就是每个厂家都有一个SDK开发包,如果第三方集成厂家需要兼容多个厂家的话,就需要针对每个厂家的SDK都要来一遍,这个对于开发人员来说,厂家越多越崩溃,而国标GB28181的出现就是为了规范这些厂家,类似于onvif一样,约定厂家都按照一个统一的标准来回放视频,这对于广大开发者来说是福音,一般视频监控设备厂家除了支持自家的SDK以外,肯定都会支持onvif和gb28181,不过检测的产品除外。正常来说过检测的产品价格会贵一些,毕竟检测成本摆在那。
皮肤开源:https://gitee.com/feiyangqingyun/QWidgetDemo https://github.com/feiyangqingyun/QWidgetDemo
文件名称:styledemo
体验地址:https://gitee.com/feiyangqingyun/QWidgetExe https://github.com/feiyangqingyun/QWidgetExe
文件名称:bin_video_system.zip
void Demo::on_pushButtonLogin_clicked()
{
UNS_INT32 ret;
mDeviceType = ui->comboBoxProtocol->currentData().toInt();
mDeviceIP = ui->lineEditAddress->text();
mDevicePort = ui->lineEditPort->text().toInt();
mUsername = ui->lineEditUsername->text();
mPassword = ui->lineEditPassword->text();
QByteArray username = mUsername.toLatin1();
QByteArray password = mPassword.toLatin1();
QByteArray ipaddr = mDeviceIP.toLatin1();
QString result;
ret = DeviceInterface::login(mDeviceType, username.data(), password.data(), ipaddr.data(), mDevicePort, mLoginHandle);
if (ret != UNS_ESUCCESS) {
result = QString::fromLocal8Bit("登录失败,错误码 ") + QString::number(ret, 10);
QMessageBox::question(this, QString::fromLocal8Bit("提示框"), result, QMessageBox::Yes);
} else {
result = QString::fromLocal8Bit("登录成功");
updateChannelList();
}
}
void Demo::on_pushButtonLogout_clicked()
{
if (!checkLogin()) {
return;
}
DeviceInterface::logout(mLoginHandle);
mLoginHandle = NULL;
}
void Demo::onStartPlayLive()
{
UNS_INT32 ret;
if (!checkLogin()) {
return;
}
updatePlayLiveData(NULL);
UNS_LIVEPLAY_PARAMETER_T param;
param.channel = 0;//mPlayLiveChannel;
param.stream_type = mStreamType;
param.play_wnd = (void *)(ui->videoFrame->winId());
mPlayType = 0;
ret = DeviceInterface::startLivePlay(mLoginHandle, ¶m, liveDataCallback, this, mPlayHandle);
if (ret != UNS_ESUCCESS) {
QString result = QString::fromLocal8Bit("预览失败,错误码 ") + QString::number(ret, 10);
QMessageBox::question(this, QString::fromLocal8Bit("提示框"), result, QMessageBox::Yes);
}
}
void Demo::onStopPlayLive()
{
if (!checkLogin()) {
return;
}
if (mPlayType != 0) {
return;
}
UNS_INT32 ret;
ret = DeviceInterface::stopLivePlay(mPlayHandle);
ui->videoFrame->update();
}
void Demo::onStartPlayback()
{
UNS_INT32 ret;
if (!checkLogin()) {
return;
}
updatePlaybackData();
UNS_PLAYBACK_PARAMETER_T param;
param.channel = mPlaybackChannel;
param.type = 0;
param.method = 0;
param.start = mStartTime;
param.end = mEndTime;
param.play_wnd = (void *)(ui->videoFrame->winId());
mPlayType = 1;
ret = DeviceInterface::startPlayBack(mLoginHandle, ¶m, backDataCallback, this, mPlayHandle);
if (ret != UNS_ESUCCESS) {
QString result = QString::fromLocal8Bit("回放失败,错误码 ") + QString::number(ret, 10);
QMessageBox::question(this, QString::fromLocal8Bit("提示框"), result, QMessageBox::Yes);
}
}
void Demo::onStopPlayback()
{
if (!checkLogin()) {
return;
}
if (mPlayType != 1) {
return;
}
UNS_INT32 ret;
ret = DeviceInterface::stopPlayBack(mPlayHandle);
ui->videoFrame->update();
}
void Demo::onFastPlayback()
{
if (!checkPlayer()) {
return;
}
mPlayScale++;
UNS_INT32 ret = DeviceInterface::scalePlayBack(mPlayHandle, mPlayScale);
//CHECK_RESULT(ret);
}
void Demo::onSlowPlayback()
{
if (!checkPlayer()) {
return;
}
mPlayScale--;
UNS_INT32 ret = DeviceInterface::scalePlayBack(mPlayHandle, mPlayScale);
//CHECK_RESULT(ret);
}
void Demo::onPausePlayback()
{
if (!checkPlayer()) {
return;
}
UNS_INT32 ret = DeviceInterface::pausePlayBack(mPlayHandle);
// CHECK_RESULT(ret);
}
void Demo::onResumePlayback()
{
if (!checkPlayer()) {
return;
}
UNS_INT32 ret = DeviceInterface::resumePlayBack(mPlayHandle);
// CHECK_RESULT(ret);
}
标签:经纬 百度 int() gb28181 ber 自动播放 end 响应 显示
原文地址:https://www.cnblogs.com/feiyangqingyun/p/12058024.html