annotate libmenu/vf_menu.c @ 22625:34c5e9089683

Remove duplicate largefile CFLAGS that are set from configure.
author diego
date Fri, 16 Mar 2007 22:24:15 +0000
parents 83366c8e1928
children 2a66d95355f0
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
16862
931bdbc37ee0 Unify include paths, -I.. is in CFLAGS.
diego
parents: 13528
diff changeset
14 #include "mp_msg.h"
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
15
16862
931bdbc37ee0 Unify include paths, -I.. is in CFLAGS.
diego
parents: 13528
diff changeset
16 #include "libmpcodecs/img_format.h"
931bdbc37ee0 Unify include paths, -I.. is in CFLAGS.
diego
parents: 13528
diff changeset
17 #include "libmpcodecs/mp_image.h"
931bdbc37ee0 Unify include paths, -I.. is in CFLAGS.
diego
parents: 13528
diff changeset
18 #include "libmpcodecs/vf.h"
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
19
16862
931bdbc37ee0 Unify include paths, -I.. is in CFLAGS.
diego
parents: 13528
diff changeset
20 #include "libvo/fastmemcpy.h"
931bdbc37ee0 Unify include paths, -I.. is in CFLAGS.
diego
parents: 13528
diff changeset
21 #include "libvo/video_out.h"
931bdbc37ee0 Unify include paths, -I.. is in CFLAGS.
diego
parents: 13528
diff changeset
22 #include "libvo/font_load.h"
931bdbc37ee0 Unify include paths, -I.. is in CFLAGS.
diego
parents: 13528
diff changeset
23 #include "input/input.h"
931bdbc37ee0 Unify include paths, -I.. is in CFLAGS.
diego
parents: 13528
diff changeset
24 #include "m_struct.h"
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
25 #include "menu.h"
22284
83366c8e1928 Fix menu to work with mpctx
uau
parents: 21925
diff changeset
26 #include "access_mpcontext.h"
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
27
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
28
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
29 static struct vf_priv_s* st_priv = NULL;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
30
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
31 static mp_image_t* pause_mpi = NULL;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
32 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
33 /// if nonzero display menu at startup
13528
39bdfbbc4216 support newer gcc
faust3
parents: 13344
diff changeset
34 int attribute_used menu_startup = 0;
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
35
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
36 struct vf_priv_s {
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
37 menu_t* root;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
38 menu_t* current;
21803
3acc4b00bcc6 allows OSD menu to be displayed when using MPEG PES video out
ben
parents: 19489
diff changeset
39 int passthrough;
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
40 };
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
41
17908
dcfaebcdde14 10l (forgot ...)
michael
parents: 16862
diff changeset
42 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
43
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
44 static mp_image_t* alloc_mpi(int w, int h, uint32_t fmt) {
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
45 mp_image_t* mpi = new_mp_image(w,h);
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
46
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
47 mp_image_setfmt(mpi,fmt);
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
48 // IF09 - allocate space for 4. plane delta info - unused
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
49 if (mpi->imgfmt == IMGFMT_IF09)
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
50 {
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
51 mpi->planes[0]=memalign(64, mpi->bpp*mpi->width*(mpi->height+2)/8+
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
52 mpi->chroma_width*mpi->chroma_height);
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
53 /* delta table, just for fun ;) */
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
54 mpi->planes[3]=mpi->planes[0]+2*(mpi->chroma_width*mpi->chroma_height);
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
55 }
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
56 else
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
57 mpi->planes[0]=memalign(64, mpi->bpp*mpi->width*(mpi->height+2)/8);
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
58 if(mpi->flags&MP_IMGFLAG_PLANAR){
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
59 // YV12/I420/YVU9/IF09. feel free to add other planar formats here...
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
60 if(!mpi->stride[0]) mpi->stride[0]=mpi->width;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
61 if(!mpi->stride[1]) mpi->stride[1]=mpi->stride[2]=mpi->chroma_width;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
62 if(mpi->flags&MP_IMGFLAG_SWAPPED){
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
63 // I420/IYUV (Y,U,V)
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
64 mpi->planes[1]=mpi->planes[0]+mpi->width*mpi->height;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
65 mpi->planes[2]=mpi->planes[1]+mpi->chroma_width*mpi->chroma_height;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
66 } else {
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
67 // YV12,YVU9,IF09 (Y,V,U)
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
68 mpi->planes[2]=mpi->planes[0]+mpi->width*mpi->height;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
69 mpi->planes[1]=mpi->planes[2]+mpi->chroma_width*mpi->chroma_height;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
70 }
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
71 } else {
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
72 if(!mpi->stride[0]) mpi->stride[0]=mpi->width*mpi->bpp/8;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
73 }
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
74 mpi->flags|=MP_IMGFLAG_ALLOCATED;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
75
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
76 return mpi;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
77 }
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
78
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
79 void vf_menu_pause_update(struct vf_instance_s* vf) {
22284
83366c8e1928 Fix menu to work with mpctx
uau
parents: 21925
diff changeset
80 vo_functions_t *video_out = mpctx_get_video_out(vf->priv->current->ctx);
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
81 if(pause_mpi) {
17908
dcfaebcdde14 10l (forgot ...)
michael
parents: 16862
diff changeset
82 put_image(vf,pause_mpi, MP_NOPTS_VALUE);
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
83 // Don't draw the osd atm
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
84 //vf->control(vf,VFCTRL_DRAW_OSD,NULL);
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
85 video_out->flip_page();
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
86 }
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
87 }
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
88
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
89 static int cmd_filter(mp_cmd_t* cmd, int paused, struct vf_priv_s * priv) {
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
90
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
91 switch(cmd->id) {
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
92 case MP_CMD_PAUSE :
21818
7bd48682de5f woops, actually fix URL this time
gpoirier
parents: 21813
diff changeset
93 #if 0 // http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/2003-March/017286.html
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
94 if(!paused && !go2pause) { // Initial pause cmd -> wait the next put_image
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
95 go2pause = 1;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
96 return 1;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
97 }
9903
7d70e56f317a 10l fix by Vladimir Mosgalin <mosgalin@VM10124.spb.edu>
alex
parents: 9755
diff changeset
98 #endif
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
99 if(go2pause == 2) // Msg resent by put_image after saving the image
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
100 go2pause = 0;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
101 break;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
102 case MP_CMD_MENU : { // Convert txt cmd from the users into libmenu stuff
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
103 char* arg = cmd->args[0].v.s;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
104
19489
87c339558bc1 fix menu toggle/hide issues
ben
parents: 17994
diff changeset
105 if(!priv->current->show && !(strcmp(arg,"hide") == 0) )
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
106 priv->current->show = 1;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
107 else if(strcmp(arg,"up") == 0)
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
108 menu_read_cmd(priv->current,MENU_CMD_UP);
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
109 else if(strcmp(arg,"down") == 0)
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
110 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
111 else if(strcmp(arg,"left") == 0)
98f4e3704a76 Allow 6 ways (up/down/left/right/ok/cancel) navigation.
albeu
parents: 17908
diff changeset
112 menu_read_cmd(priv->current,MENU_CMD_LEFT);
98f4e3704a76 Allow 6 ways (up/down/left/right/ok/cancel) navigation.
albeu
parents: 17908
diff changeset
113 else if(strcmp(arg,"right") == 0)
98f4e3704a76 Allow 6 ways (up/down/left/right/ok/cancel) navigation.
albeu
parents: 17908
diff changeset
114 menu_read_cmd(priv->current,MENU_CMD_RIGHT);
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
115 else if(strcmp(arg,"ok") == 0)
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
116 menu_read_cmd(priv->current,MENU_CMD_OK);
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
117 else if(strcmp(arg,"cancel") == 0)
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
118 menu_read_cmd(priv->current,MENU_CMD_CANCEL);
19489
87c339558bc1 fix menu toggle/hide issues
ben
parents: 17994
diff changeset
119 else if(strcmp(arg,"hide") == 0 || strcmp(arg,"toggle") == 0)
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
120 priv->current->show = 0;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
121 else
17994
6927fabaef92 Part1 of several printf2mp_msg changes in patch from Otvos Attila oattila AT chello DOT hu
reynaldo
parents: 17945
diff changeset
122 mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_UnknownMenuCommand,arg);
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
123 return 1;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
124 }
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
125 case MP_CMD_SET_MENU : {
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
126 char* menu = cmd->args[0].v.s;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
127 menu_t* l = priv->current;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
128 priv->current = menu_open(menu);
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
129 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
130 mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_FailedToOpenMenu,menu);
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
131 priv->current = l;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
132 priv->current->show = 0;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
133 } else {
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
134 priv->current->show = 1;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
135 priv->current->parent = l;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
136 }
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
137 return 1;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
138 }
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
139 }
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
140 return 0;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
141 }
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
142
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
143 static void get_image(struct vf_instance_s* vf, mp_image_t *mpi){
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
144 mp_image_t *dmpi;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
145
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
146 if(mpi->type == MP_IMGTYPE_TEMP && (!(mpi->flags&MP_IMGFLAG_PRESERVE)) ) {
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
147 dmpi = vf_get_image(vf->next,mpi->imgfmt,mpi->type, mpi->flags, mpi->w, mpi->h);
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
148 memcpy(mpi->planes,dmpi->planes,MP_MAX_PLANES*sizeof(unsigned char*));
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
149 memcpy(mpi->stride,dmpi->stride,MP_MAX_PLANES*sizeof(unsigned int));
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
150 mpi->flags|=MP_IMGFLAG_DIRECT;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
151 mpi->priv=(void*)dmpi;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
152 return;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
153 }
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
154 }
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
155
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
156 static void key_cb(int code) {
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
157 menu_read_key(st_priv->current,code);
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
158 }
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
159
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
160
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
161
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
162 inline static void copy_mpi(mp_image_t *dmpi, mp_image_t *mpi) {
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
163 if(mpi->flags&MP_IMGFLAG_PLANAR){
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
164 memcpy_pic(dmpi->planes[0],mpi->planes[0], mpi->w, mpi->h,
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
165 dmpi->stride[0],mpi->stride[0]);
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
166 memcpy_pic(dmpi->planes[1],mpi->planes[1], mpi->chroma_width, mpi->chroma_height,
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
167 dmpi->stride[1],mpi->stride[1]);
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
168 memcpy_pic(dmpi->planes[2], mpi->planes[2], mpi->chroma_width, mpi->chroma_height,
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
169 dmpi->stride[2],mpi->stride[2]);
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
170 } else {
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
171 memcpy_pic(dmpi->planes[0],mpi->planes[0],
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
172 mpi->w*(dmpi->bpp/8), mpi->h,
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
173 dmpi->stride[0],mpi->stride[0]);
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
174 }
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
175 }
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
176
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
177
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
178
17908
dcfaebcdde14 10l (forgot ...)
michael
parents: 16862
diff changeset
179 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
180 mp_image_t *dmpi = NULL;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
181
21803
3acc4b00bcc6 allows OSD menu to be displayed when using MPEG PES video out
ben
parents: 19489
diff changeset
182 if (vf->priv->passthrough) {
3acc4b00bcc6 allows OSD menu to be displayed when using MPEG PES video out
ben
parents: 19489
diff changeset
183 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
184 0, mpi->w, mpi->h);
3acc4b00bcc6 allows OSD menu to be displayed when using MPEG PES video out
ben
parents: 19489
diff changeset
185 dmpi->planes[0]=mpi->planes[0];
3acc4b00bcc6 allows OSD menu to be displayed when using MPEG PES video out
ben
parents: 19489
diff changeset
186 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
187 }
3acc4b00bcc6 allows OSD menu to be displayed when using MPEG PES video out
ben
parents: 19489
diff changeset
188
8251
3d74366d947e better fix for my previous 10l
colin
parents: 8244
diff changeset
189 if(vf->priv->current->show
3d74366d947e better fix for my previous 10l
colin
parents: 8244
diff changeset
190 || (vf->priv->current->parent && vf->priv->current->parent->show)) {
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
191 // Close all menu who requested it
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
192 while(vf->priv->current->cl && vf->priv->current != vf->priv->root) {
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
193 menu_t* m = vf->priv->current;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
194 vf->priv->current = m->parent ? m->parent : vf->priv->root;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
195 menu_close(m);
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
196 }
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
198 // Step 1 : save the picture
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
199 while(go2pause == 1) {
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
200 static char delay = 0; // Hack : wait the 2 frame to be sure to show the right picture
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
201 delay ^= 1; // after a seek
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
202 if(!delay) break;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
203
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
204 if(pause_mpi && (mpi->w != pause_mpi->w || mpi->h != pause_mpi->h ||
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
205 mpi->imgfmt != pause_mpi->imgfmt)) {
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
206 free_mp_image(pause_mpi);
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
207 pause_mpi = NULL;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
208 }
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
209 if(!pause_mpi)
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
210 pause_mpi = alloc_mpi(mpi->w,mpi->h,mpi->imgfmt);
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
211 copy_mpi(pause_mpi,mpi);
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
212 mp_input_queue_cmd(mp_input_parse_cmd("pause"));
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
213 go2pause = 2;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
214 break;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
215 }
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
216
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
217 // Grab // Ungrab the keys
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
218 if(!mp_input_key_cb && vf->priv->current->show)
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
219 mp_input_key_cb = key_cb;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
220 if(mp_input_key_cb && !vf->priv->current->show)
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
221 mp_input_key_cb = NULL;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
222
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
223 if(mpi->flags&MP_IMGFLAG_DIRECT)
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
224 dmpi = mpi->priv;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
225 else {
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
226 dmpi = vf_get_image(vf->next,mpi->imgfmt,
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
227 MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE,
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
228 mpi->w,mpi->h);
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
229 copy_mpi(dmpi,mpi);
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
230 }
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
231 menu_draw(vf->priv->current,dmpi);
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
232
8244
64352fb332b6 don't fully-copy the planes if the menu doesn't show (faster)
colin
parents: 8224
diff changeset
233 } else {
64352fb332b6 don't fully-copy the planes if the menu doesn't show (faster)
colin
parents: 8224
diff changeset
234 if(mp_input_key_cb)
64352fb332b6 don't fully-copy the planes if the menu doesn't show (faster)
colin
parents: 8224
diff changeset
235 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
236
422eef67d14a speeds up mplayer execution by over FIVE times when all of the of the following apply:
gpoirier
parents: 21818
diff changeset
237 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
238 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
239 else {
21925
1c93736b6751 fix identation, broken by last commit
gpoirier
parents: 21924
diff changeset
240 dmpi = vf_get_image(vf->next,mpi->imgfmt,
1c93736b6751 fix identation, broken by last commit
gpoirier
parents: 21924
diff changeset
241 MP_IMGTYPE_EXPORT, MP_IMGFLAG_ACCEPT_STRIDE,
1c93736b6751 fix identation, broken by last commit
gpoirier
parents: 21924
diff changeset
242 mpi->w,mpi->h);
8244
64352fb332b6 don't fully-copy the planes if the menu doesn't show (faster)
colin
parents: 8224
diff changeset
243
21925
1c93736b6751 fix identation, broken by last commit
gpoirier
parents: 21924
diff changeset
244 dmpi->stride[0] = mpi->stride[0];
1c93736b6751 fix identation, broken by last commit
gpoirier
parents: 21924
diff changeset
245 dmpi->stride[1] = mpi->stride[1];
1c93736b6751 fix identation, broken by last commit
gpoirier
parents: 21924
diff changeset
246 dmpi->stride[2] = mpi->stride[2];
1c93736b6751 fix identation, broken by last commit
gpoirier
parents: 21924
diff changeset
247 dmpi->planes[0] = mpi->planes[0];
1c93736b6751 fix identation, broken by last commit
gpoirier
parents: 21924
diff changeset
248 dmpi->planes[1] = mpi->planes[1];
1c93736b6751 fix identation, broken by last commit
gpoirier
parents: 21924
diff changeset
249 dmpi->planes[2] = mpi->planes[2];
1c93736b6751 fix identation, broken by last commit
gpoirier
parents: 21924
diff changeset
250 dmpi->priv = mpi->priv;
1c93736b6751 fix identation, broken by last commit
gpoirier
parents: 21924
diff changeset
251 }
21924
422eef67d14a speeds up mplayer execution by over FIVE times when all of the of the following apply:
gpoirier
parents: 21818
diff changeset
252 }
17908
dcfaebcdde14 10l (forgot ...)
michael
parents: 16862
diff changeset
253 return vf_next_put_image(vf,dmpi, pts);
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
254 }
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
255
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
256 static void uninit(vf_instance_t *vf) {
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
257 vf->priv=NULL;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
258 if(pause_mpi) {
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
259 free_mp_image(pause_mpi);
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
260 pause_mpi = NULL;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
261 }
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
262 }
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
263
8224
fefc56153615 Fix freetype. Freetype is highly recommended for a nice output ;)
albeu
parents: 8197
diff changeset
264 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
265 unsigned int flags, unsigned int outfmt) {
fefc56153615 Fix freetype. Freetype is highly recommended for a nice output ;)
albeu
parents: 8197
diff changeset
266 #ifdef HAVE_FREETYPE
fefc56153615 Fix freetype. Freetype is highly recommended for a nice output ;)
albeu
parents: 8197
diff changeset
267 // 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
268 if (force_load_font) {
fefc56153615 Fix freetype. Freetype is highly recommended for a nice output ;)
albeu
parents: 8197
diff changeset
269 force_load_font = 0;
8635
81dbd28ef7c0 these patches let ,,oldstyle'' and freetype subtitle renderers live
arpi
parents: 8623
diff changeset
270 load_font_ft(width,height);
8224
fefc56153615 Fix freetype. Freetype is highly recommended for a nice output ;)
albeu
parents: 8197
diff changeset
271 }
fefc56153615 Fix freetype. Freetype is highly recommended for a nice output ;)
albeu
parents: 8197
diff changeset
272 #endif
21803
3acc4b00bcc6 allows OSD menu to be displayed when using MPEG PES video out
ben
parents: 19489
diff changeset
273 if(outfmt == IMGFMT_MPEGPES)
3acc4b00bcc6 allows OSD menu to be displayed when using MPEG PES video out
ben
parents: 19489
diff changeset
274 vf->priv->passthrough = 1;
8224
fefc56153615 Fix freetype. Freetype is highly recommended for a nice output ;)
albeu
parents: 8197
diff changeset
275 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
276 }
21803
3acc4b00bcc6 allows OSD menu to be displayed when using MPEG PES video out
ben
parents: 19489
diff changeset
277
3acc4b00bcc6 allows OSD menu to be displayed when using MPEG PES video out
ben
parents: 19489
diff changeset
278 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
279 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
280 }
3acc4b00bcc6 allows OSD menu to be displayed when using MPEG PES video out
ben
parents: 19489
diff changeset
281
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
282 static int open(vf_instance_t *vf, char* args){
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
283 if(!st_priv) {
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
284 st_priv = calloc(1,sizeof(struct vf_priv_s));
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
285 st_priv->root = st_priv->current = menu_open(args);
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
286 if(!st_priv->current) {
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
287 free(st_priv);
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
288 st_priv = NULL;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
289 return 0;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
290 }
13344
0d96af97ec00 option to display menu at startup, patch by Aurelien Jacobs <aurel at gnuage.org>
faust3
parents: 10397
diff changeset
291 st_priv->root->show = menu_startup;
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
292 mp_input_add_cmd_filter((mp_input_cmd_filter)cmd_filter,st_priv);
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
293 }
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
294
8224
fefc56153615 Fix freetype. Freetype is highly recommended for a nice output ;)
albeu
parents: 8197
diff changeset
295 vf->config = config;
21803
3acc4b00bcc6 allows OSD menu to be displayed when using MPEG PES video out
ben
parents: 19489
diff changeset
296 vf->query_format=query_format;
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
297 vf->put_image = put_image;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
298 vf->get_image = get_image;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
299 vf->uninit=uninit;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
300 vf->priv=st_priv;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
301 go2pause=0;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
302
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
303 return 1;
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
304 }
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
305
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
306
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
307 vf_info_t vf_info_menu = {
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
308 "Internal filter for libmenu",
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
309 "menu",
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
310 "Albeu",
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
311 "",
9755
6b7710f78c32 10L forgot this filter.
albeu
parents: 8635
diff changeset
312 open,
6b7710f78c32 10L forgot this filter.
albeu
parents: 8635
diff changeset
313 NULL
8197
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
314 };
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
315
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
316
b31caec933e9 OSD menus initial version
albeu
parents:
diff changeset
317