diff options
author | Ricardo Constantino <wiiaboo@gmail.com> | 2018-01-11 01:02:16 +0000 |
---|---|---|
committer | Ricardo Constantino <wiiaboo@gmail.com> | 2018-01-11 02:34:02 +0000 |
commit | e3bee23fe4e0dc15ea2564b684572572f2393a15 (patch) | |
tree | 346a6f7a9b10356ab46479bdfb7f1d5480b9a97b /stream/stream_bluray.c | |
parent | 154ff98128f38ff9f7ac2139013e80004b2aeb8e (diff) | |
download | mpv-e3bee23fe4e0dc15ea2564b684572572f2393a15.tar.bz2 mpv-e3bee23fe4e0dc15ea2564b684572572f2393a15.tar.xz |
stream_bluray: support detecting UHD BD directories
Close #5325
Diffstat (limited to 'stream/stream_bluray.c')
-rw-r--r-- | stream/stream_bluray.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/stream/stream_bluray.c b/stream/stream_bluray.c index 25dd1d4f8f..4dad779739 100644 --- a/stream/stream_bluray.c +++ b/stream/stream_bluray.c @@ -529,19 +529,16 @@ static bool check_bdmv(const char *path) if (!temp) return false; - bool r = false; + char data[50] = {0}; - const char *sig1 = "MOBJ020"; - const char *sig2 = "MOBJ0100"; - char data[50]; + fread(data, 50, 1, temp); + fclose(temp); - if (fread(data, 50, 1, temp) == 1) { - r = memcmp(data, sig1, strlen(sig1)) == 0 || - memcmp(data, sig2, strlen(sig2)) == 0; - } + bstr bdata = {data, 50}; - fclose(temp); - return r; + return bstr_startswith0(bdata, "MOBJ0100") || // AVCHD + bstr_startswith0(bdata, "MOBJ0200") || // Blu-ray + bstr_startswith0(bdata, "MOBJ0300"); // UHD BD } // Destructively remove the current trailing path component. |