xine-lib: xine-lib-1.2.13/src/xine-engine/id3.c File Reference

xine-lib 1.2.13-20230125hg15249

Macros | Functions | Variables
id3.c File Reference
`#include <stdlib.h>`
`#include <xine/xine_internal.h>`
`#include <xine/xineutils.h>`
`#include "bswap.h"`
`#include "../demuxers/id3.h"`
`#include "xine_private.h"`

## Macros
#define | LOG_MODULE "id3"
#define | LOG_VERBOSE
#define | ID3_GENRE_COUNT (sizeof (id3_genre) / sizeof (id3_genre[0]))
#define | ID3_ENCODING_COUNT 4

## Functions
int | id3v1_parse_tag (input_plugin_t *input, xine_stream_t *stream)
static int | id3v2_parse_genre (char *dest, const char *src, size_t len)
static int | id3v2_parse_header (input_plugin_t *input, uint32_t id3_signature, id3v2_header_t *tag_header)
static int | id3v22_parse_frame_header (input_plugin_t *input, id3v22_frame_header_t *frame_header)
static int | id3v22_interp_frame (input_plugin_t *input, xine_stream_t *stream, id3v22_frame_header_t *frame_header)
static int | id3v22_parse_tag (input_plugin_t *input, xine_stream_t *stream, uint32_t id3_signature)
static int | id3v23_parse_frame_header (input_plugin_t *input, id3v23_frame_header_t *frame_header)
static int | id3v23_parse_frame_ext_header (input_plugin_t *input, id3v23_frame_ext_header_t *frame_ext_header)
static int | id3v23_interp_frame (input_plugin_t *input, xine_stream_t *stream, id3v23_frame_header_t *frame_header)
static int | id3v23_parse_tag (input_plugin_t *input, xine_stream_t *stream, uint32_t id3_signature)
static int | id3v24_parse_genre (char *dest, const char *src, size_t len)
static int | id3v24_parse_frame_header (input_plugin_t *input, id3v24_frame_header_t *frame_header)
static int | id3v24_parse_ext_header (input_plugin_t *input, id3v24_frame_ext_header_t *frame_ext_header)
static int | id3v24_interp_frame (input_plugin_t *input, xine_stream_t *stream, id3v24_frame_header_t *frame_header)
static int | id3v24_parse_tag (input_plugin_t *input, xine_stream_t *stream, uint32_t id3_signature)
int | id3v2_parse_tag (input_plugin_t *input, xine_stream_t *stream, uint32_t id3_signature)
| Generic function for ID3v2 tags parsing.
int | xine_parse_id3v2_tag (xine_stream_t *stream, input_plugin_t *input)
| Check/parse/skip a possible initial ID3 v2 tag from the (side) stream.

## Variables
static const char | id3_genre [][24]
static const char | id3_encoding [][12]

## Macro Definition Documentation

## ◆ ID3_ENCODING_COUNT

#define ID3_ENCODING_COUNT 4

Referenced by id3v22_interp_frame(), id3v23_interp_frame(), and id3v24_interp_frame().

## ◆ ID3_GENRE_COUNT

#define ID3_GENRE_COUNT (sizeof (id3_genre) / sizeof (id3_genre[0]))

Referenced by id3v1_parse_tag(), id3v24_parse_genre(), and id3v2_parse_genre().

## ◆ LOG_MODULE

#define LOG_MODULE "id3"

Referenced by id3v22_parse_tag(), id3v23_parse_tag(), id3v24_parse_tag(), id3v2_parse_tag(), and xine_parse_id3v2_tag().

## ◆ LOG_VERBOSE

#define LOG_VERBOSE

## Function Documentation

## ◆ id3v1_parse_tag()

int id3v1_parse_tag | ( | input_plugin_t * | input,
|  | xine_stream_t * | stream )

