Commit 0935df9e authored by Sam Hocevar's avatar Sam Hocevar

   This commit is a bit early, but it'll save Stef, Henri and me much
 time later, when we don't have to backport modifications to input_*.c

   What's new :
    - playlist works again (still the old wrong way like Meuuh doesn't
    like, but this is going to change within a few hours)
    - input_ps, input_ts and input_dvd are now plugins, located in
    plugins/mpeg/ and plugins/dvd/

   What's broken :
    - audio output might be broken on some streams ; have to investigate

   What has changed :
    - fast/slow keys are now A/Z instead of A/S since S was already
    linked to the scale/noscale toggle.
    - `--dvd' doesn't work anymore, for the moment try to use :
     vlc --input dvd /dev/dvd
    - module bank is now less verbose ; use `--warn 1' to turn back
    verbosity on
parent ff77ef78
......@@ -179,21 +179,17 @@ INTERFACE = src/interface/main.o \
src/interface/intf_msg.o \
src/interface/intf_cmd.o \
src/interface/intf_ctrl.o \
src/interface/intf_plst.o \
src/interface/intf_console.o
INPUT = src/input/input_ps.o \
src/input/input_ts.o \
src/input/dvd_ifo.o \
src/input/dvd_css.o \
src/input/input_dvd.o \
src/input/mpeg_system.o \
src/input/input_ext-dec.o \
INPUT = src/input/input_ext-dec.o \
src/input/input_ext-intf.o \
src/input/input_dec.o \
src/input/input_programs.o \
src/input/input_netlist.o \
src/input/input_clock.o \
src/input/input.o
src/input/input.o \
src/input/mpeg_system.o
AUDIO_OUTPUT = src/audio_output/audio_output.o
......@@ -238,7 +234,6 @@ MISC = src/misc/mtime.o \
src/misc/rsc_files.o \
src/misc/modules.o \
src/misc/netutils.o \
src/misc/playlist.o \
src/misc/plugins.o
......@@ -276,6 +271,19 @@ endif
#
# Plugins
#
PLUGIN_NULL = plugins/null/null.o
PLUGIN_PS = plugins/mpeg/ps.o \
plugins/mpeg/input_ps.o
PLUGIN_TS = plugins/mpeg/ts.o \
plugins/mpeg/input_ts.o
PLUGIN_DVD = plugins/dvd/dvd.o \
plugins/dvd/input_dvd.o \
plugins/dvd/dvd_ifo.o \
plugins/dvd/dvd_css.o
PLUGIN_BEOS = plugins/beos/beos.o \
plugins/beos/aout_beos.o \
plugins/beos/intf_beos.o \
......@@ -284,7 +292,6 @@ PLUGIN_BEOS = plugins/beos/beos.o \
PLUGIN_DSP = plugins/dsp/dsp.o \
plugins/dsp/aout_dsp.o
PLUGIN_DUMMY = plugins/dummy/dummy.o \
plugins/dummy/aout_dummy.o \
plugins/dummy/intf_dummy.o \
......@@ -306,8 +313,6 @@ PLUGIN_SDL = plugins/sdl/sdl.o \
plugins/sdl/vout_sdl.o \
plugins/sdl/aout_sdl.o
PLUGIN_NULL = plugins/null/null.o
PLUGIN_GLIDE = plugins/glide/glide.o \
plugins/glide/intf_glide.o \
plugins/glide/vout_glide.o
......@@ -446,9 +451,8 @@ snapshot:
find -type d | while read i ; \
do mkdir -p /tmp/vlc-@VLC_VERSION@/$$i ; \
done
find debian -mindepth 1 -type d | grep -v CVS | while read i ; \
do rmdir $$i ; \
done
find debian -mindepth 1 -maxdepth 1 -type d | grep -v CVS | \
while read i ; do rm -rf /tmp/vlc-@VLC_VERSION@/$$i ; done
# CVS entries
find . -type f | grep CVS | while read i ; \
do cp $$i /tmp/vlc-@VLC_VERSION@/$$i ; \
......@@ -605,6 +609,15 @@ ifeq ($(SYS),beos)
lib/null.so: $(PLUGIN_NULL)
$(CC) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_
lib/ps.so: $(PLUGIN_PS)
$(CC) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_
lib/ts.so: $(PLUGIN_TS)
$(CC) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_
lib/dvd.so: $(PLUGIN_DVD)
$(CC) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_
lib/dummy.so: $(PLUGIN_DUMMY)
$(CC) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_
......@@ -638,6 +651,15 @@ else
lib/null.so: $(PLUGIN_NULL)
$(CC) $(PCFLAGS) -shared -o $@ $^
lib/ps.so: $(PLUGIN_PS)
$(CC) $(PCFLAGS) -shared -o $@ $^
lib/ts.so: $(PLUGIN_TS)
$(CC) $(PCFLAGS) -shared -o $@ $^
lib/dvd.so: $(PLUGIN_DVD)
$(CC) $(PCFLAGS) -shared -o $@ $^
lib/dummy.so: $(PLUGIN_DUMMY)
$(CC) $(PCFLAGS) -shared -o $@ $^
......
......@@ -3409,7 +3409,7 @@ fi
rm -f conftest*
PLUGINS=${PLUGINS}"yuv idct idctclassic motion ";
PLUGINS=${PLUGINS}"ps ts dvd yuv idct idctclassic motion ";
ARCH=${host_cpu}
# Check whether --enable-ppro or --disable-ppro was given.
......
......@@ -107,7 +107,7 @@ AC_CHECK_HEADERS(linux/cdrom.h)
AC_EGREP_HEADER(dvd,linux/cdrom.h,AC_DEFINE(LINUX_DVD,1,DVD support for linux))
dnl default plugins
PLUGINS=${PLUGINS}"yuv idct idctclassic motion ";
PLUGINS=${PLUGINS}"ps ts dvd yuv idct idctclassic motion ";
ARCH=${host_cpu}
AC_ARG_ENABLE(ppro,
......
......@@ -3,7 +3,7 @@
* Collection of useful common types and macros definitions
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: common.h,v 1.26 2001/01/18 17:40:06 massiot Exp $
* $Id: common.h,v 1.27 2001/02/08 04:43:27 sam Exp $
*
* Authors: Samuel Hocevar <sam@via.ecp.fr>
* Vincent Seguin <seguin@via.ecp.fr>
......@@ -130,6 +130,7 @@ typedef struct video_parser_s * p_video_parser_t;
/* Misc */
struct macroblock_s;
struct data_packet_s;
/*****************************************************************************
* Macros and inline functions
......
......@@ -157,6 +157,9 @@
* Input thread configuration
*****************************************************************************/
/* Environment variable containing the display method */
#define INPUT_METHOD_VAR "vlc_input"
/* XXX?? */
#define INPUT_IDLE_SLEEP ((int)(0.100*CLOCK_FREQ))
......
......@@ -2,7 +2,7 @@
* input.h: structures of the input not exported to other modules
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: input.h,v 1.14 2001/02/07 17:44:52 massiot Exp $
* $Id: input.h,v 1.26 2001/02/08 04:43:27 sam Exp $
*
* Authors:
*
......@@ -33,64 +33,34 @@
#define PADDING_PACKET_SIZE 188 /* Size of the NULL packet inserted in case
* of data loss (this should be < 188). */
/*****************************************************************************
* input_capabilities_t
*****************************************************************************
* This structure gives pointers to the useful methods of the plugin
*****************************************************************************/
typedef struct input_capabilities_s
{
/* Plugin properties */
int i_weight; /* for a given stream type, the plugin *
* with higher weight will be used */
/* Init/End */
int (* pf_probe)( struct input_thread_s * );
void (* pf_init)( struct input_thread_s * );
void (* pf_end)( struct input_thread_s * );
/* Read & Demultiplex */
int (* pf_read)( struct input_thread_s *,
struct data_packet_s * pp_packets[INPUT_READ_ONCE] );
void (* pf_demux)( struct input_thread_s *,
struct data_packet_s * );
/* Packet management facilities */
struct data_packet_s *(* pf_new_packet)( void *, size_t );
struct pes_packet_s *(* pf_new_pes)( void * );
void (* pf_delete_packet)( void *,
struct data_packet_s * );
void (* pf_delete_pes)( void *, struct pes_packet_s * );
/* Stream control capabilities */
int (* pf_rewind)( struct input_thread_s * );
/* NULL if we don't support going *
* backwards (it's gonna be fun) */
int (* pf_seek)( struct input_thread_s *, off_t );
} input_capabilities_t;
/*****************************************************************************
* Prototypes from input_ext-dec.c
*****************************************************************************/
void InitBitstream ( struct bit_stream_s *, struct decoder_fifo_s * );
void NextDataPacket ( struct bit_stream_s * );
/*****************************************************************************
* Prototypes from input.c to open files
*****************************************************************************/
void input_FileOpen ( struct input_thread_s * );
void input_FileClose( struct input_thread_s * );
/*****************************************************************************
* Prototypes from input_programs.c
*****************************************************************************/
int input_InitStream( struct input_thread_s *, size_t );
void input_EndStream( struct input_thread_s * );
int input_InitStream( struct input_thread_s *, size_t );
void input_EndStream ( struct input_thread_s * );
struct pgrm_descriptor_s * input_FindProgram( struct input_thread_s *, u16 );
struct pgrm_descriptor_s * input_AddProgram( struct input_thread_s *,
u16, size_t );
struct pgrm_descriptor_s * input_AddProgram ( struct input_thread_s *,
u16, size_t );
void input_DelProgram( struct input_thread_s *, struct pgrm_descriptor_s * );
void input_DumpStream( struct input_thread_s * );
struct es_descriptor_s * input_FindES( struct input_thread_s *, u16 );
struct es_descriptor_s * input_AddES( struct input_thread_s *,
struct pgrm_descriptor_s *, u16,
size_t );
void input_DelES( struct input_thread_s *, struct es_descriptor_s * );
int input_SelectES( struct input_thread_s *, struct es_descriptor_s * );
struct es_descriptor_s * input_AddES ( struct input_thread_s *,
struct pgrm_descriptor_s *, u16,
size_t );
void input_DelES ( struct input_thread_s *, struct es_descriptor_s * );
int input_SelectES ( struct input_thread_s *, struct es_descriptor_s * );
/*****************************************************************************
* Prototypes from input_dec.c
......@@ -98,13 +68,15 @@ int input_SelectES( struct input_thread_s *, struct es_descriptor_s * );
//decoder_capabilities_s * input_ProbeDecoder( void );
vlc_thread_t input_RunDecoder( struct decoder_capabilities_s *, void * );
void input_EndDecoder( struct input_thread_s *, struct es_descriptor_s * );
void input_DecodePES( struct decoder_fifo_s *, struct pes_packet_s * );
void input_DecodePES ( struct decoder_fifo_s *, struct pes_packet_s * );
/*****************************************************************************
* Prototypes from input_clock.c
*****************************************************************************/
void input_ClockNewRef( struct input_thread_s *,
struct pgrm_descriptor_s *, mtime_t, mtime_t );
void input_EscapeDiscontinuity( struct input_thread_s *,
struct pgrm_descriptor_s * );
void input_ClockInit( struct pgrm_descriptor_s * );
void input_ClockManageRef( struct input_thread_s *,
struct pgrm_descriptor_s *, mtime_t );
......@@ -120,7 +92,7 @@ static __inline__ void input_NullPacket( input_thread_t * p_input,
data_packet_t * p_pad_data;
pes_packet_t * p_pes;
if( (p_pad_data = p_input->p_plugin->pf_new_packet(
if( (p_pad_data = p_input->pf_new_packet(
p_input->p_method_data,
PADDING_PACKET_SIZE )) == NULL )
{
......@@ -141,8 +113,7 @@ static __inline__ void input_NullPacket( input_thread_t * p_input,
}
else
{
if( (p_pes = p_input->p_plugin->pf_new_pes(
p_input->p_method_data )) == NULL )
if( (p_pes = p_input->pf_new_pes( p_input->p_method_data )) == NULL )
{
intf_ErrMsg("Out of memory");
p_input->b_error = 1;
......
......@@ -4,7 +4,7 @@
* control the pace of reading.
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: input_ext-intf.h,v 1.13 2001/02/07 17:44:52 massiot Exp $
* $Id: input_ext-intf.h,v 1.14 2001/02/08 04:43:27 sam Exp $
*
* Authors:
*
......@@ -209,16 +209,40 @@ typedef struct input_thread_s
/* Thread properties and locks */
boolean_t b_die; /* 'die' flag */
boolean_t b_error;
boolean_t b_eof;
vlc_thread_t thread_id; /* id for thread functions */
int * pi_status; /* temporary status flag */
struct input_config_s * p_config;
/* Input module */
struct module_s * p_input_module;
/* Init/End */
void (* pf_init)( struct input_thread_s * );
void (* pf_open)( struct input_thread_s * );
void (* pf_close)( struct input_thread_s * );
void (* pf_end)( struct input_thread_s * );
/* Read & Demultiplex */
int (* pf_read)( struct input_thread_s *,
struct data_packet_s * pp_packets[] );
void (* pf_demux)( struct input_thread_s *,
struct data_packet_s * );
/* Packet management facilities */
struct data_packet_s *(*pf_new_packet)( void *, size_t );
struct pes_packet_s *(* pf_new_pes)( void * );
void (* pf_delete_packet)( void *,
struct data_packet_s * );
void (* pf_delete_pes)( void *, struct pes_packet_s * );
/* Stream control capabilities */
int (* pf_rewind)( struct input_thread_s * );
/* NULL if we don't support going *
* backwards (it's gonna be fun) */
int (* pf_seek)( struct input_thread_s *, off_t );
struct input_capabilities_s *
pp_plugins[INPUT_MAX_PLUGINS];/* list of plugins */
struct input_capabilities_s *
p_plugin; /* selected plugin */
i_p_config_t i_p_config; /* plugin configuration */
char * p_source;
int i_handle; /* socket or file descriptor */
void * p_method_data; /* data of the packet manager */
......@@ -273,8 +297,7 @@ typedef struct input_config_s
/*****************************************************************************
* Prototypes
*****************************************************************************/
struct input_thread_s * input_CreateThread( struct input_config_s *,
int *pi_status );
struct input_thread_s * input_CreateThread( int *pi_status );
void input_DestroyThread( struct input_thread_s *,
int *pi_status );
void input_Play( struct input_thread_s * );
......
/*****************************************************************************
* playlist.h : Playlist functions
* intf_plst.h : Playlist functions
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
*
......@@ -20,13 +20,45 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
typedef struct playlist_item_s
{
char* psz_name;
int i_type; /* unused yet */
int i_status; /* unused yet */
} playlist_item_t;
typedef struct playlist_s
{
int i_index;
char** p_list;
int i_index; /* current index */
int i_size; /* total size */
int i_mode; /* parse mode (random, forward, backward) */
int i_seed; /* seed used for random mode */
vlc_mutex_t change_lock;
playlist_item_t current;
playlist_item_t* p_item;
} playlist_t;
/* Used by playlist_Add */
#define PLAYLIST_START 0
#define PLAYLIST_END -1
/* Playlist parsing mode */
#define PLAYLIST_REPEAT_CURRENT 0 /* Keep playing current item */
#define PLAYLIST_FORWARD 1 /* Parse playlist until end */
#define PLAYLIST_BACKWARD -1 /* Parse backwards */
#define PLAYLIST_FORWARD_LOOP 2 /* Parse playlist and loop */
#define PLAYLIST_BACKWARD_LOOP -2 /* Parse backwards and loop */
#define PLAYLIST_RANDOM 3 /* Shuffle play */
#define PLAYLIST_REVERSE_RANDOM -3 /* Reverse shuffle play */
playlist_t * playlist_Create ( void );
void playlist_Init ( playlist_t * p_playlist, int i_optind );
void playlist_Init ( playlist_t * p_playlist );
int playlist_Add ( playlist_t * p_playlist,
int i_pos, char * psz_item );
void playlist_Next ( playlist_t * p_playlist );
void playlist_Prev ( playlist_t * p_playlist );
void playlist_Destroy ( playlist_t * p_playlist );
......@@ -36,17 +36,18 @@ typedef void * module_handle_t;
#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_MOTION 1 << 5 /* Video decoder */
#define MODULE_CAPABILITY_IDCT 1 << 6 /* IDCT transformation */
#define MODULE_CAPABILITY_AOUT 1 << 7 /* Audio output */
#define MODULE_CAPABILITY_VOUT 1 << 8 /* Video output */
#define MODULE_CAPABILITY_YUV 1 << 9 /* YUV colorspace conversion */
#define MODULE_CAPABILITY_AFX 1 << 10 /* Audio effects */
#define MODULE_CAPABILITY_VFX 1 << 11 /* Video effects */
#define MODULE_CAPABILITY_ACCESS 1 << 1 /* Input */
#define MODULE_CAPABILITY_INPUT 1 << 2 /* Input */
#define MODULE_CAPABILITY_DECAPS 1 << 3 /* Decaps */
#define MODULE_CAPABILITY_ADEC 1 << 4 /* Audio decoder */
#define MODULE_CAPABILITY_VDEC 1 << 5 /* Video decoder */
#define MODULE_CAPABILITY_MOTION 1 << 6 /* Video decoder */
#define MODULE_CAPABILITY_IDCT 1 << 7 /* IDCT transformation */
#define MODULE_CAPABILITY_AOUT 1 << 8 /* Audio output */
#define MODULE_CAPABILITY_VOUT 1 << 9 /* Video output */
#define MODULE_CAPABILITY_YUV 1 << 10 /* YUV colorspace conversion */
#define MODULE_CAPABILITY_AFX 1 << 11 /* Audio effects */
#define MODULE_CAPABILITY_VFX 1 << 12 /* Video effects */
/* FIXME: not yet used */
typedef struct probedata_s
......@@ -64,17 +65,40 @@ typedef struct function_list_s
union
{
/* Input plugin */
struct
{
int ( * pf_open ) ( struct aout_thread_s * p_aout );
int ( * pf_setformat ) ( struct aout_thread_s * p_aout );
long ( * pf_getbufinfo ) ( struct aout_thread_s * p_aout,
long l_buffer_info );
void ( * pf_play ) ( struct aout_thread_s * p_aout,
byte_t *buffer, int i_size );
void ( * pf_close ) ( struct aout_thread_s * p_aout );
int ( * pf_init ) ( struct input_thread_s * );
void ( * pf_open ) ( struct input_thread_s * );
void ( * pf_close ) ( struct input_thread_s * );
void ( * pf_end ) ( struct input_thread_s * );
void ( * pf_read ) ( struct input_thread_s *,
struct data_packet_s *
pp_packets[] );
void ( * pf_demux )( struct input_thread_s *,
struct data_packet_s * );
struct data_packet_s * ( * pf_new_packet ) ( void *, size_t );
struct pes_packet_s * ( * pf_new_pes ) ( void * );
void ( * pf_delete_packet ) ( struct data_packet_s * );
void ( * pf_delete_pes ) ( struct pes_packet_s * );
int ( * pf_rewind ) ( struct input_thread_s * );
int ( * pf_seek ) ( struct input_thread_s *, off_t );
} input;
/* Audio output plugin */
struct
{
int ( * pf_open ) ( struct aout_thread_s * );
int ( * pf_setformat ) ( struct aout_thread_s * );
long ( * pf_getbufinfo ) ( struct aout_thread_s *, long );
void ( * pf_play ) ( struct aout_thread_s *, byte_t *, int );
void ( * pf_close ) ( struct aout_thread_s * );
} aout;
/* Motion compensation plugin */
struct
{
#define motion_functions( yuv ) \
......@@ -90,23 +114,23 @@ typedef struct function_list_s
#undef motion_functions
} motion;
/* IDCT plugin */
struct
{
void ( * pf_init ) ( struct vdec_thread_s * p_vdec );
void ( * pf_sparse_idct ) ( struct vdec_thread_s * p_vdec,
dctelem_t * p_block,
int i_sparse_pos );
void ( * pf_idct ) ( struct vdec_thread_s * p_vdec,
dctelem_t * p_block,
int i_idontcare );
void ( * pf_init ) ( struct vdec_thread_s * );
void ( * pf_sparse_idct ) ( struct vdec_thread_s *,
dctelem_t *, int );
void ( * pf_idct ) ( struct vdec_thread_s *,
dctelem_t *, int );
void ( * pf_norm_scan ) ( u8 ppi_scan[2][64] );
} idct;
/* YUV transformation plugin */
struct
{
int ( * pf_init ) ( struct vout_thread_s * p_vout );
int ( * pf_reset ) ( struct vout_thread_s * p_vout );
void ( * pf_end ) ( struct vout_thread_s * p_vout );
int ( * pf_init ) ( struct vout_thread_s * );
int ( * pf_reset ) ( struct vout_thread_s * );
void ( * pf_end ) ( struct vout_thread_s * );
} yuv;
} functions;
......@@ -117,6 +141,7 @@ typedef struct module_functions_s
{
/* XXX: The order here has to be the same as above for the #defines */
function_list_t intf;
function_list_t access;
function_list_t input;
function_list_t decaps;
function_list_t adec;
......
......@@ -3,7 +3,7 @@
* and TS system layers
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: mpeg_system.h,v 1.5 2001/01/10 19:22:11 massiot Exp $
* $Id: mpeg_system.h,v 1.1 2001/02/08 04:43:27 sam Exp $
*
* Authors:
*
......
......@@ -2,7 +2,7 @@
* css_table.h : Various tables needed by css unencryption
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: css_table.h,v 1.2 2001/02/08 01:34:41 stef Exp $
* $Id: css_table.h,v 1.1 2001/02/08 04:43:27 sam Exp $
*
* Author: Stphane Borel <stef@via.ecp.fr>
*
......
/*****************************************************************************
* dvd.c : DVD input module for vlc
*****************************************************************************
* Copyright (C) 2000 VideoLAN
*
* Authors:
*
* 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.
*****************************************************************************/
#define MODULE_NAME dvd
/*****************************************************************************
* Preamble
*****************************************************************************/
#include "defs.h"
#include <stdlib.h> /* malloc(), free() */
#include <string.h> /* strdup() */
#include "config.h"
#include "common.h" /* boolean_t, byte_t */
#include "threads.h"
#include "mtime.h"
#include "modules.h"
#include "modules_inner.h"
/*****************************************************************************
* Build configuration tree.
*****************************************************************************/
MODULE_CONFIG_START
ADD_WINDOW( "Configuration for DVD module" )
ADD_COMMENT( "foobar !" )
MODULE_CONFIG_END
/*****************************************************************************
* Capabilities defined in the other files.
*****************************************************************************/
extern void input_getfunctions( function_list_t * p_function_list );
/*****************************************************************************
* 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.
*****************************************************************************/
int InitModule( module_t * p_module )
{
p_module->psz_name = MODULE_STRING;
p_module->psz_longname = "DVD input module";
p_module->psz_version = VERSION;
p_module->i_capabilities = MODULE_CAPABILITY_NULL
| MODULE_CAPABILITY_INPUT;
return( 0 );
}
/*****************************************************************************
* 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 )
{
return( -1 );
}
input_getfunctions( &p_module->p_functions->input );
p_module->p_config = p_config;
return( 0 );
}
/*****************************************************************************
* 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 )
{
free( p_module->p_functions );
return( 0 );
}