mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-05 06:58:56 +00:00
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.
This commit is contained in:
parent
679918cbf6
commit
569286d058
5 changed files with 22 additions and 307 deletions
|
@ -6,7 +6,7 @@ libgsttaginclude_HEADERS = \
|
||||||
|
|
||||||
lib_LTLIBRARIES = libgsttagedit-@GST_MAJORMINOR@.la
|
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_CFLAGS = $(GST_CFLAGS) -I$(top_srcdir)/gst/tags
|
||||||
libgsttagedit_@GST_MAJORMINOR@_la_LIBADD = $(GST_LIBS)
|
libgsttagedit_@GST_MAJORMINOR@_la_LIBADD = $(GST_LIBS)
|
||||||
libgsttagedit_@GST_MAJORMINOR@_la_LDFLAGS = $(GST_LT_LDFLAGS)
|
libgsttagedit_@GST_MAJORMINOR@_la_LDFLAGS = $(GST_LT_LDFLAGS)
|
||||||
|
|
|
@ -1,44 +0,0 @@
|
||||||
/* GStreamer
|
|
||||||
* Copyright (C) 2003 Benjamin Otte <in7y118@public.uni-hamburg.de>
|
|
||||||
*
|
|
||||||
* 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 <gst/gst.h>
|
|
||||||
|
|
||||||
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)
|
|
|
@ -27,158 +27,6 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
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 <in7y118@public.uni-hamburg.de>");
|
|
||||||
|
|
||||||
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[] = {
|
static GstTagEntryMatch tag_matches[] = {
|
||||||
{GST_TAG_TITLE, "TITLE"},
|
{GST_TAG_TITLE, "TITLE"},
|
||||||
{GST_TAG_VERSION, "VERSION"},
|
{GST_TAG_VERSION, "VERSION"},
|
||||||
|
@ -583,103 +431,3 @@ gst_tag_list_to_vorbiscomment_buffer (const GstTagList * list,
|
||||||
|
|
||||||
return buffer;
|
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);
|
|
||||||
}
|
|
||||||
|
|
|
@ -463,9 +463,13 @@ check_queue (GstPad * pad, GstBuffer * data, gpointer user_data)
|
||||||
|
|
||||||
g_object_get (G_OBJECT (queue), "current-level-time", &level, NULL);
|
g_object_get (G_OBJECT (queue), "current-level-time", &level, NULL);
|
||||||
GST_DEBUG ("Queue size: %" GST_TIME_FORMAT, GST_TIME_ARGS (level));
|
GST_DEBUG ("Queue size: %" GST_TIME_FORMAT, GST_TIME_ARGS (level));
|
||||||
level = level * 100 / play_base_bin->queue_threshold;
|
if (play_base_bin->queue_threshold > 0) {
|
||||||
if (level > 100)
|
level = level * 100 / play_base_bin->queue_threshold;
|
||||||
|
if (level > 100)
|
||||||
|
level = 100;
|
||||||
|
} else
|
||||||
level = 100;
|
level = 100;
|
||||||
|
|
||||||
fill_buffer (play_base_bin, level);
|
fill_buffer (play_base_bin, level);
|
||||||
|
|
||||||
/* continue! */
|
/* continue! */
|
||||||
|
|
|
@ -1645,17 +1645,24 @@ gst_ximagesink_set_property (GObject * object, guint prop_id,
|
||||||
ximagesink->keep_aspect = g_value_get_boolean (value);
|
ximagesink->keep_aspect = g_value_get_boolean (value);
|
||||||
break;
|
break;
|
||||||
case PROP_PIXEL_ASPECT_RATIO:
|
case PROP_PIXEL_ASPECT_RATIO:
|
||||||
g_free (ximagesink->par);
|
{
|
||||||
ximagesink->par = g_new0 (GValue, 1);
|
GValue *tmp;
|
||||||
g_value_init (ximagesink->par, GST_TYPE_FRACTION);
|
|
||||||
if (!g_value_transform (value, ximagesink->par)) {
|
tmp = g_new0 (GValue, 1);
|
||||||
|
g_value_init (tmp, GST_TYPE_FRACTION);
|
||||||
|
|
||||||
|
if (!g_value_transform (value, tmp)) {
|
||||||
GST_WARNING_OBJECT (ximagesink,
|
GST_WARNING_OBJECT (ximagesink,
|
||||||
"Could not transform string to aspect ratio");
|
"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;
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
|
|
Loading…
Reference in a new issue