References _x_meta_info_n_set(), _x_meta_info_set(), id3v1_tag_t::album, id3v1_tag_t::artist, id3v1_tag_t::comment, id3v1_tag_t::genre, id3_genre, ID3_GENRE_COUNT, input(), lprintf, id3v1_tag_t::tag, id3v1_tag_t::title, XINE_META_INFO_ALBUM, XINE_META_INFO_ARTIST, XINE_META_INFO_COMMENT, XINE_META_INFO_GENRE, XINE_META_INFO_TITLE, XINE_META_INFO_TRACK_NUMBER, XINE_META_INFO_YEAR, and id3v1_tag_t::year.

Referenced by demux_mpgaudio_send_headers().

## ◆ id3v22_interp_frame()

static int id3v22_interp_frame | ( | input_plugin_t * | input,
|  | xine_stream_t * | stream,
|  | id3v22_frame_header_t * | frame_header )
| static

References _x_meta_info_set(), _x_meta_info_set_generic(), BE_FOURCC, id3v22_frame_header_t::id, id3_encoding, ID3_ENCODING_COUNT, id3v2_parse_genre(), input(), lprintf, id3v22_frame_header_t::size, XINE_META_INFO_ALBUM, XINE_META_INFO_ARTIST, XINE_META_INFO_COMMENT, XINE_META_INFO_GENRE, XINE_META_INFO_TITLE, XINE_META_INFO_TRACK_NUMBER, and XINE_META_INFO_YEAR.

Referenced by id3v22_parse_tag().

## ◆ id3v22_parse_frame_header()

static int id3v22_parse_frame_header | ( | input_plugin_t * | input,
|  | id3v22_frame_header_t * | frame_header )
| static

References _X_BE_24, id3v22_frame_header_t::id, ID3V22_FRAME_HEADER_SIZE, input(), lprintf, and id3v22_frame_header_t::size.

Referenced by id3v22_parse_tag().

## ◆ id3v22_parse_tag()

static int id3v22_parse_tag | ( | input_plugin_t * | input,
|  | xine_stream_t * | stream,
|  | uint32_t | id3_signature )
| static

References id3v2_header_t::flags, id3v22_frame_header_t::id, ID3V22_COMPRESS_FLAG, ID3V22_FRAME_HEADER_SIZE, id3v22_interp_frame(), id3v22_parse_frame_header(), ID3V22_UNSYNCH_FLAG, ID3V22_ZERO_FLAG, id3v2_parse_header(), input(), LOG_MODULE, id3v22_frame_header_t::size, id3v2_header_t::size, xine_stream_s::xine, XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by id3v2_parse_tag().

## ◆ id3v23_interp_frame()

static int id3v23_interp_frame | ( | input_plugin_t * | input,
|  | xine_stream_t * | stream,
|  | id3v23_frame_header_t * | frame_header )
| static

References _x_meta_info_set(), _x_meta_info_set_generic(), BE_FOURCC, id3v23_frame_header_t::id, id3_encoding, ID3_ENCODING_COUNT, id3v2_parse_genre(), input(), lprintf, id3v23_frame_header_t::size, XINE_META_INFO_ALBUM, XINE_META_INFO_ARTIST, XINE_META_INFO_COMMENT, XINE_META_INFO_DISCNUMBER, XINE_META_INFO_GENRE, XINE_META_INFO_TITLE, XINE_META_INFO_TRACK_NUMBER, and XINE_META_INFO_YEAR.

Referenced by id3v23_parse_tag().

## ◆ id3v23_parse_frame_ext_header()

static int id3v23_parse_frame_ext_header | ( | input_plugin_t * | input,
|  | id3v23_frame_ext_header_t * | frame_ext_header )
| static

References _X_BE_16, _X_BE_32, id3v23_frame_ext_header_t::crc, id3v23_frame_ext_header_t::flags, input(), lprintf, id3v23_frame_ext_header_t::padding_size, and id3v23_frame_ext_header_t::size.

Referenced by id3v23_parse_tag().

## ◆ id3v23_parse_frame_header()

