24 #include "libavutil/avstring.h"
25 #include "libavutil/dict.h"
26 #include "libavutil/intreadwrite.h"
32 #define PADDING_BYTES 10
44 while (*str && *str < 128) str++;
107 if (t->
key[0] !=
'T' || strlen(t->
key) != 4)
110 for (i = 0; *table[i]; i++)
120 const char *key, *
value;
121 char year[5] = {0}, day_month[5] = {0};
130 while (value[i] >=
'0' && value[i] <=
'9') i++;
131 if (value[i] ==
'\0' || value[i] ==
'-') {
135 if (value[i] ==
'-' &&
136 value[i+1] >=
'0' && value[i+1] <=
'1' &&
137 value[i+2] >=
'0' && value[i+2] <=
'9' &&
139 value[i+4] >=
'0' && value[i+4] <=
'3' &&
140 value[i+5] >=
'0' && value[i+5] <=
'9' &&
141 (value[i+6] ==
'\0' || value[i+6] ==
' ')) {
142 snprintf(day_month,
sizeof(day_month),
"%.2s%.2s", value + i + 4, value + i + 1);
234 if (dyn_bc && !dyn_buf)
266 const char *mimetype = NULL, *desc =
"";
274 mimetype = mime->
str;
281 "write an attached picture.\n", st->
index);
unsigned int nb_chapters
Number of chapters in AVChapter array.
int len
size of the tag written so far
void ff_id3v2_start(ID3v2EncContext *id3, AVIOContext *pb, int id3v2_version, const char *magic)
Initialize an ID3v2 tag.
int ff_id3v2_write_simple(struct AVFormatContext *s, int id3v2_version, const char *magic)
Write an ID3v2 tag containing all global metadata from s.
static struct endianess table[]
AVDictionaryEntry * av_dict_get(AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags)
Get a dictionary entry with matching key.
AVCodecContext * codec
Codec context associated with this stream.
int index
stream index in AVFormatContext
void av_log(void *avcl, int level, const char *fmt,...) av_printf_format(3
Send the specified message to the log if the level is less than or equal to the current av_log_level...
const char ff_id3v2_4_tags[][4]
ID3v2.4-only text information frames.
void av_freep(void *ptr)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc() and set the pointer ...
if((e=av_dict_get(options,"", NULL, AV_DICT_IGNORE_SUFFIX)))
#define ID3v2_HEADER_SIZE
const AVMetadataConv ff_id3v2_34_metadata_conv[]
static av_cold int end(AVCodecContext *avctx)
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq) av_const
Rescale a 64-bit integer by 2 rational numbers.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
const AVMetadataConv ff_id3v2_4_metadata_conv[]
static int string_is_ascii(const uint8_t *str)
void av_dict_free(AVDictionary **m)
Free all the memory allocated for an AVDictionary struct and all keys and values. ...
static int write_chapter(AVFormatContext *s, ID3v2EncContext *id3, int id, int enc)
void ff_id3v2_finish(ID3v2EncContext *id3, AVIOContext *pb)
Finalize an opened ID3v2 tag.
size_t av_strlcpy(char *dst, const char *src, size_t size)
Copy the string src to dst, but no more than size - 1 bytes, and null-terminate dst.
const char * ff_id3v2_picture_types[21]
const CodecMime ff_id3v2_mime_tags[]
#define FF_ARRAY_ELEMS(a)
int ff_id3v2_write_metadata(AVFormatContext *s, ID3v2EncContext *id3)
Convert and write all global metadata from s into an ID3v2 tag.
void ffio_fill(AVIOContext *s, int b, int count)
int64_t size_pos
offset of the tag total size
int av_strcasecmp(const char *a, const char *b)
Locale-independent case-insensitive compare.
int64_t end
chapter start/end time in time_base units
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.
static int id3v2_check_write_tag(ID3v2EncContext *id3, AVIOContext *pb, AVDictionaryEntry *t, const char table[][4], enum ID3v2Encoding enc)
AVIOContext * pb
I/O context.
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)
Set the given entry in *pm, overwriting an existing entry.
rational number numerator/denominator
static int write_metadata(AVIOContext *pb, AVDictionary **metadata, ID3v2EncContext *id3, int enc)
static void id3v2_encode_string(AVIOContext *pb, const uint8_t *str, enum ID3v2Encoding enc)
#define MKBETAG(a, b, c, d)
int ff_id3v2_write_apic(AVFormatContext *s, ID3v2EncContext *id3, AVPacket *pkt)
Write an attached picture from pkt into an ID3v2 tag.
static int id3v2_put_ttag(ID3v2EncContext *id3, AVIOContext *avioc, const char *str1, const char *str2, uint32_t tag, enum ID3v2Encoding enc)
Write a text frame with one (normal frames) or two (TXXX frames) strings according to encoding (only ...
static void id3v2_put_size(AVIOContext *pb, int size)
AVRational time_base
time base in which the start/end timestamps are specified
const char ff_id3v2_3_tags[][4]
ID3v2.3-only text information frames.
static void id3v2_3_metadata_split_date(AVDictionary **pm)
#define AV_DICT_IGNORE_SUFFIX
int version
ID3v2 minor version, either 3 or 4.
This structure stores compressed data.