diff -Nru libbluray-0.2.2/ChangeLog libbluray-0.2.3/ChangeLog --- libbluray-0.2.2/ChangeLog 2012-03-19 14:23:58.000000000 +0000 +++ libbluray-0.2.3/ChangeLog 2012-08-17 11:27:32.000000000 +0000 @@ -1,3 +1,12 @@ +2012-08-17: Version 0.2.3 + - Fixed memory leaks + - Automatic language selection: disable subtitles when audio is in the same language + - Fixed accessing outside of array bounds + - Default to stream 0 when requested language not found + - Install bd_info + - Added disc ID and AACS MKB version to BD_DISC_INFO + - Added extended AACS error codes + 2012-03-19: Version 0.2.2 - Fixed displaying of single-loop animated buttons when not using animations - Added events for pop-up menu availability and IG menu status diff -Nru libbluray-0.2.2/Makefile.in libbluray-0.2.3/Makefile.in --- libbluray-0.2.2/Makefile.in 2012-03-19 14:53:36.000000000 +0000 +++ libbluray-0.2.3/Makefile.in 2012-08-17 11:31:47.000000000 +0000 @@ -175,7 +175,7 @@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ -DLOPEN_LDFLAGS = @DLOPEN_LDFLAGS@ +DLOPEN_LIBS = @DLOPEN_LIBS@ DOXYGEN_PAPER_SIZE = @DOXYGEN_PAPER_SIZE@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ diff -Nru libbluray-0.2.2/configure libbluray-0.2.3/configure --- libbluray-0.2.2/configure 2012-03-19 14:53:34.000000000 +0000 +++ libbluray-0.2.3/configure 2012-08-17 11:31:41.000000000 +0000 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for libbluray 0.2.2. +# Generated by GNU Autoconf 2.68 for libbluray 0.2.3. # # Report bugs to . # @@ -570,8 +570,8 @@ # Identity of this package. PACKAGE_NAME='libbluray' PACKAGE_TARNAME='libbluray' -PACKAGE_VERSION='0.2.2' -PACKAGE_STRING='libbluray 0.2.2' +PACKAGE_VERSION='0.2.3' +PACKAGE_STRING='libbluray 0.2.3' PACKAGE_BUGREPORT='http://www.videolan.org/developers/libbluray.html' PACKAGE_URL='' @@ -618,7 +618,7 @@ SET_DEBUG_OPTS SET_OPTIMIZATIONS SET_WARNINGS -DLOPEN_LDFLAGS +DLOPEN_LIBS BDJAVA_CFLAGS LT_VERSION_INFO BLURAY_VERSION_MICRO @@ -1380,7 +1380,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures libbluray 0.2.2 to adapt to many kinds of systems. +\`configure' configures libbluray 0.2.3 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1451,7 +1451,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of libbluray 0.2.2:";; + short | recursive ) echo "Configuration of libbluray 0.2.3:";; esac cat <<\_ACEOF @@ -1584,7 +1584,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -libbluray configure 0.2.2 +libbluray configure 0.2.3 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -2010,7 +2010,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by libbluray $as_me 0.2.2, which was +It was created by libbluray $as_me 0.2.3, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2937,7 +2937,7 @@ # Define the identity of the package. PACKAGE='libbluray' - VERSION='0.2.2' + VERSION='0.2.3' cat >>confdefs.h <<_ACEOF @@ -12216,7 +12216,7 @@ cat >>confdefs.h <<_ACEOF #define HAVE_DLOPEN 1 _ACEOF - DLOPEN_LDFLAGS="" + DLOPEN_LIBS="" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } @@ -12255,7 +12255,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = xyes; then : - DLOPEN_LDFLAGS="-ldl" + DLOPEN_LIBS="-ldl" else as_fn_error $? "$library_not_found" "$LINENO" 5 fi @@ -12543,6 +12543,10 @@ check_cc_options -Wundef && \ SET_WARNINGS="$SET_WARNINGS -Wundef" +# no implicit function declarations +check_cc_options -Werror-implicit-function-declaration && \ + SET_WARNINGS="$SET_WARNINGS -Werror-implicit-function-declaration" + # use -Werror if [ $use_werror = "yes" ]; then check_cc_options -Werror && \ @@ -14557,11 +14561,11 @@ BLURAY_VERSION_MINOR=2 -BLURAY_VERSION_MICRO=2 +BLURAY_VERSION_MICRO=3 # export library (.so) version -LT_VERSION_INFO="2:0:1" +LT_VERSION_INFO="3:0:2" # generate output files @@ -15202,7 +15206,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by libbluray $as_me 0.2.2, which was +This file was extended by libbluray $as_me 0.2.3, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -15268,7 +15272,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -libbluray config.status 0.2.2 +libbluray config.status 0.2.3 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff -Nru libbluray-0.2.2/configure.ac libbluray-0.2.3/configure.ac --- libbluray-0.2.2/configure.ac 2012-03-19 14:23:58.000000000 +0000 +++ libbluray-0.2.3/configure.ac 2012-08-17 11:27:32.000000000 +0000 @@ -1,7 +1,7 @@ # library version number m4_define([bluray_major], 0) m4_define([bluray_minor], 2) -m4_define([bluray_micro], 2) +m4_define([bluray_micro], 3) m4_define([bluray_version],[bluray_major.bluray_minor.bluray_micro]) # shared library version (.so version) @@ -12,9 +12,9 @@ # # Library file name will be libbluray.so.(current-age).age.revision # -m4_define([lt_current], 2) +m4_define([lt_current], 3) m4_define([lt_revision], 0) -m4_define([lt_age], 1) +m4_define([lt_age], 2) # initilization AC_INIT([libbluray], bluray_version, [http://www.videolan.org/developers/libbluray.html]) @@ -139,9 +139,9 @@ if test "${SYS}" != "mingw32" ; then AC_CHECK_FUNCS( [dlopen], - [DLOPEN_LDFLAGS=""], + [DLOPEN_LIBS=""], [AC_CHECK_LIB([dl], [dlopen], - [DLOPEN_LDFLAGS="-ldl"], + [DLOPEN_LIBS="-ldl"], [AC_MSG_ERROR($library_not_found)])]) fi @@ -198,6 +198,10 @@ check_cc_options -Wundef && \ SET_WARNINGS="$SET_WARNINGS -Wundef" +# no implicit function declarations +check_cc_options -Werror-implicit-function-declaration && \ + SET_WARNINGS="$SET_WARNINGS -Werror-implicit-function-declaration" + # use -Werror if [[ $use_werror = "yes" ]]; then check_cc_options -Werror && \ @@ -272,7 +276,7 @@ # generate output files AC_SUBST(BDJAVA_CFLAGS) -AC_SUBST(DLOPEN_LDFLAGS) +AC_SUBST(DLOPEN_LIBS) AC_SUBST(SET_WARNINGS) AC_SUBST(SET_OPTIMIZATIONS) AC_SUBST(SET_DEBUG_OPTS) diff -Nru libbluray-0.2.2/debian/changelog libbluray-0.2.3/debian/changelog --- libbluray-0.2.2/debian/changelog 2012-04-05 21:12:43.000000000 +0000 +++ libbluray-0.2.3/debian/changelog 2012-11-20 07:56:29.000000000 +0000 @@ -1,14 +1,31 @@ -libbluray (1:0.2.2-1~ppa2) precise; urgency=low +libbluray (1:0.2.3-1~precise) precise; urgency=low - * Rebuild for Precise. + [ wsnipex ] + * port to precise - -- Nate Muench Thu, 05 Apr 2012 16:12:30 -0500 + -- wsnipex Tue, 20 Nov 2012 08:55:24 +0100 -libbluray (1:0.2.2-1~ppa1) oneiric; urgency=low +libbluray (1:0.2.3-1) experimental; urgency=low - * Backported from Debian unstable. + [ Rico Tzschichholz ] + * New upstream release + - Fixed memory leaks + - Automatic language selection: disable subtitles when audio is in the + same language + - Fixed accessing outside of array bounds + - Default to stream 0 when requested language not found + - Install bd_info + - Added disc ID and AACS MKB version to BD_DISC_INFO + - Added extended AACS error codes + + [ James Page ] + * Transition package to use default java implementation: + - d/control: BD on default-jdk for linux archs. + - d/rules: Use /usr/lib/jvm/default-java for JAVA_HOME. + - d/patches/java-compat.patch: Set source/target = 1.5 to ensure + that backwards compatible bytecode is built. - -- Nate Muench Wed, 21 Mar 2012 16:29:53 -0500 + -- Rico Tzschichholz Wed, 19 Sep 2012 08:46:53 +0200 libbluray (1:0.2.2-1) unstable; urgency=low diff -Nru libbluray-0.2.2/debian/control libbluray-0.2.3/debian/control --- libbluray-0.2.2/debian/control 2012-03-16 21:53:42.000000000 +0000 +++ libbluray-0.2.3/debian/control 2012-09-20 17:18:52.000000000 +0000 @@ -9,7 +9,7 @@ DM-Upload-Allowed: yes Build-Depends: debhelper (>= 8.1.3~), javahelper, - openjdk-6-jdk [linux-any], + default-jdk [linux-any], ant, libxml2-dev, doxygen, diff -Nru libbluray-0.2.2/debian/patches/01_java-compat.patch libbluray-0.2.3/debian/patches/01_java-compat.patch --- libbluray-0.2.2/debian/patches/01_java-compat.patch 1970-01-01 00:00:00.000000000 +0000 +++ libbluray-0.2.3/debian/patches/01_java-compat.patch 2012-09-20 17:18:52.000000000 +0000 @@ -0,0 +1,19 @@ +Description: Ensure source/target is specified so backwards + compatible bytecode is generated during the build process. +Author: James Page +Forwarded: no + +Index: libbluray-0.2.2/src/libbluray/bdj/build.xml +=================================================================== +--- libbluray-0.2.2.orig/src/libbluray/bdj/build.xml 2010-07-19 10:54:58.000000000 +0100 ++++ libbluray-0.2.2/src/libbluray/bdj/build.xml 2012-08-06 11:44:21.099044620 +0100 +@@ -15,7 +15,8 @@ + + +- ++ + + + "; } +static const char *_hex2str(const uint8_t *data, size_t len) +{ + static char *str = NULL; + size_t i; + + str = realloc(str, 2*len + 1); + *str = 0; + + for (i = 0; i < len; i++) { + sprintf(str+2*i, "%02X", data[i]); + } + + return str; +} + +static const char *_aacs_error2str(int error_code) +{ + switch (error_code) { + case BD_AACS_CORRUPTED_DISC: return "corrupted BluRay disc"; + case BD_AACS_NO_CONFIG: return "AACS configuration file missing"; + case BD_AACS_NO_PK: return "no matching processing key"; + case BD_AACS_NO_CERT: return "no valid AACS certificate"; + case BD_AACS_CERT_REVOKED: return "AACS certificate revoked"; + case BD_AACS_MMC_FAILED: return "MMC authentication failed"; + } + return "unknown error"; +} + static const char *_res2str(int x, int y) { if (x > 0 && y > 0 && x < 0xffff && y < 0xffff) { @@ -130,7 +158,14 @@ printf("\nAACS detected : %s\n", _yes_no(info->aacs_detected)); if (info->aacs_detected) { printf("libaacs detected : %s\n", _yes_no(info->libaacs_detected)); - printf("AACS handled : %s\n", _yes_no(info->aacs_handled)); + if (info->libaacs_detected) { + printf("Disc ID : %s\n", _hex2str(info->disc_id, sizeof(info->disc_id))); + printf("AACS MKB version : %d\n", info->aacs_mkbv); + printf("AACS handled : %s\n", _yes_no(info->aacs_handled)); + if (!info->aacs_handled) { + printf(" (%s)\n", _aacs_error2str(info->aacs_error_code)); + } + } } printf("\nBD+ detected : %s\n", _yes_no(info->bdplus_detected)); @@ -141,5 +176,7 @@ _print_meta(bd_get_meta(bd)); + bd_close(bd); + return 0; } diff -Nru libbluray-0.2.2/src/examples/list_titles.c libbluray-0.2.3/src/examples/list_titles.c --- libbluray-0.2.2/src/examples/list_titles.c 2011-06-13 20:23:12.000000000 +0000 +++ libbluray-0.2.3/src/examples/list_titles.c 2012-08-17 11:27:32.000000000 +0000 @@ -96,5 +96,6 @@ ); bd_free_title_info(ti); } + bd_close(bd); return 0; } diff -Nru libbluray-0.2.2/src/libbluray/bdnav/meta_parse.c libbluray-0.2.3/src/libbluray/bdnav/meta_parse.c --- libbluray-0.2.2/src/libbluray/bdnav/meta_parse.c 2012-01-19 09:22:21.000000000 +0000 +++ libbluray-0.2.3/src/libbluray/bdnav/meta_parse.c 2012-08-17 11:27:32.000000000 +0000 @@ -43,44 +43,52 @@ #include #endif +#define BAD_CAST_CONST (const xmlChar *) + + #ifdef HAVE_LIBXML2 static void _parseManifestNode(xmlNode * a_node, META_DL *disclib) { xmlNode *cur_node = NULL; + xmlChar *tmp; for (cur_node = a_node; cur_node; cur_node = cur_node->next) { if (cur_node->type == XML_ELEMENT_NODE) { - if (xmlStrEqual(cur_node->parent->name, xmlCharStrdup("title"))) { - if (xmlStrEqual(cur_node->name, xmlCharStrdup("name"))) { - disclib->di_name = (char*)xmlStrdup(xmlNodeGetContent(cur_node)); + if (xmlStrEqual(cur_node->parent->name, BAD_CAST_CONST "title")) { + if (xmlStrEqual(cur_node->name, BAD_CAST_CONST "name")) { + disclib->di_name = (char*)xmlNodeGetContent(cur_node); } - if (xmlStrEqual(cur_node->name, xmlCharStrdup("alternative"))) { - disclib->di_alternative = (char*)xmlStrdup(xmlNodeGetContent(cur_node)); + if (xmlStrEqual(cur_node->name, BAD_CAST_CONST "alternative")) { + disclib->di_alternative = (char*)xmlNodeGetContent(cur_node); } - if (xmlStrEqual(cur_node->name, xmlCharStrdup("numSets"))) { - disclib->di_num_sets = atoi((char*)xmlNodeGetContent(cur_node)); + if (xmlStrEqual(cur_node->name, BAD_CAST_CONST "numSets")) { + disclib->di_num_sets = atoi((char*)(tmp = xmlNodeGetContent(cur_node))); + xmlFree(tmp); } - if (xmlStrEqual(cur_node->name, xmlCharStrdup("setNumber"))) { - disclib->di_set_number = atoi((char*)xmlNodeGetContent(cur_node)); + if (xmlStrEqual(cur_node->name, BAD_CAST_CONST "setNumber")) { + disclib->di_set_number = atoi((char*)(tmp = xmlNodeGetContent(cur_node))); + xmlFree(tmp); } } - else if (xmlStrEqual(cur_node->parent->name, xmlCharStrdup("tableOfContents"))) { - if (xmlStrEqual(cur_node->name, xmlCharStrdup("titleName")) && xmlGetProp(cur_node, xmlCharStrdup("titleNumber"))) { + else if (xmlStrEqual(cur_node->parent->name, BAD_CAST_CONST "tableOfContents")) { + if (xmlStrEqual(cur_node->name, BAD_CAST_CONST "titleName") && (tmp = xmlGetProp(cur_node, BAD_CAST_CONST "titleNumber"))) { int i = disclib->toc_count; disclib->toc_count++; disclib->toc_entries = realloc(disclib->toc_entries, (disclib->toc_count*sizeof(META_TITLE))); - disclib->toc_entries[i].title_number = atoi((const char*)xmlGetProp(cur_node, xmlCharStrdup("titleNumber"))); - disclib->toc_entries[i].title_name = (char*)xmlStrdup(xmlNodeGetContent(cur_node)); + disclib->toc_entries[i].title_number = atoi((const char*)tmp); + disclib->toc_entries[i].title_name = (char*)xmlNodeGetContent(cur_node); + X_FREE(tmp); } } - else if (xmlStrEqual(cur_node->parent->name, xmlCharStrdup("description"))) { - if (xmlStrEqual(cur_node->name, xmlCharStrdup("thumbnail")) && xmlGetProp(cur_node, xmlCharStrdup("href"))) { + else if (xmlStrEqual(cur_node->parent->name, BAD_CAST_CONST "description")) { + if (xmlStrEqual(cur_node->name, BAD_CAST_CONST "thumbnail") && (tmp = xmlGetProp(cur_node, BAD_CAST_CONST "href"))) { uint8_t i = disclib->thumb_count; disclib->thumb_count++; disclib->thumbnails = realloc(disclib->thumbnails, (disclib->thumb_count*sizeof(META_THUMBNAIL))); - disclib->thumbnails[i].path = strdup((const char*)xmlGetProp(cur_node, xmlCharStrdup("href"))); - if (xmlGetProp(cur_node, xmlCharStrdup("size"))) { - sscanf((const char*)xmlGetProp(cur_node, xmlCharStrdup("size")), "%ix%i", &disclib->thumbnails[i].xres, &disclib->thumbnails[i].yres); + disclib->thumbnails[i].path = (char *)tmp; + if ((tmp = xmlGetProp(cur_node, BAD_CAST_CONST "size"))) { + sscanf((const char*)tmp, "%ix%i", &disclib->thumbnails[i].xres, &disclib->thumbnails[i].yres); + X_FREE(tmp); } else { disclib->thumbnails[i].xres = disclib->thumbnails[i].yres = -1; @@ -142,6 +150,8 @@ BD_FILE_H *handle = file_open(path, "rb"); if (handle == NULL) { BD_DEBUG(DBG_DIR, "Failed to open meta file (%s)\n", path); + X_FREE(path); + X_FREE(base); continue; } @@ -155,6 +165,8 @@ doc = xmlReadMemory((char*)data, size_read, base, NULL, 0); if (doc == NULL) { BD_DEBUG(DBG_DIR, "Failed to parse %s\n", path); + X_FREE(path); + X_FREE(base); continue; } xmlNode *root_element = NULL; @@ -169,6 +181,8 @@ X_FREE(data); } file_close(handle); + X_FREE(path); + X_FREE(base); } xmlCleanupParser(); return root; @@ -214,18 +228,19 @@ uint8_t i; for (i = 0; i < (*p)->dl_count; i++) { uint32_t t; - for (t=0; i < (*p)->dl_entries[i].toc_count; t++) { + for (t = 0; t < (*p)->dl_entries[i].toc_count; t++) { X_FREE((*p)->dl_entries[i].toc_entries[t].title_name); - X_FREE((*p)->dl_entries[i].toc_entries); } - for (t = 0; i < (*p)->dl_entries[i].thumb_count; t++) { + for (t = 0; t < (*p)->dl_entries[i].thumb_count; t++) { X_FREE((*p)->dl_entries[i].thumbnails[t].path); - X_FREE((*p)->dl_entries[i].thumbnails); } + X_FREE((*p)->dl_entries[i].toc_entries); + X_FREE((*p)->dl_entries[i].thumbnails); X_FREE((*p)->dl_entries[i].filename); X_FREE((*p)->dl_entries[i].di_name); X_FREE((*p)->dl_entries[i].di_alternative); } + X_FREE((*p)->dl_entries); X_FREE(*p); } } diff -Nru libbluray-0.2.2/src/libbluray/bdnav/mpls_parse.c libbluray-0.2.3/src/libbluray/bdnav/mpls_parse.c --- libbluray-0.2.2/src/libbluray/bdnav/mpls_parse.c 2011-10-22 21:07:05.000000000 +0000 +++ libbluray-0.2.3/src/libbluray/bdnav/mpls_parse.c 2012-08-17 11:27:32.000000000 +0000 @@ -401,6 +401,14 @@ static void _clean_stn(MPLS_STN *stn) { + if(stn->secondary_audio) { + X_FREE(stn->secondary_audio->sa_primary_audio_ref); + } + if(stn->secondary_video) { + X_FREE(stn->secondary_video->sv_secondary_audio_ref); + X_FREE(stn->secondary_video->sv_pip_pg_ref); + } + X_FREE(stn->video); X_FREE(stn->audio); X_FREE(stn->pg); diff -Nru libbluray-0.2.2/src/libbluray/bluray-version.h libbluray-0.2.3/src/libbluray/bluray-version.h --- libbluray-0.2.2/src/libbluray/bluray-version.h 2012-03-19 14:53:56.000000000 +0000 +++ libbluray-0.2.3/src/libbluray/bluray-version.h 2012-08-17 11:32:04.000000000 +0000 @@ -27,9 +27,9 @@ #define BLURAY_VERSION_MAJOR 0 #define BLURAY_VERSION_MINOR 2 -#define BLURAY_VERSION_MICRO 2 +#define BLURAY_VERSION_MICRO 3 -#define BLURAY_VERSION_STRING "0.2.2" +#define BLURAY_VERSION_STRING "0.2.3" #define BLURAY_VERSION \ BLURAY_VERSION_CODE(BLURAY_VERSION_MAJOR, BLURAY_VERSION_MINOR, BLURAY_VERSION_MICRO) diff -Nru libbluray-0.2.2/src/libbluray/bluray.c libbluray-0.2.3/src/libbluray/bluray.c --- libbluray-0.2.2/src/libbluray/bluray.c 2012-03-19 14:23:58.000000000 +0000 +++ libbluray-0.2.3/src/libbluray/bluray.c 2012-08-17 11:27:32.000000000 +0000 @@ -258,8 +258,9 @@ static void _update_stream_psr_by_lang(BD_REGISTERS *regs, uint32_t psr_lang, uint32_t psr_stream, - uint32_t enable_flag, uint32_t undefined_val, - MPLS_STREAM *streams, unsigned num_streams) + uint32_t enable_flag, + MPLS_STREAM *streams, unsigned num_streams, + uint32_t *lang, uint32_t blacklist) { uint32_t psr_val; int stream_idx = -1; @@ -283,13 +284,21 @@ if (stream_idx < 0) { /* requested language not found */ - stream_idx = undefined_val - 1; + stream_idx = 0; enable_flag = 0; + + } else { + if (lang) { + *lang = psr_val; + } + if (blacklist == psr_val) { + enable_flag = 0; + } } /* update PSR */ - BD_DEBUG(DBG_BLURAY, "Selected stream %d (language %s)\n", ii, streams[ii].lang); + BD_DEBUG(DBG_BLURAY, "Selected stream %d (language %s)\n", stream_idx, streams[stream_idx].lang); bd_psr_lock(regs); @@ -310,13 +319,16 @@ */ if (bd->title_type == title_undef) { MPLS_STN *stn = &clip->title->pl->play_item[clip->ref].stn; + uint32_t audio_lang = 0; _update_stream_psr_by_lang(bd->regs, - PSR_AUDIO_LANG, PSR_PRIMARY_AUDIO_ID, 0, 0xff, - stn->audio, stn->num_audio); + PSR_AUDIO_LANG, PSR_PRIMARY_AUDIO_ID, 0, + stn->audio, stn->num_audio, + &audio_lang, 0); _update_stream_psr_by_lang(bd->regs, - PSR_PG_AND_SUB_LANG, PSR_PG_STREAM, 0x80000000, 0xfff, - stn->pg, stn->num_pg); + PSR_PG_AND_SUB_LANG, PSR_PG_STREAM, 0x80000000, + stn->pg, stn->num_pg, + NULL, audio_lang); } } @@ -701,17 +713,59 @@ return 0; } - bd->aacs = bd->libaacs_open(bd->device_path, keyfile_path); + int error_code = 0; + fptr_p_void aacs_open2 = (fptr_p_void)dl_dlsym(bd->h_libaacs, "aacs_open2"); + if (!aacs_open2) { + BD_DEBUG(DBG_BLURAY, "Using old aacs_open(), no verbose error reporting available (%p)\n", bd->aacs); + bd->aacs = bd->libaacs_open(bd->device_path, keyfile_path); + } else { + bd->aacs = aacs_open2(bd->device_path, keyfile_path, &error_code); + } if (bd->aacs) { - BD_DEBUG(DBG_BLURAY, "Opened libaacs (%p)\n", bd->aacs); - bd->disc_info.aacs_handled = 1; - return 1; + fptr_int aacs_get_mkb_version = (fptr_int) dl_dlsym(bd->h_libaacs, "aacs_get_mkb_version"); + fptr_p_void aacs_get_disc_id = (fptr_p_void) dl_dlsym(bd->h_libaacs, "aacs_get_disc_id"); + if (aacs_get_mkb_version) { + bd->disc_info.aacs_mkbv = aacs_get_mkb_version(bd->aacs); + } + if (aacs_get_disc_id) { + memcpy(bd->disc_info.disc_id, aacs_get_disc_id(bd->aacs), 20); + } + + if (!error_code) { + BD_DEBUG(DBG_BLURAY, "Opened libaacs (%p)\n", bd->aacs); + bd->disc_info.aacs_handled = 1; + return 1; + } } BD_DEBUG(DBG_BLURAY, "aacs_open() failed!\n"); bd->disc_info.aacs_handled = 0; + switch (error_code) { + case 0: /* AACS_SUCCESS */ + break; + case -1: /* AACS_ERROR_CORRUPTED_DISC */ + bd->disc_info.aacs_error_code = BD_AACS_CORRUPTED_DISC; + break; + case -2: /* AACS_ERROR_NO_CONFIG */ + bd->disc_info.aacs_error_code = BD_AACS_NO_CONFIG; + break; + case -3: /* AACS_ERROR_NO_PK */ + bd->disc_info.aacs_error_code = BD_AACS_NO_PK; + break; + case -4: /* AACS_ERROR_NO_CERT */ + bd->disc_info.aacs_error_code = BD_AACS_NO_CERT; + break; + case -5: /* AACS_ERROR_CERT_REVOKED */ + bd->disc_info.aacs_error_code = BD_AACS_CERT_REVOKED; + break; + case -6: /* AACS_ERROR_MMC_OPEN */ + case -7: /* AACS_ERROR_MMC_FAILURE */ + bd->disc_info.aacs_error_code = BD_AACS_MMC_FAILED; + break; + } + _libaacs_unload(bd); return 0; } @@ -1048,6 +1102,7 @@ gc_free(&bd->graphics_controller); indx_free(&bd->index); + meta_free(&bd->meta); sound_free(&bd->sound_effects); bd_registers_free(bd->regs); @@ -1307,15 +1362,15 @@ } } } + if (st->clip == NULL) { + // We previously reached the last clip. Nothing + // else to read. + _queue_event(bd, (BD_EVENT){BD_EVENT_END_OF_TITLE, 0}); + return 0; + } if (st->int_buf_off == 6144 || clip_pkt >= st->clip->end_pkt) { // Do we need to get the next clip? - if (st->clip == NULL) { - // We previously reached the last clip. Nothing - // else to read. - _queue_event(bd, (BD_EVENT){BD_EVENT_END_OF_TITLE, 0}); - return 0; - } if (clip_pkt >= st->clip->end_pkt) { // split read()'s at clip boundary diff -Nru libbluray-0.2.2/src/libbluray/bluray.h libbluray-0.2.3/src/libbluray/bluray.h --- libbluray-0.2.2/src/libbluray/bluray.h 2012-03-19 14:23:58.000000000 +0000 +++ libbluray-0.2.3/src/libbluray/bluray.h 2012-08-17 11:27:32.000000000 +0000 @@ -407,6 +407,14 @@ * Disc info */ +/* AACS error codes */ +#define BD_AACS_CORRUPTED_DISC -1 +#define BD_AACS_NO_CONFIG -2 +#define BD_AACS_NO_PK -3 +#define BD_AACS_NO_CERT -4 +#define BD_AACS_CERT_REVOKED -5 +#define BD_AACS_MMC_FAILED -6 + typedef struct { uint8_t bluray_detected; @@ -425,6 +433,14 @@ uint8_t libbdplus_detected; uint8_t bdplus_handled; + /* aacs error code */ + int aacs_error_code; + /* aacs MKB version */ + int aacs_mkbv; + + /* Disc ID */ + uint8_t disc_id[20]; + } BLURAY_DISC_INFO; /** diff -Nru libbluray-0.2.2/src/libbluray/decoders/graphics_controller.c libbluray-0.2.3/src/libbluray/decoders/graphics_controller.c --- libbluray-0.2.2/src/libbluray/decoders/graphics_controller.c 2012-01-27 16:45:40.000000000 +0000 +++ libbluray-0.2.3/src/libbluray/decoders/graphics_controller.c 2012-08-17 11:27:32.000000000 +0000 @@ -711,7 +711,7 @@ /* make sure we won't wipe other buttons */ unsigned ii, skip = 0; for (ii = 0; &gc->bog_data[ii] != bog_data; ii++) { - if (_areas_overlap(bog_data, &bog_data[ii])) + if (_areas_overlap(bog_data, &gc->bog_data[ii])) skip = 1; /* FIXME: clean non-overlapping area */ }