Commit 910f40f9 authored by Henri Fallon's avatar Henri Fallon

TS Input :
- Added DemuxPSI, DecodePAT and DecodePMT. Never tested which streams
  where PAT or PMT are splitted in more than one section.
- Some TS files still don't work (matrix.ts i.e : no sound ),
  others do ... i'll have to investigate.

Todo :
- What if data get unaligned ?
- Write NetworkOpen
- Try to find why I get no sound on matrix.ts
- Support Stream and program selection.
parent 9584da59
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* and TS system layers * and TS system layers
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000 VideoLAN
* $Id: mpeg_system.h,v 1.1 2001/02/08 04:43:27 sam Exp $ * $Id: mpeg_system.h,v 1.2 2001/02/21 04:38:59 henri Exp $
* *
* Authors: * Authors:
* *
...@@ -28,6 +28,12 @@ ...@@ -28,6 +28,12 @@
#define TS_PACKET_SIZE 188 /* Size of a TS packet */ #define TS_PACKET_SIZE 188 /* Size of a TS packet */
#define PSI_SECTION_SIZE 4096 /* Maximum size of a PSI section */ #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_section_t * psi_section_t
...@@ -39,11 +45,24 @@ typedef struct psi_section_s ...@@ -39,11 +45,24 @@ typedef struct psi_section_s
{ {
byte_t buffer[PSI_SECTION_SIZE]; byte_t buffer[PSI_SECTION_SIZE];
/* Is there a section being decoded ? */ u8 i_section_number;
boolean_t b_running_section; u8 i_last_section_number;
u8 i_version_number;
u16 i_section_length;
u16 i_read_in_section;
/* the PSI is complete */
boolean_t b_is_complete;
/* packet missed up ? */
boolean_t b_trash;
/*about sections */
boolean_t b_section_complete;
/* where are we currently ? */
byte_t * p_current;
u16 i_length;
u16 i_current_position;
} psi_section_t; } psi_section_t;
/***************************************************************************** /*****************************************************************************
...@@ -53,6 +72,9 @@ typedef struct es_ts_data_s ...@@ -53,6 +72,9 @@ typedef struct es_ts_data_s
{ {
boolean_t b_psi; /* Does the stream have to be handled by boolean_t b_psi; /* Does the stream have to be handled by
* the PSI decoder ? */ * the PSI decoder ? */
int i_psi_type; /* There are different types of PSI */
psi_section_t * p_psi_section; /* PSI packets */ psi_section_t * p_psi_section; /* PSI packets */
/* Markers */ /* Markers */
...@@ -65,6 +87,7 @@ typedef struct es_ts_data_s ...@@ -65,6 +87,7 @@ typedef struct es_ts_data_s
typedef struct pgrm_ts_data_s typedef struct pgrm_ts_data_s
{ {
u16 i_pcr_pid; /* PCR ES, for TS streams */ u16 i_pcr_pid; /* PCR ES, for TS streams */
int i_pmt_version;
} pgrm_ts_data_t; } pgrm_ts_data_t;
/***************************************************************************** /*****************************************************************************
...@@ -72,28 +95,7 @@ typedef struct pgrm_ts_data_s ...@@ -72,28 +95,7 @@ typedef struct pgrm_ts_data_s
*****************************************************************************/ *****************************************************************************/
typedef struct stream_ts_data_s typedef struct stream_ts_data_s
{ {
/* Program Association Table status */ int i_pat_version; /* Current version of the PAT */
u8 i_PAT_version; /* version number */
boolean_t b_is_PAT_complete; /* Is the PAT complete ? */
u8 i_known_PAT_sections;
/* Number of section we received so far */
byte_t a_known_PAT_sections[32];
/* Already received sections */
/* Program Map Table status */
boolean_t b_is_PMT_complete; /* Is the PMT complete ? */
u8 i_known_PMT_sections;
/* Number of section we received so far */
byte_t a_known_PMT_sections[32];
/* Already received sections */
/* Service Description Table status */
u8 i_SDT_version; /* version number */
boolean_t b_is_SDT_complete; /* Is the SDT complete ? */
u8 i_known_SDT_sections;
/* Number of section we received so far */
byte_t a_known_SDT_sections[32];
/* Already received sections */
} stream_ts_data_t; } stream_ts_data_t;
/***************************************************************************** /*****************************************************************************
...@@ -120,3 +122,5 @@ es_descriptor_t * input_ParsePS( struct input_thread_s *, ...@@ -120,3 +122,5 @@ es_descriptor_t * input_ParsePS( struct input_thread_s *,
struct data_packet_s * ); struct data_packet_s * );
void input_DemuxPS( struct input_thread_s *, struct data_packet_s * ); void input_DemuxPS( struct input_thread_s *, struct data_packet_s * );
void input_DemuxTS( struct input_thread_s *, struct data_packet_s * ); void input_DemuxTS( struct input_thread_s *, struct data_packet_s * );
void input_DemuxPSI( input_thread_t *, data_packet_t *, es_descriptor_t *,
boolean_t, boolean_t );
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* input_ts.c: TS demux and netlist management * input_ts.c: TS demux and netlist management
***************************************************************************** *****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN * Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: input_ts.c,v 1.5 2001/02/20 07:49:13 sam Exp $ * $Id: input_ts.c,v 1.6 2001/02/21 04:38:59 henri Exp $
* *
* Authors: * Authors:
* *
...@@ -130,8 +130,9 @@ static void TSInit( input_thread_t * p_input ) ...@@ -130,8 +130,9 @@ static void TSInit( input_thread_t * p_input )
{ {
/* Initialize netlist and TS structures */ /* Initialize netlist and TS structures */
thread_ts_data_t * p_method; thread_ts_data_t * p_method;
pgrm_ts_data_t * p_pgrm_demux; es_descriptor_t * p_pat_es;
es_descriptor_t * kludge1; es_ts_data_t * p_demux_data;
stream_ts_data_t * p_stream_data;
/* Initialise structure */ /* Initialise structure */
p_method = malloc( sizeof( thread_ts_data_t ) ); p_method = malloc( sizeof( thread_ts_data_t ) );
...@@ -159,28 +160,21 @@ static void TSInit( input_thread_t * p_input ) ...@@ -159,28 +160,21 @@ static void TSInit( input_thread_t * p_input )
/* Initialize the stream */ /* Initialize the stream */
input_InitStream( p_input, sizeof( stream_ts_data_t ) ); input_InitStream( p_input, sizeof( stream_ts_data_t ) );
/* FIXME : PSIDemux and PSIDecode */ /* Init */
/* Add audio and video programs */ p_stream_data = (stream_ts_data_t *)p_input->stream.p_demux_data;
/* p_input->stream.pp_programs[0] = */ p_stream_data->i_pat_version = PAT_UNINITIALIZED ;
input_AddProgram( p_input, 0, sizeof( pgrm_ts_data_t ) );
p_pgrm_demux = /* We'll have to catch the PAT in order to continue
(pgrm_ts_data_t *)p_input->stream.pp_programs[0]->p_demux_data; * Then the input will catch the PMT and then the others ES
p_pgrm_demux->i_pcr_pid = 0x78; * The PAT es is indepedent of any program. */
p_pat_es = input_AddES( p_input, NULL,
0x00, sizeof( es_ts_data_t ) );
p_demux_data=(es_ts_data_t *)p_pat_es->p_demux_data;
p_demux_data->b_psi = 1;
p_demux_data->i_psi_type = PSI_IS_PAT;
p_demux_data->p_psi_section = malloc(sizeof(psi_section_t));
p_demux_data->p_psi_section->b_is_complete = 1;
kludge1 = input_AddES( p_input, p_input->stream.pp_programs[0],
0x78, sizeof( es_ts_data_t ) );
// kludge
kludge1->i_type = MPEG2_VIDEO_ES;
input_SelectES( p_input, kludge1 );
vlc_mutex_lock( &(p_input->stream.stream_lock) );
p_input->stream.pp_programs[0]->b_is_ok = 1;
vlc_mutex_unlock( &(p_input->stream.stream_lock) );
//debug
intf_ErrMsg("End of TSINIT");
} }
/***************************************************************************** /*****************************************************************************
...@@ -188,7 +182,13 @@ intf_ErrMsg("End of TSINIT"); ...@@ -188,7 +182,13 @@ intf_ErrMsg("End of TSINIT");
*****************************************************************************/ *****************************************************************************/
static void TSEnd( input_thread_t * p_input ) static void TSEnd( input_thread_t * p_input )
{ {
es_descriptor_t * p_pat_es;
p_pat_es = input_FindES( p_input, 0x00 );
if( p_pat_es != NULL )
input_DelES( p_input, p_pat_es );
free(p_input->p_plugin_data);
} }
/***************************************************************************** /*****************************************************************************
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* input.h: structures of the input not exported to other modules * input.h: structures of the input not exported to other modules
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000 VideoLAN
* $Id: input_ts.h,v 1.1 2001/02/14 15:58:29 henri Exp $ * $Id: input_ts.h,v 1.2 2001/02/21 04:38:59 henri Exp $
* *
* Authors: * Authors:
* *
...@@ -22,12 +22,10 @@ ...@@ -22,12 +22,10 @@
*****************************************************************************/ *****************************************************************************/
// #define NB_DATA 16384 #define NB_DATA 16384
// #define NB_PES 8192 #define NB_PES 8192
#define NB_DATA 17000
#define NB_PES 9000
/* Will be used whne NetworkOpen is ready */
typedef struct thread_ts_data_s { typedef struct thread_ts_data_s {
// FILE * stream; // FILE * stream;
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment