Play Video In Qt from BYTE* Stream?

后端 未结 1 1339
粉色の甜心
粉色の甜心 2021-01-16 12:01

I want to display video in Qt from Byte* stream which is I am getting from an C++ library. The video is coming from Astrisk server in VP8 format. I am able to get Byte* Str

相关标签:
1条回答
  • 2021-01-16 12:50

    You can have a QByteArray of the byte stream, provide a QBuffer from the QByteArray and pass the buffer as the stream for a QMediaPlayer :

    databuf = QByteArray(reinterpret_cast<char*>(array), size);
    QBuffer mediaStream(&databuf);
    
    player = new QMediaPlayer;
    player->setMedia(QMediaContent(), &buffer);
    
    videoWidget = new QVideoWidget;
    player->setVideoOutput(videoWidget);
    videoWidget->show();
    
    player->play();
    
    0 讨论(0)
提交回复
热议问题