diff --git a/ext/resindvd/resindvdsrc.c b/ext/resindvd/resindvdsrc.c index 7f342d3446..e5421ca3c5 100644 --- a/ext/resindvd/resindvdsrc.c +++ b/ext/resindvd/resindvdsrc.c @@ -1,5 +1,5 @@ /* GStreamer - * Copyright (C) 2008 Jan Schmidt + * Copyright (C) 2008-2009 Jan Schmidt * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -27,6 +27,7 @@ #include #include #include +#include #include "resindvdsrc.h" @@ -597,7 +598,6 @@ rsn_dvdsrc_do_still (resinDvdSrc * src, int duration) GstEvent *still_event; GstEvent *hl_event; gboolean cmds_changed; - GstStructure *s; GstEvent *seg_event; GstSegment *segment = &(RSN_BASE_SRC (src)->segment); @@ -610,12 +610,9 @@ rsn_dvdsrc_do_still (resinDvdSrc * src, int duration) else src->still_time_remaining = GST_SECOND * duration; - /* Send a close-segment event, and a dvd-still start + /* Send a close-segment event, and a still-frame start * event, then sleep */ - s = gst_structure_new ("application/x-gst-dvd", - "event", G_TYPE_STRING, "dvd-still", - "still-state", G_TYPE_BOOLEAN, TRUE, NULL); - still_event = gst_event_new_custom (GST_EVENT_CUSTOM_DOWNSTREAM, s); + still_event = gst_video_event_new_still_frame (TRUE); gst_segment_set_last_stop (segment, GST_FORMAT_TIME, src->cur_end_ts); @@ -734,10 +731,7 @@ rsn_dvdsrc_do_still (resinDvdSrc * src, int duration) /* Tell downstream the still is over. * We only do this if the still isn't interrupted: */ - s = gst_structure_new ("application/x-gst-dvd", - "event", G_TYPE_STRING, "dvd-still", - "still-state", G_TYPE_BOOLEAN, FALSE, NULL); - still_event = gst_event_new_custom (GST_EVENT_CUSTOM_DOWNSTREAM, s); + still_event = gst_video_event_new_still_frame (FALSE); /* If the segment was too short in a timed still, it may need extending */ if (segment->last_stop < segment->start + GST_SECOND * duration) diff --git a/ext/resindvd/rsnaudiomunge.c b/ext/resindvd/rsnaudiomunge.c index 715bd62b3f..7c8cfde085 100644 --- a/ext/resindvd/rsnaudiomunge.c +++ b/ext/resindvd/rsnaudiomunge.c @@ -23,6 +23,7 @@ #include #include +#include #include "rsnaudiomunge.h" @@ -234,31 +235,6 @@ rsn_audiomunge_make_audio (RsnAudioMunge * munge, return ret; } -static void -rsn_audiomunge_handle_dvd_event (RsnAudioMunge * munge, GstEvent * event) -{ - const GstStructure *s; - const gchar *event_type; - - s = gst_event_get_structure (event); - event_type = gst_structure_get_string (s, "event"); - if (event_type == NULL) - return; - - if (strcmp (event_type, "dvd-still") == 0) { - gboolean in_still; - - if (!gst_structure_get_boolean (s, "still-state", &in_still)) - return; - - /* Remember the still-frame state, so we can generate a pre-roll buffer - * when a new-segment arrives */ - munge->in_still = in_still; - - GST_INFO_OBJECT (munge, "AUDIO MUNGE: still-state now %d", munge->in_still); - } -} - static gboolean rsn_audiomunge_sink_event (GstPad * pad, GstEvent * event) { @@ -346,10 +322,15 @@ rsn_audiomunge_sink_event (GstPad * pad, GstEvent * event) } case GST_EVENT_CUSTOM_DOWNSTREAM: { - const GstStructure *s = gst_event_get_structure (event); + gboolean in_still; - if (s && gst_structure_has_name (s, "application/x-gst-dvd")) - rsn_audiomunge_handle_dvd_event (munge, event); + if (gst_video_event_parse_still_frame (event, &in_still)) { + /* Remember the still-frame state, so we can generate a pre-roll + * buffer when a new-segment arrives */ + munge->in_still = in_still; + GST_INFO_OBJECT (munge, "AUDIO MUNGE: still-state now %d", + munge->in_still); + } ret = gst_pad_push_event (munge->srcpad, event); break; diff --git a/gst/dvdspu/Makefile.am b/gst/dvdspu/Makefile.am index 950ed82c7d..90e8ddd5e5 100644 --- a/gst/dvdspu/Makefile.am +++ b/gst/dvdspu/Makefile.am @@ -3,8 +3,9 @@ plugin_LTLIBRARIES = libgstdvdspu.la libgstdvdspu_la_SOURCES = gstdvdspu.c gstdvdspu-render.c gstspu-vobsub.c gstspu-vobsub-render.c gstspu-pgs.c -libgstdvdspu_la_CFLAGS = $(GST_CFLAGS) -libgstdvdspu_la_LIBADD = $(GST_LIBS) +libgstdvdspu_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS) +libgstdvdspu_la_LIBADD = $(GST_PLUGINS_BASE_LIBS) -lgstvideo-$(GST_MAJORMINOR) \ + $(GST_LIBS) libgstdvdspu_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) libgstdvdspu_la_LIBTOOLFLAGS = --tag=disable-static diff --git a/gst/dvdspu/gstdvdspu.c b/gst/dvdspu/gstdvdspu.c index 0d7684ec26..fd51e262d6 100644 --- a/gst/dvdspu/gstdvdspu.c +++ b/gst/dvdspu/gstdvdspu.c @@ -33,6 +33,7 @@ #endif #include +#include #include @@ -402,61 +403,38 @@ gst_dvd_spu_video_event (GstPad * pad, GstEvent * event) case GST_EVENT_CUSTOM_DOWNSTREAM: case GST_EVENT_CUSTOM_DOWNSTREAM_OOB: { - const GstStructure *structure = gst_event_get_structure (event); - const char *event_type; + gboolean in_still; - if (structure == NULL) { - res = gst_pad_event_default (pad, event); - break; - } - - if (!gst_structure_has_name (structure, "application/x-gst-dvd")) { - res = gst_pad_event_default (pad, event); - break; - } - - event_type = gst_structure_get_string (structure, "event"); - if (event_type == NULL) { - res = gst_pad_event_default (pad, event); - break; - } - - if (strcmp (event_type, "dvd-still") == 0) { - gboolean in_still; + if (gst_video_event_parse_still_frame (event, &in_still)) { + GstBuffer *to_push = NULL; /* Forward the event before handling */ res = gst_pad_event_default (pad, event); - if (gst_structure_get_boolean (structure, "still-state", &in_still)) { - GstBuffer *to_push = NULL; + GST_DEBUG_OBJECT (dvdspu, + "Still frame event on video pad: in-still = %d", in_still); - GST_DEBUG_OBJECT (dvdspu, - "DVD event of type %s on video pad: in-still = %d", event_type, - in_still); - - DVD_SPU_LOCK (dvdspu); - if (in_still) { - state->flags |= SPU_STATE_STILL_FRAME; - /* Entering still. Advance the SPU to make sure the state is - * up to date */ - gst_dvd_spu_check_still_updates (dvdspu); - /* And re-draw the still frame to make sure it appears on - * screen, otherwise the last frame might have been discarded - * by QoS */ - gst_dvd_spu_redraw_still (dvdspu, TRUE); - to_push = dvdspu->pending_frame; - dvdspu->pending_frame = NULL; - - } else { - state->flags &= ~(SPU_STATE_STILL_FRAME); - } - DVD_SPU_UNLOCK (dvdspu); - if (to_push) - gst_pad_push (dvdspu->srcpad, to_push); + DVD_SPU_LOCK (dvdspu); + if (in_still) { + state->flags |= SPU_STATE_STILL_FRAME; + /* Entering still. Advance the SPU to make sure the state is + * up to date */ + gst_dvd_spu_check_still_updates (dvdspu); + /* And re-draw the still frame to make sure it appears on + * screen, otherwise the last frame might have been discarded + * by QoS */ + gst_dvd_spu_redraw_still (dvdspu, TRUE); + to_push = dvdspu->pending_frame; + dvdspu->pending_frame = NULL; + } else { + state->flags &= ~(SPU_STATE_STILL_FRAME); } + DVD_SPU_UNLOCK (dvdspu); + if (to_push) + gst_pad_push (dvdspu->srcpad, to_push); } else { GST_DEBUG_OBJECT (dvdspu, - "DVD event of type %s on video pad", event_type); + "Custom event %" GST_PTR_FORMAT " on video pad", event); res = gst_pad_event_default (pad, event); } break;