VLC 4.0.0-dev
vlc_stream.h
Go to the documentation of this file.
1/*****************************************************************************
2 * vlc_stream.h: Stream (between access and demux) descriptor and methods
3 *****************************************************************************
4 * Copyright (C) 1999-2004 VLC authors and VideoLAN
5 *
6 * Authors: Laurent Aimar <fenrir@via.ecp.fr>
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU Lesser General Public License as published by
10 * the Free Software Foundation; either version 2.1 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public License
19 * along with this program; if not, write to the Free Software Foundation,
20 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
21 *****************************************************************************/
22
23#ifndef VLC_STREAM_H
24#define VLC_STREAM_H 1
25
26#include <vlc_tick.h>
27#include <vlc_block.h>
28#include <vlc_input.h>
29
30# ifdef __cplusplus
31extern "C" {
32# endif
33
34/**
35 * \defgroup stream Stream
36 * \ingroup input
37 * Buffered input byte streams
38 * @{
39 * \file
40 * Byte streams and byte stream filter modules interface
41 */
42
44 /* Cannot fail */
45 bool (*can_seek)(stream_t *);
46 bool (*can_pause)(stream_t *);
50 int (*get_signal)(stream_t *, double *, double *);
52 int (*get_type)(stream_t *, int *);
54 int (*set_pause_state)(stream_t *, bool);
55 int (*set_seek_point)(stream_t *, int);
56 int (*set_title)(stream_t *, int);
58 void (*close)(stream_t *);
60 union {
61 struct {
62 bool (*can_fastseek)(stream_t *);
64 ssize_t (*read)(stream_t *, void *buf, size_t len);
65 block_t *(*block)(stream_t *, bool *restrict eof);
67 int (*seek)(stream_t *, uint64_t);
69 int (*get_title)(stream_t *, unsigned *);
70 int (*get_seekpoint)(stream_t *, unsigned *);
71 int (*get_size)(stream_t *, uint64_t *);
72 int (*get_title_info)(stream_t *, input_title_t ***, int *);
73 int (*get_content_type)(stream_t *, char **);
74 int (*get_tags)(stream_t *, const block_t **);
75 int (*get_private_id_state)(stream_t *, int, bool *);
77 int (*set_record_state)(stream_t *, bool, const char *, const char *);
78 int (*set_private_id_state)(stream_t *, int, bool);
79 int (*set_private_id_ca)(stream_t *, void *);
81 struct {
82 bool (*can_record)(demux_t *);
85 int (*demux)(demux_t *);
87
90 int (*get_title)(demux_t *, int *);
91 int (*get_seekpoint)(demux_t *, int *);
92 double (*get_position)(demux_t *);
96 int (*get_title_info)(demux_t *, input_title_t ***, int *, int *, int *);
97 int (*get_fps)(demux_t *, double *);
100 int (*set_position)(demux_t *, double, bool);
101 int (*set_time)(demux_t *, vlc_tick_t, bool);
103 int (*set_record_state)(demux_t *, bool, const char *);
104 int (*set_rate)(demux_t *, float *);
107 int (*set_group_list)(demux_t *, size_t, const int *);
108 int (*set_es)(demux_t *, int);
109 int (*set_es_list)(demux_t *, size_t, const int *);
111 int (*nav_activate)(demux_t *);
112 int (*nav_up)(demux_t *);
113 int (*nav_down)(demux_t *);
114 int (*nav_left)(demux_t *);
117 int (*nav_menu)(demux_t *);
119 int (*filter_enable)(demux_t *);
122 int (*test_and_clear_flags)(demux_t *, unsigned *);
124 };
125};
126
127/**
128 * stream_t definition
129 */
130
131struct stream_t
133 struct vlc_object_t obj;
135 char *psz_name;
136 char *psz_url; /**< Full URL or MRL (can be NULL) */
137 const char *psz_location; /**< Location (URL with the scheme stripped) */
138 char *psz_filepath; /**< Local file path (if applicable) */
139 bool b_preparsing; /**< True if this access is used to preparse */
140 input_item_t *p_input_item;/**< Input item (can be NULL) */
142 /**
143 * Input stream
144 *
145 * Depending on the module capability:
146 * - "stream filter" or "demux": input byte stream (not NULL)
147 * - "access": a NULL pointer
148 * - "demux_filter": upstream demuxer or demux filter
149 */
150 stream_t *s;
152 /* es output */
153 es_out_t *out; /* our p_es_out */
155 /**
156 * Read data.
157 *
158 * Callback to read data from the stream into a caller-supplied buffer.
159 *
160 * This is the legacy implementor, using \ref vlc_stream_operations
161 * should be prefered.
162 *
163 * This may be NULL if the stream is actually a directory rather than a
164 * byte stream, or if \ref stream_t.pf_block is non-NULL.
165 *
166 * \param buf buffer to read data into
167 * \param len buffer length (in bytes)
168 *
169 * \retval -1 no data available yet
170 * \retval 0 end of stream (incl. fatal error)
171 * \retval positive number of bytes read (no more than len)
172 */
173 ssize_t (*pf_read)(stream_t *, void *buf, size_t len);
175 /**
176 * Read data block.
177 *
178 * Callback to read a block of data. The data is read into a block of
179 * memory allocated by the stream. For some streams, data can be read more
180 * efficiently in block of a certain size, and/or using a custom allocator
181 * for buffers. In such case, this callback should be provided instead of
182 * \ref stream_t.pf_read; otherwise, this should be NULL.
183 *
184 * This is the legacy implementor, using \ref vlc_stream_operations
185 * should be prefered.
186 *
187 * \param eof storage space for end-of-stream flag [OUT]
188 * (*eof is always false when invoking pf_block(); pf_block() should set
189 * *eof to true if it detects the end of the stream)
190 *
191 * \return a data block,
192 * NULL if no data available yet, on error and at end-of-stream
193 */
194 block_t *(*pf_block)(stream_t *, bool *restrict eof);
196 /**
197 * Read directory.
198 *
199 * Callback to fill an item node from a directory
200 * (see doc/browsing.txt for details).
201 *
202 * This is the legacy implementor, using \ref vlc_stream_operations
203 * should be prefered.
204 *
205 * NULL if the stream is not a directory.
206 */
209 int (*pf_demux)(stream_t *);
211 /**
212 * Seek.
213 *
214 * Callback to set the stream pointer (in bytes from start).
215 *
216 * This is the legacy implementor, using \ref vlc_stream_operations
217 * should be prefered.
218 *
219 * May be NULL if seeking is not supported.
220 */
221 int (*pf_seek)(stream_t *, uint64_t);
223 /**
224 * Stream control.
225 *
226 * Legacy way of implementing callbacks.
227 * \ref vlc_stream_operations should be prefered.
228 *
229 * \see stream_query_e
230 */
231 int (*pf_control)(stream_t *, int i_query, va_list);
233 /**
234 * Implementation of the Stream/Demux API.
235 *
236 * If NULL all operations will be redirected to \ref stream_t.pf_control.
237 */
238 const struct vlc_stream_operations *ops;
240 /**
241 * Private data pointer
242 */
243 void *p_sys;
245
246/**
247 * Possible commands to send to vlc_stream_Control() and vlc_stream_vaControl()
248 */
251 /* capabilities */
252 STREAM_CAN_SEEK, /**< arg1= bool * res=cannot fail*/
253 STREAM_CAN_FASTSEEK, /**< arg1= bool * res=cannot fail*/
254 STREAM_CAN_PAUSE, /**< arg1= bool * res=cannot fail*/
255 STREAM_CAN_CONTROL_PACE, /**< arg1= bool * res=cannot fail*/
256 /* */
257 STREAM_GET_SIZE=6, /**< arg1= uint64_t * res=can fail */
259 /* */
260 STREAM_GET_PTS_DELAY = 0x101,/**< arg1= vlc_tick_t* res=cannot fail */
261 STREAM_GET_TITLE_INFO, /**< arg1=input_title_t*** arg2=int* res=can fail */
262 STREAM_GET_TITLE, /**< arg1=unsigned * res=can fail */
263 STREAM_GET_SEEKPOINT, /**< arg1=unsigned * res=can fail */
264 STREAM_GET_META, /**< arg1= vlc_meta_t * res=can fail */
265 STREAM_GET_CONTENT_TYPE, /**< arg1= char ** res=can fail */
266 STREAM_GET_SIGNAL, /**< arg1=double *pf_quality, arg2=double *pf_strength res=can fail */
267 STREAM_GET_TAGS, /**< arg1=const block_t ** res=can fail */
268 STREAM_GET_TYPE, /**< arg1=int* res=can fail */
270 STREAM_SET_PAUSE_STATE = 0x200, /**< arg1= bool res=can fail */
271 STREAM_SET_TITLE, /**< arg1= int res=can fail */
272 STREAM_SET_SEEKPOINT, /**< arg1= int res=can fail */
274 /* XXX only data read through vlc_stream_Read/Block will be recorded */
275 STREAM_SET_RECORD_STATE, /**< arg1=bool, arg2=const char *dir_path (if arg1 is true)
276 arg3=const char *psz_ext (if arg1 is true) res=can fail */
278 STREAM_SET_PRIVATE_ID_STATE = 0x1000, /* arg1= int i_private_data, bool b_selected res=can fail */
279 STREAM_SET_PRIVATE_ID_CA, /* arg1= void * */
280 STREAM_GET_PRIVATE_ID_STATE, /* arg1=int i_private_data arg2=bool * res=can fail */
282
283/**
284 * Reads data from a byte stream.
285 *
286 * This function always waits for the requested number of bytes, unless a fatal
287 * error is encountered or the end-of-stream is reached first.
288 *
289 * If the buffer is NULL, data is skipped instead of read. This is effectively
290 * a relative forward seek, but it works even on non-seekable streams.
291 *
292 * \param buf start of buffer to read data into [OUT]
293 * \param len number of bytes to read
294 * \return the number of bytes read or a negative value on error.
295 */
296VLC_API ssize_t vlc_stream_Read(stream_t *, void *buf, size_t len) VLC_USED;
297
298/**
299 * Reads partial data from a byte stream.
300 *
301 * This function waits until some data is available for reading from the
302 * stream, a fatal error is encountered or the end-of-stream is reached.
303 *
304 * Unlike vlc_stream_Read(), this function does not wait for the full requested
305 * bytes count. It can return a short count even before the end of the stream
306 * and in the absence of any error.
307 *
308 * \param buf start of buffer to read data into [OUT]
309 * \param len buffer size (maximum number of bytes to read)
310 * \return the number of bytes read, 0 on end of stream or -1 if no data available
311 */
312VLC_API ssize_t vlc_stream_ReadPartial(stream_t *, void *buf, size_t len)
314
315/**
316 * Peeks at data from a byte stream.
317 *
318 * This function buffers for the requested number of bytes, waiting if
319 * necessary. Then it stores a pointer to the buffer. Unlike vlc_stream_Read()
320 * or vlc_stream_Block(), this function does not modify the stream read offset.
321 *
322 * \note
323 * The buffer remains valid until the next read/peek or seek operation on the
324 * same stream. In case of error, the buffer address is undefined.
325 *
326 * \param bufp storage space for the buffer address [OUT]
327 * \param len number of bytes to peek
328 * \return the number of bytes actually available (shorter than requested if
329 * the end-of-stream is reached), or a negative value on error.
330 */
331VLC_API ssize_t vlc_stream_Peek(stream_t *, const uint8_t **, size_t) VLC_USED;
333/**
334 * Reads a data block from a byte stream.
335 *
336 * This function dequeues the next block of data from the byte stream. The
337 * byte stream back-end decides on the size of the block; the caller cannot
338 * make any assumption about it.
339 *
340 * The function might also return NULL spuriously - this does not necessarily
341 * imply that the stream is ended nor that it has encountered a nonrecoverable
342 * error.
343 *
344 * This function should be used instead of vlc_stream_Read() or
345 * vlc_stream_Peek() when the caller can handle reads of any size.
346 *
347 * \return either a data block or NULL
348 */
350
351/**
352 * Tells the current stream position.
353 *
354 * This function tells the current read offset (in bytes) from the start of
355 * the start of the stream.
356 * @note The read offset may be larger than the stream size, either because of
357 * a seek past the end, or because the stream shrank asynchronously.
358 *
359 * @return the byte offset from the beginning of the stream (cannot fail)
360 */
361VLC_API uint64_t vlc_stream_Tell(const stream_t *) VLC_USED;
362
363/**
364 * Checks for end of stream.
365 *
366 * Checks if the last attempt to reads data from the stream encountered the
367 * end of stream before the attempt could be fully satisfied.
368 * The value is initially false, and is reset to false by vlc_stream_Seek().
369 *
370 * \note The function can return false even though the current stream position
371 * is equal to the stream size. It will return true after the following attempt
372 * to read more than zero bytes.
373 *
374 * \note It might be possible to read after the end of the stream.
375 * It implies the size of the stream increased asynchronously in the mean time.
376 * Streams of most types cannot trigger such a case,
377 * but regular local files notably can.
378 *
379 * \note In principles, the stream size should match the stream offset when
380 * the end-of-stream is reached. But that rule is not enforced; it is entirely
381 * dependent on the underlying implementation of the stream.
382 */
384
385/**
386 * Sets the current stream position.
387 *
388 * This function changes the read offset within a stream, if the stream
389 * supports seeking. In case of error, the read offset is not changed.
390 *
391 * @note It is possible (but not useful) to seek past the end of a stream.
392 *
393 * @param offset byte offset from the beginning of the stream
394 * @return zero on success, a negative value on error
395 */
396VLC_API int vlc_stream_Seek(stream_t *, uint64_t offset) VLC_USED;
397
398VLC_API int vlc_stream_vaControl(stream_t *s, int query, va_list args);
399
400static inline int vlc_stream_Control(stream_t *s, int query, ...)
402 va_list ap;
403 int ret;
404
405 va_start(ap, query);
406 ret = vlc_stream_vaControl(s, query, ap);
407 va_end(ap);
408 return ret;
409}
410
413
414/**
415 * Reads a directory.
416 *
417 * This function fills an input item node with any and all the items within
418 * a directory. The behaviour is undefined if the stream is not a directory.
419 *
420 * \param s directory object to read from
421 * \param node node to store the items into
422 * \return VLC_SUCCESS on success
423 */
425
426/**
427 * Closes a byte stream.
428 * \param s byte stream to close
429 */
431
433
434VLC_USED static inline bool vlc_stream_CanSeek(stream_t *s)
436 bool can_seek = false;
438 return can_seek;
439}
440
441VLC_USED static inline bool vlc_stream_CanFastSeek(stream_t *s)
443 bool can_fast_seek = false;
444 vlc_stream_Control(s, STREAM_CAN_FASTSEEK, &can_fast_seek);
445 return can_fast_seek;
446}
447
448VLC_USED static inline bool vlc_stream_CanPause(stream_t *s)
450 bool can_pause = false;
452 return can_pause;
453}
454
455VLC_USED static inline bool vlc_stream_CanPace(stream_t *s)
457 bool can_control_pace = false;
459 return can_control_pace;
460}
461
462VLC_USED static inline int vlc_stream_GetPtsDelay(stream_t *s, vlc_tick_t *pts_delay)
464 return vlc_stream_Control(s, STREAM_GET_PTS_DELAY, pts_delay);
465}
466
467VLC_USED static inline int vlc_stream_GetSeekpoint(stream_t *s, unsigned *seekpoint)
469 return vlc_stream_Control(s, STREAM_GET_SEEKPOINT, seekpoint);
470}
471
472VLC_USED static inline int vlc_stream_GetSignal(stream_t *s, double *quality, double *strength)
474 return vlc_stream_Control(s, STREAM_GET_SIGNAL, quality, strength);
475}
476
477VLC_USED static inline int vlc_stream_GetTitle(stream_t *s, unsigned *title)
479 return vlc_stream_Control(s, STREAM_GET_TITLE, title);
480}
481
482VLC_USED static inline int vlc_stream_GetMeta(stream_t *s, vlc_meta_t *meta)
484 return vlc_stream_Control(s, STREAM_GET_META, meta);
485}
486
487VLC_USED static inline int vlc_stream_GetType(stream_t *s, int *type)
489 return vlc_stream_Control(s, STREAM_GET_TYPE, type);
490}
491
492/**
493 * Get the size of the stream.
494 */
495VLC_USED static inline int vlc_stream_GetSize(stream_t *s, uint64_t *size)
497 return vlc_stream_Control(s, STREAM_GET_SIZE, size);
498}
499
500VLC_USED static inline int vlc_stream_GetTitleInfo(stream_t *s, input_title_t ***title_info, int *size)
502 return vlc_stream_Control(s, STREAM_GET_TITLE_INFO, title_info, size);
503}
504
505VLC_USED static inline int vlc_stream_GetContentType(stream_t *s, char **content_type)
507 return vlc_stream_Control(s, STREAM_GET_CONTENT_TYPE, content_type);
508}
509
510VLC_USED static inline int vlc_stream_GetTags(stream_t *s, const block_t **tags)
512 return vlc_stream_Control(s, STREAM_GET_TAGS, tags);
513}
514
515VLC_USED static inline int vlc_stream_GetPrivateIdState(stream_t *s, int priv_id, bool *state)
518}
519
520VLC_USED static inline int vlc_stream_SetPauseState(stream_t *s, bool pause_state)
522 return vlc_stream_Control(s, STREAM_SET_PAUSE_STATE, pause_state);
523}
524
525VLC_USED static inline int vlc_stream_SetSeekPoint(stream_t *s, int seekpoint)
527 return vlc_stream_Control(s, STREAM_SET_SEEKPOINT, seekpoint);
528}
529
530VLC_USED static inline int vlc_stream_SetTitle(stream_t *s, int title)
532 return vlc_stream_Control(s, STREAM_SET_TITLE, title);
533}
534
535VLC_USED static inline int vlc_stream_SetRecordState(stream_t *s, bool record_state, const char *dir_path, const char *ext)
537 return vlc_stream_Control(s, STREAM_SET_RECORD_STATE, record_state, dir_path, ext);
538}
539
540VLC_USED static inline int vlc_stream_SetPrivateIdState(stream_t *s, int priv_id, bool state)
543}
544
545/**
546 * Set the private ID ca.
547 *
548 * The ca arg is of type `en50221_capmt_info_t`.
549 */
550VLC_USED static inline int vlc_stream_SetPrivateIdCa(stream_t *s, void *ca)
553}
554
555static inline int64_t stream_Size( stream_t *s )
557 uint64_t i_pos;
558
559 if( vlc_stream_GetSize( s, &i_pos ) )
560 return 0;
561 if( i_pos >> 62 )
562 return (int64_t)1 << 62;
563 return i_pos;
564}
565
567static inline bool stream_HasExtension( stream_t *s, const char *extension )
569 const char *name = (s->psz_filepath != NULL) ? s->psz_filepath
570 : s->psz_url;
571 const char *ext = strrchr( name, '.' );
572 return ext != NULL && !strcasecmp( ext, extension );
573}
574
575/**
576 * Get the Content-Type of a stream, or NULL if unknown.
577 * Result must be free()'d.
578 */
579static inline char *stream_ContentType( stream_t *s )
581 char *res;
582 if (vlc_stream_GetContentType(s, &res))
583 return NULL;
584 return res;
585}
586
587/**
588 * Get the mime-type of a stream
589 *
590 * \warning the returned resource is to be freed by the caller
591 * \return the mime-type, or `NULL` if unknown
592 **/
594static inline char *stream_MimeType( stream_t *s )
596 char* mime_type = stream_ContentType( s );
597
598 if( mime_type ) /* strip parameters */
599 mime_type[strcspn( mime_type, " ;" )] = '\0';
600
601 return mime_type;
602}
603
604/**
605 * Checks for a MIME type.
606 *
607 * Checks if the stream has a specific MIME type.
608 */
610static inline bool stream_IsMimeType(stream_t *s, const char *type)
612 char *mime = stream_MimeType(s);
613 if (mime == NULL)
614 return false;
615
616 bool ok = !strcasecmp(mime, type);
617 free(mime);
618 return ok;
619}
620
621/**
622 * Create a stream from a memory buffer.
623 *
624 * \param obj parent VLC object
625 * \param base start address of the memory buffer to read from
626 * \param size size in bytes of the memory buffer
627 * \param preserve if false, free(base) will be called when the stream is
628 * destroyed; if true, the memory buffer is preserved
629 */
631 size_t size, bool preserve) VLC_USED;
632#define vlc_stream_MemoryNew(a, b, c, d) \
633 vlc_stream_MemoryNew(VLC_OBJECT(a), b, c, d)
634
635/**
636 * Create a stream_t reading from a URL.
637 * You must delete it using vlc_stream_Delete.
638 */
639VLC_API stream_t * vlc_stream_NewURL(vlc_object_t *obj, const char *url)
641#define vlc_stream_NewURL(a, b) vlc_stream_NewURL(VLC_OBJECT(a), b)
643/**
644 * \defgroup stream_fifo FIFO stream
645 * In-memory anonymous pipe
646 @{
647 */
648
651/**
652 * Creates a FIFO stream.
653 *
654 * Creates a non-seekable byte stream object whose byte stream is generated
655 * by another thread in the process. This is the LibVLC equivalent of an
656 * anonymous pipe/FIFO.
657 *
658 * On the reader side, the normal stream functions are used,
659 * e.g. vlc_stream_Read() and vlc_stream_Delete().
660 *
661 * The created stream object is automatically destroyed when both the reader
662 * and the writer sides have been closed, with vlc_stream_Delete() and
663 * vlc_stream_fifo_Close() respectively.
664 *
665 * \param parent parent VLC object for the stream
666 * \param reader location to store read side stream pointer [OUT]
667 * \return a FIFO stream object or NULL on memory error.
668 */
670 stream_t **reader);
671
672/**
673 * Writes a block to a FIFO stream.
674 *
675 * \param s FIFO stream created by vlc_stream_fifo_New()
676 * \param block data block to write to the stream
677 * \return 0 on success. -1 if the reader end has already been closed
678 * (errno is then set to EPIPE, and the block is deleted).
679 *
680 * \bug No congestion control is performed. If the reader end is not keeping
681 * up with the writer end, buffers will accumulate in memory.
682 */
684
685/**
686 * Writes data to a FIFO stream.
687 *
688 * This is a convenience helper for vlc_stream_fifo_Queue().
689 * \param s FIFO stream created by vlc_stream_fifo_New()
690 * \param buf start address of data to write
691 * \param len length of data to write in bytes
692 * \return len on success, or -1 on error (errno is set accordingly)
693 */
694VLC_API ssize_t vlc_stream_fifo_Write(vlc_stream_fifo_t *s, const void *buf,
695 size_t len);
696
697/**
698 * Terminates a FIFO stream.
699 *
700 * Marks the end of the FIFO stream and releases any underlying resources.
701 * \param s FIFO stream created by vlc_stream_fifo_New()
702 */
704
705/**
706 * @}
707 */
708
709/**
710 * Try to add a stream filter to an open stream.
711 * @return New stream to use, or NULL if the filter could not be added.
712 **/
713VLC_API stream_t* vlc_stream_FilterNew( stream_t *p_source, const char *psz_stream_filter );
714
715/**
716 * @}
717 */
718
719# ifdef __cplusplus
720}
721# endif
722
723#endif
#define VLC_USED
Definition: fourcc_gen.c:32
#define VLC_API
Definition: fourcc_gen.c:31
void vlc_stream_fifo_Close(vlc_stream_fifo_t *s)
Terminates a FIFO stream.
Definition: stream_fifo.c:162
ssize_t vlc_stream_fifo_Write(vlc_stream_fifo_t *s, const void *buf, size_t len)
Writes data to a FIFO stream.
Definition: stream_fifo.c:151
vlc_stream_fifo_t * vlc_stream_fifo_New(vlc_object_t *parent, stream_t **reader)
Creates a FIFO stream.
Definition: stream_fifo.c:106
int vlc_stream_fifo_Queue(vlc_stream_fifo_t *s, block_t *block)
Writes a block to a FIFO stream.
Definition: stream_fifo.c:132
static bool stream_IsMimeType(stream_t *s, const char *type)
Checks for a MIME type.
Definition: vlc_stream.h:611
static int vlc_stream_GetContentType(stream_t *s, char **content_type)
Definition: vlc_stream.h:506
block_t * vlc_stream_Block(stream_t *s, size_t)
Read data into a block.
Definition: stream.c:906
uint64_t vlc_stream_Tell(const stream_t *)
Tells the current stream position.
Definition: stream.c:625
static int vlc_stream_SetPauseState(stream_t *s, bool pause_state)
Definition: vlc_stream.h:521
static int vlc_stream_GetSeekpoint(stream_t *s, unsigned *seekpoint)
Definition: vlc_stream.h:468
ssize_t vlc_stream_Peek(stream_t *, const uint8_t **, size_t)
Peeks at data from a byte stream.
void vlc_stream_Delete(stream_t *s)
Closes a byte stream.
Definition: stream.c:143
static int vlc_stream_GetSignal(stream_t *s, double *quality, double *strength)
Definition: vlc_stream.h:473
static int vlc_stream_GetMeta(stream_t *s, vlc_meta_t *meta)
Definition: vlc_stream.h:483
stream_t * vlc_stream_FilterNew(stream_t *p_source, const char *psz_stream_filter)
Try to add a stream filter to an open stream.
Definition: stream_filter.c:50
char * vlc_stream_ReadLine(stream_t *)
Definition: stream.c:200
static int64_t stream_Size(stream_t *s)
Definition: vlc_stream.h:556
static bool vlc_stream_CanSeek(stream_t *s)
Definition: vlc_stream.h:435
int vlc_stream_Seek(stream_t *, uint64_t offset)
Sets the current stream position.
Definition: stream.c:639
static bool vlc_stream_CanPause(stream_t *s)
Definition: vlc_stream.h:449
block_t * vlc_stream_ReadBlock(stream_t *)
Reads a data block from a byte stream.
Definition: stream.c:575
ssize_t vlc_stream_ReadPartial(stream_t *, void *buf, size_t len)
Reads partial data from a byte stream.
Definition: stream.c:477
static char * stream_MimeType(stream_t *s)
Get the mime-type of a stream.
Definition: vlc_stream.h:595
static bool vlc_stream_CanPace(stream_t *s)
Definition: vlc_stream.h:456
static int vlc_stream_SetRecordState(stream_t *s, bool record_state, const char *dir_path, const char *ext)
Definition: vlc_stream.h:536
static int vlc_stream_SetTitle(stream_t *s, int title)
Definition: vlc_stream.h:531
stream_t * vlc_stream_CommonNew(vlc_object_t *, void(*)(stream_t *))
Definition: stream.c:118
bool vlc_stream_Eof(const stream_t *)
Checks for end of stream.
Definition: stream.c:632
static int vlc_stream_GetType(stream_t *s, int *type)
Definition: vlc_stream.h:488
static int vlc_stream_SetPrivateIdState(stream_t *s, int priv_id, bool state)
Definition: vlc_stream.h:541
static int vlc_stream_Control(stream_t *s, int query,...)
Definition: vlc_stream.h:401
static bool stream_HasExtension(stream_t *s, const char *extension)
Definition: vlc_stream.h:568
static int vlc_stream_SetPrivateIdCa(stream_t *s, void *ca)
Set the private ID ca.
Definition: vlc_stream.h:551
static int vlc_stream_GetTitle(stream_t *s, unsigned *title)
Definition: vlc_stream.h:478
static int vlc_stream_GetPtsDelay(stream_t *s, vlc_tick_t *pts_delay)
Definition: vlc_stream.h:463
static int vlc_stream_GetTags(stream_t *s, const block_t **tags)
Definition: vlc_stream.h:511
static int vlc_stream_GetTitleInfo(stream_t *s, input_title_t ***title_info, int *size)
Definition: vlc_stream.h:501
stream_query_e
Possible commands to send to vlc_stream_Control() and vlc_stream_vaControl()
Definition: vlc_stream.h:251
static int vlc_stream_GetSize(stream_t *s, uint64_t *size)
Get the size of the stream.
Definition: vlc_stream.h:496
int vlc_stream_ReadDir(stream_t *s, input_item_node_t *node)
Reads a directory.
Definition: stream.c:926
ssize_t vlc_stream_Read(stream_t *, void *buf, size_t len)
Reads data from a byte stream.
Definition: stream.c:499
static int vlc_stream_GetPrivateIdState(stream_t *s, int priv_id, bool *state)
Definition: vlc_stream.h:516
static int vlc_stream_SetSeekPoint(stream_t *s, int seekpoint)
Definition: vlc_stream.h:526
static bool vlc_stream_CanFastSeek(stream_t *s)
Definition: vlc_stream.h:442
#define vlc_stream_MemoryNew(a, b, c, d)
Definition: vlc_stream.h:633
int vlc_stream_vaControl(stream_t *s, int query, va_list args)
Use to control the "stream_t *".
Definition: stream.c:706
static char * stream_ContentType(stream_t *s)
Get the Content-Type of a stream, or NULL if unknown.
Definition: vlc_stream.h:580
#define vlc_stream_NewURL(a, b)
Definition: vlc_stream.h:642
@ STREAM_GET_PRIVATE_ID_STATE
Definition: vlc_stream.h:281
@ STREAM_SET_PRIVATE_ID_CA
Definition: vlc_stream.h:280
@ STREAM_GET_TITLE
arg1=unsigned * res=can fail
Definition: vlc_stream.h:263
@ STREAM_CAN_CONTROL_PACE
arg1= bool * res=cannot fail
Definition: vlc_stream.h:256
@ STREAM_SET_PAUSE_STATE
arg1= bool res=can fail
Definition: vlc_stream.h:271
@ STREAM_SET_RECORD_STATE
arg1=bool, arg2=const char *dir_path (if arg1 is true) arg3=const char *psz_ext (if arg1 is true) res...
Definition: vlc_stream.h:276
@ STREAM_GET_PTS_DELAY
arg1= vlc_tick_t* res=cannot fail
Definition: vlc_stream.h:261
@ STREAM_GET_TAGS
arg1=const block_t ** res=can fail
Definition: vlc_stream.h:268
@ STREAM_GET_CONTENT_TYPE
arg1= char ** res=can fail
Definition: vlc_stream.h:266
@ STREAM_CAN_FASTSEEK
arg1= bool * res=cannot fail
Definition: vlc_stream.h:254
@ STREAM_CAN_PAUSE
arg1= bool * res=cannot fail
Definition: vlc_stream.h:255
@ STREAM_SET_TITLE
arg1= int res=can fail
Definition: vlc_stream.h:272
@ STREAM_CAN_SEEK
arg1= bool * res=cannot fail
Definition: vlc_stream.h:253
@ STREAM_GET_SIGNAL
arg1=double *pf_quality, arg2=double *pf_strength res=can fail
Definition: vlc_stream.h:267
@ STREAM_GET_TYPE
arg1=int* res=can fail
Definition: vlc_stream.h:269
@ STREAM_GET_SEEKPOINT
arg1=unsigned * res=can fail
Definition: vlc_stream.h:264
@ STREAM_GET_SIZE
arg1= uint64_t * res=can fail
Definition: vlc_stream.h:258
@ STREAM_SET_PRIVATE_ID_STATE
Definition: vlc_stream.h:279
@ STREAM_GET_TITLE_INFO
arg1=input_title_t*** arg2=int* res=can fail
Definition: vlc_stream.h:262
@ STREAM_GET_META
arg1= vlc_meta_t * res=can fail
Definition: vlc_stream.h:265
@ STREAM_SET_SEEKPOINT
arg1= int res=can fail
Definition: vlc_stream.h:273
const char name[16]
Definition: httpd.c:1281
static thread_local struct @81 state
Definition: vlc_es_out.h:148
Definition: vlc_input.h:161
Definition: vlc_input_item.h:205
Describes an input and is used to spawn input_thread_t objects.
Definition: vlc_input_item.h:89
Definition: vlc_input.h:95
stream_t definition
Definition: vlc_stream.h:133
bool b_preparsing
True if this access is used to preparse.
Definition: vlc_stream.h:140
input_item_t * p_input_item
Input item (can be NULL)
Definition: vlc_stream.h:141
char * psz_name
Definition: vlc_stream.h:136
es_out_t * out
Definition: vlc_stream.h:154
int(* pf_control)(stream_t *, int i_query, va_list)
Stream control.
Definition: vlc_stream.h:232
int(* pf_seek)(stream_t *, uint64_t)
Seek.
Definition: vlc_stream.h:222
stream_t * s
Input stream.
Definition: vlc_stream.h:151
const char * psz_location
Location (URL with the scheme stripped)
Definition: vlc_stream.h:138
char * psz_url
Full URL or MRL (can be NULL)
Definition: vlc_stream.h:137
struct vlc_object_t obj
Definition: vlc_stream.h:134
void * p_sys
Private data pointer.
Definition: vlc_stream.h:244
char * psz_filepath
Local file path (if applicable)
Definition: vlc_stream.h:139
ssize_t(* pf_read)(stream_t *, void *buf, size_t len)
Read data.
Definition: vlc_stream.h:174
int(* pf_demux)(stream_t *)
Definition: vlc_stream.h:210
int(* pf_readdir)(stream_t *, input_item_node_t *)
Read directory.
Definition: vlc_stream.h:208
const struct vlc_stream_operations * ops
Implementation of the Stream/Demux API.
Definition: vlc_stream.h:239
Definition: vlc_frame.h:123
Definition: meta.c:40
VLC object common members.
Definition: vlc_objects.h:45
Definition: stream_fifo.c:37
Definition: vlc_stream.h:44
int(* get_meta)(stream_t *, vlc_meta_t *)
Definition: vlc_stream.h:52
int(* nav_up)(demux_t *)
Definition: vlc_stream.h:113
int(* get_title_info)(stream_t *, input_title_t ***, int *)
Definition: vlc_stream.h:73
bool(* has_unsupported_meta)(demux_t *)
Definition: vlc_stream.h:89
bool(* can_fastseek)(stream_t *)
Definition: vlc_stream.h:63
int(* get_seekpoint)(stream_t *, unsigned *)
Definition: vlc_stream.h:71
int(* get_tags)(stream_t *, const block_t **)
Definition: vlc_stream.h:75
int(* filter_disable)(demux_t *)
Definition: vlc_stream.h:121
int(* set_private_id_ca)(stream_t *, void *)
Definition: vlc_stream.h:80
bool(* can_control_rate)(demux_t *)
Definition: vlc_stream.h:84
int(* get_private_id_state)(stream_t *, int, bool *)
Definition: vlc_stream.h:76
int(* set_time)(demux_t *, vlc_tick_t, bool)
Definition: vlc_stream.h:102
int(* get_attachments)(demux_t *, input_attachment_t ***)
Definition: vlc_stream.h:99
int(* set_group_all)(demux_t *)
Definition: vlc_stream.h:107
int(* set_pause_state)(stream_t *, bool)
Definition: vlc_stream.h:55
int(* seek)(stream_t *, uint64_t)
Definition: vlc_stream.h:68
int(* get_normal_time)(demux_t *, vlc_tick_t *)
Definition: vlc_stream.h:96
bool(* can_pause)(stream_t *)
Definition: vlc_stream.h:47
int(* nav_activate)(demux_t *)
Definition: vlc_stream.h:112
int(* set_group_default)(demux_t *)
Definition: vlc_stream.h:106
double(* get_position)(demux_t *)
Definition: vlc_stream.h:93
int(* set_position)(demux_t *, double, bool)
Definition: vlc_stream.h:101
bool(* can_record)(demux_t *)
Definition: vlc_stream.h:83
int(* get_pts_delay)(stream_t *, vlc_tick_t *)
Definition: vlc_stream.h:50
int(* set_es)(demux_t *, int)
Definition: vlc_stream.h:109
int(* set_private_id_state)(stream_t *, int, bool)
Definition: vlc_stream.h:79
int(* nav_menu)(demux_t *)
Definition: vlc_stream.h:118
int(* get_signal)(stream_t *, double *, double *)
Definition: vlc_stream.h:51
int(* set_group_list)(demux_t *, size_t, const int *)
Definition: vlc_stream.h:108
int(* get_title)(stream_t *, unsigned *)
Definition: vlc_stream.h:70
int(* nav_left)(demux_t *)
Definition: vlc_stream.h:115
bool(* can_seek)(stream_t *)
Definition: vlc_stream.h:46
int(* demux)(demux_t *)
Definition: vlc_stream.h:86
int(* set_es_list)(demux_t *, size_t, const int *)
Definition: vlc_stream.h:110
int(* set_next_demux_time)(demux_t *, vlc_tick_t)
Definition: vlc_stream.h:103
int(* get_size)(stream_t *, uint64_t *)
Definition: vlc_stream.h:72
ssize_t(* read)(stream_t *, void *buf, size_t len)
Definition: vlc_stream.h:65
int(* get_content_type)(stream_t *, char **)
Definition: vlc_stream.h:74
int(* nav_right)(demux_t *)
Definition: vlc_stream.h:116
int(* get_type)(stream_t *, int *)
Definition: vlc_stream.h:53
int(* get_fps)(demux_t *, double *)
Definition: vlc_stream.h:98
int(* set_rate)(demux_t *, float *)
Definition: vlc_stream.h:105
int(* filter_enable)(demux_t *)
Definition: vlc_stream.h:120
int(* test_and_clear_flags)(demux_t *, unsigned *)
Definition: vlc_stream.h:123
int(* set_record_state)(stream_t *, bool, const char *, const char *)
Definition: vlc_stream.h:78
bool(* can_control_pace)(stream_t *)
Definition: vlc_stream.h:48
int(* set_title)(stream_t *, int)
Definition: vlc_stream.h:57
vlc_tick_t(* get_time)(demux_t *)
Definition: vlc_stream.h:95
struct vlc_stream_operations::@277::@279 stream
void(* close)(stream_t *)
Definition: vlc_stream.h:59
vlc_tick_t(* get_length)(demux_t *)
Definition: vlc_stream.h:94
int(* nav_popup)(demux_t *)
Definition: vlc_stream.h:117
int(* readdir)(stream_t *, input_item_node_t *)
Definition: vlc_stream.h:67
int(* set_seek_point)(stream_t *, int)
Definition: vlc_stream.h:56
int(* nav_down)(demux_t *)
Definition: vlc_stream.h:114
This file is a collection of common definitions and types.
int strcasecmp(const char *, const char *)
Input thread interface.
int64_t vlc_tick_t
High precision date or time interval.
Definition: vlc_tick.h:45