1 /* 2 * This file is part of libbdplus 3 * Copyright (C) 2008-2010 Accident 4 * Copyright (C) 2013 VideoLAN 5 * 6 * This library is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU Lesser General Public 8 * License as published by the Free Software Foundation; either 9 * version 2.1 of the License, or (at your option) any later version. 10 * 11 * This library is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 * Lesser General Public License for more details. 15 * 16 * You should have received a copy of the GNU Lesser General Public 17 * License along with this library. If not, see 18 * <http://www.gnu.org/licenses/>. 19 */ 20 21 #ifndef BDPLUS_H_INCLUDED 22 #define BDPLUS_H_INCLUDED 23 24 #include <stdint.h> 25 26 27 /* opaque types */ 28 29 typedef struct bdplus_s bdplus_t; 30 typedef struct bdplus_st_s bdplus_st_t; 31 32 /* Memory region types for bdplus_mmap() */ 33 34 #define MMAP_ID_PSR 0 35 #define MMAP_ID_GPR 1 36 37 /* Events from application to bdplus */ 38 39 #define BDPLUS_EVENT_START 0x00000000 40 #define BDPLUS_EVENT_TITLE 0x00000110 41 #define BDPLUS_EVENT_APPLICATION 0x00000210 42 #define BDPLUS_RUN_CONVTAB 0xffffffff /* get conversion table when disc is played without menus */ 43 44 45 /* 46 * Get the bdplus library version number. 47 * 48 */ 49 void bdplus_get_version(int *major, int *minor, int *micro); 50 51 52 /* 53 * Initialise the bdplus library. 54 * 55 * @param path Path to BD disc root 56 * @param config_path Path to BD+ configuration (optional) 57 * @param vid BD disc Volume ID 58 * @return bdplus handle, NULL on error 59 */ 60 bdplus_t *bdplus_init(const char *path, const char *config_path, const uint8_t *vid); 61 62 /* get BD+ content code generation */ 63 int32_t bdplus_get_code_gen(bdplus_t *plus); 64 65 /* get BD+ content code release date */ 66 int32_t bdplus_get_code_date(bdplus_t *plus); 67 68 69 /* 70 * Release the bdplus library. 71 * 72 * @param bdplus handle 73 */ 74 void bdplus_free(bdplus_t *); 75 76 77 /* 78 * Map player memory region. 79 * 80 * @param id Memory region type 81 * @param mem Memory region address 82 */ 83 void bdplus_mmap(bdplus_t *, uint32_t id, void *mem); 84 85 /* 86 * Set media key 87 * 88 * @param mk BD disc Media Key 89 */ 90 void bdplus_set_mk(bdplus_t *, const uint8_t *mk); 91 92 93 /* 94 * Register PSR handler functions. 95 * 96 * @param regs Application-specific handle for psr_read/psr_write 97 * @param psr_read Function used to read from PSR 98 * @param psr_write Function used to write to PSR 99 */ 100 void bdplus_psr(bdplus_t *, 101 void *regs, 102 uint32_t (*psr_read) (void *regs, int reg), 103 int (*psr_write)(void *regs, int reg, uint32_t value)); 104 105 106 /* 107 * Start the bdplus VM 108 */ 109 int32_t bdplus_start(bdplus_t *); 110 111 112 /* 113 * Send event to the bdplus VM. 114 * 115 * @param event event type (BDPLUS_EVENT_*) 116 */ 117 int32_t bdplus_event(bdplus_t *, uint32_t event, uint32_t param1, uint32_t param2); 118 119 120 /* 121 * Stream interface 122 */ 123 124 125 /* 126 * Select m2ts file for playback. 127 * 128 * @param m2ts m2ts file number 129 * @return stream handle, NULL on error 130 */ 131 bdplus_st_t *bdplus_m2ts(bdplus_t *, uint32_t m2ts); 132 133 134 /* 135 * Close stream handle. 136 */ 137 void bdplus_m2ts_close(bdplus_st_t *); 138 139 140 /* 141 * Notify stream seek. 142 * 143 * @param offset new byte offset of the stream. 144 */ 145 int32_t bdplus_seek(bdplus_st_t *, uint64_t offset); 146 147 /* 148 * Patch stream buffer. 149 * 150 * @param len buffer length 151 * @param buffer stream data 152 * @return Number of patches performed for the buffer (statistics). 153 */ 154 int32_t bdplus_fixup(bdplus_st_t *, int len, uint8_t *buffer); 155 156 157 158 #endif /* BDPLUS_H_INCLUDED */ 159