annotate libmenu/vf_menu.c @ 36372:c95bdc49af2e

ad_ffmpeg: fix commit fixing sample rate changes to actually work.
author reimar
date Wed, 16 Oct 2013 17:20:31 +0000
parents fbe5c829c69b
children 4c7ab9a4f3cd
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
28113
f8b6c7045cf8 Add standard GPL headers.
diego
parents: 27746
diff changeset
1 /*
f8b6c7045cf8 Add standard GPL headers.
diego
parents: 27746
diff changeset
2 * This file is part of MPlayer.
f8b6c7045cf8 Add standard GPL headers.
diego
parents: 27746
diff changeset
3 *
f8b6c7045cf8 Add standard GPL headers.
diego
parents: 27746
diff changeset
4 * MPlayer is free software; you can redistribute it and/or modify
f8b6c7045cf8 Add standard GPL headers.
diego
parents: 27746
diff changeset
5 * it under the terms of the GNU General Public License as published by
f8b6c7045cf8 Add standard GPL headers.
diego
parents: 27746
diff changeset
6 * the Free Software Foundation; either version 2 of the License, or
f8b6c7045cf8 Add standard GPL headers.
diego
parents: 27746
diff changeset
7 * (at your option) any later version.
f8b6c7045cf8 Add standard GPL headers.
diego
parents: 27746
diff changeset
8 *
f8b6c7045cf8 Add standard GPL headers.
diego
parents: 27746
diff changeset
9 * MPlayer is distributed in the hope that it will be useful,
f8b6c7045cf8 Add standard GPL headers.
diego
parents: 27746
diff changeset
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
f8b6c7045cf8 Add standard GPL headers.
diego
parents: 27746
diff changeset
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
f8b6c7045cf8 Add standard GPL headers.
diego
parents: 27746
diff changeset
12 * GNU General Public License for more details.
f8b6c7045cf8 Add standard GPL headers.
diego
parents: 27746
diff changeset
13 *
f8b6c7045cf8 Add standard GPL headers.
diego
parents: 27746
diff changeset
14 * You should have received a copy of the GNU General Public License along
f8b6c7045cf8 Add standard GPL headers.
diego
parents: 27746
diff changeset
15 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
f8b6c7045cf8 Add standard GPL headers.
diego
parents: 27746
diff changeset
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
f8b6c7045cf8 Add standard GPL headers.
diego
parents: 27746
diff changeset
17 */
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
18
16862
931bdbc37ee0 Unify include paths, -I.. is in CFLAGS.
diego
parents: 13528
diff changeset
19 #include "config.h"
17994
6927fabaef92 Part1 of several printf2mp_msg changes in patch from Otvos Attila oattila AT chello DOT hu
reynaldo
parents: 17945
diff changeset
20 #include "mp_msg.h"
6927fabaef92 Part1 of several printf2mp_msg changes in patch from Otvos Attila oattila AT chello DOT hu
reynaldo
parents: 17945
diff changeset
21 #include "help_mp.h"
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
22
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
23 #include <stdio.h>
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
24 #include <stdlib.h>
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
25 #include <string.h>
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
26
32043
f6249bc89c38 Move extern declarations used by both mplayer.c and mencoder.c to mpcommon.h.
diego
parents: 32025
diff changeset
27 #include "mpcommon.h"
16862
931bdbc37ee0 Unify include paths, -I.. is in CFLAGS.
diego
parents: 13528
diff changeset
28 #include "mp_msg.h"
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
29
16862
931bdbc37ee0 Unify include paths, -I.. is in CFLAGS.
diego
parents: 13528
diff changeset
30 #include "libmpcodecs/img_format.h"
931bdbc37ee0 Unify include paths, -I.. is in CFLAGS.
diego
parents: 13528
diff changeset
31 #include "libmpcodecs/mp_image.h"
931bdbc37ee0 Unify include paths, -I.. is in CFLAGS.
diego
parents: 13528
diff changeset
32 #include "libmpcodecs/vf.h"
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
33
16862
931bdbc37ee0 Unify include paths, -I.. is in CFLAGS.
diego
parents: 13528
diff changeset
34 #include "libvo/fastmemcpy.h"
931bdbc37ee0 Unify include paths, -I.. is in CFLAGS.
diego
parents: 13528
diff changeset
35 #include "libvo/video_out.h"
32466
9e627a1793b1 Move font_load.[ch], font_load_ft.c and osd_font.h from libvo to sub.
cigaes
parents: 32043
diff changeset
36 #include "sub/font_load.h"
32467
fbe5c829c69b Move libvo/sub.[ch] from libvo to sub.
cigaes
parents: 32466
diff changeset
37 #include "sub/sub.h"
16862
931bdbc37ee0 Unify include paths, -I.. is in CFLAGS.
diego
parents: 13528
diff changeset
38 #include "input/input.h"
931bdbc37ee0 Unify include paths, -I.. is in CFLAGS.
diego
parents: 13528
diff changeset
39 #include "m_struct.h"
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
40 #include "menu.h"
22284
83366c8e1928 Fix menu to work with mpctx
uau
parents: 21925
diff changeset
41 #include "access_mpcontext.h"
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
42
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
43
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
44 static struct vf_priv_s* st_priv = NULL;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
45
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
46 static mp_image_t* pause_mpi = NULL;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
47 static int go2pause = 0;
13344
0d96af97ec00 option to display menu at startup, patch by Aurelien Jacobs <aurel at gnuage.org>
faust3
parents: 10397
diff changeset
48 /// if nonzero display menu at startup
27746
38fbba4327fa Remove pointless attribute_used from variable declaration.
diego
parents: 27393
diff changeset
49 int menu_startup = 0;
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
50
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
51 struct vf_priv_s {
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
52 menu_t* root;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
53 menu_t* current;
21803
3acc4b00bcc6 allows OSD menu to be displayed when using MPEG PES video out
ben
parents: 19489
diff changeset
54 int passthrough;
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
55 };
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
56
30642
a972c1a4a012 cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents: 30633
diff changeset
57 static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts);
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
58
30642
a972c1a4a012 cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents: 30633
diff changeset
59 void vf_menu_pause_update(struct vf_instance *vf) {
25219
e82ecde2cbd4 Mark several uses of vo_functions_t as const to stop some of the current
reimar
parents: 25026
diff changeset
60 const vo_functions_t *video_out = mpctx_get_video_out(vf->priv->current->ctx);
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
61 if(pause_mpi) {
17908
dcfaebcdde14 10l (forgot ...)
michael
parents: 16862
diff changeset
62 put_image(vf,pause_mpi, MP_NOPTS_VALUE);
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
63 // Don't draw the osd atm
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
64 //vf->control(vf,VFCTRL_DRAW_OSD,NULL);
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
65 video_out->flip_page();
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
66 }
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
67 }
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
68
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
69 static int cmd_filter(mp_cmd_t* cmd, int paused, struct vf_priv_s * priv) {
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
70
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
71 switch(cmd->id) {
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
72 case MP_CMD_MENU : { // Convert txt cmd from the users into libmenu stuff
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
73 char* arg = cmd->args[0].v.s;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 29087
diff changeset
74
25496
63234bdc80e4 Simplify the condition code.
ulion
parents: 25461
diff changeset
75 if (!priv->current->show && strcmp(arg,"hide"))
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
76 priv->current->show = 1;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
77 else if(strcmp(arg,"up") == 0)
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
78 menu_read_cmd(priv->current,MENU_CMD_UP);
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
79 else if(strcmp(arg,"down") == 0)
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
80 menu_read_cmd(priv->current,MENU_CMD_DOWN);
17945
98f4e3704a76 Allow 6 ways (up/down/left/right/ok/cancel) navigation.
albeu
parents: 17908
diff changeset
81 else if(strcmp(arg,"left") == 0)
98f4e3704a76 Allow 6 ways (up/down/left/right/ok/cancel) navigation.
albeu
parents: 17908
diff changeset
82 menu_read_cmd(priv->current,MENU_CMD_LEFT);
98f4e3704a76 Allow 6 ways (up/down/left/right/ok/cancel) navigation.
albeu
parents: 17908
diff changeset
83 else if(strcmp(arg,"right") == 0)
98f4e3704a76 Allow 6 ways (up/down/left/right/ok/cancel) navigation.
albeu
parents: 17908
diff changeset
84 menu_read_cmd(priv->current,MENU_CMD_RIGHT);
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
85 else if(strcmp(arg,"ok") == 0)
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
86 menu_read_cmd(priv->current,MENU_CMD_OK);
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
87 else if(strcmp(arg,"cancel") == 0)
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
88 menu_read_cmd(priv->current,MENU_CMD_CANCEL);
25263
96d0992c7920 Remove hardcoded key->cmd bindings in libmenu, support custom key bindings
ulion
parents: 25219
diff changeset
89 else if(strcmp(arg,"home") == 0)
96d0992c7920 Remove hardcoded key->cmd bindings in libmenu, support custom key bindings
ulion
parents: 25219
diff changeset
90 menu_read_cmd(priv->current,MENU_CMD_HOME);
96d0992c7920 Remove hardcoded key->cmd bindings in libmenu, support custom key bindings
ulion
parents: 25219
diff changeset
91 else if(strcmp(arg,"end") == 0)
96d0992c7920 Remove hardcoded key->cmd bindings in libmenu, support custom key bindings
ulion
parents: 25219
diff changeset
92 menu_read_cmd(priv->current,MENU_CMD_END);
96d0992c7920 Remove hardcoded key->cmd bindings in libmenu, support custom key bindings
ulion
parents: 25219
diff changeset
93 else if(strcmp(arg,"pageup") == 0)
96d0992c7920 Remove hardcoded key->cmd bindings in libmenu, support custom key bindings
ulion
parents: 25219
diff changeset
94 menu_read_cmd(priv->current,MENU_CMD_PAGE_UP);
96d0992c7920 Remove hardcoded key->cmd bindings in libmenu, support custom key bindings
ulion
parents: 25219
diff changeset
95 else if(strcmp(arg,"pagedown") == 0)
96d0992c7920 Remove hardcoded key->cmd bindings in libmenu, support custom key bindings
ulion
parents: 25219
diff changeset
96 menu_read_cmd(priv->current,MENU_CMD_PAGE_DOWN);
25461
7ef04742572c OSD menu support mouse selection.
ulion
parents: 25263
diff changeset
97 else if(strcmp(arg,"click") == 0)
7ef04742572c OSD menu support mouse selection.
ulion
parents: 25263
diff changeset
98 menu_read_cmd(priv->current,MENU_CMD_CLICK);
19489
87c339558bc1 fix menu toggle/hide issues
ben
parents: 17994
diff changeset
99 else if(strcmp(arg,"hide") == 0 || strcmp(arg,"toggle") == 0)
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
100 priv->current->show = 0;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
101 else
17994
6927fabaef92 Part1 of several printf2mp_msg changes in patch from Otvos Attila oattila AT chello DOT hu
reynaldo
parents: 17945
diff changeset
102 mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_UnknownMenuCommand,arg);
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
103 return 1;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
104 }
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
105 case MP_CMD_SET_MENU : {
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
106 char* menu = cmd->args[0].v.s;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
107 menu_t* l = priv->current;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
108 priv->current = menu_open(menu);
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
109 if(!priv->current) {
17994
6927fabaef92 Part1 of several printf2mp_msg changes in patch from Otvos Attila oattila AT chello DOT hu
reynaldo
parents: 17945
diff changeset
110 mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_FailedToOpenMenu,menu);
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
111 priv->current = l;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
112 priv->current->show = 0;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
113 } else {
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
114 priv->current->show = 1;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
115 priv->current->parent = l;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
116 }
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
117 return 1;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
118 }
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
119 }
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
120 return 0;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
121 }
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
122
30642
a972c1a4a012 cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents: 30633
diff changeset
123 static void get_image(struct vf_instance *vf, mp_image_t *mpi){
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
124 mp_image_t *dmpi;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
125
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
126 if(mpi->type == MP_IMGTYPE_TEMP && (!(mpi->flags&MP_IMGFLAG_PRESERVE)) ) {
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
127 dmpi = vf_get_image(vf->next,mpi->imgfmt,mpi->type, mpi->flags, mpi->w, mpi->h);
23458
973e53dc7df5 Do not use fast_memcpy for small size copy, esp. when the size is constant
reimar
parents: 23457
diff changeset
128 memcpy(mpi->planes,dmpi->planes,MP_MAX_PLANES*sizeof(unsigned char*));
973e53dc7df5 Do not use fast_memcpy for small size copy, esp. when the size is constant
reimar
parents: 23457
diff changeset
129 memcpy(mpi->stride,dmpi->stride,MP_MAX_PLANES*sizeof(unsigned int));
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
130 mpi->flags|=MP_IMGFLAG_DIRECT;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
131 mpi->priv=(void*)dmpi;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
132 return;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
133 }
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
134 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 29087
diff changeset
135
25502
605d4e3e403f From now on, libmenu does not steal all input keys from input modules.
ulion
parents: 25496
diff changeset
136 static int key_cb(int code) {
605d4e3e403f From now on, libmenu does not steal all input keys from input modules.
ulion
parents: 25496
diff changeset
137 return menu_read_key(st_priv->current,code);
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
138 }
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
139
30642
a972c1a4a012 cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents: 30633
diff changeset
140 static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
141 mp_image_t *dmpi = NULL;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
142
21803
3acc4b00bcc6 allows OSD menu to be displayed when using MPEG PES video out
ben
parents: 19489
diff changeset
143 if (vf->priv->passthrough) {
3acc4b00bcc6 allows OSD menu to be displayed when using MPEG PES video out
ben
parents: 19489
diff changeset
144 dmpi=vf_get_image(vf->next, IMGFMT_MPEGPES, MP_IMGTYPE_EXPORT,
3acc4b00bcc6 allows OSD menu to be displayed when using MPEG PES video out
ben
parents: 19489
diff changeset
145 0, mpi->w, mpi->h);
3acc4b00bcc6 allows OSD menu to be displayed when using MPEG PES video out
ben
parents: 19489
diff changeset
146 dmpi->planes[0]=mpi->planes[0];
3acc4b00bcc6 allows OSD menu to be displayed when using MPEG PES video out
ben
parents: 19489
diff changeset
147 return vf_next_put_image(vf,dmpi, pts);
3acc4b00bcc6 allows OSD menu to be displayed when using MPEG PES video out
ben
parents: 19489
diff changeset
148 }
3acc4b00bcc6 allows OSD menu to be displayed when using MPEG PES video out
ben
parents: 19489
diff changeset
149
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
150 // Close all menu who requested it
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
151 while(vf->priv->current->cl && vf->priv->current != vf->priv->root) {
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
152 menu_t* m = vf->priv->current;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
153 vf->priv->current = m->parent ? m->parent : vf->priv->root;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
154 menu_close(m);
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
155 }
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
156
25026
afead6ecb8ba Remove the pause filter and the cmd queue hack, to know the mplayer going to
ulion
parents: 24960
diff changeset
157 // Try to capture the last frame before pause, or fallback to use
afead6ecb8ba Remove the pause filter and the cmd queue hack, to know the mplayer going to
ulion
parents: 24960
diff changeset
158 // last captured frame.
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
159 if(pause_mpi && (mpi->w != pause_mpi->w || mpi->h != pause_mpi->h ||
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
160 mpi->imgfmt != pause_mpi->imgfmt)) {
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
161 free_mp_image(pause_mpi);
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
162 pause_mpi = NULL;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
163 }
25026
afead6ecb8ba Remove the pause filter and the cmd queue hack, to know the mplayer going to
ulion
parents: 24960
diff changeset
164 if (!pause_mpi) {
afead6ecb8ba Remove the pause filter and the cmd queue hack, to know the mplayer going to
ulion
parents: 24960
diff changeset
165 pause_mpi = alloc_mpi(mpi->w,mpi->h,mpi->imgfmt);
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
166 copy_mpi(pause_mpi,mpi);
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
167 }
25026
afead6ecb8ba Remove the pause filter and the cmd queue hack, to know the mplayer going to
ulion
parents: 24960
diff changeset
168 else if (mpctx_get_osd_function(vf->priv->root->ctx) == OSD_PAUSE)
afead6ecb8ba Remove the pause filter and the cmd queue hack, to know the mplayer going to
ulion
parents: 24960
diff changeset
169 copy_mpi(pause_mpi,mpi);
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
170
25026
afead6ecb8ba Remove the pause filter and the cmd queue hack, to know the mplayer going to
ulion
parents: 24960
diff changeset
171 if (vf->priv->current->show) {
afead6ecb8ba Remove the pause filter and the cmd queue hack, to know the mplayer going to
ulion
parents: 24960
diff changeset
172 if (!mp_input_key_cb)
afead6ecb8ba Remove the pause filter and the cmd queue hack, to know the mplayer going to
ulion
parents: 24960
diff changeset
173 mp_input_key_cb = key_cb;
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
174
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
175 if(mpi->flags&MP_IMGFLAG_DIRECT)
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
176 dmpi = mpi->priv;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
177 else {
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
178 dmpi = vf_get_image(vf->next,mpi->imgfmt,
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
179 MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE,
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
180 mpi->w,mpi->h);
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
181 copy_mpi(dmpi,mpi);
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
182 }
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
183 menu_draw(vf->priv->current,dmpi);
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
184
8244
64352fb332b6 don't fully-copy the planes if the menu doesn't show (faster)
colin
parents: 8224
diff changeset
185 } else {
64352fb332b6 don't fully-copy the planes if the menu doesn't show (faster)
colin
parents: 8224
diff changeset
186 if(mp_input_key_cb)
64352fb332b6 don't fully-copy the planes if the menu doesn't show (faster)
colin
parents: 8224
diff changeset
187 mp_input_key_cb = NULL;
21924
422eef67d14a speeds up mplayer execution by over FIVE times when all of the of the following apply:
gpoirier
parents: 21818
diff changeset
188
422eef67d14a speeds up mplayer execution by over FIVE times when all of the of the following apply:
gpoirier
parents: 21818
diff changeset
189 if(mpi->flags&MP_IMGFLAG_DIRECT)
422eef67d14a speeds up mplayer execution by over FIVE times when all of the of the following apply:
gpoirier
parents: 21818
diff changeset
190 dmpi = mpi->priv;
422eef67d14a speeds up mplayer execution by over FIVE times when all of the of the following apply:
gpoirier
parents: 21818
diff changeset
191 else {
21925
1c93736b6751 fix identation, broken by last commit
gpoirier
parents: 21924
diff changeset
192 dmpi = vf_get_image(vf->next,mpi->imgfmt,
1c93736b6751 fix identation, broken by last commit
gpoirier
parents: 21924
diff changeset
193 MP_IMGTYPE_EXPORT, MP_IMGFLAG_ACCEPT_STRIDE,
1c93736b6751 fix identation, broken by last commit
gpoirier
parents: 21924
diff changeset
194 mpi->w,mpi->h);
8244
64352fb332b6 don't fully-copy the planes if the menu doesn't show (faster)
colin
parents: 8224
diff changeset
195
21925
1c93736b6751 fix identation, broken by last commit
gpoirier
parents: 21924
diff changeset
196 dmpi->stride[0] = mpi->stride[0];
1c93736b6751 fix identation, broken by last commit
gpoirier
parents: 21924
diff changeset
197 dmpi->stride[1] = mpi->stride[1];
1c93736b6751 fix identation, broken by last commit
gpoirier
parents: 21924
diff changeset
198 dmpi->stride[2] = mpi->stride[2];
1c93736b6751 fix identation, broken by last commit
gpoirier
parents: 21924
diff changeset
199 dmpi->planes[0] = mpi->planes[0];
1c93736b6751 fix identation, broken by last commit
gpoirier
parents: 21924
diff changeset
200 dmpi->planes[1] = mpi->planes[1];
1c93736b6751 fix identation, broken by last commit
gpoirier
parents: 21924
diff changeset
201 dmpi->planes[2] = mpi->planes[2];
1c93736b6751 fix identation, broken by last commit
gpoirier
parents: 21924
diff changeset
202 dmpi->priv = mpi->priv;
1c93736b6751 fix identation, broken by last commit
gpoirier
parents: 21924
diff changeset
203 }
21924
422eef67d14a speeds up mplayer execution by over FIVE times when all of the of the following apply:
gpoirier
parents: 21818
diff changeset
204 }
17908
dcfaebcdde14 10l (forgot ...)
michael
parents: 16862
diff changeset
205 return vf_next_put_image(vf,dmpi, pts);
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
206 }
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
207
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
208 static void uninit(vf_instance_t *vf) {
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
209 vf->priv=NULL;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
210 if(pause_mpi) {
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
211 free_mp_image(pause_mpi);
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
212 pause_mpi = NULL;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
213 }
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
214 }
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
215
30642
a972c1a4a012 cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents: 30633
diff changeset
216 static int config(struct vf_instance *vf, int width, int height, int d_width, int d_height,
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 29087
diff changeset
217 unsigned int flags, unsigned int outfmt) {
27393
4876c89bafdd Rename font-related preprocessor directives.
diego
parents: 26759
diff changeset
218 #ifdef CONFIG_FREETYPE
8224
fefc56153615 Fix freetype. Freetype is highly recommended for a nice output ;)
albeu
parents: 8197
diff changeset
219 // here is the right place to get screen dimensions
fefc56153615 Fix freetype. Freetype is highly recommended for a nice output ;)
albeu
parents: 8197
diff changeset
220 if (force_load_font) {
fefc56153615 Fix freetype. Freetype is highly recommended for a nice output ;)
albeu
parents: 8197
diff changeset
221 force_load_font = 0;
25851
9ebd00825df2 Allow independent scaling of vo_font and sub_font.
reimar
parents: 25502
diff changeset
222 load_font_ft(width,height,&vo_font,font_name,osd_font_scale_factor);
8224
fefc56153615 Fix freetype. Freetype is highly recommended for a nice output ;)
albeu
parents: 8197
diff changeset
223 }
fefc56153615 Fix freetype. Freetype is highly recommended for a nice output ;)
albeu
parents: 8197
diff changeset
224 #endif
21803
3acc4b00bcc6 allows OSD menu to be displayed when using MPEG PES video out
ben
parents: 19489
diff changeset
225 if(outfmt == IMGFMT_MPEGPES)
3acc4b00bcc6 allows OSD menu to be displayed when using MPEG PES video out
ben
parents: 19489
diff changeset
226 vf->priv->passthrough = 1;
8224
fefc56153615 Fix freetype. Freetype is highly recommended for a nice output ;)
albeu
parents: 8197
diff changeset
227 return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt);
fefc56153615 Fix freetype. Freetype is highly recommended for a nice output ;)
albeu
parents: 8197
diff changeset
228 }
21803
3acc4b00bcc6 allows OSD menu to be displayed when using MPEG PES video out
ben
parents: 19489
diff changeset
229
30642
a972c1a4a012 cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents: 30633
diff changeset
230 static int query_format(struct vf_instance *vf, unsigned int fmt){
26759
8eff880f638c cosmetics: Remove useless parentheses from return statements.
diego
parents: 25851
diff changeset
231 return vf_next_query_format(vf,fmt);
21803
3acc4b00bcc6 allows OSD menu to be displayed when using MPEG PES video out
ben
parents: 19489
diff changeset
232 }
3acc4b00bcc6 allows OSD menu to be displayed when using MPEG PES video out
ben
parents: 19489
diff changeset
233
23366
b344b6520518 rename some menu open functions, to avoid confusion with libc native open()
ben
parents: 23338
diff changeset
234 static int open_vf(vf_instance_t *vf, char* args){
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
235 if(!st_priv) {
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
236 st_priv = calloc(1,sizeof(struct vf_priv_s));
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
237 st_priv->root = st_priv->current = menu_open(args);
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
238 if(!st_priv->current) {
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
239 free(st_priv);
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
240 st_priv = NULL;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
241 return 0;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
242 }
13344
0d96af97ec00 option to display menu at startup, patch by Aurelien Jacobs <aurel at gnuage.org>
faust3
parents: 10397
diff changeset
243 st_priv->root->show = menu_startup;
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
244 mp_input_add_cmd_filter((mp_input_cmd_filter)cmd_filter,st_priv);
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
245 }
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
246
8224
fefc56153615 Fix freetype. Freetype is highly recommended for a nice output ;)
albeu
parents: 8197
diff changeset
247 vf->config = config;
21803
3acc4b00bcc6 allows OSD menu to be displayed when using MPEG PES video out
ben
parents: 19489
diff changeset
248 vf->query_format=query_format;
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
249 vf->put_image = put_image;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
250 vf->get_image = get_image;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
251 vf->uninit=uninit;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
252 vf->priv=st_priv;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
253 go2pause=0;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
254
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
255 return 1;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
256 }
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
257
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
258
32025
23d8b025634a Mark vf_info_menu declaration as const.
diego
parents: 30642
diff changeset
259 const vf_info_t vf_info_menu = {
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
260 "Internal filter for libmenu",
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
261 "menu",
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
262 "Albeu",
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
263 "",
23366
b344b6520518 rename some menu open functions, to avoid confusion with libc native open()
ben
parents: 23338
diff changeset
264 open_vf,
9755
6b7710f78c32 10L forgot this filter.
albeu
parents: 8635
diff changeset
265 NULL
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
266 };