diff --git a/include/input_ext-dec.h b/include/input_ext-dec.h index 0082f509ad948f95d0e5649fd5a23b8c81c652d1..df6aed632d6e04a8bf8f65dcac3dd3ae094235bc 100644 --- a/include/input_ext-dec.h +++ b/include/input_ext-dec.h @@ -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 * Michel Kaempf @@ -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; diff --git a/include/input_ext-intf.h b/include/input_ext-intf.h index 7e1edd9b855cef91ecbe67c874c5b5df535f41c8..673d6acf64ee01d27a92f9b38b598db31ccbf143 100644 --- a/include/input_ext-intf.h +++ b/include/input_ext-intf.h @@ -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 * @@ -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 */ diff --git a/modules/codec/adpcm.c b/modules/codec/adpcm.c index 78cf7fbc93f8d2851052a264f2b03f0f94015bc7..ce980da5c6cc6a0cfc7f667e13a6df7ca0d263c9 100644 --- a/modules/codec/adpcm.c +++ b/modules/codec/adpcm.c @@ -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 * @@ -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 ); diff --git a/modules/codec/araw.c b/modules/codec/araw.c index 3811c0e7cfba92c74afcf040c19971294767d0e2..f0b886fb529cff6834b47a3cb8b87eee62a59d83 100644 --- a/modules/codec/araw.c +++ b/modules/codec/araw.c @@ -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 * @@ -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 ) diff --git a/modules/codec/faad/decoder.c b/modules/codec/faad/decoder.c index 1f3c3d3577a5f6d9558d9a652840f6ad52e41ffb..30a64d96bd1b0aafae24258ff6da30344f1eeb4d 100644 --- a/modules/codec/faad/decoder.c +++ b/modules/codec/faad/decoder.c @@ -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 * @@ -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; - + 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; @@ -226,7 +227,7 @@ static int InitThread( adec_thread_t * p_adec ) FREE( p_adec->format.p_data ); return( -1 ); } - + if( p_adec->format.p_data == NULL ) { int i_frame_size; diff --git a/modules/codec/ffmpeg/audio.c b/modules/codec/ffmpeg/audio.c index 65e22bd9983dfe9155097b83e607e3637681ca85..55cd530bca99f56ed8b88077fb216fcd99636d89 100644 --- a/modules/codec/ffmpeg/audio.c +++ b/modules/codec/ffmpeg/audio.c @@ -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 * @@ -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 ); + ffmpeg_GetWaveFormatEx( &p_adec->format, + (uint8_t*)p_wf ); } else { diff --git a/modules/codec/ffmpeg/video.c b/modules/codec/ffmpeg/video.c index fb401c45a028409187e3fa1012f087c858c652ca..f01d05be2a6ff52e118d39079f69b27c59559f49 100644 --- a/modules/codec/ffmpeg/video.c +++ b/modules/codec/ffmpeg/video.c @@ -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 * Gildas Bazin @@ -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; diff --git a/modules/codec/xvid.c b/modules/codec/xvid.c index 5817408c9e483f8d37a27c3e42aecffeae4c2d55..ab9f857f34b611e42deb76b92aabf655f27ce549 100644 --- a/modules/codec/xvid.c +++ b/modules/codec/xvid.c @@ -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 * @@ -100,12 +100,18 @@ static int RunDecoder ( decoder_fifo_t *p_fifo ) DecoderError( p_fifo ); return VLC_EGENERIC; } + 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; + } - p_format = (BITMAPINFOHEADER *)p_fifo->p_demux_data; - - /* 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; diff --git a/modules/demux/asf/asf.c b/modules/demux/asf/asf.c index 72880669aeee51e2d78dfa4b40cf100f1df5a09c..2c4c604df57657990268049041bb56351fc4e132 100644 --- a/modules/demux/asf/asf.c +++ b/modules/demux/asf/asf.c @@ -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 * * 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 ) ); } diff --git a/modules/demux/avi/avi.c b/modules/demux/avi/avi.c index d15f2d5760154592cdcf7113b0ba74d8723c1cb1..b202d6e9c61b3ac0127a8a1f601223c6b7d79378 100644 --- a/modules/demux/avi/avi.c +++ b/modules/demux/avi/avi.c @@ -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 * * 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 } diff --git a/modules/demux/mp4/mp4.c b/modules/demux/mp4/mp4.c index 3ec85e118ef928a9ac2344159e8f5147dbb5a4d4..53d4a286f0c6b2d33b4093f2c0e98c661634a89c 100644 --- a/modules/demux/mp4/mp4.c +++ b/modules/demux/mp4/mp4.c @@ -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 * * 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 ); diff --git a/modules/demux/ogg.c b/modules/demux/ogg.c index 903d94f02e7b3d828e40a383c845275e3b6df5ab..92233561eaaef5b5da3500db4f483973afd8cf68 100644 --- a/modules/demux/ogg.c +++ b/modules/demux/ogg.c @@ -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 * @@ -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 } diff --git a/modules/demux/rawdv.c b/modules/demux/rawdv.c index ba37b0e830fad1e72ca5807c4549c282b246fa35..bc9becf07b3044aad414b02f7290ecb0351d9cd5 100644 --- a/modules/demux/rawdv.c +++ b/modules/demux/rawdv.c @@ -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 * @@ -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 ); diff --git a/modules/demux/wav/wav.c b/modules/demux/wav/wav.c index 1c7f2e7148adbf10db872071f80a9ec206b90f9b..0766ac2b1907d9a249774f45f04ac2346b79bef6 100644 --- a/modules/demux/wav/wav.c +++ b/modules/demux/wav/wav.c @@ -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 * * This program is free software; you can redistribute it and/or modify @@ -490,16 +490,15 @@ 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 ); - + p_input->stream.p_selected_program->b_is_ok = 1; vlc_mutex_unlock( &p_input->stream.stream_lock ); } @@ -513,9 +512,9 @@ static int WAVInit( vlc_object_t * p_this ) p_input->psz_demux = p_demux->psz_demux; p_demux->p_demux = module_Need( p_input, "demux", NULL ); - + p_input->psz_demux = psz_sav; - + if( !p_demux->p_demux ) { msg_Err( p_input, diff --git a/src/input/input_dec.c b/src/input/input_dec.c index f69950075c8ca45bfe70e741a3ca88b49040e612..f319f46bbdda54cb164639a8d4696722fe283471 100644 --- a/src/input/input_dec.c +++ b/src/input/input_dec.c @@ -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 * @@ -327,8 +327,9 @@ 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_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; diff --git a/src/input/input_programs.c b/src/input/input_programs.c index 3793d7baee960a8ddcabead22ef058266937b6b2..fc9225473a41b81fb1fd15ef55c30a2c6a125019 100644 --- a/src/input/input_programs.c +++ b/src/input/input_programs.c @@ -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 * @@ -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;