1 /*****************************************************************************
2 * video_output.c : video output thread
3 * This module describes the programming interface for video output threads.
4 * It includes functions allowing to open a new thread, send pictures to a
5 * thread, and destroy a previously oppened video output thread.
6 *****************************************************************************
7 * Copyright (C) 2000-2001 VideoLAN
8 * $Id: video_output.c,v 1.171 2002/04/05 01:05:22 gbazin Exp $
10 * Authors: Vincent Seguin <seguin@via.ecp.fr>
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
25 *****************************************************************************/
27 /*****************************************************************************
29 *****************************************************************************/
30 #include <errno.h> /* ENOMEM */
31 #include <stdlib.h> /* free() */
32 #include <stdio.h> /* sprintf() */
33 #include <string.h> /* strerror() */
35 #include <videolan/vlc.h>
37 #ifdef HAVE_SYS_TIMES_H
38 # include <sys/times.h>
42 #include "video_output.h"
44 /*****************************************************************************
46 *****************************************************************************/
47 static int InitThread ( vout_thread_t *p_vout );
48 static void RunThread ( vout_thread_t *p_vout );
49 static void ErrorThread ( vout_thread_t *p_vout );
50 static void EndThread ( vout_thread_t *p_vout );
51 static void DestroyThread ( vout_thread_t *p_vout, int i_status );
53 static int ReduceHeight ( int );
54 static int BinaryLog ( u32 );
55 static void MaskToShift ( int *, int *, u32 );
56 static void InitWindowSize ( vout_thread_t *, int *, int * );
58 /*****************************************************************************
59 * vout_InitBank: initialize the video output bank.
60 *****************************************************************************/
61 void vout_InitBank ( void )
63 p_vout_bank->i_count = 0;
65 vlc_mutex_init( &p_vout_bank->lock );
68 /*****************************************************************************
69 * vout_EndBank: empty the video output bank.
70 *****************************************************************************
71 * This function ends all unused video outputs and empties the bank in
73 *****************************************************************************/
74 void vout_EndBank ( void )
76 /* Ask all remaining video outputs to die */
77 while( p_vout_bank->i_count )
80 p_vout_bank->pp_vout[ --p_vout_bank->i_count ], NULL );
83 vlc_mutex_destroy( &p_vout_bank->lock );
86 /*****************************************************************************
87 * vout_CreateThread: creates a new video output thread
88 *****************************************************************************
89 * This function creates a new video output thread, and returns a pointer
90 * to its description. On error, it returns NULL.
91 * If pi_status is NULL, then the function will block until the thread is ready.
92 * If not, it will be updated using one of the THREAD_* constants.
93 *****************************************************************************/
94 vout_thread_t * vout_CreateThread ( int *pi_status,
95 int i_width, int i_height,
96 u32 i_chroma, int i_aspect )
98 vout_thread_t * p_vout; /* thread descriptor */
99 int i_status; /* thread status */
100 int i_index; /* loop variable */
103 /* Allocate descriptor */
104 p_vout = (vout_thread_t *) malloc( sizeof(vout_thread_t) );
107 intf_ErrMsg( "vout error: vout thread creation returned %s",
112 /* Choose the best module */
113 if( !(psz_plugin = config_GetPszVariable( "filter" )) )
115 psz_plugin = config_GetPszVariable( "vout" );
118 /* Initialize thread properties - thread id and locks will be initialized
122 p_vout->b_active = 0;
123 p_vout->pi_status = (pi_status != NULL) ? pi_status : &i_status;
124 *p_vout->pi_status = THREAD_CREATE;
126 /* Initialize pictures and subpictures - translation tables and functions
127 * will be initialized later in InitThread */
128 for( i_index = 0; i_index < 2 * VOUT_MAX_PICTURES; i_index++)
130 p_vout->p_picture[i_index].i_status = FREE_PICTURE;
131 p_vout->p_picture[i_index].i_type = EMPTY_PICTURE;
134 for( i_index = 0; i_index < VOUT_MAX_SUBPICTURES; i_index++)
136 p_vout->p_subpicture[i_index].i_status = FREE_SUBPICTURE;
137 p_vout->p_subpicture[i_index].i_type = EMPTY_SUBPICTURE;
140 /* No images in the heap */
141 p_vout->i_heap_size = 0;
143 /* Initialize the rendering heap */
144 I_RENDERPICTURES = 0;
145 p_vout->render.i_width = i_width;
146 p_vout->render.i_height = i_height;
147 p_vout->render.i_chroma = i_chroma;
148 p_vout->render.i_aspect = i_aspect;
150 p_vout->render.i_rmask = 0;
151 p_vout->render.i_gmask = 0;
152 p_vout->render.i_bmask = 0;
154 /* Zero the output heap */
155 I_OUTPUTPICTURES = 0;
156 p_vout->output.i_width = 0;
157 p_vout->output.i_height = 0;
158 p_vout->output.i_chroma = 0;
159 p_vout->output.i_aspect = 0;
161 p_vout->output.i_rmask = 0;
162 p_vout->output.i_gmask = 0;
163 p_vout->output.i_bmask = 0;
165 /* Initialize misc stuff */
166 p_vout->i_changes = 0;
168 p_vout->b_grayscale = 0;
170 p_vout->b_interface = 0;
172 p_vout->b_fullscreen = 0;
173 p_vout->render_time = 10;
174 p_vout->c_fps_samples= 0;
176 /* user requested fullscreen? */
177 if( config_GetIntVariable( "fullscreen" ) )
178 p_vout->i_changes |= VOUT_FULLSCREEN_CHANGE;
180 /* Initialize the dimensions of the video window */
181 InitWindowSize( p_vout, &p_vout->i_window_width,
182 &p_vout->i_window_height );
186 = module_Need( MODULE_CAPABILITY_VOUT, psz_plugin, (void *)p_vout );
188 if( psz_plugin ) free( psz_plugin );
189 if( p_vout->p_module == NULL )
191 intf_ErrMsg( "vout error: no suitable vout module" );
196 #define f p_vout->p_module->p_functions->vout.functions.vout
197 p_vout->pf_create = f.pf_create;
198 p_vout->pf_init = f.pf_init;
199 p_vout->pf_end = f.pf_end;
200 p_vout->pf_destroy = f.pf_destroy;
201 p_vout->pf_manage = f.pf_manage;
202 p_vout->pf_render = f.pf_render;
203 p_vout->pf_display = f.pf_display;
206 /* Create thread and set locks */
207 vlc_mutex_init( &p_vout->picture_lock );
208 vlc_mutex_init( &p_vout->subpicture_lock );
209 vlc_mutex_init( &p_vout->change_lock );
211 if( vlc_thread_create( &p_vout->thread_id, "video output",
212 (void *) RunThread, (void *) p_vout) )
214 intf_ErrMsg("vout error: %s", strerror(ENOMEM));
215 p_vout->pf_destroy( p_vout );
216 module_Unneed( p_vout->p_module );
221 /* If status is NULL, wait until the thread is created */
222 if( pi_status == NULL )
226 msleep( THREAD_SLEEP );
227 }while( (i_status != THREAD_READY) && (i_status != THREAD_ERROR)
228 && (i_status != THREAD_FATAL) );
229 if( i_status != THREAD_READY )
238 /*****************************************************************************
239 * vout_DestroyThread: destroys a previously created thread
240 *****************************************************************************
241 * Destroy a terminated thread.
242 * The function will request a destruction of the specified thread. If pi_error
243 * is NULL, it will return once the thread is destroyed. Else, it will be
244 * update using one of the THREAD_* constants.
245 *****************************************************************************/
246 void vout_DestroyThread( vout_thread_t *p_vout, int *pi_status )
248 int i_status; /* thread status */
251 p_vout->pi_status = (pi_status != NULL) ? pi_status : &i_status;
252 *p_vout->pi_status = THREAD_DESTROY;
254 /* Request thread destruction */
257 /* If status is NULL, wait until thread has been destroyed */
258 if( pi_status == NULL )
262 msleep( THREAD_SLEEP );
263 } while( (i_status != THREAD_OVER) && (i_status != THREAD_ERROR)
264 && (i_status != THREAD_FATAL) );
268 /*****************************************************************************
269 * InitThread: initialize video output thread
270 *****************************************************************************
271 * This function is called from RunThread and performs the second step of the
272 * initialization. It returns 0 on success. Note that the thread's flag are not
273 * modified inside this function.
274 *****************************************************************************/
275 static int InitThread( vout_thread_t *p_vout )
280 *p_vout->pi_status = THREAD_START;
282 vlc_mutex_lock( &p_vout->change_lock );
288 /* Initialize output method, it allocates direct buffers for us */
289 if( p_vout->pf_init( p_vout ) )
291 vlc_mutex_unlock( &p_vout->change_lock );
295 if( !I_OUTPUTPICTURES )
297 intf_ErrMsg( "vout error: plugin was unable to allocate at least "
298 "one direct buffer" );
299 p_vout->pf_end( p_vout );
300 vlc_mutex_unlock( &p_vout->change_lock );
304 intf_WarnMsg( 1, "vout info: got %i direct buffer(s)", I_OUTPUTPICTURES );
306 i_pgcd = ReduceHeight( p_vout->render.i_aspect );
307 intf_WarnMsg( 1, "vout info: picture in %ix%i, chroma 0x%.8x (%4.4s), "
308 "aspect ratio %i:%i",
309 p_vout->render.i_width, p_vout->render.i_height,
310 p_vout->render.i_chroma, (char*)&p_vout->render.i_chroma,
311 p_vout->render.i_aspect / i_pgcd,
312 VOUT_ASPECT_FACTOR / i_pgcd );
314 i_pgcd = ReduceHeight( p_vout->output.i_aspect );
315 intf_WarnMsg( 1, "vout info: picture out %ix%i, chroma 0x%.8x (%4.4s), "
316 "aspect ratio %i:%i",
317 p_vout->output.i_width, p_vout->output.i_height,
318 p_vout->output.i_chroma, (char*)&p_vout->output.i_chroma,
319 p_vout->output.i_aspect / i_pgcd,
320 VOUT_ASPECT_FACTOR / i_pgcd );
322 /* Calculate shifts from system-updated masks */
323 MaskToShift( &p_vout->output.i_lrshift, &p_vout->output.i_rrshift,
324 p_vout->output.i_rmask );
325 MaskToShift( &p_vout->output.i_lgshift, &p_vout->output.i_rgshift,
326 p_vout->output.i_gmask );
327 MaskToShift( &p_vout->output.i_lbshift, &p_vout->output.i_rbshift,
328 p_vout->output.i_bmask );
330 /* Check whether we managed to create direct buffers similar to
331 * the render buffers, ie same size, chroma and aspect ratio */
332 if( ( p_vout->output.i_width == p_vout->render.i_width )
333 && ( p_vout->output.i_height == p_vout->render.i_height )
334 && ( vout_ChromaCmp( p_vout->output.i_chroma, p_vout->render.i_chroma ) )
335 && ( p_vout->output.i_aspect == p_vout->render.i_aspect ) )
337 /* Cool ! We have direct buffers, we can ask the decoder to
338 * directly decode into them ! Map the first render buffers to
339 * the first direct buffers, but keep the first direct buffer
340 * for memcpy operations */
341 p_vout->b_direct = 1;
343 intf_WarnMsg( 2, "vout info: direct render, mapping "
344 "render pictures 0-%i to system pictures 1-%i",
345 VOUT_MAX_PICTURES - 2, VOUT_MAX_PICTURES - 1 );
347 for( i = 1; i < VOUT_MAX_PICTURES; i++ )
349 PP_RENDERPICTURE[ I_RENDERPICTURES ] = &p_vout->p_picture[ i ];
355 /* Rats... Something is wrong here, we could not find an output
356 * plugin able to directly render what we decode. See if we can
357 * find a chroma plugin to do the conversion */
358 p_vout->b_direct = 0;
360 /* Choose the best module */
361 p_vout->chroma.p_module
362 = module_Need( MODULE_CAPABILITY_CHROMA, NULL, (void *)p_vout );
364 if( p_vout->chroma.p_module == NULL )
366 intf_ErrMsg( "vout error: no chroma module for %4.4s to %4.4s",
367 &p_vout->render.i_chroma, &p_vout->output.i_chroma );
368 p_vout->pf_end( p_vout );
369 vlc_mutex_unlock( &p_vout->change_lock );
373 #define f p_vout->chroma.p_module->p_functions->chroma.functions.chroma
374 p_vout->chroma.pf_end = f.pf_end;
377 if( I_OUTPUTPICTURES < 2 * VOUT_MAX_PICTURES )
379 intf_WarnMsg( 2, "vout info: indirect render, mapping "
380 "render pictures %i-%i to system pictures %i-%i",
381 I_OUTPUTPICTURES - 1, 2 * VOUT_MAX_PICTURES - 2,
382 I_OUTPUTPICTURES, 2 * VOUT_MAX_PICTURES - 1 );
386 /* FIXME: if this happens, we don't have any render picture left */
387 intf_WarnMsg( 2, "vout info: indirect render, no system "
388 "pictures needed, we have %i directbuffers",
390 intf_ErrMsg( "vout: this is a bug!\n");
393 /* Append render buffers after the direct buffers */
394 for( i = I_OUTPUTPICTURES; i < 2 * VOUT_MAX_PICTURES; i++ )
396 PP_RENDERPICTURE[ I_RENDERPICTURES ] = &p_vout->p_picture[ i ];
401 /* Link pictures back to their heap */
402 for( i = 0 ; i < I_RENDERPICTURES ; i++ )
404 PP_RENDERPICTURE[ i ]->p_heap = &p_vout->render;
407 for( i = 0 ; i < I_OUTPUTPICTURES ; i++ )
409 PP_OUTPUTPICTURE[ i ]->p_heap = &p_vout->output;
412 /* Mark thread as running and return */
413 p_vout->b_active = 1;
414 *p_vout->pi_status = THREAD_READY;
419 /*****************************************************************************
420 * RunThread: video output thread
421 *****************************************************************************
422 * Video output thread. This function does only returns when the thread is
423 * terminated. It handles the pictures arriving in the video heap and the
424 * display device events.
425 *****************************************************************************/
426 static void RunThread( vout_thread_t *p_vout)
428 int i_index; /* index in heap */
429 mtime_t current_date; /* current date */
430 mtime_t display_date; /* display date */
432 picture_t * p_picture; /* picture pointer */
433 picture_t * p_directbuffer; /* direct buffer to display */
435 subpicture_t * p_subpic; /* subpicture pointer */
440 p_vout->b_error = InitThread( p_vout );
441 if( p_vout->b_error )
443 /* Destroy thread structures allocated by Create and InitThread */
444 p_vout->pf_destroy( p_vout );
446 DestroyThread( p_vout, THREAD_ERROR );
451 * Main loop - it is not executed if an error occured during
454 while( (!p_vout->b_die) && (!p_vout->b_error) )
456 /* Initialize loop variables */
458 current_date = mdate();
462 if( !(p_vout->c_loops % VOUT_STATS_NB_LOOPS) )
464 intf_Msg( "vout stats: picture heap: %d/%d",
465 I_RENDERPICTURES, p_vout->i_heap_size );
470 * Find the picture to display - this operation does not need lock,
471 * since only READY_PICTUREs are handled
476 i_index < I_RENDERPICTURES;
479 if( (PP_RENDERPICTURE[i_index]->i_status == READY_PICTURE)
480 && ( (p_picture == NULL) ||
481 (PP_RENDERPICTURE[i_index]->date < display_date) ) )
483 p_picture = PP_RENDERPICTURE[i_index];
484 display_date = p_picture->date;
488 if( p_picture != NULL )
490 /* Compute FPS rate */
491 p_vout->p_fps_sample[ p_vout->c_fps_samples++ % VOUT_FPS_SAMPLES ]
494 if( display_date < current_date + p_vout->render_time )
496 /* Picture is late: it will be destroyed and the thread
497 * will directly choose the next picture */
498 vlc_mutex_lock( &p_vout->picture_lock );
499 if( p_picture->i_refcount )
501 /* Pretend we displayed the picture, but don't destroy
502 * it since the decoder might still need it. */
503 p_picture->i_status = DISPLAYED_PICTURE;
507 /* Destroy the picture without displaying it */
508 p_picture->i_status = DESTROYED_PICTURE;
509 p_vout->i_heap_size--;
511 intf_WarnMsg( 1, "vout warning: late picture skipped (%p)",
513 vlc_mutex_unlock( &p_vout->picture_lock );
517 else if( display_date > current_date + VOUT_DISPLAY_DELAY )
519 /* A picture is ready to be rendered, but its rendering date
520 * is far from the current one so the thread will perform an
521 * empty loop as if no picture were found. The picture state
529 * Check for subpictures to display
531 p_subpic = vout_SortSubPictures( p_vout, display_date );
536 p_directbuffer = vout_RenderPicture( p_vout, p_picture, p_subpic );
539 * Call the plugin-specific rendering method
541 if( p_picture != NULL )
543 /* Render the direct buffer returned by vout_RenderPicture */
544 p_vout->pf_render( p_vout, p_directbuffer );
550 if( display_date != 0 )
552 /* Store render time using Bresenham algorithm */
553 p_vout->render_time += mdate() - current_date;
554 p_vout->render_time >>= 1;
557 /* Give back change lock */
558 vlc_mutex_unlock( &p_vout->change_lock );
560 /* Sleep a while or until a given date */
561 if( display_date != 0 )
563 mwait( display_date - VOUT_MWAIT_TOLERANCE );
567 msleep( VOUT_IDLE_SLEEP );
570 /* On awakening, take back lock and send immediately picture
572 vlc_mutex_lock( &p_vout->change_lock );
575 * Display the previously rendered picture
577 if( p_picture != NULL )
579 /* Display the direct buffer returned by vout_RenderPicture */
580 p_vout->pf_display( p_vout, p_directbuffer );
582 /* Remove picture from heap */
583 vlc_mutex_lock( &p_vout->picture_lock );
584 if( p_picture->i_refcount )
586 p_picture->i_status = DISPLAYED_PICTURE;
590 p_picture->i_status = DESTROYED_PICTURE;
591 p_vout->i_heap_size--;
593 vlc_mutex_unlock( &p_vout->picture_lock );
597 * Check events and manage thread
599 if( p_vout->pf_manage( p_vout ) )
601 /* A fatal error occured, and the thread must terminate immediately,
602 * without displaying anything - setting b_error to 1 causes the
603 * immediate end of the main while() loop. */
609 * Error loop - wait until the thread destruction is requested
611 if( p_vout->b_error )
613 ErrorThread( p_vout );
619 /* Destroy method-dependant resources */
620 p_vout->pf_destroy( p_vout );
622 /* Destroy thread structures allocated by CreateThread */
623 DestroyThread( p_vout, THREAD_OVER );
626 /*****************************************************************************
627 * ErrorThread: RunThread() error loop
628 *****************************************************************************
629 * This function is called when an error occured during thread main's loop. The
630 * thread can still receive feed, but must be ready to terminate as soon as
632 *****************************************************************************/
633 static void ErrorThread( vout_thread_t *p_vout )
635 /* Wait until a `die' order */
636 while( !p_vout->b_die )
639 msleep( VOUT_IDLE_SLEEP );
643 /*****************************************************************************
644 * EndThread: thread destruction
645 *****************************************************************************
646 * This function is called when the thread ends after a sucessful
647 * initialization. It frees all ressources allocated by InitThread.
648 *****************************************************************************/
649 static void EndThread( vout_thread_t *p_vout )
651 int i_index; /* index in heap */
654 *p_vout->pi_status = THREAD_END;
658 struct tms cpu_usage;
661 intf_Msg( "vout stats: cpu usage (user: %d, system: %d)",
662 cpu_usage.tms_utime, cpu_usage.tms_stime );
666 if( !p_vout->b_direct )
668 p_vout->chroma.pf_end( p_vout );
669 module_Unneed( p_vout->chroma.p_module );
672 /* Destroy all remaining pictures */
673 for( i_index = 0; i_index < 2 * VOUT_MAX_PICTURES; i_index++ )
675 if ( p_vout->p_picture[i_index].i_type == MEMORY_PICTURE )
677 free( p_vout->p_picture[i_index].p_data_orig );
681 /* Destroy all remaining subpictures */
682 for( i_index = 0; i_index < VOUT_MAX_SUBPICTURES; i_index++ )
684 if( p_vout->p_subpicture[i_index].i_status != FREE_SUBPICTURE )
686 free( p_vout->p_subpicture[i_index].p_sys );
690 /* Destroy translation tables */
691 p_vout->pf_end( p_vout );
693 /* Release the change lock */
694 vlc_mutex_unlock( &p_vout->change_lock );
697 /*****************************************************************************
698 * DestroyThread: thread destruction
699 *****************************************************************************
700 * This function is called when the thread ends. It frees all ressources
701 * allocated by CreateThread. Status is available at this stage.
702 *****************************************************************************/
703 static void DestroyThread( vout_thread_t *p_vout, int i_status )
705 int *pi_status; /* status adress */
707 /* Store status adress */
708 pi_status = p_vout->pi_status;
710 /* Destroy the locks */
711 vlc_mutex_destroy( &p_vout->picture_lock );
712 vlc_mutex_destroy( &p_vout->subpicture_lock );
713 vlc_mutex_destroy( &p_vout->change_lock );
715 /* Release the module */
716 module_Unneed( p_vout->p_module );
720 *pi_status = i_status;
723 /* following functions are local */
725 static int ReduceHeight( int i_ratio )
727 int i_dummy = VOUT_ASPECT_FACTOR;
735 /* VOUT_ASPECT_FACTOR is (2^7 * 3^3 * 5^3), we just check for 2, 3 and 5 */
736 while( !(i_ratio & 1) && !(i_dummy & 1) )
743 while( !(i_ratio % 3) && !(i_dummy % 3) )
750 while( !(i_ratio % 5) && !(i_dummy % 5) )
760 /*****************************************************************************
761 * BinaryLog: computes the base 2 log of a binary value
762 *****************************************************************************
763 * This functions is used by MaskToShift, to get a bit index from a binary
765 *****************************************************************************/
766 static int BinaryLog(u32 i)
770 if(i & 0xffff0000) i_log += 16;
771 if(i & 0xff00ff00) i_log += 8;
772 if(i & 0xf0f0f0f0) i_log += 4;
773 if(i & 0xcccccccc) i_log += 2;
774 if(i & 0xaaaaaaaa) i_log += 1;
776 if (i != ((u32)1 << i_log))
778 intf_ErrMsg( "vout error: binary log overflow for %i", i );
784 /*****************************************************************************
785 * MaskToShift: transform a color mask into right and left shifts
786 *****************************************************************************
787 * This function is used for obtaining color shifts from masks.
788 *****************************************************************************/
789 static void MaskToShift( int *pi_left, int *pi_right, u32 i_mask )
791 u32 i_low, i_high; /* lower hand higher bits of the mask */
795 *pi_left = *pi_right = 0;
800 i_low = i_mask & (- i_mask); /* lower bit of the mask */
801 i_high = i_mask + i_low; /* higher bit of the mask */
803 /* Transform bits into an index */
804 i_low = BinaryLog (i_low);
805 i_high = BinaryLog (i_high);
807 /* Update pointers and return */
809 *pi_right = (8 - i_high + i_low);
812 /*****************************************************************************
813 * InitWindowSize: find the initial dimensions the video window should have.
814 *****************************************************************************
815 * This function will check the "width" and "height" config options and
816 * will calculate the size that the video window should have.
817 *****************************************************************************/
818 static void InitWindowSize( vout_thread_t *p_vout, int *pi_width,
821 int i_width, i_height;
823 i_width = config_GetIntVariable( "width" );
824 i_height = config_GetIntVariable( "height" );
826 if( (i_width >= 0) && (i_height >= 0))
829 *pi_height = i_height;
832 else if( i_width >= 0 )
835 *pi_height = i_width * VOUT_ASPECT_FACTOR / p_vout->render.i_aspect;
838 else if( i_height >= 0 )
840 *pi_height = i_height;
841 *pi_width = i_height * p_vout->render.i_aspect / VOUT_ASPECT_FACTOR;
845 if( p_vout->render.i_height * p_vout->render.i_aspect
846 >= p_vout->render.i_width * VOUT_ASPECT_FACTOR )
848 *pi_width = p_vout->render.i_height
849 * p_vout->render.i_aspect / VOUT_ASPECT_FACTOR;
850 *pi_height = p_vout->render.i_height;
854 *pi_width = p_vout->render.i_width;
855 *pi_height = p_vout->render.i_width
856 * VOUT_ASPECT_FACTOR / p_vout->render.i_aspect;