1 /*****************************************************************************
2 * vout_sdl.c: SDL video output display method
3 *****************************************************************************
4 * Copyright (C) 1998-2001 VideoLAN
5 * $Id: vout_sdl.c,v 1.77 2002/01/05 02:22:03 sam Exp $
7 * Authors: Samuel Hocevar <sam@zoy.org>
8 * Pierre Baillet <oct@zoy.org>
9 * Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr>
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
24 *****************************************************************************/
26 /*****************************************************************************
28 *****************************************************************************/
29 #include <errno.h> /* ENOMEM */
30 #include <stdlib.h> /* free() */
31 #include <string.h> /* strerror() */
33 #include <videolan/vlc.h>
35 #include <sys/types.h>
37 # include <netinet/in.h> /* BSD: struct in_addr */
40 #include SDL_INCLUDE_FILE
45 #include "video_output.h"
47 #include "interface.h"
49 #include "stream_control.h" /* needed by input_ext-intf.h... */
50 #include "input_ext-intf.h"
52 #define SDL_MAX_DIRECTBUFFERS 5
53 #define SDL_DEFAULT_BPP 16
55 /*****************************************************************************
56 * vout_sys_t: video output SDL method descriptor
57 *****************************************************************************
58 * This structure is part of the video output thread descriptor.
59 * It describes the SDL specific properties of an output thread.
60 *****************************************************************************/
61 typedef struct vout_sys_s
63 SDL_Surface * p_display; /* display device */
69 SDL_Overlay * p_overlay; /* An overlay we keep to grab the XVideo port */
78 boolean_t b_cursor_autohidden;
83 /*****************************************************************************
84 * picture_sys_t: direct buffer method descriptor
85 *****************************************************************************
86 * This structure is part of the picture descriptor, it describes the
87 * SDL specific properties of a direct buffer.
88 *****************************************************************************/
89 typedef struct picture_sys_s
91 SDL_Overlay *p_overlay;
95 /*****************************************************************************
96 * Seeking function TODO: put this in a generic location !
97 *****************************************************************************/
98 static __inline__ void vout_Seek( off_t i_seek )
100 #define area p_main->p_intf->p_input->stream.p_selected_area
101 off_t i_tell = area->i_tell;
103 i_tell += i_seek * (off_t)50 * p_main->p_intf->p_input->stream.i_mux_rate;
105 i_tell = ( i_tell <= area->i_start ) ? area->i_start
106 : ( i_tell >= area->i_size ) ? area->i_size
109 input_Seek( p_main->p_intf->p_input, i_tell );
113 /*****************************************************************************
115 *****************************************************************************/
116 static int vout_Probe ( probedata_t *p_data );
117 static int vout_Create ( struct vout_thread_s * );
118 static int vout_Init ( struct vout_thread_s * );
119 static void vout_End ( struct vout_thread_s * );
120 static void vout_Destroy ( struct vout_thread_s * );
121 static int vout_Manage ( struct vout_thread_s * );
122 static void vout_Render ( struct vout_thread_s *, struct picture_s * );
123 static void vout_Display ( struct vout_thread_s *, struct picture_s * );
125 static int SDLOpenDisplay ( vout_thread_t *p_vout );
126 static void SDLCloseDisplay ( vout_thread_t *p_vout );
127 static int SDLNewPicture ( vout_thread_t *p_vout, picture_t *p_pic );
129 /*****************************************************************************
130 * Functions exported as capabilities. They are declared as static so that
131 * we don't pollute the namespace too much.
132 *****************************************************************************/
133 void _M( vout_getfunctions )( function_list_t * p_function_list )
135 p_function_list->pf_probe = vout_Probe;
136 p_function_list->functions.vout.pf_create = vout_Create;
137 p_function_list->functions.vout.pf_init = vout_Init;
138 p_function_list->functions.vout.pf_end = vout_End;
139 p_function_list->functions.vout.pf_destroy = vout_Destroy;
140 p_function_list->functions.vout.pf_manage = vout_Manage;
141 p_function_list->functions.vout.pf_render = vout_Render;
142 p_function_list->functions.vout.pf_display = vout_Display;
143 p_function_list->functions.vout.pf_setpalette = NULL;
146 /*****************************************************************************
147 * vout_Probe: probe the video driver and return a score
148 *****************************************************************************
149 * This function tries to initialize SDL and returns a score to the
150 * plugin manager so that it can select the best plugin.
151 *****************************************************************************/
152 static int vout_Probe( probedata_t *p_data )
154 if( SDL_WasInit( SDL_INIT_VIDEO ) != 0 )
162 /*****************************************************************************
163 * vout_Create: allocate SDL video thread output method
164 *****************************************************************************
165 * This function allocate and initialize a SDL vout method. It uses some of the
166 * vout properties to choose the correct mode, and change them according to the
167 * mode actually used.
168 *****************************************************************************/
169 static int vout_Create( vout_thread_t *p_vout )
171 if( SDL_WasInit( SDL_INIT_VIDEO ) != 0 )
176 /* Allocate structure */
177 p_vout->p_sys = malloc( sizeof( vout_sys_t ) );
178 if( p_vout->p_sys == NULL )
180 intf_ErrMsg( "vout error: can't create p_sys (%s)", strerror(ENOMEM) );
184 /* Initialize library */
185 if( SDL_Init( SDL_INIT_VIDEO
187 /* Win32 SDL implementation doesn't support SDL_INIT_EVENTTHREAD yet*/
188 | SDL_INIT_EVENTTHREAD
191 /* In debug mode you may want vlc to dump a core instead of staying
193 | SDL_INIT_NOPARACHUTE
197 intf_ErrMsg( "vout error: can't initialize SDL (%s)", SDL_GetError() );
198 free( p_vout->p_sys );
202 p_vout->p_sys->b_cursor = 1;
203 p_vout->p_sys->b_cursor_autohidden = 0;
204 p_vout->p_sys->i_lastmoved = mdate();
206 if( p_vout->render.i_height * p_vout->render.i_aspect
207 >= p_vout->render.i_width * VOUT_ASPECT_FACTOR )
209 p_vout->p_sys->i_width = p_vout->render.i_height
210 * p_vout->render.i_aspect / VOUT_ASPECT_FACTOR;
211 p_vout->p_sys->i_height = p_vout->render.i_height;
215 p_vout->p_sys->i_width = p_vout->render.i_width;
216 p_vout->p_sys->i_height = p_vout->render.i_width
217 * VOUT_ASPECT_FACTOR / p_vout->render.i_aspect;
221 if( p_vout->p_sys->i_width <= 300 && p_vout->p_sys->i_height <= 300 )
223 p_vout->p_sys->i_width <<= 1;
224 p_vout->p_sys->i_height <<= 1;
226 else if( p_vout->p_sys->i_width <= 400 && p_vout->p_sys->i_height <= 400 )
228 p_vout->p_sys->i_width += p_vout->p_sys->i_width >> 1;
229 p_vout->p_sys->i_height += p_vout->p_sys->i_height >> 1;
233 if( SDLOpenDisplay( p_vout ) )
235 intf_ErrMsg( "vout error: can't set up SDL (%s)", SDL_GetError() );
236 SDL_QuitSubSystem( SDL_INIT_VIDEO );
237 free( p_vout->p_sys );
244 /*****************************************************************************
245 * vout_Init: initialize SDL video thread output method
246 *****************************************************************************
247 * This function initialize the SDL display device.
248 *****************************************************************************/
249 static int vout_Init( vout_thread_t *p_vout )
254 p_vout->p_sys->i_surfaces = 0;
256 I_OUTPUTPICTURES = 0;
258 /* Initialize the output structure */
259 if( p_vout->p_sys->p_overlay == NULL )
261 /* All we have is an RGB image with square pixels */
262 p_vout->output.i_width = p_vout->p_sys->i_width;
263 p_vout->output.i_height = p_vout->p_sys->i_height;
264 p_vout->output.i_aspect = p_vout->p_sys->i_width
266 / p_vout->p_sys->i_height;
270 /* We may need to convert the chroma, but at least we keep the
272 p_vout->output.i_width = p_vout->render.i_width;
273 p_vout->output.i_height = p_vout->render.i_height;
274 p_vout->output.i_aspect = p_vout->render.i_aspect;
277 /* Try to initialize SDL_MAX_DIRECTBUFFERS direct buffers */
278 while( I_OUTPUTPICTURES < SDL_MAX_DIRECTBUFFERS )
282 /* Find an empty picture slot */
283 for( i_index = 0 ; i_index < VOUT_MAX_PICTURES ; i_index++ )
285 if( p_vout->p_picture[ i_index ].i_status == FREE_PICTURE )
287 p_pic = p_vout->p_picture + i_index;
292 /* Allocate the picture if we found one */
293 if( p_pic == NULL || SDLNewPicture( p_vout, p_pic ) )
298 p_pic->i_status = DESTROYED_PICTURE;
299 p_pic->i_type = DIRECT_PICTURE;
301 PP_OUTPUTPICTURE[ I_OUTPUTPICTURES ] = p_pic;
309 /*****************************************************************************
310 * vout_End: terminate Sys video thread output method
311 *****************************************************************************
312 * Terminate an output method created by vout_SDLCreate
313 *****************************************************************************/
314 static void vout_End( vout_thread_t *p_vout )
318 /* Free the output buffers we allocated */
319 for( i_index = I_OUTPUTPICTURES ; i_index ; )
322 if( p_vout->p_sys->p_overlay == NULL )
328 SDL_UnlockYUVOverlay(
329 PP_OUTPUTPICTURE[ i_index ]->p_sys->p_overlay );
331 PP_OUTPUTPICTURE[ i_index ]->p_sys->p_overlay );
333 free( PP_OUTPUTPICTURE[ i_index ]->p_sys );
337 /*****************************************************************************
338 * vout_Destroy: destroy Sys video thread output method
339 *****************************************************************************
340 * Terminate an output method created by vout_SDLCreate
341 *****************************************************************************/
342 static void vout_Destroy( vout_thread_t *p_vout )
344 SDLCloseDisplay( p_vout );
346 SDL_QuitSubSystem( SDL_INIT_VIDEO );
348 free( p_vout->p_sys );
351 /*****************************************************************************
352 * vout_Manage: handle Sys events
353 *****************************************************************************
354 * This function should be called regularly by video output thread. It returns
355 * a non null value if an error occured.
356 *****************************************************************************/
357 static int vout_Manage( vout_thread_t *p_vout )
359 SDL_Event event; /* SDL event */
362 while( SDL_PollEvent(&event) )
366 case SDL_VIDEORESIZE: /* Resizing of window */
367 p_vout->p_sys->i_width = event.resize.w;
368 p_vout->p_sys->i_height = event.resize.h;
369 SDLCloseDisplay( p_vout );
370 SDLOpenDisplay( p_vout );
373 case SDL_MOUSEMOTION:
374 if( p_vout->p_sys->b_cursor &&
375 (abs(event.motion.xrel) > 2 || abs(event.motion.yrel) > 2) )
377 if( p_vout->p_sys->b_cursor_autohidden )
379 p_vout->p_sys->b_cursor_autohidden = 0;
384 p_vout->p_sys->i_lastmoved = mdate();
389 case SDL_MOUSEBUTTONUP:
390 switch( event.button.button )
392 case SDL_BUTTON_RIGHT:
393 p_main->p_intf->b_menu_change = 1;
398 case SDL_MOUSEBUTTONDOWN:
399 switch( event.button.button )
401 case SDL_BUTTON_LEFT:
402 /* In this part we will eventually manage
403 * clicks for DVD navigation for instance. For the
404 * moment just pause the stream. */
405 input_SetStatus( p_main->p_intf->p_input, INPUT_STATUS_PAUSE );
419 p_main->p_intf->b_die = 1;
422 case SDL_KEYDOWN: /* if a key is pressed */
424 switch( event.key.keysym.sym )
426 case SDLK_q: /* quit */
428 p_main->p_intf->b_die = 1;
431 case SDLK_f: /* switch to fullscreen */
432 p_vout->i_changes |= VOUT_FULLSCREEN_CHANGE;
435 case SDLK_c: /* toggle grayscale */
436 p_vout->b_grayscale = ! p_vout->b_grayscale;
437 p_vout->i_changes |= VOUT_GRAYSCALE_CHANGE;
440 case SDLK_i: /* toggle info */
441 p_vout->b_info = ! p_vout->b_info;
442 p_vout->i_changes |= VOUT_INFO_CHANGE;
445 case SDLK_s: /* toggle scaling */
446 p_vout->b_scale = ! p_vout->b_scale;
447 p_vout->i_changes |= VOUT_SCALE_CHANGE;
450 case SDLK_SPACE: /* toggle interface */
451 p_vout->b_interface = ! p_vout->b_interface;
452 p_vout->i_changes |= VOUT_INTF_CHANGE;
456 p_main->p_intf->b_menu_change = 1;
475 case SDLK_F10: network_ChannelJoin( 0 ); break;
476 case SDLK_F1: network_ChannelJoin( 1 ); break;
477 case SDLK_F2: network_ChannelJoin( 2 ); break;
478 case SDLK_F3: network_ChannelJoin( 3 ); break;
479 case SDLK_F4: network_ChannelJoin( 4 ); break;
480 case SDLK_F5: network_ChannelJoin( 5 ); break;
481 case SDLK_F6: network_ChannelJoin( 6 ); break;
482 case SDLK_F7: network_ChannelJoin( 7 ); break;
483 case SDLK_F8: network_ChannelJoin( 8 ); break;
484 case SDLK_F9: network_ChannelJoin( 9 ); break;
487 intf_DbgMsg( "unhandled key %i", event.key.keysym.sym );
497 /* Fullscreen change */
498 if( p_vout->i_changes & VOUT_FULLSCREEN_CHANGE )
500 p_vout->b_fullscreen = ! p_vout->b_fullscreen;
502 SDL_WM_ToggleFullScreen(p_vout->p_sys->p_display);
504 p_vout->p_sys->b_cursor_autohidden = 0;
505 SDL_ShowCursor( p_vout->p_sys->b_cursor &&
506 ! p_vout->p_sys->b_cursor_autohidden );
508 p_vout->i_changes &= ~VOUT_FULLSCREEN_CHANGE;
512 if( ! p_vout->p_sys->b_cursor_autohidden &&
513 ( mdate() - p_vout->p_sys->i_lastmoved > 2000000 ) )
515 /* Hide the mouse automatically */
516 p_vout->p_sys->b_cursor_autohidden = 1;
523 /*****************************************************************************
524 * vout_Render: render previously calculated output
525 *****************************************************************************/
526 static void vout_Render( vout_thread_t *p_vout, picture_t *p_pic )
531 /*****************************************************************************
532 * vout_Display: displays previously rendered output
533 *****************************************************************************
534 * This function sends the currently rendered image to the display.
535 *****************************************************************************/
536 static void vout_Display( vout_thread_t *p_vout, picture_t *p_pic )
541 vout_PlacePicture( p_vout, p_vout->p_sys->i_width, p_vout->p_sys->i_height,
548 if( p_vout->p_sys->p_overlay == NULL )
551 SDL_Flip( p_vout->p_sys->p_display );
555 /* Overlay picture */
556 SDL_UnlockYUVOverlay( p_pic->p_sys->p_overlay);
557 SDL_DisplayYUVOverlay( p_pic->p_sys->p_overlay , &disp );
558 SDL_LockYUVOverlay( p_pic->p_sys->p_overlay);
562 /* following functions are local */
564 /*****************************************************************************
565 * SDLOpenDisplay: open and initialize SDL device
566 *****************************************************************************
567 * Open and initialize display according to preferences specified in the vout
569 *****************************************************************************/
570 static int SDLOpenDisplay( vout_thread_t *p_vout )
575 /* Initialize flags and cursor */
576 i_flags = SDL_ANYFORMAT | SDL_HWPALETTE | SDL_HWSURFACE | SDL_DOUBLEBUF;
577 i_flags |= p_vout->b_fullscreen ? SDL_FULLSCREEN : SDL_RESIZABLE;
579 i_bpp = SDL_VideoModeOK( p_vout->p_sys->i_width, p_vout->p_sys->i_height,
580 SDL_DEFAULT_BPP, i_flags );
583 intf_ErrMsg( "vout error: no video mode available" );
587 p_vout->p_sys->p_display = SDL_SetVideoMode( p_vout->p_sys->i_width,
588 p_vout->p_sys->i_height,
591 if( p_vout->p_sys->p_display == NULL )
593 intf_ErrMsg( "vout error: cannot set video mode" );
597 SDL_LockSurface( p_vout->p_sys->p_display );
599 switch( p_vout->render.i_chroma )
603 p_vout->output.i_chroma = SDL_IYUV_OVERLAY;
607 p_vout->output.i_chroma = SDL_YUY2_OVERLAY;
612 p_vout->output.i_chroma = SDL_UYVY_OVERLAY;
615 p_vout->output.i_chroma = SDL_YVYU_OVERLAY;
619 p_vout->output.i_chroma = SDL_YV12_OVERLAY;
623 p_vout->p_sys->p_overlay =
624 SDL_CreateYUVOverlay( 32, 32, p_vout->output.i_chroma,
625 p_vout->p_sys->p_display );
627 if( p_vout->p_sys->p_overlay == NULL )
629 p_vout->output.i_chroma = SDL_IYUV_OVERLAY;
630 p_vout->p_sys->p_overlay =
631 SDL_CreateYUVOverlay( 32, 32, p_vout->output.i_chroma,
632 p_vout->p_sys->p_display );
635 if( p_vout->p_sys->p_overlay == NULL )
637 p_vout->output.i_chroma = SDL_YV12_OVERLAY;
638 p_vout->p_sys->p_overlay =
639 SDL_CreateYUVOverlay( 32, 32, p_vout->output.i_chroma,
640 p_vout->p_sys->p_display );
643 if( p_vout->p_sys->p_overlay == NULL )
645 p_vout->output.i_chroma = SDL_YUY2_OVERLAY;
646 p_vout->p_sys->p_overlay =
647 SDL_CreateYUVOverlay( 32, 32, p_vout->output.i_chroma,
648 p_vout->p_sys->p_display );
651 if( p_vout->p_sys->p_overlay == NULL )
653 intf_WarnMsg( 3, "vout warning: no SDL overlay for 0x%.8x (%4.4s)",
654 p_vout->render.i_chroma,
655 (char*)&p_vout->render.i_chroma );
657 switch( p_vout->p_sys->p_display->format->BitsPerPixel )
660 p_vout->output.i_chroma = FOURCC_BI_RGB;
663 p_vout->output.i_chroma = FOURCC_RV15;
666 p_vout->output.i_chroma = FOURCC_RV16;
669 p_vout->output.i_chroma = FOURCC_BI_BITFIELDS;
672 p_vout->output.i_chroma = FOURCC_BI_BITFIELDS;
675 intf_ErrMsg( "vout error: unknown screen depth" );
676 SDL_UnlockSurface( p_vout->p_sys->p_display );
677 SDL_FreeSurface( p_vout->p_sys->p_display );
681 p_vout->p_sys->i_red_mask = p_vout->p_sys->p_display->format->Rmask;
682 p_vout->p_sys->i_green_mask = p_vout->p_sys->p_display->format->Gmask;
683 p_vout->p_sys->i_blue_mask = p_vout->p_sys->p_display->format->Bmask;
685 SDL_WM_SetCaption( VOUT_TITLE " (software RGB SDL output)",
686 VOUT_TITLE " (software RGB SDL output)" );
690 if( p_vout->p_sys->p_overlay->hw_overlay )
692 SDL_WM_SetCaption( VOUT_TITLE " (hardware YUV SDL output)",
693 VOUT_TITLE " (hardware YUV SDL output)" );
697 SDL_WM_SetCaption( VOUT_TITLE " (software YUV SDL output)",
698 VOUT_TITLE " (software YUV SDL output)" );
702 SDL_EventState( SDL_KEYUP, SDL_IGNORE ); /* ignore keys up */
707 /*****************************************************************************
708 * SDLCloseDisplay: close and reset SDL device
709 *****************************************************************************
710 * This function returns all resources allocated by SDLOpenDisplay and restore
711 * the original state of the device.
712 *****************************************************************************/
713 static void SDLCloseDisplay( vout_thread_t *p_vout )
715 SDL_FreeYUVOverlay( p_vout->p_sys->p_overlay );
716 SDL_UnlockSurface ( p_vout->p_sys->p_display );
717 SDL_FreeSurface( p_vout->p_sys->p_display );
720 /*****************************************************************************
721 * SDLNewPicture: allocate a picture
722 *****************************************************************************
723 * Returns 0 on success, -1 otherwise
724 *****************************************************************************/
725 static int SDLNewPicture( vout_thread_t *p_vout, picture_t *p_pic )
727 int i_width = p_vout->output.i_width;
728 int i_height = p_vout->output.i_height;
730 if( p_vout->p_sys->p_overlay == NULL )
733 if( p_vout->p_sys->i_surfaces )
735 /* We already allocated this surface, return */
739 p_pic->p_sys = malloc( sizeof( picture_sys_t ) );
741 if( p_pic->p_sys == NULL )
746 p_pic->p->p_pixels = p_vout->p_sys->p_display->pixels;
747 p_pic->p->i_lines = p_vout->p_sys->p_display->h;
748 p_pic->p->i_pitch = p_vout->p_sys->p_display->pitch;
749 p_pic->p->i_pixel_bytes = 2;
751 if( p_pic->p->i_pitch == 2 * p_vout->p_sys->p_display->w )
753 p_pic->p->b_margin = 0;
757 p_pic->p->b_margin = 1;
758 p_pic->p->b_hidden = 1;
759 p_pic->p->i_visible_bytes = 2 * p_vout->p_sys->p_display->w;
762 p_pic->p->i_red_mask = p_vout->p_sys->p_display->format->Rmask;
763 p_pic->p->i_green_mask = p_vout->p_sys->p_display->format->Gmask;
764 p_pic->p->i_blue_mask = p_vout->p_sys->p_display->format->Bmask;
766 p_vout->p_sys->i_surfaces++;
772 p_pic->p_sys = malloc( sizeof( picture_sys_t ) );
774 if( p_pic->p_sys == NULL )
779 p_pic->p_sys->p_overlay =
780 SDL_CreateYUVOverlay( i_width, i_height,
781 p_vout->output.i_chroma,
782 p_vout->p_sys->p_display );
784 if( p_pic->p_sys->p_overlay == NULL )
786 free( p_pic->p_sys );
790 SDL_LockYUVOverlay( p_pic->p_sys->p_overlay );
792 p_pic->Y_PIXELS = p_pic->p_sys->p_overlay->pixels[0];
793 p_pic->p[Y_PLANE].i_lines = p_pic->p_sys->p_overlay->h;
794 p_pic->p[Y_PLANE].i_pitch = p_pic->p_sys->p_overlay->pitches[0];
796 switch( p_vout->output.i_chroma )
798 case SDL_YV12_OVERLAY:
799 p_pic->p[Y_PLANE].i_pixel_bytes = 1;
800 p_pic->p[Y_PLANE].b_margin = 0;
802 p_pic->U_PIXELS = p_pic->p_sys->p_overlay->pixels[2];
803 p_pic->p[U_PLANE].i_lines = p_pic->p_sys->p_overlay->h / 2;
804 p_pic->p[U_PLANE].i_pitch = p_pic->p_sys->p_overlay->pitches[2];
805 p_pic->p[U_PLANE].i_pixel_bytes = 1;
806 p_pic->p[U_PLANE].b_margin = 0;
808 p_pic->V_PIXELS = p_pic->p_sys->p_overlay->pixels[1];
809 p_pic->p[V_PLANE].i_lines = p_pic->p_sys->p_overlay->h / 2;
810 p_pic->p[V_PLANE].i_pitch = p_pic->p_sys->p_overlay->pitches[1];
811 p_pic->p[V_PLANE].i_pixel_bytes = 1;
812 p_pic->p[V_PLANE].b_margin = 0;
817 case SDL_IYUV_OVERLAY:
818 p_pic->p[Y_PLANE].i_pixel_bytes = 1;
819 p_pic->p[Y_PLANE].b_margin = 0;
821 p_pic->U_PIXELS = p_pic->p_sys->p_overlay->pixels[1];
822 p_pic->p[U_PLANE].i_lines = p_pic->p_sys->p_overlay->h / 2;
823 p_pic->p[U_PLANE].i_pitch = p_pic->p_sys->p_overlay->pitches[1];
824 p_pic->p[U_PLANE].i_pixel_bytes = 1;
825 p_pic->p[U_PLANE].b_margin = 0;
827 p_pic->V_PIXELS = p_pic->p_sys->p_overlay->pixels[2];
828 p_pic->p[V_PLANE].i_lines = p_pic->p_sys->p_overlay->h / 2;
829 p_pic->p[V_PLANE].i_pitch = p_pic->p_sys->p_overlay->pitches[2];
830 p_pic->p[V_PLANE].i_pixel_bytes = 1;
831 p_pic->p[V_PLANE].b_margin = 0;
837 p_pic->p[Y_PLANE].i_pixel_bytes = 2;
838 p_pic->p[Y_PLANE].b_margin = 0;