| 1 |
/* |
| 2 |
* This file is part of libbdplus |
| 3 |
* Copyright (C) 2015 VideoLAN |
| 4 |
* |
| 5 |
* This library is free software; you can redistribute it and/or |
| 6 |
* modify it under the terms of the GNU Lesser General Public |
| 7 |
* License as published by the Free Software Foundation; either |
| 8 |
* version 2.1 of the License, or (at your option) any later version. |
| 9 |
* |
| 10 |
* This library is distributed in the hope that it will be useful, |
| 11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 |
* Lesser General Public License for more details. |
| 14 |
* |
| 15 |
* You should have received a copy of the GNU Lesser General Public |
| 16 |
* License along with this library. If not, see |
| 17 |
* <http://www.gnu.org/licenses/>. |
| 18 |
*/ |
| 19 |
|
| 20 |
#ifndef BDPLUS_FILESYSTEM_H_ |
| 21 |
#define BDPLUS_FILESYSTEM_H_ |
| 22 |
|
| 23 |
#ifdef __cplusplus |
| 24 |
extern "C" { |
| 25 |
#endif |
| 26 |
|
| 27 |
#include <stdint.h> |
| 28 |
|
| 29 |
#ifndef BD_PUBLIC |
| 30 |
# define BD_PUBLIC |
| 31 |
#endif |
| 32 |
|
| 33 |
/* Keep this compatible with libaacs ! */ |
| 34 |
typedef struct bdplus_file BDPLUS_FILE_H; |
| 35 |
struct bdplus_file |
| 36 |
{ |
| 37 |
void *internal; |
| 38 |
|
| 39 |
void (*close) (BDPLUS_FILE_H *file); |
| 40 |
int64_t (*seek) (BDPLUS_FILE_H *file, int64_t offset, int32_t origin); |
| 41 |
int64_t (*tell) (BDPLUS_FILE_H *file); |
| 42 |
int (*eof) (BDPLUS_FILE_H *file); |
| 43 |
int64_t (*read) (BDPLUS_FILE_H *file, uint8_t *buf, int64_t size); |
| 44 |
int64_t (*write) (BDPLUS_FILE_H *file, const uint8_t *buf, int64_t size); |
| 45 |
}; |
| 46 |
|
| 47 |
/** |
| 48 |
* |
| 49 |
* Function that will be used to open a file |
| 50 |
* |
| 51 |
* NOTE: file name is relative to disc root directory ! |
| 52 |
* |
| 53 |
* @param handle application-specific handle |
| 54 |
* @param filename file to open |
| 55 |
* @return pointer to BDPLUS_FILE_H, NULL if error |
| 56 |
*/ |
| 57 |
typedef BDPLUS_FILE_H* (*BDPLUS_FILE_OPEN)(void *handle, const char *filename); |
| 58 |
|
| 59 |
/** |
| 60 |
* |
| 61 |
* Register function pointer that will be used to open a file |
| 62 |
* |
| 63 |
* @param bdplus bdplus instance |
| 64 |
* @param handle handle that will be passed to file open function |
| 65 |
* @param p function pointer |
| 66 |
*/ |
| 67 |
struct bdplus_s; |
| 68 |
|
| 69 |
BD_PUBLIC |
| 70 |
void bdplus_set_fopen(struct bdplus_s *bdplus, void *handle, BDPLUS_FILE_OPEN p); |
| 71 |
|
| 72 |
#ifdef __cplusplus |
| 73 |
} |
| 74 |
#endif |
| 75 |
|
| 76 |
#endif /* BDPLUS_FILESYSTEM_H_ */ |