]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - mp3_afh.c
kill the read_chunk handler of struct audio_format handler
[paraslash.git] / mp3_afh.c
index 4ed134fa1bc1f62d6be22f747d664adfdc6c5101..691f1f093c302320b8877cf6588fdec246bb6c51 100644 (file)
--- 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,47 +456,12 @@ 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;
 }
 
-static int mp3_reposition_stream(__a_unused long unsigned new_frame)
-{
-       return 1;
-}
-
-static char *mp3_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 void mp3_close_audio_file(void)
 {
        if (!infile)
@@ -518,8 +483,6 @@ void mp3_init(struct audio_format_handler *p)
 {
        af = p;
        af->get_file_info = mp3_get_file_info;
-       af->reposition_stream = mp3_reposition_stream;
-       af->read_chunk = mp3_read_chunk;
        af->close_audio_file = mp3_close_audio_file;
        af->get_header_info = NULL;
        /* eof_tv gets overwritten in mp3_get_file_info() */