Main Page | Data Structures | File List | Data Fields | Globals | Related Pages

playlist.h File Reference

#include "mod_musicindex.h"
#include "cache.h"
#include "inf.h"
#include <mad.h>
#include <stdio.h>
#include <sys/stat.h>
#include <ctype.h>
#include <vorbis/codec.h>
#include <vorbis/vorbisfile.h>
#include <id3tag.h>

Go to the source code of this file.

Defines

#define INPUT_BUFFER_SIZE   8192
 Input buffer size used by libmad subsystem.

#define GENRE_MAX   0x94
 Max number of digit coded genres.


Functions

mu_entmake_ogg_entry (apr_pool_t *pool, mu_ent *head, FILE *in, mu_config *conf, mu_ent_names *names, request_rec *r)
 Fills in the information fields about OGG data.

mu_entmake_mp3_entry (apr_pool_t *pool, mu_ent *head, FILE *in, mu_config *conf, mu_ent_names *names, request_rec *r)
 Fills in the information fields about MP3 data.

mu_entmake_music_entry (apr_pool_t *pool, request_rec *r, mu_ent *head, mu_config *conf, mu_ent_names *names)
 Add a file (and the content of the directory if requested) to the chain.

short musicindex_directory (request_rec *r, mu_config *conf)
 Generates and sends a webpage listing the music files in the directory.

short playlist_directory (request_rec *r, mu_config *conf)
 Creates and sends a playlist with the content of a directory.

short playlist_selected (request_rec *r, mu_config *conf)
 Generates and sends a playlist with only selected items.

mu_entnew_ent (apr_pool_t *pool, mu_ent *head)
 Creates a new musical entry (mp3, ogg or directory).


Define Documentation

#define GENRE_MAX   0x94
 

Max number of digit coded genres.

Definition at line 35 of file playlist.h.

Referenced by make_mp3_entry().

#define INPUT_BUFFER_SIZE   8192
 

Input buffer size used by libmad subsystem.

Definition at line 34 of file playlist.h.

Referenced by make_mp3_entry().


Function Documentation

mu_ent* make_mp3_entry apr_pool_t *  pool,
mu_ent head,
FILE *  in,
mu_config conf,
mu_ent_names names,
request_rec *  r
 

Fills in the information fields about MP3 data.

This function reads the id3 tags (using libid3tag0) from the MP3 file and fills in the struct mu_ent fields accordingly.

Parameters:
pool Pool
head Head
in MP3 file to parse
conf MusicIndex configuration paramaters struct
names Names
r Apache request_rec struct to handle log writings (debugging)
Returns:
When possible, struct mu_ent correctly set up

Bug:
Reports wrong bitrate/length with VBR files.

Todo:
VBR handling (Xing headers decoding).

Definition at line 273 of file playlist.c.

References mu_ent::album, mu_ent::artist, mu_ent::bitrate, mu_ent::date, mu_ent_names::filename, mu_ent::filetype, FT_MP3, mu_ent::genre, GENRE_MAX, INPUT_BUFFER_SIZE, mu_ent::length, MI_QUICKPL, mpg123_id3_genres, mpg123_mp3_ext_check(), new_ent(), mu_config::options, mu_ent::posn, mu_ent::size, mu_ent::title, mu_ent::track, and utf8_id3tag_findframe().

Referenced by make_music_entry().

mu_ent* make_music_entry apr_pool_t *  pool,
request_rec *  r,
mu_ent head,
mu_config conf,
mu_ent_names names
 

Add a file (and the content of the directory if requested) to the chain.

This function creates a new entry from a file. If the file is a directory and the recursive option is set, all its content is also added. If the file is an ogg vorbis or an mp3, it is simply added.

Parameters:
pool Pool
r Apache request_rec struct to handle log writings (debugging)
head Head
conf MusicIndex configuration paramaters struct
names Names

Todo:
Clear ent structure. Apache doesn't like the usual "free".
Returns:
When possible, struct mu_ent correctly set up

