audiotracy: always request the timestamp during the syncing phase
[vlc.git] / include / vlc_input.h
blobb0bb237b89a055a730e0203c98448bca8b7b9c38
1 /*****************************************************************************
2 * vlc_input.h: Core input structures
3 *****************************************************************************
4 * Copyright (C) 1999-2015 VLC authors and VideoLAN
6 * Authors: Christophe Massiot <massiot@via.ecp.fr>
7 * Laurent Aimar <fenrir@via.ecp.fr>
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU Lesser General Public License as published by
11 * the Free Software Foundation; either version 2.1 of the License, or
12 * (at your option) any later version.
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 Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public License
20 * along with this program; if not, write to the Free Software Foundation,
21 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22 *****************************************************************************/
24 #ifndef VLC_INPUT_H
25 #define VLC_INPUT_H 1
27 /**
28 * \defgroup input Input
29 * \ingroup vlc
30 * Input thread
31 * @{
32 * \file
33 * Input thread interface
36 #include <vlc_es.h>
37 #include <vlc_meta.h>
38 #include <vlc_epg.h>
39 #include <vlc_input_item.h>
40 #include <vlc_vout.h>
41 #include <vlc_vout_osd.h>
43 #include <string.h>
45 typedef struct input_resource_t input_resource_t;
47 /*****************************************************************************
48 * Seek point: (generalisation of chapters)
49 *****************************************************************************/
50 struct seekpoint_t
52 vlc_tick_t i_time_offset;
53 char *psz_name;
56 static inline seekpoint_t *vlc_seekpoint_New( void )
58 seekpoint_t *point = (seekpoint_t*)malloc( sizeof( seekpoint_t ) );
59 if( !point )
60 return NULL;
61 point->i_time_offset = -1;
62 point->psz_name = NULL;
63 return point;
66 static inline void vlc_seekpoint_Delete( seekpoint_t *point )
68 if( !point ) return;
69 free( point->psz_name );
70 free( point );
73 static inline seekpoint_t *vlc_seekpoint_Duplicate( const seekpoint_t *src )
75 seekpoint_t *point = vlc_seekpoint_New();
76 if( likely(point) )
78 if( src->psz_name ) point->psz_name = strdup( src->psz_name );
79 point->i_time_offset = src->i_time_offset;
81 return point;
84 /*****************************************************************************
85 * Title:
86 *****************************************************************************/
88 /* input_title_t.i_flags field */
89 #define INPUT_TITLE_MENU 0x01 /* Menu title */
90 #define INPUT_TITLE_INTERACTIVE 0x02 /* Interactive title. Playback position has no meaning. */
92 typedef struct input_title_t
94 char *psz_name;
96 vlc_tick_t i_length; /* Length(microsecond) if known, else 0 */
98 unsigned i_flags; /* Is it a menu or a normal entry */
100 /* Title seekpoint */
101 int i_seekpoint;
102 seekpoint_t **seekpoint;
103 } input_title_t;
105 static inline input_title_t *vlc_input_title_New(void)
107 input_title_t *t = (input_title_t*)malloc( sizeof( input_title_t ) );
108 if( !t )
109 return NULL;
111 t->psz_name = NULL;
112 t->i_flags = 0;
113 t->i_length = 0;
114 t->i_seekpoint = 0;
115 t->seekpoint = NULL;
117 return t;
120 static inline void vlc_input_title_Delete( input_title_t *t )
122 int i;
123 if( t == NULL )
124 return;
126 free( t->psz_name );
127 for( i = 0; i < t->i_seekpoint; i++ )
128 vlc_seekpoint_Delete( t->seekpoint[i] );
129 free( t->seekpoint );
130 free( t );
133 static inline input_title_t *vlc_input_title_Duplicate( const input_title_t *t )
135 input_title_t *dup = vlc_input_title_New( );
136 if( dup == NULL) return NULL;
138 if( t->psz_name ) dup->psz_name = strdup( t->psz_name );
139 dup->i_flags = t->i_flags;
140 dup->i_length = t->i_length;
141 if( t->i_seekpoint > 0 )
143 dup->seekpoint = (seekpoint_t**)vlc_alloc( t->i_seekpoint, sizeof(seekpoint_t*) );
144 if( likely(dup->seekpoint) )
146 for( int i = 0; i < t->i_seekpoint; i++ )
147 dup->seekpoint[i] = vlc_seekpoint_Duplicate( t->seekpoint[i] );
148 dup->i_seekpoint = t->i_seekpoint;
152 return dup;
155 /*****************************************************************************
156 * Attachments
157 *****************************************************************************/
158 struct input_attachment_t
160 char *psz_name;
161 char *psz_mime;
162 char *psz_description;
164 size_t i_data;
165 void *p_data;
168 VLC_API void vlc_input_attachment_Release( input_attachment_t *a );
170 VLC_API input_attachment_t *vlc_input_attachment_New( const char *psz_name,
171 const char *psz_mime,
172 const char *psz_description,
173 const void *p_data,
174 size_t i_data );
176 VLC_API input_attachment_t *vlc_input_attachment_Hold( input_attachment_t *a );
179 * Input rate.
181 * It is an float used by the variable "rate" in the
182 * range [INPUT_RATE_MIN, INPUT_RATE_MAX]
183 * the default value being 1.f. It represents the ratio of playback speed to
184 * nominal speed (bigger is faster).
188 * Minimal rate value
190 #define INPUT_RATE_MIN 0.03125f
192 * Maximal rate value
194 #define INPUT_RATE_MAX 31.25f
196 /** @} */
197 #endif