[vlc-commits] demux: asf: don't store exclusion guid types as is

Francois Cartegnie git at videolan.org
Sat Nov 23 10:25:04 CET 2013


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Sat Nov 23 08:29:43 2013 +0100| [8c36b8a07c42dd6026bed8391b37b66b12f74ad9] | committer: Francois Cartegnie

demux: asf: don't store exclusion guid types as is

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=8c36b8a07c42dd6026bed8391b37b66b12f74ad9
---

 modules/demux/asf/libasf.c |   21 +++++++++++----------
 modules/demux/asf/libasf.h |   10 +++++++++-
 2 files changed, 20 insertions(+), 11 deletions(-)

diff --git a/modules/demux/asf/libasf.c b/modules/demux/asf/libasf.c
index 9170e20..d0d5a10 100644
--- a/modules/demux/asf/libasf.c
+++ b/modules/demux/asf/libasf.c
@@ -976,16 +976,14 @@ static int ASF_ReadObject_advanced_mutual_exclusion( stream_t *s,
 
     p_data = &p_peek[24];
 
-    ASF_GetGUID( &p_ae->type, &p_data[0] );
+    if( !ASF_HAVE( 16 + 2 * sizeof(uint16_t) ) ) /* at least one entry */
+        return VLC_EGENERIC;
+
+    if ( guidcmp( (const guid_t *) p_data, &asf_guid_mutex_language ) )
+        p_ae->exclusion_type = LANGUAGE;
+    else if ( guidcmp( (const guid_t *) p_data, &asf_guid_mutex_bitrate ) )
+        p_ae->exclusion_type = BITRATE;
     ASF_SKIP( 16 );
-#ifdef ASF_DEBUG
-    if( guidcmp( &p_ae->type, &asf_guid_mutex_language ) )
-        msg_Dbg( s, "Language exclusion" );
-    else if( guidcmp( &p_ae->type, &asf_guid_mutex_bitrate ) )
-        msg_Dbg( s, "Bitrate exclusion" );
-    else
-        msg_Warn(s, "Unknown exclusion type" );
-#endif
 
     p_ae->i_stream_number_count = ASF_READ2();
     p_ae->pi_stream_number = calloc( p_ae->i_stream_number_count, sizeof(int) );
@@ -999,7 +997,10 @@ static int ASF_ReadObject_advanced_mutual_exclusion( stream_t *s,
     p_ae->i_stream_number_count = i;
 
 #ifdef ASF_DEBUG
-    msg_Dbg( s, "read \"advanced mutual exclusion object\"" );
+    msg_Dbg( s, "read \"advanced mutual exclusion object\" type %s",
+             p_ae->exclusion_type == LANGUAGE ? "Language" :
+             ( p_ae->exclusion_type == BITRATE ) ? "Bitrate" : "Unknown"
+    );
     for( i = 0; i < p_ae->i_stream_number_count; i++ )
         msg_Dbg( s, "  - stream=%d", p_ae->pi_stream_number[i] );
 #endif
diff --git a/modules/demux/asf/libasf.h b/modules/demux/asf/libasf.h
index 33c99fe..30103a0 100644
--- a/modules/demux/asf/libasf.h
+++ b/modules/demux/asf/libasf.h
@@ -275,11 +275,19 @@ typedef struct
     asf_object_stream_properties_t *p_sp;
 } asf_object_extended_stream_properties_t;
 
+#define ASF_MAX_EXCLUSION_TYPE 2
+typedef enum
+{
+    LANGUAGE = ASF_MAX_EXCLUSION_TYPE,
+    BITRATE = 1,
+    UNKNOWN = 0
+} asf_exclusion_type_t;
+
 typedef struct
 {
     ASF_OBJECT_COMMON
 
-    guid_t  type;
+    asf_exclusion_type_t exclusion_type;
     int16_t i_stream_number_count;
     int16_t *pi_stream_number;
 



More information about the vlc-commits mailing list