Commit 6aaf8121 authored by Sam Hocevar's avatar Sam Hocevar

o remise de b_stereo dans les structures audio en attendant que soit

  d�finie une api pour la gestion de plus de 2 voies, qui de toute fa�on
  est loin d'�tre une priorit�. je dirais m�me qu'on s'en fout.
 o argument suppl�mentaire pour GetBufInfo() pour que la m�thode dummy
  attende un temps convenable, et correction de aout_dummy.c
 o le test sur la variable DEBUG dans config.h est maintenant conforme
  � ce que dit le Makefile.
 o suppression d'une variable inutile dans intf_fb.c
 o --long-help devient --longhelp comme dans mpg123
 o version du programme arbitrairement mise � 0.95.0
 o commentaire d'une variable inutilis�e dans Synchronize (video_output.c)
 o correction du "LIN" en "LIB" dans le Makefile, qui doit tra�ner l�
  depuis des si�cles
 o proprification de quelques routines du Makefile

le code de s�lection de m�thode audio/video est loin d'�tre propre, je
dirais m�me que c'est du gros caca, mais j'y bosse.

bonne nuit,
parent 62ee3e00
......@@ -14,17 +14,21 @@
#SHELL=/bin/sh
# Audio output settings
AUDIO_DSP=YES
AUDIO = dsp
# Not yet supported
#AUDIO += esd
# Fallback method that should always work
AUDIO += dummy
# Video output settings
VIDEO_X11=YES
VIDEO_FB=YES
#VIDEO_GGI=YES
# You probably won't need this one
#VIDEO_GLIDE=YES
VIDEO = x11 fb
#VIDEO += ggi
#VIDEO += glide
# Not yet supported
#VIDEO_BEOS=YES
#VIDEO_DGA=YES
#VIDEO += beos
#VIDEO += dga
# Fallback method that should always work
VIDEO += dummy
# Target architecture
ARCH=X86
......@@ -45,7 +49,7 @@ MMX=YES
DECODER=new
# Debugging mode on or off (set to 1 to activate)
DEBUG=1
DEBUG=0
#----------------- do not change anything below this line ----------------------
......@@ -54,57 +58,17 @@ DEBUG=1
################################################################################
# Program version - may only be changed by the project leader
PROGRAM_VERSION = 1.0-dev
# AUDIO_OPTIONS describes all used audio options
AUDIO_OPTIONS = dummy
aout_method = audio_output/aout_dummy.o
ifeq ($(AUDIO_DSP), YES)
AUDIO_OPTIONS += dsp
DEFINE += -DAUDIO_DSP
aout_method += audio_output/aout_dsp.o
endif
PROGRAM_VERSION = 0.95.0
# VIDEO_OPTIONS describes all used video options
VIDEO_OPTIONS = dummy
intf_method = interface/intf_dummy.o
vout_method = video_output/vout_dummy.o
ifeq ($(VIDEO_GLIDE), YES)
VIDEO_OPTIONS += glide
DEFINE += -DVIDEO_GLIDE
intf_method += interface/intf_glide.o
vout_method += video_output/vout_glide.o
endif
ifeq ($(VIDEO_X11), YES)
VIDEO_OPTIONS += x11
DEFINE += -DVIDEO_X11
intf_method += interface/intf_x11.o
vout_method += video_output/vout_x11.o
endif
ifeq ($(VIDEO_GGI), YES)
VIDEO_OPTIONS += ggi
DEFINE += -DVIDEO_GGI
intf_method += interface/intf_ggi.o
vout_method += video_output/vout_ggi.o
endif
ifeq ($(VIDEO_FB), YES)
VIDEO_OPTIONS += fb
DEFINE += -DVIDEO_FB
intf_method += interface/intf_fb.o
vout_method += video_output/vout_fb.o
endif
ifeq ($(VIDEO_BEOS), YES)
VIDEO_OPTIONS += beos
DEFINE += -DVIDEO_BEOS
intf_method += interface/intf_beos.o
vout_method += video_output/vout_beos.o
endif
ifeq ($(VIDEO_DGA), YES)
VIDEO_OPTIONS += dga
DEFINE += -DVIDEO_DGA
intf_method += interface/intf_dga.o
vout_method += video_output/vout_dga.o
endif
# audio options
audio := $(shell echo $(AUDIO) | tr 'A-Z' 'a-z')
AUDIO := $(shell echo $(AUDIO) | tr 'a-z' 'A-Z')
DEFINE += $(AUDIO:%=-DAUDIO_%)
# video options
video := $(shell echo $(VIDEO) | tr 'A-Z' 'a-z')
VIDEO := $(shell echo $(VIDEO) | tr 'a-z' 'A-Z')
DEFINE += $(VIDEO:%=-DVIDEO_%)
# PROGRAM_OPTIONS is an identification string of the compilation options
PROGRAM_OPTIONS = $(ARCH) $(SYS)
......@@ -119,8 +83,8 @@ PROGRAM_BUILD = `date -R` $(USER)@`hostname`
# including ARCH_xx and SYS_xx. It will be passed to C compiler.
DEFINE += -DARCH_$(ARCH)
DEFINE += -DSYS_$(SYS)
DEFINE += -DAUDIO_OPTIONS="\"$(shell echo $(AUDIO_OPTIONS) | tr 'A-Z' 'a-z')\""
DEFINE += -DVIDEO_OPTIONS="\"$(shell echo $(VIDEO_OPTIONS) | tr 'A-Z' 'a-z')\""
DEFINE += -DAUDIO_OPTIONS="\"$(audio)\""
DEFINE += -DVIDEO_OPTIONS="\"$(video)\""
DEFINE += -DPROGRAM_VERSION="\"$(PROGRAM_VERSION)\""
DEFINE += -DPROGRAM_OPTIONS="\"$(PROGRAM_OPTIONS)\""
DEFINE += -DPROGRAM_BUILD="\"$(PROGRAM_BUILD)\""
......@@ -138,11 +102,11 @@ endif
#
INCLUDE += -Iinclude
ifeq ($(VIDEO_X11),YES)
ifneq (,$(findstring x11,$(video)))
INCLUDE += -I/usr/X11R6/include
endif
ifeq ($(VIDEO_GLIDE),YES)
ifneq (,$(findstring glide,$(video)))
INCLUDE += -I/usr/include/glide
endif
......@@ -150,17 +114,17 @@ endif
# Libraries
#
LIB += -lpthread
LIN += -lm
LIB += -lm
ifeq ($(VIDEO_X11),YES)
ifneq (,$(findstring x11,$(video)))
LIB += -L/usr/X11R6/lib
LIB += -lX11
LIB += -lXext
endif
ifeq ($(VIDEO_GGI),YES)
ifneq (,$(findstring ggi,$(video)))
LIB += -lggi
endif
ifeq ($(VIDEO_GLIDE),YES)
ifneq (,$(findstring glide,$(video)))
LIB += -lglide2x
endif
......@@ -242,7 +206,7 @@ interface_obj = interface/main.o \
interface/intf_ctrl.o \
interface/control.o \
interface/intf_console.o \
$(intf_method)
$(video:%=interface/intf_%.o)
input_obj = input/input_vlan.o \
input/input_file.o \
......@@ -254,12 +218,12 @@ input_obj = input/input_vlan.o \
input/input.o
audio_output_obj = audio_output/audio_output.o \
$(aout_method)
$(audio:%=audio_output/aout_%.o)
video_output_obj = video_output/video_output.o \
video_output/video_text.o \
video_output/video_yuv.o \
$(vout_method)
$(video:%=video_output/vout_%.o)
ac3_decoder_obj = ac3_decoder/ac3_decoder.o \
ac3_decoder/ac3_parse.o \
......
......@@ -97,6 +97,7 @@ typedef struct
boolean_t b_die;
int i_channels;
boolean_t b_stereo;
long l_rate;
vlc_mutex_t data_lock;
......@@ -141,7 +142,8 @@ 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 long (aout_sys_getbufinfo_t) ( p_aout_thread_t p_aout,
long l_buffer_limit );
typedef void (aout_sys_playsamples_t) ( p_aout_thread_t p_aout,
byte_t *buffer, int i_size );
typedef void (aout_sys_close_t) ( p_aout_thread_t p_aout );
......@@ -186,6 +188,8 @@ typedef struct aout_thread_s
int i_format;
/* Number of channels */
int i_channels;
/* Mono or Stereo sound */
boolean_t b_stereo;
/* Rate and gain of the audio output sound (in Hz) */
long l_rate;
long l_gain;
......@@ -203,6 +207,8 @@ typedef struct aout_thread_s
/* Get the fallback method */
#ifdef AUDIO_DSP
#define AOUT_DEFAULT_METHOD "dsp"
#else
#define AOUT_DEFAULT_METHOD "dummy"
#endif
/* Those are from <linux/soundcard.h> but are needed because of formats
......
......@@ -10,21 +10,23 @@
/*****************************************************************************
* Prototypes
*****************************************************************************/
#ifdef AUDIO_DUMMY
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 );
long aout_DummySysGetBufInfo ( aout_thread_t *p_aout, long l_buffer_info );
void aout_DummySysPlaySamples ( aout_thread_t *p_aout, byte_t *buffer, int i_size );
void aout_DummySysClose ( aout_thread_t *p_aout );
#endif
#ifdef AUDIO_DSP
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 );
long aout_DspSysGetBufInfo ( aout_thread_t *p_aout, long l_buffer_info );
void aout_DspSysPlaySamples ( aout_thread_t *p_aout, byte_t *buffer, int i_size );
void aout_DspSysClose ( aout_thread_t *p_aout );
#endif
......@@ -53,7 +53,7 @@
/*****************************************************************************
* Debugging options - define or undefine symbols
*****************************************************************************/
#ifdef DEBUG
#if DEBUG == 1
/* General debugging support, which depends of the DEBUG define, is determined
* in the Makefile */
......
......@@ -6,12 +6,14 @@
/*****************************************************************************
* Prototypes
*****************************************************************************/
#ifdef VIDEO_DUMMY
int vout_DummySysCreate ( p_vout_thread_t p_vout, char *psz_display, int i_root_window );
int vout_DummySysInit ( p_vout_thread_t p_vout );
void vout_DummySysEnd ( p_vout_thread_t p_vout );
void vout_DummySysDestroy ( p_vout_thread_t p_vout );
int vout_DummySysManage ( p_vout_thread_t p_vout );
void vout_DummySysDisplay ( p_vout_thread_t p_vout );
#endif
#ifdef VIDEO_X11
int vout_X11SysCreate ( p_vout_thread_t p_vout, char *psz_display, int i_root_window );
int vout_X11SysInit ( p_vout_thread_t p_vout );
......
......@@ -182,6 +182,7 @@ static int InitThread( ac3dec_thread_t * p_ac3dec )
aout_fifo.i_type = AOUT_ADEC_STEREO_FIFO;
aout_fifo.i_channels = 2;
aout_fifo.b_stereo = 1;
aout_fifo.l_frame_size = AC3DEC_FRAME_SIZE;
......
......@@ -741,12 +741,14 @@ 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.i_channels = 1;
aout_fifo.b_stereo = 0;
}
else
{
intf_DbgMsg("adec debug: mode == stereo\n");
aout_fifo.i_type = AOUT_ADEC_STEREO_FIFO;
aout_fifo.i_channels = 2;
aout_fifo.b_stereo = 1;
}
/* Checking the sampling frequency */
......
......@@ -113,6 +113,10 @@ aout_thread_t *aout_CreateThread( int *pi_status )
free( p_aout );
return( NULL );
}
p_aout->b_stereo = ( p_aout->i_channels == 2 ) ? 1 : 0; /* XXX only works
for i_channels == 1 or 2 */
if ( p_aout->p_sys_reset( p_aout ) )
{
p_aout->p_sys_close( p_aout );
......@@ -138,12 +142,6 @@ aout_thread_t *aout_CreateThread( int *pi_status )
return( NULL );
}
/* this code isn't very nice since some values might be uninitialized */
/* intf_DbgMsg("aout debug: audio device (%s) opened (format=%i, channels=%i, rate=%li)\n",
p_aout->psz_device,
p_aout->i_format,
p_aout->i_channels, p_aout->l_rate); */
//?? maybe it would be cleaner to change SpawnThread prototype
//?? see vout to handle status correctly - however, it is not critical since
//?? this thread is only called in main and all calls are blocking
......@@ -270,7 +268,7 @@ static int aout_SpawnThread( aout_thread_t * p_aout )
intf_ErrMsg("aout error: not enough memory to create the output buffer\n");
return( -1 );
}
if ( (p_aout->s32_buffer = (s32 *)calloc(p_aout->l_units, sizeof(s32) << ( p_aout->i_channels - 1))) == NULL )
if ( (p_aout->s32_buffer = (s32 *)calloc(p_aout->l_units, sizeof(s32) << ( p_aout->b_stereo))) == NULL )
{
intf_ErrMsg("aout error: not enough memory to create the s32 output buffer\n");
free( p_aout->buffer );
......@@ -350,6 +348,7 @@ aout_fifo_t * aout_CreateFifo( aout_thread_t * p_aout, aout_fifo_t * p_fifo )
p_aout->fifo[i_fifo].b_die = 0;
p_aout->fifo[i_fifo].i_channels = p_fifo->i_channels;
p_aout->fifo[i_fifo].b_stereo = p_fifo->b_stereo;
p_aout->fifo[i_fifo].l_rate = p_fifo->l_rate;
p_aout->fifo[i_fifo].buffer = p_fifo->buffer;
......@@ -364,6 +363,7 @@ aout_fifo_t * aout_CreateFifo( aout_thread_t * p_aout, aout_fifo_t * p_fifo )
p_aout->fifo[i_fifo].b_die = 0;
p_aout->fifo[i_fifo].i_channels = p_fifo->i_channels;
p_aout->fifo[i_fifo].b_stereo = p_fifo->b_stereo;
p_aout->fifo[i_fifo].l_rate = p_fifo->l_rate;
p_aout->fifo[i_fifo].l_frame_size = p_fifo->l_frame_size;
......@@ -480,7 +480,7 @@ static __inline__ int NextFrame( aout_thread_t * p_aout, aout_fifo_t * p_fifo, m
{
p_fifo->b_start_frame = 1;
p_fifo->l_next_frame = (p_fifo->l_start_frame + 1) & AOUT_FIFO_SIZE;
p_fifo->l_unit = p_fifo->l_start_frame * (p_fifo->l_frame_size >> (p_fifo->i_channels - 1));
p_fifo->l_unit = p_fifo->l_start_frame * (p_fifo->l_frame_size >> (p_fifo->b_stereo));
break;
}
p_fifo->l_start_frame = (p_fifo->l_start_frame + 1) & AOUT_FIFO_SIZE;
......@@ -518,7 +518,7 @@ static __inline__ int NextFrame( aout_thread_t * p_aout, aout_fifo_t * p_fifo, m
}
}
l_units = ((p_fifo->l_next_frame - p_fifo->l_start_frame) & AOUT_FIFO_SIZE) * (p_fifo->l_frame_size >> (p_fifo->i_channels - 1));
l_units = ((p_fifo->l_next_frame - p_fifo->l_start_frame) & AOUT_FIFO_SIZE) * (p_fifo->l_frame_size >> (p_fifo->b_stereo));
l_rate = p_fifo->l_rate + ((aout_date - p_fifo->date[p_fifo->l_start_frame]) / 256);
// fprintf( stderr, "aout debug: %lli (%li);\n", aout_date - p_fifo->date[p_fifo->l_start_frame], l_rate );
......@@ -526,7 +526,7 @@ static __inline__ int NextFrame( aout_thread_t * p_aout, aout_fifo_t * p_fifo, m
InitializeIncrement( &p_fifo->unit_increment, l_rate, p_aout->l_rate );
p_fifo->l_units = (((l_units - (p_fifo->l_unit -
(p_fifo->l_start_frame * (p_fifo->l_frame_size >> (p_fifo->i_channels - 1)))))
(p_fifo->l_start_frame * (p_fifo->l_frame_size >> (p_fifo->b_stereo)))))
* p_aout->l_rate) / l_rate) + 1;
/* We release the lock before leaving */
......@@ -578,7 +578,7 @@ void aout_Thread_S16_Stereo( aout_thread_t * p_aout )
if ( p_aout->fifo[i_fifo].l_units > p_aout->l_units )
{
l_buffer = 0;
while ( l_buffer < (p_aout->l_units << 1) ) /* p_aout->i_channels - 1 == 1 */
while ( l_buffer < (p_aout->l_units << 1) ) /* p_aout->b_stereo == 1 */
{
p_aout->s32_buffer[l_buffer++] +=
(s32)( ((s16 *)p_aout->fifo[i_fifo].buffer)[p_aout->fifo[i_fifo].l_unit] );
......@@ -591,7 +591,7 @@ void aout_Thread_S16_Stereo( aout_thread_t * p_aout )
else
{
l_buffer = 0;
while ( l_buffer < (p_aout->fifo[i_fifo].l_units << 1) ) /* p_aout->i_channels - 1 == 1 */
while ( l_buffer < (p_aout->fifo[i_fifo].l_units << 1) ) /* p_aout->b_stereo == 1 */
{
p_aout->s32_buffer[l_buffer++] +=
(s32)( ((s16 *)p_aout->fifo[i_fifo].buffer)[p_aout->fifo[i_fifo].l_unit] );
......@@ -609,7 +609,7 @@ void aout_Thread_S16_Stereo( aout_thread_t * p_aout )
if ( p_aout->fifo[i_fifo].l_units > p_aout->l_units )
{
l_buffer = 0;
while ( l_buffer < (p_aout->l_units << 1) ) /* p_aout->i_channels - 1 == 1 */
while ( l_buffer < (p_aout->l_units << 1) ) /* p_aout->b_stereo == 1 */
{
p_aout->s32_buffer[l_buffer++] +=
(s32)( ((s16 *)p_aout->fifo[i_fifo].buffer)[2*p_aout->fifo[i_fifo].l_unit] );
......@@ -622,7 +622,7 @@ void aout_Thread_S16_Stereo( aout_thread_t * p_aout )
else
{
l_buffer = 0;
while ( l_buffer < (p_aout->fifo[i_fifo].l_units << 1) ) /* p_aout->i_channels - 1 == 1 */
while ( l_buffer < (p_aout->fifo[i_fifo].l_units << 1) ) /* p_aout->b_stereo == 1 */
{
p_aout->s32_buffer[l_buffer++] +=
(s32)( ((s16 *)p_aout->fifo[i_fifo].buffer)[2*p_aout->fifo[i_fifo].l_unit] );
......@@ -660,7 +660,7 @@ void aout_Thread_S16_Stereo( aout_thread_t * p_aout )
if ( p_aout->fifo[i_fifo].l_units > l_units )
{
l_buffer_limit = p_aout->l_units << 1; /* p_aout->i_channels - 1 == 1 */
l_buffer_limit = p_aout->l_units << 1; /* p_aout->b_stereo == 1 */
while ( l_buffer < l_buffer_limit )
{
p_aout->s32_buffer[l_buffer++] +=
......@@ -669,10 +669,10 @@ void aout_Thread_S16_Stereo( aout_thread_t * p_aout )
(s32)( ((s16 *)p_aout->fifo[i_fifo].buffer)[p_aout->fifo[i_fifo].l_unit] );
UPDATE_INCREMENT( p_aout->fifo[i_fifo].unit_increment, p_aout->fifo[i_fifo].l_unit )
if ( p_aout->fifo[i_fifo].l_unit >= /* p_aout->fifo[i_fifo].i_channels - 1 == 0 */
if ( p_aout->fifo[i_fifo].l_unit >= /* p_aout->fifo[i_fifo].b_stereo == 0 */
((AOUT_FIFO_SIZE + 1) * (p_aout->fifo[i_fifo].l_frame_size >> 0)) )
{
p_aout->fifo[i_fifo].l_unit -= /* p_aout->fifo[i_fifo].i_channels - 1 == 0 */
p_aout->fifo[i_fifo].l_unit -= /* p_aout->fifo[i_fifo].b_stereo == 0 */
((AOUT_FIFO_SIZE + 1) * (p_aout->fifo[i_fifo].l_frame_size >> 0));
}
}
......@@ -682,7 +682,7 @@ void aout_Thread_S16_Stereo( aout_thread_t * p_aout )
else
{
l_buffer_limit = l_buffer + (p_aout->fifo[i_fifo].l_units << 1);
/* p_aout->i_channels - 1 == 1 */
/* p_aout->b_stereo == 1 */
while ( l_buffer < l_buffer_limit )
{
p_aout->s32_buffer[l_buffer++] +=
......@@ -691,10 +691,10 @@ void aout_Thread_S16_Stereo( aout_thread_t * p_aout )
(s32)( ((s16 *)p_aout->fifo[i_fifo].buffer)[p_aout->fifo[i_fifo].l_unit] );
UPDATE_INCREMENT( p_aout->fifo[i_fifo].unit_increment, p_aout->fifo[i_fifo].l_unit )
if ( p_aout->fifo[i_fifo].l_unit >= /* p_aout->fifo[i_fifo].i_channels - 1 == 0 */
if ( p_aout->fifo[i_fifo].l_unit >= /* p_aout->fifo[i_fifo].b_stereo == 0 */
((AOUT_FIFO_SIZE + 1) * (p_aout->fifo[i_fifo].l_frame_size >> 0)) )
{
p_aout->fifo[i_fifo].l_unit -= /* p_aout->fifo[i_fifo].i_channels - 1 == 0 */
p_aout->fifo[i_fifo].l_unit -= /* p_aout->fifo[i_fifo].b_stereo == 0 */
((AOUT_FIFO_SIZE + 1) * (p_aout->fifo[i_fifo].l_frame_size >> 0));
}
}
......@@ -737,7 +737,7 @@ void aout_Thread_S16_Stereo( aout_thread_t * p_aout )
if ( p_aout->fifo[i_fifo].l_units > l_units )
{
l_buffer_limit = p_aout->l_units << 1; /* p_aout->i_channels - 1 == 1 */
l_buffer_limit = p_aout->l_units << 1; /* p_aout->b_stereo == 1 */
while ( l_buffer < l_buffer_limit )
{
p_aout->s32_buffer[l_buffer++] +=
......@@ -746,10 +746,10 @@ void aout_Thread_S16_Stereo( aout_thread_t * p_aout )
(s32)( ((s16 *)p_aout->fifo[i_fifo].buffer)[2*p_aout->fifo[i_fifo].l_unit+1] );
UPDATE_INCREMENT( p_aout->fifo[i_fifo].unit_increment, p_aout->fifo[i_fifo].l_unit )
if ( p_aout->fifo[i_fifo].l_unit >= /* p_aout->fifo[i_fifo].i_channels - 1 == 1 */
if ( p_aout->fifo[i_fifo].l_unit >= /* p_aout->fifo[i_fifo].b_stereo == 1 */
((AOUT_FIFO_SIZE + 1) * (p_aout->fifo[i_fifo].l_frame_size >> 1)) )
{
p_aout->fifo[i_fifo].l_unit -= /* p_aout->fifo[i_fifo].i_channels - 1 == 1 */
p_aout->fifo[i_fifo].l_unit -= /* p_aout->fifo[i_fifo].b_stereo == 1 */
((AOUT_FIFO_SIZE + 1) * (p_aout->fifo[i_fifo].l_frame_size >> 1));
}
}
......@@ -759,7 +759,7 @@ void aout_Thread_S16_Stereo( aout_thread_t * p_aout )
else
{
l_buffer_limit = l_buffer + (p_aout->fifo[i_fifo].l_units << 1);
/* p_aout->i_channels - 1 == 1 */
/* p_aout->b_stereo == 1 */
while ( l_buffer < l_buffer_limit )
{
p_aout->s32_buffer[l_buffer++] +=
......@@ -768,10 +768,10 @@ void aout_Thread_S16_Stereo( aout_thread_t * p_aout )
(s32)( ((s16 *)p_aout->fifo[i_fifo].buffer)[2*p_aout->fifo[i_fifo].l_unit+1] );
UPDATE_INCREMENT( p_aout->fifo[i_fifo].unit_increment, p_aout->fifo[i_fifo].l_unit )
if ( p_aout->fifo[i_fifo].l_unit >= /* p_aout->fifo[i_fifo].i_channels - 1 == 1 */
if ( p_aout->fifo[i_fifo].l_unit >= /* p_aout->fifo[i_fifo].b_stereo == 1 */
((AOUT_FIFO_SIZE + 1) * (p_aout->fifo[i_fifo].l_frame_size >> 1)) )
{
p_aout->fifo[i_fifo].l_unit -= /* p_aout->fifo[i_fifo].i_channels - 1 == 1 */
p_aout->fifo[i_fifo].l_unit -= /* p_aout->fifo[i_fifo].b_stereo == 1 */
((AOUT_FIFO_SIZE + 1) * (p_aout->fifo[i_fifo].l_frame_size >> 1));
}
}
......@@ -797,7 +797,7 @@ void aout_Thread_S16_Stereo( aout_thread_t * p_aout )
}
vlc_mutex_unlock( &p_aout->fifos_lock );
l_buffer_limit = p_aout->l_units << 1; /* p_aout->i_channels - 1 == 1 */
l_buffer_limit = p_aout->l_units << 1; /* p_aout->b_stereo == 1 */
for ( l_buffer = 0; l_buffer < l_buffer_limit; l_buffer++ )
{
......@@ -805,8 +805,8 @@ void aout_Thread_S16_Stereo( aout_thread_t * p_aout )
p_aout->s32_buffer[l_buffer] = 0;
}
l_bytes = p_aout->p_sys_getbufinfo( p_aout );
p_aout->date = mdate() + ((((mtime_t)(l_bytes / 4)) * 1000000) / ((mtime_t)p_aout->l_rate)); /* sizeof(s16) << (p_aout->i_channels - 1) == 4 */
l_bytes = p_aout->p_sys_getbufinfo( p_aout, l_buffer_limit );
p_aout->date = mdate() + ((((mtime_t)(l_bytes / 4)) * 1000000) / ((mtime_t)p_aout->l_rate)); /* sizeof(s16) << (p_aout->b_stereo) == 4 */
p_aout->p_sys_playsamples( p_aout, (byte_t *)p_aout->buffer, l_buffer_limit * sizeof(s16) );
if ( l_bytes > (l_buffer_limit * sizeof(s16)) )
{
......
......@@ -275,7 +275,7 @@ static int PlayAudio( int i_argc, intf_arg_t *p_argv )
}
/* Set default configuration */
fifo.i_channels = 1 + AOUT_DEFAULT_STEREO;
fifo.i_channels = 1 + ( fifo.b_stereo = AOUT_DEFAULT_STEREO );
fifo.l_rate = AOUT_DEFAULT_RATE;
/* The channels and rate parameters are essential ! */
......@@ -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.i_channels - 1)) );
fifo.l_units = ( long )( stat_buffer.st_size / (sizeof(s16) << fifo.b_stereo) );
/* Allocate memory, read file and close it */
if ( (fifo.buffer = malloc(sizeof(s16)*(fifo.l_units << (fifo.i_channels - 1)))) == NULL ) /* !! */
if ( (fifo.buffer = malloc(sizeof(s16)*(fifo.l_units << fifo.b_stereo))) == 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.i_channels - 1)))
!= sizeof(s16)*(fifo.l_units << (fifo.i_channels - 1)) )
if ( read(i_fd, fifo.buffer, sizeof(s16)*(fifo.l_units << fifo.b_stereo))
!= sizeof(s16)*(fifo.l_units << fifo.b_stereo) )
{
intf_IntfMsg("play-audio error: can't read %s", psz_file);
free( fifo.buffer );
......
......@@ -62,7 +62,7 @@ static const struct option longopts[] =
/* General/common options */
{ "help", 0, 0, 'h' },
{ "long-help", 0, 0, 'H' },
{ "longhelp", 0, 0, 'H' },
{ "version", 0, 0, 'v' },
/* Audio options */
......@@ -337,7 +337,7 @@ static int GetConfiguration( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
Usage( SHORT_HELP );
return( -1 );
break;
case 'H': /* -H, --long-help */
case 'H': /* -H, --longhelp */
Usage( LONG_HELP );
return( -1 );
break;
......@@ -426,7 +426,7 @@ static void Usage( int i_fashion )
/* Options */
intf_Msg("Options:\n" \
" -h, --help, -H, --long-help \tprint short/long usage\n" \
" -h, --help, -H, --longhelp \tprint short/long usage\n" \
" -v, --version \tprint version information\n" \
" --noaudio, --novideo \tdisable audio/video\n" \
" --aout {" AUDIO_OPTIONS "} \taudio output method\n" \
......
......@@ -85,6 +85,7 @@ vout_thread_t * vout_CreateThread ( char *psz_display, int i_root_window,
/* Sets method-specific functions */
switch( i_method )
{
#ifdef VIDEO_DUMMY
case VOUT_DUMMY_METHOD:
p_vout->p_sys_create = vout_DummySysCreate;
p_vout->p_sys_init = vout_DummySysInit;
......@@ -93,6 +94,7 @@ vout_thread_t * vout_CreateThread ( char *psz_display, int i_root_window,
p_vout->p_sys_manage = vout_DummySysManage;
p_vout->p_sys_display = vout_DummySysDisplay;
break;
#endif
#ifdef VIDEO_X11
case VOUT_X11_METHOD:
p_vout->p_sys_create = vout_X11SysCreate;
......@@ -1915,7 +1917,7 @@ static void Synchronize( vout_thread_t *p_vout, s64 i_delay )
{
int i_synchro_inc = 0;
//???? gore following
static int i_panic_count = 0;
//static int i_panic_count = 0;
static int i_last_synchro_inc = 0;
static float r_synchro_level = VOUT_SYNCHRO_LEVEL_START;
static int i_truc = 1;
......
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