play_media.h (3025B)
1 /* 2 This file is part of GNUnet. 3 Copyright (C) 2022 GNUnet e.V. 4 5 GNUnet is free software: you can redistribute it and/or modify it 6 under the terms of the GNU Affero General Public License as published 7 by the Free Software Foundation, either version 3 of the License, 8 or (at your option) any later version. 9 10 GNUnet is distributed in the hope that it will be useful, but 11 WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 Affero General Public License for more details. 14 15 You should have received a copy of the GNU Affero General Public License 16 along with this program. If not, see <http://www.gnu.org/licenses/>. 17 18 SPDX-License-Identifier: AGPL3.0-or-later 19 */ 20 /* 21 * @author Tobias Frisch 22 * @file ui/play_media.h 23 */ 24 25 #ifndef UI_PLAY_MEDIA_H_ 26 #define UI_PLAY_MEDIA_H_ 27 28 #include "messenger.h" 29 30 #include <glib-2.0/glib.h> 31 #include <gstreamer-1.0/gst/gst.h> 32 #include <pthread.h> 33 34 typedef struct UI_PLAY_MEDIA_Handle 35 { 36 gboolean fullscreen; 37 38 GstElement *pipeline; 39 GstElement *sink; 40 41 GtkWindow *parent; 42 43 GtkBuilder *builder; 44 HdyWindow *window; 45 46 GtkRevealer *header_revealer; 47 HdyHeaderBar *title_bar; 48 GtkButton *back_button; 49 50 HdyFlap *controls_flap; 51 52 GtkStack *preview_stack; 53 GtkWidget *fail_box; 54 GtkWidget *video_box; 55 56 GtkButton *play_pause_button; 57 GtkStack *play_symbol_stack; 58 59 GtkVolumeButton *volume_button; 60 GtkLabel *timeline_label; 61 GtkProgressBar *timeline_progress_bar; 62 GtkScale* timeline_scale; 63 64 GtkButton *settings_button; 65 66 GtkButton *fullscreen_button; 67 GtkStack *fullscreen_symbol_stack; 68 69 guint timeline; 70 guint motion_lost; 71 72 guint timeline_signal; 73 74 pthread_t video_tid; 75 } UI_PLAY_MEDIA_Handle; 76 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 */ 85 gboolean 86 ui_play_media_window_supports_file_extension(const gchar *filename); 87 88 /** 89 * Initializes a handle for the play media window 90 * of a given messenger application. 91 * 92 * @param app Messenger application 93 * @param handle Play media window handle 94 */ 95 void 96 ui_play_media_window_init(MESSENGER_Application *app, 97 UI_PLAY_MEDIA_Handle *handle); 98 99 /** 100 * Updates a handle for the play media window with 101 * a specific uri to play a media file from. 102 * 103 * @param handle Play media window handle 104 * @param uri URI of media file 105 * @param file Media file handle or NULL 106 */ 107 void 108 ui_play_media_window_update(UI_PLAY_MEDIA_Handle *handle, 109 const gchar *uri, 110 const struct GNUNET_CHAT_File *file); 111 112 /** 113 * Cleans up the allocated resources and resets the 114 * state of a given play media window handle. 115 * 116 * @param handle Play media window handle 117 */ 118 void 119 ui_play_media_window_cleanup(UI_PLAY_MEDIA_Handle *handle); 120 121 #endif /* UI_PLAY_MEDIA_H_ */