]> git.sesse.net Git - vlc/blob - src/video_output/vout_intf.c
* src/video_output/vout_intf.c: small fix for cropping.
[vlc] / src / video_output / vout_intf.c
1 /*****************************************************************************
2  * vout_intf.c : video output interface
3  *****************************************************************************
4  * Copyright (C) 2000-2004 the VideoLAN team
5  * $Id$
6  *
7  * Authors: Gildas Bazin <gbazin@videolan.org>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
22  *****************************************************************************/
23
24 /*****************************************************************************
25  * Preamble
26  *****************************************************************************/
27 #include <stdlib.h>                                                /* free() */
28
29 #include <vlc/vlc.h>
30 #include <vlc/intf.h>
31
32 #include "vlc_video.h"
33 #include "video_output.h"
34 #include "vlc_image.h"
35 #include "vlc_spu.h"
36
37 /*****************************************************************************
38  * Local prototypes
39  *****************************************************************************/
40
41 /* Object variables callbacks */
42 static int ZoomCallback( vlc_object_t *, char const *,
43                          vlc_value_t, vlc_value_t, void * );
44 static int CropCallback( vlc_object_t *, char const *,
45                          vlc_value_t, vlc_value_t, void * );
46 static int OnTopCallback( vlc_object_t *, char const *,
47                           vlc_value_t, vlc_value_t, void * );
48 static int FullscreenCallback( vlc_object_t *, char const *,
49                                vlc_value_t, vlc_value_t, void * );
50 static int SnapshotCallback( vlc_object_t *, char const *,
51                              vlc_value_t, vlc_value_t, void * );
52
53 /*****************************************************************************
54  * vout_RequestWindow: Create/Get a video window if possible.
55  *****************************************************************************
56  * This function looks for the main interface and tries to request
57  * a new video window. If it fails then the vout will still need to create the
58  * window by itself.
59  *****************************************************************************/
60 void *vout_RequestWindow( vout_thread_t *p_vout,
61                           int *pi_x_hint, int *pi_y_hint,
62                           unsigned int *pi_width_hint,
63                           unsigned int *pi_height_hint )
64 {
65     intf_thread_t *p_intf = NULL;
66     vlc_list_t *p_list;
67     void *p_window;
68     vlc_value_t val;
69     int i;
70
71     /* Small kludge */
72     if( !var_Type( p_vout, "aspect-ratio" ) ) vout_IntfInit( p_vout );
73
74     /* Get requested coordinates */
75     var_Get( p_vout, "video-x", &val );
76     *pi_x_hint = val.i_int ;
77     var_Get( p_vout, "video-y", &val );
78     *pi_y_hint = val.i_int;
79
80     *pi_width_hint = p_vout->i_window_width;
81     *pi_height_hint = p_vout->i_window_height;
82
83     /* Check whether someone provided us with a window ID */
84     var_Get( p_vout->p_vlc, "drawable", &val );
85     if( val.i_int ) return (void *)val.i_int;
86
87     /* Find if the main interface supports embedding */
88     p_list = vlc_list_find( p_vout, VLC_OBJECT_INTF, FIND_ANYWHERE );
89     if( !p_list ) return NULL;
90
91     for( i = 0; i < p_list->i_count; i++ )
92     {
93         p_intf = (intf_thread_t *)p_list->p_values[i].p_object;
94         if( p_intf->b_block && p_intf->pf_request_window ) break;
95         p_intf = NULL;
96     }
97
98     if( !p_intf )
99     {
100         vlc_list_release( p_list );
101         return NULL;
102     }
103
104     vlc_object_yield( p_intf );
105     vlc_list_release( p_list );
106
107     p_window = p_intf->pf_request_window( p_intf, p_vout, pi_x_hint, pi_y_hint,
108                                           pi_width_hint, pi_height_hint );
109
110     if( !p_window ) vlc_object_release( p_intf );
111     else p_vout->p_parent_intf = p_intf;
112
113     return p_window;
114 }
115
116 void vout_ReleaseWindow( vout_thread_t *p_vout, void *p_window )
117 {
118     intf_thread_t *p_intf = p_vout->p_parent_intf;
119
120     if( !p_intf ) return;
121
122     vlc_mutex_lock( &p_intf->object_lock );
123     if( p_intf->b_dead )
124     {
125         vlc_mutex_unlock( &p_intf->object_lock );
126         return;
127     }
128
129     if( !p_intf->pf_release_window )
130     {
131         msg_Err( p_vout, "no pf_release_window");
132         vlc_mutex_unlock( &p_intf->object_lock );
133         vlc_object_release( p_intf );
134         return;
135     }
136
137     p_intf->pf_release_window( p_intf, p_window );
138
139     p_vout->p_parent_intf = NULL;
140     vlc_mutex_unlock( &p_intf->object_lock );
141     vlc_object_release( p_intf );
142 }
143
144 int vout_ControlWindow( vout_thread_t *p_vout, void *p_window,
145                         int i_query, va_list args )
146 {
147     intf_thread_t *p_intf = p_vout->p_parent_intf;
148     int i_ret;
149
150     if( !p_intf ) return VLC_EGENERIC;
151
152     vlc_mutex_lock( &p_intf->object_lock );
153     if( p_intf->b_dead )
154     {
155         vlc_mutex_unlock( &p_intf->object_lock );
156         return VLC_EGENERIC;
157     }
158
159     if( !p_intf->pf_control_window )
160     {
161         msg_Err( p_vout, "no pf_control_window");
162         vlc_mutex_unlock( &p_intf->object_lock );
163         return VLC_EGENERIC;
164     }
165
166     i_ret = p_intf->pf_control_window( p_intf, p_window, i_query, args );
167     vlc_mutex_unlock( &p_intf->object_lock );
168     return i_ret;
169 }
170
171 /*****************************************************************************
172  * vout_IntfInit: called during the vout creation to initialise misc things.
173  *****************************************************************************/
174 void vout_IntfInit( vout_thread_t *p_vout )
175 {
176     vlc_value_t val, text, old_val;
177
178     /* Create a few object variables we'll need later on */
179     var_Create( p_vout, "snapshot-path", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
180     var_Create( p_vout, "snapshot-format", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
181     var_Create( p_vout, "aspect-ratio", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
182     var_Create( p_vout, "monitor-aspect-ratio",
183                                       VLC_VAR_STRING | VLC_VAR_DOINHERIT );
184     var_Create( p_vout, "width", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
185     var_Create( p_vout, "height", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
186     var_Create( p_vout, "align", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
187     var_Create( p_vout, "video-x", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
188     var_Create( p_vout, "video-y", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
189
190     var_Create( p_vout, "zoom", VLC_VAR_FLOAT | VLC_VAR_ISCOMMAND |
191                 VLC_VAR_HASCHOICE | VLC_VAR_DOINHERIT );
192
193     text.psz_string = _("Zoom");
194     var_Change( p_vout, "zoom", VLC_VAR_SETTEXT, &text, NULL );
195
196     var_Get( p_vout, "zoom", &old_val );
197     if( old_val.f_float == 0.25 ||
198         old_val.f_float == 0.5 ||
199         old_val.f_float == 1 ||
200         old_val.f_float == 2 )
201     {
202         var_Change( p_vout, "zoom", VLC_VAR_DELCHOICE, &old_val, NULL );
203     }
204
205     val.f_float = 0.25; text.psz_string = _("1:4 Quarter");
206     var_Change( p_vout, "zoom", VLC_VAR_ADDCHOICE, &val, &text );
207     val.f_float = 0.5; text.psz_string = _("1:2 Half");
208     var_Change( p_vout, "zoom", VLC_VAR_ADDCHOICE, &val, &text );
209     val.f_float = 1; text.psz_string = _("1:1 Original");
210     var_Change( p_vout, "zoom", VLC_VAR_ADDCHOICE, &val, &text );
211     val.f_float = 2; text.psz_string = _("2:1 Double");
212     var_Change( p_vout, "zoom", VLC_VAR_ADDCHOICE, &val, &text );
213
214     var_Set( p_vout, "zoom", old_val );
215
216     var_AddCallback( p_vout, "zoom", ZoomCallback, NULL );
217
218     var_Create( p_vout, "crop", VLC_VAR_STRING | VLC_VAR_ISCOMMAND |
219                 VLC_VAR_HASCHOICE | VLC_VAR_DOINHERIT );
220
221     text.psz_string = _("Crop");
222     var_Change( p_vout, "crop", VLC_VAR_SETTEXT, &text, NULL );
223
224     val.psz_string = "";
225     var_Change( p_vout, "crop", VLC_VAR_DELCHOICE, &val, 0 );
226     val.psz_string = ""; text.psz_string = _("Default");
227     var_Change( p_vout, "crop", VLC_VAR_ADDCHOICE, &val, &text );
228     val.psz_string = "001:1"; text.psz_string = _("1:1");
229     var_Change( p_vout, "crop", VLC_VAR_ADDCHOICE, &val, &text );
230     val.psz_string = "004:3"; text.psz_string = _("4:3");
231     var_Change( p_vout, "crop", VLC_VAR_ADDCHOICE, &val, &text );
232     val.psz_string = "16:9"; text.psz_string = _("16:9");
233     var_Change( p_vout, "crop", VLC_VAR_ADDCHOICE, &val, &text );
234     val.psz_string = "221:100"; text.psz_string = _("221:100");
235     var_Change( p_vout, "crop", VLC_VAR_ADDCHOICE, &val, &text );
236
237     var_AddCallback( p_vout, "crop", CropCallback, NULL );
238
239     /* Add a variable to indicate if the window should be on top of others */
240     var_Create( p_vout, "video-on-top", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
241     text.psz_string = _("Always on top");
242     var_Change( p_vout, "video-on-top", VLC_VAR_SETTEXT, &text, NULL );
243     var_AddCallback( p_vout, "video-on-top", OnTopCallback, NULL );
244
245     /* Add a variable to indicate whether we want window decoration or not */
246     var_Create( p_vout, "video-deco", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
247
248     /* Add a fullscreen variable */
249     var_Create( p_vout, "fullscreen", VLC_VAR_BOOL );
250     text.psz_string = _("Fullscreen");
251     var_Change( p_vout, "fullscreen", VLC_VAR_SETTEXT, &text, NULL );
252     var_Change( p_vout, "fullscreen", VLC_VAR_INHERITVALUE, &val, NULL );
253     if( val.b_bool )
254     {
255         /* user requested fullscreen */
256         p_vout->i_changes |= VOUT_FULLSCREEN_CHANGE;
257     }
258     var_AddCallback( p_vout, "fullscreen", FullscreenCallback, NULL );
259
260     /* Add a snapshot variable */
261     var_Create( p_vout, "video-snapshot", VLC_VAR_VOID | VLC_VAR_ISCOMMAND );
262     text.psz_string = _("Snapshot");
263     var_Change( p_vout, "video-snapshot", VLC_VAR_SETTEXT, &text, NULL );
264     var_AddCallback( p_vout, "video-snapshot", SnapshotCallback, NULL );
265
266     /* Mouse coordinates */
267     var_Create( p_vout, "mouse-x", VLC_VAR_INTEGER );
268     var_Create( p_vout, "mouse-y", VLC_VAR_INTEGER );
269     var_Create( p_vout, "mouse-button-down", VLC_VAR_INTEGER );
270     var_Create( p_vout, "mouse-moved", VLC_VAR_BOOL );
271     var_Create( p_vout, "mouse-clicked", VLC_VAR_INTEGER );
272
273     var_Create( p_vout, "intf-change", VLC_VAR_BOOL );
274     val.b_bool = VLC_TRUE;
275     var_Set( p_vout, "intf-change", val );
276 }
277
278 /*****************************************************************************
279  * vout_Snapshot: generates a snapshot.
280  *****************************************************************************/
281 int vout_Snapshot( vout_thread_t *p_vout, picture_t *p_pic )
282 {
283     image_handler_t *p_image = image_HandlerCreate( p_vout );
284     video_format_t fmt_in = {0}, fmt_out = {0};
285     char *psz_filename;
286     subpicture_t *p_subpic;
287     picture_t *p_pif;
288     vlc_value_t val, format;
289     int i_ret;
290
291     var_Get( p_vout, "snapshot-path", &val );
292     if( val.psz_string && !*val.psz_string )
293     {
294         free( val.psz_string );
295         val.psz_string = 0;
296     }
297
298 #if defined(SYS_DARWIN) || defined(SYS_BEOS)
299     if( !val.psz_string && p_vout->p_vlc->psz_homedir )
300     {
301         asprintf( &val.psz_string, "%s/Desktop",
302                   p_vout->p_vlc->psz_homedir );
303     }
304
305 #elif defined(WIN32) && !defined(UNDER_CE)
306     if( !val.psz_string && p_vout->p_vlc->psz_homedir )
307     {
308         /* Get the My Pictures folder path */
309
310         char *p_mypicturesdir = NULL;
311         typedef HRESULT (WINAPI *SHGETFOLDERPATH)( HWND, int, HANDLE, DWORD,
312                                                    LPSTR );
313         #ifndef CSIDL_FLAG_CREATE
314         #   define CSIDL_FLAG_CREATE 0x8000
315         #endif
316         #ifndef CSIDL_MYPICTURES
317         #   define CSIDL_MYPICTURES 0x27
318         #endif
319         #ifndef SHGFP_TYPE_CURRENT
320         #   define SHGFP_TYPE_CURRENT 0
321         #endif
322
323         HINSTANCE shfolder_dll;
324         SHGETFOLDERPATH SHGetFolderPath ;
325
326         /* load the shfolder dll to retrieve SHGetFolderPath */
327         if( ( shfolder_dll = LoadLibrary( _T("SHFolder.dll") ) ) != NULL )
328         {
329             SHGetFolderPath = (void *)GetProcAddress( shfolder_dll,
330                                                       _T("SHGetFolderPathA") );
331             if( SHGetFolderPath != NULL )
332             {
333                 p_mypicturesdir = (char *)malloc( MAX_PATH );
334                 if( p_mypicturesdir ) 
335                 {
336
337                     if( S_OK != SHGetFolderPath( NULL,
338                                         CSIDL_MYPICTURES | CSIDL_FLAG_CREATE,
339                                         NULL, SHGFP_TYPE_CURRENT,
340                                         p_mypicturesdir ) )
341                     {
342                         free( p_mypicturesdir );
343                         p_mypicturesdir = NULL;
344                     }
345                 }
346             }
347             FreeLibrary( shfolder_dll );
348         }
349
350         if( p_mypicturesdir == NULL )
351         {
352             asprintf( &val.psz_string, "%s/" CONFIG_DIR,
353                       p_vout->p_vlc->psz_homedir );
354         }
355         else
356         {
357             asprintf( &val.psz_string, p_mypicturesdir );
358             free( p_mypicturesdir );
359         }
360     }
361
362 #else
363     if( !val.psz_string && p_vout->p_vlc->psz_homedir )
364     {
365         asprintf( &val.psz_string, "%s/" CONFIG_DIR,
366                   p_vout->p_vlc->psz_homedir );
367     }
368 #endif
369
370     if( !val.psz_string )
371     {
372         msg_Err( p_vout, "no directory specified for snapshots" );
373         return VLC_EGENERIC;
374     }
375     var_Get( p_vout, "snapshot-format", &format );
376     if( !format.psz_string || !*format.psz_string )
377     {
378         if( format.psz_string ) free( format.psz_string );
379         format.psz_string = strdup( "png" );
380     }
381
382     asprintf( &psz_filename, "%s/vlcsnap-%u.%s", val.psz_string,
383               (unsigned int)(p_pic->date / 100000) & 0xFFFFFF,
384               format.psz_string );
385     free( val.psz_string );
386     free( format.psz_string );
387
388     /* Save the snapshot */
389     fmt_in = p_vout->fmt_in;
390     fmt_out.i_sar_num = fmt_out.i_sar_den = 1;
391     i_ret = image_WriteUrl( p_image, p_pic, &fmt_in, &fmt_out, psz_filename );
392     if( i_ret != VLC_SUCCESS )
393     {
394         msg_Err( p_vout, "could not create snapshot %s", psz_filename );
395         free( psz_filename );
396         image_HandlerDelete( p_image );
397         return VLC_EGENERIC;
398     }
399
400     msg_Dbg( p_vout, "snapshot taken (%s)", psz_filename );
401     free( psz_filename );
402
403     /* Inject a subpicture with the snapshot */
404     memset( &fmt_out, 0, sizeof(fmt_out) );
405     fmt_out.i_chroma = VLC_FOURCC('Y','U','V','A');
406     p_pif = image_Convert( p_image, p_pic, &fmt_in, &fmt_out );
407     image_HandlerDelete( p_image );
408     if( !p_pif ) return VLC_EGENERIC;
409
410     p_subpic = spu_CreateSubpicture( p_vout->p_spu );
411     if( p_subpic == NULL )
412     {
413          p_pif->pf_release( p_pif );
414          return VLC_EGENERIC;
415     }
416
417     p_subpic->i_channel = 0;
418     p_subpic->i_start = mdate();
419     p_subpic->i_stop = mdate() + 4000000;
420     p_subpic->b_ephemer = VLC_TRUE;
421     p_subpic->b_fade = VLC_TRUE;
422     p_subpic->i_original_picture_width = p_vout->render.i_width * 4;
423     p_subpic->i_original_picture_height = p_vout->render.i_height * 4;
424
425     p_subpic->p_region = spu_CreateRegion( p_vout->p_spu, &fmt_out );
426     vout_CopyPicture( p_image->p_parent, &p_subpic->p_region->picture, p_pif );
427     p_pif->pf_release( p_pif );
428
429     spu_DisplaySubpicture( p_vout->p_spu, p_subpic );
430
431     return VLC_SUCCESS;
432 }
433
434 /*****************************************************************************
435  * vout_ControlDefault: default methods for video output control.
436  *****************************************************************************/
437 int vout_vaControlDefault( vout_thread_t *p_vout, int i_query, va_list args )
438 {
439     switch( i_query )
440     {
441     case VOUT_REPARENT:
442     case VOUT_CLOSE:
443         if( p_vout->p_parent_intf )
444         {
445             vlc_object_release( p_vout->p_parent_intf );
446             p_vout->p_parent_intf = NULL;
447         }
448         return VLC_SUCCESS;
449         break;
450
451     case VOUT_SNAPSHOT:
452         p_vout->b_snapshot = VLC_TRUE;
453         return VLC_SUCCESS;
454         break;
455
456     default:
457         msg_Dbg( p_vout, "control query not supported" );
458         return VLC_EGENERIC;
459     }
460 }
461
462 /*****************************************************************************
463  * Object variables callbacks
464  *****************************************************************************/
465 static int ZoomCallback( vlc_object_t *p_this, char const *psz_cmd,
466                          vlc_value_t oldval, vlc_value_t newval, void *p_data )
467 {
468     vout_thread_t *p_vout = (vout_thread_t *)p_this;
469     vout_Control( p_vout, VOUT_SET_ZOOM, newval.f_float );
470     return VLC_SUCCESS;
471 }
472
473 static int CropCallback( vlc_object_t *p_this, char const *psz_cmd,
474                          vlc_value_t oldval, vlc_value_t newval, void *p_data )
475 {
476     vout_thread_t *p_vout = (vout_thread_t *)p_this;
477     int64_t i_aspect_num, i_aspect_den;
478     unsigned int i_width, i_height;
479
480     char *psz_end, *psz_parser = strchr( newval.psz_string, ':' );
481
482     /* Restore defaults */
483     p_vout->fmt_in.i_x_offset = p_vout->fmt_render.i_x_offset;
484     p_vout->fmt_in.i_visible_width = p_vout->fmt_render.i_visible_width;
485     p_vout->fmt_in.i_y_offset = p_vout->fmt_render.i_y_offset;
486     p_vout->fmt_in.i_visible_height = p_vout->fmt_render.i_visible_height;
487
488     if( !psz_parser ) goto crop_end;
489
490     i_aspect_num = strtol( newval.psz_string, &psz_end, 0 );
491     if( psz_end == newval.psz_string ) goto crop_end;
492
493     i_aspect_den = strtol( ++psz_parser, &psz_end, 0 );
494     if( psz_end == psz_parser ) goto crop_end;
495
496     i_width = p_vout->fmt_in.i_sar_den * p_vout->fmt_render.i_visible_height *
497         i_aspect_num / i_aspect_den / p_vout->fmt_in.i_sar_num;
498     i_height = p_vout->fmt_render.i_visible_width * p_vout->fmt_in.i_sar_num *
499         i_aspect_den / i_aspect_num / p_vout->fmt_in.i_sar_den;
500
501     if( i_width < p_vout->fmt_render.i_visible_width )
502     {
503         p_vout->fmt_in.i_x_offset = p_vout->fmt_render.i_x_offset +
504             (p_vout->fmt_render.i_visible_width - i_width) / 2;
505         p_vout->fmt_in.i_visible_width = i_width;
506     }
507     else
508     {
509         p_vout->fmt_in.i_y_offset = p_vout->fmt_render.i_y_offset +
510             (p_vout->fmt_render.i_visible_height - i_height) / 2;
511         p_vout->fmt_in.i_visible_height = i_height;
512     }
513
514  crop_end:
515     msg_Dbg( p_vout, "cropping picture %ix%i to %i,%i,%ix%i",
516              p_vout->fmt_in.i_width, p_vout->fmt_in.i_height,
517              p_vout->fmt_in.i_x_offset, p_vout->fmt_in.i_y_offset,
518              p_vout->fmt_in.i_visible_width,
519              p_vout->fmt_in.i_visible_height );
520
521     return VLC_SUCCESS;
522 }
523
524 static int OnTopCallback( vlc_object_t *p_this, char const *psz_cmd,
525                          vlc_value_t oldval, vlc_value_t newval, void *p_data )
526 {
527     vout_thread_t *p_vout = (vout_thread_t *)p_this;
528     playlist_t *p_playlist;
529     vout_Control( p_vout, VOUT_SET_STAY_ON_TOP, newval.b_bool );
530
531     p_playlist = (playlist_t *)vlc_object_find( p_this, VLC_OBJECT_PLAYLIST,
532                                                  FIND_PARENT );
533     if( p_playlist )
534     {
535         /* Modify playlist as well because the vout might have to be restarted */
536         var_Create( p_playlist, "video-on-top", VLC_VAR_BOOL );
537         var_Set( p_playlist, "video-on-top", newval );
538
539         vlc_object_release( p_playlist );
540     }
541     return VLC_SUCCESS;
542 }
543
544 static int FullscreenCallback( vlc_object_t *p_this, char const *psz_cmd,
545                        vlc_value_t oldval, vlc_value_t newval, void *p_data )
546 {
547     vout_thread_t *p_vout = (vout_thread_t *)p_this;
548     playlist_t *p_playlist;
549     vlc_value_t val;
550
551     p_vout->i_changes |= VOUT_FULLSCREEN_CHANGE;
552
553     p_playlist = (playlist_t *)vlc_object_find( p_this, VLC_OBJECT_PLAYLIST,
554                                                  FIND_PARENT );
555     if( p_playlist )
556     {
557         /* Modify playlist as well because the vout might have to be restarted */
558         var_Create( p_playlist, "fullscreen", VLC_VAR_BOOL );
559         var_Set( p_playlist, "fullscreen", newval );
560
561         vlc_object_release( p_playlist );
562     }
563
564     /* Disable "always on top" in fullscreen mode */
565     var_Get( p_vout, "video-on-top", &val );
566     if( newval.b_bool && val.b_bool )
567     {
568         val.b_bool = VLC_FALSE;
569         vout_Control( p_vout, VOUT_SET_STAY_ON_TOP, val.b_bool );
570     }
571     else if( !newval.b_bool && val.b_bool )
572     {
573         vout_Control( p_vout, VOUT_SET_STAY_ON_TOP, val.b_bool );
574     }
575
576     val.b_bool = VLC_TRUE;
577     var_Set( p_vout, "intf-change", val );
578     return VLC_SUCCESS;
579 }
580
581 static int SnapshotCallback( vlc_object_t *p_this, char const *psz_cmd,
582                        vlc_value_t oldval, vlc_value_t newval, void *p_data )
583 {
584     vout_thread_t *p_vout = (vout_thread_t *)p_this;
585     vout_Control( p_vout, VOUT_SNAPSHOT );
586     return VLC_SUCCESS;
587 }