From subversion at mplayerhq.hu Sat Sep 4 19:26:51 2021 From: subversion at mplayerhq.hu (reimar) Date: Sat, 4 Sep 2021 19:26:51 +0300 (EEST) Subject: [MPlayer-cvslog] r38314 - trunk/stream/stream_bd.c Message-ID: <20210904162651.3343368A16C@ffbox0-bg.mplayerhq.hu> Author: reimar Date: Sat Sep 4 19:26:50 2021 New Revision: 38314 Log: stream_bd.c: support newer keydb.cfg format Modified: trunk/stream/stream_bd.c Modified: trunk/stream/stream_bd.c ============================================================================== --- trunk/stream/stream_bd.c Fri May 14 23:26:55 2021 (r38313) +++ trunk/stream/stream_bd.c Sat Sep 4 19:26:50 2021 (r38314) @@ -170,10 +170,15 @@ static int find_vuk(struct bd_priv *bd, if (vukfound) return 1; } - filename = av_asprintf("%s/.config/aacs/KEYDB.cfg", home); + filename = av_asprintf("%s/.config/aacs/keydb.cfg", home); file = open_stream(filename, NULL, NULL); if (!file) { av_freep(&filename); + filename = av_asprintf("%s/.config/aacs/KEYDB.cfg", home); + file = open_stream(filename, NULL, NULL); + } + if (!file) { + av_freep(&filename); filename = av_asprintf("%s/.dvdcss/KEYDB.cfg", home); file = open_stream(filename, NULL, NULL); } @@ -197,7 +202,9 @@ static int find_vuk(struct bd_priv *bd, // or I | I-Key // can be followed by ; and comment - if (av_strncasecmp(line, idstr, 40)) + if (strlen(line) < 40) continue; + // Do not care whether it starts with 0x or not + if (av_strncasecmp(line, idstr, 40) && av_strncasecmp(line + 2, idstr, 40)) continue; mp_msg(MSGT_OPEN, MSGL_V, "KeyDB found Entry for DiscID:\n%s\n", line); @@ -206,6 +213,7 @@ static int find_vuk(struct bd_priv *bd, break; vst += 6; while (isspace(*vst)) vst++; + if (vst[0] == '0' && vst[1] == 'x') vst += 2; if (sscanf(vst, "%16"SCNx64, &bd->vuk.u64[0]) != 1) continue; if (sscanf(vst + 16, "%16"SCNx64, &bd->vuk.u64[1]) != 1) @@ -214,6 +222,8 @@ static int find_vuk(struct bd_priv *bd, bd->vuk.u64[1] = av_be2ne64(bd->vuk.u64[1]); vukfound = 1; } + if (!vukfound) + mp_msg(MSGT_OPEN, MSGL_V, "Failed to find KeyDB Entry for DiscID:\n%s\n", line); free_stream(file); return vukfound; }