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 */
......
This diff is collapsed.
......@@ -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