Qt(dialog provider): fix utf8 issue with generic dialog box title
[vlc.git] / src / video_output / vout_intf.c
blob5640a2565550b77f5a90e6c69de93d2e837d88bc
1 /*****************************************************************************
2 * vout_intf.c : video output interface
3 *****************************************************************************
4 * Copyright (C) 2000-2007 VLC authors and VideoLAN
6 * Authors: Gildas Bazin <gbazin@videolan.org>
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU Lesser General Public License as published by
10 * the Free Software Foundation; either version 2.1 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public License
19 * along with this program; if not, write to the Free Software Foundation,
20 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
21 *****************************************************************************/
23 /*****************************************************************************
24 * Preamble
25 *****************************************************************************/
27 #ifdef HAVE_CONFIG_H
28 # include "config.h"
29 #endif
31 #include <vlc_common.h>
33 #include <stdio.h>
34 #include <stdlib.h> /* free() */
35 #include <assert.h>
37 #include <vlc_block.h>
38 #include <vlc_modules.h>
40 #include <vlc_vout.h>
41 #include <vlc_vout_osd.h>
42 #include <vlc_strings.h>
43 #include <vlc_charset.h>
44 #include "vout_internal.h"
46 /*****************************************************************************
47 * Local prototypes
48 *****************************************************************************/
49 /* Object variables callbacks */
50 static int CropCallback( vlc_object_t *, char const *,
51 vlc_value_t, vlc_value_t, void * );
52 static int CropBorderCallback( vlc_object_t *, char const *,
53 vlc_value_t, vlc_value_t, void * );
54 static int AspectCallback( vlc_object_t *, char const *,
55 vlc_value_t, vlc_value_t, void * );
56 static int AutoScaleCallback( vlc_object_t *, char const *,
57 vlc_value_t, vlc_value_t, void * );
58 static int ScaleCallback( vlc_object_t *, char const *,
59 vlc_value_t, vlc_value_t, void * );
60 static int ZoomCallback( vlc_object_t *, char const *,
61 vlc_value_t, vlc_value_t, void * );
62 static int AboveCallback( vlc_object_t *, char const *,
63 vlc_value_t, vlc_value_t, void * );
64 static int WallPaperCallback( vlc_object_t *, char const *,
65 vlc_value_t, vlc_value_t, void * );
66 static int FullscreenCallback( vlc_object_t *, char const *,
67 vlc_value_t, vlc_value_t, void * );
68 static int SnapshotCallback( vlc_object_t *, char const *,
69 vlc_value_t, vlc_value_t, void * );
70 static int VideoFilterCallback( vlc_object_t *, char const *,
71 vlc_value_t, vlc_value_t, void * );
72 static int SubSourceCallback( vlc_object_t *, char const *,
73 vlc_value_t, vlc_value_t, void * );
74 static int SubFilterCallback( vlc_object_t *, char const *,
75 vlc_value_t, vlc_value_t, void * );
76 static int SubMarginCallback( vlc_object_t *, char const *,
77 vlc_value_t, vlc_value_t, void * );
79 /*****************************************************************************
80 * vout_IntfInit: called during the vout creation to initialise misc things.
81 *****************************************************************************/
82 static const struct
84 double f_value;
85 char psz_label[13];
86 } p_zoom_values[] = {
87 { 0.25, N_("1:4 Quarter") },
88 { 0.5, N_("1:2 Half") },
89 { 1, N_("1:1 Original") },
90 { 2, N_("2:1 Double") },
93 static const struct
95 char psz_value[8];
96 char psz_label[8];
97 } p_crop_values[] = {
98 { "", N_("Default") },
99 { "16:10", "16:10" },
100 { "16:9", "16:9" },
101 { "4:3", "4:3" },
102 { "185:100", "1.85:1" },
103 { "221:100", "2.21:1" },
104 { "235:100", "2.35:1" },
105 { "239:100", "2.39:1" },
106 { "5:3", "5:3" },
107 { "5:4", "5:4" },
108 { "1:1", "1:1" },
111 static const struct
113 char psz_value[8];
114 char psz_label[8];
115 } p_aspect_ratio_values[] = {
116 { "", N_("Default") },
117 { "16:9", "16:9" },
118 { "4:3", "4:3" },
119 { "1:1", "1:1" },
120 { "16:10", "16:10" },
121 { "221:100", "2.21:1" },
122 { "235:100", "2.35:1" },
123 { "239:100", "2.39:1" },
124 { "5:4", "5:4" },
127 static void AddCustomRatios( vout_thread_t *p_vout, const char *psz_var,
128 char *psz_list )
130 assert( psz_list );
132 char *psz_cur = psz_list;
133 char *psz_next;
134 while( psz_cur && *psz_cur )
136 vlc_value_t val, text;
137 psz_next = strchr( psz_cur, ',' );
138 if( psz_next )
140 *psz_next = '\0';
141 psz_next++;
143 val.psz_string = psz_cur;
144 text.psz_string = psz_cur;
145 var_Change( p_vout, psz_var, VLC_VAR_ADDCHOICE, &val, &text);
146 psz_cur = psz_next;
150 void vout_IntfInit( vout_thread_t *p_vout )
152 vlc_value_t val, text, old_val;
153 char *psz_buf;
155 /* Create a few object variables we'll need later on */
156 var_Create( p_vout, "snapshot-num", VLC_VAR_INTEGER );
157 var_SetInteger( p_vout, "snapshot-num", 1 );
159 var_Create( p_vout, "width", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
160 var_Create( p_vout, "height", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
161 var_Create( p_vout, "align", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
163 var_Create( p_vout, "video-x", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
164 var_Create( p_vout, "video-y", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
166 var_Create( p_vout, "mouse-hide-timeout",
167 VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
169 /* Add variables to manage scaling video */
170 var_Create( p_vout, "autoscale", VLC_VAR_BOOL | VLC_VAR_DOINHERIT
171 | VLC_VAR_ISCOMMAND );
172 text.psz_string = _("Autoscale video");
173 var_Change( p_vout, "autoscale", VLC_VAR_SETTEXT, &text, NULL );
174 var_AddCallback( p_vout, "autoscale", AutoScaleCallback, NULL );
176 var_Create( p_vout, "scale", VLC_VAR_FLOAT | VLC_VAR_DOINHERIT
177 | VLC_VAR_ISCOMMAND );
178 text.psz_string = _("Scale factor");
179 var_Change( p_vout, "scale", VLC_VAR_SETTEXT, &text, NULL );
180 var_AddCallback( p_vout, "scale", ScaleCallback, NULL );
182 /* Zoom object var */
183 var_Create( p_vout, "zoom", VLC_VAR_FLOAT | VLC_VAR_ISCOMMAND |
184 VLC_VAR_HASCHOICE | VLC_VAR_DOINHERIT );
186 text.psz_string = _("Zoom");
187 var_Change( p_vout, "zoom", VLC_VAR_SETTEXT, &text, NULL );
188 old_val.f_float = var_GetFloat( p_vout, "zoom" );
190 for( size_t i = 0; i < ARRAY_SIZE(p_zoom_values); i++ )
192 val.f_float = p_zoom_values[i].f_value;
193 text.psz_string = vlc_gettext( p_zoom_values[i].psz_label );
194 /* FIXME: This DELCHOICE hack corrupts the the "zoom" variable value
195 * for a short time window. Same for "crop" and "aspect-ratio". */
196 if( old_val.f_float == val.f_float )
197 var_Change( p_vout, "zoom", VLC_VAR_DELCHOICE, &old_val, NULL );
198 var_Change( p_vout, "zoom", VLC_VAR_ADDCHOICE, &val, &text );
199 if( old_val.f_float == val.f_float )
200 var_Change( p_vout, "zoom", VLC_VAR_SETVALUE, &old_val, NULL );
203 var_AddCallback( p_vout, "zoom", ZoomCallback, NULL );
205 /* Crop offset vars */
206 var_Create( p_vout, "crop-left", VLC_VAR_INTEGER | VLC_VAR_ISCOMMAND );
207 var_Create( p_vout, "crop-top", VLC_VAR_INTEGER | VLC_VAR_ISCOMMAND );
208 var_Create( p_vout, "crop-right", VLC_VAR_INTEGER | VLC_VAR_ISCOMMAND );
209 var_Create( p_vout, "crop-bottom", VLC_VAR_INTEGER | VLC_VAR_ISCOMMAND );
211 var_AddCallback( p_vout, "crop-left", CropBorderCallback, NULL );
212 var_AddCallback( p_vout, "crop-top", CropBorderCallback, NULL );
213 var_AddCallback( p_vout, "crop-right", CropBorderCallback, NULL );
214 var_AddCallback( p_vout, "crop-bottom", CropBorderCallback, NULL );
216 /* Crop object var */
217 var_Create( p_vout, "crop", VLC_VAR_STRING | VLC_VAR_ISCOMMAND |
218 VLC_VAR_HASCHOICE | VLC_VAR_DOINHERIT );
220 text.psz_string = _("Crop");
221 var_Change( p_vout, "crop", VLC_VAR_SETTEXT, &text, NULL );
223 val.psz_string = (char*)"";
224 var_Change( p_vout, "crop", VLC_VAR_DELCHOICE, &val, 0 );
226 for( size_t i = 0; i < ARRAY_SIZE(p_crop_values); i++ )
228 val.psz_string = (char*)p_crop_values[i].psz_value;
229 text.psz_string = _( p_crop_values[i].psz_label );
230 var_Change( p_vout, "crop", VLC_VAR_ADDCHOICE, &val, &text );
233 /* Add custom crop ratios */
234 psz_buf = var_CreateGetNonEmptyString( p_vout, "custom-crop-ratios" );
235 if( psz_buf )
237 AddCustomRatios( p_vout, "crop", psz_buf );
238 free( psz_buf );
241 var_AddCallback( p_vout, "crop", CropCallback, NULL );
243 /* Monitor pixel aspect-ratio */
244 var_Create( p_vout, "monitor-par", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
246 /* Aspect-ratio object var */
247 var_Create( p_vout, "aspect-ratio", VLC_VAR_STRING | VLC_VAR_ISCOMMAND |
248 VLC_VAR_HASCHOICE | VLC_VAR_DOINHERIT );
250 text.psz_string = _("Aspect ratio");
251 var_Change( p_vout, "aspect-ratio", VLC_VAR_SETTEXT, &text, NULL );
253 val.psz_string = (char*)"";
254 var_Change( p_vout, "aspect-ratio", VLC_VAR_DELCHOICE, &val, 0 );
256 for( size_t i = 0; i < ARRAY_SIZE(p_aspect_ratio_values); i++ )
258 val.psz_string = (char*)p_aspect_ratio_values[i].psz_value;
259 text.psz_string = _( p_aspect_ratio_values[i].psz_label );
260 var_Change( p_vout, "aspect-ratio", VLC_VAR_ADDCHOICE, &val, &text );
263 /* Add custom aspect ratios */
264 psz_buf = var_CreateGetNonEmptyString( p_vout, "custom-aspect-ratios" );
265 if( psz_buf )
267 AddCustomRatios( p_vout, "aspect-ratio", psz_buf );
268 free( psz_buf );
271 var_AddCallback( p_vout, "aspect-ratio", AspectCallback, NULL );
273 /* Add a variable to indicate if the window should be on top of others */
274 var_Create( p_vout, "video-on-top", VLC_VAR_BOOL | VLC_VAR_DOINHERIT
275 | VLC_VAR_ISCOMMAND );
276 text.psz_string = _("Always on top");
277 var_Change( p_vout, "video-on-top", VLC_VAR_SETTEXT, &text, NULL );
278 var_AddCallback( p_vout, "video-on-top", AboveCallback, NULL );
280 /* Add a variable to indicate if the window should be below all others */
281 var_Create( p_vout, "video-wallpaper", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
282 var_AddCallback( p_vout, "video-wallpaper", WallPaperCallback,
283 (void *)(uintptr_t)VOUT_WINDOW_STATE_BELOW );
285 /* Add a variable to indicate whether we want window decoration or not */
286 var_Create( p_vout, "video-deco", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
288 /* Add a fullscreen variable */
289 var_Create( p_vout, "fullscreen",
290 VLC_VAR_BOOL | VLC_VAR_DOINHERIT | VLC_VAR_ISCOMMAND );
291 text.psz_string = _("Fullscreen");
292 var_Change( p_vout, "fullscreen", VLC_VAR_SETTEXT, &text, NULL );
293 var_AddCallback( p_vout, "fullscreen", FullscreenCallback, NULL );
295 /* Add a snapshot variable */
296 var_Create( p_vout, "video-snapshot", VLC_VAR_VOID | VLC_VAR_ISCOMMAND );
297 text.psz_string = _("Snapshot");
298 var_Change( p_vout, "video-snapshot", VLC_VAR_SETTEXT, &text, NULL );
299 var_AddCallback( p_vout, "video-snapshot", SnapshotCallback, NULL );
301 /* Add a video-filter variable */
302 var_Create( p_vout, "video-filter",
303 VLC_VAR_STRING | VLC_VAR_DOINHERIT | VLC_VAR_ISCOMMAND );
304 var_AddCallback( p_vout, "video-filter", VideoFilterCallback, NULL );
306 /* Add a sub-source variable */
307 var_Create( p_vout, "sub-source",
308 VLC_VAR_STRING | VLC_VAR_DOINHERIT | VLC_VAR_ISCOMMAND );
309 var_AddCallback( p_vout, "sub-source", SubSourceCallback, NULL );
311 /* Add a sub-filter variable */
312 var_Create( p_vout, "sub-filter",
313 VLC_VAR_STRING | VLC_VAR_DOINHERIT | VLC_VAR_ISCOMMAND );
314 var_AddCallback( p_vout, "sub-filter", SubFilterCallback, NULL );
316 /* Add sub-margin variable */
317 var_Create( p_vout, "sub-margin",
318 VLC_VAR_INTEGER | VLC_VAR_DOINHERIT | VLC_VAR_ISCOMMAND );
319 var_AddCallback( p_vout, "sub-margin", SubMarginCallback, NULL );
321 /* Mouse coordinates */
322 var_Create( p_vout, "mouse-button-down", VLC_VAR_INTEGER );
323 var_Create( p_vout, "mouse-moved", VLC_VAR_COORDS );
324 var_Create( p_vout, "mouse-clicked", VLC_VAR_COORDS );
325 var_Create( p_vout, "mouse-object", VLC_VAR_BOOL );
327 vout_IntfReinit( p_vout );
330 void vout_IntfReinit( vout_thread_t *p_vout )
332 var_TriggerCallback( p_vout, "zoom" );
333 var_TriggerCallback( p_vout, "crop" );
334 var_TriggerCallback( p_vout, "aspect-ratio" );
336 var_TriggerCallback( p_vout, "video-on-top" );
337 var_TriggerCallback( p_vout, "video-wallpaper" );
339 var_TriggerCallback( p_vout, "video-filter" );
340 var_TriggerCallback( p_vout, "sub-source" );
341 var_TriggerCallback( p_vout, "sub-filter" );
342 var_TriggerCallback( p_vout, "sub-margin" );
345 /*****************************************************************************
346 * vout_Snapshot: generates a snapshot.
347 *****************************************************************************/
349 * This function will inject a subpicture into the vout with the provided
350 * picture
352 static int VoutSnapshotPip( vout_thread_t *p_vout, picture_t *p_pic )
354 subpicture_t *p_subpic = subpicture_NewFromPicture( VLC_OBJECT(p_vout),
355 p_pic, VLC_CODEC_YUVA );
356 if( !p_subpic )
357 return VLC_EGENERIC;
359 /* FIXME SPU_DEFAULT_CHANNEL is not good (used by the text) but
360 * hardcoded 0 doesn't seem right */
361 p_subpic->i_channel = 0;
362 p_subpic->i_start = mdate();
363 p_subpic->i_stop = p_subpic->i_start + 4000000;
364 p_subpic->b_ephemer = true;
365 p_subpic->b_fade = true;
367 /* Reduce the picture to 1/4^2 of the screen */
368 p_subpic->i_original_picture_width *= 4;
369 p_subpic->i_original_picture_height *= 4;
371 vout_PutSubpicture( p_vout, p_subpic );
372 return VLC_SUCCESS;
376 * This function will display the name and a PIP of the provided snapshot
378 static void VoutOsdSnapshot( vout_thread_t *p_vout, picture_t *p_pic, const char *psz_filename )
380 msg_Dbg( p_vout, "snapshot taken (%s)", psz_filename );
381 vout_OSDMessage( p_vout, SPU_DEFAULT_CHANNEL, "%s", psz_filename );
383 if( var_InheritBool( p_vout, "snapshot-preview" ) )
385 if( VoutSnapshotPip( p_vout, p_pic ) )
386 msg_Warn( p_vout, "Failed to display snapshot" );
391 * This function will handle a snapshot request
393 static void VoutSaveSnapshot( vout_thread_t *p_vout )
395 char *psz_path = var_InheritString( p_vout, "snapshot-path" );
396 char *psz_format = var_InheritString( p_vout, "snapshot-format" );
397 char *psz_prefix = var_InheritString( p_vout, "snapshot-prefix" );
399 /* */
400 picture_t *p_picture;
401 block_t *p_image;
402 video_format_t fmt;
404 /* 500ms timeout
405 * XXX it will cause trouble with low fps video (< 2fps) */
406 if( vout_GetSnapshot( p_vout, &p_image, &p_picture, &fmt, psz_format, 500*1000 ) )
408 p_picture = NULL;
409 p_image = NULL;
410 goto exit;
413 if( !psz_path )
415 psz_path = vout_snapshot_GetDirectory();
416 if( !psz_path )
418 msg_Err( p_vout, "no path specified for snapshots" );
419 goto exit;
423 vout_snapshot_save_cfg_t cfg;
424 memset( &cfg, 0, sizeof(cfg) );
425 cfg.is_sequential = var_InheritBool( p_vout, "snapshot-sequential" );
426 cfg.sequence = var_GetInteger( p_vout, "snapshot-num" );
427 cfg.path = psz_path;
428 cfg.format = psz_format;
429 cfg.prefix_fmt = psz_prefix;
431 char *psz_filename;
432 int i_sequence;
433 if (vout_snapshot_SaveImage( &psz_filename, &i_sequence,
434 p_image, p_vout, &cfg ) )
435 goto exit;
436 if( cfg.is_sequential )
437 var_SetInteger( p_vout, "snapshot-num", i_sequence + 1 );
439 VoutOsdSnapshot( p_vout, p_picture, psz_filename );
441 /* signal creation of a new snapshot file */
442 var_SetString( p_vout->p_libvlc, "snapshot-file", psz_filename );
444 free( psz_filename );
446 exit:
447 if( p_image )
448 block_Release( p_image );
449 if( p_picture )
450 picture_Release( p_picture );
451 free( psz_prefix );
452 free( psz_format );
453 free( psz_path );
456 /*****************************************************************************
457 * Handle filters
458 *****************************************************************************/
460 void vout_EnableFilter( vout_thread_t *p_vout, const char *psz_name,
461 bool b_add, bool b_setconfig )
463 char *psz_parser;
464 char *psz_string;
465 const char *psz_filter_type;
467 module_t *p_obj = module_find( psz_name );
468 if( !p_obj )
470 msg_Err( p_vout, "Unable to find filter module \"%s\".", psz_name );
471 return;
474 if( module_provides( p_obj, "video filter2" ) )
476 psz_filter_type = "video-filter";
478 else if( module_provides( p_obj, "sub source" ) )
480 psz_filter_type = "sub-source";
482 else if( module_provides( p_obj, "sub filter" ) )
484 psz_filter_type = "sub-filter";
486 else
488 msg_Err( p_vout, "Unknown video filter type." );
489 return;
492 psz_string = var_GetString( p_vout, psz_filter_type );
494 /* Todo : Use some generic chain manipulation functions */
495 if( !psz_string ) psz_string = strdup("");
497 psz_parser = strstr( psz_string, psz_name );
498 if( b_add )
500 if( !psz_parser )
502 psz_parser = psz_string;
503 if( asprintf( &psz_string, (*psz_string) ? "%s:%s" : "%s%s",
504 psz_string, psz_name ) == -1 )
506 free( psz_parser );
507 return;
509 free( psz_parser );
511 else
513 free( psz_string );
514 return;
517 else
519 if( psz_parser )
521 memmove( psz_parser, psz_parser + strlen(psz_name) +
522 (*(psz_parser + strlen(psz_name)) == ':' ? 1 : 0 ),
523 strlen(psz_parser + strlen(psz_name)) + 1 );
525 /* Remove trailing : : */
526 if( *(psz_string+strlen(psz_string ) -1 ) == ':' )
528 *(psz_string+strlen(psz_string ) -1 ) = '\0';
531 else
533 free( psz_string );
534 return;
538 if( b_setconfig )
540 config_PutPsz( p_vout, psz_filter_type, psz_string );
543 var_SetString( p_vout, psz_filter_type, psz_string );
545 free( psz_string );
548 /*****************************************************************************
549 * Object variables callbacks
550 *****************************************************************************/
551 static int CropCallback( vlc_object_t *object, char const *cmd,
552 vlc_value_t oldval, vlc_value_t newval, void *data )
554 vout_thread_t *vout = (vout_thread_t *)object;
555 VLC_UNUSED(cmd); VLC_UNUSED(oldval); VLC_UNUSED(data);
556 unsigned num, den;
557 unsigned y, x;
558 unsigned width, height;
559 unsigned left, top, right, bottom;
561 if (sscanf(newval.psz_string, "%u:%u", &num, &den) == 2) {
562 vout_ControlChangeCropRatio(vout, num, den);
563 } else if (sscanf(newval.psz_string, "%ux%u+%u+%u",
564 &width, &height, &x, &y) == 4) {
565 vout_ControlChangeCropWindow(vout, x, y, width, height);
566 } else if (sscanf(newval.psz_string, "%u+%u+%u+%u",
567 &left, &top, &right, &bottom) == 4) {
568 vout_ControlChangeCropBorder(vout, left, top, right, bottom);
569 } else if (*newval.psz_string == '\0') {
570 vout_ControlChangeCropRatio(vout, 0, 0);
571 } else {
572 msg_Err(object, "Unknown crop format (%s)", newval.psz_string);
574 return VLC_SUCCESS;
577 static int CropBorderCallback(vlc_object_t *object, char const *cmd,
578 vlc_value_t oldval, vlc_value_t newval, void *data)
580 vout_thread_t *vout = (vout_thread_t *)object;
581 VLC_UNUSED(cmd); VLC_UNUSED(oldval); VLC_UNUSED(data); VLC_UNUSED(newval);
583 vout_ControlChangeCropBorder(vout,
584 var_GetInteger(object, "crop-left"),
585 var_GetInteger(object, "crop-top"),
586 var_GetInteger(object, "crop-right"),
587 var_GetInteger(object, "crop-bottom"));
588 return VLC_SUCCESS;
591 static int AspectCallback( vlc_object_t *object, char const *cmd,
592 vlc_value_t oldval, vlc_value_t newval, void *data )
594 vout_thread_t *vout = (vout_thread_t *)object;
595 VLC_UNUSED(cmd); VLC_UNUSED(oldval); VLC_UNUSED(data);
596 unsigned num, den;
598 if (sscanf(newval.psz_string, "%u:%u", &num, &den) == 2 &&
599 (num > 0) == (den > 0))
600 vout_ControlChangeSampleAspectRatio(vout, num, den);
601 else if (*newval.psz_string == '\0')
602 vout_ControlChangeSampleAspectRatio(vout, 0, 0);
603 return VLC_SUCCESS;
606 static int AutoScaleCallback( vlc_object_t *obj, char const *name,
607 vlc_value_t prev, vlc_value_t cur, void *data )
609 vout_thread_t *p_vout = (vout_thread_t *)obj;
611 (void) name; (void) prev; (void) data;
612 vout_ControlChangeDisplayFilled( p_vout, cur.b_bool );
613 return VLC_SUCCESS;
616 static int ScaleCallback( vlc_object_t *obj, char const *name,
617 vlc_value_t prev, vlc_value_t cur, void *data )
619 vout_thread_t *p_vout = (vout_thread_t *)obj;
621 (void) name; (void) prev; (void) data;
622 vout_ControlChangeZoom( p_vout, 1000 * cur.f_float, 1000 );
623 return VLC_SUCCESS;
626 static int ZoomCallback( vlc_object_t *obj, char const *name,
627 vlc_value_t prev, vlc_value_t cur, void *data )
629 (void) name; (void) prev; (void) data;
630 return var_SetFloat( obj, "scale", cur.f_float );
633 static int AboveCallback( vlc_object_t *obj, char const *name,
634 vlc_value_t prev, vlc_value_t cur, void *data )
636 vout_ControlChangeWindowState( (vout_thread_t *)obj,
637 cur.b_bool ? VOUT_WINDOW_STATE_ABOVE : VOUT_WINDOW_STATE_NORMAL );
638 (void) name; (void) prev; (void) data;
639 return VLC_SUCCESS;
642 static int WallPaperCallback( vlc_object_t *obj, char const *name,
643 vlc_value_t prev, vlc_value_t cur, void *data )
645 vout_thread_t *vout = (vout_thread_t *)obj;
647 if( cur.b_bool )
649 vout_ControlChangeWindowState( vout, VOUT_WINDOW_STATE_BELOW );
650 vout_ControlChangeFullscreen( vout, true );
652 else
654 var_TriggerCallback( obj, "fullscreen" );
655 var_TriggerCallback( obj, "video-on-top" );
657 (void) name; (void) prev; (void) data;
658 return VLC_SUCCESS;
661 static int FullscreenCallback( vlc_object_t *p_this, char const *psz_cmd,
662 vlc_value_t oldval, vlc_value_t newval, void *p_data )
664 vout_thread_t *p_vout = (vout_thread_t *)p_this;
665 (void)psz_cmd; (void)p_data;
667 if( oldval.b_bool != newval.b_bool )
668 vout_ControlChangeFullscreen( p_vout, newval.b_bool );
669 return VLC_SUCCESS;
672 static int SnapshotCallback( vlc_object_t *p_this, char const *psz_cmd,
673 vlc_value_t oldval, vlc_value_t newval, void *p_data )
675 vout_thread_t *p_vout = (vout_thread_t *)p_this;
676 VLC_UNUSED(psz_cmd); VLC_UNUSED(oldval);
677 VLC_UNUSED(newval); VLC_UNUSED(p_data);
679 VoutSaveSnapshot( p_vout );
680 return VLC_SUCCESS;
683 static int VideoFilterCallback( vlc_object_t *p_this, char const *psz_cmd,
684 vlc_value_t oldval, vlc_value_t newval, void *p_data)
686 vout_thread_t *p_vout = (vout_thread_t *)p_this;
687 VLC_UNUSED(psz_cmd); VLC_UNUSED(oldval); VLC_UNUSED(p_data);
689 vout_ControlChangeFilters( p_vout, newval.psz_string );
690 return VLC_SUCCESS;
693 static int SubSourceCallback( vlc_object_t *p_this, char const *psz_cmd,
694 vlc_value_t oldval, vlc_value_t newval, void *p_data)
696 vout_thread_t *p_vout = (vout_thread_t *)p_this;
697 VLC_UNUSED(psz_cmd); VLC_UNUSED(oldval); VLC_UNUSED(p_data);
699 vout_ControlChangeSubSources( p_vout, newval.psz_string );
700 return VLC_SUCCESS;
703 static int SubFilterCallback( vlc_object_t *p_this, char const *psz_cmd,
704 vlc_value_t oldval, vlc_value_t newval, void *p_data)
706 vout_thread_t *p_vout = (vout_thread_t *)p_this;
707 VLC_UNUSED(psz_cmd); VLC_UNUSED(oldval); VLC_UNUSED(p_data);
709 vout_ControlChangeSubFilters( p_vout, newval.psz_string );
710 return VLC_SUCCESS;
713 static int SubMarginCallback( vlc_object_t *p_this, char const *psz_cmd,
714 vlc_value_t oldval, vlc_value_t newval, void *p_data)
716 vout_thread_t *p_vout = (vout_thread_t *)p_this;
717 VLC_UNUSED(psz_cmd); VLC_UNUSED(oldval); VLC_UNUSED(p_data);
719 vout_ControlChangeSubMargin( p_vout, newval.i_int );
720 return VLC_SUCCESS;