X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=ogg_afh.c;h=a18c4d7efb7695584bbf0c7de89e491fdc899419;hp=b5ecc4b0f3ebc96ec5459d3e7a7e59c3ce5326f9;hb=4cfbdce5e460934d4724cac63aa718ea6c7af199;hpb=c0067c4d103b41d1f80b83170719d4afa999be54 diff --git a/ogg_afh.c b/ogg_afh.c index b5ecc4b0..a18c4d7e 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", @@ -272,37 +273,6 @@ err: return ret; } -static char *ogg_read_chunk(long unsigned current_chunk, ssize_t *len) -{ - int ret; - size_t pos; - - *len = 0; - if (current_chunk >= num_chunks) - return NULL; - *len = chunk_table[current_chunk + 1] - chunk_table[current_chunk]; - if (!*len) /* nothing to send for this run */ - return inbuf; - pos = chunk_table[current_chunk]; - if (inbuf_size < *len) { - PARA_INFO_LOG("increasing inbuf for chunk #%lu/%zu to %zd bytes\n", - current_chunk, num_chunks, *len); - inbuf = para_realloc(inbuf, *len); - inbuf_size = *len; - } -// PARA_DEBUG_LOG("reading chunk #%lu@%zd (%zd bytes)\n", current_chunk, -// pos, *len); - ret = fseek(infile, pos, SEEK_SET); - if (ret < 0) - return NULL; - ret = para_fread(inbuf, *len, 1, infile); - if (ret != *len) - return NULL; -// PARA_DEBUG_LOG("ret: %d, inbuf[0]: %lx - %lx\n", ret, (long unsigned) inbuf[0], -// (long unsigned) inbuf[4]); - return (char *)inbuf; -} - static char *ogg_get_header_info(int *len) { *len = header_len; @@ -320,7 +290,6 @@ void ogg_init(struct audio_format_handler *p) { af = p; af->get_file_info = ogg_get_file_info, - af->read_chunk = ogg_read_chunk; af->close_audio_file = ogg_close_audio_file; af->get_header_info = ogg_get_header_info; af->chunk_tv.tv_sec = 0;