From 569286d0586e4d43c3db9e303521ad92afcd1cb3 Mon Sep 17 00:00:00 2001 From: Jan Schmidt Date: Sun, 20 Nov 2005 17:11:06 +0000 Subject: [PATCH] gst-libs/gst/tag/: Remove obsolete vorbistag element and debug category. Original commit message from CVS: * gst-libs/gst/tag/Makefile.am: * gst-libs/gst/tag/gstvorbistag.c: (gst_tag_list_to_vorbiscomment_buffer): Remove obsolete vorbistag element and debug category. * gst/playback/gstplaybasebin.c: (check_queue): Don't divide by 0 when queue-threshold is 0. * sys/ximage/ximagesink.c: (gst_ximagesink_set_property): Don't modify an existing pixel-aspect-ratio if we fail to read a new one. --- gst-libs/gst/tag/Makefile.am | 2 +- gst-libs/gst/tag/gsttagediting.c | 44 ------ gst-libs/gst/tag/gstvorbistag.c | 252 ------------------------------- gst/playback/gstplaybasebin.c | 8 +- sys/ximage/ximagesink.c | 23 ++- 5 files changed, 22 insertions(+), 307 deletions(-) delete mode 100644 gst-libs/gst/tag/gsttagediting.c diff --git a/gst-libs/gst/tag/Makefile.am b/gst-libs/gst/tag/Makefile.am index 4dfc29fe44..92b8f681a2 100644 --- a/gst-libs/gst/tag/Makefile.am +++ b/gst-libs/gst/tag/Makefile.am @@ -6,7 +6,7 @@ libgsttaginclude_HEADERS = \ lib_LTLIBRARIES = libgsttagedit-@GST_MAJORMINOR@.la -libgsttagedit_@GST_MAJORMINOR@_la_SOURCES = gstvorbistag.c gsttagediting.c gstid3tag.c +libgsttagedit_@GST_MAJORMINOR@_la_SOURCES = gstvorbistag.c gstid3tag.c libgsttagedit_@GST_MAJORMINOR@_la_CFLAGS = $(GST_CFLAGS) -I$(top_srcdir)/gst/tags libgsttagedit_@GST_MAJORMINOR@_la_LIBADD = $(GST_LIBS) libgsttagedit_@GST_MAJORMINOR@_la_LDFLAGS = $(GST_LT_LDFLAGS) diff --git a/gst-libs/gst/tag/gsttagediting.c b/gst-libs/gst/tag/gsttagediting.c deleted file mode 100644 index 8ed7d4bd3b..0000000000 --- a/gst-libs/gst/tag/gsttagediting.c +++ /dev/null @@ -1,44 +0,0 @@ -/* GStreamer - * Copyright (C) 2003 Benjamin Otte - * - * gsttagediting.c: tag editing plugin - * - * 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 "config.h" -#endif - -#include "gsttageditingprivate.h" -#include - -static gboolean -plugin_init (GstPlugin * plugin) -{ - if (!gst_element_register (plugin, "vorbistag", - GST_RANK_PRIMARY, gst_vorbis_tag_get_type ())) { - return FALSE; - } - - return TRUE; -} - -GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, - GST_VERSION_MINOR, - "gsttags", - "elements for manipulating data from ogg streams", - plugin_init, VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN) diff --git a/gst-libs/gst/tag/gstvorbistag.c b/gst-libs/gst/tag/gstvorbistag.c index e98e19006c..360ec3c0b4 100644 --- a/gst-libs/gst/tag/gstvorbistag.c +++ b/gst-libs/gst/tag/gstvorbistag.c @@ -27,158 +27,6 @@ #include #include -GST_DEBUG_CATEGORY_STATIC (gst_vorbis_tag_debug); -#define GST_CAT_DEFAULT gst_vorbis_tag_debug - -#define GST_TYPE_VORBIS_TAG (gst_vorbis_tag_get_type()) -#define GST_VORBIS_TAG(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_VORBIS_TAG, GstVorbisTag)) -#define GST_VORBIS_TAG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_VORBIS_TAG, GstVorbisTag)) -#define GST_IS_VORBIS_TAG(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_VORBIS_TAG)) -#define GST_IS_VORBIS_TAG_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_VORBIS_TAG)) - -typedef struct _GstVorbisTag GstVorbisTag; -typedef struct _GstVorbisTagClass GstVorbisTagClass; - -struct _GstVorbisTag -{ - GstElement element; - - /* pads */ - GstPad *sinkpad; - GstPad *srcpad; - - /* output mode */ - guint output; -}; - -struct _GstVorbisTagClass -{ - GstElementClass parent_class; -}; - -/* elementfactory information */ -static GstElementDetails gst_vorbis_tag_details = -GST_ELEMENT_DETAILS ("vorbis tag extractor", - "Tag", - "Extract tagging information from vorbis streams", - "Benjamin Otte "); - -enum -{ - OUTPUT_UNKNOWN, - OUTPUT_TAGS, - OUTPUT_DATA -}; - -/* signals and args */ -enum -{ - /* FILL ME */ - LAST_SIGNAL -}; - -static GstStaticPadTemplate gst_vorbis_tag_src_template = - GST_STATIC_PAD_TEMPLATE ("src", - GST_PAD_SRC, - GST_PAD_ALWAYS, - GST_STATIC_CAPS ("audio/x-vorbis; application/x-gst-tags") - ); - -static GstStaticPadTemplate gst_vorbis_tag_sink_template = -GST_STATIC_PAD_TEMPLATE ("sink", - GST_PAD_SINK, - GST_PAD_ALWAYS, - GST_STATIC_CAPS ("audio/x-vorbis") - ); - - -static void gst_vorbis_tag_base_init (gpointer g_class); -static void gst_vorbis_tag_class_init (gpointer g_class, gpointer class_data); -static void gst_vorbis_tag_init (GTypeInstance * instance, gpointer g_class); - -static GstFlowReturn gst_vorbis_tag_chain (GstPad * pad, GstBuffer * buffer); - -static GstStateChangeReturn gst_vorbis_tag_change_state (GstElement * element, - GstStateChange transition); - -static GstElementClass *parent_class = NULL; - -/* static guint gst_vorbis_tag_signals[LAST_SIGNAL] = { 0 }; */ - -GType -gst_vorbis_tag_get_type (void) -{ - static GType vorbis_tag_type = 0; - - if (!vorbis_tag_type) { - static const GTypeInfo vorbis_tag_info = { - sizeof (GstVorbisTagClass), - gst_vorbis_tag_base_init, - NULL, - gst_vorbis_tag_class_init, - NULL, - NULL, - sizeof (GstVorbisTag), - 0, - gst_vorbis_tag_init, - }; - static const GInterfaceInfo tag_setter_info = { - NULL, - NULL, - NULL - }; - - vorbis_tag_type = - g_type_register_static (GST_TYPE_ELEMENT, "GstVorbisTag", - &vorbis_tag_info, 0); - - g_type_add_interface_static (vorbis_tag_type, GST_TYPE_TAG_SETTER, - &tag_setter_info); - - GST_DEBUG_CATEGORY_INIT (gst_vorbis_tag_debug, "vorbistag", 0, - "vorbis tagging element"); - } - return vorbis_tag_type; -} -static void -gst_vorbis_tag_base_init (gpointer g_class) -{ - GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); - - gst_element_class_set_details (element_class, &gst_vorbis_tag_details); - - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&gst_vorbis_tag_sink_template)); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&gst_vorbis_tag_src_template)); -} -static void -gst_vorbis_tag_class_init (gpointer g_class, gpointer class_data) -{ - GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class); - - parent_class = g_type_class_peek_parent (g_class); - - gstelement_class->change_state = gst_vorbis_tag_change_state; -} -static void -gst_vorbis_tag_init (GTypeInstance * instance, gpointer g_class) -{ - GstVorbisTag *tag = GST_VORBIS_TAG (instance); - - /* create the sink and src pads */ - tag->sinkpad = - gst_pad_new_from_template (gst_static_pad_template_get - (&gst_vorbis_tag_sink_template), "sink"); - gst_element_add_pad (GST_ELEMENT (tag), tag->sinkpad); - gst_pad_set_chain_function (tag->sinkpad, - GST_DEBUG_FUNCPTR (gst_vorbis_tag_chain)); - - tag->srcpad = - gst_pad_new_from_template (gst_static_pad_template_get - (&gst_vorbis_tag_src_template), "src"); - gst_element_add_pad (GST_ELEMENT (tag), tag->srcpad); -} static GstTagEntryMatch tag_matches[] = { {GST_TAG_TITLE, "TITLE"}, {GST_TAG_VERSION, "VERSION"}, @@ -583,103 +431,3 @@ gst_tag_list_to_vorbiscomment_buffer (const GstTagList * list, return buffer; } - -static GstFlowReturn -gst_vorbis_tag_chain (GstPad * pad, GstBuffer * buffer) -{ - GstVorbisTag *tag; - GstBuffer *out = NULL; - - tag = GST_VORBIS_TAG (gst_pad_get_parent (pad)); - - if (tag->output == OUTPUT_UNKNOWN) { - GstCaps *vorbis_caps = gst_caps_new_simple ("audio/x-vorbis", NULL); - GstCaps *tags_caps = gst_caps_new_simple ("application/x-gst-tags", NULL); - - /* caps nego */ - do { -#if 0 - if (gst_pad_try_set_caps (tag->srcpad, vorbis_caps) >= 0) { - tag->output = OUTPUT_DATA; - } else if (gst_pad_try_set_caps (tag->srcpad, tags_caps) >= 0) { - tag->output = OUTPUT_TAGS; - } else { - const GstCaps *caps = - gst_static_caps_get (&gst_vorbis_tag_src_template.static_caps); - if (gst_pad_recover_caps_error (tag->srcpad, caps)) - continue; - gst_caps_unref (vorbis_caps); - gst_caps_unref (tags_caps); - return GST_FLOW_ERROR; - } -#endif - } while (FALSE); - - gst_caps_unref (vorbis_caps); - gst_caps_unref (tags_caps); - } - - if (GST_BUFFER_SIZE (buffer) == 0) - GST_ELEMENT_ERROR (tag, CORE, TAG, (NULL), - ("empty buffers are not allowed in vorbis data")); - - if (GST_BUFFER_DATA (buffer)[0] == 3) { - gchar *vendor; - GstTagList *list = - gst_tag_list_from_vorbiscomment_buffer (buffer, (guchar *) "\003vorbis", - 7, &vendor); - const GstTagList *found_tags; - - gst_buffer_unref (buffer); - if (list == NULL) { - GST_ELEMENT_ERROR (tag, CORE, TAG, (NULL), - ("invalid data in vorbis comments")); - return GST_FLOW_ERROR; - } - //gst_element_found_tags_for_pad (GST_ELEMENT (tag), tag->srcpad, 0, - // gst_tag_list_copy (list)); - - found_tags = gst_tag_setter_get_list (GST_TAG_SETTER (tag)); - if (found_tags) - gst_tag_list_insert (list, found_tags, - gst_tag_setter_get_merge_mode (GST_TAG_SETTER (tag))); - out = gst_tag_list_to_vorbiscomment_buffer (list, (guchar *) "\003vorbis", - 7, vendor); - gst_tag_list_free (list); - g_free (vendor); - } - - if (tag->output == OUTPUT_DATA) { - gst_pad_push (tag->srcpad, out); - } else { - gst_buffer_unref (out); - } - return GST_FLOW_OK; -} - -static GstStateChangeReturn -gst_vorbis_tag_change_state (GstElement * element, GstStateChange transition) -{ - GstVorbisTag *tag; - - tag = GST_VORBIS_TAG (element); - - switch (transition) { - case GST_STATE_CHANGE_NULL_TO_READY: - break; - case GST_STATE_CHANGE_READY_TO_PAUSED: - break; - case GST_STATE_CHANGE_PAUSED_TO_PLAYING: - /* do something to get out of the chain function faster */ - break; - case GST_STATE_CHANGE_PLAYING_TO_PAUSED: - break; - case GST_STATE_CHANGE_PAUSED_TO_READY: - tag->output = OUTPUT_UNKNOWN; - break; - case GST_STATE_CHANGE_READY_TO_NULL: - break; - } - - return parent_class->change_state (element, transition); -} diff --git a/gst/playback/gstplaybasebin.c b/gst/playback/gstplaybasebin.c index c038fe6b8b..3033c4463e 100644 --- a/gst/playback/gstplaybasebin.c +++ b/gst/playback/gstplaybasebin.c @@ -463,9 +463,13 @@ check_queue (GstPad * pad, GstBuffer * data, gpointer user_data) g_object_get (G_OBJECT (queue), "current-level-time", &level, NULL); GST_DEBUG ("Queue size: %" GST_TIME_FORMAT, GST_TIME_ARGS (level)); - level = level * 100 / play_base_bin->queue_threshold; - if (level > 100) + if (play_base_bin->queue_threshold > 0) { + level = level * 100 / play_base_bin->queue_threshold; + if (level > 100) + level = 100; + } else level = 100; + fill_buffer (play_base_bin, level); /* continue! */ diff --git a/sys/ximage/ximagesink.c b/sys/ximage/ximagesink.c index 25dfb1ca11..a14103cb0a 100644 --- a/sys/ximage/ximagesink.c +++ b/sys/ximage/ximagesink.c @@ -1645,17 +1645,24 @@ gst_ximagesink_set_property (GObject * object, guint prop_id, ximagesink->keep_aspect = g_value_get_boolean (value); break; case PROP_PIXEL_ASPECT_RATIO: - g_free (ximagesink->par); - ximagesink->par = g_new0 (GValue, 1); - g_value_init (ximagesink->par, GST_TYPE_FRACTION); - if (!g_value_transform (value, ximagesink->par)) { + { + GValue *tmp; + + tmp = g_new0 (GValue, 1); + g_value_init (tmp, GST_TYPE_FRACTION); + + if (!g_value_transform (value, tmp)) { GST_WARNING_OBJECT (ximagesink, "Could not transform string to aspect ratio"); - gst_value_set_fraction (ximagesink->par, 1, 1); + g_free (tmp); + } else { + GST_DEBUG_OBJECT (ximagesink, "set PAR to %d/%d", + gst_value_get_fraction_numerator (tmp), + gst_value_get_fraction_denominator (tmp)); + g_free (ximagesink->par); + ximagesink->par = tmp; } - GST_DEBUG_OBJECT (ximagesink, "set PAR to %d/%d", - gst_value_get_fraction_numerator (ximagesink->par), - gst_value_get_fraction_denominator (ximagesink->par)); + } break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);