gstreamer/gst-libs/gst/tag/id3v2.h

122 lines
3.3 KiB
C
Raw Normal View History

tag: id3v2: all new LGPL id3 demuxer, can use zlib for compressed frames Original commit message from CVS: * configure.ac: Check for optional dependency on zlib for id3demux * gst-libs/gst/tag/Makefile.am: * gst-libs/gst/tag/gstid3demux.c: (gst_gst_id3demux_get_type), (gst_id3demux_base_init), (gst_id3demux_class_init), (gst_id3demux_reset), (gst_id3demux_init), (gst_id3demux_dispose), (gst_id3demux_add_srcpad), (gst_id3demux_remove_srcpad), (gst_id3demux_trim_buffer), (gst_id3demux_chain), (gst_id3demux_set_property), (gst_id3demux_get_property), (id3demux_get_upstream_size), (gst_id3demux_srcpad_event), (gst_id3demux_read_id3v1), (gst_id3demux_read_id3v2), (gst_id3demux_sink_activate), (gst_id3demux_src_activate_pull), (gst_id3demux_src_checkgetrange), (gst_id3demux_read_range), (gst_id3demux_src_getrange), (gst_id3demux_change_state), (gst_id3demux_pad_query), (gst_id3demux_get_query_types), (simple_find_peek), (simple_find_suggest), (gst_id3demux_do_typefind), (gst_id3demux_send_tag_event), (plugin_init): * gst-libs/gst/tag/gstid3demux.h: * gst-libs/gst/tag/id3v2.c: (read_synch_uint), (id3demux_read_id3v1_tag), (id3demux_read_id3v2_tag), (id3demux_id3v2_frame_hdr_size), (convert_fid_to_v240), (id3demux_id3v2_frames_to_tag_list): * gst-libs/gst/tag/id3v2.h: * gst-libs/gst/tag/id3v2.4.0-frames.txt: * gst-libs/gst/tag/id3v2.4.0-structure.txt: * gst-libs/gst/tag/id3v2frames.c: (id3demux_id3v2_parse_frame), (parse_comment_frame), (parse_text_identification_frame), (id3v2_tag_to_taglist), (parse_split_strings): All new LGPL id3 demuxer. Can use zlib for compressed frames, otherwise it discards them. Works on my test files. * gst/wavparse/gstwavparse.c: (gst_wavparse_loop): Don't send EOS to a non-existing srcpad The debug category can be static
2005-12-18 15:14:44 +00:00
/* 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., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
tag: id3v2: all new LGPL id3 demuxer, can use zlib for compressed frames Original commit message from CVS: * configure.ac: Check for optional dependency on zlib for id3demux * gst-libs/gst/tag/Makefile.am: * gst-libs/gst/tag/gstid3demux.c: (gst_gst_id3demux_get_type), (gst_id3demux_base_init), (gst_id3demux_class_init), (gst_id3demux_reset), (gst_id3demux_init), (gst_id3demux_dispose), (gst_id3demux_add_srcpad), (gst_id3demux_remove_srcpad), (gst_id3demux_trim_buffer), (gst_id3demux_chain), (gst_id3demux_set_property), (gst_id3demux_get_property), (id3demux_get_upstream_size), (gst_id3demux_srcpad_event), (gst_id3demux_read_id3v1), (gst_id3demux_read_id3v2), (gst_id3demux_sink_activate), (gst_id3demux_src_activate_pull), (gst_id3demux_src_checkgetrange), (gst_id3demux_read_range), (gst_id3demux_src_getrange), (gst_id3demux_change_state), (gst_id3demux_pad_query), (gst_id3demux_get_query_types), (simple_find_peek), (simple_find_suggest), (gst_id3demux_do_typefind), (gst_id3demux_send_tag_event), (plugin_init): * gst-libs/gst/tag/gstid3demux.h: * gst-libs/gst/tag/id3v2.c: (read_synch_uint), (id3demux_read_id3v1_tag), (id3demux_read_id3v2_tag), (id3demux_id3v2_frame_hdr_size), (convert_fid_to_v240), (id3demux_id3v2_frames_to_tag_list): * gst-libs/gst/tag/id3v2.h: * gst-libs/gst/tag/id3v2.4.0-frames.txt: * gst-libs/gst/tag/id3v2.4.0-structure.txt: * gst-libs/gst/tag/id3v2frames.c: (id3demux_id3v2_parse_frame), (parse_comment_frame), (parse_text_identification_frame), (id3v2_tag_to_taglist), (parse_split_strings): All new LGPL id3 demuxer. Can use zlib for compressed frames, otherwise it discards them. Works on my test files. * gst/wavparse/gstwavparse.c: (gst_wavparse_loop): Don't send EOS to a non-existing srcpad The debug category can be static
2005-12-18 15:14:44 +00:00
*/
#ifndef __ID3TAGS_H__
#define __ID3TAGS_H__
#include <gst/gst.h>
#include <gst/tag/tag-prelude.h>
tag: id3v2: all new LGPL id3 demuxer, can use zlib for compressed frames Original commit message from CVS: * configure.ac: Check for optional dependency on zlib for id3demux * gst-libs/gst/tag/Makefile.am: * gst-libs/gst/tag/gstid3demux.c: (gst_gst_id3demux_get_type), (gst_id3demux_base_init), (gst_id3demux_class_init), (gst_id3demux_reset), (gst_id3demux_init), (gst_id3demux_dispose), (gst_id3demux_add_srcpad), (gst_id3demux_remove_srcpad), (gst_id3demux_trim_buffer), (gst_id3demux_chain), (gst_id3demux_set_property), (gst_id3demux_get_property), (id3demux_get_upstream_size), (gst_id3demux_srcpad_event), (gst_id3demux_read_id3v1), (gst_id3demux_read_id3v2), (gst_id3demux_sink_activate), (gst_id3demux_src_activate_pull), (gst_id3demux_src_checkgetrange), (gst_id3demux_read_range), (gst_id3demux_src_getrange), (gst_id3demux_change_state), (gst_id3demux_pad_query), (gst_id3demux_get_query_types), (simple_find_peek), (simple_find_suggest), (gst_id3demux_do_typefind), (gst_id3demux_send_tag_event), (plugin_init): * gst-libs/gst/tag/gstid3demux.h: * gst-libs/gst/tag/id3v2.c: (read_synch_uint), (id3demux_read_id3v1_tag), (id3demux_read_id3v2_tag), (id3demux_id3v2_frame_hdr_size), (convert_fid_to_v240), (id3demux_id3v2_frames_to_tag_list): * gst-libs/gst/tag/id3v2.h: * gst-libs/gst/tag/id3v2.4.0-frames.txt: * gst-libs/gst/tag/id3v2.4.0-structure.txt: * gst-libs/gst/tag/id3v2frames.c: (id3demux_id3v2_parse_frame), (parse_comment_frame), (parse_text_identification_frame), (id3v2_tag_to_taglist), (parse_split_strings): All new LGPL id3 demuxer. Can use zlib for compressed frames, otherwise it discards them. Works on my test files. * gst/wavparse/gstwavparse.c: (gst_wavparse_loop): Don't send EOS to a non-existing srcpad The debug category can be static
2005-12-18 15:14:44 +00:00
G_BEGIN_DECLS
#define ID3V2_MARK_SIZE 3
#define ID3V2_HDR_SIZE GST_TAG_ID3V2_HEADER_SIZE
tag: id3v2: all new LGPL id3 demuxer, can use zlib for compressed frames Original commit message from CVS: * configure.ac: Check for optional dependency on zlib for id3demux * gst-libs/gst/tag/Makefile.am: * gst-libs/gst/tag/gstid3demux.c: (gst_gst_id3demux_get_type), (gst_id3demux_base_init), (gst_id3demux_class_init), (gst_id3demux_reset), (gst_id3demux_init), (gst_id3demux_dispose), (gst_id3demux_add_srcpad), (gst_id3demux_remove_srcpad), (gst_id3demux_trim_buffer), (gst_id3demux_chain), (gst_id3demux_set_property), (gst_id3demux_get_property), (id3demux_get_upstream_size), (gst_id3demux_srcpad_event), (gst_id3demux_read_id3v1), (gst_id3demux_read_id3v2), (gst_id3demux_sink_activate), (gst_id3demux_src_activate_pull), (gst_id3demux_src_checkgetrange), (gst_id3demux_read_range), (gst_id3demux_src_getrange), (gst_id3demux_change_state), (gst_id3demux_pad_query), (gst_id3demux_get_query_types), (simple_find_peek), (simple_find_suggest), (gst_id3demux_do_typefind), (gst_id3demux_send_tag_event), (plugin_init): * gst-libs/gst/tag/gstid3demux.h: * gst-libs/gst/tag/id3v2.c: (read_synch_uint), (id3demux_read_id3v1_tag), (id3demux_read_id3v2_tag), (id3demux_id3v2_frame_hdr_size), (convert_fid_to_v240), (id3demux_id3v2_frames_to_tag_list): * gst-libs/gst/tag/id3v2.h: * gst-libs/gst/tag/id3v2.4.0-frames.txt: * gst-libs/gst/tag/id3v2.4.0-structure.txt: * gst-libs/gst/tag/id3v2frames.c: (id3demux_id3v2_parse_frame), (parse_comment_frame), (parse_text_identification_frame), (id3v2_tag_to_taglist), (parse_split_strings): All new LGPL id3 demuxer. Can use zlib for compressed frames, otherwise it discards them. Works on my test files. * gst/wavparse/gstwavparse.c: (gst_wavparse_loop): Don't send EOS to a non-existing srcpad The debug category can be static
2005-12-18 15:14:44 +00:00
/* From id3v2.c */
guint id3v2_read_synch_uint (const guint8 * data, guint size);
tag: id3v2: all new LGPL id3 demuxer, can use zlib for compressed frames Original commit message from CVS: * configure.ac: Check for optional dependency on zlib for id3demux * gst-libs/gst/tag/Makefile.am: * gst-libs/gst/tag/gstid3demux.c: (gst_gst_id3demux_get_type), (gst_id3demux_base_init), (gst_id3demux_class_init), (gst_id3demux_reset), (gst_id3demux_init), (gst_id3demux_dispose), (gst_id3demux_add_srcpad), (gst_id3demux_remove_srcpad), (gst_id3demux_trim_buffer), (gst_id3demux_chain), (gst_id3demux_set_property), (gst_id3demux_get_property), (id3demux_get_upstream_size), (gst_id3demux_srcpad_event), (gst_id3demux_read_id3v1), (gst_id3demux_read_id3v2), (gst_id3demux_sink_activate), (gst_id3demux_src_activate_pull), (gst_id3demux_src_checkgetrange), (gst_id3demux_read_range), (gst_id3demux_src_getrange), (gst_id3demux_change_state), (gst_id3demux_pad_query), (gst_id3demux_get_query_types), (simple_find_peek), (simple_find_suggest), (gst_id3demux_do_typefind), (gst_id3demux_send_tag_event), (plugin_init): * gst-libs/gst/tag/gstid3demux.h: * gst-libs/gst/tag/id3v2.c: (read_synch_uint), (id3demux_read_id3v1_tag), (id3demux_read_id3v2_tag), (id3demux_id3v2_frame_hdr_size), (convert_fid_to_v240), (id3demux_id3v2_frames_to_tag_list): * gst-libs/gst/tag/id3v2.h: * gst-libs/gst/tag/id3v2.4.0-frames.txt: * gst-libs/gst/tag/id3v2.4.0-structure.txt: * gst-libs/gst/tag/id3v2frames.c: (id3demux_id3v2_parse_frame), (parse_comment_frame), (parse_text_identification_frame), (id3v2_tag_to_taglist), (parse_split_strings): All new LGPL id3 demuxer. Can use zlib for compressed frames, otherwise it discards them. Works on my test files. * gst/wavparse/gstwavparse.c: (gst_wavparse_loop): Don't send EOS to a non-existing srcpad The debug category can be static
2005-12-18 15:14:44 +00:00
/* 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;
tag: id3v2: all new LGPL id3 demuxer, can use zlib for compressed frames Original commit message from CVS: * configure.ac: Check for optional dependency on zlib for id3demux * gst-libs/gst/tag/Makefile.am: * gst-libs/gst/tag/gstid3demux.c: (gst_gst_id3demux_get_type), (gst_id3demux_base_init), (gst_id3demux_class_init), (gst_id3demux_reset), (gst_id3demux_init), (gst_id3demux_dispose), (gst_id3demux_add_srcpad), (gst_id3demux_remove_srcpad), (gst_id3demux_trim_buffer), (gst_id3demux_chain), (gst_id3demux_set_property), (gst_id3demux_get_property), (id3demux_get_upstream_size), (gst_id3demux_srcpad_event), (gst_id3demux_read_id3v1), (gst_id3demux_read_id3v2), (gst_id3demux_sink_activate), (gst_id3demux_src_activate_pull), (gst_id3demux_src_checkgetrange), (gst_id3demux_read_range), (gst_id3demux_src_getrange), (gst_id3demux_change_state), (gst_id3demux_pad_query), (gst_id3demux_get_query_types), (simple_find_peek), (simple_find_suggest), (gst_id3demux_do_typefind), (gst_id3demux_send_tag_event), (plugin_init): * gst-libs/gst/tag/gstid3demux.h: * gst-libs/gst/tag/id3v2.c: (read_synch_uint), (id3demux_read_id3v1_tag), (id3demux_read_id3v2_tag), (id3demux_id3v2_frame_hdr_size), (convert_fid_to_v240), (id3demux_id3v2_frames_to_tag_list): * gst-libs/gst/tag/id3v2.h: * gst-libs/gst/tag/id3v2.4.0-frames.txt: * gst-libs/gst/tag/id3v2.4.0-structure.txt: * gst-libs/gst/tag/id3v2frames.c: (id3demux_id3v2_parse_frame), (parse_comment_frame), (parse_text_identification_frame), (id3v2_tag_to_taglist), (parse_split_strings): All new LGPL id3 demuxer. Can use zlib for compressed frames, otherwise it discards them. Works on my test files. * gst/wavparse/gstwavparse.c: (gst_wavparse_loop): Don't send EOS to a non-existing srcpad The debug category can be static
2005-12-18 15:14:44 +00:00
} 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)
/* FIXME 0.11: remove 'private' bit from GST_TAG_ID3V2_FRAME */
/**
* GST_TAG_ID3V2_FRAME:
*
* Contains a single unprocessed ID3v2 frame. (buffer)
*
* (Not public API for now)
*/
#define GST_TAG_ID3V2_FRAME "private-id3v2-frame"
tag: id3v2: all new LGPL id3 demuxer, can use zlib for compressed frames Original commit message from CVS: * configure.ac: Check for optional dependency on zlib for id3demux * gst-libs/gst/tag/Makefile.am: * gst-libs/gst/tag/gstid3demux.c: (gst_gst_id3demux_get_type), (gst_id3demux_base_init), (gst_id3demux_class_init), (gst_id3demux_reset), (gst_id3demux_init), (gst_id3demux_dispose), (gst_id3demux_add_srcpad), (gst_id3demux_remove_srcpad), (gst_id3demux_trim_buffer), (gst_id3demux_chain), (gst_id3demux_set_property), (gst_id3demux_get_property), (id3demux_get_upstream_size), (gst_id3demux_srcpad_event), (gst_id3demux_read_id3v1), (gst_id3demux_read_id3v2), (gst_id3demux_sink_activate), (gst_id3demux_src_activate_pull), (gst_id3demux_src_checkgetrange), (gst_id3demux_read_range), (gst_id3demux_src_getrange), (gst_id3demux_change_state), (gst_id3demux_pad_query), (gst_id3demux_get_query_types), (simple_find_peek), (simple_find_suggest), (gst_id3demux_do_typefind), (gst_id3demux_send_tag_event), (plugin_init): * gst-libs/gst/tag/gstid3demux.h: * gst-libs/gst/tag/id3v2.c: (read_synch_uint), (id3demux_read_id3v1_tag), (id3demux_read_id3v2_tag), (id3demux_id3v2_frame_hdr_size), (convert_fid_to_v240), (id3demux_id3v2_frames_to_tag_list): * gst-libs/gst/tag/id3v2.h: * gst-libs/gst/tag/id3v2.4.0-frames.txt: * gst-libs/gst/tag/id3v2.4.0-structure.txt: * gst-libs/gst/tag/id3v2frames.c: (id3demux_id3v2_parse_frame), (parse_comment_frame), (parse_text_identification_frame), (id3v2_tag_to_taglist), (parse_split_strings): All new LGPL id3 demuxer. Can use zlib for compressed frames, otherwise it discards them. Works on my test files. * gst/wavparse/gstwavparse.c: (gst_wavparse_loop): Don't send EOS to a non-existing srcpad The debug category can be static
2005-12-18 15:14:44 +00:00
/* From id3v2frames.c */
gboolean id3v2_parse_frame (ID3TagsWorking *work);
tag: id3v2: all new LGPL id3 demuxer, can use zlib for compressed frames Original commit message from CVS: * configure.ac: Check for optional dependency on zlib for id3demux * gst-libs/gst/tag/Makefile.am: * gst-libs/gst/tag/gstid3demux.c: (gst_gst_id3demux_get_type), (gst_id3demux_base_init), (gst_id3demux_class_init), (gst_id3demux_reset), (gst_id3demux_init), (gst_id3demux_dispose), (gst_id3demux_add_srcpad), (gst_id3demux_remove_srcpad), (gst_id3demux_trim_buffer), (gst_id3demux_chain), (gst_id3demux_set_property), (gst_id3demux_get_property), (id3demux_get_upstream_size), (gst_id3demux_srcpad_event), (gst_id3demux_read_id3v1), (gst_id3demux_read_id3v2), (gst_id3demux_sink_activate), (gst_id3demux_src_activate_pull), (gst_id3demux_src_checkgetrange), (gst_id3demux_read_range), (gst_id3demux_src_getrange), (gst_id3demux_change_state), (gst_id3demux_pad_query), (gst_id3demux_get_query_types), (simple_find_peek), (simple_find_suggest), (gst_id3demux_do_typefind), (gst_id3demux_send_tag_event), (plugin_init): * gst-libs/gst/tag/gstid3demux.h: * gst-libs/gst/tag/id3v2.c: (read_synch_uint), (id3demux_read_id3v1_tag), (id3demux_read_id3v2_tag), (id3demux_id3v2_frame_hdr_size), (convert_fid_to_v240), (id3demux_id3v2_frames_to_tag_list): * gst-libs/gst/tag/id3v2.h: * gst-libs/gst/tag/id3v2.4.0-frames.txt: * gst-libs/gst/tag/id3v2.4.0-structure.txt: * gst-libs/gst/tag/id3v2frames.c: (id3demux_id3v2_parse_frame), (parse_comment_frame), (parse_text_identification_frame), (id3v2_tag_to_taglist), (parse_split_strings): All new LGPL id3 demuxer. Can use zlib for compressed frames, otherwise it discards them. Works on my test files. * gst/wavparse/gstwavparse.c: (gst_wavparse_loop): Don't send EOS to a non-existing srcpad The debug category can be static
2005-12-18 15:14:44 +00:00
guint8 * id3v2_ununsync_data (const guint8 * unsync_data, guint32 * size);
GstDebugCategory * id3v2_ensure_debug_category (void);
G_END_DECLS
tag: id3v2: all new LGPL id3 demuxer, can use zlib for compressed frames Original commit message from CVS: * configure.ac: Check for optional dependency on zlib for id3demux * gst-libs/gst/tag/Makefile.am: * gst-libs/gst/tag/gstid3demux.c: (gst_gst_id3demux_get_type), (gst_id3demux_base_init), (gst_id3demux_class_init), (gst_id3demux_reset), (gst_id3demux_init), (gst_id3demux_dispose), (gst_id3demux_add_srcpad), (gst_id3demux_remove_srcpad), (gst_id3demux_trim_buffer), (gst_id3demux_chain), (gst_id3demux_set_property), (gst_id3demux_get_property), (id3demux_get_upstream_size), (gst_id3demux_srcpad_event), (gst_id3demux_read_id3v1), (gst_id3demux_read_id3v2), (gst_id3demux_sink_activate), (gst_id3demux_src_activate_pull), (gst_id3demux_src_checkgetrange), (gst_id3demux_read_range), (gst_id3demux_src_getrange), (gst_id3demux_change_state), (gst_id3demux_pad_query), (gst_id3demux_get_query_types), (simple_find_peek), (simple_find_suggest), (gst_id3demux_do_typefind), (gst_id3demux_send_tag_event), (plugin_init): * gst-libs/gst/tag/gstid3demux.h: * gst-libs/gst/tag/id3v2.c: (read_synch_uint), (id3demux_read_id3v1_tag), (id3demux_read_id3v2_tag), (id3demux_id3v2_frame_hdr_size), (convert_fid_to_v240), (id3demux_id3v2_frames_to_tag_list): * gst-libs/gst/tag/id3v2.h: * gst-libs/gst/tag/id3v2.4.0-frames.txt: * gst-libs/gst/tag/id3v2.4.0-structure.txt: * gst-libs/gst/tag/id3v2frames.c: (id3demux_id3v2_parse_frame), (parse_comment_frame), (parse_text_identification_frame), (id3v2_tag_to_taglist), (parse_split_strings): All new LGPL id3 demuxer. Can use zlib for compressed frames, otherwise it discards them. Works on my test files. * gst/wavparse/gstwavparse.c: (gst_wavparse_loop): Don't send EOS to a non-existing srcpad The debug category can be static
2005-12-18 15:14:44 +00:00
#endif