Commit | Line | Data |
---|---|---|
3719602c PC |
1 | /* Copyright (C) 2010-2020 The RetroArch team |
2 | * | |
3 | * --------------------------------------------------------------------------------------- | |
4 | * The following license statement only applies to this file (interface_stream.h). | |
5 | * --------------------------------------------------------------------------------------- | |
6 | * | |
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: | |
12 | * | |
13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | |
14 | * | |
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. | |
21 | */ | |
22 | ||
23 | #ifndef _LIBRETRO_SDK_INTERFACE_STREAM_H | |
24 | #define _LIBRETRO_SDK_INTERFACE_STREAM_H | |
25 | ||
26 | #include <stdint.h> | |
27 | #include <stddef.h> | |
28 | #include <sys/types.h> | |
29 | ||
30 | #include <retro_common_api.h> | |
31 | #include <boolean.h> | |
32 | ||
33 | RETRO_BEGIN_DECLS | |
34 | ||
35 | enum intfstream_type | |
36 | { | |
37 | INTFSTREAM_FILE = 0, | |
38 | INTFSTREAM_MEMORY, | |
39 | INTFSTREAM_CHD, | |
40 | INTFSTREAM_RZIP | |
41 | }; | |
42 | ||
43 | typedef struct intfstream_internal intfstream_internal_t, intfstream_t; | |
44 | ||
45 | typedef struct intfstream_info | |
46 | { | |
47 | struct | |
48 | { | |
49 | struct | |
50 | { | |
51 | uint8_t *data; | |
52 | uint64_t size; | |
53 | } buf; | |
54 | bool writable; | |
55 | } memory; | |
56 | struct | |
57 | { | |
58 | void *handle; | |
59 | int32_t track; | |
60 | } chd; | |
61 | enum intfstream_type type; | |
62 | } intfstream_info_t; | |
63 | ||
64 | void *intfstream_init(intfstream_info_t *info); | |
65 | ||
66 | bool intfstream_resize(intfstream_internal_t *intf, | |
67 | intfstream_info_t *info); | |
68 | ||
69 | bool intfstream_open(intfstream_internal_t *intf, | |
70 | const char *path, unsigned mode, unsigned hints); | |
71 | ||
72 | int64_t intfstream_read(intfstream_internal_t *intf, | |
73 | void *s, uint64_t len); | |
74 | ||
75 | int64_t intfstream_write(intfstream_internal_t *intf, | |
76 | const void *s, uint64_t len); | |
77 | ||
78 | int intfstream_printf(intfstream_internal_t *intf, | |
79 | const char* format, ...); | |
80 | ||
81 | int64_t intfstream_get_ptr(intfstream_internal_t *intf); | |
82 | ||
83 | char *intfstream_gets(intfstream_internal_t *intf, | |
84 | char *buffer, uint64_t len); | |
85 | ||
86 | int intfstream_getc(intfstream_internal_t *intf); | |
87 | ||
88 | int64_t intfstream_seek(intfstream_internal_t *intf, | |
89 | int64_t offset, int whence); | |
90 | ||
91 | void intfstream_rewind(intfstream_internal_t *intf); | |
92 | ||
93 | int64_t intfstream_tell(intfstream_internal_t *intf); | |
94 | ||
95 | int intfstream_eof(intfstream_internal_t *intf); | |
96 | ||
97 | void intfstream_putc(intfstream_internal_t *intf, int c); | |
98 | ||
99 | int intfstream_close(intfstream_internal_t *intf); | |
100 | ||
101 | int64_t intfstream_get_size(intfstream_internal_t *intf); | |
102 | ||
103 | int intfstream_flush(intfstream_internal_t *intf); | |
104 | ||
105 | uint32_t intfstream_get_offset_to_start(intfstream_internal_t *intf); | |
106 | ||
107 | uint32_t intfstream_get_frame_size(intfstream_internal_t *intf); | |
108 | ||
109 | uint32_t intfstream_get_first_sector(intfstream_internal_t* intf); | |
110 | ||
111 | bool intfstream_is_compressed(intfstream_internal_t *intf); | |
112 | ||
113 | bool intfstream_get_crc(intfstream_internal_t *intf, uint32_t *crc); | |
114 | ||
115 | intfstream_t *intfstream_open_file(const char *path, | |
116 | unsigned mode, unsigned hints); | |
117 | ||
118 | intfstream_t *intfstream_open_memory(void *data, | |
119 | unsigned mode, unsigned hints, uint64_t size); | |
120 | ||
121 | intfstream_t *intfstream_open_writable_memory(void *data, | |
122 | unsigned mode, unsigned hints, uint64_t size); | |
123 | ||
124 | intfstream_t *intfstream_open_chd_track(const char *path, | |
125 | unsigned mode, unsigned hints, int32_t track); | |
126 | ||
127 | intfstream_t *intfstream_open_rzip_file(const char *path, | |
128 | unsigned mode); | |
129 | ||
130 | RETRO_END_DECLS | |
131 | ||
132 | #endif |