azen0r
7th June 2012, 10:53
Hi,
On a linux ubuntu with Qt 4.8.1, I have a device driver that creates a /dev/video0 node.
I would like to show the video into a videowidget with phonon. Is it possible ? any tip on how to do this ?
I can open /dev/video0 with vlc and mplayer so the stream is surely created and available.
Since Phonon's backend uses gstreamer, I investigated in this direction too.
gstreamer-properties provides a mean to test video default input pipeline and this works, I can view the stream with this test.
Pipeline field shows : v4l2src device="/dev/video0" though I don't know how to interpret that.
On Qt side, my test code looks like
int main(int argv, char **args)
{
QApplication app(argv, args);
Phonon::MediaObject* mediaObj = new Phonon::MediaObject();
Phonon::VideoWidget* vidWid = new Phonon::VideoWidget();
Phonon::createPath(mediaObj, vidWid);
Phonon::MediaSource medSrc( QString("/dev/video" ));
//Phonon::MediaSource medSrc( QString("/tmp/video.mp4" ));
mediaObj->setCurrentSource( medSrc );
mediaObj->play();
std::cout<<"last err : "<<mediaObj->errorString().toStdString ()<<std::endl;
vidWid->show();
return app.exec();
}
if I use
Phonon::MediaSource medSrc( QString("/tmp/video.mp4" )); the video is played as expected
if I use
Phonon::MediaSource medSrc( QString("/dev/video" )); the widget keeps desperately black
errorString is always empty.
Since Totem is also built onto gstream, I tried to open the stream with it but failed to get anything too.
Any help would be greatly appreciated.
On a linux ubuntu with Qt 4.8.1, I have a device driver that creates a /dev/video0 node.
I would like to show the video into a videowidget with phonon. Is it possible ? any tip on how to do this ?
I can open /dev/video0 with vlc and mplayer so the stream is surely created and available.
Since Phonon's backend uses gstreamer, I investigated in this direction too.
gstreamer-properties provides a mean to test video default input pipeline and this works, I can view the stream with this test.
Pipeline field shows : v4l2src device="/dev/video0" though I don't know how to interpret that.
On Qt side, my test code looks like
int main(int argv, char **args)
{
QApplication app(argv, args);
Phonon::MediaObject* mediaObj = new Phonon::MediaObject();
Phonon::VideoWidget* vidWid = new Phonon::VideoWidget();
Phonon::createPath(mediaObj, vidWid);
Phonon::MediaSource medSrc( QString("/dev/video" ));
//Phonon::MediaSource medSrc( QString("/tmp/video.mp4" ));
mediaObj->setCurrentSource( medSrc );
mediaObj->play();
std::cout<<"last err : "<<mediaObj->errorString().toStdString ()<<std::endl;
vidWid->show();
return app.exec();
}
if I use
Phonon::MediaSource medSrc( QString("/tmp/video.mp4" )); the video is played as expected
if I use
Phonon::MediaSource medSrc( QString("/dev/video" )); the widget keeps desperately black
errorString is always empty.
Since Totem is also built onto gstream, I tried to open the stream with it but failed to get anything too.
Any help would be greatly appreciated.