views:

2087

answers:

3

I want to create a Qt widget that can play incoming RTP streams where the video is encoded as H264 and contains no audio.

My basic plan for implementation is this:

  • Create a Phonon MediaSource object (Stream type).
  • Connect it with a QIODevice subclass that provides the data
  • Obtain the video data using either:
    • The JRTPLIB client library
    • The GStreamer gstrtpbin plugin. This plugin takes care depayloading the packages and decoding the video. Maybe this improves the chances that Phonon will recognize the data.

My environment:

  • Ubuntu 9.10
  • Qt 4.6

My questions:

  • Is my approach a good one? Perhaps I'm overlooking a more obvious or simple solution?
  • I'm currently experiencing this issue: when trying to play the video stream the state of the MediaObject turns to ErrorState with errorType FatalError. Can anyone tell me what I'm doing wrong?

Edit
One solution I found is using libVLC in combination with Qt, which I learned about in this thread. Here's a code sample for the interested. I'm still looking for a Phonon-based solution.
Ideally I would only need to provide an SDP file and job is done.

+2  A: 

The way I understand Phonon works at least in Windows is that QT provides a phonon backend plugin for DirectShow (\plugins\phonon_backend\phonon_ds94.dll) and GStreamer in your case. Then you would either obtain or write your own DirectShow filter which can accept RTP streams as a source. DirectShow takes care of the decoding, and Phonon will take care of the rendering.

So if the backend works, the application code is as simple as:

        Phonon::MediaObject *media = new Phonon::MediaObject();
        Phonon::VideoWidget *video = new Phonon::VideoWidget();
        Phonon::createPath(media, video);
        media->setCurrentSource(source);
        media->play();

Seems that the problem lies with the GStreamer backend accepting RTP as a source. Can you playback that source in standalone GStreamer without any problems?

Vicken Simonian
I haven't managed to make it work yet. Playing a local file works, but when I try to load an RTP stream (through a MediaSource(QIODevice) object that read RTP packets) the VideoPlayer stays in LoadingState.Right now I am experimenting with another approach: I'm using GStreamer's gstrtpbin plugin to read incoming RTP data, decode the video stream and somehow connect it to a Qt widget.
StackedCrooked
A: 

Did y9ou get this to work? Could ou post enough code to help out this next guy?

Check my accepted answer.
StackedCrooked
A: 

I was able to get it to work using the libVLC solution. I can't garantuee that this is the best solution though as I simply stopped looking after that.

Here's a link to the libVLC sample.

StackedCrooked