ext/dvdnav/dvdnavsrc.c: Fix name of custom event (use same as dvdreadsrc).

Original commit message from CVS:
* ext/dvdnav/dvdnavsrc.c: (gst_dvd_nav_src_push_titlelang_event):
Fix name of custom event (use same as dvdreadsrc).
* gst/dvdsub/gstdvdsubdec.c: (gst_dvd_sub_dec_chain),
(gst_dvd_sub_dec_sink_event), (gst_dvd_sub_dec_handle_dvd_event):
Fix event parsing (the event name is in the structure, not the
name of the structure itself); also fix indentation after
boilerplate macro.
This commit is contained in:
Tim-Philipp Müller 2006-04-25 12:17:02 +00:00
parent 24be286d0f
commit 62e9ba35b5
3 changed files with 68 additions and 42 deletions

View file

@ -1,3 +1,14 @@
2006-04-25 Tim-Philipp Müller <tim at centricular dot net>
* ext/dvdnav/dvdnavsrc.c: (gst_dvd_nav_src_push_titlelang_event):
Fix name of custom event (use same as dvdreadsrc).
* gst/dvdsub/gstdvdsubdec.c: (gst_dvd_sub_dec_chain),
(gst_dvd_sub_dec_sink_event), (gst_dvd_sub_dec_handle_dvd_event):
Fix event parsing (the event name is in the structure, not the
name of the structure itself); also fix indentation after
boilerplate macro.
2006-04-23 Tim-Philipp Müller <tim at centricular dot net> 2006-04-23 Tim-Philipp Müller <tim at centricular dot net>
* ext/mad/gstid3tag.c: (plugin_init): * ext/mad/gstid3tag.c: (plugin_init):

View file

@ -1183,7 +1183,7 @@ gst_dvd_nav_src_push_titlelang_event (GstDvdNavSrc * src)
/* build event */ /* build event */
s = gst_structure_new ("application/x-gst-event", s = gst_structure_new ("application/x-gst-dvd",
"event", G_TYPE_STRING, "dvd-lang-codes", NULL); "event", G_TYPE_STRING, "dvd-lang-codes", NULL);
e = gst_event_new_custom (GST_EVENT_CUSTOM_DOWNSTREAM, s); e = gst_event_new_custom (GST_EVENT_CUSTOM_DOWNSTREAM, s);

View file

