direct3d11: set the texture size after we know we use a staging one
[vlc.git] / include / vlc_memstream.h
blob0ed78a7315e166a13dc40aa24491b0f2c52dccfb
1 /*****************************************************************************
2 * vlc_memstream.h:
3 *****************************************************************************
4 * Copyright (C) 2016 RĂ©mi Denis-Courmont
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU Lesser General Public License as published by
8 * the Free Software Foundation; either version 2.1 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
19 *****************************************************************************/
21 #ifndef VLC_MEMSTREAM_H
22 # define VLC_MEMSTREAM_H 1
24 # include <stdarg.h>
25 # include <stdio.h>
27 struct vlc_memstream
29 union
31 FILE *stream;
32 int error;
34 char *ptr;
35 size_t length;
38 VLC_API
39 int vlc_memstream_open(struct vlc_memstream *ms);
41 VLC_API
42 int vlc_memstream_flush(struct vlc_memstream *ms) VLC_USED;
44 VLC_API
45 int vlc_memstream_close(struct vlc_memstream *ms) VLC_USED;
47 VLC_API
48 size_t vlc_memstream_write(struct vlc_memstream *ms,
49 const void *ptr, size_t len);
51 VLC_API
52 int vlc_memstream_putc(struct vlc_memstream *ms, int c);
54 VLC_API
55 int vlc_memstream_puts(struct vlc_memstream *ms, const char *str);
57 VLC_API
58 int vlc_memstream_vprintf(struct vlc_memstream *ms, const char *fmt,
59 va_list args);
61 VLC_API
62 int vlc_memstream_printf(struct vlc_memstream *s, const char *fmt,
63 ...) VLC_FORMAT(2,3);
65 # ifdef __GNUC__
66 static inline int vlc_memstream_puts_len(struct vlc_memstream *ms,
67 const char *str, size_t len)
69 return (vlc_memstream_write(ms, str, len) == len) ? (int)len : EOF;
71 # define vlc_memstream_puts(ms,s) \
72 (__builtin_constant_p(__builtin_strlen(s)) ? \
73 vlc_memstream_puts_len(ms,s,__builtin_strlen(s)) : \
74 vlc_memstream_puts(ms,s))
75 # endif
76 #endif /* VLC_MEMSTREAM_H */