1 /* Copyright (C) 2010-2020 The RetroArch team
3 * ---------------------------------------------------------------------------------------
4 * The following license statement only applies to this file (interface_stream.h).
5 * ---------------------------------------------------------------------------------------
7 * Permission is hereby granted, free of charge,
8 * to any person obtaining a copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation the rights to
10 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
11 * and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
13 * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
16 * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
18 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
19 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 #ifndef _LIBRETRO_SDK_INTERFACE_STREAM_H
24 #define _LIBRETRO_SDK_INTERFACE_STREAM_H
28 #include <sys/types.h>
30 #include <retro_common_api.h>
43 typedef struct intfstream_internal intfstream_internal_t, intfstream_t;
45 typedef struct intfstream_info
61 enum intfstream_type type;
64 void *intfstream_init(intfstream_info_t *info);
66 bool intfstream_resize(intfstream_internal_t *intf,
67 intfstream_info_t *info);
69 bool intfstream_open(intfstream_internal_t *intf,
70 const char *path, unsigned mode, unsigned hints);
72 int64_t intfstream_read(intfstream_internal_t *intf,
73 void *s, uint64_t len);
75 int64_t intfstream_write(intfstream_internal_t *intf,
76 const void *s, uint64_t len);
78 int intfstream_printf(intfstream_internal_t *intf,
79 const char* format, ...);
81 int64_t intfstream_get_ptr(intfstream_internal_t *intf);
83 char *intfstream_gets(intfstream_internal_t *intf,
84 char *buffer, uint64_t len);
86 int intfstream_getc(intfstream_internal_t *intf);
88 int64_t intfstream_seek(intfstream_internal_t *intf,
89 int64_t offset, int whence);
91 void intfstream_rewind(intfstream_internal_t *intf);
93 int64_t intfstream_tell(intfstream_internal_t *intf);
95 int intfstream_eof(intfstream_internal_t *intf);
97 void intfstream_putc(intfstream_internal_t *intf, int c);
99 int intfstream_close(intfstream_internal_t *intf);
101 int64_t intfstream_get_size(intfstream_internal_t *intf);
103 int intfstream_flush(intfstream_internal_t *intf);
105 uint32_t intfstream_get_offset_to_start(intfstream_internal_t *intf);
107 uint32_t intfstream_get_frame_size(intfstream_internal_t *intf);
109 uint32_t intfstream_get_first_sector(intfstream_internal_t* intf);
111 bool intfstream_is_compressed(intfstream_internal_t *intf);
113 bool intfstream_get_crc(intfstream_internal_t *intf, uint32_t *crc);
115 intfstream_t *intfstream_open_file(const char *path,
116 unsigned mode, unsigned hints);
118 intfstream_t *intfstream_open_memory(void *data,
119 unsigned mode, unsigned hints, uint64_t size);
121 intfstream_t *intfstream_open_writable_memory(void *data,
122 unsigned mode, unsigned hints, uint64_t size);
124 intfstream_t *intfstream_open_chd_track(const char *path,
125 unsigned mode, unsigned hints, int32_t track);
127 intfstream_t *intfstream_open_rzip_file(const char *path,