FFmpeg
Classes | Typedefs | Functions | Variables
id3v2.c File Reference

ID3v2 header parser. More...

#include "config.h"
#include "libavutil/avstring.h"
#include "libavutil/bprint.h"
#include "libavutil/dict.h"
#include "libavutil/intreadwrite.h"
#include "avio_internal.h"
#include "internal.h"
#include "id3v1.h"
#include "id3v2.h"

Classes

struct  ID3v2EMFunc
 

Typedefs

typedef struct ID3v2EMFunc ID3v2EMFunc
 

Functions

int ff_id3v2_match (const uint8_t *buf, const char *magic)
 Detect ID3v2 Header. More...
 
int ff_id3v2_tag_len (const uint8_t *buf)
 Get the length of an ID3v2 tag. More...
 
void ff_id3v2_read_dict (AVIOContext *pb, AVDictionary **metadata, const char *magic, ID3v2ExtraMeta **extra_meta)
 Read an ID3v2 tag into specified dictionary and retrieve supported extra metadata. More...
 
void ff_id3v2_read (AVFormatContext *s, const char *magic, ID3v2ExtraMeta **extra_meta, unsigned int max_search_size)
 Read an ID3v2 tag, including supported extra metadata. More...
 
void ff_id3v2_free_extra_meta (ID3v2ExtraMeta **extra_meta)
 Free memory allocated parsing special (non-text) metadata. More...
 
int ff_id3v2_parse_apic (AVFormatContext *s, ID3v2ExtraMeta **extra_meta)
 Create a stream for each APIC (attached picture) extracted from the ID3v2 header.
 
int ff_id3v2_parse_chapters (AVFormatContext *s, ID3v2ExtraMeta **extra_meta)
 Create chapters for all CHAP tags found in the ID3v2 header.
 
int ff_id3v2_parse_priv_dict (AVDictionary **metadata, ID3v2ExtraMeta **extra_meta)
 Parse PRIV tags into a dictionary. More...
 
int ff_id3v2_parse_priv (AVFormatContext *s, ID3v2ExtraMeta **extra_meta)
 Add metadata for all PRIV tags in the ID3v2 header. More...
 

Variables

const AVMetadataConv ff_id3v2_34_metadata_conv []
 
const AVMetadataConv ff_id3v2_4_metadata_conv []
 
const char ff_id3v2_tags [][4]
 A list of text information frames allowed in both ID3 v2.3 and v2.4 http://www.id3.org/id3v2.4.0-frames http://www.id3.org/id3v2.4.0-changes. More...
 
const char ff_id3v2_4_tags [][4]
 ID3v2.4-only text information frames. More...
 
const char ff_id3v2_3_tags [][4]
 ID3v2.3-only text information frames. More...
 
const char *const ff_id3v2_picture_types [21]
 
const CodecMime ff_id3v2_mime_tags []
 

Detailed Description

ID3v2 header parser.

Specifications available at: http://id3.org/Developer_Information

Function Documentation

§ ff_id3v2_free_extra_meta()

void ff_id3v2_free_extra_meta ( ID3v2ExtraMeta **  extra_meta)

Free memory allocated parsing special (non-text) metadata.

Parameters
extra_metaPointer to a pointer to the head of a ID3v2ExtraMeta list, *extra_meta is set to NULL.

§ ff_id3v2_match()

int ff_id3v2_match ( const uint8_t *  buf,
const char *  magic 
)

Detect ID3v2 Header.

Parameters
bufmust be ID3v2_HEADER_SIZE byte long
magicmagic bytes to identify the header. If in doubt, use ID3v2_DEFAULT_MAGIC.

§ ff_id3v2_parse_priv()

int ff_id3v2_parse_priv ( AVFormatContext s,
ID3v2ExtraMeta **  extra_meta 
)

Add metadata for all PRIV tags in the ID3v2 header.

The PRIV owner is the metadata key. The PRIV data is the value, with non-printable characters escaped.

§ ff_id3v2_parse_priv_dict()

int ff_id3v2_parse_priv_dict ( AVDictionary **  d,
ID3v2ExtraMeta **  extra_meta 
)

Parse PRIV tags into a dictionary.

The PRIV owner is the metadata key. The PRIV data is the value, with non-printable characters escaped.

§ ff_id3v2_read()

void ff_id3v2_read ( AVFormatContext s,
const char *  magic,
ID3v2ExtraMeta **  extra_meta,
unsigned int  max_search_size 
)

Read an ID3v2 tag, including supported extra metadata.

Data is read from and stored to AVFormatContext.

Parameters
extra_metaIf not NULL, extra metadata is parsed into a list of ID3v2ExtraMeta structs and *extra_meta points to the head of the list

