make get_file_info() return the chunk table
authorAndre Noll <maan@systemlinux.org>
Sun, 4 Mar 2007 21:08:04 +0000 (22:08 +0100)
committerAndre Noll <maan@systemlinux.org>
Sun, 4 Mar 2007 21:08:04 +0000 (22:08 +0100)
This is a preparation for the moving the read_chunk handler to
the vss layer.

aac_afh.c
afh.h
mp3_afh.c
ogg_afh.c
vss.c

index e5ee2eef9520ea57631a6b6f112434de87ffee29..b017a83231bc010ed19536c80c916523ef321458 100644 (file)
--- a/aac_afh.c
+++ b/aac_afh.c
@@ -136,7 +136,7 @@ static long unsigned aac_set_chunk_tv(mp4AudioSpecificConfig *mp4ASC)
  * Init m4a file and write some tech data to given pointers.
  */
 static int aac_get_file_info(FILE *file, char *info_str, long unsigned *frames,
  * Init m4a file and write some tech data to given pointers.
  */
 static int aac_get_file_info(FILE *file, char *info_str, long unsigned *frames,
-       int *seconds)
+       int *seconds, size_t **vss_chunk_table)
 {
        int i, ret, decoder_len;
        size_t skip;
 {
        int i, ret, decoder_len;
        size_t skip;
@@ -172,6 +172,7 @@ static int aac_get_file_info(FILE *file, char *info_str, long unsigned *frames,
                return ret;
        *frames = num_chunks;
        *seconds = aac_set_chunk_tv(&mp4ASC);
                return ret;
        *frames = num_chunks;
        *seconds = aac_set_chunk_tv(&mp4ASC);
+       *vss_chunk_table = chunk_table;
        for (;;) {
                ret = aac_find_entry_point(inbuf, inbuf_len, &skip);
                if (ret >= 0)
        for (;;) {
                ret = aac_find_entry_point(inbuf, inbuf_len, &skip);
                if (ret >= 0)
diff --git a/afh.h b/afh.h
index 0ead11e0e997879a6e4ed98cc05770871cb3917f..35b7a70e4dff72220f4550f4fbecc6dffdc48710 100644 (file)
--- a/afh.h
+++ b/afh.h
@@ -90,10 +90,11 @@ struct audio_format_handler {
         * this audio format. A negative return value indicates that this audio format
         * handler did not recognize the given file. On success, the function is
         * expected to return a positive value and to fill in \arg info_str, \arg
         * this audio format. A negative return value indicates that this audio format
         * handler did not recognize the given file. On success, the function is
         * expected to return a positive value and to fill in \arg info_str, \arg
-        * chunks and \arg seconds appropriately.
+        * chunks and \arg seconds appropriately and to return the chunk table
+        * via \a vss_chunk_table.
        */
        int (*get_file_info)(FILE *audio_file, char *info_str,
        */
        int (*get_file_info)(FILE *audio_file, char *info_str,
-               long unsigned *chunks, int *seconds);
+               long unsigned *chunks, int *seconds, size_t **vss_chunk_table);
        /**
         * cleanup function of this audio format handler
         *
        /**
         * cleanup function of this audio format handler
         *
index 6850cbd83b8f8bee770aafb43a4ee984af5d7956..398a334e0f51668e2a8acfc11b5f68e7051352bb 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,
  * 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;
 
 {
        int ret;
 
@@ -456,6 +456,7 @@ static int mp3_get_file_info(FILE *audio_file, char *info_str,
        write_info_str(info_str);
        *frames = num_chunks;
        *seconds = mp3.seconds;
        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;
        if (*seconds < 2 || !*frames)
                return -E_MP3_INFO;
        return 1;
index b5ecc4b0f3ebc96ec5459d3e7a7e59c3ce5326f9..483c8365d0cc437757023e725b5a8a8d294d4953 100644 (file)
--- a/ogg_afh.c
+++ b/ogg_afh.c
@@ -222,7 +222,7 @@ static int ogg_save_header(FILE *file, int len)
  * Init oggvorbis file and write some tech data to given pointers.
  */
 static int ogg_get_file_info(FILE *file, char *info_str, long unsigned *frames,
  * Init oggvorbis file and write some tech data to given pointers.
  */
 static int ogg_get_file_info(FILE *file, char *info_str, long unsigned *frames,
-       int *seconds)
+       int *seconds, size_t **vss_chunk_table)
 {
        int ret;
        double time_total;
 {
        int ret;
        double time_total;
@@ -259,6 +259,7 @@ static int ogg_get_file_info(FILE *file, char *info_str, long unsigned *frames,
        vi_channels = vi->channels;
        ogg_compute_chunk_table(time_total);
        *frames = num_chunks;
        vi_channels = vi->channels;
        ogg_compute_chunk_table(time_total);
        *frames = num_chunks;
+       *vss_chunk_table = chunk_table;
        sprintf(info_str, "audio_file_info1:%zu x %lu, %ldkHz, %d channels, %ldkbps\n"
                "audio_file_info2: \n"
                "audio_file_info3: \n",
        sprintf(info_str, "audio_file_info1:%zu x %lu, %ldkHz, %d channels, %ldkbps\n"
                "audio_file_info2: \n"
                "audio_file_info3: \n",
diff --git a/vss.c b/vss.c
index 1983b8e5212fca40c99dd5c2963faee5c4e9d5fc..ea647254e497ac9ffa7eb3963a6a11759719d67b 100644 (file)
--- a/vss.c
+++ b/vss.c
@@ -42,6 +42,7 @@ static struct timeval autoplay_barrier;
 extern struct misc_meta_data *mmd;
 extern struct audio_file_selector selectors[];
 extern struct sender senders[];
 extern struct misc_meta_data *mmd;
 extern struct audio_file_selector selectors[];
 extern struct sender senders[];
+static size_t *chunk_table;
 
 static FILE *audio_file = NULL;
 
 
 static FILE *audio_file = NULL;
 
@@ -86,6 +87,8 @@ static struct audio_format_handler afl[] = {
 /** iterate over each supported audio format */
 #define FOR_EACH_AUDIO_FORMAT(i) for (i = 0; afl[i].name; i++)
 
 /** iterate over each supported audio format */
 #define FOR_EACH_AUDIO_FORMAT(i) for (i = 0; afl[i].name; i++)
 
+
+
 /**
  * check if vss status flag \a P (playing) is set
  *
 /**
  * check if vss status flag \a P (playing) is set
  *
@@ -182,7 +185,7 @@ void vss_init(void)
 static int get_file_info(int i)
 {
        return  afl[i].get_file_info(audio_file, mmd->audio_file_info,
 static int get_file_info(int i)
 {
        return  afl[i].get_file_info(audio_file, mmd->audio_file_info,
-               &mmd->chunks_total, &mmd->seconds_total);
+               &mmd->chunks_total, &mmd->seconds_total, &chunk_table);
 }
 
 /**
 }
 
 /**