Mercurial > mplayer.hg
annotate gui/mplayer/gtk/menu.c @ 23978:ef6e50c3c172
Revert setting audio output channel count for FFmpeg
The FFmpeg API needs to be fixed before this can be done sanely.
ffdca wants the desired output channel count to be set in
avctx->channels. Unfortunately it also completely fails if the requested
number of channels is not available rather than returning a different
amount (if 6 channels are requested we'd probably rather use stereo than
fail completely).
ffvorbis ignores caller-set values in avctx->channels. It writes the
channel count there once during init. This means the caller can only
set the count before init because later there would be no indication
whether the channel count in avctx reflects real output.
ffwma requires the caller to supply the encoded channel count
in avctx->channels during init or it fails. So it is not possible to
set a different number of desired output channels there before init
either.
author | uau |
---|---|
date | Thu, 02 Aug 2007 21:54:14 +0000 |
parents | acfe034e5386 |
children | 10dfbc523184 |
rev | line source |
---|---|
23077 | 1 |
2 #include <stdio.h> | |
3 #include <stdlib.h> | |
4 #include <string.h> | |
5 | |
6 #include "config.h" | |
7 #include "help_mp.h" | |
8 #include "access_mpcontext.h" | |
9 #include "mixer.h" | |
10 | |
11 #include "menu.h" | |
12 #include "../widgets.h" | |
23154
e564b9cd7290
Fix several implicit declarations of functions warnings.
diego
parents:
23153
diff
changeset
|
13 #include "../gmplayer.h" |
23077 | 14 #include "app.h" |
15 | |
16 #include "stream/stream.h" | |
17 #include "../libmpdemux/demuxer.h" | |
18 #include "../libmpdemux/stheader.h" | |
19 | |
20 #include "../pixmaps/ab.xpm" | |
21 #include "../pixmaps/half.xpm" | |
22 #include "../pixmaps/normal.xpm" | |
23 #include "../pixmaps/double.xpm" | |
24 #include "../pixmaps/fs.xpm" | |
25 #include "../pixmaps/exit.xpm" | |
26 #include "../pixmaps/prefs.xpm" | |
27 #include "../pixmaps/eq.xpm" | |
28 #include "../pixmaps/pl.xpm" | |
29 #include "../pixmaps/skin.xpm" | |
30 #include "../pixmaps/sound.xpm" | |
31 #include "../pixmaps/open.xpm" | |
32 #include "../pixmaps/play.xpm" | |
33 #include "../pixmaps/stop2.xpm" | |
34 #include "../pixmaps/pause.xpm" | |
35 #include "../pixmaps/prev.xpm" | |
36 #include "../pixmaps/next.xpm" | |
37 #include "../pixmaps/aspect.xpm" | |
38 #include "../pixmaps/a11.xpm" | |
39 #include "../pixmaps/a169.xpm" | |
40 #include "../pixmaps/a235.xpm" | |
41 #include "../pixmaps/a43.xpm" | |
42 #include "../pixmaps/file2.xpm" | |
43 #include "../pixmaps/url.xpm" | |
44 #include "../pixmaps/sub.xpm" | |
45 #include "../pixmaps/delsub.xpm" | |
46 #include "../pixmaps/empty.xpm" | |
47 #include "../pixmaps/loadeaf.xpm" | |
48 #include "../pixmaps/title.xpm" | |
49 #ifdef USE_DVDREAD | |
50 #include "../pixmaps/dvd.xpm" | |
51 #include "../pixmaps/playdvd.xpm" | |
52 #include "../pixmaps/chapter.xpm" | |
53 #include "../pixmaps/dolby.xpm" | |
54 #include "../pixmaps/tongue.xpm" | |
55 #include "../pixmaps/tonguebla.xpm" | |
56 #include "../pixmaps/empty1px.xpm" | |
57 #endif | |
58 #ifdef HAVE_VCD | |
59 #include "../pixmaps/vcd.xpm" | |
60 #include "../pixmaps/playvcd.xpm" | |
61 #endif | |
62 | |
63 void ActivateMenuItem( int Item ) | |
64 { | |
65 // fprintf( stderr,"[menu] item: %d.%d\n",Item&0xffff,Item>>16 ); | |
66 gtkPopupMenu=Item & 0x0000ffff; | |
67 gtkPopupMenuParam=Item >> 16; | |
68 mplEventHandling( Item & 0x0000ffff,Item >> 16 ); | |
69 } | |
70 | |
71 static GtkWidget * AddMenuCheckItem(GtkWidget *window1, const char * immagine_xpm, GtkWidget* Menu,const char* label, gboolean state, int Number) | |
72 { | |
73 GtkWidget * Label = NULL; | |
74 GtkWidget * Pixmap = NULL; | |
75 GtkWidget * hbox = NULL; | |
76 GtkWidget * Item = NULL; | |
77 | |
78 GdkPixmap *PixmapIcon = NULL; | |
79 GdkColor transparent; | |
80 GdkBitmap *MaskIcon = NULL; | |
81 | |
82 PixmapIcon = gdk_pixmap_create_from_xpm_d (window1->window, &MaskIcon, &transparent,(gchar **)immagine_xpm ); | |
83 Pixmap = gtk_pixmap_new (PixmapIcon, MaskIcon); | |
84 gdk_pixmap_unref (PixmapIcon); | |
85 | |
86 Item=gtk_check_menu_item_new(); | |
87 Label = gtk_label_new (label); | |
88 | |
89 hbox = gtk_hbox_new (FALSE, 8); | |
90 gtk_box_pack_start (GTK_BOX (hbox), Pixmap, FALSE, FALSE, 0); | |
91 gtk_box_pack_start (GTK_BOX (hbox), Label, FALSE, FALSE, 0); | |
92 gtk_container_add (GTK_CONTAINER (Item), hbox); | |
93 | |
94 gtk_menu_append( GTK_MENU( Menu ),Item ); | |
95 | |
96 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(Item),state); | |
97 gtk_signal_connect_object( GTK_OBJECT(Item),"activate", | |
98 GTK_SIGNAL_FUNC(ActivateMenuItem),(gpointer)Number ); | |
99 gtk_menu_item_right_justify (GTK_MENU_ITEM (Item)); | |
100 gtk_widget_show_all(Item); | |
101 | |
102 return Item; | |
103 } | |
104 GtkWidget * AddMenuItem( GtkWidget *window1, const char * immagine_xpm, GtkWidget * SubMenu,const char * label,int Number ) | |
105 { | |
106 GtkWidget * Label = NULL; | |
107 GtkWidget * Pixmap = NULL; | |
108 GtkWidget * hbox = NULL; | |
109 GtkWidget * Item = NULL; | |
110 GdkPixmap * PixmapIcon = NULL; | |
111 GdkColor transparent; | |
112 GdkBitmap * MaskIcon = NULL; | |
113 | |
114 PixmapIcon = gdk_pixmap_create_from_xpm_d (window1->window, &MaskIcon, &transparent,(gchar **)immagine_xpm ); | |
115 Pixmap = gtk_pixmap_new (PixmapIcon, MaskIcon); | |
116 gdk_pixmap_unref (PixmapIcon); | |
117 | |
118 Item=gtk_menu_item_new(); | |
119 Label = gtk_label_new (label); | |
120 | |
121 hbox = gtk_hbox_new (FALSE, 8); | |
122 gtk_box_pack_start (GTK_BOX (hbox), Pixmap, FALSE, FALSE, 0); | |
123 gtk_box_pack_start (GTK_BOX (hbox), Label, FALSE, FALSE, 0); | |
124 gtk_container_add (GTK_CONTAINER (Item), hbox); | |
125 | |
126 | |
127 gtk_menu_append( GTK_MENU( SubMenu ),Item ); | |
128 gtk_signal_connect_object( GTK_OBJECT(Item),"activate", | |
129 GTK_SIGNAL_FUNC(ActivateMenuItem),(gpointer)Number ); | |
130 | |
131 gtk_menu_item_right_justify (GTK_MENU_ITEM (Item)); | |
132 gtk_widget_show_all(Item); | |
133 return Item; | |
134 } | |
135 | |
136 | |
137 GtkWidget * AddSubMenu( GtkWidget *window1, const char * immagine_xpm, GtkWidget * Menu,const char * label ) | |
138 { | |
139 GtkWidget * Label = NULL; | |
140 GtkWidget * Pixmap = NULL; | |
141 GtkWidget * hbox = NULL; | |
142 GtkWidget * Item = NULL; | |
143 GtkWidget * SubItem = NULL; | |
144 GdkPixmap * PixmapIcon = NULL; | |
145 GdkColor transparent; | |
146 GdkBitmap * MaskIcon = NULL; | |
147 | |
148 PixmapIcon = gdk_pixmap_create_from_xpm_d (window1->window, &MaskIcon, &transparent,(gchar **)immagine_xpm); | |
149 Pixmap = gtk_pixmap_new (PixmapIcon, MaskIcon); | |
150 gdk_pixmap_unref (PixmapIcon); | |
151 | |
152 SubItem=gtk_menu_item_new(); | |
153 Item=gtk_menu_new(); | |
154 Label = gtk_label_new (label); | |
155 | |
156 hbox = gtk_hbox_new (FALSE, 8); | |
157 gtk_box_pack_start (GTK_BOX (hbox), Pixmap, FALSE, FALSE, 0); | |
158 gtk_box_pack_start (GTK_BOX (hbox), Label, FALSE, FALSE, 0); | |
159 gtk_container_add (GTK_CONTAINER (SubItem), hbox); | |
160 | |
161 gtk_menu_append( GTK_MENU( Menu ),SubItem ); | |
162 gtk_menu_item_set_submenu( GTK_MENU_ITEM( SubItem ),Item ); | |
163 | |
164 gtk_widget_show_all( SubItem ); | |
165 return Item; | |
166 } | |
167 | |
168 GtkWidget * AddSeparator( GtkWidget * Menu ) | |
169 { | |
170 GtkWidget * Item = NULL; | |
171 | |
172 Item=gtk_menu_item_new (); | |
173 gtk_widget_show( Item ); | |
174 gtk_container_add( GTK_CONTAINER( Menu ),Item ); | |
175 gtk_widget_set_sensitive( Item,FALSE ); | |
176 | |
177 return Item; | |
178 } | |
179 | |
180 typedef struct | |
181 { | |
182 int id; | |
183 const char * name; | |
184 } Languages_t; | |
185 | |
186 #define lng( a,b ) ( (int)(a) * 256 + b ) | |
187 static Languages_t Languages[] = | |
188 { | |
189 { lng( 'a','b' ), "Abkhazian" }, | |
190 { lng( 'a','a' ), "Afar" }, | |
191 { lng( 'a','f' ), "Afrikaans" }, | |
192 { lng( 's','q' ), "Albanian" }, | |
193 { lng( 'a','m' ), "Amharic" }, | |
194 { lng( 'a','r' ), "Arabic" }, | |
195 { lng( 'h','y' ), "Armenian" }, | |
196 { lng( 'a','s' ), "Assamese" }, | |
197 { lng( 'a','e' ), "Avestan" }, | |
198 { lng( 'a','y' ), "Aymara" }, | |
199 { lng( 'a','z' ), "Azerbaijani" }, | |
200 { lng( 'b','a' ), "Bashkir" }, | |
201 { lng( 'e','u' ), "Basque" }, | |
202 { lng( 'b','e' ), "Belarusian" }, | |
203 { lng( 'b','n' ), "Bengali" }, | |
204 { lng( 'b','h' ), "Bihari" }, | |
205 { lng( 'b','i' ), "Bislama" }, | |
206 { lng( 'b','s' ), "Bosnian" }, | |
207 { lng( 'b','r' ), "Breton" }, | |
208 { lng( 'b','g' ), "Bulgarian" }, | |
209 { lng( 'm','y' ), "Burmese" }, | |
210 { lng( 'c','a' ), "Catalan" }, | |
211 { lng( 'c','h' ), "Chamorro" }, | |
212 { lng( 'c','e' ), "Chechen" }, | |
213 { lng( 'n','y' ), "Chichewa;Nyanja" }, | |
214 { lng( 'z','h' ), "Chinese" }, | |
215 { lng( 'c','u' ), "ChurchSlavic" }, | |
216 { lng( 'c','v' ), "Chuvash" }, | |
217 { lng( 'k','w' ), "Cornish" }, | |
218 { lng( 'c','o' ), "Corsican" }, | |
219 { lng( 'h','r' ), "Croatian" }, | |
220 { lng( 'c','s' ), "Czech" }, | |
221 { lng( 'd','a' ), "Danish" }, | |
222 { lng( 'n','l' ), "Dutch" }, | |
223 { lng( 'd','z' ), "Dzongkha" }, | |
224 { lng( 'e','n' ), "English" }, | |
225 { lng( 'e','o' ), "Esperanto" }, | |
226 { lng( 'e','t' ), "Estonian" }, | |
227 { lng( 'f','o' ), "Faroese" }, | |
228 { lng( 'f','j' ), "Fijian" }, | |
229 { lng( 'f','i' ), "Finnish" }, | |
230 { lng( 'f','r' ), "French" }, | |
231 { lng( 'f','y' ), "Frisian" }, | |
232 { lng( 'g','d' ), "Gaelic(Scots" }, | |
233 { lng( 'g','l' ), "Gallegan" }, | |
234 { lng( 'k','a' ), "Georgian" }, | |
235 { lng( 'd','e' ), "German" }, | |
236 { lng( 'e','l' ), "Greek" }, | |
237 { lng( 'g','n' ), "Guarani" }, | |
238 { lng( 'g','u' ), "Gujarati" }, | |
239 { lng( 'h','a' ), "Hausa" }, | |
240 { lng( 'h','e' ), "Hebrew" }, | |
241 { lng( 'i','w' ), "Hebrew" }, | |
242 { lng( 'h','z' ), "Herero" }, | |
243 { lng( 'h','i' ), "Hindi" }, | |
244 { lng( 'h','o' ), "HiriMotu" }, | |
245 { lng( 'h','u' ), "Hungarian" }, | |
246 { lng( 'i','s' ), "Icelandic" }, | |
247 { lng( 'i','d' ), "Indonesian" }, | |
248 { lng( 'i','n' ), "Indonesian" }, | |
249 { lng( 'i','a' ), "Interlingua" }, | |
250 { lng( 'i','e' ), "Interlingue" }, | |
251 { lng( 'i','u' ), "Inuktitut" }, | |
252 { lng( 'i','k' ), "Inupiaq" }, | |
253 { lng( 'g','a' ), "Irish" }, | |
254 { lng( 'i','t' ), "Italian" }, | |
255 { lng( 'j','a' ), "Japanese" }, | |
256 { lng( 'j','v' ), "Javanese" }, | |
257 { lng( 'j','w' ), "Javanese" }, | |
258 { lng( 'k','l' ), "Kalaallisut" }, | |
259 { lng( 'k','n' ), "Kannada" }, | |
260 { lng( 'k','s' ), "Kashmiri" }, | |
261 { lng( 'k','k' ), "Kazakh" }, | |
262 { lng( 'k','m' ), "Khmer" }, | |
263 { lng( 'k','i' ), "Kikuyu" }, | |
264 { lng( 'r','w' ), "Kinyarwanda" }, | |
265 { lng( 'k','y' ), "Kirghiz" }, | |
266 { lng( 'k','v' ), "Komi" }, | |
267 { lng( 'k','o' ), "Korean" }, | |
268 { lng( 'k','j' ), "Kuanyama" }, | |
269 { lng( 'k','u' ), "Kurdish" }, | |
270 { lng( 'l','o' ), "Lao" }, | |
271 { lng( 'l','a' ), "Latin" }, | |
272 { lng( 'l','v' ), "Latvian" }, | |
273 { lng( 'l','b' ), "Letzeburgesch" }, | |
274 { lng( 'l','n' ), "Lingala" }, | |
275 { lng( 'l','t' ), "Lithuanian" }, | |
276 { lng( 'm','k' ), "Macedonian" }, | |
277 { lng( 'm','g' ), "Malagasy" }, | |
278 { lng( 'm','s' ), "Malay" }, | |
279 { lng( 'm','l' ), "Malayalam" }, | |
280 { lng( 'm','t' ), "Maltese" }, | |
281 { lng( 'g','v' ), "Manx" }, | |
282 { lng( 'm','i' ), "Maori" }, | |
283 { lng( 'm','r' ), "Marathi" }, | |
284 { lng( 'm','h' ), "Marshall" }, | |
285 { lng( 'm','o' ), "Moldavian" }, | |
286 { lng( 'm','n' ), "Mongolian" }, | |
287 { lng( 'n','a' ), "Nauru" }, | |
288 { lng( 'n','v' ), "Navajo" }, | |
289 { lng( 'n','d' ), "North Ndebele" }, | |
290 { lng( 'n','r' ), "South Ndebele" }, | |
291 { lng( 'n','g' ), "Ndonga" }, | |
292 { lng( 'n','e' ), "Nepali" }, | |
293 { lng( 's','e' ), "NorthernSami" }, | |
294 { lng( 'n','o' ), "Norwegian" }, | |
23734 | 295 { lng( 'n','b' ), "NorwegianBokmål" }, |
23077 | 296 { lng( 'n','n' ), "NorwegianNynorsk" }, |
297 { lng( 'n','y' ), "Nyanja;Chichewa" }, | |
23734 | 298 { lng( 'o','c' ), "Occitan(post1500;Provençal" }, |
23077 | 299 { lng( 'o','r' ), "Oriya" }, |
300 { lng( 'o','m' ), "Oromo" }, | |
301 { lng( 'o','s' ), "Ossetian;Ossetic" }, | |
302 { lng( 'p','i' ), "Pali" }, | |
303 { lng( 'p','a' ), "Panjabi" }, | |
304 { lng( 'f','a' ), "Persian" }, | |
305 { lng( 'p','l' ), "Polish" }, | |
306 { lng( 'p','t' ), "Portuguese" }, | |
23734 | 307 { lng( 'o','c' ), "Provençal;Occitan(post1500" }, |
23077 | 308 { lng( 'p','s' ), "Pushto" }, |
309 { lng( 'q','u' ), "Quechua" }, | |
310 { lng( 'r','m' ), "Raeto-Romance" }, | |
311 { lng( 'r','o' ), "Romanian" }, | |
312 { lng( 'r','n' ), "Rundi" }, | |
313 { lng( 'r','u' ), "Russian" }, | |
314 { lng( 's','m' ), "Samoan" }, | |
315 { lng( 's','g' ), "Sango" }, | |
316 { lng( 's','a' ), "Sanskrit" }, | |
317 { lng( 's','c' ), "Sardinian" }, | |
318 { lng( 's','r' ), "Serbian" }, | |
319 { lng( 's','n' ), "Shona" }, | |
320 { lng( 's','d' ), "Sindhi" }, | |
321 { lng( 's','i' ), "Sinhalese" }, | |
322 { lng( 's','k' ), "Slovak" }, | |
323 { lng( 's','l' ), "Slovenian" }, | |
324 { lng( 's','o' ), "Somali" }, | |
325 { lng( 's','t' ), "Sotho" }, | |
326 { lng( 'e','s' ), "Spanish" }, | |
327 { lng( 's','u' ), "Sundanese" }, | |
328 { lng( 's','w' ), "Swahili" }, | |
329 { lng( 's','s' ), "Swati" }, | |
330 { lng( 's','v' ), "Swedish" }, | |
331 { lng( 't','l' ), "Tagalog" }, | |
332 { lng( 't','y' ), "Tahitian" }, | |
333 { lng( 't','g' ), "Tajik" }, | |
334 { lng( 't','a' ), "Tamil" }, | |
335 { lng( 't','t' ), "Tatar" }, | |
336 { lng( 't','e' ), "Telugu" }, | |
337 { lng( 't','h' ), "Thai" }, | |
338 { lng( 'b','o' ), "Tibetan" }, | |
339 { lng( 't','i' ), "Tigrinya" }, | |
340 { lng( 't','o' ), "Tonga" }, | |
341 { lng( 't','s' ), "Tsonga" }, | |
342 { lng( 't','n' ), "Tswana" }, | |
343 { lng( 't','r' ), "Turkish" }, | |
344 { lng( 't','k' ), "Turkmen" }, | |
345 { lng( 't','w' ), "Twi" }, | |
346 { lng( 'u','g' ), "Uighur" }, | |
347 { lng( 'u','k' ), "Ukrainian" }, | |
348 { lng( 'u','r' ), "Urdu" }, | |
349 { lng( 'u','z' ), "Uzbek" }, | |
350 { lng( 'v','i' ), "Vietnamese" }, | |
23734 | 351 { lng( 'v','o' ), "Volapük" }, |
23077 | 352 { lng( 'c','y' ), "Welsh" }, |
353 { lng( 'w','o' ), "Wolof" }, | |
354 { lng( 'x','h' ), "Xhosa" }, | |
355 { lng( 'y','i' ), "Yiddish" }, | |
356 { lng( 'j','i' ), "Yiddish" }, | |
357 { lng( 'y','o' ), "Yoruba" }, | |
358 { lng( 'z','a' ), "Zhuang" }, | |
359 { lng( 'z','u' ), "Zulu" }, | |
360 }; | |
361 #undef lng | |
362 | |
363 #ifdef USE_DVDREAD | |
364 static char * ChannelTypes[] = | |
365 { "Dolby Digital","","Mpeg1","Mpeg2","PCM","","Digital Theatre System" }; | |
366 static char * ChannelNumbers[] = | |
367 { "","Stereo","","","","5.1" }; | |
368 #endif | |
369 | |
370 const char * GetLanguage( int language ) | |
371 { | |
372 unsigned int i; | |
373 for ( i=0;i<sizeof( Languages ) / sizeof( Languages_t );i++ ) | |
374 if ( Languages[i].id == language ) return Languages[i].name; | |
375 return NULL; | |
376 } | |
377 | |
378 | |
379 GtkWidget * DVDSubMenu; | |
380 GtkWidget * DVDTitleMenu; | |
381 GtkWidget * DVDChapterMenu; | |
382 GtkWidget * DVDAudioLanguageMenu; | |
383 GtkWidget * DVDSubtitleLanguageMenu; | |
384 GtkWidget * AspectMenu; | |
385 GtkWidget * VCDSubMenu; | |
386 GtkWidget * VCDTitleMenu; | |
387 | |
388 GtkWidget * create_PopUpMenu( void ) | |
389 { | |
390 GtkWidget * window1; | |
391 GtkWidget * Menu = NULL; | |
392 GtkWidget * SubMenu = NULL; | |
393 GtkWidget * MenuItem = NULL; | |
394 GtkWidget * H, * N, * D, * F; | |
395 mixer_t *mixer = mpctx_get_mixer(guiIntfStruct.mpcontext); | |
396 int global_sub_size = mpctx_get_global_sub_size(guiIntfStruct.mpcontext); | |
397 | |
398 Menu=gtk_menu_new(); | |
399 gtk_widget_realize (Menu); | |
400 window1 = gtk_widget_get_toplevel(Menu); | |
401 | |
402 | |
403 AddMenuItem( window1, (const char*)ab_xpm, Menu,MSGTR_MENU_AboutMPlayer" ", evAbout ); | |
404 AddSeparator( Menu ); | |
405 SubMenu=AddSubMenu( window1, (const char*)open_xpm, Menu,MSGTR_MENU_Open ); | |
406 AddMenuItem( window1, (const char*)file2_xpm, SubMenu,MSGTR_MENU_PlayFile" ", evLoadPlay ); | |
407 #ifdef HAVE_VCD | |
408 AddMenuItem( window1, (const char*)playvcd_xpm, SubMenu,MSGTR_MENU_PlayVCD, evPlayVCD ); | |
409 #endif | |
410 #ifdef USE_DVDREAD | |
411 AddMenuItem( window1, (const char*)playdvd_xpm, SubMenu,MSGTR_MENU_PlayDVD, evPlayDVD ); | |
412 #endif | |
413 AddMenuItem( window1, (const char*)url_xpm, SubMenu,MSGTR_MENU_PlayURL, evSetURL ); | |
414 AddMenuItem( window1, (const char*)sub_xpm, SubMenu,MSGTR_MENU_LoadSubtitle" ", evLoadSubtitle ); | |
415 AddMenuItem( window1, (const char*)delsub_xpm, SubMenu,MSGTR_MENU_DropSubtitle,evDropSubtitle ); | |
416 AddMenuItem( window1, (const char*)loadeaf_xpm, SubMenu,MSGTR_MENU_LoadExternAudioFile, evLoadAudioFile ); | |
417 SubMenu=AddSubMenu(window1, (const char*)play_xpm, Menu,MSGTR_MENU_Playing ); | |
418 AddMenuItem( window1, (const char*)play_xpm, SubMenu,MSGTR_MENU_Play" ", evPlay ); | |
419 AddMenuItem( window1, (const char*)pause_xpm, SubMenu,MSGTR_MENU_Pause, evPause ); | |
420 AddMenuItem( window1, (const char*)stop2_xpm, SubMenu,MSGTR_MENU_Stop, evStop ); | |
421 AddMenuItem( window1, (const char*)next_xpm, SubMenu,MSGTR_MENU_NextStream, evNext ); | |
422 AddMenuItem( window1, (const char*)prev_xpm, SubMenu,MSGTR_MENU_PrevStream, evPrev ); | |
423 // AddSeparator( SubMenu ); | |
424 // AddMenuItem( SubMenu,"Back 10 sec", evBackward10sec ); | |
425 // AddMenuItem( SubMenu,"Fwd 10 sec", evForward10sec ); | |
426 // AddMenuItem( SubMenu,"Back 1 min", evBackward1min ); | |
427 // AddMenuItem( SubMenu,"Fwd 1 min", evForward1min ); | |
428 // SubMenu=AddSubMenu( Menu,MSGTR_MENU_Size ); | |
429 // AddMenuItem( SubMenu,MSGTR_MENU_NormalSize" ", evNormalSize ); | |
430 // AddMenuItem( SubMenu,MSGTR_MENU_DoubleSize, evDoubleSize ); | |
431 // AddMenuItem( SubMenu,MSGTR_MENU_FullScreen, evFullScreen ); | |
432 #ifdef HAVE_VCD | |
433 VCDSubMenu=AddSubMenu( window1, (const char*)vcd_xpm, Menu,MSGTR_MENU_VCD ); | |
434 AddMenuItem( window1, (const char*)playvcd_xpm, VCDSubMenu,MSGTR_MENU_PlayDisc,evPlayVCD ); | |
435 AddSeparator( VCDSubMenu ); | |
436 VCDTitleMenu=AddSubMenu( window1, (const char*)title_xpm, VCDSubMenu,MSGTR_MENU_Titles ); | |
437 if ( guiIntfStruct.VCDTracks ) | |
438 { | |
439 char tmp[32]; int i; | |
440 for ( i=0;i < guiIntfStruct.VCDTracks;i++ ) | |
441 { | |
442 snprintf( tmp,32,MSGTR_MENU_Title,i+1 ); | |
443 //AddMenuItem( VCDTitleMenu,tmp,( (i+1) << 16 ) + evSetVCDTrack ); | |
444 AddMenuItem(window1, (const char*)empty_xpm, VCDTitleMenu,tmp,( (i+1) << 16 ) + evSetVCDTrack ); | |
445 } | |
446 } | |
447 else | |
448 { | |
449 MenuItem=AddMenuItem( window1, (const char*)empty_xpm, VCDTitleMenu,MSGTR_MENU_None,evNone ); | |
450 gtk_widget_set_sensitive( MenuItem,FALSE ); | |
451 } | |
452 #endif | |
453 #ifdef USE_DVDREAD | |
454 DVDSubMenu=AddSubMenu( window1, (const char*)dvd_xpm, Menu,MSGTR_MENU_DVD ); | |
455 AddMenuItem( window1, (const char*)playdvd_xpm, DVDSubMenu,MSGTR_MENU_PlayDisc" ", evPlayDVD ); | |
456 // AddMenuItem( DVDSubMenu,MSGTR_MENU_ShowDVDMenu, evNone ); | |
457 AddSeparator( DVDSubMenu ); | |
458 DVDTitleMenu=AddSubMenu( window1, (const char*)title_xpm, DVDSubMenu,MSGTR_MENU_Titles ); | |
459 if ( guiIntfStruct.DVD.titles ) | |
460 { | |
461 char tmp[32]; int i; | |
462 for ( i=1 ; i<= guiIntfStruct.DVD.titles;i++ ) | |
463 { | |
464 snprintf( tmp,32,MSGTR_MENU_Title,i); | |
465 AddMenuCheckItem( window1, (const char*)empty1px_xpm, DVDTitleMenu,tmp, | |
466 guiIntfStruct.DVD.current_title == i, | |
467 (i << 16) + evSetDVDTitle ); | |
468 } | |
469 } | |
470 else | |
471 { | |
472 MenuItem=AddMenuItem( window1, (const char*)empty_xpm, DVDTitleMenu,MSGTR_MENU_None,evNone ); | |
473 gtk_widget_set_sensitive( MenuItem,FALSE ); | |
474 } | |
475 DVDChapterMenu=AddSubMenu( window1, (const char*)chapter_xpm, DVDSubMenu,MSGTR_MENU_Chapters ); | |
476 if ( guiIntfStruct.DVD.chapters ) | |
477 { | |
478 char tmp[32]; int i; | |
479 for ( i=1;i <= guiIntfStruct.DVD.chapters;i++ ) | |
480 { | |
481 snprintf( tmp,32,MSGTR_MENU_Chapter,i ); | |
482 AddMenuCheckItem( window1, (const char*)empty1px_xpm, DVDChapterMenu,tmp,guiIntfStruct.DVD.current_chapter == i, | |
483 ( i << 16 ) + evSetDVDChapter ); | |
484 } | |
485 } | |
486 else | |
487 { | |
488 MenuItem=AddMenuItem( window1, (const char*)empty_xpm, DVDChapterMenu,MSGTR_MENU_None,evNone ); | |
489 gtk_widget_set_sensitive( MenuItem,FALSE ); | |
490 } | |
491 DVDAudioLanguageMenu=AddSubMenu( window1, (const char*)tongue_xpm, DVDSubMenu,MSGTR_MENU_AudioLanguages ); | |
492 if ( guiIntfStruct.DVD.nr_of_audio_channels ) | |
493 { | |
494 char tmp[64]; int i, id = guiIntfStruct.demuxer ? ((demuxer_t *)guiIntfStruct.demuxer)->audio->id : audio_id; | |
495 for ( i=0;i < guiIntfStruct.DVD.nr_of_audio_channels;i++ ) | |
496 { | |
497 snprintf( tmp,64,"%s - %s %s",GetLanguage( guiIntfStruct.DVD.audio_streams[i].language ), | |
498 ChannelTypes[ guiIntfStruct.DVD.audio_streams[i].type ], | |
499 ChannelNumbers[ guiIntfStruct.DVD.audio_streams[i].channels ] ); | |
500 // if ( id == -1 ) id=audio_id; //guiIntfStruct.DVD.audio_streams[i].id; | |
501 AddMenuCheckItem( window1, (const char*)dolby_xpm, DVDAudioLanguageMenu,tmp, | |
502 id == guiIntfStruct.DVD.audio_streams[i].id, | |
503 ( guiIntfStruct.DVD.audio_streams[i].id << 16 ) + evSetDVDAudio ); | |
504 } | |
505 } | |
506 else | |
507 { | |
508 MenuItem=AddMenuItem( window1, (const char*)empty_xpm, DVDAudioLanguageMenu,MSGTR_MENU_None,evNone ); | |
509 gtk_widget_set_sensitive( MenuItem,FALSE ); | |
510 } | |
511 DVDSubtitleLanguageMenu=AddSubMenu( window1, (const char*)tonguebla_xpm, DVDSubMenu,MSGTR_MENU_SubtitleLanguages ); | |
512 if ( guiIntfStruct.DVD.nr_of_subtitles ) | |
513 { | |
514 char tmp[64]; int i; | |
515 AddMenuItem( window1, (const char*)empty1px_xpm, DVDSubtitleLanguageMenu,MSGTR_MENU_None,( (unsigned short)-1 << 16 ) + evSetDVDSubtitle ); | |
516 for ( i=0;i < guiIntfStruct.DVD.nr_of_subtitles;i++ ) | |
517 { | |
518 snprintf( tmp,64,"%s",GetLanguage( guiIntfStruct.DVD.subtitles[i].language ) ); | |
519 AddMenuCheckItem( window1, (const char*)empty1px_xpm, DVDSubtitleLanguageMenu,tmp, | |
520 dvdsub_id == guiIntfStruct.DVD.subtitles[i].id, | |
521 ( guiIntfStruct.DVD.subtitles[i].id << 16 ) + evSetDVDSubtitle ); | |
522 } | |
523 } | |
524 else | |
525 { | |
526 MenuItem=AddMenuItem( window1, (const char*)empty_xpm, DVDSubtitleLanguageMenu,MSGTR_MENU_None,evNone ); | |
527 gtk_widget_set_sensitive( MenuItem,FALSE ); | |
528 } | |
529 #endif | |
530 | |
531 // if ( guiIntfStruct.Playing ) | |
532 { | |
533 AspectMenu=AddSubMenu( window1, (const char*)aspect_xpm, Menu,MSGTR_MENU_AspectRatio ); | |
534 AddMenuItem( window1, (const char*)a11_xpm, AspectMenu,MSGTR_MENU_Original,( 1 << 16 ) + evSetAspect ); | |
535 AddMenuItem( window1, (const char*)a169_xpm, AspectMenu,"16:9",( 2 << 16 ) + evSetAspect ); | |
536 AddMenuItem( window1, (const char*)a43_xpm, AspectMenu,"4:3",( 3 << 16 ) + evSetAspect ); | |
537 AddMenuItem( window1, (const char*)a235_xpm, AspectMenu,"2.35",( 4 << 16 ) + evSetAspect ); | |
538 } | |
539 | |
540 if ( guiIntfStruct.Playing && guiIntfStruct.demuxer && guiIntfStruct.StreamType != STREAMTYPE_DVD ) | |
541 { | |
542 int i,c = 0; | |
543 | |
544 for ( i=0;i < MAX_A_STREAMS;i++ ) | |
545 if ( ((demuxer_t *)guiIntfStruct.demuxer)->a_streams[i] ) c++; | |
546 | |
547 if ( c > 1 ) | |
548 { | |
549 SubMenu=AddSubMenu( window1, (const char*)empty_xpm, Menu,MSGTR_MENU_AudioTrack ); | |
550 for ( i=0;i < MAX_A_STREAMS;i++ ) | |
551 if ( ((demuxer_t *)guiIntfStruct.demuxer)->a_streams[i] ) | |
552 { | |
553 int aid = ((sh_audio_t *)((demuxer_t *)guiIntfStruct.demuxer)->a_streams[i])->aid; | |
554 char tmp[32]; | |
555 snprintf( tmp,32,MSGTR_MENU_Track,aid ); | |
556 AddMenuItem( window1, (const char*)empty_xpm, SubMenu,tmp,( aid << 16 ) + evSetAudio ); | |
557 } | |
558 } | |
559 | |
560 for ( c=0,i=0;i < MAX_V_STREAMS;i++ ) | |
561 if ( ((demuxer_t *)guiIntfStruct.demuxer)->v_streams[i] ) c++; | |
562 | |
563 if ( c > 1 ) | |
564 { | |
565 SubMenu=AddSubMenu( window1, (const char*)empty_xpm, Menu,MSGTR_MENU_VideoTrack ); | |
566 for ( i=0;i < MAX_V_STREAMS;i++ ) | |
567 if ( ((demuxer_t *)guiIntfStruct.demuxer)->v_streams[i] ) | |
568 { | |
569 int vid = ((sh_video_t *)((demuxer_t *)guiIntfStruct.demuxer)->v_streams[i])->vid; | |
570 char tmp[32]; | |
571 snprintf( tmp,32,MSGTR_MENU_Track,vid ); | |
572 AddMenuItem( window1, (const char*)empty_xpm, SubMenu,tmp,( vid << 16 ) + evSetVideo ); | |
573 } | |
574 } | |
575 } | |
576 | |
577 /* cheap subtitle switching for non-DVD streams */ | |
578 if ( global_sub_size && guiIntfStruct.StreamType != STREAMTYPE_DVD ) | |
579 { | |
580 int i; | |
581 SubMenu=AddSubMenu( window1, (const char*)empty_xpm, Menu, MSGTR_MENU_Subtitles ); | |
582 AddMenuItem( window1, (const char*)empty_xpm, SubMenu, MSGTR_MENU_None, (-1 << 16) + evSetSubtitle ); | |
583 for ( i=0;i < global_sub_size;i++ ) | |
584 { | |
585 char tmp[32]; | |
586 snprintf( tmp, 32, MSGTR_MENU_Track, i ); | |
587 AddMenuItem( window1,(const char*)empty_xpm,SubMenu,tmp,( i << 16 ) + evSetSubtitle ); | |
588 } | |
589 } | |
590 | |
591 AddSeparator( Menu ); | |
592 MenuItem=AddMenuCheckItem( window1, (const char*)sound_xpm, Menu,MSGTR_MENU_Mute,mixer->muted,evMute ); | |
593 if ( !guiIntfStruct.AudioType ) gtk_widget_set_sensitive( MenuItem,FALSE ); | |
594 AddMenuItem( window1, (const char*)pl_xpm, Menu,MSGTR_MENU_PlayList, evPlayList ); | |
595 AddMenuItem( window1, (const char*)skin_xpm, Menu,MSGTR_MENU_SkinBrowser, evSkinBrowser ); | |
596 AddMenuItem( window1, (const char*)prefs_xpm, Menu,MSGTR_MENU_Preferences, evPreferences ); | |
597 AddMenuItem( window1, (const char*)eq_xpm, Menu,MSGTR_Equalizer, evEqualizer ); | |
598 | |
599 if ( guiIntfStruct.NoWindow == False ) | |
600 { | |
601 int b1 = 0, b2 = 0, b_half = 0; | |
602 AddSeparator( Menu ); | |
603 if ( !appMPlayer.subWindow.isFullScreen && guiIntfStruct.Playing ) | |
604 { | |
605 if ( ( appMPlayer.subWindow.Width == guiIntfStruct.MovieWidth * 2 )&& | |
606 ( appMPlayer.subWindow.Height == guiIntfStruct.MovieHeight * 2 ) ) b2=1; | |
607 else if ( ( appMPlayer.subWindow.Width == guiIntfStruct.MovieWidth / 2 ) && | |
608 ( appMPlayer.subWindow.Height == guiIntfStruct.MovieHeight / 2 ) ) b_half=1; | |
609 else b1=1; | |
610 } else b1=!appMPlayer.subWindow.isFullScreen; | |
611 H=AddMenuCheckItem( window1, (const char*)half_xpm, Menu,MSGTR_MENU_HalfSize,b_half,evHalfSize ); | |
612 N=AddMenuCheckItem( window1, (const char*)normal_xpm, Menu,MSGTR_MENU_NormalSize" ",b1,evNormalSize ); | |
613 D=AddMenuCheckItem( window1, (const char*)double_xpm, Menu,MSGTR_MENU_DoubleSize,b2,evDoubleSize ); | |
614 F=AddMenuCheckItem( window1, (const char*)fs_xpm, Menu,MSGTR_MENU_FullScreen,appMPlayer.subWindow.isFullScreen,evFullScreen ); | |
615 if ( !gtkShowVideoWindow && !guiIntfStruct.Playing ) | |
616 { | |
617 gtk_widget_set_sensitive( H,FALSE ); | |
618 gtk_widget_set_sensitive( N,FALSE ); | |
619 gtk_widget_set_sensitive( D,FALSE ); | |
620 gtk_widget_set_sensitive( F,FALSE ); | |
621 } | |
622 } | |
623 | |
624 AddSeparator( Menu ); | |
625 AddMenuItem( window1, (const char*)exit_xpm, Menu,MSGTR_MENU_Exit, evExit ); | |
626 | |
627 return Menu; | |
628 } |