§ ff_id3v2_read_dict()

void ff_id3v2_read_dict ( AVIOContext pb,
AVDictionary **  metadata,
const char *  magic,
ID3v2ExtraMeta **  extra_meta 
)

Read an ID3v2 tag into specified dictionary and retrieve supported extra metadata.

Parameters
metadataParsed metadata is stored here
extra_metaIf not NULL, extra metadata is parsed into a list of ID3v2ExtraMeta structs and *extra_meta points to the head of the list

§ ff_id3v2_tag_len()

int ff_id3v2_tag_len ( const uint8_t *  buf)

Get the length of an ID3v2 tag.

Parameters
bufmust be ID3v2_HEADER_SIZE bytes long and point to the start of an already detected ID3v2 tag

Variable Documentation

§ ff_id3v2_34_metadata_conv

const AVMetadataConv ff_id3v2_34_metadata_conv[]
Initial value:
= {
{ "TALB", "album" },
{ "TCOM", "composer" },
{ "TCON", "genre" },
{ "TCOP", "copyright" },
{ "TENC", "encoded_by" },
{ "TIT2", "title" },
{ "TLAN", "language" },
{ "TPE1", "artist" },
{ "TPE2", "album_artist" },
{ "TPE3", "performer" },
{ "TPOS", "disc" },
{ "TPUB", "publisher" },
{ "TRCK", "track" },
{ "TSSE", "encoder" },
{ "USLT", "lyrics" },
{ 0 }
}

§ ff_id3v2_3_tags

const char ff_id3v2_3_tags[][4]
Initial value:
= {
"TDAT", "TIME", "TORY", "TRDA", "TSIZ", "TYER",
{ 0 },
}

ID3v2.3-only text information frames.

§ ff_id3v2_4_metadata_conv

const AVMetadataConv ff_id3v2_4_metadata_conv[]
Initial value:
= {
{ "TCMP", "compilation" },
{ "TDRC", "date" },
{ "TDRL", "date" },
{ "TDEN", "creation_time" },
{ "TSOA", "album-sort" },
{ "TSOP", "artist-sort" },
{ "TSOT", "title-sort" },
{ 0 }
}

§ ff_id3v2_4_tags

const char ff_id3v2_4_tags[][4]
Initial value:
= {
"TDEN", "TDOR", "TDRC", "TDRL", "TDTG", "TIPL", "TMCL", "TMOO",
"TPRO", "TSOA", "TSOP", "TSOT", "TSST",
{ 0 },
}

ID3v2.4-only text information frames.

§ ff_id3v2_mime_tags

const CodecMime ff_id3v2_mime_tags[]
Initial value:
= {
{ "image/gif", AV_CODEC_ID_GIF },
{ "image/jpeg", AV_CODEC_ID_MJPEG },
{ "image/jpg", AV_CODEC_ID_MJPEG },
{ "image/png", AV_CODEC_ID_PNG },
{ "image/tiff", AV_CODEC_ID_TIFF },
{ "image/bmp", AV_CODEC_ID_BMP },
{ "JPG", AV_CODEC_ID_MJPEG },
{ "PNG", AV_CODEC_ID_PNG },
{ "", AV_CODEC_ID_NONE },
}

§ ff_id3v2_picture_types

const char* const ff_id3v2_picture_types[21]
Initial value:
= {
"Other",
"32x32 pixels 'file icon'",
"Other file icon",
"Cover (front)",
"Cover (back)",
"Leaflet page",
"Media (e.g. label side of CD)",
"Lead artist/lead performer/soloist",
"Artist/performer",
"Conductor",
"Band/Orchestra",
"Composer",
"Lyricist/text writer",
"Recording Location",
"During recording",
"During performance",
"Movie/video screen capture",
"A bright coloured fish",
"Illustration",
"Band/artist logotype",
"Publisher/Studio logotype",
}

§ ff_id3v2_tags

const char ff_id3v2_tags[][4]
Initial value:
= {
"TALB", "TBPM", "TCOM", "TCON", "TCOP", "TDLY", "TENC", "TEXT",
"TFLT", "TIT1", "TIT2", "TIT3", "TKEY", "TLAN", "TLEN", "TMED",
"TOAL", "TOFN", "TOLY", "TOPE", "TOWN", "TPE1", "TPE2", "TPE3",
"TPE4", "TPOS", "TPUB", "TRCK", "TRSN", "TRSO", "TSRC", "TSSE",
{ 0 },
}

A list of text information frames allowed in both ID3 v2.3 and v2.4 http://www.id3.org/id3v2.4.0-frames http://www.id3.org/id3v2.4.0-changes.