FFmpeg
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
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 "id3v2.h"

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).
 
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.
 
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.
 

Function Documentation

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 string_is_ascii ( const uint8_t str)
static

Definition at line 39 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 45 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 64 of file id3v2enc.c.

Referenced by ff_id3v2_write_metadata(), and id3v2_check_write_tag().

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_3_metadata_split_date ( AVDictionary **  pm)
static

Definition at line 113 of file id3v2enc.c.

Referenced by ff_id3v2_write_metadata().

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(), and put_id3v2_tags().

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(), 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 199 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 264 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 272 of file id3v2enc.c.

Referenced by oma_write_header().