导航

    全志在线开发者论坛

    • 注册
    • 登录
    • 搜索
    • 版块
    • 话题
    • 在线文档
    • 社区主页

    分享QT中引入tplayer,未能渲染到weight中,有没有大佬能改写源码能在QT中使用

    GUI
    1
    2
    484
    正在加载更多帖子
    • 从旧到新
    • 从新到旧
    • 最多赞同
    回复
    • 在新帖中回复
    登录后回复
    此主题已被删除。只有拥有主题管理权限的用户可以查看。
    • V
      vejoker LV 4 最后由 编辑

      捕获.JPG
      这是引入库部分,注释掉的是我写的用不上的,其中crypto需要在sdk中全局查找拷贝来的

      foot@foot-VirtualBox:~/qtFile/videoDemo/videoDemo$ tree
      .
      ├── main.cpp
      ├── mainwindow.cpp
      ├── mainwindow.h
      ├── mainwindow.ui
      ├── tpmanager
      │   ├── crypto1.1
      │   │   ├── libcrypto.a
      │   │   ├── libcrypto.so -> libcrypto.so.1.1
      │   │   ├── libcrypto.so.1.1
      │   │   ├── libssl.a
      │   │   ├── libssl.so -> libssl.so.1.1
      │   │   └── libssl.so.1.1
      │   ├── include
      │   │   ├── cdx_config.h
      │   │   ├── CdxKeyedVector.h
      │   │   ├── libcedarc
      │   │   │   └── include
      │   │   │       ├── cdc_config.h
      │   │   │       ├── memoryAdapter.h
      │   │   │       ├── sc_interface.h
      │   │   │       ├── sdecoder.h
      │   │   │       ├── typedef.h
      │   │   │       ├── vbasetype.h
      │   │   │       ├── vdecoder.h
      │   │   │       ├── veAdapter.h
      │   │   │       ├── veInterface.h
      │   │   │       └── vencoder.h
      │   │   ├── libcedarx
      │   │   │   ├── base
      │   │   │   │   └── include
      │   │   │   │       ├── AwMessageQueue.h
      │   │   │   │       ├── AwPool.h
      │   │   │   │       ├── CdxAtomic.h
      │   │   │   │       ├── CdxBase64.h
      │   │   │   │       ├── CdxBinary.h
      │   │   │   │       ├── CdxBitReader.h
      │   │   │   │       ├── CdxBuffer.h
      │   │   │   │       ├── CdxDebug.h
      │   │   │   │       ├── CdxEnumCommon.h
      │   │   │   │       ├── CdxISOLang.h
      │   │   │   │       ├── CdxKeyedVector.h
      │   │   │   │       ├── CdxList.h
      │   │   │   │       ├── CdxList.i
      │   │   │   │       ├── CdxLock.h
      │   │   │   │       ├── cdx_log.h
      │   │   │   │       ├── CdxMemory.h
      │   │   │   │       ├── CdxMessage.h
      │   │   │   │       ├── CdxMeta.h
      │   │   │   │       ├── CdxQueue.h
      │   │   │   │       ├── CdxSocketUtil.h
      │   │   │   │       ├── CdxStrUtil.h
      │   │   │   │       ├── CdxSysinfo.h
      │   │   │   │       ├── CdxTime.h
      │   │   │   │       ├── CdxTypes.h
      │   │   │   │       ├── CdxUrl.h
      │   │   │   │       └── SmartDnsService.h
      │   │   │   ├── external
      │   │   │   │   └── include
      │   │   │   │       ├── adecoder
      │   │   │   │       │   └── adecoder.h
      │   │   │   │       ├── aencoder
      │   │   │   │       │   └── aencoder.h
      │   │   │   │       └── sdecoder
      │   │   │   │           └── sdecoder.h
      │   │   │   ├── parser
      │   │   │   │   └── include
      │   │   │   │       ├── awPlayReadyLicense.h
      │   │   │   │       └── CdxParser.h
      │   │   │   ├── playback
      │   │   │   │   └── include
      │   │   │   │       ├── deinterlace.h
      │   │   │   │       ├── layerControl.h
      │   │   │   │       ├── player.h
      │   │   │   │       ├── soundControl.h
      │   │   │   │       └── subtitleControl.h
      │   │   │   └── stream
      │   │   │       └── include
      │   │   │           ├── AwRtpStream.h
      │   │   │           ├── CdxSeqBuffer.h
      │   │   │           ├── CdxStreamErrno.h
      │   │   │           └── CdxStream.h
      │   │   ├── PostProcessCom.h
      │   │   ├── tplayer.h
      │   │   ├── videoOutPort.h
      │   │   └── xplayer
      │   │       └── include
      │   │           ├── mediaInfo.h
      │   │           ├── xplayer.h
      │   │           └── xplayerUtil.h
      │   ├── jpegdecode
      │   │   └── libjpegdecode.so
      │   ├── lib
      │   │   ├── libadecoder.so
      │   │   ├── libasound.so -> libasound.so.2.0.0
      │   │   ├── libasound.so.2 -> libasound.so.2.0.0
      │   │   ├── libasound.so.2.0.0
      │   │   ├── libawrecorder.so
      │   │   ├── libcdx_playback.so
      │   │   ├── libcrypto.so -> libcrypto.so.1.0.0
      │   │   ├── libcrypto.so.1.0.0
      │   │   ├── libscaledown.so
      │   │   ├── libsubdecoder.so
      │   │   ├── libuapi.so
      │   │   ├── libvenc_common.so
      │   │   ├── libvenc_h264.so
      │   │   ├── libvenc_h265.so
      │   │   ├── libvenc_jpeg.so
      │   │   ├── libVE.so
      │   │   ├── libvideoengine.so
      │   │   ├── libxplayer.so
      │   │   ├── libz.a
      │   │   ├── libz.so -> libz.so.1.2.8
      │   │   ├── libz.so.1 -> libz.so.1.2.8
      │   │   └── libz.so.1.2.8
      │   ├── libcedarc
      │   │   └── lib
      │   │       ├── libaftertreatment.la
      │   │       ├── libaftertreatment.so
      │   │       ├── libcdc_base.la
      │   │       ├── libcdc_base.so
      │   │       ├── libfbm.la
      │   │       ├── libfbm.so
      │   │       ├── libMemAdapter.la
      │   │       ├── libMemAdapter.so
      │   │       ├── libOmxCore.la
      │   │       ├── libOmxCore.so
      │   │       ├── libOmxVdec.la
      │   │       ├── libOmxVdec.so
      │   │       ├── libOmxVenc.la
      │   │       ├── libOmxVenc.so
      │   │       ├── libsbm.la
      │   │       ├── libsbm.so
      │   │       ├── libvdecoder.la
      │   │       ├── libvdecoder.so
      │   │       ├── libvenc_base.la
      │   │       ├── libvenc_base.so
      │   │       ├── libvencoder.la
      │   │       └── libvencoder.so
      │   ├── libcedarx
      │   │   └── lib
      │   │       ├── libcdx_base.la
      │   │       ├── libcdx_base.so
      │   │       ├── libcdx_common.la
      │   │       ├── libcdx_common.so
      │   │       ├── libcdx_parser.la
      │   │       ├── libcdx_parser.so
      │   │       ├── libcdx_stream.la
      │   │       └── libcdx_stream.so
      │   ├── tmetadataretriever
      │   │   └── libtmetadataretriever.so
      │   ├── tplayer
      │   │   └── libtplayer.so
      │   └── trecorder
      │       └── libtrecorder.so
      ├── User
      │   ├── tpmanager.cpp
      │   └── tpmanager.h
      ├── videoDemo.pro
      └── videoDemo.pro.user
      

      文件结构树部分就是整个demo项目的结构,我是将package->allwinner->tina_multimedia的部分内容拷贝到项目中,其中User文件夹是参考tplayerdemo.c的CallbackForTPlayer写的。

      最后mainwindow.cpp写的内容是

      MainWindow::MainWindow(QWidget *parent)
          : QMainWindow(parent)
          , ui(new Ui::MainWindow)
      {
          ui->setupUi(this);
      
          TPlayer* tplayer = TPlayerCreate(CEDARX_PLAYER);
          TPlayerSetNotifyCallback(tplayer,myCallback,NULL);
          if(TPlayerSetDataSource(tplayer,"http://192.168.0.123:9999/explorer?path=upload%2F2025-03%2F4.mp4",NULL) != 0)
          {
              printf("TPlayerSetDataSource() return fail.\n");
          }
          else
          {
              printf("TPlayerSetDataSource() end\n");
          }
          if(TPlayerPrepare(tplayer)!= 0)
          {
              printf("TPlayerPrepare return fail.\n");
          }else{
              printf("TPlayerPrepare end\n");
          }
          if(TPlayerStart(tplayer) != 0)
          {
              printf("TPlayerStart() return fail.\n");
          }else{
              printf("started.\n");
          }
      
          qInfo() << "video is create now" ;
      }
      
      //最简单的一个tplayer播放流程
      

      总结,折腾几天,发现tplayer没有提供视频数据帧的方法,想着能通过tplayer来实现在qt中播放视频,但是源码是开源的,应该能实现在qt中播放,我不会改。如果我说的有什么错误或者不妥之处,还请大佬指正。

      1 条回复 最后回复 回复 引用 分享 0
      • V
        vejoker LV 4 最后由 vejoker 编辑

        【已解决:可以显示渲染到屏幕中】

        自己挖的坑还得自己解决😢

        按照以上步骤配置好环境,引入该有的库文件

        在main.cpp中,设置以下内容

        #include "mainwindow.h"
        
        #include <QApplication>
        
        #include <QDebug>
        #include <tplayer.h>
        #include "User/tpmanager.h"
        #include <QLabel>
        
        int main(int argc, char *argv[])
        {
            QApplication a(argc, argv);
            MainWindow w;
        
            //可以注释掉这个MainWindow w窗体,使它不可见。或者给他透明度,我这里给的是透明度
            w.setWindowOpacity(0.5);//这句不起作用,冗余代码
            w.show();
        
            //绘制内容在tplayer视频上
            QLabel* label = new QLabel();
            label->setText("hello");
            label->setStyleSheet("font-size:20px;color:#ff0000");
            label->move(400,460);
            label->show();
        
        
            qInfo() << "hello" ;
        
        
            TPlayer* tplayer = TPlayerCreate(CEDARX_PLAYER);
            TPlayerSetNotifyCallback(tplayer,myCallback,NULL);
            TPlayerSetDisplayRect(tplayer,0,0,800,640);//设置位置大小
            if(TPlayerSetDataSource(tplayer,"http://192.168.0.123:9999/explorer?path=upload%2F2025-03%2F4.mp4",NULL) != 0)
            {
                printf("TPlayerSetDataSource() return fail.\n");
            }
            else
            {
                printf("TPlayerSetDataSource() end\n");
            }
            if(TPlayerPrepare(tplayer)!= 0)
            {
                printf("TPlayerPrepare return fail.\n");
            }else{
                printf("TPlayerPrepare end\n");
            }
            if(TPlayerStart(tplayer) != 0)
            {
                printf("TPlayerStart() return fail.\n");
            }else{
                printf("started.\n");
            }
        
        
            return a.exec();
        }
        
        

        效果图片:
        捕获.JPG

        1 条回复 最后回复 回复 引用 分享 2
        • 1 / 1
        • First post
          Last post

        Copyright © 2024 深圳全志在线有限公司 粤ICP备2021084185号 粤公网安备44030502007680号

        行为准则 | 用户协议 | 隐私权政策