id3tag.c File Reference

#include <config.h>
#include "lame.h"
#include "machine.h"
#include "encoder.h"
#include "id3tag.h"
#include "lame_global_flags.h"
#include "util.h"
#include "bitstream.h"

Include dependency graph for id3tag.c:

Go to the source code of this file.

Defines

#define strchr   index
#define strrchr   rindex
#define memcpy(d, s, n)   bcopy ((s), (d), (n))
#define memmove(d, s, n)   bcopy ((s), (d), (n))
#define GENRE_NAME_COUNT   ((int)(sizeof genre_names / sizeof (const char *const)))
#define GENRE_ALPHA_COUNT   ((int)(sizeof genre_alpha_map / sizeof (int)))
#define GENRE_INDEX_OTHER   12
#define GENRE_NUM_UNKNOWN   255
#define FRAME_ID(a, b, c, d)
#define TITLE_FRAME_ID   FRAME_ID('T', 'I', 'T', '2')
#define ARTIST_FRAME_ID   FRAME_ID('T', 'P', 'E', '1')
#define ALBUM_FRAME_ID   FRAME_ID('T', 'A', 'L', 'B')
#define YEAR_FRAME_ID   FRAME_ID('T', 'Y', 'E', 'R')
#define COMMENT_FRAME_ID   FRAME_ID('C', 'O', 'M', 'M')
#define TRACK_FRAME_ID   FRAME_ID('T', 'R', 'C', 'K')
#define GENRE_FRAME_ID   FRAME_ID('T', 'C', 'O', 'N')
#define ENCODER_FRAME_ID   FRAME_ID('T', 'S', 'S', 'E')
#define PLAYLENGTH_FRAME_ID   FRAME_ID('T', 'L', 'E', 'N')

Functions

char * strchr ()
char ** strrchr ()
void id3tag_genre_list (void(*handler)(int, const char *, void *), void *cookie)
void id3tag_init (lame_global_flags *gfp)
void id3tag_add_v2 (lame_global_flags *gfp)
void id3tag_v1_only (lame_global_flags *gfp)
void id3tag_v2_only (lame_global_flags *gfp)
void id3tag_space_v1 (lame_global_flags *gfp)
void id3tag_pad_v2 (lame_global_flags *gfp)
static void local_strdup (char **dst, const char *src)
void id3tag_set_title (lame_global_flags *gfp, const char *title)
void id3tag_set_artist (lame_global_flags *gfp, const char *artist)
void id3tag_set_album (lame_global_flags *gfp, const char *album)
void id3tag_set_year (lame_global_flags *gfp, const char *year)
void id3tag_set_comment (lame_global_flags *gfp, const char *comment)
int id3tag_set_track (lame_global_flags *gfp, const char *track)
static int local_strcasecmp (const char *s1, const char *s2)
int id3tag_set_genre (lame_global_flags *gfp, const char *genre)
int id3tag_set_fieldvalue (lame_global_flags *gfp, const char *fieldvalue)
int id3tag_set_albumart (lame_global_flags *gfp, const char *image, unsigned long size)
static unsigned char * set_4_byte_value (unsigned char *bytes, unsigned long value)
static unsigned char * set_frame (unsigned char *frame, unsigned long id, const char *text, size_t length)
static unsigned char * set_frame_custom (unsigned char *frame, const char *fieldvalue)
static unsigned char * set_frame_apic (unsigned char *frame, const char *mimetype, const unsigned char *data, size_t size)
int id3tag_write_v2 (lame_global_flags *gfp)
static unsigned char * set_text_field (unsigned char *field, const char *text, size_t size, int pad)
int id3tag_write_v1 (lame_global_flags *gfp)

Variables

static const char *const genre_names []
static const int genre_alpha_map []


Define Documentation

#define ALBUM_FRAME_ID   FRAME_ID('T', 'A', 'L', 'B')

Definition at line 442 of file id3tag.c.

Referenced by id3tag_write_v2().

#define ARTIST_FRAME_ID   FRAME_ID('T', 'P', 'E', '1')

Definition at line 441 of file id3tag.c.

Referenced by id3tag_write_v2().

#define COMMENT_FRAME_ID   FRAME_ID('C', 'O', 'M', 'M')

Definition at line 444 of file id3tag.c.

Referenced by id3tag_write_v2(), and set_frame().

