Commit 22fca623 authored by Laurent Aimar's avatar Laurent Aimar

* all: A little clean up.

parent b75c3a7a
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* asf.c : ASFv01 file input module for vlc * asf.c : ASFv01 file input module for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* $Id: asf.c,v 1.31 2003/08/17 23:02:52 fenrir Exp $ * $Id: asf.c,v 1.32 2003/08/17 23:42:37 fenrir Exp $
* 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
...@@ -24,37 +24,40 @@ ...@@ -24,37 +24,40 @@
* Preamble * Preamble
*****************************************************************************/ *****************************************************************************/
#include <stdlib.h> /* malloc(), free() */ #include <stdlib.h> /* malloc(), free() */
#include <string.h> /* strdup() */
#include <errno.h>
#include <sys/types.h>
#include <vlc/vlc.h> #include <vlc/vlc.h>
#include <vlc/input.h> #include <vlc/input.h>
#include "codecs.h" /* BITMAPINFOHEADER, WAVEFORMATEX */
#include "libasf.h" #include "libasf.h"
#include "asf.h" #include "asf.h"
/*****************************************************************************
* Local prototypes
*****************************************************************************/
static int Activate ( vlc_object_t * );
static void Deactivate ( vlc_object_t * );
static int Demux ( input_thread_t * );
/***************************************************************************** /*****************************************************************************
* Module descriptor * Module descriptor
*****************************************************************************/ *****************************************************************************/
static int Open ( vlc_object_t * );
static void Close ( vlc_object_t * );
vlc_module_begin(); vlc_module_begin();
set_description( _("ASF v1.0 demuxer (file only)") ); set_description( _("ASF v1.0 demuxer") );
set_capability( "demux", 200 ); set_capability( "demux", 200 );
set_callbacks( Activate, Deactivate ); set_callbacks( Open, Close );
add_shortcut( "asf" ); add_shortcut( "asf" );
vlc_module_end(); vlc_module_end();
/***************************************************************************** /*****************************************************************************
* Activate: check file and initializes ASF structures * Local prototypes
*****************************************************************************/ *****************************************************************************/
static int Activate( vlc_object_t * p_this ) static int Demux ( input_thread_t * );
static mtime_t GetMoviePTS( demux_sys_t * );
static int DemuxPacket( input_thread_t *, vlc_bool_t b_play_audio );
/*****************************************************************************
* Open: check file and initializes ASF structures
*****************************************************************************/
static int Open( vlc_object_t * p_this )
{ {
input_thread_t *p_input = (input_thread_t *)p_this; input_thread_t *p_input = (input_thread_t *)p_this;
uint8_t *p_peek; uint8_t *p_peek;
...@@ -65,95 +68,71 @@ static int Activate( vlc_object_t * p_this ) ...@@ -65,95 +68,71 @@ static int Activate( vlc_object_t * p_this )
vlc_bool_t b_seekable; vlc_bool_t b_seekable;
/* Initialize access plug-in structures. */ input_info_category_t *p_cat;
if( p_input->i_mtu == 0 )
{
/* Improve speed. */
p_input->i_bufsize = INPUT_DEFAULT_BUFSIZE;
}
p_input->pf_demux = Demux;
/* a little test to see if it could be a asf stream */ /* a little test to see if it could be a asf stream */
if( input_Peek( p_input, &p_peek, 16 ) < 16 ) if( input_Peek( p_input, &p_peek, 16 ) < 16 )
{ {
msg_Warn( p_input, "ASF v1.0 plugin discarded (cannot peek)" ); msg_Warn( p_input, "ASF plugin discarded (cannot peek)" );
return( -1 ); return VLC_EGENERIC;
} }
GetGUID( &guid, p_peek ); ASF_GetGUID( &guid, p_peek );
if( !CmpGUID( &guid, &asf_object_header_guid ) ) if( !ASF_CmpGUID( &guid, &asf_object_header_guid ) )
{ {
msg_Warn( p_input, "ASF v1.0 plugin discarded (not a valid file)" ); msg_Warn( p_input, "ASF plugin discarded (not a valid file)" );
return( -1 ); return VLC_EGENERIC;
} }
/* create our structure that will contains all data */ /* Set p_input field */
if( !( p_input->p_demux_data = p_input->pf_demux = Demux;
p_demux = malloc( sizeof( demux_sys_t ) ) ) ) p_input->p_demux_data = p_demux = malloc( sizeof( demux_sys_t ) );
{
msg_Err( p_input, "out of memory" );
return( -1 );
}
memset( p_demux, 0, sizeof( demux_sys_t ) ); memset( p_demux, 0, sizeof( demux_sys_t ) );
p_demux->i_pcr = -1;
p_demux->i_time = -1; p_demux->i_time = -1;
/* Now load all object ( except raw data ) */ /* Now load all object ( except raw data ) */
if( p_input->stream.b_seekable && p_input->stream.i_method == INPUT_METHOD_FILE ) b_seekable = p_input->stream.b_seekable &&
{ p_input->stream.i_method == INPUT_METHOD_FILE;
b_seekable = VLC_TRUE;
}
else
{
b_seekable = VLC_FALSE;
}
if( !ASF_ReadObjectRoot( p_input, &p_demux->root, b_seekable ) ) if( !ASF_ReadObjectRoot( p_input, &p_demux->root, b_seekable ) )
{ {
msg_Warn( p_input, "ASF v1.0 plugin discarded (not a valid file)" ); msg_Warn( p_input, "ASF plugin discarded (not a valid file)" );
free( p_demux ); free( p_demux );
return( -1 ); return VLC_EGENERIC;
} }
/* Check if we have found all mandatory asf object */ /* Check if we have found all mandatory asf object */
if( !p_demux->root.p_hdr || !p_demux->root.p_data ) if( !p_demux->root.p_hdr || !p_demux->root.p_data )
{ {
ASF_FreeObjectRoot( p_input, &p_demux->root ); msg_Warn( p_input, "ASF plugin discarded (not a valid file)" );
free( p_demux ); goto error;
msg_Warn( p_input, "ASF v1.0 plugin discarded (not a valid file)" );
return( -1 );
} }
if( !( p_demux->p_fp = ASF_FindObject( p_demux->root.p_hdr, if( !( p_demux->p_fp = ASF_FindObject( p_demux->root.p_hdr,
&asf_object_file_properties_guid, 0 ) ) ) &asf_object_file_properties_guid, 0 ) ) )
{ {
ASF_FreeObjectRoot( p_input, &p_demux->root ); msg_Warn( p_input,
free( p_demux ); "ASF plugin discarded (missing file_properties object)" );
msg_Warn( p_input, "ASF v1.0 plugin discarded (missing file_properties object)" ); goto error;
return( -1 );
} }
if( p_demux->p_fp->i_min_data_packet_size != p_demux->p_fp->i_max_data_packet_size ) if( p_demux->p_fp->i_min_data_packet_size != p_demux->p_fp->i_max_data_packet_size )
{ {
ASF_FreeObjectRoot( p_input, &p_demux->root ); msg_Warn( p_input,
free( p_demux ); "ASF plugin discarded (invalid file_properties object)" );
msg_Warn( p_input, "ASF v1.0 plugin discarded (invalid file_properties object)" ); goto error;
return( -1 );
} }
p_demux->i_streams = ASF_CountObject( p_demux->root.p_hdr, p_demux->i_streams = ASF_CountObject( p_demux->root.p_hdr,
&asf_object_stream_properties_guid ); &asf_object_stream_properties_guid );
if( !p_demux->i_streams ) if( !p_demux->i_streams )
{ {
ASF_FreeObjectRoot( p_input, &p_demux->root );
free( p_demux );
msg_Warn( p_input, "ASF plugin discarded (cannot find any stream!)" ); msg_Warn( p_input, "ASF plugin discarded (cannot find any stream!)" );
return( -1 ); goto error;
} }
else
{
input_info_category_t *p_cat = input_InfoCategory( p_input, "Asf" );
msg_Dbg( p_input, "found %d streams", p_demux->i_streams ); msg_Dbg( p_input, "found %d streams", p_demux->i_streams );
p_cat = input_InfoCategory( p_input, "Asf" );
input_AddInfo( p_cat, _("Number of streams"), "%d" , p_demux->i_streams ); input_AddInfo( p_cat, _("Number of streams"), "%d" , p_demux->i_streams );
}
/* create one program */ /* create one program */
vlc_mutex_lock( &p_input->stream.stream_lock ); vlc_mutex_lock( &p_input->stream.stream_lock );
...@@ -161,16 +140,16 @@ static int Activate( vlc_object_t * p_this ) ...@@ -161,16 +140,16 @@ static int Activate( vlc_object_t * p_this )
{ {
vlc_mutex_unlock( &p_input->stream.stream_lock ); vlc_mutex_unlock( &p_input->stream.stream_lock );
msg_Err( p_input, "cannot init stream" ); msg_Err( p_input, "cannot init stream" );
return( -1 ); goto error;
} }
if( input_AddProgram( p_input, 0, 0) == NULL ) if( input_AddProgram( p_input, 0, 0) == NULL )
{ {
vlc_mutex_unlock( &p_input->stream.stream_lock ); vlc_mutex_unlock( &p_input->stream.stream_lock );
msg_Err( p_input, "cannot add program" ); msg_Err( p_input, "cannot add program" );
return( -1 ); goto error;
} }
p_input->stream.p_selected_program = p_input->stream.pp_programs[0]; p_input->stream.p_selected_program = p_input->stream.pp_programs[0];
p_input->stream.i_mux_rate = 0 ; /* FIXME */ p_input->stream.i_mux_rate = 0 ; /* updated later */
vlc_mutex_unlock( &p_input->stream.stream_lock ); vlc_mutex_unlock( &p_input->stream.stream_lock );
for( i_stream = 0; i_stream < p_demux->i_streams; i_stream ++ ) for( i_stream = 0; i_stream < p_demux->i_streams; i_stream ++ )
...@@ -178,7 +157,6 @@ static int Activate( vlc_object_t * p_this ) ...@@ -178,7 +157,6 @@ static int Activate( vlc_object_t * p_this )
asf_stream_t *p_stream; asf_stream_t *p_stream;
asf_object_stream_properties_t *p_sp; asf_object_stream_properties_t *p_sp;
char psz_cat[sizeof("Stream ")+10]; char psz_cat[sizeof("Stream ")+10];
input_info_category_t *p_cat;
sprintf( psz_cat, "Stream %d", i_stream ); sprintf( psz_cat, "Stream %d", i_stream );
p_cat = input_InfoCategory( p_input, psz_cat); p_cat = input_InfoCategory( p_input, psz_cat);
...@@ -198,7 +176,7 @@ static int Activate( vlc_object_t * p_this ) ...@@ -198,7 +176,7 @@ static int Activate( vlc_object_t * p_this )
p_stream->p_es = NULL; p_stream->p_es = NULL;
vlc_mutex_unlock( &p_input->stream.stream_lock ); vlc_mutex_unlock( &p_input->stream.stream_lock );
if( CmpGUID( &p_sp->i_stream_type, &asf_object_stream_type_audio ) ) if( ASF_CmpGUID( &p_sp->i_stream_type, &asf_object_stream_type_audio ) )
{ {
int i_codec; int i_codec;
if( p_sp->p_type_specific_data ) if( p_sp->p_type_specific_data )
...@@ -278,7 +256,7 @@ static int Activate( vlc_object_t * p_this ) ...@@ -278,7 +256,7 @@ static int Activate( vlc_object_t * p_this )
} }
} }
else else
if( CmpGUID( &p_sp->i_stream_type, &asf_object_stream_type_video ) ) if( ASF_CmpGUID( &p_sp->i_stream_type, &asf_object_stream_type_video ) )
{ {
p_stream->i_cat = VIDEO_ES; p_stream->i_cat = VIDEO_ES;
p_stream->p_es = input_AddES( p_input, p_stream->p_es = input_AddES( p_input,
...@@ -398,7 +376,6 @@ static int Activate( vlc_object_t * p_this ) ...@@ -398,7 +376,6 @@ static int Activate( vlc_object_t * p_this )
{ {
p_input->stream.i_mux_rate = 0; p_input->stream.i_mux_rate = 0;
} }
} }
else else
{ {
...@@ -406,15 +383,147 @@ static int Activate( vlc_object_t * p_this ) ...@@ -406,15 +383,147 @@ static int Activate( vlc_object_t * p_this )
p_input->stream.i_mux_rate = 0; p_input->stream.i_mux_rate = 0;
} }
p_input->stream.p_selected_program->b_is_ok = 1; p_input->stream.p_selected_program->b_is_ok = 1;
vlc_mutex_unlock( &p_input->stream.stream_lock ); vlc_mutex_unlock( &p_input->stream.stream_lock );
return VLC_SUCCESS;
error:
ASF_FreeObjectRoot( p_input, &p_demux->root );
free( p_demux );
return VLC_EGENERIC;
}
/*****************************************************************************
* Demux: read packet and send them to decoders
*****************************************************************************/
static int Demux( input_thread_t *p_input )
{
demux_sys_t *p_demux = p_input->p_demux_data;
vlc_bool_t b_play_audio;
int i;
vlc_bool_t b_stream;
b_stream = VLC_FALSE;
for( i = 0; i < 128; i++ )
{
if( p_demux->stream[i] &&
p_demux->stream[i]->p_es &&
p_demux->stream[i]->p_es->p_decoder_fifo )
{
b_stream = VLC_TRUE;
}
}
if( !b_stream )
{
msg_Warn( p_input, "no stream selected, exiting..." );
return( 0 ); return( 0 );
}
/* catch seek from user */
if( p_input->stream.p_selected_program->i_synchro_state == SYNCHRO_REINIT )
{
off_t i_offset;
msleep( p_input->i_pts_delay );
i_offset = ASF_TellAbsolute( p_input ) - p_demux->i_data_begin;
if( i_offset < 0 )
{
i_offset = 0;
}
i_offset += p_demux->p_fp->i_min_data_packet_size -
i_offset % p_demux->p_fp->i_min_data_packet_size;
ASF_SeekAbsolute( p_input, p_demux->i_data_begin + i_offset );
p_demux->i_time = -1;
for( i = 0; i < 128 ; i++ )
{
#define p_stream p_demux->stream[i]
if( p_stream )
{
p_stream->i_time = -1;
}
#undef p_stream
}
}
/* Check if we need to send the audio data to decoder */
b_play_audio = !p_input->stream.control.b_mute;
for( ;; )
{
mtime_t i_length;
mtime_t i_time_begin = GetMoviePTS( p_demux );
int i_result;
if( p_input->b_die )
{
break;
}
if( ( i_result = DemuxPacket( p_input, b_play_audio ) ) <= 0 )
{
return i_result;
}
if( i_time_begin == -1 )
{
i_time_begin = GetMoviePTS( p_demux );
}
else
{
i_length = GetMoviePTS( p_demux ) - i_time_begin;
if( i_length < 0 || i_length >= 40 * 1000 )
{
break;
}
}
}
p_demux->i_time = GetMoviePTS( p_demux );
if( p_demux->i_time >= 0 )
{
input_ClockManageRef( p_input,
p_input->stream.p_selected_program,
p_demux->i_time * 9 / 100 );
}
return( 1 );
}
/*****************************************************************************
* Close: frees unused data
*****************************************************************************/
static void Close( vlc_object_t * p_this )
{
input_thread_t *p_input = (input_thread_t *)p_this;
demux_sys_t *p_sys = p_input->p_demux_data;
int i_stream;
msg_Dbg( p_input, "Freeing all memory" );
ASF_FreeObjectRoot( p_input, &p_sys->root );
for( i_stream = 0; i_stream < 128; i_stream++ )
{
#define p_stream p_sys->stream[i_stream]
if( p_stream )
{
if( p_stream->p_pes )
{
input_DeletePES( p_input->p_method_data, p_stream->p_pes );
}
free( p_stream );
}
#undef p_stream
}
free( p_sys );
} }
/*****************************************************************************
*
*****************************************************************************/
static mtime_t GetMoviePTS( demux_sys_t *p_demux ) static mtime_t GetMoviePTS( demux_sys_t *p_demux )
{ {
mtime_t i_time; mtime_t i_time;
...@@ -441,9 +550,6 @@ static mtime_t GetMoviePTS( demux_sys_t *p_demux ) ...@@ -441,9 +550,6 @@ static mtime_t GetMoviePTS( demux_sys_t *p_demux )
return( i_time ); return( i_time );
} }
/*****************************************************************************
* Demux: read packet and send them to decoders
*****************************************************************************/
#define GETVALUE2b( bits, var, def ) \ #define GETVALUE2b( bits, var, def ) \
switch( (bits)&0x03 ) \ switch( (bits)&0x03 ) \
{ \ { \
...@@ -766,133 +872,4 @@ loop_error_recovery: ...@@ -766,133 +872,4 @@ loop_error_recovery:
return( 1 ); return( 1 );
} }
static int Demux( input_thread_t *p_input )
{
demux_sys_t *p_demux = p_input->p_demux_data;
vlc_bool_t b_play_audio;
int i;
vlc_bool_t b_stream;
b_stream = VLC_FALSE;
for( i = 0; i < 128; i++ )
{
if( p_demux->stream[i] &&
p_demux->stream[i]->p_es &&
p_demux->stream[i]->p_es->p_decoder_fifo )
{
b_stream = VLC_TRUE;
}
}
if( !b_stream )
{
msg_Warn( p_input, "no stream selected, exiting..." );
return( 0 );
}
/* catch seek from user */
if( p_input->stream.p_selected_program->i_synchro_state == SYNCHRO_REINIT )
{
off_t i_offset;
msleep( p_input->i_pts_delay );
i_offset = ASF_TellAbsolute( p_input ) - p_demux->i_data_begin;
if( i_offset < 0 )
{
i_offset = 0;
}
/* XXX work only when i_min_data_packet_size == i_max_data_packet_size */
i_offset += p_demux->p_fp->i_min_data_packet_size -
i_offset % p_demux->p_fp->i_min_data_packet_size;
ASF_SeekAbsolute( p_input, p_demux->i_data_begin + i_offset );
p_demux->i_time = -1;
for( i = 0; i < 128 ; i++ )
{
#define p_stream p_demux->stream[i]
if( p_stream )
{
p_stream->i_time = -1;
}
#undef p_stream
}
}
/* Check if we need to send the audio data to decoder */
b_play_audio = !p_input->stream.control.b_mute;
for( ;; )
{
mtime_t i_length;
mtime_t i_time_begin = GetMoviePTS( p_demux );
int i_result;
if( p_input->b_die )
{
break;
}
if( ( i_result = DemuxPacket( p_input, b_play_audio ) ) <= 0 )
{
return i_result;
}
if( i_time_begin == -1 )
{
i_time_begin = GetMoviePTS( p_demux );
}
else
{
i_length = GetMoviePTS( p_demux ) - i_time_begin;
if( i_length < 0 || i_length >= 40 * 1000 )
{
break;
}
}
}
p_demux->i_time = GetMoviePTS( p_demux );
if( p_demux->i_time >= 0 )
{
/* update pcr XXX in mpeg scale so in 90000 unit/s */
p_demux->i_pcr = p_demux->i_time * 9 / 100;
/* first wait for the good time to read next packets */
input_ClockManageRef( p_input,
p_input->stream.p_selected_program,
p_demux->i_pcr );
}
return( 1 );
}
/*****************************************************************************
* MP4End: frees unused data
*****************************************************************************/
static void Deactivate( vlc_object_t * p_this )
{
#define FREE( p ) \
if( p ) { free( p ); }
input_thread_t * p_input = (input_thread_t *)p_this;
demux_sys_t *p_demux = p_input->p_demux_data;
int i_stream;
msg_Dbg( p_input, "Freeing all memory" );
ASF_FreeObjectRoot( p_input, &p_demux->root );
for( i_stream = 0; i_stream < 128; i_stream++ )
{
#define p_stream p_demux->stream[i_stream]
if( p_stream )
{
if( p_stream->p_pes )
{
input_DeletePES( p_input->p_method_data, p_stream->p_pes );
}
free( p_stream );
}
#undef p_stream
}
FREE( p_input->p_demux_data );
#undef FREE
}
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* asf.h : ASFv01 file input module for vlc * asf.h : ASFv01 file input module for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* $Id: asf.h,v 1.3 2003/02/01 01:21:04 fenrir Exp $ * $Id: asf.h,v 1.4 2003/08/17 23:42:37 fenrir Exp $
* 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
...@@ -34,7 +34,6 @@ typedef struct asf_stream_s ...@@ -34,7 +34,6 @@ typedef struct asf_stream_s
struct demux_sys_t struct demux_sys_t
{ {
mtime_t i_pcr; // 1/90000 s
mtime_t i_time; // µs mtime_t i_time; // µs
asf_object_root_t root; asf_object_root_t root;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* libasf.c : * libasf.c :
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* $Id: libasf.c,v 1.13 2003/08/17 23:02:52 fenrir Exp $ * $Id: libasf.c,v 1.14 2003/08/17 23:42:37 fenrir Exp $
* 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
...@@ -21,13 +21,11 @@ ...@@ -21,13 +21,11 @@
*****************************************************************************/ *****************************************************************************/
#include <stdlib.h> /* malloc(), free() */ #include <stdlib.h> /* malloc(), free() */
#include <string.h> /* strdup() */
#include <errno.h>
#include <sys/types.h>
#include <vlc/vlc.h> #include <vlc/vlc.h>
#include <vlc/input.h> #include <vlc/input.h>
#include "codecs.h" /* BITMAPINFOHEADER, WAVEFORMATEX */
#include "libasf.h" #include "libasf.h"
#define ASF_DEBUG 1 #define ASF_DEBUG 1
...@@ -43,7 +41,7 @@ ...@@ -43,7 +41,7 @@
(guid).v4[0],(guid).v4[1],(guid).v4[2],(guid).v4[3], \ (guid).v4[0],(guid).v4[1],(guid).v4[2],(guid).v4[3], \
(guid).v4[4],(guid).v4[5],(guid).v4[6],(guid).v4[7] (guid).v4[4],(guid).v4[5],(guid).v4[6],(guid).v4[7]
void GetGUID( guid_t *p_guid, uint8_t *p_data ) void ASF_GetGUID( guid_t *p_guid, uint8_t *p_data )
{ {
p_guid->v1 = GetDWLE( p_data ); p_guid->v1 = GetDWLE( p_data );
p_guid->v2 = GetWLE( p_data + 4); p_guid->v2 = GetWLE( p_data + 4);
...@@ -51,7 +49,7 @@ void GetGUID( guid_t *p_guid, uint8_t *p_data ) ...@@ -51,7 +49,7 @@ void GetGUID( guid_t *p_guid, uint8_t *p_data )
memcpy( p_guid->v4, p_data + 8, 8 ); memcpy( p_guid->v4, p_data + 8, 8 );
} }
int CmpGUID( const guid_t *p_guid1, const guid_t *p_guid2 ) int ASF_CmpGUID( const guid_t *p_guid1, const guid_t *p_guid2 )
{ {
if( (p_guid1->v1 != p_guid2->v1 )||(p_guid1->v2 != p_guid2->v2 )|| if( (p_guid1->v1 != p_guid2->v1 )||(p_guid1->v2 != p_guid2->v2 )||
(p_guid1->v3 != p_guid2->v3 )|| (p_guid1->v3 != p_guid2->v3 )||
...@@ -184,7 +182,7 @@ int ASF_ReadObjectCommon( input_thread_t *p_input, ...@@ -184,7 +182,7 @@ int ASF_ReadObjectCommon( input_thread_t *p_input,
{ {
return( 0 ); return( 0 );
} }
GetGUID( &p_common->i_object_id, p_peek ); ASF_GetGUID( &p_common->i_object_id, p_peek );
p_common->i_object_size = GetQWLE( p_peek + 16 ); p_common->i_object_size = GetQWLE( p_peek + 16 );
p_common->i_object_pos = ASF_TellAbsolute( p_input ); p_common->i_object_pos = ASF_TellAbsolute( p_input );
p_common->p_next = NULL; p_common->p_next = NULL;
...@@ -300,7 +298,7 @@ int ASF_ReadObject_Data( input_thread_t *p_input, ...@@ -300,7 +298,7 @@ int ASF_ReadObject_Data( input_thread_t *p_input,
{ {
return( 0 ); return( 0 );
} }
GetGUID( &p_data->i_file_id, p_peek + 24 ); ASF_GetGUID( &p_data->i_file_id, p_peek + 24 );
p_data->i_total_data_packets = GetQWLE( p_peek + 40 ); p_data->i_total_data_packets = GetQWLE( p_peek + 40 );
p_data->i_reserved = GetWLE( p_peek + 48 ); p_data->i_reserved = GetWLE( p_peek + 48 );
#ifdef ASF_DEBUG #ifdef ASF_DEBUG
...@@ -325,7 +323,7 @@ int ASF_ReadObject_Index( input_thread_t *p_input, ...@@ -325,7 +323,7 @@ int ASF_ReadObject_Index( input_thread_t *p_input,
{ {
return( 0 ); return( 0 );
} }
GetGUID( &p_index->i_file_id, p_peek + 24 ); ASF_GetGUID( &p_index->i_file_id, p_peek + 24 );
p_index->i_index_entry_time_interval = GetQWLE( p_peek + 40 ); p_index->i_index_entry_time_interval = GetQWLE( p_peek + 40 );
p_index->i_max_packet_count = GetDWLE( p_peek + 48 ); p_index->i_max_packet_count = GetDWLE( p_peek + 48 );
p_index->i_index_entry_count = GetDWLE( p_peek + 52 ); p_index->i_index_entry_count = GetDWLE( p_peek + 52 );
...@@ -362,7 +360,7 @@ int ASF_ReadObject_file_properties( input_thread_t *p_input, ...@@ -362,7 +360,7 @@ int ASF_ReadObject_file_properties( input_thread_t *p_input,
{ {
return( 0 ); return( 0 );
} }
GetGUID( &p_fp->i_file_id, p_peek + 24 ); ASF_GetGUID( &p_fp->i_file_id, p_peek + 24 );
p_fp->i_file_size = GetQWLE( p_peek + 40 ); p_fp->i_file_size = GetQWLE( p_peek + 40 );
p_fp->i_creation_date = GetQWLE( p_peek + 48 ); p_fp->i_creation_date = GetQWLE( p_peek + 48 );
p_fp->i_data_packets_count = GetQWLE( p_peek + 56 ); p_fp->i_data_packets_count = GetQWLE( p_peek + 56 );
...@@ -407,7 +405,7 @@ int ASF_ReadObject_header_extention( input_thread_t *p_input, ...@@ -407,7 +405,7 @@ int ASF_ReadObject_header_extention( input_thread_t *p_input,
{ {
return( 0 ); return( 0 );
} }
GetGUID( &p_he->i_reserved1, p_peek + 24 ); ASF_GetGUID( &p_he->i_reserved1, p_peek + 24 );
p_he->i_reserved2 = GetWLE( p_peek + 40 ); p_he->i_reserved2 = GetWLE( p_peek + 40 );
p_he->i_header_extention_size = GetDWLE( p_peek + 42 ); p_he->i_header_extention_size = GetDWLE( p_peek + 42 );
if( p_he->i_header_extention_size ) if( p_he->i_header_extention_size )
...@@ -450,8 +448,8 @@ int ASF_ReadObject_stream_properties( input_thread_t *p_input, ...@@ -450,8 +448,8 @@ int ASF_ReadObject_stream_properties( input_thread_t *p_input,
{ {
return( 0 ); return( 0 );
} }
GetGUID( &p_sp->i_stream_type, p_peek + 24 ); ASF_GetGUID( &p_sp->i_stream_type, p_peek + 24 );
GetGUID( &p_sp->i_error_correction_type, p_peek + 40 ); ASF_GetGUID( &p_sp->i_error_correction_type, p_peek + 40 );
p_sp->i_time_offset = GetQWLE( p_peek + 56 ); p_sp->i_time_offset = GetQWLE( p_peek + 56 );
p_sp->i_type_specific_data_length = GetDWLE( p_peek + 64 ); p_sp->i_type_specific_data_length = GetDWLE( p_peek + 64 );
p_sp->i_error_correction_data_length = GetDWLE( p_peek + 68 ); p_sp->i_error_correction_data_length = GetDWLE( p_peek + 68 );
...@@ -524,7 +522,7 @@ int ASF_ReadObject_codec_list( input_thread_t *p_input, ...@@ -524,7 +522,7 @@ int ASF_ReadObject_codec_list( input_thread_t *p_input,
return( 0 ); return( 0 );
} }
GetGUID( &p_cl->i_reserved, p_peek + 24 ); ASF_GetGUID( &p_cl->i_reserved, p_peek + 24 );
p_cl->i_codec_entries_count = GetWLE( p_peek + 40 ); p_cl->i_codec_entries_count = GetWLE( p_peek + 40 );
if( p_cl->i_codec_entries_count > 0 ) if( p_cl->i_codec_entries_count > 0 )
{ {
...@@ -757,9 +755,9 @@ int ASF_ReadObject( input_thread_t *p_input, ...@@ -757,9 +755,9 @@ int ASF_ReadObject( input_thread_t *p_input,
/* find this object */ /* find this object */
for( i_index = 0; ; i_index++ ) for( i_index = 0; ; i_index++ )
{ {
if( CmpGUID( ASF_Object_Function[i_index].p_id, if( ASF_CmpGUID( ASF_Object_Function[i_index].p_id,
&p_obj->common.i_object_id )|| &p_obj->common.i_object_id )||
CmpGUID( ASF_Object_Function[i_index].p_id, ASF_CmpGUID( ASF_Object_Function[i_index].p_id,
&asf_object_null_guid ) ) &asf_object_null_guid ) )
{ {
break; break;
...@@ -822,9 +820,9 @@ void ASF_FreeObject( input_thread_t *p_input, ...@@ -822,9 +820,9 @@ void ASF_FreeObject( input_thread_t *p_input,
/* find this object */ /* find this object */
for( i_index = 0; ; i_index++ ) for( i_index = 0; ; i_index++ )
{ {
if( CmpGUID( ASF_Object_Function[i_index].p_id, if( ASF_CmpGUID( ASF_Object_Function[i_index].p_id,
&p_obj->common.i_object_id )|| &p_obj->common.i_object_id )||
CmpGUID( ASF_Object_Function[i_index].p_id, ASF_CmpGUID( ASF_Object_Function[i_index].p_id,
&asf_object_null_guid ) ) &asf_object_null_guid ) )
{ {
break; break;
...@@ -945,7 +943,7 @@ int __ASF_CountObject( asf_object_t *p_obj, const guid_t *p_guid ) ...@@ -945,7 +943,7 @@ int __ASF_CountObject( asf_object_t *p_obj, const guid_t *p_guid )
p_child = p_obj->common.p_first; p_child = p_obj->common.p_first;
while( p_child ) while( p_child )
{ {
if( CmpGUID( &p_child->common.i_object_id, p_guid ) ) if( ASF_CmpGUID( &p_child->common.i_object_id, p_guid ) )
{ {
i_count++; i_count++;
} }
...@@ -962,7 +960,7 @@ void *__ASF_FindObject( asf_object_t *p_obj, const guid_t *p_guid, int i_number ...@@ -962,7 +960,7 @@ void *__ASF_FindObject( asf_object_t *p_obj, const guid_t *p_guid, int i_number
while( p_child ) while( p_child )
{ {
if( CmpGUID( &p_child->common.i_object_id, p_guid ) ) if( ASF_CmpGUID( &p_child->common.i_object_id, p_guid ) )
{ {
if( i_number == 0 ) if( i_number == 0 )
{ {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* libasf.h : * libasf.h :
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* $Id: libasf.h,v 1.5 2002/12/06 16:34:06 sam Exp $ * $Id: libasf.h,v 1.6 2003/08/17 23:42:37 fenrir Exp $
* 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
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/ *****************************************************************************/
#include "codecs.h" /* BITMAPINFOHEADER, WAVEFORMATEX */
/***************************************************************************** /*****************************************************************************
* Structure needed for decoder * Structure needed for decoder
...@@ -153,24 +152,6 @@ static const guid_t asf_object_stream_type_command = ...@@ -153,24 +152,6 @@ static const guid_t asf_object_stream_type_command =
{ 0xA3,0xAC, 0x00,0xA0,0xC9,0x03,0x48,0xF6 } { 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 \ #define ASF_OBJECT_COMMON \
int i_type; \ int i_type; \
guid_t i_object_id; \ guid_t i_object_id; \
...@@ -334,14 +315,6 @@ typedef struct asf_object_codec_list_s ...@@ -334,14 +315,6 @@ typedef struct asf_object_codec_list_s
} asf_object_codec_list_t; } 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 typedef struct asf_marker_s
{ {
uint64_t i_offset; uint64_t i_offset;
...@@ -351,7 +324,6 @@ typedef struct asf_marker_s ...@@ -351,7 +324,6 @@ typedef struct asf_marker_s
uint32_t i_flags; uint32_t i_flags;
uint32_t i_marker_description_length; uint32_t i_marker_description_length;
uint8_t *i_marker_description; uint8_t *i_marker_description;
/* u8 padding */
} asf_marker_t; } asf_marker_t;
...@@ -366,14 +338,6 @@ typedef struct asf_object_marker_s ...@@ -366,14 +338,6 @@ typedef struct asf_object_marker_s
} asf_object_marker_t; } asf_object_marker_t;
#if 0
typedef struct asf_object__s
{
ASF_OBJECT_COMMON
} asf_object__t;
#endif
typedef union asf_object_u typedef union asf_object_u
{ {
asf_object_common_t common; asf_object_common_t common;
...@@ -395,8 +359,8 @@ int ASF_SeekAbsolute( input_thread_t *p_input, off_t i_pos); ...@@ -395,8 +359,8 @@ int ASF_SeekAbsolute( input_thread_t *p_input, off_t i_pos);
int ASF_ReadData( input_thread_t *p_input, uint8_t *p_buff, int i_size ); int ASF_ReadData( input_thread_t *p_input, uint8_t *p_buff, int i_size );
int ASF_SkipBytes( input_thread_t *p_input, int i_count ); int ASF_SkipBytes( input_thread_t *p_input, int i_count );
void GetGUID( guid_t *p_guid, uint8_t *p_data ); void ASF_GetGUID( guid_t *p_guid, uint8_t *p_data );
int CmpGUID( const guid_t *p_guid1, const guid_t *p_guid2 ); int ASF_CmpGUID( const guid_t *p_guid1, const guid_t *p_guid2 );
int ASF_ReadObjectCommon( input_thread_t *p_input, int ASF_ReadObjectCommon( input_thread_t *p_input,
asf_object_t *p_obj ); asf_object_t *p_obj );
......
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