]> git.sesse.net Git - vlc/blobdiff - modules/demux/asf/libasf.h
* Stringreview !!!
[vlc] / modules / demux / asf / libasf.h
index a68c81f26ad214aad0dfe6654c74c31e0d2befcc..6277c4a59c0f21353963ac696466afab12126e4c 100644 (file)
@@ -1,15 +1,15 @@
 /*****************************************************************************
- * libasf.h : 
+ * libasf.h :
  *****************************************************************************
- * Copyright (C) 2001 VideoLAN
- * $Id: libasf.h,v 1.2 2002/10/21 09:18:37 fenrir Exp $
+ * Copyright (C) 2001-2003 VideoLAN
+ * $Id: libasf.h,v 1.8 2004/01/25 20:05:28 hartman Exp $
  * 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
  * (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
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
  *****************************************************************************/
 
+
 /*****************************************************************************
  * Structure needed for decoder
  *****************************************************************************/
-typedef struct bitmapinfoheader_s
-{
-    u32 i_size; /* size of header 40 + size of data follwoing this header */
-    u32 i_width;
-    u32 i_height;
-    u16 i_planes;
-    u16 i_bitcount;
-    u32 i_compression;
-    u32 i_sizeimage;
-    u32 i_xpelspermeter;
-    u32 i_ypelspermeter;
-    u32 i_clrused;
-    u32 i_clrimportant;
-} bitmapinfoheader_t;
-
-typedef struct waveformatex_s
-{
-    u16 i_format;
-    u16 i_channels;
-    u32 i_samplepersec;
-    u32 i_avgbytespersec;
-    u16 i_blockalign;
-    u16 i_bitspersample;
-    u16 i_size;          /* This give size of data 
-                            imediatly following this header. */
-} waveformatex_t;
-
 typedef struct guid_s
 {
-    u32 v1; /* le */
-    u16 v2; /* le */
-    u16 v3; /* le */
-    u8  v4[8];
+    uint32_t v1; /* le */
+    uint16_t v2; /* le */
+    uint16_t v3; /* le */
+    uint8_t  v4[8];
 } guid_t;
 
 #define ASF_OBJECT_TYPE_NULL      0x0000
@@ -78,7 +52,7 @@ static const guid_t asf_object_null_guid =
     { 0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00 }
 };
 
-static const guid_t asf_object_header_guid = 
+static const guid_t asf_object_header_guid =
 {
     0x75B22630,
     0x668E,
@@ -86,7 +60,7 @@ static const guid_t asf_object_header_guid =
     { 0xA6,0xD9, 0x00,0xAA,0x00,0x62,0xCE,0x6C }
 };
 
-static const guid_t asf_object_data_guid = 
+static const guid_t asf_object_data_guid =
 {
     0x75B22636,
     0x668E,
@@ -129,12 +103,12 @@ static const guid_t asf_object_content_description_guid =
     { 0xa6, 0xd9, 0x00, 0xaa, 0x00, 0x62, 0xce, 0x6c }
 };
 
-static const guid_t asf_object_header_extention_guid = 
+static const guid_t asf_object_header_extention_guid =
 {
    0x5FBF03B5,
    0xA92E,
    0x11CF,
-   { 0x8E,0xE3, 0x00,0xC0,0x0C,0x20,0x53,0x65 } 
+   { 0x8E,0xE3, 0x00,0xC0,0x0C,0x20,0x53,0x65 }
 };
 
 static const guid_t asf_object_codec_list_guid =
@@ -178,29 +152,11 @@ static const guid_t asf_object_stream_type_command =
     { 0xA3,0xAC, 0x00,0xA0,0xC9,0x03,0x48,0xF6 }
 };
 
-#if 0
-static const guid_t asf_object_
-{
-
-
-};
-#endif
-#if 0
-typedef struct asf_packet_s
-{
-    int i_stream_number;
-
-    int i_payload_size;
-    u8  *p_payload_data;
-    
-} asf_packet_t;
-#endif
-
 #define ASF_OBJECT_COMMON           \
     int          i_type;            \
     guid_t       i_object_id;       \
-    u64          i_object_size;     \
-    u64          i_object_pos;      \
+    uint64_t     i_object_size;     \
+    uint64_t     i_object_pos;      \
     union asf_object_u *p_father;  \
     union asf_object_u *p_first;   \
     union asf_object_u *p_last;    \
