]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - vss.c
vss.c: Introduce get_audio_file_info().
[paraslash.git] / vss.c
diff --git a/vss.c b/vss.c
index a16b006ffa0527d5d4f4301b1e13122457b1756a..e0c0b584dbe4819f392d02c1d33076e4751af492 100644 (file)
--- a/vss.c
+++ b/vss.c
  * senders.
  */
 
+#include "para.h"
+#include "afh.h"
 #include "server.h"
 #include <sys/mman.h> /* mmap */
 #include <sys/time.h> /* gettimeofday */
 #include "server.cmdline.h"
-#include "afs.h"
+#include "afs_common.h"
 #include "vss.h"
 #include "send.h"
 #include "error.h"
@@ -224,6 +226,26 @@ static int get_audio_format(int omit)
        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
  */
@@ -400,7 +422,7 @@ static void vss_eof(void)
  * treamtment.
  *
  */
-char *vss_get_header(unsigned *header_len)
+char *vss_get_header(size_t *header_len)
 {
        if (mmd->audio_format < 0 || !map || !mmd->afi.header_len)
                return NULL;