]> git.sesse.net Git - vlc/blob - plugins/mpeg/input_ts.c
This commit is a bit early, but it'll save Stef, Henri and me much
[vlc] / plugins / mpeg / input_ts.c
1 /*****************************************************************************
2  * input_ts.c: TS demux and netlist management
3  *****************************************************************************
4  * Copyright (C) 1998, 1999, 2000 VideoLAN
5  * $Id: input_ts.c,v 1.1 2001/02/08 04:43:27 sam Exp $
6  *
7  * Authors: 
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  * 
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
22  *****************************************************************************/
23
24 /*****************************************************************************
25  * Preamble
26  *****************************************************************************/
27 #include "defs.h"
28
29 #include <stdlib.h>
30 #include <string.h>
31 #include <errno.h>
32
33 #include "config.h"
34 #include "common.h"
35 #include "threads.h"
36 #include "mtime.h"
37 #include "tests.h"
38 #include "modules.h"
39
40 #include "intf_msg.h"
41
42 #include "stream_control.h"
43 #include "input_ext-intf.h"
44 #include "input_ext-dec.h"
45
46 #include "input.h"
47
48 #include "mpeg_system.h"
49 #include "input_netlist.h"
50
51 /*****************************************************************************
52  * Local prototypes
53  *****************************************************************************/
54 static int  TSProbe     ( probedata_t * );
55 static int  TSRead      ( struct input_thread_s *,
56                           data_packet_t * p_packets[INPUT_READ_ONCE] );
57 static void TSInit      ( struct input_thread_s * );
58 static void TSEnd       ( struct input_thread_s * );
59
60 /*****************************************************************************
61  * Functions exported as capabilities. They are declared as static so that
62  * we don't pollute the namespace too much.
63  *****************************************************************************/
64 void input_getfunctions( function_list_t * p_function_list )
65 {
66 #define input p_function_list->functions.input
67     p_function_list->pf_probe = TSProbe;
68     input.pf_init             = TSInit;
69     input.pf_open             = input_FileOpen;
70     input.pf_close            = input_FileClose;
71     input.pf_end              = TSEnd;
72     input.pf_read             = TSRead;
73     input.pf_demux            = input_DemuxTS;
74     input.pf_new_packet       = input_NetlistNewPacket;
75     input.pf_new_pes          = input_NetlistNewPES;
76     input.pf_delete_packet    = input_NetlistDeletePacket;
77     input.pf_delete_pes       = input_NetlistDeletePES;
78     input.pf_rewind           = NULL;
79     input.pf_seek             = NULL;
80 #undef input
81 }
82
83 /*****************************************************************************
84  * TSProbe: verifies that the stream is a TS stream
85  *****************************************************************************/
86 static int TSProbe( probedata_t * p_data )
87 {
88     if( TestMethod( INPUT_METHOD_VAR, "ts" ) )
89     {
90         return( 999 );
91     }
92
93     /* verify that the first byte is 0x47 */
94     return 1;
95 }
96
97 /*****************************************************************************
98  * TSInit: initializes TS structures
99  *****************************************************************************/
100 static void TSInit( input_thread_t * p_input )
101 {
102     /* Initialize netlist and TS structures */
103 }
104
105 /*****************************************************************************
106  * TSEnd: frees unused data
107  *****************************************************************************/
108 static void TSEnd( input_thread_t * p_input )
109 {
110
111 }
112
113 /*****************************************************************************
114  * TSRead: reads data packets
115  *****************************************************************************
116  * Returns -1 in case of error, 0 if everything went well, and 1 in case of
117  * EOF.
118  *****************************************************************************/
119 static int TSRead( input_thread_t * p_input,
120                    data_packet_t * pp_packets[INPUT_READ_ONCE] )
121 {
122     return -1;
123 }
124