1 /*****************************************************************************
2 * vout_sdl.c: SDL video output display method
3 *****************************************************************************
4 * Copyright (C) 1998-2001 VideoLAN
5 * $Id: vout_sdl.c,v 1.79 2002/01/07 02:12:29 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 )
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_Probe ( probedata_t *p_data );
124 static int vout_Create ( struct vout_thread_s * );
125 static int vout_Init ( struct vout_thread_s * );
126 static void vout_End ( struct vout_thread_s * );
127 static void vout_Destroy ( struct vout_thread_s * );
128 static int vout_Manage ( struct vout_thread_s * );
129 static void vout_Render ( struct vout_thread_s *, struct picture_s * );
130 static void vout_Display ( struct vout_thread_s *, struct picture_s * );
132 static int SDLOpenDisplay ( vout_thread_t *p_vout );
133 static void SDLCloseDisplay ( vout_thread_t *p_vout );
134 static int SDLNewPicture ( vout_thread_t *p_vout, picture_t *p_pic );
136 /*****************************************************************************
137 * Functions exported as capabilities. They are declared as static so that
138 * we don't pollute the namespace too much.
139 *****************************************************************************/
140 void _M( vout_getfunctions )( function_list_t * p_function_list )
142 p_function_list->pf_probe = vout_Probe;
143 p_function_list->functions.vout.pf_create = vout_Create;
144 p_function_list->functions.vout.pf_init = vout_Init;
145 p_function_list->functions.vout.pf_end = vout_End;
146 p_function_list->functions.vout.pf_destroy = vout_Destroy;
147 p_function_list->functions.vout.pf_manage = vout_Manage;
148 p_function_list->functions.vout.pf_render = vout_Render;
149 p_function_list->functions.vout.pf_display = vout_Display;
152 /*****************************************************************************
153 * vout_Probe: probe the video driver and return a score
154 *****************************************************************************
155 * This function tries to initialize SDL and returns a score to the
156 * plugin manager so that it can select the best plugin.
157 *****************************************************************************/
158 static int vout_Probe( probedata_t *p_data )
160 if( SDL_WasInit( SDL_INIT_VIDEO ) != 0 )
168 /*****************************************************************************
169 * vout_Create: allocate SDL video thread output method
170 *****************************************************************************
171 * This function allocate and initialize a SDL vout method. It uses some of the
172 * vout properties to choose the correct mode, and change them according to the
173 * mode actually used.
174 *****************************************************************************/
175 static int vout_Create( vout_thread_t *p_vout )
177 if( SDL_WasInit( SDL_INIT_VIDEO ) != 0 )
182 /* Allocate structure */
183 p_vout->p_sys = malloc( sizeof( vout_sys_t ) );
184 if( p_vout->p_sys == NULL )
186 intf_ErrMsg( "vout error: can't create p_sys (%s)", strerror(ENOMEM) );
190 /* Initialize library */
191 if( SDL_Init( SDL_INIT_VIDEO
193 /* Win32 SDL implementation doesn't support SDL_INIT_EVENTTHREAD yet*/
194 | SDL_INIT_EVENTTHREAD
197 /* In debug mode you may want vlc to dump a core instead of staying
199 | SDL_INIT_NOPARACHUTE
203 intf_ErrMsg( "vout error: can't initialize SDL (%s)", SDL_GetError() );
204 free( p_vout->p_sys );
208 p_vout->p_sys->b_cursor = 1;
209 p_vout->p_sys->b_cursor_autohidden = 0;
210 p_vout->p_sys->i_lastmoved = mdate();
212 if( p_vout->render.i_height * p_vout->render.i_aspect
213 >= p_vout->render.i_width * VOUT_ASPECT_FACTOR )
215 p_vout->p_sys->i_width = p_vout->render.i_height
216 * p_vout->render.i_aspect / VOUT_ASPECT_FACTOR;
217 p_vout->p_sys->i_height = p_vout->render.i_height;
221 p_vout->p_sys->i_width = p_vout->render.i_width;
222 p_vout->p_sys->i_height = p_vout->render.i_width
223 * VOUT_ASPECT_FACTOR / p_vout->render.i_aspect;
227 if( p_vout->p_sys->i_width <= 300 && p_vout->p_sys->i_height <= 300 )
229 p_vout->p_sys->i_width <<= 1;
230 p_vout->p_sys->i_height <<= 1;
232 else if( p_vout->p_sys->i_width <= 400 && p_vout->p_sys->i_height <= 400 )
234 p_vout->p_sys->i_width += p_vout->p_sys->i_width >> 1;
235 p_vout->p_sys->i_height += p_vout->p_sys->i_height >> 1;
239 if( SDLOpenDisplay( p_vout ) )
241 intf_ErrMsg( "vout error: can't set up SDL (%s)", SDL_GetError() );
242 SDL_QuitSubSystem( SDL_INIT_VIDEO );
243 free( p_vout->p_sys );
250 /*****************************************************************************
251 * vout_Init: initialize SDL video thread output method
252 *****************************************************************************
253 * This function initialize the SDL display device.
254 *****************************************************************************/
255 static int vout_Init( vout_thread_t *p_vout )
260 p_vout->p_sys->i_surfaces = 0;
262 I_OUTPUTPICTURES = 0;
264 /* Initialize the output structure */
265 if( p_vout->p_sys->p_overlay == NULL )
267 /* All we have is an RGB image with square pixels */
268 p_vout->output.i_width = p_vout->p_sys->i_width;
269 p_vout->output.i_height = p_vout->p_sys->i_height;
270 p_vout->output.i_aspect = p_vout->p_sys->i_width
272 / p_vout->p_sys->i_height;
276 /* We may need to convert the chroma, but at least we keep the
278 p_vout->output.i_width = p_vout->render.i_width;
279 p_vout->output.i_height = p_vout->render.i_height;
280 p_vout->output.i_aspect = p_vout->render.i_aspect;
283 /* Try to initialize SDL_MAX_DIRECTBUFFERS direct buffers */
284 while( I_OUTPUTPICTURES < SDL_MAX_DIRECTBUFFERS )
288 /* Find an empty picture slot */
289 for( i_index = 0 ; i_index < VOUT_MAX_PICTURES ; i_index++ )
291 if( p_vout->p_picture[ i_index ].i_status == FREE_PICTURE )
293 p_pic = p_vout->p_picture + i_index;
298 /* Allocate the picture if we found one */
299 if( p_pic == NULL || SDLNewPicture( p_vout, p_pic ) )
304 p_pic->i_status = DESTROYED_PICTURE;
305 p_pic->i_type = DIRECT_PICTURE;
307 PP_OUTPUTPICTURE[ I_OUTPUTPICTURES ] = p_pic;
315 /*****************************************************************************
316 * vout_End: terminate Sys video thread output method
317 *****************************************************************************
318 * Terminate an output method created by vout_SDLCreate
319 *****************************************************************************/
320 static void vout_End( vout_thread_t *p_vout )
324 /* Free the output buffers we allocated */
325 for( i_index = I_OUTPUTPICTURES ; i_index ; )
328 if( p_vout->p_sys->p_overlay == NULL )
334 SDL_UnlockYUVOverlay(
335 PP_OUTPUTPICTURE[ i_index ]->p_sys->p_overlay );
337 PP_OUTPUTPICTURE[ i_index ]->p_sys->p_overlay );
339 free( PP_OUTPUTPICTURE[ i_index ]->p_sys );
343 /*****************************************************************************
344 * vout_Destroy: destroy Sys video thread output method
345 *****************************************************************************
346 * Terminate an output method created by vout_SDLCreate
347 *****************************************************************************/
348 static void vout_Destroy( vout_thread_t *p_vout )
350 SDLCloseDisplay( p_vout );
352 SDL_QuitSubSystem( SDL_INIT_VIDEO );
354 free( p_vout->p_sys );
357 /*****************************************************************************
358 * vout_Manage: handle Sys events
359 *****************************************************************************
360 * This function should be called regularly by video output thread. It returns
361 * a non null value if an error occured.
362 *****************************************************************************/
363 static int vout_Manage( vout_thread_t *p_vout )
365 SDL_Event event; /* SDL event */
368 while( SDL_PollEvent(&event) )
372 case SDL_VIDEORESIZE: /* Resizing of window */
373 p_vout->p_sys->i_width = event.resize.w;
374 p_vout->p_sys->i_height = event.resize.h;
375 SDLCloseDisplay( p_vout );
376 SDLOpenDisplay( p_vout );
379 case SDL_MOUSEMOTION:
380 if( p_vout->p_sys->b_cursor &&
381 (abs(event.motion.xrel) > 2 || abs(event.motion.yrel) > 2) )
383 if( p_vout->p_sys->b_cursor_autohidden )
385 p_vout->p_sys->b_cursor_autohidden = 0;
390 p_vout->p_sys->i_lastmoved = mdate();
395 case SDL_MOUSEBUTTONUP:
396 switch( event.button.button )
398 case SDL_BUTTON_RIGHT:
399 p_main->p_intf->b_menu_change = 1;
404 case SDL_MOUSEBUTTONDOWN:
405 switch( event.button.button )
407 case SDL_BUTTON_LEFT:
408 /* In this part we will eventually manage
409 * clicks for DVD navigation for instance. For the
410 * moment just pause the stream. */
411 input_SetStatus( p_input_bank->pp_input[0],
412 INPUT_STATUS_PAUSE );
426 p_main->p_intf->b_die = 1;
429 case SDL_KEYDOWN: /* if a key is pressed */
431 switch( event.key.keysym.sym )
433 case SDLK_q: /* quit */
435 p_main->p_intf->b_die = 1;
438 case SDLK_f: /* switch to fullscreen */
439 p_vout->i_changes |= VOUT_FULLSCREEN_CHANGE;
442 case SDLK_c: /* toggle grayscale */
443 p_vout->b_grayscale = ! p_vout->b_grayscale;
444 p_vout->i_changes |= VOUT_GRAYSCALE_CHANGE;
447 case SDLK_i: /* toggle info */
448 p_vout->b_info = ! p_vout->b_info;
449 p_vout->i_changes |= VOUT_INFO_CHANGE;
452 case SDLK_s: /* toggle scaling */
453 p_vout->b_scale = ! p_vout->b_scale;
454 p_vout->i_changes |= VOUT_SCALE_CHANGE;
457 case SDLK_SPACE: /* toggle interface */
458 p_vout->b_interface = ! p_vout->b_interface;
459 p_vout->i_changes |= VOUT_INTF_CHANGE;
463 p_main->p_intf->b_menu_change = 1;
482 case SDLK_F10: network_ChannelJoin( 0 ); break;
483 case SDLK_F1: network_ChannelJoin( 1 ); break;
484 case SDLK_F2: network_ChannelJoin( 2 ); break;
485 case SDLK_F3: network_ChannelJoin( 3 ); break;
486 case SDLK_F4: network_ChannelJoin( 4 ); break;
487 case SDLK_F5: network_ChannelJoin( 5 ); break;
488 case SDLK_F6: network_ChannelJoin( 6 ); break;
489 case SDLK_F7: network_ChannelJoin( 7 ); break;
490 case SDLK_F8: network_ChannelJoin( 8 ); break;
491 case SDLK_F9: network_ChannelJoin( 9 ); break;
494 intf_DbgMsg( "unhandled key %i", event.key.keysym.sym );
504 /* Fullscreen change */
505 if( p_vout->i_changes & VOUT_FULLSCREEN_CHANGE )
507 p_vout->b_fullscreen = ! p_vout->b_fullscreen;
509 SDL_WM_ToggleFullScreen(p_vout->p_sys->p_display);
511 p_vout->p_sys->b_cursor_autohidden = 0;
512 SDL_ShowCursor( p_vout->p_sys->b_cursor &&
513 ! p_vout->p_sys->b_cursor_autohidden );
515 p_vout->i_changes &= ~VOUT_FULLSCREEN_CHANGE;
519 if( ! p_vout->p_sys->b_cursor_autohidden &&
520 ( mdate() - p_vout->p_sys->i_lastmoved > 2000000 ) )
522 /* Hide the mouse automatically */
523 p_vout->p_sys->b_cursor_autohidden = 1;
530 /*****************************************************************************
531 * vout_Render: render previously calculated output
532 *****************************************************************************/
533 static void vout_Render( vout_thread_t *p_vout, picture_t *p_pic )
538 /*****************************************************************************
539 * vout_Display: displays previously rendered output
540 *****************************************************************************
541 * This function sends the currently rendered image to the display.
542 *****************************************************************************/
543 static void vout_Display( vout_thread_t *p_vout, picture_t *p_pic )
548 vout_PlacePicture( p_vout, p_vout->p_sys->i_width, p_vout->p_sys->i_height,
555 if( p_vout->p_sys->p_overlay == NULL )
558 SDL_Flip( p_vout->p_sys->p_display );
562 /* Overlay picture */
563 SDL_UnlockYUVOverlay( p_pic->p_sys->p_overlay);
564 SDL_DisplayYUVOverlay( p_pic->p_sys->p_overlay , &disp );
565 SDL_LockYUVOverlay( p_pic->p_sys->p_overlay);
569 /* following functions are local */
571 /*****************************************************************************
572 * SDLOpenDisplay: open and initialize SDL device
573 *****************************************************************************
574 * Open and initialize display according to preferences specified in the vout
576 *****************************************************************************/
577 static int SDLOpenDisplay( vout_thread_t *p_vout )
582 /* Initialize flags and cursor */
583 i_flags = SDL_ANYFORMAT | SDL_HWPALETTE | SDL_HWSURFACE | SDL_DOUBLEBUF;
584 i_flags |= p_vout->b_fullscreen ? SDL_FULLSCREEN : SDL_RESIZABLE;
586 i_bpp = SDL_VideoModeOK( p_vout->p_sys->i_width, p_vout->p_sys->i_height,
587 SDL_DEFAULT_BPP, i_flags );
590 intf_ErrMsg( "vout error: no video mode available" );
594 p_vout->p_sys->p_display = SDL_SetVideoMode( p_vout->p_sys->i_width,
595 p_vout->p_sys->i_height,
598 if( p_vout->p_sys->p_display == NULL )
600 intf_ErrMsg( "vout error: cannot set video mode" );
604 SDL_LockSurface( p_vout->p_sys->p_display );
606 /* Choose the chroma we will try first. */
607 switch( p_vout->render.i_chroma )
611 p_vout->output.i_chroma = SDL_YUY2_OVERLAY;
616 p_vout->output.i_chroma = SDL_UYVY_OVERLAY;
619 p_vout->output.i_chroma = SDL_YVYU_OVERLAY;
625 p_vout->output.i_chroma = SDL_YV12_OVERLAY;
629 p_vout->p_sys->p_overlay =
630 SDL_CreateYUVOverlay( 32, 32, p_vout->output.i_chroma,
631 p_vout->p_sys->p_display );
633 /* FIXME: if the first overlay we find is software, don't stop,
634 * because we may find a hardware one later ... */
636 /* If this best choice failed, fall back to other chromas */
637 if( p_vout->p_sys->p_overlay == NULL )
639 p_vout->output.i_chroma = SDL_IYUV_OVERLAY;
640 p_vout->p_sys->p_overlay =
641 SDL_CreateYUVOverlay( 32, 32, p_vout->output.i_chroma,
642 p_vout->p_sys->p_display );
645 if( p_vout->p_sys->p_overlay == NULL )
647 p_vout->output.i_chroma = SDL_YV12_OVERLAY;
648 p_vout->p_sys->p_overlay =
649 SDL_CreateYUVOverlay( 32, 32, p_vout->output.i_chroma,
650 p_vout->p_sys->p_display );
653 if( p_vout->p_sys->p_overlay == NULL )
655 p_vout->output.i_chroma = SDL_YUY2_OVERLAY;
656 p_vout->p_sys->p_overlay =
657 SDL_CreateYUVOverlay( 32, 32, p_vout->output.i_chroma,
658 p_vout->p_sys->p_display );
661 if( p_vout->p_sys->p_overlay == NULL )
663 intf_WarnMsg( 3, "vout warning: no SDL overlay for 0x%.8x (%4.4s)",
664 p_vout->render.i_chroma,
665 (char*)&p_vout->render.i_chroma );
667 switch( p_vout->p_sys->p_display->format->BitsPerPixel )
670 p_vout->output.i_chroma = FOURCC_BI_RGB;
673 p_vout->output.i_chroma = FOURCC_RV15;
676 p_vout->output.i_chroma = FOURCC_RV16;
679 p_vout->output.i_chroma = FOURCC_BI_BITFIELDS;
682 p_vout->output.i_chroma = FOURCC_BI_BITFIELDS;
685 intf_ErrMsg( "vout error: unknown screen depth" );
686 SDL_UnlockSurface( p_vout->p_sys->p_display );
687 SDL_FreeSurface( p_vout->p_sys->p_display );
691 p_vout->p_sys->i_red_mask = p_vout->p_sys->p_display->format->Rmask;
692 p_vout->p_sys->i_green_mask = p_vout->p_sys->p_display->format->Gmask;
693 p_vout->p_sys->i_blue_mask = p_vout->p_sys->p_display->format->Bmask;
695 SDL_WM_SetCaption( VOUT_TITLE " (software RGB SDL output)",
696 VOUT_TITLE " (software RGB SDL output)" );
700 if( p_vout->p_sys->p_overlay->hw_overlay )
702 SDL_WM_SetCaption( VOUT_TITLE " (hardware YUV SDL output)",
703 VOUT_TITLE " (hardware YUV SDL output)" );
707 SDL_WM_SetCaption( VOUT_TITLE " (software YUV SDL output)",
708 VOUT_TITLE " (software YUV SDL output)" );
712 SDL_EventState( SDL_KEYUP, SDL_IGNORE ); /* ignore keys up */
717 /*****************************************************************************
718 * SDLCloseDisplay: close and reset SDL device
719 *****************************************************************************
720 * This function returns all resources allocated by SDLOpenDisplay and restore
721 * the original state of the device.
722 *****************************************************************************/
723 static void SDLCloseDisplay( vout_thread_t *p_vout )
725 SDL_FreeYUVOverlay( p_vout->p_sys->p_overlay );
726 SDL_UnlockSurface ( p_vout->p_sys->p_display );
727 SDL_FreeSurface( p_vout->p_sys->p_display );
730 /*****************************************************************************
731 * SDLNewPicture: allocate a picture
732 *****************************************************************************
733 * Returns 0 on success, -1 otherwise
734 *****************************************************************************/
735 static int SDLNewPicture( vout_thread_t *p_vout, picture_t *p_pic )
737 int i_width = p_vout->output.i_width;
738 int i_height = p_vout->output.i_height;
740 if( p_vout->p_sys->p_overlay == NULL )
743 if( p_vout->p_sys->i_surfaces )
745 /* We already allocated this surface, return */
749 p_pic->p_sys = malloc( sizeof( picture_sys_t ) );
751 if( p_pic->p_sys == NULL )
756 p_pic->p->p_pixels = p_vout->p_sys->p_display->pixels;
757 p_pic->p->i_lines = p_vout->p_sys->p_display->h;
758 p_pic->p->i_pitch = p_vout->p_sys->p_display->pitch;
759 p_pic->p->i_pixel_bytes = 2;
761 if( p_pic->p->i_pitch == 2 * p_vout->p_sys->p_display->w )
763 p_pic->p->b_margin = 0;
767 p_pic->p->b_margin = 1;
768 p_pic->p->b_hidden = 1;
769 p_pic->p->i_visible_bytes = 2 * p_vout->p_sys->p_display->w;
772 p_pic->p->i_red_mask = p_vout->p_sys->p_display->format->Rmask;
773 p_pic->p->i_green_mask = p_vout->p_sys->p_display->format->Gmask;
774 p_pic->p->i_blue_mask = p_vout->p_sys->p_display->format->Bmask;
776 p_vout->p_sys->i_surfaces++;
782 p_pic->p_sys = malloc( sizeof( picture_sys_t ) );
784 if( p_pic->p_sys == NULL )
789 p_pic->p_sys->p_overlay =
790 SDL_CreateYUVOverlay( i_width, i_height,
791 p_vout->output.i_chroma,
792 p_vout->p_sys->p_display );
794 if( p_pic->p_sys->p_overlay == NULL )
796 free( p_pic->p_sys );
800 SDL_LockYUVOverlay( p_pic->p_sys->p_overlay );
802 p_pic->Y_PIXELS = p_pic->p_sys->p_overlay->pixels[0];
803 p_pic->p[Y_PLANE].i_lines = p_pic->p_sys->p_overlay->h;
804 p_pic->p[Y_PLANE].i_pitch = p_pic->p_sys->p_overlay->pitches[0];
806 switch( p_vout->output.i_chroma )
808 case SDL_YV12_OVERLAY:
809 p_pic->p[Y_PLANE].i_pixel_bytes = 1;
810 p_pic->p[Y_PLANE].b_margin = 0;
812 p_pic->U_PIXELS = p_pic->p_sys->p_overlay->pixels[2];
813 p_pic->p[U_PLANE].i_lines = p_pic->p_sys->p_overlay->h / 2;
814 p_pic->p[U_PLANE].i_pitch = p_pic->p_sys->p_overlay->pitches[2];
815 p_pic->p[U_PLANE].i_pixel_bytes = 1;
816 p_pic->p[U_PLANE].b_margin = 0;
818 p_pic->V_PIXELS = p_pic->p_sys->p_overlay->pixels[1];
819 p_pic->p[V_PLANE].i_lines = p_pic->p_sys->p_overlay->h / 2;
820 p_pic->p[V_PLANE].i_pitch = p_pic->p_sys->p_overlay->pitches[1];
821 p_pic->p[V_PLANE].i_pixel_bytes = 1;
822 p_pic->p[V_PLANE].b_margin = 0;
827 case SDL_IYUV_OVERLAY:
828 p_pic->p[Y_PLANE].i_pixel_bytes = 1;
829 p_pic->p[Y_PLANE].b_margin = 0;
831 p_pic->U_PIXELS = p_pic->p_sys->p_overlay->pixels[1];
832 p_pic->p[U_PLANE].i_lines = p_pic->p_sys->p_overlay->h / 2;
833 p_pic->p[U_PLANE].i_pitch = p_pic->p_sys->p_overlay->pitches[1];
834 p_pic->p[U_PLANE].i_pixel_bytes = 1;
835 p_pic->p[U_PLANE].b_margin = 0;
837 p_pic->V_PIXELS = p_pic->p_sys->p_overlay->pixels[2];
838 p_pic->p[V_PLANE].i_lines = p_pic->p_sys->p_overlay->h / 2;
839 p_pic->p[V_PLANE].i_pitch = p_pic->p_sys->p_overlay->pitches[2];
840 p_pic->p[V_PLANE].i_pixel_bytes = 1;
841 p_pic->p[V_PLANE].b_margin = 0;
847 p_pic->p[Y_PLANE].i_pixel_bytes = 2;
848 p_pic->p[Y_PLANE].b_margin = 0;