Commit 49a0736e authored by Henri Fallon's avatar Henri Fallon

All decoders (audio, video, subtitles) are now modules.

- mpeg_vdec, mpeg_adec and ac3_adec are builtins by default
- ac3_spdif, spu_dec and lpcm_dec are plugins by default
parent bee557f9
......@@ -83,8 +83,8 @@ N: Henri Fallon
E: henri@via.ecp.fr
C: henri
D: ALSA audio output
D: input netlist
D: MPEG TS input
D: MPEG TS input, input netlist.
D: Decoder modularization
N: Arnaud Gomes-do-Vale
E: arnaud@carrosse.frmug.org
......
......@@ -13,7 +13,9 @@ endif
#
# All possible plugin directories, needed for make clean
#
PLUGINS_DIR := alsa \
PLUGINS_DIR := ac3_adec \
ac3_spdif \
alsa \
beos \
darwin \
directx \
......@@ -29,21 +31,24 @@ PLUGINS_DIR := alsa \
idct \
imdct \
kde \
lpcm_adec \
macosx \
mga \
motion \
mpeg \
mpeg_adec \
mpeg_vdec \
qt \
sdl \
spu_dec \
text \
vcd \
x11 \
yuv
#
# All possible plugin objects
#
PLUGINS_TARGETS := alsa/alsa \
PLUGINS_TARGETS := ac3_adec/ac3_adec \
ac3_spdif/ac3_spdif \
alsa/alsa \
beos/beos \
darwin/darwin \
directx/directx \
......@@ -69,6 +74,7 @@ PLUGINS_TARGETS := alsa/alsa \
imdct/imdct3dn \
imdct/imdctsse \
kde/kde \
lpcm_adec/lpcm_adec \
macosx/macosx \
macosx/macosx_qt \
mga/mga \
......@@ -77,11 +83,14 @@ PLUGINS_TARGETS := alsa/alsa \
motion/motionmmxext \
motion/motion3dnow \
motion/motionaltivec \
mpeg_adec/mpeg_adec \
mpeg_vdec/mpeg_vdec \
mpeg/es \
mpeg/ps \
mpeg/ts \
qt/qt \
sdl/sdl \
spu_dec/spu_dec \
text/ncurses \
text/rc \
vcd/vcd \
......@@ -89,7 +98,6 @@ PLUGINS_TARGETS := alsa/alsa \
x11/xvideo \
yuv/yuv \
yuv/yuvmmx
#
# C Objects
#
......@@ -97,24 +105,12 @@ INTERFACE := main interface intf_msg intf_playlist intf_channels
INPUT := input input_ext-dec input_ext-intf input_dec input_programs input_netlist input_clock mpeg_system
VIDEO_OUTPUT := video_output video_text video_spu video_yuv
AUDIO_OUTPUT := audio_output aout_ext-dec aout_u8 aout_s8 aout_u16 aout_s16 aout_spdif
AC3_DECODER := ac3_decoder_thread ac3_decoder ac3_parse ac3_exponent ac3_bit_allocate ac3_mantissa ac3_rematrix ac3_imdct
AC3_SPDIF := ac3_spdif ac3_iec958
LPCM_DECODER := lpcm_decoder_thread
AUDIO_DECODER := audio_decoder adec_generic adec_layer1 adec_layer2 adec_math
SPU_DECODER := spu_decoder
VIDEO_DECODER := video_parser vpar_headers vpar_blocks vpar_synchro vpar_pool video_decoder
MISC := mtime tests modules netutils iso_lang
C_OBJ := $(INTERFACE:%=src/interface/%.o) \
$(INPUT:%=src/input/%.o) \
$(VIDEO_OUTPUT:%=src/video_output/%.o) \
$(AUDIO_OUTPUT:%=src/audio_output/%.o) \
$(AC3_DECODER:%=src/ac3_decoder/%.o) \
$(AC3_SPDIF:%=src/ac3_spdif/%.o) \
$(LPCM_DECODER:%=src/lpcm_decoder/%.o) \
$(AUDIO_DECODER:%=src/audio_decoder/%.o) \
$(SPU_DECODER:%=src/spu_decoder/%.o) \
$(VIDEO_DECODER:%=src/video_decoder/%.o) \
$(MISC:%=src/misc/%.o)
#
......
......@@ -198,7 +198,7 @@ Task: 0x47
Difficulty: Hard
Urgency: Normal
Description: Make decoders dynamically loadable
Status: Todo
Status: Done 05 October 2001 (henri)
Task: 0x46
Difficulty: Hard
......
......@@ -3699,8 +3699,8 @@ fi
ARCH=${target_cpu}
BUILTINS="${BUILTINS} es ps ts yuv idct idctclassic motion imdct downmix"
PLUGINS="${PLUGINS}"
BUILTINS="${BUILTINS} es ps ts yuv idct idctclassic motion imdct downmix mpeg_adec lpcm_adec ac3_adec mpeg_vdec"
PLUGINS="${PLUGINS} ac3_spdif spu_dec"
MMX_MODULES="yuvmmx idctmmx motionmmx"
MMXEXT_MODULES="idctmmxext motionmmxext"
......
......@@ -295,8 +295,8 @@ ARCH=${target_cpu}
dnl
dnl default modules
dnl
BUILTINS="${BUILTINS} es ps ts yuv idct idctclassic motion imdct downmix"
PLUGINS="${PLUGINS}"
BUILTINS="${BUILTINS} es ps ts yuv idct idctclassic motion imdct downmix mpeg_adec lpcm_adec ac3_adec mpeg_vdec"
PLUGINS="${PLUGINS} ac3_spdif spu_dec"
dnl
dnl Accelerated modules
......
......@@ -23,20 +23,20 @@ chapters.
<sect1> <title> Decoder configuration </title>
<para>
The input thread spawns the appropriate decoders [the relation is
currently hard-wired in <filename>src/input/input_programs.c</filename>].
It then launches <function> *_CreateThread()</function>, with either
an <type>adec_config_t</type> (audio) or an <type> vdec_config_t</type>
(video) structure, described in <filename> include/input_ext-dec.h</filename>.
The input thread spawns the appropriate decoder modules from <filename>
src/input/input_dec.c</filename>. The <function>Dec_CreateThread</funcion>
function selects the more accurate decoder module. Each decoder module
looks at decoder_config.i_type and returns a score [ see the modules
section ]. It then launches <function> module.pf_RunThread()</function>,
with an <type>decoder_config_t</type> (audio) or an <type> vdec_config_t
</type>, described in <filename> include/input_ext-dec.h</filename>.
</para>
<para>
It contains some parameters relative to the output thread, which will
be described in the following chapters, and a generic <type>
decoder_config_t</type>, which gives the decoder the ES ID and type, and
pointers to a <type> stream_control_t </type> structure (gives
information on the play status), a <type> decoder_fifo_t </type>
and <parameter> pf_init_bit_stream</parameter>, which will be
The generic <type>decoder_config_t</type> structure, gives the decoder
the ES ID and type, and pointers to a <type> stream_control_t </type>
structure (gives information on the play status), a <type> decoder_fifo_t
</type> and <parameter> pf_init_bit_stream</parameter>, which will be
described in the next two sections.
</para>
......@@ -379,7 +379,8 @@ seven methods :
<itemizedlist>
<listitem> <para> <function> vdec_IDCT </function> <parameter>
( vdec_thread_t * p_vdec, dctelem_t * p_block, int ) </parameter> :
( decoder_config_t * p_config, dctelem_t * p_block, int )
</parameter> :
Does the complete 2-D IDCT. 64 coefficients are in <parameter>
p_block</parameter>.
</para> </listitem>
......
......@@ -49,8 +49,15 @@
S.A.S. </ulink> </orgname>
</affiliation>
</collab>
<pubdate> $Id: manual.xml,v 1.1 2001/07/16 15:54:59 massiot Exp $ </pubdate>
<collab>
<collabname> <ulink url="mailto:henri@via.ecp.fr">Henri Fallon
</ulink> </collabname>
<affiliation>
<jobtitle> Developer </jobtitle>
<orgname> VideoLAN project </orgname>
</affiliation>
</collab>
<pubdate> $Id: manual.xml,v 1.2 2001/11/13 12:09:17 henri Exp $ </pubdate>
<copyright> <year> 2001 </year>
<holder> Christophe Massiot, for IDEALX S.A.S. </holder>
</copyright>
......
......@@ -3,7 +3,7 @@
* Collection of useful common types and macros definitions
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: common.h,v 1.47 2001/11/08 21:07:24 jlj Exp $
* $Id: common.h,v 1.48 2001/11/13 12:09:17 henri Exp $
*
* Authors: Samuel Hocevar <sam@via.ecp.fr>
* Vincent Seguin <seguin@via.ecp.fr>
......@@ -85,6 +85,7 @@ typedef struct plugin_info_s * p_plugin_info_t;
/* Plugins */
struct playlist_s;
struct playlist_item_s;
struct module_s;
typedef struct playlist_s * p_playlist_t;
typedef struct playlist_item_s * p_playlist_item_t;
......@@ -125,6 +126,7 @@ struct vout_sys_s;
struct vdec_thread_s;
struct vpar_thread_s;
struct video_parser_s;
struct picture_t;
typedef struct vout_thread_s * p_vout_thread_t;
typedef struct vout_font_s * p_vout_font_t;
......@@ -138,6 +140,13 @@ struct macroblock_s;
struct data_packet_s;
struct es_descriptor_s;
struct pgrm_descriptor_s;
struct pes_packet_s;
struct input_area_s;
struct bit_stream_s;
/* Decoders */
struct decoder_config_s;
struct decoder_fifo_s;
/*****************************************************************************
* Macros and inline functions
......
......@@ -2,7 +2,7 @@
* input_ext-dec.h: structures exported to the VideoLAN decoders
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: input_ext-dec.h,v 1.36 2001/10/03 12:46:17 massiot Exp $
* $Id: input_ext-dec.h,v 1.37 2001/11/13 12:09:17 henri Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Michel Kaempf <maxx@via.ecp.fr>
......@@ -22,6 +22,17 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
/* ES streams types - see ISO/IEC 13818-1 table 2-29 numbers */
#define MPEG1_VIDEO_ES 0x01
#define MPEG2_VIDEO_ES 0x02
#define MPEG1_AUDIO_ES 0x03
#define MPEG2_AUDIO_ES 0x04
#define AC3_AUDIO_ES 0x81
/* These ones might violate the norm : */
#define DVD_SPU_ES 0x82
#define LPCM_AUDIO_ES 0x83
#define UNKNOWN_ES 0xFF
/* Structures exported to the decoders */
/*****************************************************************************
......@@ -203,9 +214,11 @@ typedef struct bit_stream_s
/*****************************************************************************
* Protoypes from input_ext-dec.c
*****************************************************************************/
#ifndef PLUGIN
u32 UnalignedShowBits( struct bit_stream_s *, unsigned int );
void UnalignedRemoveBits( struct bit_stream_s * );
u32 UnalignedGetBits( struct bit_stream_s *, unsigned int );
#endif
/*****************************************************************************
* AlignWord : fill in the bit buffer so that the byte pointer be aligned
......@@ -517,53 +530,13 @@ typedef struct decoder_config_s
void (* pf_bitstream_callback)( struct bit_stream_s *,
boolean_t ),
void * );
} decoder_config_t;
/*****************************************************************************
* vdec_config_t
*****************************************************************************
* Pointers given to video decoders threads.
*****************************************************************************/
struct vout_thread_s;
/* Decoder thread */
vlc_thread_t thread_id;
typedef struct vdec_config_s
{
struct picture_s * (* pf_create_picture)( struct vout_thread_s *,
int i_type, int i_width,
int i_height );
void (* pf_destroy_picture)( struct vout_thread_s *,
struct picture_s * );
void (* pf_display_picture)( struct vout_thread_s *,
struct picture_s * );
void (* pf_date_picture)( struct vout_thread_s *,
struct picture_s *, mtime_t date );
void (* pf_link_picture)( struct vout_thread_s *,
struct picture_s *, mtime_t date );
void (* pf_unlink_picture)( struct vout_thread_s *,
struct picture_s *, mtime_t date );
struct subpicture_s *(* pf_create_subpicture)( struct vout_thread_s *,
int i_type, int i_size );
void (* pf_destroy_subpicture)( struct vout_thread_s *,
struct subpicture_s * );
void (* pf_display_subpicture)( struct vout_thread_s *,
struct subpicture_s * );
decoder_config_t decoder_config;
} vdec_config_t;
/*****************************************************************************
* adec_config_t
*****************************************************************************
* Pointers given to audio decoders threads.
*****************************************************************************/
typedef struct adec_config_s
{
struct aout_fifo_s * (* pf_create_fifo)( struct aout_fifo_s * );
void (* pf_destroy_fifo)( void );
decoder_config_t decoder_config;
} adec_config_t;
/* Plugin/Builtin properties */
struct module_s * p_dec_module;
} decoder_config_t;
/*
* Communication interface between decoders and input
......
......@@ -4,7 +4,7 @@
* control the pace of reading.
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: input_ext-intf.h,v 1.46 2001/11/11 18:15:41 sam Exp $
* $Id: input_ext-intf.h,v 1.47 2001/11/13 12:09:17 henri Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -75,6 +75,8 @@ typedef struct es_descriptor_s
count_t c_packets; /* total packets read */
count_t c_invalid_packets; /* invalid packets read */
struct decoder_config_s * p_dec_config;
} es_descriptor_t;
/* Special PID values - note that the PID is only on 13 bits, and that values
......@@ -83,16 +85,6 @@ typedef struct es_descriptor_s
#define CONDITIONNAL_ACCESS_TABLE_PID 0x0001 /* not used */
#define EMPTY_ID 0xffff /* empty record in a table */
/* ES streams types - see ISO/IEC 13818-1 table 2-29 numbers */
#define MPEG1_VIDEO_ES 0x01
#define MPEG2_VIDEO_ES 0x02
#define MPEG1_AUDIO_ES 0x03
#define MPEG2_AUDIO_ES 0x04
#define AC3_AUDIO_ES 0x81
/* These ones might violate the norm : */
#define DVD_SPU_ES 0x82
#define LPCM_AUDIO_ES 0x83
#define UNKNOWN_ES 0xFF
/* ES Categories to be used by interface plugins */
#define VIDEO_ES 0x00
......
......@@ -3,7 +3,7 @@
* but exported to plug-ins
*****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: input_ext-plugins.h,v 1.3 2001/11/11 01:32:03 stef Exp $
* $Id: input_ext-plugins.h,v 1.4 2001/11/13 12:09:17 henri Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -69,7 +69,7 @@ int input_UnselectES( struct input_thread_s *, struct es_descriptor_s * );
* Prototypes from input_dec.c
*****************************************************************************/
//decoder_capabilities_s * input_ProbeDecoder( void );
vlc_thread_t input_RunDecoder( struct decoder_capabilities_s *, void * );
vlc_thread_t input_RunDecoder( void * );
void input_EndDecoder( struct input_thread_s *, struct es_descriptor_s * );
void input_DecodePES ( struct decoder_fifo_s *, struct pes_packet_s * );
void input_EscapeDiscontinuity( struct input_thread_s *,
......
......@@ -2,7 +2,7 @@
* modules.h : Module management functions.
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: modules.h,v 1.30 2001/11/08 01:48:09 jlj Exp $
* $Id: modules.h,v 1.31 2001/11/13 12:09:17 henri Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -59,15 +59,14 @@ typedef void * module_handle_t;
#define MODULE_CAPABILITY_ACCESS 1 << 1 /* Input */
#define MODULE_CAPABILITY_INPUT 1 << 2 /* Input */
#define MODULE_CAPABILITY_DECAPS 1 << 3 /* Decaps */
#define MODULE_CAPABILITY_ADEC 1 << 4 /* Audio decoder */
#define MODULE_CAPABILITY_VDEC 1 << 5 /* Video decoder */
#define MODULE_CAPABILITY_MOTION 1 << 6 /* Motion compensation */
#define MODULE_CAPABILITY_IDCT 1 << 7 /* IDCT transformation */
#define MODULE_CAPABILITY_AOUT 1 << 8 /* Audio output */
#define MODULE_CAPABILITY_VOUT 1 << 9 /* Video output */
#define MODULE_CAPABILITY_YUV 1 << 10 /* YUV colorspace conversion */
#define MODULE_CAPABILITY_IMDCT 1 << 11 /* IMDCT transformation */
#define MODULE_CAPABILITY_DOWNMIX 1 << 12 /* AC3 downmix */
#define MODULE_CAPABILITY_DEC 1 << 4 /* Video decoder */
#define MODULE_CAPABILITY_MOTION 1 << 5 /* Motion compensation */
#define MODULE_CAPABILITY_IDCT 1 << 6 /* IDCT transformation */
#define MODULE_CAPABILITY_AOUT 1 << 7 /* Audio output */
#define MODULE_CAPABILITY_VOUT 1 << 8 /* Video output */
#define MODULE_CAPABILITY_YUV 1 << 9 /* YUV colorspace conversion */
#define MODULE_CAPABILITY_IMDCT 1 << 10 /* IMDCT transformation */
#define MODULE_CAPABILITY_DOWNMIX 1 << 11 /* AC3 downmix */
/* FIXME: kludge */
struct input_area_s;
......@@ -77,9 +76,12 @@ struct dm_par_s;
struct bit_stream_s;
struct decoder_fifo_s;
struct decoder_config_s;
/* FIXME: not yet used */
typedef struct probedata_s
{
u8 i_type;
struct
{
char * psz_data;
......@@ -214,6 +216,12 @@ typedef struct function_list_s
} downmix;
/* Decoder plugins */
struct
{
int ( * pf_RunThread ) ( struct decoder_config_s * p_config );
} dec;
} functions;
} function_list_t;
......@@ -225,8 +233,7 @@ typedef struct module_functions_s
function_list_t access;
function_list_t input;
function_list_t decaps;
function_list_t adec;
function_list_t vdec;
function_list_t dec;
function_list_t motion;
function_list_t idct;
function_list_t aout;
......
......@@ -19,6 +19,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
struct module_t;
typedef struct module_symbols_s
{
......@@ -40,6 +41,7 @@ typedef struct module_symbols_s
void ( * intf_Msg ) ( char *, ... );
void ( * intf_ErrMsg ) ( char *, ... );
void ( * intf_StatMsg ) ( char *, ... );
void ( * intf_WarnMsg ) ( int, char *, ... );
void ( * intf_WarnMsgImm ) ( int, char *, ... );
#ifdef TRACE
......@@ -132,6 +134,38 @@ typedef struct module_symbols_s
void ( * input_NetlistDeletePES ) ( void *, struct pes_packet_s * );
void ( * input_NetlistEnd ) ( struct input_thread_s * );
struct aout_fifo_s * ( * aout_CreateFifo )
( int, int, long, long, long, void * );
void ( * aout_DestroyFifo ) ( struct aout_fifo_s * );
struct vout_thread_s * (* vout_CreateThread) ( int *, int, int );
struct subpicture_s * (* vout_CreateSubPicture) ( struct vout_thread_s *,
int, int );
struct picture_s * ( * vout_CreatePicture ) ( struct vout_thread_s *,
int, int, int );
void ( * vout_DestroySubPicture ) ( struct vout_thread_s *,
struct subpicture_s * );
void ( * vout_DisplaySubPicture ) ( struct vout_thread_s *,
struct subpicture_s * );
void ( * vout_DisplayPicture ) ( struct vout_thread_s *,
struct picture_s * );
void ( * vout_DestroyPicture ) ( struct vout_thread_s *,
struct picture_s * );
void ( * vout_LinkPicture ) ( struct vout_thread_s *,
struct picture_s * );
void ( * vout_UnlinkPicture ) ( struct vout_thread_s *,
struct picture_s * );
void ( * vout_DatePicture ) ( struct vout_thread_s *p_vout,
struct picture_s *p_pic, mtime_t );
u32 ( * UnalignedShowBits ) ( struct bit_stream_s *, unsigned int );
void ( * UnalignedRemoveBits ) ( struct bit_stream_s * );
u32 ( * UnalignedGetBits ) ( struct bit_stream_s *, unsigned int );
struct module_s * ( * module_Need ) ( int, void * );
void ( * module_Unneed ) ( struct module_s * );
} module_symbols_t;
#define STORE_SYMBOLS( p_symbols ) \
......@@ -149,6 +183,7 @@ typedef struct module_symbols_s
(p_symbols)->intf_ProcessKey = intf_ProcessKey; \
(p_symbols)->intf_Msg = intf_Msg; \
(p_symbols)->intf_ErrMsg = intf_ErrMsg; \
(p_symbols)->intf_StatMsg = intf_StatMsg;\
(p_symbols)->intf_WarnMsg = intf_WarnMsg; \
(p_symbols)->intf_WarnMsgImm = intf_WarnMsgImm; \
(p_symbols)->intf_PlaylistAdd = intf_PlaylistAdd; \
......@@ -197,7 +232,24 @@ typedef struct module_symbols_s
(p_symbols)->input_NetlistNewPES = input_NetlistNewPES; \
(p_symbols)->input_NetlistDeletePacket = input_NetlistDeletePacket; \
(p_symbols)->input_NetlistDeletePES = input_NetlistDeletePES; \
(p_symbols)->input_NetlistEnd = input_NetlistEnd;
(p_symbols)->input_NetlistEnd = input_NetlistEnd; \
(p_symbols)->aout_CreateFifo = aout_CreateFifo; \
(p_symbols)->aout_DestroyFifo = aout_DestroyFifo; \
(p_symbols)->vout_CreateThread = vout_CreateThread; \
(p_symbols)->vout_CreateSubPicture = vout_CreateSubPicture; \
(p_symbols)->vout_DestroySubPicture = vout_DestroySubPicture; \
(p_symbols)->vout_DisplaySubPicture = vout_DisplaySubPicture; \
(p_symbols)->vout_CreatePicture = vout_CreatePicture; \
(p_symbols)->vout_DisplayPicture = vout_DisplayPicture; \
(p_symbols)->vout_DestroyPicture = vout_DestroyPicture; \
(p_symbols)->vout_DatePicture = vout_DatePicture; \
(p_symbols)->vout_LinkPicture = vout_LinkPicture; \
(p_symbols)->vout_UnlinkPicture = vout_UnlinkPicture; \
(p_symbols)->UnalignedGetBits = UnalignedGetBits; \
(p_symbols)->UnalignedRemoveBits = UnalignedRemoveBits; \
(p_symbols)->UnalignedShowBits = UnalignedShowBits; \
(p_symbols)->module_Need = module_Need; \
(p_symbols)->module_Unneed = module_Unneed;
#define STORE_TRACE_SYMBOLS( p_symbols ) \
(p_symbols)->intf_DbgMsg = _intf_DbgMsg; \
......@@ -224,6 +276,7 @@ extern module_symbols_t* p_symbols;
# define intf_Msg p_symbols->intf_Msg
# define intf_ErrMsg p_symbols->intf_ErrMsg
# define intf_StatMsg p_symbols->intf_StatMsg
# define intf_WarnMsg p_symbols->intf_WarnMsg
# define intf_WarnMsgImm p_symbols->intf_WarnMsgImm
#ifdef TRACE
......@@ -291,5 +344,25 @@ extern module_symbols_t* p_symbols;
# define input_NetlistDeletePES p_symbols->input_NetlistDeletePES
# define input_NetlistEnd p_symbols->input_NetlistEnd
# define aout_CreateFifo p_symbols->aout_CreateFifo
# define aout_DestroyFifo p_symbols->aout_DestroyFifo
# define vout_CreateThread p_symbols->vout_CreateThread
# define vout_CreateSubPicture p_symbols->vout_CreateSubPicture
# define vout_DestroySubPicture p_symbols->vout_DestroySubPicture
# define vout_DisplaySubPicture p_symbols->vout_DisplaySubPicture
# define vout_CreatePicture p_symbols->vout_CreatePicture
# define vout_DisplayPicture p_symbols->vout_DisplayPicture
# define vout_DestroyPicture p_symbols->vout_DestroyPicture
# define vout_DatePicture p_symbols->vout_DatePicture
# define vout_LinkPicture p_symbols->vout_LinkPicture
# define vout_UnlinkPicture p_symbols->vout_UnlinkPicture
# define UnalignedShowBits p_symbols->UnalignedShowBits
# define UnalignedRemoveBits p_symbols->UnalignedRemoveBits
# define UnalignedGetBits p_symbols->UnalignedGetBits
# define module_Need p_symbols->module_Need
# define module_Unneed p_symbols->module_Unneed
#endif
###############################################################################
# vlc (VideoLAN Client) AC3 audio decoder module makefile
# (c)2001 VideoLAN
###############################################################################
#
# Objects
#
PLUGIN_C = ac3_adec.o ac3_decoder.o ac3_parse.o ac3_exponent.o ac3_bit_allocate.o ac3_mantissa.o ac3_rematrix.o ac3_imdct.o
BUILTIN_C = $(PLUGIN_C:%.o=BUILTIN_%.o)
ALL_OBJ = $(PLUGIN_C) $(BUILTIN_C)
#
# Virtual targets
#
include ../../Makefile.modules
#
# Real targets
#
../ac3_adec.so: $(PLUGIN_C)
$(CC) $(PCFLAGS) -o $@ $^ $(PLCFLAGS)
../ac3_adec.a: $(BUILTIN_C)
ar r $@ $^
$(RANLIB) $@
/*****************************************************************************
* ac3_decoder_thread.c: ac3 decoder thread
* ac3_adec.c: ac3 decoder module main file
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: ac3_decoder_thread.c,v 1.39 2001/10/31 11:55:53 reno Exp $
* $Id: ac3_adec.c,v 1.1 2001/11/13 12:09:17 henri Exp $
*
* Authors: Michel Lespinasse <walken@zoy.org>
*
......@@ -29,6 +29,8 @@
* - vlc_cond_signal() / vlc_cond_wait()
*
*/
#define MODULE_NAME ac3_adec
#include "modules_inner.h"
/*****************************************************************************
* Preamble
......@@ -46,40 +48,88 @@
#include "common.h"
#include "threads.h"
#include "mtime.h"
#include "modules.h"
#include "intf_msg.h" /* intf_DbgMsg(), intf_ErrMsg() */
#include "audio_output.h"
#include "modules.h"
#include "modules_export.h"
#include "stream_control.h"
#include "input_ext-dec.h"
#include "audio_output.h"
#include "input_ext-intf.h" /* MPEG?_AUDIO_ES */
#include "ac3_imdct.h"
#include "ac3_downmix.h"
#include "ac3_decoder.h"
#include "ac3_decoder_thread.h"
#include "ac3_adec.h"
#define AC3DEC_FRAME_SIZE (2*1536)
/*****************************************************************************
* Local prototypes
*****************************************************************************/
static int InitThread (ac3dec_thread_t * p_adec);
static void RunThread (ac3dec_thread_t * p_adec);
static void ErrorThread (ac3dec_thread_t * p_adec);
static void EndThread (ac3dec_thread_t * p_adec);
static void BitstreamCallback ( bit_stream_t *p_bit_stream,
static int ac3_adec_Probe ( probedata_t * );
static int ac3_adec_Run ( decoder_config_t * );
static int ac3_adec_Init (ac3dec_thread_t * p_adec);
static void ac3_adec_ErrorThread (ac3dec_thread_t * p_adec);
static void ac3_adec_EndThread (ac3dec_thread_t * p_adec);
static void BitstreamCallback ( bit_stream_t *p_bit_stream,
boolean_t b_new_pes );
/*****************************************************************************
* ac3dec_CreateThread: creates an ac3 decoder thread
* Capabilities
*****************************************************************************/
void _M( adec_getfunctions )( function_list_t * p_function_list )
{
p_function_list->pf_probe = ac3_adec_Probe;
p_function_list->functions.dec.pf_RunThread = ac3_adec_Run;
}
/*****************************************************************************
* Build configuration tree.
*****************************************************************************/
MODULE_CONFIG_START
ADD_WINDOW( "Configuration for ac3 decoder module" )
ADD_COMMENT( "Nothing to configure" )
MODULE_CONFIG_STOP
MODULE_INIT_START
p_module->i_capabilities = MODULE_CAPABILITY_DEC;
p_module->psz_longname = "Ac3 sofware decoder";
MODULE_INIT_STOP
MODULE_ACTIVATE_START
_M( adec_getfunctions )( &p_module->p_functions->dec );
MODULE_ACTIVATE_STOP
MODULE_DEACTIVATE_START
MODULE_DEACTIVATE_STOP
/*****************************************************************************
* ac3_adec_Probe: probe the decoder and return score
*****************************************************************************
* Tries to launch a decoder and return score so that the interface is able
* to chose.
*****************************************************************************/
static int ac3_adec_Probe( probedata_t *p_data )
{
if( p_data->i_type == AC3_AUDIO_ES )
return( 50 );
else
return( 0 );
}
/*****************************************************************************
* ac3_adec_Run: this function is called just after the thread is created
*****************************************************************************/
vlc_thread_t ac3dec_CreateThread( adec_config_t * p_config )
static int ac3_adec_Run ( decoder_config_t * p_config )
{
ac3dec_thread_t * p_ac3thread;
int sync;
intf_DbgMsg( "ac3dec debug: creating ac3 decoder thread" );
intf_DbgMsg( "ac3_adec debug: ac3_adec thread launched, initializing" );
/* Allocate the memory needed to store the thread's structure */
p_ac3thread = (ac3dec_thread_t *)memalign(16, sizeof(ac3dec_thread_t));
......@@ -87,15 +137,110 @@ vlc_thread_t ac3dec_CreateThread( adec_config_t * p_config )