[vlc-commits] ASF: cleaning

Jean-Baptiste Kempf git at videolan.org
Sun Aug 28 02:10:10 CEST 2011


vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Sun Aug 28 00:52:53 2011 +0200| [30e4a13f2934871e0a2fa182c2485fbe1b8b0b0d] | committer: Jean-Baptiste Kempf

ASF: cleaning

Trailing spaces, guid names consistency with MMS module, calloc, enum

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

 modules/demux/asf/asf.c    |   11 +++++------
 modules/demux/asf/libasf.c |   16 ++++------------
 modules/demux/asf/libasf.h |   26 ++++++++++++++++++--------
 3 files changed, 27 insertions(+), 26 deletions(-)

diff --git a/modules/demux/asf/asf.c b/modules/demux/asf/asf.c
index 3f52256..dd091bb 100644
--- a/modules/demux/asf/asf.c
+++ b/modules/demux/asf/asf.c
@@ -53,10 +53,10 @@ static void Close ( vlc_object_t * );
 vlc_module_begin ()
     set_category( CAT_INPUT )
     set_subcategory( SUBCAT_INPUT_DEMUX )
-    set_description( N_("ASF v1.0 demuxer") )
+    set_description( N_("ASF/WMV demuxer") )
     set_capability( "demux", 200 )
     set_callbacks( Open, Close )
-    add_shortcut( "asf" )
+    add_shortcut( "asf", "wmv" )
 vlc_module_end ()
 
 
@@ -126,8 +126,7 @@ static int Open( vlc_object_t * p_this )
     /* Set p_demux fields */
     p_demux->pf_demux = Demux;
     p_demux->pf_control = Control;
-    p_demux->p_sys = p_sys = malloc( sizeof( demux_sys_t ) );
-    memset( p_sys, 0, sizeof( demux_sys_t ) );
+    p_demux->p_sys = p_sys = calloc( 1, sizeof( demux_sys_t ) );
 
     /* Load the headers */
     if( DemuxInit( p_demux ) )
@@ -811,12 +810,12 @@ static int DemuxInit( demux_t *p_demux )
         if( p_hdr_ext )
         {
             int i_ext_stream = ASF_CountObject( p_hdr_ext,
-                                                &asf_object_extended_stream_properties );
+                                                &asf_object_extended_stream_properties_guid );
             for( int i = 0; i < i_ext_stream; i++ )
             {
                 asf_object_t *p_tmp =
                     ASF_FindObject( p_hdr_ext,
-                                    &asf_object_extended_stream_properties, i );
+                                    &asf_object_extended_stream_properties_guid, i );
                 if( p_tmp->ext_stream.i_stream_number == p_sp->i_stream_number )
                 {
                     p_esp = &p_tmp->ext_stream;
diff --git a/modules/demux/asf/libasf.c b/modules/demux/asf/libasf.c
index 02d2081..99167cc 100644
--- a/modules/demux/asf/libasf.c
+++ b/modules/demux/asf/libasf.c
@@ -32,14 +32,6 @@
 
 #define ASF_DEBUG 1
 
-#define GUID_FMT "0x%x-0x%x-0x%x-0x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x"
-#define GUID_PRINT( guid )  \
-    (guid).v1,              \
-    (guid).v2,              \
-    (guid).v3,              \
-    (guid).v4[0],(guid).v4[1],(guid).v4[2],(guid).v4[3],    \
-    (guid).v4[4],(guid).v4[5],(guid).v4[6],(guid).v4[7]
-
 /* Helpers:
  * They ensure that invalid reads will not create problems.
  * They are expansion safe
@@ -1274,7 +1266,7 @@ static const struct
     { &asf_object_stream_bitrate_properties, ASF_OBJECT_OTHER,
       ASF_ReadObject_stream_bitrate_properties,
       ASF_FreeObject_stream_bitrate_properties },
-    { &asf_object_extended_stream_properties, ASF_OBJECT_OTHER,
+    { &asf_object_extended_stream_properties_guid, ASF_OBJECT_OTHER,
       ASF_ReadObject_extended_stream_properties,
       ASF_FreeObject_extended_stream_properties },
     { &asf_object_advanced_mutual_exclusion, ASF_OBJECT_OTHER,
@@ -1435,7 +1427,7 @@ static const struct
     { &asf_object_language_list, "Language List" },
     { &asf_object_stream_bitrate_properties, "Stream Bitrate Properties" },
     { &asf_object_padding, "Padding" },
-    { &asf_object_extended_stream_properties, "Extended Stream Properties" },
+    { &asf_object_extended_stream_properties_guid, "Extended Stream Properties" },
     { &asf_object_advanced_mutual_exclusion, "Advanced Mutual Exclusion" },
     { &asf_object_stream_prioritization, "Stream Prioritization" },
     { &asf_object_extended_content_description, "Extended content description"},
@@ -1568,12 +1560,12 @@ asf_object_root_t *ASF_ReadObjectRoot( stream_t *s, int b_seekable )
                                     &asf_object_metadata_guid, 0 );
                 /* Special case for broken designed file format :( */
                 i_ext_stream = ASF_CountObject( p_hdr_ext,
-                                    &asf_object_extended_stream_properties );
+                                    &asf_object_extended_stream_properties_guid );
                 for( i = 0; i < i_ext_stream; i++ )
                 {
                     asf_object_t *p_esp =
                         ASF_FindObject( p_hdr_ext,
-                                   &asf_object_extended_stream_properties, i );
+                                   &asf_object_extended_stream_properties_guid, i );
                     if( p_esp->ext_stream.p_sp )
                     {
                         asf_object_t *p_sp =
diff --git a/modules/demux/asf/libasf.h b/modules/demux/asf/libasf.h
index efbf56a..ff90b3c 100644
--- a/modules/demux/asf/libasf.h
+++ b/modules/demux/asf/libasf.h
@@ -2,7 +2,7 @@
  * libasf.h :
  *****************************************************************************
  * Copyright © 2001-2004, 2011 the VideoLAN team
- * 
+ *
  * Authors: Laurent Aimar <fenrir at via.ecp.fr>
  *
  * This program is free software; you can redistribute it and/or modify
@@ -32,6 +32,14 @@ typedef struct guid_s
     uint8_t  v4[8];
 } guid_t;
 
