播放视频在Qt从BYTE *流? [英] Play Video In Qt from BYTE* Stream?
本文介绍了播放视频在Qt从BYTE *流?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在Qt从Byte *流显示视频,这是我从一个C ++库。视频来自Astrisk服务器VP8格式。我可以得到Byte *流从它在Qt现在我想显示它在Qt窗口我还得到所有的视频信息,如帧率,大小,宽度,高度。等等。
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* Stream from it in Qt now i want to display it in Qt window I am also getting all the information of video like frame rate, size, width, height. etc.
推荐答案
你可以有一个 QByteArray
从 QByteArray
中提供 QBuffer
,并将缓冲区作为 QMediaPlayer
:
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();
这篇关于播放视频在Qt从BYTE *流?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文