@ -27,32 +27,28 @@
#include "gstdvdsubdec.h" #include "gstdvdsubdec.h"
#include <string.h> #include <string.h>
GST_BOILERPLATE (GstDvdSubDec, gst_dvd_sub_dec, GstElement, GST_TYPE_ELEMENT) GST_BOILERPLATE (GstDvdSubDec, gst_dvd_sub_dec, GstElement, GST_TYPE_ELEMENT);
static gboolean gst_dvd_sub_dec_src_event (GstPad * srcpad, static gboolean gst_dvd_sub_dec_src_event (GstPad * srcpad, GstEvent * event);
GstEvent * event); static GstFlowReturn gst_dvd_sub_dec_chain (GstPad * pad, GstBuffer * buf);
static GstFlowReturn gst_dvd_sub_dec_chain (GstPad * pad, GstBuffer * buf);
static gboolean gst_dvd_sub_dec_handle_dvd_event (GstDvdSubDec * dec, static gboolean gst_dvd_sub_dec_handle_dvd_event (GstDvdSubDec * dec,
GstEvent * event);
static void gst_dvd_sub_dec_finalize (GObject * gobject);
static void gst_setup_palette (GstDvdSubDec * dec);
static void gst_dvd_sub_dec_merge_title (GstDvdSubDec * dec,
GstBuffer * buf);
static GstClockTime gst_dvd_sub_dec_get_event_delay (GstDvdSubDec * dec);
static gboolean gst_dvd_sub_dec_sink_event (GstPad * pad,
GstEvent * event); GstEvent * event);
static void gst_dvd_sub_dec_finalize (GObject * gobject);
static void gst_setup_palette (GstDvdSubDec * dec);
static void gst_dvd_sub_dec_merge_title (GstDvdSubDec * dec, GstBuffer * buf);
static GstClockTime gst_dvd_sub_dec_get_event_delay (GstDvdSubDec * dec);
static gboolean gst_dvd_sub_dec_sink_event (GstPad * pad, GstEvent * event);
static GstFlowReturn gst_send_subtitle_frame (GstDvdSubDec * dec, static GstFlowReturn gst_send_subtitle_frame (GstDvdSubDec * dec,
GstClockTime end_ts); GstClockTime end_ts);
static GstElementDetails gst_dvd_sub_dec_details = { static const GstElementDetails gst_dvd_sub_dec_details =
"DVD subtitle Decoder", GST_ELEMENT_DETAILS ("DVD subtitle Decoder",
"Codec/Decoder/Video", "Codec/Decoder/Video",
"Decodes DVD subtitles into AYUV video frames", "Decodes DVD subtitles into AYUV video frames",
"Wim Taymans <wim.taymans@chello.be>, " "Wim Taymans <wim.taymans@chello.be>, "
"Jan Schmidt <thaytan@mad.scientist.com>" "Jan Schmidt <thaytan@mad.scientist.com>");
};
static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src", static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC, GST_PAD_SRC,
@ -742,7 +738,7 @@ gst_dvd_sub_dec_chain (GstPad * pad, GstBuffer * buf)
GST_TIME_FORMAT ", dur %" G_GINT64_FORMAT, GST_BUFFER_SIZE (buf), GST_TIME_FORMAT ", dur %" G_GINT64_FORMAT, GST_BUFFER_SIZE (buf),
GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf)), GST_BUFFER_DURATION (buf)); GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf)), GST_BUFFER_DURATION (buf));
if (GST_CLOCK_TIME_IS_VALID (GST_BUFFER_TIMESTAMP (buf))) { if (GST_BUFFER_TIMESTAMP_IS_VALID (buf)) {
if (!GST_CLOCK_TIME_IS_VALID (dec->next_ts)) { if (!GST_CLOCK_TIME_IS_VALID (dec->next_ts)) {
dec->next_ts = GST_BUFFER_TIMESTAMP (buf); dec->next_ts = GST_BUFFER_TIMESTAMP (buf);
} }
@ -806,26 +802,27 @@ gst_dvd_sub_dec_sink_event (GstPad * pad, GstEvent * event)
GstDvdSubDec *dec = GST_DVD_SUB_DEC (gst_pad_get_parent (pad)); GstDvdSubDec *dec = GST_DVD_SUB_DEC (gst_pad_get_parent (pad));
gboolean ret = FALSE; gboolean ret = FALSE;
GST_LOG_OBJECT (dec, "Handling %s event", GST_EVENT_TYPE_NAME (event)); GST_LOG_OBJECT (dec, "%s event", GST_EVENT_TYPE_NAME (event));
switch (GST_EVENT_TYPE (event)) { switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_CUSTOM_DOWNSTREAM:{ case GST_EVENT_CUSTOM_DOWNSTREAM:{
GstClockTime ts = GST_EVENT_TIMESTAMP (event); GstClockTime ts = GST_EVENT_TIMESTAMP (event);
GST_LOG_OBJECT (dec, "DVD event on subtitle pad with timestamp %llu", if (event->structure != NULL &&
GST_EVENT_TIMESTAMP (event)); gst_structure_has_name (event->structure, "application/x-gst-dvd")) {
if (GST_CLOCK_TIME_IS_VALID (ts)) if (GST_CLOCK_TIME_IS_VALID (ts))
gst_dvd_sub_dec_advance_time (dec, ts); gst_dvd_sub_dec_advance_time (dec, ts);
if (!gst_dvd_sub_dec_handle_dvd_event (dec, event)) { if (gst_dvd_sub_dec_handle_dvd_event (dec, event)) {
ret = gst_pad_event_default (pad, event); /* gst_dvd_sub_dec_advance_time (dec, dec->next_ts + GST_SECOND / 30.0); */
break; gst_event_unref (event);
ret = TRUE;
break;
}
} }
// gst_dvd_sub_dec_advance_time (dec, dec->next_ts + GST_SECOND / 30.0);
gst_event_unref (event); ret = gst_pad_event_default (pad, event);
ret = TRUE;
break; break;
} }
case GST_EVENT_NEWSEGMENT:{ case GST_EVENT_NEWSEGMENT:{
@ -900,10 +897,22 @@ static gboolean
gst_dvd_sub_dec_handle_dvd_event (GstDvdSubDec * dec, GstEvent * event) gst_dvd_sub_dec_handle_dvd_event (GstDvdSubDec * dec, GstEvent * event)
{ {
GstStructure *structure; GstStructure *structure;
const gchar *event_name;
structure = (GstStructure *) gst_event_get_structure (event); structure = (GstStructure *) gst_event_get_structure (event);
if (gst_structure_has_name (structure, "dvd-spu-highlight")) { if (structure == NULL)
goto not_handled;
event_name = gst_structure_get_string (structure, "event");
GST_LOG_OBJECT (dec, "DVD event %s with timestamp %lld on sub pad",
GST_STR_NULL (event_name), GST_EVENT_TIMESTAMP (event));
if (event_name == NULL)
goto not_handled;
if (strcmp (event_name, "dvd-spu-highlight") == 0) {
gint button; gint button;
gint palette, sx, sy, ex, ey; gint palette, sx, sy, ex, ey;
gint i; gint i;
@ -933,13 +942,13 @@ gst_dvd_sub_dec_handle_dvd_event (GstDvdSubDec * dec, GstEvent * event)
gst_setup_palette (dec); gst_setup_palette (dec);
dec->buf_dirty = TRUE; dec->buf_dirty = TRUE;
} else if (gst_structure_has_name (structure, "dvd-spu-clut-change")) { } else if (strcmp (event_name, "dvd-spu-clut-change") == 0) {
/* Take a copy of the colour table */ /* Take a copy of the colour table */
gchar name[16]; gchar name[16];
int i; int i;
gint value; gint value;
GST_LOG_OBJECT (dec, "New colour table recieved"); GST_LOG_OBJECT (dec, "New colour table received");
for (i = 0; i < 16; i++) { for (i = 0; i < 16; i++) {
g_snprintf (name, sizeof (name), "clut%02d", i); g_snprintf (name, sizeof (name), "clut%02d", i);
if (!gst_structure_get_int (structure, name, &value)) { if (!gst_structure_get_int (structure, name, &value)) {
@ -953,23 +962,29 @@ gst_dvd_sub_dec_handle_dvd_event (GstDvdSubDec * dec, GstEvent * event)
gst_setup_palette (dec); gst_setup_palette (dec);
dec->buf_dirty = TRUE; dec->buf_dirty = TRUE;
} else if (gst_structure_has_name (structure, "dvd-spu-stream-change") } else if (strcmp (event_name, "dvd-spu-stream-change") == 0
|| gst_structure_has_name (structure, "dvd-spu-reset-highlight")) { || strcmp (event_name, "dvd-spu-reset-highlight") == 0) {
/* Turn off forced highlight display */ /* Turn off forced highlight display */
dec->current_button = 0; dec->current_button = 0;
GST_LOG_OBJECT (dec, "Clearing button state"); GST_LOG_OBJECT (dec, "Clearing button state");
dec->buf_dirty = TRUE; dec->buf_dirty = TRUE;
} else if (gst_structure_has_name (structure, "dvd-spu-still-frame")) { } else if (strcmp (event_name, "dvd-spu-still-frame") == 0) {
/* Handle a still frame */ /* Handle a still frame */
GST_LOG_OBJECT (dec, "Received still frame notification"); GST_LOG_OBJECT (dec, "Received still frame notification");
} else { } else {
goto not_handled;
}
return TRUE;
not_handled:
{
/* Ignore all other unknown events */ /* Ignore all other unknown events */
GST_LOG_OBJECT (dec, "Ignoring other custom event %s", GST_LOG_OBJECT (dec, "Ignoring other custom event %" GST_PTR_FORMAT,
gst_structure_get_name (structure)); structure);
return FALSE; return FALSE;
} }
return TRUE;
} }
static gboolean static gboolean