From aee7bc654a67f45556ad2c6dc0e98a06bc95c8ff Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Sun, 4 Mar 2007 22:08:04 +0100 Subject: [PATCH] make get_file_info() return the chunk table This is a preparation for the moving the read_chunk handler to the vss layer. --- aac_afh.c | 3 ++- afh.h | 5 +++-- mp3_afh.c | 3 ++- ogg_afh.c | 3 ++- vss.c | 5 ++++- 5 files changed, 13 insertions(+), 6 deletions(-) diff --git a/aac_afh.c b/aac_afh.c index e5ee2eef..b017a832 100644 --- a/aac_afh.c +++ b/aac_afh.c @@ -136,7 +136,7 @@ static long unsigned aac_set_chunk_tv(mp4AudioSpecificConfig *mp4ASC) * Init m4a file and write some tech data to given pointers. */ static int aac_get_file_info(FILE *file, char *info_str, long unsigned *frames, - int *seconds) + int *seconds, size_t **vss_chunk_table) { int i, ret, decoder_len; size_t skip; @@ -172,6 +172,7 @@ static int aac_get_file_info(FILE *file, char *info_str, long unsigned *frames, return ret; *frames = num_chunks; *seconds = aac_set_chunk_tv(&mp4ASC); + *vss_chunk_table = chunk_table; for (;;) { ret = aac_find_entry_point(inbuf, inbuf_len, &skip); if (ret >= 0) diff --git a/afh.h b/afh.h index 0ead11e0..35b7a70e 100644 --- a/afh.h +++ b/afh.h @@ -90,10 +90,11 @@ struct audio_format_handler { * this audio format. A negative return value indicates that this audio format * handler did not recognize the given file. On success, the function is * expected to return a positive value and to fill in \arg info_str, \arg - * chunks and \arg seconds appropriately. + * chunks and \arg seconds appropriately and to return the chunk table + * via \a vss_chunk_table. */ int (*get_file_info)(FILE *audio_file, char *info_str, - long unsigned *chunks, int *seconds); + long unsigned *chunks, int *seconds, size_t **vss_chunk_table); /** * cleanup function of this audio format handler * diff --git a/mp3_afh.c b/mp3_afh.c index 6850cbd8..398a334e 100644 --- a/mp3_afh.c +++ b/mp3_afh.c @@ -441,7 +441,7 @@ err_out: * Read mp3 information from audio file */ static int mp3_get_file_info(FILE *audio_file, char *info_str, - long unsigned *frames, int *seconds) + long unsigned *frames, int *seconds, size_t **vss_chunk_table) { int ret; @@ -456,6 +456,7 @@ static int mp3_get_file_info(FILE *audio_file, char *info_str, write_info_str(info_str); *frames = num_chunks; *seconds = mp3.seconds; + *vss_chunk_table = chunk_table; if (*seconds < 2 || !*frames) return -E_MP3_INFO; return 1; diff --git a/ogg_afh.c b/ogg_afh.c index b5ecc4b0..483c8365 100644 --- a/ogg_afh.c +++ b/ogg_afh.c @@ -222,7 +222,7 @@ static int ogg_save_header(FILE *file, int len) * Init oggvorbis file and write some tech data to given pointers. */ static int ogg_get_file_info(FILE *file, char *info_str, long unsigned *frames, - int *seconds) + int *seconds, size_t **vss_chunk_table) { int ret; double time_total; @@ -259,6 +259,7 @@ static int ogg_get_file_info(FILE *file, char *info_str, long unsigned *frames, vi_channels = vi->channels; ogg_compute_chunk_table(time_total); *frames = num_chunks; + *vss_chunk_table = chunk_table; sprintf(info_str, "audio_file_info1:%zu x %lu, %ldkHz, %d channels, %ldkbps\n" "audio_file_info2: \n" "audio_file_info3: \n", diff --git a/vss.c b/vss.c index 1983b8e5..ea647254 100644 --- a/vss.c +++ b/vss.c @@ -42,6 +42,7 @@ static struct timeval autoplay_barrier; extern struct misc_meta_data *mmd; extern struct audio_file_selector selectors[]; extern struct sender senders[]; +static size_t *chunk_table; static FILE *audio_file = NULL; @@ -86,6 +87,8 @@ static struct audio_format_handler afl[] = { /** iterate over each supported audio format */ #define FOR_EACH_AUDIO_FORMAT(i) for (i = 0; afl[i].name; i++) + + /** * check if vss status flag \a P (playing) is set * @@ -182,7 +185,7 @@ void vss_init(void) static int get_file_info(int i) { return afl[i].get_file_info(audio_file, mmd->audio_file_info, - &mmd->chunks_total, &mmd->seconds_total); + &mmd->chunks_total, &mmd->seconds_total, &chunk_table); } /** -- 2.30.2