split afs.h
[paraslash.git] / ogg.c
diff --git a/ogg.c b/ogg.c
index b38a8f4979a6dfccf4578f314b4914536546b05a..3445970bd867acfbcd7ad52a1df1a58edd9bf691 100644 (file)
--- a/ogg.c
+++ b/ogg.c
@@ -24,6 +24,7 @@
 #include "server.cmdline.h"
 #include "server.h"
 #include "afs.h"
 #include "server.cmdline.h"
 #include "server.h"
 #include "afs.h"
+#include "afh.h"
 #include "error.h"
 #include "string.h"
 
 #include "error.h"
 #include "string.h"
 
@@ -36,7 +37,7 @@ static FILE *infile;
 static int header_len, oggbuf_len, vi_channels;
 static char *header, *oggbuf;
 static ssize_t *chunk_table, max_chunk_len;
 static int header_len, oggbuf_len, vi_channels;
 static char *header, *oggbuf;
 static ssize_t *chunk_table, max_chunk_len;
-struct audio_format *af;
+struct audio_format_handler *af;
 static long vi_sampling_rate, vi_bitrate, vi_bitrate_nominal,
        num_chunks;
 
 static long vi_sampling_rate, vi_bitrate, vi_bitrate_nominal,
        num_chunks;
 
@@ -46,7 +47,7 @@ static int ogg_compute_header_len(void)
        unsigned int serial;
        char *buf;
        ogg_page page;
        unsigned int serial;
        char *buf;
        ogg_page page;
-        ogg_packet packet;
+       ogg_packet packet;
        vorbis_comment vc;
        vorbis_info vi;
        ogg_stream_state *stream_in = para_malloc(sizeof(ogg_stream_state));
        vorbis_comment vc;
        vorbis_info vi;
        ogg_stream_state *stream_in = para_malloc(sizeof(ogg_stream_state));
@@ -170,8 +171,8 @@ static void ogg_compute_chunk_table(double time_total)
                        break;
                pos = ov_raw_tell(oggvorbis_file);
                diff = pos - old_pos;
                        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: %zd, "
                chunk_table[i] = pos;
                if (i < 11 || !((i - 1) % 1000)|| i > num - 11)
                        PARA_DEBUG_LOG("chunk #%d: %g secs, pos: %zd, "
@@ -345,7 +346,8 @@ static char *ogg_get_header_info(int *len)
        return header;
 }
 
        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;
 {
        af = p;
        af->reposition_stream = ogg_reposition_stream;
@@ -356,4 +358,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->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;
 }
 }