+#define GUID_FMT "0x%x-0x%x-0x%x-0x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x"
+#define GUID_PRINT( guid )  \
+    (guid).v1,              \
+    (guid).v2,              \
+    (guid).v3,              \
+    (guid).v4[0],(guid).v4[1],(guid).v4[2],(guid).v4[3],    \
+    (guid).v4[4],(guid).v4[5],(guid).v4[6],(guid).v4[7]
+
 enum
 {
     ASF_OBJECT_NULL = 0,
@@ -150,7 +158,7 @@ static const guid_t asf_object_padding =
 {0x1806D474, 0xCADF, 0x4509, {0xA4, 0xBA, 0x9A, 0xAB, 0xCB, 0x96, 0xAA, 0xE8}};
 
 // header extension
-static const guid_t asf_object_extended_stream_properties =
+static const guid_t asf_object_extended_stream_properties_guid =
 {0x14E6A5CB, 0xC672, 0x4332, {0x83, 0x99, 0xA9, 0x69, 0x52, 0x06, 0x5B, 0x5A}};
 
 static const guid_t asf_object_group_mutual_exclusion_guid =
@@ -300,12 +308,14 @@ typedef struct
 
 } asf_object_header_extension_t;
 
-#define ASF_METADATA_TYPE_STRING 0x0000
-#define ASF_METADATA_TYPE_BYTE   0x0001
-#define ASF_METADATA_TYPE_BOOL   0x0002
-#define ASF_METADATA_TYPE_DWORD  0x0003
-#define ASF_METADATA_TYPE_QWORD  0x0004
-#define ASF_METADATA_TYPE_WORD   0x0005
+enum {
+    ASF_METADATA_TYPE_STRING,
+    ASF_METADATA_TYPE_BYTE,
+    ASF_METADATA_TYPE_BOOL,
+    ASF_METADATA_TYPE_DWORD,
+    ASF_METADATA_TYPE_QWORD,
+    ASF_METADATA_TYPE_WORD,
+};
 
 typedef struct
 {



More information about the vlc-commits mailing list