mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-17 00:10:31 +02:00
The libretro-common submodule pinned the standalone repository at 76a3d54. It is replaced by an in-tree copy of RetroArch master (b655a20) holding only what the core uses: the VFS, file, string, encoding, compat and time sources it already built, the headers they and the core include, the threading set - rthreads, retro_atomic, retro_spsc and retro_waitable_spsc, mpsc_stack, retro_triple_buffer, retro_eventcount, retro_asym_eventcount, retro_procbarrier and tpool, with features_cpu and rstrtod, which they need - and the codecs that replace the bundled zlib, zstd, libchdr, libzip and libpng: rinflate and rdeflate, rzstd, rchd with its LZMA and FLAC decoders, rzip_archive, rpng and crc32. stdstring.c, which nothing calls, is no longer built. The threading sources are always built, by both the static Makefile and CMake; the VFS set stays behind HAVE_LIBRETRO_VFS as before. The codecs are built by the change that switches the core over to them.
135 lines
5.1 KiB
C
135 lines
5.1 KiB
C
/* Copyright (C) 2010-2020 The RetroArch team
|
|
*
|
|
* ---------------------------------------------------------------------------------------
|
|
* The following license statement only applies to this file (trans_stream.h).
|
|
* ---------------------------------------------------------------------------------------
|
|
*
|
|
* Permission is hereby granted, free of charge,
|
|
* to any person obtaining a copy of this software and associated documentation files (the "Software"),
|
|
* to deal in the Software without restriction, including without limitation the rights to
|
|
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
|
|
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
*
|
|
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
*
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
|
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
*/
|
|
|
|
#ifndef LIBRETRO_SDK_TRANS_STREAM_H__
|
|
#define LIBRETRO_SDK_TRANS_STREAM_H__
|
|
|
|
#include <stdint.h>
|
|
#include <stddef.h>
|
|
#include <boolean.h>
|
|
|
|
#ifdef _WIN32
|
|
#include <direct.h>
|
|
#else
|
|
#include <unistd.h>
|
|
#endif
|
|
|
|
#include <retro_miscellaneous.h>
|
|
|
|
#include <retro_common_api.h>
|
|
|
|
RETRO_BEGIN_DECLS
|
|
|
|
enum trans_stream_error
|
|
{
|
|
TRANS_STREAM_ERROR_NONE = 0,
|
|
TRANS_STREAM_ERROR_AGAIN, /* more work to do */
|
|
TRANS_STREAM_ERROR_ALLOCATION_FAILURE, /* malloc failure */
|
|
TRANS_STREAM_ERROR_INVALID, /* invalid state */
|
|
TRANS_STREAM_ERROR_BUFFER_FULL, /* output buffer full */
|
|
TRANS_STREAM_ERROR_OTHER
|
|
};
|
|
|
|
/* Values for the "strategy" property, which selects how a deflate
|
|
* backend trades match searching against Huffman coding. Numerically
|
|
* identical to zlib's Z_* constants, restated here so callers do not
|
|
* have to include zlib.h to pick one. A backend that does not
|
|
* implement strategies returns false from define() and keeps its
|
|
* default behaviour. */
|
|
#define TRANS_STREAM_STRATEGY_DEFAULT 0
|
|
#define TRANS_STREAM_STRATEGY_FILTERED 1
|
|
#define TRANS_STREAM_STRATEGY_HUFFMAN 2
|
|
#define TRANS_STREAM_STRATEGY_RLE 3
|
|
#define TRANS_STREAM_STRATEGY_FIXED 4
|
|
|
|
struct trans_stream_backend
|
|
{
|
|
const char *ident;
|
|
const struct trans_stream_backend *reverse;
|
|
|
|
/* Create a stream data structure */
|
|
void *(*stream_new)(void);
|
|
|
|
/* Free it */
|
|
void (*stream_free)(void *);
|
|
|
|
/* (Optional) Set extra properties, defined per transcoder */
|
|
bool (*define)(void *, const char *, uint32_t);
|
|
|
|
/* Set our input source */
|
|
void (*set_in)(void *, const uint8_t *, uint32_t);
|
|
|
|
/* Set our output target */
|
|
void (*set_out)(void *, uint8_t *, uint32_t);
|
|
|
|
/* Perform a transcoding, flushing/finalizing if asked to. Writes out how
|
|
* many bytes were read and written. Error target optional. */
|
|
bool (*trans)(void *, bool, uint32_t *, uint32_t *, enum trans_stream_error *);
|
|
};
|
|
|
|
/**
|
|
* trans_stream_trans_full:
|
|
* @backend : transcoding backend
|
|
* @data : (optional) existing stream data, or a target
|
|
* for the new stream data to be saved
|
|
* @in : input data
|
|
* @in_size : input size
|
|
* @out : output data
|
|
* @out_size : output size
|
|
* @error : (optional) output for error code
|
|
*
|
|
* Perform a full transcoding from a source to a destination.
|
|
*/
|
|
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);
|
|
|
|
const struct trans_stream_backend* trans_stream_get_zlib_deflate_backend(void);
|
|
const struct trans_stream_backend* trans_stream_get_zlib_inflate_backend(void);
|
|
|
|
/* The built-in Zstandard codec, where it is compiled in: one frame per
|
|
* flushed transform. */
|
|
#ifdef HAVE_RZSTD
|
|
const struct trans_stream_backend* trans_stream_get_rzstd_encode_backend(void);
|
|
const struct trans_stream_backend* trans_stream_get_rzstd_decode_backend(void);
|
|
#endif
|
|
const struct trans_stream_backend* trans_stream_get_pipe_backend(void);
|
|
|
|
extern const struct trans_stream_backend zlib_deflate_backend;
|
|
extern const struct trans_stream_backend zlib_inflate_backend;
|
|
extern const struct trans_stream_backend pipe_backend;
|
|
|
|
/* Clean-room, zlib-free DEFLATE backend (encodings/deflate.c). Always
|
|
* available; used as the fallback compression backend when zlib is not
|
|
* compiled in. */
|
|
const struct trans_stream_backend* trans_stream_get_deflate_deflate_backend(void);
|
|
const struct trans_stream_backend* trans_stream_get_deflate_inflate_backend(void);
|
|
|
|
extern const struct trans_stream_backend deflate_deflate_backend;
|
|
extern const struct trans_stream_backend deflate_inflate_backend;
|
|
|
|
RETRO_END_DECLS
|
|
|
|
#endif
|