* aac.c : Raw aac Stream input module for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
- * $Id: aac.c,v 1.3 2003/09/07 22:48:29 fenrir Exp $
+ * $Id: aac.c,v 1.4 2003/09/12 16:26:40 fenrir Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
struct demux_sys_t
{
- stream_t *s;
mtime_t i_time;
es_descriptor_t *p_es;
p_input->p_demux_data = p_sys = malloc( sizeof( demux_sys_t ) );
p_sys->i_time = 0;
- if( ( p_sys->s = stream_OpenInput( p_input ) ) == NULL )
- {
- msg_Err( p_input, "cannot create stream" );
- goto error;
- }
-
/* peek the begining (10 is for adts header) */
- if( stream_Peek( p_sys->s, &p_peek, 10 ) < 10 )
+ if( stream_Peek( p_input->s, &p_peek, 10 ) < 10 )
{
msg_Err( p_input, "cannot peek" );
goto error;
return VLC_SUCCESS;
error:
- if( p_sys->s )
- {
- stream_Release( p_sys->s );
- }
free( p_sys );
return VLC_EGENERIC;
}
uint8_t h[8];
uint8_t *p_peek;
- if( stream_Peek( p_sys->s, &p_peek, 8 ) < 8 )
+ if( stream_Peek( p_input->s, &p_peek, 8 ) < 8 )
{
msg_Warn( p_input, "cannot peek" );
return 0;
int i_skip = 0;
int i_peek;
- i_peek = stream_Peek( p_sys->s, &p_peek, 8096 );
+ i_peek = stream_Peek( p_input->s, &p_peek, 8096 );
if( i_peek < 8 )
{
msg_Warn( p_input, "cannot peek" );
}
msg_Warn( p_input, "garbage=%d bytes", i_skip );
- stream_Read( p_sys->s, NULL, i_skip );
+ stream_Read( p_input->s, NULL, i_skip );
return 1;
}
p_input->stream.p_selected_program,
p_sys->i_time * 9 / 100 );
- if( ( p_pes = stream_PesPacket( p_sys->s, AAC_FRAME_SIZE( h ) ) ) == NULL )
+ if( ( p_pes = stream_PesPacket( p_input->s, AAC_FRAME_SIZE( h ) ) )==NULL )
{
msg_Warn( p_input, "cannot read data" );
return 0;
input_thread_t *p_input = (input_thread_t*)p_this;
demux_sys_t *p_sys = p_input->p_demux_data;
- if( p_sys->s )
- {
- stream_Release( p_sys->s );
- }
free( p_sys );
}