本文整理汇总了C++中BD_DEBUG函数的典型用法代码示例。如果您正苦于以下问题:C++ BD_DEBUG函数的具体用法?C++ BD_DEBUG怎么用?C++ BD_DEBUG使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了BD_DEBUG函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: calloc
META_ROOT *meta_parse(BD_DISC *disc)
{
#ifdef HAVE_LIBXML2
META_ROOT *root = calloc(1, sizeof(META_ROOT));
if (!root) {
BD_DEBUG(DBG_CRIT, "out of memory\n");
return NULL;
}
root->dl_count = 0;
xmlDocPtr doc;
_findMetaXMLfiles(root, disc);
uint8_t i;
for (i = 0; i < root->dl_count; i++) {
uint8_t *data = NULL;
size_t size;
size = disc_read_file(disc, "BDMV" DIR_SEP "META" DIR_SEP "DL",
root->dl_entries[i].filename,
&data);
if (!data || size == 0) {
BD_DEBUG(DBG_DIR, "Failed to read BDMV/META/DL/%s\n", root->dl_entries[i].filename);
} else {
doc = xmlReadMemory((char*)data, (int)size, NULL, NULL, 0);
if (doc == NULL) {
BD_DEBUG(DBG_DIR, "Failed to parse BDMV/META/DL/%s\n", root->dl_entries[i].filename);
} else {
xmlNode *root_element = NULL;
root_element = xmlDocGetRootElement(doc);
root->dl_entries[i].di_name = root->dl_entries[i].di_alternative = NULL;
root->dl_entries[i].di_num_sets = root->dl_entries[i].di_set_number = -1;
root->dl_entries[i].toc_count = root->dl_entries[i].thumb_count = 0;
root->dl_entries[i].toc_entries = NULL;
root->dl_entries[i].thumbnails = NULL;
_parseManifestNode(root_element, &root->dl_entries[i]);
xmlFreeDoc(doc);
}
X_FREE(data);
}
}
xmlCleanupParser();
return root;
#else
(void)disc;
BD_DEBUG(DBG_DIR, "configured without libxml2 - can't parse meta info\n");
return NULL;
#endif
}
示例2: file_open_mythiowrapper
static BD_FILE_H *_file_open(const char* filename, const char *cmode)
{
BD_FILE_H *file;
int fd = -1;
int flags = 0;
int mode = 0;
if (strchr(cmode, 'w')) {
flags = O_WRONLY | O_CREAT | O_TRUNC;
mode = S_IRUSR | S_IWUSR;
} else {
flags = O_RDONLY;
}
#ifdef O_CLOEXEC
flags |= O_CLOEXEC;
#endif
#ifdef O_BINARY
flags |= O_BINARY;
#endif
if (strncmp(filename, "myth://", 7) == 0)
return file_open_mythiowrapper(filename, cmode);
if ((fd = open(filename, flags, mode)) < 0) {
BD_DEBUG(DBG_FILE, "Error opening file %s\n", filename);
return NULL;
}
file = calloc(1, sizeof(BD_FILE_H));
if (!file) {
close(fd);
BD_DEBUG(DBG_FILE, "Error opening file %s (out of memory)\n", filename);
return NULL;
}
file->close = _file_close;
file->seek = _file_seek;
file->read = _file_read;
file->write = _file_write;
file->tell = _file_tell;
//file->eof = file_eof_linux;
file->internal = (void*)(intptr_t)fd;
BD_DEBUG(DBG_FILE, "Opened POSIX file %s (%p)\n", filename, (void*)file);
return file;
}
示例3: str_printf
BDPLUS_FILE_H *file_open_default(void *handle, const char* file_name)
{
const char *device_root = handle;
char *file_path;
BDPLUS_FILE_H *file;
FILE *fp;
file_path = str_printf("%s"DIR_SEP"%s", device_root, file_name);
if (!file_path) {
BD_DEBUG(DBG_CRIT, "out of memory\n");
return NULL;
}
fp = fopen(file_path, "rb");
X_FREE(file_path);
if (!fp) {
return NULL;
}
file = calloc(1, sizeof(BDPLUS_FILE_H));
file->internal = fp;
file->close = _file_close;
file->seek = _file_seek;
file->read = _file_read;
return file;
}
示例4: WideCharToMultiByte
const char *file_get_config_system(const char *dir)
{
static char *appdir = NULL;
wchar_t wdir[MAX_PATH];
if (!dir) {
// first call
if (appdir)
return appdir;
/* Get the "Application Data" folder for all users */
if (S_OK == SHGetFolderPathW(NULL, CSIDL_COMMON_APPDATA | CSIDL_FLAG_CREATE,
NULL, SHGFP_TYPE_CURRENT, wdir)) {
int len = WideCharToMultiByte (CP_UTF8, 0, wdir, -1, NULL, 0, NULL, NULL);
appdir = malloc(len);
WideCharToMultiByte (CP_UTF8, 0, wdir, -1, appdir, len, NULL, NULL);
return appdir;
} else {
BD_DEBUG(DBG_FILE, "Can't find common configuration directory !\n");
return NULL;
}
} else {
// next call
return NULL;
}
return dir;
}
示例5: _findMetaXMLfiles
static void _findMetaXMLfiles(META_ROOT *meta, const char *device_path)
{
BD_DIR_H *dir;
BD_DIRENT ent;
char *path = NULL;
path = str_printf("%s" DIR_SEP "BDMV" DIR_SEP "META" DIR_SEP "DL", device_path);
dir = dir_open(path);
if (dir == NULL) {
BD_DEBUG(DBG_DIR, "Failed to open meta dir %s\n", path);
X_FREE(path);
return;
}
int res;
for (res = dir_read(dir, &ent); !res; res = dir_read(dir, &ent)) {
if (ent.d_name[0] == '.')
continue;
else if (ent.d_name != NULL && strncasecmp(ent.d_name, "bdmt_", 5) == 0) {
uint8_t i = meta->dl_count;
meta->dl_count++;
meta->dl_entries = realloc(meta->dl_entries, (meta->dl_count*sizeof(META_DL)));
meta->dl_entries[i].filename = str_dup(ent.d_name);
strncpy(meta->dl_entries[i].language_code, ent.d_name+5,3);
meta->dl_entries[i].language_code[3] = '\0';
str_tolower(meta->dl_entries[i].language_code);
}
}
dir_close(dir);
X_FREE(path);
}
示例6: _process_psr_event
/*
* register hook
*/
static void _process_psr_event(void *handle, BD_PSR_EVENT *ev)
{
GRAPHICS_CONTROLLER *gc = (GRAPHICS_CONTROLLER *)handle;
if (ev->ev_type == BD_PSR_SAVE) {
BD_DEBUG(DBG_GC, "PSR SAVE event\n");
/* save menu page state */
bd_mutex_lock(&gc->mutex);
_save_page_state(gc);
bd_mutex_unlock(&gc->mutex);
return;
}
if (ev->ev_type == BD_PSR_RESTORE) {
switch (ev->psr_idx) {
case PSR_SELECTED_BUTTON_ID:
return;
case PSR_MENU_PAGE_ID:
/* restore menus */
bd_mutex_lock(&gc->mutex);
_restore_page_state(gc);
bd_mutex_unlock(&gc->mutex);
return;
default:
/* others: ignore */
return;
}
}
}
示例7: _decode_segment
static int _decode_segment(PG_DISPLAY_SET *s, PES_BUFFER *p)
{
BITBUFFER bb;
bb_init(&bb, p->buf, p->len);
uint8_t type = bb_read(&bb, 8);
/*uint16_t len = */ bb_read(&bb, 16);
switch (type) {
case PGS_OBJECT:
return _decode_ods(s, &bb, p);
case PGS_PALETTE:
return _decode_pds(s, &bb, p);
case PGS_WINDOW:
return _decode_wds(s, &bb, p);
case PGS_PG_COMPOSITION:
return _decode_pcs(s, &bb, p);
case PGS_IG_COMPOSITION:
return _decode_ics(s, &bb, p);
case PGS_END_OF_DISPLAY:
s->complete = 1;
return 1;
default:
BD_DEBUG(DBG_DECODE | DBG_CRIT, "unknown segment type 0x%x\n", type);
break;
}
return 0;
}
示例8: _load_aes_keys
static int _load_aes_keys(bdplus_aes_key_t *aes_keys, const char *base)
{
char *path = str_printf("%s/" AES_KEYS_FILE, base);
uint8_t *keys;
uint32_t size = 0;
uint32_t num_keys, ii;
if (!path) {
return -1;
}
keys = (uint8_t *)file_load(path, &size);
X_FREE(path);
num_keys = size / 16;
if (num_keys > MAX_AES_KEYS) {
num_keys = MAX_AES_KEYS;
}
if (num_keys * 16 != size) {
BD_DEBUG(DBG_FILE | DBG_CRIT, "Invalid AES key file size\n");
}
for (ii = 0; ii < num_keys; ii++) {
memcpy(aes_keys[ii].key, keys + 16*ii, 16);
}
X_FREE(keys);
return num_keys > 6 ? (int)num_keys : -1;
}
示例9: _stream_read
static int64_t _stream_read(BD_FILE_H *fp, uint8_t *buf, int64_t size)
{
DEC_STREAM *st = (DEC_STREAM *)fp->internal;
int64_t result;
if (size != 6144) {
BD_DEBUG(DBG_CRIT, "read size != unit size\n");
return 0;
}
result = st->fp->read(st->fp, buf, size);
if (result <= 0) {
return result;
}
if (st->aacs) {
if (libaacs_decrypt_unit(st->aacs, buf)) {
/* failure is detected from TP header */
}
}
if (st->bdplus) {
if (libbdplus_fixup(st->bdplus, buf, (int)size) < 0) {
/* there's no way to verify if the stream was decoded correctly */
}
}
return result;
}
示例10: _findMetaXMLfiles
static void _findMetaXMLfiles(META_ROOT *meta, BD_DISC *disc)
{
BD_DIR_H *dir;
BD_DIRENT ent;
dir = disc_open_dir(disc, "BDMV" DIR_SEP "META" DIR_SEP "DL");
if (dir == NULL) {
BD_DEBUG(DBG_DIR, "Failed to open meta dir BDMV/META/DL/\n");
return;
}
int res;
for (res = dir_read(dir, &ent); !res; res = dir_read(dir, &ent)) {
if (ent.d_name[0] == '.')
continue;
else if (strncasecmp(ent.d_name, "bdmt_", 5) == 0) {
META_DL *new_dl_entries = realloc(meta->dl_entries, ((meta->dl_count + 1)*sizeof(META_DL)));
if (new_dl_entries) {
uint8_t i = meta->dl_count;
meta->dl_count++;
meta->dl_entries = new_dl_entries;
memset(&meta->dl_entries[i], 0, sizeof(meta->dl_entries[i]));
meta->dl_entries[i].filename = str_dup(ent.d_name);
strncpy(meta->dl_entries[i].language_code, ent.d_name+5,3);
meta->dl_entries[i].language_code[3] = '\0';
str_tolower(meta->dl_entries[i].language_code);
}
}
}
dir_close(dir);
}
示例11: _decode_interactive_composition
static int _decode_interactive_composition(BITBUFFER *bb, BD_IG_INTERACTIVE_COMPOSITION *p)
{
unsigned ii;
uint32_t data_len = bb_read(bb, 24);
uint32_t buf_len = bb->p_end - bb->p;
if (data_len != buf_len) {
BD_DEBUG(DBG_DECODE, "ig_decode_interactive(): buffer size mismatch (expected %d, have %d)\n", data_len, buf_len);
return 0;
}
p->stream_model = bb_read(bb, 1);
p->ui_model = bb_read(bb, 1);
bb_skip(bb, 6);
if (p->stream_model == 0) {
bb_skip(bb, 7);
p->composition_timeout_pts = bb_read_u64(bb, 33);
bb_skip(bb, 7);
p->selection_timeout_pts = bb_read_u64(bb, 33);
}
p->user_timeout_duration = bb_read(bb, 24);
p->num_pages = bb_read(bb, 8);
p->page = calloc(p->num_pages, sizeof(BD_IG_PAGE));
for (ii = 0; ii < p->num_pages; ii++) {
_decode_page(bb, &p->page[ii]);
}
return 1;
}
示例12: _mobj_parse_object
static int _mobj_parse_object(BITSTREAM *bs, MOBJ_OBJECT *obj)
{
int i;
obj->resume_intention_flag = bs_read(bs, 1);
obj->menu_call_mask = bs_read(bs, 1);
obj->title_search_mask = bs_read(bs, 1);
bs_skip(bs, 13); /* padding */
obj->num_cmds = bs_read(bs, 16);
obj->cmds = calloc(obj->num_cmds, sizeof(MOBJ_CMD));
if (!obj->cmds) {
BD_DEBUG(DBG_CRIT, "out of memory\n");
return 0;
}
for (i = 0; i < obj->num_cmds; i++) {
uint8_t buf[12];
bs_read_bytes(bs, buf, 12);
mobj_parse_cmd(buf, &obj->cmds[i]);
}
return 1;
}
示例13: Java_org_videolan_Libbluray_setKeyInterestN
JNIEXPORT void JNICALL Java_org_videolan_Libbluray_setKeyInterestN(JNIEnv * env,
jclass cls, jlong np, jint mask) {
BLURAY* bd = (BLURAY*)(intptr_t)np;
BD_DEBUG(DBG_JNI, "setKeyInterestN(0x%x)\n", (int)mask);
bd_set_bdj_kit(bd, mask);
}
示例14: Java_org_videolan_Libbluray_setUOMaskN
JNIEXPORT void JNICALL Java_org_videolan_Libbluray_setUOMaskN(JNIEnv * env,
jclass cls, jlong np, jboolean menuCallMask, jboolean titleSearchMask) {
BLURAY* bd = (BLURAY*)(intptr_t)np;
BD_DEBUG(DBG_JNI, "setUOMaskN(%d,%d)\n", (int)menuCallMask, (int)titleSearchMask);
bd_set_bdj_uo_mask(bd, ((!!menuCallMask) * BDJ_MENU_CALL_MASK) | ((!!titleSearchMask) * BDJ_TITLE_SEARCH_MASK));
}
示例15: Java_org_videolan_Libbluray_getUOMaskN
JNIEXPORT jlong JNICALL Java_org_videolan_Libbluray_getUOMaskN(JNIEnv * env,
jclass cls, jlong np) {
BLURAY* bd = (BLURAY*)(intptr_t)np;
BD_DEBUG(DBG_JNI, "getUOMaskN()\n");
return bd_get_uo_mask(bd);
}