Commit 66c62b43 authored by Sam Hocevar's avatar Sam Hocevar

* ./modules/demux/mpeg/system.c: added a helper plugin for MPEG-related

    demux plugins (ps, ts, but also dvd*).
  * ./src/input/mpeg_system.c: removed MPEG-related stuff from the vlc core.
  * ./src/misc/modules.c: max recursion level is now 5.
  * ./modules/access/dvdplay/es.c: fixed a buffer overflow.
parent d669f1c3
......@@ -20,7 +20,7 @@ VLC := vlc
LIBVLC := libvlc
INTERFACE := interface intf_eject
PLAYLIST := playlist
INPUT := input input_ext-plugins input_ext-dec input_ext-intf input_dec input_programs input_clock mpeg_system input_info
INPUT := input input_ext-plugins input_ext-dec input_ext-intf input_dec input_programs input_clock input_info
VIDEO_OUTPUT := video_output video_text vout_pictures vout_subpictures
AUDIO_OUTPUT := audio_output aout_ext-dec aout_pcm aout_spdif
MISC := mtime modules threads cpu configuration netutils iso_lang messages objects extras
......
......@@ -32,7 +32,7 @@ RELEASE = @RELEASE@
# Build environment
#
CC = @CC@
CFLAGS = @CFLAGS@
CFLAGS += @CFLAGS@
SHELL = @SHELL@
RANLIB = @RANLIB@
STRIP = @STRIP@
......
#! /bin/sh
## bootstrap.sh file for vlc, the VideoLAN Client
## $Id: bootstrap.sh,v 1.8 2002/07/21 15:27:09 sam Exp $
## $Id: bootstrap.sh,v 1.9 2002/08/07 00:29:36 sam Exp $
##
## Authors: Samuel Hocevar <sam@zoy.org>
......@@ -73,7 +73,7 @@ echo "$file."
echo -n " + fixing glade bugs: "
for file in gnome_interface.c gtk_interface.c
do
if grep -q "DO NOT EDIT THIS FILE" plugins/gtk/$file
if grep -q "DO NOT EDIT THIS FILE" modules/gui/gtk/$file
then
rm -f /tmp/$$.$file.bak
cat > /tmp/$$.$file.bak << EOF
......@@ -81,7 +81,7 @@ then
#include <vlc/vlc.h>
EOF
tail +8 plugins/gtk/$file \
tail +8 modules/gui/gtk/$file \
| sed 's#DISABLED!!!_("/dev/dvd")#config_GetPsz( "dvd" )#' \
| sed 's#DISABLED!!!11954#config_GetInt( "frequency" )#' \
| sed 's#DISABLED!!!27500#config_GetInt( "symbol-rate" )#' \
......@@ -91,17 +91,17 @@ EOF
| sed 's#_("/dev/dvd")#"/dev/dvd"#' \
| sed 's#_(\("./."\))#\1#' \
>> /tmp/$$.$file.bak
mv -f /tmp/$$.$file.bak plugins/gtk/$file
mv -f /tmp/$$.$file.bak modules/gui/gtk/$file
fi
echo -n "$file "
done
file=gtk_support.h
if grep -q "DO NOT EDIT THIS FILE" plugins/gtk/$file
if grep -q "DO NOT EDIT THIS FILE" modules/gui/gtk/$file
then
rm -f /tmp/$$.$file.bak
sed 's/DO NOT EDIT THIS FILE.*/This file was created automatically by glade and fixed by bootstrap.sh/ ; s/#if.*ENABLE_NLS.*/#if defined( ENABLE_NLS ) \&\& defined ( HAVE_GETTEXT )/' < plugins/gtk/$file > /tmp/$$.$file.bak
mv -f /tmp/$$.$file.bak plugins/gtk/$file
sed 's/DO NOT EDIT THIS FILE.*/This file was created automatically by glade and fixed by bootstrap.sh/ ; s/#if.*ENABLE_NLS.*/#if defined( ENABLE_NLS ) \&\& defined ( HAVE_GETTEXT )/' < modules/gui/gtk/$file > /tmp/$$.$file.bak
mv -f /tmp/$$.$file.bak modules/gui/gtk/$file
fi
echo "$file."
......
......@@ -5538,7 +5538,7 @@ esac
BUILTINS="${BUILTINS}"
PLUGINS="${PLUGINS} misc/dummy/dummy misc/null/null"
PLUGINS="${PLUGINS} control/rc/rc misc/logger/logger access/file access/udp access/http misc/network/ipv4 misc/memcpy/memcpy"
PLUGINS="${PLUGINS} demux/mpeg/es demux/mpeg/audio demux/mpeg/ps demux/mpeg/ts"
PLUGINS="${PLUGINS} demux/mpeg/es demux/mpeg/audio demux/mpeg/mpeg_system demux/mpeg/ps demux/mpeg/ts"
PLUGINS="${PLUGINS} codec/mpeg_video/idct/idct codec/mpeg_video/idct/idctclassic codec/mpeg_video/motion/motion codec/a52old/imdct/imdct codec/a52old/downmix/downmix codec/mpeg_audio/mpeg_audio codec/a52old/a52old codec/mpeg_video/mpeg_video codec/lpcm/lpcm codec/spdif/spdif codec/spudec/spudec"
PLUGINS="${PLUGINS} video_filter/deinterlace/deinterlace video_filter/invert video_filter/wall video_filter/transform video_filter/distort video_filter/clone video_filter/crop"
PLUGINS="${PLUGINS} visualization/scope/scope"
......
......@@ -436,7 +436,7 @@ dnl
BUILTINS="${BUILTINS}"
PLUGINS="${PLUGINS} misc/dummy/dummy misc/null/null"
PLUGINS="${PLUGINS} control/rc/rc misc/logger/logger access/file access/udp access/http misc/network/ipv4 misc/memcpy/memcpy"
PLUGINS="${PLUGINS} demux/mpeg/es demux/mpeg/audio demux/mpeg/ps demux/mpeg/ts"
PLUGINS="${PLUGINS} demux/mpeg/es demux/mpeg/audio demux/mpeg/mpeg_system demux/mpeg/ps demux/mpeg/ts"
PLUGINS="${PLUGINS} codec/mpeg_video/idct/idct codec/mpeg_video/idct/idctclassic codec/mpeg_video/motion/motion codec/a52old/imdct/imdct codec/a52old/downmix/downmix codec/mpeg_audio/mpeg_audio codec/a52old/a52old codec/mpeg_video/mpeg_video codec/lpcm/lpcm codec/spdif/spdif codec/spudec/spudec"
PLUGINS="${PLUGINS} video_filter/deinterlace/deinterlace video_filter/invert video_filter/wall video_filter/transform video_filter/distort video_filter/clone video_filter/crop"
PLUGINS="${PLUGINS} visualization/scope/scope"
......
......@@ -2,7 +2,7 @@
* input_ext-dec.h: structures exported to the VideoLAN decoders
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: input_ext-dec.h,v 1.66 2002/08/04 17:23:41 sam Exp $
* $Id: input_ext-dec.h,v 1.67 2002/08/07 00:29:36 sam Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Michel Kaempf <maxx@via.ecp.fr>
......@@ -116,7 +116,7 @@ struct decoder_fifo_t
/* Standard pointers given to the decoders as a toolbox. */
u16 i_id;
vlc_fourcc_t i_fourcc;
void * p_demux_data;
es_sys_t * p_demux_data;
stream_ctrl_t * p_stream_ctrl;
/* Module properties */
......
......@@ -4,7 +4,7 @@
* control the pace of reading.
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: input_ext-intf.h,v 1.74 2002/08/04 17:23:41 sam Exp $
* $Id: input_ext-intf.h,v 1.75 2002/08/07 00:29:36 sam Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -56,7 +56,7 @@ struct es_descriptor_t
* available */
/* Demultiplexer information */
void * p_demux_data;
es_sys_t * p_demux_data;
pgrm_descriptor_t * p_pgrm; /* very convenient in the demultiplexer */
/* PES parser information */
......@@ -112,7 +112,7 @@ struct pgrm_descriptor_t
int i_synchro_state;
/* Demultiplexer data */
void * p_demux_data;
pgrm_sys_t * p_demux_data;
int i_es_number; /* size of the following array */
es_descriptor_t ** pp_es; /* array of pointers to ES */
......@@ -213,7 +213,7 @@ struct stream_descriptor_t
* status change request */
/* Demultiplexer data */
void * p_demux_data;
stream_sys_t * p_demux_data;
/* Programs descriptions */
int i_pgrm_number; /* size of the following array */
......@@ -275,7 +275,7 @@ struct input_thread_t
int (* pf_set_program )( input_thread_t *, pgrm_descriptor_t * );
int (* pf_set_area )( input_thread_t *, input_area_t * );
void (* pf_seek ) ( input_thread_t *, off_t );
void * p_access_data;
access_sys_t * p_access_data;
size_t i_mtu;
/* Demux module */
......@@ -284,7 +284,7 @@ struct input_thread_t
int (* pf_rewind ) ( input_thread_t * );
/* NULL if we don't support going *
* backwards (it's gonna be fun) */
void * p_demux_data; /* data of the demux */
demux_sys_t * p_demux_data; /* data of the demux */
/* Buffer manager */
input_buffers_t *p_method_data; /* data of the packet manager */
......
......@@ -3,7 +3,7 @@
* but exported to plug-ins
*****************************************************************************
* Copyright (C) 1999-2002 VideoLAN
* $Id: input_ext-plugins.h,v 1.33 2002/07/31 20:56:50 sam Exp $
* $Id: input_ext-plugins.h,v 1.34 2002/08/07 00:29:36 sam Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -142,130 +142,6 @@ static inline void input_NullPacket( input_thread_t * p_input,
}
}
/*
* Optional MPEG demultiplexing
*/
/*****************************************************************************
* Constants
*****************************************************************************/
#define TS_PACKET_SIZE 188 /* Size of a TS packet */
#define TS_SYNC_CODE 0x47 /* First byte of a TS packet */
#define PSI_SECTION_SIZE 4096 /* Maximum size of a PSI section */
#define PAT_UNINITIALIZED (1 << 6)
#define PMT_UNINITIALIZED (1 << 6)
#define PSI_IS_PAT 0x00
#define PSI_IS_PMT 0x01
#define UNKNOWN_PSI 0xff
/****************************************************************************
* psi_callback_t
****************************************************************************
* Used by TS demux to handle a PSI, either with the builtin decoder, either
* with a library such as libdvbpsi
****************************************************************************/
typedef void( * psi_callback_t )(
input_thread_t * p_input,
data_packet_t * p_data,
es_descriptor_t * p_es,
vlc_bool_t b_unit_start );
/*****************************************************************************
* psi_section_t
*****************************************************************************
* Describes a PSI section. Beware, it doesn't contain pointers to the TS
* packets that contain it as for a PES, but the data themselves
*****************************************************************************/
typedef struct psi_section_t
{
byte_t buffer[PSI_SECTION_SIZE];
u8 i_section_number;
u8 i_last_section_number;
u8 i_version_number;
u16 i_section_length;
u16 i_read_in_section;
/* the PSI is complete */
vlc_bool_t b_is_complete;
/* packet missed up ? */
vlc_bool_t b_trash;
/*about sections */
vlc_bool_t b_section_complete;
/* where are we currently ? */
byte_t * p_current;
} psi_section_t;
/*****************************************************************************
* es_ts_data_t: extension of es_descriptor_t
*****************************************************************************/
typedef struct es_ts_data_t
{
vlc_bool_t b_psi; /* Does the stream have to be handled by
* the PSI decoder ? */
int i_psi_type; /* There are different types of PSI */
psi_section_t * p_psi_section; /* PSI packets */
/* Markers */
int i_continuity_counter;
} es_ts_data_t;
/*****************************************************************************
* pgrm_ts_data_t: extension of pgrm_descriptor_t
*****************************************************************************/
typedef struct pgrm_ts_data_t
{
u16 i_pcr_pid; /* PCR ES, for TS streams */
int i_pmt_version;
/* libdvbpsi pmt decoder handle */
void * p_pmt_handle;
} pgrm_ts_data_t;
/*****************************************************************************
* stream_ts_data_t: extension of stream_descriptor_t
*****************************************************************************/
typedef struct stream_ts_data_t
{
int i_pat_version; /* Current version of the PAT */
/* libdvbpsi pmt decoder handle */
void * p_pat_handle;
} stream_ts_data_t;
/*****************************************************************************
* stream_ps_data_t: extension of stream_descriptor_t
*****************************************************************************/
typedef struct stream_ps_data_t
{
vlc_bool_t b_has_PSM; /* very rare, in fact */
u8 i_PSM_version;
} stream_ps_data_t;
/* PSM version is 5 bits, so -1 is not a valid value */
#define EMPTY_PSM_VERSION -1
/*****************************************************************************
* Prototypes
*****************************************************************************/
VLC_EXPORT( void, input_ParsePES, ( input_thread_t *, es_descriptor_t * ) );
VLC_EXPORT( void, input_GatherPES, ( input_thread_t *, data_packet_t *, es_descriptor_t *, vlc_bool_t, vlc_bool_t ) );
VLC_EXPORT( ssize_t, input_ReadPS, ( input_thread_t *, data_packet_t ** ) );
VLC_EXPORT( es_descriptor_t *, input_ParsePS, ( input_thread_t *, data_packet_t * ) );
VLC_EXPORT( ssize_t, input_ReadTS, ( input_thread_t *, data_packet_t ** ) );
VLC_EXPORT( void, input_DemuxPS, ( input_thread_t *, data_packet_t * ) );
VLC_EXPORT( void, input_DemuxTS, ( input_thread_t *, data_packet_t *, void(*) ( input_thread_t *, data_packet_t *, es_descriptor_t *, vlc_bool_t ) ) );
/*
* Optional standard file descriptor operations (input_ext-plugins.h)
*/
......
......@@ -3,7 +3,7 @@
* Collection of useful common types and macros definitions
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: vlc_common.h,v 1.13 2002/07/31 20:56:50 sam Exp $
* $Id: vlc_common.h,v 1.14 2002/08/07 00:29:36 sam Exp $
*
* Authors: Samuel Hocevar <sam@via.ecp.fr>
* Vincent Seguin <seguin@via.ecp.fr>
......@@ -147,7 +147,6 @@ VLC_DECLARE_STRUCT(module_bank_t)
VLC_DECLARE_STRUCT(module_t)
VLC_DECLARE_STRUCT(module_config_t)
VLC_DECLARE_STRUCT(module_symbols_t)
VLC_DECLARE_STRUCT(module_functions_t)
/* Interface */
VLC_DECLARE_STRUCT(intf_thread_t)
......@@ -159,10 +158,19 @@ VLC_DECLARE_STRUCT(intf_channel_t)
/* Input */
VLC_DECLARE_STRUCT(input_thread_t)
VLC_DECLARE_STRUCT(input_channel_t)
VLC_DECLARE_STRUCT(input_cfg_t)
VLC_DECLARE_STRUCT(input_area_t)
VLC_DECLARE_STRUCT(input_buffers_t)
VLC_DECLARE_STRUCT(input_socket_t)
VLC_DECLARE_STRUCT(input_info_t)
VLC_DECLARE_STRUCT(input_info_category_t)
VLC_DECLARE_STRUCT(access_sys_t)
VLC_DECLARE_STRUCT(demux_sys_t)
VLC_DECLARE_STRUCT(es_descriptor_t)
VLC_DECLARE_STRUCT(es_sys_t)
VLC_DECLARE_STRUCT(pgrm_descriptor_t)
VLC_DECLARE_STRUCT(pgrm_sys_t)
VLC_DECLARE_STRUCT(stream_descriptor_t)
VLC_DECLARE_STRUCT(stream_sys_t)
/* Audio */
VLC_DECLARE_STRUCT(aout_thread_t)
......@@ -184,24 +192,14 @@ VLC_DECLARE_STRUCT(subpicture_sys_t)
VLC_DECLARE_STRUCT(decoder_fifo_t)
/* Misc */
VLC_DECLARE_STRUCT(macroblock_t)
VLC_DECLARE_STRUCT(data_packet_t)
VLC_DECLARE_STRUCT(data_buffer_t)
VLC_DECLARE_STRUCT(downmix_t)
VLC_DECLARE_STRUCT(imdct_t)
VLC_DECLARE_STRUCT(complex_t)
VLC_DECLARE_STRUCT(dm_par_t)
VLC_DECLARE_STRUCT(es_descriptor_t)
VLC_DECLARE_STRUCT(pgrm_descriptor_t)
VLC_DECLARE_STRUCT(stream_descriptor_t)
VLC_DECLARE_STRUCT(stream_position_t)
VLC_DECLARE_STRUCT(stream_ctrl_t)
VLC_DECLARE_STRUCT(pes_packet_t)
VLC_DECLARE_STRUCT(bit_stream_t)
VLC_DECLARE_STRUCT(network_socket_t)
VLC_DECLARE_STRUCT(iso639_lang_t)
VLC_DECLARE_STRUCT(input_info_t)
VLC_DECLARE_STRUCT(input_info_category_t)
/*****************************************************************************
* Plug-in stuff
......
......@@ -16,7 +16,6 @@ struct module_symbols_t
data_packet_t * (* input_ShareBuffer_inner) ( input_buffers_t *, data_buffer_t * ) ;
es_descriptor_t * (* input_AddES_inner) ( input_thread_t *, pgrm_descriptor_t *, u16, size_t ) ;
es_descriptor_t * (* input_FindES_inner) ( input_thread_t *, u16 ) ;
es_descriptor_t * (* input_ParsePS_inner) ( input_thread_t *, data_packet_t * ) ;
float (* __config_GetFloat_inner) (vlc_object_t *, const char *) ;
input_area_t * (* input_AddArea_inner) ( input_thread_t * ) ;
input_info_category_t * (* input_InfoCategory_inner) ( input_thread_t *, char * ) ;
......@@ -61,8 +60,6 @@ struct module_symbols_t
ssize_t (* input_FDRead_inner) ( input_thread_t *, byte_t *, size_t ) ;
ssize_t (* input_FillBuffer_inner) ( input_thread_t * ) ;
ssize_t (* input_Peek_inner) ( input_thread_t *, byte_t **, size_t ) ;
ssize_t (* input_ReadPS_inner) ( input_thread_t *, data_packet_t ** ) ;
ssize_t (* input_ReadTS_inner) ( input_thread_t *, data_packet_t ** ) ;
ssize_t (* input_SplitBuffer_inner) ( input_thread_t *, data_packet_t **, size_t ) ;
subpicture_t * (* vout_CreateSubPicture_inner) ( vout_thread_t *, int, int ) ;
u32 (* UnalignedGetBits_inner) ( bit_stream_t *, unsigned int ) ;
......@@ -112,13 +109,9 @@ struct module_symbols_t
void (* input_DelProgram_inner) ( input_thread_t *, pgrm_descriptor_t * ) ;
void (* input_DeletePES_inner) ( input_buffers_t *, pes_packet_t * ) ;
void (* input_DeletePacket_inner) ( input_buffers_t *, data_packet_t * ) ;
void (* input_DemuxPS_inner) ( input_thread_t *, data_packet_t * ) ;
void (* input_DemuxTS_inner) ( input_thread_t *, data_packet_t *, void(*) ( input_thread_t *, data_packet_t *, es_descriptor_t *, vlc_bool_t ) ) ;
void (* input_DumpStream_inner) ( input_thread_t * ) ;
void (* input_EndStream_inner) ( input_thread_t * ) ;
void (* input_FDSeek_inner) ( input_thread_t *, off_t ) ;
void (* input_GatherPES_inner) ( input_thread_t *, data_packet_t *, es_descriptor_t *, vlc_bool_t, vlc_bool_t ) ;
void (* input_ParsePES_inner) ( input_thread_t *, es_descriptor_t * ) ;
void (* input_ReleaseBuffer_inner) ( input_buffers_t *, data_buffer_t * ) ;
void (* intf_Destroy_inner) ( intf_thread_t * ) ;
void (* intf_StopThread_inner) ( intf_thread_t * ) ;
......@@ -225,8 +218,6 @@ struct module_symbols_t
# define input_DelProgram p_symbols->input_DelProgram_inner
# define input_DeletePES p_symbols->input_DeletePES_inner
# define input_DeletePacket p_symbols->input_DeletePacket_inner
# define input_DemuxPS p_symbols->input_DemuxPS_inner
# define input_DemuxTS p_symbols->input_DemuxTS_inner
# define input_DumpStream p_symbols->input_DumpStream_inner
# define input_EndStream p_symbols->input_EndStream_inner
# define input_FDNetworkRead p_symbols->input_FDNetworkRead_inner
......@@ -235,18 +226,13 @@ struct module_symbols_t
# define input_FillBuffer p_symbols->input_FillBuffer_inner
# define input_FindES p_symbols->input_FindES_inner
# define input_FindProgram p_symbols->input_FindProgram_inner
# define input_GatherPES p_symbols->input_GatherPES_inner
# define input_InfoCategory p_symbols->input_InfoCategory_inner
# define input_InitStream p_symbols->input_InitStream_inner
# define input_NewBuffer p_symbols->input_NewBuffer_inner
# define input_NewPES p_symbols->input_NewPES_inner
# define input_NewPacket p_symbols->input_NewPacket_inner
# define input_OffsetToTime p_symbols->input_OffsetToTime_inner
# define input_ParsePES p_symbols->input_ParsePES_inner
# define input_ParsePS p_symbols->input_ParsePS_inner
# define input_Peek p_symbols->input_Peek_inner
# define input_ReadPS p_symbols->input_ReadPS_inner
# define input_ReadTS p_symbols->input_ReadTS_inner
# define input_ReleaseBuffer p_symbols->input_ReleaseBuffer_inner
# define input_SelectES p_symbols->input_SelectES_inner
# define input_SetProgram p_symbols->input_SetProgram_inner
......
......@@ -8,7 +8,7 @@
* -udf.* to find files
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: access.c,v 1.1 2002/08/04 17:23:41 sam Exp $
* $Id: access.c,v 1.2 2002/08/07 00:29:36 sam Exp $
*
* Author: Stphane Borel <stef@via.ecp.fr>
*
......@@ -37,6 +37,8 @@
#include <vlc/vlc.h>
#include <vlc/input.h>
#include "../../demux/mpeg/system.h"
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
......
/* demux.c: DVD demux functions.
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: demux.c,v 1.1 2002/08/04 17:23:41 sam Exp $
* $Id: demux.c,v 1.2 2002/08/07 00:29:36 sam Exp $
*
* Author: Stphane Borel <stef@via.ecp.fr>
*
......@@ -30,6 +30,8 @@
#include <vlc/vlc.h>
#include <vlc/input.h>
#include "../../demux/mpeg/system.h"
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
......@@ -47,6 +49,15 @@
/* how many packets DVDDemux will read in each loop */
#define DVD_READ_ONCE 64
/*****************************************************************************
* Private structure
*****************************************************************************/
struct demux_sys_t
{
module_t * p_module;
mpeg_demux_t mpeg;
};
/*****************************************************************************
* Local prototypes
*****************************************************************************/
......@@ -54,22 +65,33 @@ static int DVDDemux ( input_thread_t * );
void DVDLaunchDecoders( input_thread_t * );
/*
* Data demux functions
*/
/*****************************************************************************
* DVDInit: initializes DVD structures
* DVDInit: initialize DVD structures
*****************************************************************************/
int E_(DVDInit) ( vlc_object_t *p_this )
{
input_thread_t *p_input = (input_thread_t *)p_this;
demux_sys_t * p_demux;
if( p_input->stream.i_method != INPUT_METHOD_DVD )
{
return -1;
}
p_demux = p_input->p_demux_data = malloc( sizeof(demux_sys_t ) );
if( p_demux == NULL )
{
return -1;
}
p_input->p_private = (void*)&p_demux->mpeg;
p_demux->p_module = module_Need( p_input, "mpeg-system", NULL );
if( p_demux->p_module == NULL )
{
free( p_input->p_demux_data );
return -1;
}
p_input->pf_demux = DVDDemux;
p_input->pf_rewind = NULL;
......@@ -82,6 +104,17 @@ int E_(DVDInit) ( vlc_object_t *p_this )
return 0;
}
/*****************************************************************************
* DVDEnd: free DVD structures
*****************************************************************************/
void E_(DVDEnd) ( vlc_object_t *p_this )
{
input_thread_t *p_input = (input_thread_t *)p_this;
module_Unneed( p_input, p_input->p_demux_data->p_module );
free( p_input->p_demux_data );
}
/*****************************************************************************
* DVDDemux
*****************************************************************************/
......@@ -94,7 +127,7 @@ static int DVDDemux( input_thread_t * p_input )
/* Read headers to compute payload length */
for( i = 0 ; i < DVD_READ_ONCE ; i++ )
{
i_result = input_ReadPS( p_input, &p_data );
i_result = p_input->p_demux_data->mpeg.pf_read_ps( p_input, &p_data );
if( i_result < 0 )
{
......@@ -105,7 +138,7 @@ static int DVDDemux( input_thread_t * p_input )
return i;
}
input_DemuxPS( p_input, p_data );
p_input->p_demux_data->mpeg.pf_demux_ps( p_input, p_data );
}
return i;
......
......@@ -2,7 +2,7 @@
* dvd.c : DVD input module for vlc
*****************************************************************************
* Copyright (C) 2000-2001 VideoLAN
* $Id: dvd.c,v 1.1 2002/08/04 17:23:41 sam Exp $
* $Id: dvd.c,v 1.2 2002/08/07 00:29:36 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -51,6 +51,7 @@ int E_(DVDOpen) ( vlc_object_t * );
void E_(DVDClose) ( vlc_object_t * );
int E_(DVDInit) ( vlc_object_t * );
void E_(DVDEnd) ( vlc_object_t * );
#ifdef GOD_DAMN_DMCA
static void *p_libdvdcss;
......@@ -97,7 +98,7 @@ vlc_module_begin();
set_callbacks( E_(DVDOpen), E_(DVDClose) );
add_submodule();
set_capability( "demux", 0 );
set_callbacks( E_(DVDInit), NULL );
set_callbacks( E_(DVDInit), E_(DVDEnd) );
#ifdef GOD_DAMN_DMCA
ProbeLibDVDCSS();
#endif
......
......@@ -2,7 +2,7 @@
* access.c: access capabilities for dvdplay plugin.
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: access.c,v 1.1 2002/08/04 17:23:42 sam Exp $
* $Id: access.c,v 1.2 2002/08/07 00:29:36 sam Exp $
*
* Author: Stphane Borel <stef@via.ecp.fr>
*
......@@ -30,6 +30,8 @@
#include <vlc/vlc.h>
#include <vlc/input.h>
#include "../../demux/mpeg/system.h"
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
......
......@@ -2,7 +2,7 @@
* demux.c: demux functions for dvdplay.
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: demux.c,v 1.1 2002/08/04 17:23:42 sam Exp $
* $Id: demux.c,v 1.2 2002/08/07 00:29:36 sam Exp $
*
* Author: Stphane Borel <stef@via.ecp.fr>
*
......@@ -31,6 +31,8 @@
#include <vlc/vlc.h>
#include <vlc/input.h>
#include "../../demux/mpeg/system.h"
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
......@@ -58,13 +60,25 @@
*****************************************************************************/
static int Demux ( input_thread_t * );
/*****************************************************************************
* Private structure
*****************************************************************************/
struct demux_sys_t
{
dvd_data_t * p_dvd;
module_t * p_module;
mpeg_demux_t mpeg;
};
/*****************************************************************************
* InitDVD: initializes dvdplay structures
*****************************************************************************/
int E_(InitDVD) ( vlc_object_t *p_this )
{
input_thread_t *p_input = (input_thread_t *)p_this;
dvd_data_t * p_dvd;
dvd_data_t * p_dvd = (dvd_data_t *)p_input->p_access_data;
demux_sys_t * p_demux;
char * psz_intf = NULL;
if( p_input->stream.i_method != INPUT_METHOD_DVD )
......@@ -72,8 +86,21 @@ int E_(InitDVD) ( vlc_object_t *p_this )
return -1;
}
p_input->p_demux_data = (void*)p_input->p_access_data;
p_dvd = (dvd_data_t *)p_input->p_demux_data;
p_demux = p_input->p_demux_data = malloc( sizeof(demux_sys_t ) );
if( p_demux == NULL )
{
return -1;
}
p_input->p_private = (void*)&p_demux->mpeg;
p_demux->p_module = module_Need( p_input, "mpeg-system", NULL );
if( p_demux->p_module == NULL )
{
free( p_input->p_demux_data );
return -1;
}
p_input