]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - mp3_afh.c
mysql_selector.c: mark mysql_macro_list[] const
[paraslash.git] / mp3_afh.c
index 4eaad087f1405d3b7ee85d8ec4121c0cac15bf21..7146124803e6c13420e404df919090cb4f556940 100644 (file)
--- a/mp3_afh.c
+++ b/mp3_afh.c
@@ -46,7 +46,6 @@
 
 #define FRAME_HEADER_SIZE 4
 #define MIN_FRAME_SIZE 21
-#define DEFAULT_INBUF_SIZE 8192
 
 struct mp3header {
        unsigned long sync;
@@ -71,7 +70,6 @@ struct id3tag {
 };
 
 struct mp3info {
-       char *filename;
        struct mp3header header;
        int id3_isvalid;
        struct id3tag id3;
@@ -82,13 +80,13 @@ struct mp3info {
 };
 
 /** \endcond */
-static int frequencies[3][4] = {
+static const int frequencies[3][4] = {
        {22050,24000,16000,50000}, /* MPEG 2.0 */
        {44100,48000,32000,50000}, /* MPEG 1.0 */
        {11025,12000,8000,50000} /* MPEG 2.5 */
 };
 
-static int mp3info_bitrate[2][3][14] = {
+static const int mp3info_bitrate[2][3][14] = {
 { /* MPEG 2.0 */
        {32,48,56,64,80,96,112,128,144,160,176,192,224,256}, /* layer 1 */
        {8,16,24,32,40,48,56,64,80,96,112,128,144,160}, /* layer 2 */
@@ -102,13 +100,11 @@ static int mp3info_bitrate[2][3][14] = {
 }
 };
 
-static int frame_size_index[] = {24000, 72000, 72000};
+static const int frame_size_index[] = {24000, 72000, 72000};
 static const char *mode_text[] = {"stereo", "joint stereo", "dual channel", "mono", "invalid"};
 
 static FILE *infile;
 static struct mp3info mp3;
-static char *inbuf;
-static size_t inbuf_size;
 static struct audio_format_handler *af;
 static ssize_t *chunk_table, num_chunks;
 
@@ -194,8 +190,7 @@ static int compare_headers(struct mp3header *h1,struct mp3header *h2)
                        (h1->original == h2->original) &&
                        (h1->emphasis == h2->emphasis))
                return 1;
-       else
-               return 0;
+       return 0;
 }
 
 /**
@@ -367,8 +362,6 @@ static int mp3_read_info(void)
        unsigned chunk_table_size = 1000; /* gets increased on demand */
 
        num_chunks = 0;
-       inbuf = para_malloc(DEFAULT_INBUF_SIZE);
-       inbuf_size = DEFAULT_INBUF_SIZE;
        chunk_table = para_malloc(chunk_table_size * sizeof(size_t));
        ret = mp3_get_id3();
        if (ret < 0)
@@ -443,7 +436,6 @@ static int mp3_read_info(void)
 err_out:
        PARA_ERROR_LOG("%s\n", PARA_STRERROR(-ret));
        free(chunk_table);
-       free(inbuf);
        return ret;
 }
 
@@ -479,7 +471,6 @@ static void mp3_close_audio_file(void)
        fclose(infile);
        infile = NULL;
        free(chunk_table);
-       free(inbuf);
 }
 
 static const char* mp3_suffixes[] = {"mp3", NULL};