From e2a039a53e2f26e1be0297b4cd199613b6193438 Mon Sep 17 00:00:00 2001 From: Jan Schmidt Date: Sat, 30 Sep 2006 15:30:07 +0000 Subject: [PATCH] gst/playback/gstdecodebin.c: Fix typo in a debug statement. Original commit message from CVS: * gst/playback/gstdecodebin.c: (close_pad_link): Fix typo in a debug statement. * gst/playback/gstplaybasebin.c: (probe_triggered), (new_decoded_pad_full), (new_decoded_pad), (subs_new_decoded_pad), (gen_source_element), (source_new_pad), (analyse_source), (setup_source): When handling no_more_pads in new_decoded_pad, make sure to treat subtitle pads correctly. Fixes playback with subtitle files. Move a recurring message to LOG level. * sys/xvimage/xvimagesink.c: (gst_xvimagesink_get_xv_support): The maximum value for the Xv colorkey on this Radeon is 0xFFFFFFFF, which ends up as -1 when cast to an int. Make the logic handle the max value as an unsigned mask and only change the colorkey when it's a value we recognise. --- ChangeLog | 20 ++++++++++++++++ gst/playback/gstdecodebin.c | 2 +- gst/playback/gstplaybasebin.c | 40 ++++++++++++++++++++++--------- sys/xvimage/xvimagesink.c | 44 ++++++++++++++++++++++++++--------- 4 files changed, 83 insertions(+), 23 deletions(-) diff --git a/ChangeLog b/ChangeLog index d28425a603..3c5c84c7fe 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,23 @@ +2006-09-30 Jan Schmidt + + * gst/playback/gstdecodebin.c: (close_pad_link): + Fix typo in a debug statement. + + * gst/playback/gstplaybasebin.c: (probe_triggered), + (new_decoded_pad_full), (new_decoded_pad), (subs_new_decoded_pad), + (gen_source_element), (source_new_pad), (analyse_source), + (setup_source): + When handling no_more_pads in new_decoded_pad, make sure to treat + subtitle pads correctly. Fixes playback with subtitle files. + + Move a recurring message to LOG level. + + * sys/xvimage/xvimagesink.c: (gst_xvimagesink_get_xv_support): + The maximum value for the Xv colorkey on this Radeon is 0xFFFFFFFF, + which ends up as -1 when cast to an int. Make the logic handle the + max value as an unsigned mask and only change the colorkey when it's + a value we recognise. + 2006-09-29 Philippe Kalaf * gst-libs/gst/rtp/gstbasertpaudiopayload.c: diff --git a/gst/playback/gstdecodebin.c b/gst/playback/gstdecodebin.c index 1cefcd3531..e4f1850c8c 100644 --- a/gst/playback/gstdecodebin.c +++ b/gst/playback/gstdecodebin.c @@ -736,7 +736,7 @@ close_pad_link (GstElement * element, GstPad * pad, GstCaps * caps, /* ERRORS */ unknown_type: { - GST_LOG_OBJECT (pad, "unkown type found, fire signal"); + GST_LOG_OBJECT (pad, "unknown type found, fire signal"); g_signal_emit (G_OBJECT (decode_bin), gst_decode_bin_signals[SIGNAL_UNKNOWN_TYPE], 0, pad, caps); return; diff --git a/gst/playback/gstplaybasebin.c b/gst/playback/gstplaybasebin.c index a51f754348..22c021c35e 100644 --- a/gst/playback/gstplaybasebin.c +++ b/gst/playback/gstplaybasebin.c @@ -993,7 +993,7 @@ probe_triggered (GstPad * pad, GstEvent * event, gpointer user_data) type = GST_EVENT_TYPE (event); - GST_DEBUG ("probe triggered, (%d) %s", type, gst_event_type_get_name (type)); + GST_LOG ("probe triggered, (%d) %s", type, gst_event_type_get_name (type)); /* we only care about EOS */ if (type != GST_EVENT_EOS) @@ -1135,12 +1135,13 @@ silence_stream (GstPad * pad, GstMiniObject * data, gpointer user_data) return FALSE; } -/* signal fired when decodebin has found a new raw pad. We create - * a preroll element if needed and the appropriate streaminfo. - */ +/* Called by the signal handlers when a decodebin (main or subtitle) has + * found a new raw pad. We create a preroll element if needed and the + * appropriate streaminfo. Commits the group if there will be no more pads + * from decodebin */ static void -new_decoded_pad (GstElement * element, GstPad * pad, gboolean last, - GstPlayBaseBin * play_base_bin) +new_decoded_pad_full (GstElement * element, GstPad * pad, gboolean last, + GstPlayBaseBin * play_base_bin, gboolean is_subs) { GstStructure *structure; const gchar *mimetype; @@ -1152,7 +1153,7 @@ new_decoded_pad (GstElement * element, GstPad * pad, gboolean last, guint sig; GstObject *parent; - GST_DEBUG ("play base: new decoded pad %d", last); + GST_DEBUG ("play base: new decoded pad. Last: %d", last); /* first see if this pad has interesting caps */ caps = gst_pad_get_caps (pad); @@ -1227,7 +1228,7 @@ new_decoded_pad (GstElement * element, GstPad * pad, gboolean last, /* signal the no more pads after adding the stream */ if (last) - no_more_pads (element, play_base_bin); + no_more_pads_full (element, is_subs, play_base_bin); return; @@ -1241,6 +1242,20 @@ no_type: } } +static void +new_decoded_pad (GstElement * element, GstPad * pad, gboolean last, + GstPlayBaseBin * play_base_bin) +{ + new_decoded_pad_full (element, pad, last, play_base_bin, FALSE); +} + +static void +subs_new_decoded_pad (GstElement * element, GstPad * pad, gboolean last, + GstPlayBaseBin * play_base_bin) +{ + new_decoded_pad_full (element, pad, last, play_base_bin, TRUE); +} + static void set_encoding_element (GstElement * element, gchar * encoding) { @@ -1392,6 +1407,8 @@ gen_source_element (GstPlayBaseBin * play_base_bin, GstElement ** subbin) goto uri_blacklisted; if (play_base_bin->suburi) { + GST_LOG_OBJECT (play_base_bin, "Creating decoder for subtitles URI %s", + play_base_bin->suburi); /* subtitle specified */ *subbin = setup_subtitle (play_base_bin, play_base_bin->suburi); } else { @@ -1464,7 +1481,7 @@ source_new_pad (GstElement * element, GstPad * pad, GstPlayBaseBin * bin) /* if this is a pad with all raw caps, we can expose it */ if (has_all_raw_caps (pad, &is_raw) && is_raw) { /* it's all raw, create output pads. */ - new_decoded_pad (element, pad, FALSE, bin); + new_decoded_pad_full (element, pad, FALSE, bin, FALSE); return; } @@ -1655,7 +1672,8 @@ analyse_source (GstPlayBaseBin * play_base_bin, gboolean * is_raw, /* caps on source pad are all raw, we can add the pad */ if (*is_raw) - new_decoded_pad (play_base_bin->source, pad, FALSE, play_base_bin); + new_decoded_pad_full (play_base_bin->source, pad, FALSE, + play_base_bin, FALSE); break; } } @@ -1806,7 +1824,7 @@ setup_source (GstPlayBaseBin * play_base_bin, gchar ** new_location) /* do type detection, without adding (so no preroll) */ g_signal_connect (G_OBJECT (db), "new-decoded-pad", - G_CALLBACK (new_decoded_pad), play_base_bin); + G_CALLBACK (subs_new_decoded_pad), play_base_bin); g_signal_connect (G_OBJECT (db), "no-more-pads", G_CALLBACK (sub_no_more_pads), play_base_bin); g_signal_connect (G_OBJECT (db), "unknown-type", diff --git a/sys/xvimage/xvimagesink.c b/sys/xvimage/xvimagesink.c index 89775e5e15..8ea22ad534 100644 --- a/sys/xvimage/xvimagesink.c +++ b/sys/xvimage/xvimagesink.c @@ -1191,21 +1191,43 @@ gst_xvimagesink_get_xv_support (GstXvImageSink * xvimagesink, for (i = 0; i < count; i++) if (!strcmp (attr[i].name, colorkey)) { const Atom atom = XInternAtom (xcontext->disp, colorkey, False); - int ckey; + guint32 ckey; + guint32 keymask; + gint bits; + gboolean set_attr = TRUE; + + /* Count the bits in the colorkey mask 'max' value */ + bits = 0; + for (keymask = (guint32) (attr[i].max_value); + keymask != 0; keymask >>= 1) + bits++; /* set a colorkey in the right format RGB565/RGB888 - * note that the colorkey is independent from the display depth (xcontext->depth) - */ - ckey = - attr[i].max_value <= - 0xffff ? ((1 << 10) | (2 << 5) | 3) : ((1 << 16) | (2 << 8) | 3); - ckey = CLAMP (ckey, attr[i].min_value, attr[i].max_value); + * note that the colorkey is independent from the display + * depth (xcontext->depth). We only handle these 2 cases, because + * they're the only types of devices we've encountered. If we don't + * recognise it, leave it alone */ + if (bits == 16) + ckey = (1 << 10) | (2 << 5) | 3; + else if (bits == 24 || bits == 32) + ckey = (1 << 16) | (2 << 8) | 3; + else + set_attr = FALSE; - GST_LOG_OBJECT (xvimagesink, - "Setting color key for display depth %d to 0x%x", - xcontext->depth, ckey); - XvSetPortAttribute (xcontext->disp, xcontext->xv_port_id, atom, ckey); + if (set_attr) { + ckey = CLAMP (ckey, (guint32) attr[i].min_value, + (guint32) attr[i].max_value); + GST_LOG_OBJECT (xvimagesink, + "Setting color key for display depth %d to 0x%x", + xcontext->depth, ckey); + + XvSetPortAttribute (xcontext->disp, xcontext->xv_port_id, atom, + (gint) ckey); + } else { + GST_LOG_OBJECT (xvimagesink, + "Unknown bit depth for Xv Colorkey - not adjusting "); + } break; }