Commit 63f553ea authored by Christophe Massiot's avatar Christophe Massiot

* Fixed AOUT_CHAN_CHANNEL2 trivial mixer,

* Fixed a compile issue in the vcd plug-in,
* Fixed SDL behavior with > 2 channels.
parent 7ee2435d
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* cdrom.c: cdrom tools * cdrom.c: cdrom tools
***************************************************************************** *****************************************************************************
* Copyright (C) 1998-2001 VideoLAN * Copyright (C) 1998-2001 VideoLAN
* $Id: cdrom.c,v 1.4 2002/10/15 19:56:59 gbazin Exp $ * $Id: cdrom.c,v 1.5 2002/10/16 23:12:46 massiot Exp $
* *
* Authors: Johan Bilien <jobi@via.ecp.fr> * Authors: Johan Bilien <jobi@via.ecp.fr>
* Gildas Bazin <gbazin@netcourrier.com> * Gildas Bazin <gbazin@netcourrier.com>
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
#include <fcntl.h> #include <fcntl.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h>
#include <string.h> #include <string.h>
#include <errno.h> #include <errno.h>
...@@ -222,7 +223,7 @@ int ioctl_GetTracksMap( vlc_object_t *p_this, const vcddev_t *p_vcddev, ...@@ -222,7 +223,7 @@ int ioctl_GetTracksMap( vlc_object_t *p_this, const vcddev_t *p_vcddev,
CDTOC *pTOC; CDTOC *pTOC;
int i_descriptors; int i_descriptors;
if( ( pTOC = darwin_getTOC( p_this, p_vcddev->psz_dev ) ) == NULL ) if( ( pTOC = darwin_getTOC( p_this, p_vcddev ) ) == NULL )
{ {
msg_Err( p_this, "failed to get the TOC" ); msg_Err( p_this, "failed to get the TOC" );
return 0; return 0;
...@@ -868,7 +869,7 @@ static void CloseVCDImage( vlc_object_t * p_this, vcddev_t *p_vcddev ) ...@@ -868,7 +869,7 @@ static void CloseVCDImage( vlc_object_t * p_this, vcddev_t *p_vcddev )
/**************************************************************************** /****************************************************************************
* darwin_getTOC: get the TOC * darwin_getTOC: get the TOC
****************************************************************************/ ****************************************************************************/
static CDTOC *darwin_getTOC( vlc_object_t * p_this, vcddev_t *p_vcddev ) static CDTOC *darwin_getTOC( vlc_object_t * p_this, const vcddev_t *p_vcddev )
{ {
mach_port_t port; mach_port_t port;
char *psz_devname; char *psz_devname;
...@@ -876,7 +877,7 @@ static CDTOC *darwin_getTOC( vlc_object_t * p_this, vcddev_t *p_vcddev ) ...@@ -876,7 +877,7 @@ static CDTOC *darwin_getTOC( vlc_object_t * p_this, vcddev_t *p_vcddev )
CDTOC *pTOC = NULL; CDTOC *pTOC = NULL;
io_iterator_t iterator; io_iterator_t iterator;
io_registry_entry_t service; io_registry_entry_t service;
CFDictionaryRef properties; CFMutableDictionaryRef properties;
CFDataRef data; CFDataRef data;
/* get the device name */ /* get the device name */
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* cdrom.h: cdrom tools header * cdrom.h: cdrom tools header
***************************************************************************** *****************************************************************************
* Copyright (C) 1998-2001 VideoLAN * Copyright (C) 1998-2001 VideoLAN
* $Id: cdrom.h,v 1.3 2002/10/15 19:56:59 gbazin Exp $ * $Id: cdrom.h,v 1.4 2002/10/16 23:12:46 massiot Exp $
* *
* Authors: Johan Bilien <jobi@via.ecp.fr> * Authors: Johan Bilien <jobi@via.ecp.fr>
* Gildas Bazin <gbazin@netcourrier.com> * Gildas Bazin <gbazin@netcourrier.com>
...@@ -203,7 +203,7 @@ static int OpenVCDImage( vlc_object_t *, const char *, vcddev_t * ); ...@@ -203,7 +203,7 @@ static int OpenVCDImage( vlc_object_t *, const char *, vcddev_t * );
static void CloseVCDImage( vlc_object_t *, vcddev_t * ); static void CloseVCDImage( vlc_object_t *, vcddev_t * );
#if defined( SYS_DARWIN ) #if defined( SYS_DARWIN )
static CDTOC *darwin_getTOC( vlc_object_t *, const char * ); static CDTOC *darwin_getTOC( vlc_object_t *, const vcddev_t * );
static int darwin_getNumberOfDescriptors( CDTOC * ); static int darwin_getNumberOfDescriptors( CDTOC * );
static int darwin_getNumberOfTracks( CDTOC *, int ); static int darwin_getNumberOfTracks( CDTOC *, int );
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* trivial.c : trivial channel mixer plug-in (drops unwanted channels) * trivial.c : trivial channel mixer plug-in (drops unwanted channels)
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * Copyright (C) 2002 VideoLAN
* $Id: trivial.c,v 1.4 2002/09/30 21:32:31 massiot Exp $ * $Id: trivial.c,v 1.5 2002/10/16 23:12:46 massiot Exp $
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* *
...@@ -107,9 +107,13 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter, ...@@ -107,9 +107,13 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
{ {
int i_input_nb = aout_FormatNbChannels( &p_filter->input ); int i_input_nb = aout_FormatNbChannels( &p_filter->input );
int i_output_nb = aout_FormatNbChannels( &p_filter->output ); int i_output_nb = aout_FormatNbChannels( &p_filter->output );
s32 * p_dest = (s32 *)p_out_buf->p_buffer;
s32 * p_src = (s32 *)p_in_buf->p_buffer;
if ( p_filter->output.i_channels == AOUT_CHAN_CHANNEL2 )
p_src++;
SparseCopy( (s32 *)p_out_buf->p_buffer, (s32 *)p_in_buf->p_buffer, SparseCopy( p_dest, p_src, p_in_buf->i_nb_samples, i_output_nb,
p_in_buf->i_nb_samples, i_output_nb, i_input_nb ); i_input_nb );
p_out_buf->i_nb_samples = p_in_buf->i_nb_samples; p_out_buf->i_nb_samples = p_in_buf->i_nb_samples;
p_out_buf->i_nb_bytes = p_in_buf->i_nb_bytes * i_output_nb / i_input_nb; p_out_buf->i_nb_bytes = p_in_buf->i_nb_bytes * i_output_nb / i_input_nb;
......
...@@ -2,11 +2,12 @@ ...@@ -2,11 +2,12 @@
* sdl.c : SDL audio output plugin for vlc * sdl.c : SDL audio output plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2000-2002 VideoLAN * Copyright (C) 2000-2002 VideoLAN
* $Id: sdl.c,v 1.13 2002/09/30 11:05:35 sam Exp $ * $Id: sdl.c,v 1.14 2002/10/16 23:12:45 massiot Exp $
* *
* Authors: Michel Kaempf <maxx@via.ecp.fr> * Authors: Michel Kaempf <maxx@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org> * Samuel Hocevar <sam@zoy.org>
* Pierre Baillet <oct@zoy.org> * Pierre Baillet <oct@zoy.org>
* Christophe Massiot <massiot@via.ecp.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
...@@ -76,20 +77,18 @@ vlc_module_end(); ...@@ -76,20 +77,18 @@ vlc_module_end();
static int Open ( vlc_object_t *p_this ) static int Open ( vlc_object_t *p_this )
{ {
aout_instance_t *p_aout = (aout_instance_t *)p_this; aout_instance_t *p_aout = (aout_instance_t *)p_this;
SDL_AudioSpec desired; SDL_AudioSpec desired, obtained;
int i_nb_channels;
/* Check that no one uses the DSP. */
Uint32 i_flags = SDL_INIT_AUDIO; Uint32 i_flags = SDL_INIT_AUDIO;
if( SDL_WasInit( i_flags ) ) if( SDL_WasInit( i_flags ) )
{ {
return VLC_EGENERIC; return VLC_EGENERIC;
} }
p_aout->output.pf_play = Play;
aout_VolumeSoftInit( p_aout );
#ifndef WIN32 #ifndef WIN32
/* Win32 SDL implementation doesn't support SDL_INIT_EVENTTHREAD yet*/ /* Win32 SDL implementation doesn't support SDL_INIT_EVENTTHREAD yet */
i_flags |= SDL_INIT_EVENTTHREAD; i_flags |= SDL_INIT_EVENTTHREAD;
#endif #endif
#ifdef DEBUG #ifdef DEBUG
...@@ -105,28 +104,57 @@ static int Open ( vlc_object_t *p_this ) ...@@ -105,28 +104,57 @@ static int Open ( vlc_object_t *p_this )
return VLC_EGENERIC; return VLC_EGENERIC;
} }
if ( p_aout->output.output.i_channels > 2 ) i_nb_channels = aout_FormatNbChannels( &p_aout->output.output );
p_aout->output.output.i_channels = 2; if ( i_nb_channels > 2 )
p_aout->output.output.i_format = AOUT_FMT_S16_NE; {
p_aout->output.i_nb_samples = FRAME_SIZE; /* SDL doesn't support more than two channels. */
i_nb_channels = 2;
/* TODO: finish and clean this */ p_aout->output.output.i_channels = AOUT_CHAN_STEREO;
}
desired.freq = p_aout->output.output.i_rate; desired.freq = p_aout->output.output.i_rate;
desired.format = AUDIO_S16SYS; desired.format = AUDIO_S16SYS;
desired.channels = p_aout->output.output.i_channels; desired.channels = i_nb_channels;
desired.callback = SDLCallback; desired.callback = SDLCallback;
desired.userdata = p_aout; desired.userdata = p_aout;
desired.samples = FRAME_SIZE; desired.samples = FRAME_SIZE;
/* Open the sound device - FIXME : get the "natural" parameters */ /* Open the sound device. */
if( SDL_OpenAudio( &desired, NULL ) < 0 ) if( SDL_OpenAudio( &desired, &obtained ) < 0 )
{ {
return VLC_EGENERIC; return VLC_EGENERIC;
} }
SDL_PauseAudio( 0 ); SDL_PauseAudio( 0 );
/* Now have a look at what we got. */
switch ( obtained.format )
{
case AUDIO_S16LSB:
p_aout->output.output.i_format = VLC_FOURCC('s','1','6','l'); break;
case AUDIO_S16MSB:
p_aout->output.output.i_format = VLC_FOURCC('s','1','6','b'); break;
case AUDIO_U16LSB:
p_aout->output.output.i_format = VLC_FOURCC('u','1','6','l'); break;
case AUDIO_U16MSB:
p_aout->output.output.i_format = VLC_FOURCC('u','1','6','b'); break;
case AUDIO_S8:
p_aout->output.output.i_format = VLC_FOURCC('s','8',' ',' '); break;
case AUDIO_U8:
p_aout->output.output.i_format = VLC_FOURCC('u','8',' ',' '); break;
}
/* Volume is entirely done in software. */
aout_VolumeSoftInit( p_aout );
if ( obtained.channels != i_nb_channels )
{
p_aout->output.output.i_channels = (obtained.channels == 2 ?
AOUT_CHAN_STEREO :
AOUT_CHAN_MONO);
}
p_aout->output.output.i_rate = obtained.freq;
p_aout->output.i_nb_samples = obtained.samples;
p_aout->output.pf_play = Play;
return VLC_SUCCESS; return VLC_SUCCESS;
} }
......
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