Commit 1c13a987 authored by Christophe Massiot's avatar Christophe Massiot

Big round of fixes in the aout3.

* Audio and video should now _always_ be perfectly in sync.
* Changes in a52.c (end_date management) must be ported to other codecs,
  otherwise mixer errors will appear.
* Audio output plug-in can now tell whether they can handle a little
  clock drift (for instance, inserting zeroes after a pause).
parent 692795dc
This diff is collapsed.
......@@ -449,6 +449,7 @@ PLUGINS="${PLUGINS} codec/a52old/imdct/imdct codec/a52old/downmix/downmix codec/
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 audio_filter/converter/float32tos8 audio_filter/converter/float32tou16 audio_filter/converter/float32tou8 audio_filter/converter/a52tospdif audio_filter/converter/fixed32tofloat32 audio_filter/converter/fixed32tos16 audio_filter/converter/s16tofloat32"
PLUGINS="${PLUGINS} audio_filter/resampler/trivial"
PLUGINS="${PLUGINS} audio_filter/channel_mixer/trivial"
PLUGINS="${PLUGINS} audio_mixer/trivial audio_mixer/spdif"
PLUGINS="${PLUGINS} audio_output/file"
#PLUGINS="${PLUGINS} visualization/scope/scope"
......
......@@ -2,7 +2,7 @@
* aout_internal.h : internal defines for audio output
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: aout_internal.h,v 1.7 2002/08/19 23:12:57 massiot Exp $
* $Id: aout_internal.h,v 1.8 2002/08/21 22:41:59 massiot Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -82,95 +82,11 @@ typedef struct aout_alloc_t
*****************************************************************************/
typedef struct aout_fifo_t
{
struct aout_buffer_t * p_first;
struct aout_buffer_t ** pp_last;
mtime_t end_date;
aout_buffer_t * p_first;
aout_buffer_t ** pp_last;
audio_date_t end_date;
} aout_fifo_t;
static inline void aout_FifoInit( struct aout_instance_t * p_aout,
aout_fifo_t * p_fifo )
{
p_fifo->p_first = NULL;
p_fifo->pp_last = &p_fifo->p_first;
p_fifo->end_date = 0;
}
static inline void aout_FifoPush( struct aout_instance_t * p_aout,
aout_fifo_t * p_fifo,
aout_buffer_t * p_buffer )
{
*p_fifo->pp_last = p_buffer;
p_fifo->pp_last = &p_buffer->p_next;
*p_fifo->pp_last = NULL;
/* Enforce continuity of the stream. */
if ( p_fifo->end_date )
{
mtime_t duration = p_buffer->end_date - p_buffer->start_date;
p_buffer->start_date = p_fifo->end_date;
p_buffer->end_date = p_fifo->end_date =
p_buffer->start_date + duration;
}
else
{
p_fifo->end_date = p_buffer->end_date;
}
}
static inline mtime_t aout_FifoNextStart( struct aout_instance_t * p_aout,
aout_fifo_t * p_fifo )
{
return p_fifo->end_date;
}
/* Reinit the end_date (for instance after a pause). */
static inline void aout_FifoSet( struct aout_instance_t * p_aout,
aout_fifo_t * p_fifo, mtime_t date )
{
aout_buffer_t * p_buffer;
p_fifo->end_date = date;
/* Remove all buffers. */
p_buffer = p_fifo->p_first;
while ( p_buffer != NULL )
{
aout_buffer_t * p_next = p_buffer->p_next;
aout_BufferFree( p_buffer );
p_buffer = p_next;
}
p_fifo->p_first = NULL;
p_fifo->pp_last = &p_fifo->p_first;
}
/* This function supposes there is at least one buffer in p_fifo. */
static inline aout_buffer_t * aout_FifoPop( struct aout_instance_t * p_aout,
aout_fifo_t * p_fifo )
{
aout_buffer_t * p_buffer;
p_buffer = p_fifo->p_first;
p_fifo->p_first = p_buffer->p_next;
if ( p_fifo->p_first == NULL )
{
p_fifo->pp_last = &p_fifo->p_first;
}
return p_buffer;
}
static inline void aout_FifoDestroy( struct aout_instance_t * p_aout,
aout_fifo_t * p_fifo )
{
aout_buffer_t * p_buffer;
p_buffer = p_fifo->p_first;
while ( p_buffer != NULL )
{
aout_buffer_t * p_next = p_buffer->p_next;
aout_BufferFree( p_buffer );
p_buffer = p_next;
}
}
/*****************************************************************************
* aout_filter_t : audio output filter
*****************************************************************************/
......@@ -297,3 +213,12 @@ void aout_OutputPlay( aout_instance_t * p_aout, aout_buffer_t * p_buffer );
void aout_OutputDelete( aout_instance_t * p_aout );
VLC_EXPORT( aout_buffer_t *, aout_OutputNextBuffer, ( aout_instance_t *, mtime_t, vlc_bool_t ) );
void aout_FormatPrepare( audio_sample_format_t * p_format );
void aout_FifoInit( aout_instance_t *, aout_fifo_t *, u32 );
mtime_t aout_FifoNextStart( aout_instance_t *, aout_fifo_t * );
void aout_FifoPush( aout_instance_t *, aout_fifo_t *, aout_buffer_t * );
void aout_FifoSet( aout_instance_t *, aout_fifo_t *, mtime_t );
void aout_FifoMoveDates( aout_instance_t *, aout_fifo_t *, mtime_t );
aout_buffer_t * aout_FifoPop( aout_instance_t * p_aout, aout_fifo_t * p_fifo );
void aout_FifoDestroy( aout_instance_t * p_aout, aout_fifo_t * p_fifo );
......@@ -2,7 +2,7 @@
* audio_output.h : audio output interface
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: audio_output.h,v 1.60 2002/08/19 21:31:11 massiot Exp $
* $Id: audio_output.h,v 1.61 2002/08/21 22:41:59 massiot Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -126,6 +126,16 @@ struct aout_buffer_t
/* Size of a frame for S/PDIF output. */
#define AOUT_SPDIF_SIZE 6144
/*****************************************************************************
* audio_date_t : date incrementation without long-term rounding errors
*****************************************************************************/
struct audio_date_t
{
mtime_t date;
u32 i_divider;
u32 i_remainder;
};
/*****************************************************************************
* Prototypes
*****************************************************************************/
......@@ -136,7 +146,11 @@ VLC_EXPORT( void, aout_DeleteInstance, ( aout_instance_t * ) );
VLC_EXPORT( aout_buffer_t *, aout_BufferNew, ( aout_instance_t *, aout_input_t *, size_t ) );
VLC_EXPORT( void, aout_BufferDelete, ( aout_instance_t *, aout_input_t *, aout_buffer_t * ) );
VLC_EXPORT( void, aout_BufferPlay, ( aout_instance_t *, aout_input_t *, aout_buffer_t * ) );
VLC_EXPORT( void, aout_FormatPrepare, ( audio_sample_format_t * p_format ) );
VLC_EXPORT( void, aout_DateInit, ( audio_date_t *, u32 ) );
VLC_EXPORT( void, aout_DateSet, ( audio_date_t *, mtime_t ) );
VLC_EXPORT( void, aout_DateMove, ( audio_date_t *, mtime_t ) );
VLC_EXPORT( mtime_t, aout_DateGet, ( const audio_date_t * ) );
VLC_EXPORT( mtime_t, aout_DateIncrement, ( audio_date_t *, u32 ) );
/* From input.c : */
#define aout_InputNew(a,b,c) __aout_InputNew(VLC_OBJECT(a),b,c)
......
......@@ -105,15 +105,15 @@
/* Duration between the time we receive the data packet, and the time we will
* mark it to be presented */
#define DEFAULT_PTS_DELAY (mtime_t)(.45*CLOCK_FREQ)
#define DEFAULT_PTS_DELAY (mtime_t)(.2*CLOCK_FREQ)
/* DVD and VCD devices */
#ifndef WIN32
# define DVD_DEVICE "/dev/dvd"
# define VCD_DEVICE "/dev/cdrom"
# define DVD_DEVICE "/dev/dvd"
# define VCD_DEVICE "/dev/cdrom"
#else
# define DVD_DEVICE "D"
# define VCD_DEVICE "D"
# define DVD_DEVICE "D"
# define VCD_DEVICE "D"
#endif
/*****************************************************************************
......@@ -139,9 +139,13 @@
* will cause the calling thread to sleep */
#define AOUT_MAX_PREPARE_TIME (mtime_t)(.5*CLOCK_FREQ)
/* Buffers which arrive after pts - AOUT_MIN_PREPARE_TIME will be trashed
* to avoid too heavy resampling */
#define AOUT_MIN_PREPARE_TIME (mtime_t)(.04*CLOCK_FREQ)
/* Max acceptable delay between the coded PTS and the actual presentation
* time, without resampling */
#define AOUT_PTS_TOLERANCE (mtime_t)(.03*CLOCK_FREQ)
#define AOUT_PTS_TOLERANCE (mtime_t)(.02*CLOCK_FREQ)
/*****************************************************************************
* Video configuration
......
......@@ -3,7 +3,7 @@
* Collection of useful common types and macros definitions
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: vlc_common.h,v 1.21 2002/08/21 15:53:06 sam Exp $
* $Id: vlc_common.h,v 1.22 2002/08/21 22:41:59 massiot Exp $
*
* Authors: Samuel Hocevar <sam@via.ecp.fr>
* Vincent Seguin <seguin@via.ecp.fr>
......@@ -178,6 +178,7 @@ typedef struct aout_sys_t aout_sys_t;
typedef struct aout_input_t aout_input_t;
typedef struct aout_buffer_t aout_buffer_t;
typedef struct audio_sample_format_t audio_sample_format_t;
typedef struct audio_date_t audio_date_t;
/* Video */
typedef struct vout_thread_t vout_thread_t;
......
......@@ -53,6 +53,8 @@ struct module_symbols_t
module_config_t * (* config_FindConfig_inner) ( vlc_object_t *, const char *psz_name ) ;
module_t * (* __module_Need_inner) ( vlc_object_t *, const char *, const char * ) ;
msg_subscription_t* (* __msg_Subscribe_inner) ( vlc_object_t * ) ;
mtime_t (* aout_DateGet_inner) ( const audio_date_t * ) ;
mtime_t (* aout_DateIncrement_inner) ( audio_date_t *, u32 ) ;
mtime_t (* input_ClockGetTS_inner) ( input_thread_t *, pgrm_descriptor_t *, mtime_t ) ;
mtime_t (* mdate_inner) ( void ) ;
pes_packet_t * (* input_NewPES_inner) ( input_buffers_t * ) ;
......@@ -102,8 +104,10 @@ struct module_symbols_t
void (* __vlc_thread_ready_inner) ( vlc_object_t * ) ;
void (* aout_BufferDelete_inner) ( aout_instance_t *, aout_input_t *, aout_buffer_t * ) ;
void (* aout_BufferPlay_inner) ( aout_instance_t *, aout_input_t *, aout_buffer_t * ) ;
void (* aout_DateInit_inner) ( audio_date_t *, u32 ) ;
void (* aout_DateMove_inner) ( audio_date_t *, mtime_t ) ;
void (* aout_DateSet_inner) ( audio_date_t *, mtime_t ) ;
void (* aout_DeleteInstance_inner) ( aout_instance_t * ) ;
void (* aout_FormatPrepare_inner) ( audio_sample_format_t * p_format ) ;
void (* aout_InputDelete_inner) ( aout_instance_t *, aout_input_t * ) ;
void (* config_Duplicate_inner) ( module_t *, module_config_t * ) ;
void (* config_SetCallbacks_inner) ( module_config_t *, module_config_t * ) ;
......@@ -210,8 +214,12 @@ struct module_symbols_t
# define aout_BufferDelete p_symbols->aout_BufferDelete_inner
# define aout_BufferNew p_symbols->aout_BufferNew_inner
# define aout_BufferPlay p_symbols->aout_BufferPlay_inner
# define aout_DateGet p_symbols->aout_DateGet_inner
# define aout_DateIncrement p_symbols->aout_DateIncrement_inner
# define aout_DateInit p_symbols->aout_DateInit_inner
# define aout_DateMove p_symbols->aout_DateMove_inner
# define aout_DateSet p_symbols->aout_DateSet_inner
# define aout_DeleteInstance p_symbols->aout_DeleteInstance_inner
# define aout_FormatPrepare p_symbols->aout_FormatPrepare_inner
# define aout_InputDelete p_symbols->aout_InputDelete_inner
# define aout_OutputNextBuffer p_symbols->aout_OutputNextBuffer_inner
# define config_Duplicate p_symbols->config_Duplicate_inner
......
/*****************************************************************************
* trivial.c : trivial channel mixer plug-in (drops unwanted channels)
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: trivial.c,v 1.1 2002/08/21 22:41:59 massiot Exp $
*
* Authors: Christophe Massiot <massiot@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.
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
#include <errno.h>
#include <stdlib.h> /* malloc(), free() */
#include <string.h>
#include <vlc/vlc.h>
#include "audio_output.h"
#include "aout_internal.h"
/*****************************************************************************
* Local prototypes
*****************************************************************************/
static int Create ( vlc_object_t * );
static void DoWork ( aout_instance_t *, aout_filter_t *, aout_buffer_t *,
aout_buffer_t * );
/*****************************************************************************
* Module descriptor
*****************************************************************************/
vlc_module_begin();
set_description( _("audio filter for trivial channel mixing") );
set_capability( "audio filter", 1 );
set_callbacks( Create, NULL );
vlc_module_end();
/*****************************************************************************
* Create: allocate trivial channel mixer
*****************************************************************************/
static int Create( vlc_object_t *p_this )
{
aout_filter_t * p_filter = (aout_filter_t *)p_this;
if ( p_filter->input.i_channels == p_filter->output.i_channels
|| p_filter->input.i_format != p_filter->output.i_format
|| p_filter->input.i_rate != p_filter->output.i_rate
|| (p_filter->input.i_format != AOUT_FMT_FLOAT32
&& p_filter->input.i_format != AOUT_FMT_FIXED32) )
{
return -1;
}
p_filter->pf_do_work = DoWork;
if ( p_filter->input.i_channels > p_filter->output.i_channels )
{
/* Downmixing */
p_filter->b_in_place = 1;
}
else
{
/* Upmixing */
p_filter->b_in_place = 0;
}
return 0;
}
/*****************************************************************************
* SparseCopy: trivially downmix or upmix a buffer
*****************************************************************************/
static void SparseCopy( s32 * p_dest, const s32 * p_src, size_t i_len,
int i_output_stride, int i_input_stride )
{
int i;
for ( i = 0; i < i_len; i++ )
{
int j;
for ( j = 0; j < i_output_stride; j++ )
{
p_dest[j] = p_src[j];
}
p_src += i_input_stride;
p_dest += i_output_stride;
}
}
/*****************************************************************************
* DoWork: convert a buffer
*****************************************************************************/
static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
aout_buffer_t * p_in_buf, aout_buffer_t * p_out_buf )
{
SparseCopy( (s32 *)p_out_buf->p_buffer, (s32 *)p_in_buf->p_buffer,
p_in_buf->i_nb_samples, p_filter->output.i_channels,
p_filter->input.i_channels );
p_out_buf->i_nb_samples = p_in_buf->i_nb_samples;
p_out_buf->i_nb_bytes = p_in_buf->i_nb_bytes * p_filter->output.i_channels
/ p_filter->input.i_channels;
}
......@@ -2,7 +2,7 @@
* a52tospdif.c : encapsulates A/52 frames into S/PDIF packets
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: a52tospdif.c,v 1.8 2002/08/17 13:26:57 tcastley Exp $
* $Id: a52tospdif.c,v 1.9 2002/08/21 22:41:59 massiot Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Stphane Borel <stef@via.ecp.fr>
......@@ -50,7 +50,7 @@ static void DoWork ( aout_instance_t *, aout_filter_t *, aout_buffer_t *,
* Module descriptor
*****************************************************************************/
vlc_module_begin();
set_description( _("aout filter for A/52->S/PDIF encapsulation") );
set_description( _("audio filter for A/52->S/PDIF encapsulation") );
set_capability( "audio filter", 10 );
set_callbacks( Create, NULL );
vlc_module_end();
......@@ -82,11 +82,13 @@ static int Create( vlc_object_t *p_this )
static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
aout_buffer_t * p_in_buf, aout_buffer_t * p_out_buf )
{
u16 i;
#ifdef WORDS_BIGENDIAN
static const u8 p_sync[6] = { 0xF8, 0x72, 0x4E, 0x1F, 0x00, 0x01 };
#else
static const u8 p_sync[6] = { 0x72, 0xF8, 0x1F, 0x4E, 0x01, 0x00 };
# ifndef HAVE_SWAB
u16 i;
# endif
#endif
u16 i_length = p_in_buf->i_nb_samples;
u16 * pi_length;
......
......@@ -2,7 +2,7 @@
* fixed32float32.c : converter from fixed32 to float32 bits integer
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: fixed32tofloat32.c,v 1.5 2002/08/19 21:31:11 massiot Exp $
* $Id: fixed32tofloat32.c,v 1.6 2002/08/21 22:41:59 massiot Exp $
*
* Authors: Jean-Paul Saman <jpsaman@wxs.nl>
*
......@@ -44,7 +44,7 @@ static void DoWork ( aout_instance_t *, aout_filter_t *, aout_buffer_t *,
* Module descriptor
*****************************************************************************/
vlc_module_begin();
set_description( _("aout filter for fixed32->float32 conversion") );
set_description( _("audio filter for fixed32->float32 conversion") );
set_capability( "audio filter", 10 );
set_callbacks( Create, NULL );
vlc_module_end();
......@@ -105,6 +105,8 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
#endif
/* combined conversion */
/* This has absolutely no chance of working. *p_in is s32, gcc
* doesn't know anything of vlc_fixed_t... --Meuuh */
if ( *p_in >= 8 ) *p_out = (float) 1.0;
else if ( *p_in < -8 ) *p_out = (float) -1.0;
else *p_out =(float) (*p_in/8.0);
......@@ -113,5 +115,6 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
}
p_out_buf->i_nb_samples = p_in_buf->i_nb_samples;
p_out_buf->i_nb_bytes = p_in_buf->i_nb_bytes;
}
......@@ -2,7 +2,7 @@
* fixed32tos16.c : converter from fixed32 to signed 16 bits integer
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: fixed32tos16.c,v 1.4 2002/08/19 21:31:11 massiot Exp $
* $Id: fixed32tos16.c,v 1.5 2002/08/21 22:41:59 massiot Exp $
*
* Authors: Jean-Paul Saman <jpsaman@wxs.nl>
*
......@@ -44,7 +44,7 @@ static void DoWork ( aout_instance_t *, aout_filter_t *, aout_buffer_t *,
* Module descriptor
*****************************************************************************/
vlc_module_begin();
set_description( _("aout filter for fixed32->s16 conversion") );
set_description( _("audio filter for fixed32->s16 conversion") );
set_capability( "audio filter", 10 );
set_callbacks( Create, NULL );
vlc_module_end();
......@@ -216,4 +216,5 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
// p_in++; p_out++;
}
p_out_buf->i_nb_samples = p_in_buf->i_nb_samples;
p_out_buf->i_nb_bytes = p_in_buf->i_nb_bytes / 2;
}
......@@ -2,7 +2,7 @@
* float32tos16.c : converter from float32 to signed 16 bits integer
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: float32tos16.c,v 1.8 2002/08/19 21:31:11 massiot Exp $
* $Id: float32tos16.c,v 1.9 2002/08/21 22:41:59 massiot Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -44,15 +44,13 @@ static void DoWork ( aout_instance_t *, aout_filter_t *, aout_buffer_t *,
* Module descriptor
*****************************************************************************/
vlc_module_begin();
set_description( _("aout filter for float32->s16 conversion") );
set_description( _("audio filter for float32->s16 conversion") );
set_capability( "audio filter", 1 );
set_callbacks( Create, NULL );
vlc_module_end();
/*****************************************************************************
* Create: allocate trivial mixer
*****************************************************************************
* This function allocates and initializes a Crop vout method.
*****************************************************************************/
static int Create( vlc_object_t *p_this )
{
......@@ -88,7 +86,7 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
for ( i = p_in_buf->i_nb_samples * p_filter->input.i_channels ; i-- ; )
{
#if 0
/* Slow version */
/* Slow version. */
if ( *p_in >= 1.0 ) *p_out = 32767;
else if ( *p_in < -1.0 ) *p_out = -32768;
else *p_out = *p_in * 32768.0;
......
......@@ -2,7 +2,7 @@
* float32tos8.c : converter from float32 to signed 8 bits integer
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: float32tos8.c,v 1.3 2002/08/19 21:31:11 massiot Exp $
* $Id: float32tos8.c,v 1.4 2002/08/21 22:41:59 massiot Exp $
*
* Authors: Xavier Maillard <zedek@fxgsproject.org>
*
......@@ -44,7 +44,7 @@ static void DoWork ( aout_instance_t *, aout_filter_t *, aout_buffer_t *,
* Module descriptor
*****************************************************************************/
vlc_module_begin();
set_description( _("aout filter for float32->s8 conversion") );
set_description( _("audio filter for float32->s8 conversion") );
set_capability( "audio filter", 1 );
set_callbacks( Create, NULL );
vlc_module_end();
......
......@@ -2,7 +2,7 @@
* float32tou16.c : converter from float32 to unsigned 16 bits integer
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: float32tou16.c,v 1.3 2002/08/19 21:31:11 massiot Exp $
* $Id: float32tou16.c,v 1.4 2002/08/21 22:41:59 massiot Exp $
*
* Authors: Xavier Maillard <zedek@fxgsproject.org>
*
......@@ -44,7 +44,7 @@ static void DoWork ( aout_instance_t *, aout_filter_t *, aout_buffer_t *,
* Module descriptor
*****************************************************************************/
vlc_module_begin();
set_description( _("aout filter for float32->u16 conversion") );
set_description( _("audio filter for float32->u16 conversion") );
set_capability( "audio filter", 1 );
set_callbacks( Create, NULL );
vlc_module_end();
......
......@@ -2,7 +2,7 @@
* float32tou8.c : converter from float32 to unsigned 8 bits integer
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: float32tou8.c,v 1.3 2002/08/19 21:31:11 massiot Exp $
* $Id: float32tou8.c,v 1.4 2002/08/21 22:41:59 massiot Exp $
*
* Authors: Xavier Maillard <zedek@fxgsproject.org>
*
......@@ -44,7 +44,7 @@ static void DoWork ( aout_instance_t *, aout_filter_t *, aout_buffer_t *,
* Module descriptor
*****************************************************************************/
vlc_module_begin();
set_description( _("aout filter for float32->u8 conversion") );
set_description( _("audio filter for float32->u8 conversion") );
set_capability( "audio filter", 1 );
set_callbacks( Create, NULL );
vlc_module_end();
......
......@@ -2,7 +2,7 @@
* s16tofloat32.c : converter from signed 16 bits integer to float32
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: s16tofloat32.c,v 1.1 2002/08/21 09:27:40 sam Exp $
* $Id: s16tofloat32.c,v 1.2 2002/08/21 22:41:59 massiot Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -44,7 +44,7 @@ static void DoWork ( aout_instance_t *, aout_filter_t *, aout_buffer_t *,
* Module descriptor
*****************************************************************************/
vlc_module_begin();
set_description( _("aout filter for s16->float32 conversion") );
set_description( _("audio filter for s16->float32 conversion") );
set_capability( "audio filter", 1 );
set_callbacks( Create, NULL );
vlc_module_end();
......
......@@ -2,7 +2,7 @@
* trivial.c : trivial resampler (skips samples or pads with zeroes)
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: trivial.c,v 1.3 2002/08/12 22:12:50 massiot Exp $
* $Id: trivial.c,v 1.4 2002/08/21 22:41:59 massiot Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -44,22 +44,23 @@ static void DoWork ( aout_instance_t *, aout_filter_t *, aout_buffer_t *,
* Module descriptor
*****************************************************************************/
vlc_module_begin();
set_description( _("aout filter for trivial resampling") );
set_description( _("audio filter for trivial resampling") );
set_capability( "audio filter", 1 );
set_callbacks( Create, NULL );
vlc_module_end();
/*****************************************************************************
* Create: allocate trivial resampler
*****************************************************************************
* This function allocates and initializes a Crop vout method.
*****************************************************************************/
static int Create( vlc_object_t *p_this )
{
aout_filter_t * p_filter = (aout_filter_t *)p_this;
if ( p_filter->input.i_rate == p_filter->output.i_rate
|| p_filter->input.i_format != p_filter->output.i_format )
|| p_filter->input.i_format != p_filter->output.i_format
|| p_filter->input.i_channels != p_filter->output.i_channels
|| (p_filter->input.i_format != AOUT_FMT_FLOAT32
&& p_filter->input.i_format != AOUT_FMT_FIXED32) )
{
return -1;
}
......@@ -83,7 +84,7 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
if ( p_out_buf != p_in_buf )
{
/* For whatever reason the buffer allocator decided to allocate
* a new buffer. */
* a new buffer. Currently, this never happens. */
p_aout->p_vlc->pf_memcpy( p_out_buf->p_buffer, p_in_buf->p_buffer,
__MIN(i_out_nb, i_in_nb) );
}
......@@ -95,5 +96,6 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
}
p_out_buf->i_nb_samples = i_out_nb;
p_out_buf->i_nb_bytes = i_out_nb * sizeof(s32);
}
......@@ -2,7 +2,7 @@
* spdif.c : dummy mixer for S/PDIF output (1 input only)
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: spdif.c,v 1.4 2002/08/19 21:31:11 massiot Exp $
* $Id: spdif.c,v 1.5 2002/08/21 22:41:59 massiot Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -45,7 +45,6 @@ static void DoWork ( aout_instance_t *, aout_buffer_t * );
vlc_module_begin();
set_description( _("dummy spdif audio mixer module") );
set_capability( "audio mixer", 1 );
add_shortcut( "spdif" );
set_callbacks( Create, NULL );
vlc_module_end();
......
......@@ -2,7 +2,7 @@
* trivial.c : trivial mixer plug-in (1 input, no downmixing)
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: trivial.c,v 1.5 2002/08/19 21:31:11 massiot Exp $
* $Id: trivial.c,v 1.6 2002/08/21 22:41:59 massiot Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -43,9 +43,8 @@ static void DoWork ( aout_instance_t *, aout_buffer_t * );
* Module descriptor
*****************************************************************************/
vlc_module_begin();
set_description( _("trivial aout mixer module") );
set_description( _("trivial audio mixer module") );
set_capability( "audio mixer", 1 );
add_shortcut( "trivial" );
set_callbacks( Create, NULL );
vlc_module_end();
......@@ -67,34 +66,13 @@ static int Create( vlc_object_t *p_this )
return 0;
}
#if 0
/*****************************************************************************
* SparseCopy: trivially downmix or upmix a buffer
*****************************************************************************/
static void SparseCopy( u32 * p_dest, const u32 * p_src, size_t i_len,
int i_output_stride, int i_input_stride )
{
int i;
for ( i = 0; i < i_len; i++ )
{
int j;
for ( j = 0; j < i_output_stride; j++ )
{
p_dest[j] = p_src[j];
}
p_src += i_input_stride;
p_dest += i_output_stride;
}
}
#endif
/*****************************************************************************
* DoWork: mix a new output buffer
*****************************************************************************/
static void DoWork( aout_instance_t * p_aout, aout_buffer_t * p_buffer )
{
aout_input_t * p_input = p_aout->pp_inputs[0];
int i_nb_bytes = p_buffer->i_nb_samples * sizeof(u32)
int i_nb_bytes = p_buffer->i_nb_samples * sizeof(s32)
* p_aout->mixer.mixer.i_channels;
byte_t * p_in = p_input->p_first_byte_to_mix;
byte_t * p_out = p_buffer->p_buffer;
......@@ -104,7 +82,7 @@ static void DoWork( aout_instance_t * p_aout, aout_buffer_t * p_buffer )
ptrdiff_t i_available_bytes = (p_input->fifo.p_first->p_buffer
- p_in)
+ p_input->fifo.p_first->i_nb_samples
* sizeof(u32)
* sizeof(s32)
* p_aout->mixer.mixer.i_channels;
if ( i_available_bytes < i_nb_bytes )
......
......@@ -2,7 +2,7 @@
* sdl.c : SDL audio output plugin for vlc
*****************************************************************************
* Copyright (C) 2000-2002 VideoLAN
* $Id: sdl.c,v 1.3 2002/08/19 21:31:11 massiot Exp $
* $Id: sdl.c,v 1.4 2002/08/21 22:41:59 massiot Exp $
*
* Authors: Michel Kaempf <maxx@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
......@@ -150,7 +150,7 @@ static void SDLCallback( void * _p_aout, byte_t * p_stream, int i_len )
{
aout_instance_t * p_aout = (aout_instance_t *)_p_aout;
/* FIXME : take into account SDL latency instead of mdate() */
aout_buffer_t * p_buffer = aout_OutputNextBuffer( p_aout, mdate(), 0 );
aout_buffer_t * p_buffer = aout_OutputNextBuffer( p_aout, mdate(), 1 );
if ( i_len != FRAME_SIZE * sizeof(s16)
* p_aout->output.output.i_channels )
......