]> git.sesse.net Git - vlc/blob - include/input.h
-New ES detection based on .ifo for DVD module. It might fail (I have
[vlc] / include / input.h
1 /*****************************************************************************
2  * input.h: structures of the input not exported to other modules
3  *****************************************************************************
4  * Copyright (C) 1999, 2000 VideoLAN
5  * $Id: input.h,v 1.31 2001/02/22 08:44:45 stef Exp $
6  *
7  * Authors: Christophe Massiot <massiot@via.ecp.fr>
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  * Communication plugin -> input
26  */
27
28 /* FIXME: you've gotta move this move this, you've gotta move this move this */
29 #define INPUT_READ_ONCE     7   /* We live in a world dominated by Ethernet. *
30                                  * Ethernet MTU is 1500 bytes, so in a UDP   *
31                                  * packet we can put : 1500/188 = 7 TS       *
32                                  * packets. Have a nice day and merry Xmas.  */
33 #define PADDING_PACKET_SIZE 188 /* Size of the NULL packet inserted in case
34                                  * of data loss (this should be < 188).      */
35 #define PADDING_PACKET_NUMBER 10 /* Number of padding packets top insert to
36                                   * escape a decoder.                        */
37 #define NO_SEEK             -1
38
39 /*****************************************************************************
40  * Prototypes from input_ext-dec.c
41  *****************************************************************************/
42 void InitBitstream  ( struct bit_stream_s *, struct decoder_fifo_s * );
43 void NextDataPacket ( struct bit_stream_s * );
44
45 /*****************************************************************************
46  * Prototypes from input.c to open files
47  *****************************************************************************/
48 void input_FileOpen ( struct input_thread_s * );
49 void input_FileClose( struct input_thread_s * );
50
51 /*****************************************************************************
52  * Prototypes from input_programs.c
53  *****************************************************************************/
54 int  input_InitStream( struct input_thread_s *, size_t );
55 void input_EndStream ( struct input_thread_s * );
56 struct pgrm_descriptor_s * input_FindProgram( struct input_thread_s *, u16 );
57 struct pgrm_descriptor_s * input_AddProgram ( struct input_thread_s *,
58                                               u16, size_t );
59 void input_DelProgram( struct input_thread_s *, struct pgrm_descriptor_s * );
60 struct input_area_s * input_AddArea( struct input_thread_s * );
61 void input_DelArea   ( struct input_thread_s *, struct input_area_s * );
62 void input_DumpStream( struct input_thread_s * );
63 struct es_descriptor_s * input_FindES( struct input_thread_s *, u16 );
64 struct es_descriptor_s * input_AddES ( struct input_thread_s *,
65                                        struct pgrm_descriptor_s *, u16,
66                                        size_t );
67 void input_DelES     ( struct input_thread_s *, struct es_descriptor_s * );
68 int  input_SelectES  ( struct input_thread_s *, struct es_descriptor_s * );
69 int  input_UnSelectES( struct input_thread_s *, struct es_descriptor_s * );
70
71 /*****************************************************************************
72  * Prototypes from input_dec.c
73  *****************************************************************************/
74 //decoder_capabilities_s * input_ProbeDecoder( void );
75 vlc_thread_t input_RunDecoder( struct decoder_capabilities_s *, void * );
76 void input_EndDecoder( struct input_thread_s *, struct es_descriptor_s * );
77 void input_DecodePES ( struct decoder_fifo_s *, struct pes_packet_s * );
78 void input_EscapeDiscontinuity( struct input_thread_s *,
79                                 struct pgrm_descriptor_s * );
80 void input_EscapeAudioDiscontinuity( struct input_thread_s *,
81                                      struct pgrm_descriptor_s * );
82
83 /*****************************************************************************
84  * Prototypes from input_clock.c
85  *****************************************************************************/
86 void input_ClockInit( struct pgrm_descriptor_s * );
87 void input_ClockManageRef( struct input_thread_s *,
88                            struct pgrm_descriptor_s *, mtime_t );
89 mtime_t input_ClockGetTS( struct input_thread_s *,
90                           struct pgrm_descriptor_s *, mtime_t );
91
92 /*****************************************************************************
93  * Create a NULL packet for padding in case of a data loss
94  *****************************************************************************/
95 static __inline__ void input_NullPacket( input_thread_t * p_input,
96                                          es_descriptor_t * p_es )
97 {
98     data_packet_t *             p_pad_data;
99     pes_packet_t *              p_pes;
100
101     if( (p_pad_data = p_input->pf_new_packet(
102                     p_input->p_method_data,
103                     PADDING_PACKET_SIZE )) == NULL )
104     {
105         intf_ErrMsg("Out of memory");
106         p_input->b_error = 1;
107         return;
108     }
109
110     memset( p_pad_data->p_buffer, 0, PADDING_PACKET_SIZE );
111     p_pad_data->b_discard_payload = 1;
112     p_pes = p_es->p_pes;
113
114     if( p_pes != NULL )
115     {
116         p_pes->b_discontinuity = 1;
117         p_es->p_last->p_next = p_pad_data;
118         p_es->p_last = p_pad_data;
119     }
120     else
121     {
122         if( (p_pes = p_input->pf_new_pes( p_input->p_method_data )) == NULL )
123         {
124             intf_ErrMsg("Out of memory");
125             p_input->b_error = 1;
126             return;
127         }
128
129         p_pes->i_rate = p_input->stream.control.i_rate;
130         p_pes->p_first = p_pad_data;
131         p_pes->b_discontinuity = 1;
132         input_DecodePES( p_es->p_decoder_fifo, p_pes );
133     }
134 }
135