CBDDemuxer::CBDDemuxer(CCritSec *pLock, ILAVFSettingsInternal *pSettings) : CBaseDemuxer(L"bluray demuxer", pLock) , m_pSettings(pSettings) { #ifdef DEBUG bd_set_debug_mask(DBG_FILE|DBG_BLURAY|DBG_DIR|DBG_NAV|DBG_CRIT); bd_set_debug_handler(&bd_log); #else bd_set_debug_mask(0); #endif }
bool CBlurayDirectory::InitializeBluray(const std::string &root) { bd_set_debug_handler(CBlurayCallback::bluray_logger); bd_set_debug_mask(DBG_CRIT | DBG_BLURAY | DBG_NAV); m_bd = bd_init(); if (!m_bd) { CLog::Log(LOGERROR, "CBlurayDirectory::InitializeBluray - failed to initialize libbluray"); return false; } std::string langCode; g_LangCodeExpander.ConvertToISO6392T(g_langInfo.GetDVDMenuLanguage(), langCode); bd_set_player_setting_str(m_bd, BLURAY_PLAYER_SETTING_MENU_LANG, langCode.c_str()); if (!bd_open_files(m_bd, const_cast<std::string*>(&root), CBlurayCallback::dir_open, CBlurayCallback::file_open)) { CLog::Log(LOGERROR, "CBlurayDirectory::InitializeBluray - failed to open %s", CURL::GetRedacted(root).c_str()); return false; } m_blurayInitialized = true; return true; }
CBDDemuxer::CBDDemuxer(CCritSec *pLock, ILAVFSettingsInternal *pSettings) : CBaseDemuxer(L"bluray demuxer", pLock) , m_lavfDemuxer(NULL) , m_pb(NULL) , m_pBD(NULL) , m_pTitle(NULL) , m_pSettings(pSettings) , m_rtOffset(NULL) , m_rtNewOffset(0) , m_bNewOffsetPos(0) , m_nTitleCount(0) { #ifdef DEBUG bd_set_debug_mask(DBG_FILE|DBG_BLURAY|DBG_DIR|DBG_NAV|DBG_CRIT); bd_set_debug_handler(&bd_log); #endif }
int main(int argc, char *argv[]) { int title = -1; int verbose = 0; int args = 0; /* * parse arguments */ if (argc < 2) { printf("\nUsage:\n %s [-v] [-t <title>] <media_path> [<keyfile_path>]\n\n", argv[0]); return -1; } if (!strcmp(argv[1+args], "-v")) { verbose = 1; args++; } if (!strcmp(argv[1+args], "-t")) { args++; title = atoi(argv[1+args]); args++; printf("Requested title %d\n", title); } if (verbose) { printf("Enabling verbose debug\n"); bd_set_debug_mask(bd_get_debug_mask() | DBG_HDMV | DBG_BLURAY); } printf("\n"); /* * open and setup */ BLURAY *bd = bd_open(argv[1+args], argv[2+args]); if (!bd) { printf("bd_open(\'%s\') failed\n", argv[1]); return -1; } bd_set_player_setting (bd, BLURAY_PLAYER_SETTING_PARENTAL, 99); bd_set_player_setting_str(bd, BLURAY_PLAYER_SETTING_AUDIO_LANG, "eng"); bd_set_player_setting_str(bd, BLURAY_PLAYER_SETTING_PG_LANG, "eng"); bd_set_player_setting_str(bd, BLURAY_PLAYER_SETTING_MENU_LANG, "eng"); bd_set_player_setting_str(bd, BLURAY_PLAYER_SETTING_COUNTRY_CODE, NULL); /* * play */ printf("Running first play movie object\n"); fflush(stdout); bd_play(bd); _print_events(bd); printf("\n"); /* * play title */ if (title >= 0) { printf("Playing title %d\n", title); fflush(stdout); bd_play_title(bd, title); _print_events(bd); printf("\n"); } /* * play playlist */ _play_pl(bd); _play_pl(bd); _play_pl(bd); /* * clean up */ bd_close(bd); return 0; }