Commit ac549c59 authored by Erik Van Grunderbeeck's avatar Erik Van Grunderbeeck Committed by hpi1

Clean up debugging macro's, make debugging intel compiler compatible.

Rename some defines that are more or less considered standard for some development environments (TRACE, DEBUG, ERROR)
Signed-off-by: default avatarErik Van Grunderbeeck <erik@arawix.com>

Use new debug masks in decoders and graphics processor.
Signed-off-by: default avatarhpi1 <hpi.libbluray@gmail.com>
parent 9530578b
......@@ -39,14 +39,14 @@ int main(int argc, char *argv[])
//bd_get_titles(bd, 0);
DEBUG(DBG_BLURAY,"\nListing titles:\n");
BD_DEBUG(DBG_BLURAY,"\nListing titles:\n");
count = bd_get_titles(bd, TITLES_RELEVANT);
for (ii = 0; ii < count; ii++)
{
BLURAY_TITLE_INFO* ti;
ti = bd_get_title_info(bd, ii);
DEBUG(DBG_BLURAY,
BD_DEBUG(DBG_BLURAY,
"index: %d duration: %02"PRIu64":%02"PRIu64":%02"PRIu64" chapters: %d\n",
ii,
(ti->duration / 90000) / (3600),
......@@ -75,8 +75,8 @@ int main(int argc, char *argv[])
if (fwrite(buf, len, 1, fd) < 1)
break;
if (!(ii % 1000)) {
DEBUG(DBG_BLURAY,
"%d\r", ii);
BD_DEBUG(DBG_BLURAY,
"%d\r", ii);
}
}
......
......@@ -50,7 +50,7 @@ int main(int argc, char *argv[])
unsigned int seconds = 0;
char *bd_dir = NULL;
DEBUG(DBG_BLURAY,"\nListing titles:\n");
BD_DEBUG(DBG_BLURAY,"\nListing titles:\n");
do
{
......
......@@ -53,7 +53,7 @@ static void dir_close_posix(BD_DIR_H *dir)
closedir((DIR *)dir->internal);
#endif
DEBUG(DBG_DIR, "Closed POSIX dir (%p)\n", dir);
BD_DEBUG(DBG_DIR, "Closed POSIX dir (%p)\n", dir);
X_FREE(dir);
}
......@@ -92,7 +92,7 @@ static BD_DIR_H *dir_open_posix(const char* dirname)
{
BD_DIR_H *dir = malloc(sizeof(BD_DIR_H));
DEBUG(DBG_DIR, "Opening POSIX dir %s... (%p)\n", dirname, dir);
BD_DEBUG(DBG_DIR, "Opening POSIX dir %s... (%p)\n", dirname, dir);
dir->close = dir_close_posix;
dir->read = dir_read_posix;
......@@ -122,7 +122,7 @@ static BD_DIR_H *dir_open_posix(const char* dirname)
}
#endif
DEBUG(DBG_DIR, "Error opening dir! (%p)\n", dir);
BD_DEBUG(DBG_DIR, "Error opening dir! (%p)\n", dir);
X_FREE(dir);
......
......@@ -75,7 +75,7 @@ void *dl_dlopen ( const char* path, const char *version )
name = str_printf("%s%s", path, ext);
}
DEBUG(DBG_FILE, "searching for library '%s' ...\n", name);
BD_DEBUG(DBG_FILE, "searching for library '%s' ...\n", name);
#if defined(_WIN32)
wchar_t wname[MAX_PATH];
......@@ -84,13 +84,13 @@ void *dl_dlopen ( const char* path, const char *version )
if (!result) {
char buf[128];
DEBUG(DBG_FILE, "can't open library '%s': %s\n", name, dlerror(buf, sizeof(buf)));
BD_DEBUG(DBG_FILE, "can't open library '%s': %s\n", name, dlerror(buf, sizeof(buf)));
}
#else
result = dlopen(name, RTLD_LAZY);
if (!result) {
DEBUG(DBG_FILE, "can't open library '%s': %s\n", name, dlerror());
BD_DEBUG(DBG_FILE, "can't open library '%s': %s\n", name, dlerror());
}
#endif
......@@ -106,13 +106,13 @@ void *dl_dlsym ( void* handle, const char* symbol )
if (!result) {
char buf[128];
DEBUG(DBG_FILE | DBG_CRIT, "GetProcAddress(%p, '%s') failed: %s\n", handle, symbol, dlerror(buf, sizeof(buf)));
BD_DEBUG(DBG_FILE | DBG_CRIT, "GetProcAddress(%p, '%s') failed: %s\n", handle, symbol, dlerror(buf, sizeof(buf)));
}
#else
void *result = dlsym(handle, symbol);
if (!result) {
DEBUG(DBG_FILE | DBG_CRIT, "dlsym(%p, '%s') failed: %s\n", handle, symbol, dlerror());
BD_DEBUG(DBG_FILE | DBG_CRIT, "dlsym(%p, '%s') failed: %s\n", handle, symbol, dlerror());
}
#endif
......
......@@ -44,7 +44,7 @@ static void file_close_linux(BD_FILE_H *file)
if (file) {
fclose((FILE *)file->internal);
DEBUG(DBG_FILE, "Closed LINUX file (%p)\n", file);
BD_DEBUG(DBG_FILE, "Closed LINUX file (%p)\n", file);
X_FREE(file);
}
......@@ -88,7 +88,7 @@ static BD_FILE_H *file_open_linux(const char* filename, const char *mode)
FILE *fp = NULL;
BD_FILE_H *file = malloc(sizeof(BD_FILE_H));
DEBUG(DBG_FILE, "Opening LINUX file %s... (%p)\n", filename, file);
BD_DEBUG(DBG_FILE, "Opening LINUX file %s... (%p)\n", filename, file);
file->close = file_close_linux;
file->seek = file_seek_linux;
file->read = file_read_linux;
......@@ -102,7 +102,7 @@ static BD_FILE_H *file_open_linux(const char* filename, const char *mode)
return file;
}
DEBUG(DBG_FILE, "Error opening file! (%p)\n", file);
BD_DEBUG(DBG_FILE, "Error opening file! (%p)\n", file);
X_FREE(file);
......
......@@ -44,7 +44,7 @@ BDJAVA* bdj_open(const char *path, const char* start, void* bd, void* registers)
void* jvm_lib = load_jvm();
if (!jvm_lib) {
DEBUG(DBG_BDJ | DBG_CRIT, "Wasn't able to load libjvm.so\n");
BD_DEBUG(DBG_BDJ | DBG_CRIT, "Wasn't able to load libjvm.so\n");
return NULL;
}
......@@ -77,7 +77,7 @@ BDJAVA* bdj_open(const char *path, const char* start, void* bd, void* registers)
free(bdjava);
free(option);
free(classpath_opt);
DEBUG(DBG_BDJ | DBG_CRIT, "Couldn't find symbol JNI_CreateJavaVM.\n");
BD_DEBUG(DBG_BDJ | DBG_CRIT, "Couldn't find symbol JNI_CreateJavaVM.\n");
return NULL;
}
......@@ -87,7 +87,7 @@ BDJAVA* bdj_open(const char *path, const char* start, void* bd, void* registers)
if (result != JNI_OK || !bdjava->env) {
free(bdjava);
DEBUG(DBG_BDJ | DBG_CRIT, "Failed to create new Java VM.\n");
BD_DEBUG(DBG_BDJ | DBG_CRIT, "Failed to create new Java VM.\n");
return NULL;
}
......@@ -98,13 +98,13 @@ BDJAVA* bdj_open(const char *path, const char* start, void* bd, void* registers)
if (!bdjo) {
free(bdjava);
DEBUG(DBG_BDJ | DBG_CRIT, "Failed to load BDJO file.\n");
BD_DEBUG(DBG_BDJ | DBG_CRIT, "Failed to load BDJO file.\n");
return NULL;
}
if (start_xlet(bdjava->env, path, bdjo, bdjava) == BDJ_ERROR) {
free(bdjava);
DEBUG(DBG_BDJ | DBG_CRIT, "Failed to start BDJ program.\n");
BD_DEBUG(DBG_BDJ | DBG_CRIT, "Failed to start BDJ program.\n");
return NULL;
}
......@@ -166,7 +166,7 @@ void* load_jvm()
{
const char* java_home = getenv("JAVA_HOME"); // FIXME: should probably search multiple directories
if (java_home == NULL) {
DEBUG(DBG_BDJ | DBG_CRIT, "JAVA_HOME not set, can't find Java VM.\n");
BD_DEBUG(DBG_BDJ | DBG_CRIT, "JAVA_HOME not set, can't find Java VM.\n");
return NULL;
}
......
......@@ -33,7 +33,7 @@
*/
#define JNICHK(a) if((*env)->ExceptionOccurred(env)) { \
DEBUG(DBG_BDJ, "Exception occured\n"); \
BD_DEBUG(DBG_BDJ, "Exception occured\n"); \
(*env)->ExceptionDescribe(env); \
} if (!a) return NULL;
......@@ -354,7 +354,7 @@ static jobject _parse_bdjo(JNIEnv* env, BITBUFFER* buf)
bb_read_bytes(buf, magic, 4);
if (strncmp((const char*) magic, "BDJO", 4) != 0) {
DEBUG(DBG_BDJ | DBG_CRIT, "Invalid magic number in BDJO.\n");
BD_DEBUG(DBG_BDJ | DBG_CRIT, "Invalid magic number in BDJO.\n");
return NULL;
}
......@@ -362,10 +362,10 @@ static jobject _parse_bdjo(JNIEnv* env, BITBUFFER* buf)
uint8_t version[4];
bb_read_bytes(buf, version, 4);
if (_get_version(version) == BDJ_ERROR) {
DEBUG(DBG_BDJ | DBG_CRIT, "Invalid version of BDJO.\n");
BD_DEBUG(DBG_BDJ | DBG_CRIT, "Invalid version of BDJO.\n");
return NULL;
}
DEBUG(DBG_BDJ, "[bdj] BDJO > Version: %.4s\n", version);
BD_DEBUG(DBG_BDJ, "[bdj] BDJO > Version: %.4s\n", version);
// skip some unnecessary data
bb_seek(buf, 8*0x28, SEEK_CUR);
......@@ -397,7 +397,7 @@ jobject bdjo_read(JNIEnv* env, const char* file)
{
BD_FILE_H *handle = file_open(file, "rb");
if (handle == NULL) {
DEBUG(DBG_BDJ | DBG_CRIT, "Failed to open bdjo file (%s)\n", file);
BD_DEBUG(DBG_BDJ | DBG_CRIT, "Failed to open bdjo file (%s)\n", file);
return NULL;
}
......
......@@ -102,7 +102,7 @@ static int _parse_app_info(BITSTREAM *bs, INDX_APP_INFO *app_info)
len = bs_read(bs, 32);
if (len != 34) {
DEBUG(DBG_NAV, "index.bdmv app_info length is %d, expected 34 !\n", len);
BD_DEBUG(DBG_NAV, "index.bdmv app_info length is %d, expected 34 !\n", len);
}
bs_skip(bs, 1);
......@@ -134,7 +134,7 @@ static int _parse_header(BITSTREAM *bs, int *index_start, int *extension_data_st
if (sig1 != INDX_SIG1 ||
(sig2 != INDX_SIG2A &&
sig2 != INDX_SIG2B)) {
DEBUG(DBG_NAV | DBG_CRIT, "index.bdmv failed signature match: expected INDX0100 got %8.8s\n", bs->buf);
BD_DEBUG(DBG_NAV | DBG_CRIT, "index.bdmv failed signature match: expected INDX0100 got %8.8s\n", bs->buf);
return 0;
}
......@@ -154,7 +154,7 @@ INDX_ROOT *indx_parse(const char *file_name)
fp = file_open(file_name, "rb");
if (!fp) {
DEBUG(DBG_NAV | DBG_CRIT, "indx_parse(): error opening %s\n", file_name);
BD_DEBUG(DBG_NAV | DBG_CRIT, "indx_parse(): error opening %s\n", file_name);
X_FREE(index);
return NULL;
}
......@@ -162,19 +162,19 @@ INDX_ROOT *indx_parse(const char *file_name)
bs_init(&bs, fp);
if (!_parse_header(&bs, &indexes_start, &extension_data_start)) {
DEBUG(DBG_NAV | DBG_CRIT, "index.bdmv: invalid header\n");
BD_DEBUG(DBG_NAV | DBG_CRIT, "index.bdmv: invalid header\n");
goto error;
}
if (!_parse_app_info(&bs, &index->app_info)) {
DEBUG(DBG_NAV | DBG_CRIT, "index.bdmv: error parsing app info\n");
BD_DEBUG(DBG_NAV | DBG_CRIT, "index.bdmv: error parsing app info\n");
goto error;
}
bs_seek_byte(&bs, indexes_start);
if (!_parse_index(&bs, index)) {
DEBUG(DBG_NAV | DBG_CRIT, "index.bdmv: error parsing indexes\n");
BD_DEBUG(DBG_NAV | DBG_CRIT, "index.bdmv: error parsing indexes\n");
goto error;
}
......
......@@ -99,7 +99,7 @@ static void _findMetaXMLfiles(META_ROOT *meta, const char *device_path)
path = str_printf("%s" DIR_SEP "BDMV" DIR_SEP "META" DIR_SEP "DL", device_path);
dir = dir_open(path);
if (dir == NULL) {
DEBUG(DBG_DIR, "Failed to open meta dir %s\n", path);
BD_DEBUG(DBG_DIR, "Failed to open meta dir %s\n", path);
X_FREE(path);
return;
}
......@@ -139,7 +139,7 @@ META_ROOT *meta_parse(const char *device_path)
BD_FILE_H *handle = file_open(path, "rb");
if (handle == NULL) {
DEBUG(DBG_DIR, "Failed to open meta file (%s)\n", path);
BD_DEBUG(DBG_DIR, "Failed to open meta file (%s)\n", path);
continue;
}
......@@ -152,7 +152,7 @@ META_ROOT *meta_parse(const char *device_path)
int64_t size_read = file_read(handle, data, length);
doc = xmlReadMemory((char*)data, size_read, base, NULL, 0);
if (doc == NULL) {
DEBUG(DBG_DIR, "Failed to parse %s\n", path);
BD_DEBUG(DBG_DIR, "Failed to parse %s\n", path);
continue;
}
xmlNode *root_element = NULL;
......@@ -171,7 +171,7 @@ META_ROOT *meta_parse(const char *device_path)
xmlCleanupParser();
return root;
#else
DEBUG(DBG_DIR, "configured without libxml2 - can't parse meta info\n");
BD_DEBUG(DBG_DIR, "configured without libxml2 - can't parse meta info\n");
return NULL;
#endif
}
......@@ -181,7 +181,7 @@ META_DL *meta_get(META_ROOT *meta_root, const char *language_code)
unsigned i;
if (meta_root == NULL || meta_root->dl_count == 0) {
DEBUG(DBG_DIR, "meta_get not possible, no info available!\n");
BD_DEBUG(DBG_DIR, "meta_get not possible, no info available!\n");
return NULL;
}
......@@ -191,17 +191,17 @@ META_DL *meta_get(META_ROOT *meta_root, const char *language_code)
return &meta_root->dl_entries[i];
}
}
DEBUG(DBG_DIR, "requested disclib language '%s' not found\n", language_code);
BD_DEBUG(DBG_DIR, "requested disclib language '%s' not found\n", language_code);
}
for (i = 0; i < meta_root->dl_count; i++) {
if (strcasecmp(DEFAULT_LANGUAGE, meta_root->dl_entries[i].language_code) == 0) {
DEBUG(DBG_DIR, "using default disclib language '"DEFAULT_LANGUAGE"'\n");
BD_DEBUG(DBG_DIR, "using default disclib language '"DEFAULT_LANGUAGE"'\n");
return &meta_root->dl_entries[i];
}
}
DEBUG(DBG_DIR, "requested disclib language '%s' or default '"DEFAULT_LANGUAGE"' not found, using '%s' instead\n", language_code, meta_root->dl_entries[0].language_code);
BD_DEBUG(DBG_DIR, "requested disclib language '%s' or default '"DEFAULT_LANGUAGE"' not found, using '%s' instead\n", language_code, meta_root->dl_entries[0].language_code);
return &meta_root->dl_entries[0];
}
......
......@@ -123,12 +123,12 @@ NAV_TITLE_LIST* nav_get_title_list(const char *root, uint32_t flags)
title_list = calloc(1, sizeof(NAV_TITLE_LIST));
title_list->title_info = calloc(title_info_alloc, sizeof(NAV_TITLE_INFO));
DEBUG(DBG_NAV, "Root: %s:\n", root);
BD_DEBUG(DBG_NAV, "Root: %s:\n", root);
path = str_printf("%s" DIR_SEP "BDMV" DIR_SEP "PLAYLIST", root);
dir = dir_open(path);
if (dir == NULL) {
DEBUG(DBG_NAV, "Failed to open dir: %s\n", path);
BD_DEBUG(DBG_NAV, "Failed to open dir: %s\n", path);
X_FREE(path);
X_FREE(title_list);
return NULL;
......@@ -214,7 +214,7 @@ char* nav_find_main_title(const char *root)
int res;
char longest[11];
DEBUG(DBG_NAV, "Root: %s:\n", root);
BD_DEBUG(DBG_NAV, "Root: %s:\n", root);
path = str_printf("%s" DIR_SEP "BDMV" DIR_SEP "PLAYLIST", root);
dir = dir_open(path);
......@@ -454,7 +454,7 @@ NAV_TITLE* nav_title_open(const char *root, const char *playlist)
title->angle = 0;
title->pl = mpls_parse(path, 0);
if (title->pl == NULL) {
DEBUG(DBG_NAV, "Fail: Playlist parse %s\n", path);
BD_DEBUG(DBG_NAV, "Fail: Playlist parse %s\n", path);
X_FREE(title);
X_FREE(path);
return NULL;
......
......@@ -42,7 +42,7 @@ static int _bclk_parse_header(BITSTREAM *bs, uint32_t *data_start, uint32_t *ext
if (sig1 != BCLK_SIG1 ||
(sig2 != BCLK_SIG2A &&
sig2 != BCLK_SIG2B)) {
DEBUG(DBG_NAV, "sound.bdmv failed signature match: expected BCLK0100 got %8.8s\n", bs->buf);
BD_DEBUG(DBG_NAV, "sound.bdmv failed signature match: expected BCLK0100 got %8.8s\n", bs->buf);
return 0;
}
......@@ -57,19 +57,19 @@ static int _sound_parse_attributes(BITSTREAM *bs, SOUND_OBJECT *obj)
int i;
switch (i = bs_read(bs, 4)) {
default: DEBUG(DBG_NAV, "unknown channel configuration code %d\n", i);
default: BD_DEBUG(DBG_NAV, "unknown channel configuration code %d\n", i);
case 1: obj->num_channels = 1;
break;
case 3: obj->num_channels = 2;
break;
};
switch (i = bs_read(bs, 4)) {
default: DEBUG(DBG_NAV, "unknown sample rate code %d\n", i);
default: BD_DEBUG(DBG_NAV, "unknown sample rate code %d\n", i);
case 1: obj->sample_rate = 48000;
break;
};
switch (i = bs_read(bs, 2)) {
default: DEBUG(DBG_NAV, "unknown bits per sample code %d\n", i);
default: BD_DEBUG(DBG_NAV, "unknown bits per sample code %d\n", i);
case 1: obj->bits_per_sample = 16;
break;
};
......@@ -131,14 +131,14 @@ SOUND_DATA *sound_parse(const char *file_name)
fp = file_open(file_name, "rb");
if (!fp) {
DEBUG(DBG_NAV | DBG_CRIT, "error opening %s\n", file_name);
BD_DEBUG(DBG_NAV | DBG_CRIT, "error opening %s\n", file_name);
return NULL;
}
bs_init(&bs, fp);
if (!_bclk_parse_header(&bs, &data_start, &extension_data_start)) {
DEBUG(DBG_NAV | DBG_CRIT, "%s: invalid header\n", file_name);
BD_DEBUG(DBG_NAV | DBG_CRIT, "%s: invalid header\n", file_name);
goto error;
}
......@@ -149,7 +149,7 @@ SOUND_DATA *sound_parse(const char *file_name)
num_sounds = bs_read(&bs, 8);
if (data_len < 1) {
DEBUG(DBG_NAV | DBG_CRIT, "%s: empty database\n", file_name);
BD_DEBUG(DBG_NAV | DBG_CRIT, "%s: empty database\n", file_name);
goto error;
}
......@@ -161,7 +161,7 @@ SOUND_DATA *sound_parse(const char *file_name)
for (i = 0; i < data->num_sounds; i++) {
if (!_sound_parse_index(&bs, data_offsets + i, &data->sounds[i])) {
DEBUG(DBG_NAV | DBG_CRIT, "%s: error parsing sound %d attribues\n", file_name, i);
BD_DEBUG(DBG_NAV | DBG_CRIT, "%s: error parsing sound %d attribues\n", file_name, i);
goto error;
}
}
......@@ -173,7 +173,7 @@ SOUND_DATA *sound_parse(const char *file_name)
bs_seek_byte(&bs, data_start + data_offsets[i]);
if (!_sound_read_samples(&bs, &data->sounds[i])) {
DEBUG(DBG_NAV | DBG_CRIT, "%s: error reading samples for sound %d\n", file_name, i);
BD_DEBUG(DBG_NAV | DBG_CRIT, "%s: error reading samples for sound %d\n", file_name, i);
goto error;
}
}
......
......@@ -202,7 +202,7 @@ static int _queue_event(BLURAY *bd, BD_EVENT ev)
return 1;
}
DEBUG(DBG_BLURAY|DBG_CRIT, "_queue_event(%d, %d): queue overflow !\n", ev.event, ev.param);
BD_DEBUG(DBG_BLURAY|DBG_CRIT, "_queue_event(%d, %d): queue overflow !\n", ev.event, ev.param);
}
return 0;
......@@ -258,10 +258,10 @@ static int _open_m2ts(BLURAY *bd, BD_STREAM *st)
return 1;
}
DEBUG(DBG_BLURAY, "Clip %s empty! (%p)\n", f_name, bd);
BD_DEBUG(DBG_BLURAY, "Clip %s empty! (%p)\n", f_name, bd);
}
DEBUG(DBG_BLURAY | DBG_CRIT, "Unable to open clip %s! (%p)\n",
BD_DEBUG(DBG_BLURAY | DBG_CRIT, "Unable to open clip %s! (%p)\n",
f_name, bd);
X_FREE(f_name);
......@@ -273,7 +273,7 @@ static int _read_block(BLURAY *bd, BD_STREAM *st, uint8_t *buf)
const int len = 6144;
if (st->fp) {
DEBUG(DBG_STREAM, "Reading unit [%d bytes] at %"PRIu64"... (%p)\n",
BD_DEBUG(DBG_STREAM, "Reading unit [%d bytes] at %"PRIu64"... (%p)\n",
len, st->clip_block_pos, bd);
if (len + st->clip_block_pos <= st->clip_size) {
......@@ -281,11 +281,11 @@ static int _read_block(BLURAY *bd, BD_STREAM *st, uint8_t *buf)
if ((read_len = file_read(st->fp, buf, len))) {
if (read_len != len)
DEBUG(DBG_STREAM | DBG_CRIT, "Read %d bytes at %"PRIu64" ; requested %d ! (%p)\n", read_len, st->clip_block_pos, len, bd);
BD_DEBUG(DBG_STREAM | DBG_CRIT, "Read %d bytes at %"PRIu64" ; requested %d ! (%p)\n", read_len, st->clip_block_pos, len, bd);
if (bd->aacs && bd->libaacs_decrypt_unit) {
if (!bd->libaacs_decrypt_unit(bd->aacs, buf)) {
DEBUG(DBG_AACS | DBG_CRIT, "Unable decrypt unit (AACS)! (%p)\n", bd);
BD_DEBUG(DBG_AACS | DBG_CRIT, "Unable decrypt unit (AACS)! (%p)\n", bd);
return 0;
} // decrypt
......@@ -299,7 +299,7 @@ static int _read_block(BLURAY *bd, BD_STREAM *st, uint8_t *buf)
numFixes = bd->bdplus_fixup(bd->bdplus, len, buf);
#if 1
if (numFixes) {
DEBUG(DBG_BDPLUS,
BD_DEBUG(DBG_BDPLUS,
"BDPLUS did %u fixups\n", numFixes);
}
#endif
......@@ -308,28 +308,28 @@ static int _read_block(BLURAY *bd, BD_STREAM *st, uint8_t *buf)
/* Check TP_extra_header Copy_permission_indicator. If != 0, unit is still encrypted. */
if (buf[0] & 0xc0) {
DEBUG(DBG_BLURAY | DBG_CRIT,
BD_DEBUG(DBG_BLURAY | DBG_CRIT,
"TP header copy permission indicator != 0, unit is still encrypted? (%p)\n", bd);
_queue_event(bd, (BD_EVENT){BD_EVENT_ENCRYPTED, 0});
return 0;
}
DEBUG(DBG_STREAM, "Read unit OK! (%p)\n", bd);
BD_DEBUG(DBG_STREAM, "Read unit OK! (%p)\n", bd);
return 1;
}
DEBUG(DBG_STREAM | DBG_CRIT, "Read %d bytes at %"PRIu64" failed ! (%p)\n", len, st->clip_block_pos, bd);
BD_DEBUG(DBG_STREAM | DBG_CRIT, "Read %d bytes at %"PRIu64" failed ! (%p)\n", len, st->clip_block_pos, bd);
return 0;
}
DEBUG(DBG_STREAM | DBG_CRIT, "Read past EOF ! (%p)\n", bd);
BD_DEBUG(DBG_STREAM | DBG_CRIT, "Read past EOF ! (%p)\n", bd);
return 0;
}
DEBUG(DBG_BLURAY, "No valid title selected! (%p)\n", bd);
BD_DEBUG(DBG_BLURAY, "No valid title selected! (%p)\n", bd);
return 0;
}
......@@ -368,7 +368,7 @@ static int _preload_m2ts(BLURAY *bd, BD_PRELOAD *p)
for (; buf < end; buf += 6144) {
if (!_read_block(bd, &st, buf)) {
DEBUG(DBG_BLURAY|DBG_CRIT, "_preload_m2ts(): error loading %s at %"PRIu64"\n",
BD_DEBUG(DBG_BLURAY|DBG_CRIT, "_preload_m2ts(): error loading %s at %"PRIu64"\n",
st.clip->name, (uint64_t)(buf - p->buf));
_close_m2ts(&st);
_close_preload(p);
......@@ -378,7 +378,7 @@ static int _preload_m2ts(BLURAY *bd, BD_PRELOAD *p)
/* */
DEBUG(DBG_BLURAY, "_preload_m2ts(): loaded %"PRIu64" bytes from %s\n",
BD_DEBUG(DBG_BLURAY, "_preload_m2ts(): loaded %"PRIu64" bytes from %s\n",
st.clip_size, st.clip->name);
_close_m2ts(&st);
......@@ -449,12 +449,12 @@ static int _libaacs_required(BLURAY *bd)
if (fd) {
file_close(fd);
DEBUG(DBG_BLURAY, "AACS/Unit_Key_RO.inf found. Disc seems to be AACS protected (%p)\n", bd);
BD_DEBUG(DBG_BLURAY, "AACS/Unit_Key_RO.inf found. Disc seems to be AACS protected (%p)\n", bd);
bd->disc_info.aacs_detected = 1;
return 1;
}
DEBUG(DBG_BLURAY, "AACS/Unit_Key_RO.inf not found. No AACS protection (%p)\n", bd);
BD_DEBUG(DBG_BLURAY, "AACS/Unit_Key_RO.inf not found. No AACS protection (%p)\n", bd);
bd->disc_info.aacs_detected = 0;
return 0;
}
......@@ -469,22 +469,22 @@ static int _libaacs_load(BLURAY *bd)
bd->disc_info.libaacs_detected = 0;
if ((bd->h_libaacs = dl_dlopen("libaacs", "0"))) {
DEBUG(DBG_BLURAY, "Loading libaacs (%p)\n", bd->h_libaacs);
BD_DEBUG(DBG_BLURAY, "Loading libaacs (%p)\n", bd->h_libaacs);
bd->libaacs_open = (fptr_p_void)dl_dlsym(bd->h_libaacs, "aacs_open");
bd->libaacs_decrypt_unit = (fptr_int)dl_dlsym(bd->h_libaacs, "aacs_decrypt_unit");
if (bd->libaacs_open && bd->libaacs_decrypt_unit) {
DEBUG(DBG_BLURAY, "Loaded libaacs (%p)\n", bd->h_libaacs);
BD_DEBUG(DBG_BLURAY, "Loaded libaacs (%p)\n", bd->h_libaacs);
bd->disc_info.libaacs_detected = 1;
return 1;
} else {
DEBUG(DBG_BLURAY, "libaacs dlsym failed! (%p)\n", bd->h_libaacs);
BD_DEBUG(DBG_BLURAY, "libaacs dlsym failed! (%p)\n", bd->h_libaacs);
}
} else {
DEBUG(DBG_BLURAY, "libaacs not found! (%p)\n", bd);
BD_DEBUG(DBG_BLURAY, "libaacs not found! (%p)\n", bd);
}
_libaacs_unload(bd);
......@@ -492,7 +492,7 @@ static int _libaacs_load(BLURAY *bd)
return 0;
#else
DEBUG(DBG_BLURAY, "Using libaacs via normal linking\n");
BD_DEBUG(DBG_BLURAY, "Using libaacs via normal linking\n");
bd->libaacs_open = &aacs_open;
bd->libaacs_decrypt_unit = &aacs_decrypt_unit;
......@@ -519,12 +519,12 @@ static int _libaacs_open(BLURAY *bd, const char *keyfile_path)
bd->aacs = bd->libaacs_open(bd->device_path, keyfile_path);
if (bd->aacs) {
DEBUG(DBG_BLURAY, "Opened libaacs (%p)\n", bd->aacs);
BD_DEBUG(DBG_BLURAY, "Opened libaacs (%p)\n", bd->aacs);
bd->disc_info.aacs_handled = 1;
return 1;
}
DEBUG(DBG_BLURAY, "aacs_open() failed!\n");
BD_DEBUG(DBG_BLURAY, "aacs_open() failed!\n");
bd->disc_info.aacs_handled = 0;
_libaacs_unload(bd);
......@@ -539,14 +539,14 @@ static uint8_t *_libaacs_get_vid(BLURAY *bd)
if (fptr) {
return (uint8_t*)fptr(bd->aacs);
}
DEBUG(DBG_BLURAY, "aacs_get_vid() dlsym failed! (%p)", bd);
BD_DEBUG(DBG_BLURAY, "aacs_get_vid() dlsym failed! (%p)", bd);
return NULL;
#else
return aacs_get_vid(bd->aacs);
#endif
}
DEBUG(DBG_BLURAY, "_libaacs_get_vid(): libaacs not initialized! (%p)", bd);
BD_DEBUG(DBG_BLURAY, "_libaacs_get_vid(): libaacs not initialized! (%p)", bd);
return NULL;
}
......@@ -586,19 +586,19 @@ static int _libbdplus_required(BLURAY *bd)
if (fd) {
file_close(fd);
DEBUG(DBG_BLURAY, "BDSVM/00000.svm found. Disc seems to be BD+ protected (%p)\n", bd);
BD_DEBUG(DBG_BLURAY, "BDSVM/00000.svm found. Disc seems to be BD+ protected (%p)\n", bd);
bd->disc_info.bdplus_detected = 1;
return 1;
}
DEBUG(DBG_BLURAY, "BDSVM/00000.svm not found. No BD+ protection (%p)\n", bd);
BD_DEBUG(DBG_BLURAY, "BDSVM/00000.svm not found. No BD+ protection (%p)\n", bd);
bd->disc_info.bdplus_detected = 0;
return 0;