annotate libmenu/vf_menu.c @ 25066:89c42f6f6e89

(cosmetics) Indentation fix of previous commit.
author voroshil
date Sun, 18 Nov 2007 11:15:14 +0000
parents afead6ecb8ba
children e82ecde2cbd4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
1
16862
931bdbc37ee0 Unify include paths, -I.. is in CFLAGS.
diego
parents: 13528
diff changeset
2 #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
3 #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
4 #include "help_mp.h"
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
5
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
6 #include <stdio.h>
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
7 #include <stdlib.h>
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
8 #include <string.h>
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
9
8623
440301fef3fe Added/reordered #includes to silence warnings about "implicit declaration".
rathann
parents: 8251
diff changeset
10 #ifdef HAVE_MALLOC_H
440301fef3fe Added/reordered #includes to silence warnings about "implicit declaration".
rathann
parents: 8251
diff changeset
11 #include <malloc.h>
440301fef3fe Added/reordered #includes to silence warnings about "implicit declaration".
rathann
parents: 8251
diff changeset
12 #endif
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
13
23338
2a66d95355f0 add new -subfont option, that allows having a different font for OSD (controls and menu) and subtitles
ben
parents: 22284
diff changeset
14 #include "mplayer.h"
16862
931bdbc37ee0 Unify include paths, -I.. is in CFLAGS.
diego
parents: 13528
diff changeset
15 #include "mp_msg.h"
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
16
16862
931bdbc37ee0 Unify include paths, -I.. is in CFLAGS.
diego
parents: 13528
diff changeset
17 #include "libmpcodecs/img_format.h"
931bdbc37ee0 Unify include paths, -I.. is in CFLAGS.
diego
parents: 13528
diff changeset
18 #include "libmpcodecs/mp_image.h"
931bdbc37ee0 Unify include paths, -I.. is in CFLAGS.
diego
parents: 13528
diff changeset
19 #include "libmpcodecs/vf.h"
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
20
16862
931bdbc37ee0 Unify include paths, -I.. is in CFLAGS.
diego
parents: 13528
diff changeset
21 #include "libvo/fastmemcpy.h"
931bdbc37ee0 Unify include paths, -I.. is in CFLAGS.
diego
parents: 13528
diff changeset
22 #include "libvo/video_out.h"
931bdbc37ee0 Unify include paths, -I.. is in CFLAGS.
diego
parents: 13528
diff changeset
23 #include "libvo/font_load.h"
25026
afead6ecb8ba Remove the pause filter and the cmd queue hack, to know the mplayer going to
ulion
parents: 24960
diff changeset
24 #include "libvo/sub.h"
16862
931bdbc37ee0 Unify include paths, -I.. is in CFLAGS.
diego
parents: 13528
diff changeset
25 #include "input/input.h"
931bdbc37ee0 Unify include paths, -I.. is in CFLAGS.
diego
parents: 13528
diff changeset
26 #include "m_struct.h"
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
27 #include "menu.h"
22284
83366c8e1928 Fix menu to work with mpctx
uau
parents: 21925
diff changeset
28 #include "access_mpcontext.h"
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
29
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
30
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
31 static struct vf_priv_s* st_priv = NULL;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
32
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
33 static mp_image_t* pause_mpi = NULL;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
34 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
35 /// if nonzero display menu at startup
13528
39bdfbbc4216 support newer gcc
faust3
parents: 13344
diff changeset
36 int attribute_used menu_startup = 0;
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
37
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
38 struct vf_priv_s {
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
39 menu_t* root;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
40 menu_t* current;
21803
3acc4b00bcc6 allows OSD menu to be displayed when using MPEG PES video out
ben
parents: 19489
diff changeset
41 int passthrough;
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
42 };
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
43
17908
dcfaebcdde14 10l (forgot ...)
michael
parents: 16862
diff changeset
44 static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts);
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
45
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
46 void vf_menu_pause_update(struct vf_instance_s* vf) {
22284
83366c8e1928 Fix menu to work with mpctx
uau
parents: 21925
diff changeset
47 vo_functions_t *video_out = mpctx_get_video_out(vf->priv->current->ctx);
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
48 if(pause_mpi) {
17908
dcfaebcdde14 10l (forgot ...)
michael
parents: 16862
diff changeset
49 put_image(vf,pause_mpi, MP_NOPTS_VALUE);
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
50 // Don't draw the osd atm
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
51 //vf->control(vf,VFCTRL_DRAW_OSD,NULL);
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
52 video_out->flip_page();
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
53 }
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
54 }
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
55
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
56 static int cmd_filter(mp_cmd_t* cmd, int paused, struct vf_priv_s * priv) {
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
57
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
58 switch(cmd->id) {
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
59 case MP_CMD_MENU : { // Convert txt cmd from the users into libmenu stuff
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
60 char* arg = cmd->args[0].v.s;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
61
19489
87c339558bc1 fix menu toggle/hide issues
ben
parents: 17994
diff changeset
62 if(!priv->current->show && !(strcmp(arg,"hide") == 0) )
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
63 priv->current->show = 1;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
64 else if(strcmp(arg,"up") == 0)
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
65 menu_read_cmd(priv->current,MENU_CMD_UP);
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
66 else if(strcmp(arg,"down") == 0)
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
67 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
68 else if(strcmp(arg,"left") == 0)
98f4e3704a76 Allow 6 ways (up/down/left/right/ok/cancel) navigation.
albeu
parents: 17908
diff changeset
69 menu_read_cmd(priv->current,MENU_CMD_LEFT);
98f4e3704a76 Allow 6 ways (up/down/left/right/ok/cancel) navigation.
albeu
parents: 17908
diff changeset
70 else if(strcmp(arg,"right") == 0)
98f4e3704a76 Allow 6 ways (up/down/left/right/ok/cancel) navigation.
albeu
parents: 17908
diff changeset
71 menu_read_cmd(priv->current,MENU_CMD_RIGHT);
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
72 else if(strcmp(arg,"ok") == 0)
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
73 menu_read_cmd(priv->current,MENU_CMD_OK);
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
74 else if(strcmp(arg,"cancel") == 0)
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
75 menu_read_cmd(priv->current,MENU_CMD_CANCEL);
19489
87c339558bc1 fix menu toggle/hide issues
ben
parents: 17994
diff changeset
76 else if(strcmp(arg,"hide") == 0 || strcmp(arg,"toggle") == 0)
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
77 priv->current->show = 0;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
78 else
17994
6927fabaef92 Part1 of several printf2mp_msg changes in patch from Otvos Attila oattila AT chello DOT hu
reynaldo
parents: 17945
diff changeset
79 mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_UnknownMenuCommand,arg);
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
80 return 1;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
81 }
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
82 case MP_CMD_SET_MENU : {
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
83 char* menu = cmd->args[0].v.s;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
84 menu_t* l = priv->current;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
85 priv->current = menu_open(menu);
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
86 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
87 mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_FailedToOpenMenu,menu);
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
88 priv->current = l;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
89 priv->current->show = 0;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
90 } else {
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
91 priv->current->show = 1;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
92 priv->current->parent = l;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
93 }
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
94 return 1;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
95 }
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
96 }
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
97 return 0;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
98 }
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
99
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
100 static void get_image(struct vf_instance_s* vf, mp_image_t *mpi){
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
101 mp_image_t *dmpi;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
102
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
103 if(mpi->type == MP_IMGTYPE_TEMP && (!(mpi->flags&MP_IMGFLAG_PRESERVE)) ) {
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
104 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
105 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
106 memcpy(mpi->stride,dmpi->stride,MP_MAX_PLANES*sizeof(unsigned int));
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
107 mpi->flags|=MP_IMGFLAG_DIRECT;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
108 mpi->priv=(void*)dmpi;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
109 return;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
110 }
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
111 }
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
112
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
113 static void key_cb(int code) {
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
114 menu_read_key(st_priv->current,code);
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
115 }
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
116
17908
dcfaebcdde14 10l (forgot ...)
michael
parents: 16862
diff changeset
117 static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
118 mp_image_t *dmpi = NULL;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
119
21803
3acc4b00bcc6 allows OSD menu to be displayed when using MPEG PES video out
ben
parents: 19489
diff changeset
120 if (vf->priv->passthrough) {
3acc4b00bcc6 allows OSD menu to be displayed when using MPEG PES video out
ben
parents: 19489
diff changeset
121 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
122 0, mpi->w, mpi->h);
3acc4b00bcc6 allows OSD menu to be displayed when using MPEG PES video out
ben
parents: 19489
diff changeset
123 dmpi->planes[0]=mpi->planes[0];
3acc4b00bcc6 allows OSD menu to be displayed when using MPEG PES video out
ben
parents: 19489
diff changeset
124 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
125 }
3acc4b00bcc6 allows OSD menu to be displayed when using MPEG PES video out
ben
parents: 19489
diff changeset
126
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
127 // Close all menu who requested it
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
128 while(vf->priv->current->cl && vf->priv->current != vf->priv->root) {
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
129 menu_t* m = vf->priv->current;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
130 vf->priv->current = m->parent ? m->parent : vf->priv->root;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
131 menu_close(m);
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
132 }
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
133
25026
afead6ecb8ba Remove the pause filter and the cmd queue hack, to know the mplayer going to
ulion
parents: 24960
diff changeset
134 // 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
135 // last captured frame.
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
136 if(pause_mpi && (mpi->w != pause_mpi->w || mpi->h != pause_mpi->h ||
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
137 mpi->imgfmt != pause_mpi->imgfmt)) {
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
138 free_mp_image(pause_mpi);
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
139 pause_mpi = NULL;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
140 }
25026
afead6ecb8ba Remove the pause filter and the cmd queue hack, to know the mplayer going to
ulion
parents: 24960
diff changeset
141 if (!pause_mpi) {
afead6ecb8ba Remove the pause filter and the cmd queue hack, to know the mplayer going to
ulion
parents: 24960
diff changeset
142 pause_mpi = alloc_mpi(mpi->w,mpi->h,mpi->imgfmt);
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
143 copy_mpi(pause_mpi,mpi);
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
144 }
25026
afead6ecb8ba Remove the pause filter and the cmd queue hack, to know the mplayer going to
ulion
parents: 24960
diff changeset
145 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
146 copy_mpi(pause_mpi,mpi);
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
147
25026
afead6ecb8ba Remove the pause filter and the cmd queue hack, to know the mplayer going to
ulion
parents: 24960
diff changeset
148 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
149 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
150 mp_input_key_cb = key_cb;
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
151
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
152 if(mpi->flags&MP_IMGFLAG_DIRECT)
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
153 dmpi = mpi->priv;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
154 else {
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
155 dmpi = vf_get_image(vf->next,mpi->imgfmt,
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
156 MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE,
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
157 mpi->w,mpi->h);
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
158 copy_mpi(dmpi,mpi);
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
159 }
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
160 menu_draw(vf->priv->current,dmpi);
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
161
8244
64352fb332b6 don't fully-copy the planes if the menu doesn't show (faster)
colin
parents: 8224
diff changeset
162 } else {
64352fb332b6 don't fully-copy the planes if the menu doesn't show (faster)
colin
parents: 8224
diff changeset
163 if(mp_input_key_cb)
64352fb332b6 don't fully-copy the planes if the menu doesn't show (faster)
colin
parents: 8224
diff changeset
164 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
165
422eef67d14a speeds up mplayer execution by over FIVE times when all of the of the following apply:
gpoirier
parents: 21818
diff changeset
166 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
167 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
168 else {
21925
1c93736b6751 fix identation, broken by last commit
gpoirier
parents: 21924
diff changeset
169 dmpi = vf_get_image(vf->next,mpi->imgfmt,
1c93736b6751 fix identation, broken by last commit
gpoirier
parents: 21924
diff changeset
170 MP_IMGTYPE_EXPORT, MP_IMGFLAG_ACCEPT_STRIDE,
1c93736b6751 fix identation, broken by last commit
gpoirier
parents: 21924
diff changeset
171 mpi->w,mpi->h);
8244
64352fb332b6 don't fully-copy the planes if the menu doesn't show (faster)
colin
parents: 8224
diff changeset
172
21925
1c93736b6751 fix identation, broken by last commit
gpoirier
parents: 21924
diff changeset
173 dmpi->stride[0] = mpi->stride[0];
1c93736b6751 fix identation, broken by last commit
gpoirier
parents: 21924
diff changeset
174 dmpi->stride[1] = mpi->stride[1];
1c93736b6751 fix identation, broken by last commit
gpoirier
parents: 21924
diff changeset
175 dmpi->stride[2] = mpi->stride[2];
1c93736b6751 fix identation, broken by last commit
gpoirier
parents: 21924
diff changeset
176 dmpi->planes[0] = mpi->planes[0];
1c93736b6751 fix identation, broken by last commit
gpoirier
parents: 21924
diff changeset
177 dmpi->planes[1] = mpi->planes[1];
1c93736b6751 fix identation, broken by last commit
gpoirier
parents: 21924
diff changeset
178 dmpi->planes[2] = mpi->planes[2];
1c93736b6751 fix identation, broken by last commit
gpoirier
parents: 21924
diff changeset
179 dmpi->priv = mpi->priv;
1c93736b6751 fix identation, broken by last commit
gpoirier
parents: 21924
diff changeset
180 }
21924
422eef67d14a speeds up mplayer execution by over FIVE times when all of the of the following apply:
gpoirier
parents: 21818
diff changeset
181 }
17908
dcfaebcdde14 10l (forgot ...)
michael
parents: 16862
diff changeset
182 return vf_next_put_image(vf,dmpi, pts);
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
183 }
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
184
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
185 static void uninit(vf_instance_t *vf) {
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
186 vf->priv=NULL;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
187 if(pause_mpi) {
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
188 free_mp_image(pause_mpi);
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
189 pause_mpi = NULL;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
190 }
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
191 }
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
192
8224
fefc56153615 Fix freetype. Freetype is highly recommended for a nice output ;)
albeu
parents: 8197
diff changeset
193 static int config(struct vf_instance_s* vf, int width, int height, int d_width, int d_height,
fefc56153615 Fix freetype. Freetype is highly recommended for a nice output ;)
albeu
parents: 8197
diff changeset
194 unsigned int flags, unsigned int outfmt) {
fefc56153615 Fix freetype. Freetype is highly recommended for a nice output ;)
albeu
parents: 8197
diff changeset
195 #ifdef HAVE_FREETYPE
fefc56153615 Fix freetype. Freetype is highly recommended for a nice output ;)
albeu
parents: 8197
diff changeset
196 // 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
197 if (force_load_font) {
fefc56153615 Fix freetype. Freetype is highly recommended for a nice output ;)
albeu
parents: 8197
diff changeset
198 force_load_font = 0;
23338
2a66d95355f0 add new -subfont option, that allows having a different font for OSD (controls and menu) and subtitles
ben
parents: 22284
diff changeset
199 load_font_ft(width,height,&vo_font,font_name);
8224
fefc56153615 Fix freetype. Freetype is highly recommended for a nice output ;)
albeu
parents: 8197
diff changeset
200 }
fefc56153615 Fix freetype. Freetype is highly recommended for a nice output ;)
albeu
parents: 8197
diff changeset
201 #endif
21803
3acc4b00bcc6 allows OSD menu to be displayed when using MPEG PES video out
ben
parents: 19489
diff changeset
202 if(outfmt == IMGFMT_MPEGPES)
3acc4b00bcc6 allows OSD menu to be displayed when using MPEG PES video out
ben
parents: 19489
diff changeset
203 vf->priv->passthrough = 1;
8224
fefc56153615 Fix freetype. Freetype is highly recommended for a nice output ;)
albeu
parents: 8197
diff changeset
204 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
205 }
21803
3acc4b00bcc6 allows OSD menu to be displayed when using MPEG PES video out
ben
parents: 19489
diff changeset
206
3acc4b00bcc6 allows OSD menu to be displayed when using MPEG PES video out
ben
parents: 19489
diff changeset
207 static int query_format(struct vf_instance_s* vf, unsigned int fmt){
3acc4b00bcc6 allows OSD menu to be displayed when using MPEG PES video out
ben
parents: 19489
diff changeset
208 return (vf_next_query_format(vf,fmt));
3acc4b00bcc6 allows OSD menu to be displayed when using MPEG PES video out
ben
parents: 19489
diff changeset
209 }
3acc4b00bcc6 allows OSD menu to be displayed when using MPEG PES video out
ben
parents: 19489
diff changeset
210
23366
b344b6520518 rename some menu open functions, to avoid confusion with libc native open()
ben
parents: 23338
diff changeset
211 static int open_vf(vf_instance_t *vf, char* args){
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
212 if(!st_priv) {
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
213 st_priv = calloc(1,sizeof(struct vf_priv_s));
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
214 st_priv->root = st_priv->current = menu_open(args);
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
215 if(!st_priv->current) {
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
216 free(st_priv);
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
217 st_priv = NULL;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
218 return 0;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
219 }
13344
0d96af97ec00 option to display menu at startup, patch by Aurelien Jacobs <aurel at gnuage.org>
faust3
parents: 10397
diff changeset
220 st_priv->root->show = menu_startup;
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
221 mp_input_add_cmd_filter((mp_input_cmd_filter)cmd_filter,st_priv);
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
222 }
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
223
8224
fefc56153615 Fix freetype. Freetype is highly recommended for a nice output ;)
albeu
parents: 8197
diff changeset
224 vf->config = config;
21803
3acc4b00bcc6 allows OSD menu to be displayed when using MPEG PES video out
ben
parents: 19489
diff changeset
225 vf->query_format=query_format;
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
226 vf->put_image = put_image;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
227 vf->get_image = get_image;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
228 vf->uninit=uninit;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
229 vf->priv=st_priv;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
230 go2pause=0;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
231
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
232 return 1;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
233 }
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
234
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
235
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
236 vf_info_t vf_info_menu = {
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
237 "Internal filter for libmenu",
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
238 "menu",
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
239 "Albeu",
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
240 "",
23366
b344b6520518 rename some menu open functions, to avoid confusion with libc native open()
ben
parents: 23338
diff changeset
241 open_vf,
9755
6b7710f78c32 10L forgot this filter.
albeu
parents: 8635
diff changeset
242 NULL
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
243 };
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
244
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
245
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
246