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->p_demux_data->p_dvd = p_dvd;
p_input->pf_demux = Demux;
p_input->pf_rewind = NULL;
......@@ -98,7 +125,7 @@ int E_(InitDVD) ( vlc_object_t *p_this )
void E_(EndDVD) ( 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 = p_input->p_demux_data->p_dvd;
intf_thread_t * p_intf = NULL;
p_intf = vlc_object_find( p_input, VLC_OBJECT_INTF, FIND_CHILD );
......@@ -110,8 +137,10 @@ void E_(EndDVD) ( vlc_object_t *p_this )
intf_Destroy( p_intf );
}
p_dvd = (dvd_data_t *)p_input->p_demux_data;
p_dvd->p_intf = NULL;
module_Unneed( p_input, p_input->p_demux_data->p_module );
free( p_input->p_demux_data );
}
/*****************************************************************************
......@@ -125,19 +154,21 @@ static int Demux( input_thread_t * p_input )
ptrdiff_t i_remains;
int i_data_nb = 0;
p_dvd = (dvd_data_t *)p_input->p_demux_data;
p_dvd = p_input->p_demux_data->p_dvd;
/* Read headers to compute payload length */
do
{
if( ( i_result = input_ReadPS( p_input, &p_data ) ) <= 0)
i_result = p_input->p_demux_data->mpeg.pf_read_ps( p_input, &p_data );
if( i_result <= 0 )
{
return i_result;
}
i_remains = p_input->p_last_data - p_input->p_current_data;
input_DemuxPS( p_input, p_data );
p_input->p_demux_data->mpeg.pf_demux_ps( p_input, p_data );
++i_data_nb;
......
......@@ -2,7 +2,7 @@
* es.c: functions to handle elementary streams.
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: es.c,v 1.1 2002/08/04 17:23:42 sam Exp $
* $Id: es.c,v 1.2 2002/08/07 00:29:36 sam Exp $
*
* Author: Stphane Borel <stef@via.ecp.fr>
*
......@@ -204,7 +204,7 @@ void dvdplay_Subp( input_thread_t * p_input )
if( pi_palette )
{
ADDES( i_id, VLC_FOURCC('s','p','u',' '), SPU_ES,
p_attr->lang_code, 16*sizeof(u32) );
p_attr->lang_code, sizeof(int) + 16*sizeof(u32) );
*(int*)p_es->p_demux_data = 0xBeeF;
memcpy( (void*)p_es->p_demux_data + sizeof(int),
pi_palette, 16*sizeof(u32) );
......
......@@ -2,7 +2,7 @@
* dvdread.c : DvdRead input module for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: dvdread.c,v 1.1 2002/08/04 17:23:42 sam Exp $
* $Id: dvdread.c,v 1.2 2002/08/07 00:29:36 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -36,6 +36,7 @@ int E_(OpenDVD) ( vlc_object_t * );
void E_(CloseDVD) ( vlc_object_t * );
int E_(InitDVD) ( vlc_object_t * );
void E_(EndDVD) ( vlc_object_t * );
/*****************************************************************************
* Module descriptor
......@@ -48,6 +49,6 @@ vlc_module_begin();
set_callbacks( E_(OpenDVD), E_(CloseDVD) );
add_submodule();
set_capability( "demux", 0 );
set_callbacks( E_(InitDVD), NULL );
set_callbacks( E_(InitDVD), E_(EndDVD) );
vlc_module_end();
......@@ -6,7 +6,7 @@
* It depends on: libdvdread for ifo files and block reading.
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: input.c,v 1.1 2002/08/04 17:23:42 sam Exp $
* $Id: input.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
......@@ -75,6 +77,15 @@
/* how many blocks DVDRead will read in each loop */
#define DVD_BLOCK_READ_ONCE 64
/*****************************************************************************
* Private structure
*****************************************************************************/
struct demux_sys_t
{
module_t * p_module;
mpeg_demux_t mpeg;
};
/*****************************************************************************
* Local prototypes
*****************************************************************************/
......@@ -97,17 +108,32 @@ static void DvdReadFindCell ( thread_dvd_data_t * p_dvd );
*/
/*****************************************************************************
* InitDVD: initializes DVD structures
* InitDVD: initialize DVD structures
*****************************************************************************/
int E_(InitDVD) ( 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 = DvdReadDemux;
p_input->pf_rewind = NULL;
......@@ -120,6 +146,17 @@ int E_(InitDVD) ( vlc_object_t *p_this )
return 0;
}
/*****************************************************************************
* EndDVD: end DVD structures
*****************************************************************************/
void E_(EndDVD) ( 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 );
}
/*****************************************************************************
* DvdReadDemux
*****************************************************************************/
......@@ -180,7 +217,7 @@ static int DvdReadDemux( input_thread_t * p_input )
p_input->p_current_data += i_stuffing;
}
input_DemuxPS( p_input, p_data );
p_input->p_demux_data->mpeg.pf_demux_ps( p_input, p_data );
}
......
......@@ -2,7 +2,7 @@
* http.c: HTTP access plug-in
*****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN
* $Id: http.c,v 1.1 2002/08/04 17:23:41 sam Exp $
* $Id: http.c,v 1.2 2002/08/07 00:29:36 sam Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -91,7 +91,7 @@ typedef struct _input_socket_s
*****************************************************************************/
static int HTTPConnect( input_thread_t * p_input, off_t i_tell )
{
_input_socket_t * p_access_data = p_input->p_access_data;
_input_socket_t * p_access_data;
module_t * p_network;
char psz_buffer[256];
byte_t * psz_parser;
......@@ -99,6 +99,7 @@ static int HTTPConnect( input_thread_t * p_input, off_t i_tell )
char * psz_return_alpha;
/* Find an appropriate network module */
p_access_data = (_input_socket_t *)p_input->p_access_data;
p_input->p_private = (void*) &p_access_data->socket_desc;
p_network = module_Need( p_input, "network", p_access_data->psz_network );
if( p_network == NULL )
......@@ -260,7 +261,8 @@ static int Open( vlc_object_t *p_this )
char * psz_proxy;
int i_server_port = 0;
p_access_data = p_input->p_access_data = malloc( sizeof(_input_socket_t) );
p_access_data = malloc( sizeof(_input_socket_t) );
p_input->p_access_data = (access_sys_t *)p_access_data;
if( p_access_data == NULL )
{
msg_Err( p_input, "out of memory" );
......@@ -492,7 +494,7 @@ static int SetProgram( input_thread_t * p_input,
*****************************************************************************/
static void Seek( input_thread_t * p_input, off_t i_pos )
{
_input_socket_t * p_access_data = p_input->p_access_data;
_input_socket_t *p_access_data = (_input_socket_t*)p_input->p_access_data;
close( p_access_data->_socket.i_handle );
msg_Dbg( p_input, "seeking to position %lld", i_pos );
HTTPConnect( p_input, i_pos );
......
......@@ -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 @@
* udp.c: raw UDP access plug-in
*****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN
* $Id: udp.c,v 1.1 2002/08/04 17:23:41 sam Exp $
* $Id: udp.c,v 1.2 2002/08/07 00:29:36 sam Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -237,7 +237,9 @@ static int Open( vlc_object_t *p_this )
}
module_Unneed( p_input, p_network );
p_access_data = p_input->p_access_data = malloc( sizeof(input_socket_t) );
p_access_data = malloc( sizeof(input_socket_t) );
p_input->p_access_data = (access_sys_t *)p_access_data;
if( p_access_data == NULL )
{
msg_Err( p_input, "out of memory" );
......
......@@ -2,7 +2,7 @@
* vcd.c : VCD input module for vlc
*****************************************************************************
* Copyright (C) 2000 VideoLAN
* $Id: vcd.c,v 1.1 2002/08/04 17:23:42 sam Exp $
* $Id: vcd.c,v 1.2 2002/08/07 00:29:36 sam Exp $
*
* Author: Johan Bilien <jobi@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 @@
* downmix.h : A52 downmix types
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: downmix.h,v 1.1 2002/08/04 17:23:42 sam Exp $
* $Id: downmix.h,v 1.2 2002/08/07 00:29:36 sam Exp $
*
* Authors: Michel Kaempf <maxx@via.ecp.fr>
* Renaud Dartus <reno@videolan.org>
......@@ -22,6 +22,9 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
VLC_DECLARE_STRUCT(dm_par_t)
VLC_DECLARE_STRUCT(downmix_t)
struct dm_par_t
{
float unit;
......
......@@ -2,7 +2,7 @@
* imdct.h : A52 IMDCT types
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: imdct.h,v 1.1 2002/08/04 17:23:42 sam Exp $
* $Id: imdct.h,v 1.2 2002/08/07 00:29:36 sam Exp $
*
* Authors: Michel Kaempf <maxx@via.ecp.fr>
* Renaud Dartus <reno@videolan.org>
......@@ -22,6 +22,9 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
VLC_DECLARE_STRUCT(complex_t)
VLC_DECLARE_STRUCT(imdct_t)
struct complex_t
{
float real;
......
/*****************************************************************************
* video_decoder.h : video decoder thread
* decoder.h : video decoder thread
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: decoder.h,v 1.1 2002/08/04 17:23:42 sam Exp $
* $Id: decoder.h,v 1.2 2002/08/07 00:29:36 sam Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -21,10 +21,14 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
VLC_DECLARE_STRUCT(vpar_thread_t)
VLC_DECLARE_STRUCT(vdec_thread_t)
VLC_DECLARE_STRUCT(vdec_pool_t)
/*****************************************************************************
* vdec_thread_t: video decoder thread descriptor
*****************************************************************************/
typedef struct vdec_thread_s
struct vdec_thread_t
{
VLC_COMMON_MEMBERS
......@@ -32,9 +36,8 @@ typedef struct vdec_thread_s
void * p_idct_data;
/* Input properties */
struct vdec_pool_s * p_pool;
} vdec_thread_t;
vdec_pool_t * p_pool;
};
/*****************************************************************************
* Prototypes
......@@ -45,6 +48,6 @@ void vdec_DecodeMacroblockBW ( vdec_thread_t *, macroblock_t * );
void vdec_DecodeMacroblock420( vdec_thread_t *, macroblock_t * );
void vdec_DecodeMacroblock422( vdec_thread_t *, macroblock_t * );
void vdec_DecodeMacroblock444( vdec_thread_t *, macroblock_t * );
vdec_thread_t * vdec_CreateThread ( struct vdec_pool_s * );
vdec_thread_t * vdec_CreateThread ( vdec_pool_t * );
void vdec_DestroyThread ( vdec_thread_t * );
/*****************************************************************************
* video_parser.h : video parser thread
* parser.h : video parser thread
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: parser.h,v 1.1 2002/08/04 17:23:42 sam Exp $
* $Id: parser.h,v 1.2 2002/08/07 00:29:36 sam Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Jean-Marc Dressler <polux@via.ecp.fr>
......@@ -60,11 +60,11 @@ extern u8 pi_scan[2][64];
/*****************************************************************************
* Prototypes
*****************************************************************************/
void vpar_InitScanTable( struct vpar_thread_s * p_vpar );
void vpar_InitScanTable( vpar_thread_t * p_vpar );
typedef void (*f_picture_data_t)( struct vpar_thread_s * p_vpar );
typedef void (*f_picture_data_t)( vpar_thread_t * p_vpar );
#define PROTO_PICD( FUNCNAME ) \
void FUNCNAME( struct vpar_thread_s * p_vpar );
void FUNCNAME( vpar_thread_t * p_vpar );
PROTO_PICD( vpar_PictureDataGENERIC )
#if (VPAR_OPTIM_LEVEL > 0)
......@@ -232,8 +232,8 @@ typedef struct picture_parsing_s
/*****************************************************************************
* Prototypes
*****************************************************************************/
int vpar_NextSequenceHeader( struct vpar_thread_s * p_vpar );
int vpar_ParseHeader( struct vpar_thread_s * p_vpar );
int vpar_NextSequenceHeader( vpar_thread_t * p_vpar );
int vpar_ParseHeader( vpar_thread_t * p_vpar );
/*
......@@ -286,20 +286,13 @@ typedef struct video_synchro_s
/*****************************************************************************
* Prototypes
*****************************************************************************/
void vpar_SynchroInit ( struct vpar_thread_s * p_vpar );
vlc_bool_t vpar_SynchroChoose ( struct vpar_thread_s * p_vpar,
int i_coding_type, int i_structure );
void vpar_SynchroTrash ( struct vpar_thread_s * p_vpar,
int i_coding_type, int i_structure );
void vpar_SynchroDecode ( struct vpar_thread_s * p_vpar,
int i_coding_type, int i_structure );
void vpar_SynchroEnd ( struct vpar_thread_s * p_vpar,
int i_coding_type, int i_structure,
int i_garbage );
mtime_t vpar_SynchroDate ( struct vpar_thread_s * p_vpar );
void vpar_SynchroNewPicture( struct vpar_thread_s * p_vpar, int i_coding_type,
int i_repeat_field );
void vpar_SynchroInit ( vpar_thread_t * p_vpar );
vlc_bool_t vpar_SynchroChoose ( vpar_thread_t * p_vpar, int, int );
void vpar_SynchroTrash ( vpar_thread_t * p_vpar, int, int );
void vpar_SynchroDecode ( vpar_thread_t * p_vpar, int, int );
void vpar_SynchroEnd ( vpar_thread_t * p_vpar, int, int, int );
mtime_t vpar_SynchroDate ( vpar_thread_t * p_vpar );
void vpar_SynchroNewPicture ( vpar_thread_t * p_vpar, int, int );
/*
* Video parser structures
......@@ -308,7 +301,7 @@ void vpar_SynchroNewPicture( struct vpar_thread_s * p_vpar, int i_coding_type,
/*****************************************************************************
* vpar_thread_t: video parser thread descriptor
*****************************************************************************/
typedef struct vpar_thread_s
struct vpar_thread_t
{
bit_stream_t bit_stream;
......@@ -360,7 +353,7 @@ typedef struct vpar_thread_s
* pictures decoded */
count_t pc_malformed_pictures[4]; /* number of pictures trashed
* during parsing */
} vpar_thread_t;
};
/*****************************************************************************
* NextStartCode : Find the next start code
......@@ -382,7 +375,7 @@ static inline void NextStartCode( bit_stream_t * p_bit_stream )
*****************************************************************************
* Quantizer scale factor (ISO/IEC 13818-2 7.4.2.2)
*****************************************************************************/
static inline void LoadQuantizerScale( struct vpar_thread_s * p_vpar )
static inline void LoadQuantizerScale( vpar_thread_t * p_vpar )
{
/* Quantization coefficient table */
static u8 pi_non_linear_quantizer_scale[32] =
......
/*****************************************************************************
* vdec_ext-plugins.h : structures from the video decoder exported to plug-ins
* plugins.h : structures from the video decoder exported to plug-ins
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: plugins.h,v 1.1 2002/08/04 18:39:41 sam Exp $
* $Id: plugins.h,v 1.2 2002/08/07 00:29:36 sam Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -47,7 +47,7 @@ typedef struct motion_inner_t
vlc_bool_t b_second_half;
} motion_inner_t;
struct macroblock_t
typedef struct macroblock_t
{
int i_mb_modes;
......@@ -64,7 +64,8 @@ struct macroblock_t
motion_inner_t p_motions[8];
int i_nb_motions;
yuv_data_t * pp_dest[3];
};
} macroblock_t;
/* Macroblock Modes */
#define MB_INTRA 1
......
......@@ -2,7 +2,7 @@
* vpar_pool.h : video parser/video decoders communication
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: pool.h,v 1.1 2002/08/04 17:23:42 sam Exp $
* $Id: pool.h,v 1.2 2002/08/07 00:29:36 sam Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -27,9 +27,7 @@
* This structure is used for the communication between the parser and the
* decoders.
*****************************************************************************/
typedef struct vdec_pool_s vdec_pool_t;
struct vdec_pool_s
struct vdec_pool_t
{
/* Locks */
vlc_mutex_t lock; /* Structure data lock */
......@@ -68,8 +66,7 @@ struct vdec_pool_s
void (* pf_decode_mb) ( vdec_pool_t *, macroblock_t * );
/* Pointer to the decoding function - used for B&W switching */
void (* pf_vdec_decode) ( struct vdec_thread_s *,
macroblock_t * );
void (* pf_vdec_decode) ( vdec_thread_t *, macroblock_t * );
vlc_bool_t b_bw; /* Current value for B&W */
/* Access to the plug-ins needed by the video decoder thread */
......@@ -77,15 +74,15 @@ struct vdec_pool_s
void ( * ppppf_motion[2][2][4] ) ( yuv_data_t *, yuv_data_t *,
int, int );
struct vpar_thread_s * p_vpar;
vpar_thread_t * p_vpar;
};
/*****************************************************************************
* Prototypes
*****************************************************************************/
void vpar_InitPool ( struct vpar_thread_s * );
void vpar_SpawnPool ( struct vpar_thread_s * );
void vpar_EndPool ( struct vpar_thread_s * );
void vpar_InitPool ( vpar_thread_t * );
void vpar_SpawnPool ( vpar_thread_t * );
void vpar_EndPool ( vpar_thread_t * );
/*****************************************************************************
* vpar_GetMacroblock: In a vdec thread, get the next available macroblock
......
This diff is collapsed.
......@@ -2,7 +2,7 @@
* avi.h : AVI file Stream input module for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: avi.h,v 1.1 2002/08/04 17:23:42 sam Exp $
* $Id: avi.h,v 1.2 2002/08/07 00:29:36 sam Exp $
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
......@@ -237,7 +237,7 @@ typedef struct AVIStreamInfo_s
int i_pes_totalsize;
} AVIStreamInfo_t;
typedef struct demux_data_avi_file_s
struct demux_sys_t
{
mtime_t i_pcr;
int i_rate;
......@@ -258,6 +258,5 @@ typedef struct demux_data_avi_file_s
/* current audio and video es */
AVIStreamInfo_t *p_info_video;
AVIStreamInfo_t *p_info_audio;
} demux_data_avi_file_t;
};
......@@ -2,7 +2,7 @@
* mp4.c : MP4 file input module for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: mp4.c,v 1.1 2002/08/04 17:23:42 sam Exp $
* $Id: mp4.c,v 1.2 2002/08/07 00:29:36 sam Exp $
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
......@@ -86,7 +86,7 @@ static int MP4Init( vlc_object_t * p_this )
u8 *p_peek;
u32 i_type;
demux_data_mp4_t *p_demux;
demux_sys_t *p_demux;
MP4_Box_t *p_moov;
MP4_Box_t *p_ftyp;
......@@ -138,12 +138,12 @@ static int MP4Init( vlc_object_t * p_this )
/* create our structure that will contains all data */
if( !( p_input->p_demux_data =
p_demux = malloc( sizeof( demux_data_mp4_t ) ) ) )
p_demux = malloc( sizeof( demux_sys_t ) ) ) )
{
msg_Err( p_input, "out of memory" );
return( -1 );
}
memset( p_demux, 0, sizeof( demux_data_mp4_t ) );
memset( p_demux, 0, sizeof( demux_sys_t ) );
p_input->p_demux_data = p_demux;
......@@ -299,7 +299,7 @@ static int MP4Init( vlc_object_t * p_this )
*****************************************************************************/
static int MP4Demux( input_thread_t *p_input )
{
demux_data_mp4_t *p_demux = p_input->p_demux_data;
demux_sys_t *p_demux = p_input->p_demux_data;
int i_track;
/* first wait for the good time to read a packet */
......@@ -376,7 +376,7 @@ static void __MP4End ( vlc_object_t * p_this )
if( p ) { free( p ); }
int i_track;
input_thread_t * p_input = (input_thread_t *)p_this;
demux_data_mp4_t *p_demux = p_input->p_demux_data;
demux_sys_t *p_demux = p_input->p_demux_data;
msg_Dbg( p_input, "Freeing all memory" );
MP4_FreeBox( p_input, &p_demux->box_root );
......@@ -942,7 +942,7 @@ static void MP4_StartDecoder( input_thread_t *p_input,
break;
}
p_demux_track->p_es->p_demux_data = p_init;
p_demux_track->p_es->p_demux_data = (es_sys_t *)p_init;
vlc_mutex_lock( &p_input->stream.stream_lock );
input_SelectES( p_input, p_demux_track->p_es );
vlc_mutex_unlock( &p_input->stream.stream_lock );
......
......@@ -2,7 +2,7 @@
* mp4.h : MP4 file input module for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: mp4.h,v 1.1 2002/08/04 17:23:42 sam Exp $
* $Id: mp4.h,v 1.2 2002/08/07 00:29:36 sam Exp $
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
......@@ -123,7 +123,7 @@ typedef struct track_data_mp4_s
/*****************************************************************************
*
*****************************************************************************/
typedef struct demux_data_mp4_s
struct demux_sys_t
{
MP4_Box_t box_root; /* container for the hole file */
......@@ -137,7 +137,7 @@ typedef struct demux_data_mp4_s
track_data_mp4_t *track; /* array of track */
} demux_data_mp4_t;
};
static inline u64 MP4_GetTrackPos( track_data_mp4_t *p_track )
{
......@@ -198,7 +198,7 @@ static inline mtime_t MP4_GetTrackPTS( track_data_mp4_t *p_track )
(mtime_t)p_track->i_timescale ) );
}
static inline mtime_t MP4_GetMoviePTS(demux_data_mp4_t *p_demux )
static inline mtime_t MP4_GetMoviePTS(demux_sys_t *p_demux )
{
return( (mtime_t)(
(mtime_t)1000000 *
......
mpeg_system_SOURCES = system.c
es_SOURCES = es.c
ps_SOURCES = ps.c
ts_SOURCES = ts.c
......
......@@ -2,7 +2,7 @@
* mpeg_audio.c : mpeg_audio Stream input module for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: audio.c,v 1.1 2002/08/04 17:23:42 sam Exp $
* $Id: audio.c,v 1.2 2002/08/07 00:29:36 sam Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
......@@ -94,7 +94,7 @@ typedef struct mpegaudio_xing_header_s
int i_avgbitrate; /* calculated, XXX: bits/sec not Kb */
} mpegaudio_xing_header_t;
typedef struct demux_data_mpegaudio_s
struct demux_sys_t
{
mtime_t i_pts;
......@@ -103,8 +103,7 @@ typedef struct demux_data_mpegaudio_s
es_descriptor_t *p_es;
mpegaudio_format_t mpeg;
mpegaudio_xing_header_t xingheader;
} demux_data_mpegaudio_t;
};
static int mpegaudio_bitrate[2][3][16] =
......@@ -422,7 +421,7 @@ static void MPEGAudio_ExtractXingHeader( input_thread_t *p_input,
static int Activate( vlc_object_t * p_this )
{
input_thread_t * p_input = (input_thread_t *)p_this;
demux_data_mpegaudio_t * p_mpegaudio;
demux_sys_t * p_mpegaudio;
mpegaudio_format_t mpeg;
es_descriptor_t * p_es;
int i_pos;
......@@ -507,8 +506,7 @@ static int Activate( vlc_object_t * p_this )
vlc_mutex_unlock( &p_input->stream.stream_lock );
/* create p_mpegaudio and init it */
p_input->p_demux_data =
p_mpegaudio = malloc( sizeof( demux_data_mpegaudio_t ));
p_mpegaudio = p_input->p_demux_data = malloc( sizeof(demux_sys_t) );
if( !p_mpegaudio )
{
......@@ -575,8 +573,8 @@ static int Demux( input_thread_t * p_input )
int i_toread;
pes_packet_t *p_pes;
mpegaudio_format_t mpeg;
demux_data_mpegaudio_t *p_mpegaudio =
(demux_data_mpegaudio_t*) p_input->p_demux_data;
demux_sys_t *p_mpegaudio = p_input->p_demux_data;
/* look for a frame */
if( !MPEGAudio_FindFrame( p_input, &i_pos, &mpeg, 4096 ) )
{
......
/*****************************************************************************
* mpeg_ps.c : Program Stream input module for vlc
* ps.c : Program Stream input module for vlc
*****************************************************************************
* Copyright (C) 2000-2001 VideoLAN
* $Id: ps.c,v 1.1 2002/08/04 17:23:42 sam Exp $
* $Id: ps.c,v 1.2 2002/08/07 00:29:36 sam Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -33,15 +33,27 @@
#include <sys/types.h>
#include "system.h"
/*****************************************************************************
* Constants
*****************************************************************************/
#define PS_READ_ONCE 50
/*****************************************************************************
* Private structure
*****************************************************************************/
struct demux_sys_t
{
module_t * p_module;
mpeg_demux_t mpeg;
};
/*****************************************************************************
* Local prototypes
*****************************************************************************/
static int Activate ( vlc_object_t * );
static void Deactivate ( vlc_object_t * );
static int Demux ( input_thread_t * );
/*****************************************************************************
......@@ -50,16 +62,17 @@ static int Demux ( input_thread_t * );
vlc_module_begin();
set_description( _("ISO 13818-1 MPEG Program Stream input") );
set_capability( "demux", 100 );
set_callbacks( Activate, NULL );
set_callbacks( Activate, Deactivate );
add_shortcut( "ps" );
vlc_module_end();
/*****************************************************************************
* Activate: initializes PS structures
* Activate: initialize PS structures
*****************************************************************************/
static int Activate( vlc_object_t * p_this )
{
input_thread_t * p_input = (input_thread_t *)p_this;
demux_sys_t * p_demux;
byte_t * p_peek;
/* Set the demux function */
......@@ -77,7 +90,7 @@ static int Activate( vlc_object_t * p_this )
{
/* Stream shorter than 4 bytes... */
msg_Err( p_input, "cannot peek()" );
return( -1 );
return -1;
}
if( *p_peek || *(p_peek + 1) || *(p_peek + 2) != 1 )
......@@ -106,9 +119,25 @@ static int Activate( vlc_object_t * p_this )
}
}
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;
}
if( input_InitStream( p_input, sizeof( stream_ps_data_t ) ) == -1 )
{
return( -1 );
module_Unneed( p_input, p_demux->p_module );
free( p_input->p_demux_data );
return -1;
}
input_AddProgram( p_input, 0, sizeof( stream_ps_data_t ) );
......@@ -130,7 +159,7 @@ static int Activate( vlc_object_t * p_this )
ssize_t i_result;
data_packet_t * p_data;
i_result = input_ReadPS( p_input, &p_data );
i_result = p_demux->mpeg.pf_read_ps( p_input, &p_data );
if( i_result == 0 )
{
......@@ -146,7 +175,7 @@ static int Activate( vlc_object_t * p_this )
break;
}
input_ParsePS( p_input, p_data );
p_demux->mpeg.pf_parse_ps( p_input, p_data );
input_DeletePacket( p_input->p_method_data, p_data );
/* File too big. */
......@@ -246,7 +275,18 @@ static int Activate( vlc_object_t * p_this )
vlc_mutex_unlock( &p_input->stream.stream_lock );
}
return( 0 );
return 0;
}
/*****************************************************************************
* Deactivate: deinitialize PS structures
*****************************************************************************/
static void Deactivate( 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 );
}
/*****************************************************************************
......@@ -263,16 +303,16 @@ static int Demux( input_thread_t * p_input )
{
data_packet_t * p_data;
ssize_t i_result;
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 )
{
return( i_result );
return i_result;
}
input_DemuxPS( p_input, p_data );
p_input->p_demux_data->mpeg.pf_demux_ps( p_input, p_data );
}
return( i );
return i;
}
/*****************************************************************************
* mpeg_system.c: TS, PS and PES management
* system.c: helper module for TS, PS and PES management
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: mpeg_system.c,v 1.101 2002/08/04 17:23:44 sam Exp $
* Copyright (C) 1998-2002 VideoLAN
* $Id: system.c,v 1.1 2002/08/07 00:29:36 sam Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Michel Lespinasse <walken@via.ecp.fr>
* Benot Steiner <benny@via.ecp.fr>
* Samuel Hocevar <sam@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
* Henri Fallon <henri@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
......@@ -33,11 +33,44 @@
#include <sys/types.h> /* off_t */
#include <vlc/vlc.h>
#include <vlc/input.h>
#include "stream_control.h"
#include "input_ext-intf.h"
#include "input_ext-dec.h"
#include "input_ext-plugins.h"
#include "system.h"
/*****************************************************************************
* Local prototypes
*****************************************************************************/
static int Activate ( vlc_object_t * );
static ssize_t ReadPS ( input_thread_t *, data_packet_t ** );
static es_descriptor_t * ParsePS ( input_thread_t *, data_packet_t * );
static void DemuxPS ( input_thread_t *, data_packet_t * );
static ssize_t ReadTS ( input_thread_t *, data_packet_t ** );
static void DemuxTS ( input_thread_t *, data_packet_t *,
psi_callback_t );
/*****************************************************************************
* Module descriptor
*****************************************************************************/
vlc_module_begin();
set_description( _("generic ISO 13818-1 MPEG demultiplexing") );
set_capability( "mpeg-system", 100 );
set_callbacks( Activate, NULL );
vlc_module_end();
/*****************************************************************************
* Activate: initializes helper functions
*****************************************************************************/
static int Activate ( vlc_object_t *p_this )
{
static mpeg_demux_t mpeg_demux =
{ NULL, ReadPS, ParsePS, DemuxPS, ReadTS, DemuxTS };
memcpy( p_this->p_private, &mpeg_demux, sizeof( mpeg_demux ) );
return VLC_SUCCESS;
}
/*
* PES Packet management
......@@ -96,12 +129,12 @@ static inline size_t MoveChunk( byte_t * p_dest, data_packet_t ** pp_data_src,
}
/*****************************************************************************
* input_ParsePES
* ParsePES
*****************************************************************************
* Parse a finished PES packet and analyze its header.
*****************************************************************************/
#define PES_HEADER_SIZE 7
void input_ParsePES( input_thread_t * p_input, es_descriptor_t * p_es )
static void ParsePES( input_thread_t * p_input, es_descriptor_t * p_es )
{
data_packet_t * p_data;
byte_t * p_byte;
......@@ -396,11 +429,11 @@ void input_ParsePES( input_thread_t * p_input, es_descriptor_t * p_es )
}
/*****************************************************************************
* input_GatherPES:
* GatherPES:
*****************************************************************************
* Gather a PES packet.
*****************************************************************************/
void input_GatherPES( input_thread_t * p_input, data_packet_t * p_data,
static void GatherPES( input_thread_t * p_input, data_packet_t * p_data,
es_descriptor_t * p_es,
vlc_bool_t b_unit_start, vlc_bool_t b_packet_lost )
{
......@@ -419,7 +452,7 @@ void input_GatherPES( input_thread_t * p_input, data_packet_t * p_data,
/* If the data packet contains the begining of a new PES packet, and
* if we were reassembling a PES packet, then the PES should be
* complete now, so parse its header and give it to the decoders. */
input_ParsePES( p_input, p_es );
ParsePES( p_input, p_es );
}
if( !b_unit_start && p_pes == NULL )
......@@ -475,7 +508,7 @@ void input_GatherPES( input_thread_t * p_input, data_packet_t * p_data,
if( p_pes->i_pes_size == p_es->i_pes_real_size )
{
/* The packet is finished, parse it */
input_ParsePES( p_input, p_es );
ParsePES( p_input, p_es );
}
}
#undef p_pes
......@@ -656,7 +689,7 @@ static void DecodePSM( input_thread_t * p_input, data_packet_t * p_data )
}
/*****************************************************************************
* input_ReadPS: store a PS packet into a data_buffer_t
* ReadPS: store a PS packet into a data_buffer_t
*****************************************************************************/
#define PEEK( SIZE ) \
i_error = input_Peek( p_input, &p_peek, SIZE ); \
......@@ -670,7 +703,7 @@ static void DecodePSM( input_thread_t * p_input, data_packet_t * p_data )
return( 0 ); \
}
ssize_t input_ReadPS( input_thread_t * p_input, data_packet_t ** pp_data )
static ssize_t ReadPS( input_thread_t * p_input, data_packet_t ** pp_data )
{
byte_t * p_peek;
size_t i_packet_size;
......@@ -761,9 +794,9 @@ ssize_t input_ReadPS( input_thread_t * p_input, data_packet_t ** pp_data )
#undef PEEK
/*****************************************************************************
* input_ParsePS: read the PS header
* ParsePS: read the PS header
*****************************************************************************/
es_descriptor_t * input_ParsePS( input_thread_t * p_input,
static es_descriptor_t * ParsePS( input_thread_t * p_input,
data_packet_t * p_data )
{
u32 i_code;
......@@ -896,9 +929,9 @@ es_descriptor_t * input_ParsePS( input_thread_t * p_input,
}
/*****************************************************************************
* input_DemuxPS: first step of demultiplexing: the PS header
* DemuxPS: first step of demultiplexing: the PS header
*****************************************************************************/
void input_DemuxPS( input_thread_t * p_input, data_packet_t * p_data )
static void DemuxPS( input_thread_t * p_input, data_packet_t * p_data )
{
u32 i_code;
vlc_bool_t b_trash = 0;
......@@ -1012,7 +1045,7 @@ void input_DemuxPS( input_thread_t * p_input, data_packet_t * p_data )
}
else
{
p_es = input_ParsePS( p_input, p_data );
p_es = ParsePS( p_input, p_data );
vlc_mutex_lock( &p_input->stream.control.control_lock );
if( p_es != NULL && p_es->p_decoder_fifo != NULL
......@@ -1020,7 +1053,7 @@ void input_DemuxPS( input_thread_t * p_input, data_packet_t * p_data )
{
vlc_mutex_unlock( &p_input->stream.control.control_lock );
p_es->c_packets++;
input_GatherPES( p_input, p_data, p_es, 1, 0 );
GatherPES( p_input, p_data, p_es, 1, 0 );
}
else
{
......@@ -1043,7 +1076,7 @@ void input_DemuxPS( input_thread_t * p_input, data_packet_t * p_data )
*/
/*****************************************************************************
* input_ReadTS: store a TS packet into a data_buffer_t
* ReadTS: store a TS packet into a data_buffer_t
*****************************************************************************/
#define PEEK( SIZE ) \
i_error = input_Peek( p_input, &p_peek, SIZE ); \
......@@ -1057,7 +1090,7 @@ void input_DemuxPS( input_thread_t * p_input, data_packet_t * p_data )
return( 0 ); \
}
ssize_t input_ReadTS( input_thread_t * p_input, data_packet_t ** pp_data )
static ssize_t ReadTS( input_thread_t * p_input, data_packet_t ** pp_data )
{
byte_t * p_peek;
ssize_t i_error, i_read;
......@@ -1100,9 +1133,9 @@ ssize_t input_ReadTS( input_thread_t * p_input, data_packet_t ** pp_data )
}
/*****************************************************************************
* input_DemuxTS: first step of demultiplexing: the TS header
* DemuxTS: first step of demultiplexing: the TS header
*****************************************************************************/
void input_DemuxTS( input_thread_t * p_input, data_packet_t * p_data,
static void DemuxTS( input_thread_t * p_input, data_packet_t * p_data,
psi_callback_t pf_psi_callback )
{
u16 i_pid;
......@@ -1324,7 +1357,7 @@ void input_DemuxTS( input_thread_t * p_input, data_packet_t * p_data,
else
{
/* The payload carries a PES stream */
input_GatherPES( p_input, p_data, p_es, b_unit_start, b_lost );
GatherPES( p_input, p_data, p_es, b_unit_start, b_lost );
}
}
......@@ -1332,3 +1365,4 @@ void input_DemuxTS( input_thread_t * p_input, data_packet_t * p_data,
#undef p
}
/*****************************************************************************
* system.h: MPEG demultiplexing.
*****************************************************************************
* Copyright (C) 1999-2002 VideoLAN
* $Id: system.h,v 1.1 2002/08/07 00:29:36 sam Exp $
*
* Authors: Christophe Massiot <massiot@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.
*****************************************************************************/
/*
* 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 );
/****************************************************************************
* mpeg_demux_t
****************************************************************************
* Demux callbacks exported by the helper plugin
****************************************************************************/
typedef struct mpeg_demux_t
{
module_t * p_module;
ssize_t (*pf_read_ps) ( input_thread_t *, data_packet_t ** );
es_descriptor_t * (*pf_parse_ps) ( input_thread_t *, data_packet_t * );
void (*pf_demux_ps) ( input_thread_t *, data_packet_t * );
ssize_t (*pf_read_ts) ( input_thread_t *, data_packet_t ** );
void (*pf_demux_ts) ( input_thread_t *, data_packet_t *,
psi_callback_t );
} mpeg_demux_t;
/*****************************************************************************
* 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
......@@ -2,7 +2,7 @@
* mpeg_ts.c : Transport Stream input module for vlc
*****************************************************************************
* Copyright (C) 2000-2001 VideoLAN
* $Id: ts.c,v 1.1 2002/08/04 17:23:42 sam Exp $
* $Id: ts.c,v 1.2 2002/08/07 00:29:36 sam Exp $
*
* Authors: Henri Fallon <henri@via.ecp.fr>
* Johan Bilien <jobi@via.ecp.fr>
......@@ -50,15 +50,27 @@
# endif
#endif
#include "system.h"
/*****************************************************************************
* Constants
*****************************************************************************/
#define TS_READ_ONCE 200
/*****************************************************************************
* Private structure
*****************************************************************************/
struct demux_sys_t
{
module_t * p_module;
mpeg_demux_t mpeg;
};
/*****************************************************************************
* Local prototypes
*****************************************************************************/
static int Activate ( vlc_object_t * );
static void Deactivate ( vlc_object_t * );
static int Demux ( input_thread_t * );
#if defined MODULE_NAME_IS_ts
......@@ -88,15 +100,16 @@ vlc_module_begin();
set_capability( "demux", 170 );
add_shortcut( "ts_dvbpsi" );
#endif
set_callbacks( Activate, NULL );
set_callbacks( Activate, Deactivate );
vlc_module_end();
/*****************************************************************************
* Activate: initializes TS structures
* Activate: initialize TS structures
*****************************************************************************/
static int Activate( vlc_object_t * p_this )
{
input_thread_t * p_input = (input_thread_t *)p_this;
demux_sys_t * p_demux;
es_descriptor_t * p_pat_es;
es_ts_data_t * p_demux_data;
stream_ts_data_t * p_stream_data;
......@@ -116,7 +129,7 @@ static int Activate( vlc_object_t * p_this )
if( input_Peek( p_input, &p_peek, 1 ) < 1 )
{
msg_Err( p_input, "cannot peek()" );
return( -1 );
return -1;
}
if( *p_peek != TS_SYNC_CODE )
......@@ -129,7 +142,7 @@ static int Activate( vlc_object_t * p_this )
else
{
msg_Warn( p_input, "TS module discarded (no sync)" );
return( -1 );
return -1;
}
}
......@@ -140,11 +153,27 @@ static int Activate( vlc_object_t * p_this )
p_input->i_bufsize = (p_input->i_mtu / TS_PACKET_SIZE) * TS_PACKET_SIZE;
}
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;
}
vlc_mutex_lock( &p_input->stream.stream_lock );
if( input_InitStream( p_input, sizeof( stream_ts_data_t ) ) == -1 )
{
return( -1 );
module_Unneed( p_input, p_demux->p_module );
free( p_input->p_demux_data );
return -1;
}
p_stream_data = (stream_ts_data_t *)p_input->stream.p_demux_data;
......@@ -157,7 +186,9 @@ static int Activate( vlc_object_t * p_this )
if( p_stream_data->p_pat_handle == NULL )
{
msg_Err( p_input, "could not create PAT decoder" );
return( -1 );
module_Unneed( p_input, p_demux->p_module );
free( p_input->p_demux_data );
return -1;
}
#endif
......@@ -174,7 +205,18 @@ static int Activate( vlc_object_t * p_this )
vlc_mutex_unlock( &p_input->stream.stream_lock );
return( 0 );
return 0;
}
/*****************************************************************************
* Deactivate: deinitialize TS structures
*****************************************************************************/
static void Deactivate( 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 );
}
/*****************************************************************************
......@@ -185,6 +227,7 @@ static int Activate( vlc_object_t * p_this )
*****************************************************************************/
static int Demux( input_thread_t * p_input )
{
demux_sys_t * p_demux = p_input->p_demux_data;
int i_read_once = (p_input->i_mtu ?
p_input->i_bufsize / TS_PACKET_SIZE :
TS_READ_ONCE);
......@@ -195,17 +238,18 @@ static int Demux( input_thread_t * p_input )
data_packet_t * p_data;
ssize_t i_result;
i_result = input_ReadTS( p_input, &p_data );
i_result = p_demux->mpeg.pf_read_ts( p_input, &p_data );
if( i_result <= 0 )
{
return( i_result );
return i_result;
}
input_DemuxTS( p_input, p_data, (psi_callback_t) &PSI_CALLBACK );
p_demux->mpeg.pf_demux_ts( p_input, p_data,
(psi_callback_t) &PSI_CALLBACK );
}
return( i_read_once );
return i_read_once;
}
......
......@@ -2,7 +2,7 @@
* configuration.c management of the modules configuration
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: configuration.c,v 1.33 2002/07/31 20:56:53 sam Exp $
* $Id: configuration.c,v 1.34 2002/08/07 00:29:37 sam Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
......@@ -511,8 +511,8 @@ int __config_LoadConfigFile( vlc_object_t *p_this, const char *psz_module_name )
!memcmp( &line[1], p_module->psz_object_name,
strlen(p_module->psz_object_name) ) )
{
msg_Dbg( p_this, "loading config for module \"%s\"",
p_module->psz_object_name );
//msg_Dbg( p_this, "loading config for module \"%s\"",
// p_module->psz_object_name );
break;
}
......@@ -560,16 +560,16 @@ int __config_LoadConfigFile( vlc_object_t *p_this, const char *psz_module_name )
if( !*psz_option_value )
break; /* ignore empty option */
p_item->i_value = atoi( psz_option_value);
msg_Dbg( p_this, "option \"%s\", value %i",
p_item->psz_name, p_item->i_value );
//msg_Dbg( p_this, "option \"%s\", value %i",
// p_item->psz_name, p_item->i_value );
break;
case CONFIG_ITEM_FLOAT:
if( !*psz_option_value )
break; /* ignore empty option */
p_item->f_value = (float)atof( psz_option_value);
msg_Dbg( p_this, "option \"%s\", value %f",
p_item->psz_name, (double)p_item->f_value );
//msg_Dbg( p_this, "option \"%s\", value %f",
// p_item->psz_name, (double)p_item->f_value );
break;
default:
......@@ -584,9 +584,9 @@ int __config_LoadConfigFile( vlc_object_t *p_this, const char *psz_module_name )
vlc_mutex_unlock( p_item->p_lock );
msg_Dbg( p_this, "option \"%s\", value \"%s\"",
p_item->psz_name,
p_item->psz_value ? p_item->psz_value : "" );
//msg_Dbg( p_this, "option \"%s\", value \"%s\"",
// p_item->psz_name,
// p_item->psz_value ? p_item->psz_value : "" );
break;
}
}
......
......@@ -2,7 +2,7 @@
* modules.c : Builtin and plugin modules management functions
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: modules.c,v 1.80 2002/08/06 00:26:48 sam Exp $
* $Id: modules.c,v 1.81 2002/08/07 00:29:37 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Ethan C. Baldridge <BaldridgeE@cadmus.com>
......@@ -88,7 +88,7 @@
*****************************************************************************/
#ifdef HAVE_DYNAMIC_PLUGINS
static void AllocateAllPlugins ( vlc_object_t * );
static void AllocatePluginDir ( vlc_object_t *, const char * );
static void AllocatePluginDir ( vlc_object_t *, const char *, int );
static int AllocatePluginFile ( vlc_object_t *, char * );
#endif
static int AllocateBuiltinModule( vlc_object_t *, int ( * ) ( module_t * ) );
......@@ -630,7 +630,8 @@ static void AllocateAllPlugins( vlc_object_t *p_this )
msg_Dbg( p_this, "recursively browsing `%s'", psz_fullpath );
AllocatePluginDir( p_this, psz_fullpath );
/* Don't go deeper than 5 subdirectories */
AllocatePluginDir( p_this, psz_fullpath, 5 );
#if defined( SYS_BEOS ) || defined( SYS_DARWIN )
if( b_notinroot )
......@@ -644,7 +645,8 @@ static void AllocateAllPlugins( vlc_object_t *p_this )
/*****************************************************************************
* AllocatePluginDir: recursively parse a directory to look for plugins
*****************************************************************************/
static void AllocatePluginDir( vlc_object_t *p_this, const char *psz_dir )
static void AllocatePluginDir( vlc_object_t *p_this, const char *psz_dir,
int i_maxdepth )
{
#define PLUGIN_EXT ".so"
int i_dirlen;
......@@ -653,6 +655,11 @@ static void AllocatePluginDir( vlc_object_t *p_this, const char *psz_dir )
struct dirent * file;
if( i_maxdepth < 0 )
{
return;
}
dir = opendir( psz_dir );
if( !dir )
......@@ -679,7 +686,7 @@ static void AllocatePluginDir( vlc_object_t *p_this, const char *psz_dir )
if( !stat( psz_file, &statbuf ) && statbuf.st_mode & S_IFDIR )
{
AllocatePluginDir( p_this, psz_file );
AllocatePluginDir( p_this, psz_file, i_maxdepth - 1 );
}
else if( i_len > strlen( PLUGIN_EXT )
/* We only load files ending with ".so" */
......@@ -763,8 +770,8 @@ static int AllocatePluginFile( vlc_object_t * p_this, char * psz_file )
p_this->p_vlc->p_module_bank->first = p_module;
p_this->p_vlc->p_module_bank->i_count++;
msg_Dbg( p_this, "plugin \"%s\", %s",
p_module->psz_object_name, p_module->psz_longname );
//msg_Dbg( p_this, "plugin \"%s\", %s",
// p_module->psz_object_name, p_module->psz_longname );
vlc_object_attach( p_module, p_this->p_vlc->p_module_bank );
......@@ -881,8 +888,8 @@ static int AllocateBuiltinModule( vlc_object_t * p_this,
p_this->p_vlc->p_module_bank->first = p_module;
p_this->p_vlc->p_module_bank->i_count++;
msg_Dbg( p_this, "builtin \"%s\", %s",
p_module->psz_object_name, p_module->psz_longname );
//msg_Dbg( p_this, "builtin \"%s\", %s",
// p_module->psz_object_name, p_module->psz_longname );
vlc_object_attach( p_module, p_this->p_vlc->p_module_bank );
......
......@@ -245,13 +245,6 @@ static inline const char * module_error( char *psz_buffer )
(p_symbols)->input_AccessInit_inner = input_AccessInit; \
(p_symbols)->input_AccessReinit_inner = input_AccessReinit; \
(p_symbols)->input_AccessEnd_inner = input_AccessEnd; \
(p_symbols)->input_ParsePES_inner = input_ParsePES; \
(p_symbols)->input_GatherPES_inner = input_GatherPES; \
(p_symbols)->input_ReadPS_inner = input_ReadPS; \
(p_symbols)->input_ParsePS_inner = input_ParsePS; \
(p_symbols)->input_ReadTS_inner = input_ReadTS; \
(p_symbols)->input_DemuxPS_inner = input_DemuxPS; \
(p_symbols)->input_DemuxTS_inner = input_DemuxTS; \
(p_symbols)->__input_FDClose_inner = __input_FDClose; \
(p_symbols)->__input_FDNetworkClose_inner = __input_FDNetworkClose; \
(p_symbols)->input_FDRead_inner = input_FDRead; \
......
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