X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=ogg_afh.c;h=fcc88362981c815cd0a04823d504a7ea4df5dec0;hp=d295f2d31ba1a482f7c67a0d0663a1efc5c82867;hb=0bd031509add6dccedb04a1e79420a7a9ca02711;hpb=c79899fe6a1e8eb3086749f46c599d9790d99921 diff --git a/ogg_afh.c b/ogg_afh.c index d295f2d3..fcc88362 100644 --- a/ogg_afh.c +++ b/ogg_afh.c @@ -35,8 +35,8 @@ static double chunk_time = 0.25; static OggVorbis_File *oggvorbis_file; static FILE *infile; -static int header_len, oggbuf_len, vi_channels; -static char *header, *oggbuf; +static int header_len, inbuf_size, vi_channels; +static char *header, *inbuf; static ssize_t *chunk_table, max_chunk_len; static struct audio_format_handler *af; static long vi_sampling_rate, vi_bitrate, vi_bitrate_nominal, @@ -81,11 +81,9 @@ static int ogg_compute_header_len(void) goto err2; } ret = -E_VORBIS; - if (vorbis_synthesis_headerin(&vi, &vc, &packet) < 0) { + if (vorbis_synthesis_headerin(&vi, &vc, &packet) < 0) goto err2; - } else - PARA_INFO_LOG("channels: %i, rate: %li\n", vi.channels, - vi.rate); + PARA_INFO_LOG("channels: %i, rate: %li\n", vi.channels, vi.rate); ogg_stream_packetin(stream_out, &packet); ret = ogg_sync_pageout(sync_in, &page); @@ -161,7 +159,7 @@ static void ogg_compute_chunk_table(double time_total) num = time_total / chunk_time + 3; PARA_DEBUG_LOG("chunk time: %g allocating %d chunk pointers\n", chunk_time, num); - chunk_table = para_malloc(num * sizeof(ogg_int64_t)); + chunk_table = para_malloc(num * sizeof(size_t)); chunk_table[0] = 0; max_chunk_len = 0; rewind(infile); @@ -203,9 +201,9 @@ static void ogg_close_audio_file(void) free(chunk_table); chunk_table = NULL; num_chunks = 0; - free(oggbuf); - oggbuf = NULL; - oggbuf_len = 0; + free(inbuf); + inbuf = NULL; + inbuf_size = 0; } static int ogg_save_header(FILE *file, int len) @@ -313,20 +311,20 @@ static char *ogg_read_chunk(long unsigned current_chunk, ssize_t *len) ogg_int64_t cs = get_chunk_size(current_chunk); if (!cs) { /* nothing to send for this run */ *len = 0; - return oggbuf; + return inbuf; } if (cs < 0) { /* eof */ *len = 0; return NULL; } *len = cs; - if (!oggbuf || oggbuf_len < *len) { + if (!inbuf || inbuf_size < *len) { PARA_INFO_LOG("increasing ogg buffer size (%d -> %zu)\n", - oggbuf_len, *len); - oggbuf = para_realloc(oggbuf, *len); - oggbuf_len = *len; + inbuf_size, *len); + inbuf = para_realloc(inbuf, *len); + inbuf_size = *len; } - ret = read(fileno(infile), oggbuf, *len); + ret = read(fileno(infile), inbuf, *len); if (!ret) { *len = 0; return NULL; @@ -338,7 +336,7 @@ static char *ogg_read_chunk(long unsigned current_chunk, ssize_t *len) if (ret != *len) PARA_WARNING_LOG("short read (%d/%zd)\n", ret, *len); *len = ret; - return oggbuf; + return inbuf; } static char *ogg_get_header_info(int *len)