mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-24 02:31:03 +00:00
mad, id3mux: (re)move broken, unmaintained and unloved id3mux element
It will be reborn with a shiny new code base under its hood in -bad. See #581756 and #565764.
This commit is contained in:
parent
c111e03e78
commit
78ed09615b
6 changed files with 196 additions and 1580 deletions
|
@ -108,9 +108,6 @@ GST_IS_MAD
|
||||||
GST_IS_MAD_CLASS
|
GST_IS_MAD_CLASS
|
||||||
GST_TYPE_MAD
|
GST_TYPE_MAD
|
||||||
gst_mad_get_type
|
gst_mad_get_type
|
||||||
gst_id3_tag_get_type
|
|
||||||
gst_mad_id3_to_tag_list
|
|
||||||
gst_mad_tag_list_to_id3_tag
|
|
||||||
</SECTION>
|
</SECTION>
|
||||||
|
|
||||||
<SECTION>
|
<SECTION>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<plugin>
|
<plugin>
|
||||||
<name>mad</name>
|
<name>mad</name>
|
||||||
<description>id3 tag manipulation and mp3 decoding based on the mad library</description>
|
<description>mp3 decoding based on the mad library</description>
|
||||||
<filename>../../ext/mad/.libs/libgstmad.so</filename>
|
<filename>../../ext/mad/.libs/libgstmad.so</filename>
|
||||||
<basename>libgstmad.so</basename>
|
<basename>libgstmad.so</basename>
|
||||||
<version>0.10.11.1</version>
|
<version>0.10.11.1</version>
|
||||||
|
@ -9,27 +9,6 @@
|
||||||
<package>GStreamer Ugly Plug-ins git/prerelease</package>
|
<package>GStreamer Ugly Plug-ins git/prerelease</package>
|
||||||
<origin>Unknown package origin</origin>
|
<origin>Unknown package origin</origin>
|
||||||
<elements>
|
<elements>
|
||||||
<element>
|
|
||||||
<name>id3mux</name>
|
|
||||||
<longname>id3 tag muxer</longname>
|
|
||||||
<class>Codec/Muxer/Audio</class>
|
|
||||||
<description>Add ID3 tagging information</description>
|
|
||||||
<author>Benjamin Otte <otte@gnome.org></author>
|
|
||||||
<pads>
|
|
||||||
<caps>
|
|
||||||
<name>sink</name>
|
|
||||||
<direction>sink</direction>
|
|
||||||
<presence>always</presence>
|
|
||||||
<details>audio/mpeg, mpegversion=(int)1; audio/x-flac</details>
|
|
||||||
</caps>
|
|
||||||
<caps>
|
|
||||||
<name>src</name>
|
|
||||||
<direction>source</direction>
|
|
||||||
<presence>always</presence>
|
|
||||||
<details>application/x-id3</details>
|
|
||||||
</caps>
|
|
||||||
</pads>
|
|
||||||
</element>
|
|
||||||
<element>
|
<element>
|
||||||
<name>mad</name>
|
<name>mad</name>
|
||||||
<longname>mad mp3 decoder</longname>
|
<longname>mad mp3 decoder</longname>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
plugin_LTLIBRARIES = libgstmad.la
|
plugin_LTLIBRARIES = libgstmad.la
|
||||||
|
|
||||||
libgstmad_la_SOURCES = gstmad.c gstid3tag.c
|
libgstmad_la_SOURCES = gstmad.c
|
||||||
|
|
||||||
libgstmad_la_CFLAGS = \
|
libgstmad_la_CFLAGS = \
|
||||||
$(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS) \
|
$(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS) \
|
||||||
|
|
1541
ext/mad/gstid3tag.c
1541
ext/mad/gstid3tag.c
File diff suppressed because it is too large
Load diff
199
ext/mad/gstmad.c
199
ext/mad/gstmad.c
|
@ -114,13 +114,9 @@ static void gst_mad_set_index (GstElement * element, GstIndex * index);
|
||||||
static GstIndex *gst_mad_get_index (GstElement * element);
|
static GstIndex *gst_mad_get_index (GstElement * element);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void
|
static GstTagList *gst_mad_id3_to_tag_list (const struct id3_tag *tag);
|
||||||
_do_init (GType type)
|
|
||||||
{
|
|
||||||
GST_DEBUG_CATEGORY_INIT (mad_debug, "mad", 0, "mad mp3 decoding");
|
|
||||||
}
|
|
||||||
|
|
||||||
GST_BOILERPLATE_FULL (GstMad, gst_mad, GstElement, GST_TYPE_ELEMENT, _do_init);
|
GST_BOILERPLATE (GstMad, gst_mad, GstElement, GST_TYPE_ELEMENT);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
#define GST_TYPE_MAD_LAYER (gst_mad_layer_get_type())
|
#define GST_TYPE_MAD_LAYER (gst_mad_layer_get_type())
|
||||||
|
@ -1790,3 +1786,194 @@ gst_mad_change_state (GstElement * element, GstStateChange transition)
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* id3 tag helper (FIXME: why does mad parse id3 tags at all? It shouldn't) */
|
||||||
|
static GstTagList *
|
||||||
|
gst_mad_id3_to_tag_list (const struct id3_tag *tag)
|
||||||
|
{
|
||||||
|
const struct id3_frame *frame;
|
||||||
|
const id3_ucs4_t *ucs4;
|
||||||
|
id3_utf8_t *utf8;
|
||||||
|
GstTagList *tag_list;
|
||||||
|
GType tag_type;
|
||||||
|
guint i = 0;
|
||||||
|
|
||||||
|
tag_list = gst_tag_list_new ();
|
||||||
|
|
||||||
|
while ((frame = id3_tag_findframe (tag, NULL, i++)) != NULL) {
|
||||||
|
const union id3_field *field;
|
||||||
|
unsigned int nstrings, j;
|
||||||
|
const gchar *tag_name;
|
||||||
|
|
||||||
|
/* find me the function to query the frame id */
|
||||||
|
gchar *id = g_strndup (frame->id, 5);
|
||||||
|
|
||||||
|
tag_name = gst_tag_from_id3_tag (id);
|
||||||
|
if (tag_name == NULL) {
|
||||||
|
g_free (id);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strcmp (id, "COMM") == 0) {
|
||||||
|
if (frame->nfields < 4)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
ucs4 = id3_field_getfullstring (&frame->fields[3]);
|
||||||
|
g_assert (ucs4);
|
||||||
|
|
||||||
|
utf8 = id3_ucs4_utf8duplicate (ucs4);
|
||||||
|
if (utf8 == 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (!g_utf8_validate ((char *) utf8, -1, NULL)) {
|
||||||
|
GST_ERROR ("converted string is not valid utf-8");
|
||||||
|
g_free (utf8);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
gst_tag_list_add (tag_list, GST_TAG_MERGE_APPEND,
|
||||||
|
GST_TAG_COMMENT, utf8, NULL);
|
||||||
|
|
||||||
|
g_free (utf8);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (frame->nfields < 2)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
field = &frame->fields[1];
|
||||||
|
nstrings = id3_field_getnstrings (field);
|
||||||
|
|
||||||
|
for (j = 0; j < nstrings; ++j) {
|
||||||
|
ucs4 = id3_field_getstrings (field, j);
|
||||||
|
g_assert (ucs4);
|
||||||
|
|
||||||
|
if (strcmp (id, ID3_FRAME_GENRE) == 0)
|
||||||
|
ucs4 = id3_genre_name (ucs4);
|
||||||
|
|
||||||
|
utf8 = id3_ucs4_utf8duplicate (ucs4);
|
||||||
|
if (utf8 == 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (!g_utf8_validate ((char *) utf8, -1, NULL)) {
|
||||||
|
GST_ERROR ("converted string is not valid utf-8");
|
||||||
|
free (utf8);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
tag_type = gst_tag_get_type (tag_name);
|
||||||
|
|
||||||
|
/* be sure to add non-string tags here */
|
||||||
|
switch (tag_type) {
|
||||||
|
case G_TYPE_UINT:
|
||||||
|
{
|
||||||
|
guint tmp;
|
||||||
|
gchar *check;
|
||||||
|
|
||||||
|
tmp = strtoul ((char *) utf8, &check, 10);
|
||||||
|
|
||||||
|
if (strcmp (tag_name, GST_TAG_DATE) == 0) {
|
||||||
|
GDate *d;
|
||||||
|
|
||||||
|
if (*check != '\0')
|
||||||
|
break;
|
||||||
|
if (tmp == 0)
|
||||||
|
break;
|
||||||
|
d = g_date_new_dmy (1, 1, tmp);
|
||||||
|
tmp = g_date_get_julian (d);
|
||||||
|
g_date_free (d);
|
||||||
|
} else if (strcmp (tag_name, GST_TAG_TRACK_NUMBER) == 0) {
|
||||||
|
if (*check == '/') {
|
||||||
|
guint total;
|
||||||
|
|
||||||
|
check++;
|
||||||
|
total = strtoul (check, &check, 10);
|
||||||
|
if (*check != '\0')
|
||||||
|
break;
|
||||||
|
|
||||||
|
gst_tag_list_add (tag_list, GST_TAG_MERGE_APPEND,
|
||||||
|
GST_TAG_TRACK_COUNT, total, NULL);
|
||||||
|
}
|
||||||
|
} else if (strcmp (tag_name, GST_TAG_ALBUM_VOLUME_NUMBER) == 0) {
|
||||||
|
if (*check == '/') {
|
||||||
|
guint total;
|
||||||
|
|
||||||
|
check++;
|
||||||
|
total = strtoul (check, &check, 10);
|
||||||
|
if (*check != '\0')
|
||||||
|
break;
|
||||||
|
|
||||||
|
gst_tag_list_add (tag_list, GST_TAG_MERGE_APPEND,
|
||||||
|
GST_TAG_ALBUM_VOLUME_COUNT, total, NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (*check != '\0')
|
||||||
|
break;
|
||||||
|
gst_tag_list_add (tag_list, GST_TAG_MERGE_APPEND, tag_name, tmp,
|
||||||
|
NULL);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case G_TYPE_UINT64:
|
||||||
|
{
|
||||||
|
guint64 tmp;
|
||||||
|
|
||||||
|
g_assert (strcmp (tag_name, GST_TAG_DURATION) == 0);
|
||||||
|
tmp = strtoul ((char *) utf8, NULL, 10);
|
||||||
|
if (tmp == 0) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
gst_tag_list_add (tag_list, GST_TAG_MERGE_APPEND,
|
||||||
|
GST_TAG_DURATION, tmp * 1000 * 1000, NULL);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case G_TYPE_STRING:{
|
||||||
|
gst_tag_list_add (tag_list, GST_TAG_MERGE_APPEND,
|
||||||
|
tag_name, (const gchar *) utf8, NULL);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
/* handles GST_TYPE_DATE and anything else */
|
||||||
|
default:{
|
||||||
|
GValue src = { 0, };
|
||||||
|
GValue dest = { 0, };
|
||||||
|
|
||||||
|
g_value_init (&src, G_TYPE_STRING);
|
||||||
|
g_value_set_string (&src, (const gchar *) utf8);
|
||||||
|
|
||||||
|
g_value_init (&dest, tag_type);
|
||||||
|
if (g_value_transform (&src, &dest)) {
|
||||||
|
gst_tag_list_add_values (tag_list, GST_TAG_MERGE_APPEND,
|
||||||
|
tag_name, &dest, NULL);
|
||||||
|
} else {
|
||||||
|
GST_WARNING ("Failed to transform tag from string to type '%s'",
|
||||||
|
g_type_name (tag_type));
|
||||||
|
}
|
||||||
|
g_value_unset (&src);
|
||||||
|
g_value_unset (&dest);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
free (utf8);
|
||||||
|
}
|
||||||
|
g_free (id);
|
||||||
|
}
|
||||||
|
|
||||||
|
return tag_list;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* plugin initialisation */
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
plugin_init (GstPlugin * plugin)
|
||||||
|
{
|
||||||
|
GST_DEBUG_CATEGORY_INIT (mad_debug, "mad", 0, "mad mp3 decoding");
|
||||||
|
|
||||||
|
return gst_element_register (plugin, "mad", GST_RANK_SECONDARY,
|
||||||
|
gst_mad_get_type ());
|
||||||
|
}
|
||||||
|
|
||||||
|
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
|
||||||
|
GST_VERSION_MINOR,
|
||||||
|
"mad",
|
||||||
|
"mp3 decoding based on the mad library",
|
||||||
|
plugin_init, VERSION, "GPL", GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN);
|
||||||
|
|
|
@ -104,13 +104,7 @@ struct _GstMadClass
|
||||||
GstElementClass parent_class;
|
GstElementClass parent_class;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
GType gst_mad_get_type (void);
|
||||||
GType gst_mad_get_type (void);
|
|
||||||
GType gst_id3_tag_get_type (guint type);
|
|
||||||
|
|
||||||
GstTagList* gst_mad_id3_to_tag_list (const struct id3_tag * tag);
|
|
||||||
struct id3_tag * gst_mad_tag_list_to_id3_tag (GstTagList * list);
|
|
||||||
|
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue