changeset 16031:c2e78215f0d9

Ultravox improvements according to specs (didn't know they existed *g*)
author reimar
date Wed, 20 Jul 2005 17:12:33 +0000
parents b7c6b22576dd
children c5a629a2f33c
files libmpdemux/http.c
diffstat 1 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/http.c	Wed Jul 20 15:11:16 2005 +0000
+++ b/libmpdemux/http.c	Wed Jul 20 17:12:33 2005 +0000
@@ -74,17 +74,20 @@
       my_read(fd, info, 6, sc);
     else
       my_read(fd, &info[1], 5, sc);
-    if (info[0] != 0x5a || info[1] != 0x00) {
+    // sync byte and reserved flags
+    if (info[0] != 0x5a || (info[1] & 0xfc) != 0x00) {
       mp_msg(MSGT_DEMUXER, MSGL_ERR, "Invalid or unknown uvox metadata\n");
       return 0;
     }
+    if (info[1] & 0x01)
+      mp_msg(MSGT_DEMUXER, MSGL_WARN, "Encrypted ultravox data\n");
     metaint = info[4] << 8 | info[5];
-    if (info[3] == 0x02) {
+    if ((info[3] & 0xf) < 0x07) { // discard any metadata nonsense
       char *metabuf = malloc(metaint);
       my_read(fd, metabuf, metaint, sc);
       free(metabuf);
     }
-  } while (info[3] == 0x02);
+  } while ((info[3] & 0xf) < 0x07);
   return metaint;
 }