Index: Makefile =================================================================== --- Makefile (revision 29136) +++ Makefile (working copy) @@ -553,6 +553,7 @@ SRCS_MPLAYER-$(DXR3) += libvo/vo_dxr3.c SRCS_MPLAYER-$(ESD) += libao2/ao_esd.c SRCS_MPLAYER-$(FBDEV) += libvo/vo_fbdev.c libvo/vo_fbdev2.c +SRCS_MPLAYER-$(PS3) += libvo/vo_ps3.c SRCS_MPLAYER-$(GGI) += libvo/vo_ggi.c SRCS_MPLAYER-$(GIF) += libvo/vo_gif89a.c SRCS_MPLAYER-$(GL) += libvo/gl_common.c libvo/vo_gl.c libvo/vo_gl2.c Index: libvo/video_out.c =================================================================== --- libvo/video_out.c (revision 29136) +++ libvo/video_out.c (working copy) @@ -114,6 +114,7 @@ extern vo_functions_t video_out_directx; extern vo_functions_t video_out_kva; extern vo_functions_t video_out_dxr2; +extern vo_functions_t video_out_ps3; extern vo_functions_t video_out_dxr3; extern vo_functions_t video_out_ivtv; extern vo_functions_t video_out_v4l2; @@ -201,6 +202,9 @@ &video_out_fbdev, &video_out_fbdev2, #endif +#ifdef CONFIG_PS3 + &video_out_ps3, +#endif #ifdef CONFIG_SVGALIB &video_out_svga, #endif Index: libvo/vo_ps3.c =================================================================== --- libvo/vo_ps3.c (revision 0) +++ libvo/vo_ps3.c (revision 0) @@ -0,0 +1,912 @@ +/* vo_ps3.c - video out interface utilizing spu-medialib +* to offload scaling and yuv2rgb colorspace +* conversion to the PS3's SPEs: +* http://wiki.ps2dev.org/ps3:spu-medialib +* +* This is very experimental code which is not ready for +* public consumption. Many todo:'s remain, and +* many more mistakes still need to be corrected. +* +* Distributed AS IS. Use at your own risk. Author is not liable +* in any way for any use, misuse, nonuse, expectation, failed +* expectation, problem, or anything else. +* +* Notes: +* needs to do direct rendering but enables it automatically +* don't need -dr flag +* +* needs to double buffer - also automatic (no -double needed) +* +* doesn't do windows - takes over framebuffer for now +* +* h264 issues: +* video currently doesn't "direct render" unless u post process +* with -vf pp or something +* broken on PS3 (regardless of vo) - too slow & audio strange +* using -demuxer 35 -lavdopts fast:threads=2 will provide +* improvement once ffmpeg uses threads for x264. Now it's too slow +* try with -vo null and still broken ( see, it's not vo's fault : ) ) +* +* configure now autodetects spu-medialib and enables vo_ps3 +* +* use -vo ps3:snapshot to save current buffers in a .yuv file on pause +* +* make normally ( ./configure; make && make install ) +* +* Usage: +* $ ps3videomode -v 5 -f +* $ mplayer -vo ps3 /lost/video/watch-ppu-usage.mpg +* +* +* Bugs ( known ) : +* Non direct rendered video is broken - on todo list +* Lots more! : ) +* +* Original version: Copyright 2007 by Bill Garrett ( wgarrett@sc.rr.com ) +* +* Modified version: Copyright 2009 by Kristian Jerpetjøn aka unsolo +* ( kristian.jerpetjoen@gmail.com) +* +* Credits: +* Many thanks to the creators & contributors of spu-medialib +* and especially to unsolo - a tireless genius who made all this +* possible. +* +* Thanks also to _Demo_, jbit, and nomego for advice & testing, and +* access to nomego's 32UL ps3! ;) +* +* Changelog: +* 12/22/2007 kristian jerpetjøn +* no longer double buffer frame buffer to accomodate 2.6.24 +* now setting console graphics mode & text on exit (root only) - screen blanking issue +* begining removal of libps3fb dependency +* 04/03/2009 kristian jerpetjøn +* removed dependency to libps3fb +* removed ebugging code +* fixed indentation +* removed dead code +* removed prototypes +*/ + +#include +#include +#include +#include +#include + +#include + +#include "config.h" +#include "mplayer.h" +#include "aspect.h" +#include "mp_msg.h" +#include "help_mp.h" +#include "video_out.h" +#include "video_out_internal.h" +#include "subopt-helper.h" +#include "fastmemcpy.h" +#include "osd.h" +#include "sub.h" + +#if HAVE_MALLOC_H +#include +#endif + +#include +#include + +#include +#include +#include +#include +#include +#include + +#define NUM_BUFFERS 2 +#define FB_DEV "/dev/fb0" +#define CONSOLE "/dev/tty" +#define FALLBACK "/dev/console" + +static vo_info_t info = +{ + "PS3 framebuffer w/ spe offload courtesy of spu_medialib (https://sourceforge.net/projects/spu-medialib)", + "ps3", + "Bill Garrett ", + "Kristian Jerpetjøn vo_screenwidth ) || ( dstH > vo_screenheight ) || vo_fs ) + { + if ( my_aspect <= fb_aspect ) //height is limiting factor + { + dstH = vo_screenheight; + dstW = dstH*my_aspect; + } + else //width is limiting + { + dstW = vo_screenwidth; + dstH = dstW/my_aspect; + } + } + mp_msg ( MSGT_VO, MSGL_INFO, "[vo_ps3] setup_scale: Using dest WxH:%ix%i\n", dstW, dstH ); +} + + +/* yuvcsc_check - check spu_yuv2argb_scaler process + * make sure it's ready to run, and if not wait + */ +static void yuvcsc_check() +{ + + if ( wait_yuvcsc ) //make sure last run finished + { + + yuvcsc_msg = yuvscsc_receive_message ( yuvcsc ); //get status + + while ( yuvcsc_msg != RDY ) + { + yuvcsc_not_ready++; //*shouldn't* get here + mp_msg ( MSGT_VO, MSGL_WARN, "[vo_ps3] yuvcsc_check: ***yuvcsc not ready to run! :(\n" ); + yuvcsc_msg = yuvscsc_receive_message ( yuvcsc ); + } + wait_yuvcsc = 0; + } +} + +static void draw_alpha ( int x0, int y0, int w, int h, unsigned char* src, + unsigned char *srca, int stride ) +{ + switch ( src_fmt ) + { + case IMGFMT_I420: //Planar I420 0x30323449 + case IMGFMT_YV12: //Planar YV12 0x32315659 + case IMGFMT_IYUV: //Planar IYUV 0x56555949 + vo_draw_alpha_yv12 ( w, h, src, srca, stride, + buf_plane_ptr[0] + ( y0 * src_stride[0] + x0 ), src_stride[0] ); + } +} + +static void clear() +{ + + int i; + + mp_msg ( MSGT_VO, MSGL_INFO, "[vo_ps3] clear: Clearing buffers\n" ); + + for ( i=0; iwidth, mpi->height, mpi->x, mpi->y, mpi->w, mpi->h, + mpi->stride[0], mpi->stride[1], mpi->stride[2], + mpi->chroma_width, mpi->chroma_height, mpi->bpp, + mpi->planes[0], mpi->planes[1], mpi->planes[2], + mpi->imgfmt, mpi->type, mpi->pict_type, mpi->flags, mpi->priv, + mpi->flags & MP_IMGFLAG_PRESERVE, mpi->flags & MP_IMGFLAG_READABLE, + mpi->flags & MP_IMGFLAG_DIRECT, mpi->flags & MP_IMGFLAG_DRAW_CALLBACK ); +} + +static void buf_info() +{ + + mp_msg ( MSGT_VO, MSGL_INFO, "[vo_ps3] buffer info:\n" + " page=%i, inbuf_{y,u,v}[0]={%p,%p,%p}, inbuf_{y,u,v}[1]={%p,%p,%p}\n" + " parking_lot_page=%i, parking_lot_{y,u,v}[0]={%p,%p,%p}, parking_lot_{y,u,v}[1]={%p,%p,%p}\n" + " buf_plane_ptr[]={%p,%p,%p}\n", + page, inbuf_y[0], inbuf_u[0], inbuf_v[0], inbuf_y[1], inbuf_u[1], inbuf_v[1], + parking_lot_page, + parking_lot_y[0], parking_lot_u[0], parking_lot_v[0], + parking_lot_y[1], parking_lot_u[1], parking_lot_v[1], + buf_plane_ptr[0], buf_plane_ptr[1], buf_plane_ptr[2] ); +} + +static void init_spu_medialib() +{ + + //init spu-medialib's scaler & colorspace converter on an spe + yuvcsc = yuvscsc_init_yuv2argb_scaler ( srcW, srcH, dstW, dstH, offset, maxW, + ( ea_t * ) inbuf_y[0], ( ea_t * ) inbuf_y[1], + ( ea_t * ) inbuf_u[0], ( ea_t * ) inbuf_u[1], + ( ea_t * ) inbuf_v[0], ( ea_t * ) inbuf_v[1], + fb_buf0, fb_buf0 ); + + mp_msg ( MSGT_VO, MSGL_INFO, "[vo_ps3] init_spu_medialib: Initialized spu-medialib's spu_yuv2argb_scaler with:\n %ix%i=>%ix%i, offset:%i, maxW:%i\n", srcW, srcH, dstW, dstH, offset, maxW ); +} + +static void update_spu_medialib() +{ + yuvscsc_set_srcW ( yuvcsc, srcW ); + yuvscsc_set_srcH ( yuvcsc, srcH ); + yuvscsc_set_dstW ( yuvcsc, dstW ); + yuvscsc_set_dstH ( yuvcsc, dstH ); + yuvscsc_set_offset ( yuvcsc, offset ); + yuvscsc_set_maxwidth ( yuvcsc, maxW ); + yuvscsc_send_message ( yuvcsc,UPDATE ); +} + +/* yuvcsc_run - time to put the image on the back framebuffer + * + * + */ +static void yuvcsc_run() +{ + + yuvcsc_check(); //confirm last run finished + + wait_yuvcsc = 1; + + yuvscsc_send_message ( yuvcsc, RUN ); +} + +static void cleanup_spu_medialib() +{ + + yuvcsc_check(); + + yuvscsc_destroy ( yuvcsc ); + + mp_msg ( MSGT_VO, MSGL_INFO, "[vo_ps3] cleanup_spu_medialib: Destroyed spu-medialib's scaler/converter\n" ); +} + +static void setup_screen() +{ + + vo_dx = vo_dy = 0; + vo_screenwidth=fbW - ( fbX*2 ); + vo_screenheight=fbH - ( fbY*2 ); + + setup_scale(); + + //set aspect stuff + aspect_save_orig ( srcW, srcH ); + aspect_save_screenres ( vo_screenwidth, vo_screenheight ); + aspect_save_prescale ( dstW, dstH ); + + geometry ( &vo_dx, &vo_dy, &dstW, &dstH, vo_screenwidth, vo_screenheight ); + aspect ( &dstW, &dstH, A_NOZOOM ); + my_aspect = ( float ) dstW / ( float ) dstH; //kill's me to do that :( + + //take care of scaling and scaler requirements + fix_scale(); + + //center image -- this is wrong from mplayer's perspective - it should be + // before the geometry & aspect call, but i don't want + // mplayer to center the image because i can do it in + // spu-medialib and we don't have to draw the extra black bars + vo_dx = ( fbW - ( 2 * fbX ) - dstW ) /2; + vo_dx = ( vo_dx+3 ) &~3; + vo_dy = ( fbH - ( 2 * fbY ) - dstH ) /2; + offset = vo_dx + ( fbW * vo_dy ); + + mp_msg ( MSGT_VO, MSGL_INFO, "[vo_ps3] setup_screen: After mplayer aspect changes:\n" + " vo_dx/dy=%ix%i, vo_screenwidth/height=%ix%i, offset=%i\n" + " desired image size=%ix%i\n", + vo_dx, vo_dy, vo_screenwidth, vo_screenheight, offset, dstW, dstH ); + clear(); +} + +static int init_framebuffer() +{ + int arg; + int res=0; + + console = open ( CONSOLE, O_NONBLOCK ); + + + if ( console >= 0 ) + res = ioctl ( console,KDGETMODE,&arg ); + + //ok the previous failed lets attempt to open as root + if ( ( console < 0 ) || ( res < 0 ) ) + { + close ( console ); + //This will only work if you are root + console = open ( FALLBACK, O_NONBLOCK ); + res = ioctl ( console,KDGETMODE,&arg ); + } + + //all options to open the FB has failed.. So lets bail.. + if ( ( res < 0 ) || ( console < 0 ) ) + { + mp_msg ( MSGT_VO,MSGL_INFO,"[vo_ps3] failed to open console\n" ); + close ( console ); + return -1; + } + + if ( arg != KD_GRAPHICS ) + { + if ( ioctl ( console,KDSETMODE,KD_GRAPHICS ) < 0 ) + { + + return -1; + } + } + //ok we asume the console blanking is killed.. now its "safe" to handle the fb + + fb = open ( FB_DEV,O_RDWR ); + + //major problem if it occurs + if ( fb < 0 ) + { + mp_msg ( MSGT_VO, MSGL_INFO, "[vo_ps3] init_framebuffer: failed to open fb\n" ); + res=-1; + } + if ( ioctl ( fb, PS3FB_IOCTL_SCREENINFO, ( unsigned long ) &ps3_fb ) < 0 ) + { + mp_msg ( MSGT_VO, MSGL_INFO, "[vo_ps3] init_framebuffer: failed to get fb info\n" ); + res=-1; + } + + if ( ioctl ( fb, PS3FB_IOCTL_ON ) < 0 ) + { + mp_msg ( MSGT_VO, MSGL_INFO, "[vo_ps3] init_framebuffer: failed to set manual swap control\n" ); + res=-1; + } + + if ( res < 0 ) + { + ioctl ( console,KDSETMODE,KD_TEXT ); + close ( console ); + ioctl ( fb,PS3FB_IOCTL_OFF ); + close ( fb ); + return -1; + } + + //mmap get the FB mmap + fb_buf0 = mmap ( NULL, ps3_fb.xres*ps3_fb.yres*4, PROT_WRITE, MAP_SHARED, fb, 0 ); + + fbW=ps3_fb.xres; + fbH=ps3_fb.yres; + fbX=ps3_fb.xoff; + fbY=ps3_fb.yoff; + fb_length = fbW*fbH*4*fb_frames; + fb_aspect = ( float ) fbW / ( float ) fbH; + + mp_msg ( MSGT_VO, MSGL_INFO, + "[vo_ps3] init_framebuffer: Initialized framebuffer & disabled console\n" + "FB is %ix%i at offset %ix%i\n", fbW, fbH, fbX, fbY ); + return res; +} + +/* preinit - pre-initialization section +* +* Called before initializing video output driver for evaluating subopts. +* Currently, we don't utilize any subopts (e.g. -vo ps3:subopt +*/ +static int preinit ( const char *arg ) +{ + +opt_t subopts[] = //See subopt_helper.h + { + { "debug", OPT_ARG_BOOL, &debug, NULL}, + { "noadj", OPT_ARG_BOOL, &noadj, NULL}, + { "snapshot", OPT_ARG_BOOL, &snap, NULL}, + { NULL, 0, NULL, NULL} + }; + + if ( subopt_parse ( arg, subopts ) ) + { + mp_msg ( MSGT_VO, MSGL_WARN, + "Suboptions for -vo ps3:\n" + " debug - turn on debugging output specific to vo_ps3\n" + " noadj - don't honor & scale to mplayer's suggested d_width x d_height\n" + " snapshot - take a raw yuv snapshot of input buffers on pause (to inbuf0/1.yuv)\n" + "\n" ); + } + + mp_msg ( MSGT_VO, MSGL_INFO, + "ps3 suboptions:\n" + " debug:%i\n" + " noadj:%i\n" + " snapshot:%i\n", + debug, noadj, snap ); + + /* init PS3 FrameBuffer */ + if ( init_framebuffer() < 0 ) + return -1; + + return 0; +} + +/* query_format - determine which formats are supported by this vo + * + * formats specifies image format - see libmpcodec/img_format.h + */ +static int query_format ( uint32_t format ) +{ + + mp_msg ( MSGT_VO, MSGL_INFO, "[vo_ps3] query_format: Called for %s (0x%x)\n", + vo_format_name ( format ), format ); + + switch ( format ) + { + case IMGFMT_I420: //Planar I420 0x30323449 + case IMGFMT_YV12: //Planar YV12 0x32315659 + case IMGFMT_IYUV: //Planar IYUV 0x56555949 + return VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW | VFCAP_SWSCALE | VFCAP_ACCEPT_STRIDE; + default: + return VO_FALSE; //not supporting anything else yet + } +} + +/* config - configure video output driver + * + * width,height are of source, d_width,d_height are suggested window size, + * format specifies image format - see libmpcodec/img_format.h + */ +static int config ( uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t flags, char *title, uint32_t format ) +{ + + int i; + + if ( vo_config_count > 0 ) //already config'd + { + return 0; + } + + srcW = dstW = width; //original size - dst same unless scaled + srcH = dstH = height; + src_aspect = ( float ) srcW / ( float ) srcH; + src_fmt = format; + src_title = title; + + suggestedW = d_width; + suggestedH = d_height; + suggested_aspect = ( float ) suggestedW / ( float ) suggestedH; + + maxW=fbW; + maxH=fbH; + + vo_doublebuffering = VO_TRUE; + vo_directrendering = VO_TRUE; + + if ( flags && VOFLAG_FULLSCREEN ) + vo_fs = 1; + + switch ( format ) + { + case IMGFMT_I420: //Planar I420 0x30323449 + case IMGFMT_YV12: //Planar YV12 0x32315659 + case IMGFMT_IYUV: //Planar IYUV 0x56555949 + src_buf_siz = srcW*srcH + srcW*srcH/2; + src_stride[0] = srcW; //buffer plane strides 0=y, 1=u, 2=v + src_stride[1] = src_stride[2] = src_stride[0]/2; + src_p_siz[0] = srcW * srcH; //buffer plane sizes 0=y, 1=u, 2=v + src_p_siz[1] = src_p_siz[2] = srcW/2 * srcH/2; + src_bpp = 12; + break; + default: + mp_msg ( MSGT_VO, MSGL_FATAL, "[vo_ps3] config: Unsupported format:%i\n", format ); + return 1; + } + + for ( i=0; iflags & MP_IMGFLAG_READABLE ) && ( mpi->type == MP_IMGTYPE_IPB || mpi->type == MP_IMGTYPE_IP ) ) + { + if ( debug ) + { + mp_msg ( MSGT_VO, MSGL_INFO, "[vo_ps3] get_image: READABLE -> stash in parking lot\n" ); + mpi_info ( mpi ); + buf_info(); + } + buf_plane_ptr[0] = parking_lot_y[parking_lot_page]; + buf_plane_ptr[1] = parking_lot_u[parking_lot_page]; + buf_plane_ptr[2] = parking_lot_v[parking_lot_page]; + mpi->flags |= MP_IMGFLAG_ALLOCATED; + parking_lot_page^=1; + } + else + { + buf_plane_ptr[0] = inbuf_y[page]; + buf_plane_ptr[1] = inbuf_u[page]; + buf_plane_ptr[2] = inbuf_v[page]; + mpi->flags |= MP_IMGFLAG_DIRECT; + } + + mpi->planes[0] = buf_plane_ptr[0]; + mpi->planes[1] = buf_plane_ptr[1]; + mpi->planes[2] = buf_plane_ptr[2]; + + mpi->stride[0] = src_stride[0]; + mpi->stride[1] = src_stride[1]; + mpi->stride[2] = src_stride[2]; + + mpi->chroma_width = srcW/2; + mpi->chroma_height = srcH/2; + + mpi->priv = buf_plane_ptr[0]; + + return 0; +} + +static uint32_t draw_image ( mp_image_t *mpi ) +{ + + int i; + int mpi_p_siz[3], mpi_p_w[3], mpi_p_h[3]; + + draw_image_count++; + + if ( !(mpi->flags & MP_IMGFLAG_DIRECT) ) + { + + //todo: not (mpi->flags & MP_IMGFLAG_DIRECT) (no -dr flag for direct rendering), + // may need to handle MP_IMGFLAG_READABLE IPB (B) frames differently + // When direct rendering is enabled (-dr), I moved the B frames to a non-direct + // buffer and then when drawn with draw_image, they (seem) to work fine + // BUT, without direct rendering, don't know how to handle them :( + // Just drawing them as called makes a mess of the video. + if ( ( mpi->flags & MP_IMGFLAG_READABLE ) && + ( mpi->type == MP_IMGTYPE_IPB || mpi->type == MP_IMGTYPE_IP ) ) + { + buf_plane_ptr[0] = inbuf_y[page]; + buf_plane_ptr[1] = inbuf_u[page]; + buf_plane_ptr[2] = inbuf_v[page]; + } + else + { + buf_plane_ptr[0] = inbuf_y[page]; + buf_plane_ptr[1] = inbuf_u[page]; + buf_plane_ptr[2] = inbuf_v[page]; + } + + mpi_p_siz[0] = mpi->stride[0] * mpi->height; + mpi_p_siz[1] = mpi->stride[1] * mpi->chroma_height; + mpi_p_siz[2] = mpi->stride[2] * mpi->chroma_height; + + mpi_p_w[0] = mpi->w; + mpi_p_w[1] = mpi_p_w[2] = mpi->chroma_width; + + mpi_p_h[0] = mpi->h; + mpi_p_h[1] = mpi_p_h[2] = mpi->chroma_height; + + for ( i=0; i<3; i++ ) //planes y,u,v + { + if ( mpi->stride[i] == src_stride[i] ) + { + fast_memcpy ( buf_plane_ptr[i], mpi->planes[i], mpi_p_siz[i] ); + } + else + { + + memcpy_pic ( buf_plane_ptr[i], mpi->planes[i], mpi_p_w[i], mpi_p_h[i], src_stride[i], mpi->stride[i] ); + } + } + + } + return 0; +} + +static int draw_frame ( uint8_t *src[] ) +{ + draw_frame_count++; + + return draw_slice ( src, src_stride, srcW, srcH, 0, 0 ); +} + +static uint32_t start_slice ( mp_image_t *mpi ) +{ + // do nothing + return 0; +} + +/* draw_slice - draw a planar YUV slice to the buffer + * + * + */ +static int draw_slice ( uint8_t *src[], int stride[], int w,int h,int x,int y ) +{ + + int i; + int slice_siz[3], slice_p_w[3], slice_p_h[3], offset[3]; + + draw_slice_count++; + + //todo: should we care about MP_IMGFLAG_PRESERVE for a slice? + + buf_plane_ptr[0] = inbuf_y[page]; + buf_plane_ptr[1] = inbuf_u[page]; + buf_plane_ptr[2] = inbuf_v[page]; + + // setup for YV12 - always for slice? should add switch statement to check format + slice_siz[0] = stride[0] * h; + slice_siz[1] = stride[1] * h/2; + slice_siz[2] = stride[2] * h/2; + + slice_p_w[0] = w; + slice_p_w[1] = slice_p_w[2] = w/2; + + slice_p_h[0] = h; + slice_p_h[1] = slice_p_h[2] = h/2; + + offset[0] = y * src_stride[0] + x; + offset[1] = y/2 * src_stride[1] + x/2; + offset[2] = y/2 * src_stride[2] + x/2; + + for ( i=0; i<3; i++ ) + { + //planes y,u,v + if ( stride[i] == src_stride[i] ) + { + fast_memcpy ( buf_plane_ptr[i]+offset[i], src[i], slice_siz[i] ); + } + else + { + + memcpy_pic ( buf_plane_ptr[i]+offset[i], src[i], slice_p_w[i], slice_p_h[i], src_stride[i], stride[i] ); + } + } + return 0; +} + +static void draw_osd ( void ) +{ + + vo_draw_text ( srcW, srcH, draw_alpha ); +} + +static void flip_page ( void ) +{ + int frame=0; + + flip_count++; + + yuvcsc_run(); + + yuvcsc_check ( yuvcsc ); + + //first we flip.. + + ioctl ( fb, PS3FB_IOCTL_FSEL, ( unsigned long ) &frame ); + page=page^1; +} + +/* check_events - + * + * + */ +static void check_events ( void ) +{ + //do nothing +} + +static int toggle_fullscreen ( void ) +{ + + vo_fs^=1; + + setup_screen(); + + init_framebuffer(); + + update_spu_medialib(); + + return 0; + +} + +/* control - control interface + * + * + */ +static int control ( uint32_t request, void *data, ... ) +{ + + switch ( request ) + { + + case VOCTRL_QUERY_FORMAT: /* 2 */ + return query_format ( * ( ( uint32_t* ) data ) ); + + case VOCTRL_RESET: /* 3 */ + if ( debug ) + mp_msg ( MSGT_VO, MSGL_INFO, "[vo_ps3] control: todo: handle RESET (%u)\n", request ); + return VO_NOTIMPL; + + case VOCTRL_FULLSCREEN: /* 5 */ + return toggle_fullscreen(); + + case VOCTRL_PAUSE: /* 7 */ + if ( snap ) + snapshot(); + return 0; + + case VOCTRL_RESUME: /* 8 */ + return 0; + + case VOCTRL_GET_IMAGE: /* 9 */ + return get_image ( data ); + + case VOCTRL_DRAW_IMAGE: /* 13 */ + return draw_image ( data ); + + case VOCTRL_UPDATE_SCREENINFO: /* 32 */ + mp_msg ( MSGT_VO, MSGL_WARN, "[vo_ps3] control: todo: handle UPDATE_SCREENINFO (%u)\n", request ); + return VO_NOTIMPL; + + case VOCTRL_START_SLICE: /* 21 */ + return start_slice ( data ); + + default: + mp_msg ( MSGT_VO, MSGL_WARN, "[vo_ps3] control: Unhandled VOCTRL %u\n\n", request ); + return VO_NOTIMPL; + } +} + +static void uninit ( void ) +{ + + int i; + + cleanup_spu_medialib(); + + /* Cleanup FrameBuffer and re-enable console */ + ioctl ( fb, PS3FB_IOCTL_OFF ); + ioctl ( console, KDSETMODE, KD_TEXT ); + + if (console) + close ( console ); + if (fb) + close ( fb ); + + mp_msg ( MSGT_VO, MSGL_INFO, "[vo_ps3] uninit: Cleaned up FrameBuffer and re-enabled console.\n" ); + + for ( i=0; i $TMPC << EOF +#include +#include +#include +int main(void) { return 0; } +EOF + _ps3=no + cc_check -lspu-medialib -lspe2 && _ps3=yes +fi +if test "$_ps3" = yes; then + def_ps3='#define CONFIG_PS3 1' + libs_mplayer="$libs_mplayer -lspu-medialib -lspe2" + _vomodules="ps3 $_vomodules" +else + def_ps3='#undef CONFIG_PS3' + _novomodules="ps3 $_novomodules" +fi +echores "$_ps3" echocheck "DVB" if test "$_dvb" = auto ; then @@ -8204,6 +8228,7 @@ FAAD_INTERNAL = $_faad_internal FASTMEMCPY = $_fastmemcpy FBDEV = $_fbdev +PS3 = $_ps3 FREETYPE = $_freetype FTP = $_ftp GIF = $_gif @@ -8715,6 +8740,7 @@ $def_dxr2 $def_dxr3 $def_fbdev +$def_ps3 $def_ggi $def_ggiwmh $def_gif