static void win32_update_frame_format( vo_driver_t * vo_driver, vo_frame_t * vo_frame, uint32_t width, uint32_t height, double ratio, int format, int flags ) { win32_driver_t * win32_driver = ( win32_driver_t * ) vo_driver; win32_frame_t * win32_frame = ( win32_frame_t * ) vo_frame; /*printf("vo_out_directx : win32_update_frame_format() - width = %d, height=%d, ratio_code=%d, format=%d, flags=%d\n", width, height, ratio_code, format, flags);*/ if( ( win32_frame->format != format ) || ( win32_frame->width != width ) || ( win32_frame->height != height ) ) { // free our allocated memory win32_free_framedata((vo_frame_t *)&win32_frame->vo_frame); // create new render buffer if( format == XINE_IMGFMT_YV12 ) { win32_frame->vo_frame.pitches[0] = 8*((width + 7) / 8); win32_frame->vo_frame.pitches[1] = 8*((width + 15) / 16); win32_frame->vo_frame.pitches[2] = 8*((width + 15) / 16); win32_frame->vo_frame.base[0] = malloc(win32_frame->vo_frame.pitches[0] * height); win32_frame->vo_frame.base[1] = malloc(win32_frame->vo_frame.pitches[1] * ((height+1)/2)); win32_frame->vo_frame.base[2] = malloc(win32_frame->vo_frame.pitches[2] * ((height+1)/2)); win32_frame->size = win32_frame->vo_frame.pitches[0] * height * 2; } else if( format == XINE_IMGFMT_YUY2 ) { win32_frame->vo_frame.pitches[0] = 8*((width + 3) / 4); win32_frame->vo_frame.base[0] = malloc(win32_frame->vo_frame.pitches[0] * height * 2); win32_frame->vo_frame.base[1] = NULL; win32_frame->vo_frame.base[2] = NULL; win32_frame->size = win32_frame->vo_frame.pitches[0] * height * 2; } #if RGB_SUPPORT else if( format == IMGFMT_RGB ) { win32_frame->size = width * height * 3; win32_frame->buffer = malloc( win32_frame->size ); vo_frame->base[0] = win32_frame->buffer; } #endif else { printf ( "vo_out_directx : !!! unsupported image format %04x !!!\n", format ); exit (1); } win32_frame->format = format; win32_frame->width = width; win32_frame->height = height; win32_frame->ratio = ratio; } }
static void win32_frame_dispose( vo_frame_t * vo_frame ) { win32_frame_t * win32_frame = ( win32_frame_t * ) vo_frame; free(win32_frame->buffer); win32_free_framedata(vo_frame); free( win32_frame ); }