#define ENCODER_FRAME_ID   FRAME_ID('T', 'S', 'S', 'E')

Definition at line 447 of file id3tag.c.

Referenced by id3tag_write_v2().

#define FRAME_ID ( a,
b,
c,
 ) 

Value:

( ((unsigned long)(a) << 24) \
    | ((unsigned long)(b) << 16) \
    | ((unsigned long)(c) <<  8) \
    | ((unsigned long)(d) <<  0) )

Definition at line 435 of file id3tag.c.

Referenced by set_frame_apic().

#define GENRE_ALPHA_COUNT   ((int)(sizeof genre_alpha_map / sizeof (int)))

Definition at line 116 of file id3tag.c.

Referenced by id3tag_genre_list().

#define GENRE_FRAME_ID   FRAME_ID('T', 'C', 'O', 'N')

Definition at line 446 of file id3tag.c.

Referenced by id3tag_write_v2().

#define GENRE_INDEX_OTHER   12

Definition at line 118 of file id3tag.c.

Referenced by id3tag_set_genre().

#define GENRE_NAME_COUNT   ((int)(sizeof genre_names / sizeof (const char *const)))

Definition at line 101 of file id3tag.c.

Referenced by id3tag_genre_list(), and id3tag_set_genre().

#define GENRE_NUM_UNKNOWN   255

Definition at line 134 of file id3tag.c.

Referenced by id3tag_init().

#define memcpy ( d,
s,
 )     bcopy ((s), (d), (n))

Definition at line 48 of file id3tag.c.

#define memmove ( d,
s,
 )     bcopy ((s), (d), (n))

Definition at line 49 of file id3tag.c.

#define PLAYLENGTH_FRAME_ID   FRAME_ID('T', 'L', 'E', 'N')

Definition at line 448 of file id3tag.c.

Referenced by id3tag_write_v2().

#define strchr   index

Definition at line 43 of file id3tag.c.

#define strrchr   rindex

Definition at line 44 of file id3tag.c.

#define TITLE_FRAME_ID   FRAME_ID('T', 'I', 'T', '2')

Definition at line 440 of file id3tag.c.

Referenced by id3tag_write_v2().

#define TRACK_FRAME_ID   FRAME_ID('T', 'R', 'C', 'K')

Definition at line 445 of file id3tag.c.

Referenced by id3tag_write_v2().

#define YEAR_FRAME_ID   FRAME_ID('T', 'Y', 'E', 'R')

Definition at line 443 of file id3tag.c.

Referenced by id3tag_write_v2().


Function Documentation

void id3tag_add_v2 ( lame_global_flags gfp  ) 

Definition at line 148 of file id3tag.c.

References ADD_V2_FLAG, id3tag_spec::flags, gfc, gfp, lame_global_struct::internal_flags, lame_internal_flags::tag_spec, and V1_ONLY_FLAG.

Referenced by id3tag_set_albumart(), id3tag_set_fieldvalue(), and parse_args().

void id3tag_genre_list ( void(*)(int, const char *, void *)  handler,
void *  cookie 
)

Definition at line 121 of file id3tag.c.

References GENRE_ALPHA_COUNT, genre_alpha_map, GENRE_NAME_COUNT, genre_names, and i.

Referenced by parse_args().

void id3tag_init ( lame_global_flags gfp  ) 

Definition at line 137 of file id3tag.c.

References free_id3tag(), id3tag_spec::genre_id3v1, GENRE_NUM_UNKNOWN, gfc, gfp, lame_global_struct::internal_flags, and lame_internal_flags::tag_spec.

Referenced by parse_args().

Here is the call graph for this function:

void id3tag_pad_v2 ( lame_global_flags gfp  ) 

Definition at line 180 of file id3tag.c.

References id3tag_spec::flags, gfc, gfp, lame_global_struct::internal_flags, PAD_V2_FLAG, lame_internal_flags::tag_spec, and V1_ONLY_FLAG.

Referenced by parse_args().

void id3tag_set_album ( lame_global_flags gfp,
const char *  album 
)

Definition at line 225 of file id3tag.c.

References id3tag_spec::album, CHANGED_FLAG, id3tag_spec::flags, gfc, gfp, lame_global_struct::internal_flags, local_strdup(), and lame_internal_flags::tag_spec.

Referenced by parse_args().

