From 6b2b65af737a6f04e2a251b38694fe1576c2ed68 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Thu, 5 Nov 2020 13:04:42 +0100 Subject: Better detect non-streamable videos, do not sort rooms by activity, it causes a mess on update --- src/QuickMedia.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/QuickMedia.cpp') diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp index 5fc5fb7..c9072b2 100644 --- a/src/QuickMedia.cpp +++ b/src/QuickMedia.cpp @@ -1532,7 +1532,7 @@ namespace QuickMedia { static int accumulate_string_limit_head(char *data, int size, void *userdata) { std::string *str = (std::string*)userdata; str->append(data, size); - if(str->size() >= 40) + if(str->size() >= 42) return 1; return 0; } @@ -1540,10 +1540,10 @@ namespace QuickMedia { static bool video_url_is_non_streamable_mp4(const char *url) { std::string result; const char *args[] = { "curl", "-sLf", "-r", "0-40", "-H", useragent_str, "--", url, nullptr }; - exec_program(args, accumulate_string_limit_head, &result, 40); - return (result.size() >= 40) + exec_program(args, accumulate_string_limit_head, &result, 42); + return (result.size() >= 42) && (memcmp(&result[4], "ftypisom", 8) == 0 || memcmp(&result[4], "ftypmp42", 8) == 0 || memcmp(&result[4], "ftymp42", 7) == 0 || memcmp(&result[4], "fty3gp5", 7) == 0) - && (memcmp(&result[36], "moov", 4) != 0); + && (memmem(&result[0], result.size(), "moov", 4) == NULL); } const char* Program::get_plugin_name() const { -- cgit v1.2.3