struct audio_format_handler: use proper pointer type for the init function
[paraslash.git] / ogg.c
diff --git a/ogg.c b/ogg.c
index d3ebd465730b66ac2ec071e4af851dc47301b4d2..6bdb2306f6c0fb29147d8b63673e804060c2b3cd 100644 (file)
--- a/ogg.c
+++ b/ogg.c
@@ -35,8 +35,8 @@ static OggVorbis_File *oggvorbis_file;
 static FILE *infile;
 static int header_len, oggbuf_len, vi_channels;
 static char *header, *oggbuf;
-static ogg_int64_t *chunk_table, max_chunk_len;
-struct audio_format *af;
+static ssize_t *chunk_table, max_chunk_len;
+struct audio_format_handler *af;
 static long vi_sampling_rate, vi_bitrate, vi_bitrate_nominal,
        num_chunks;
 
@@ -152,7 +152,7 @@ static void tunetable(void)
 static void ogg_compute_chunk_table(double time_total)
 {
        int i, ret, num;
-       ogg_int64_t pos = 0, min = 0, old_pos;
+       ssize_t pos = 0, min = 0, old_pos;
 
        old_pos = 0;
        ret = 0;
@@ -170,19 +170,19 @@ static void ogg_compute_chunk_table(double time_total)
                        break;
                pos = ov_raw_tell(oggvorbis_file);
                diff = pos - old_pos;
-               max_chunk_len = MAX(max_chunk_len, diff);
-               min = (i == 1)? diff : MIN(min, diff);
+               max_chunk_len = PARA_MAX(max_chunk_len, diff);
+               min = (i == 1)? diff : PARA_MIN(min, diff);
                chunk_table[i] = pos;
                if (i < 11 || !((i - 1) % 1000)|| i > num - 11)
-                       PARA_DEBUG_LOG("chunk #%d: %g secs, pos: %lli, "
-                               "size: %lli\n", i - 1,
+                       PARA_DEBUG_LOG("chunk #%d: %g secs, pos: %zd, "
+                               "size: %zd\n", i - 1,
                                i * chunk_time, pos, pos - old_pos);
                old_pos = pos;
        }
        num_chunks = i - 1;
        chunk_table[i] = pos;
        tunetable();
-       PARA_INFO_LOG("%li chunks (%fs), max chunk: %lli, min chunk: %lli\n",
+       PARA_INFO_LOG("%li chunks (%fs), max chunk: %zd, min chunk: %zd\n",
                num_chunks, chunk_time, max_chunk_len, min);
        rewind(infile);
 }
@@ -319,7 +319,7 @@ char *ogg_read_chunk(long unsigned current_chunk, ssize_t *len)
        }
        *len = cs;
        if (!oggbuf || oggbuf_len < *len) {
-               PARA_INFO_LOG("increasing ogg buffer size (%d -> %u)\n",
+               PARA_INFO_LOG("increasing ogg buffer size (%d -> %zu)\n",
                        oggbuf_len, *len);
                oggbuf = para_realloc(oggbuf, *len);
                oggbuf_len = *len;
@@ -334,7 +334,7 @@ char *ogg_read_chunk(long unsigned current_chunk, ssize_t *len)
                return NULL;
        }
        if (ret != *len)
-               PARA_WARNING_LOG("short read (%d/%d)\n", ret, *len);
+               PARA_WARNING_LOG("short read (%d/%zd)\n", ret, *len);
        *len = ret;
        return oggbuf;
 }
@@ -345,7 +345,8 @@ static char *ogg_get_header_info(int *len)
        return header;
 }
 
-void ogg_init(void *p)
+static const char* ogg_suffixes[] = {"ogg", NULL};
+void ogg_init(struct audio_format_handler *p)
 {
        af = p;
        af->reposition_stream = ogg_reposition_stream;
@@ -356,4 +357,5 @@ void ogg_init(void *p)
        af->chunk_tv.tv_sec = 0;
        af->chunk_tv.tv_usec = 250 * 1000;
        tv_scale(3, &af->chunk_tv, &af->eof_tv);
+       af->suffixes = ogg_suffixes;
 }