mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-20 04:56:24 +00:00
ext/mad/gstid3tag.c: lots of fixes to make id3mux work and id3demux work correctly
Original commit message from CVS: * ext/mad/gstid3tag.c: (gst_id3_tag_get_type), (gst_id3_tag_class_init), (gst_id3_tag_init), (gst_id3_tag_set_property), (gst_id3_tag_get_tag_to_render), (gst_id3_tag_handle_event), (gst_id3_tag_do_caps_nego), (gst_id3_tag_send_tag_event): lots of fixes to make id3mux work and id3demux work correctly
This commit is contained in:
parent
ee6ee028a9
commit
cc88656bfb
2 changed files with 46 additions and 24 deletions
|
@ -1,3 +1,12 @@
|
||||||
|
2004-05-24 Benjamin Otte <in7y118@public.uni-hamburg.de>
|
||||||
|
|
||||||
|
* ext/mad/gstid3tag.c: (gst_id3_tag_get_type),
|
||||||
|
(gst_id3_tag_class_init), (gst_id3_tag_init),
|
||||||
|
(gst_id3_tag_set_property), (gst_id3_tag_get_tag_to_render),
|
||||||
|
(gst_id3_tag_handle_event), (gst_id3_tag_do_caps_nego),
|
||||||
|
(gst_id3_tag_send_tag_event):
|
||||||
|
lots of fixes to make id3mux work and id3demux work correctly
|
||||||
|
|
||||||
2004-05-24 Stephane Loeuillet <stephane.loeuillet@tiscali.fr>
|
2004-05-24 Stephane Loeuillet <stephane.loeuillet@tiscali.fr>
|
||||||
|
|
||||||
* ext/Makefile.am:
|
* ext/Makefile.am:
|
||||||
|
|
|
@ -132,8 +132,7 @@ GST_STATIC_PAD_TEMPLATE ("src",
|
||||||
static GstStaticPadTemplate id3_tag_src_id3_template_factory =
|
static GstStaticPadTemplate id3_tag_src_id3_template_factory =
|
||||||
GST_STATIC_PAD_TEMPLATE ("src",
|
GST_STATIC_PAD_TEMPLATE ("src",
|
||||||
GST_PAD_SRC,
|
GST_PAD_SRC,
|
||||||
/* FIXME: for spider - should be GST_PAD_ALWAYS, */
|
GST_PAD_ALWAYS,
|
||||||
GST_PAD_SOMETIMES,
|
|
||||||
GST_STATIC_CAPS ("application/x-id3")
|
GST_STATIC_CAPS ("application/x-id3")
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -209,7 +208,7 @@ gst_id3_tag_get_type (guint type)
|
||||||
(type == GST_ID3_TAG_PARSE_BASE) ? GST_TYPE_ELEMENT :
|
(type == GST_ID3_TAG_PARSE_BASE) ? GST_TYPE_ELEMENT :
|
||||||
GST_TYPE_ID3_TAG, name[type], &id3_tag_info, 0);
|
GST_TYPE_ID3_TAG, name[type], &id3_tag_info, 0);
|
||||||
|
|
||||||
if (type & GST_ID3_TAG_PARSE_DEMUX) {
|
if (type & GST_ID3_TAG_PARSE_MUX) {
|
||||||
g_type_add_interface_static (id3_tag_type[type], GST_TYPE_TAG_SETTER,
|
g_type_add_interface_static (id3_tag_type[type], GST_TYPE_TAG_SETTER,
|
||||||
&tag_setter_info);
|
&tag_setter_info);
|
||||||
}
|
}
|
||||||
|
@ -251,13 +250,9 @@ gst_id3_tag_class_init (gpointer g_class, gpointer class_data)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tag_class->type & GST_ID3_TAG_PARSE_DEMUX) {
|
if (tag_class->type & GST_ID3_TAG_PARSE_DEMUX) {
|
||||||
g_object_class_install_property (gobject_class, ARG_V2_TAG,
|
g_object_class_install_property (gobject_class, ARG_PREFER_V1,
|
||||||
g_param_spec_boolean ("v2-tag", "add version 2 tag",
|
g_param_spec_boolean ("prefer-v1", "prefer version 1 tag",
|
||||||
"Add version 2 tag at start of file", TRUE,
|
"Prefer tags from tag at end of file", FALSE,
|
||||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
|
|
||||||
g_object_class_install_property (gobject_class, ARG_V1_TAG,
|
|
||||||
g_param_spec_boolean ("v1-tag", "add version 1 tag",
|
|
||||||
"Add version 1 tag at end of file", FALSE,
|
|
||||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
|
G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
|
||||||
gst_element_class_add_pad_template (gstelement_class,
|
gst_element_class_add_pad_template (gstelement_class,
|
||||||
gst_static_pad_template_get (&id3_tag_src_any_template_factory));
|
gst_static_pad_template_get (&id3_tag_src_any_template_factory));
|
||||||
|
@ -267,9 +262,13 @@ gst_id3_tag_class_init (gpointer g_class, gpointer class_data)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tag_class->type & GST_ID3_TAG_PARSE_MUX) {
|
if (tag_class->type & GST_ID3_TAG_PARSE_MUX) {
|
||||||
g_object_class_install_property (gobject_class, ARG_PREFER_V1,
|
g_object_class_install_property (gobject_class, ARG_V2_TAG,
|
||||||
g_param_spec_boolean ("prefer-v1", "prefer version 1 tag",
|
g_param_spec_boolean ("v2-tag", "add version 2 tag",
|
||||||
"Prefer tags from tag at end of file", FALSE,
|
"Add version 2 tag at start of file", TRUE,
|
||||||
|
G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
|
||||||
|
g_object_class_install_property (gobject_class, ARG_V1_TAG,
|
||||||
|
g_param_spec_boolean ("v1-tag", "add version 1 tag",
|
||||||
|
"Add version 1 tag at end of file", FALSE,
|
||||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
|
G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
|
||||||
}
|
}
|
||||||
if (tag_class->type == GST_ID3_TAG_PARSE_MUX) {
|
if (tag_class->type == GST_ID3_TAG_PARSE_MUX) {
|
||||||
|
@ -338,7 +337,10 @@ gst_id3_tag_init (GTypeInstance * instance, gpointer g_class)
|
||||||
gst_pad_set_chain_function (tag->sinkpad,
|
gst_pad_set_chain_function (tag->sinkpad,
|
||||||
GST_DEBUG_FUNCPTR (gst_id3_tag_chain));
|
GST_DEBUG_FUNCPTR (gst_id3_tag_chain));
|
||||||
}
|
}
|
||||||
|
if (GST_ID3_TAG_GET_CLASS (tag)->type == GST_ID3_TAG_PARSE_MUX) {
|
||||||
|
/* only the muxer class here, all other use sometimes pads */
|
||||||
|
gst_id3_tag_add_src_pad (tag);
|
||||||
|
}
|
||||||
/* FIXME: for the alli^H^H^H^Hspider - gst_id3_tag_add_src_pad (tag); */
|
/* FIXME: for the alli^H^H^H^Hspider - gst_id3_tag_add_src_pad (tag); */
|
||||||
tag->parse_mode = GST_ID3_TAG_PARSE_BASE;
|
tag->parse_mode = GST_ID3_TAG_PARSE_BASE;
|
||||||
tag->buffer = NULL;
|
tag->buffer = NULL;
|
||||||
|
@ -356,15 +358,12 @@ gst_id3_tag_set_property (GObject * object, guint prop_id, const GValue * value,
|
||||||
switch (prop_id) {
|
switch (prop_id) {
|
||||||
case ARG_V1_TAG:
|
case ARG_V1_TAG:
|
||||||
tag->v1tag_render = g_value_get_boolean (value);
|
tag->v1tag_render = g_value_get_boolean (value);
|
||||||
g_object_notify (object, "v1-tag");
|
|
||||||
break;
|
break;
|
||||||
case ARG_V2_TAG:
|
case ARG_V2_TAG:
|
||||||
tag->v2tag_render = g_value_get_boolean (value);
|
tag->v2tag_render = g_value_get_boolean (value);
|
||||||
g_object_notify (object, "v2-tag");
|
|
||||||
break;
|
break;
|
||||||
case ARG_PREFER_V1:
|
case ARG_PREFER_V1:
|
||||||
tag->prefer_v1tag = g_value_get_boolean (value);
|
tag->prefer_v1tag = g_value_get_boolean (value);
|
||||||
g_object_notify (object, "prefer-v1");
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
|
@ -372,7 +371,7 @@ gst_id3_tag_set_property (GObject * object, guint prop_id, const GValue * value,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* make sure we render at least one tag */
|
/* make sure we render at least one tag */
|
||||||
if (GST_ID3_TAG_GET_CLASS (tag)->type == GST_ID3_TAG_PARSE_DEMUX &&
|
if (GST_ID3_TAG_GET_CLASS (tag)->type == GST_ID3_TAG_PARSE_MUX &&
|
||||||
!tag->v1tag_render && !tag->v2tag_render) {
|
!tag->v1tag_render && !tag->v2tag_render) {
|
||||||
g_object_set (object, prop_id == ARG_V1_TAG ? "v2-tag" : "v1-tag", TRUE,
|
g_object_set (object, prop_id == ARG_V1_TAG ? "v2-tag" : "v1-tag", TRUE,
|
||||||
NULL);
|
NULL);
|
||||||
|
@ -730,7 +729,8 @@ gst_id3_tag_get_tag_to_render (GstID3Tag * tag)
|
||||||
if (tag->event_tags)
|
if (tag->event_tags)
|
||||||
ret = gst_tag_list_copy (tag->event_tags);
|
ret = gst_tag_list_copy (tag->event_tags);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
gst_tag_list_insert (ret, tag->parsed_tags, GST_TAG_MERGE_KEEP);
|
if (tag->parsed_tags)
|
||||||
|
gst_tag_list_insert (ret, tag->parsed_tags, GST_TAG_MERGE_KEEP);
|
||||||
} else if (tag->parsed_tags) {
|
} else if (tag->parsed_tags) {
|
||||||
ret = gst_tag_list_copy (tag->parsed_tags);
|
ret = gst_tag_list_copy (tag->parsed_tags);
|
||||||
}
|
}
|
||||||
|
@ -784,9 +784,15 @@ gst_id3_tag_handle_event (GstPad * pad, GstEvent * event)
|
||||||
gst_data_unref (GST_DATA (event));
|
gst_data_unref (GST_DATA (event));
|
||||||
break;
|
break;
|
||||||
case GST_ID3_TAG_STATE_NORMAL_START:
|
case GST_ID3_TAG_STATE_NORMAL_START:
|
||||||
GST_ERROR_OBJECT (tag, "tag event not sent, FIXME");
|
if (!CAN_BE_DEMUXER (tag)) {
|
||||||
gst_id3_tag_set_state (tag, GST_ID3_TAG_STATE_NORMAL);
|
/* initial discont, ignore */
|
||||||
/* fall through */
|
gst_data_unref (GST_DATA (event));
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
GST_ERROR_OBJECT (tag, "tag event not sent, FIXME");
|
||||||
|
gst_id3_tag_set_state (tag, GST_ID3_TAG_STATE_NORMAL);
|
||||||
|
/* fall through */
|
||||||
|
}
|
||||||
case GST_ID3_TAG_STATE_NORMAL:{
|
case GST_ID3_TAG_STATE_NORMAL:{
|
||||||
gint64 value;
|
gint64 value;
|
||||||
GstEvent *new;
|
GstEvent *new;
|
||||||
|
@ -816,7 +822,7 @@ gst_id3_tag_handle_event (GstPad * pad, GstEvent * event)
|
||||||
gst_data_unref (GST_DATA (event));
|
gst_data_unref (GST_DATA (event));
|
||||||
break;
|
break;
|
||||||
case GST_EVENT_EOS:
|
case GST_EVENT_EOS:
|
||||||
if (tag->v1tag_render && !tag->parse_mode) {
|
if (tag->v1tag_render && IS_MUXER (tag)) {
|
||||||
GstTagList *merged;
|
GstTagList *merged;
|
||||||
struct id3_tag *id3;
|
struct id3_tag *id3;
|
||||||
|
|
||||||
|
@ -920,9 +926,11 @@ gst_id3_tag_do_caps_nego (GstID3Tag * tag, GstBuffer * buffer)
|
||||||
if (!tag->srcpad)
|
if (!tag->srcpad)
|
||||||
gst_id3_tag_add_src_pad (tag);
|
gst_id3_tag_add_src_pad (tag);
|
||||||
if (!gst_pad_is_linked (tag->srcpad)) {
|
if (!gst_pad_is_linked (tag->srcpad)) {
|
||||||
|
GST_DEBUG_OBJECT (tag, "srcpad not linked, not proceeding");
|
||||||
tag->parse_mode = GST_ID3_TAG_GET_CLASS (tag)->type;
|
tag->parse_mode = GST_ID3_TAG_GET_CLASS (tag)->type;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
} else {
|
} else {
|
||||||
|
GST_DEBUG_OBJECT (tag, "renegotiating");
|
||||||
return gst_pad_renegotiate (tag->srcpad) != GST_PAD_LINK_REFUSED;
|
return gst_pad_renegotiate (tag->srcpad) != GST_PAD_LINK_REFUSED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -964,8 +972,13 @@ gst_id3_tag_send_tag_event (GstID3Tag * tag)
|
||||||
GstTagList *merged = gst_tag_list_merge (tag->event_tags, tag->parsed_tags,
|
GstTagList *merged = gst_tag_list_merge (tag->event_tags, tag->parsed_tags,
|
||||||
GST_TAG_MERGE_KEEP);
|
GST_TAG_MERGE_KEEP);
|
||||||
|
|
||||||
|
if (tag->parsed_tags)
|
||||||
|
gst_element_found_tags (GST_ELEMENT (tag), tag->parsed_tags);
|
||||||
if (merged) {
|
if (merged) {
|
||||||
gst_element_found_tags_for_pad (GST_ELEMENT (tag), tag->srcpad, 0, merged);
|
GstEvent *event = gst_event_new_tag (merged);
|
||||||
|
|
||||||
|
GST_EVENT_TIMESTAMP (event) = 0;
|
||||||
|
gst_pad_push (tag->srcpad, GST_DATA (event));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
static void
|
static void
|
||||||
|
|
Loading…
Reference in a new issue