static int id3v23_parse_frame_header | ( | input_plugin_t * | input,
|  | id3v23_frame_header_t * | frame_header )
| static

References _X_BE_16, _X_BE_32, id3v23_frame_header_t::flags, id3v23_frame_header_t::id, ID3V23_FRAME_HEADER_SIZE, input(), lprintf, and id3v23_frame_header_t::size.

Referenced by id3v23_parse_tag().

## ◆ id3v23_parse_tag()

static int id3v23_parse_tag | ( | input_plugin_t * | input,
|  | xine_stream_t * | stream,
|  | uint32_t | id3_signature )
| static

References id3v2_header_t::flags, id3v23_frame_header_t::id, ID3V23_EXT_HEADER_FLAG, ID3V23_FRAME_HEADER_SIZE, id3v23_interp_frame(), id3v23_parse_frame_ext_header(), id3v23_parse_frame_header(), ID3V23_UNSYNCH_FLAG, ID3V23_ZERO_FLAG, id3v2_parse_header(), input(), LOG_MODULE, lprintf, id3v23_frame_ext_header_t::size, id3v23_frame_header_t::size, id3v2_header_t::size, xine_stream_s::xine, XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by id3v2_parse_tag().

## ◆ id3v24_interp_frame()

static int id3v24_interp_frame | ( | input_plugin_t * | input,
|  | xine_stream_t * | stream,
|  | id3v24_frame_header_t * | frame_header )
| static

References _x_meta_info_set(), _x_meta_info_set_generic(), BE_FOURCC, id3v24_frame_header_t::id, id3_encoding, ID3_ENCODING_COUNT, id3v24_parse_genre(), input(), lprintf, id3v24_frame_header_t::size, XINE_META_INFO_ALBUM, XINE_META_INFO_ARTIST, XINE_META_INFO_COMMENT, XINE_META_INFO_DISCNUMBER, XINE_META_INFO_GENRE, XINE_META_INFO_TITLE, XINE_META_INFO_TRACK_NUMBER, and XINE_META_INFO_YEAR.

Referenced by id3v24_parse_tag().

## ◆ id3v24_parse_ext_header()

static int id3v24_parse_ext_header | ( | input_plugin_t * | input,
|  | id3v24_frame_ext_header_t * | frame_ext_header )
| static

References _X_BE_32, BE_35_synchsafe(), id3v24_frame_ext_header_t::crc, id3v24_frame_ext_header_t::flags, ID3V24_EXT_CRC_FLAG, ID3V24_EXT_RESTRICTIONS_FLAG, ID3V24_EXT_UPDATE_FLAG, ID3V24_EXT_ZERO_FLAG, input(), lprintf, id3v24_frame_ext_header_t::restrictions, and id3v24_frame_ext_header_t::size.

Referenced by id3v24_parse_tag().

## ◆ id3v24_parse_frame_header()

static int id3v24_parse_frame_header | ( | input_plugin_t * | input,
|  | id3v24_frame_header_t * | frame_header )
| static

References _X_BE_16, _X_BE_32, id3v24_frame_header_t::flags, id3v24_frame_header_t::id, ID3V24_FRAME_HEADER_SIZE, input(), lprintf, and id3v24_frame_header_t::size.

Referenced by id3v24_parse_tag().

## ◆ id3v24_parse_genre()

static int id3v24_parse_genre | ( | char * | dest,
|  | const char * | src,
|  | size_t | len )
| static

References id3_genre, ID3_GENRE_COUNT, and lprintf.

Referenced by id3v24_interp_frame().

## ◆ id3v24_parse_tag()

static int id3v24_parse_tag | ( | input_plugin_t * | input,
|  | xine_stream_t * | stream,
|  | uint32_t | id3_signature )
| static

