Commit d896f8e8 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Define GUID only once, in vlc_codecs.h

parent 56fcd2ca
......@@ -43,6 +43,8 @@ typedef struct _GUID
} GUID, *REFGUID, *LPGUID;
#endif /* GUID_DEFINED */
typedef GUID guid_t;
#ifdef HAVE_ATTRIBUTE_PACKED
# define ATTR_PACKED __attribute__((__packed__))
#elif defined(__SUNPRO_C)
......
......@@ -27,6 +27,7 @@
#include <vlc_common.h>
#include <vlc_rand.h>
#include <vlc_codecs.h>
#include "asf.h"
#include "buffer.h"
......@@ -59,7 +60,7 @@ void asf_HeaderParse ( asf_header_t *hdr,
var_buffer_initread( &buffer, p_header, i_header );
var_buffer_getguid( &buffer, &guid );
if( !CmpGUID( &guid, &asf_object_header_guid ) )
if( !guidcmp( &guid, &asf_object_header_guid ) )
{
/* ERROR: */
}
......@@ -70,7 +71,7 @@ void asf_HeaderParse ( asf_header_t *hdr,
var_buffer_getguid( &buffer, &guid );
i_size = var_buffer_get64( &buffer );
if( CmpGUID( &guid, &asf_object_file_properties_guid ) )
if( guidcmp( &guid, &asf_object_file_properties_guid ) )
{
var_buffer_getmemory( &buffer, NULL, 16 );
hdr->i_file_size = var_buffer_get64( &buffer );
......@@ -81,12 +82,12 @@ void asf_HeaderParse ( asf_header_t *hdr,
var_buffer_getmemory( &buffer, NULL, i_size - 24 - 16 - 8 - 8 - 8 - 8-8-8-4 - 4);
}
else if( CmpGUID( &guid, &asf_object_header_extension_guid ) )
else if( guidcmp( &guid, &asf_object_header_extension_guid ) )
{
/* Enter it */
var_buffer_getmemory( &buffer, NULL, 46 - 24 );
}
else if( CmpGUID( &guid, &asf_object_extended_stream_properties_guid ) )
else if( guidcmp( &guid, &asf_object_extended_stream_properties_guid ) )
{
/* Grrrrrr */
int16_t i_count1, i_count2;
......@@ -126,7 +127,7 @@ void asf_HeaderParse ( asf_header_t *hdr,
/* It's a hack we just skip the first part of the object until
* the embed stream properties if any (ugly, but whose fault ?) */
}
else if( CmpGUID( &guid, &asf_object_stream_properties_guid ) )
else if( guidcmp( &guid, &asf_object_stream_properties_guid ) )
{
int i_stream_id;
guid_t stream_type;
......@@ -137,11 +138,11 @@ void asf_HeaderParse ( asf_header_t *hdr,
i_stream_id = var_buffer_get8( &buffer ) & 0x7f;
var_buffer_getmemory( &buffer, NULL, i_size - 24 - 32 - 16 - 1);
if( CmpGUID( &stream_type, &asf_object_stream_type_video ) )
if( guidcmp( &stream_type, &asf_object_stream_type_video ) )
{
hdr->stream[i_stream_id].i_cat = ASF_STREAM_VIDEO;
}
else if( CmpGUID( &stream_type, &asf_object_stream_type_audio ) )
else if( guidcmp( &stream_type, &asf_object_stream_type_audio ) )
{
hdr->stream[i_stream_id].i_cat = ASF_STREAM_AUDIO;
}
......@@ -150,7 +151,7 @@ void asf_HeaderParse ( asf_header_t *hdr,
hdr->stream[i_stream_id].i_cat = ASF_STREAM_UNKNOWN;
}
}
else if ( CmpGUID( &guid, &asf_object_stream_bitrate_properties ) )
else if ( guidcmp( &guid, &asf_object_stream_bitrate_properties ) )
{
int i_count;
uint8_t i_stream_id;
......
......@@ -121,7 +121,7 @@ static int Open( vlc_object_t * p_this )
if( stream_Peek( p_demux->s, &p_peek, 16 ) < 16 ) return VLC_EGENERIC;
ASF_GetGUID( &guid, p_peek );
if( !CmpGUID( &guid, &asf_object_header_guid ) ) return VLC_EGENERIC;
if( !guidcmp( &guid, &asf_object_header_guid ) ) return VLC_EGENERIC;
/* Set p_demux fields */
p_demux->pf_demux = Demux;
......@@ -167,7 +167,7 @@ static int Demux( demux_t *p_demux )
guid_t guid;
ASF_GetGUID( &guid, p_peek );
if( CmpGUID( &guid, &asf_object_header_guid ) )
if( guidcmp( &guid, &asf_object_header_guid ) )
{
msg_Warn( p_demux, "found a new ASF header" );
/* We end this stream */
......@@ -826,7 +826,7 @@ static int DemuxInit( demux_t *p_demux )
es_format_t fmt;
if( CmpGUID( &p_sp->i_stream_type, &asf_object_stream_type_audio ) &&
if( guidcmp( &p_sp->i_stream_type, &asf_object_stream_type_audio ) &&
p_sp->i_type_specific_data_length >= sizeof( WAVEFORMATEX ) - 2 )
{
uint8_t *p_data = p_sp->p_type_specific_data;
......@@ -856,7 +856,7 @@ static int DemuxInit( demux_t *p_demux )
msg_Dbg( p_demux, "added new audio stream(codec:0x%x,ID:%d)",
GetWLE( p_data ), p_sp->i_stream_number );
}
else if( CmpGUID( &p_sp->i_stream_type,
else if( guidcmp( &p_sp->i_stream_type,
&asf_object_stream_type_video ) &&
p_sp->i_type_specific_data_length >= 11 +
sizeof( BITMAPINFOHEADER ) )
......@@ -931,7 +931,7 @@ static int DemuxInit( demux_t *p_demux )
msg_Dbg( p_demux, "added new video stream(ID:%d)",
p_sp->i_stream_number );
}
else if( CmpGUID( &p_sp->i_stream_type, &asf_object_extended_stream_header ) &&
else if( guidcmp( &p_sp->i_stream_type, &asf_object_extended_stream_header ) &&
p_sp->i_type_specific_data_length >= 64 )
{
/* Now follows a 64 byte header of which we don't know much */
......@@ -940,7 +940,7 @@ static int DemuxInit( demux_t *p_demux )
unsigned int i_data = p_sp->i_type_specific_data_length - 64;
msg_Dbg( p_demux, "Ext stream header detected. datasize = %d", p_sp->i_type_specific_data_length );
if( CmpGUID( p_ref, &asf_object_extended_stream_type_audio ) &&
if( guidcmp( p_ref, &asf_object_extended_stream_type_audio ) &&
i_data >= sizeof( WAVEFORMATEX ) - 2)
{
int i_format;
......
......@@ -1289,9 +1289,9 @@ static int ASF_ReadObject( stream_t *s, asf_object_t *p_obj,
/* find this object */
for( i_index = 0; ; i_index++ )
{
if( CmpGUID( ASF_Object_Function[i_index].p_id,
if( guidcmp( ASF_Object_Function[i_index].p_id,
&p_obj->common.i_object_id ) ||
CmpGUID( ASF_Object_Function[i_index].p_id,
guidcmp( ASF_Object_Function[i_index].p_id,
&asf_object_null_guid ) )
{
break;
......@@ -1350,9 +1350,9 @@ static void ASF_FreeObject( stream_t *s, asf_object_t *p_obj )
/* find this object */
for( i_index = 0; ; i_index++ )
{
if( CmpGUID( ASF_Object_Function[i_index].p_id,
if( guidcmp( ASF_Object_Function[i_index].p_id,
&p_obj->common.i_object_id )||
CmpGUID( ASF_Object_Function[i_index].p_id,
guidcmp( ASF_Object_Function[i_index].p_id,
&asf_object_null_guid ) )
{
break;
......@@ -1423,7 +1423,7 @@ static void ASF_ObjectDumpDebug( vlc_object_t *p_obj,
/* Find the name */
for( i = 0; ASF_ObjectDumpDebugInfo[i].p_id != NULL; i++ )
{
if( CmpGUID( ASF_ObjectDumpDebugInfo[i].p_id,
if( guidcmp( ASF_ObjectDumpDebugInfo[i].p_id,
&p_node->i_object_id ) )
break;
}
......@@ -1596,7 +1596,7 @@ int __ASF_CountObject( asf_object_t *p_obj, const guid_t *p_guid )
p_child = p_obj->common.p_first;
while( p_child )
{
if( CmpGUID( &p_child->common.i_object_id, p_guid ) )
if( guidcmp( &p_child->common.i_object_id, p_guid ) )
i_count++;
p_child = p_child->common.p_next;
......@@ -1613,7 +1613,7 @@ void *__ASF_FindObject( asf_object_t *p_obj, const guid_t *p_guid,
while( p_child )
{
if( CmpGUID( &p_child->common.i_object_id, p_guid ) )
if( guidcmp( &p_child->common.i_object_id, p_guid ) )
{
if( i_number == 0 )
return p_child;
......
......@@ -23,17 +23,11 @@
#ifndef LIBASG_GUID_H
#define LIBASG_GUID_H
#include <vlc_codecs.h>
/*****************************************************************************
* Structure needed for decoder
*****************************************************************************/
typedef struct guid_s
{
uint32_t Data1; /* le */
uint16_t Data2; /* le */
uint16_t Data3; /* le */
uint8_t Data4[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).Data1, \
......@@ -232,16 +226,4 @@ static inline void ASF_GetGUID( guid_t *p_guid, const uint8_t *p_data )
memcpy( p_guid->Data4, p_data + 8, 8 );
}
static inline bool CmpGUID( const guid_t *p_guid1, const guid_t *p_guid2 )
{
if( (p_guid1->Data1 != p_guid2->Data1 )||
(p_guid1->Data2 != p_guid2->Data2 )||
(p_guid1->Data3 != p_guid2->Data3 )||
( memcmp( p_guid1->Data4, p_guid2->Data4, 8 )) )
{
return false;
}
return true;
}
#endif
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