diff --git a/AUTHORS b/AUTHORS index d1ae239d57..c81a62d535 100644 --- a/AUTHORS +++ b/AUTHORS @@ -48,7 +48,8 @@ E: gbazin@netcourrier.com C: gbazin D: mingw32 port, various win32 fixes D: DirectX audio and video output, win32 WaveOut audio output -D: a52 decoder using liba52 +D: a52 decoder using liba52 and vorbis decoder using libvorbis +D: ogg demultiplexer D: Configuration file infrastructure S: France diff --git a/MAINTAINERS b/MAINTAINERS index a5aa1d7042..7b351bb1fa 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1,4 +1,4 @@ -# $Id: MAINTAINERS,v 1.2 2002/08/16 14:30:39 bozo Exp $ +# $Id: MAINTAINERS,v 1.3 2002/10/23 23:17:45 gbazin Exp $ # # VLC MAINTAINERS # @@ -79,7 +79,7 @@ - AC3 SPDIF : [stef] - A/52 : [gibalou] ([meuuh]) - SPU : [sam] - - Ogg/Vorbis : Xavier Maillard + - Ogg/Vorbis : [gibalou] * DOCUMENTATION diff --git a/STATUS b/STATUS index c212a87e47..205670f6eb 100644 --- a/STATUS +++ b/STATUS @@ -1,4 +1,4 @@ -# $Id: STATUS,v 1.4 2002/08/16 14:30:39 bozo Exp $ +# $Id: STATUS,v 1.5 2002/10/23 23:17:45 gbazin Exp $ # # VLC STATUS # @@ -46,8 +46,6 @@ Jon Lech Johansen : Xavier Maillard : - Xinerama fullscreen support ETA : completed - - Ogg/Vorbis decoder plug-in - ETA : soon Christophe Massiot : - Audio output 3 diff --git a/TODO b/TODO index 2e0c39738f..c246e7f3d0 100644 --- a/TODO +++ b/TODO @@ -478,7 +478,7 @@ Description: Ogg/Vorbis audio decoder support The Ogg/Vorbis audio format is a free alternative to the patent-encumbered MP3 format. The system packets are quite different than the MPEG ones, so adding support for it would require a lot of code rewrite. -Status: In the works (Xavier Maillard) +Status: Done 24 Nov 2002 (gbazin) Task: 0x23 Difficulty: Guru diff --git a/configure.ac.in b/configure.ac.in index f370769c66..672a590071 100644 --- a/configure.ac.in +++ b/configure.ac.in @@ -1071,6 +1071,19 @@ then PLUGINS="${PLUGINS} aac" fi +dnl +dnl ogg plugin +dnl +AC_ARG_ENABLE(ogg, + [ --enable-ogg Ogg demux support (default enabled)]) +if test "x${enable_ogg}" != "xno" +then + AC_CHECK_HEADERS(ogg/ogg.h, [ + PLUGINS="${PLUGINS} ogg" + LDFLAGS_ogg="${LDFLAGS_ogg} -logg" + ],[]) +fi + dnl dnl Codec plugins dnl @@ -1355,20 +1368,6 @@ then PLUGINS="${PLUGINS} cinepak" fi -dnl -dnl ogg vorbis plugin -dnl -AC_ARG_ENABLE(vorbis, - [ --enable-vorbis Ogg/Vorbis decoder support (default enabled)]) -if test "x${enable_vorbis}" != "xno" -then - AC_CHECK_HEADERS(ogg/ogg.h, [ - dnl disabled for the moment - #PLUGINS="${PLUGINS} ogg vorbis" - LDFLAGS_vorbis="${LDFLAGS_vorbis} -lvorbis" - ],[]) -fi - dnl dnl DV plugin dnl @@ -1382,6 +1381,19 @@ then ],[]) fi +dnl +dnl Vorbis plugin +dnl +AC_ARG_ENABLE(vorbis, + [ --enable-vorbis Vorbis decoder support (default enabled)]) +if test "x${enable_vorbis}" != "xno" +then + AC_CHECK_HEADERS(vorbis/codec.h, [ + PLUGINS="${PLUGINS} vorbis" + LDFLAGS_vorbis="${LDFLAGS_vorbis} -lvorbis" + ],[]) +fi + dnl dnl Video plugins dnl diff --git a/include/input_ext-dec.h b/include/input_ext-dec.h index 73434d04b8..80336c84d3 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.72 2002/10/21 10:46:34 fenrir Exp $ + * $Id: input_ext-dec.h,v 1.73 2002/10/23 23:17:45 gbazin Exp $ * * Authors: Christophe Massiot * Michel Kaempf @@ -209,6 +209,8 @@ struct bit_stream_t *****************************************************************************/ VLC_EXPORT( void, InitBitstream, ( bit_stream_t *, decoder_fifo_t *, void ( * )( bit_stream_t *, vlc_bool_t ), void * p_callback_arg ) ); VLC_EXPORT( vlc_bool_t, NextDataPacket, ( decoder_fifo_t *, data_packet_t ** ) ); +VLC_EXPORT( pes_packet_t *, GetPES, ( decoder_fifo_t * ) ); +VLC_EXPORT( pes_packet_t *, NextPES, ( decoder_fifo_t * ) ); VLC_EXPORT( void, BitstreamNextDataPacket, ( bit_stream_t * ) ); VLC_EXPORT( u32, UnalignedShowBits, ( bit_stream_t *, unsigned int ) ); VLC_EXPORT( void, UnalignedRemoveBits, ( bit_stream_t * ) ); diff --git a/modules/LIST b/modules/LIST index ab7c495e73..c10f0255d1 100644 --- a/modules/LIST +++ b/modules/LIST @@ -1,5 +1,5 @@ List of vlc plugins -$Id: LIST,v 1.2 2002/09/15 20:54:12 jpsaman Exp $ +$Id: LIST,v 1.3 2002/10/23 23:17:45 gbazin Exp $ * a52_system: input module for A52 decapsulation. @@ -125,6 +125,8 @@ $Id: LIST,v 1.2 2002/09/15 20:54:12 jpsaman Exp $ * null: a module with no capabilities. + * ogg: input module for OGG decapsulation. + * qt: interface module using the Qt widget set. * qte: video output module for Qt Embedded. @@ -137,6 +139,8 @@ $Id: LIST,v 1.2 2002/09/15 20:54:12 jpsaman Exp $ * vcd: input module for accessing Video CDs. + * vorbis: a vorbis audio decoder using the libvorbis library. + * waveout: simple audio output module for Windows. * x11: video output module using the X11 API. diff --git a/modules/codec/Modules.am b/modules/codec/Modules.am index 011cd67635..a84b054d5a 100644 --- a/modules/codec/Modules.am +++ b/modules/codec/Modules.am @@ -1,3 +1,4 @@ SOURCES_a52 = modules/codec/a52.c SOURCES_lpcm = modules/codec/lpcm.c SOURCES_araw = modules/codec/araw.c +SOURCES_vorbis = modules/codec/vorbis.c diff --git a/modules/demux/Modules.am b/modules/demux/Modules.am index 4bf20a5020..de15b39ec0 100644 --- a/modules/demux/Modules.am +++ b/modules/demux/Modules.am @@ -1 +1,2 @@ SOURCES_a52sys = modules/demux/a52sys.c +SOURCES_ogg = modules/demux/ogg.c diff --git a/src/input/input_ext-dec.c b/src/input/input_ext-dec.c index bd40554f81..0a0cbb6108 100644 --- a/src/input/input_ext-dec.c +++ b/src/input/input_ext-dec.c @@ -2,7 +2,7 @@ * input_ext-dec.c: services to the decoders ***************************************************************************** * Copyright (C) 1998-2001 VideoLAN - * $Id: input_ext-dec.c,v 1.35 2002/10/21 10:46:34 fenrir Exp $ + * $Id: input_ext-dec.c,v 1.36 2002/10/23 23:17:44 gbazin Exp $ * * Authors: Christophe Massiot * @@ -110,6 +110,73 @@ void DecoderError( decoder_fifo_t * p_fifo ) vlc_mutex_unlock (&p_fifo->data_lock); } +/***************************************************************************** + * GetPES: return the first PES from the fifo + *****************************************************************************/ +static inline pes_packet_t *_GetPES( decoder_fifo_t * p_fifo ) +{ + pes_packet_t * p_pes; + + vlc_mutex_lock( &p_fifo->data_lock ); + + if( p_fifo->p_first == NULL ) + { + /* No PES in the FIFO. p_last is no longer valid. */ + p_fifo->pp_last = &p_fifo->p_first; + + if( p_fifo->b_die ) + { + vlc_mutex_unlock( &p_fifo->data_lock ); + return NULL; + } + + /* Signal the input thread we're waiting. This is only + * needed in case of slave clock (ES plug-in) but it won't + * harm. */ + vlc_cond_signal( &p_fifo->data_wait ); + + /* Wait for the input to tell us when we receive a packet. */ + vlc_cond_wait( &p_fifo->data_wait, &p_fifo->data_lock ); + } + + p_pes = p_fifo->p_first; + + vlc_mutex_unlock( &p_fifo->data_lock ); + + return p_pes; +} + +pes_packet_t * GetPES( decoder_fifo_t * p_fifo ) +{ + return( _GetPES( p_fifo ) ); +} + +/***************************************************************************** + * NextPES: free the current PES and return the next one + *****************************************************************************/ +static inline pes_packet_t * _NextPES( decoder_fifo_t * p_fifo ) +{ + pes_packet_t * p_next; + + vlc_mutex_lock( &p_fifo->data_lock ); + + /* Free the previous PES packet. */ + p_next = p_fifo->p_first->p_next; + p_fifo->p_first->p_next = NULL; + input_DeletePES( p_fifo->p_packets_mgt, p_fifo->p_first ); + p_fifo->p_first = p_next; + p_fifo->i_depth--; + + vlc_mutex_unlock( &p_fifo->data_lock ); + + return _GetPES( p_fifo ); +} + +pes_packet_t * NextPES( decoder_fifo_t * p_fifo ) +{ + return( _NextPES( p_fifo ) ); +} + /***************************************************************************** * NextDataPacket: go to the data packet after *pp_data, return 1 if we * changed PES @@ -127,35 +194,8 @@ static inline vlc_bool_t _NextDataPacket( decoder_fifo_t * p_fifo, * time to jump to the next PES packet */ if( (*pp_data)->p_next == NULL ) { - pes_packet_t * p_next; - - vlc_mutex_lock( &p_fifo->data_lock ); - - /* Free the previous PES packet. */ - p_next = p_fifo->p_first->p_next; - p_fifo->p_first->p_next = NULL; - input_DeletePES( p_fifo->p_packets_mgt, p_fifo->p_first ); - p_fifo->p_first = p_next; - p_fifo->i_depth--; - - if( p_fifo->p_first == NULL ) - { - /* No PES in the FIFO. p_last is no longer valid. */ - p_fifo->pp_last = &p_fifo->p_first; - - /* Signal the input thread we're waiting. This is only - * needed in case of slave clock (ES plug-in) but it won't - * harm. */ - vlc_cond_signal( &p_fifo->data_wait ); - - /* Wait for the input to tell us when we receive a packet. */ - vlc_cond_wait( &p_fifo->data_wait, &p_fifo->data_lock ); - } - /* The next packet could be found in the next PES packet */ - *pp_data = p_fifo->p_first->p_first; - - vlc_mutex_unlock( &p_fifo->data_lock ); + *pp_data = (_NextPES( p_fifo ))->p_first; b_new_pes = 1; }