From a791c8a76d8a5caa24b2c17436dec6aadd4d7e42 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sun, 18 Oct 2020 21:47:31 +0200 Subject: Matrix: add support for mp4 files with ftypmp42 magic number --- TODO | 2 +- src/FileAnalyzer.cpp | 3 ++- src/plugins/Matrix.cpp | 8 ++++---- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/TODO b/TODO index edd4525..c685cf6 100644 --- a/TODO +++ b/TODO @@ -111,4 +111,4 @@ to fix this we could perhaps replace the newly created body items for replies wh Add button to skip to next video. MPV has this feature when setting "next" video (can be done over IPC). Handle room leave in matrix and remove rooms from the list. Use a custom allocator that replaces malloc/realloc/free/new/delete to release memory properly, using munmap in free/delete. The C allocator doesn't do that! memory usage remains high after one large allocation. The C allocator only marks it as free. -Ignore timestamp ordering for messages in matrix? element seems to do that, and also we need the latest message to be last i guess to set read markers properly? \ No newline at end of file +Ignore timestamp ordering for messages in matrix? element seems to do that (or only for new messages???), and also we need the latest message to be last I guess to set read markers properly? \ No newline at end of file diff --git a/src/FileAnalyzer.cpp b/src/FileAnalyzer.cpp index 690e40e..1f46150 100644 --- a/src/FileAnalyzer.cpp +++ b/src/FileAnalyzer.cpp @@ -20,9 +20,10 @@ namespace QuickMedia { // What about audio ogg files that are not opus? // TODO: Test all of these - static const std::array magic_numbers = { + static const std::array magic_numbers = { MagicNumber{ {'R', 'I', 'F', 'F', -1, -1, -1, -1, 'A', 'V', 'I', ' '}, 12, ContentType::VIDEO_AVI }, MagicNumber{ {0x00, 0x00, 0x00, -1, 'f', 't', 'y', 'p', 'i', 's', 'o', 'm'}, 12, ContentType::VIDEO_MP4 }, + MagicNumber{ {0x00, 0x00, 0x00, -1, 'f', 't', 'y', 'p', 'm', 'p', '4', '2'}, 12, ContentType::VIDEO_MP4 }, MagicNumber{ {0x1A, 0x45, 0xDF, 0xA3}, 4, ContentType::VIDEO_WEBM }, MagicNumber{ {'.', 's', 'n', 'd'}, 4, ContentType::AUDIO_BASIC }, MagicNumber{ {'F', 'O', 'R', 'M', -1, -1, -1, -1, 'A', 'I', 'F', 'F'}, 12, ContentType::AUDIO_AIFF }, diff --git a/src/plugins/Matrix.cpp b/src/plugins/Matrix.cpp index d81c53c..f7364d1 100644 --- a/src/plugins/Matrix.cpp +++ b/src/plugins/Matrix.cpp @@ -801,15 +801,15 @@ namespace QuickMedia { string_split(body, '\n', [&formatted_body, &contains_formatted_text, &line](const char *str, size_t size){ if(line > 0) formatted_body += "
"; + std::string line_str(str, size); + html_escape_sequences(line_str); if(size > 0 && str[0] == '>') { - std::string line(str, size); - html_escape_sequences(line); formatted_body += ""; - formatted_body += line; + formatted_body += line_str; formatted_body += ""; contains_formatted_text = true; } else { - formatted_body.append(str, size); + formatted_body += line_str; } ++line; return true; -- cgit v1.2.3