]> git.sesse.net Git - vlc/blobdiff - modules/demux/asf/libasf.h
demux: asf: flush remaining tail data (fix #5356)
[vlc] / modules / demux / asf / libasf.h
index 63ca23009e5729e97b44eb7fbd5adc37f6b4bd5c..5271fecd40bf9035585fde1e95eb65200205a35e 100644 (file)
 /*****************************************************************************
  * libasf.h :
  *****************************************************************************
- * Copyright (C) 2001-2003 the VideoLAN team
- * $Id$
+ * Copyright © 2001-2004, 2011 VLC authors and VideoLAN
+ *
  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
  *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
  * (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
  *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
 
 /*****************************************************************************
  * Structure needed for decoder
  *****************************************************************************/
-typedef struct guid_s
-{
-    uint32_t v1; /* le */
-    uint16_t v2; /* le */
-    uint16_t v3; /* le */
-    uint8_t  v4[8];
-} guid_t;
-
-enum
-{
-    ASF_OBJECT_NULL = 0,
-    ASF_OBJECT_ROOT,
-    ASF_OBJECT_HEADER,
-    ASF_OBJECT_DATA,
-    ASF_OBJECT_INDEX,
-    ASF_OBJECT_FILE_PROPERTIES,
-    ASF_OBJECT_STREAM_PROPERTIES,
-    ASF_OBJECT_HEADER_EXTENSION,
-    ASF_OBJECT_CODEC_LIST,
-    ASF_OBJECT_MARKER,
-    ASF_OBJECT_CONTENT_DESCRIPTION,
-    ASF_OBJECT_METADATA,
-    ASF_OBJECT_PADDING,
-    ASF_OBJECT_OTHER,
-};
-
-static const guid_t asf_object_null_guid =
-{
-    0x00000000,
-    0x0000,
-    0x0000,
-    { 0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00 }
-};
-
-static const guid_t asf_object_header_guid =
-{0x75B22630, 0x668E, 0x11CF, {0xA6, 0xD9, 0x00, 0xAA, 0x00, 0x62, 0xCE, 0x6C}};
-
-static const guid_t asf_object_data_guid =
-{0x75B22636, 0x668E, 0x11CF, {0xA6, 0xD9, 0x00, 0xAA, 0x00, 0x62, 0xCE, 0x6C}};
-
-static const guid_t asf_object_index_guid =
-{0x33000890, 0xE5B1, 0x11CF, {0x89, 0xF4, 0x00, 0xA0, 0xC9, 0x03, 0x49, 0xCB}};
-
-static const guid_t asf_object_file_properties_guid =
-{0x8cabdca1, 0xa947, 0x11cf, {0x8e, 0xe4, 0x00, 0xC0, 0x0C, 0x20, 0x53, 0x65}};
-
-static const guid_t asf_object_stream_properties_guid =
-{0xB7DC0791, 0xA9B7, 0x11CF, {0x8E, 0xE6, 0x00, 0xC0, 0x0C, 0x20, 0x53, 0x65}};
-
-static const guid_t asf_object_content_description_guid =
-{0x75B22633, 0x668E, 0x11CF, {0xa6, 0xd9, 0x00, 0xaa, 0x00, 0x62, 0xce, 0x6c}};
-
-static const guid_t asf_object_header_extension_guid =
-{0x5FBF03B5, 0xA92E, 0x11CF, {0x8E, 0xE3, 0x00, 0xC0, 0x0C, 0x20, 0x53, 0x65}};
-
-static const guid_t asf_object_metadata_guid =
-{0xC5F8CBEA, 0x5BAF, 0x4877, {0x84, 0x67, 0xAA, 0x8C, 0x44, 0xFA, 0x4C, 0xCA}};
-
-static const guid_t asf_object_codec_list_guid =
-{0x86D15240, 0x311D, 0x11D0, {0xA3, 0xA4, 0x00, 0xA0, 0xC9, 0x03, 0x48, 0xF6}};
-
-static const guid_t asf_object_marker_guid =
-{0xF487CD01, 0xA951, 0x11CF, {0x8E, 0xE6, 0x00, 0xC0, 0x0C, 0x20, 0x53, 0x65}};
-
-static const guid_t asf_object_stream_type_audio =
-{0xF8699E40, 0x5B4D, 0x11CF, {0xA8, 0xFD, 0x00, 0x80, 0x5F, 0x5C, 0x44, 0x2B}};
-
-static const guid_t asf_object_stream_type_video =
-{0xbc19efc0, 0x5B4D, 0x11CF, {0xA8, 0xFD, 0x00, 0x80, 0x5F, 0x5C, 0x44, 0x2B}};
-
-static const guid_t asf_object_stream_type_command =
-{0x59DACFC0, 0x59E6, 0x11D0, {0xA3, 0xAC, 0x00, 0xA0, 0xC9, 0x03, 0x48, 0xF6}};
 
-/* TODO */
-static const guid_t asf_object_stream_bitrate_properties =
-{0x7BF875CE, 0x468D, 0x11D1, {0x8D, 0x82, 0x00, 0x60, 0x97, 0xC9, 0xA2, 0xB2}};
-
-static const guid_t asf_object_language_list =
-{0x7C4346A9, 0xEFE0, 0x4BFC, {0xB2, 0x29, 0x39, 0x3E, 0xDE, 0x41, 0x5C, 0x85}};
-
-static const guid_t asf_object_extended_stream_properties =
-{0x14E6A5CB, 0xC672, 0x4332, {0x83, 0x99, 0xA9, 0x69, 0x52, 0x06, 0x5B, 0x5A}};
-
-static const guid_t asf_object_advanced_mutual_exclusion =
-{0xA08649CF, 0x4775, 0x4670, {0x8A, 0x16, 0x6E, 0x35, 0x35, 0x75, 0x66, 0xCD}};
-
-static const guid_t asf_object_padding =
-{0x1806D474, 0xCADF, 0x4509, {0xA4, 0xBA, 0x9A, 0xAB, 0xCB, 0x96, 0xAA, 0xE8}};
-
-static const guid_t asf_object_stream_prioritization =
-{0xD4FED15B, 0x88D3, 0x454F, {0x81, 0xF0, 0xED, 0x5C, 0x45, 0x99, 0x9E, 0x24}};
-
-static const guid_t asf_object_extended_content_description =
-{0xD2D0A440, 0xE307, 0x11D2, {0x97, 0xF0, 0x00, 0xA0, 0xC9, 0x5E, 0xA8, 0x50}};
+#include "libasf_guid.h"
 
 #define ASF_OBJECT_COMMON          \
     int          i_type;           \
@@ -145,8 +53,8 @@ typedef struct
 /****************************************************************************
  * High level asf object
  ****************************************************************************/
-/* This is the first header find in a asf file
- * It's the only object that have subobject */
+/* This is the first header found in an asf file
+ * It's the only object that has subobjects */
 typedef struct
 {
     ASF_OBJECT_COMMON
@@ -231,12 +139,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
 {
@@ -264,23 +174,16 @@ typedef struct
     ASF_OBJECT_COMMON
 
     char *psz_title;
-    char *psz_author;
+    char *psz_artist;
     char *psz_copyright;
     char *psz_description;
     char *psz_rating;
 
 } asf_object_content_description_t;
 
-typedef struct
-{
-    uint16_t i_length;
-    uint16_t *i_char;
-
-} string16_t;
-
 #define ASF_CODEC_TYPE_VIDEO    0x0001
 #define ASF_CODEC_TYPE_AUDIO    0x0002
-#define ASF_CODEC_TYPE_UNKNOW   0xffff
+#define ASF_CODEC_TYPE_UNKNOWN  0xffff
 
 typedef struct
 {
@@ -309,7 +212,7 @@ typedef struct
     uint32_t     i_send_time;
     uint32_t     i_flags;
     uint32_t     i_marker_description_length;
-    uint8_t      *i_marker_description;
+    char         *p_marker_description;
 
 } asf_marker_t;
 
@@ -319,7 +222,7 @@ typedef struct
     guid_t      i_reserved1;
     uint32_t    i_count;
     uint16_t    i_reserved2;
-    string16_t name;
+    char        *name;
     asf_marker_t *marker;
 
 } asf_object_marker_t;
@@ -372,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;
 
@@ -391,6 +302,15 @@ typedef struct
     int *pi_priority_stream_number;
 } asf_object_stream_prioritization_t;
 
