[gst-cvs] gst-plugins-bad: resindvd, dvdspu: Use new still-frame API from gst-plugins-base
Jan Schmidt
thaytan at kemper.freedesktop.org
Tue Nov 17 19:17:14 PST 2009
Module: gst-plugins-bad
Branch: master
Commit: 6b45854967c45a1012613859cc432b4e276250eb
URL: http://cgit.freedesktop.org/gstreamer/gst-plugins-bad/commit/?id=6b45854967c45a1012613859cc432b4e276250eb
Author: Jan Schmidt <thaytan at noraisin.net>
Date: Wed Nov 18 03:09:18 2009 +0000
resindvd, dvdspu: Use new still-frame API from gst-plugins-base
Replace the current custom DVD still-frame events with new event
creation/parsing API from libgstvideo.
---
ext/resindvd/resindvdsrc.c | 16 +++------
ext/resindvd/rsnaudiomunge.c | 39 ++++++-----------------
gst/dvdspu/Makefile.am | 5 ++-
gst/dvdspu/gstdvdspu.c | 70 ++++++++++++++---------------------------
4 files changed, 42 insertions(+), 88 deletions(-)
diff --git a/ext/resindvd/resindvdsrc.c b/ext/resindvd/resindvdsrc.c
index 7f342d3..e5421ca 100644
--- a/ext/resindvd/resindvdsrc.c
+++ b/ext/resindvd/resindvdsrc.c
@@ -1,5 +1,5 @@
/* GStreamer
- * Copyright (C) 2008 Jan Schmidt <thaytan at noraisin.net>
+ * Copyright (C) 2008-2009 Jan Schmidt <thaytan at noraisin.net>
*
* 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 <gst/gst.h>
#include <gst/gst-i18n-plugin.h>
#include <gst/interfaces/navigation.h>
+#include <gst/video/video.h>
#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 715bd62..7c8cfde 100644
--- a/ext/resindvd/rsnaudiomunge.c
+++ b/ext/resindvd/rsnaudiomunge.c
@@ -23,6 +23,7 @@
#include <string.h>
#include <gst/gst.h>
+#include <gst/video/video.h>
#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);
-
- if (s && gst_structure_has_name (s, "application/x-gst-dvd"))
- rsn_audiomunge_handle_dvd_event (munge, event);
+ gboolean in_still;
+
+ 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 950ed82..90e8ddd 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 0d7684e..fd51e26 100644
--- a/gst/dvdspu/gstdvdspu.c
+++ b/gst/dvdspu/gstdvdspu.c
@@ -33,6 +33,7 @@
#endif
#include <gst/gst-i18n-plugin.h>
+#include <gst/video/video.h>
#include <string.h>
@@ -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,
- "DVD event of type %s on video pad: in-still = %d", event_type,
- in_still);
+ GST_DEBUG_OBJECT (dvdspu,
+ "Still frame event on video pad: in-still = %d", 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;
More information about the Gstreamer-commits
mailing list