Here is the call graph for this function:

int id3tag_set_albumart ( lame_global_flags gfp,
const char *  image,
unsigned long  size 
)

Definition at line 384 of file id3tag.c.

References id3tag_spec::albumart, id3tag_spec::albumart_mimetype, id3tag_spec::albumart_size, CHANGED_FLAG, id3tag_spec::flags, gfc, gfp, id3tag_add_v2(), lame_global_struct::internal_flags, LAME_MAXALBUMART, memcpy, MIMETYPE_GIF, MIMETYPE_JPEG, MIMETYPE_NONE, MIMETYPE_PNG, and lame_internal_flags::tag_spec.

Referenced by parse_args().

Here is the call graph for this function:

void id3tag_set_artist ( lame_global_flags gfp,
const char *  artist 
)

Definition at line 215 of file id3tag.c.

References id3tag_spec::artist, CHANGED_FLAG, id3tag_spec::flags, gfc, gfp, lame_global_struct::internal_flags, local_strdup(), and lame_internal_flags::tag_spec.

Referenced by parse_args().

Here is the call graph for this function:

void id3tag_set_comment ( lame_global_flags gfp,
const char *  comment 
)

Definition at line 255 of file id3tag.c.

References CHANGED_FLAG, id3tag_spec::comment, id3tag_spec::flags, gfc, gfp, lame_global_struct::internal_flags, local_strdup(), and lame_internal_flags::tag_spec.

Referenced by parse_args().

Here is the call graph for this function:

int id3tag_set_fieldvalue ( lame_global_flags gfp,
const char *  fieldvalue 
)

Definition at line 363 of file id3tag.c.

References CHANGED_FLAG, id3tag_spec::flags, gfc, gfp, id3tag_add_v2(), lame_global_struct::internal_flags, id3tag_spec::num_values, lame_internal_flags::tag_spec, and id3tag_spec::values.

Referenced by parse_args().

Here is the call graph for this function:

int id3tag_set_genre ( lame_global_flags gfp,
const char *  genre 
)

Definition at line 313 of file id3tag.c.

References ADD_V2_FLAG, CHANGED_FLAG, id3tag_spec::flags, id3tag_spec::genre_id3v1, id3tag_spec::genre_id3v2, GENRE_INDEX_OTHER, GENRE_NAME_COUNT, genre_names, gfc, gfp, i, lame_global_struct::internal_flags, local_strcasecmp(), local_strdup(), and lame_internal_flags::tag_spec.

Referenced by parse_args().

Here is the call graph for this function:

void id3tag_set_title ( lame_global_flags gfp,
const char *  title 
)

Definition at line 205 of file id3tag.c.

References CHANGED_FLAG, id3tag_spec::flags, gfc, gfp, lame_global_struct::internal_flags, local_strdup(), lame_internal_flags::tag_spec, and id3tag_spec::title.

Referenced by parse_args().

Here is the call graph for this function:

int id3tag_set_track ( lame_global_flags gfp,
const char *  track 
)

Definition at line 265 of file id3tag.c.

References ADD_V2_FLAG, CHANGED_FLAG, id3tag_spec::flags, gfc, gfp, lame_global_struct::internal_flags, local_strdup(), strchr, lame_internal_flags::tag_spec, id3tag_spec::track_id3v1, and id3tag_spec::track_id3v2.

Referenced by parse_args().

Here is the call graph for this function:

void id3tag_set_year ( lame_global_flags gfp,
const char *  year 
)

Definition at line 235 of file id3tag.c.

References CHANGED_FLAG, id3tag_spec::flags, gfc, gfp, lame_global_struct::internal_flags, lame_internal_flags::tag_spec, and id3tag_spec::year.

Referenced by parse_args().

void id3tag_space_v1 ( lame_global_flags gfp  ) 

Definition at line 172 of file id3tag.c.

References id3tag_spec::flags, gfc, gfp, lame_global_struct::internal_flags, SPACE_V1_FLAG, lame_internal_flags::tag_spec, and V2_ONLY_FLAG.

Referenced by parse_args().

void id3tag_v1_only ( lame_global_flags gfp  ) 

Definition at line 156 of file id3tag.c.

References ADD_V2_FLAG, id3tag_spec::flags, gfc, gfp, lame_global_struct::internal_flags, lame_internal_flags::tag_spec, V1_ONLY_FLAG, and V2_ONLY_FLAG.

