forked from videolan/vlc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vlc_input.h
206 lines (174 loc) · 5.71 KB
/
vlc_input.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
/*****************************************************************************
* vlc_input.h: Core input structures
*****************************************************************************
* Copyright (C) 1999-2015 VLC authors and VideoLAN
*
* Authors: Christophe Massiot <[email protected]>
* Laurent Aimar <[email protected]>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef VLC_INPUT_H
#define VLC_INPUT_H 1
/**
* \defgroup input Input
* \ingroup vlc
* Input thread
* @{
* \file
* Input thread interface
*/
#include <vlc_es.h>
#include <vlc_meta.h>
#include <vlc_epg.h>
#include <vlc_input_item.h>
#include <vlc_vout.h>
#include <vlc_vout_osd.h>
#include <string.h>
typedef struct input_resource_t input_resource_t;
/*****************************************************************************
* Seek point: (generalisation of chapters)
*****************************************************************************/
struct seekpoint_t
{
vlc_tick_t i_time_offset;
char *psz_name;
};
static inline seekpoint_t *vlc_seekpoint_New( void )
{
seekpoint_t *point = (seekpoint_t*)malloc( sizeof( seekpoint_t ) );
if( !point )
return NULL;
point->i_time_offset = -1;
point->psz_name = NULL;
return point;
}
static inline void vlc_seekpoint_Delete( seekpoint_t *point )
{
if( !point ) return;
free( point->psz_name );
free( point );
}
static inline seekpoint_t *vlc_seekpoint_Duplicate( const seekpoint_t *src )
{
seekpoint_t *point = vlc_seekpoint_New();
if (unlikely(point == NULL))
return NULL;
if (src->psz_name)
{
point->psz_name = strdup(src->psz_name);
if (point->psz_name == NULL)
{
vlc_seekpoint_Delete(point);
return NULL;
}
}
point->i_time_offset = src->i_time_offset;
return point;
}
/*****************************************************************************
* Title:
*****************************************************************************/
/* input_title_t.i_flags field */
#define INPUT_TITLE_MENU 0x01 /* Menu title */
#define INPUT_TITLE_INTERACTIVE 0x02 /* Interactive title. Playback position has no meaning. */
#define INPUT_TITLE_MAIN 0x04 /* Main title */
typedef struct input_title_t
{
char *psz_name;
vlc_tick_t i_length; /* Length(microsecond) if known, else 0 */
unsigned i_flags; /* Is it a menu or a normal entry */
/* Title seekpoint */
int i_seekpoint;
seekpoint_t **seekpoint;
} input_title_t;
static inline input_title_t *vlc_input_title_New(void)
{
input_title_t *t = (input_title_t*)malloc( sizeof( input_title_t ) );
if( !t )
return NULL;
t->psz_name = NULL;
t->i_flags = 0;
t->i_length = 0;
t->i_seekpoint = 0;
t->seekpoint = NULL;
return t;
}
static inline void vlc_input_title_Delete( input_title_t *t )
{
int i;
if( t == NULL )
return;
free( t->psz_name );
for( i = 0; i < t->i_seekpoint; i++ )
vlc_seekpoint_Delete( t->seekpoint[i] );
free( t->seekpoint );
free( t );
}
static inline input_title_t *vlc_input_title_Duplicate( const input_title_t *t )
{
input_title_t *dup = vlc_input_title_New( );
if( dup == NULL) return NULL;
if( t->psz_name ) dup->psz_name = strdup( t->psz_name );
dup->i_flags = t->i_flags;
dup->i_length = t->i_length;
if( t->i_seekpoint > 0 )
{
dup->seekpoint = (seekpoint_t**)vlc_alloc( t->i_seekpoint, sizeof(seekpoint_t*) );
if( likely(dup->seekpoint) )
{
for( int i = 0; i < t->i_seekpoint; i++ )
dup->seekpoint[i] = vlc_seekpoint_Duplicate( t->seekpoint[i] );
dup->i_seekpoint = t->i_seekpoint;
}
}
return dup;
}
/*****************************************************************************
* Attachments
*****************************************************************************/
struct input_attachment_t
{
char *psz_name;
char *psz_mime;
char *psz_description;
size_t i_data;
void *p_data;
};
VLC_API void vlc_input_attachment_Release( input_attachment_t *a );
VLC_API input_attachment_t *vlc_input_attachment_New( const char *psz_name,
const char *psz_mime,
const char *psz_description,
const void *p_data,
size_t i_data );
VLC_API input_attachment_t *vlc_input_attachment_Hold( input_attachment_t *a );
/**
* Input rate.
*
* It is an float used by the variable "rate" in the
* range [INPUT_RATE_MIN, INPUT_RATE_MAX]
* the default value being 1.f. It represents the ratio of playback speed to
* nominal speed (bigger is faster).
*/
/**
* Minimal rate value
*/
#define INPUT_RATE_MIN 0.03125f
/**
* Maximal rate value
*/
#define INPUT_RATE_MAX 31.25f
/** @} */
#endif