Commit 6c84da28 authored by Gildas Bazin's avatar Gildas Bazin

* commit modules/demux/asf/*: load and parse the metadata object + coding style changes.

parent 55cab795
This diff is collapsed.
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* libasf.h : * libasf.h :
***************************************************************************** *****************************************************************************
* Copyright (C) 2001-2003 VideoLAN * Copyright (C) 2001-2003 VideoLAN
* $Id: libasf.h,v 1.8 2004/01/25 20:05:28 hartman Exp $ * $Id$
* Authors: Laurent Aimar <fenrir@via.ecp.fr> * Authors: Laurent Aimar <fenrir@via.ecp.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
...@@ -39,10 +39,11 @@ typedef struct guid_s ...@@ -39,10 +39,11 @@ typedef struct guid_s
#define ASF_OBJECT_TYPE_INDEX 0x0004 #define ASF_OBJECT_TYPE_INDEX 0x0004
#define ASF_OBJECT_TYPE_FILE_PROPERTIES 0x0005 #define ASF_OBJECT_TYPE_FILE_PROPERTIES 0x0005
#define ASF_OBJECT_TYPE_STREAM_PROPERTIES 0x0006 #define ASF_OBJECT_TYPE_STREAM_PROPERTIES 0x0006
#define ASF_OBJECT_TYPE_EXTENTION_HEADER 0x0007 #define ASF_OBJECT_TYPE_HEADER_EXTENSION 0x0007
#define ASF_OBJECT_TYPE_CODEC_LIST 0x0008 #define ASF_OBJECT_TYPE_CODEC_LIST 0x0008
#define ASF_OBJECT_TYPE_MARKER 0x0009 #define ASF_OBJECT_TYPE_MARKER 0x0009
#define ASF_OBJECT_TYPE_CONTENT_DESCRIPTION 0x000a #define ASF_OBJECT_TYPE_CONTENT_DESCRIPTION 0x000a
#define ASF_OBJECT_TYPE_METADATA 0x000b
static const guid_t asf_object_null_guid = static const guid_t asf_object_null_guid =
{ {
...@@ -53,110 +54,49 @@ static const guid_t asf_object_null_guid = ...@@ -53,110 +54,49 @@ static const guid_t asf_object_null_guid =
}; };
static const guid_t asf_object_header_guid = static const guid_t asf_object_header_guid =
{ {0x75B22630, 0x668E, 0x11CF, {0xA6, 0xD9, 0x00, 0xAA, 0x00, 0x62, 0xCE, 0x6C}};
0x75B22630,
0x668E,
0x11CF,
{ 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, 0x11CF, {0xA6, 0xD9, 0x00, 0xAA, 0x00, 0x62, 0xCE, 0x6C}};
0x75B22636,
0x668E,
0x11CF,
{ 0xA6,0xD9, 0x00,0xAA,0x00,0x62,0xCE,0x6C }
};
static const guid_t asf_object_index_guid = static const guid_t asf_object_index_guid =
{ {0x33000890, 0xE5B1, 0x11CF, {0x89, 0xF4, 0x00, 0xA0, 0xC9, 0x03, 0x49, 0xCB}};
0x33000890,
0xE5B1,
0x11CF,
{ 0x89,0xF4, 0x00,0xA0,0xC9,0x03,0x49,0xCB }
};
static const guid_t asf_object_file_properties_guid = static const guid_t asf_object_file_properties_guid =
{ {0x8cabdca1, 0xa947, 0x11cf, {0x8e, 0xe4, 0x00, 0xC0, 0x0C, 0x20, 0x53, 0x65}};
0x8cabdca1,
0xa947,
0x11cf,
{ 0x8e,0xe4, 0x00,0xC0,0x0C,0x20,0x53,0x65 }
};
static const guid_t asf_object_stream_properties_guid = static const guid_t asf_object_stream_properties_guid =
{ {0xB7DC0791, 0xA9B7, 0x11CF, {0x8E, 0xE6, 0x00, 0xC0, 0x0C, 0x20, 0x53, 0x65}};
0xB7DC0791,
0xA9B7,
0x11CF,
{ 0x8E,0xE6, 0x00,0xC0,0x0C,0x20,0x53,0x65 }
};
static const guid_t asf_object_content_description_guid = static const guid_t asf_object_content_description_guid =
{ {0x75B22633, 0x668E, 0x11CF, {0xa6, 0xd9, 0x00, 0xaa, 0x00, 0x62, 0xce, 0x6c}};
0x75B22633,
0x668E,
0x11CF,
{ 0xa6, 0xd9, 0x00, 0xaa, 0x00, 0x62, 0xce, 0x6c }
};
static const guid_t asf_object_header_extention_guid = static const guid_t asf_object_header_extension_guid =
{ {0x5FBF03B5, 0xA92E, 0x11CF, {0x8E, 0xE3, 0x00, 0xC0, 0x0C, 0x20, 0x53, 0x65}};
0x5FBF03B5,
0xA92E, static const guid_t asf_object_metadata_guid =
0x11CF, {0xC5F8CBEA, 0x5BAF, 0x4877, {0x84, 0x67, 0xAA, 0x8C, 0x44, 0xFA, 0x4C, 0xCA}};
{ 0x8E,0xE3, 0x00,0xC0,0x0C,0x20,0x53,0x65 }
};
static const guid_t asf_object_codec_list_guid = static const guid_t asf_object_codec_list_guid =
{ {0x86D15240, 0x311D, 0x11D0, {0xA3, 0xA4, 0x00, 0xA0, 0xC9, 0x03, 0x48, 0xF6}};
0x86D15240,
0x311D,
0x11D0,
{ 0xA3,0xA4, 0x00,0xA0,0xC9,0x03,0x48,0xF6 }
};
static const guid_t asf_object_marker_guid = static const guid_t asf_object_marker_guid =
{ {0xF487CD01, 0xA951, 0x11CF, {0x8E, 0xE6, 0x00, 0xC0, 0x0C, 0x20, 0x53, 0x65}};
0xF487CD01,
0xA951,
0x11CF,
{ 0x8E,0xE6, 0x00,0xC0,0x0C,0x20,0x53,0x65 }
};
static const guid_t asf_object_stream_type_audio = static const guid_t asf_object_stream_type_audio =
{ {0xF8699E40, 0x5B4D, 0x11CF, {0xA8, 0xFD, 0x00, 0x80, 0x5F, 0x5C, 0x44, 0x2B}};
0xF8699E40,
0x5B4D,
0x11CF,
{ 0xA8,0xFD, 0x00,0x80,0x5F,0x5C,0x44,0x2B }
};
static const guid_t asf_object_stream_type_video = static const guid_t asf_object_stream_type_video =
{ {0xbc19efc0, 0x5B4D, 0x11CF, {0xA8, 0xFD, 0x00, 0x80, 0x5F, 0x5C, 0x44, 0x2B}};
0xbc19efc0,
0x5B4D,
0x11CF,
{ 0xA8,0xFD, 0x00,0x80,0x5F,0x5C,0x44,0x2B }
};
static const guid_t asf_object_stream_type_command = static const guid_t asf_object_stream_type_command =
{ {0x59DACFC0, 0x59E6, 0x11D0, {0xA3, 0xAC, 0x00, 0xA0, 0xC9, 0x03, 0x48, 0xF6}};
0x59DACFC0,
0x59E6,
0x11D0,
{ 0xA3,0xAC, 0x00,0xA0,0xC9,0x03,0x48,0xF6 }
};
#define ASF_OBJECT_COMMON \ #define ASF_OBJECT_COMMON \
int i_type; \ int i_type; \
guid_t i_object_id; \ guid_t i_object_id; \
uint64_t i_object_size; \ uint64_t i_object_size; \
uint64_t i_object_pos; \ uint64_t i_object_pos; \
union asf_object_u *p_father; \ union asf_object_u *p_father; \
union asf_object_u *p_first; \ union asf_object_u *p_first; \
union asf_object_u *p_last; \ union asf_object_u *p_last; \
...@@ -253,16 +193,44 @@ typedef struct asf_object_stream_properties_s ...@@ -253,16 +193,44 @@ typedef struct asf_object_stream_properties_s
uint8_t *p_error_correction_data; uint8_t *p_error_correction_data;
} asf_object_stream_properties_t; } asf_object_stream_properties_t;
typedef struct asf_object_header_extention_s typedef struct asf_object_header_extension_s
{ {
ASF_OBJECT_COMMON ASF_OBJECT_COMMON
guid_t i_reserved1; guid_t i_reserved1;
uint16_t i_reserved2; uint16_t i_reserved2;
uint32_t i_header_extention_size; uint32_t i_header_extension_size;
uint8_t *p_header_extention_data; uint8_t *p_header_extension_data;
} 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
typedef struct asf_metadata_record_s
{
uint16_t i_stream;
uint16_t i_type;
char *psz_name;
} asf_object_header_extention_t; int64_t i_val;
int i_data;
uint8_t *p_data;
} asf_metadata_record_t;
typedef struct asf_object_metadata_s
{
ASF_OBJECT_COMMON
uint32_t i_record_entries_count;
asf_metadata_record_t *record;
} asf_object_metadata_t;
typedef struct asf_objec_content_description_s typedef struct asf_objec_content_description_s
{ {
...@@ -280,6 +248,7 @@ typedef struct string16_s ...@@ -280,6 +248,7 @@ typedef struct string16_s
{ {
uint16_t i_length; uint16_t i_length;
uint16_t *i_char; uint16_t *i_char;
} string16_t; } string16_t;
#define ASF_CODEC_TYPE_VIDEO 0x0001 #define ASF_CODEC_TYPE_VIDEO 0x0001
...@@ -339,10 +308,14 @@ typedef struct asf_object_root_s ...@@ -339,10 +308,14 @@ typedef struct asf_object_root_s
asf_object_data_t *p_data; asf_object_data_t *p_data;
/* could be NULL if !b_seekable or not-present */ /* could be NULL if !b_seekable or not-present */
asf_object_index_t *p_index; asf_object_index_t *p_index;
asf_object_header_extension_t *p_hdr_ext;
/* from asf_object_header_t */ /* from asf_object_header_t */
asf_object_file_properties_t *p_fp; asf_object_file_properties_t *p_fp;
/* from asf_object_header_extension_t */
asf_object_metadata_t *p_metadata;
} asf_object_root_t; } asf_object_root_t;
/**************************************************************************** /****************************************************************************
...@@ -357,23 +330,22 @@ typedef union asf_object_u ...@@ -357,23 +330,22 @@ typedef union asf_object_u
asf_object_root_t root; asf_object_root_t root;
asf_object_file_properties_t file_properties; asf_object_file_properties_t file_properties;
asf_object_stream_properties_t stream_properties; asf_object_stream_properties_t stream_properties;
asf_object_header_extention_t header_extention; asf_object_header_extension_t header_extension;
asf_object_metadata_t metadata;
asf_object_codec_list_t codec_list; asf_object_codec_list_t codec_list;
asf_object_marker_t marker; asf_object_marker_t marker;
} asf_object_t; } asf_object_t;
void ASF_GetGUID( guid_t *p_guid, uint8_t *p_data );
void ASF_GetGUID ( guid_t *p_guid, uint8_t *p_data ); int ASF_CmpGUID( const guid_t *p_guid1, const guid_t *p_guid2 );
int ASF_CmpGUID ( const guid_t *p_guid1, const guid_t *p_guid2 );
asf_object_root_t *ASF_ReadObjectRoot( stream_t *, int b_seekable ); asf_object_root_t *ASF_ReadObjectRoot( stream_t *, int b_seekable );
void ASF_FreeObjectRoot ( stream_t *, asf_object_root_t *p_root ); void ASF_FreeObjectRoot( stream_t *, asf_object_root_t *p_root );
#define ASF_CountObject( a, b ) __ASF_CountObject( (asf_object_t*)(a), b ) #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 ) #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 );
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment