Commit 9a9f8a1e authored by Christophe Massiot's avatar Christophe Massiot

More S/PDIF fixes.

parent a29bce0b
This diff is collapsed.
......@@ -442,7 +442,8 @@ PLUGINS="${PLUGINS} misc/dummy/dummy misc/null/null"
PLUGINS="${PLUGINS} control/rc/rc misc/logger/logger access/file access/udp access/http misc/network/ipv4 misc/memcpy/memcpy"
PLUGINS="${PLUGINS} demux/mpeg/es demux/mpeg/audio demux/mpeg/mpeg_system demux/mpeg/ps demux/mpeg/ts"
PLUGINS="${PLUGINS} codec/mpeg_video/idct/idct codec/mpeg_video/idct/idctclassic codec/mpeg_video/motion/motion codec/mpeg_video/mpeg_video codec/spudec/spudec"
#PLUGINS="${PLUGINS} codec/a52old/imdct/imdct codec/a52old/downmix/downmix codec/mpeg_audio/mpeg_audio codec/a52old/a52old codec/lpcm/lpcm codec/spdif/spdif"
PLUGINS="${PLUGINS} codec/spdif"
#PLUGINS="${PLUGINS} codec/a52old/imdct/imdct codec/a52old/downmix/downmix codec/mpeg_audio/mpeg_audio codec/a52old/a52old codec/lpcm/lpcm"
PLUGINS="${PLUGINS} video_filter/deinterlace/deinterlace video_filter/invert video_filter/wall video_filter/transform video_filter/distort video_filter/clone video_filter/crop"
PLUGINS="${PLUGINS} audio_filter/converter/float32tos16"
PLUGINS="${PLUGINS} audio_filter/resampler/trivial"
......@@ -1155,7 +1156,7 @@ then
a52_LDFLAGS="${a52_LDFLAGS} -L${real_a52_tree}/liba52/.libs"
LDFLAGS="${save_LDFLAGS} ${a52_LDFLAGS}"
AC_CHECK_LIB(a52, a52_free, [
BUILTINS="${BUILTINS} codec/a52/a52"
BUILTINS="${BUILTINS} codec/a52"
a52_LDFLAGS="${a52_LDFLAGS} -la52 -lm"
a52_CFLAGS="${a52_CFLAGS} -DUSE_A52DEC_TREE"
],[
......@@ -1186,7 +1187,7 @@ then
LDFLAGS="${save_LDFLAGS} ${test_LDFLAGS}"
AC_CHECK_HEADERS(a52dec/a52.h, [
AC_CHECK_LIB(a52, a52_free, [
BUILTINS="${BUILTINS} codec/a52/a52"
BUILTINS="${BUILTINS} codec/a52"
a52_LDFLAGS="${a52_LDFLAGS} ${test_LDFLAGS} -la52 -lm"
a52_CFLAGS="${a52_CFLAGS} ${test_CFLAGS}"
],[
......
......@@ -129,12 +129,16 @@
#define VOLUME_MAX 1024
#define VOLUME_MIN 0
/* Max number of pre-filters per input, and max-number of post-filters */
/* Max number of pre-filters per input, and max number of post-filters */
#define AOUT_MAX_FILTERS 10
/* Max number of inputs */
#define AOUT_MAX_INPUTS 5
/* Buffers which arrive in advance of more than AOUT_MAX_PREPARE_TIME
* will cause the calling thread to sleep */
#define AOUT_MAX_PREPARE_TIME (mtime_t)(.5*CLOCK_FREQ)
/*****************************************************************************
* Video configuration
*****************************************************************************/
......
......@@ -2,7 +2,7 @@
* oss.c : OSS /dev/dsp module for vlc
*****************************************************************************
* Copyright (C) 2000-2002 VideoLAN
* $Id: oss.c,v 1.4 2002/08/09 23:47:23 massiot Exp $
* $Id: oss.c,v 1.5 2002/08/11 01:27:01 massiot Exp $
*
* Authors: Michel Kaempf <maxx@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
......@@ -293,39 +293,44 @@ static int OSSThread( aout_instance_t * p_aout )
int i_bytes_per_sample;
aout_buffer_t * p_buffer;
mtime_t next_date;
int i_tmp;
int i_tmp, i_size;
byte_t * p_bytes;
/* Get the presentation date of the next write() operation. It
* is equal to the current date + duration of buffered samples.
* Order is important here, since GetBufInfo is believed to take
* more time than mdate(). */
if( !p_sys->b_initialized )
{
msleep( THREAD_SLEEP );
continue;
}
i_bytes_per_sample = aout_FormatToSize( &p_aout->output.output, 1 );
next_date = (mtime_t)GetBufInfo( p_aout ) * 1000000
/ i_bytes_per_sample
/ p_aout->output.output.i_rate;
next_date += mdate();
if ( p_aout->output.output.i_format != AOUT_FMT_SPDIF )
{
/* Get the presentation date of the next write() operation. It
* is equal to the current date + duration of buffered samples.
* Order is important here, since GetBufInfo is believed to take
* more time than mdate(). */
next_date = (mtime_t)GetBufInfo( p_aout ) * 1000000
/ aout_FormatToByterate( &p_aout->output.output,
p_aout->output.output.i_rate );
next_date += mdate();
}
p_buffer = aout_OutputNextBuffer( p_aout, next_date );
if ( p_buffer != NULL )
{
p_bytes = p_buffer->p_buffer;
i_size = aout_FormatToSize( &p_aout->output.output,
p_buffer->i_nb_samples );
}
else
{
p_bytes = alloca( DEFAULT_FRAME_SIZE * i_bytes_per_sample );
memset( p_bytes, 0, DEFAULT_FRAME_SIZE * i_bytes_per_sample );
i_size = aout_FormatToSize( &p_aout->output.output,
DEFAULT_FRAME_SIZE );
p_bytes = alloca( i_size );
memset( p_bytes, 0, i_size );
}
i_tmp = write( p_sys->i_fd, p_bytes,
DEFAULT_FRAME_SIZE * i_bytes_per_sample );
i_tmp = write( p_sys->i_fd, p_bytes, i_size );
if( i_tmp < 0 )
{
......
/*****************************************************************************
* a52.h: ATSC A/52 aka AC-3 decoder plugin for vlc.
* This plugin makes use of liba52 to decode A/52 audio
* (http://liba52.sf.net/).
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: a52.h,v 1.2 2002/08/07 21:36:56 massiot Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
* 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.
*****************************************************************************/
/*****************************************************************************
* a52_thread_t : a52 decoder thread descriptor
*****************************************************************************/
typedef struct a52_thread_s
{
/*
* liba52 properties
*/
a52_state_t * p_a52_state;
vlc_bool_t b_dynrng;
/* The bit stream structure handles the PES stream at the bit level */
bit_stream_t bit_stream;
/*
* Input properties
*/
decoder_fifo_t * p_fifo; /* stores the PES stream data */
data_packet_t * p_data;
/*
* Output properties
*/
aout_instance_t * p_aout; /* opaque */
aout_input_t * p_aout_input; /* opaque */
audio_sample_format_t output_format;
mtime_t last_date;
} a52_thread_t;
/*****************************************************************************
* spdif.h: header for A52 pass-through
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: spdif.h,v 1.1 2002/08/04 17:23:42 sam Exp $
*
* Authors: Stéphane Borel <stef@via.ecp.fr>
*
* 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.
****************************************************************************/
/****************************************************************************
* information about A52 frame
****************************************************************************/
typedef struct sync_frame_s
{
struct syncinfo
{
u8 syncword[2];
u8 crc1[2];
u8 code;
} syncinfo;
struct bsi
{
u8 bsidmod;
u8 acmod;
} bsi;
} sync_frame_t;
typedef struct frame_size_s
{
u16 i_bit_rate;
u16 i_frame_size[3];
} frame_size_t;
typedef struct info_s
{
int i_bit_rate;
int i_frame_size;
int i_sample_rate;
int i_bs_mod;
} info_t;
/*****************************************************************************
* spdif_thread_t : A52 pass-through thread descriptor
*****************************************************************************/
typedef struct spdif_thread_s
{
/*
* Thread properties
*/
vlc_thread_t thread_id; /* id for thread functions */
/*
* Input properties
*/
decoder_fifo_t * p_fifo; /* stores the PES stream data */
/* The bit stream structure handles the PES stream at the bit level */
bit_stream_t bit_stream;
int i_available;
/*
* Decoder properties
*/
info_t info;
u8 * p_bytes;
/* current pes date */
mtime_t i_pts;
mtime_t i_real_pts;
/*
* Output properties
*/
int i_previous_format;
aout_fifo_t * p_aout_fifo; /* stores the decompressed audio frames */
} spdif_thread_t;
......@@ -2,7 +2,7 @@
* audio_output.c : audio output instance
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: audio_output.c,v 1.91 2002/08/09 23:47:23 massiot Exp $
* $Id: audio_output.c,v 1.92 2002/08/11 01:27:01 massiot Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -137,6 +137,9 @@ void aout_BufferPlay( aout_instance_t * p_aout, aout_input_t * p_input,
/ p_input->input.i_rate;
}
/* If the buffer is too early, wait a while. */
mwait( p_buffer->start_date - AOUT_MAX_PREPARE_TIME );
aout_InputPlay( p_aout, p_input, p_buffer );
/* Run the mixer if it is able to run. */
......
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