]> git.sesse.net Git - vlc/blob - modules/video_filter/wall.c
f832cd92e10ccb211c28b764717a6c8ba1dd72c9
[vlc] / modules / video_filter / wall.c
1 /*****************************************************************************
2  * wall.c : Wall video plugin for vlc
3  *****************************************************************************
4  * Copyright (C) 2000, 2001, 2002, 2003 VideoLAN (Centrale Réseaux) and its contributors
5  * $Id$
6  *
7  * Authors: Samuel Hocevar <sam@zoy.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>                                      /* malloc(), free() */
28 #include <string.h>
29
30 #include <vlc/vlc.h>
31 #include <vlc/vout.h>
32
33 #include "filter_common.h"
34
35 /*****************************************************************************
36  * Local prototypes
37  *****************************************************************************/
38 static int  Create    ( vlc_object_t * );
39 static void Destroy   ( vlc_object_t * );
40
41 static int  Init      ( vout_thread_t * );
42 static void End       ( vout_thread_t * );
43 static void Render    ( vout_thread_t *, picture_t * );
44
45 static void RemoveAllVout  ( vout_thread_t *p_vout );
46
47 static int  SendEvents( vlc_object_t *, char const *,
48                         vlc_value_t, vlc_value_t, void * );
49
50 /*****************************************************************************
51  * Module descriptor
52  *****************************************************************************/
53 #define COLS_TEXT N_("Number of columns")
54 #define COLS_LONGTEXT N_("Select the number of horizontal video windows in " \
55     "which to split the video.")
56
57 #define ROWS_TEXT N_("Number of rows")
58 #define ROWS_LONGTEXT N_("Select the number of vertical video windows in " \
59     "which to split the video.")
60
61 #define ACTIVE_TEXT N_("Active windows")
62 #define ACTIVE_LONGTEXT N_("Comma separated list of active windows, " \
63     "defaults to all")
64
65 #define ASPECT_TEXT N_("Element aspect ratio")
66 #define ASPECT_LONGTEXT N_("The aspect ratio of the individual displays building the display wall")
67
68 vlc_module_begin();
69     set_description( _("Wall video filter") );
70     set_shortname( N_("Image wall" ));
71     set_capability( "video filter", 0 );
72     set_category( CAT_VIDEO );
73     set_subcategory( SUBCAT_VIDEO_VFILTER );
74
75     add_integer( "wall-cols", 3, NULL, COLS_TEXT, COLS_LONGTEXT, VLC_FALSE );
76     add_integer( "wall-rows", 3, NULL, ROWS_TEXT, ROWS_LONGTEXT, VLC_FALSE );
77     add_string( "wall-active", NULL, NULL, ACTIVE_TEXT, ACTIVE_LONGTEXT, VLC_FALSE );
78     add_string( "wall-element-aspect", "4:3", NULL, ASPECT_TEXT, ASPECT_LONGTEXT, VLC_FALSE );
79
80     add_shortcut( "wall" );
81     set_callbacks( Create, Destroy );
82 vlc_module_end();
83
84 /*****************************************************************************
85  * vout_sys_t: Wall video output method descriptor
86  *****************************************************************************
87  * This structure is part of the video output thread descriptor.
88  * It describes the Wall specific properties of an output thread.
89  *****************************************************************************/
90 struct vout_sys_t
91 {
92     int    i_col;
93     int    i_row;
94     int    i_vout;
95     struct vout_list_t
96     {
97         vlc_bool_t b_active;
98         int i_width;
99         int i_height;
100         int i_left;
101         int i_top;
102         vout_thread_t *p_vout;
103     } *pp_vout;
104 };
105
106 /*****************************************************************************
107  * Control: control facility for the vout (forwards to child vout)
108  *****************************************************************************/
109 static int Control( vout_thread_t *p_vout, int i_query, va_list args )
110 {
111     int i_row, i_col, i_vout = 0;
112
113     for( i_row = 0; i_row < p_vout->p_sys->i_row; i_row++ )
114     {
115         for( i_col = 0; i_col < p_vout->p_sys->i_col; i_col++ )
116         {
117             vout_vaControl( p_vout->p_sys->pp_vout[ i_vout ].p_vout,
118                             i_query, args );
119             i_vout++;
120         }
121     }
122     return VLC_SUCCESS;
123 }
124
125 /*****************************************************************************
126  * Create: allocates Wall video thread output method
127  *****************************************************************************
128  * This function allocates and initializes a Wall vout method.
129  *****************************************************************************/
130 static int Create( vlc_object_t *p_this )
131 {
132     vout_thread_t *p_vout = (vout_thread_t *)p_this;
133     char *psz_method, *psz_tmp, *psz_method_tmp;
134     int i_vout;
135
136     /* Allocate structure */
137     p_vout->p_sys = malloc( sizeof( vout_sys_t ) );
138     if( p_vout->p_sys == NULL )
139     {
140         msg_Err( p_vout, "out of memory" );
141         return VLC_ENOMEM;
142     }
143
144     p_vout->pf_init = Init;
145     p_vout->pf_end = End;
146     p_vout->pf_manage = NULL;
147     p_vout->pf_render = Render;
148     p_vout->pf_display = NULL;
149     p_vout->pf_control = Control;
150
151     /* Look what method was requested */
152     p_vout->p_sys->i_col = config_GetInt( p_vout, "wall-cols" );
153     p_vout->p_sys->i_row = config_GetInt( p_vout, "wall-rows" );
154
155     p_vout->p_sys->i_col = __MAX( 1, __MIN( 15, p_vout->p_sys->i_col ) );
156     p_vout->p_sys->i_row = __MAX( 1, __MIN( 15, p_vout->p_sys->i_row ) );
157
158     msg_Dbg( p_vout, "opening a %i x %i wall",
159              p_vout->p_sys->i_col, p_vout->p_sys->i_row );
160
161     p_vout->p_sys->pp_vout = malloc( p_vout->p_sys->i_row *
162                                      p_vout->p_sys->i_col *
163                                      sizeof(struct vout_list_t) );
164     if( p_vout->p_sys->pp_vout == NULL )
165     {
166         msg_Err( p_vout, "out of memory" );
167         free( p_vout->p_sys );
168         return VLC_ENOMEM;
169     }
170
171     psz_method_tmp = psz_method = config_GetPsz( p_vout, "wall-active" );
172
173     /* If no trailing vout are specified, take them all */
174     if( psz_method == NULL )
175     {
176         for( i_vout = p_vout->p_sys->i_row * p_vout->p_sys->i_col;
177              i_vout--; )
178         {
179             p_vout->p_sys->pp_vout[i_vout].b_active = 1;
180         }
181     }
182     /* If trailing vout are specified, activate only the requested ones */
183     else
184     {
185         for( i_vout = p_vout->p_sys->i_row * p_vout->p_sys->i_col;
186              i_vout--; )
187         {
188             p_vout->p_sys->pp_vout[i_vout].b_active = 0;
189         }
190
191         while( *psz_method )
192         {
193             psz_tmp = psz_method;
194             while( *psz_tmp && *psz_tmp != ',' )
195             {
196                 psz_tmp++;
197             }
198
199             if( *psz_tmp )
200             {
201                 *psz_tmp = '\0';
202                 i_vout = atoi( psz_method );
203                 psz_method = psz_tmp + 1;
204             }
205             else
206             {
207                 i_vout = atoi( psz_method );
208                 psz_method = psz_tmp;
209             }
210
211             if( i_vout >= 0 &&
212                 i_vout < p_vout->p_sys->i_row * p_vout->p_sys->i_col )
213             {
214                 p_vout->p_sys->pp_vout[i_vout].b_active = 1;
215             }
216         }
217     }
218
219     free( psz_method_tmp );
220
221     return VLC_SUCCESS;
222 }
223
224 /*****************************************************************************
225  * Init: initialize Wall video thread output method
226  *****************************************************************************/
227 static int Init( vout_thread_t *p_vout )
228 {
229     int i_index, i_row, i_col, i_width, i_height, i_left, i_top;
230     unsigned int i_target_width,i_target_height;
231     picture_t *p_pic;
232     video_format_t fmt = {0};
233     int i_aspect = 4*VOUT_ASPECT_FACTOR/3;
234     int i_align = 0;
235     unsigned int i_hstart, i_hend, i_vstart, i_vend;
236     unsigned int w1,h1,w2,h2;
237     int i_xpos, i_ypos;
238     int i_vstart_rounded = 0, i_hstart_rounded = 0;
239     char *psz_aspect;
240
241     psz_aspect = config_GetPsz( p_vout, "wall-element-aspect" );
242     if( psz_aspect && *psz_aspect )
243     {
244         char *psz_parser = strchr( psz_aspect, ':' );
245         if( psz_parser )
246         {
247             *psz_parser++ = '\0';
248             i_aspect = atoi( psz_aspect ) * VOUT_ASPECT_FACTOR
249                 / atoi( psz_parser );
250         }
251         else
252         {
253             msg_Warn( p_vout, "invalid aspect ratio specification" );
254         }
255         free( psz_aspect );
256     }
257     
258
259     i_xpos = var_CreateGetInteger( p_vout, "video-x" );
260     i_ypos = var_CreateGetInteger( p_vout, "video-y" );
261     if( i_xpos < 0 ) i_xpos = 0;
262     if( i_ypos < 0 ) i_ypos = 0;
263
264     I_OUTPUTPICTURES = 0;
265
266     /* Initialize the output structure */
267     p_vout->output.i_chroma = p_vout->render.i_chroma;
268     p_vout->output.i_width  = p_vout->render.i_width;
269     p_vout->output.i_height = p_vout->render.i_height;
270     p_vout->output.i_aspect = p_vout->render.i_aspect;
271     var_Create( p_vout, "align", VLC_VAR_INTEGER );
272
273     fmt.i_width = fmt.i_visible_width = p_vout->render.i_width;
274     fmt.i_height = fmt.i_visible_height = p_vout->render.i_height;
275     fmt.i_x_offset = fmt.i_y_offset = 0;
276     fmt.i_chroma = p_vout->render.i_chroma;
277     fmt.i_aspect = p_vout->render.i_aspect;
278     fmt.i_sar_num = p_vout->render.i_aspect * fmt.i_height / fmt.i_width;
279     fmt.i_sar_den = VOUT_ASPECT_FACTOR;
280
281     w1 = p_vout->output.i_width / p_vout->p_sys->i_col;
282     w1 &= ~1;
283     h1 = w1 * VOUT_ASPECT_FACTOR / i_aspect&~1;
284     h1 &= ~1;
285     
286     h2 = p_vout->output.i_height / p_vout->p_sys->i_row&~1;
287     h2 &= ~1;
288     w2 = h2 * i_aspect / VOUT_ASPECT_FACTOR&~1;
289     w2 &= ~1;
290     
291     if ( h1 * p_vout->p_sys->i_row < p_vout->output.i_height )
292     {
293         unsigned int i_tmp;
294         i_target_width = w2;        
295         i_target_height = h2;
296         i_vstart = 0;
297         i_vend = p_vout->output.i_height;
298         i_tmp = i_target_width * p_vout->p_sys->i_col;
299         while( i_tmp < p_vout->output.i_width ) i_tmp += p_vout->p_sys->i_col;
300         i_hstart = (( i_tmp - p_vout->output.i_width ) / 2)&~1;
301         i_hstart_rounded  = ( ( i_tmp - p_vout->output.i_width ) % 2 ) ||
302             ( ( ( i_tmp - p_vout->output.i_width ) / 2 ) & 1 );
303         i_hend = i_hstart + p_vout->output.i_width;
304     }
305     else
306     {
307         unsigned int i_tmp;
308         i_target_height = h1;
309         i_target_width = w1;
310         i_hstart = 0;
311         i_hend = p_vout->output.i_width;
312         i_tmp = i_target_height * p_vout->p_sys->i_row;
313         while( i_tmp < p_vout->output.i_height ) i_tmp += p_vout->p_sys->i_row;
314         i_vstart = ( ( i_tmp - p_vout->output.i_height ) / 2 ) & ~1;
315         i_vstart_rounded  = ( ( i_tmp - p_vout->output.i_height ) % 2 ) ||
316             ( ( ( i_tmp - p_vout->output.i_height ) / 2 ) & 1 );
317         i_vend = i_vstart + p_vout->output.i_height;
318     }
319     msg_Dbg( p_vout, "target resolution %dx%d", i_target_width, i_target_height );
320
321     /* Try to open the real video output */
322     msg_Dbg( p_vout, "spawning the real video outputs" );
323
324     p_vout->p_sys->i_vout = 0;
325     msg_Dbg( p_vout, "target window (%d,%d)-(%d,%d)", i_hstart,i_vstart,i_hend,i_vend );
326     
327
328     i_top = 0;
329     i_height = 0;
330     for( i_row = 0; i_row < p_vout->p_sys->i_row; i_row++ )
331     {
332         i_left = 0;
333         i_top += i_height;
334         for( i_col = 0; i_col < p_vout->p_sys->i_col; i_col++ )
335         {
336             i_align = 0;
337
338             if( i_col*i_target_width >= i_hstart &&
339                 (i_col+1)*i_target_width <= i_hend )
340             {
341                 i_width = i_target_width;
342             }
343             else if( ( i_col + 1 ) * i_target_width < i_hstart ||
344                      ( i_col * i_target_width ) > i_hend )
345             {
346                 i_width = 0;                
347             }
348             else
349             {
350                 i_width = ( i_target_width - i_hstart % i_target_width );
351                 if( i_col >= ( p_vout->p_sys->i_col / 2 ) )
352                 {
353                     i_align |= VOUT_ALIGN_LEFT;
354                     i_width -= i_hstart_rounded ? 2: 0;
355                 }
356                 else
357                 {
358                     i_align |= VOUT_ALIGN_RIGHT;
359                 }
360             }
361             
362             if( i_row * i_target_height >= i_vstart &&
363                 ( i_row + 1 ) * i_target_height <= i_vend )
364             {
365                 i_height = i_target_height;
366             }
367             else if( ( i_row + 1 ) * i_target_height < i_vstart ||
368                      ( i_row * i_target_height ) > i_vend )
369             {
370                 i_height = 0;
371             }
372             else
373             {
374                 i_height = ( i_target_height -
375                              i_vstart%i_target_height );
376                 if(  i_row >= ( p_vout->p_sys->i_row / 2 ) )
377                 {
378                     i_align |= VOUT_ALIGN_TOP;
379                     i_height -= i_vstart_rounded ? 2: 0;
380                 }
381                 else
382                 {
383                     i_align |= VOUT_ALIGN_BOTTOM;
384                 }
385             }
386             if( i_height == 0 || i_width == 0 )
387             {
388                 p_vout->p_sys->pp_vout[ p_vout->p_sys->i_vout ].b_active = VLC_FALSE;
389             }
390
391             p_vout->p_sys->pp_vout[ p_vout->p_sys->i_vout ].i_width = i_width;
392             p_vout->p_sys->pp_vout[ p_vout->p_sys->i_vout ].i_height = i_height;
393             p_vout->p_sys->pp_vout[ p_vout->p_sys->i_vout ].i_left = i_left;
394             p_vout->p_sys->pp_vout[ p_vout->p_sys->i_vout ].i_top = i_top;
395             i_left += i_width;
396
397             if( !p_vout->p_sys->pp_vout[ p_vout->p_sys->i_vout ].b_active )
398             {
399                 p_vout->p_sys->i_vout++;
400                 continue;
401             }
402             var_SetInteger( p_vout, "align", i_align );
403             var_SetInteger( p_vout, "video-x", i_left + i_xpos - i_width);
404             var_SetInteger( p_vout, "video-y", i_top + i_ypos );
405
406             fmt.i_width = fmt.i_visible_width = i_width;
407             fmt.i_height = fmt.i_visible_height = i_height;
408             fmt.i_aspect = i_aspect * i_target_height / i_height *
409                 i_width / i_target_width;
410
411             p_vout->p_sys->pp_vout[ p_vout->p_sys->i_vout ].p_vout =
412                 vout_Create( p_vout, &fmt );
413             if( !p_vout->p_sys->pp_vout[ p_vout->p_sys->i_vout ].p_vout )
414             {
415                 msg_Err( p_vout, "failed to get %ix%i vout threads",
416                                  p_vout->p_sys->i_col, p_vout->p_sys->i_row );
417                 RemoveAllVout( p_vout );
418                 return VLC_EGENERIC;
419             }
420             ADD_CALLBACKS(
421                 p_vout->p_sys->pp_vout[ p_vout->p_sys->i_vout ].p_vout,
422                 SendEvents );
423             p_vout->p_sys->i_vout++;
424         }
425     }
426
427     ALLOCATE_DIRECTBUFFERS( VOUT_MAX_PICTURES );
428
429     ADD_PARENT_CALLBACKS( SendEventsToChild );
430
431     return VLC_SUCCESS;
432 }
433
434 /*****************************************************************************
435  * End: terminate Wall video thread output method
436  *****************************************************************************/
437 static void End( vout_thread_t *p_vout )
438 {
439     int i_index;
440
441     /* Free the fake output buffers we allocated */
442     for( i_index = I_OUTPUTPICTURES ; i_index ; )
443     {
444         i_index--;
445         free( PP_OUTPUTPICTURE[ i_index ]->p_data_orig );
446     }
447 }
448
449 /*****************************************************************************
450  * Destroy: destroy Wall video thread output method
451  *****************************************************************************
452  * Terminate an output method created by WallCreateOutputMethod
453  *****************************************************************************/
454 static void Destroy( vlc_object_t *p_this )
455 {
456     vout_thread_t *p_vout = (vout_thread_t *)p_this;
457
458     RemoveAllVout( p_vout );
459
460     DEL_PARENT_CALLBACKS( SendEventsToChild );
461
462     free( p_vout->p_sys->pp_vout );
463     free( p_vout->p_sys );
464 }
465
466 /*****************************************************************************
467  * Render: displays previously rendered output
468  *****************************************************************************
469  * This function send the currently rendered image to Wall image, waits
470  * until it is displayed and switch the two rendering buffers, preparing next
471  * frame.
472  *****************************************************************************/
473 static void Render( vout_thread_t *p_vout, picture_t *p_pic )
474 {
475     picture_t *p_outpic = NULL;
476     int i_col, i_row, i_vout, i_plane;
477     int pi_left_skip[VOUT_MAX_PLANES], pi_top_skip[VOUT_MAX_PLANES];
478
479     i_vout = 0;
480
481     for( i_row = 0; i_row < p_vout->p_sys->i_row; i_row++ )
482     {
483         for( i_col = 0; i_col < p_vout->p_sys->i_col; i_col++ )
484         {
485             for( i_plane = 0 ; i_plane < p_pic->i_planes ; i_plane++ )
486             {
487                 pi_left_skip[i_plane] = p_vout->p_sys->pp_vout[ i_vout ].i_left * p_pic->p[ i_plane ].i_pitch / p_vout->output.i_width;
488                 pi_top_skip[i_plane] = (p_vout->p_sys->pp_vout[ i_vout ].i_top * p_pic->p[ i_plane ].i_lines / p_vout->output.i_height)*p_pic->p[i_plane].i_pitch;
489             }
490
491             if( !p_vout->p_sys->pp_vout[ i_vout ].b_active )
492             {
493                 i_vout++;
494                 continue;
495             }
496
497             while( ( p_outpic =
498                 vout_CreatePicture( p_vout->p_sys->pp_vout[ i_vout ].p_vout,
499                                     0, 0, 0 )
500                    ) == NULL )
501             {
502                 if( p_vout->b_die || p_vout->b_error )
503                 {
504                     vout_DestroyPicture(
505                         p_vout->p_sys->pp_vout[ i_vout ].p_vout, p_outpic );
506                     return;
507                 }
508
509                 msleep( VOUT_OUTMEM_SLEEP );
510             }
511
512             vout_DatePicture( p_vout->p_sys->pp_vout[ i_vout ].p_vout,
513                               p_outpic, p_pic->date );
514             vout_LinkPicture( p_vout->p_sys->pp_vout[ i_vout ].p_vout,
515                               p_outpic );
516
517             for( i_plane = 0 ; i_plane < p_pic->i_planes ; i_plane++ )
518             {
519                 uint8_t *p_in, *p_in_end, *p_out;
520                 int i_in_pitch = p_pic->p[i_plane].i_pitch;
521                 int i_out_pitch = p_outpic->p[i_plane].i_pitch;
522                 int i_copy_pitch = p_outpic->p[i_plane].i_visible_pitch;
523
524                 p_in = p_pic->p[i_plane].p_pixels
525                         + pi_top_skip[i_plane] + pi_left_skip[i_plane];
526
527                 p_in_end = p_in + p_outpic->p[i_plane].i_visible_lines
528                                    * p_pic->p[i_plane].i_pitch;
529
530                 p_out = p_outpic->p[i_plane].p_pixels;
531
532                 while( p_in < p_in_end )
533                 {
534                     p_vout->p_vlc->pf_memcpy( p_out, p_in, i_copy_pitch );
535                     p_in += i_in_pitch;
536                     p_out += i_out_pitch;
537                 }
538
539 //                pi_left_skip[i_plane] += i_copy_pitch;
540             }
541
542             vout_UnlinkPicture( p_vout->p_sys->pp_vout[ i_vout ].p_vout,
543                                 p_outpic );
544             vout_DisplayPicture( p_vout->p_sys->pp_vout[ i_vout ].p_vout,
545                                  p_outpic );
546
547             i_vout++;
548         }
549
550 /*         for( i_plane = 0 ; i_plane < p_pic->i_planes ; i_plane++ ) */
551 /*         { */
552 /*             pi_top_skip[i_plane] += p_vout->p_sys->pp_vout[ i_vout ].i_height */
553 /*                                      * p_pic->p[i_plane].i_visible_lines */
554 /*                                      / p_vout->output.i_height */
555 /*                                      * p_pic->p[i_plane].i_pitch; */
556 /*         } */
557     }
558 }
559
560 /*****************************************************************************
561  * RemoveAllVout: destroy all the child video output threads
562  *****************************************************************************/
563 static void RemoveAllVout( vout_thread_t *p_vout )
564 {
565     while( p_vout->p_sys->i_vout )
566     {
567          --p_vout->p_sys->i_vout;
568          if( p_vout->p_sys->pp_vout[ p_vout->p_sys->i_vout ].b_active )
569          {
570              DEL_CALLBACKS(
571                  p_vout->p_sys->pp_vout[ p_vout->p_sys->i_vout ].p_vout,
572                  SendEvents );
573              vlc_object_detach(
574                  p_vout->p_sys->pp_vout[ p_vout->p_sys->i_vout ].p_vout );
575              vout_Destroy(
576                  p_vout->p_sys->pp_vout[ p_vout->p_sys->i_vout ].p_vout );
577          }
578     }
579 }
580
581 /*****************************************************************************
582  * SendEvents: forward mouse and keyboard events to the parent p_vout
583  *****************************************************************************/
584 static int SendEvents( vlc_object_t *p_this, char const *psz_var,
585                        vlc_value_t oldval, vlc_value_t newval, void *_p_vout )
586 {
587     vout_thread_t *p_vout = (vout_thread_t *)_p_vout;
588     int i_vout;
589     vlc_value_t sentval = newval;
590
591     /* Find the video output index */
592     for( i_vout = 0; i_vout < p_vout->p_sys->i_vout; i_vout++ )
593     {
594         if( p_this == (vlc_object_t *)p_vout->p_sys->pp_vout[ i_vout ].p_vout )
595         {
596             break;
597         }
598     }
599
600     if( i_vout == p_vout->p_sys->i_vout )
601     {
602         return VLC_EGENERIC;
603     }
604
605     /* Translate the mouse coordinates */
606     if( !strcmp( psz_var, "mouse-x" ) )
607     {
608         sentval.i_int += p_vout->output.i_width
609                           * (i_vout % p_vout->p_sys->i_col)
610                           / p_vout->p_sys->i_col;
611     }
612     else if( !strcmp( psz_var, "mouse-y" ) )
613     {
614         sentval.i_int += p_vout->output.i_height
615                           * (i_vout / p_vout->p_sys->i_row)
616                           / p_vout->p_sys->i_row;
617     }
618
619     var_Set( p_vout, psz_var, sentval );
620
621     return VLC_SUCCESS;
622 }
623
624 /*****************************************************************************
625  * SendEventsToChild: forward events to the child/children vout
626  *****************************************************************************/
627 static int SendEventsToChild( vlc_object_t *p_this, char const *psz_var,
628                        vlc_value_t oldval, vlc_value_t newval, void *p_data )
629 {
630     vout_thread_t *p_vout = (vout_thread_t *)p_this;
631     int i_row, i_col, i_vout = 0;
632
633     for( i_row = 0; i_row < p_vout->p_sys->i_row; i_row++ )
634     {
635         for( i_col = 0; i_col < p_vout->p_sys->i_col; i_col++ )
636         {
637             var_Set( p_vout->p_sys->pp_vout[ i_vout ].p_vout, psz_var, newval);
638             if( !strcmp( psz_var, "fullscreen" ) ) break;
639             i_vout++;
640         }
641     }
642
643     return VLC_SUCCESS;
644 }