Commit dd9e6708 authored by Gildas Bazin's avatar Gildas Bazin

* configure.ac, modules/codec/Modules.am, modules/codec/speex.c: new speex decoder and packetizer using libspeex.
* modules/demux/ogg.c: added support for speex to the Ogg demuxer.
* modules/mux/ogg.c: added support for speex to the Ogg muxer.
* src/misc/variables.c: when creating choices object variables with inheritance enabled, automatically add the inherited value to the list of choices.
* modules/access/udp.c: use an object variable and inheritance for "udp-caching".
* src/input/input.c: disable the hack for filenames with colons on win32 because filenames can't contain colons.
parent c106f23b
dnl Autoconf settings for vlc
dnl $Id: configure.ac,v 1.89 2003/10/21 17:31:36 gbazin Exp $
dnl $Id: configure.ac,v 1.90 2003/10/22 17:12:30 gbazin Exp $
AC_INIT(vlc,0.6.3-cvs)
......@@ -2035,6 +2035,18 @@ then
],[])
fi
dnl
dnl Speex plugin
dnl
AC_ARG_ENABLE(speex,
[ --enable-speex Speex decoder support (default enabled)])
if test "${enable_speex}" != "no"
then
AC_CHECK_HEADERS(speex.h, [
AX_ADD_PLUGINS([speex])
AX_ADD_LDFLAGS([speex],[-lspeex]) ],[])
fi
dnl
dnl tarkin decoder plugin
dnl
......
......@@ -2,7 +2,7 @@
* udp.c: raw UDP & RTP access plug-in
*****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN
* $Id: udp.c,v 1.22 2003/08/24 16:59:35 hartman Exp $
* $Id: udp.c,v 1.23 2003/10/22 17:12:30 gbazin Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Tristan Leteurtre <tooney@via.ecp.fr>
......@@ -106,6 +106,7 @@ static int Open( vlc_object_t *p_this )
char * psz_bind_port = "";
int i_bind_port = 0, i_server_port = 0;
network_socket_t socket_desc;
vlc_value_t val;
if( config_GetInt( p_input, "ipv4" ) )
{
......@@ -286,7 +287,9 @@ static int Open( vlc_object_t *p_this )
p_input->i_mtu = socket_desc.i_mtu;
/* Update default_pts to a suitable value for udp access */
p_input->i_pts_delay = config_GetInt( p_input, "udp-caching" ) * 1000;
var_Create( p_input, "udp-caching", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
var_Get( p_input, "udp-caching", &val );
p_input->i_pts_delay = val.i_int * 1000;
return( 0 );
}
......
......@@ -8,6 +8,7 @@ SOURCES_vorbis = vorbis.c
SOURCES_tarkin = tarkin.c
SOURCES_theora = theora.c
SOURCES_tremor = vorbis.c
SOURCES_speex = speex.c
SOURCES_dv = dv.c
SOURCES_xvid = xvid.c
SOURCES_adpcm = adpcm.c
......
This diff is collapsed.
......@@ -2,7 +2,7 @@
* ogg.c : ogg stream input module for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: ogg.c,v 1.39 2003/10/19 16:53:59 gbazin Exp $
* $Id: ogg.c,v 1.40 2003/10/22 17:12:30 gbazin Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
......@@ -356,6 +356,7 @@ static void Ogg_DecodePacket( input_thread_t *p_input,
switch( p_stream->i_fourcc )
{
case VLC_FOURCC( 'v','o','r','b' ):
case VLC_FOURCC( 's','p','x',' ' ):
case VLC_FOURCC( 't','h','e','o' ):
if( p_stream->i_packets_backup == 3 ) p_stream->b_force_backup = 0;
break;
......@@ -398,7 +399,8 @@ static void Ogg_DecodePacket( input_thread_t *p_input,
vlc_mutex_unlock( &p_input->stream.control.control_lock );
/* Convert the pcr into a pts */
if( p_stream->i_fourcc == VLC_FOURCC( 'v','o','r','b' ) )
if( p_stream->i_fourcc == VLC_FOURCC( 'v','o','r','b' ) ||
p_stream->i_fourcc == VLC_FOURCC( 's','p','x',' ' ) )
{
if( p_stream->i_pcr >= 0 )
{
......@@ -484,6 +486,7 @@ static void Ogg_DecodePacket( input_thread_t *p_input,
if( p_stream->i_cat == SPU_ES ) p_pes->i_dts = 0;
if( p_stream->i_fourcc != VLC_FOURCC( 'v','o','r','b' ) &&
p_stream->i_fourcc != VLC_FOURCC( 's','p','x',' ' ) &&
p_stream->i_fourcc != VLC_FOURCC( 't','a','r','k' ) &&
p_stream->i_fourcc != VLC_FOURCC( 't','h','e','o' ) )
{
......@@ -602,6 +605,49 @@ static int Ogg_FindLogicalStreams( input_thread_t *p_input, demux_sys_t *p_ogg)
p_stream->i_bitrate );
}
}
/* Check for Speex header */
if( oggpacket.bytes >= 7 &&
! strncmp( &oggpacket.packet[0], "Speex", 5 ) )
{
oggpack_buffer opb;
p_stream->i_cat = AUDIO_ES;
p_stream->i_fourcc = VLC_FOURCC( 's','p','x',' ' );
/* Signal that we want to keep a backup of the vorbis
* stream headers. They will be used when switching between
* audio streams. */
p_stream->b_force_backup = 1;
/* Cheat and get additionnal info ;) */
oggpack_readinit( &opb, oggpacket.packet, oggpacket.bytes);
oggpack_adv( &opb, 224 );
oggpack_adv( &opb, 32 ); /* speex_version_id */
oggpack_adv( &opb, 32 ); /* header_size */
p_stream->f_rate = oggpack_read( &opb, 32 );
oggpack_adv( &opb, 32 ); /* mode */
oggpack_adv( &opb, 32 ); /* mode_bitstream_version */
p_stream->i_channels = oggpack_read( &opb, 32 );
p_stream->i_bitrate = oggpack_read( &opb, 32 );
{
char title[sizeof("Stream") + 10];
input_info_category_t *p_cat;
sprintf( title, "Stream %d", p_ogg->i_streams );
p_cat = input_InfoCategory( p_input, title );
input_AddInfo( p_cat, _("Type"), _("Audio") );
input_AddInfo( p_cat, _("Codec"), _("Speex") );
input_AddInfo( p_cat, _("Sample Rate"), "%f",
p_stream->f_rate );
input_AddInfo( p_cat, _("Channels"), "%d",
p_stream->i_channels );
input_AddInfo( p_cat, _("Bit Rate"), "%d",
p_stream->i_bitrate );
msg_Dbg( p_input, "found speex header, channels: %i, "
"rate: %i, bitrate: %i",
p_stream->i_channels,
(int)p_stream->f_rate, p_stream->i_bitrate );
}
}
/* Check for Theora header */
else if( oggpacket.bytes >= 7 &&
! strncmp( &oggpacket.packet[1], "theora", 6 ) )
......@@ -1489,7 +1535,8 @@ static int Demux( input_thread_t * p_input )
}
/* An Ogg/vorbis packet contains an end date granulepos */
if( p_stream->i_fourcc == VLC_FOURCC( 'v','o','r','b' ) )
if( p_stream->i_fourcc == VLC_FOURCC( 'v','o','r','b' ) ||
p_stream->i_fourcc == VLC_FOURCC( 's','p','x',' ' ) )
{
if( ogg_stream_packetout( &p_stream->os, &oggpacket ) > 0 )
{
......
......@@ -2,7 +2,7 @@
* ogg.c: ogg muxer module for vlc
*****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN
* $Id: ogg.c,v 1.18 2003/10/10 17:09:42 gbazin Exp $
* $Id: ogg.c,v 1.19 2003/10/22 17:12:30 gbazin Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Gildas Bazin <gbazin@netcourrier.com>
......@@ -422,6 +422,10 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
msg_Dbg( p_mux, "vorbis stream" );
break;
case VLC_FOURCC( 's', 'p', 'x', ' ' ):
msg_Dbg( p_mux, "speex stream" );
break;
default:
FREE( p_input->p_sys );
return( VLC_EGENERIC );
......@@ -595,12 +599,13 @@ static sout_buffer_t *OggCreateHeader( sout_mux_t *p_mux, mtime_t i_dts )
p_stream->i_packet_no = 0;
if( p_stream->i_fourcc == VLC_FOURCC( 'v', 'o', 'r', 'b' ) ||
p_stream->i_fourcc == VLC_FOURCC( 's', 'p', 'x', ' ' ) ||
p_stream->i_fourcc == VLC_FOURCC( 't', 'h', 'e', 'o' ) )
{
/* Special case, headers are already there in the
* incoming stream or we backed them up earlier */
/* first packet in order: vorbis/theora info */
/* first packet in order: vorbis/speex/theora info */
if( !p_stream->i_sout_headers )
{
p_og = sout_FifoGet( p_mux->pp_inputs[i]->p_fifo );
......@@ -655,6 +660,7 @@ static sout_buffer_t *OggCreateHeader( sout_mux_t *p_mux, mtime_t i_dts )
ogg_stream_t *p_stream = (ogg_stream_t*)p_mux->pp_inputs[i]->p_sys;
if( p_stream->i_fourcc == VLC_FOURCC( 'v', 'o', 'r', 'b' ) ||
p_stream->i_fourcc == VLC_FOURCC( 's', 'p', 'x', ' ' ) ||
p_stream->i_fourcc == VLC_FOURCC( 't', 'h', 'e', 'o' ) )
{
/* Special case, headers are already there in the incoming stream.
......@@ -860,6 +866,7 @@ static int Mux( sout_mux_t *p_mux )
p_data = sout_FifoGet( p_input->p_fifo );
if( p_stream->i_fourcc != VLC_FOURCC( 'v', 'o', 'r', 'b' ) &&
p_stream->i_fourcc != VLC_FOURCC( 's', 'p', 'x', ' ' ) &&
p_stream->i_fourcc != VLC_FOURCC( 't', 'h', 'e', 'o' ) )
{
sout_BufferReallocFromPreHeader( p_mux->p_sout, p_data, 1 );
......@@ -874,7 +881,8 @@ static int Mux( sout_mux_t *p_mux )
if( p_stream->i_cat == AUDIO_ES )
{
if( p_stream->i_fourcc == VLC_FOURCC( 'v', 'o', 'r', 'b' ) )
if( p_stream->i_fourcc == VLC_FOURCC( 'v', 'o', 'r', 'b' ) ||
p_stream->i_fourcc == VLC_FOURCC( 's', 'p', 'x', ' ' ) )
{
/* number of sample from begining + current packet */
op.granulepos =
......@@ -908,9 +916,11 @@ static int Mux( sout_mux_t *p_mux )
ogg_stream_packetin( &p_stream->os, &op );
if( p_stream->i_cat == SPU_ES )
if( p_stream->i_cat == SPU_ES ||
p_stream->i_fourcc == VLC_FOURCC( 's', 'p', 'x', ' ' ) )
{
/* Subtitles need to be flushed to be sent on time */
/* Subtitles or Speex packets are quite small so they
* need to be flushed to be sent on time */
sout_BufferChain( &p_og, OggStreamFlush( p_mux, &p_stream->os,
p_data->i_dts ) );
}
......
......@@ -4,7 +4,7 @@
* decoders.
*****************************************************************************
* Copyright (C) 1998-2002 VideoLAN
* $Id: input.c,v 1.248 2003/10/20 00:01:06 hartman Exp $
* $Id: input.c,v 1.249 2003/10/22 17:12:31 gbazin Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -627,11 +627,13 @@ static int InitThread( input_thread_t * p_input )
p_input->p_access = module_Need( p_input, "access",
p_input->psz_access );
#ifndef WIN32 /* Remove this gross hack from the win32 build as colons
* are forbidden in filenames on Win32. */
/* Maybe we got something like: /Volumes/toto:titi/gabu.mpg */
if ( p_input->p_access == NULL
&& (*p_input->psz_demux || *p_input->psz_access) )
{
/* Maybe we got something like :
* /Volumes/toto:titi/gabu.mpg */
p_input->psz_access = p_input->psz_demux = "";
p_input->psz_name = p_input->psz_source;
free( p_input->psz_dupsource);
......@@ -640,6 +642,7 @@ static int InitThread( input_thread_t * p_input )
p_input->p_access = module_Need( p_input, "access",
p_input->psz_access );
}
#endif
if( p_input->p_access == NULL )
{
......
......@@ -2,7 +2,7 @@
* variables.c: routines for object variables handling
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: variables.c,v 1.31 2003/09/29 15:45:19 sigmunau Exp $
* $Id: variables.c,v 1.32 2003/10/22 17:12:31 gbazin Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -271,10 +271,21 @@ int __var_Create( vlc_object_t *p_this, const char *psz_name, int i_type )
{
/* Free data if needed */
p_var->pf_free( &p_var->val );
/* Check boundaries and list */
CheckValue( p_var, &val );
/* Set the variable */
p_var->val = val;
if( i_type & VLC_VAR_HASCHOICE )
{
/* We must add the inherited value to our choice list */
p_var->i_default = 0;
INSERT_ELEM( p_var->choices.p_values, p_var->choices.i_count,
0, val );
INSERT_ELEM( p_var->choices_text.p_values,
p_var->choices_text.i_count, 0, val );
p_var->pf_dup( &p_var->choices.p_values[0] );
p_var->choices_text.p_values[0].psz_string = NULL;
}
}
}
......@@ -1173,7 +1184,6 @@ static int InheritValue( vlc_object_t *p_this, const char *psz_name,
if( i_var >= 0 )
{
/* We found it! */
p_var = &p_this->p_parent->p_vars[i_var];
/* Really get the variable */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment