VLC 4.0.0-dev
Loading...
Searching...
No Matches
vlc_input.h
Go to the documentation of this file.
1/*****************************************************************************
2 * vlc_input.h: Core input structures
3 *****************************************************************************
4 * Copyright (C) 1999-2015 VLC authors and VideoLAN
5 *
6 * Authors: Christophe Massiot <massiot@via.ecp.fr>
7 * Laurent Aimar <fenrir@via.ecp.fr>
8 *
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.
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 Lesser General Public License for more details.
18 *
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 *****************************************************************************/
23
24#ifndef VLC_INPUT_H
25#define VLC_INPUT_H 1
26
27/**
28 * \defgroup input Input
29 * \ingroup vlc
30 * Input thread
31 * @{
32 * \file
33 * Input thread interface
34 */
35
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>
42
43#include <string.h>
44
47/*****************************************************************************
48 * Seek point: (generalisation of chapters)
49 *****************************************************************************/
50struct seekpoint_t
56static 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;
64}
65
66static inline void vlc_seekpoint_Delete( seekpoint_t *point )
68 if( !point ) return;
69 free( point->psz_name );
70 free( point );
71}
72
73static inline seekpoint_t *vlc_seekpoint_Duplicate( const seekpoint_t *src )
76 if (unlikely(point == NULL))
77 return NULL;
78
79 if (src->psz_name)
80 {
81 point->psz_name = strdup(src->psz_name);
82 if (point->psz_name == NULL)
83 {
85 return NULL;
86 }
87 }
88 point->i_time_offset = src->i_time_offset;
89 return point;
90}
91
92/*****************************************************************************
93 * Title:
94 *****************************************************************************/
95
96/* input_title_t.i_flags field */
97#define INPUT_TITLE_MENU 0x01 /* Menu title */
98#define INPUT_TITLE_INTERACTIVE 0x02 /* Interactive title. Playback position has no meaning. */
99#define INPUT_TITLE_MAIN 0x04 /* Main title */
101typedef struct input_title_t
103 char *psz_name;
105 vlc_tick_t i_length; /* Length(microsecond) if known, else 0 */
107 unsigned i_flags; /* Is it a menu or a normal entry */
109 /* Title seekpoint */
110 int i_seekpoint;
114static inline input_title_t *vlc_input_title_New(void)
116 input_title_t *t = (input_title_t*)malloc( sizeof( input_title_t ) );
117 if( !t )
118 return NULL;
119
120 t->psz_name = NULL;
121 t->i_flags = 0;
122 t->i_length = 0;
123 t->i_seekpoint = 0;
124 t->seekpoint = NULL;
125
126 return t;
127}
128
129static inline void vlc_input_title_Delete( input_title_t *t )
131 int i;
132 if( t == NULL )
133 return;
134
135 free( t->psz_name );
136 for( i = 0; i < t->i_seekpoint; i++ )
138 free( t->seekpoint );
139 free( t );
140}
141
145 if( dup == NULL) return NULL;
146
147 if( t->psz_name ) dup->psz_name = strdup( t->psz_name );
148 dup->i_flags = t->i_flags;
149 dup->i_length = t->i_length;
150 if( t->i_seekpoint > 0 )
151 {
152 dup->seekpoint = (seekpoint_t**)vlc_alloc( t->i_seekpoint, sizeof(seekpoint_t*) );
153 if( likely(dup->seekpoint) )
154 {
155 for( int i = 0; i < t->i_seekpoint; i++ )
157 dup->i_seekpoint = t->i_seekpoint;
158 }
159 }
160
161 return dup;
162}
163
164/*****************************************************************************
165 * Attachments
166 *****************************************************************************/
169 char *psz_name;
170 char *psz_mime;
173 size_t i_data;
174 void *p_data;
176
178
180 const char *psz_mime,
181 const char *psz_description,
182 const void *p_data,
183 size_t i_data );
184
186
187/**
188 * Input rate.
189 *
190 * It is an float used by the variable "rate" in the
191 * range [INPUT_RATE_MIN, INPUT_RATE_MAX]
192 * the default value being 1.f. It represents the ratio of playback speed to
193 * nominal speed (bigger is faster).
194 */
195
196/**
197 * Minimal rate value
198 */
199#define INPUT_RATE_MIN 0.03125f
200/**
201 * Maximal rate value
202 */
203#define INPUT_RATE_MAX 31.25f
205/** @} */
206#endif
#define VLC_API
Definition fourcc_gen.c:31
#define unlikely(p)
Predicted false condition.
Definition vlc_common.h:246
#define likely(p)
Predicted true condition.
Definition vlc_common.h:237
static input_title_t * vlc_input_title_Duplicate(const input_title_t *t)
Definition vlc_input.h:143
static void vlc_seekpoint_Delete(seekpoint_t *point)
Definition vlc_input.h:67
void vlc_input_attachment_Release(input_attachment_t *a)
Definition attachment.c:40
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)
Definition attachment.c:57
static seekpoint_t * vlc_seekpoint_New(void)
Definition vlc_input.h:57
static void vlc_input_title_Delete(input_title_t *t)
Definition vlc_input.h:130
static seekpoint_t * vlc_seekpoint_Duplicate(const seekpoint_t *src)
Definition vlc_input.h:74
static input_title_t * vlc_input_title_New(void)
Definition vlc_input.h:115
input_attachment_t * vlc_input_attachment_Hold(input_attachment_t *a)
Definition attachment.c:85
const char * psz_mime
Definition image.c:619
Definition vlc_input.h:169
char * psz_description
Definition vlc_input.h:172
char * psz_name
Definition vlc_input.h:170
void * p_data
Definition vlc_input.h:175
size_t i_data
Definition vlc_input.h:174
char * psz_mime
Definition vlc_input.h:171
Definition resource.c:58
Definition vlc_input.h:103
char * psz_name
Definition vlc_input.h:104
vlc_tick_t i_length
Definition vlc_input.h:106
seekpoint_t ** seekpoint
Definition vlc_input.h:112
unsigned i_flags
Definition vlc_input.h:108
int i_seekpoint
Definition vlc_input.h:111
Definition vlc_input.h:52
char * psz_name
Definition vlc_input.h:54
vlc_tick_t i_time_offset
Definition vlc_input.h:53
const char * psz_name
Definition text_style.c:33
This file is a collection of common definitions and types.
static void * vlc_alloc(size_t count, size_t size)
Definition vlc_common.h:1071
This file defines functions and structures for storing dvb epg information.
This file defines the elementary streams format types.
char * strdup(const char *)
This file defines functions, structures and enums for input items in vlc.
This file defines functions and structures for stream meta-data in vlc.
int64_t vlc_tick_t
High precision date or time interval.
Definition vlc_tick.h:48
Video output thread interface.
Overlay text and widgets.