+typedef struct
+{
+    ASF_OBJECT_COMMON
+
+    asf_exclusion_type_t exclusion_type;
+    uint16_t i_stream_number_count;
+    uint16_t *pi_stream_numbers;
+} asf_object_bitrate_mutual_exclusion_t;
+
 typedef struct
 {
     ASF_OBJECT_COMMON
@@ -436,21 +356,20 @@ typedef union asf_object_u
     asf_object_metadata_t           metadata;
     asf_object_codec_list_t         codec_list;
     asf_object_marker_t             marker;
-    asf_object_language_list_t      lang;
+    asf_object_language_list_t      language_list;
     asf_object_stream_bitrate_properties_t stream_bitrate;
     asf_object_extended_stream_properties_t ext_stream;
+    asf_object_content_description_t content_description;
+    asf_object_advanced_mutual_exclusion_t advanced_mutual_exclusion;
+    asf_object_stream_prioritization_t stream_prioritization;
+    asf_object_bitrate_mutual_exclusion_t bitrate_mutual_exclusion;
+    asf_object_extended_content_description_t extended_content_description;
 
 } asf_object_t;
 
-
-void ASF_GetGUID( guid_t *p_guid, uint8_t *p_data );
-int  ASF_CmpGUID( const guid_t *p_guid1, const guid_t *p_guid2 );
-
 asf_object_root_t *ASF_ReadObjectRoot( stream_t *, int b_seekable );
 void               ASF_FreeObjectRoot( stream_t *, asf_object_root_t *p_root );
 
-#define ASF_CountObject( a, b ) __ASF_CountObject( (asf_object_t*)(a), b )
-int  __ASF_CountObject ( asf_object_t *p_obj, const guid_t *p_guid );
+int ASF_CountObject ( void *p_obj, const guid_t *p_guid );
 
-#define ASF_FindObject( a, b, c )  __ASF_FindObject( (asf_object_t*)(a), b, c )
-void *__ASF_FindObject( asf_object_t *p_obj, const guid_t *p_guid, int i_number );
+void *ASF_FindObject( void *p_obj, const guid_t *p_guid, int i_number );