| 1 |
/* |
| 2 |
lfs_wrap: I/O wrapper code |
| 3 |
|
| 4 |
copyright 2010-2023 by the mpg123 project |
| 5 |
free software under the terms of the LGPL 2.1 |
| 6 |
see COPYING and AUTHORS files in distribution or http://mpg123.org |
| 7 |
initially written by Thomas Orgis (after code from Michael Hipp) |
| 8 |
|
| 9 |
This is the interface to the implementation of internal reading/seeking |
| 10 |
as well as wrapping of client callbacks to the one and only 64 bit |
| 11 |
callback API on opaque handles. |
| 12 |
|
| 13 |
Code outside of this shall not be concerned with I/O details, and |
| 14 |
code inside of this shall not be concerned with other |
| 15 |
libmpg123 internals. Just the public portable API interface. |
| 16 |
*/ |
| 17 |
|
| 18 |
|
| 19 |
// This is to be offered by libmpg123 code that has access to frame struct |
| 20 |
// details. It returns the address to load/store the pointer to the |
| 21 |
// wrapper handle from/into. A little hack to keep things disentangled. |
| 22 |
void ** INT123_wrap_handle(mpg123_handle *mh); |
| 23 |
// Set error code in the mpg123 handle and return MPG123_ERR. |
| 24 |
int INT123_set_err(mpg123_handle *mh, int err); |
| 25 |
|
| 26 |
// These are offered by the source associated with this header. |
| 27 |
|
| 28 |
// This is one open routine for all ways. One of the given resource arguments is active: |
| 29 |
// 1. handle: if path == NULL && fd < 0 |
| 30 |
// 2. path: if path != NULL |
| 31 |
// 3. fd: if fd >= 0 |
| 32 |
// In case of 64 bit handle setup, this does nothing. |
| 33 |
// Return values: |
| 34 |
// 0: setup for wrapped I/O successful. |
| 35 |
// 1: use user-supplied 64 bit I/O handle directly, no internal wrappery |
| 36 |
// <0: error |
| 37 |
#define LFS_WRAP_NONE 1 |
| 38 |
int INT123_wrap_open(mpg123_handle *mh, void *handle, const char *path, int fd, long timeout, int quiet); |
| 39 |
// Deallocate all associated resources and handle memory itself. |
| 40 |
void INT123_wrap_destroy(void * handle); |
| 41 |
|
| 42 |
// The bulk of functions are implementations of the non-portable |
| 43 |
// libmpg123 API declared or implied in the main header. |