FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions
id3v2enc.c File Reference
#include <stdint.h>
#include <string.h>
#include "libavutil/avstring.h"
#include "libavutil/dict.h"
#include "libavutil/intreadwrite.h"
#include "avformat.h"
#include "avio.h"
#include "avio_internal.h"
#include "id3v2.h"

Go to the source code of this file.

Macros

#define PADDING_BYTES   10
 

Functions

static void id3v2_put_size (AVIOContext *pb, int size)
 
static int string_is_ascii (const uint8_t *str)
 
static void id3v2_encode_string (AVIOContext *pb, const uint8_t *str, enum ID3v2Encoding enc)
 
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 UTF-8 or UTF-16+BOM supported).
 
static int id3v2_check_write_tag (ID3v2EncContext *id3, AVIOContext *pb, AVDictionaryEntry *t, const char table[][4], enum ID3v2Encoding enc)
 
static void id3v2_3_metadata_split_date (AVDictionary **pm)
 
void ff_id3v2_start (ID3v2EncContext *id3, AVIOContext *pb, int id3v2_version, const char *magic)
 Initialize an ID3v2 tag.
 
static int write_metadata (AVIOContext *pb, AVDictionary **metadata, ID3v2EncContext *id3, int enc)
 
static int write_chapter (AVFormatContext *s, ID3v2EncContext *id3, int id, int enc)
 
int ff_id3v2_write_metadata (AVFormatContext *s, ID3v2EncContext *id3)
 Convert and write all global metadata from s into an ID3v2 tag.
 
int ff_id3v2_write_apic (AVFormatContext *s, ID3v2EncContext *id3, AVPacket *pkt)
 Write an attached picture from pkt into an ID3v2 tag.
 
void ff_id3v2_finish (ID3v2EncContext *id3, AVIOContext *pb)
 Finalize an opened 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.
 

Macro Definition Documentation

#define PADDING_BYTES   10

Definition at line 32 of file id3v2enc.c.

Referenced by ff_id3v2_finish().

Function Documentation

static void id3v2_put_size ( AVIOContext pb,
int  size 
)
static

Definition at line 34 of file id3v2enc.c.

Referenced by ff_id3v2_finish(), ff_id3v2_write_apic(), and id3v2_put_ttag().

static int string_is_ascii ( const uint8_t str)
static

Definition at line 42 of file id3v2enc.c.

Referenced by id3v2_put_ttag().

static void id3v2_encode_string ( AVIOContext pb,
const uint8_t str,
enum ID3v2Encoding  enc 
)
static

Definition at line 48 of file id3v2enc.c.

Referenced by ff_id3v2_write_apic(), and id3v2_put_ttag().

static int id3v2_put_ttag ( ID3v2EncContext id3,
AVIOContext avioc,
const char *  str1,
const char *  str2,
uint32_t  tag,
enum ID3v2Encoding  enc 
)
static

Write a text frame with one (normal frames) or two (TXXX frames) strings according to encoding (only UTF-8 or UTF-16+BOM supported).

Returns
number of bytes written or a negative error code.

Definition at line 67 of file id3v2enc.c.

Referenced by id3v2_check_write_tag(), and write_metadata().

static int id3v2_check_write_tag ( ID3v2EncContext id3,
AVIOContext pb,
AVDictionaryEntry t,
const char  table[][4],
enum ID3v2Encoding  enc 
)
static

Definition at line 101 of file id3v2enc.c.

Referenced by write_metadata().

static void id3v2_3_metadata_split_date ( AVDictionary **  pm)
static

Definition at line 116 of file id3v2enc.c.

Referenced by write_metadata().

void ff_id3v2_start ( ID3v2EncContext id3,
AVIOContext pb,
int  id3v2_version,
const char *  magic 
)

Initialize an ID3v2 tag.

Definition at line 154 of file id3v2enc.c.

Referenced by ff_id3v2_write_simple(), and put_id3v2_tags().

static int write_metadata ( AVIOContext pb,
AVDictionary **  metadata,
ID3v2EncContext id3,
int  enc 
)
static

Definition at line 168 of file id3v2enc.c.

Referenced by ff_id3v2_write_metadata(), and write_chapter().

static int write_chapter ( AVFormatContext s,
ID3v2EncContext id3,
int  id,
int  enc 
)
static

Definition at line 200 of file id3v2enc.c.

Referenced by ff_id3v2_write_metadata().

int ff_id3v2_write_metadata ( AVFormatContext s,
ID3v2EncContext id3 
)

Convert and write all global metadata from s into an ID3v2 tag.

Definition at line 241 of file id3v2enc.c.

Referenced by ff_id3v2_write_simple(), and put_id3v2_tags().

int ff_id3v2_write_apic ( AVFormatContext s,
ID3v2EncContext id3,
AVPacket pkt 
)

Write an attached picture from pkt into an ID3v2 tag.

Definition at line 258 of file id3v2enc.c.

Referenced by put_id3v2_tags().

void ff_id3v2_finish ( ID3v2EncContext id3,
AVIOContext pb 
)

Finalize an opened ID3v2 tag.

Definition at line 323 of file id3v2enc.c.

Referenced by ff_id3v2_write_simple(), mp3_queue_flush(), and put_id3v2_tags().

int ff_id3v2_write_simple ( struct AVFormatContext s,
int  id3v2_version,
const char *  magic 
)

Write an ID3v2 tag containing all global metadata from s.

Parameters
id3v2_versionSubversion of ID3v2; supported values are 3 and 4
magicmagic bytes to identify the header If in doubt, use ID3v2_DEFAULT_MAGIC.

Definition at line 339 of file id3v2enc.c.

Referenced by oma_write_header().