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 );
}
......@@ -2,7 +2,7 @@
* dvd_css.c: Functions for DVD authentification and unscrambling
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: dvd_css.c,v 1.5 2001/02/08 01:34:41 stef Exp $
* $Id: dvd_css.c,v 1.1 2001/02/08 04:43:27 sam Exp $
*
* Author: Stphane Borel <stef@via.ecp.fr>
*
......
......@@ -2,7 +2,7 @@
* dvd_css.h: Structures for DVD authentification and unscrambling
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: dvd_css.h,v 1.5 2001/02/08 01:34:41 stef Exp $
* $Id: dvd_css.h,v 1.1 2001/02/08 04:43:27 sam Exp $
*
* Author: Stphane Borel <stef@via.ecp.fr>
*
......
......@@ -2,7 +2,7 @@
* dvd_ifo.c: Functions for ifo parsing
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: dvd_ifo.c,v 1.7 2001/02/08 01:34:41 stef Exp $
* $Id: dvd_ifo.c,v 1.1 2001/02/08 04:43:27 sam Exp $
*
* Author: Stphane Borel <stef@via.ecp.fr>
*
......
......@@ -2,7 +2,7 @@
* dvd_ifo.h: Structures for ifo parsing
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: dvd_ifo.h,v 1.7 2001/02/08 01:34:42 stef Exp $
* $Id: dvd_ifo.h,v 1.1 2001/02/08 04:43:27 sam Exp $
*
* Author: Stphane Borel <stef@via.ecp.fr>
*
......
This diff is collapsed.
/*****************************************************************************
* input_dvd.h: thread structure of the DVD plugin
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
*
* Author: Stéphane Borel <stef@via.ecp.fr>
*
* 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.
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
#define DVD_LB_SIZE 2048
/*****************************************************************************
* thread_dvd_data_t: extension of input_thread_t for DVD specificity
*****************************************************************************/
typedef struct thread_dvd_data_s
{
int i_fd; // File descriptor of device
boolean_t b_encrypted; // CSS encryption
int i_read_once; // NB of bytes read by DVDRead
int i_title; // Current Title
/* Scrambling Information */
#if defined( HAVE_SYS_DVDIO_H ) || defined( LINUX_DVD )
struct css_s css;
#endif
/* Structure that contains all information of the DVD */
struct ifo_s ifo;
} thread_dvd_data_t;
/*****************************************************************************
* Prototypes in dvd_ifo.c
*****************************************************************************/
struct ifo_s IfoInit( int );
void IfoRead( struct ifo_s * );
void IfoEnd( ifo_t * );
/*****************************************************************************
* Prototypes in dvd_css.c
*****************************************************************************/
#if defined( HAVE_SYS_DVDIO_H ) || defined( LINUX_DVD )
int CSSTest ( int );
struct css_s CSSInit ( int );
int CSSGetKeys ( struct css_s * );
int CSSDescrambleSector( u8 * , u8 * );
#endif
......@@ -2,7 +2,7 @@
* input_ps.c: PS demux and packet management
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: input_ps.c,v 1.22 2001/02/07 15:32:26 massiot Exp $
* $Id: input_ps.c,v 1.1 2001/02/08 04:43:27 sam Exp $
*
* Authors:
*
......@@ -34,6 +34,7 @@
#include "common.h"
#include "threads.h"
#include "mtime.h"
#include "tests.h"
#include "intf_msg.h"
......@@ -50,18 +51,44 @@
#include "debug.h"
#include "modules.h"
/*****************************************************************************
* Local prototypes
*****************************************************************************/
static int PSProbe ( struct input_thread_s * );
static int PSProbe ( probedata_t * );
static int PSRead ( struct input_thread_s *,
data_packet_t * p_packets[INPUT_READ_ONCE] );
static void PSInit ( struct input_thread_s * );
static void PSEnd ( struct input_thread_s * );
static struct pes_packet_s * NewPES ( void * p_garbage );
static struct data_packet_s * NewPacket ( void *, size_t );
static void DeletePacket( void *, struct data_packet_s * );
static void DeletePES ( void *, struct pes_packet_s * );
/*****************************************************************************
* Functions exported as capabilities. They are declared as static so that
* we don't pollute the namespace too much.
*****************************************************************************/
void input_getfunctions( function_list_t * p_function_list )
{
#define input p_function_list->functions.input
p_function_list->pf_probe = PSProbe;
input.pf_init = PSInit;
input.pf_open = input_FileOpen;
input.pf_close = input_FileClose;
input.pf_end = PSEnd;
input.pf_read = PSRead;
input.pf_demux = input_DemuxPS;
input.pf_new_packet = NewPacket;
input.pf_new_pes = NewPES;
input.pf_delete_packet = DeletePacket;
input.pf_delete_pes = DeletePES;
input.pf_rewind = NULL;
input.pf_seek = NULL;
#undef input
}
/*
* Data reading functions
*/
......@@ -69,11 +96,14 @@ static void DeletePES ( void *, struct pes_packet_s * );
/*****************************************************************************
* PSProbe: verifies that the stream is a PS stream
*****************************************************************************/
static int PSProbe( input_thread_t * p_input )
static int PSProbe( probedata_t *p_data )
{
/* verify that the first three bytes are 0x000001, or unscramble and
* re-do. */
return 1;
if( TestMethod( INPUT_METHOD_VAR, "ps" ) )
{
return( 999 );
}
return 10;
}
/*****************************************************************************
......@@ -180,27 +210,21 @@ static void PSInit( input_thread_t * p_input )
case MPEG1_AUDIO_ES:
case MPEG2_AUDIO_ES:
if( main_GetIntVariable( INPUT_DVD_CHANNEL_VAR, 0 )
if( main_GetIntVariable( INPUT_DVD_AUDIO_VAR, 0 )
== REQUESTED_MPEG
&& main_GetIntVariable( INPUT_DVD_CHANNEL_VAR, 0 )
== (p_es->i_id & 0x1F) )
switch( main_GetIntVariable( INPUT_DVD_AUDIO_VAR, 0 ) )
{
case 0:
main_PutIntVariable( INPUT_DVD_AUDIO_VAR,
REQUESTED_MPEG );
case REQUESTED_MPEG:
input_SelectES( p_input, p_es );
}
break;
case AC3_AUDIO_ES:
if( main_GetIntVariable( INPUT_DVD_CHANNEL_VAR, 0 )
if( main_GetIntVariable( INPUT_DVD_AUDIO_VAR, 0 )
== REQUESTED_AC3
&& main_GetIntVariable( INPUT_DVD_CHANNEL_VAR, 0 )
== ((p_es->i_id & 0xF00) >> 8) )
switch( main_GetIntVariable( INPUT_DVD_AUDIO_VAR, 0 ) )
{
case 0:
main_PutIntVariable( INPUT_DVD_AUDIO_VAR,
REQUESTED_AC3 );
case REQUESTED_AC3:
input_SelectES( p_input, p_es );
}
break;
......@@ -495,25 +519,4 @@ static void DeletePES( void * p_garbage, pes_packet_t * p_pes )
free( p_pes );
}
/*****************************************************************************
* PSKludge: fakes a PS plugin (FIXME)
*****************************************************************************/
input_capabilities_t * PSKludge( void )
{
input_capabilities_t * p_plugin;
p_plugin = (input_capabilities_t *)malloc( sizeof(input_capabilities_t) );
p_plugin->pf_probe = PSProbe;
p_plugin->pf_init = PSInit;
p_plugin->pf_end = PSEnd;
p_plugin->pf_read = PSRead;
p_plugin->pf_demux = input_DemuxPS; /* FIXME: use i_p_config_t ! */
p_plugin->pf_new_packet = NewPacket;
p_plugin->pf_new_pes = NewPES;
p_plugin->pf_delete_packet = DeletePacket;
p_plugin->pf_delete_pes = DeletePES;
p_plugin->pf_rewind = NULL;
p_plugin->pf_seek = NULL;
return( p_plugin );
}
......@@ -2,7 +2,7 @@
* input_ps.h: thread structure of the PS plugin
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: input_ps.h,v 1.2 2000/12/21 15:01:08 massiot Exp $
* $Id: input_ps.h,v 1.1 2001/02/08 04:43:27 sam Exp $
*
* Authors:
*
......
......@@ -2,7 +2,7 @@
* input_ts.c: TS demux and netlist management
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: input_ts.c,v 1.3 2001/01/05 18:46:44 massiot Exp $
* $Id: input_ts.c,v 1.1 2001/02/08 04:43:27 sam Exp $
*
* Authors:
*
......@@ -34,6 +34,8 @@
#include "common.h"
#include "threads.h"
#include "mtime.h"
#include "tests.h"
#include "modules.h"
#include "intf_msg.h"
......@@ -49,17 +51,45 @@
/*****************************************************************************
* Local prototypes
*****************************************************************************/
static int TSProbe ( struct input_thread_s * );
static int TSProbe ( probedata_t * );
static int TSRead ( struct input_thread_s *,
data_packet_t * p_packets[INPUT_READ_ONCE] );
static void TSInit ( struct input_thread_s * );
static void TSEnd ( struct input_thread_s * );
/*****************************************************************************
* Functions exported as capabilities. They are declared as static so that
* we don't pollute the namespace too much.
*****************************************************************************/
void input_getfunctions( function_list_t * p_function_list )
{
#define input p_function_list->functions.input
p_function_list->pf_probe = TSProbe;
input.pf_init = TSInit;
input.pf_open = input_FileOpen;
input.pf_close = input_FileClose;
input.pf_end = TSEnd;
input.pf_read = TSRead;
input.pf_demux = input_DemuxTS;
input.pf_new_packet = input_NetlistNewPacket;
input.pf_new_pes = input_NetlistNewPES;
input.pf_delete_packet = input_NetlistDeletePacket;
input.pf_delete_pes = input_NetlistDeletePES;
input.pf_rewind = NULL;
input.pf_seek = NULL;
#undef input
}
/*****************************************************************************
* TSProbe: verifies that the stream is a TS stream
*****************************************************************************/
static int TSProbe( input_thread_t * p_input )
static int TSProbe( probedata_t * p_data )
{
if( TestMethod( INPUT_METHOD_VAR, "ts" ) )
{
return( 999 );
}
/* verify that the first byte is 0x47 */
return 1;
}
......@@ -92,26 +122,3 @@ static int TSRead( input_thread_t * p_input,
return -1;
}
/*****************************************************************************
* TSKludge: fakes a TS plugin (FIXME)
*****************************************************************************/
input_capabilities_t * TSKludge( void )
{
input_capabilities_t * p_plugin;
p_plugin = (input_capabilities_t *)malloc( sizeof(input_capabilities_t) );
p_plugin->pf_probe = TSProbe;
p_plugin->pf_init = TSInit;
p_plugin->pf_end = TSEnd;
p_plugin->pf_read = TSRead;
p_plugin->pf_demux = input_DemuxTS; /* FIXME: use i_p_config_t ! */
p_plugin->pf_new_packet = input_NetlistNewPacket;
p_plugin->pf_new_pes = input_NetlistNewPES;
p_plugin->pf_delete_packet = input_NetlistDeletePacket;
p_plugin->pf_delete_pes = input_NetlistDeletePES;
p_plugin->pf_rewind = NULL;
p_plugin->pf_seek = NULL;
return( p_plugin );
}
/*****************************************************************************
* ps.c : Program Stream 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 ps
/*****************************************************************************
* 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 PS 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 = "ISO 13818-1 MPEG Program Stream 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 );
}
/*****************************************************************************
* ts.c : Transport Stream 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 ts
/*****************************************************************************
* 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 TS 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 = "ISO 13818-1 MPEG Transport Stream 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 );
}
......@@ -136,7 +136,7 @@ static int aout_Probe( probedata_t *p_data )
return( 999 );
}
return( 50 );
return( 40 );
}
/*****************************************************************************
......
......@@ -2,7 +2,7 @@
* intf_sdl.c: SDL interface plugin
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: intf_sdl.c,v 1.29 2001/02/08 01:06:11 reno Exp $
* $Id: intf_sdl.c,v 1.30 2001/02/08 04:43:27 sam Exp $
*
* Authors:
*
......@@ -154,7 +154,7 @@ void intf_SDLManage( intf_thread_t *p_intf )
input_Forward( p_intf->p_input, i_rate );
break;
case SDLK_s:
case SDLK_z:
i_rate = p_intf->p_input->stream.control.i_rate*2;
if ( i_rate <= MAXIMAL_RATE )
{
......
This diff is collapsed.
......@@ -2,7 +2,7 @@
* input_programs.c: es_descriptor_t, pgrm_descriptor_t management
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: input_programs.c,v 1.28 2001/02/07 15:32:26 massiot Exp $
* $Id: input_programs.c,v 1.29 2001/02/08 04:43:28 sam Exp $
*
* Authors:
*
......@@ -449,8 +449,7 @@ static int InitDecConfig( input_thread_t * p_input, es_descriptor_t * p_es,
p_config->p_decoder_fifo->i_start = p_config->p_decoder_fifo->i_end = 0;
p_config->p_decoder_fifo->b_die = p_config->p_decoder_fifo->b_error = 0;
p_config->p_decoder_fifo->p_packets_mgt = p_input->p_method_data;
p_config->p_decoder_fifo->pf_delete_pes =
p_input->p_plugin->pf_delete_pes;
p_config->p_decoder_fifo->pf_delete_pes = p_input->pf_delete_pes;
p_es->p_decoder_fifo = p_config->p_decoder_fifo;
p_config->pf_init_bit_stream = InitBitstream;
......
......@@ -2,7 +2,7 @@
* mpeg_system.c: TS, PS and PES management
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: mpeg_system.c,v 1.31 2001/02/08 01:34:42 stef Exp $
* $Id: mpeg_system.c,v 1.32 2001/02/08 04:43:28 sam Exp $
*
* Authors:
*
......@@ -134,7 +134,7 @@ void input_ParsePES( input_thread_t * p_input, es_descriptor_t * p_es )
!= PES_HEADER_SIZE )
{
intf_WarnMsg( 3, "PES packet too short to have a header" );
p_input->p_plugin->pf_delete_pes( p_input->p_method_data, p_pes );
p_input->pf_delete_pes( p_input->p_method_data, p_pes );
p_pes = NULL;
return;
}
......@@ -148,7 +148,7 @@ void input_ParsePES( input_thread_t * p_input, es_descriptor_t * p_es )
{
/* packet_start_code_prefix != 0x000001 */
intf_ErrMsg( "PES packet doesn't start with 0x000001 : data loss" );
p_input->p_plugin->pf_delete_pes( p_input->p_method_data, p_pes );
p_input->pf_delete_pes( p_input->p_method_data, p_pes );
p_pes = NULL;
}
else
......@@ -194,8 +194,8 @@ void input_ParsePES( input_thread_t * p_input, es_descriptor_t * p_es )
{
intf_WarnMsg( 3,
"PES packet too short to have a MPEG-2 header" );
p_input->p_plugin->pf_delete_pes( p_input->p_method_data,
p_pes );
p_input->pf_delete_pes( p_input->p_method_data,
p_pes );
p_pes = NULL;
return;
}
......@@ -211,9 +211,8 @@ void input_ParsePES( input_thread_t * p_input, es_descriptor_t * p_es )
{
intf_WarnMsg( 3,
"PES packet too short to have a MPEG-2 header" );
p_input->p_plugin->pf_delete_pes(
p_input->p_method_data,
p_pes );
p_input->pf_delete_pes( p_input->p_method_data,
p_pes );
p_pes = NULL;
return;
}
......@@ -228,9 +227,8 @@ void input_ParsePES( input_thread_t * p_input, es_descriptor_t * p_es )
{
intf_WarnMsg( 3,
"PES packet too short to have a MPEG-2 header" );
p_input->p_plugin->pf_delete_pes(
p_input->p_method_data,
p_pes );
p_input->pf_delete_pes( p_input->p_method_data,
p_pes );
p_pes = NULL;
return;
}
......@@ -260,7 +258,7 @@ void input_ParsePES( input_thread_t * p_input, es_descriptor_t * p_es )
{
intf_WarnMsg( 3,
"PES packet too short to have a MPEG-1 header" );
p_input->p_plugin->pf_delete_pes( p_input->p_method_data, p_pes );
p_input->pf_delete_pes( p_input->p_method_data, p_pes );
p_pes = NULL;
return;
}
......@@ -268,7 +266,7 @@ void input_ParsePES( input_thread_t * p_input, es_descriptor_t * p_es )
if( i_pes_header_size == 22 )
{
intf_ErrMsg( "Too much MPEG-1 stuffing" );
p_input->p_plugin->pf_delete_pes( p_input->p_method_data, p_pes );
p_input->pf_delete_pes( p_input->p_method_data, p_pes );
p_pes = NULL;
return;
}
......@@ -284,7 +282,7 @@ void input_ParsePES( input_thread_t * p_input, es_descriptor_t * p_es )
{
intf_WarnMsg( 3,
"PES packet too short to have a MPEG-1 header" );
p_input->p_plugin->pf_delete_pes( p_input->p_method_data, p_pes );
p_input->pf_delete_pes( p_input->p_method_data, p_pes );
p_pes = NULL;
return;
}
......@@ -304,8 +302,7 @@ void input_ParsePES( input_thread_t * p_input, es_descriptor_t * p_es )
{
intf_WarnMsg( 3,
"PES packet too short to have a MPEG-1 header" );
p_input->p_plugin->pf_delete_pes(
p_input->p_method_data, p_pes );
p_input->pf_delete_pes( p_input->p_method_data, p_pes );
p_pes = NULL;
return;
}
......@@ -322,8 +319,8 @@ void input_ParsePES( input_thread_t * p_input, es_descriptor_t * p_es )
{
intf_WarnMsg( 3,
"PES packet too short to have a MPEG-1 header" );
p_input->p_plugin->pf_delete_pes(
p_input->p_method_data, p_pes );
p_input->pf_delete_pes( p_input->p_method_data,
p_pes );
p_pes = NULL;
return;
}
......@@ -363,8 +360,7 @@ void input_ParsePES( input_thread_t * p_input, es_descriptor_t * p_es )
if( (p_data = p_data->p_next) == NULL )
{
intf_ErrMsg( "PES header bigger than payload" );
p_input->p_plugin->pf_delete_pes( p_input->p_method_data,
p_pes );
p_input->pf_delete_pes( p_input->p_method_data, p_pes );
p_pes = NULL;
return;
}
......@@ -375,7 +371,7 @@ void input_ParsePES( input_thread_t * p_input, es_descriptor_t * p_es )
if( i_payload_size < i_pes_header_size )
{
intf_ErrMsg( "PES header bigger than payload" );
p_input->p_plugin->pf_delete_pes( p_input->p_method_data, p_pes );
p_input->pf_delete_pes( p_input->p_method_data, p_pes );
p_pes = NULL;
return;
}
......@@ -391,7 +387,7 @@ void input_ParsePES( input_thread_t * p_input, es_descriptor_t * p_es )
{
intf_ErrMsg("No fifo to receive PES %p (who wrote this damn code ?)",
p_pes);
p_input->p_plugin->pf_delete_pes( p_input->p_method_data, p_pes );
p_input->pf_delete_pes( p_input->p_method_data, p_pes );
}
p_pes = NULL;
}
......@@ -431,7 +427,7 @@ void input_GatherPES( input_thread_t * p_input, data_packet_t * p_data,
if( !b_unit_start && p_pes == NULL )
{
/* Random access... */
p_input->p_plugin->pf_delete_packet( p_input->p_method_data, p_data );
p_input->pf_delete_packet( p_input->p_method_data, p_data );
}
else
{
......@@ -442,7 +438,7 @@ void input_GatherPES( input_thread_t * p_input, data_packet_t * p_data,
* packet. This is also here that we can synchronize with the
* stream if we lost packets or if the decoder has just
* started. */
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;
......@@ -859,7 +855,7 @@ void input_DemuxPS( input_thread_t * p_input, data_packet_t * p_data )
/* Trash the packet if it has no payload or if it isn't selected */
if( b_trash )
{
p_input->p_plugin->pf_delete_packet( p_input->p_method_data, p_data );
p_input->pf_delete_packet( p_input->p_method_data, p_data );
#ifdef STATS
p_input->c_packets_trashed++;
#endif
......@@ -1051,7 +1047,7 @@ void input_DemuxTS( input_thread_t * p_input, data_packet_t * p_data )
/* Trash the packet if it has no payload or if it isn't selected */
if( b_trash )
{
p_input->p_plugin->pf_delete_packet( p_input, p_data );
p_input->pf_delete_packet( p_input, p_data );
#ifdef STATS
p_input->c_packets_trashed++;
#endif
......
......@@ -38,7 +38,6 @@
#include "mtime.h"
#include "plugins.h"
#include "modules.h"
#include "playlist.h"
#include "stream_control.h"
#include "input_ext-intf.h"
......@@ -49,6 +48,7 @@
#include "interface.h"
#include "intf_cmd.h"
#include "intf_console.h"
#include "intf_plst.h"
#include "keystrokes.h"
#include "video.h"
......@@ -159,6 +159,7 @@ intf_thread_t* intf_Create( void )
free( p_intf );
return( NULL );
}
if( p_intf->p_sys_create( p_intf ) )
{
intf_ErrMsg("intf error: cannot create interface");
......@@ -178,71 +179,10 @@ intf_thread_t* intf_Create( void )
*****************************************************************************/
void intf_Run( intf_thread_t *p_intf )
{
char * psz_server = main_GetPszVariable( INPUT_SERVER_VAR, NULL );
input_config_t * p_input_config;
/* Flush messages before spawning input */
intf_FlushMsg();
/* If a server was specified */
if( psz_server )
{
if( (p_input_config =
(input_config_t *)malloc( sizeof(input_config_t) )) == NULL )
{
intf_ErrMsg( "intf error: cannot create input_config_t" );
}
else
{
p_input_config->i_method = INPUT_METHOD_UCAST;
p_input_config->p_source = psz_server;
p_input_config->p_default_aout = p_main->p_aout;
p_input_config->p_default_vout = p_intf->p_vout;
p_intf->p_input = input_CreateThread( p_input_config, NULL );
}
}
/* DVD mode */
else if( p_main->b_dvd )
{
if( (p_input_config =
(input_config_t *)malloc( sizeof(input_config_t) )) == NULL )
{
intf_ErrMsg( "intf error: cannot create input_config_t" );
}
else
{
p_input_config->i_method = INPUT_METHOD_DVD;
p_input_config->p_source = main_GetPszVariable( INPUT_DVD_DEVICE_VAR, INPUT_DVD_DEVICE_DEFAULT );
p_input_config->p_default_aout = p_main->p_aout;
p_input_config->p_default_vout = p_intf->p_vout;
p_intf->p_input = input_CreateThread( p_input_config, NULL );
}
}
/* Or if a file was specified */
else if( p_main->p_playlist->p_list != NULL )
{
if( (p_input_config =
(input_config_t *)malloc( sizeof(input_config_t) )) == NULL )
{
intf_ErrMsg( "intf error: cannot create input_config_t" );
}
else
{
p_input_config->i_method = INPUT_METHOD_FILE;
p_input_config->p_source = p_main->p_playlist->p_list[0]; /* FIXME ??? */
p_input_config->p_default_aout = p_main->p_aout;
p_input_config->p_default_vout = p_intf->p_vout;
p_intf->p_input = input_CreateThread( p_input_config, NULL );
}
}
/* Execute the initialization script - if a positive number is returned,
* the script could be executed but failed */
else if( intf_ExecScript( main_GetPszVariable( INTF_INIT_SCRIPT_VAR, INTF_INIT_SCRIPT_DEFAULT ) ) > 0 )
{
intf_ErrMsg( "intf error: errors occured during startup script" );
}
p_intf->p_input = input_CreateThread( NULL );
/* Main loop */
while(!p_intf->b_die && (p_intf->p_input != NULL) )
......@@ -583,7 +523,7 @@ static int LoadChannels( intf_thread_t *p_intf, char *psz_filename )
p_file = fopen( psz_filename, "r" );
if( p_file == NULL )
{
intf_ErrMsg( "intf error: cannot open %s (%s)",
intf_DbgMsg( "intf warning: cannot open %s (%s)",
psz_filename, strerror(errno) );
return( 1 );
}
......
/*****************************************************************************
* intf_plst.c : Playlist management functions
*****************************************************************************
* Copyright (C) 1999, 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.
*****************************************************************************/
#include "defs.h"
#include "config.h"
#include <stdlib.h> /* free(), strtol() */
#include <stdio.h> /* sprintf() */
#include <string.h> /* strerror() */
#include <errno.h> /* ENOMEM */
#include "common.h"
#include "threads.h"
#include "intf_msg.h"
#include "intf_plst.h"
#include "main.h"
static void NextItem( playlist_t * p_playlist );
playlist_t * playlist_Create ( void )
{
playlist_t *p_playlist;
/* Allocate structure */
p_playlist = malloc( sizeof( playlist_t ) );
if( !p_playlist )
{
intf_ErrMsg("playlist error: %s", strerror( ENOMEM ) );
return( NULL );
}
return( p_playlist );
}
void playlist_Init ( playlist_t * p_playlist )
{
vlc_mutex_init( &p_playlist->change_lock );
p_playlist->i_index = -1; /* -1 means we are not playing anything yet */
p_playlist->i_size = 0;
p_playlist->i_mode = PLAYLIST_FORWARD;
p_playlist->i_seed = 0;
/* There is no current item */
p_playlist->current.i_type = 0;
p_playlist->current.i_status = 0;
p_playlist->current.psz_name = NULL;
/* The playlist is empty */
p_playlist->p_item = NULL;
intf_Msg("playlist: playlist created");
}
int playlist_Add( playlist_t * p_playlist, int i_pos, char * psz_item )
{
int i_index;
playlist_item_t * p_item;
vlc_mutex_lock( &p_playlist->change_lock );
if( i_pos == PLAYLIST_END )
{
i_pos = p_playlist->i_size;
}
else if( i_pos > p_playlist->i_size )
{
intf_ErrMsg( "playlist error: inserting item beyond playlist size" );
vlc_mutex_unlock( &p_playlist->change_lock );
return( -1 );
}
/* Increment playlist size */
p_playlist->i_size++;
p_playlist->p_item = realloc( p_playlist->p_item,
p_playlist->i_size * sizeof( playlist_item_t ) );
/* Move second place of the playlist to make room for new item */
for( i_index = p_playlist->i_size - 1; i_index > i_pos; i_index-- )
{
p_playlist->p_item[ i_index ] = p_playlist->p_item[ i_index - 1 ];
}
/* Insert the new item */
p_item = &p_playlist->p_item[ i_pos ];
p_item->i_type = 0;
p_item->i_status = 0;
p_item->psz_name = strdup( psz_item );
intf_Msg( "playlist: added %s", psz_item );
vlc_mutex_unlock( &p_playlist->change_lock );
return( 0 );
}
void playlist_Next( playlist_t * p_playlist )
{
vlc_mutex_lock( &p_playlist->change_lock );
NextItem( p_playlist );
vlc_mutex_unlock( &p_playlist->change_lock );
}
void playlist_Prev( playlist_t * p_playlist )
{
vlc_mutex_lock( &p_playlist->change_lock );
p_playlist->i_mode = -p_playlist->i_mode;
NextItem( p_playlist );
p_playlist->i_mode = -p_playlist->i_mode;
vlc_mutex_unlock( &p_playlist->change_lock );
}
int playlist_Delete( playlist_t * p_playlist, int i_pos )
{
int i_index;
char * psz_name;
vlc_mutex_lock( &p_playlist->change_lock );
if( !p_playlist->i_size || i_pos >= p_playlist->i_size )
{
intf_ErrMsg( "playlist error: deleting item beyond playlist size" );
vlc_mutex_unlock( &p_playlist->change_lock );
return( -1 );
}
/* Store the location of the item's name */
psz_name = p_playlist->p_item[ i_pos ].psz_name;
/* Fill the room by moving the next items */
for( i_index = i_pos; i_index < p_playlist->i_size - 1; i_index++ )
{
p_playlist->p_item[ i_index ] = p_playlist->p_item[ i_index + 1 ];
}
/* Decrement playlist size */
p_playlist->i_size--;
p_playlist->p_item = realloc( p_playlist->p_item,
p_playlist->i_size * sizeof( playlist_item_t ) );
intf_Msg( "playlist: removed %s", psz_name );
/* Delete the item */
free( psz_name );
vlc_mutex_unlock( &p_playlist->change_lock );
return( 0 );
}
void playlist_Destroy( playlist_t * p_playlist )
{
int i_index;
for( i_index = p_playlist->i_size - 1; p_playlist->i_size; i_index-- )
{
playlist_Delete( p_playlist, i_index );
}
vlc_mutex_destroy( &p_playlist->change_lock );
if( p_playlist->current.psz_name != NULL )
{
free( p_playlist->current.psz_name );
}
free( p_playlist );
intf_Msg("playlist: playlist destroyed");
}
static void NextItem( playlist_t * p_playlist )
{
if( !p_playlist->i_size )
{
p_playlist->i_index = -1;
}
else
{
switch( p_playlist->i_mode )
{
case PLAYLIST_FORWARD:
p_playlist->i_index++;
if( p_playlist->i_index > p_playlist->i_size - 1 )
{
p_playlist->i_index = -1;
}
break;
case PLAYLIST_FORWARD_LOOP:
p_playlist->i_index++;
if( p_playlist->i_index > p_playlist->i_size - 1 )
{
p_playlist->i_index = 0;
}
break;
case PLAYLIST_BACKWARD:
p_playlist->i_index--;
if( p_playlist->i_index < 0 )
{
p_playlist->i_index = -1;
}
break;
case PLAYLIST_BACKWARD_LOOP:
p_playlist->i_index--;
if( p_playlist->i_index < 0 )
{
p_playlist->i_index = p_playlist->i_size - 1;
}
break;
case PLAYLIST_REPEAT_CURRENT:
/* Just repeat what we were doing */
if( p_playlist->i_index < 0
|| p_playlist->i_index > p_playlist->i_size - 1 )
{
p_playlist->i_index = 0;
}
break;
case PLAYLIST_RANDOM:
/* FIXME: TODO ! */
p_playlist->i_index++;
if( p_playlist->i_index > p_playlist->i_size - 1 )
{
p_playlist->i_index = 0;
}
break;
}
/* Duplicate the playlist entry */
if( p_playlist->i_index != -1 )
{
if( p_playlist->current.psz_name != NULL )
{
free( p_playlist->current.psz_name );
}
p_playlist->current = p_playlist->p_item[ p_playlist->i_index ];
p_playlist->current.psz_name
= strdup( p_playlist->current.psz_name );
}
}
}
This diff is collapsed.
......@@ -308,7 +308,7 @@ module_t * module_Need( module_bank_t *p_bank,
/* We release the global lock */
vlc_mutex_unlock( &p_bank->lock );
intf_Msg( "module: locking module `%s'", p_bestmodule->psz_name );
intf_WarnMsg( 1, "module: locking module `%s'", p_bestmodule->psz_name );
/* Don't forget that the module is still locked if bestmodule != NULL */
return( p_bestmodule );
......@@ -329,7 +329,7 @@ void module_Unneed( module_bank_t * p_bank, module_t * p_module )
* so there is no need to check the return value. */
UnlockModule( p_module );
intf_Msg( "module: unlocking module `%s'", p_module->psz_name );
intf_WarnMsg( 1, "module: unlocking module `%s'", p_module->psz_name );
/* We release the global lock */
vlc_mutex_unlock( &p_bank->lock );
......@@ -357,7 +357,7 @@ static int AllocateDynModule( module_bank_t * p_bank, char * psz_filename )
if( module_load( psz_filename, &handle ) )
{
/* The dynamic module couldn't be opened */
intf_DbgMsg( "module warning: cannot open %s (%s)",
intf_ErrMsg( "module warning: cannot open %s (%s)",
psz_filename, module_error() );
return( -1 );
}
......@@ -452,8 +452,8 @@ static int AllocateDynModule( module_bank_t * p_bank, char * psz_filename )
p_bank->first = p_module;
/* Immediate message so that a slow module doesn't make the user wait */
intf_MsgImm( "module: dynamic module `%s', %s",
p_module->psz_name, p_module->psz_longname );
intf_WarnMsgImm( 1, "module: dynamic module `%s', %s",
p_module->psz_name, p_module->psz_longname );
return( 0 );
}
......@@ -677,8 +677,9 @@ static int CallSymbol( module_t * p_module, char * psz_name )
if( !p_symbol )
{
/* We couldn't load the symbol */
intf_DbgMsg( "module warning: cannot find symbol %s in module %s (%s)",
psz_name, p_module->psz_filename, module_error() );
intf_WarnMsg( 1, "module warning: "
"cannot find symbol %s in module %s (%s)",
psz_name, p_module->psz_filename, module_error() );
return( -1 );
}
......
/*****************************************************************************
* playlist.c : Playlist management functions
*****************************************************************************
* Copyright (C) 1999, 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.
*****************************************************************************/
#include "defs.h"
#include "config.h"
#include <stdlib.h> /* free(), strtol() */
#include <stdio.h> /* sprintf() */
#include <string.h> /* strerror() */
#include <errno.h> /* ENOMEM */
#include "common.h"
#include "intf_msg.h"
#include "playlist.h"
#include "main.h"
/* Local prototypes */
//int TestPlugin ( plugin_id_t *p_plugin_id, char * psz_name );
//int AllocatePlugin ( plugin_id_t plugin_id, plugin_bank_t * p_bank );
playlist_t * playlist_Create ( void )
{
playlist_t *p_playlist;
/* Allocate structure */
p_playlist = malloc( sizeof( playlist_t ) );
if( !p_playlist )
{
intf_ErrMsg("playlist error: %s", strerror( ENOMEM ) );
return( NULL );
}
p_playlist->i_index = 0;
p_playlist->p_list = NULL;
intf_Msg("playlist: playlist created");
return( p_playlist );
}
void playlist_Init( playlist_t * p_playlist, int i_optind )
{
int i_list_index = 0;
int i_index;
int i_argc = p_main->i_argc;
if( i_optind < i_argc )
{
i_list_index = i_argc - i_optind;
p_playlist->p_list = malloc( i_list_index * sizeof( int ) );
for( i_index = 0 ; i_argc - i_index > i_optind ; i_index++ )
{
if( strncmp( p_main->ppsz_argv[ i_argc - i_index - 1], "-", 1 ) )
{
p_playlist->p_list[ i_index ] =
p_main->ppsz_argv[ i_argc - i_index - 1];
}
else
{
p_playlist->p_list[ i_index ] = "/dev/stdin";
}
}
}
else
{
/* if no file was asked, get stream from the network */
p_playlist->p_list = NULL;
}
p_main->p_playlist->i_index = i_list_index;
}
void playlist_Destroy( playlist_t * p_playlist )
{
free( p_playlist );
}
/*
* Following functions are local
*/
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