diff --git a/MODULES b/MODULES index 29a8edb69b4ec1dda4400ed8342da6aa8b8914f6..7b855b895d7cb24520ce5b9641fe228990678179 100644 --- a/MODULES +++ b/MODULES @@ -1,5 +1,7 @@ List of vlc plugins -$Id: MODULES,v 1.3 2002/01/30 00:09:49 sam Exp $ +$Id: MODULES,v 1.4 2002/06/02 23:43:38 bozo Exp $ + + * a52_system: input module for A52 decapsulation. * ac3_adec: software AC3 decoder. diff --git a/Makefile b/Makefile index 48a533df0d106e5bbdb63887a8e85b57705bdf6d..9a542c4449da3283aceddc747c80ae982168bcfe 100644 --- a/Makefile +++ b/Makefile @@ -17,6 +17,7 @@ endif # All possible plugin directories, needed for make clean # PLUGINS_DIR := a52 \ + a52_system \ aa \ ac3_adec \ ac3_spdif \ @@ -67,6 +68,7 @@ PLUGINS_DIR := a52 \ PLUGINS_TARGETS := a52/a52 \ aa/aa \ + a52_system/a52_system \ ac3_adec/ac3_adec \ ac3_spdif/ac3_spdif \ access/file \ diff --git a/configure b/configure index a74585648825ecc83e7f92d87a62b11f40c86360..57023eb2e0566f5c739d09568c22900387f39201 100755 --- a/configure +++ b/configure @@ -5472,7 +5472,7 @@ case x"${target_cpu}" in esac BUILTINS="${BUILTINS} idct idctclassic motion imdct downmix mpeg_adec ac3_adec mpeg_vdec" -PLUGINS="${PLUGINS} dummy null rc logger mpeg_es mpeg_audio mpeg_ps mpeg_ts file udp http ipv4 memcpy lpcm_adec ac3_spdif spudec filter_deinterlace filter_invert filter_wall filter_transform filter_distort filter_clone filter_crop fx_scope chroma_i420_rgb chroma_i420_yuy2 chroma_i422_yuy2 chroma_i420_ymga" +PLUGINS="${PLUGINS} dummy null rc logger mpeg_es mpeg_audio mpeg_ps mpeg_ts file udp http a52_system ipv4 memcpy lpcm_adec ac3_spdif spudec filter_deinterlace filter_invert filter_wall filter_transform filter_distort filter_clone filter_crop fx_scope chroma_i420_rgb chroma_i420_yuy2 chroma_i422_yuy2 chroma_i420_ymga" MMX_MODULES="memcpymmx idctmmx motionmmx chroma_i420_rgb_mmx chroma_i420_yuy2_mmx chroma_i422_yuy2_mmx chroma_i420_ymga_mmx" MMXEXT_MODULES="memcpymmxext idctmmxext motionmmxext" diff --git a/configure.in b/configure.in index a01e64b2b1747736b39813be23a568d499e27e5e..2a9a8ceec4b69d7a5f010cc6b247421d15aa3425 100644 --- a/configure.in +++ b/configure.in @@ -413,7 +413,7 @@ dnl dnl default modules dnl BUILTINS="${BUILTINS} idct idctclassic motion imdct downmix mpeg_adec ac3_adec mpeg_vdec" -PLUGINS="${PLUGINS} dummy null rc logger mpeg_es mpeg_audio mpeg_ps mpeg_ts file udp http ipv4 memcpy lpcm_adec ac3_spdif spudec filter_deinterlace filter_invert filter_wall filter_transform filter_distort filter_clone filter_crop fx_scope chroma_i420_rgb chroma_i420_yuy2 chroma_i422_yuy2 chroma_i420_ymga" +PLUGINS="${PLUGINS} dummy null rc logger mpeg_es mpeg_audio mpeg_ps mpeg_ts file udp http a52_system ipv4 memcpy lpcm_adec ac3_spdif spudec filter_deinterlace filter_invert filter_wall filter_transform filter_distort filter_clone filter_crop fx_scope chroma_i420_rgb chroma_i420_yuy2 chroma_i422_yuy2 chroma_i420_ymga" dnl dnl Accelerated modules diff --git a/plugins/a52_system/Makefile b/plugins/a52_system/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..baad11ddb985d719f0cd8ee06fbcf850ae37f393 --- /dev/null +++ b/plugins/a52_system/Makefile @@ -0,0 +1,2 @@ +a52_system_SOURCES = a52_system.c + diff --git a/plugins/a52_system/a52_system.c b/plugins/a52_system/a52_system.c new file mode 100644 index 0000000000000000000000000000000000000000..4df18fadf812831f49e648b5b6e59361ed44e3be --- /dev/null +++ b/plugins/a52_system/a52_system.c @@ -0,0 +1,207 @@ +/***************************************************************************** + * a52_system.c : A52 input module for vlc + ***************************************************************************** + * Copyright (C) 2001 VideoLAN + * $Id: a52_system.c,v 1.1 2002/06/02 23:43:38 bozo Exp $ + * + * Authors: Arnaud de Bossoreille de Ribou + * + * 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 /* malloc(), free() */ +#include /* strdup() */ +#include + +#include +#include + +#include + +/***************************************************************************** + * Constants + *****************************************************************************/ +#define A52_PACKET_SIZE 16384 +#define MAX_PACKETS_IN_FIFO 3 + +/***************************************************************************** + * Local prototypes + *****************************************************************************/ +static void input_getfunctions( function_list_t * p_function_list ); +static int Demux ( struct input_thread_s * ); +static int Init ( struct input_thread_s * ); +static void End ( struct input_thread_s * ); + + +/***************************************************************************** + * Build configuration tree. + *****************************************************************************/ +MODULE_CONFIG_START +MODULE_CONFIG_STOP + +MODULE_INIT_START + SET_DESCRIPTION( _("A52 input") ) + ADD_CAPABILITY( DEMUX, 150 ) + ADD_SHORTCUT( "a52sys" ) +MODULE_INIT_STOP + +MODULE_ACTIVATE_START + input_getfunctions( &p_module->p_functions->demux ); +MODULE_ACTIVATE_STOP + +MODULE_DEACTIVATE_START +MODULE_DEACTIVATE_STOP + +/***************************************************************************** + * Functions exported as capabilities. They are declared as static so that + * we don't pollute the namespace too much. + *****************************************************************************/ +static void input_getfunctions( function_list_t * p_function_list ) +{ +#define input p_function_list->functions.demux + input.pf_init = Init; + input.pf_end = End; + input.pf_demux = Demux; + input.pf_rewind = NULL; +#undef input +} + +/* + * Data reading functions + */ + +/***************************************************************************** + * Init: initializes ES structures + *****************************************************************************/ +static int Init( input_thread_t * p_input ) +{ + es_descriptor_t * p_es; + byte_t * p_peek; + + /* Initialize access plug-in structures. */ + if( p_input->i_mtu == 0 ) + { + /* Improve speed. */ + p_input->i_bufsize = INPUT_DEFAULT_BUFSIZE; + } + + /* Have a peep at the show. */ + if( input_Peek( p_input, &p_peek, 2 ) < 2 ) + { + /* Stream shorter than 4 bytes... */ + msg_Err( p_input, "cannot peek()" ); + return( -1 ); + } + + if( *p_peek != 0x0b || *(p_peek + 1) != 0x77 ) + { + if( *p_input->psz_demux && !strncmp( p_input->psz_demux, "a52sys", 3 ) ) + { + /* User forced */ + msg_Err( p_input, "this doesn't look like an a52 stream, continuing" ); + } + else + { + msg_Warn( p_input, "a52 module discarded (no startcode)" ); + return( -1 ); + } + } + + if( input_InitStream( p_input, 0 ) == -1 ) + { + return( -1 ); + } + input_AddProgram( p_input, 0, 0 ); + p_input->stream.p_selected_program = p_input->stream.pp_programs[0]; + vlc_mutex_lock( &p_input->stream.stream_lock ); + p_es = input_AddES( p_input, p_input->stream.p_selected_program, 0xBD, 0 ); + p_es->i_stream_id = 0xBD; + p_es->i_type = AC3_AUDIO_ES; + p_es->i_cat = AUDIO_ES; + input_SelectES( p_input, p_es ); + p_input->stream.p_selected_area->i_tell = 0; + p_input->stream.p_selected_program->b_is_ok = 1; + vlc_mutex_unlock( &p_input->stream.stream_lock ); + + return( 0 ); +} + +/***************************************************************************** + * End: frees unused data + *****************************************************************************/ +static void End( input_thread_t * p_input ) +{ +} + +/***************************************************************************** + * Demux: reads and demuxes data packets + ***************************************************************************** + * Returns -1 in case of error, 0 in case of EOF, 1 otherwise + *****************************************************************************/ +static int Demux( input_thread_t * p_input ) +{ + ssize_t i_read; + decoder_fifo_t * p_fifo = + p_input->stream.p_selected_program->pp_es[0]->p_decoder_fifo; + pes_packet_t * p_pes; + data_packet_t * p_data; + + i_read = input_SplitBuffer( p_input, &p_data, A52_PACKET_SIZE ); + + if ( i_read <= 0 ) + { + return( i_read ); + } + + p_pes = input_NewPES( p_input->p_method_data ); + + if( p_pes == NULL ) + { + msg_Err( p_input, "out of memory" ); + input_DeletePacket( p_input->p_method_data, p_data ); + return( -1 ); + } + + p_pes->i_rate = p_input->stream.control.i_rate; + p_pes->p_first = p_pes->p_last = p_data; + p_pes->i_nb_data = 1; + + vlc_mutex_lock( &p_fifo->data_lock ); + if( p_fifo->i_depth >= MAX_PACKETS_IN_FIFO ) + { + /* Wait for the decoder. */ + vlc_cond_wait( &p_fifo->data_wait, &p_fifo->data_lock ); + } + vlc_mutex_unlock( &p_fifo->data_lock ); + + if( (p_input->stream.p_selected_program->i_synchro_state == SYNCHRO_REINIT) + |(p_input->stream.p_selected_program->i_synchro_state == SYNCHRO_START) + | (input_ClockManageControl( p_input, + p_input->stream.p_selected_program, + (mtime_t)0 ) == PAUSE_S) ) + { + msg_Warn( p_input, "synchro reinit" ); + p_pes->i_pts = mdate() + DEFAULT_PTS_DELAY; + p_input->stream.p_selected_program->i_synchro_state = SYNCHRO_OK; + } + + input_DecodePES( p_fifo, p_pes ); + + return( 1 ); +} + diff --git a/plugins/ac3_spdif/ac3_spdif.c b/plugins/ac3_spdif/ac3_spdif.c index 39cdaab2bbb3bda6f7273a73fee7f5d37e9a24f8..d42c0b5d5685eaef3754f1e88232b9c67580fa7b 100644 --- a/plugins/ac3_spdif/ac3_spdif.c +++ b/plugins/ac3_spdif/ac3_spdif.c @@ -2,7 +2,7 @@ * ac3_spdif.c: ac3 pass-through to external decoder with enabled soundcard ***************************************************************************** * Copyright (C) 2001 VideoLAN - * $Id: ac3_spdif.c,v 1.28 2002/06/01 18:04:48 sam Exp $ + * $Id: ac3_spdif.c,v 1.29 2002/06/02 23:43:38 bozo Exp $ * * Authors: Stéphane Borel * Juha Yrjola @@ -199,7 +199,10 @@ static int decoder_Run( decoder_fifo_t * p_fifo ) { i_current_pts += i_frame_time; } - + + // wait a little to avoid an input flood from the a52 input + mwait( i_current_pts - 500000 ); + vlc_mutex_lock (&p_spdif->p_aout_fifo->data_lock); p_spdif->p_aout_fifo->date[p_spdif->p_aout_fifo->i_end_frame] =