PDA

View Full Version : Play continously updated QBuffer with Phonon



Skinney
9th September 2010, 21:47
Hi!

Currently im encoding a movie to another format, but at the same time i want to play it, so that you don't have to wait for encoding to finish before watching the movie. The way i thought to do it was to make Phonon play a QBuffer, and just update the QBuffer as more data presents itself.

This is the relevant code:


void MainWindow::playVideoPart(QByteArray *part)
{
if (videoWidget == 0)
setupVideoWidget();

if (inputBuffer == 0)
{
inputBuffer = new QBuffer(part);
inputBuffer->open(QBuffer::ReadWrite | QBuffer::Append);
}
else
{
inputBuffer->write(part->trimmed());
}

//if (mediaObject.state() != Phonon::PlayingState)
//{
mediaObject.enqueue(Phonon::MediaSource(inputBuffe r));
mediaObject.play();
//}
}

Unfortuanetly, this only plays the first part of the movie, and stops shortly afterwards... anyone got any idea of how i ca get this working?

tbscope
10th September 2010, 05:44
Implement a custom abstractmediastream
http://qt.gitorious.org/qt/qt/blobs/4.7/src/3rdparty/phonon/phonon/abstractmediastream.h

Skinney
16th September 2010, 01:27
As far as I can gather, abstractmediastream is not supported by all backends, only Xine...

The problem i'm having, i realized, is that MediaSource apperantly reads the data from my inputBuffer only once, which means it will stop playback when reached the end of the read bytes, not the end of the actual QBuffer...

Is there really no way to get around this? Is there a better way to stream video over a tcpSocket?

johnm
6th October 2011, 09:51
Hi,

sorry to re-open such an old thread, but I was wondering if you (or anyone) found the solution to this as I am now in the same boat so to speak.

Thanks

John

derektmm
1st December 2011, 18:45
Same here... did anyone ever solve this?

Thanks
Derek