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 "id3v2.h"
Include dependency graph for id3v2enc.c:

Go to the source code of this file.

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). More...
 
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. More...
 
int ff_id3v2_write_metadata (AVFormatContext *s, ID3v2EncContext *id3)
 Convert and write all global metadata from s into an ID3v2 tag. More...
 
int ff_id3v2_write_apic (AVFormatContext *s, ID3v2EncContext *id3, AVPacket *pkt)
 Write an attached picture from pkt into an ID3v2 tag. More...
 
void ff_id3v2_finish (ID3v2EncContext *id3, AVIOContext *pb)
 Finalize an opened ID3v2 tag. More...
 
int ff_id3v2_write_simple (struct AVFormatContext *s, int id3v2_version, const char *magic)
 Write an ID3v2 tag containing all global metadata from s. More...
 

Function Documentation

void ff_id3v2_finish ( ID3v2EncContext id3,
AVIOContext pb 
)

Finalize an opened ID3v2 tag.

Definition at line 264 of file id3v2enc.c.

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

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

Initialize an ID3v2 tag.

Definition at line 151 of file id3v2enc.c.

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

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

Write an attached picture from pkt into an ID3v2 tag.

Definition at line 199 of file id3v2enc.c.

Referenced by put_id3v2_tags(), and query_codec().

int ff_id3v2_write_metadata ( AVFormatContext s,
ID3v2EncContext id3 
)

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

Definition at line 165 of file id3v2enc.c.

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

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 272 of file id3v2enc.c.

Referenced by oma_write_header().

static void id3v2_3_metadata_split_date ( AVDictionary **  pm)
static

Definition at line 113 of file id3v2enc.c.

Referenced by ff_id3v2_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 98 of file id3v2enc.c.

Referenced by ff_id3v2_write_metadata().

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

Definition at line 45 of file id3v2enc.c.

Referenced by ff_id3v2_write_apic(), and id3v2_put_ttag().

static void id3v2_put_size ( AVIOContext pb,
int  size 
)
static

Definition at line 31 of file id3v2enc.c.

Referenced by ff_id3v2_finish(), 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 64 of file id3v2enc.c.

Referenced by ff_id3v2_write_metadata(), and id3v2_check_write_tag().

static int string_is_ascii ( const uint8_t str)
static

Definition at line 39 of file id3v2enc.c.

Referenced by id3v2_put_ttag().