mod_musicindex
1.4.1
|
MP3 files management system. More...
#include "playlist.h"
#include "playlist-mp3.h"
#include <mad.h>
#include <id3tag.h>
#include <ctype.h>
Go to the source code of this file.
Data Structures | |
struct | |
xing header structure More... |
Macros | |
#define | INPUT_BUFFER_SIZE 16*1024 |
Input buffer size used by libmad subsystem. | |
#define | MAD_AVERAGE_FRAMES 10 |
Number of frames to read before doing average calculations for VBR files. | |
#define | DO_FAST_CALC 1 |
Whether we should read the whole file and get accurate bitrate/length or not. | |
#define | XING_MAGIC1 ( ('X' << 24) | ('i' << 16) | ('n' << 8) | 'g' ) |
XING magic header. | |
#define | XING_MAGIC2 ( ('I' << 24) | ('n' << 16) | ('f' << 8) | 'o' ) |
XING magic header. |
Enumerations | |
enum | { XING_FRAMES = 0x00000001L, XING_BYTES = 0x00000002L, XING_TOC = 0x00000004L, XING_SCALE = 0x00000008L } |
xing fields enumeration More... |
Functions | |
static short | xing_parse (struct xing *xing, struct mad_bitptr ptr, unsigned short bitlen) |
Parse Xing VBR headers. | |
static short | mpg123_mp3_ext_check (const char *const filename) |
Checks for valid MP3 filename extension. | |
static id3_utf8_t * | utf8_id3tag_findframe (struct id3_tag *tag, const char *const frameid, unsigned short index) |
Converts an id3tag string in utf8. | |
mu_ent * | make_mp3_entry (request_rec *r, apr_pool_t *pool, FILE *const in, const char *const filename) |
Fills in the information fields about MP3 data. |
MP3 files management system.
This file contains everything needed to produce music entries from MP3 files.
Some pieces of code are based on xmms mpg123 and mad plugins.
DEV NOTE: As one might guess, MP3 files are a real mess :P
Definition in file playlist-mp3.c.
#define DO_FAST_CALC 1 |
Whether we should read the whole file and get accurate bitrate/length or not.
Definition at line 46 of file playlist-mp3.c.
Referenced by make_mp3_entry().
#define INPUT_BUFFER_SIZE 16*1024 |
Input buffer size used by libmad subsystem.
Definition at line 44 of file playlist-mp3.c.
Referenced by make_mp3_entry().
#define MAD_AVERAGE_FRAMES 10 |
Number of frames to read before doing average calculations for VBR files.
Definition at line 45 of file playlist-mp3.c.
Referenced by make_mp3_entry().
#define XING_MAGIC1 ( ('X' << 24) | ('i' << 16) | ('n' << 8) | 'g' ) |
#define XING_MAGIC2 ( ('I' << 24) | ('n' << 16) | ('f' << 8) | 'o' ) |
anonymous enum |
xing fields enumeration
Definition at line 60 of file playlist-mp3.c.
mu_ent* make_mp3_entry | ( | request_rec * | r, |
apr_pool_t * | pool, | ||
FILE *const | in, | ||
const char *const | filename | ||
) |
Fills in the information fields about MP3 data.
This function reads the id3 tags (using libid3tag0) from the MP3 file in and fills in the struct mu_ent fields accordingly.
pool | Pool |
in | MP3 file to parse (closed on normal exit) |
filename | current filename |
r | Apache request_rec struct to handle log writings (debugging) |
Definition at line 252 of file playlist-mp3.c.
References mu_ent::album, apr_pstrdup, mu_ent::artist, mu_ent::bitrate, xing::bytes, mu_ent::date, DO_FAST_CALC, EF_VBR, mu_ent::filetype, mu_ent::flags, xing::frames, mu_ent::freq, FT_MP3, mu_ent::genre, INPUT_BUFFER_SIZE, mu_ent::length, MAD_AVERAGE_FRAMES, MI_QUICKPL, mi_rdebug, mpg123_mp3_ext_check(), mu_ent::mtime, musicindex_module, NEW_ENT, mu_config::options, mu_ent::posn, mu_ent::size, mu_ent::title, mu_ent::track, utf8_id3tag_findframe(), and xing_parse().
|
inlinestatic |
Checks for valid MP3 filename extension.
filename | The filename to check. |
Definition at line 181 of file playlist-mp3.c.
Referenced by make_mp3_entry().
|
static |
Converts an id3tag string in utf8.
This function reads the id3tag from an MP3 file (if any) and converts the result in the utf8 standard format. It handles V1/V2 genres correctly.
tag | The tag struct to parse |
frameid | The type of tag data searched |
index | The id3tag index value |
Definition at line 205 of file playlist-mp3.c.
Referenced by make_mp3_entry().
|
static |
Parse Xing VBR headers.
This function comes from xmms-mad plugin.
Xing structure to populate. | |
ptr | mad_bitptr struct. |
bitlen | bit size. |
Definition at line 116 of file playlist-mp3.c.
References xing::bytes, xing::flags, xing::frames, xing::scale, xing::toc, XING_BYTES, XING_FRAMES, XING_MAGIC1, XING_MAGIC2, XING_SCALE, and XING_TOC.
Referenced by make_mp3_entry().