]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
vss.c: Introduce get_audio_file_info().
authorAndre Noll <maan@systemlinux.org>
Sun, 9 Sep 2007 12:56:41 +0000 (14:56 +0200)
committerAndre Noll <maan@systemlinux.org>
Sun, 9 Sep 2007 12:56:41 +0000 (14:56 +0200)
This is going to be used from within aft's com_add() which ATM only
supports mp3.

chunk_queue.c
vss.c
vss.h

index 0b1e300026c94d60d7d55e6172ed8f338cf0b069..17d70eace1d1ee1c9a4b3ae17bd80c562c1dc212 100644 (file)
@@ -8,6 +8,7 @@
 
 #include "para.h"
 #include "list.h"
 
 #include "para.h"
 #include "list.h"
+#include "afh.h"
 #include "vss.h"
 #include "string.h"
 #include "error.h"
 #include "vss.h"
 #include "string.h"
 #include "error.h"
diff --git a/vss.c b/vss.c
index d0f57aec9a9cda035b58f561af8855a10dacbc05..e0c0b584dbe4819f392d02c1d33076e4751af492 100644 (file)
--- a/vss.c
+++ b/vss.c
@@ -226,6 +226,26 @@ static int get_audio_format(int omit)
        return -E_AUDIO_FORMAT;
 }
 
        return -E_AUDIO_FORMAT;
 }
 
+int get_audio_file_info(const char *path, char *data, size_t size,
+               struct audio_format_info *afhi)
+{
+       int ret, i, format = guess_audio_format(path);
+       if (format >= 0) {
+               ret = afl[format].get_file_info(data, size, afhi);
+               if (ret >= 0)
+                       return ret;
+       }
+       FOR_EACH_AUDIO_FORMAT(i) {
+               if (i == format) /* we already tried this one to no avail */
+                       continue;
+               ret = afl[i].get_file_info(data, size, afhi);
+               if (ret >= 0)
+                       return ret;
+       }
+       return -E_AUDIO_FORMAT;
+
+}
+
 /*
  * upddate shared mem
  */
 /*
  * upddate shared mem
  */
diff --git a/vss.h b/vss.h
index 7d2764dae647e0926d11095499c5a6957d980c2f..3374e94696d419e8f0cbbe0636cefa5c4ffd16ec 100644 (file)
--- a/vss.h
+++ b/vss.h
@@ -16,6 +16,8 @@ unsigned int vss_paused(void);
 char *vss_get_header(size_t *header_len);
 struct timeval *vss_chunk_time(void);
 int guess_audio_format(const char *name);
 char *vss_get_header(size_t *header_len);
 struct timeval *vss_chunk_time(void);
 int guess_audio_format(const char *name);
+int get_audio_file_info(const char *path, char *data, size_t size,
+               struct audio_format_info *afhi);
 const char *supported_audio_formats(void);
 int vss_get_chunk(long unsigned chunk_num, char **buf, size_t *len);
 
 const char *supported_audio_formats(void);
 int vss_get_chunk(long unsigned chunk_num, char **buf, size_t *len);