1 /*
2  * Copyright (c) 2014-2022 gnome-mpv
3  *
4  * This file is part of Celluloid.
5  *
6  * Celluloid is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * Celluloid is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with Celluloid.  If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef DEF_H
21 #define DEF_H
22 
23 #define APP_ID "io.github.celluloid_player.Celluloid"
24 #define ICON_NAME APP_ID
25 #define BIN_NAME "celluloid"
26 #define CONFIG_DIR BIN_NAME
27 #define CONFIG_ROOT "io.github.celluloid-player.Celluloid"
28 #define CONFIG_WIN_STATE CONFIG_ROOT".window-state"
29 #define ACTION_PREFIX "celluloid-action"
30 #define DEFAULT_LOG_LEVEL MPV_LOG_LEVEL_ERROR
31 #define MPRIS_TRACK_LIST_BEFORE 10
32 #define MPRIS_TRACK_LIST_AFTER 10
33 #define MPRIS_TRACK_ID_NO_TRACK "/org/mpris/MediaPlayer2/TrackList/NoTrack"
34 #define MPRIS_TRACK_ID_PREFIX "/io/github/CelluloidPlayer/Celluloid/Track/"
35 #define MPRIS_BUS_NAME "org.mpris.MediaPlayer2."APP_ID
36 #define MPRIS_OBJ_ROOT_PATH "/org/mpris/MediaPlayer2"
37 #define MPV_OPTION_PREFIX "--mpv-"
38 #define PLAYLIST_DEFAULT_WIDTH 200
39 #define CSD_WIDTH_OFFSET 52
40 #define CSD_HEIGHT_OFFSET 99
41 #define WAYLAND_NOCSD_HEIGHT_OFFSET 60
42 #define MAIN_WINDOW_DEFAULT_WIDTH 625
43 #define MAIN_WINDOW_DEFAULT_HEIGHT 400
44 #define SEEK_BAR_UPDATE_INTERVAL 250
45 #define FS_CONTROL_HIDE_DELAY 1
46 #define KEYSTRING_MAX_LEN 16
47 #define MIN_MPV_MAJOR 0
48 #define MIN_MPV_MINOR 29
49 #define MIN_MPV_PATCH 0
50 
51 #define SUBTITLE_EXTS	{	"utf",\
52 				"utf8",\
53 				"utf-8",\
54 				"idx",\
55 				"sub",\
56 				"srt",\
57 				"smi",\
58 				"rt",\
59 				"txt",\
60 				"ssa",\
61 				"aqt",\
62 				"jss",\
63 				"js",\
64 				"ass",\
65 				"mks",\
66 				"vtt",\
67 				"sup",\
68 				NULL }
69 
70 #define PLAYLIST_EXTS	{	"m3u",\
71 				"m3u8",\
72 				"ini",\
73 				"pls",\
74 				"txt",\
75 				NULL }
76 
77 #define DND_TARGETS	{	{.target = "PLAYLIST_PATH",\
78 				.flags = GTK_TARGET_SAME_APP,\
79 				.info = 0},\
80 				{.target = "text/uri-list",\
81 				.flags = 0,\
82 				.info = 0},\
83 				{.target = "text/plain",\
84 				.flags = 0,\
85 				.info = 0},\
86 				{.target = "STRING",\
87 				.flags = 0,\
88 				.info = 0} }
89 
90 #define DEFAULT_KEYBINDS \
91 	{	"Alt+0 set window-scale 0.5",\
92 		"Alt+1 set window-scale 1.0",\
93 		"Alt+2 set window-scale 2.0",\
94 		"Ctrl+o script-message celluloid-action win.show-open-dialog((false, false))",\
95 		"Ctrl+l script-message celluloid-action win.show-open-location-dialog(false)",\
96 		"Ctrl+Shift+o script-message celluloid-action win.show-open-dialog((false, true))",\
97 		"Ctrl+Shift+l script-message celluloid-action win.show-open-location-dialog(true)",\
98 		"Ctrl+Shift+s script-message celluloid-action win.save-playlist",\
99 		"Ctrl+f script-message celluloid-action win.search-playlist",\
100 		"Ctrl+q quit",\
101 		"Ctrl+? script-message celluloid-action win.show-shortcuts-dialog",\
102 		"Ctrl+p script-message celluloid-action win.show-preferences-dialog",\
103 		"Ctrl+h script-message celluloid-action win.toggle-controls",\
104 		"F9 script-message celluloid-action win.toggle-playlist",\
105 		"F10 script-message celluloid-action win.toggle-main-menu",\
106 		"DEL script-message celluloid-action win.remove-selected-playlist-item",\
107 		"U stop",\
108 		"STOP stop",\
109 		"F11 cycle fullscreen",\
110 		"WHEEL_UP add volume 2",\
111 		"WHEEL_DOWN add volume -2",\
112 		"WHEEL_LEFT no-osd seek -10",\
113 		"WHEEL_RIGHT no-osd seek 10",\
114 		NULL }
115 
116 #define KEYSTRING_MAP	{	"PGUP", "Page_Up",\
117 				"PGDWN", "Page_Down",\
118 				"BS", "\b",\
119 				"SHARP", "#",\
120 				"UP", "KP_Up",\
121 				"DOWN", "KP_Down",\
122 				"RIGHT", "KP_Right",\
123 				"LEFT", "KP_Left",\
124 				"RIGHT", "Right",\
125 				"LEFT", "Left",\
126 				"UP", "Up",\
127 				"DOWN", "Down",\
128 				"ESC", "\x1b",\
129 				"DEL", "\x7f",\
130 				"ENTER", "\r",\
131 				"INS", "Insert",\
132 				"VOLUME_LOWER", "AudioLowerVolume",\
133 				"MUTE", "AudioMute",\
134 				"VOLUME_UP", "AudioRaiseVolume",\
135 				"PLAY", "AudioPlay",\
136 				"STOP", "AudioStop",\
137 				"PREV", "AudioPrev",\
138 				"NEXT", "AudioNext",\
139 				"FORWARD", "AudioForward",\
140 				"REWIND", "AudioRewind",\
141 				"MENU", "Menu",\
142 				"HOMEPAGE", "HomePage",\
143 				"MAIL", "Mail",\
144 				"FAVORITES", "Favorites",\
145 				"SEARCH", "Search",\
146 				"SLEEP", "Sleep",\
147 				"CANCEL", "Cancel",\
148 				"RECORD", "AudioRecord",\
149 				"", "Control_L",\
150 				"", "Control_R",\
151 				"", "Alt_L",\
152 				"", "Alt_R",\
153 				"", "Meta_L",\
154 				"", "Meta_R",\
155 				"", "Shift_L",\
156 				"", "Shift_R",\
157 				NULL }
158 
159 #define SUPPORTED_PROTOCOLS	{	"cdda",\
160 					"rtmp",\
161 					"rtsp",\
162 					"http",\
163 					"https",\
164 					"mms",\
165 					"mmst",\
166 					"mmsh",\
167 					"mmshttp",\
168 					"rtp",\
169 					"httpproxy",\
170 					"hls",\
171 					"rtmpe",\
172 					"rtmps",\
173 					"rtmpt",\
174 					"rtmpte",\
175 					"rtmpts",\
176 					"srtp",\
177 					"lavf",\
178 					"ffmpeg",\
179 					"udp",\
180 					"ftp",\
181 					"tcp",\
182 					"tls",\
183 					"unix",\
184 					"sftp",\
185 					"md5",\
186 					"concat",\
187 					"avdevice",\
188 					"av",\
189 					"dvb",\
190 					"tv",\
191 					"pvr",\
192 					"smb",\
193 					"file",\
194 					"dvdread",\
195 					"dvd",\
196 					"dvdnav",\
197 					"bd",\
198 					"br",\
199 					"bluray",\
200 					"bdnav",\
201 					"brnav",\
202 					"bluraynav",\
203 					"memory",\
204 					"null",\
205 					"mf",\
206 					"edl",\
207 					"rar",\
208 					NULL }
209 
210 #define SUPPORTED_MIME_TYPES	{	"application/ogg",\
211 					"application/x-ogg",\
212 					"application/sdp",\
213 					"application/smil",\
214 					"application/x-smil",\
215 					"application/streamingmedia",\
216 					"application/x-streamingmedia",\
217 					"application/vnd.rn-realmedia",\
218 					"application/vnd.rn-realmedia-vbr",\
219 					"audio/aac",\
220 					"audio/x-aac",\
221 					"audio/m4a",\
222 					"audio/x-m4a",\
223 					"audio/mp1",\
224 					"audio/x-mp1",\
225 					"audio/mp2",\
226 					"audio/x-mp2",\
227 					"audio/mp3",\
228 					"audio/x-mp3",\
229 					"audio/mpeg",\
230 					"audio/x-mpeg",\
231 					"audio/mpegurl",\
232 					"audio/x-mpegurl",\
233 					"audio/mpg",\
234 					"audio/x-mpg",\
235 					"audio/rn-mpeg",\
236 					"audio/ogg",\
237 					"audio/scpls",\
238 					"audio/x-scpls",\
239 					"audio/vnd.rn-realaudio",\
240 					"audio/wav",\
241 					"audio/x-pn-windows-pcm",\
242 					"audio/x-realaudio",\
243 					"audio/x-pn-realaudio",\
244 					"audio/x-ms-wma",\
245 					"audio/x-pls",\
246 					"audio/x-wav",\
247 					"video/mpeg",\
248 					"video/x-mpeg",\
249 					"video/x-mpeg2",\
250 					"video/mp4",\
251 					"video/msvideo",\
252 					"video/x-msvideo",\
253 					"video/ogg",\
254 					"video/quicktime",\
255 					"video/vnd.rn-realvideo",\
256 					"video/x-ms-afs",\
257 					"video/x-ms-asf",\
258 					"video/x-ms-wmv",\
259 					"video/x-ms-wmx",\
260 					"video/x-ms-wvxvideo",\
261 					"video/x-avi",\
262 					"video/x-fli",\
263 					"video/x-flv",\
264 					"video/x-theora",\
265 					"video/x-matroska",\
266 					"video/webm",\
267 					"audio/x-flac",\
268 					"audio/x-vorbis+ogg",\
269 					"video/x-ogm+ogg",\
270 					"audio/x-shorten",\
271 					"audio/x-ape",\
272 					"audio/x-wavpack",\
273 					"audio/x-tta",\
274 					"audio/AMR",\
275 					"audio/ac3",\
276 					"video/mp2t",\
277 					"audio/flac",\
278 					NULL }
279 
280 #endif
281