diff options
author | Jan Schmidt <thaytan@noraisin.net> | 2012-09-09 16:40:00 -0700 |
---|---|---|
committer | Jan Schmidt <thaytan@noraisin.net> | 2012-09-12 23:05:47 -0700 |
commit | 8d5c1be31200c8f6380ee0116a9b2b31fb253b9f (patch) | |
tree | 59f5ae30d787a3ca027f74bdff7d8a9382cc78c2 | |
parent | 16f5120d96070a86c420fe7d8ddb27340b0d8b6c (diff) | |
download | gstreamer-plugins-bad-8d5c1be31200c8f6380ee0116a9b2b31fb253b9f.tar.gz |
dvdspu: Advance video stream with gap events.
Handle Gap events the way we used to handle segment updates
and advance/fill in the video stream accordingly. Fixes
'still' menus which aren't DVD still frames, but are just a
single frame with accompanying audio.
-rw-r--r-- | gst/dvdspu/gstdvdspu.c | 52 |
1 files changed, 38 insertions, 14 deletions
diff --git a/gst/dvdspu/gstdvdspu.c b/gst/dvdspu/gstdvdspu.c index 0eb84f38b..41d6169c3 100644 --- a/gst/dvdspu/gstdvdspu.c +++ b/gst/dvdspu/gstdvdspu.c @@ -380,6 +380,27 @@ gst_dvd_spu_video_proxy_getcaps (GstPad * pad, GstCaps * filter) return caps; } +/* With SPU lock held */ +static void +update_video_to_position (GstDVDSpu * dvdspu, GstClockTime new_pos) +{ + SpuState *state = &dvdspu->spu_state; +#if 0 + g_print ("Segment update for video. Advancing from %" GST_TIME_FORMAT + " to %" GST_TIME_FORMAT "\n", + GST_TIME_ARGS (dvdspu->video_seg.position), GST_TIME_ARGS (start)); +#endif + while (dvdspu->video_seg.position < new_pos && + !(state->flags & SPU_STATE_STILL_FRAME)) { + DVD_SPU_UNLOCK (dvdspu); + if (dvdspu_handle_vid_buffer (dvdspu, NULL) != GST_FLOW_OK) { + DVD_SPU_LOCK (dvdspu); + break; + } + DVD_SPU_LOCK (dvdspu); + } +} + static gboolean gst_dvd_spu_video_event (GstPad * pad, GstObject * parent, GstEvent * event) { @@ -456,20 +477,7 @@ gst_dvd_spu_video_event (GstPad * pad, GstObject * parent, GstEvent * event) DVD_SPU_LOCK (dvdspu); if (seg.start > dvdspu->video_seg.position) { -#if 0 - g_print ("Segment update for video. Advancing from %" GST_TIME_FORMAT - " to %" GST_TIME_FORMAT "\n", - GST_TIME_ARGS (dvdspu->video_seg.position), GST_TIME_ARGS (start)); -#endif - while (dvdspu->video_seg.position < seg.start && - !(state->flags & SPU_STATE_STILL_FRAME)) { - DVD_SPU_UNLOCK (dvdspu); - if (dvdspu_handle_vid_buffer (dvdspu, NULL) != GST_FLOW_OK) { - DVD_SPU_LOCK (dvdspu); - break; - } - DVD_SPU_LOCK (dvdspu); - } + update_video_to_position (dvdspu, seg.start); } dvdspu->video_seg = seg; @@ -478,6 +486,22 @@ gst_dvd_spu_video_event (GstPad * pad, GstObject * parent, GstEvent * event) res = gst_pad_event_default (pad, parent, event); break; } + case GST_EVENT_GAP: + { + GstClockTime timestamp, duration; + gst_event_parse_gap (event, ×tamp, &duration); + if (GST_CLOCK_TIME_IS_VALID (duration)) + timestamp += duration; + + DVD_SPU_LOCK (dvdspu); + GST_LOG_OBJECT (dvdspu, "Received GAP. Advancing to %" GST_TIME_FORMAT, + GST_TIME_ARGS (timestamp)); + update_video_to_position (dvdspu, timestamp); + DVD_SPU_UNLOCK (dvdspu); + + gst_event_unref (event); + break; + } case GST_EVENT_FLUSH_START: res = gst_pad_event_default (pad, parent, event); goto done; |