Referenced by parse_args().

void id3tag_v2_only ( lame_global_flags gfp  ) 

Definition at line 164 of file id3tag.c.

References id3tag_spec::flags, gfc, gfp, lame_global_struct::internal_flags, lame_internal_flags::tag_spec, V1_ONLY_FLAG, and V2_ONLY_FLAG.

Referenced by parse_args().

int id3tag_write_v1 ( lame_global_flags gfp  ) 

Definition at line 749 of file id3tag.c.

References add_dummy_byte(), id3tag_spec::album, id3tag_spec::artist, CHANGED_FLAG, id3tag_spec::comment, id3tag_spec::flags, id3tag_spec::genre_id3v1, gfc, gfp, lame_global_struct::internal_flags, set_text_field(), SPACE_V1_FLAG, lame_internal_flags::tag_spec, id3tag_spec::title, id3tag_spec::track_id3v1, V2_ONLY_FLAG, and id3tag_spec::year.

Referenced by lame_encode_flush().

Here is the call graph for this function:

int id3tag_write_v2 ( lame_global_flags gfp  ) 

Definition at line 542 of file id3tag.c.

References add_dummy_byte(), ADD_V2_FLAG, id3tag_spec::album, ALBUM_FRAME_ID, id3tag_spec::albumart, id3tag_spec::albumart_mimetype, id3tag_spec::albumart_size, id3tag_spec::artist, ARTIST_FRAME_ID, CHANGED_FLAG, id3tag_spec::comment, COMMENT_FRAME_ID, ENCODER_FRAME_ID, id3tag_spec::flags, GENRE_FRAME_ID, id3tag_spec::genre_id3v2, get_lame_version(), gfc, gfp, lame_global_struct::in_samplerate, lame_global_struct::internal_flags, MAX_U_32_NUM, MIMETYPE_GIF, MIMETYPE_JPEG, MIMETYPE_PNG, lame_global_struct::num_samples, id3tag_spec::num_values, PAD_V2_FLAG, PLAYLENGTH_FRAME_ID, set_frame(), set_frame_apic(), set_frame_custom(), lame_internal_flags::tag_spec, id3tag_spec::title, TITLE_FRAME_ID, TRACK_FRAME_ID, id3tag_spec::track_id3v1, id3tag_spec::track_id3v2, V1_ONLY_FLAG, V2_ONLY_FLAG, id3tag_spec::values, id3tag_spec::year, and YEAR_FRAME_ID.

Referenced by lame_init_bitstream().

Here is the call graph for this function:

static int local_strcasecmp ( const char *  s1,
const char *  s2 
) [static]

Definition at line 296 of file id3tag.c.

Referenced by filename_to_type(), and id3tag_set_genre().

static void local_strdup ( char **  dst,
const char *  src 
) [static]

Definition at line 189 of file id3tag.c.

Referenced by id3tag_set_album(), id3tag_set_artist(), id3tag_set_comment(), id3tag_set_genre(), id3tag_set_title(), and id3tag_set_track().

static unsigned char* set_4_byte_value ( unsigned char *  bytes,
unsigned long  value 
) [static]

Definition at line 425 of file id3tag.c.

Referenced by set_frame(), set_frame_apic(), and set_frame_custom().

static unsigned char* set_frame ( unsigned char *  frame,
unsigned long  id,
const char *  text,
size_t  length 
) [static]

Definition at line 451 of file id3tag.c.

References COMMENT_FRAME_ID, and set_4_byte_value().

Referenced by id3tag_write_v2().

Here is the call graph for this function:

static unsigned char* set_frame_apic ( unsigned char *  frame,
const char *  mimetype,
const unsigned char *  data,
size_t  size 
) [static]

Definition at line 506 of file id3tag.c.

References FRAME_ID, and set_4_byte_value().

Referenced by id3tag_write_v2().

Here is the call graph for this function:

static unsigned char* set_frame_custom ( unsigned char *  frame,
const char *  fieldvalue 
) [static]

Definition at line 483 of file id3tag.c.

References set_4_byte_value().

Referenced by id3tag_write_v2().

Here is the call graph for this function:

static unsigned char* set_text_field ( unsigned char *  field,
const char *  text,
size_t  size,
int  pad 
) [static]

