PDA

View Full Version : phonon VideoPlayer refresh



rbp
5th November 2008, 06:01
hello,

I'm having trouble seeking with the phonon VideoPlayer widget.
I want the user to be able to pause the video and then jump between different frames. Usually when I ask the video to seek it responds, but sometimes the video gets 'stuck' and won't update until I play and repause it.

Querying currentTime() tells me that the video knows it is at a new frame but the video is not updating:

video->pause();
video->seek(frame);
assert(video->currentTime() == frame); // no problem here

Is there a way to force the video to refresh to show the current frame? Or is there a way to determine whether the video has updated to the current frame?

In case it matters, I'm seeking using a SeekSlider (http://doc.trolltech.com/4.4/phonon-seekslider.html) connected to the video, although I had the same problem with a normal slider.

regards,
Richard

muellerp
5th November 2008, 10:14
I don't think this will work.

The seek( ms ) is in milliseconds and not in frames.

For sure it seems that you calculate with the frames at which ms it should be, but it is not the intention of this interface.

The seek is just forwarded to the phonon backend and basically it depends on the backend what it really does with this information. It may round or jump to something near to it.
This maybe especially the case, when the fps is not constant over time.

In order to see if it would work, I would look into the sources of your backend.
The backends don't have to many files, so the search may not take too long.

Also a google "phonon frames -electron" gives some hints for this topic, i.e. that in the experimental of kde phonon branch a frame based interface is intended, but for sure it is not in Phonon 4.2 which is shipped with Qt 4.4.

rbp
5th November 2008, 11:56
apologies for the confusing terminology. I meant ms.

My problem is not of translating between ms and frames but that when I seek to a position sometimes the video still shows the previous position. This only happens when the video is paused - if I seek when the video is playing it updates. Phonon seems to be too conservative with its updates when paused so I want to force a refresh.

muellerp
5th November 2008, 12:11
Which BE are you using?

and how about

videoWidget->repaint();

after your jump?

I mean, there may be reasons why it should not repaint automatically after a seek().

rbp
6th November 2008, 01:03
what does BE stand for?

yeah I've tried repaint() and update() but they don't make a difference. I suspected this was because the seeking is done asynchronously so at the time I call repaint() the player has not updated yet. However even when I tried calling repaint() periodically (every 100ms) the videoplayer still got stuck as before.

muellerp
6th November 2008, 08:48
Maybe it is not intended to be used as you want (that means not supported) or just wrongly supported (bug).

BE stands for Backend, so: Which backend do you use (gstreamer or xine on Linux, DS9 on Win or qt7 on Mac)?
This would help looking into the sources for detailed handling of VideoWidget and MediaObject of these backends for your case.

But you are right: Currently there doesn't seem to be a signal like seekFinished. Only the tick interval may help (but for sure you only need a one time shot).

rbp
14th November 2008, 02:56
from a discussion on the QT-interest mailing list I found that it is a codec problem. When I tried wmv files instead the seek worked but not for avi (which are smaller so I assume more compressed).