RetroArch
trans_stream.h
Go to the documentation of this file.
1 /* Copyright (C) 2010-2018 The RetroArch team
2  *
3  * ---------------------------------------------------------------------------------------
4  * The following license statement only applies to this file (trans_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_TRANS_STREAM_H__
24 #define LIBRETRO_SDK_TRANS_STREAM_H__
25 
26 #include <stdint.h>
27 #include <stddef.h>
28 #include <boolean.h>
29 
30 #ifdef _WIN32
31 #include <direct.h>
32 #else
33 #include <unistd.h>
34 #endif
35 
36 #include <retro_miscellaneous.h>
37 
38 #include <retro_common_api.h>
39 
41 
42 
44 {
46  TRANS_STREAM_ERROR_AGAIN, /* more work to do */
48  TRANS_STREAM_ERROR_INVALID, /* invalid state */
49  TRANS_STREAM_ERROR_BUFFER_FULL, /* output buffer full */
51 };
52 
54 {
55  const char *ident;
57 
58  /* Create a stream data structure */
59  void *(*stream_new)(void);
60 
61  /* Free it */
62  void (*stream_free)(void *);
63 
64  /* (Optional) Set extra properties, defined per transcoder */
65  bool (*define)(void *, const char *, uint32_t);
66 
67  /* Set our input source */
68  void (*set_in)(void *, const uint8_t *, uint32_t);
69 
70  /* Set our output target */
71  void (*set_out)(void *, uint8_t *, uint32_t);
72 
73  /* Perform a transcoding, flushing/finalizing if asked to. Writes out how
74  * many bytes were read and written. Error target optional. */
75  bool (*trans)(void *, bool, uint32_t *, uint32_t *, enum trans_stream_error *);
76 };
77 
92  struct trans_stream_backend *backend, void **data,
93  const uint8_t *in, uint32_t in_size,
94  uint8_t *out, uint32_t out_size,
96 
100 
101 extern const struct trans_stream_backend zlib_deflate_backend;
102 extern const struct trans_stream_backend zlib_inflate_backend;
103 extern const struct trans_stream_backend pipe_backend;
104 
106 
107 #endif
108 
const struct trans_stream_backend * trans_stream_get_zlib_inflate_backend(void)
Definition: trans_stream.c:83
#define RETRO_BEGIN_DECLS
Definition: retro_common_api.h:41
Definition: trans_stream.h:48
const struct trans_stream_backend * trans_stream_get_pipe_backend(void)
Definition: trans_stream.c:92
const struct trans_stream_backend * reverse
Definition: trans_stream.h:56
struct passwd out
Definition: missing_libc_functions.c:51
typedef void(__stdcall *PFN_DESTRUCTION_CALLBACK)(void *pData)
Definition: ibxm.h:9
typedef bool(RETRO_CALLCONV *retro_replace_image_index_t)(unsigned index
bool(* define)(void *, const char *, uint32_t)
Definition: trans_stream.h:65
Definition: trans_stream.h:47
const char * ident
Definition: trans_stream.h:55
string backend
Definition: test_shaders.py:19
static l_noret error(LoadState *S, const char *why)
Definition: lundump.c:39
Definition: trans_stream.h:50
GLuint in
Definition: glext.h:10523
Definition: trans_stream.h:45
const struct trans_stream_backend pipe_backend
Definition: trans_stream_pipe.c:86
void(* set_in)(void *, const uint8_t *, uint32_t)
Definition: trans_stream.h:68
Definition: trans_stream.h:46
#define RETRO_END_DECLS
Definition: retro_common_api.h:42
Definition: trans_stream.h:53
const struct trans_stream_backend zlib_deflate_backend
Definition: trans_stream_zlib.c:270
trans_stream_error
Definition: trans_stream.h:43
void(* stream_free)(void *)
Definition: trans_stream.h:62
bool(* trans)(void *, bool, uint32_t *, uint32_t *, enum trans_stream_error *)
Definition: trans_stream.h:75
const struct trans_stream_backend * trans_stream_get_zlib_deflate_backend(void)
Definition: trans_stream.c:74
Definition: trans_stream.h:49
void(* set_out)(void *, uint8_t *, uint32_t)
Definition: trans_stream.h:71
bool trans_stream_trans_full(struct trans_stream_backend *backend, void **data, const uint8_t *in, uint32_t in_size, uint8_t *out, uint32_t out_size, enum trans_stream_error *error)
Definition: trans_stream.c:37
unsigned char uint8_t
Definition: stdint.h:124
unsigned int uint32_t
Definition: stdint.h:126
const struct trans_stream_backend zlib_inflate_backend
Definition: trans_stream_zlib.c:281