Commit f8da8c95 authored by Sam Hocevar's avatar Sam Hocevar

. all plugins now compile with -fPIC.

 . made the audio_output API a bit simpler.

 . got rid of modules_config.h.

 . fixed `make install' rule.

 . fixed warnings in the MMX YUV compilation.

 . probably fixed a bug in the input : pp_foo structures were free()d at
   the end, but this was useless since the last call to realloc() is
   equivalent to free(), and two consecutive calls to free() aren't a
   goo idea.

 . we check that the version number match and that we don't already have
   a module by that name when loading a new module.

 . all public module_* functions now properly lock the module bank.

 . the audio_output now uses the new module API ; EsounD and DSP modules
   have been ported, which should be enough for Henri to port the ALSA one.


   The new plugin API is now much simpler ; it's now just a matter of
calling module_Need( p_main->p_module_bank, MODULE_CAPABILITY_FOO, p_data );
and if successful we get the best module. Capabilities can be ORed, so that
one can ask for a plugin that does VOUT _and_ INTF actions for instance.

   It's not complete yet though -- by making it generic I had to do a few
ugly casts here and there, which I am going to fix ASAP. Also, command line
selection of a plugin does not work yet.

   The switch to the new plugin API has probably broken the BeOS audio
output ; we can either wait until the whole vlc has switched to the new
plugins, or create a separate beos_sound.so that conforms to the new API.
parent b7b3386b
...@@ -150,9 +150,7 @@ endif ...@@ -150,9 +150,7 @@ endif
# #
# C compiler flags: plugin compilation # C compiler flags: plugin compilation
# #
ifneq (,$(findstring solaris,$(SYS)))
PCFLAGS += -fPIC PCFLAGS += -fPIC
endif
# #
# C compiler flags: dependancies # C compiler flags: dependancies
...@@ -407,9 +405,9 @@ install: ...@@ -407,9 +405,9 @@ install:
mkdir -p $(prefix)/bin mkdir -p $(prefix)/bin
$(INSTALL) vlc $(prefix)/bin $(INSTALL) vlc $(prefix)/bin
# ugly # ugly
for alias in "" @ALIASES@ ; do if test $$alias ; then ln -s vlc $(prefix)/bin/$$alias ; fi ; done for alias in "" @ALIASES@ ; do if test $$alias ; then rm -f $(prefix)/bin/$$alias && ln -s vlc $(prefix)/bin/$$alias ; fi ; done
mkdir -p $(prefix)/lib/videolan/vlc mkdir -p $(prefix)/lib/videolan/vlc
$(INSTALL) -m 644 $(PLUGINS) $(prefix)/lib/videolan/vlc $(INSTALL) -m 644 $(PLUGINS:%=lib/%.so) $(prefix)/lib/videolan/vlc
mkdir -p $(prefix)/share/videolan mkdir -p $(prefix)/share/videolan
$(INSTALL) -m 644 share/*.psf $(prefix)/share/videolan $(INSTALL) -m 644 share/*.psf $(prefix)/share/videolan
$(INSTALL) -m 644 share/*.png $(prefix)/share/videolan $(INSTALL) -m 644 share/*.png $(prefix)/share/videolan
...@@ -478,11 +476,11 @@ $(STD_PLUGIN_OBJ): %.o: %.c ...@@ -478,11 +476,11 @@ $(STD_PLUGIN_OBJ): %.o: %.c
$(PLUGIN_GNOME): %.o: Makefile.dep $(PLUGIN_GNOME): %.o: Makefile.dep
$(PLUGIN_GNOME): %.o: %.c $(PLUGIN_GNOME): %.o: %.c
$(CC) $(CFLAGS) `gnome-config --cflags gnomeui` -c -o $@ $< $(CC) $(CFLAGS) $(PCFLAGS) `gnome-config --cflags gnomeui` -c -o $@ $<
$(PLUGIN_GLIDE): %.o: Makefile.dep $(PLUGIN_GLIDE): %.o: Makefile.dep
$(PLUGIN_GLIDE): %.o: %.c $(PLUGIN_GLIDE): %.o: %.c
$(CC) $(CFLAGS) -I/usr/include/glide -c -o $@ $< $(CC) $(CFLAGS) $(PCFLAGS) -I/usr/include/glide -c -o $@ $<
# #
# Real targets # Real targets
...@@ -501,56 +499,56 @@ lib/beos.so: $(PLUGIN_BEOS) ...@@ -501,56 +499,56 @@ lib/beos.so: $(PLUGIN_BEOS)
lib/esd.so: $(PLUGIN_ESD) lib/esd.so: $(PLUGIN_ESD)
ifneq (,$(findstring bsd,$(SYS))) ifneq (,$(findstring bsd,$(SYS)))
$(CC) $(LCFLAGS) -shared -lesd -o $@ $^ $(CC) -shared -lesd -o $@ $^ $(LCFLAGS) -lesd
else else
$(CC) $(LCFLAGS) -shared -laudiofile -lesd -o $@ $^ $(CC) -shared -o $@ $^ $(LCFLAGS) -laudiofile -lesd
endif endif
lib/dsp.so: $(PLUGIN_DSP) lib/dsp.so: $(PLUGIN_DSP)
$(CC) $(LCFLAGS) -shared -o $@ $^ $(CC) -shared -o $@ $^ $(LCFLAGS)
lib/alsa.so: $(PLUGIN_ALSA) lib/alsa.so: $(PLUGIN_ALSA)
$(CC) $(LCFLAGS) -shared -o $@ $^ $(CC) -shared -o $@ $^ $(LCFLAGS)
lib/null.so: $(PLUGIN_NULL) lib/null.so: $(PLUGIN_NULL)
$(CC) $(LCFLAGS) -shared -o $@ $^ $(CC) -shared -o $@ $^ $(LCFLAGS)
lib/dummy.so: $(PLUGIN_DUMMY) lib/dummy.so: $(PLUGIN_DUMMY)
$(CC) $(LCFLAGS) -shared -o $@ $^ $(CC) -shared -o $@ $^ $(LCFLAGS)
lib/fb.so: $(PLUGIN_FB) lib/fb.so: $(PLUGIN_FB)
$(CC) $(LCFLAGS) -shared -o $@ $^ $(CC) -shared -o $@ $^ $(LCFLAGS)
lib/x11.so: $(PLUGIN_X11) lib/x11.so: $(PLUGIN_X11)
$(CC) $(LCFLAGS) -shared -L/usr/X11R6/lib -lX11 -lXext -o $@ $^ $(CC) -shared -L/usr/X11R6/lib -o $@ $^ $(LCFLAGS) -lX11 -lXext
lib/mga.so: $(PLUGIN_MGA) lib/mga.so: $(PLUGIN_MGA)
$(CC) $(LCFLAGS) -shared -L/usr/X11R6/lib -lX11 -lXext -o $@ $^ $(CC) -shared -L/usr/X11R6/lib -o $@ $^ $(LCFLAGS) -lX11 -lXext
lib/gnome.so: $(PLUGIN_GNOME) lib/gnome.so: $(PLUGIN_GNOME)
$(CC) $(LCFLAGS) -shared `gnome-config --libs gnomeui | sed 's,-rdynamic,,'` -o $@ $^ $(CC) -shared -o $@ $^ $(LCFLAGS) `gnome-config --libs gnomeui | sed 's,-rdynamic,,'`
lib/glide.so: $(PLUGIN_GLIDE) lib/glide.so: $(PLUGIN_GLIDE)
$(CC) $(LCFLAGS) -shared $(LIB_GLIDE) -o $@ $^ $(CC) -shared $(LIB_GLIDE) -o $@ $^ $(LCFLAGS)
lib/ggi.so: $(PLUGIN_GGI) lib/ggi.so: $(PLUGIN_GGI)
$(CC) $(LCFLAGS) -shared $(LIB_GGI) -o $@ $^ $(CC) -shared $(LIB_GGI) -o $@ $^ $(LCFLAGS)
lib/sdl.so: $(PLUGIN_SDL) lib/sdl.so: $(PLUGIN_SDL)
$(CC) $(LCFLAGS) -shared $(LIB_SDL) -o $@ $^ $(CC) -shared $(LIB_SDL) -o $@ $^ $(LCFLAGS)
lib/yuv.so: $(PLUGIN_YUV) lib/yuv.so: $(PLUGIN_YUV)
ifeq ($(SYS),beos) ifeq ($(SYS),beos)
$(CC) $(CFLAGS) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_ $(CC) $(CFLAGS) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_
else else
$(CC) $(LCFLAGS) -shared -o $@ $^ $(CC) -shared -o $@ $^ $(LCFLAGS)
endif endif
lib/yuvmmx.so: $(PLUGIN_YUVMMX) lib/yuvmmx.so: $(PLUGIN_YUVMMX)
ifeq ($(SYS),beos) ifeq ($(SYS),beos)
$(CC) $(CFLAGS) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_ $(CC) $(CFLAGS) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_
else else
$(CC) $(LCFLAGS) -shared -o $@ $^ $(CC) -shared -o $@ $^ $(LCFLAGS)
endif endif
################################################################################ ################################################################################
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
#export DH_VERBOSE=1 #export DH_VERBOSE=1
# This is the debhelper compatability version to use. # This is the debhelper compatability version to use.
export DH_COMPAT=1 export DH_COMPAT=3
build: build-stamp build: build-stamp
build-stamp: build-stamp:
...@@ -15,9 +15,9 @@ build-stamp: ...@@ -15,9 +15,9 @@ build-stamp:
./configure --prefix=/usr \ ./configure --prefix=/usr \
--mandir=\$${prefix}/share/man \ --mandir=\$${prefix}/share/man \
--infodir=\$${prefix}/share/info \ --infodir=\$${prefix}/share/info \
--enable-mmx --enable-gnome --enable-fb \ --enable-gnome --enable-fb \
--enable-ggi --enable-esd --enable-glide \ --with-ggi --enable-esd --with-glide \
--enable-sdl --with-sdl
$(MAKE) $(MAKE)
touch build-stamp touch build-stamp
......
...@@ -120,16 +120,13 @@ typedef struct ...@@ -120,16 +120,13 @@ typedef struct
/***************************************************************************** /*****************************************************************************
* aout_thread_t : audio output thread descriptor * aout_thread_t : audio output thread descriptor
*****************************************************************************/ *****************************************************************************/
typedef int (aout_sys_open_t) ( p_aout_thread_t p_aout ); typedef int (aout_open_t) ( p_aout_thread_t p_aout );
typedef int (aout_sys_reset_t) ( p_aout_thread_t p_aout ); typedef int (aout_setformat_t) ( p_aout_thread_t p_aout );
typedef int (aout_sys_setformat_t) ( p_aout_thread_t p_aout ); typedef long (aout_getbufinfo_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,
long l_buffer_limit ); long l_buffer_limit );
typedef void (aout_sys_playsamples_t) ( p_aout_thread_t p_aout, typedef void (aout_play_t) ( p_aout_thread_t p_aout,
byte_t *buffer, int i_size ); byte_t *buffer, int i_size );
typedef void (aout_sys_close_t) ( p_aout_thread_t p_aout ); typedef void (aout_close_t) ( p_aout_thread_t p_aout );
typedef struct aout_thread_s typedef struct aout_thread_s
{ {
...@@ -140,15 +137,13 @@ typedef struct aout_thread_s ...@@ -140,15 +137,13 @@ typedef struct aout_thread_s
vlc_mutex_t fifos_lock; vlc_mutex_t fifos_lock;
aout_fifo_t fifo[ AOUT_MAX_FIFOS ]; aout_fifo_t fifo[ AOUT_MAX_FIFOS ];
/* Plugins */ /* Plugin used and shortcuts to access its capabilities */
aout_sys_open_t * p_sys_open; struct module_s * p_module;
aout_sys_reset_t * p_sys_reset; aout_open_t * p_open;
aout_sys_setformat_t * p_sys_setformat; aout_setformat_t * p_setformat;
aout_sys_setchannels_t * p_sys_setchannels; aout_getbufinfo_t * p_getbufinfo;
aout_sys_setrate_t * p_sys_setrate; aout_play_t * p_play;
aout_sys_getbufinfo_t * p_sys_getbufinfo; aout_close_t * p_close;
aout_sys_playsamples_t * p_sys_playsamples;
aout_sys_close_t * p_sys_close;
void * buffer; void * buffer;
/* The s32 buffer is used to mix all the audio fifos together before /* The s32 buffer is used to mix all the audio fifos together before
......
...@@ -31,8 +31,90 @@ typedef void * module_handle_t; ...@@ -31,8 +31,90 @@ typedef void * module_handle_t;
#endif #endif
/***************************************************************************** /*****************************************************************************
* Configuration structure * Module capabilities.
*****************************************************************************/ *****************************************************************************/
#define MODULE_CAPABILITY_NULL 0 /* The Module can't do anything */
#define MODULE_CAPABILITY_INTF 1<<0 /* Interface */
#define MODULE_CAPABILITY_INPUT 1<<1 /* Input */
#define MODULE_CAPABILITY_DECAPS 1<<2 /* Decaps */
#define MODULE_CAPABILITY_ADEC 1<<3 /* Audio decoder */
#define MODULE_CAPABILITY_VDEC 1<<4 /* Video decoder */
#define MODULE_CAPABILITY_AOUT 1<<5 /* Audio output */
#define MODULE_CAPABILITY_VOUT 1<<6 /* Video output */
#define MODULE_CAPABILITY_YUV 1<<7 /* YUV colorspace conversion */
#define MODULE_CAPABILITY_AFX 1<<8 /* Audio effects */
#define MODULE_CAPABILITY_VFX 1<<9 /* Video effects */
/* FIXME: not yet used */
typedef struct probedata_s
{
struct
{
char * psz_data;
} aout;
} probedata_t;
/* FIXME: find a nicer way to do this. */
typedef struct function_list_s
{
int ( * p_probe ) ( probedata_t * p_data );
union
{
struct
{
int ( * p_open ) ( struct aout_thread_s * p_aout );
int ( * p_setformat ) ( struct aout_thread_s * p_aout );
long ( * p_getbufinfo ) ( struct aout_thread_s * p_aout,
long l_buffer_info );
void ( * p_play ) ( struct aout_thread_s * p_aout,
byte_t *buffer, int i_size );
void ( * p_close ) ( struct aout_thread_s * p_aout );
} aout;
} functions;
} function_list_t;
typedef struct module_functions_s
{
/* The order here has to be the same as above for the #defines */
function_list_t intf;
function_list_t input;
function_list_t decaps;
function_list_t adec;
function_list_t vdec;
function_list_t aout;
function_list_t vout;
function_list_t yuv;
function_list_t afx;
function_list_t vfx;
} module_functions_t;
typedef struct module_functions_s * p_module_functions_t;
/*****************************************************************************
* Macros used to build the configuration structure.
*****************************************************************************/
/* Mandatory first and last parts of the structure */
#define MODULE_CONFIG_ITEM_START 0x01 /* The main window */
#define MODULE_CONFIG_ITEM_END 0x00 /* End of the window */
/* Configuration widgets */
#define MODULE_CONFIG_ITEM_PANE 0x02 /* A notebook pane */
#define MODULE_CONFIG_ITEM_FRAME 0x03 /* A frame */
#define MODULE_CONFIG_ITEM_COMMENT 0x04 /* A comment text */
#define MODULE_CONFIG_ITEM_STRING 0x05 /* A string */
#define MODULE_CONFIG_ITEM_FILE 0x06 /* A file selector */
#define MODULE_CONFIG_ITEM_CHECK 0x07 /* A checkbox */
#define MODULE_CONFIG_ITEM_CHOOSE 0x08 /* A choose box */
#define MODULE_CONFIG_ITEM_RADIO 0x09 /* A radio box */
#define MODULE_CONFIG_ITEM_SCALE 0x0a /* A horizontal ruler */
#define MODULE_CONFIG_ITEM_SPIN 0x0b /* A numerical selector */
typedef struct module_config_s typedef struct module_config_s
{ {
int i_type; /* Configuration widget type */ int i_type; /* Configuration widget type */
...@@ -46,7 +128,16 @@ typedef struct module_config_s ...@@ -46,7 +128,16 @@ typedef struct module_config_s
* Bank and module description structures * Bank and module description structures
*****************************************************************************/ *****************************************************************************/
/* The main module structure */ /* The module bank structure */
typedef struct module_bank_s
{
struct module_s * first; /* First module of the bank */
vlc_mutex_t lock; /* Global lock -- you can't imagine how awful it
is to design thread-safe linked lists. */
} module_bank_t;
/* The module description structure */
typedef struct module_s typedef struct module_s
{ {
boolean_t b_builtin; /* Set to true if the module is built in */ boolean_t b_builtin; /* Set to true if the module is built in */
...@@ -64,20 +155,12 @@ typedef struct module_s ...@@ -64,20 +155,12 @@ typedef struct module_s
struct module_s * next; /* Next module */ struct module_s * next; /* Next module */
struct module_s * prev; /* Previous module */ struct module_s * prev; /* Previous module */
u32 i_capabilities; /* Capability list */
module_config_t * p_config; /* Module configuration structure table */ module_config_t * p_config; /* Module configuration structure table */
} module_t; u32 i_capabilities; /* Capability list */
p_module_functions_t p_functions; /* Capability functions */
/* The module bank structure */
typedef struct module_bank_s
{
module_t * first; /* First module of the bank */
vlc_mutex_t lock; /* Global lock -- you can't imagine how awful it } module_t;
is to design thread-safe linked lists. */
} module_bank_t;
/***************************************************************************** /*****************************************************************************
* Exported functions. * Exported functions.
...@@ -88,6 +171,8 @@ void module_DestroyBank ( module_bank_t * p_bank ); ...@@ -88,6 +171,8 @@ void module_DestroyBank ( module_bank_t * p_bank );
void module_ResetBank ( module_bank_t * p_bank ); void module_ResetBank ( module_bank_t * p_bank );
void module_ManageBank ( module_bank_t * p_bank ); void module_ManageBank ( module_bank_t * p_bank );
int module_Need ( module_t * p_module ); module_t * module_Need ( module_bank_t *p_bank,
int module_Unneed ( module_t * p_module ); int i_capabilities, void *p_data );
void module_Unneed ( module_bank_t * p_bank,
module_t * p_module );
/*****************************************************************************
* modules_config.h : Module configuration tools.
*****************************************************************************
* Copyright (C) 2001 VideoLAN
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
* 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.
*****************************************************************************/
/*****************************************************************************
* Module capabilities.
*****************************************************************************/
#define MODULE_CAPABILITY_NULL 0 /* The Module can't do anything */
#define MODULE_CAPABILITY_INTF 1<<0 /* Interface */
#define MODULE_CAPABILITY_INPUT 1<<1 /* Input */
#define MODULE_CAPABILITY_DECAPS 1<<2 /* Decaps */
#define MODULE_CAPABILITY_ADEC 1<<3 /* Audio decoder */
#define MODULE_CAPABILITY_VDEC 1<<4 /* Video decoder */
#define MODULE_CAPABILITY_AOUT 1<<5 /* Audio output */
#define MODULE_CAPABILITY_VOUT 1<<6 /* Video output */
#define MODULE_CAPABILITY_YUV 1<<7 /* YUV colorspace conversion */
#define MODULE_CAPABILITY_AFX 1<<8 /* Audio effects */
#define MODULE_CAPABILITY_VFX 1<<9 /* Video effects */
/*****************************************************************************
* Macros used to build the configuration structure.
*****************************************************************************/
/* Mandatory first and last parts of the structure */
#define MODULE_CONFIG_ITEM_START 0x01 /* The main window */
#define MODULE_CONFIG_ITEM_END 0x00 /* End of the window */
/* Configuration widgets */
#define MODULE_CONFIG_ITEM_PANE 0x02 /* A notebook pane */
#define MODULE_CONFIG_ITEM_FRAME 0x03 /* A frame */
#define MODULE_CONFIG_ITEM_COMMENT 0x04 /* A comment text */
#define MODULE_CONFIG_ITEM_STRING 0x05 /* A string */
#define MODULE_CONFIG_ITEM_FILE 0x06 /* A file selector */
#define MODULE_CONFIG_ITEM_CHECK 0x07 /* A checkbox */
#define MODULE_CONFIG_ITEM_CHOOSE 0x08 /* A choose box */
#define MODULE_CONFIG_ITEM_RADIO 0x09 /* A radio box */
#define MODULE_CONFIG_ITEM_SCALE 0x0a /* A horizontal ruler */
#define MODULE_CONFIG_ITEM_SPIN 0x0b /* A numerical selector */
...@@ -52,12 +52,9 @@ static void aout_GetPlugin( p_aout_thread_t p_aout ); ...@@ -52,12 +52,9 @@ static void aout_GetPlugin( p_aout_thread_t p_aout );
/* Audio output */ /* Audio output */
int aout_AlsaOpen ( aout_thread_t *p_aout ); int aout_AlsaOpen ( aout_thread_t *p_aout );
int aout_AlsaReset ( aout_thread_t *p_aout );
int aout_AlsaSetFormat ( aout_thread_t *p_aout ); int aout_AlsaSetFormat ( aout_thread_t *p_aout );
int aout_AlsaSetChannels ( aout_thread_t *p_aout );
int aout_AlsaSetRate ( aout_thread_t *p_aout );
long aout_AlsaGetBufInfo ( aout_thread_t *p_aout, long l_buffer_info ); long aout_AlsaGetBufInfo ( aout_thread_t *p_aout, long l_buffer_info );
void aout_AlsaPlaySamples ( aout_thread_t *p_aout, byte_t *buffer, void aout_AlsaPlay ( aout_thread_t *p_aout, byte_t *buffer,
int i_size ); int i_size );
void aout_AlsaClose ( aout_thread_t *p_aout ); void aout_AlsaClose ( aout_thread_t *p_aout );
...@@ -96,12 +93,9 @@ plugin_info_t * GetConfig( void ) ...@@ -96,12 +93,9 @@ plugin_info_t * GetConfig( void )
static void aout_GetPlugin( p_aout_thread_t p_aout ) static void aout_GetPlugin( p_aout_thread_t p_aout )
{ {
p_aout->p_sys_open = aout_AlsaOpen; p_aout->p_open = aout_AlsaOpen;
p_aout->p_sys_reset = aout_AlsaReset; p_aout->p_setformat = aout_AlsaSetFormat;
p_aout->p_sys_setformat = aout_AlsaSetFormat; p_aout->p_getbufinfo = aout_AlsaGetBufInfo;
p_aout->p_sys_setchannels = aout_AlsaSetChannels; p_aout->p_play = aout_AlsaPlay;
p_aout->p_sys_setrate = aout_AlsaSetRate; p_aout->p_close = aout_AlsaClose;
p_aout->p_sys_getbufinfo = aout_AlsaGetBufInfo;
p_aout->p_sys_playsamples = aout_AlsaPlaySamples;
p_aout->p_sys_close = aout_AlsaClose;
} }
...@@ -204,39 +204,6 @@ int aout_AlsaSetFormat ( aout_thread_t *p_aout ) ...@@ -204,39 +204,6 @@ int aout_AlsaSetFormat ( aout_thread_t *p_aout )
return ( 0 ); return ( 0 );
} }
/*****************************************************************************
* aout_AlsaReset: resets the dsp
*****************************************************************************/
int aout_AlsaReset ( aout_thread_t *p_aout )
{
/* TODO : put something in here, such as close and open again
* or check status, drain, flush, .... */
return ( 0 );
}
/*****************************************************************************
* aout_AlsaSetChannels: sets mono, stereo and other modes
*****************************************************************************/
int aout_AlsaSetChannels ( aout_thread_t *p_aout )
{
/* TODO : normally, nothing
* everything should be done in the AlsaSetFormat, as far a I understand
* the alsa documentation
*/
return ( 0 );
}
/*****************************************************************************
* aout_AlsaSetRate: sets the audio output rate
*****************************************************************************
* As in the previous function, the rate is supposed to be set in the
* AlsaSetFormat function
*****************************************************************************/
int aout_AlsaSetRate ( aout_thread_t *p_aout )
{
return ( 0 );
}
/***************************************************************************** /*****************************************************************************
* aout_AlsaGetBufInfo: buffer status query * aout_AlsaGetBufInfo: buffer status query
*****************************************************************************/ *****************************************************************************/
...@@ -286,9 +253,9 @@ long aout_AlsaGetBufInfo ( aout_thread_t *p_aout, long l_buffer_limit ) ...@@ -286,9 +253,9 @@ long aout_AlsaGetBufInfo ( aout_thread_t *p_aout, long l_buffer_limit )
} }
/***************************************************************************** /*****************************************************************************
* aout_AlsaPlaySamples * aout_AlsaPlay
*****************************************************************************/ *****************************************************************************/
void aout_AlsaPlaySamples ( aout_thread_t *p_aout, byte_t *buffer, int i_size ) void aout_AlsaPlay ( aout_thread_t *p_aout, byte_t *buffer, int i_size )
{ {
int i_write_returns; int i_write_returns;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* aout_beos.cpp: beos interface * aout_beos.cpp: beos interface
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000 VideoLAN
* $Id: aout_beos.cpp,v 1.7 2001/01/05 18:46:43 massiot Exp $ * $Id: aout_beos.cpp,v 1.8 2001/01/07 16:17:58 sam Exp $
* *
* Authors: * Authors:
* Samuel Hocevar <sam@via.ecp.fr> * Samuel Hocevar <sam@via.ecp.fr>
...@@ -135,13 +135,6 @@ int aout_BeOpen( aout_thread_t *p_aout ) ...@@ -135,13 +135,6 @@ int aout_BeOpen( aout_thread_t *p_aout )
return( 0 ); return( 0 );
} }
/*****************************************************************************
* aout_BeReset: resets the dsp
*****************************************************************************/
int aout_BeReset( aout_thread_t *p_aout )
{
return( 0 );
}
/***************************************************************************** /*****************************************************************************
* aout_BeSetFormat: sets the dsp output format * aout_BeSetFormat: sets the dsp output format
...@@ -151,22 +144,6 @@ int aout_BeSetFormat( aout_thread_t *p_aout ) ...@@ -151,22 +144,6 @@ int aout_BeSetFormat( aout_thread_t *p_aout )
return( 0 ); return( 0 );
} }
/*****************************************************************************
* aout_BeSetChannels: sets the dsp's stereo or mono mode
*****************************************************************************/
int aout_BeSetChannels( aout_thread_t *p_aout )
{
return( 0 );
}
/*****************************************************************************
* aout_BeSetRate: sets the dsp's audio output rate
*****************************************************************************/
int aout_BeSetRate( aout_thread_t *p_aout )
{
return( 0 );
}
/***************************************************************************** /*****************************************************************************
* aout_BeGetBufInfo: buffer status query * aout_BeGetBufInfo: buffer status query
*****************************************************************************/ *****************************************************************************/
...@@ -185,11 +162,11 @@ long aout_BeGetBufInfo( aout_thread_t *p_aout, long l_buffer_limit ) ...@@ -185,11 +162,11 @@ long aout_BeGetBufInfo( aout_thread_t *p_aout, long l_buffer_limit )
} }
/***************************************************************************** /*****************************************************************************
* aout_BePlaySamples: plays a sound samples buffer * aout_BePlay: plays a sound samples buffer
***************************************************************************** *****************************************************************************
* This function writes a buffer of i_length bytes in the dsp * This function writes a buffer of i_length bytes in the dsp
*****************************************************************************/ *****************************************************************************/
void aout_BePlaySamples( aout_thread_t *p_aout, byte_t *buffer, int i_size ) void aout_BePlay( aout_thread_t *p_aout, byte_t *buffer, int i_size )
{ {
long i_newbuf_pos; long i_newbuf_pos;
......
...@@ -54,7 +54,7 @@ int aout_BeSetFormat ( aout_thread_t *p_aout ); ...@@ -54,7 +54,7 @@ int aout_BeSetFormat ( aout_thread_t *p_aout );
int aout_BeSetChannels ( aout_thread_t *p_aout ); int aout_BeSetChannels ( aout_thread_t *p_aout );
int aout_BeSetRate ( aout_thread_t *p_aout ); int aout_BeSetRate ( aout_thread_t *p_aout );
long aout_BeGetBufInfo ( aout_thread_t *p_aout, long l_buffer_info ); long aout_BeGetBufInfo ( aout_thread_t *p_aout, long l_buffer_info );
void aout_BePlaySamples ( aout_thread_t *p_aout, byte_t *buffer, void aout_BePlay ( aout_thread_t *p_aout, byte_t *buffer,
int i_size ); int i_size );
void aout_BeClose ( aout_thread_t *p_aout ); void aout_BeClose ( aout_thread_t *p_aout );
...@@ -102,14 +102,11 @@ plugin_info_t * GetConfig( void ) ...@@ -102,14 +102,11 @@ plugin_info_t * GetConfig( void )
static void aout_GetPlugin( p_aout_thread_t p_aout ) static void aout_GetPlugin( p_aout_thread_t p_aout )
{ {
p_aout->p_sys_open = aout_BeOpen; p_aout->p_open = aout_BeOpen;
p_aout->p_sys_reset = aout_BeReset; p_aout->p_setformat = aout_BeSetFormat;
p_aout->p_sys_setformat = aout_BeSetFormat; p_aout->p_getbufinfo = aout_BeGetBufInfo;
p_aout->p_sys_setchannels = aout_BeSetChannels; p_aout->p_play = aout_BePlay;
p_aout->p_sys_setrate = aout_BeSetRate; p_aout->p_close = aout_BeClose;
p_aout->p_sys_getbufinfo = aout_BeGetBufInfo;
p_aout->p_sys_playsamples = aout_BePlaySamples;
p_aout->p_sys_close = aout_BeClose;
} }
static void vout_GetPlugin( p_vout_thread_t p_vout ) static void vout_GetPlugin( p_vout_thread_t p_vout )
......
This diff is collapsed.
/***************************************************************************** /*****************************************************************************
* dsp.c : OSS /dev/dsp plugin for vlc * dsp.c : OSS /dev/dsp module for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2000 VideoLAN * Copyright (C) 2000 VideoLAN
* *
* Authors: * Authors: Michel Kaempf <maxx@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
* *
* 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
...@@ -20,98 +21,92 @@ ...@@ -20,98 +21,92 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/ *****************************************************************************/
#define MODULE_NAME dsp
/***************************************************************************** /*****************************************************************************
* Preamble * Preamble
*****************************************************************************/ *****************************************************************************/
#include "defs.h" #include "defs.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdlib.h> /* malloc(), free() */ #include <stdlib.h> /* malloc(), free() */
#include <unistd.h> /* close() */ #include <string.h> /* strdup() */
#include "config.h" #include "config.h"
#include "common.h" /* boolean_t, byte_t */ #include "common.h" /* boolean_t, byte_t */
#include "threads.h" #include "threads.h"
#include "mtime.h" #include "mtime.h"
#include "tests.h" #include "tests.h"
#include "plugins.h"
#include "interface.h" #include "modules.h"
#include "audio_output.h" #include "modules_inner.h"
#include "video.h"
#include "video_output.h"
#include "main.h" /*****************************************************************************
* Build configuration tree.
*****************************************************************************/
MODULE_CONFIG_START( "Configuration for dsp module" )
ADD_FRAME( "OSS Device" )
ADD_FILE( "Device name: ", MODULE_VAR(device), NULL )
MODULE_CONFIG_END
/***************************************************************************** /*****************************************************************************
* Exported prototypes * Capabilities defined in the other files.
*****************************************************************************/ *****************************************************************************/
static void aout_GetPlugin( p_aout_thread_t p_aout ); void dsp_aout_getfunctions( function_list_t * p_function_list );
/* Audio output */
int aout_DspOpen ( aout_thread_t *p_aout );
int aout_DspReset ( aout_thread_t *p_aout );
int aout_DspSetFormat ( aout_thread_t *p_aout );
int aout_DspSetChannels ( aout_thread_t *p_aout );
int aout_DspSetRate ( aout_thread_t *p_aout );
long aout_DspGetBufInfo ( aout_thread_t *p_aout, long l_buffer_info );
void aout_DspPlaySamples ( aout_thread_t *p_aout, byte_t *buffer,
int i_size );
void aout_DspClose ( aout_thread_t *p_aout );
/***************************************************************************** /*****************************************************************************
* GetConfig: get the plugin structure and configuration * InitModule: get the module structure and configuration.
*****************************************************************************
* We have to fill psz_name, psz_longname and psz_version. These variables
* will be strdup()ed later by the main application because the module can
* be unloaded later to save memory, and we want to be able to access this
* data even after the module has been unloaded.
*****************************************************************************/ *****************************************************************************/
plugin_info_t * GetConfig( void ) int InitModule( module_t * p_module )
{ {
int i_fd; p_module->psz_name = MODULE_STRING;
plugin_info_t * p_info = (plugin_info_t *) malloc( sizeof(plugin_info_t) ); p_module->psz_longname = "Linux OSS /dev/dsp module";
p_module->psz_version = VERSION;
p_info->psz_name = "OSS /dev/dsp"; p_module->i_capabilities = MODULE_CAPABILITY_NULL
p_info->psz_version = VERSION; | MODULE_CAPABILITY_AOUT;
p_info->psz_author = "the VideoLAN team <vlc@videolan.org>";
p_info->aout_GetPlugin = aout_GetPlugin; return( 0 );
p_info->vout_GetPlugin = NULL; }
p_info->intf_GetPlugin = NULL;
p_info->yuv_GetPlugin = NULL;
/* Test if the device can be opened */ /*****************************************************************************
if ( (i_fd = open( main_GetPszVariable( AOUT_DSP_VAR, AOUT_DSP_DEFAULT ), * ActivateModule: set the module to an usable state.
O_WRONLY|O_NONBLOCK )) < 0 ) *****************************************************************************
{ * This function fills the capability functions and the configuration
p_info->i_score = 0; * structure. Once ActivateModule() has been called, the i_usage can
} * be set to 0 and calls to NeedModule() be made to increment it. To unload
else * the module, one has to wait until i_usage == 0 and call DeactivateModule().
*****************************************************************************/
int ActivateModule( module_t * p_module )
{
p_module->p_functions = malloc( sizeof( module_functions_t ) );
if( p_module->p_functions == NULL )
{ {
close( i_fd ); return( -1 );
p_info->i_score = 0x100;
} }
/* If this plugin was requested, score it higher */ dsp_aout_getfunctions( &p_module->p_functions->aout );
if( TestMethod( AOUT_METHOD_VAR, "dsp" ) )
{
p_info->i_score += 0x200;
}
return( p_info ); p_module->p_config = p_config;
return( 0 );
} }
/***************************************************************************** /*****************************************************************************
* Following functions are only called through the p_info structure * DeactivateModule: make sure the module can be unloaded.
*****************************************************************************
* This function must only be called when i_usage == 0. If it successfully
* returns, i_usage can be set to -1 and the module unloaded. Be careful to
* lock usage_lock during the whole process.
*****************************************************************************/ *****************************************************************************/
int DeactivateModule( module_t * p_module )
static void aout_GetPlugin( p_aout_thread_t p_aout )
{ {
p_aout->p_sys_open = aout_DspOpen; free( p_module->p_functions );
p_aout->p_sys_reset = aout_DspReset;
p_aout->p_sys_setformat = aout_DspSetFormat; return( 0 );
p_aout->p_sys_setchannels = aout_DspSetChannels;
p_aout->p_sys_setrate = aout_DspSetRate;
p_aout->p_sys_getbufinfo = aout_DspGetBufInfo;
p_aout->p_sys_playsamples = aout_DspPlaySamples;
p_aout->p_sys_close = aout_DspClose;
} }
...@@ -60,14 +60,6 @@ int aout_DummyOpen( aout_thread_t *p_aout ) ...@@ -60,14 +60,6 @@ int aout_DummyOpen( aout_thread_t *p_aout )
return( 0 ); return( 0 );
} }
/*****************************************************************************
* aout_DummyReset: fake reset
*****************************************************************************/
int aout_DummyReset( aout_thread_t *p_aout )
{
return( 0 );
}
/***************************************************************************** /*****************************************************************************
* aout_DummySetFormat: pretends to set the dsp output format * aout_DummySetFormat: pretends to set the dsp output format
*****************************************************************************/ *****************************************************************************/
...@@ -76,22 +68,6 @@ int aout_DummySetFormat( aout_thread_t *p_aout ) ...@@ -76,22 +68,6 @@ int aout_DummySetFormat( aout_thread_t *p_aout )
return( 0 ); return( 0 );
} }
/*****************************************************************************
* aout_DummySetChannels: pretends to set stereo or mono mode
*****************************************************************************/
int aout_DummySetChannels( aout_thread_t *p_aout )
{
return( 0 );
}
/*****************************************************************************
* aout_DummySetRate: pretends to set audio output rate
*****************************************************************************/
int aout_DummySetRate( aout_thread_t *p_aout )
{
return( 0 );
}
/***************************************************************************** /*****************************************************************************
* aout_DummyGetBufInfo: returns available bytes in buffer * aout_DummyGetBufInfo: returns available bytes in buffer
*****************************************************************************/ *****************************************************************************/
...@@ -101,10 +77,11 @@ long aout_DummyGetBufInfo( aout_thread_t *p_aout, long l_buffer_limit ) ...@@ -101,10 +77,11 @@ long aout_DummyGetBufInfo( aout_thread_t *p_aout, long l_buffer_limit )
} }
/***************************************************************************** /*****************************************************************************
* aout_DummyPlaySamples: pretends to play a sound * aout_DummyPlay: pretends to play a sound
*****************************************************************************/ *****************************************************************************/
void aout_DummyPlaySamples( aout_thread_t *p_aout, byte_t *buffer, int i_size ) void aout_DummyPlay( aout_thread_t *p_aout, byte_t *buffer, int i_size )
{ {
;
} }
/***************************************************************************** /*****************************************************************************
......
...@@ -48,12 +48,9 @@ static void intf_GetPlugin( p_intf_thread_t p_intf ); ...@@ -48,12 +48,9 @@ static void intf_GetPlugin( p_intf_thread_t p_intf );
/* Audio output */ /* Audio output */
int aout_DummyOpen ( aout_thread_t *p_aout ); int aout_DummyOpen ( aout_thread_t *p_aout );
int aout_DummyReset ( aout_thread_t *p_aout );
int aout_DummySetFormat ( aout_thread_t *p_aout ); int aout_DummySetFormat ( aout_thread_t *p_aout );
int aout_DummySetChannels ( aout_thread_t *p_aout );
int aout_DummySetRate ( aout_thread_t *p_aout );
long aout_DummyGetBufInfo ( aout_thread_t *p_aout, long l_buffer_info ); long aout_DummyGetBufInfo ( aout_thread_t *p_aout, long l_buffer_info );
void aout_DummyPlaySamples ( aout_thread_t *p_aout, byte_t *buffer, void aout_DummyPlay ( aout_thread_t *p_aout, byte_t *buffer,
int i_size ); int i_size );
void aout_DummyClose ( aout_thread_t *p_aout ); void aout_DummyClose ( aout_thread_t *p_aout );
...@@ -114,14 +111,11 @@ plugin_info_t * GetConfig( void ) ...@@ -114,14 +111,11 @@ plugin_info_t * GetConfig( void )
static void aout_GetPlugin( p_aout_thread_t p_aout ) static void aout_GetPlugin( p_aout_thread_t p_aout )
{ {
p_aout->p_sys_open = aout_DummyOpen; p_aout->p_open = aout_DummyOpen;
p_aout->p_sys_reset = aout_DummyReset; p_aout->p_setformat = aout_DummySetFormat;
p_aout->p_sys_setformat = aout_DummySetFormat; p_aout->p_getbufinfo = aout_DummyGetBufInfo;
p_aout->p_sys_setchannels = aout_DummySetChannels; p_aout->p_play = aout_DummyPlay;
p_aout->p_sys_setrate = aout_DummySetRate; p_aout->p_close = aout_DummyClose;
p_aout->p_sys_getbufinfo = aout_DummyGetBufInfo;
p_aout->p_sys_playsamples = aout_DummyPlaySamples;
p_aout->p_sys_close = aout_DummyClose;
} }
static void vout_GetPlugin( p_vout_thread_t p_vout ) static void vout_GetPlugin( p_vout_thread_t p_vout )
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
***************************************************************************** *****************************************************************************
* Copyright (C) 2000 VideoLAN * Copyright (C) 2000 VideoLAN
* *
* Authors: * Authors: Samuel Hocevar <sam@zoy.org>
* *
* 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
...@@ -51,6 +51,8 @@ ...@@ -51,6 +51,8 @@
#include "intf_msg.h" /* intf_DbgMsg(), intf_ErrMsg() */ #include "intf_msg.h" /* intf_DbgMsg(), intf_ErrMsg() */
#include "main.h" #include "main.h"
#include "modules.h"
/***************************************************************************** /*****************************************************************************
* aout_sys_t: esd audio output method descriptor * aout_sys_t: esd audio output method descriptor
***************************************************************************** *****************************************************************************
...@@ -64,9 +66,47 @@ typedef struct aout_sys_s ...@@ -64,9 +66,47 @@ typedef struct aout_sys_s
} aout_sys_t; } aout_sys_t;
/***************************************************************************** /*****************************************************************************
* aout_EsdOpen: opens an esd socket * Local prototypes.
*****************************************************************************/ *****************************************************************************/
int aout_EsdOpen( aout_thread_t *p_aout ) static int aout_Probe ( probedata_t *p_data );
static int aout_Open ( aout_thread_t *p_aout );
static int aout_SetFormat ( aout_thread_t *p_aout );
static long aout_GetBufInfo ( aout_thread_t *p_aout, long l_buffer_info );
static void aout_Play ( aout_thread_t *p_aout,
byte_t *buffer, int i_size );
static void aout_Close ( aout_thread_t *p_aout );
/*****************************************************************************
* Functions exported as capabilities. They are declared as static so that
* we don't pollute the namespace too much.
*****************************************************************************/
void esd_aout_getfunctions( function_list_t * p_function_list )
{
p_function_list->p_probe = aout_Probe;
p_function_list->functions.aout.p_open = aout_Open;
p_function_list->functions.aout.p_setformat = aout_SetFormat;
p_function_list->functions.aout.p_getbufinfo = aout_GetBufInfo;
p_function_list->functions.aout.p_play = aout_Play;
p_function_list->functions.aout.p_close = aout_Close;
}
/*****************************************************************************
* aout_Probe: probes the audio device and return a score
*****************************************************************************
* This function tries to open the dps and returns a score to the plugin
* manager so that it can
*****************************************************************************/
static int aout_Probe( probedata_t *p_data )
{
/* We don't have to test anything -- if we managed to open this plugin,
* it means we have the appropriate libs. */
return( 50 );
}
/*****************************************************************************
* aout_Open: open an esd socket
*****************************************************************************/
static int aout_Open( aout_thread_t *p_aout )
{ {
/* mpg123 does it this way */ /* mpg123 does it this way */
int i_bits = ESD_BITS16; int i_bits = ESD_BITS16;
...@@ -112,52 +152,28 @@ int aout_EsdOpen( aout_thread_t *p_aout ) ...@@ -112,52 +152,28 @@ int aout_EsdOpen( aout_thread_t *p_aout )
} }
/***************************************************************************** /*****************************************************************************
* aout_EsdReset: resets the dsp * aout_SetFormat: set the output format
*****************************************************************************/
int aout_EsdReset( aout_thread_t *p_aout )
{
return( 0 );
}
/*****************************************************************************
* aout_EsdSetFormat: sets the dsp output format
*****************************************************************************/
int aout_EsdSetFormat( aout_thread_t *p_aout )
{
return( 0 );
}
/*****************************************************************************
* aout_EsdSetChannels: sets the dsp's stereo or mono mode
*****************************************************************************/
int aout_EsdSetChannels( aout_thread_t *p_aout )
{
return( 0 );
}
/*****************************************************************************
* aout_EsdSetRate: sets the dsp's audio output rate
*****************************************************************************/ *****************************************************************************/
int aout_EsdSetRate( aout_thread_t *p_aout ) static int aout_SetFormat( aout_thread_t *p_aout )
{ {
return( 0 ); return( 0 );
} }
/***************************************************************************** /*****************************************************************************
* aout_EsdGetBufInfo: buffer status query * aout_GetBufInfo: buffer status query
*****************************************************************************/ *****************************************************************************/
long aout_EsdGetBufInfo( aout_thread_t *p_aout, long l_buffer_limit ) long aout_GetBufInfo( aout_thread_t *p_aout, long l_buffer_limit )
{ {
/* arbitrary value that should be changed */ /* arbitrary value that should be changed */
return( l_buffer_limit ); return( l_buffer_limit );
} }
/***************************************************************************** /*****************************************************************************
* aout_EsdPlaySamples: plays a sound samples buffer * aout_Play: play a sound samples buffer
***************************************************************************** *****************************************************************************
* This function writes a buffer of i_length bytes in the dsp * This function writes a buffer of i_length bytes in the socket
*****************************************************************************/ *****************************************************************************/
void aout_EsdPlaySamples( aout_thread_t *p_aout, byte_t *buffer, int i_size ) void aout_Play( aout_thread_t *p_aout, byte_t *buffer, int i_size )
{ {
int amount; int amount;
...@@ -182,9 +198,9 @@ void aout_EsdPlaySamples( aout_thread_t *p_aout, byte_t *buffer, int i_size ) ...@@ -182,9 +198,9 @@ void aout_EsdPlaySamples( aout_thread_t *p_aout, byte_t *buffer, int i_size )
} }
/***************************************************************************** /*****************************************************************************
* aout_EsdClose: closes the dsp audio device * aout_Close: close the Esound socket
*****************************************************************************/ *****************************************************************************/
void aout_EsdClose( aout_thread_t *p_aout ) void aout_Close( aout_thread_t *p_aout )
{ {
close( p_aout->i_fd ); close( p_aout->i_fd );
} }
......
/***************************************************************************** /*****************************************************************************
* esd.c : Esound plugin for vlc * esd.c : EsounD module
***************************************************************************** *****************************************************************************
* Copyright (C) 2000 VideoLAN * Copyright (C) 2000, 2001 VideoLAN
* *
* Authors: * Authors: Samuel Hocevar <sam@zoy.org>
* *
* 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
...@@ -20,82 +20,92 @@ ...@@ -20,82 +20,92 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/ *****************************************************************************/
#define MODULE_NAME esd
/***************************************************************************** /*****************************************************************************
* Preamble * Preamble
*****************************************************************************/ *****************************************************************************/
#include "defs.h" #include "defs.h"
#include <stdlib.h> /* malloc(), free() */ #include <stdlib.h> /* malloc(), free() */
#include <string.h> /* strdup() */
#include "config.h" #include "config.h"
#include "common.h" /* boolean_t, byte_t */ #include "common.h" /* boolean_t, byte_t */
#include "threads.h" #include "threads.h"
#include "mtime.h" #include "mtime.h"
#include "tests.h" #include "tests.h"
#include "plugins.h"
#include "interface.h" #include "modules.h"
#include "audio_output.h" #include "modules_inner.h"
#include "video.h"
#include "video_output.h"
/***************************************************************************** /*****************************************************************************
* Exported prototypes * Build configuration tree.
*****************************************************************************/ *****************************************************************************/
static void aout_GetPlugin( p_aout_thread_t p_aout ); MODULE_CONFIG_START( "Configuration for esd module" )
ADD_FRAME( "EsounD" )
/* Audio output */ ADD_COMMENT( "This module does not need configuration" )
int aout_EsdOpen ( aout_thread_t *p_aout ); MODULE_CONFIG_END
int aout_EsdReset ( aout_thread_t *p_aout );
int aout_EsdSetFormat ( aout_thread_t *p_aout );
int aout_EsdSetChannels ( aout_thread_t *p_aout );
int aout_EsdSetRate ( aout_thread_t *p_aout );
long aout_EsdGetBufInfo ( aout_thread_t *p_aout, long l_buffer_info );
void aout_EsdPlaySamples ( aout_thread_t *p_aout, byte_t *buffer,
int i_size );
void aout_EsdClose ( aout_thread_t *p_aout );
/***************************************************************************** /*****************************************************************************
* GetConfig: get the plugin structure and configuration * Capabilities defined in the other files.
*****************************************************************************/ *****************************************************************************/
plugin_info_t * GetConfig( void ) void esd_aout_getfunctions( function_list_t * p_function_list );
{
plugin_info_t * p_info = (plugin_info_t *) malloc( sizeof(plugin_info_t) );
p_info->psz_name = "Esound"; /*****************************************************************************
p_info->psz_version = VERSION; * InitModule: get the module structure and configuration.
p_info->psz_author = "the VideoLAN team <vlc@videolan.org>"; *****************************************************************************
* We have to fill psz_name, psz_longname and psz_version. These variables
* will be strdup()ed later by the main application because the module can
* be unloaded later to save memory, and we want to be able to access this
* data even after the module has been unloaded.
*****************************************************************************/
int InitModule( module_t * p_module )
{
p_module->psz_name = MODULE_STRING;
p_module->psz_longname = "EsounD audio module";
p_module->psz_version = VERSION;
p_info->aout_GetPlugin = aout_GetPlugin; p_module->i_capabilities = MODULE_CAPABILITY_NULL
p_info->vout_GetPlugin = NULL; | MODULE_CAPABILITY_AOUT;
p_info->intf_GetPlugin = NULL;
p_info->yuv_GetPlugin = NULL;
/* esound should always work, but score it lower than DSP */ return( 0 );
p_info->i_score = 0x100; }
/* If this plugin was requested, score it higher */ /*****************************************************************************
if( TestMethod( AOUT_METHOD_VAR, "esd" ) ) * ActivateModule: set the module to an usable state.
*****************************************************************************
* This function fills the capability functions and the configuration
* structure. Once ActivateModule() has been called, the i_usage can
* be set to 0 and calls to NeedModule() be made to increment it. To unload
* the module, one has to wait until i_usage == 0 and call DeactivateModule().
*****************************************************************************/
int ActivateModule( module_t * p_module )
{
p_module->p_functions = malloc( sizeof( module_functions_t ) );
if( p_module->p_functions == NULL )
{ {
p_info->i_score += 0x200; return( -1 );
} }
return( p_info ); esd_aout_getfunctions( &p_module->p_functions->aout );
p_module->p_config = p_config;
return( 0 );
} }
/***************************************************************************** /*****************************************************************************
* Following functions are only called through the p_info structure * DeactivateModule: make sure the module can be unloaded.
*****************************************************************************
* This function must only be called when i_usage == 0. If it successfully
* returns, i_usage can be set to -1 and the module unloaded. Be careful to
* lock usage_lock during the whole process.
*****************************************************************************/ *****************************************************************************/
int DeactivateModule( module_t * p_module )
static void aout_GetPlugin( p_aout_thread_t p_aout )
{ {
p_aout->p_sys_open = aout_EsdOpen; free( p_module->p_functions );
p_aout->p_sys_reset = aout_EsdReset;
p_aout->p_sys_setformat = aout_EsdSetFormat; return( 0 );
p_aout->p_sys_setchannels = aout_EsdSetChannels;
p_aout->p_sys_setrate = aout_EsdSetRate;
p_aout->p_sys_getbufinfo = aout_EsdGetBufInfo;
p_aout->p_sys_playsamples = aout_EsdPlaySamples;
p_aout->p_sys_close = aout_EsdClose;
} }
...@@ -35,25 +35,25 @@ ...@@ -35,25 +35,25 @@
#include "threads.h" #include "threads.h"
#include "mtime.h" #include "mtime.h"
#include "tests.h" #include "tests.h"
#include "modules.h" #include "modules.h"
#include "modules_inner.h" #include "modules_inner.h"
#include "modules_config.h"
/***************************************************************************** /*****************************************************************************
* Build configuration tree. * Build configuration tree.
*****************************************************************************/ *****************************************************************************/
MODULE_CONFIG_START( "Configuration for null module" ) MODULE_CONFIG_START( "Configuration for null module" )
ADD_PANE( "First" ) ADD_PANE( "First pane" )
ADD_FRAME( "First test" ) ADD_FRAME( "First frame" )
ADD_COMMENT( "You can put whatever you want here." ) ADD_COMMENT( "You can put whatever you want here." )
ADD_STRING( "Random text: ", MODULE_VAR(text), NULL ) ADD_STRING( "Random text: ", MODULE_VAR(text), NULL )
ADD_FRAME( "Second test" ) ADD_FRAME( "Second frame" )
ADD_COMMENT( "The file below is not used." ) ADD_COMMENT( "The file below is not used." )
ADD_FILE( "Select file: ", MODULE_VAR(file), NULL ) ADD_FILE( "Select file: ", MODULE_VAR(file), NULL )
ADD_FRAME( "Third test" ) ADD_FRAME( "Third frame" )
ADD_COMMENT( "This space intentionally left blank." ) ADD_COMMENT( "This space intentionally left blank." )
ADD_PANE( "Second" ) ADD_PANE( "Second pane" )
ADD_FRAME( "NULL Frame" ) ADD_FRAME( "Frame" )
ADD_COMMENT( "There is nothing in this frame." ) ADD_COMMENT( "There is nothing in this frame." )
MODULE_CONFIG_END MODULE_CONFIG_END
...@@ -68,7 +68,7 @@ MODULE_CONFIG_END ...@@ -68,7 +68,7 @@ MODULE_CONFIG_END
int InitModule( module_t * p_module ) int InitModule( module_t * p_module )
{ {
p_module->psz_name = MODULE_STRING; p_module->psz_name = MODULE_STRING;
p_module->psz_longname = "the Null Module that does nothing"; p_module->psz_longname = "the Null module that does nothing";
p_module->psz_version = VERSION; p_module->psz_version = VERSION;
p_module->i_capabilities = MODULE_CAPABILITY_NULL; p_module->i_capabilities = MODULE_CAPABILITY_NULL;
...@@ -86,7 +86,11 @@ int InitModule( module_t * p_module ) ...@@ -86,7 +86,11 @@ int InitModule( module_t * p_module )
*****************************************************************************/ *****************************************************************************/
int ActivateModule( module_t * p_module ) int ActivateModule( module_t * p_module )
{ {
/* Since the Null module can't do anything, there is no need to
* fill the p_functions structure. */
p_module->p_functions = NULL;
p_module->p_config = p_config; p_module->p_config = p_config;
return( 0 ); return( 0 );
} }
...@@ -99,6 +103,7 @@ int ActivateModule( module_t * p_module ) ...@@ -99,6 +103,7 @@ int ActivateModule( module_t * p_module )
*****************************************************************************/ *****************************************************************************/
int DeactivateModule( module_t * p_module ) int DeactivateModule( module_t * p_module )
{ {
/* We didn't allocate p_functions - so we don't have to free it */
return( 0 ); return( 0 );
} }
...@@ -27,20 +27,23 @@ ...@@ -27,20 +27,23 @@
*****************************************************************************/ *****************************************************************************/
/* hope these constant values are cache line aligned */ /* hope these constant values are cache line aligned */
static unsigned long long mmx_80w = 0x0080008000800080; #define UNUSED_LONGLONG(foo) \
static unsigned long long mmx_10w = 0x1010101010101010; static unsigned long long foo __attribute__((unused))
static unsigned long long mmx_00ffw = 0x00ff00ff00ff00ff; UNUSED_LONGLONG(mmx_80w) = 0x0080008000800080;
static unsigned long long mmx_Y_coeff = 0x253f253f253f253f; UNUSED_LONGLONG(mmx_10w) = 0x1010101010101010;
UNUSED_LONGLONG(mmx_00ffw) = 0x00ff00ff00ff00ff;
UNUSED_LONGLONG(mmx_Y_coeff) = 0x253f253f253f253f;
static unsigned long long mmx_U_green = 0xf37df37df37df37d; UNUSED_LONGLONG(mmx_U_green) = 0xf37df37df37df37d;
static unsigned long long mmx_U_blue = 0x4093409340934093; UNUSED_LONGLONG(mmx_U_blue) = 0x4093409340934093;
static unsigned long long mmx_V_red = 0x3312331233123312; UNUSED_LONGLONG(mmx_V_red) = 0x3312331233123312;
static unsigned long long mmx_V_green = 0xe5fce5fce5fce5fc; UNUSED_LONGLONG(mmx_V_green) = 0xe5fce5fce5fce5fc;
static unsigned long long mmx_redmask = 0xf8f8f8f8f8f8f8f8; UNUSED_LONGLONG(mmx_redmask) = 0xf8f8f8f8f8f8f8f8;
static unsigned long long mmx_grnmask = 0xfcfcfcfcfcfcfcfc; UNUSED_LONGLONG(mmx_grnmask) = 0xfcfcfcfcfcfcfcfc;
static unsigned long long mmx_grnshift = 0x03; UNUSED_LONGLONG(mmx_grnshift) = 0x03;
static unsigned long long mmx_blueshift = 0x03; UNUSED_LONGLONG(mmx_blueshift) = 0x03;
#undef UNUSED_LONGLONG
#define MMX_INIT_16 " \n\ #define MMX_INIT_16 " \n\
\n\ \n\
......
...@@ -47,6 +47,7 @@ ...@@ -47,6 +47,7 @@
#include "threads.h" #include "threads.h"
#include "mtime.h" /* mtime_t, mdate(), msleep() */ #include "mtime.h" /* mtime_t, mdate(), msleep() */
#include "plugins.h" #include "plugins.h"
#include "modules.h"
#include "intf_msg.h" /* intf_DbgMsg(), intf_ErrMsg() */ #include "intf_msg.h" /* intf_DbgMsg(), intf_ErrMsg() */
...@@ -99,9 +100,6 @@ static __inline__ void InitializeIncrement( aout_increment_t * p_increment, long ...@@ -99,9 +100,6 @@ static __inline__ void InitializeIncrement( aout_increment_t * p_increment, long
aout_thread_t *aout_CreateThread( int *pi_status ) aout_thread_t *aout_CreateThread( int *pi_status )
{ {
aout_thread_t * p_aout; /* thread descriptor */ aout_thread_t * p_aout; /* thread descriptor */
typedef void ( aout_getplugin_t ) ( aout_thread_t * p_aout );
int i_index;
int i_best_index = 0, i_best_score = 0;
#if 0 #if 0
int i_status; /* thread status */ int i_status; /* thread status */
#endif #endif
...@@ -113,41 +111,31 @@ aout_thread_t *aout_CreateThread( int *pi_status ) ...@@ -113,41 +111,31 @@ aout_thread_t *aout_CreateThread( int *pi_status )
return( NULL ); return( NULL );
} }
/* Get a suitable audio plugin */ /* Choose the best module */
for( i_index = 0 ; i_index < p_main->p_bank->i_plugin_count ; i_index++ ) p_aout->p_module = module_Need( p_main->p_module_bank,
{ MODULE_CAPABILITY_AOUT, NULL );
/* If there's a plugin in p_info ... */
if( p_main->p_bank->p_info[ i_index ] != NULL )
{
/* ... and if this plugin provides the functions we want ... */
if( p_main->p_bank->p_info[ i_index ]->aout_GetPlugin != NULL )
{
/* ... and if this plugin has a good score ... */
if( p_main->p_bank->p_info[ i_index ]->i_score > i_best_score )
{
/* ... then take it */
i_best_score = p_main->p_bank->p_info[ i_index ]->i_score;
i_best_index = i_index;
}
}
}
}
if( i_best_score == 0 ) if( p_aout->p_module == NULL )
{ {
intf_ErrMsg( "aout error: no suitable aout module" );
free( p_aout ); free( p_aout );
return( NULL ); return( NULL );
} }
/* Get the plugin functions */ #define aout_functions p_aout->p_module->p_functions->aout.functions.aout
( (aout_getplugin_t *) p_aout->p_open = aout_functions.p_open;
p_main->p_bank->p_info[ i_best_index ]->aout_GetPlugin )( p_aout ); p_aout->p_setformat = aout_functions.p_setformat;
p_aout->p_getbufinfo = aout_functions.p_getbufinfo;
p_aout->p_play = aout_functions.p_play;
p_aout->p_close = aout_functions.p_close;
#undef aout_functions
/* /*
* Initialize audio device * Initialize audio device
*/ */
if ( p_aout->p_sys_open( p_aout ) ) if ( p_aout->p_open( p_aout ) )
{ {
module_Unneed( p_main->p_module_bank, p_aout->p_module );
free( p_aout ); free( p_aout );
return( NULL ); return( NULL );
} }
...@@ -155,27 +143,10 @@ aout_thread_t *aout_CreateThread( int *pi_status ) ...@@ -155,27 +143,10 @@ aout_thread_t *aout_CreateThread( int *pi_status )
p_aout->b_stereo = ( p_aout->i_channels == 2 ) ? 1 : 0; /* FIXME: only works p_aout->b_stereo = ( p_aout->i_channels == 2 ) ? 1 : 0; /* FIXME: only works
for i_channels == 1 or 2 ??*/ for i_channels == 1 or 2 ??*/
if ( p_aout->p_sys_reset( p_aout ) ) if ( p_aout->p_setformat( p_aout ) )
{ {
p_aout->p_sys_close( p_aout ); p_aout->p_close( p_aout );
free( p_aout ); module_Unneed( p_main->p_module_bank, p_aout->p_module );
return( NULL );
}
if ( p_aout->p_sys_setformat( p_aout ) )
{
p_aout->p_sys_close( p_aout );
free( p_aout );
return( NULL );
}
if ( p_aout->p_sys_setchannels( p_aout ) )
{
p_aout->p_sys_close( p_aout );
free( p_aout );
return( NULL );
}
if ( p_aout->p_sys_setrate( p_aout ) )
{
p_aout->p_sys_close( p_aout );
free( p_aout ); free( p_aout );
return( NULL ); return( NULL );
} }
...@@ -188,7 +159,8 @@ aout_thread_t *aout_CreateThread( int *pi_status ) ...@@ -188,7 +159,8 @@ aout_thread_t *aout_CreateThread( int *pi_status )
* this thread is only called in main and all calls are blocking */ * this thread is only called in main and all calls are blocking */
if( aout_SpawnThread( p_aout ) ) if( aout_SpawnThread( p_aout ) )
{ {
p_aout->p_sys_close( p_aout ); p_aout->p_close( p_aout );
module_Unneed( p_main->p_module_bank, p_aout->p_module );
free( p_aout ); free( p_aout );
return( NULL ); return( NULL );
} }
...@@ -362,8 +334,11 @@ void aout_DestroyThread( aout_thread_t * p_aout, int *pi_status ) ...@@ -362,8 +334,11 @@ void aout_DestroyThread( aout_thread_t * p_aout, int *pi_status )
} }
vlc_mutex_destroy( &p_aout->fifos_lock ); vlc_mutex_destroy( &p_aout->fifos_lock );
/* Release the aout module */
module_Unneed( p_main->p_module_bank, p_aout->p_module );
/* Free the structure */ /* Free the structure */
p_aout->p_sys_close( p_aout ); p_aout->p_close( p_aout );
intf_DbgMsg("aout debug: audio device (%s) closed", p_aout->psz_device); intf_DbgMsg("aout debug: audio device (%s) closed", p_aout->psz_device);
/* Free structure */ /* Free structure */
...@@ -822,9 +797,9 @@ void aout_Thread_U8_Mono( aout_thread_t * p_aout ) ...@@ -822,9 +797,9 @@ void aout_Thread_U8_Mono( aout_thread_t * p_aout )
((u8 *)p_aout->buffer)[l_buffer] = (u8)( ( (p_aout->s32_buffer[l_buffer] / AOUT_MAX_FIFOS / 256 ) + 128 ) * p_aout->vol / 256 ); ((u8 *)p_aout->buffer)[l_buffer] = (u8)( ( (p_aout->s32_buffer[l_buffer] / AOUT_MAX_FIFOS / 256 ) + 128 ) * p_aout->vol / 256 );
p_aout->s32_buffer[l_buffer] = 0; p_aout->s32_buffer[l_buffer] = 0;
} }
l_bytes = p_aout->p_sys_getbufinfo( p_aout, l_buffer_limit ); l_bytes = p_aout->p_getbufinfo( p_aout, l_buffer_limit );
p_aout->date = mdate() + ((((mtime_t)(l_bytes / 1 )) * 1000000) / ((mtime_t)p_aout->l_rate)); /* sizeof(u8) << (p_aout->b_stereo) == 1 */ p_aout->date = mdate() + ((((mtime_t)(l_bytes / 1 )) * 1000000) / ((mtime_t)p_aout->l_rate)); /* sizeof(u8) << (p_aout->b_stereo) == 1 */
p_aout->p_sys_playsamples( p_aout, (byte_t *)p_aout->buffer, l_buffer_limit * sizeof(u8) ); p_aout->p_play( p_aout, (byte_t *)p_aout->buffer, l_buffer_limit * sizeof(u8) );
if ( l_bytes > (l_buffer_limit * sizeof(u8) * 2) ) /* There are 2 channels (left & right) */ if ( l_bytes > (l_buffer_limit * sizeof(u8) * 2) ) /* There are 2 channels (left & right) */
{ {
msleep( p_aout->l_msleep ); msleep( p_aout->l_msleep );
...@@ -1113,9 +1088,9 @@ void aout_Thread_U8_Stereo( aout_thread_t * p_aout ) ...@@ -1113,9 +1088,9 @@ void aout_Thread_U8_Stereo( aout_thread_t * p_aout )
((u8 *)p_aout->buffer)[l_buffer] = (u8)( ( (p_aout->s32_buffer[l_buffer] / AOUT_MAX_FIFOS / 256) + 128 ) * p_aout->vol / 256 ); ((u8 *)p_aout->buffer)[l_buffer] = (u8)( ( (p_aout->s32_buffer[l_buffer] / AOUT_MAX_FIFOS / 256) + 128 ) * p_aout->vol / 256 );
p_aout->s32_buffer[l_buffer] = 0; p_aout->s32_buffer[l_buffer] = 0;
} }
l_bytes = p_aout->p_sys_getbufinfo( p_aout, l_buffer_limit ); l_bytes = p_aout->p_getbufinfo( p_aout, l_buffer_limit );
p_aout->date = mdate() + ((((mtime_t)(l_bytes / 2 )) * 1000000) / ((mtime_t)p_aout->l_rate)); /* sizeof(u8) << (p_aout->b_stereo) == 2 */ p_aout->date = mdate() + ((((mtime_t)(l_bytes / 2 )) * 1000000) / ((mtime_t)p_aout->l_rate)); /* sizeof(u8) << (p_aout->b_stereo) == 2 */
p_aout->p_sys_playsamples( p_aout, (byte_t *)p_aout->buffer, l_buffer_limit * sizeof(u8) ); p_aout->p_play( p_aout, (byte_t *)p_aout->buffer, l_buffer_limit * sizeof(u8) );
if ( l_bytes > (l_buffer_limit * sizeof(u8)) ) if ( l_bytes > (l_buffer_limit * sizeof(u8)) )
{ {
msleep( p_aout->l_msleep ); msleep( p_aout->l_msleep );
...@@ -1408,9 +1383,9 @@ void aout_Thread_S16_Stereo( aout_thread_t * p_aout ) ...@@ -1408,9 +1383,9 @@ void aout_Thread_S16_Stereo( aout_thread_t * p_aout )
p_aout->s32_buffer[l_buffer] = 0; p_aout->s32_buffer[l_buffer] = 0;
} }
l_bytes = p_aout->p_sys_getbufinfo( p_aout, l_buffer_limit ); l_bytes = p_aout->p_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->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) ); p_aout->p_play( p_aout, (byte_t *)p_aout->buffer, l_buffer_limit * sizeof(s16) );
if ( l_bytes > (l_buffer_limit * sizeof(s16)) ) if ( l_bytes > (l_buffer_limit * sizeof(s16)) )
{ {
msleep( p_aout->l_msleep ); msleep( p_aout->l_msleep );
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* input_programs.c: es_descriptor_t, pgrm_descriptor_t management * input_programs.c: es_descriptor_t, pgrm_descriptor_t management
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000 VideoLAN
* $Id: input_programs.c,v 1.20 2001/01/07 04:31:18 henri Exp $ * $Id: input_programs.c,v 1.21 2001/01/07 16:17:58 sam Exp $
* *
* Authors: * Authors:
* *
...@@ -84,15 +84,12 @@ void input_EndStream( input_thread_t * p_input ) ...@@ -84,15 +84,12 @@ void input_EndStream( input_thread_t * p_input )
/* Don't put i instead of 0 !! */ /* Don't put i instead of 0 !! */
input_DelProgram( p_input, p_input->stream.pp_programs[0] ); input_DelProgram( p_input, p_input->stream.pp_programs[0] );
} }
free( p_input->stream.pp_programs );
/* Free standalone ES */ /* Free standalone ES */
for( i = 0; i < p_input->stream.i_es_number; i++ ) for( i = 0; i < p_input->stream.i_es_number; i++ )
{ {
input_DelES( p_input, p_input->stream.pp_es[0] ); input_DelES( p_input, p_input->stream.pp_es[0] );
} }
free( p_input->stream.pp_es );
free( p_input->stream.pp_selected_es );
} }
/***************************************************************************** /*****************************************************************************
...@@ -202,9 +199,6 @@ void input_DelProgram( input_thread_t * p_input, pgrm_descriptor_t * p_pgrm ) ...@@ -202,9 +199,6 @@ void input_DelProgram( input_thread_t * p_input, pgrm_descriptor_t * p_pgrm )
input_DelES( p_input, p_pgrm->pp_es[i_index] ); input_DelES( p_input, p_pgrm->pp_es[i_index] );
} }
/* Free the table of es descriptors */
free( p_pgrm->pp_es );
/* Free the demux data */ /* Free the demux data */
if( p_pgrm->p_demux_data != NULL ) if( p_pgrm->p_demux_data != NULL )
{ {
...@@ -221,16 +215,19 @@ void input_DelProgram( input_thread_t * p_input, pgrm_descriptor_t * p_pgrm ) ...@@ -221,16 +215,19 @@ void input_DelProgram( input_thread_t * p_input, pgrm_descriptor_t * p_pgrm )
/* Remove this program from the stream's list of programs */ /* Remove this program from the stream's list of programs */
p_input->stream.i_pgrm_number--; p_input->stream.i_pgrm_number--;
p_input->stream.pp_programs[i_pgrm_index] = p_input->stream.pp_programs[i_pgrm_index] =
p_input->stream.pp_programs[p_input->stream.i_pgrm_number]; p_input->stream.pp_programs[p_input->stream.i_pgrm_number];
p_input->stream.pp_programs = realloc( p_input->stream.pp_programs, p_input->stream.pp_programs = realloc( p_input->stream.pp_programs,
p_input->stream.i_pgrm_number p_input->stream.i_pgrm_number
* sizeof(pgrm_descriptor_t *) ); * sizeof(pgrm_descriptor_t *) );
if( p_input->stream.pp_programs == NULL) if( p_input->stream.i_pgrm_number && p_input->stream.pp_programs == NULL)
{ {
intf_ErrMsg( "Unable to realloc memory in input_DelProgram" ); intf_ErrMsg( "input error: unable to realloc program list"
" in input_DelProgram" );
} }
/* Free the description of this program */ /* Free the description of this program */
free( p_pgrm ); free( p_pgrm );
} }
...@@ -360,7 +357,7 @@ void input_DelES( input_thread_t * p_input, es_descriptor_t * p_es ) ...@@ -360,7 +357,7 @@ void input_DelES( input_thread_t * p_input, es_descriptor_t * p_es )
p_pgrm->pp_es = realloc( p_pgrm->pp_es, p_pgrm->pp_es = realloc( p_pgrm->pp_es,
p_pgrm->i_es_number p_pgrm->i_es_number
* sizeof(es_descriptor_t *)); * sizeof(es_descriptor_t *));
if( p_pgrm->pp_es == NULL ) if( p_pgrm->i_es_number && p_pgrm->pp_es == NULL )
{ {
intf_ErrMsg( "Unable to realloc memory in input_DelES" ); intf_ErrMsg( "Unable to realloc memory in input_DelES" );
} }
...@@ -391,7 +388,7 @@ void input_DelES( input_thread_t * p_input, es_descriptor_t * p_es ) ...@@ -391,7 +388,7 @@ void input_DelES( input_thread_t * p_input, es_descriptor_t * p_es )
p_input->stream.pp_es = realloc( p_input->stream.pp_es, p_input->stream.pp_es = realloc( p_input->stream.pp_es,
p_input->stream.i_es_number p_input->stream.i_es_number
* sizeof(es_descriptor_t *)); * sizeof(es_descriptor_t *));
if( p_input->stream.pp_es == NULL ) if( p_input->stream.i_es_number && p_input->stream.pp_es == NULL )
{ {
intf_ErrMsg( "Unable to realloc memory in input_DelES" ); intf_ErrMsg( "Unable to realloc memory in input_DelES" );
} }
......
This diff is collapsed.
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