Commit 1ca89389 authored by Mark Nauwelaerts's avatar Mark Nauwelaerts Committed by Tim-Philipp Müller

id3demux: use -base provided id3 tag parsing

https://bugzilla.gnome.org/show_bug.cgi?id=654388
parent 26a3a125
......@@ -993,9 +993,9 @@ AG_GST_CHECK_FEATURE(WAVPACK, [wavpack plug-in], wavpack, [
AC_SUBST(WAVPACK_LIBS)
])
dnl *** qtdemux & id3demux & matroska prefer to have zlib ***
dnl *** qtdemux & matroska prefer to have zlib ***
translit(dnm, m, l) AM_CONDITIONAL(USE_ZLIB, true)
AG_GST_CHECK_FEATURE(ZLIB, [zlib support for id3demux/qtdemux/matroska],, [
AG_GST_CHECK_FEATURE(ZLIB, [zlib support for qtdemux/matroska],, [
AG_GST_CHECK_LIBHEADER(ZLIB,
z, uncompress,, zlib.h, [
HAVE_ZLIB="yes"
......
plugin_LTLIBRARIES = libgstid3demux.la
libgstid3demux_la_SOURCES = gstid3demux.c id3tags.c id3v2frames.c
libgstid3demux_la_SOURCES = gstid3demux.c
libgstid3demux_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS)
libgstid3demux_la_LIBADD = $(GST_PLUGINS_BASE_LIBS) -lgsttag-@GST_MAJORMINOR@ \
-lgstpbutils-@GST_MAJORMINOR@ $(GST_BASE_LIBS) $(ZLIB_LIBS)
-lgstpbutils-@GST_MAJORMINOR@ $(GST_BASE_LIBS)
libgstid3demux_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
libgstid3demux_la_LIBTOOLFLAGS = --tag=disable-static
noinst_HEADERS = gstid3demux.h id3tags.h
noinst_HEADERS = gstid3demux.h
Android.mk: Makefile.am $(BUILT_SOURCES)
androgenizer \
......
......@@ -55,7 +55,6 @@
#include <string.h>
#include "gstid3demux.h"
#include "id3tags.h"
enum
{
......@@ -68,6 +67,9 @@ enum
GST_DEBUG_CATEGORY (id3demux_debug);
#define GST_CAT_DEFAULT (id3demux_debug)
#define ID3V1_TAG_SIZE 128
#define ID3V2_HDR_SIZE GST_TAG_ID3V2_HEADER_SIZE
static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
......@@ -142,7 +144,7 @@ gst_id3demux_identify_tag (GstTagDemux * demux, GstBuffer * buf,
if (data[0] != 'I' || data[1] != 'D' || data[2] != '3')
goto no_marker;
*tag_size = id3demux_calc_id3v2_tag_size (buf);
*tag_size = gst_tag_get_id3v2_tag_size (buf);
} else {
if (data[0] != 'T' || data[1] != 'A' || data[2] != 'G')
goto no_marker;
......@@ -178,11 +180,10 @@ gst_id3demux_parse_tag (GstTagDemux * demux, GstBuffer * buffer,
gboolean start_tag, guint * tag_size, GstTagList ** tags)
{
if (start_tag) {
ID3TagsResult res; /* FIXME: make id3tags.c return tagmuxresult values */
res = id3demux_read_id3v2_tag (buffer, tag_size, tags);
*tag_size = gst_tag_get_id3v2_tag_size (buffer);
*tags = gst_tag_list_from_id3v2_tag (buffer);
if (G_LIKELY (res == ID3TAGS_READ_TAG)) {
if (G_LIKELY (*tags != NULL)) {
gst_id3demux_add_container_format (*tags);
return GST_TAG_DEMUX_RESULT_OK;
} else {
......@@ -276,11 +277,6 @@ plugin_init (GstPlugin * plugin)
gst_tag_register_musicbrainz_tags ();
/* ensure private tag is registered */
gst_tag_register (GST_ID3_DEMUX_TAG_ID3V2_FRAME, GST_TAG_FLAG_META,
GST_TYPE_BUFFER, "ID3v2 frame", "unparsed id3v2 tag frame",
gst_tag_merge_use_first);
return gst_element_register (plugin, "id3demux",
GST_RANK_PRIMARY, GST_TYPE_ID3DEMUX);
}
......
This diff is collapsed.
/* Copyright 2005 Jan Schmidt <thaytan@mad.scientist.com>
*
* 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.
*/
#ifndef __ID3TAGS_H__
#define __ID3TAGS_H__
#include <gst/gst.h>
G_BEGIN_DECLS
/* private tag for storing unprocessed ID3v2 frames */
#define GST_ID3_DEMUX_TAG_ID3V2_FRAME "private-id3v2-frame"
#define ID3V1_TAG_SIZE 128
#define ID3V2_MARK_SIZE 3
#define ID3V2_HDR_SIZE 10
typedef enum {
ID3TAGS_MORE_DATA,
ID3TAGS_READ_TAG,
ID3TAGS_BROKEN_TAG
} ID3TagsResult;
/* From id3tags.c */
guint id3demux_calc_id3v2_tag_size (GstBuffer * buf);
ID3TagsResult id3demux_read_id3v2_tag (GstBuffer *buffer, guint *id3v2_size,
GstTagList **tags);
guint read_synch_uint (const guint8 * data, guint size);
/* Things shared by id3tags.c and id3v2frames.c */
#define ID3V2_VERSION 0x0400
#define ID3V2_VER_MAJOR(v) ((v) >> 8)
#define ID3V2_VER_MINOR(v) ((v) & 0xff)
typedef struct {
guint16 version;
guint8 flags;
guint32 size;
guint8 *frame_data;
guint32 frame_data_size;
guint32 ext_hdr_size;
guint8 ext_flag_bytes;
guint8 *ext_flag_data;
} ID3v2Header;
typedef struct {
ID3v2Header hdr;
GstBuffer *buffer;
GstTagList *tags;
/* Current frame decoding */
guint cur_frame_size;
gchar *frame_id;
guint16 frame_flags;
guint8 *parse_data;
guint parse_size;
/* To collect day/month from obsolete TDAT frame if it exists */
guint pending_month;
guint pending_day;
} ID3TagsWorking;
enum {
ID3V2_HDR_FLAG_UNSYNC = 0x80,
ID3V2_HDR_FLAG_EXTHDR = 0x40,
ID3V2_HDR_FLAG_EXPERIMENTAL = 0x20,
ID3V2_HDR_FLAG_FOOTER = 0x10
};
enum {
ID3V2_EXT_FLAG_UPDATE = 0x80,
ID3V2_EXT_FLAG_CRC = 0x40,
ID3V2_EXT_FLAG_RESTRICTED = 0x20
};
enum {
ID3V2_FRAME_STATUS_FRAME_ALTER_PRESERVE = 0x4000,
ID3V2_FRAME_STATUS_FILE_ALTER_PRESERVE = 0x2000,
ID3V2_FRAME_STATUS_READONLY = 0x1000,
ID3V2_FRAME_FORMAT_GROUPING_ID = 0x0040,
ID3V2_FRAME_FORMAT_COMPRESSION = 0x0008,
ID3V2_FRAME_FORMAT_ENCRYPTION = 0x0004,
ID3V2_FRAME_FORMAT_UNSYNCHRONISATION = 0x0002,
ID3V2_FRAME_FORMAT_DATA_LENGTH_INDICATOR = 0x0001
};
#define ID3V2_3_FRAME_FLAGS_MASK \
(ID3V2_FRAME_STATUS_FRAME_ALTER_PRESERVE | \
ID3V2_FRAME_STATUS_FILE_ALTER_PRESERVE | \
ID3V2_FRAME_STATUS_READONLY | \
ID3V2_FRAME_FORMAT_GROUPING_ID | \
ID3V2_FRAME_FORMAT_COMPRESSION | \
ID3V2_FRAME_FORMAT_ENCRYPTION)
/* From id3v2frames.c */
gboolean id3demux_id3v2_parse_frame (ID3TagsWorking *work);
guint8 * id3demux_ununsync_data (const guint8 * unsync_data, guint32 * size);
G_END_DECLS
#endif
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment