Commit 81b7c545 authored by Laurent Aimar's avatar Laurent Aimar

* all: I have added two new variables in es_descriptor_t and

decoder_fifo_t (p_waveformatex and p_bitmapinfoheader). It's
a replacement of p_demux_data as this variable is used by
some demuxers in another way. This way, I will be able to add
preliminary support of mpeg4 in mpeg2TS... (I haven't tested ogm
demuxer so if somebody wants ...)
parent 4118695e
......@@ -2,7 +2,7 @@
* input_ext-dec.h: structures exported to the VideoLAN decoders
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: input_ext-dec.h,v 1.77 2002/11/11 14:39:11 sam Exp $
* $Id: input_ext-dec.h,v 1.78 2003/01/07 21:49:01 fenrir Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Michel Kaempf <maxx@via.ecp.fr>
......@@ -107,6 +107,8 @@ struct decoder_fifo_t
es_sys_t * p_demux_data;
stream_ctrl_t * p_stream_ctrl;
sout_instance_t * p_sout;
void * p_waveformatex;
void * p_bitmapinfoheader;
/* Module properties */
module_t * p_module;
......
......@@ -4,7 +4,7 @@
* control the pace of reading.
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: input_ext-intf.h,v 1.82 2002/12/31 01:54:35 massiot Exp $
* $Id: input_ext-intf.h,v 1.83 2003/01/07 21:49:01 fenrir Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -65,6 +65,8 @@ struct es_descriptor_t
/* Decoder information */
decoder_fifo_t * p_decoder_fifo;
void * p_waveformatex;
void * p_bitmapinfoheader;
count_t c_packets; /* total packets read */
count_t c_invalid_packets; /* invalid packets read */
......
......@@ -2,7 +2,7 @@
* adpcm.c : adpcm variant audio decoder
*****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN
* $Id: adpcm.c,v 1.4 2003/01/02 20:48:28 gbazin Exp $
* $Id: adpcm.c,v 1.5 2003/01/07 21:49:01 fenrir Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
......@@ -223,7 +223,7 @@ static int RunDecoder( decoder_fifo_t *p_fifo )
static int InitThread( adec_thread_t * p_adec )
{
if( !( p_adec->p_wf = (WAVEFORMATEX*)p_adec->p_fifo->p_demux_data ) )
if( ( p_adec->p_wf = (WAVEFORMATEX*)p_adec->p_fifo->p_waveformatex ) == NULL )
{
msg_Err( p_adec->p_fifo, "missing format" );
return( -1 );
......
......@@ -2,7 +2,7 @@
* araw.c: Pseudo audio decoder; for raw pcm data
*****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN
* $Id: araw.c,v 1.10 2003/01/02 20:48:28 gbazin Exp $
* $Id: araw.c,v 1.11 2003/01/07 21:49:01 fenrir Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
......@@ -193,13 +193,12 @@ static void GetWaveFormatEx( waveformatex_t *p_wh,
static int InitThread( adec_thread_t * p_adec )
{
if( !p_adec->p_fifo->p_demux_data )
if( ( p_adec->p_wf = (WAVEFORMATEX*)p_adec->p_fifo->p_waveformatex ) == NULL )
{
msg_Err( p_adec->p_fifo, "unknown raw format" );
return( -1 );
}
p_adec->p_wf = (WAVEFORMATEX*)p_adec->p_fifo->p_demux_data;
/* fixing some values */
if( p_adec->p_wf->wFormatTag == WAVE_FORMAT_PCM &&
!p_adec->p_wf->nBlockAlign )
......
......@@ -2,7 +2,7 @@
* decoder.c: AAC decoder using libfaad2
*****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN
* $Id: decoder.c,v 1.16 2003/01/02 20:48:28 gbazin Exp $
* $Id: decoder.c,v 1.17 2003/01/07 21:49:01 fenrir Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
......@@ -198,13 +198,14 @@ static void GetPESData( u8 *p_buf, int i_max, pes_packet_t *p_pes )
*****************************************************************************/
static int InitThread( adec_thread_t * p_adec )
{
WAVEFORMATEX *p_wf;
int i_status;
unsigned long i_rate;
unsigned char i_nb_channels;
faacDecConfiguration *p_faad_config;
if( !p_adec->p_fifo->p_demux_data )
if( ( p_wf = (WAVEFORMATEX*)p_adec->p_fifo->p_waveformatex ) == NULL )
{
msg_Warn( p_adec->p_fifo,
"cannot load stream informations" );
......@@ -212,7 +213,7 @@ static int InitThread( adec_thread_t * p_adec )
else
{
faac_GetWaveFormatEx( &p_adec->format,
(u8*)p_adec->p_fifo->p_demux_data );
(uint8_t*)p_wf );
}
p_adec->p_buffer = NULL;
......
......@@ -2,7 +2,7 @@
* audio.c: audio decoder using ffmpeg library
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: audio.c,v 1.10 2003/01/02 20:48:28 gbazin Exp $
* $Id: audio.c,v 1.11 2003/01/07 21:49:01 fenrir Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
......@@ -116,10 +116,12 @@ static void ffmpeg_GetWaveFormatEx( waveformatex_t *p_wh,
*****************************************************************************/
int E_( InitThread_Audio )( adec_thread_t *p_adec )
{
if( p_adec->p_fifo->p_demux_data )
WAVEFORMATEX *p_wf;
if( ( p_wf = p_adec->p_fifo->p_waveformatex ) != NULL )
{
ffmpeg_GetWaveFormatEx( &p_adec->format,
(u8*)p_adec->p_fifo->p_demux_data );
(uint8_t*)p_wf );
}
else
{
......
......@@ -2,7 +2,7 @@
* video.c: video decoder using ffmpeg library
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: video.c,v 1.14 2002/12/18 16:31:25 fenrir Exp $
* $Id: video.c,v 1.15 2003/01/07 21:49:01 fenrir Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Gildas Bazin <gbazin@netcourrier.com>
......@@ -280,10 +280,8 @@ int E_( InitThread_Video )( vdec_thread_t *p_vdec )
p_vdec->p_ff_pic = &p_vdec->ff_pic;
#endif
if( p_vdec->p_fifo->p_demux_data )
if( ( p_vdec->p_format = (BITMAPINFOHEADER *)p_vdec->p_fifo->p_bitmapinfoheader) != NULL )
{
p_vdec->p_format = (BITMAPINFOHEADER *)p_vdec->p_fifo->p_demux_data;
/* ***** Fill p_context with init values ***** */
p_vdec->p_context->width = p_vdec->p_format->biWidth;
p_vdec->p_context->height = p_vdec->p_format->biHeight;
......
......@@ -2,7 +2,7 @@
* xvid.c: a decoder for libxvidcore, the Xvid video codec
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: xvid.c,v 1.3 2002/11/28 17:34:59 sam Exp $
* $Id: xvid.c,v 1.4 2003/01/07 21:49:01 fenrir Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -100,12 +100,18 @@ static int RunDecoder ( decoder_fifo_t *p_fifo )
DecoderError( p_fifo );
return VLC_EGENERIC;
}
p_format = (BITMAPINFOHEADER *)p_fifo->p_demux_data;
if( ( p_format = (BITMAPINFOHEADER *)p_fifo->p_bitmapinfoheader ) == NULL )
{
i_width = 1;
i_height = 1; // avoid segfault anyway it's wrong
}
else
{
/* Guess picture properties from the BIH */
i_width = p_format->biWidth;
i_height = p_format->biHeight;
}
i_chroma = VLC_FOURCC('Y','V','1','2');
i_aspect = VOUT_ASPECT_FACTOR * i_width / i_height;
......
......@@ -2,7 +2,7 @@
* asf.c : ASFv01 file input module for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: asf.c,v 1.13 2003/01/05 21:03:58 sigmunau Exp $
* $Id: asf.c,v 1.14 2003/01/07 21:49:01 fenrir Exp $
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
......@@ -254,7 +254,7 @@ static int Activate( vlc_object_t * p_this )
i_size = p_sp->i_type_specific_data_length;
p_wf = malloc( i_size );
p_stream->p_es->p_demux_data = (void*)p_wf;
p_stream->p_es->p_waveformatex = (void*)p_wf;
p_data = p_sp->p_type_specific_data;
p_wf->wFormatTag = GetWLE( p_data );
......@@ -271,7 +271,7 @@ static int Activate( vlc_object_t * p_this )
i_size - sizeof( WAVEFORMATEX ));
if( i_size > sizeof( WAVEFORMATEX ) )
{
memcpy( (uint8_t*)p_stream->p_es->p_demux_data + sizeof( WAVEFORMATEX ),
memcpy( (uint8_t*)p_wf + sizeof( WAVEFORMATEX ),
p_data + sizeof( WAVEFORMATEX ),
i_size - sizeof( WAVEFORMATEX ) );
}
......@@ -309,7 +309,7 @@ static int Activate( vlc_object_t * p_this )
i_size = p_sp->i_type_specific_data_length - 11;
p_bih = malloc( i_size );
p_stream->p_es->p_demux_data = (void*)p_bih;
p_stream->p_es->p_bitmapinfoheader = (void*)p_bih;
p_data = p_sp->p_type_specific_data + 11;
p_bih->biSize = GetDWLE( p_data );
......@@ -334,7 +334,7 @@ static int Activate( vlc_object_t * p_this )
if( i_size > sizeof( BITMAPINFOHEADER ) )
{
memcpy( (uint8_t*)p_stream->p_es->p_demux_data + sizeof( BITMAPINFOHEADER ),
memcpy( (uint8_t*)p_bih + sizeof( BITMAPINFOHEADER ),
p_data + sizeof( BITMAPINFOHEADER ),
i_size - sizeof( BITMAPINFOHEADER ) );
}
......
......@@ -2,7 +2,7 @@
* avi.c : AVI file Stream input module for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: avi.c,v 1.19 2002/12/27 15:40:52 sam Exp $
* $Id: avi.c,v 1.20 2003/01/07 21:49:01 fenrir Exp $
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
......@@ -974,9 +974,6 @@ static int AVIInit( vlc_object_t * p_this )
input_AddInfo( p_cat, "Bits Per Sample", "%d",
p_avi_strf_auds->p_wf->wBitsPerSample );
}
break;
case( AVIFOURCC_vids ):
......@@ -1043,18 +1040,20 @@ static int AVIInit( vlc_object_t * p_this )
p_info->p_es =
p_es = input_AddES( p_input,
p_input->stream.p_selected_program, 1+i,
i_init_size );
0 );
vlc_mutex_unlock( &p_input->stream.stream_lock );
p_es->i_stream_id =i; /* XXX: i don't use it */
p_es->i_fourcc = p_info->i_fourcc;
p_es->i_cat = p_info->i_cat;
/* We copy strf for decoder in p_es->p_demux_data */
if( p_init_data )
if( p_es->i_cat == AUDIO_ES )
{
p_es->p_waveformatex = malloc( i_init_size );
memcpy( p_es->p_waveformatex, p_init_data, i_init_size );
}
else if( p_es->i_cat == VIDEO_ES )
{
memcpy( p_es->p_demux_data,
p_init_data,
i_init_size );
p_es->p_bitmapinfoheader = malloc( i_init_size );
memcpy( p_es->p_bitmapinfoheader, p_init_data, i_init_size );
}
#undef p_info
}
......
......@@ -2,7 +2,7 @@
* mp4.c : MP4 file input module for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: mp4.c,v 1.10 2002/12/14 18:57:34 fenrir Exp $
* $Id: mp4.c,v 1.11 2003/01/07 21:49:01 fenrir Exp $
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
......@@ -1143,8 +1143,14 @@ static void MP4_StartDecoder( input_thread_t *p_input,
p_init = NULL;
break;
}
p_demux_track->p_es->p_demux_data = (es_sys_t *)p_init;
if( p_demux_track->i_cat == AUDIO_ES )
{
p_demux_track->p_es->p_waveformatex = (void*)p_init;
}
else if( p_demux_track->i_cat == VIDEO_ES )
{
p_demux_track->p_es->p_bitmapinfoheader = (void*)p_init;
}
vlc_mutex_lock( &p_input->stream.stream_lock );
input_SelectES( p_input, p_demux_track->p_es );
vlc_mutex_unlock( &p_input->stream.stream_lock );
......
......@@ -2,7 +2,7 @@
* ogg.c : ogg stream input module for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: ogg.c,v 1.17 2002/12/20 15:18:56 sigmunau Exp $
* $Id: ogg.c,v 1.18 2003/01/07 21:49:01 fenrir Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
......@@ -1128,8 +1128,8 @@ static int Activate( vlc_object_t * p_this )
p_stream->p_es->i_stream_id = p_stream->p_es->i_id = i_stream;
p_stream->p_es->i_fourcc = p_stream->i_fourcc;
p_stream->p_es->i_cat = p_stream->i_cat;
p_stream->p_es->p_demux_data = p_stream->p_bih ?
(void *)p_stream->p_bih : (void *)p_stream->p_wf;
p_stream->p_es->p_waveformatex = (void*)p_stream->p_wf;
p_stream->p_es->p_bitmapinfoheader = (void*)p_stream->p_bih;
#undef p_stream
}
......
......@@ -2,7 +2,7 @@
* rawdv.c : raw dv input module for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: rawdv.c,v 1.1 2002/12/17 21:15:43 gbazin Exp $
* $Id: rawdv.c,v 1.2 2003/01/07 21:49:01 fenrir Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
......@@ -267,7 +267,7 @@ static int Activate( vlc_object_t * p_this )
p_rawdv->p_video_es->i_stream_id = 0;
p_rawdv->p_video_es->i_fourcc = VLC_FOURCC( 'd','v','s','d' );
p_rawdv->p_video_es->i_cat = VIDEO_ES;
p_rawdv->p_video_es->p_demux_data = (void *)p_rawdv->p_bih;
p_rawdv->p_video_es->p_bitmapinfoheader = (void *)p_rawdv->p_bih;
input_SelectES( p_input, p_rawdv->p_video_es );
vlc_mutex_unlock( &p_input->stream.stream_lock );
......
......@@ -2,7 +2,7 @@
* wav.c : wav file input module for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: wav.c,v 1.8 2002/12/18 14:17:10 sam Exp $
* $Id: wav.c,v 1.9 2003/01/07 21:49:01 fenrir Exp $
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
......@@ -490,13 +490,12 @@ static int WAVInit( vlc_object_t * p_this )
p_demux->p_es = input_AddES( p_input,
p_input->stream.p_selected_program, 1,
p_demux->i_wf );
0 );
p_demux->p_es->i_stream_id = 1;
p_demux->p_es->i_fourcc = p_demux->i_fourcc;
p_demux->p_es->i_cat = AUDIO_ES;
memcpy( p_demux->p_es->p_demux_data,
p_demux->p_wf,
p_demux->i_wf );
p_demux->p_es->p_waveformatex = malloc( p_demux->i_wf );
memcpy( p_demux->p_es->p_waveformatex, p_demux->p_wf, p_demux->i_wf );
input_SelectES( p_input, p_demux->p_es );
......
......@@ -2,7 +2,7 @@
* input_dec.c: Functions for the management of decoders
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: input_dec.c,v 1.54 2002/12/18 17:52:23 gbazin Exp $
* $Id: input_dec.c,v 1.55 2003/01/07 21:49:01 fenrir Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -328,7 +328,8 @@ static decoder_fifo_t * CreateDecoderFifo( input_thread_t * p_input,
p_fifo->i_id = p_es->i_id;
p_fifo->i_fourcc = p_es->i_fourcc;
p_fifo->p_demux_data = p_es->p_demux_data;
p_fifo->p_waveformatex = p_es->p_waveformatex;
p_fifo->p_bitmapinfoheader = p_es->p_bitmapinfoheader;
p_fifo->p_stream_ctrl = &p_input->stream.control;
p_fifo->p_sout = p_input->stream.p_sout;
......
......@@ -2,7 +2,7 @@
* input_programs.c: es_descriptor_t, pgrm_descriptor_t management
*****************************************************************************
* Copyright (C) 1999-2002 VideoLAN
* $Id: input_programs.c,v 1.99 2002/12/06 16:34:08 sam Exp $
* $Id: input_programs.c,v 1.100 2003/01/07 21:49:01 fenrir Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -461,6 +461,8 @@ es_descriptor_t * input_AddES( input_thread_t * p_input,
{
p_es->p_demux_data = NULL;
}
p_es->p_waveformatex = NULL;
p_es->p_bitmapinfoheader = NULL;
/* Add this ES to the program definition if one is given */
if( p_pgrm )
......@@ -531,6 +533,14 @@ void input_DelES( input_thread_t * p_input, es_descriptor_t * p_es )
{
free( p_es->p_demux_data );
}
if( p_es->p_waveformatex )
{
free( p_es->p_waveformatex );
}
if( p_es->p_bitmapinfoheader )
{
free( p_es->p_bitmapinfoheader );
}
/* Find the ES in the ES table */
for( i_es_index = 0; i_es_index < p_input->stream.i_es_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