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 /* */
259 STREAM_GET_SIZE=6, /**< arg1=(uint64_t *) res=can fail */
260 STREAM_GET_MTIME, /**< arg1=(uint64_t *) res=can fail
261 Returns the last modified time in seconds since epoch. */
263 /* */
264 STREAM_GET_PTS_DELAY = 0x101, /**< arg1=(vlc_tick_t *) res=cannot fail */
265 STREAM_GET_TITLE_INFO, /**< arg1=(input_title_t***) arg2=(int*) res=can fail */
266 STREAM_GET_TITLE, /**< arg1=(unsigned *) res=can fail */
267 STREAM_GET_SEEKPOINT, /**< arg1=(unsigned *) res=can fail */
268 STREAM_GET_META, /**< arg1=(vlc_meta_t *) res=can fail */
269 STREAM_GET_CONTENT_TYPE, /**< arg1=(char **) res=can fail */
270 STREAM_GET_SIGNAL, /**< arg1=(double *pf_quality), arg2=(double *pf_strength) res=can fail */
271 STREAM_GET_TAGS, /**< arg1=(const block_t **) res=can fail */
272 STREAM_GET_TYPE, /**< arg1=(int*) res=can fail */
274 STREAM_SET_PAUSE_STATE = 0x200, /**< arg1=(bool) res=can fail */
275 STREAM_SET_TITLE, /**< arg1=(int) res=can fail */
276 STREAM_SET_SEEKPOINT, /**< arg1=(int) res=can fail */
278 /* XXX only data read through vlc_stream_Read/Block will be recorded */
279 STREAM_SET_RECORD_STATE, /**< arg1=bool, arg2=const char *dir_path (if arg1 is true),
280 arg3=const char *psz_ext (if arg1 is true) res=can fail */
282 STREAM_SET_PRIVATE_ID_STATE = 0x1000, /**< arg1=(int i_private_data) arg2=(bool b_selected) res=can fail */
283 STREAM_SET_PRIVATE_ID_CA, /**< arg1=(void *) */
284 STREAM_GET_PRIVATE_ID_STATE, /**< arg1=(int i_private_data) arg2=(bool *) res=can fail */
286
287/**
288 * Reads data from a byte stream.
289 *
290 * This function always waits for the requested number of bytes, unless a fatal
291 * error is encountered or the end-of-stream is reached first.
292 *
293 * If the buffer is NULL, data is skipped instead of read. This is effectively
294 * a relative forward seek, but it works even on non-seekable streams.
295 *
296 * \param s the stream object to read from
297 * \param buf start of buffer to read data into [OUT]
298 * \param len number of bytes to read
299 * \return the number of bytes read or a negative value on error.
300 */
301VLC_API ssize_t vlc_stream_Read(stream_t *s, void *buf, size_t len) VLC_USED;
302
303/**
304 * Reads partial data from a byte stream.
305 *
306 * This function waits until some data is available for reading from the
307 * stream, a fatal error is encountered or the end-of-stream is reached.
308 *
309 * Unlike vlc_stream_Read(), this function does not wait for the full requested
310 * bytes count. It can return a short count even before the end of the stream
311 * and in the absence of any error.
312 *
313 * \param s the stream object to read from
314 * \param buf start of buffer to read data into [OUT]
315 * \param len buffer size (maximum number of bytes to read)
316 * \return the number of bytes read, 0 on end of stream or -1 if no data available
317 */
318VLC_API ssize_t vlc_stream_ReadPartial(stream_t *s, void *buf, size_t len)
320
321/**
322 * Peeks at data from a byte stream.
323 *
324 * This function buffers for the requested number of bytes, waiting if
325 * necessary. Then it stores a pointer to the buffer. Unlike vlc_stream_Read()
326 * or vlc_stream_Block(), this function does not modify the stream read offset.
327 *
328 * \note
329 * The buffer remains valid until the next read/peek or seek operation on the
330 * same stream. In case of error, the buffer address is undefined.
331 *
332 * \param s the stream object to peek from
333 * \param bufp storage space for the buffer address [OUT]
334 * \param len number of bytes to peek
335 * \return the number of bytes actually available (shorter than requested if
336 * the end-of-stream is reached), or a negative value on error.
337 */
338VLC_API ssize_t vlc_stream_Peek(stream_t *s, const uint8_t **bufp, size_t len)
340
341/**
342 * Reads a data block from a byte stream.
343 *
344 * This function dequeues the next block of data from the byte stream. The
345 * byte stream back-end decides on the size of the block; the caller cannot
346 * make any assumption about it.
347 *
348 * The function might also return NULL spuriously - this does not necessarily
349 * imply that the stream is ended nor that it has encountered a nonrecoverable
350 * error.
351 *
352 * This function should be used instead of vlc_stream_Read() or
353 * vlc_stream_Peek() when the caller can handle reads of any size.
354 *
355 * \return either a data block or NULL
356 */
358
359/**
360 * Tells the current stream position.
361 *
362 * This function tells the current read offset (in bytes) from the start of
363 * the start of the stream.
364 * @note The read offset may be larger than the stream size, either because of
365 * a seek past the end, or because the stream shrank asynchronously.
366 *
367 * @return the byte offset from the beginning of the stream (cannot fail)
368 */
369VLC_API uint64_t vlc_stream_Tell(const stream_t *) VLC_USED;
370
371/**
372 * Checks for end of stream.
373 *
374 * Checks if the last attempt to reads data from the stream encountered the
375 * end of stream before the attempt could be fully satisfied.
376 * The value is initially false, and is reset to false by vlc_stream_Seek().
377 *
378 * \note The function can return false even though the current stream position
379 * is equal to the stream size. It will return true after the following attempt
380 * to read more than zero bytes.
381 *
382 * \note It might be possible to read after the end of the stream.
383 * It implies the size of the stream increased asynchronously in the mean time.
384 * Streams of most types cannot trigger such a case,
385 * but regular local files notably can.
386 *
387 * \note In principles, the stream size should match the stream offset when
388 * the end-of-stream is reached. But that rule is not enforced; it is entirely
389 * dependent on the underlying implementation of the stream.
390 */
392
393/**
394 * Sets the current stream position.
395 *
396 * This function changes the read offset within a stream, if the stream
397 * supports seeking. In case of error, the read offset is not changed.
398 *
399 * @note It is possible (but not useful) to seek past the end of a stream.
400 *
401 * \param s the stream object to seek from
402 * @param offset byte offset from the beginning of the stream
403 * @return zero on success, a negative value on error
404 */
405VLC_API int vlc_stream_Seek(stream_t *s, uint64_t offset) VLC_USED;
406
407VLC_API int vlc_stream_vaControl(stream_t *s, int query, va_list args);
408
409static inline int vlc_stream_Control(stream_t *s, int query, ...)
411 va_list ap;
412 int ret;
413
414 va_start(ap, query);
415 ret = vlc_stream_vaControl(s, query, ap);
416 va_end(ap);
417 return ret;
418}
419
422
423/**
424 * Reads a directory.
425 *
426 * This function fills an input item node with any and all the items within
427 * a directory. The behaviour is undefined if the stream is not a directory.
428 *
429 * \param s directory object to read from
430 * \param node node to store the items into
431 * \return VLC_SUCCESS on success
432 */
434
435/**
436 * Closes a byte stream.
437 * \param s byte stream to close
438 */
440
442
443VLC_USED static inline bool vlc_stream_CanSeek(stream_t *s)
445 bool can_seek = false;
447 return can_seek;
448}
449
450VLC_USED static inline bool vlc_stream_CanFastSeek(stream_t *s)
452 bool can_fast_seek = false;
453 vlc_stream_Control(s, STREAM_CAN_FASTSEEK, &can_fast_seek);
454 return can_fast_seek;
455}
456
457VLC_USED static inline bool vlc_stream_CanPause(stream_t *s)
459 bool can_pause = false;
461 return can_pause;
462}
463
464VLC_USED static inline bool vlc_stream_CanPace(stream_t *s)
473 vlc_tick_t pts_delay;
475 return pts_delay;
476}
477
478VLC_USED static inline int vlc_stream_GetSeekpoint(stream_t *s, unsigned *seekpoint)
480 return vlc_stream_Control(s, STREAM_GET_SEEKPOINT, seekpoint);
481}
482
483VLC_USED static inline int vlc_stream_GetSignal(stream_t *s, double *quality, double *strength)
485 return vlc_stream_Control(s, STREAM_GET_SIGNAL, quality, strength);
486}
487
488VLC_USED static inline int vlc_stream_GetTitle(stream_t *s, unsigned *title)
490 return vlc_stream_Control(s, STREAM_GET_TITLE, title);
491}
492
493VLC_USED static inline int vlc_stream_GetMeta(stream_t *s, vlc_meta_t *meta)
495 return vlc_stream_Control(s, STREAM_GET_META, meta);
496}
497
498VLC_USED static inline int vlc_stream_GetType(stream_t *s, int *type)
500 return vlc_stream_Control(s, STREAM_GET_TYPE, type);
501}
502
503/**
504 * Get the size of the stream.
505 */
506VLC_USED static inline int vlc_stream_GetSize(stream_t *s, uint64_t *size)
508 return vlc_stream_Control(s, STREAM_GET_SIZE, size);
509}
510
511VLC_USED static inline int vlc_stream_GetMTime(stream_t *s, uint64_t *mtime)
513 return vlc_stream_Control(s, STREAM_GET_MTIME, mtime);
514}
515
516VLC_USED static inline int vlc_stream_GetTitleInfo(stream_t *s, input_title_t ***title_info, int *size)
518 return vlc_stream_Control(s, STREAM_GET_TITLE_INFO, title_info, size);
519}
520
521VLC_USED static inline int vlc_stream_GetContentType(stream_t *s, char **content_type)
523 return vlc_stream_Control(s, STREAM_GET_CONTENT_TYPE, content_type);
524}
525
526VLC_USED static inline int vlc_stream_GetTags(stream_t *s, const block_t **tags)
528 return vlc_stream_Control(s, STREAM_GET_TAGS, tags);
529}
530
531VLC_USED static inline int vlc_stream_GetPrivateIdState(stream_t *s, int priv_id, bool *state)
534}
535
536VLC_USED static inline int vlc_stream_SetPauseState(stream_t *s, bool pause_state)
538 return vlc_stream_Control(s, STREAM_SET_PAUSE_STATE, pause_state);
539}
540
541VLC_USED static inline int vlc_stream_SetSeekPoint(stream_t *s, int seekpoint)
543 return vlc_stream_Control(s, STREAM_SET_SEEKPOINT, seekpoint);
544}
545
546VLC_USED static inline int vlc_stream_SetTitle(stream_t *s, int title)
548 return vlc_stream_Control(s, STREAM_SET_TITLE, title);
549}
550
551VLC_USED static inline int vlc_stream_SetRecordState(stream_t *s, bool record_state, const char *dir_path, const char *ext)
553 return vlc_stream_Control(s, STREAM_SET_RECORD_STATE, record_state, dir_path, ext);
554}
555
556VLC_USED static inline int vlc_stream_SetPrivateIdState(stream_t *s, int priv_id, bool state)
559}
560
561/**
562 * Set the private ID ca.
563 *
564 * The ca arg is of type `en50221_capmt_info_t`.
565 */
566VLC_USED static inline int vlc_stream_SetPrivateIdCa(stream_t *s, void *ca)
569}
570
571static inline int64_t stream_Size( stream_t *s )
573 uint64_t i_pos;
574
575 if( vlc_stream_GetSize( s, &i_pos ) )
576 return 0;
577 if( i_pos >> 62 )
578 return (int64_t)1 << 62;
579 return i_pos;
580}
581
583static inline bool stream_HasExtension( stream_t *s, const char *extension )
585 const char *name = (s->psz_filepath != NULL) ? s->psz_filepath
586 : s->psz_url;
587 const char *ext = strrchr( name, '.' );
588 return ext != NULL && !strcasecmp( ext, extension );
589}
590
591/**
592 * Get the Content-Type of a stream, or NULL if unknown.
593 * Result must be free()'d.
594 */
595static inline char *stream_ContentType( stream_t *s )
597 char *res;
598 if (vlc_stream_GetContentType(s, &res))
599 return NULL;
600 return res;
601}
602
603/**
604 * Get the mime-type of a stream
605 *
606 * \warning the returned resource is to be freed by the caller
607 * \return the mime-type, or `NULL` if unknown
608 **/
610static inline char *stream_MimeType( stream_t *s )
612 char* mime_type = stream_ContentType( s );
613
614 if( mime_type ) /* strip parameters */
615 mime_type[strcspn( mime_type, " ;" )] = '\0';
616
617 return mime_type;
618}
619
620/**
621 * Checks for a MIME type.
622 *
623 * Checks if the stream has a specific MIME type.
624 */
626static inline bool stream_IsMimeType(stream_t *s, const char *type)
628 char *mime = stream_MimeType(s);
629 if (mime == NULL)
630 return false;
631
632 bool ok = !strcasecmp(mime, type);
633 free(mime);
634 return ok;
635}
636
637/**
638 * Create a stream from a memory buffer.
639 *
640 * \param obj parent VLC object
641 * \param base start address of the memory buffer to read from
642 * \param size size in bytes of the memory buffer
643 * \param preserve if false, free(base) will be called when the stream is
644 * destroyed; if true, the memory buffer is preserved
645 */
647 size_t size, bool preserve) VLC_USED;
648#define vlc_stream_MemoryNew(a, b, c, d) \
649 vlc_stream_MemoryNew(VLC_OBJECT(a), b, c, d)
650
651/**
652 * Create a stream_t reading from a URL.
653 * You must delete it using vlc_stream_Delete.
654 */
655VLC_API stream_t * vlc_stream_NewURL(vlc_object_t *obj, const char *url)
657#define vlc_stream_NewURL(a, b) vlc_stream_NewURL(VLC_OBJECT(a), b)
659/**
660 * \defgroup stream_fifo FIFO stream
661 * In-memory anonymous pipe
662 @{
663 */
664
667/**
668 * Creates a FIFO stream.
669 *
670 * Creates a non-seekable byte stream object whose byte stream is generated
671 * by another thread in the process. This is the LibVLC equivalent of an
672 * anonymous pipe/FIFO.
673 *
674 * On the reader side, the normal stream functions are used,
675 * e.g. vlc_stream_Read() and vlc_stream_Delete().
676 *
677 * The created stream object is automatically destroyed when both the reader
678 * and the writer sides have been closed, with vlc_stream_Delete() and
679 * vlc_stream_fifo_Close() respectively.
680 *
681 * \param parent parent VLC object for the stream
682 * \param reader location to store read side stream pointer [OUT]
683 * \return a FIFO stream object or NULL on memory error.
684 */
686 stream_t **reader);
687
688/**
689 * Writes a block to a FIFO stream.
690 *
691 * \param s FIFO stream created by vlc_stream_fifo_New()
692 * \param block data block to write to the stream
693 * \return 0 on success. -1 if the reader end has already been closed
694 * (errno is then set to EPIPE, and the block is deleted).
695 *
696 * \bug No congestion control is performed. If the reader end is not keeping
697 * up with the writer end, buffers will accumulate in memory.
698 */
700
701/**
702 * Writes data to a FIFO stream.
703 *
704 * This is a convenience helper for vlc_stream_fifo_Queue().
705 * \param s FIFO stream created by vlc_stream_fifo_New()
706 * \param buf start address of data to write
707 * \param len length of data to write in bytes
708 * \return len on success, or -1 on error (errno is set accordingly)
709 */
710VLC_API ssize_t vlc_stream_fifo_Write(vlc_stream_fifo_t *s, const void *buf,
711 size_t len);
712
713/**
714 * Terminates a FIFO stream.
715 *
716 * Marks the end of the FIFO stream and releases any underlying resources.
717 * \param s FIFO stream created by vlc_stream_fifo_New()
718 */
720
721/**
722 * @}
723 */
724
725/**
726 * Try to add a stream filter to an open stream.
727 * @return New stream to use, or NULL if the filter could not be added.
728 **/
729VLC_API stream_t* vlc_stream_FilterNew( stream_t *p_source, const char *psz_stream_filter );
730
731/**
732 * @}
733 */
734
735# ifdef __cplusplus
736}
737# endif
738
739#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:627
static int vlc_stream_GetContentType(stream_t *s, char **content_type)
Definition vlc_stream.h:522
block_t * vlc_stream_Block(stream_t *s, size_t)
Read data into a block.
Definition stream.c:927
uint64_t vlc_stream_Tell(const stream_t *)
Tells the current stream position.
Definition stream.c:636
static int vlc_stream_SetPauseState(stream_t *s, bool pause_state)
Definition vlc_stream.h:537
static int vlc_stream_GetSeekpoint(stream_t *s, unsigned *seekpoint)
Definition vlc_stream.h:479
ssize_t vlc_stream_Read(stream_t *s, void *buf, size_t len)
Reads data from a byte stream.
Definition stream.c:510
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:484
static int vlc_stream_GetMeta(stream_t *s, vlc_meta_t *meta)
Definition vlc_stream.h:494
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:512
static int64_t stream_Size(stream_t *s)
Definition vlc_stream.h:572
static bool vlc_stream_CanSeek(stream_t *s)
Definition vlc_stream.h:444
static bool vlc_stream_CanPause(stream_t *s)
Definition vlc_stream.h:458
block_t * vlc_stream_ReadBlock(stream_t *)
Reads a data block from a byte stream.
Definition stream.c:586
static vlc_tick_t vlc_stream_GetPtsDelay(stream_t *s)
Definition vlc_stream.h:472
static char * stream_MimeType(stream_t *s)
Get the mime-type of a stream.
Definition vlc_stream.h:611
static bool vlc_stream_CanPace(stream_t *s)
Definition vlc_stream.h:465
static int vlc_stream_SetRecordState(stream_t *s, bool record_state, const char *dir_path, const char *ext)
Definition vlc_stream.h:552
static int vlc_stream_SetTitle(stream_t *s, int title)
Definition vlc_stream.h:547
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:643
static int vlc_stream_GetType(stream_t *s, int *type)
Definition vlc_stream.h:499
static int vlc_stream_SetPrivateIdState(stream_t *s, int priv_id, bool state)
Definition vlc_stream.h:557
static int vlc_stream_Control(stream_t *s, int query,...)
Definition vlc_stream.h:410
static bool stream_HasExtension(stream_t *s, const char *extension)
Definition vlc_stream.h:584
static int vlc_stream_SetPrivateIdCa(stream_t *s, void *ca)
Set the private ID ca.
Definition vlc_stream.h:567
ssize_t vlc_stream_ReadPartial(stream_t *s, void *buf, size_t len)
Reads partial data from a byte stream.
Definition stream.c:488
static int vlc_stream_GetTitle(stream_t *s, unsigned *title)
Definition vlc_stream.h:489
static int vlc_stream_GetTags(stream_t *s, const block_t **tags)
Definition vlc_stream.h:527
static int vlc_stream_GetTitleInfo(stream_t *s, input_title_t ***title_info, int *size)
Definition vlc_stream.h:517
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:507
int vlc_stream_ReadDir(stream_t *s, input_item_node_t *node)
Reads a directory.
Definition stream.c:947
int vlc_stream_Seek(stream_t *s, uint64_t offset)
Sets the current stream position.
Definition stream.c:650
static int vlc_stream_GetPrivateIdState(stream_t *s, int priv_id, bool *state)
Definition vlc_stream.h:532
static int vlc_stream_SetSeekPoint(stream_t *s, int seekpoint)
Definition vlc_stream.h:542
static bool vlc_stream_CanFastSeek(stream_t *s)
Definition vlc_stream.h:451
#define vlc_stream_MemoryNew(a, b, c, d)
Definition vlc_stream.h:649
int vlc_stream_vaControl(stream_t *s, int query, va_list args)
Use to control the "stream_t *".
Definition stream.c:717
static char * stream_ContentType(stream_t *s)
Get the Content-Type of a stream, or NULL if unknown.
Definition vlc_stream.h:596
#define vlc_stream_NewURL(a, b)
Definition vlc_stream.h:658
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:285
@ STREAM_SET_PRIVATE_ID_CA
arg1=(void *)
Definition vlc_stream.h:284
@ STREAM_GET_TITLE
arg1=(unsigned *) res=can fail
Definition vlc_stream.h:267
@ 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:275
@ 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:280
@ STREAM_GET_PTS_DELAY
arg1=(vlc_tick_t *) res=cannot fail
Definition vlc_stream.h:265
@ STREAM_GET_MTIME
arg1=(uint64_t *) res=can fail Returns the last modified time in seconds since epoch.
Definition vlc_stream.h:261
@ STREAM_GET_TAGS
arg1=(const block_t **) res=can fail
Definition vlc_stream.h:272
@ STREAM_GET_CONTENT_TYPE
arg1=(char **) res=can fail
Definition vlc_stream.h:270
@ 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:276
@ 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:271
@ STREAM_GET_TYPE
arg1=(int*) res=can fail
Definition vlc_stream.h:273
@ STREAM_GET_SEEKPOINT
arg1=(unsigned *) res=can fail
Definition vlc_stream.h:268
@ STREAM_GET_SIZE
arg1=(uint64_t *) res=can fail
Definition vlc_stream.h:260
@ STREAM_SET_PRIVATE_ID_STATE
arg1=(int i_private_data) arg2=(bool b_selected) res=can fail
Definition vlc_stream.h:283
@ STREAM_GET_TITLE_INFO
arg1=(input_title_t***) arg2=(int*) res=can fail
Definition vlc_stream.h:266
@ STREAM_GET_META
arg1=(vlc_meta_t *) res=can fail
Definition vlc_stream.h:269
@ STREAM_SET_SEEKPOINT
arg1=(int) res=can fail
Definition vlc_stream.h:277
const char name[16]
Definition httpd.c:1298
static thread_local struct @83 state
Definition vlc_es_out.h:142
Definition vlc_input.h:169
Definition vlc_input_item.h:210
Describes an input and is used to spawn input_thread_t objects.
Definition vlc_input_item.h:98
Definition vlc_input.h:103
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 vlc_frame.h:123
Definition meta.c:40
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
struct vlc_stream_operations::@274::@276 stream
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
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.
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