@@ -214,57 +170,47 @@ typedef struct asf_object_common_s
 
 typedef struct asf_index_entry_s
 {
-    u32 i_packet_number;
-    u16 i_packet_count;
+    uint32_t i_packet_number;
+    uint16_t i_packet_count;
 
 } asf_index_entry_t;
 
 /****************************************************************************
- * High level asf object 
+ * High level asf object
  ****************************************************************************/
 /* This is the first header find in a asf file
  * It's the only object that have subobject */
 typedef struct asf_object_header_s
 {
     ASF_OBJECT_COMMON
-    u32 i_sub_object_count;
-    u8  i_reserved1; /* 0x01, but could be safely ignored */
-    u8  i_reserved2; /* 0x02, if not must failed to source the contain */
-   
+    uint32_t i_sub_object_count;
+    uint8_t  i_reserved1; /* 0x01, but could be safely ignored */
+    uint8_t  i_reserved2; /* 0x02, if not must failed to source the contain */
+
 } asf_object_header_t;
 
 typedef struct asf_object_data_s
 {
     ASF_OBJECT_COMMON
-    guid_t  i_file_id;
-    u64     i_total_data_packets;
-    u16     i_reserved;
-    
+    guid_t      i_file_id;
+    uint64_t    i_total_data_packets;
+    uint16_t    i_reserved;
+
 } asf_object_data_t;
 
 
 typedef struct asf_object_index_s
 {
     ASF_OBJECT_COMMON
-    guid_t  i_file_id;
-    u64     i_index_entry_time_interval;
-    u32     i_max_packet_count;
-    u32     i_index_entry_count;
-    
+    guid_t      i_file_id;
+    uint64_t    i_index_entry_time_interval;
+    uint32_t    i_max_packet_count;
+    uint32_t    i_index_entry_count;
+
     asf_index_entry_t *index_entry;
 
 } asf_object_index_t;
 
-typedef struct asf_object_root_s
-{
-    ASF_OBJECT_COMMON
-    
-    asf_object_header_t *p_hdr;
-    asf_object_data_t   *p_data;
-    asf_object_index_t  *p_index;
-
-} asf_object_root_t;
-
 /****************************************************************************
  * Sub level asf object
  ****************************************************************************/
@@ -274,19 +220,19 @@ typedef struct asf_object_root_s
 typedef struct asf_object_file_properties_s
 {
     ASF_OBJECT_COMMON
-    
+
     guid_t  i_file_id;
-    u64     i_file_size;
-    u64     i_creation_date;
-    u64     i_data_packets_count;
-    u64     i_play_duration;
-    u64     i_send_duration;
-    u64     i_preroll;
-    u32     i_flags;
-    u32     i_min_data_packet_size;
-    u32     i_max_data_packet_size;
-    u32     i_max_bitrate;
-    
+    uint64_t     i_file_size;
+    uint64_t     i_creation_date;
+    uint64_t     i_data_packets_count;
+    uint64_t     i_play_duration;
+    uint64_t     i_send_duration;
+    uint64_t     i_preroll;
+    uint32_t     i_flags;
+    uint32_t     i_min_data_packet_size;
+    uint32_t     i_max_data_packet_size;
+    uint32_t     i_max_bitrate;
+
 } asf_object_file_properties_t;
 
 #define ASF_STREAM_PROPERTIES_ENCRYPTED 0x8000
@@ -296,25 +242,25 @@ typedef struct asf_object_stream_properties_s
 
     guid_t  i_stream_type;
     guid_t  i_error_correction_type;
-    u64     i_time_offset;
-    u32     i_type_specific_data_length;
-    u32     i_error_correction_data_length;
-    u16     i_flags;
+    uint64_t     i_time_offset;
+    uint32_t     i_type_specific_data_length;
+    uint32_t     i_error_correction_data_length;
+    uint16_t     i_flags;
         /* extrated from flags */
-        u8      i_stream_number;
-    u32     i_reserved;
-    u     *p_type_specific_data;
-    u     *p_error_correction_data;
+        uint8_t i_stream_number;
+    uint32_t    i_reserved;
+    uint8_t     *p_type_specific_data;
+    uint8_t     *p_error_correction_data;
 } asf_object_stream_properties_t;
 
 typedef struct asf_object_header_extention_s
 {
     ASF_OBJECT_COMMON
 
-    guid_t  i_reserved1;
-    u16     i_reserved2;
-    u32     i_header_extention_size;
-    u     *p_header_extention_data;
+    guid_t      i_reserved1;
+    uint16_t    i_reserved2;
+    uint32_t    i_header_extention_size;
+    uint8_t     *p_header_extention_data;
 
 } asf_object_header_extention_t;
 
@@ -332,8 +278,8 @@ typedef struct asf_objec_content_description_s
 
 typedef struct string16_s
 {
-    u16 i_length;
-    u16 *i_char;
+    uint16_t i_length;
+    uint16_t *i_char;
 } string16_t;
 
 #define ASF_CODEC_TYPE_VIDEO    0x0001
