VLC 4.0.0-dev
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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
42#include <string.h>
43
46/*****************************************************************************
47 * Seek point: (generalisation of chapters)
48 *****************************************************************************/
49struct seekpoint_t
55static inline seekpoint_t *vlc_seekpoint_New( void )
57 seekpoint_t *point = (seekpoint_t*)malloc( sizeof( seekpoint_t ) );
58 if( !point )
59 return NULL;
60 point->i_time_offset = -1;
61 point->psz_name = NULL;
62 return point;
63}
64
65static inline void vlc_seekpoint_Delete( seekpoint_t *point )
67 if( !point ) return;
68 free( point->psz_name );
69 free( point );
70}
71
72static inline seekpoint_t *vlc_seekpoint_Duplicate( const seekpoint_t *src )
75 if (unlikely(point == NULL))
76 return NULL;
77
78 if (src->psz_name)
79 {
80 point->psz_name = strdup(src->psz_name);
81 if (point->psz_name == NULL)
82 {
84 return NULL;
85 }
86 }
87 point->i_time_offset = src->i_time_offset;
88 return point;
89}
90
91/*****************************************************************************
92 * Title:
93 *****************************************************************************/
94
95/* input_title_t.i_flags field */
96#define INPUT_TITLE_MENU 0x01 /* Menu title */
97#define INPUT_TITLE_INTERACTIVE 0x02 /* Interactive title. Playback position has no meaning. */
98#define INPUT_TITLE_MAIN 0x04 /* Main title */
100typedef struct input_title_t
102 char *psz_name;
104 vlc_tick_t i_length; /* Length(microsecond) if known, else 0 */
106 unsigned i_flags; /* Is it a menu or a normal entry */
108 /* Title seekpoint */
109 int i_seekpoint;
113static inline input_title_t *vlc_input_title_New(void)
115 input_title_t *t = (input_title_t*)malloc( sizeof( input_title_t ) );
116 if( !t )
117 return NULL;
118
119 t->psz_name = NULL;
120 t->i_flags = 0;
121 t->i_length = 0;
122 t->i_seekpoint = 0;
123 t->seekpoint = NULL;
124
125 return t;
126}
127
128static inline void vlc_input_title_Delete( input_title_t *t )
130 int i;
131 if( t == NULL )
132 return;
133
134 free( t->psz_name );
135 for( i = 0; i < t->i_seekpoint; i++ )
137 free( t->seekpoint );
138 free( t );
139}
140
144 if( dup == NULL) return NULL;
145
146 if( t->psz_name ) dup->psz_name = strdup( t->psz_name );
147 dup->i_flags = t->i_flags;
148 dup->i_length = t->i_length;
149 if( t->i_seekpoint > 0 )
150 {
151 dup->seekpoint = (seekpoint_t**)vlc_alloc( t->i_seekpoint, sizeof(seekpoint_t*) );
152 if( likely(dup->seekpoint) )
153 {
154 for( int i = 0; i < t->i_seekpoint; i++ )
156 dup->i_seekpoint = t->i_seekpoint;
157 }
158 }
159
160 return dup;
161}
162
163/*****************************************************************************
164 * Attachments
165 *****************************************************************************/
168 char *psz_name;
169 char *psz_mime;
172 size_t i_data;
173 void *p_data;
175
177
179 const char *psz_mime,
180 const char *psz_description,
181 const void *p_data,
182 size_t i_data );
183
185
186/**
187 * Input rate.
188 *
189 * It is an float used by the variable "rate" in the
190 * range [INPUT_RATE_MIN, INPUT_RATE_MAX]
191 * the default value being 1.f. It represents the ratio of playback speed to
192 * nominal speed (bigger is faster).
193 */
194
195/**
196 * Minimal rate value
197 */
198#define INPUT_RATE_MIN 0.03125f
199/**
200 * Maximal rate value
201 */
202#define INPUT_RATE_MAX 31.25f
204/** @} */
205#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:142
static void vlc_seekpoint_Delete(seekpoint_t *point)
Definition vlc_input.h:66
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:56
static void vlc_input_title_Delete(input_title_t *t)
Definition vlc_input.h:129
static seekpoint_t * vlc_seekpoint_Duplicate(const seekpoint_t *src)
Definition vlc_input.h:73
static input_title_t * vlc_input_title_New(void)
Definition vlc_input.h:114
input_attachment_t * vlc_input_attachment_Hold(input_attachment_t *a)
Definition attachment.c:85
const char * psz_mime
Definition image.c:620
Definition vlc_input.h:168
char * psz_description
Definition vlc_input.h:171
char * psz_name
Definition vlc_input.h:169
void * p_data
Definition vlc_input.h:174
size_t i_data
Definition vlc_input.h:173
char * psz_mime
Definition vlc_input.h:170
Definition resource.c:58
Definition vlc_input.h:102
char * psz_name
Definition vlc_input.h:103
vlc_tick_t i_length
Definition vlc_input.h:105
seekpoint_t ** seekpoint
Definition vlc_input.h:111
unsigned i_flags
Definition vlc_input.h:107
int i_seekpoint
Definition vlc_input.h:110
Definition vlc_input.h:51
char * psz_name
Definition vlc_input.h:53
vlc_tick_t i_time_offset
Definition vlc_input.h:52
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.