[gst-devel] mpeg1 playback question

Wim Taymans wim.taymans at chello.be
Fri Jul 12 00:00:12 CEST 2002


> i ported my 0.3.1 video player to 0.4.0.  It was fairly painless, but
> i still have some questions:
>
>
>+ i'm not sure how to do the old seek-by-offset.  Here is my new code:
>
> GstEvent *ev =
>    gst_event_new_seek (GST_SEEK_METHOD_SET|GST_FORMAT_BYTES|
>                        GST_SEEK_FLAG_FLUSH, offset);
>  gst_pad_send_event (gst_element_get_pad (fv->cur_source->elem,
"src"), ev);
>

The idea with the seek is to send the event as close to a sink element
as possible, so
that all element in the pipeline can participate in the seek (ans
resync)
Sending the event on a source should eventually work but I don't think
all plugins deal
with the DISCONT event properly

>
> Does this look correct?  It doesn't work very well.  The player
freezes
> after a few seeks.  gst-player does much better (i couldn't get it to
> freeze at all).
>

The seek should be done on videosink (or audiosink)

> Do i need to route the seek through gstmpegparse.c?  If so, shall i
> submit a patch to add seek-by-offset support to
gst_mpeg_parse_handle_src_event?
>
>
> + How do i translate byte-offset into time-offset?  i see that i can
> query the bit_rate, but i'd prefer a simple time-offset API.  Am i
> looking for gst_clock_get_time()?
>
gst_clock_get_time() is pretty unrelated. You just want to seek on an
element
that can do time seeking (mpeg2dec for example)

>
>+ The other problem is that the video & audio are out of sync.  This is

>not a problem of my machine is too slow.  The player takes about 13% of

>my CPU.  mplayer can play DVDs without dropping frames.  There is some
>kind of clock sync problem.  Either the video is too slow and the audio

>is choppy, or the video is too fast and the audio doesn't play at all.
>gst-player has the same problem (but with less severity).
>
Don't know about this one

>i think i'm missing something basic about clocks.  How do i add a
>clock to my pipeline?  What is the new "sync" property in mpegdemux?

A clock is just to sync streams in a pipeline, usually the clock is
selected automatically
from the list of elements that provide a clock. If no element provides a
clock,
a simple system clock is used. You can explicitly set a clock with
gst_bin_use_clock.

The sync property in mpegdemux is makes mpegdemux sync the SCR on the
clock, which
makes sure that the audio and video queues are not flooded with data.

Regards,

Wim

--
Victory to the Divine Mother!!         after all,
  http://sahajayoga.org                  http://why-compete.org






More information about the gstreamer-devel mailing list