From 9ffb8859d78ad1c111b6d2b2e1ded0c11aaacfee Mon Sep 17 00:00:00 2001 From: Arun Raghavan Date: Wed, 3 Nov 2010 14:37:07 +0530 Subject: [PATCH 01/13] discoverer: Don't wait for subtitle streams to preroll Subtitle streams being parse can cause the pipeline to wait indefinitely to PREROLL. This makes subtitle streams got to PAUSED even if no data is available. This should not be a cause for concern as we don't expect to get much data for subtitle streams other than language tags from the container. https://bugzilla.gnome.org/show_bug.cgi?id=632291 --- gst-libs/gst/pbutils/gstdiscoverer.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/gst-libs/gst/pbutils/gstdiscoverer.c b/gst-libs/gst/pbutils/gstdiscoverer.c index 4a7d72d27d..58d3e5288b 100644 --- a/gst-libs/gst/pbutils/gstdiscoverer.c +++ b/gst-libs/gst/pbutils/gstdiscoverer.c @@ -443,6 +443,15 @@ uridecodebin_pad_added_cb (GstElement * uridecodebin, GstPad * pad, { PrivateStream *ps; GstPad *sinkpad = NULL; + GstCaps *caps; + static GstCaps *subs_caps = NULL; + + if (!subs_caps) { + subs_caps = gst_caps_from_string ("text/plain; text/x-pango-markup; " + "subpicture/x-pgs; subpicture/x-dvb; application/x-subtitle-unknown; " + "application/x-ssa; application/x-ass; subtitle/x-kate; " + "video/x-dvd-subpicture; "); + } GST_DEBUG_OBJECT (dc, "pad %s:%s", GST_DEBUG_PAD_NAME (pad)); @@ -459,6 +468,16 @@ uridecodebin_pad_added_cb (GstElement * uridecodebin, GstPad * pad, g_object_set (ps->sink, "silent", TRUE, NULL); g_object_set (ps->queue, "max-size-buffers", 1, "silent", TRUE, NULL); + caps = gst_pad_get_caps_reffed (pad); + + if (gst_caps_can_intersect (caps, subs_caps)) { + /* Subtitle streams are sparse and don't provide any information - don't + * wait for data to preroll */ + g_object_set (ps->sink, "async", FALSE, NULL); + } + + gst_caps_unref (caps); + gst_bin_add_many (dc->priv->pipeline, ps->queue, ps->sink, NULL); if (!gst_element_link_pads_full (ps->queue, "src", ps->sink, "sink", From 8c13488022051543d1d653e83e0d35b632a63646 Mon Sep 17 00:00:00 2001 From: Andoni Morales Alastruey Date: Fri, 22 Oct 2010 14:01:26 +0200 Subject: [PATCH 02/13] multifdsink: disconnect inactive clients in the select loop too Clients are usually disconnected in the streaming thread if their inactivity is bigger than the timeout. If no new buffers are to be rendered in the sink, these clients will never be disconnected and for that reason it should be handled in the select() loop too. --- gst/tcp/gstmultifdsink.c | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/gst/tcp/gstmultifdsink.c b/gst/tcp/gstmultifdsink.c index 4072eefb87..00cff05ec8 100644 --- a/gst/tcp/gstmultifdsink.c +++ b/gst/tcp/gstmultifdsink.c @@ -2447,10 +2447,34 @@ gst_multi_fd_sink_handle_clients (GstMultiFdSink * sink) * - client socket input (ie, clients saying goodbye) * - client socket output (ie, client reads) */ GST_LOG_OBJECT (sink, "waiting on action on fdset"); - result = gst_poll_wait (sink->fdset, GST_CLOCK_TIME_NONE); - /* < 0 is an error, 0 just means a timeout happened, which is impossible */ - if (result < 0) { + result = gst_poll_wait (sink->fdset, sink->timeout != 0 ? sink->timeout : + GST_CLOCK_TIME_NONE); + + /* Handle the special case in which the sink is not receiving more buffers + * and will not disconnect innactive client in the streaming thread. */ + if (G_UNLIKELY (result == 0)) { + GstClockTime now; + GTimeVal nowtv; + + g_get_current_time (&nowtv); + now = GST_TIMEVAL_TO_TIME (nowtv); + + CLIENTS_LOCK (sink); + for (clients = sink->clients; clients; clients = next) { + GstTCPClient *client; + + client = (GstTCPClient *) clients->data; + next = g_list_next (clients); + if (sink->timeout > 0 + && now - client->last_activity_time > sink->timeout) { + client->status = GST_CLIENT_STATUS_SLOW; + gst_multi_fd_sink_remove_client_link (sink, clients); + } + } + CLIENTS_UNLOCK (sink); + return; + } else if (result < 0) { GST_WARNING_OBJECT (sink, "wait failed: %s (%d)", g_strerror (errno), errno); if (errno == EBADF) { From 4ee738be590348912ae3af607711af8b4550ad3f Mon Sep 17 00:00:00 2001 From: Thiago Santos Date: Thu, 10 Mar 2011 14:38:47 -0300 Subject: [PATCH 03/13] encodebin: Tear down old profiles when setting new ones In NULL/READY, we should be able to switch profiles on encodebin, this patch makes it tear down old profiles when new ones are set if in NULL/READY states https://bugzilla.gnome.org/show_bug.cgi?id=644416 --- gst/encoding/gstencodebin.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gst/encoding/gstencodebin.c b/gst/encoding/gstencodebin.c index c1a0e8bbc0..51b93ce9a8 100644 --- a/gst/encoding/gstencodebin.c +++ b/gst/encoding/gstencodebin.c @@ -1698,9 +1698,9 @@ gst_encode_bin_set_profile (GstEncodeBin * ebin, GstEncodingProfile * profile) } /* If we're not active, we can deactivate the previous profile */ - if (ebin->profile) - gst_encoding_profile_unref (ebin->profile); - ebin->profile = NULL; + if (ebin->profile) { + gst_encode_bin_tear_down_profile (ebin); + } return gst_encode_bin_setup_profile (ebin, profile); } From 40eaac6191b4a3ab58a5d134e6b2ad015ec5b19d Mon Sep 17 00:00:00 2001 From: Thiago Santos Date: Thu, 10 Mar 2011 14:22:38 -0300 Subject: [PATCH 04/13] tests: encodebin: Add reuse test case Adds a test case to check if encodebin can be reused https://bugzilla.gnome.org/show_bug.cgi?id=644416 --- tests/check/elements/encodebin.c | 61 ++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/tests/check/elements/encodebin.c b/tests/check/elements/encodebin.c index 3b5d66ad82..03ff262806 100644 --- a/tests/check/elements/encodebin.c +++ b/tests/check/elements/encodebin.c @@ -810,6 +810,66 @@ GST_START_TEST (test_encodebin_impossible_element_combination) GST_END_TEST; +static void +_test_encodebin_reuse (GstEncodingProfile * prof1, GstEncodingProfile * prof2) +{ + GstElement *ebin; + + ebin = gst_element_factory_make ("encodebin", NULL); + + /* Set a profile on encodebin... */ + if (prof1) + g_object_set (ebin, "profile", prof1, NULL); + + /* Make sure we can go to PAUSED */ + fail_unless_equals_int (gst_element_set_state (ebin, GST_STATE_PAUSED), + GST_STATE_CHANGE_SUCCESS); + + /* Set back to NULL */ + fail_unless_equals_int (gst_element_set_state (ebin, GST_STATE_NULL), + GST_STATE_CHANGE_SUCCESS); + + if (prof2) + g_object_set (ebin, "profile", prof2, NULL); + + /* Make sure we can go to PLAYING */ + fail_unless_equals_int (gst_element_set_state (ebin, GST_STATE_PAUSED), + GST_STATE_CHANGE_SUCCESS); + + /* Set back to NULL */ + fail_unless_equals_int (gst_element_set_state (ebin, GST_STATE_NULL), + GST_STATE_CHANGE_SUCCESS); + + gst_object_unref (ebin); +} + +GST_START_TEST (test_encodebin_reuse) +{ + GstEncodingProfile *prof1; + GstEncodingProfile *prof2; + GstEncodingProfile *prof3; + GstCaps *caps; + + caps = gst_caps_new_simple ("application/ogg", NULL); + prof1 = (GstEncodingProfile *) gst_encoding_container_profile_new ((gchar *) + "myprofile", NULL, caps, NULL); + gst_caps_unref (caps); + + prof2 = create_ogg_theora_vorbis_profile (1, 1); + prof3 = create_vorbis_only_profile (); + + _test_encodebin_reuse (prof1, NULL); + _test_encodebin_reuse (prof1, prof1); + + _test_encodebin_reuse (prof1, prof2); + + _test_encodebin_reuse (prof2, prof3); + + gst_encoding_profile_unref (prof1); +}; + +GST_END_TEST; + static Suite * encodebin_suite (void) @@ -831,6 +891,7 @@ encodebin_suite (void) tcase_add_test (tc_chain, test_encodebin_render_audio_video_static); tcase_add_test (tc_chain, test_encodebin_render_audio_video_dynamic); tcase_add_test (tc_chain, test_encodebin_impossible_element_combination); + tcase_add_test (tc_chain, test_encodebin_reuse); return s; } From fae2e1bc2da4c6526362f70791108893f36a1393 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Sat, 12 Mar 2011 17:51:41 +0000 Subject: [PATCH 05/13] tests: add libscpp unit test to make sure g++ likes our library headers --- configure.ac | 18 +++-- tests/check/Makefile.am | 16 +++- tests/check/libs/.gitignore | 1 + tests/check/libs/gstlibscpp.cc | 139 +++++++++++++++++++++++++++++++++ 4 files changed, 165 insertions(+), 9 deletions(-) create mode 100644 tests/check/libs/gstlibscpp.cc diff --git a/configure.ac b/configure.ac index bacd07a46e..c8d8597750 100644 --- a/configure.ac +++ b/configure.ac @@ -135,18 +135,20 @@ dnl *** checks for programs *** dnl find a compiler AC_PROG_CC AC_PROG_CC_STDC -AC_PROG_CXX - -dnl determine if c++ is available on this system -AC_CHECK_PROG(HAVE_CXX, $CXX, yes, no) - -dnl determine c++ preprocessor -dnl FIXME: do we need this ? -AC_PROG_CXXCPP dnl check if the compiler supports '-c' and '-o' options AM_PROG_CC_C_O +dnl determine if c++ is available on this system +AC_PROG_CXX +dnl CXX may be set to some default even if no c++ compiler is available +dnl (thanks autotools!), so just try to compile some c++ code to make sure +AC_LANG_PUSH([C++]) +AC_TRY_COMPILE([ class Foo { int bar; };], , working_cxx=yes, working_cxx=no) +AC_LANG_POP([C++]) +AC_MSG_NOTICE([working c++ compiler found: $working_cxx]) +AM_CONDITIONAL(HAVE_CXX, test "x$working_cxx" = "xyes") + AC_PATH_PROG(VALGRIND_PATH, valgrind, no) AM_CONDITIONAL(HAVE_VALGRIND, test ! "x$VALGRIND_PATH" = "xno") diff --git a/tests/check/Makefile.am b/tests/check/Makefile.am index f496787d35..ee9981916f 100644 --- a/tests/check/Makefile.am +++ b/tests/check/Makefile.am @@ -99,6 +99,12 @@ else check_orc = endif +if HAVE_CXX +cxx_checks = libs/gstlibscpp +else +cxx_checks = +endif + check_PROGRAMS = \ $(check_alsa) \ $(check_gnomevfs) \ @@ -144,6 +150,7 @@ check_PROGRAMS = \ libs/rtsp \ libs/tag \ libs/video \ + $(cxx_checks) \ $(check_orc) \ pipelines/simple-launch-lines \ pipelines/streamheader \ @@ -170,7 +177,12 @@ noinst_HEADERS = \ # libs/struct_sparc.h \ # libs/struct_x86_64.h -AM_CFLAGS = $(GST_CFLAGS) $(GST_CHECK_CFLAGS) \ +AM_CFLAGS = -I$(top_srcdir)/gst-libs -I$(top_builddir)/gst-libs \ + $(GST_CFLAGS) $(GST_CHECK_CFLAGS) \ + -DGST_TEST_FILES_PATH="\"$(TEST_FILES_DIRECTORY)\"" \ + -UG_DISABLE_ASSERT -UG_DISABLE_CAST_CHECKS +AM_CXXFLAGS = -I$(top_srcdir)/gst-libs -I$(top_builddir)/gst-libs \ + $(GST_CXXFLAGS) $(GST_CHECK_CFLAGS) \ -DGST_TEST_FILES_PATH="\"$(TEST_FILES_DIRECTORY)\"" \ -UG_DISABLE_ASSERT -UG_DISABLE_CAST_CHECKS LDADD = $(GST_LIBS) $(GST_CHECK_LIBS) @@ -295,6 +307,8 @@ libs_profile_CFLAGS = \ libs_profile_LDADD = \ $(top_builddir)/gst-libs/gst/pbutils/libgstpbutils-@GST_MAJORMINOR@.la $(LDADD) +libs_gstlibscpp_SOURCES = libs/gstlibscpp.cc + elements_appsink_CFLAGS = \ $(GST_PLUGINS_BASE_CFLAGS) \ $(AM_CFLAGS) diff --git a/tests/check/libs/.gitignore b/tests/check/libs/.gitignore index f0e5c928e7..5e807df6a9 100644 --- a/tests/check/libs/.gitignore +++ b/tests/check/libs/.gitignore @@ -2,6 +2,7 @@ audio cddabasesrc fft +gstlibscpp mixer navigation netbuffer diff --git a/tests/check/libs/gstlibscpp.cc b/tests/check/libs/gstlibscpp.cc new file mode 100644 index 0000000000..aa80624cc4 --- /dev/null +++ b/tests/check/libs/gstlibscpp.cc @@ -0,0 +1,139 @@ +/* GStreamer + * Copyright (C) 2011 Tim-Philipp Müller + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include + +#include +#include +#include +#include + +/* we mostly just want to make sure that our library headers don't + * contain anything a C++ compiler might not like */ +GST_START_TEST (test_nothing) +{ + gst_init (NULL, NULL); +} + +GST_END_TEST; + +static Suite * +libscpp_suite (void) +{ + Suite *s = suite_create ("GstLibsCpp"); + TCase *tc_chain = tcase_create ("C++ libs header tests"); + + suite_add_tcase (s, tc_chain); + tcase_add_test (tc_chain, test_nothing); + + return s; +} + +GST_CHECK_MAIN (libscpp); From fee3266056b522cdd34e606b5682553d35eec5a1 Mon Sep 17 00:00:00 2001 From: Stefan Kost Date: Fri, 4 Mar 2011 14:52:28 +0200 Subject: [PATCH 06/13] textoverlay: add a hack to init the pango engine Layout a single char to pre-create all resources. --- ext/pango/gsttextoverlay.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/ext/pango/gsttextoverlay.c b/ext/pango/gsttextoverlay.c index c09de831e6..1c449c8fe9 100644 --- a/ext/pango/gsttextoverlay.c +++ b/ext/pango/gsttextoverlay.c @@ -519,6 +519,7 @@ gst_text_overlay_class_init (GstTextOverlayClass * klass) g_param_spec_boolean ("vertical-render", "vertical render", "Vertical Render.", DEFAULT_PROP_VERTICAL_RENDER, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + } static void @@ -642,6 +643,23 @@ gst_text_overlay_init (GstTextOverlay * overlay, GstTextOverlayClass * klass) overlay->text_linked = FALSE; overlay->cond = g_cond_new (); gst_segment_init (&overlay->segment, GST_FORMAT_TIME); + + /* FIXME: this is a hack to initialize the pango engine + * see http://bugzilla.gnome.org/show_bug.cgi?id=412678 + * and http://bugzilla.gnome.org/show_bug.cgi?id=642960 + */ + { + PangoRectangle ink_rect, logical_rect; + static gsize init_cookie = 0; + + if (g_once_init_enter (&init_cookie)) { + pango_layout_set_width (overlay->layout, -1); + pango_layout_set_markup (overlay->layout, " ", 1); + pango_layout_get_pixel_extents (overlay->layout, &ink_rect, + &logical_rect); + g_once_init_leave (&init_cookie, (gsize) 1); + } + } } static void From 1d73ea887dd1e9bc4ee2b0ec5d2327adeba72a53 Mon Sep 17 00:00:00 2001 From: Stefan Kost Date: Fri, 4 Mar 2011 14:52:01 +0200 Subject: [PATCH 07/13] textoverlay: drop trailing whitespaces --- ext/pango/gsttextoverlay.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ext/pango/gsttextoverlay.c b/ext/pango/gsttextoverlay.c index 1c449c8fe9..3111a02eaf 100644 --- a/ext/pango/gsttextoverlay.c +++ b/ext/pango/gsttextoverlay.c @@ -32,7 +32,7 @@ * the text set via the "text" property will be rendered. If the text sink * pad is linked, text will be rendered as it is received on that pad, * honouring and matching the buffer timestamps of both input streams. - * + * * The text can contain newline characters and text wrapping is enabled by * default. * @@ -41,7 +41,7 @@ * |[ * gst-launch -v videotestsrc ! textoverlay text="Room A" valign=top halign=left ! xvimagesink * ]| Here is a simple pipeline that displays a static text in the top left - * corner of the video picture + * corner of the video picture * |[ * gst-launch -v filesrc location=subtitles.srt ! subparse ! txt. videotestsrc ! timeoverlay ! textoverlay name=txt shaded-background=yes ! xvimagesink * ]| Here is another pipeline that displays subtitles from an .srt subtitle @@ -54,12 +54,12 @@ * 1 * 00:00:03,000 --> 00:00:05,000 * Hello? (3-5s) - * + * * 2 * 00:00:08,000 --> 00:00:13,000 * Yes, this is a subtitle. Don't * you like it? (8-13s) - * + * * 3 * 00:00:18,826 --> 00:01:02,886 * Uh? What are you talking about? @@ -1268,8 +1268,8 @@ gst_text_overlay_render_pangocairo (GstTextOverlay * overlay, if (width + overlay->deltax > (overlay->use_vertical_render ? overlay->height : overlay->width)) { - /* - * subtitle image width is larger then overlay width + /* + * subtitle image width is larger then overlay width * so rearrange overlay wrap mode. */ gst_text_overlay_update_wrap_mode (overlay); From 7f1382112e48e932724707e81bde79950ac0d451 Mon Sep 17 00:00:00 2001 From: Stefan Kost Date: Mon, 14 Mar 2011 10:05:34 +0200 Subject: [PATCH 08/13] decodebin2: reflow configuring new multiqueue instance Use a single g_object_set to configure the new multiqueue instance. Also don't needlessly set "use-buffering" if it is the default. --- gst/playback/gstdecodebin2.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/gst/playback/gstdecodebin2.c b/gst/playback/gstdecodebin2.c index 882d53f804..998d15bece 100644 --- a/gst/playback/gstdecodebin2.c +++ b/gst/playback/gstdecodebin2.c @@ -2696,10 +2696,12 @@ gst_decode_group_new (GstDecodeBin * dbin, GstDecodeChain * parent) if (G_UNLIKELY (!group->multiqueue)) goto missing_multiqueue; - g_object_set (mq, "use-buffering", dbin->use_buffering, NULL); + /* default is for use-buffering is FALSE */ if (dbin->use_buffering) { - g_object_set (mq, "low-percent", dbin->low_percent, NULL); - g_object_set (mq, "high-percent", dbin->high_percent, NULL); + g_object_set (mq, + "use-buffering", TRUE, + "low-percent", dbin->low_percent, + "high-percent", dbin->high_percent, NULL); } /* configure queue sizes for preroll */ From 63be375c215ef66fbb2044889ae3006e1af5e99c Mon Sep 17 00:00:00 2001 From: Stefan Kost Date: Mon, 14 Mar 2011 10:09:35 +0200 Subject: [PATCH 09/13] plaback: trim trailing whitespace --- gst/playback/gstdecodebin2.c | 2 +- gst/playback/gstplaybasebin.c | 12 ++++++------ gst/playback/gstplaybin2.c | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/gst/playback/gstdecodebin2.c b/gst/playback/gstdecodebin2.c index 998d15bece..31b5ebba8a 100644 --- a/gst/playback/gstdecodebin2.c +++ b/gst/playback/gstdecodebin2.c @@ -678,7 +678,7 @@ gst_decode_bin_class_init (GstDecodeBinClass * klass) * If this function returns NULL, @pad will be exposed as a final caps. * * If this function returns an empty array, the pad will be considered as - * having an unhandled type media type. + * having an unhandled type media type. * * * Only the signal handler that is connected first will ever by invoked. diff --git a/gst/playback/gstplaybasebin.c b/gst/playback/gstplaybasebin.c index efb4ac0306..530d4011dc 100644 --- a/gst/playback/gstplaybasebin.c +++ b/gst/playback/gstplaybasebin.c @@ -705,7 +705,7 @@ queue_threshold_reached (GstElement * queue, GstPlayBaseBin * play_base_bin) } /* this signal will be fired when one of the queues with raw - * data is filled. This means that the group building stage is over + * data is filled. This means that the group building stage is over * and playback of the new queued group should start. This is a rather unusual * situation because normally the group is commited when the "no_more_pads" * signal is fired. @@ -843,7 +843,7 @@ gen_preroll_element (GstPlayBaseBin * play_base_bin, /* the overrun signal is always attached and serves two purposes: * - * 1) when we are building a group and the overrun is called, we commit the + * 1) when we are building a group and the overrun is called, we commit the * group. The reason being that if we fill the entire queue without a * normal group commit (with _no_more_pads()) we can assume the * audio/video is completely wacked or the element just does not know when @@ -1252,7 +1252,7 @@ probe_triggered (GstPad * pad, GstEvent * event, gpointer user_data) /* This function will be called when the sinkpad of the preroll element * is unlinked, we have to connect something to the sinkpad or else the - * state change will fail.. + * state change will fail.. */ static void preroll_unlinked (GstPad * pad, GstPad * peerpad, @@ -1315,8 +1315,8 @@ silence_stream (GstPad * pad, GstMiniObject * data, gpointer user_data) return FALSE; } -/* 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 +/* 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 @@ -1936,7 +1936,7 @@ analyse_source (GstPlayBaseBin * play_base_bin, gboolean * is_raw, if (GST_PAD_TEMPLATE_DIRECTION (templ) == GST_PAD_SRC) { if (GST_PAD_TEMPLATE_PRESENCE (templ) == GST_PAD_SOMETIMES) { *is_dynamic = TRUE; - break; /* only break out if we found a sometimes src pad + break; /* only break out if we found a sometimes src pad continue walking through if say a request src pad is found elements such as mpegtsparse and dvbbasebin have request and sometimes src pads */ diff --git a/gst/playback/gstplaybin2.c b/gst/playback/gstplaybin2.c index 03af931a44..8d6dbccede 100644 --- a/gst/playback/gstplaybin2.c +++ b/gst/playback/gstplaybin2.c @@ -2426,7 +2426,7 @@ notify_tags_cb (GObject * object, GParamSpec * pspec, gpointer user_data) } /* this function is called when a new pad is added to decodebin. We check the - * type of the pad and add it to the selector element of the group. + * type of the pad and add it to the selector element of the group. */ static void pad_added_cb (GstElement * decodebin, GstPad * pad, GstSourceGroup * group) @@ -3431,7 +3431,7 @@ deactivate_group (GstPlayBin * playbin, GstSourceGroup * group) } /* setup the next group to play, this assumes the next_group is valid and - * configured. It swaps out the current_group and activates the valid + * configured. It swaps out the current_group and activates the valid * next_group. */ static gboolean setup_next_source (GstPlayBin * playbin, GstState target) From 3294ecda7d8d869b7dd945f3893de0c81be59002 Mon Sep 17 00:00:00 2001 From: Stefan Kost Date: Mon, 14 Mar 2011 11:12:53 +0200 Subject: [PATCH 10/13] Revert "textoverlay: add a hack to init the pango engine" This reverts commit fee3266056b522cdd34e606b5682553d35eec5a1. --- ext/pango/gsttextoverlay.c | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/ext/pango/gsttextoverlay.c b/ext/pango/gsttextoverlay.c index 3111a02eaf..54a260f5c1 100644 --- a/ext/pango/gsttextoverlay.c +++ b/ext/pango/gsttextoverlay.c @@ -519,7 +519,6 @@ gst_text_overlay_class_init (GstTextOverlayClass * klass) g_param_spec_boolean ("vertical-render", "vertical render", "Vertical Render.", DEFAULT_PROP_VERTICAL_RENDER, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - } static void @@ -643,23 +642,6 @@ gst_text_overlay_init (GstTextOverlay * overlay, GstTextOverlayClass * klass) overlay->text_linked = FALSE; overlay->cond = g_cond_new (); gst_segment_init (&overlay->segment, GST_FORMAT_TIME); - - /* FIXME: this is a hack to initialize the pango engine - * see http://bugzilla.gnome.org/show_bug.cgi?id=412678 - * and http://bugzilla.gnome.org/show_bug.cgi?id=642960 - */ - { - PangoRectangle ink_rect, logical_rect; - static gsize init_cookie = 0; - - if (g_once_init_enter (&init_cookie)) { - pango_layout_set_width (overlay->layout, -1); - pango_layout_set_markup (overlay->layout, " ", 1); - pango_layout_get_pixel_extents (overlay->layout, &ink_rect, - &logical_rect); - g_once_init_leave (&init_cookie, (gsize) 1); - } - } } static void From 9ac74c59db5b2cb7090b9e18fda1894c8511e881 Mon Sep 17 00:00:00 2001 From: Stefan Kost Date: Mon, 14 Mar 2011 11:14:04 +0200 Subject: [PATCH 11/13] textoverlay: use a class wide mutex to work around pango reentrance issues Pango is not reentrant. Use a class wide mutex to protect pange use in gst_text_overlay_render_pangocairo(). This works reliable in contrast to the hack in my previous commit. Fixes Bug #412678 --- ext/pango/gsttextoverlay.c | 6 ++++++ ext/pango/gsttextoverlay.h | 1 + 2 files changed, 7 insertions(+) diff --git a/ext/pango/gsttextoverlay.c b/ext/pango/gsttextoverlay.c index 54a260f5c1..ca38dc1ff2 100644 --- a/ext/pango/gsttextoverlay.c +++ b/ext/pango/gsttextoverlay.c @@ -375,6 +375,8 @@ gst_text_overlay_class_init (GstTextOverlayClass * klass) gstelement_class->change_state = GST_DEBUG_FUNCPTR (gst_text_overlay_change_state); + klass->pango_lock = g_mutex_new (); + klass->get_text = gst_text_overlay_get_text; fontmap = pango_cairo_font_map_get_default (); klass->pango_context = @@ -1235,6 +1237,8 @@ gst_text_overlay_render_pangocairo (GstTextOverlay * overlay, double scalef = 1.0; double a, r, g, b; + g_mutex_lock (GST_TEXT_OVERLAY_GET_CLASS (overlay)->pango_lock); + if (overlay->auto_adjust_size) { /* 640 pixel is default */ scalef = (double) (overlay->width) / DEFAULT_SCALE_BASIS; @@ -1298,6 +1302,8 @@ gst_text_overlay_render_pangocairo (GstTextOverlay * overlay, cairo_matrix_init_scale (&cairo_matrix, scalef, scalef); } + g_mutex_unlock (GST_TEXT_OVERLAY_GET_CLASS (overlay)->pango_lock); + /* reallocate surface */ overlay->text_image = g_realloc (overlay->text_image, 4 * width * height); diff --git a/ext/pango/gsttextoverlay.h b/ext/pango/gsttextoverlay.h index 10dd9479e0..d230121c43 100644 --- a/ext/pango/gsttextoverlay.h +++ b/ext/pango/gsttextoverlay.h @@ -155,6 +155,7 @@ struct _GstTextOverlayClass { GstElementClass parent_class; PangoContext *pango_context; + GMutex *pango_lock; gchar * (*get_text) (GstTextOverlay *overlay, GstBuffer *video_frame); }; From a558af4bbf6cd3cdcfbcb6e5ef791d154d251d79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Mon, 14 Mar 2011 18:35:27 +0000 Subject: [PATCH 12/13] typefinding: add depth and endianness to DTS caps https://bugzilla.gnome.org/show_bug.cgi?id=644208 --- gst/typefind/gsttypefindfunctions.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/gst/typefind/gsttypefindfunctions.c b/gst/typefind/gsttypefindfunctions.c index 47c6bb5fc4..861549032f 100644 --- a/gst/typefind/gsttypefindfunctions.c +++ b/gst/typefind/gsttypefindfunctions.c @@ -1333,7 +1333,7 @@ static GstStaticCaps dts_caps = GST_STATIC_CAPS ("audio/x-dts"); static gboolean dts_parse_frame_header (DataScanCtx * c, guint * frame_size, - guint * sample_rate, guint * channels) + guint * sample_rate, guint * channels, guint * depth, guint * endianness) { static const int sample_rates[16] = { 0, 8000, 16000, 32000, 0, 0, 11025, 22050, 44100, 0, 0, 12000, 24000, 48000, 96000, 192000 @@ -1349,11 +1349,13 @@ dts_parse_frame_header (DataScanCtx * c, guint * frame_size, /* raw big endian or 14-bit big endian */ if (marker == 0x7FFE8001 || marker == 0x1FFFE800) { + *endianness = G_BIG_ENDIAN; for (i = 0; i < G_N_ELEMENTS (hdr); ++i) hdr[i] = GST_READ_UINT16_BE (c->data + (i * sizeof (guint16))); } else /* raw little endian or 14-bit little endian */ if (marker == 0xFE7F0180 || marker == 0xFF1F00E8) { + *endianness = G_LITTLE_ENDIAN; for (i = 0; i < G_N_ELEMENTS (hdr); ++i) hdr[i] = GST_READ_UINT16_LE (c->data + (i * sizeof (guint16))); } else { @@ -1376,6 +1378,9 @@ dts_parse_frame_header (DataScanCtx * c, guint * frame_size, hdr[5] = (hdr[5] << 12) | ((hdr[6] >> 2) & 0x0FFF); hdr[6] = (hdr[6] << 14) | ((hdr[7] >> 0) & 0x3FFF); g_assert (hdr[0] == 0x7FFE && hdr[1] == 0x8001); + *depth = 14; + } else { + *depth = 16; } GST_LOG ("frame header: %04x%04x%04x%04x", hdr[2], hdr[3], hdr[4], hdr[5]); @@ -1409,12 +1414,13 @@ dts_type_find (GstTypeFind * tf, gpointer unused) * a lower probability if not found right at the start. Check that the * frame is followed by a second frame at the expected offset. */ while (c.offset <= DTS_MAX_FRAMESIZE) { - guint frame_size = 0, rate = 0, chans = 0; + guint frame_size = 0, rate = 0, chans = 0, depth = 0, endianness = 0; if (G_UNLIKELY (!data_scan_ctx_ensure_data (tf, &c, DTS_MIN_FRAMESIZE))) return; - if (G_UNLIKELY (dts_parse_frame_header (&c, &frame_size, &rate, &chans))) { + if (G_UNLIKELY (dts_parse_frame_header (&c, &frame_size, &rate, &chans, + &depth, &endianness))) { GstTypeFindProbability prob; DataScanCtx next_c; @@ -1433,10 +1439,13 @@ dts_type_find (GstTypeFind * tf, gpointer unused) if (chans > 0) { gst_type_find_suggest_simple (tf, prob, "audio/x-dts", "rate", G_TYPE_INT, rate, "channels", G_TYPE_INT, chans, + "depth", G_TYPE_INT, depth, "endianness", G_TYPE_INT, endianness, "framed", G_TYPE_BOOLEAN, FALSE, NULL); } else { gst_type_find_suggest_simple (tf, prob, "audio/x-dts", - "rate", G_TYPE_INT, rate, "framed", G_TYPE_BOOLEAN, FALSE, NULL); + "rate", G_TYPE_INT, rate, "depth", G_TYPE_INT, depth, + "endianness", G_TYPE_INT, endianness, + "framed", G_TYPE_BOOLEAN, FALSE, NULL); } return; From a38fd9f9ec1fa6d16ce46674d6575662b4a2e801 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Mon, 14 Mar 2011 19:42:49 +0100 Subject: [PATCH 13/13] oggmux: Increase the seen header packets count when seeing a header packet This fixes muxing of Speex content and possibly other formats where the header detection works by counting the packets. Fixes bug #644745. --- ext/ogg/gstoggmux.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ext/ogg/gstoggmux.c b/ext/ogg/gstoggmux.c index 9016102d2e..f2194f5119 100644 --- a/ext/ogg/gstoggmux.c +++ b/ext/ogg/gstoggmux.c @@ -835,6 +835,7 @@ gst_ogg_mux_queue_pads (GstOggMux * ogg_mux) GST_DEBUG_OBJECT (ogg_mux, "got header buffer in control state, ignoring"); /* just ignore */ + pad->map.n_header_packets_seen++; gst_buffer_unref (buf); buf = NULL; } else {