1 /*****************************************************************************
2 * vout_sdl.c: SDL video output display method
3 *****************************************************************************
4 * Copyright (C) 1998-2001 VideoLAN
5 * $Id: vout_sdl.c,v 1.81 2002/02/15 13:32:53 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 10
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 )
102 vlc_mutex_lock( &p_input_bank->lock );
103 if( p_input_bank->pp_input[0] != NULL )
105 #define S p_input_bank->pp_input[0]->stream
106 i_tell = S.p_selected_area->i_tell + i_seek * (off_t)50 * S.i_mux_rate;
108 i_tell = ( i_tell <= 0 /*S.p_selected_area->i_start*/ )
109 ? 0 /*S.p_selected_area->i_start*/
110 : ( i_tell >= S.p_selected_area->i_size )
111 ? S.p_selected_area->i_size
114 input_Seek( p_input_bank->pp_input[0], i_tell );
117 vlc_mutex_unlock( &p_input_bank->lock );
120 /*****************************************************************************
122 *****************************************************************************/
123 static int vout_Create ( struct vout_thread_s * );
124 static int vout_Init ( struct vout_thread_s * );
125 static void vout_End ( struct vout_thread_s * );
126 static void vout_Destroy ( struct vout_thread_s * );
127 static int vout_Manage ( struct vout_thread_s * );
128 static void vout_Render ( struct vout_thread_s *, struct picture_s * );
129 static void vout_Display ( struct vout_thread_s *, struct picture_s * );
131 static int SDLOpenDisplay ( vout_thread_t *p_vout );
132 static void SDLCloseDisplay ( vout_thread_t *p_vout );
133 static int SDLNewPicture ( vout_thread_t *p_vout, picture_t *p_pic );
135 /*****************************************************************************
136 * Functions exported as capabilities. They are declared as static so that
137 * we don't pollute the namespace too much.
138 *****************************************************************************/
139 void _M( vout_getfunctions )( function_list_t * p_function_list )
141 p_function_list->functions.vout.pf_create = vout_Create;
142 p_function_list->functions.vout.pf_init = vout_Init;
143 p_function_list->functions.vout.pf_end = vout_End;
144 p_function_list->functions.vout.pf_destroy = vout_Destroy;
145 p_function_list->functions.vout.pf_manage = vout_Manage;
146 p_function_list->functions.vout.pf_render = vout_Render;
147 p_function_list->functions.vout.pf_display = vout_Display;
150 /*****************************************************************************
151 * vout_Create: allocate SDL video thread output method
152 *****************************************************************************
153 * This function allocate and initialize a SDL vout method. It uses some of the
154 * vout properties to choose the correct mode, and change them according to the
155 * mode actually used.
156 *****************************************************************************/
157 static int vout_Create( vout_thread_t *p_vout )
159 if( SDL_WasInit( SDL_INIT_VIDEO ) != 0 )
164 /* Allocate structure */
165 p_vout->p_sys = malloc( sizeof( vout_sys_t ) );
166 if( p_vout->p_sys == NULL )
168 intf_ErrMsg( "vout error: can't create p_sys (%s)", strerror(ENOMEM) );
172 /* Initialize library */
173 if( SDL_Init( SDL_INIT_VIDEO
175 /* Win32 SDL implementation doesn't support SDL_INIT_EVENTTHREAD yet*/
176 | SDL_INIT_EVENTTHREAD
179 /* In debug mode you may want vlc to dump a core instead of staying
181 | SDL_INIT_NOPARACHUTE
185 intf_ErrMsg( "vout error: can't initialize SDL (%s)", SDL_GetError() );
186 free( p_vout->p_sys );
190 p_vout->p_sys->b_cursor = 1;
191 p_vout->p_sys->b_cursor_autohidden = 0;
192 p_vout->p_sys->i_lastmoved = mdate();
194 if( p_vout->render.i_height * p_vout->render.i_aspect
195 >= p_vout->render.i_width * VOUT_ASPECT_FACTOR )
197 p_vout->p_sys->i_width = p_vout->render.i_height
198 * p_vout->render.i_aspect / VOUT_ASPECT_FACTOR;
199 p_vout->p_sys->i_height = p_vout->render.i_height;
203 p_vout->p_sys->i_width = p_vout->render.i_width;
204 p_vout->p_sys->i_height = p_vout->render.i_width
205 * VOUT_ASPECT_FACTOR / p_vout->render.i_aspect;
209 if( p_vout->p_sys->i_width <= 300 && p_vout->p_sys->i_height <= 300 )
211 p_vout->p_sys->i_width <<= 1;
212 p_vout->p_sys->i_height <<= 1;
214 else if( p_vout->p_sys->i_width <= 400 && p_vout->p_sys->i_height <= 400 )
216 p_vout->p_sys->i_width += p_vout->p_sys->i_width >> 1;
217 p_vout->p_sys->i_height += p_vout->p_sys->i_height >> 1;
221 if( SDLOpenDisplay( p_vout ) )
223 intf_ErrMsg( "vout error: can't set up SDL (%s)", SDL_GetError() );
224 SDL_QuitSubSystem( SDL_INIT_VIDEO );
225 free( p_vout->p_sys );
232 /*****************************************************************************
233 * vout_Init: initialize SDL video thread output method
234 *****************************************************************************
235 * This function initialize the SDL display device.
236 *****************************************************************************/
237 static int vout_Init( vout_thread_t *p_vout )
242 p_vout->p_sys->i_surfaces = 0;
244 I_OUTPUTPICTURES = 0;
246 /* Initialize the output structure */
247 if( p_vout->p_sys->p_overlay == NULL )
249 /* All we have is an RGB image with square pixels */
250 p_vout->output.i_width = p_vout->p_sys->i_width;
251 p_vout->output.i_height = p_vout->p_sys->i_height;
252 p_vout->output.i_aspect = p_vout->p_sys->i_width
254 / p_vout->p_sys->i_height;
258 /* We may need to convert the chroma, but at least we keep the
260 p_vout->output.i_width = p_vout->render.i_width;
261 p_vout->output.i_height = p_vout->render.i_height;
262 p_vout->output.i_aspect = p_vout->render.i_aspect;
265 /* Try to initialize SDL_MAX_DIRECTBUFFERS direct buffers */
266 while( I_OUTPUTPICTURES < SDL_MAX_DIRECTBUFFERS )
270 /* Find an empty picture slot */
271 for( i_index = 0 ; i_index < VOUT_MAX_PICTURES ; i_index++ )
273 if( p_vout->p_picture[ i_index ].i_status == FREE_PICTURE )
275 p_pic = p_vout->p_picture + i_index;
280 /* Allocate the picture if we found one */
281 if( p_pic == NULL || SDLNewPicture( p_vout, p_pic ) )
286 p_pic->i_status = DESTROYED_PICTURE;
287 p_pic->i_type = DIRECT_PICTURE;
289 PP_OUTPUTPICTURE[ I_OUTPUTPICTURES ] = p_pic;
297 /*****************************************************************************
298 * vout_End: terminate Sys video thread output method
299 *****************************************************************************
300 * Terminate an output method created by vout_SDLCreate
301 *****************************************************************************/
302 static void vout_End( vout_thread_t *p_vout )
306 /* Free the output buffers we allocated */
307 for( i_index = I_OUTPUTPICTURES ; i_index ; )
310 if( p_vout->p_sys->p_overlay == NULL )
316 SDL_UnlockYUVOverlay(
317 PP_OUTPUTPICTURE[ i_index ]->p_sys->p_overlay );
319 PP_OUTPUTPICTURE[ i_index ]->p_sys->p_overlay );
321 free( PP_OUTPUTPICTURE[ i_index ]->p_sys );
325 /*****************************************************************************
326 * vout_Destroy: destroy Sys video thread output method
327 *****************************************************************************
328 * Terminate an output method created by vout_SDLCreate
329 *****************************************************************************/
330 static void vout_Destroy( vout_thread_t *p_vout )
332 SDLCloseDisplay( p_vout );
334 SDL_QuitSubSystem( SDL_INIT_VIDEO );
336 free( p_vout->p_sys );
339 /*****************************************************************************
340 * vout_Manage: handle Sys events
341 *****************************************************************************
342 * This function should be called regularly by video output thread. It returns
343 * a non null value if an error occured.
344 *****************************************************************************/
345 static int vout_Manage( vout_thread_t *p_vout )
347 SDL_Event event; /* SDL event */
350 while( SDL_PollEvent(&event) )
354 case SDL_VIDEORESIZE: /* Resizing of window */
355 p_vout->p_sys->i_width = event.resize.w;
356 p_vout->p_sys->i_height = event.resize.h;
357 SDLCloseDisplay( p_vout );
358 SDLOpenDisplay( p_vout );
361 case SDL_MOUSEMOTION:
362 if( p_vout->p_sys->b_cursor &&
363 (abs(event.motion.xrel) > 2 || abs(event.motion.yrel) > 2) )
365 if( p_vout->p_sys->b_cursor_autohidden )
367 p_vout->p_sys->b_cursor_autohidden = 0;
372 p_vout->p_sys->i_lastmoved = mdate();
377 case SDL_MOUSEBUTTONUP:
378 switch( event.button.button )
380 case SDL_BUTTON_RIGHT:
381 p_main->p_intf->b_menu_change = 1;
386 case SDL_MOUSEBUTTONDOWN:
387 switch( event.button.button )
389 case SDL_BUTTON_LEFT:
390 /* In this part we will eventually manage
391 * clicks for DVD navigation for instance. For the
392 * moment just pause the stream. */
393 input_SetStatus( p_input_bank->pp_input[0],
394 INPUT_STATUS_PAUSE );
408 p_main->p_intf->b_die = 1;
411 case SDL_KEYDOWN: /* if a key is pressed */
413 switch( event.key.keysym.sym )
415 case SDLK_q: /* quit */
417 p_main->p_intf->b_die = 1;
420 case SDLK_f: /* switch to fullscreen */
421 p_vout->i_changes |= VOUT_FULLSCREEN_CHANGE;
424 case SDLK_c: /* toggle grayscale */
425 p_vout->b_grayscale = ! p_vout->b_grayscale;
426 p_vout->i_changes |= VOUT_GRAYSCALE_CHANGE;
429 case SDLK_i: /* toggle info */
430 p_vout->b_info = ! p_vout->b_info;
431 p_vout->i_changes |= VOUT_INFO_CHANGE;
434 case SDLK_s: /* toggle scaling */
435 p_vout->b_scale = ! p_vout->b_scale;
436 p_vout->i_changes |= VOUT_SCALE_CHANGE;
439 case SDLK_SPACE: /* toggle interface */
440 p_vout->b_interface = ! p_vout->b_interface;
441 p_vout->i_changes |= VOUT_INTF_CHANGE;
445 p_main->p_intf->b_menu_change = 1;
464 case SDLK_F10: network_ChannelJoin( 0 ); break;
465 case SDLK_F1: network_ChannelJoin( 1 ); break;
466 case SDLK_F2: network_ChannelJoin( 2 ); break;
467 case SDLK_F3: network_ChannelJoin( 3 ); break;
468 case SDLK_F4: network_ChannelJoin( 4 ); break;
469 case SDLK_F5: network_ChannelJoin( 5 ); break;
470 case SDLK_F6: network_ChannelJoin( 6 ); break;
471 case SDLK_F7: network_ChannelJoin( 7 ); break;
472 case SDLK_F8: network_ChannelJoin( 8 ); break;
473 case SDLK_F9: network_ChannelJoin( 9 ); break;
476 intf_DbgMsg( "unhandled key %i", event.key.keysym.sym );
486 /* Fullscreen change */
487 if( p_vout->i_changes & VOUT_FULLSCREEN_CHANGE )
489 p_vout->b_fullscreen = ! p_vout->b_fullscreen;
491 SDL_WM_ToggleFullScreen(p_vout->p_sys->p_display);
493 p_vout->p_sys->b_cursor_autohidden = 0;
494 SDL_ShowCursor( p_vout->p_sys->b_cursor &&
495 ! p_vout->p_sys->b_cursor_autohidden );
497 p_vout->i_changes &= ~VOUT_FULLSCREEN_CHANGE;
501 if( ! p_vout->p_sys->b_cursor_autohidden &&
502 ( mdate() - p_vout->p_sys->i_lastmoved > 2000000 ) )
504 /* Hide the mouse automatically */
505 p_vout->p_sys->b_cursor_autohidden = 1;
512 /*****************************************************************************
513 * vout_Render: render previously calculated output
514 *****************************************************************************/
515 static void vout_Render( vout_thread_t *p_vout, picture_t *p_pic )
520 /*****************************************************************************
521 * vout_Display: displays previously rendered output
522 *****************************************************************************
523 * This function sends the currently rendered image to the display.
524 *****************************************************************************/
525 static void vout_Display( vout_thread_t *p_vout, picture_t *p_pic )
530 vout_PlacePicture( p_vout, p_vout->p_sys->i_width, p_vout->p_sys->i_height,
537 if( p_vout->p_sys->p_overlay == NULL )
540 SDL_Flip( p_vout->p_sys->p_display );
544 /* Overlay picture */
545 SDL_UnlockYUVOverlay( p_pic->p_sys->p_overlay);
546 SDL_DisplayYUVOverlay( p_pic->p_sys->p_overlay , &disp );
547 SDL_LockYUVOverlay( p_pic->p_sys->p_overlay);
551 /* following functions are local */
553 /*****************************************************************************
554 * SDLOpenDisplay: open and initialize SDL device
555 *****************************************************************************
556 * Open and initialize display according to preferences specified in the vout
558 *****************************************************************************/
559 static int SDLOpenDisplay( vout_thread_t *p_vout )
564 /* Initialize flags and cursor */
565 i_flags = SDL_ANYFORMAT | SDL_HWPALETTE | SDL_HWSURFACE | SDL_DOUBLEBUF;
566 i_flags |= p_vout->b_fullscreen ? SDL_FULLSCREEN : SDL_RESIZABLE;
568 i_bpp = SDL_VideoModeOK( p_vout->p_sys->i_width, p_vout->p_sys->i_height,
569 SDL_DEFAULT_BPP, i_flags );
572 intf_ErrMsg( "vout error: no video mode available" );
576 p_vout->p_sys->p_display = SDL_SetVideoMode( p_vout->p_sys->i_width,
577 p_vout->p_sys->i_height,
580 if( p_vout->p_sys->p_display == NULL )
582 intf_ErrMsg( "vout error: cannot set video mode" );
586 SDL_LockSurface( p_vout->p_sys->p_display );
588 /* Choose the chroma we will try first. */
589 switch( p_vout->render.i_chroma )
593 p_vout->output.i_chroma = SDL_YUY2_OVERLAY;
598 p_vout->output.i_chroma = SDL_UYVY_OVERLAY;
601 p_vout->output.i_chroma = SDL_YVYU_OVERLAY;
607 p_vout->output.i_chroma = SDL_YV12_OVERLAY;
611 p_vout->p_sys->p_overlay =
612 SDL_CreateYUVOverlay( 32, 32, p_vout->output.i_chroma,
613 p_vout->p_sys->p_display );
615 /* FIXME: if the first overlay we find is software, don't stop,
616 * because we may find a hardware one later ... */
618 /* If this best choice failed, fall back to other chromas */
619 if( p_vout->p_sys->p_overlay == NULL )
621 p_vout->output.i_chroma = SDL_IYUV_OVERLAY;
622 p_vout->p_sys->p_overlay =
623 SDL_CreateYUVOverlay( 32, 32, p_vout->output.i_chroma,
624 p_vout->p_sys->p_display );
627 if( p_vout->p_sys->p_overlay == NULL )
629 p_vout->output.i_chroma = SDL_YV12_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_YUY2_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 intf_WarnMsg( 3, "vout warning: no SDL overlay for 0x%.8x (%4.4s)",
646 p_vout->render.i_chroma,
647 (char*)&p_vout->render.i_chroma );
649 switch( p_vout->p_sys->p_display->format->BitsPerPixel )
652 p_vout->output.i_chroma = FOURCC_BI_RGB;
655 p_vout->output.i_chroma = FOURCC_RV15;
658 p_vout->output.i_chroma = FOURCC_RV16;
661 p_vout->output.i_chroma = FOURCC_BI_BITFIELDS;
664 p_vout->output.i_chroma = FOURCC_BI_BITFIELDS;
667 intf_ErrMsg( "vout error: unknown screen depth" );
668 SDL_UnlockSurface( p_vout->p_sys->p_display );
669 SDL_FreeSurface( p_vout->p_sys->p_display );
673 p_vout->p_sys->i_red_mask = p_vout->p_sys->p_display->format->Rmask;
674 p_vout->p_sys->i_green_mask = p_vout->p_sys->p_display->format->Gmask;
675 p_vout->p_sys->i_blue_mask = p_vout->p_sys->p_display->format->Bmask;
677 SDL_WM_SetCaption( VOUT_TITLE " (software RGB SDL output)",
678 VOUT_TITLE " (software RGB SDL output)" );
682 if( p_vout->p_sys->p_overlay->hw_overlay )
684 SDL_WM_SetCaption( VOUT_TITLE " (hardware YUV SDL output)",
685 VOUT_TITLE " (hardware YUV SDL output)" );
689 SDL_WM_SetCaption( VOUT_TITLE " (software YUV SDL output)",
690 VOUT_TITLE " (software YUV SDL output)" );
694 SDL_EventState( SDL_KEYUP, SDL_IGNORE ); /* ignore keys up */
699 /*****************************************************************************
700 * SDLCloseDisplay: close and reset SDL device
701 *****************************************************************************
702 * This function returns all resources allocated by SDLOpenDisplay and restore
703 * the original state of the device.
704 *****************************************************************************/
705 static void SDLCloseDisplay( vout_thread_t *p_vout )
707 SDL_FreeYUVOverlay( p_vout->p_sys->p_overlay );
708 SDL_UnlockSurface ( p_vout->p_sys->p_display );
709 SDL_FreeSurface( p_vout->p_sys->p_display );
712 /*****************************************************************************
713 * SDLNewPicture: allocate a picture
714 *****************************************************************************
715 * Returns 0 on success, -1 otherwise
716 *****************************************************************************/
717 static int SDLNewPicture( vout_thread_t *p_vout, picture_t *p_pic )
719 int i_width = p_vout->output.i_width;
720 int i_height = p_vout->output.i_height;
722 if( p_vout->p_sys->p_overlay == NULL )
725 if( p_vout->p_sys->i_surfaces )
727 /* We already allocated this surface, return */
731 p_pic->p_sys = malloc( sizeof( picture_sys_t ) );
733 if( p_pic->p_sys == NULL )
738 p_pic->p->p_pixels = p_vout->p_sys->p_display->pixels;
739 p_pic->p->i_lines = p_vout->p_sys->p_display->h;
740 p_pic->p->i_pitch = p_vout->p_sys->p_display->pitch;
741 p_pic->p->i_pixel_bytes = 2;
743 if( p_pic->p->i_pitch == 2 * p_vout->p_sys->p_display->w )
745 p_pic->p->b_margin = 0;
749 p_pic->p->b_margin = 1;
750 p_pic->p->b_hidden = 1;
751 p_pic->p->i_visible_bytes = 2 * p_vout->p_sys->p_display->w;
754 p_pic->p->i_red_mask = p_vout->p_sys->p_display->format->Rmask;
755 p_pic->p->i_green_mask = p_vout->p_sys->p_display->format->Gmask;
756 p_pic->p->i_blue_mask = p_vout->p_sys->p_display->format->Bmask;
758 p_vout->p_sys->i_surfaces++;
764 p_pic->p_sys = malloc( sizeof( picture_sys_t ) );
766 if( p_pic->p_sys == NULL )
771 p_pic->p_sys->p_overlay =
772 SDL_CreateYUVOverlay( i_width, i_height,
773 p_vout->output.i_chroma,
774 p_vout->p_sys->p_display );
776 if( p_pic->p_sys->p_overlay == NULL )
778 free( p_pic->p_sys );
782 SDL_LockYUVOverlay( p_pic->p_sys->p_overlay );
784 p_pic->Y_PIXELS = p_pic->p_sys->p_overlay->pixels[0];
785 p_pic->p[Y_PLANE].i_lines = p_pic->p_sys->p_overlay->h;
786 p_pic->p[Y_PLANE].i_pitch = p_pic->p_sys->p_overlay->pitches[0];
788 switch( p_vout->output.i_chroma )
790 case SDL_YV12_OVERLAY:
791 p_pic->p[Y_PLANE].i_pixel_bytes = 1;
792 p_pic->p[Y_PLANE].b_margin = 0;
794 p_pic->U_PIXELS = p_pic->p_sys->p_overlay->pixels[2];
795 p_pic->p[U_PLANE].i_lines = p_pic->p_sys->p_overlay->h / 2;
796 p_pic->p[U_PLANE].i_pitch = p_pic->p_sys->p_overlay->pitches[2];
797 p_pic->p[U_PLANE].i_pixel_bytes = 1;
798 p_pic->p[U_PLANE].b_margin = 0;
800 p_pic->V_PIXELS = p_pic->p_sys->p_overlay->pixels[1];
801 p_pic->p[V_PLANE].i_lines = p_pic->p_sys->p_overlay->h / 2;
802 p_pic->p[V_PLANE].i_pitch = p_pic->p_sys->p_overlay->pitches[1];
803 p_pic->p[V_PLANE].i_pixel_bytes = 1;
804 p_pic->p[V_PLANE].b_margin = 0;
809 case SDL_IYUV_OVERLAY:
810 p_pic->p[Y_PLANE].i_pixel_bytes = 1;
811 p_pic->p[Y_PLANE].b_margin = 0;
813 p_pic->U_PIXELS = p_pic->p_sys->p_overlay->pixels[1];
814 p_pic->p[U_PLANE].i_lines = p_pic->p_sys->p_overlay->h / 2;
815 p_pic->p[U_PLANE].i_pitch = p_pic->p_sys->p_overlay->pitches[1];
816 p_pic->p[U_PLANE].i_pixel_bytes = 1;
817 p_pic->p[U_PLANE].b_margin = 0;
819 p_pic->V_PIXELS = p_pic->p_sys->p_overlay->pixels[2];
820 p_pic->p[V_PLANE].i_lines = p_pic->p_sys->p_overlay->h / 2;
821 p_pic->p[V_PLANE].i_pitch = p_pic->p_sys->p_overlay->pitches[2];
822 p_pic->p[V_PLANE].i_pixel_bytes = 1;
823 p_pic->p[V_PLANE].b_margin = 0;
829 p_pic->p[Y_PLANE].i_pixel_bytes = 2;
830 p_pic->p[Y_PLANE].b_margin = 0;