aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheJackiMonster <thejackimonster@gmail.com>2022-12-05 21:35:25 +0100
committerTheJackiMonster <thejackimonster@gmail.com>2022-12-05 21:35:25 +0100
commitaefac32b50c41a2a6f137b84b80753cd26333aa5 (patch)
tree89cfedeead31715c9f1f5c86e20fc16b9646522d
parent36058f083af2fccf616b72df5fa387a14db3b657 (diff)
downloadmessenger-gtk-aefac32b50c41a2a6f137b84b80753cd26333aa5.tar.gz
messenger-gtk-aefac32b50c41a2a6f137b84b80753cd26333aa5.zip
Adjusted video file extension support for playback
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
-rw-r--r--src/ui/message.c4
-rw-r--r--src/ui/play_media.c21
-rw-r--r--src/ui/play_media.h11
3 files changed, 33 insertions, 3 deletions
diff --git a/src/ui/message.c b/src/ui/message.c
index 3678414..b375215 100644
--- a/src/ui/message.c
+++ b/src/ui/message.c
@@ -502,9 +502,7 @@ _update_file_message(UI_MESSAGE_Handle *handle,
502 return; 502 return;
503 } 503 }
504 504
505 const char* extension = strrchr(filename, '.'); 505 if (ui_play_media_window_supports_file_extension(filename))
506
507 if (0 == g_strcmp0(extension, ".mp4"))
508 { 506 {
509 handle->media = TRUE; 507 handle->media = TRUE;
510 goto file_progress; 508 goto file_progress;
diff --git a/src/ui/play_media.c b/src/ui/play_media.c
index 6dd9c6e..a2841a4 100644
--- a/src/ui/play_media.c
+++ b/src/ui/play_media.c
@@ -27,6 +27,27 @@
27#include "../application.h" 27#include "../application.h"
28#include "../ui.h" 28#include "../ui.h"
29 29
30gboolean
31ui_play_media_window_supports_file_extension(const gchar *filename)
32{
33 if (!filename)
34 return FALSE;
35
36 const char* extension = strrchr(filename, '.');
37
38 if (!extension)
39 return FALSE;
40
41 if (0 == g_strcmp0(extension, ".mkv"))
42 return TRUE;
43 if (0 == g_strcmp0(extension, ".mp4"))
44 return TRUE;
45 if (0 == g_strcmp0(extension, ".webm"))
46 return TRUE;
47
48 return FALSE;
49}
50
30static void 51static void
31handle_back_button_click(GtkButton *button, 52handle_back_button_click(GtkButton *button,
32 gpointer user_data) 53 gpointer user_data)
diff --git a/src/ui/play_media.h b/src/ui/play_media.h
index 301e070..0efb78d 100644
--- a/src/ui/play_media.h
+++ b/src/ui/play_media.h
@@ -75,6 +75,17 @@ typedef struct UI_PLAY_MEDIA_Handle
75} UI_PLAY_MEDIA_Handle; 75} UI_PLAY_MEDIA_Handle;
76 76
77/** 77/**
78 * Returns whether the file extension of a given
79 * filename is supported for playing the type of
80 * media.
81 *
82 * @param filename Filename of potential media file
83 * @return TRUE if the extension is supported for playback, otherwise FALSE
84 */
85gboolean
86ui_play_media_window_supports_file_extension(const gchar *filename);
87
88/**
78 * Initializes a handle for the play media window 89 * Initializes a handle for the play media window
79 * of a given messenger application. 90 * of a given messenger application.
80 * 91 *