1 /* Copyright 2005 Jan Schmidt <thaytan@mad.scientist.com> 2 * 3 * This library is free software; you can redistribute it and/or 4 * modify it under the terms of the GNU Library General Public 5 * License as published by the Free Software Foundation; either 6 * version 2 of the License, or (at your option) any later version. 7 * 8 * This library is distributed in the hope that it will be useful, 9 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 * Library General Public License for more details. 12 * 13 * You should have received a copy of the GNU Library General Public 14 * License along with this library; if not, write to the 15 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, 16 * Boston, MA 02110-1301, USA. 17 */ 18 19 #ifndef __ID3TAGS_H__ 20 #define __ID3TAGS_H__ 21 22 #include <gst/gst.h> 23 #include <gst/tag/tag-prelude.h> 24 25 G_BEGIN_DECLS 26 27 #define ID3V2_MARK_SIZE 3 28 #define ID3V2_HDR_SIZE GST_TAG_ID3V2_HEADER_SIZE 29 30 /* From id3v2.c */ 31 guint id3v2_read_synch_uint (const guint8 * data, guint size); 32 33 /* Things shared by id3tags.c and id3v2frames.c */ 34 #define ID3V2_VERSION 0x0400 35 #define ID3V2_VER_MAJOR(v) ((v) >> 8) 36 #define ID3V2_VER_MINOR(v) ((v) & 0xff) 37 38 typedef struct { 39 guint16 version; 40 guint8 flags; 41 guint32 size; 42 43 guint8 *frame_data; 44 guint32 frame_data_size; 45 46 guint32 ext_hdr_size; 47 guint8 ext_flag_bytes; 48 guint8 *ext_flag_data; 49 } ID3v2Header; 50 51 typedef struct { 52 ID3v2Header hdr; 53 54 GstBuffer *buffer; 55 GstTagList *tags; 56 57 /* Current frame decoding */ 58 guint cur_frame_size; 59 gchar *frame_id; 60 guint16 frame_flags; 61 62 guint8 *parse_data; 63 guint parse_size; 64 65 /* To collect day/month from obsolete TDAT frame if it exists */ 66 guint pending_month; 67 guint pending_day; 68 } ID3TagsWorking; 69 70 enum { 71 ID3V2_HDR_FLAG_UNSYNC = 0x80, 72 ID3V2_HDR_FLAG_EXTHDR = 0x40, 73 ID3V2_HDR_FLAG_EXPERIMENTAL = 0x20, 74 ID3V2_HDR_FLAG_FOOTER = 0x10 75 }; 76 77 enum { 78 ID3V2_EXT_FLAG_UPDATE = 0x80, 79 ID3V2_EXT_FLAG_CRC = 0x40, 80 ID3V2_EXT_FLAG_RESTRICTED = 0x20 81 }; 82 83 enum { 84 ID3V2_FRAME_STATUS_FRAME_ALTER_PRESERVE = 0x4000, 85 ID3V2_FRAME_STATUS_FILE_ALTER_PRESERVE = 0x2000, 86 ID3V2_FRAME_STATUS_READONLY = 0x1000, 87 ID3V2_FRAME_FORMAT_GROUPING_ID = 0x0040, 88 ID3V2_FRAME_FORMAT_COMPRESSION = 0x0008, 89 ID3V2_FRAME_FORMAT_ENCRYPTION = 0x0004, 90 ID3V2_FRAME_FORMAT_UNSYNCHRONISATION = 0x0002, 91 ID3V2_FRAME_FORMAT_DATA_LENGTH_INDICATOR = 0x0001 92 }; 93 94 #define ID3V2_3_FRAME_FLAGS_MASK \ 95 (ID3V2_FRAME_STATUS_FRAME_ALTER_PRESERVE | \ 96 ID3V2_FRAME_STATUS_FILE_ALTER_PRESERVE | \ 97 ID3V2_FRAME_STATUS_READONLY | \ 98 ID3V2_FRAME_FORMAT_GROUPING_ID | \ 99 ID3V2_FRAME_FORMAT_COMPRESSION | \ 100 ID3V2_FRAME_FORMAT_ENCRYPTION) 101 102 /* FIXME 0.11: remove 'private' bit from GST_TAG_ID3V2_FRAME */ 103 /** 104 * GST_TAG_ID3V2_FRAME: 105 * 106 * Contains a single unprocessed ID3v2 frame. (buffer) 107 * 108 * (Not public API for now) 109 */ 110 #define GST_TAG_ID3V2_FRAME "private-id3v2-frame" 111 112 /* From id3v2frames.c */ 113 gboolean id3v2_parse_frame (ID3TagsWorking *work); 114 115 guint8 * id3v2_ununsync_data (const guint8 * unsync_data, guint32 * size); 116 117 GstDebugCategory * id3v2_ensure_debug_category (void); 118 119 G_END_DECLS 120 121 #endif 122