Definition at line 450 of file playlist.c.

References mu_ent::album, mu_ent::artist, CA_CREATE, cache_check_dir(), cache_check_file(), mu_config::cache_path, cache_read_file(), cache_write_file(), mu_ent::file, mu_ent_names::filename, mu_ent::filetype, FT_DIR, make_mp3_entry(), make_ogg_entry(), MAX_STRING, MI_PLAYLIST, MI_RECURSIVE, MI_SEARCH, mu_cache_data::name, new_ent(), mu_config::options, mu_config::play_recursive, mu_config::search, mu_ent::title, mu_ent::uri, and mu_ent_names::uri.

Referenced by musicindex_directory(), playlist_directory(), and playlist_selected().

mu_ent* make_ogg_entry apr_pool_t *  pool,
mu_ent head,
FILE *  in,
mu_config conf,
mu_ent_names names,
request_rec *  r
 

Fills in the information fields about OGG data.

This function reads the ogg tags (using libvorbisfile) from the ogg file and fills in the struct mu_ent fields accordingly. If the file is not an ogg one, the function returns p = head.

Parameters:
pool Pool
head Head
in ogg file to parse
conf MusicIndex configuration paramaters struct
names Names
r Apache request_rec struct to handle log writings (debugging)
Returns:
When possible, struct mu_ent correctly set up

Definition at line 211 of file playlist.c.

References mu_ent::album, mu_ent::artist, mu_ent::bitrate, mu_ent::date, mu_ent::filetype, FT_OGG, mu_ent::genre, mu_ent::length, MI_QUICKPL, new_ent(), mu_config::options, mu_ent::posn, mu_ent::title, and mu_ent::track.

Referenced by make_music_entry().

short musicindex_directory request_rec *  r,
mu_config conf
 

Generates and sends a webpage listing the music files in the directory.

Parameters:
r Apache request_rec struct
conf MusicIndex configuration parameters struct
Returns:
0 on success, error code otherwise.

Definition at line 592 of file playlist.c.

References make_music_entry(), MI_SEARCH, mu_config::options, quicksort(), send_directories(), send_foot(), send_head(), and send_tracks().

Referenced by handle_musicindex().

mu_ent* new_ent apr_pool_t *  pool,
mu_ent head
 

Creates a new musical entry (mp3, ogg or directory).

Parameters:
pool Apache pool linked to the current request
head music entry structure which will follow this one in the list
Returns:
A new mu_ent

Definition at line 46 of file playlist.c.

References mu_ent::next.

Referenced by cache_read_file(), make_mp3_entry(), make_music_entry(), and make_ogg_entry().

short playlist_directory request_rec *  r,
mu_config conf
 

Creates and sends a playlist with the content of a directory.

This function generates a playlist containing all the files in the current directory, either recursively or not.

Parameters:
r Apache request_rec struct
conf MusicIndex configuration paramaters struct
Returns:
0 on success, error code otherwise.

Definition at line 643 of file playlist.c.

References make_music_entry(), MI_PLAYLIST, mu_config::options, quicksort(), and send_playlist().

Referenced by handle_musicindex().

short playlist_selected request_rec *  r,
mu_config conf
 

Generates and sends a playlist with only selected items.

This function parses the requests, which is the form : http://...../?file=file1&file=file2&file=file3...

Note that in FORM requests, arguments have ' ' replaced by '+', other "special" characters are changed to their URI equivalent. Here is the trick : ap_unescape_url doesn't change the '+' to its URI equivalent. So we first change ' ' to '+' and then call the apache function. Easy, isn't it ?

Parameters:
r Apache request_rec struct
conf MusicIndex configuration paramaters struct
Returns:
0

Definition at line 691 of file playlist.c.

References mu_ent_names::filename, make_music_entry(), MAX_STRING, quicksort(), send_playlist(), and mu_ent_names::uri.

Referenced by handle_musicindex().


Generated on Thu Oct 30 13:50:29 2003 for mod_musicindex by doxygen 1.3.4