Commit 12336778 authored by Gildas Bazin's avatar Gildas Bazin

* modules/codec/a52old/*, modules/codec/mpeg_audio/*, modules/codec/mpeg_video/*: got rid of deprecated decoders.
parent 2d3c9c2c
dnl Autoconf settings for vlc
dnl $Id: configure.ac,v 1.82 2003/10/04 11:17:04 sam Exp $
dnl $Id: configure.ac,v 1.83 2003/10/04 11:59:59 gbazin Exp $
AC_INIT(vlc,0.6.3-cvs)
......@@ -349,10 +349,10 @@ AM_CONDITIONAL(BUILD_GETOPT, ${need_getopt})
if test "${SYS}" != "mingw32"; then
AC_TYPE_SIGNAL
AC_CHECK_LIB(m,cos,[
AX_ADD_LDFLAGS([imdct adjust distort a52tofloat32],[-lm])
AX_ADD_LDFLAGS([adjust distort a52tofloat32],[-lm])
])
AC_CHECK_LIB(m,pow,[
AX_ADD_LDFLAGS([ffmpeg stream_out_transcode imdct imdct3dn imdctsse i420_rgb faad],[-lm])
AX_ADD_LDFLAGS([ffmpeg stream_out_transcode i420_rgb faad],[-lm])
])
AC_CHECK_LIB(m,sqrt,[
AX_ADD_LDFLAGS([headphone_channel_mixer],[-lm])
......@@ -826,12 +826,6 @@ case "${target_cpu}" in
;;
esac
case "${ARCH}" in
hppa64)
AX_ADD_CFLAGS([mpeg_video_old],[-ffunction-sections])
;;
esac
dnl
dnl Enable profiling
dnl
......@@ -845,7 +839,6 @@ test "${enable_cprof}" != "yes" && enable_cprof="no"
dnl
dnl default modules
dnl
#AX_ADD_BUILTINS([mpeg_video_old idct idctclassic motion])
AX_ADD_PLUGINS([dummy rc logger gestures memcpy])
AX_ADD_PLUGINS([es mpga m4v mpeg_system ps ts avi asf aac mp4 rawdv])
AX_ADD_PLUGINS([spudec mpeg_audio lpcm a52 dts cinepak])
......@@ -3375,16 +3368,9 @@ AC_OUTPUT([
modules/audio_mixer/Makefile
modules/audio_output/Makefile
modules/codec/Makefile
modules/codec/a52old/Makefile
modules/codec/a52old/downmix/Makefile
modules/codec/a52old/imdct/Makefile
modules/codec/faad/Makefile
modules/codec/ffmpeg/Makefile
modules/codec/ffmpeg/postprocessing/Makefile
modules/codec/mpeg_audio/Makefile
modules/codec/mpeg_video/Makefile
modules/codec/mpeg_video/idct/Makefile
modules/codec/mpeg_video/motion/Makefile
modules/codec/spudec/Makefile
modules/control/Makefile
modules/control/corba/Makefile
......
.deps
.dirstamp
*.lo
*.la
*.dll
*.dylib
*.sl
*.so
Makefile.am
Makefile.in
Makefile
SOURCES_a52old = \
a52old.c \
adec.h \
internal.h \
decoder.c \
decoder.h \
parse.c \
exponent.c \
exponent.h \
bit_allocate.c \
mantissa.c \
mantissa.h \
rematrix.c \
imdct.c \
imdct.h \
downmix.h \
$(NULL)
/*****************************************************************************
* a52old.c: A52 decoder module main file
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: a52old.c,v 1.9 2003/02/20 01:52:45 sigmunau Exp $
*
* Authors: Michel Lespinasse <walken@zoy.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
#include <stdlib.h> /* malloc(), free() */
#include <string.h> /* memset() */
#include <vlc/vlc.h>
#include <vlc/aout.h>
#include <vlc/decoder.h>
#include "aout_internal.h"
#ifdef HAVE_UNISTD_H
# include <unistd.h> /* getpid() */
#endif
#include "imdct.h"
#include "downmix.h"
#include "adec.h"
#define A52DEC_FRAME_SIZE 1536
/*****************************************************************************
* Local prototypes
*****************************************************************************/
static int OpenDecoder ( vlc_object_t * );
static int RunDecoder ( decoder_fifo_t * );
static int InitThread ( a52dec_t * );
static void EndThread ( a52dec_t * );
static void BitstreamCallback ( bit_stream_t *, vlc_bool_t );
/*****************************************************************************
* Module descriptor
*****************************************************************************/
vlc_module_begin();
add_category_hint( N_("Miscellaneous"), NULL, VLC_TRUE );
add_module ( "a52-downmix", "downmix", NULL, NULL,
N_("A52 downmix module"), NULL, VLC_TRUE );
add_module ( "a52-imdct", "imdct", NULL, NULL,
N_("A52 IMDCT module"), NULL, VLC_TRUE );
set_description( _("software A52 decoder") );
set_capability( "decoder", 50 );
set_callbacks( OpenDecoder, NULL );
add_shortcut( "a52" );
vlc_module_end();
/*****************************************************************************
* OpenDecoder: probe the decoder and return score
*****************************************************************************
* Tries to launch a decoder and return score so that the interface is able
* to chose.
*****************************************************************************/
static int OpenDecoder( vlc_object_t *p_this )
{
decoder_fifo_t *p_fifo = (decoder_fifo_t*) p_this;
if( p_fifo->i_fourcc != VLC_FOURCC('a','5','2',' ')
&& p_fifo->i_fourcc != VLC_FOURCC('a','5','2','b') )
{
return VLC_EGENERIC;
}
p_fifo->pf_run = RunDecoder;
return VLC_SUCCESS;
}
/*****************************************************************************
* RunDecoder: this function is called just after the thread is created
*****************************************************************************/
static int RunDecoder( decoder_fifo_t *p_fifo )
{
a52dec_t * p_a52dec;
void * p_orig; /* pointer before memalign */
vlc_bool_t b_sync = 0;
mtime_t i_pts = 0;
aout_buffer_t *p_aout_buffer;
audio_sample_format_t output_format;
audio_date_t end_date;
/* Allocate the memory needed to store the thread's structure */
p_a52dec = (a52dec_t *)vlc_memalign( &p_orig, 16, sizeof(a52dec_t) );
memset( p_a52dec, 0, sizeof( a52dec_t ) );
if( p_a52dec == NULL )
{
msg_Err( p_fifo, "out of memory" );
DecoderError( p_fifo );
return( -1 );
}
/*
* Initialize the thread properties
*/
p_a52dec->p_fifo = p_fifo;
if( InitThread( p_a52dec ) )
{
msg_Err( p_fifo, "could not initialize thread" );
DecoderError( p_fifo );
free( p_orig );
return( -1 );
}
/* A52 decoder thread's main loop */
/* FIXME : do we have enough room to store the decoded frames ?? */
while ((!p_a52dec->p_fifo->b_die) && (!p_a52dec->p_fifo->b_error))
{
sync_info_t sync_info;
if( !b_sync )
{
int i_sync_ptr;
#define p_bit_stream (&p_a52dec->bit_stream)
/* Go to the next PES packet and jump to sync_ptr */
do {
BitstreamNextDataPacket( p_bit_stream );
} while( !p_bit_stream->p_decoder_fifo->b_die
&& !p_bit_stream->p_decoder_fifo->b_error
&& p_bit_stream->p_data !=
p_bit_stream->p_decoder_fifo->p_first->p_first );
i_sync_ptr = *(p_bit_stream->p_byte - 2) << 8
| *(p_bit_stream->p_byte - 1);
p_bit_stream->p_byte += i_sync_ptr;
/* Empty the bit FIFO and realign the bit stream */
p_bit_stream->fifo.buffer = 0;
p_bit_stream->fifo.i_available = 0;
AlignWord( p_bit_stream );
b_sync = 1;
#undef p_bit_stream
}
if (sync_frame (p_a52dec, &sync_info))
{
b_sync = 0;
continue;
}
if( ( p_a52dec->p_aout_input == NULL )||
( output_format.i_rate != sync_info.sample_rate ) )
{
if( p_a52dec->p_aout_input )
{
/* Delete old output */
msg_Warn( p_a52dec->p_fifo, "opening a new aout" );
aout_DecDelete( p_a52dec->p_aout, p_a52dec->p_aout_input );
}
/* Set output configuration */
output_format.i_format = AOUT_FMT_S16_NE;
output_format.i_channels = 2; /* FIXME ! */
output_format.i_rate = sync_info.sample_rate;
aout_DateInit( &end_date, output_format.i_rate );
p_a52dec->p_aout_input = aout_DecNew( p_a52dec->p_fifo,
&p_a52dec->p_aout,
&output_format );
}
if( p_a52dec->p_aout_input == NULL )
{
msg_Err( p_a52dec->p_fifo, "failed to create aout fifo" );
p_a52dec->p_fifo->b_error = 1;
continue;
}
NextPTS( &p_a52dec->bit_stream, &i_pts, NULL );
if( i_pts != 0 && i_pts != aout_DateGet( &end_date ) )
{
aout_DateSet( &end_date, i_pts );
}
if( !aout_DateGet( &end_date ) )
{
continue;
}
p_aout_buffer = aout_DecNewBuffer( p_a52dec->p_aout,
p_a52dec->p_aout_input,
A52DEC_FRAME_SIZE );
if( !p_aout_buffer )
{
msg_Err( p_a52dec->p_fifo, "cannot get aout buffer" );
p_a52dec->p_fifo->b_error = 1;
continue;
}
p_aout_buffer->start_date = aout_DateGet( &end_date );
p_aout_buffer->end_date = aout_DateIncrement( &end_date,
A52DEC_FRAME_SIZE );
if (decode_frame (p_a52dec, (s16*)p_aout_buffer->p_buffer))
{
b_sync = 0;
aout_DecDeleteBuffer( p_a52dec->p_aout, p_a52dec->p_aout_input,
p_aout_buffer );
continue;
}
else
{
aout_DecPlay( p_a52dec->p_aout, p_a52dec->p_aout_input,
p_aout_buffer );
}
RealignBits(&p_a52dec->bit_stream);
}
/* If b_error is set, the A52 decoder thread enters the error loop */
if (p_a52dec->p_fifo->b_error)
{
DecoderError( p_a52dec->p_fifo );
}
/* End of the A52 decoder thread */
EndThread (p_a52dec);
free( p_orig );
return( 0 );
}
/*****************************************************************************
* InitThread: initialize data before entering main loop
*****************************************************************************/
static int InitThread( a52dec_t * p_a52dec )
{
/*
* Choose the best downmix module
*/
p_a52dec->p_downmix = vlc_object_create( p_a52dec->p_fifo,
sizeof( downmix_t ) );
p_a52dec->p_downmix->psz_object_name = "downmix";
p_a52dec->p_downmix->p_module =
module_Need( p_a52dec->p_downmix, "downmix", "$a52-downmix" );
if( p_a52dec->p_downmix->p_module == NULL )
{
msg_Err( p_a52dec->p_fifo, "no suitable downmix module" );
vlc_object_destroy( p_a52dec->p_downmix );
return( -1 );
}
/*
* Choose the best IMDCT module
*/
p_a52dec->p_imdct = vlc_object_create( p_a52dec->p_fifo,
sizeof( imdct_t ) );
#define IMDCT p_a52dec->p_imdct
p_a52dec->p_imdct->p_module =
module_Need( p_a52dec->p_imdct, "imdct", "$a52-imdct" );
if( p_a52dec->p_imdct->p_module == NULL )
{
msg_Err( p_a52dec->p_fifo, "no suitable IMDCT module" );
vlc_object_destroy( p_a52dec->p_imdct );
module_Unneed( p_a52dec->p_downmix, p_a52dec->p_downmix->p_module );
vlc_object_destroy( p_a52dec->p_downmix );
return( -1 );
}
/* Initialize the A52 decoder structures */
p_a52dec->samples = vlc_memalign( &p_a52dec->samples_orig,
16, 6 * 256 * sizeof(float) );
IMDCT->buf = vlc_memalign( &IMDCT->buf_orig,
16, N/4 * sizeof(complex_t) );
IMDCT->delay = vlc_memalign( &IMDCT->delay_orig,
16, 6 * 256 * sizeof(float) );
IMDCT->delay1 = vlc_memalign( &IMDCT->delay1_orig,
16, 6 * 256 * sizeof(float) );
IMDCT->xcos1 = vlc_memalign( &IMDCT->xcos1_orig,
16, N/4 * sizeof(float) );
IMDCT->xsin1 = vlc_memalign( &IMDCT->xsin1_orig,
16, N/4 * sizeof(float) );
IMDCT->xcos2 = vlc_memalign( &IMDCT->xcos2_orig,
16, N/8 * sizeof(float) );
IMDCT->xsin2 = vlc_memalign( &IMDCT->xsin2_orig,
16, N/8 * sizeof(float) );
IMDCT->xcos_sin_sse = vlc_memalign( &IMDCT->xcos_sin_sse_orig,
16, 128 * 4 * sizeof(float) );
IMDCT->w_1 = vlc_memalign( &IMDCT->w_1_orig,
16, 1 * sizeof(complex_t) );
IMDCT->w_2 = vlc_memalign( &IMDCT->w_2_orig,
16, 2 * sizeof(complex_t) );
IMDCT->w_4 = vlc_memalign( &IMDCT->w_4_orig,
16, 4 * sizeof(complex_t) );
IMDCT->w_8 = vlc_memalign( &IMDCT->w_8_orig,
16, 8 * sizeof(complex_t) );
IMDCT->w_16 = vlc_memalign( &IMDCT->w_16_orig,
16, 16 * sizeof(complex_t) );
IMDCT->w_32 = vlc_memalign( &IMDCT->w_32_orig,
16, 32 * sizeof(complex_t) );
IMDCT->w_64 = vlc_memalign( &IMDCT->w_64_orig,
16, 64 * sizeof(complex_t) );
#undef IMDCT
E_( a52_init )( p_a52dec );
/*
* Initialize the output properties
*/
p_a52dec->p_aout = NULL;
p_a52dec->p_aout_input = NULL;
/*
* Bit stream
*/
return( InitBitstream( &p_a52dec->bit_stream, p_a52dec->p_fifo,
BitstreamCallback, (void *) p_a52dec ) );
}
/*****************************************************************************
* EndThread : A52 decoder thread destruction
*****************************************************************************/
static void EndThread (a52dec_t * p_a52dec)
{
/* If the audio output fifo was created, we destroy it */
if( p_a52dec->p_aout_input )
{
aout_DecDelete( p_a52dec->p_aout, p_a52dec->p_aout_input );
}
/* Free allocated structures */
#define IMDCT p_a52dec->p_imdct
free( IMDCT->w_1_orig );
free( IMDCT->w_64_orig );
free( IMDCT->w_32_orig );
free( IMDCT->w_16_orig );
free( IMDCT->w_8_orig );
free( IMDCT->w_4_orig );
free( IMDCT->w_2_orig );
free( IMDCT->xcos_sin_sse_orig );
free( IMDCT->xsin2_orig );
free( IMDCT->xcos2_orig );
free( IMDCT->xsin1_orig );
free( IMDCT->xcos1_orig );
free( IMDCT->delay1_orig );
free( IMDCT->delay_orig );
free( IMDCT->buf_orig );
#undef IMDCT
free( p_a52dec->samples_orig );
/* Unlock the modules */
module_Unneed( p_a52dec->p_downmix, p_a52dec->p_downmix->p_module );
vlc_object_destroy( p_a52dec->p_downmix );
module_Unneed( p_a52dec->p_imdct, p_a52dec->p_imdct->p_module );
vlc_object_destroy( p_a52dec->p_imdct );
/* Free what's left of the decoder */
free( p_a52dec->imdct_orig );
CloseBitstream( p_a52dec->bit_stream );
}
/*****************************************************************************
* BitstreamCallback: Import parameters from the new data/PES packet
*****************************************************************************
* This function is called by input's NextDataPacket.
*****************************************************************************/
static void BitstreamCallback ( bit_stream_t * p_bit_stream,
vlc_bool_t b_new_pes )
{
if( b_new_pes )
{
/* Drop special A52 header */
/* p_bit_stream->p_byte += 3; */
}
}
/*****************************************************************************
* adec.h : A52 decoder interface
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: adec.h,v 1.4 2002/08/23 14:05:22 sam Exp $
*
* Authors: Michel Kaempf <maxx@via.ecp.fr>
* Renaud Dartus <reno@videolan.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
/*****************************************************************************
* Prototypes
*****************************************************************************/
vlc_thread_t a52dec_CreateThread( decoder_fifo_t * p_fifo );
/**** A52 decoder API - public A52 decoder structures */
typedef struct a52dec_s a52dec_t;
typedef struct sync_info_s {
int sample_rate; /* sample rate in Hz */
int frame_size; /* frame size in bytes */
int bit_rate; /* nominal bit rate in kbps */
} sync_info_t;
/**** A52 decoder API - functions publically provided by the A52 decoder ****/
int E_( a52_init )(a52dec_t * p_a52dec);
int sync_frame (a52dec_t * p_a52dec, sync_info_t * p_sync_info);
int decode_frame (a52dec_t * p_a52dec, s16 * buffer);
/**** EVERYTHING AFTER THIS POINT IS PRIVATE ! DO NOT USE DIRECTLY ****/
/**** A52 decoder internal structures ****/
/* The following structures are filled in by their corresponding parse_*
* functions. See http://www.atsc.org/Standards/A52/a_52.pdf for
* full details on each field. Indented fields are used to denote
* conditional fields.
*/
typedef struct syncinfo_s {
/* Sync word == 0x0B77 */
/* u16 syncword; */
/* crc for the first 5/8 of the sync block */
/* u16 crc1; */
/* Stream Sampling Rate (kHz) 0 = 48, 1 = 44.1, 2 = 32, 3 = reserved */
u16 fscod;
/* Frame size code */
u16 frmsizecod;
/* Information not in the AC-3 bitstream, but derived */
/* Frame size in 16 bit words */
u16 frame_size;
/* Bit rate in kilobits */
/*u16 bit_rate;*/
} syncinfo_t;
typedef struct bsi_s {
/* Bit stream identification == 0x8 */
u16 bsid;
/* Bit stream mode */
u16 bsmod;
/* Audio coding mode */
u16 acmod;
/* If we're using the centre channel then */
/* centre mix level */
u16 cmixlev;
/* If we're using the surround channel then */
/* surround mix level */
u16 surmixlev;
/* If we're in 2/0 mode then */
/* Dolby surround mix level - NOT USED - */
u16 dsurmod;
/* Low frequency effects on */
u16 lfeon;
/* Dialogue Normalization level */
u16 dialnorm;
/* Compression exists */
u16 compre;
/* Compression level */
u16 compr;
/* Language code exists */
u16 langcode;
/* Language code */
u16 langcod;
/* Audio production info exists*/
u16 audprodie;
u16 mixlevel;
u16 roomtyp;
/* If we're in dual mono mode (acmod == 0) then extra stuff */
u16 dialnorm2;
u16 compr2e;
u16 compr2;
u16 langcod2e;
u16 langcod2;
u16 audprodi2e;
u16 mixlevel2;
u16 roomtyp2;
/* Copyright bit */
u16 copyrightb;
/* Original bit */
u16 origbs;
/* Timecode 1 exists */
u16 timecod1e;
/* Timecode 1 */
u16 timecod1;
/* Timecode 2 exists */
u16 timecod2e;
/* Timecode 2 */
u16 timecod2;
/* Additional bit stream info exists */
u16 addbsie;
/* Additional bit stream length - 1 (in bytes) */
u16 addbsil;
/* Additional bit stream information (max 64 bytes) */
u8 addbsi[64];