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