Commit 2ebf6c03 authored by Sam Hocevar's avatar Sam Hocevar

o renommage arbitraire et totalitaire de idctmmx.S en vdec_idctmmx.S

 o correction d'une typo d�bile dans audio_output au commit pr�c�dent
 o b_stereo est remplac� par i_channels
 o suppression de la structure aout_dsp_t dont les membres d�pendant
  de l'output se retrouve dans aout_*_sys_t, et les autres directement
  dans aout_thread_t, on se fait pas chier.
parent 2733b268
......@@ -326,10 +326,10 @@ C_OBJ = $(interface_obj) \
ifeq ($(ARCH),X86)
ifeq ($(MMX), YES)
ifeq ($(DECODER),new)
ASM_OBJ = video_decoder/idctmmx.o \
ASM_OBJ = video_decoder/vdec_idctmmx.o \
video_output/video_yuv_mmx.o
else
ASM_OBJ = video_decoder_ref/idctmmx.o \
ASM_OBJ = video_decoder_ref/vdec_idctmmx.o \
video_output/video_yuv_mmx.o
endif
endif
......
......@@ -25,8 +25,8 @@
/* Default output device. You probably should not change this. */
#define AOUT_DEFAULT_DEVICE "/dev/dsp"
/* Default audio output format (AFMT_S16_NE = Native Endianess) */
#define AOUT_DEFAULT_FORMAT AFMT_S16_NE
/* Default audio output format (AOUT_FMT_S16_NE = Native Endianess) */
#define AOUT_DEFAULT_FORMAT AOUT_FMT_S16_NE
/* Default stereo mode (0 stands for mono, 1 for stereo) */
#define AOUT_DEFAULT_STEREO 1
......@@ -59,28 +59,6 @@
#define AOUT_FIFO_ISEMPTY( fifo ) ( (fifo).l_end_frame == (fifo).i_start_frame )
#define AOUT_FIFO_ISFULL( fifo ) ( ((((fifo).l_end_frame + 1) - (fifo).l_start_frame) & AOUT_FIFO_SIZE) == 0 )
/*****************************************************************************
* aout_sys_t
*****************************************************************************/
typedef struct
{
/* Path to the audio output device (default is set to "/dev/dsp") */
char * psz_device;
int i_fd;
/* Format of the audio output samples (see <sys/soundcard.h>) */
int i_format;
/* Following boolean is set to 0 if output sound is mono, 1 if stereo */
boolean_t b_stereo;
/* Rate of the audio output sound (in Hz) */
long l_rate;
/* Buffer information structure, used by aout_sys_getbufinfo() to store the
* current state of the internal sound card buffer */
audio_buf_info buf_info;
} aout_sys_t;
/*****************************************************************************
* aout_increment_t
*****************************************************************************
......@@ -118,7 +96,7 @@ typedef struct
int i_type;
boolean_t b_die;
boolean_t b_stereo;
int i_channels;
long l_rate;
vlc_mutex_t data_lock;
......@@ -158,23 +136,21 @@ typedef struct
/*****************************************************************************
* aout_thread_t : audio output thread descriptor
*****************************************************************************/
typedef int (aout_sys_open_t) ( aout_sys_t *p_sys );
typedef int (aout_sys_reset_t) ( aout_sys_t *p_sys );
typedef int (aout_sys_setformat_t) ( aout_sys_t *p_sys );
typedef int (aout_sys_setchannels_t) ( aout_sys_t *p_sys );
typedef int (aout_sys_setrate_t) ( aout_sys_t *p_sys );
typedef long (aout_sys_getbufinfo_t) ( aout_sys_t *p_sys );
typedef void (aout_sys_playsamples_t) ( aout_sys_t *p_sys,
typedef int (aout_sys_open_t) ( p_aout_thread_t p_aout );
typedef int (aout_sys_reset_t) ( p_aout_thread_t p_aout );
typedef int (aout_sys_setformat_t) ( p_aout_thread_t p_aout );
typedef int (aout_sys_setchannels_t) ( p_aout_thread_t p_aout );
typedef int (aout_sys_setrate_t) ( p_aout_thread_t p_aout );
typedef long (aout_sys_getbufinfo_t) ( p_aout_thread_t p_aout );
typedef void (aout_sys_playsamples_t) ( p_aout_thread_t p_aout,
byte_t *buffer, int i_size );
typedef void (aout_sys_close_t) ( aout_sys_t *p_sys );
typedef void (aout_sys_close_t) ( p_aout_thread_t p_aout );
typedef struct aout_thread_s
{
vlc_thread_t thread_id;
boolean_t b_die;
aout_sys_t sys;
vlc_mutex_t fifos_lock;
aout_fifo_t fifo[ AOUT_MAX_FIFOS ];
......@@ -202,6 +178,22 @@ typedef struct aout_thread_s
* will be played */
mtime_t date;
/* Path to the audio output device (default is set to "/dev/dsp") */
char * psz_device;
int i_fd;
/* Format of the audio output samples */
int i_format;
/* Number of channels */
int i_channels;
/* Rate and gain of the audio output sound (in Hz) */
long l_rate;
long l_gain;
/* there might be some useful private structure, such as audio_buf_info
* for the OSS output */
p_aout_sys_t p_sys;
} aout_thread_t;
/* Output methods */
......@@ -213,6 +205,21 @@ typedef struct aout_thread_s
#define AOUT_DEFAULT_METHOD "dsp"
#endif
/* Those are from <linux/soundcard.h> but are needed because of formats
* on other platforms */
#define AOUT_FMT_U8 0x00000008
#define AOUT_FMT_S16_LE 0x00000010 /* Little endian signed 16 */
#define AOUT_FMT_S16_BE 0x00000020 /* Big endian signed 16 */
#define AOUT_FMT_S8 0x00000040
#define AOUT_FMT_U16_LE 0x00000080 /* Little endian U16 */
#define AOUT_FMT_U16_BE 0x00000100 /* Big endian U16 */
#if __BYTE_ORDER == __LITTLE_ENDIAN
#define AOUT_FMT_S16_NE AOUT_FMT_S16_LE
#elif __BYTE_ORDER == __BIG_ENDIAN
#define AOUT_FMT_S16_NE AOUT_FMT_S16_BE
#endif
/*****************************************************************************
* Prototypes
*****************************************************************************/
......
......@@ -10,21 +10,21 @@
/*****************************************************************************
* Prototypes
*****************************************************************************/
int aout_DummySysOpen ( aout_sys_t *p_sys );
int aout_DummySysReset ( aout_sys_t *p_sys );
int aout_DummySysSetFormat ( aout_sys_t *p_sys );
int aout_DummySysSetChannels ( aout_sys_t *p_sys );
int aout_DummySysSetRate ( aout_sys_t *p_sys );
long aout_DummySysGetBufInfo ( aout_sys_t *p_sys );
void aout_DummySysPlaySamples ( aout_sys_t *p_sys, byte_t *buffer, int i_size );
void aout_DummySysClose ( aout_sys_t *p_sys );
int aout_DummySysOpen ( aout_thread_t *p_aout );
int aout_DummySysReset ( aout_thread_t *p_aout );
int aout_DummySysSetFormat ( aout_thread_t *p_aout );
int aout_DummySysSetChannels ( aout_thread_t *p_aout );
int aout_DummySysSetRate ( aout_thread_t *p_aout );
long aout_DummySysGetBufInfo ( aout_thread_t *p_aout );
void aout_DummySysPlaySamples ( aout_thread_t *p_aout, byte_t *buffer, int i_size );
void aout_DummySysClose ( aout_thread_t *p_aout );
#ifdef AUDIO_DSP
int aout_DspSysOpen ( aout_sys_t *p_sys );
int aout_DspSysReset ( aout_sys_t *p_sys );
int aout_DspSysSetFormat ( aout_sys_t *p_sys );
int aout_DspSysSetChannels ( aout_sys_t *p_sys );
int aout_DspSysSetRate ( aout_sys_t *p_sys );
long aout_DspSysGetBufInfo ( aout_sys_t *p_sys );
void aout_DspSysPlaySamples ( aout_sys_t *p_dsp, byte_t *buffer, int i_size );
void aout_DspSysClose ( aout_sys_t *p_sys );
int aout_DspSysOpen ( aout_thread_t *p_aout );
int aout_DspSysReset ( aout_thread_t *p_aout );
int aout_DspSysSetFormat ( aout_thread_t *p_aout );
int aout_DspSysSetChannels ( aout_thread_t *p_aout );
int aout_DspSysSetRate ( aout_thread_t *p_aout );
long aout_DspSysGetBufInfo ( aout_thread_t *p_aout );
void aout_DspSysPlaySamples ( aout_thread_t *p_aout, byte_t *buffer, int i_size );
void aout_DspSysClose ( aout_thread_t *p_aout );
#endif
......@@ -58,8 +58,10 @@ typedef struct input_cfg_s * p_input_cfg_t;
/* Audio */
struct aout_thread_s;
struct aout_sys_s;
typedef struct aout_thread_s * p_aout_thread_t;
typedef struct aout_sys_s * p_aout_sys_t;
/* Video */
struct vout_thread_s;
......
......@@ -181,7 +181,7 @@ static int InitThread( ac3dec_thread_t * p_ac3dec )
vlc_mutex_unlock( &p_ac3dec->fifo.data_lock );
aout_fifo.i_type = AOUT_ADEC_STEREO_FIFO;
aout_fifo.b_stereo = 1;
aout_fifo.i_channels = 2;
aout_fifo.l_frame_size = AC3DEC_FRAME_SIZE;
......
......@@ -740,13 +740,13 @@ static int InitThread( adec_thread_t * p_adec )
{
intf_DbgMsg("adec debug: mode == mono\n");
aout_fifo.i_type = AOUT_ADEC_MONO_FIFO;
aout_fifo.b_stereo = 0;
aout_fifo.i_channels = 1;
}
else
{
intf_DbgMsg("adec debug: mode == stereo\n");
aout_fifo.i_type = AOUT_ADEC_STEREO_FIFO;
aout_fifo.b_stereo = 1;
aout_fifo.i_channels = 2;
}
/* Checking the sampling frequency */
......
This diff is collapsed.
......@@ -110,9 +110,9 @@ const intf_command_t control_command[] =
" functions.\nIf a command name is provided as argument, displays a short "\
"inline help about the command.\n" },
{ "play-audio", PlayAudio, /* play-audio */
/* format: */ "stereo=i? rate=i? s ",
/* format: */ "channels=i? rate=i? s ",
/* summary: */ "play an audio file",
/* usage: */ "play-audio [stereo=1/0] [rate=r] <file>",
/* usage: */ "play-audio [channels=1/2] [rate=r] <file>",
/* help: */ "Load and play an audio file." },
{ "play-video", PlayVideo, /* play-video */
/* format: */ "s ",
......@@ -275,17 +275,17 @@ static int PlayAudio( int i_argc, intf_arg_t *p_argv )
}
/* Set default configuration */
fifo.b_stereo = AOUT_DEFAULT_STEREO;
fifo.i_channels = 1 + AOUT_DEFAULT_STEREO;
fifo.l_rate = AOUT_DEFAULT_RATE;
/* The stereo and rate parameters are essential ! */
/* The channels and rate parameters are essential ! */
/* Parse parameters - see command list above */
for ( i_arg = 1; i_arg < i_argc; i_arg++ )
{
switch( p_argv[i_arg].i_index )
{
case 0: /* stereo */
fifo.b_stereo = p_argv[i_arg].i_num;
case 0: /* channels */
fifo.i_channels = p_argv[i_arg].i_num;
break;
case 1: /* rate */
fifo.l_rate = p_argv[i_arg].i_num;
......@@ -297,18 +297,18 @@ static int PlayAudio( int i_argc, intf_arg_t *p_argv )
}
/* Setting up the type of the fifo */
switch ( fifo.b_stereo )
switch ( fifo.i_channels )
{
case 0:
case 1:
fifo.i_type = AOUT_INTF_MONO_FIFO;
break;
case 1:
case 2:
fifo.i_type = AOUT_INTF_STEREO_FIFO;
break;
default:
intf_IntfMsg("play-audio error: stereo must be 0 or 1");
intf_IntfMsg("play-audio error: channels must be 1 or 2");
return( INTF_OTHER_ERROR );
}
......@@ -322,17 +322,17 @@ static int PlayAudio( int i_argc, intf_arg_t *p_argv )
/* Get file size to calculate number of audio units */
fstat( i_fd, &stat_buffer );
fifo.l_units = ( long )( stat_buffer.st_size / (sizeof(s16) << fifo.b_stereo) );
fifo.l_units = ( long )( stat_buffer.st_size / (sizeof(s16) << (fifo.i_channels - 1)) );
/* Allocate memory, read file and close it */
if ( (fifo.buffer = malloc(sizeof(s16)*(fifo.l_units << fifo.b_stereo))) == NULL ) /* !! */
if ( (fifo.buffer = malloc(sizeof(s16)*(fifo.l_units << (fifo.i_channels - 1)))) == NULL ) /* !! */
{
intf_IntfMsg("play-audio error: not enough memory to read `%s'", psz_file );
close( i_fd ); /* close file */
return( INTF_OTHER_ERROR );
}
if ( read(i_fd, fifo.buffer, sizeof(s16)*(fifo.l_units << fifo.b_stereo))
!= sizeof(s16)*(fifo.l_units << fifo.b_stereo) )
if ( read(i_fd, fifo.buffer, sizeof(s16)*(fifo.l_units << (fifo.i_channels - 1)))
!= sizeof(s16)*(fifo.l_units << (fifo.i_channels - 1)) )
{
intf_IntfMsg("play-audio error: can't read %s", psz_file);
free( fifo.buffer );
......@@ -342,7 +342,7 @@ static int PlayAudio( int i_argc, intf_arg_t *p_argv )
close( i_fd );
/* Now we can work out how many output units we can compute with the fifo */
fifo.l_units = (long)(((s64)fifo.l_units*(s64)p_main->p_aout->sys.l_rate)/(s64)fifo.l_rate);
fifo.l_units = (long)(((s64)fifo.l_units*(s64)p_main->p_aout->l_rate)/(s64)fifo.l_rate);
/* Create the fifo */
if ( aout_CreateFifo(p_main->p_aout, &fifo) == NULL )
......
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