]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - aac_afh.c
aac: error cleanup
[paraslash.git] / aac_afh.c
index b7e828f4d7c76287e871fee87dc17023215a80ab..93d3bec8157702b9f769178d4d9c4ed5e81ecd2e 100644 (file)
--- a/aac_afh.c
+++ b/aac_afh.c
  *     along with this program; if not, write to the Free Software
  *     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
  */
-/** \file aac_afh.c para_server's aac audio format handler */
+/*
+ * based in parts on libfaad, Copyright (C) 2003-2005 M. Bakker,
+ * Ahead Software AG
+ */
 
+/** \file aac_afh.c para_server's aac audio format handler */
 
 #include "server.cmdline.h"
 #include "server.h"
@@ -66,11 +70,10 @@ static int aac_find_stsz(unsigned char *buf, unsigned buflen, unsigned *skip)
                return sample_count;
        }
        PARA_WARNING_LOG("stsz not found, buflen: %d\n", buflen);
-       return -E_STCO;
+       return -E_STSZ;
 }
 
-
-static int read_stsz(unsigned skip)
+static int read_chunk_table(unsigned skip)
 {
        int ret, i;
        long unsigned sum = 0;
@@ -109,7 +112,6 @@ static int read_stsz(unsigned skip)
 
 }
 
-
 /*
  * Init m4a file and write some tech data to given pointers.
  */
@@ -151,12 +153,12 @@ static int aac_get_file_info(FILE *file, char *info_str, long unsigned *frames,
        } else
                PARA_WARNING_LOG("no mp4ASC %s\n", "");
 
-       ret = read_stsz(skip);
+       ret = read_chunk_table(skip);
        if (ret < 0)
                return ret;
        *frames = num_chunks;
        for (;;) {
-               ret = aac_find_entry(inbuf, inbuf_len, &skip);
+               ret = aac_find_entry_point(inbuf, inbuf_len, &skip);
                if (ret >= 0)
                        break;
                ret = read(fileno(infile), inbuf, inbuf_size);
@@ -190,7 +192,8 @@ static int aac_get_file_info(FILE *file, char *info_str, long unsigned *frames,
  */
 static int aac_reposition_stream(long unsigned request)
 {
-       return -E_AAC_REPOS;
+       return 1;
+//     return -E_AAC_REPOS;
 }
 
 static __must_check int para_fread(void *ptr, size_t size, size_t nmemb, FILE *stream)
@@ -203,7 +206,7 @@ static __must_check int para_fread(void *ptr, size_t size, size_t nmemb, FILE *s
        return -E_FREAD;
 }
 
-char *aac_read_chunk(long unsigned current_chunk, ssize_t *len)
+static char *aac_read_chunk(long unsigned current_chunk, ssize_t *len)
 {
        int ret;
        size_t pos;