Commit 434f3796 authored by Christophe Massiot's avatar Christophe Massiot

* Splitted up p_method_data/p_plugin_data ;

* Cleaned up input_ts.c, added it into the Makefile.
parent dca61827
......@@ -186,6 +186,7 @@ INTERFACE = src/interface/main.o \
src/interface/intf_console.o
INPUT = src/input/input_ps.o \
src/input/input_ts.o \
src/input/mpeg_system.o \
src/input/input_ext-dec.o \
src/input/input_programs.o \
......
......@@ -4,7 +4,7 @@
* control the pace of reading.
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: input_ext-intf.h,v 1.6 2000/12/21 13:54:15 massiot Exp $
* $Id: input_ext-intf.h,v 1.7 2000/12/21 15:01:08 massiot Exp $
*
* Authors:
*
......@@ -206,7 +206,8 @@ typedef struct input_thread_s
i_p_config_t i_p_config; /* plugin configuration */
int i_handle; /* socket or file descriptor */
void * p_method_data;
void * p_method_data; /* data of the packet manager */
void * p_plugin_data; /* data of the plugin */
/* General stream description */
stream_descriptor_t stream; /* PAT tables */
......
......@@ -2,7 +2,7 @@
* input_ps.c: PS demux and packet management
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: input_ps.c,v 1.9 2000/12/21 14:18:15 massiot Exp $
* $Id: input_ps.c,v 1.10 2000/12/21 15:01:08 massiot Exp $
*
* Authors:
*
......@@ -90,7 +90,7 @@ static void PSInit( input_thread_t * p_input )
return;
}
p_input->p_method_data = (void *)p_method;
p_input->p_plugin_data = (void *)p_method;
/* Re-open the socket as a buffered FILE stream */
if( (p_method->stream = fdopen( p_input->i_handle, "r" )) == NULL )
......@@ -158,7 +158,7 @@ static void PSInit( input_thread_t * p_input )
static void PSEnd( input_thread_t * p_input )
{
free( p_input->stream.p_demux_data );
free( p_input->p_method_data );
free( p_input->p_plugin_data );
}
/*****************************************************************************
......@@ -170,7 +170,7 @@ static __inline__ int SafeRead( input_thread_t * p_input, byte_t * p_buffer,
thread_ps_data_t * p_method;
int i_error;
p_method = (thread_ps_data_t *)p_input->p_method_data;
p_method = (thread_ps_data_t *)p_input->p_plugin_data;
while( fread( p_buffer, i_len, 1, p_method->stream ) != 1 )
{
if( feof( p_method->stream ) )
......@@ -191,7 +191,7 @@ static __inline__ int SafeRead( input_thread_t * p_input, byte_t * p_buffer,
}
/*****************************************************************************
* PSRead: reads a data packet
* PSRead: reads data packets
*****************************************************************************
* Returns -1 in case of error, 0 if everything went well, and 1 in case of
* EOF.
......@@ -205,7 +205,7 @@ static int PSRead( input_thread_t * p_input,
int i_packet, i_error;
thread_ps_data_t * p_method;
p_method = (thread_ps_data_t *)p_input->p_method_data;
p_method = (thread_ps_data_t *)p_input->p_plugin_data;
memset( pp_packets, 0, INPUT_READ_ONCE * sizeof(data_packet_t *) );
for( i_packet = 0; i_packet < INPUT_READ_ONCE; i_packet++ )
......@@ -416,6 +416,7 @@ input_capabilities_t * PSKludge( void )
input_capabilities_t * p_plugin;
p_plugin = (input_capabilities_t *)malloc( sizeof(input_capabilities_t) );
p_plugin->pf_probe = PSProbe;
p_plugin->pf_init = PSInit;
p_plugin->pf_end = PSEnd;
p_plugin->pf_read = PSRead;
......
/*****************************************************************************
* Constants
* input_ps.h: thread structure of the PS plugin
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: input_ps.h,v 1.2 2000/12/21 15:01:08 massiot Exp $
*
* Authors:
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
/*****************************************************************************
......
......@@ -2,6 +2,7 @@
* input_ts.c: TS demux and netlist management
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: input_ts.c,v 1.2 2000/12/21 15:01:08 massiot Exp $
*
* Authors:
*
......@@ -23,23 +24,37 @@
/*****************************************************************************
* Preamble
*****************************************************************************/
#include "time_control.h"
#include "defs.h"
#include <stdlib.h>
#include <netinet/in.h>
#include <string.h>
#include <errno.h>
#include "config.h"
#include "common.h"
#include "threads.h"
#include "mtime.h"
#include "intf_msg.h"
#include "stream_control.h"
#include "input_ext-intf.h"
#include "input_ext-dec.h"
#include "input.h"
#include "mpeg_system.h"
#include "input_netlist.h"
/*****************************************************************************
* Local prototypes
*****************************************************************************/
static int TSProbe ( struct input_thread_s * );
static void TSRead ( struct input_thread_s * );
static int TSInit ( struct input_thread_s * );
static int TSRead ( struct input_thread_s *,
data_packet_t * p_packets[INPUT_READ_ONCE] );
static void TSInit ( struct input_thread_s * );
static void TSEnd ( struct input_thread_s * );
static struct data_packet_s * NewPacket ( struct input_thread_s *,
size_t );
static void DeletePacket( struct input_thread_s *,
struct data_packet_s * );
static void DeletePES ( struct input_thread_s *,
struct pes_packet_s * );
/*****************************************************************************
* TSProbe: verifies that the stream is a TS stream
......@@ -47,9 +62,57 @@ static void DeletePES ( struct input_thread_s *,
static int TSProbe( input_thread_t * p_input )
{
/* verify that the first byte is 0x47 */
return 1;
}
/*****************************************************************************
* TSInit: initializes TS structures
*****************************************************************************/
static void TSInit( input_thread_t * p_input )
{
/* Initialize netlist and TS structures */
}
/*****************************************************************************
* TSEnd: frees unused data
*****************************************************************************/
static void TSEnd( input_thread_t * p_input )
{
}
/*****************************************************************************
* TSRead: reads data packets
*****************************************************************************
* Returns -1 in case of error, 0 if everything went well, and 1 in case of
* EOF.
*****************************************************************************/
static int TSRead( input_thread_t * p_input,
data_packet_t * pp_packets[INPUT_READ_ONCE] )
{
return -1;
}
/*****************************************************************************
* TSKludge: fakes a TS plugin (FIXME)
*****************************************************************************/
input_capabilities_t * TSKludge( void )
{
input_capabilities_t * p_plugin;
p_plugin = (input_capabilities_t *)malloc( sizeof(input_capabilities_t) );
p_plugin->pf_probe = TSProbe;
p_plugin->pf_init = TSInit;
p_plugin->pf_end = TSEnd;
p_plugin->pf_read = TSRead;
p_plugin->pf_demux = input_DemuxTS; /* FIXME: use i_p_config_t ! */
p_plugin->pf_new_packet = input_NetlistNewPacket;
p_plugin->pf_new_pes = input_NetlistNewPES;
p_plugin->pf_delete_packet = input_NetlistDeletePacket;
p_plugin->pf_delete_pes = input_NetlistDeletePES;
p_plugin->pf_rewind = NULL;
p_plugin->pf_seek = NULL;
return( p_plugin );
}
/*****************************************************************************
* thread_ts_data_t: extension of input_thread_t
*****************************************************************************/
typedef struct thread_ts_data_s
{
/* To use the efficiency of the scatter/gather IO operations without
* malloc'ing all the time, we implemented a FIFO of free data packets.
*/
vlc_mutex_lock lock;
struct iovec p_free_iovec[INPUT_MAX_TS + INPUT_TS_READ_ONCE];
data_packet_t * p_free_ts[INPUT_MAX_TS + INPUT_TS_READ_ONCE];
int i_free_start, i_free_end;
/* The free data packets are stored here : */
data_packet_t * p_data_packets;
byte_t * p_buffers;
} thread_ts_data_t;
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