42 while (*str && *str < 128) str++;
105 if (t->
key[0] !=
'T' || strlen(t->
key) != 4)
108 for (i = 0; *table[i]; i++)
118 const char *key, *
value;
119 char year[5] = {0}, day_month[5] = {0};
128 while (value[i] >=
'0' && value[i] <=
'9') i++;
129 if (value[i] ==
'\0' || value[i] ==
'-') {
133 if (value[i] ==
'-' &&
134 value[i+1] >=
'0' && value[i+1] <=
'1' &&
135 value[i+2] >=
'0' && value[i+2] <=
'9' &&
137 value[i+4] >=
'0' && value[i+4] <=
'3' &&
138 value[i+5] >=
'0' && value[i+5] <=
'9' &&
139 (value[i+6] ==
'\0' || value[i+6] ==
' ')) {
140 snprintf(day_month,
sizeof(day_month),
"%.2s%.2s", value + i + 4, value + i + 1);
232 if (dyn_bc && !dyn_buf)
264 const char *mimetype =
NULL, *desc =
"";
272 mimetype = mime->
str;
279 "write an attached picture.\n", st->
index);
330 if (padding_bytes < 0)
339 padding_bytes = av_clip(padding_bytes, 10, 268435455 - id3->
len);
341 id3->
len += padding_bytes;
unsigned int nb_chapters
Number of chapters in AVChapter array.
void avio_wl16(AVIOContext *s, unsigned int val)
int avio_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer)
Return the written size and a pointer to the buffer.
int len
size of the tag written so far
int ff_id3v2_write_metadata(AVFormatContext *s, ID3v2EncContext *id3)
Convert and write all global metadata from s into an ID3v2 tag.
int index
stream index in AVFormatContext
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
const char ff_id3v2_4_tags[][4]
ID3v2.4-only text information frames.
#define FF_ARRAY_ELEMS(a)
int avio_open_dyn_buf(AVIOContext **s)
Open a write only memory stream.
void ff_id3v2_start(ID3v2EncContext *id3, AVIOContext *pb, int id3v2_version, const char *magic)
Initialize an ID3v2 tag.
#define ID3v2_HEADER_SIZE
const AVMetadataConv ff_id3v2_34_metadata_conv[]
static av_cold int end(AVCodecContext *avctx)
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_RB32
AVStream ** streams
A list of all streams in the file.
AVDictionaryEntry * av_dict_get(const AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags)
Get a dictionary entry with matching key.
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
void avio_write(AVIOContext *s, const unsigned char *buf, int size)
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
AVDictionary * metadata
Metadata that applies to the whole file.
const AVMetadataConv ff_id3v2_4_metadata_conv[]
static const struct endianess table[]
static int string_is_ascii(const uint8_t *str)
void av_dict_free(AVDictionary **pm)
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)
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]
AVCodecContext * codec
Codec context associated with this stream.
const CodecMime ff_id3v2_mime_tags[]
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.
GLsizei GLboolean const GLfloat * value
void ff_id3v2_finish(ID3v2EncContext *id3, AVIOContext *pb, int padding_bytes)
Finalize an opened ID3v2 tag.
int avio_put_str(AVIOContext *s, const char *str)
Write a NULL-terminated string.
int metadata_header_padding
Number of bytes to be written as padding in a metadata header.
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.
AVIOContext * pb
I/O context.
static int id3v2_check_write_tag(ID3v2EncContext *id3, AVIOContext *pb, AVDictionaryEntry *t, const char table[][4], enum ID3v2Encoding enc)
void avio_w8(AVIOContext *s, int b)
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)
int avio_put_str16le(AVIOContext *s, const char *str)
Convert an UTF-8 string to UTF-16LE and write it.
static void id3v2_encode_string(AVIOContext *pb, const uint8_t *str, enum ID3v2Encoding enc)
int ff_id3v2_write_simple(struct AVFormatContext *s, int id3v2_version, const char *magic)
Write an ID3v2 tag containing all global metadata from s.
void avio_wb16(AVIOContext *s, unsigned int val)
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
#define MKBETAG(a, b, c, d)
const char ff_id3v2_3_tags[][4]
ID3v2.3-only text information frames.
int ff_id3v2_write_apic(AVFormatContext *s, ID3v2EncContext *id3, AVPacket *pkt)
Write an attached picture from pkt into an ID3v2 tag.
static void id3v2_3_metadata_split_date(AVDictionary **pm)
void avio_wb32(AVIOContext *s, unsigned int val)
#define AV_DICT_IGNORE_SUFFIX
Return first entry in a dictionary whose first part corresponds to the search key, ignoring the suffix of the found key string.
int version
ID3v2 minor version, either 3 or 4.
This structure stores compressed data.