Definition at line 735 of file id3tag.c.

Referenced by id3tag_write_v1().

char* strchr (  ) 

char* * strrchr (  ) 


Variable Documentation

const int genre_alpha_map[] [static]

Initial value:

 {
    123, 34, 74, 73, 99, 20, 40, 26, 145, 90, 116, 41, 135, 85, 96, 138, 89, 0,
    107, 132, 65, 88, 104, 102, 97, 136, 61, 141, 32, 1, 112, 128, 57, 140, 2,
    139, 58, 3, 125, 50, 22, 4, 55, 127, 122, 120, 98, 52, 48, 54, 124, 25, 84,
    80, 115, 81, 119, 5, 30, 36, 59, 126, 38, 49, 91, 6, 129, 79, 137, 7, 35,
    100, 131, 19, 33, 46, 47, 8, 29, 146, 63, 86, 71, 45, 142, 9, 77, 82, 64,
    133, 10, 66, 39, 11, 103, 12, 75, 134, 13, 53, 62, 109, 117, 23, 108, 92,
    67, 93, 43, 121, 15, 68, 14, 16, 76, 87, 118, 17, 78, 143, 114, 110, 69, 21,
    111, 95, 105, 42, 37, 24, 56, 44, 101, 83, 94, 106, 147, 113, 18, 51, 130,
    144, 60, 70, 31, 72, 27, 28
}

Definition at line 104 of file id3tag.c.

Referenced by id3tag_genre_list().

const char* const genre_names[] [static]

Initial value:

 {
    
    "Blues", "Classic Rock", "Country", "Dance", "Disco", "Funk", "Grunge",
    "Hip-Hop", "Jazz", "Metal", "New Age", "Oldies", "Other", "Pop", "R&B",
    "Rap", "Reggae", "Rock", "Techno", "Industrial", "Alternative", "Ska",
    "Death Metal", "Pranks", "Soundtrack", "Euro-Techno", "Ambient", "Trip-Hop",
    "Vocal", "Jazz+Funk", "Fusion", "Trance", "Classical", "Instrumental",
    "Acid", "House", "Game", "Sound Clip", "Gospel", "Noise", "Alternative Rock",
    "Bass", "Soul", "Punk", "Space", "Meditative", "Instrumental Pop",
    "Instrumental Rock", "Ethnic", "Gothic", "Darkwave", "Techno-Industrial",
    "Electronic", "Pop-Folk", "Eurodance", "Dream", "Southern Rock", "Comedy",
    "Cult", "Gangsta", "Top 40", "Christian Rap", "Pop/Funk", "Jungle",
    "Native US", "Cabaret", "New Wave", "Psychedelic", "Rave",
    "Showtunes", "Trailer", "Lo-Fi", "Tribal", "Acid Punk", "Acid Jazz",
    "Polka", "Retro", "Musical", "Rock & Roll", "Hard Rock", "Folk",
    "Folk-Rock", "National Folk", "Swing", "Fast Fusion", "Bebob", "Latin",
    "Revival", "Celtic", "Bluegrass", "Avantgarde", "Gothic Rock",
    "Progressive Rock", "Psychedelic Rock", "Symphonic Rock", "Slow Rock",
    "Big Band", "Chorus", "Easy Listening", "Acoustic", "Humour", "Speech",
    "Chanson", "Opera", "Chamber Music", "Sonata", "Symphony", "Booty Bass",
    "Primus", "Porn Groove", "Satire", "Slow Jam", "Club", "Tango", "Samba",
    "Folklore", "Ballad", "Power Ballad", "Rhythmic Soul", "Freestyle", "Duet",
    "Punk Rock", "Drum Solo", "Acappella", "Euro-House", "Dance Hall",
    "Goa", "Drum & Bass", "Club-House", "Hardcore", "Terror", "Indie",
    "BritPop", "Negerpunk", "Polsk Punk", "Beat", "Christian Gangsta",
    "Heavy Metal", "Black Metal", "Crossover", "Contemporary Christian",
    "Christian Rock", "Merengue", "Salsa", "Thrash Metal", "Anime", "JPop",
    "SynthPop"
}

Definition at line 68 of file id3tag.c.

Referenced by id3tag_genre_list(), and id3tag_set_genre().


Generated on Sun Dec 2 11:36:07 2007 for LAME by  doxygen 1.5.2