References id3v2_header_t::flags, id3v24_frame_header_t::id, ID3V24_EXPERIMENTAL_FLAG, ID3V24_EXT_HEADER_FLAG, ID3V24_FOOTER_FLAG, ID3V24_FOOTER_SIZE, ID3V24_FRAME_HEADER_SIZE, id3v24_interp_frame(), id3v24_parse_ext_header(), id3v24_parse_frame_header(), ID3V24_UNSYNCH_FLAG, ID3V24_ZERO_FLAG, id3v2_parse_header(), input(), LOG_MODULE, id3v24_frame_ext_header_t::size, id3v24_frame_header_t::size, id3v2_header_t::size, xine_stream_s::xine, XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by id3v2_parse_tag().

## ◆ id3v2_parse_genre()

static int id3v2_parse_genre | ( | char * | dest,
|  | const char * | src,
|  | size_t | len )
| static

References id3_genre, ID3_GENRE_COUNT, and lprintf.

Referenced by id3v22_interp_frame(), and id3v23_interp_frame().

## ◆ id3v2_parse_header()

static int id3v2_parse_header | ( | input_plugin_t * | input,
|  | uint32_t | id3_signature,
|  | id3v2_header_t * | tag_header )
| static

References _X_BE_32_synchsafe(), be2me_32, id3v2_header_t::flags, id3v2_header_t::id, input(), lprintf, id3v2_header_t::revision, and id3v2_header_t::size.

Referenced by id3v22_parse_tag(), id3v23_parse_tag(), and id3v24_parse_tag().

## ◆ id3v2_parse_tag()

int id3v2_parse_tag | ( | input_plugin_t * | input,
|  | xine_stream_t * | stream,
|  | uint32_t | id3_signature )

Generic function for ID3v2 tags parsing.

Parameters

  input | Pointer to the input plugin used by the demuxer, used to access the tag's data.
  stream | Pointer to the xine stream currently being read.
  mp3_frame_header | Header of the MP3 frame carrying the tag.

Note
  This function will take care of calling the proper function for parsing ID3v2.2, ID3v2.3 or ID3v2.4 tags.

References _x_assert, be2me_32, id3v22_parse_tag(), ID3V22_TAG, id3v23_parse_tag(), ID3V23_TAG, id3v24_parse_tag(), ID3V24_TAG, ID3V2X_MASK, ID3V2X_TAG, input(), LOG_MODULE, xine_stream_s::xine, XINE_VERBOSITY_LOG, and xprintf.

Referenced by demux_mpgaudio_next(), and xine_parse_id3v2_tag().

## ◆ xine_parse_id3v2_tag()

int xine_parse_id3v2_tag | ( | xine_stream_t * | stream,
|  | input_plugin_t * | input )

Check/parse/skip a possible initial ID3 v2 tag from the (side) stream.

Parameters

  stream | The xine stream currently being read.
  input | The input plugin to use, or NULL for the stream default.

Note
  Safe to call during stream type detection.

Returns
  The byte count skipped or 0.

References _x_demux_read_header(), id3v2_istag(), id3v2_parse_tag(), xine_stream_private_st::id3v2_tag_size, input(), INPUT_CAP_PREVIEW, INPUT_CAP_SIZED_PREVIEW, INPUT_OPTIONAL_DATA_NEW_PREVIEW, INPUT_OPTIONAL_SUCCESS, INPUT_OPTIONAL_UNSUPPORTED, xine_stream_s::input_plugin, LOG_MODULE, NULL, xine_stream_private_st::s, input_plugin_s::seek, xine_stream_s::xine, XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by detect_mpgaudio_file(), open_flac_file(), open_mpc_file(), and probe_aac_file().

## Variable Documentation

## ◆ id3_encoding

const char id3_encoding[][12]
| static

Initial value:
= {
"ISO-8859-1",
"UTF-16",
"UTF-16BE",
"UTF-8"}

Referenced by id3v22_interp_frame(), id3v23_interp_frame(), and id3v24_interp_frame().

## ◆ id3_genre

const char id3_genre[][24]
| static

Referenced by id3v1_parse_tag(), id3v24_parse_genre(), and id3v2_parse_genre().