FFmpeg
|
#include "config.h"
#include "libavutil/avstring.h"
#include "libavutil/bprint.h"
#include "libavutil/dict.h"
#include "libavutil/intreadwrite.h"
#include "libavcodec/png.h"
#include "avio_internal.h"
#include "demux.h"
#include "id3v1.h"
#include "id3v2.h"
Go to the source code of this file.
Data Structures | |
struct | ExtraMetaList |
struct | 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... | |
static unsigned int | get_size (AVIOContext *s, int len) |
static unsigned int | size_to_syncsafe (unsigned int size) |
static int | is_tag (const char *buf, unsigned int len) |
static int | check_tag (AVIOContext *s, int offset, unsigned int len) |
Return 1 if the tag of length len at the given offset is valid, 0 if not, -1 on error. More... | |
static void | free_geobtag (void *obj) |
Free GEOB type extra metadata. More... | |
static int | decode_str (AVFormatContext *s, AVIOContext *pb, int encoding, uint8_t **dst, int *maxread) |
Decode characters to UTF-8 according to encoding type. More... | |
static void | read_ttag (AVFormatContext *s, AVIOContext *pb, int taglen, AVDictionary **metadata, const char *key) |
Parse a text tag. More... | |
static void | read_uslt (AVFormatContext *s, AVIOContext *pb, int taglen, AVDictionary **metadata) |
static void | read_comment (AVFormatContext *s, AVIOContext *pb, int taglen, AVDictionary **metadata) |
Parse a comment tag. More... | |
static void | list_append (ID3v2ExtraMeta *new_elem, ExtraMetaList *list) |
static void | read_geobtag (AVFormatContext *s, AVIOContext *pb, int taglen, const char *tag, ExtraMetaList *extra_meta, int isv34) |
Parse GEOB tag into a ID3v2ExtraMetaGEOB struct. More... | |
static int | is_number (const char *str) |
static AVDictionaryEntry * | get_date_tag (AVDictionary *m, const char *tag) |
static void | merge_date (AVDictionary **m) |
static void | free_apic (void *obj) |
static void | rstrip_spaces (char *buf) |
static void | read_apic (AVFormatContext *s, AVIOContext *pb, int taglen, const char *tag, ExtraMetaList *extra_meta, int isv34) |
static void | free_chapter (void *obj) |
static void | read_chapter (AVFormatContext *s, AVIOContext *pb, int len, const char *ttag, ExtraMetaList *extra_meta, int isv34) |
static void | free_priv (void *obj) |
static void | read_priv (AVFormatContext *s, AVIOContext *pb, int taglen, const char *tag, ExtraMetaList *extra_meta, int isv34) |
static const ID3v2EMFunc * | get_extra_meta_func (const char *tag, int isv34) |
Get the corresponding ID3v2EMFunc struct for a tag. More... | |
static void | id3v2_parse (AVIOContext *pb, AVDictionary **metadata, AVFormatContext *s, int len, uint8_t version, uint8_t flags, ExtraMetaList *extra_meta) |
static void | id3v2_read_internal (AVIOContext *pb, AVDictionary **metadata, AVFormatContext *s, const char *magic, ID3v2ExtraMeta **extra_metap, int64_t max_search_size) |
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. More... | |
int | ff_id3v2_parse_chapters (AVFormatContext *s, ID3v2ExtraMeta *cur) |
Create chapters for all CHAP tags found in the ID3v2 header. More... | |
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 [] |
static const AVMetadataConv | id3v2_2_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 [] |
static const ID3v2EMFunc | id3v2_extra_meta_funcs [] |
ID3v2 header parser
Specifications available at: http://id3.org/Developer_Information
Definition in file id3v2.c.
int ff_id3v2_match | ( | const uint8_t * | buf, |
const char * | magic | ||
) |
Detect ID3v2 Header.
buf | must be ID3v2_HEADER_SIZE byte long |
magic | magic bytes to identify the header. If in doubt, use ID3v2_DEFAULT_MAGIC. |
Definition at line 144 of file id3v2.c.
Referenced by adts_aac_read_packet(), av_probe_input_format3(), id3v2_read_internal(), intercept_id3(), mp3_read_probe(), and oma_read_probe().
int ff_id3v2_tag_len | ( | const uint8_t * | buf | ) |
Get the length of an ID3v2 tag.
buf | must be ID3v2_HEADER_SIZE bytes long and point to the start of an already detected ID3v2 tag |
Definition at line 157 of file id3v2.c.
Referenced by av_probe_input_format3(), handle_id3(), intercept_id3(), mp3_read_probe(), and oma_read_probe().
|
static |
Definition at line 169 of file id3v2.c.
Referenced by id3v2_parse().
Definition at line 177 of file id3v2.c.
Referenced by id3v2_parse().
Definition at line 187 of file id3v2.c.
Referenced by check_tag().
|
static |
Return 1 if the tag of length len at the given offset is valid, 0 if not, -1 on error.
Definition at line 205 of file id3v2.c.
Referenced by id3v2_parse().
|
static |
Free GEOB type extra metadata.
Definition at line 222 of file id3v2.c.
Referenced by read_geobtag().
|
static |
Decode characters to UTF-8 according to encoding type.
The decoded buffer is always null terminated. Stop reading when either *maxread bytes are read from pb or U+0000 character is found.
dst | Pointer where the address of the buffer with the decoded bytes is stored. Buffer must be freed by caller. |
maxread | Pointer to maximum number of characters to read from the AVIOContext. After execution the value is decremented by the number of bytes actually read. |
Definition at line 243 of file id3v2.c.
Referenced by read_apic(), read_chapter(), read_comment(), read_geobtag(), read_priv(), read_ttag(), and read_uslt().
|
static |
Parse a text tag.
Definition at line 320 of file id3v2.c.
Referenced by id3v2_parse(), and read_chapter().
|
static |
Definition at line 359 of file id3v2.c.
Referenced by id3v2_parse().
|
static |
|
static |
Definition at line 451 of file id3v2.c.
Referenced by read_apic(), read_chapter(), read_geobtag(), and read_priv().
|
static |
Parse GEOB tag into a ID3v2ExtraMetaGEOB struct.
|
static |
Definition at line 532 of file id3v2.c.
Referenced by get_date_tag().
|
static |
Definition at line 539 of file id3v2.c.
Referenced by merge_date().
|
static |
Definition at line 548 of file id3v2.c.
Referenced by id3v2_read_internal().
|
static |
Definition at line 580 of file id3v2.c.
Referenced by read_apic().
|
static |
Definition at line 587 of file id3v2.c.
Referenced by read_apic().
|
static |
|
static |
Definition at line 683 of file id3v2.c.
Referenced by read_chapter().
|
static |
|
static |
Definition at line 744 of file id3v2.c.
Referenced by read_priv().
|
static |
|
static |
Get the corresponding ID3v2EMFunc struct for a tag.
isv34 | Determines if v2.2 or v2.3/4 strings are used |
Definition at line 807 of file id3v2.c.
Referenced by ff_id3v2_free_extra_meta(), and id3v2_parse().
|
static |
Definition at line 821 of file id3v2.c.
Referenced by id3v2_read_internal().
|
static |
Definition at line 1077 of file id3v2.c.
Referenced by ff_id3v2_read(), and 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.
metadata | Parsed metadata is stored here | |
[out] | extra_meta | If not NULL, extra metadata is parsed into a list of ID3v2ExtraMeta structs and *extra_meta points to the head of the list |
Definition at line 1130 of file id3v2.c.
Referenced by avformat_open_input(), handle_id3(), and parse_id3().
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.
[out] | extra_meta | If not NULL, extra metadata is parsed into a list of ID3v2ExtraMeta structs and *extra_meta points to the head of the list |
[opt] | max_search_search restrict ID3 magic number search (bytes from start) |
Definition at line 1136 of file id3v2.c.
Referenced by aiff_read_header(), get_id3_tag(), oma_read_header(), parse_dsd_prop(), and read_id3().
void ff_id3v2_free_extra_meta | ( | ID3v2ExtraMeta ** | extra_meta | ) |
Free memory allocated parsing special (non-text) metadata.
extra_meta | Pointer to a pointer to the head of a ID3v2ExtraMeta list, *extra_meta is set to NULL. |
Definition at line 1142 of file id3v2.c.
Referenced by aiff_read_header(), avformat_open_input(), free_playlist_list(), get_id3_tag(), handle_id3(), hls_read_header(), oma_read_header(), parse_dsd_prop(), and read_id3().
int ff_id3v2_parse_apic | ( | AVFormatContext * | s, |
ID3v2ExtraMeta * | extra_meta | ||
) |
Create a stream for each APIC (attached picture) extracted from the ID3v2 header.
Definition at line 1158 of file id3v2.c.
Referenced by aiff_read_header(), avformat_open_input(), get_id3_tag(), handle_id3(), hls_read_header(), parse_dsd_prop(), and read_id3().
int ff_id3v2_parse_chapters | ( | AVFormatContext * | s, |
ID3v2ExtraMeta * | cur | ||
) |
Create chapters for all CHAP tags found in the ID3v2 header.
Definition at line 1189 of file id3v2.c.
Referenced by aiff_read_header(), avformat_open_input(), get_id3_tag(), oma_read_header(), parse_dsd_prop(), and read_id3().
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.
Definition at line 1214 of file id3v2.c.
Referenced by ff_id3v2_parse_priv(), and handle_id3().
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.
Definition at line 1254 of file id3v2.c.
Referenced by avformat_open_input(), and hls_read_header().
const AVMetadataConv ff_id3v2_34_metadata_conv[] |
Definition at line 45 of file id3v2.c.
Referenced by id3v2_read_internal(), read_chapter(), and write_metadata().
const AVMetadataConv ff_id3v2_4_metadata_conv[] |
Definition at line 64 of file id3v2.c.
Referenced by id3v2_read_internal(), read_chapter(), and write_metadata().
|
static |
Definition at line 76 of file id3v2.c.
Referenced by id3v2_read_internal().
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.
Definition at line 89 of file id3v2.c.
Referenced by write_metadata().
const char ff_id3v2_4_tags[][4] |
ID3v2.4-only text information frames.
Definition at line 97 of file id3v2.c.
Referenced by write_metadata().
const char ff_id3v2_3_tags[][4] |
ID3v2.3-only text information frames.
Definition at line 103 of file id3v2.c.
Referenced by write_metadata().
const char* const ff_id3v2_picture_types[21] |
Definition at line 108 of file id3v2.c.
Referenced by asf_read_picture(), ff_flac_parse_picture(), ff_id3v2_write_apic(), flac_write_picture(), and read_apic().
const CodecMime ff_id3v2_mime_tags[] |
Definition at line 132 of file id3v2.c.
Referenced by asf_read_picture(), ff_flac_parse_picture(), ff_id3v2_write_apic(), flac_write_picture(), query_codec(), and read_apic().
|
static |
Definition at line 794 of file id3v2.c.
Referenced by get_extra_meta_func().