VLC 4.0.0-dev
|
In-memory byte stream are a portable wrapper for in-memory formatted output byte streams. More...
Data Structures | |
struct | vlc_memstream |
In-memory stream object. More... | |
Functions | |
int | vlc_memstream_open (struct vlc_memstream *ms) |
Initializes a byte stream object. More... | |
int | vlc_memstream_flush (struct vlc_memstream *ms) |
Flushes a byte stream object. More... | |
int | vlc_memstream_close (struct vlc_memstream *ms) |
Closes a byte stream object. More... | |
size_t | vlc_memstream_write (struct vlc_memstream *ms, const void *ptr, size_t len) |
Appends a binary blob to a byte stream. More... | |
int | vlc_memstream_putc (struct vlc_memstream *ms, int c) |
Appends a single byte to a byte stream. More... | |
int | vlc_memstream_puts (struct vlc_memstream *ms, const char *str) |
Appends a nul-terminated string to a byte stream. More... | |
int | vlc_memstream_vprintf (struct vlc_memstream *ms, const char *fmt, va_list args) |
Appends a formatted string to a byte stream. More... | |
int | vlc_memstream_printf (struct vlc_memstream *s, const char *fmt,...) |
Appends a formatted string to a byte stream. More... | |
In-memory byte stream are a portable wrapper for in-memory formatted output byte streams.
Compare with POSIX open_memstream()
.
int vlc_memstream_close | ( | struct vlc_memstream * | ms | ) |
Closes a byte stream object.
This function flushes the stream object, releases any underlying resource, except for the heap-allocated formatted buffer ms->ptr
, and deinitializes the object.
On success, the caller is responsible for freeing the buffer with free()
.
Compare with fclose()
.
0 | success |
EOF | failure (ms->ptr and ms->length are unspecified) |
References vlc_memstream::error, and vlc_memstream::ptr.
Referenced by EsOutCreateStrId(), mrl_EscapeFragmentIdentifier(), RunDownloader(), sout_AnnounceRegisterSDP(), StreamExtractorCreateMRL(), vlc_CPU_dump(), vlc_http_msg_format(), vlc_player_input_GetSelectedTrackStringIds(), vlc_player_osd_Tracks(), vlc_spawn_inner(), vlc_strfplayer(), vlc_uri_compose(), vlc_uri_fixup(), vlc_uri_fixup_inner(), and vlc_xml_encode().
int vlc_memstream_flush | ( | struct vlc_memstream * | ms | ) |
Flushes a byte stream object.
This function ensures that any previous write to the byte stream is flushed and the in-memory buffer is synchronized. It can be used observe the content of the buffer before the final vlc_memstream_close().
Compare with fflush()
.
ms->ptr
must not be freed. It can only be freed after a successful call to vlc_memstream_close().0 | success, i.e., ms->ptr and ms->length are valid |
EOF | failure (ms->ptr and ms->length are unspecified) |
References vlc_memstream::error.
int vlc_memstream_open | ( | struct vlc_memstream * | ms | ) |
Initializes a byte stream object.
Compare with POSIX open_memstream()
.
ms | byte stream object |
0 | on success |
EOF | on error |
References vlc_memstream::error, vlc_memstream::length, vlc_memstream::ptr, and unlikely.
Referenced by EsOutCreateStrId(), mrl_EscapeFragmentIdentifier(), RunDownloader(), sout_AnnounceRegisterSDP(), StreamExtractorCreateMRL(), vlc_CPU_dump(), vlc_http_msg_format(), vlc_player_input_GetSelectedTrackStringIds(), vlc_player_osd_Tracks(), vlc_spawn_inner(), vlc_strfplayer(), vlc_uri_compose(), vlc_uri_fixup(), vlc_uri_fixup_inner(), and vlc_xml_encode().
int vlc_memstream_printf | ( | struct vlc_memstream * | s, |
const char * | fmt, | ||
... | |||
) |
Appends a formatted string to a byte stream.
Compare with fprintf()
.
References vlc_memstream_vprintf().
Referenced by EsOutCreateStrId(), mrl_EscapeFragmentIdentifier(), StreamExtractorCreateMRL(), vlc_http_msg_format(), vlc_spawn_inner(), vlc_strfplayer(), vlc_uri_compose(), vlc_uri_fixup_inner(), vlc_uri_putc(), vlc_xml_encode(), and write_duration().
int vlc_memstream_putc | ( | struct vlc_memstream * | ms, |
int | c | ||
) |
Appends a single byte to a byte stream.
Compare with putc()
or fputc()
.
Unsigned | byte value converted to int. |
References vlc_memstream_write().
Referenced by EsOutCreateStrId(), sout_AnnounceRegisterSDP(), StreamExtractorCreateMRL(), vlc_player_input_GetSelectedTrackStringIds(), vlc_strfplayer(), vlc_uri_compose(), vlc_uri_fixup(), vlc_uri_fixup_inner(), and vlc_uri_putc().
int vlc_memstream_puts | ( | struct vlc_memstream * | ms, |
const char * | str | ||
) |
Appends a nul-terminated string to a byte stream.
Compare with fputs()
.
References vlc_memstream_write().
Referenced by EsOutCreateStrId(), sout_AnnounceRegisterSDP(), StreamExtractorCreateMRL(), vlc_CPU_dump(), vlc_http_msg_format(), vlc_player_input_GetSelectedTrackStringIds(), vlc_player_osd_Tracks(), vlc_strfplayer(), vlc_uri_compose(), vlc_xml_encode(), and write_meta().
int vlc_memstream_vprintf | ( | struct vlc_memstream * | ms, |
const char * | fmt, | ||
va_list | args | ||
) |
Appends a formatted string to a byte stream.
Compare with vfprintf()
.
References add_overflow, vlc_memstream::error, vlc_memstream::length, vlc_memstream::ptr, and unlikely.
Referenced by vlc_memstream_printf().
size_t vlc_memstream_write | ( | struct vlc_memstream * | ms, |
const void * | ptr, | ||
size_t | len | ||
) |
Appends a binary blob to a byte stream.
Compare with fwrite()
.
ptr | start address of the blob |
length | byte length of the blob |
References add_overflow, vlc_memstream::error, vlc_memstream::length, vlc_memstream::ptr, and unlikely.
Referenced by RunDownloader(), sout_AnnounceRegisterSDP(), vlc_memstream_putc(), vlc_memstream_puts(), vlc_uri_compose(), vlc_uri_fixup(), and vlc_xml_encode().