[Mplayerxp-cvslog] SF.net SVN: mplayerxp:[482] mplayerxp
Brought to you by:
olov
From: <nic...@us...> - 2012-11-29 09:44:51
|
Revision: 482 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=482&view=rev Author: nickols_k Date: 2012-11-29 09:44:34 +0000 (Thu, 29 Nov 2012) Log Message: ----------- implement class Video_Output as main module of Video Subsystem Modified Paths: -------------- mplayerxp/libao2/ao_wav.cpp mplayerxp/libmpcodecs/dec_video.cpp mplayerxp/libmpsub/find_sub.cpp mplayerxp/libmpsub/spudec.cpp mplayerxp/libmpsub/spudec.h mplayerxp/libmpsub/subreader.h mplayerxp/libvo/sub.cpp mplayerxp/libvo/sub.h mplayerxp/libvo/video_out.cpp mplayerxp/libvo/video_out.h mplayerxp/libvo/video_out_internal.h mplayerxp/libvo/vo_fbdev.cpp mplayerxp/libvo/vo_null.cpp mplayerxp/libvo/vo_opengl.cpp mplayerxp/libvo/vo_sdl.cpp mplayerxp/libvo/vo_vesa.cpp mplayerxp/libvo/vo_x11.cpp mplayerxp/libvo/vo_xv.cpp mplayerxp/libvo/x11_system.cpp mplayerxp/libvo/x11_system.h mplayerxp/mplayerxp.cpp mplayerxp/mplayerxp.h mplayerxp/postproc/libmenu/menu.cpp mplayerxp/postproc/vf.cpp mplayerxp/postproc/vf.h mplayerxp/postproc/vf_1bpp.cpp mplayerxp/postproc/vf_2xsai.cpp mplayerxp/postproc/vf_aspect.cpp mplayerxp/postproc/vf_delogo.cpp mplayerxp/postproc/vf_denoise3d.cpp mplayerxp/postproc/vf_dint.cpp mplayerxp/postproc/vf_down3dright.cpp mplayerxp/postproc/vf_expand.cpp mplayerxp/postproc/vf_flip.cpp mplayerxp/postproc/vf_format.cpp mplayerxp/postproc/vf_menu.cpp mplayerxp/postproc/vf_mirror.cpp mplayerxp/postproc/vf_noise.cpp mplayerxp/postproc/vf_ow.cpp mplayerxp/postproc/vf_palette.cpp mplayerxp/postproc/vf_panscan.cpp mplayerxp/postproc/vf_perspective.cpp mplayerxp/postproc/vf_pp.cpp mplayerxp/postproc/vf_raw.cpp mplayerxp/postproc/vf_rectangle.cpp mplayerxp/postproc/vf_rgb2bgr.cpp mplayerxp/postproc/vf_rotate.cpp mplayerxp/postproc/vf_scale.cpp mplayerxp/postproc/vf_smartblur.cpp mplayerxp/postproc/vf_softpulldown.cpp mplayerxp/postproc/vf_test.cpp mplayerxp/postproc/vf_unsharp.cpp mplayerxp/postproc/vf_vo.cpp mplayerxp/postproc/vf_yuvcsp.cpp mplayerxp/postproc/vf_yuy2.cpp mplayerxp/postproc/vf_yvu9.cpp mplayerxp/xmpcore/xmp_vplayer.cpp Modified: mplayerxp/libao2/ao_wav.cpp =================================================================== --- mplayerxp/libao2/ao_wav.cpp 2012-11-29 07:05:15 UTC (rev 481) +++ mplayerxp/libao2/ao_wav.cpp 2012-11-29 09:44:34 UTC (rev 482) @@ -220,7 +220,6 @@ } // return: how many bytes can be played without blocking -extern vo_data_t* vo_data; static unsigned get_space(const ao_data_t* ao){ priv_t* priv=reinterpret_cast<priv_t*>(ao->priv); float pts=dae_played_frame(xp_core->video).v_pts; Modified: mplayerxp/libmpcodecs/dec_video.cpp =================================================================== --- mplayerxp/libmpcodecs/dec_video.cpp 2012-11-29 07:05:15 UTC (rev 481) +++ mplayerxp/libmpcodecs/dec_video.cpp 2012-11-29 09:44:34 UTC (rev 482) @@ -313,7 +313,7 @@ if(frame->flags) return 0; update_subtitle(sh_video,frame->pts,mpi->xp_idx); - vo_flush_page(vo_data,dae_curr_vdecoded(xp_core)); + vo_data->flush_page(dae_curr_vdecoded(xp_core)); t2=GetTimer()-t2; tt=t2*0.000001f; @@ -375,7 +375,7 @@ MP_UNIT("spudec"); spudec_now_pts(vo_data->spudec,90000*v_pts); if(spudec_visible(vo_data->spudec)) { - vo_draw_spudec_direct(vo_data,xp_idx); + vo_data->draw_spudec_direct(xp_idx); } else { spudec_heartbeat(vo_data->spudec,90000*v_pts); if (vo_data->vobsub) { @@ -393,7 +393,7 @@ } } /* detect wether the sub has changed or not */ - if(spudec_changed(vo_data->spudec)) vo_draw_spudec_direct(vo_data,xp_idx); + if(spudec_changed(vo_data->spudec)) vo_data->draw_spudec_direct(xp_idx); MP_UNIT(NULL); } } @@ -493,13 +493,13 @@ // autodetect flipping if(vo_conf.flip==0){ - vo_FLIP_UNSET(vo_data); + vo_data->FLIP_UNSET(); if(sh->codec->outflags[j]&CODECS_FLAG_FLIP) if(!(sh->codec->outflags[j]&CODECS_FLAG_NOFLIP)) - vo_FLIP_SET(vo_data); + vo_data->FLIP_SET(); } - if(vo_data->flags&VFCAP_FLIPPED) vo_FLIP_REVERT(vo_data); - if(vo_FLIP(vo_data) && !(vo_data->flags&VFCAP_FLIP)){ + if(vo_data->flags&VFCAP_FLIPPED) vo_data->FLIP_REVERT(); + if(vo_data->FLIP() && !(vo_data->flags&VFCAP_FLIP)){ // we need to flip, but no flipping filter avail. sh->vfilter=vf=vf_open_filter(vf,sh,"flip",NULL,libinput); } @@ -539,7 +539,7 @@ if(_w<screen_size_x || vo_conf.image_zoom>8){ screen_size_y=(int)((float)screen_size_x*(1.0/sh->aspect)); screen_size_y+=screen_size_y%2; // round - if(screen_size_y<sh->src_h) // Do not downscale verticaly + if(unsigned(screen_size_y)<sh->src_h) // Do not downscale verticaly screen_size_y=sh->src_h; } else screen_size_x=_w; // keep new width } else { Modified: mplayerxp/libmpsub/find_sub.cpp =================================================================== --- mplayerxp/libmpsub/find_sub.cpp 2012-11-29 07:05:15 UTC (rev 481) +++ mplayerxp/libmpsub/find_sub.cpp 2012-11-29 09:44:34 UTC (rev 482) @@ -20,9 +20,8 @@ static unsigned long nosub_range_start=ULONG_MAX; static unsigned long nosub_range_end=ULONG_MAX; -void find_sub(subtitle* subtitles,unsigned long key,any_t*vo_data){ +void find_sub(subtitle* subtitles,unsigned long key,Video_Output*vo){ int i,j; - vo_data_t*vo=reinterpret_cast<vo_data_t*>(vo_data); if ( !subtitles ) return; Modified: mplayerxp/libmpsub/spudec.cpp =================================================================== --- mplayerxp/libmpsub/spudec.cpp 2012-11-29 07:05:15 UTC (rev 481) +++ mplayerxp/libmpsub/spudec.cpp 2012-11-29 09:44:34 UTC (rev 482) @@ -606,7 +606,7 @@ } } -void __FASTCALL__ spudec_draw(any_t*self, draw_osd_f draw_alpha,any_t*vo) +void __FASTCALL__ spudec_draw(any_t*self, draw_osd_f draw_alpha,const Video_Output*vo) { spudec_handle_t *spu = (spudec_handle_t *)self; if (spu->start_pts <= spu->now_pts && spu->now_pts < spu->end_pts && spu->image) @@ -750,7 +750,7 @@ sws_freeContext(ctx); } -void __FASTCALL__ spudec_draw_scaled(any_t*me, unsigned int dxs, unsigned int dys, draw_osd_f draw_alpha,any_t*vo) +void __FASTCALL__ spudec_draw_scaled(any_t*me, unsigned int dxs, unsigned int dys, draw_osd_f draw_alpha,const Video_Output*vo) { spudec_handle_t *spu = (spudec_handle_t *)me; scale_pixel *table_x; Modified: mplayerxp/libmpsub/spudec.h =================================================================== --- mplayerxp/libmpsub/spudec.h 2012-11-29 07:05:15 UTC (rev 481) +++ mplayerxp/libmpsub/spudec.h 2012-11-29 09:44:34 UTC (rev 482) @@ -8,11 +8,16 @@ extern int spu_aamode; extern float spu_gaussvar; +namespace mpxp { + class Video_Output; +} +using namespace mpxp; + void __FASTCALL__ spudec_heartbeat(any_t*__self, unsigned int pts100); void __FASTCALL__ spudec_now_pts(any_t*__self, unsigned int pts100); void __FASTCALL__ spudec_assemble(any_t*__self, unsigned char *packet, unsigned int len, unsigned int pts100); -void __FASTCALL__ spudec_draw(any_t*__self, draw_osd_f draw_alpha,any_t* vo); -void __FASTCALL__ spudec_draw_scaled(any_t*__self, unsigned int dxs, unsigned int dys,draw_osd_f draw_alpha,any_t* vo); +void __FASTCALL__ spudec_draw(any_t*__self, draw_osd_f draw_alpha,const Video_Output* vo); +void __FASTCALL__ spudec_draw_scaled(any_t*__self, unsigned int dxs, unsigned int dys,draw_osd_f draw_alpha,const Video_Output* vo); void __FASTCALL__ spudec_update_palette(any_t*__self,const unsigned int *palette); any_t* __FASTCALL__ spudec_new_scaled(unsigned int *palette, unsigned int frame_width, unsigned int frame_height); any_t* __FASTCALL__ spudec_new_scaled_vobsub(unsigned int *palette, unsigned int *cuspal, unsigned int custom, unsigned int frame_width, unsigned int frame_height); Modified: mplayerxp/libmpsub/subreader.h =================================================================== --- mplayerxp/libmpsub/subreader.h 2012-11-29 07:05:15 UTC (rev 481) +++ mplayerxp/libmpsub/subreader.h 2012-11-29 09:44:34 UTC (rev 482) @@ -1,6 +1,11 @@ #ifndef __MPLAYER_SUBREADER_H #define __MPLAYER_SUBREADER_H +namespace mpxp { + class Video_Output; +} +using namespace mpxp; + extern int sub_uses_time; extern int sub_errs; extern int sub_num; // number of subtitle structs @@ -37,7 +42,7 @@ extern void list_sub_file(subtitle* subs); extern void dump_mpsub(subtitle* subs, float fps); extern void sub_free(subtitle* subs ); -extern void find_sub(subtitle* subtitles,unsigned long key,any_t*vo_data); +extern void find_sub(subtitle* subtitles,unsigned long key,Video_Output*vo_data); extern void subcp_open (void); extern void subcp_close (void); Modified: mplayerxp/libvo/sub.cpp =================================================================== --- mplayerxp/libvo/sub.cpp 2012-11-29 07:05:15 UTC (rev 481) +++ mplayerxp/libvo/sub.cpp 2012-11-29 09:44:34 UTC (rev 482) @@ -16,6 +16,8 @@ #define MSGT_CLASS MSGT_OSD #include "mp_msg.h" +namespace mpxp { + static const char * __sub_osd_names[]={ "Seekbar", "Play", @@ -64,7 +66,7 @@ } // renders the buffer -static void vo_draw_text_from_buffer(any_t*vo,unsigned idx,mp_osd_obj_t* obj,draw_osd_f draw_alpha){ +static void vo_draw_text_from_buffer(const Video_Output*vo,unsigned idx,mp_osd_obj_t* obj,draw_osd_f draw_alpha){ if (obj->allocated > 0) { draw_alpha(vo,idx, obj->bbox.x1,obj->bbox.y1, @@ -97,22 +99,20 @@ } // return the real height of a char: -inline static int __FASTCALL__ get_height(vo_data_t*vo,int c,int h){ +inline static int __FASTCALL__ get_height(const Video_Output*vo,int c,int h){ int font; if ((font=vo->font->font[c])>=0) if(h<vo->font->pic_a[font]->h) h=vo->font->pic_a[font]->h; return h; } -int __FASTCALL__ get_osd_height(any_t*v,int c,int h) +int __FASTCALL__ get_osd_height(const Video_Output*vo,int c,int h) { - vo_data_t* vo=(vo_data_t*)v; return vo->font?get_height(vo,c,h):0; } -static void __FASTCALL__ vo_update_text_osd(any_t*v,mp_osd_obj_t* obj,int dxs,int dys){ - vo_data_t* vo=(vo_data_t*)v; - unsigned char *cp=(unsigned char *)vo->osd_text; +static void __FASTCALL__ vo_update_text_osd(const Video_Output*vo,mp_osd_obj_t* obj,int dxs,int dys){ + const unsigned char *cp=(const unsigned char *)vo->osd_text; int x=20; int h=0; @@ -133,9 +133,8 @@ } -static void __FASTCALL__ vo_draw_text_osd(any_t*v,unsigned idx,mp_osd_obj_t* obj,draw_osd_f draw_alpha){ - vo_data_t* vo=(vo_data_t*)v; - unsigned char *cp=(unsigned char *)vo->osd_text; +static void __FASTCALL__ vo_draw_text_osd(const Video_Output*vo,unsigned idx,mp_osd_obj_t* obj,draw_osd_f draw_alpha){ + const unsigned char *cp=(const unsigned char *)vo->osd_text; int font; int x=obj->x; @@ -161,8 +160,7 @@ // // the above schema is rescalled to n=elems bars -static void __FASTCALL__ vo_update_text_progbar(any_t*v,mp_osd_obj_t* obj,int dxs,int dys){ - vo_data_t* vo=(vo_data_t*)v; +static void __FASTCALL__ vo_update_text_progbar(const Video_Output*vo,mp_osd_obj_t* obj,int dxs,int dys){ obj->flags|=OSDFLAG_CHANGED|OSDFLAG_VISIBLE; if(vo->osd_progbar_type<0 || !vo->font){ @@ -193,8 +191,7 @@ } -static void __FASTCALL__ vo_draw_text_progbar(any_t*v,unsigned idx,mp_osd_obj_t* obj,draw_osd_f draw_alpha){ - vo_data_t* vo=(vo_data_t*)v; +static void __FASTCALL__ vo_draw_text_progbar(const Video_Output*vo,unsigned idx,mp_osd_obj_t* obj,draw_osd_f draw_alpha){ unsigned char *s; unsigned char *sa; int i,w,h,st,mark; @@ -277,8 +274,7 @@ // vo_draw_text_sub(int dxs,int dys,void (*draw_alpha)(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride)) -static void __FASTCALL__ vo_update_text_sub(any_t*v,mp_osd_obj_t* obj,int dxs,int dys){ - vo_data_t* vo=reinterpret_cast<vo_data_t*>(v); +static void __FASTCALL__ vo_update_text_sub(const Video_Output*vo,mp_osd_obj_t* obj,int dxs,int dys){ char *t; int c,i,j,l,font; int len; @@ -385,8 +381,7 @@ } -static void __FASTCALL__ vo_draw_text_sub(any_t*v,unsigned idx,mp_osd_obj_t* obj,draw_osd_f draw_alpha){ - vo_data_t* vo=(vo_data_t*)v; +static void __FASTCALL__ vo_draw_text_sub(const Video_Output*vo,unsigned idx,mp_osd_obj_t* obj,draw_osd_f draw_alpha){ int i,j,c,x,l,font; int y=obj->y; @@ -426,8 +421,7 @@ vo_osd_list=NULL; } -int __FASTCALL__ vo_update_osd(any_t*v,int dxs,int dys){ - vo_data_t* vo=(vo_data_t*)v; +int __FASTCALL__ vo_update_osd(const Video_Output*vo,int dxs,int dys){ mp_osd_obj_t* obj=vo_osd_list; int chg=0; while(obj){ @@ -509,10 +503,9 @@ new_osd_obj(OSDTYPE_DVDNAV); } -void __FASTCALL__ vo_remove_text(any_t*v,unsigned idx,int dxs,int dys,clear_osd_f f_remove){ - vo_data_t* vo=(vo_data_t*)v; +void __FASTCALL__ vo_remove_text(const Video_Output*vo,unsigned idx,int dxs,int dys,clear_osd_f f_remove){ mp_osd_obj_t* obj=vo_osd_list; - vo_update_osd(v,dxs,dys); + vo_update_osd(vo,dxs,dys); while(obj){ if(((obj->flags&OSDFLAG_CHANGED) || (obj->flags&OSDFLAG_VISIBLE) || (obj->cleared_frames>=0)) && @@ -520,7 +513,6 @@ int w=obj->old_bbox.x2-obj->old_bbox.x1; int h=obj->old_bbox.y2-obj->old_bbox.y1; if(w>0 && h>0){ - vo->osd_changed_flag=obj->flags&OSDFLAG_CHANGED; // temp hack f_remove(vo,idx,obj->old_bbox.x1,obj->old_bbox.y1,w,h); } // obj->flags&=~OSDFLAG_OLD_BBOX; @@ -534,27 +526,24 @@ } } -void __FASTCALL__ vo_draw_spudec(any_t*v,unsigned idx,int dxs,int dys,draw_osd_f draw_alpha){ +void __FASTCALL__ vo_draw_spudec(const Video_Output*vo,unsigned idx,int dxs,int dys,draw_osd_f draw_alpha){ UNUSED(idx); - vo_data_t*vo=(vo_data_t*)v; - spudec_draw_scaled(vo->spudec, dxs, dys, draw_alpha,v); // FIXME + spudec_draw_scaled(vo->spudec, dxs, dys, draw_alpha,vo); // FIXME } -void __FASTCALL__ vo_draw_text(any_t*v,unsigned idx,int dxs,int dys,draw_osd_f draw_alpha){ - vo_data_t* vo=(vo_data_t*)v; +void __FASTCALL__ vo_draw_text(const Video_Output*vo,unsigned idx,int dxs,int dys,draw_osd_f draw_alpha){ mp_osd_obj_t* obj=vo_osd_list; - vo_update_osd(v,dxs,dys); + vo_update_osd(vo,dxs,dys); while(obj){ if(obj->flags&OSDFLAG_VISIBLE){ obj->cleared_frames=0; - vo->osd_changed_flag=obj->flags&OSDFLAG_CHANGED; // temp hack switch(obj->type){ case OSDTYPE_SPU: - spudec_draw_scaled(vo->spudec, dxs, dys, draw_alpha,v); // FIXME + spudec_draw_scaled(vo->spudec, dxs, dys, draw_alpha,vo); // FIXME break; case OSDTYPE_VOBSUB: - if(vo->spudec) spudec_draw_scaled(vo->spudec, dxs, dys, draw_alpha,v); // FIXME + if(vo->spudec) spudec_draw_scaled(vo->spudec, dxs, dys, draw_alpha,vo); // FIXME break; case OSDTYPE_OSD: vo_draw_text_osd(vo,idx,obj,draw_alpha); @@ -607,3 +596,4 @@ } return 0; } +} // namespace mpxp \ No newline at end of file Modified: mplayerxp/libvo/sub.h =================================================================== --- mplayerxp/libvo/sub.h 2012-11-29 07:05:15 UTC (rev 481) +++ mplayerxp/libvo/sub.h 2012-11-29 09:44:34 UTC (rev 482) @@ -3,102 +3,106 @@ #include <inttypes.h> #include "osd_render.h" -typedef struct mp_osd_bbox_s { - int x1,y1,x2,y2; -} mp_osd_bbox_t; +namespace mpxp { + typedef struct mp_osd_bbox_s { + int x1,y1,x2,y2; + } mp_osd_bbox_t; -enum { - OSDTYPE_OSD =1, - OSDTYPE_SUBTITLE =2, - OSDTYPE_PROGBAR =3, - OSDTYPE_SPU =4, - OSDTYPE_VOBSUB =5, - OSDTYPE_DVDNAV =6, - OSDTYPE_TELETEXT =7 -}; + enum { + OSDTYPE_OSD =1, + OSDTYPE_SUBTITLE =2, + OSDTYPE_PROGBAR =3, + OSDTYPE_SPU =4, + OSDTYPE_VOBSUB =5, + OSDTYPE_DVDNAV =6, + OSDTYPE_TELETEXT =7 + }; -enum { - OSDFLAG_VISIBLE =1, - OSDFLAG_CHANGED =2, - OSDFLAG_BBOX =4, - OSDFLAG_OLD_BBOX =8, - OSDFLAG_FORCE_UPDATE=16 -}; + enum { + OSDFLAG_VISIBLE =1, + OSDFLAG_CHANGED =2, + OSDFLAG_BBOX =4, + OSDFLAG_OLD_BBOX=8, + OSDFLAG_FORCE_UPDATE=16 + }; -enum { - MAX_UCS =1600, - MAX_UCSLINES =16 -}; -typedef struct mp_osd_obj_s { - struct mp_osd_obj_s* next; - unsigned char type; - unsigned char alignment; // 2 bits: x;y percents, 2 bits: x;y relative to parent; 2 bits: alignment left/right/center - unsigned short flags; - int x,y; - int dxs,dys; - mp_osd_bbox_t bbox; // bounding box - mp_osd_bbox_t old_bbox; // the renderer will save bbox here - int cleared_frames; // The number of frames that has been cleared from old OSD, -1 = don't clear - union { - struct { - const any_t* sub; // value of vo_sub at last update - int utbl[MAX_UCS+1]; // subtitle text - int xtbl[MAX_UCSLINES]; // x positions - int lines; // no. of lines - } subtitle; - struct { - int elems; - } progbar; - } params; - int stride; - int allocated; - unsigned char *alpha_buffer; - unsigned char *bitmap_buffer; -} mp_osd_obj_t; + enum { + MAX_UCS =1600, + MAX_UCSLINES =16 + }; -enum { - OSD_PLAY =0x01, - OSD_PAUSE =0x02, - OSD_STOP =0x03, - OSD_REW =0x04, - OSD_FFW =0x05, - OSD_CLOCK =0x06, - OSD_CONTRAST =0x07, - OSD_SATURATION =0x08, - OSD_VOLUME =0x09, - OSD_BRIGHTNESS =0x0A, - OSD_HUE =0x0B, - OSD_DVDMENU =0x0C, + typedef struct mp_osd_obj_s { + struct mp_osd_obj_s* next; + unsigned char type; + unsigned char alignment; // 2 bits: x;y percents, 2 bits: x;y relative to parent; 2 bits: alignment left/right/center + unsigned short flags; + int x,y; + int dxs,dys; + mp_osd_bbox_t bbox; // bounding box + mp_osd_bbox_t old_bbox; // the renderer will save bbox here + int cleared_frames; // The number of frames that has been cleared from old OSD, -1 = don't clear + union { + struct { + const any_t* sub; // value of vo_sub at last update + int utbl[MAX_UCS+1]; // subtitle text + int xtbl[MAX_UCSLINES]; // x positions + int lines; // no. of lines + } subtitle; + struct { + int elems; + } progbar; + } params; + int stride; + int allocated; + unsigned char *alpha_buffer; + unsigned char *bitmap_buffer; + } mp_osd_obj_t; - OSD_PB_START =0x10, - OSD_PB_0 =0x11, - OSD_PB_END =0x12, - OSD_PB_1 =0x13 -}; + enum { + OSD_PLAY =0x01, + OSD_PAUSE =0x02, + OSD_STOP =0x03, + OSD_REW =0x04, + OSD_FFW =0x05, + OSD_CLOCK =0x06, + OSD_CONTRAST =0x07, + OSD_SATURATION =0x08, + OSD_VOLUME =0x09, + OSD_BRIGHTNESS =0x0A, + OSD_HUE =0x0B, + OSD_DVDMENU =0x0C, -typedef struct sub_data_s { - char * cp; - int unicode; - int utf8; - int pos; - int bg_color; /* subtitles background color */ - int bg_alpha; -}sub_data_t; -extern sub_data_t sub_data; + OSD_PB_START =0x10, + OSD_PB_0 =0x11, + OSD_PB_END =0x12, + OSD_PB_1 =0x13 + }; -typedef void (* __FASTCALL__ draw_osd_f)(any_t*vo,unsigned idx,int x0,int y0, int w,int h,const unsigned char* src,const unsigned char *srca, int stride); -typedef void (* __FASTCALL__ clear_osd_f)(any_t*vo,unsigned idx,int x0,int y0, int w,int h); + typedef struct sub_data_s { + char * cp; + int unicode; + int utf8; + int pos; + int bg_color; /* subtitles background color */ + int bg_alpha; + }sub_data_t; + extern sub_data_t sub_data; -/* for direct calll from XP-thread*/ -extern void __FASTCALL__ vo_draw_spudec(any_t*vo,unsigned idx,int dxs,int dys,draw_osd_f draw_alpha); + class Video_Output; -extern void __FASTCALL__ vo_draw_text(any_t*vo,unsigned idx,int dxs,int dys, draw_osd_f draw_alpha); -extern void __FASTCALL__ vo_remove_text(any_t*vo,unsigned idx,int dxs,int dys,clear_osd_f remove); + typedef void (* __FASTCALL__ draw_osd_f)(const Video_Output* vo,unsigned idx,int x0,int y0, int w,int h,const unsigned char* src,const unsigned char *srca, int stride); + typedef void (* __FASTCALL__ clear_osd_f)(const Video_Output* vo,unsigned idx,int x0,int y0, int w,int h); -void vo_init_osd(void); -int __FASTCALL__ vo_update_osd(any_t*vo,int dxs,int dys); -int __FASTCALL__ vo_osd_changed(int new_value); -int __FASTCALL__ get_osd_height(any_t* vo,int c,int h); -void __FASTCALL__ osd_set_nav_box (uint16_t sx, uint16_t sy, uint16_t ex, uint16_t ey); + /* for direct calll from XP-thread*/ + extern void __FASTCALL__ vo_draw_spudec(const Video_Output* vo,unsigned idx,int dxs,int dys,draw_osd_f draw_alpha); + extern void __FASTCALL__ vo_draw_text(const Video_Output* vo,unsigned idx,int dxs,int dys, draw_osd_f draw_alpha); + extern void __FASTCALL__ vo_remove_text(const Video_Output* vo,unsigned idx,int dxs,int dys,clear_osd_f remove); + + void vo_init_osd(void); + int __FASTCALL__ vo_update_osd(const Video_Output* vo,int dxs,int dys); + int __FASTCALL__ vo_osd_changed(int new_value); + int __FASTCALL__ get_osd_height(const Video_Output* vo,int c,int h); + void __FASTCALL__ osd_set_nav_box (uint16_t sx, uint16_t sy, uint16_t ex, uint16_t ey); +} // namespace #endif Modified: mplayerxp/libvo/video_out.cpp =================================================================== --- mplayerxp/libvo/video_out.cpp 2012-11-29 07:05:15 UTC (rev 481) +++ mplayerxp/libvo/video_out.cpp 2012-11-29 09:44:34 UTC (rev 482) @@ -48,6 +48,8 @@ #include "sub.h" #include "vo_msg.h" +namespace mpxp{ + VO_Config::VO_Config() { memset(&subdevice,0,reinterpret_cast<long>(&dbpp) - reinterpret_cast<long>(&subdevice)); movie_aspect=-1.0; @@ -94,16 +96,6 @@ NULL }; -/* fullscreen: - * bit 0 (0x01) means fullscreen (-fs) - * bit 1 (0x02) means mode switching (-vm) - * bit 2 (0x04) enables software scaling (-zoom) - * bit 3 (0x08) enables flipping (-flip) - */ -#define VOFLG_FS 0x00000001UL -#define VOFLG_VM 0x00000002UL -#define VOFLG_ZOOM 0x00000004UL -#define VOFLG_FLIP 0x00000008UL typedef struct dri_priv_s { unsigned flags; int has_dri; @@ -142,9 +134,26 @@ delete vo_iface; } -void vo_print_help(vo_data_t*vo) +Video_Output::Video_Output() { + inited=0; + osd_progbar_type=-1; + osd_progbar_value=100; // 0..256 + + vo_priv_t* priv; + priv=new(zeromem) vo_priv_t; + vo_priv=priv; + rnd_fill(antiviral_hole,reinterpret_cast<long>(&flags)-reinterpret_cast<long>(&antiviral_hole)); +} + +Video_Output::~Video_Output() { + vo_priv_t* priv=static_cast<vo_priv_t*>(vo_priv); + MSG_DBG3("dri_vo_dbg: vo_uninit\n"); + inited--; + delete priv; +} + +void Video_Output::print_help() const { - UNUSED(vo); unsigned i; MSG_INFO("Available video output drivers:\n"); i=0; @@ -155,9 +164,9 @@ MSG_INFO("\n"); } -MPXP_Rc vo_register(vo_data_t*vo,const char *driver_name) +MPXP_Rc Video_Output::_register(const char *driver_name) const { - vo_priv_t& priv=*static_cast<vo_priv_t*>(vo->vo_priv); + vo_priv_t& priv=*static_cast<vo_priv_t*>(vo_priv); unsigned i; if(!driver_name) priv.video_out=vo_infos[0]; else @@ -171,104 +180,24 @@ return priv.video_out?MPXP_Ok:MPXP_False; } -const vo_info_t* vo_get_info(vo_data_t*vo) +const vo_info_t* Video_Output::get_info() const { - vo_priv_t& priv=*static_cast<vo_priv_t*>(vo->vo_priv); + vo_priv_t& priv=*static_cast<vo_priv_t*>(vo_priv); return priv.video_out; } -vo_data_t* __FASTCALL__ vo_preinit_structs( void ) +MPXP_Rc Video_Output::init(const char *subdevice) const { - vo_data_t* vo; - - vo=new(zeromem) vo_data_t; - vo->osd_progbar_type=-1; - vo->osd_progbar_value=100; // 0..256 - - vo_priv_t* priv; - priv=new(zeromem) vo_priv_t; - vo->vo_priv=priv; - rnd_fill(vo->antiviral_hole,offsetof(vo_data_t,flags)-offsetof(vo_data_t,antiviral_hole)); - return vo; -} - -MPXP_Rc __FASTCALL__ vo_init(vo_data_t*vo,const char *subdevice) -{ - vo_priv_t& priv=*static_cast<vo_priv_t*>(vo->vo_priv); + vo_priv_t& priv=*static_cast<vo_priv_t*>(vo_priv); MSG_DBG3("dri_vo_dbg: vo_init(%s)\n",subdevice); priv.frame_counter=0; priv.vo_iface=priv.video_out->query_interface(subdevice); return priv.vo_iface?MPXP_Ok:MPXP_False; } -int __FASTCALL__ vo_describe_fourcc(uint32_t fourcc,vo_format_desc *vd) +void Video_Output::dri_config(uint32_t fourcc) const { - int is_planar; - is_planar=0; - vd->x_mul[0]=vd->x_mul[1]=vd->x_mul[2]=vd->x_mul[3]=1; - vd->x_div[0]=vd->x_div[1]=vd->x_div[2]=vd->x_div[3]=1; - vd->y_mul[0]=vd->y_mul[1]=vd->y_mul[2]=vd->y_mul[3]=1; - vd->y_div[0]=vd->y_div[1]=vd->y_div[2]=vd->y_div[3]=1; - switch(fourcc) - { - case IMGFMT_Y800: - is_planar=1; - case IMGFMT_RGB8: - case IMGFMT_BGR8: - vd->bpp = 8; - break; - case IMGFMT_YVU9: - case IMGFMT_IF09: - vd->bpp = 9; - vd->x_div[1]=vd->x_div[2]=4; - vd->y_div[1]=vd->y_div[2]=4; - is_planar=1; - break; - case IMGFMT_YV12: - case IMGFMT_I420: - case IMGFMT_IYUV: - vd->bpp = 12; - vd->x_div[1]=vd->x_div[2]=2; - vd->y_div[1]=vd->y_div[2]=2; - is_planar=1; - break; - case IMGFMT_YUY2: - case IMGFMT_YVYU: - case IMGFMT_UYVY: - vd->x_mul[0]=2; - vd->bpp = 16; - break; - case IMGFMT_RGB15: - case IMGFMT_BGR15: - vd->bpp = 15; - vd->x_mul[0]=2; - break; - case IMGFMT_RGB16: - case IMGFMT_BGR16: - vd->bpp = 16; - vd->x_mul[0]=2; - break; - case IMGFMT_RGB24: - case IMGFMT_BGR24: - vd->bpp = 24; - vd->x_mul[0]=3; - break; - case IMGFMT_RGB32: - case IMGFMT_BGR32: - vd->bpp = 32; - vd->x_mul[0]=4; - break; - default: - /* unknown fourcc */ - vd->bpp=0; - break; - } - return is_planar; -} - -static void __FASTCALL__ dri_config(vo_data_t*vo,uint32_t fourcc) -{ - vo_priv_t& priv=*static_cast<vo_priv_t*>(vo->vo_priv); + vo_priv_t& priv=*static_cast<vo_priv_t*>(vo_priv); priv.dri.is_planar = vo_describe_fourcc(fourcc,&priv.vod); priv.dri.bpp=priv.vod.bpp; if(!priv.dri.bpp) priv.dri.has_dri=0; /*unknown fourcc*/ @@ -278,9 +207,9 @@ } } -static void __FASTCALL__ ps_tune(vo_data_t*vo,unsigned width,unsigned height) +void Video_Output::ps_tune(unsigned width,unsigned height) const { - vo_priv_t& priv=*static_cast<vo_priv_t*>(vo->vo_priv); + vo_priv_t& priv=*static_cast<vo_priv_t*>(vo_priv); int src_is_planar; unsigned src_stride,ps_x,ps_y; vo_format_desc vd; @@ -291,34 +220,29 @@ priv.ps_off[0] = priv.ps_off[1] = priv.ps_off[2] = priv.ps_off[3] = 0; if(!src_is_planar) priv.ps_off[0] = ps_y*src_stride+ps_x*((vd.bpp+7)/8); - else - { + else { priv.ps_off[0] = ps_y*src_stride+ps_x; - if(vd.bpp==12) /*YV12 series*/ - { - priv.ps_off[1] = (ps_y/2)*(src_stride/2)+ps_x/2; - priv.ps_off[2] = (ps_y/2)*(src_stride/2)+ps_x/2; + if(vd.bpp==12) { /*YV12 series*/ + priv.ps_off[1] = (ps_y/2)*(src_stride/2)+ps_x/2; + priv.ps_off[2] = (ps_y/2)*(src_stride/2)+ps_x/2; } - else - if(vd.bpp==9) /*YVU9 series*/ - { - priv.ps_off[1] = (ps_y/4)*(src_stride/4)+ps_x/4; - priv.ps_off[2] = (ps_y/4)*(src_stride/4)+ps_x/4; + else if(vd.bpp==9) { /*YVU9 series*/ + priv.ps_off[1] = (ps_y/4)*(src_stride/4)+ps_x/4; + priv.ps_off[2] = (ps_y/4)*(src_stride/4)+ps_x/4; } } } -static void __FASTCALL__ dri_tune(vo_data_t*vo,unsigned width,unsigned height) +void Video_Output::dri_tune(unsigned width,unsigned height) const { - vo_priv_t& priv=*static_cast<vo_priv_t*>(vo->vo_priv); + vo_priv_t& priv=*static_cast<vo_priv_t*>(vo_priv); priv.dri.sstride=priv.dri.is_planar?width:width*((priv.dri.bpp+7)/8); priv.dri.off[0] = priv.dri.off[1] = priv.dri.off[2] = priv.dri.off[3] = 0; if(!priv.dri.is_planar) { priv.dri.planes_eq = priv.dri.sstride == priv.dri.cap.strides[0]; priv.dri.off[0] = priv.dri.cap.y*priv.dri.cap.strides[0]+priv.dri.cap.x*((priv.dri.bpp+7)/8); } - else - { + else { unsigned long y_off,u_off,v_off; dri_surface_t surf; surf.idx=0; @@ -327,36 +251,31 @@ u_off = (unsigned long)std::min(surf.planes[1],surf.planes[2]); v_off = (unsigned long)std::max(surf.planes[1],surf.planes[2]); priv.dri.off[0] = priv.dri.cap.y*priv.dri.cap.strides[0]+priv.dri.cap.x; - if(priv.dri.bpp==12) /*YV12 series*/ - { - priv.dri.planes_eq = width == priv.dri.cap.strides[0] && + if(priv.dri.bpp==12) { /*YV12 series*/ + priv.dri.planes_eq = width == priv.dri.cap.strides[0] && width*height == u_off - y_off && width*height*5/4 == v_off - y_off && priv.dri.cap.strides[0]/2 == priv.dri.cap.strides[1] && priv.dri.cap.strides[0]/2 == priv.dri.cap.strides[2]; - priv.dri.off[1] = (priv.dri.cap.y/2)*priv.dri.cap.strides[1]+priv.dri.cap.x/2; - priv.dri.off[2] = (priv.dri.cap.y/2)*priv.dri.cap.strides[2]+priv.dri.cap.x/2; + priv.dri.off[1] = (priv.dri.cap.y/2)*priv.dri.cap.strides[1]+priv.dri.cap.x/2; + priv.dri.off[2] = (priv.dri.cap.y/2)*priv.dri.cap.strides[2]+priv.dri.cap.x/2; } - else - if(priv.dri.bpp==9) /*YVU9 series*/ - { - priv.dri.planes_eq = width == priv.dri.cap.strides[0] && + else if(priv.dri.bpp==9) { /*YVU9 series*/ + priv.dri.planes_eq = width == priv.dri.cap.strides[0] && width*height == u_off - y_off && width*height*17/16 == v_off - y_off && priv.dri.cap.strides[0]/4 == priv.dri.cap.strides[1] && priv.dri.cap.strides[0]/4 == priv.dri.cap.strides[2]; - priv.dri.off[1] = (priv.dri.cap.y/4)*priv.dri.cap.strides[1]+priv.dri.cap.x/4; - priv.dri.off[2] = (priv.dri.cap.y/4)*priv.dri.cap.strides[2]+priv.dri.cap.x/4; - } - else - if(priv.dri.bpp==8) /*Y800 series*/ - priv.dri.planes_eq = width == priv.dri.cap.strides[0]; + priv.dri.off[1] = (priv.dri.cap.y/4)*priv.dri.cap.strides[1]+priv.dri.cap.x/4; + priv.dri.off[2] = (priv.dri.cap.y/4)*priv.dri.cap.strides[2]+priv.dri.cap.x/4; + } else if(priv.dri.bpp==8) /*Y800 series*/ + priv.dri.planes_eq = width == priv.dri.cap.strides[0]; } priv.dri.accel=(priv.dri.cap.caps&(DRI_CAP_DOWNSCALER|DRI_CAP_HORZSCALER| DRI_CAP_UPSCALER|DRI_CAP_VERTSCALER))== (DRI_CAP_DOWNSCALER|DRI_CAP_HORZSCALER| DRI_CAP_UPSCALER|DRI_CAP_VERTSCALER); - priv.dri.dr = priv.srcFourcc == priv.dri.cap.fourcc && !(priv.dri.flags & VOFLG_FLIP) && + priv.dri.dr = priv.srcFourcc == priv.dri.cap.fourcc && !(priv.dri.flags & VOFLAG_FLIPPING) && !priv.ps_off[0] && !priv.ps_off[1] && !priv.ps_off[2] && !priv.ps_off[3]; if(priv.dri.dr && priv.dri.cap.w < width) priv.dri.dr = priv.dri.cap.caps&(DRI_CAP_DOWNSCALER|DRI_CAP_HORZSCALER)?1:0; @@ -368,19 +287,19 @@ priv.dri.dr = priv.dri.cap.caps&(DRI_CAP_UPSCALER|DRI_CAP_VERTSCALER)?1:0; } -static void __FASTCALL__ dri_reconfig(vo_data_t*vo,int is_resize ) +void Video_Output::dri_reconfig(int is_resize ) const { - vo_priv_t& priv=*static_cast<vo_priv_t*>(vo->vo_priv); + vo_priv_t& priv=*static_cast<vo_priv_t*>(vo_priv); priv.dri.has_dri = 1; priv.vo_iface->get_surface_caps(&priv.dri.cap); - dri_config(vo,priv.dri.cap.fourcc); + dri_config(priv.dri.cap.fourcc); /* ugly workaround of swapped BGR-fourccs. Should be removed in the future */ if(!priv.dri.has_dri) { priv.dri.has_dri=1; priv.dri.cap.fourcc = bswap_32(priv.dri.cap.fourcc); - dri_config(vo,priv.dri.cap.fourcc); + dri_config(priv.dri.cap.fourcc); } - dri_tune(vo,priv.image_width,priv.image_height); + dri_tune(priv.image_width,priv.image_height); /* TODO: smart analizer of scaling possibilities of vo_driver */ if(is_resize) { xp_core->in_resize=1; @@ -389,21 +308,20 @@ vf_reinit_vo(priv.dri.cap.w,priv.dri.cap.h,priv.dri.cap.fourcc,0); } -static int vo_inited=0; -MPXP_Rc __FASTCALL__ vo_config(vo_data_t*vo,uint32_t width, uint32_t height, uint32_t d_width, - uint32_t d_height, uint32_t fullscreen, const char *title, +MPXP_Rc Video_Output::configure(uint32_t width, uint32_t height, uint32_t d_width, + uint32_t d_height, vo_flags_e _fullscreen, const char *title, uint32_t format) { - vo_priv_t& priv=*static_cast<vo_priv_t*>(vo->vo_priv); + vo_priv_t& priv=*static_cast<vo_priv_t*>(vo_priv); MPXP_Rc retval; unsigned dest_fourcc,w,d_w,h,d_h; MSG_DBG3("dri_vo_dbg: vo_config\n"); - if(vo_inited) { + if(inited) { MSG_FATAL("!!!priv.video_out internal fatal error: priv.video_out is initialized more than once!!!\n"); return MPXP_False; } - vo_inited++; - vo->flags=fullscreen; + inited++; + flags=_fullscreen; dest_fourcc = format; priv.org_width = width; priv.org_height = height; @@ -416,16 +334,16 @@ priv.dri.d_width = d_w; priv.dri.d_height = d_h; MSG_V("priv.video_out->config(%u,%u,%u,%u,0x%x,'%s',%s)\n" - ,w,h,d_w,d_h,fullscreen,title,vo_format_name(dest_fourcc)); - retval = priv.vo_iface->configure(w,h,d_w,d_h,fullscreen,title,dest_fourcc); + ,w,h,d_w,d_h,_fullscreen,title,vo_format_name(dest_fourcc)); + retval = priv.vo_iface->configure(w,h,d_w,d_h,_fullscreen,title,dest_fourcc); priv.srcFourcc=format; if(retval == MPXP_Ok) { priv.vo_iface->get_surface_caps(&priv.dri.cap); priv.image_format = format; priv.image_width = w; priv.image_height = h; - ps_tune(vo,priv.image_width,priv.org_height); - dri_reconfig(vo,0); + ps_tune(priv.image_width,priv.org_height); + dri_reconfig(0); MSG_V("dri_vo_caps: driver does %s support DRI\n",priv.dri.has_dri?"":"not"); MSG_V("dri_vo_caps: caps=%08X fourcc=%08X(%s) x,y,w,h(%u %u %u %u)\n" "dri_vo_caps: width_height(%u %u) strides(%u %u %u %u) priv.dri.bpp=%u\n" @@ -441,18 +359,18 @@ "dri_vo_src: flags=%08X fourcc=%08X(%s)\n" ,width,height ,d_width,d_height - ,fullscreen + ,_fullscreen ,format ,vo_format_name(format)); - priv.dri.flags = fullscreen; + priv.dri.flags = _fullscreen; } return retval; } /* if vo_driver doesn't support dri then it won't work with this logic */ -uint32_t __FASTCALL__ vo_query_format(vo_data_t*vo,uint32_t* fourcc, unsigned src_w, unsigned src_h) +uint32_t Video_Output::query_format(uint32_t* fourcc, unsigned src_w, unsigned src_h) const { - vo_priv_t& priv=*static_cast<vo_priv_t*>(vo->vo_priv); + vo_priv_t& priv=*static_cast<vo_priv_t*>(vo_priv); uint32_t dri_forced_fourcc; vo_query_fourcc_t qfourcc; MSG_DBG3("dri_vo_dbg: vo_query_format(%08lX)\n",*fourcc); @@ -466,16 +384,16 @@ return qfourcc.flags; } -MPXP_Rc vo_reset(vo_data_t*vo) +MPXP_Rc Video_Output::reset() const { - vo_priv_t& priv=*static_cast<vo_priv_t*>(vo->vo_priv); + vo_priv_t& priv=*static_cast<vo_priv_t*>(vo_priv); MSG_DBG3("dri_vo_dbg: vo_reset\n"); return priv.vo_iface->reset(); } -MPXP_Rc vo_screenshot(vo_data_t*vo,unsigned idx ) +MPXP_Rc Video_Output::screenshot(unsigned idx) const { - vo_priv_t& priv=*static_cast<vo_priv_t*>(vo->vo_priv); + vo_priv_t& priv=*static_cast<vo_priv_t*>(vo_priv); char buf[256]; MSG_DBG3("dri_vo_dbg: vo_screenshot\n"); sprintf(buf,"%llu",priv.frame_counter); @@ -485,68 +403,61 @@ return gr_screenshot(buf,const_cast<const uint8_t**>(surf.planes),priv.dri.cap.strides,priv.dri.cap.fourcc,priv.dri.cap.width,priv.dri.cap.height); } -MPXP_Rc vo_pause(vo_data_t*vo) +MPXP_Rc Video_Output::pause() const { - vo_priv_t& priv=*static_cast<vo_priv_t*>(vo->vo_priv); + vo_priv_t& priv=*static_cast<vo_priv_t*>(vo_priv); MSG_DBG3("dri_vo_dbg: vo_pause\n"); return priv.vo_iface->pause(); } -MPXP_Rc vo_resume(vo_data_t*vo) +MPXP_Rc Video_Output::resume() const { - vo_priv_t& priv=*static_cast<vo_priv_t*>(vo->vo_priv); + vo_priv_t& priv=*static_cast<vo_priv_t*>(vo_priv); MSG_DBG3("dri_vo_dbg: vo_resume\n"); return priv.vo_iface->resume(); } -MPXP_Rc __FASTCALL__ vo_get_surface_caps(vo_data_t* vo,dri_surface_cap_t*caps) { - vo_priv_t& priv=*static_cast<vo_priv_t*>(vo->vo_priv); +MPXP_Rc Video_Output::get_surface_caps(dri_surface_cap_t*caps) const { + vo_priv_t& priv=*static_cast<vo_priv_t*>(vo_priv); priv.vo_iface->get_surface_caps(caps); return MPXP_Ok; } -MPXP_Rc __FASTCALL__ vo_get_surface(vo_data_t*vo,mp_image_t* mpi) +MPXP_Rc Video_Output::get_surface(mp_image_t* mpi) const { - vo_priv_t& priv=*static_cast<vo_priv_t*>(vo->vo_priv); + vo_priv_t& priv=*static_cast<vo_priv_t*>(vo_priv); int width_less_stride; MSG_DBG2("dri_vo_dbg: vo_get_surface type=%X flg=%X\n",mpi->type,mpi->flags); width_less_stride = 0; - if(mpi->flags & MP_IMGFLAG_PLANAR) - { + if(mpi->flags & MP_IMGFLAG_PLANAR) { width_less_stride = mpi->w <= priv.dri.cap.strides[0] && (mpi->w>>mpi->chroma_x_shift) <= priv.dri.cap.strides[1] && (mpi->w>>mpi->chroma_x_shift) <= priv.dri.cap.strides[2]; } else width_less_stride = mpi->w*mpi->bpp <= priv.dri.cap.strides[0]; - if(priv.dri.has_dri) - { + if(priv.dri.has_dri) { /* static is singlebuffered decoding */ - if(mpi->type==MP_IMGTYPE_STATIC && priv.dri.num_xp_frames>1) - { + if(mpi->type==MP_IMGTYPE_STATIC && priv.dri.num_xp_frames>1) { MSG_DBG2("dri_vo_dbg: vo_get_surface FAIL mpi->type==MP_IMGTYPE_STATIC && priv.dri.num_xp_frames>1\n"); return MPXP_False; } /*I+P requires 2+ static buffers for R/W */ - if(mpi->type==MP_IMGTYPE_IP && (priv.dri.num_xp_frames < 2 || (priv.dri.cap.caps&DRI_CAP_VIDEO_MMAPED)==DRI_CAP_VIDEO_MMAPED)) - { + if(mpi->type==MP_IMGTYPE_IP && (priv.dri.num_xp_frames < 2 || (priv.dri.cap.caps&DRI_CAP_VIDEO_MMAPED)==DRI_CAP_VIDEO_MMAPED)) { MSG_DBG2("dri_vo_dbg: vo_get_surface FAIL (mpi->type==MP_IMGTYPE_IP && priv.dri.num_xp_frames < 2) || (priv.dri.cap.caps&DRI_CAP_VIDEO_MMAPED)==DRI_CAP_VIDEO_MMAPED\n"); return MPXP_False; } /*I+P+B requires 3+ static buffers for R/W */ - if(mpi->type==MP_IMGTYPE_IPB && (priv.dri.num_xp_frames != 3 || (priv.dri.cap.caps&DRI_CAP_VIDEO_MMAPED)==DRI_CAP_VIDEO_MMAPED)) - { + if(mpi->type==MP_IMGTYPE_IPB && (priv.dri.num_xp_frames != 3 || (priv.dri.cap.caps&DRI_CAP_VIDEO_MMAPED)==DRI_CAP_VIDEO_MMAPED)) { MSG_DBG2("dri_vo_dbg: vo_get_surface FAIL (mpi->type==MP_IMGTYPE_IPB && priv.dri.num_xp_frames != 3) || (priv.dri.cap.caps&DRI_CAP_VIDEO_MMAPED)==DRI_CAP_VIDEO_MMAPED\n"); return MPXP_False; } /* video surface is bad thing for reading */ - if(((mpi->flags&MP_IMGFLAG_READABLE)||(mpi->type==MP_IMGTYPE_TEMP)) && (priv.dri.cap.caps&DRI_CAP_VIDEO_MMAPED)==DRI_CAP_VIDEO_MMAPED) - { + if(((mpi->flags&MP_IMGFLAG_READABLE)||(mpi->type==MP_IMGTYPE_TEMP)) && (priv.dri.cap.caps&DRI_CAP_VIDEO_MMAPED)==DRI_CAP_VIDEO_MMAPED) { MSG_DBG2("dri_vo_dbg: vo_get_surface FAIL mpi->flags&MP_IMGFLAG_READABLE && (priv.dri.cap.caps&DRI_CAP_VIDEO_MMAPED)==DRI_CAP_VIDEO_MMAPED\n"); return MPXP_False; } /* it seems that surfaces are equal */ - if((((mpi->flags&MP_IMGFLAG_ACCEPT_STRIDE) && width_less_stride) || priv.dri.planes_eq) && priv.dri.dr) - { + if((((mpi->flags&MP_IMGFLAG_ACCEPT_STRIDE) && width_less_stride) || priv.dri.planes_eq) && priv.dri.dr) { dri_surface_t surf; surf.idx=mpi->xp_idx; priv.vo_iface->get_surface(&surf); @@ -566,11 +477,11 @@ else return MPXP_False; } -static int __FASTCALL__ adjust_size(const any_t*vo,unsigned cw,unsigned ch,unsigned *nw,unsigned *nh) +int Video_Output::adjust_size(unsigned cw,unsigned ch,unsigned *nw,unsigned *nh) const { - vo_priv_t& priv=*static_cast<vo_priv_t*>(((vo_data_t*)vo)->vo_priv); + vo_priv_t& priv=*static_cast<vo_priv_t*>(vo_priv); MSG_DBG3("dri_vo_dbg: adjust_size was called %u %u %u %u\n",cw,ch,*nw,*nh); - if((priv.dri.flags & VOFLG_ZOOM) && (cw != *nw || ch != *nh) && !(priv.dri.flags & VOFLG_FS)) + if((priv.dri.flags & VOFLAG_SWSCALE) && (cw != *nw || ch != *nh) && !(priv.dri.flags & VOFLAG_FULLSCREEN)) { float aspect,newv; aspect = (float)priv.dri.d_width / (float)priv.dri.d_height; @@ -592,16 +503,21 @@ return 0; } -int vo_check_events(vo_data_t*vo) +static int __FASTCALL__ adjust_size(const Video_Output*vo,unsigned cw,unsigned ch,unsigned *nw,unsigned *nh) { - vo_priv_t& priv=*static_cast<vo_priv_t*>(vo->vo_priv); + return vo->adjust_size(cw,ch,nw,nh); +} + +int Video_Output::check_events() const +{ + vo_priv_t& priv=*static_cast<vo_priv_t*>(vo_priv); uint32_t retval; int need_repaint; vo_resize_t vrest; MSG_DBG3("dri_vo_dbg: vo_check_events\n"); vrest.event_type = 0; - vrest.vo = vo; - vrest.adjust_size = adjust_size; + vrest.vo = this; + vrest.adjust_size = ::adjust_size; retval = vrest.event_type = priv.vo_iface->check_events(&vrest); /* it's ok since accelerated drivers doesn't touch surfaces but there is only one driver (vo_x11) which changes surfaces @@ -609,38 +525,38 @@ need_repaint=0; if(priv.dri.has_dri && retval == MPXP_True && (vrest.event_type & VO_EVENT_RESIZE) == VO_EVENT_RESIZE) { need_repaint=1; - dri_reconfig(vo,1); + dri_reconfig(1); } return (need_repaint && !priv.dri.accel) || (vrest.event_type&VO_EVENT_FORCE_UPDATE); } -MPXP_Rc vo_fullscreen(vo_data_t*vo) +MPXP_Rc Video_Output::fullscreen() const { - vo_priv_t& priv=*static_cast<vo_priv_t*>(vo->vo_priv); + vo_priv_t& priv=*static_cast<vo_priv_t*>(vo_priv); MPXP_Rc retval; MSG_DBG3("dri_vo_dbg: vo_fullscreen\n"); retval = priv.vo_iface->toggle_fullscreen(); if(priv.dri.has_dri && retval == MPXP_True) - dri_reconfig(vo,1); - if(retval == MPXP_True) priv.dri.flags ^= VOFLG_FS; + dri_reconfig(1); + if(retval == MPXP_True) priv.dri.flags ^= VOFLAG_FULLSCREEN; return retval; } -unsigned __FASTCALL__ vo_get_num_frames(vo_data_t*vo) { - vo_priv_t& priv=*static_cast<vo_priv_t*>(vo->vo_priv); +unsigned Video_Output::get_num_frames() const { + vo_priv_t& priv=*static_cast<vo_priv_t*>(vo_priv); return priv.dri.num_xp_frames; } -MPXP_Rc __FASTCALL__ vo_draw_slice(vo_data_t*vo,const mp_image_t *mpi) +MPXP_Rc Video_Output::draw_slice(const mp_image_t *mpi) const { - vo_priv_t& priv=*static_cast<vo_priv_t*>(vo->vo_priv); + vo_priv_t& priv=*static_cast<vo_priv_t*>(vo_priv); unsigned i,_w[4],_h[4],x,y; MSG_DBG3("dri_vo_dbg: vo_draw_slice xywh=%i %i %i %i\n",mpi->x,mpi->y,mpi->w,mpi->h); if(priv.dri.has_dri) { uint8_t *dst[4]; const uint8_t *ps_src[4]; int dstStride[4]; - int finalize=vo_is_final(vo); + int finalize=is_final(); unsigned idx = mpi->xp_idx; dri_surface_t surf; surf.idx=idx; @@ -669,16 +585,16 @@ return MPXP_False; } -void vo_select_frame(vo_data_t*vo,unsigned play_idx) +void Video_Output::select_frame(unsigned play_idx) const { - vo_priv_t& priv=*static_cast<vo_priv_t*>(vo->vo_priv); + vo_priv_t& priv=*static_cast<vo_priv_t*>(vo_priv); MSG_DBG2("dri_vo_dbg: vo_select_frame(play_idx=%u)\n",play_idx); priv.vo_iface->select_frame(play_idx); } -void vo_flush_page(vo_data_t*vo,unsigned decoder_idx) +void Video_Output::flush_page(unsigned decoder_idx) const { - vo_priv_t& priv=*static_cast<vo_priv_t*>(vo->vo_priv); + vo_priv_t& priv=*static_cast<vo_priv_t*>(vo_priv); MSG_DBG3("dri_vo_dbg: vo_flush_pages [idx=%u]\n",decoder_idx); priv.frame_counter++; if((priv.dri.cap.caps & DRI_CAP_VIDEO_MMAPED)!=DRI_CAP_VIDEO_MMAPED) @@ -686,9 +602,9 @@ } /* DRAW OSD */ -static void __FASTCALL__ clear_rect(vo_data_t*vo,unsigned _y0,unsigned h,uint8_t *dest,unsigned stride,unsigned dstride,uint8_t filler) +void Video_Output::clear_rect(unsigned _y0,unsigned h,uint8_t *dest,unsigned stride,unsigned dstride,uint8_t filler) const { - vo_priv_t& priv=*static_cast<vo_priv_t*>(vo->vo_priv); + vo_priv_t& priv=*static_cast<vo_priv_t*>(vo_priv); unsigned i; for(i=0;i<h;i++) { @@ -697,9 +613,9 @@ } } -static void __FASTCALL__ clear_rect2(vo_data_t*vo,unsigned _y0,unsigned h,uint8_t *dest,unsigned stride,unsigned dstride,uint8_t filler) +void Video_Output::clear_rect2(unsigned _y0,unsigned h,uint8_t *dest,unsigned stride,unsigned dstride,uint8_t filler) const { - vo_priv_t& priv=*static_cast<vo_priv_t*>(vo->vo_priv); + vo_priv_t& priv=*static_cast<vo_priv_t*>(vo_priv); unsigned i; unsigned _y1 = priv.dri.cap.y/2; unsigned _y2 = (priv.dri.cap.y+priv.dri.cap.h)/2; @@ -710,9 +626,9 @@ } } -static void __FASTCALL__ clear_rect4(vo_data_t*vo,unsigned _y0,unsigned h,uint8_t *dest,unsigned stride,unsigned dstride,uint8_t filler) +void Video_Output::clear_rect4(unsigned _y0,unsigned h,uint8_t *dest,unsigned stride,unsigned dstride,uint8_t filler) const { - vo_priv_t& priv=*static_cast<vo_priv_t*>(vo->vo_priv); + vo_priv_t& priv=*static_cast<vo_priv_t*>(vo_priv); unsigned i; unsigned _y1 = priv.dri.cap.y/4; unsigned _y2 = (priv.dri.cap.y+priv.dri.cap.h)/4; @@ -723,9 +639,9 @@ } } -static void __FASTCALL__ clear_rect_rgb(vo_data_t*vo,unsigned _y0,unsigned h,uint8_t *dest,unsigned stride,unsigned dstride) +void Video_Output::clear_rect_rgb(unsigned _y0,unsigned h,uint8_t *dest,unsigned stride,unsigned dstride) const { - vo_priv_t& priv=*static_cast<vo_priv_t*>(vo->vo_priv); + vo_priv_t& priv=*static_cast<vo_priv_t*>(vo_priv); unsigned i; for(i=0;i<h;i++) { @@ -734,9 +650,9 @@ } } -static void __FASTCALL__ clear_rect_yuy2(vo_data_t*vo,unsigned _y0,unsigned h,uint8_t *dest,unsigned stride,unsigned dstride) +void Video_Output::clear_rect_yuy2(unsigned _y0,unsigned h,uint8_t *dest,unsigned stride,unsigned dstride) const { - vo_priv_t& priv=*static_cast<vo_priv_t*>(vo->vo_priv); + vo_priv_t& priv=*static_cast<vo_priv_t*>(vo_priv); unsigned i; for(i=0;i<h;i++) { @@ -755,14 +671,13 @@ } } -static void __FASTCALL__ dri_remove_osd(any_t*_vo,unsigned idx,int x0,int _y0, int w,int h) +void Video_Output::dri_remove_osd(unsigned idx,int x0,int _y0, int w,int h) const { - vo_data_t* vo=reinterpret_cast<vo_data_t*>(_vo); - vo_priv_t& priv=*static_cast<vo_priv_t*>(vo->vo_priv); + vo_priv_t& priv=*static_cast<vo_priv_t*>(vo_priv); dri_surface_t surf; surf.idx=idx; priv.vo_iface->get_surface(&surf); - if(x0+w<=priv.dri.cap.width&&_y0+h<=priv.dri.cap.height) + if(unsigned(x0+w)<=priv.dri.cap.width&&unsigned(_y0+h)<=priv.dri.cap.height) switch(priv.dri.cap.fourcc) { case IMGFMT_RGB15: @@ -773,49 +688,49 @@ case IMGFMT_BGR24: case IMGFMT_RGB32: case IMGFMT_BGR32: - clear_rect_rgb(vo,_y0,h,surf.planes[0]+_y0*priv.dri.cap.strides[0]+x0*((priv.dri.bpp+7)/8), + clear_rect_rgb(_y0,h,surf.planes[0]+_y0*priv.dri.cap.strides[0]+x0*((priv.dri.bpp+7)/8), w*(priv.dri.bpp+7)/8,priv.dri.cap.strides[0]); break; case IMGFMT_YVYU: case IMGFMT_YUY2: - clear_rect_yuy2(vo,_y0,h,surf.planes[0]+_y0*priv.dri.cap.strides[0]+x0*2, + clear_rect_yuy2(_y0,h,surf.planes[0]+_y0*priv.dri.cap.strides[0]+x0*2, w*2,priv.dri.cap.strides[0]); break; case IMGFMT_UYVY: - clear_rect_yuy2(vo,_y0,h,surf.planes[0]+_y0*priv.dri.cap.strides[0]+x0*2+1, + clear_rect_yuy2(_y0,h,surf.planes[0]+_y0*priv.dri.cap.strides[0]+x0*2+1, w*2,priv.dri.cap.strides[0]); break; case IMGFMT_Y800: - clear_rect(vo,_y0,h,surf.planes[0]+_y0*priv.dri.cap.strides[0]+x0, + clear_rect(_y0,h,surf.planes[0]+_y0*priv.dri.cap.strides[0]+x0, w,priv.dri.cap.strides[0],0x10); break; case IMGFMT_YV12: case IMGFMT_I420: case IMGFMT_IYUV: - clear_rect(vo,_y0,h,surf.planes[0]+_y0*priv.dri.cap.strides[0]+x0, + clear_rect(_y0,h,surf.planes[0]+_y0*priv.dri.cap.strides[0]+x0, w,priv.dri.cap.strides[0],0x10); - clear_rect2(vo,_y0/2,h/2,surf.planes[1]+_y0/2*priv.dri.cap.strides[1]+x0/2, + clear_rect2(_y0/2,h/2,surf.planes[1]+_y0/2*priv.dri.cap.strides[1]+x0/2, w/2,priv.dri.cap.strides[1],0x80); - clear_rect2(vo,_y0/2,h/2,surf.planes[2]+_y0/2*priv.dri.cap.strides[2]+x0/2, + clear_rect2(_y0/2,h/2,surf.planes[2]+_y0/2*priv.dri.cap.strides[2]+x0/2, w/2,priv.dri.cap.strides[2],0x80); break; case IMGFMT_YVU9: case IMGFMT_IF09: - clear_rect(vo,_y0,h,surf.planes[0]+_y0*priv.dri.cap.strides[0]+x0, + clear_rect(_y0,h,surf.planes[0]+_y0*priv.dri.cap.strides[0]+x0, w,priv.dri.cap.strides[0],0x10); - clear_rect4(vo,_y0/4,h/4,surf.planes[1]+_y0/4*priv.dri.cap.strides[1]+x0/4, + clear_rect4(_y0/4,h/4,surf.planes[1]+_y0/4*priv.dri.cap.strides[1]+x0/4, w/4,priv.dri.cap.strides[1],0x80); - clear_rect4(vo,_y0/4,h/4,surf.planes[2]+_y0/4*priv.dri.cap.strides[2]+x0/4, + clear_rect4(_y0/4,h/4,surf.planes[2]+_y0/4*priv.dri.cap.strides[2]+x0/4, w/4,priv.dri.cap.strides[2],0x80); break; } } -static void __FASTCALL__ dri_draw_osd(any_t*vo,unsigned idx,int x0,int _y0, int w,int h,const unsigned char* src,const unsigned char *srca, int stride) +void Video_Output::dri_draw_osd(unsigned idx,int x0,int _y0, int w,int h,const unsigned char* src,const unsigned char *srca, int stride) const { - vo_priv_t& priv=*static_cast<vo_priv_t*>(reinterpret_cast<vo_data_t*>(vo)->vo_priv); - int finalize=vo_is_final(reinterpret_cast<vo_data_t*>(vo)); - if(x0+w<=priv.dri.cap.width&&_y0+h<=priv.dri.cap.height) + vo_priv_t& priv=*static_cast<vo_priv_t*>(vo_priv); + int finalize=is_final(); + if(unsigned(x0+w)<=priv.dri.cap.width&&unsigned(_y0+h)<=priv.dri.cap.height) { if(!priv.draw_alpha) priv.draw_alpha=new(zeromem) OSD_Render(priv.dri.cap.fourcc); if(priv.draw_alpha) { @@ -829,53 +744,119 @@ } } -void vo_draw_osd(vo_data_t*vo,unsigned idx) +static void dri_remove_osd(const Video_Output* vo,unsigned idx,int x0,int _y0, int w,int h) { + return vo->dri_remove_osd(idx,x0,_y0,w,h); +} +static void dri_draw_osd(const Video_Output* vo,unsigned idx,int x0,int _y0, int w,int h,const unsigned char* src,const unsigned char *srca, int stride) { + return vo->dri_draw_osd(idx,x0,_y0,w,h,src,srca,stride); +} + +void Video_Output::draw_osd(unsigned idx) const { - vo_priv_t& priv=*static_cast<vo_priv_t*>(vo->vo_priv); + vo_priv_t& priv=*static_cast<vo_priv_t*>(vo_priv); MSG_DBG3("dri_vo_dbg: vo_draw_osd\n"); if(priv.dri.has_dri && !(priv.dri.cap.caps & DRI_CAP_HWOSD)) { if( priv.dri.cap.x || priv.dri.cap.y || priv.dri.cap.w != priv.dri.cap.width || priv.dri.cap.h != priv.dri.cap.height) - vo_remove_text(vo,idx,priv.dri.cap.width,priv.dri.cap.height,dri_remove_osd); - vo_draw_text(vo,idx,priv.dri.cap.width,priv.dri.cap.height,dri_draw_osd); + vo_remove_text(this,idx,priv.dri.cap.width,priv.dri.cap.height,::dri_remove_osd); + vo_draw_text(this,idx,priv.dri.cap.width,priv.dri.cap.height,::dri_draw_osd); } } -void vo_draw_spudec_direct(vo_data_t*vo,unsigned idx) +void Video_Output::draw_spudec_direct(unsigned idx) const { - vo_priv_t& priv=*static_cast<vo_priv_t*>(vo->vo_priv); + vo_priv_t& priv=*static_cast<vo_priv_t*>(vo_priv); MSG_DBG3("dri_vo_dbg: vo_draw_osd\n"); if(priv.dri.has_dri && !(priv.dri.cap.caps & DRI_CAP_HWOSD)) { // if( priv.dri.cap.x || priv.dri.cap.y || // priv.dri.cap.w != priv.dri.cap.width || priv.dri.cap.h != priv.dri.cap.height) // vo_remove_text(idx,priv.dri.cap.width,priv.dri.cap.height,dri_remove_osd); - vo_draw_spudec(vo,idx,priv.dri.cap.width,priv.dri.cap.height,dri_draw_osd); + vo_draw_spudec(this,idx,priv.dri.cap.width,priv.dri.cap.height,::dri_draw_osd); } } -void vo_uninit(vo_data_t*vo) -{ - vo_priv_t* priv=static_cast<vo_priv_t*>(vo->vo_priv); - MSG_DBG3("dri_vo_dbg: vo_uninit\n"); - vo_inited--; - delete priv; -} -MPXP_Rc __FASTCALL__ vo_control(vo_data_t*vo,uint32_t request, any_t*data) +MPXP_Rc Video_Output::ctrl(uint32_t request, any_t*data) const { MPXP_Rc rval; - vo_priv_t& priv=*static_cast<vo_priv_t*>(vo->vo_priv); + vo_priv_t& priv=*static_cast<vo_priv_t*>(vo_priv); rval=priv.vo_iface->ctrl(request,data); MSG_DBG3("dri_vo_dbg: %u=vo_control( %u, %p )\n",rval,request,data); return rval; } -int __FASTCALL__ vo_is_final(vo_data_t*vo) { - vo_priv_t& priv=*static_cast<vo_priv_t*>(vo->vo_priv); +int Video_Output::is_final() const { + vo_priv_t& priv=*static_cast<vo_priv_t*>(vo_priv); int mmaped=priv.dri.cap.caps&DRI_CAP_VIDEO_MMAPED; int busmaster=priv.dri.cap.caps&DRI_CAP_BUSMASTERING; return mmaped||busmaster||(priv.dri.num_xp_frames>1); } +int __FASTCALL__ vo_describe_fourcc(uint32_t fourcc,vo_format_desc *vd) +{ + int is_planar; + is_planar=0; + vd->x_mul[0]=vd->x_mul[1]=vd->x_mul[2]=vd->x_mul[3]=1; + vd->x_div[0]=vd->x_div[1]=vd->x_div[2]=vd->x_div[3]=1; + vd->y_mul[0]=vd->y_mul[1]=vd->y_mul[2]=vd->y_mul[3]=1; + vd->y_div[0]=vd->y_div[1]=vd->y_div[2]=vd->y_div[3]=1; + switch(fourcc) + { + case IMGFMT_Y800: + is_planar=1; + case IMGFMT_RGB8: + case IMGFMT_BGR8: + vd->bpp = 8; + break; + case IMGFMT_YVU9: + case IMGFMT_IF09: + vd->bpp = 9; + vd->x_div[1]=vd->x_div[2]=4; + vd->y_div[1]=vd->y_div[2]=4; + is_planar=1; + break; + case IMGFMT_YV12: + case IMGFMT_I420: + case IMGFMT_IYUV: + vd->bpp = 12; + vd->x_div[1]=vd->x_div[2]=2; + vd->y_div[1]=vd->y_div[2]=2; + is_planar=1; + break; + case IMGFMT_YUY2: + case IMGFMT_YVYU: + case IMGFMT_UYVY: + vd->x_mul[0]=2; + vd->bpp = 16; + break; + case IMGFMT_RGB15: + case IMGFMT_BGR15: + vd->bpp = 15; + vd->x_mul[0]=2; + break; + case IMGFMT_RGB16: + case IMGFMT_BGR16: + vd->bpp = 16; + vd->x_mul[0]=2; + break; + case IMGFMT_RGB24: + case IMGFMT_BGR24: + vd->bpp = 24; + vd->x_mul[0]=3; + break; + case IMGFMT_RGB32: + case IMGFMT_BGR32: + vd->bpp = 32; + vd->x_mul[0]=4; + break; + default: + /* unknown fourcc */ + vd->bpp=0; + break; + } + return is_planar; +} + +} // namespace mpxp Modified: mplayerxp/libvo/video_out.h =================================================================== --- mplayerxp/libvo/video_out.h 2012-11-29 07:05:15 UTC (rev 481) +++ mplayerxp/libvo/video_out.h 2012-11-29 09:44:34 UTC (rev 482) @@ -27,55 +27,61 @@ #include "xmpcore/mp_image.h" #include "xmpcore/xmp_enums.h" -enum { - VO_EVENT_EXPOSE =1, - VO_EVENT_RESIZE =2, - VO_EVENT_KEYPRESS =4, - VO_EVENT_FORCE_UPDATE=0x80000000 -}; +namespace mpxp { + enum { + VO_EVENT_EXPOSE =1, + VO_EVENT_RESIZE =2, + VO_EVENT_KEYPRESS =4, + VO_EVENT_FORCE_UPDATE =0x80000000 + }; -enum { - VOCTRL_SET_EQUALIZER=1, /**< Set video equalizer */ - VOCTRL_GET_EQUALIZER /**< Get video equalizer */ -}; + enum { + VOCTRL_SET_EQUALIZER=1, /**< Set video equalizer */ + VOCTRL_GET_EQUALIZER /**< Get video equalizer */ + }; -enum { - VOFLAG_FULLSCREEN =0x01, /**< User wants to have fullscreen playback */ - VOFLAG_MODESWITCHING=0x02, /**< User enables to find the best video mode */ - VOFLAG_SWSCALE =0x04, /**< Obsolete. User enables slow Software scaler */ - VOFLAG_FLIPPING =0x08 /**< User enables page flipping (doublebuffering / XP mode) */ -}; + enum vo_flags_e { + VOFLAG_NONE =0x00, /**< User wants to have fullscreen playback */ + VOFLAG_FULLSCREEN =0x01, /**< User wants to have fullscreen playback */ + VOFLAG_MODESWITCHING =0x02, /**< User enables to find the best video mode */ + VOFLAG_SWSCALE =0x04, /**< Obsolete. User enables slow Software scaler */ + VOFLAG_FLIPPING =0x08 /**< User enables page flipping (doublebuffering / XP mode) */ + }; -/** Text description of VO-driver */ -class VO_Interface; -typedef VO_Interface* (*query_interface_t)(const char* args); -struct vo_info_t -{ - const char* name; /**< driver name ("Matrox Millennium G200/G400") */ - const char* short_name; /**< short name (for config strings) ("mga") */ - const char* author; /**< author ("Aaron Holtzman <aho...@es...>") */ - const char* comment;/**< any additional comments */ - query_interface_t query_interface; -}; + /** Text description of VO-driver */ + class VO_Interface; + typedef VO_Interface* (*query_interface_t)(const char* args); + struct vo_info_t { + const char* name; /**< driver name ("Matrox Millennium G200/G400") */ + const char* short_name; /**< short name (for config strings) ("mga") */ + const char* author; /**< author ("Aaron Holtzman <aho...@es...>") */ + const char* comment;/**< any additional comments */ + query_interface_t query_interface; + }; -enum { - VOCAP_NA=0x00, - VOCAP_SUPPORTED=0x01, - VOCAP_HWSCALER=0x02, - VOCAP_FLIP=0x04 -}; -/** Request for supported FOURCC by VO-driver */ -typedef struct vo_query_fourcc_s -{ - uint32_t fourcc; /**< Fourcc of decoded image */ - unsigned w,h; /**< Width and height of decoded image */ - unsigned flags; /**< Flags for this fourcc VOCAP_* */ -}vo_query_fourcc_t; + enum { + VOCAP_NA=0x00, + VOCAP_SUPPORTED=0x01, + VOCAP_HWSCALER=0x02, + VOCAP_FLIP=0x04 + }; + inline vo_flags_e operator~(vo_flags_e a) { return static_cast<vo_flags_e>(~static_cast<unsigned>(a)); } + inline vo_flags_e operator|(vo_flags_e a, vo_flags_e b) { return static_cast<vo_flags_e>(static_cast<unsigned>(a)|static_cast<unsigned>(b)); } + inline vo_flags_e operator&(vo_flags_e a, vo_flags_e b) { return static_cast<vo_flags_e>(static_cast<unsigned>(a)&static_cast<unsigned>(b)); } + inline vo_flags_e operator^(vo_flags_e a, vo_flags_e b) { return static_cast<vo_flags_e>(static_cast<unsigned>(a)^static_cast<unsigned>(b)); } + inline vo_flags_e operator|=(vo_flags_e a, vo_flags_e b) { return (a=static_cast<vo_flags_e>(static_cast<unsigned>(a)|static_cast<unsigned>(b))); } + inline vo_flags_e operator&=(vo_flags_e a, vo_flags_e b) { return (a=static_cast<vo_flags_e>(static_cast<unsigned>(a)&static_cast<unsigned>(b))); } + inline vo_flags_e operator^=(vo_flags_e a, vo_flags_e b) { return (a=static_cast<vo_flags_e>(static_cast<unsigned>(a)^static_cast<unsigned>(b))); } + /** Request for supported FOURCC by VO-driver */ + typedef struct vo_query_fourcc_s { + uint32_t fourcc; /**< Fourcc of decoded image */ + unsigned w,h; /**< Width and height of decoded image */ + unsigned flags; /**< Flags for this fourcc VOCAP_* */ + }vo_query_fourcc_t; -/** Named video equalizer */ -typedef struct vo_videq_s -{ + /** Named video equalizer */ + typedef struct vo_videq_s { #define VO_EC_BRIGHTNESS "Brightness" #define VO_EC_CONTRAST "Contrast" #define VO_EC_GAMMA "Gamma" @@ -84,152 +90,162 @@ #define VO_EC_RED_INTENSITY "RedIntensity" #define VO_EC_GREEN_INTENSITY "GreenIntensity" #define VO_EC_BLUE_INTENSITY "BlueIntensity" - const char *name; /**< name of equalizer control */ - int value; /**< value of equalizer control in range -1000 +1000 */ -}vo_videq_t; + const char *name; /**< name of equalizer control */ + int value; /**< value of equalizer control in range -1000 +1000 */ + }vo_videq_t; -typedef struct vo_gamma_s{ - int brightness; - int saturation; - int contrast; - int hue; - int red_intensity; - int green_intensity; - int blue_intensity; -}vo_gamma_t; + typedef struct vo_gamma_s{ + int brightness; + int saturation; + int contrast; + int hue; + int red_intensity; + int green_intensity; + int blue_intensity; + }vo_gamma_t; -typedef struct vo_rect_s { - unsigned x,y,w,h; -}vo_rect_t; + typedef struct vo_rect_s { + unsigned x,y,w,h; + }vo_rect_t; -struct vo_rect2 { - int left, right, top, bottom, width, height; -}; + struct vo_rect2 { + int left, right, top, bottom, width, height; + }; -struct VO_Config { - VO_Config(); - ~VO_Config() {} + struct VO_Config { + VO_Config(); + ~VO_Config() {} - char * subdevice; // currently unused - char* mDisplayName; - int xinerama_screen; + char * subdevice; // currently unused + char* mDisplayName; + int xinerama_screen; - int vsync; + int vsync; - unsigned xp_buffs; /**< contains number of buffers for decoding ahead */ - unsigned use_bm; /**< indicates user's agreement for using busmastering */ + unsigned xp_buffs; /**< contains number of buffers for decoding ahead */ + unsigned use_bm; /**< indicates user's agreement for using busmastering */ - vo_gamma_t gamma; + vo_gamma_t gamma; - int image_width; //opt_screen_size_x - int image_height; //opt_screen_size_y - float image_zoom; //screen_size_xy + int image_width; //opt_screen_size_x + int image_height; //opt_screen_size_y + float image_zoom; //screen_size_xy - float movie_aspect; - int fsmode; - int vidmode; - int fullscreen; - int softzoom; - int flip; - unsigned dbpp; -}; -extern VO_Config vo_conf; + float movie_aspect; + int fsmode; + int vidmode; + int fullscreen; + int sof... [truncated message content] |