@@ -342,63 +288,66 @@ typedef struct string16_s
 
 typedef struct asf_codec_entry_s
 {
-    u16         i_type;
+    uint16_t    i_type;
     char        *psz_name;
     char        *psz_description;
-    
-    u16         i_information_length;
-    u8          *p_information;
+
+    uint16_t    i_information_length;
+    uint8_t     *p_information;
 } asf_codec_entry_t;
 
 typedef struct asf_object_codec_list_s
 {
     ASF_OBJECT_COMMON
-    guid_t  i_reserved;
-    u32     i_codec_entries_count;
-    asf_codec_entry_t *codec; 
+    guid_t      i_reserved;
+    uint32_t    i_codec_entries_count;
+    asf_codec_entry_t *codec;
 
 } asf_object_codec_list_t;
 
-#if 0
-typedef struct asf_object_script_command_s
-{
-    ASF_OBJECT_COMMON
-
-    
-} asf_object_script_command_t;
-#endif
 typedef struct asf_marker_s
 {
-    u64     i_offset;
-    u64     i_presentation_time;
-    u16     i_entry_length;
-    u32     i_send_time;
-    u32     i_flags;
-    u32     i_marker_description_length;
-    u8      *i_marker_description;
-    /* u8 padding */
-            
+    uint64_t     i_offset;
+    uint64_t     i_presentation_time;
+    uint16_t     i_entry_length;
+    uint32_t     i_send_time;
+    uint32_t     i_flags;
+    uint32_t     i_marker_description_length;
+    uint8_t      *i_marker_description;
+
 } asf_marker_t;
 
 typedef struct asf_object_marker_s
 {
     ASF_OBJECT_COMMON
-    guid_t  i_reserved1;
-    u32     i_count;
-    u16     i_reserved2;
+    guid_t      i_reserved1;
+    uint32_t    i_count;
+    uint16_t    i_reserved2;
     string16_t name;
     asf_marker_t *marker;
 
 } asf_object_marker_t;
 
-#if 0
-typedef struct asf_object__s
+/****************************************************************************
+ * Special Root Object
+ ****************************************************************************/
+typedef struct asf_object_root_s
 {
     ASF_OBJECT_COMMON
 
-} asf_object__t;
-#endif
+    asf_object_header_t *p_hdr;
+    asf_object_data_t   *p_data;
+    /* could be NULL if !b_seekable or not-present */
+    asf_object_index_t  *p_index;
 
+    /* from asf_object_header_t */
+    asf_object_file_properties_t *p_fp;
+    
+} asf_object_root_t;
+
+/****************************************************************************
+ * asf_object_t: union of all objects.
+ ****************************************************************************/
 typedef union asf_object_u
 {
     asf_object_common_t common;
@@ -408,42 +357,23 @@ typedef union asf_object_u
     asf_object_root_t   root;
     asf_object_file_properties_t    file_properties;
     asf_object_stream_properties_t  stream_properties;
-    asf_object_header_extention_t   header_extention;   
+    asf_object_header_extention_t   header_extention;
     asf_object_codec_list_t         codec_list;
     asf_object_marker_t             marker;
-    
+
 } asf_object_t;
 
 
-off_t   ASF_TellAbsolute( input_thread_t *p_input );
-int     ASF_SeekAbsolute( input_thread_t *p_input, off_t i_pos);
-int     ASF_ReadData( input_thread_t *p_input, u8 *p_buff, int i_size );
-int     ASF_SkipBytes( input_thread_t *p_input, int i_count );
 
-void GetGUID( guid_t *p_guid, u8 *p_data );
-int  CmpGUID( const guid_t *p_guid1, const guid_t *p_guid2 );
-    
-int  ASF_ReadObjectCommon( input_thread_t *p_input,
-                           asf_object_t *p_obj );
-int  ASF_NextObject( input_thread_t *p_input,
-                     asf_object_t *p_obj );
-int  ASF_GotoObject( input_thread_t *p_input,
-                     asf_object_t *p_obj );
-
-int  ASF_ReadObject( input_thread_t *p_input,
-                     asf_object_t *p_obj,
-                     asf_object_t *p_father );
-void ASF_FreeObject( input_thread_t *p_input,
-                     asf_object_t *p_obj );
-int  ASF_ReadObjectRoot( input_thread_t *p_input,
-                         asf_object_root_t *p_root,
-                         int b_seekable );
-void ASF_FreeObjectRoot( input_thread_t *p_input,
-                         asf_object_root_t *p_root );
+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   ( asf_object_t *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   ( asf_object_t *p_obj, const guid_t *p_guid, int i_number );