[Mplayerxp-cvslog] SF.net SVN: mplayerxp:[164] mplayerxp
Brought to you by:
olov
From: <nic...@us...> - 2012-10-16 16:31:48
|
Revision: 164 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=164&view=rev Author: nickols_k Date: 2012-10-16 16:31:36 +0000 (Tue, 16 Oct 2012) Log Message: ----------- optimize size+speed: combine variables into structures Modified Paths: -------------- mplayerxp/cfg-mplayer.h mplayerxp/configure mplayerxp/find_sub.c mplayerxp/libmpdemux/demux_mkv.c mplayerxp/libmpdemux/demux_mpxp64.c mplayerxp/libmpdemux/demux_ogg.c mplayerxp/libmpdemux/demuxer.c mplayerxp/libmpdemux/s_dvdnav.c mplayerxp/libmpdemux/sub_cc.c mplayerxp/libmpdemux/sub_ty.c mplayerxp/libvo/font_load.c mplayerxp/libvo/screenshot.c mplayerxp/libvo/sub.c mplayerxp/libvo/sub.h mplayerxp/libvo/video_out.c mplayerxp/libvo/video_out.h mplayerxp/libvo/vo_dga.c mplayerxp/libvo/vo_fbdev.c mplayerxp/libvo/vo_null.c mplayerxp/libvo/vo_opengl.c mplayerxp/libvo/vo_vesa.c mplayerxp/libvo/vo_x11.c mplayerxp/libvo/vo_xv.c mplayerxp/libvo/vo_xvidix.c mplayerxp/libvo/vosub_vidix.c mplayerxp/libvo/x11_common.c mplayerxp/libvo/x11_common.h mplayerxp/mplayer.c mplayerxp/postproc/libmenu/menu.c mplayerxp/postproc/libmenu/menu_list.c mplayerxp/postproc/libmenu/menu_txt.c mplayerxp/spudec.c mplayerxp/spudec.h mplayerxp/subreader.c mplayerxp/subreader.h Modified: mplayerxp/cfg-mplayer.h =================================================================== --- mplayerxp/cfg-mplayer.h 2012-10-15 16:05:13 UTC (rev 163) +++ mplayerxp/cfg-mplayer.h 2012-10-16 16:31:36 UTC (rev 164) @@ -22,25 +22,12 @@ extern int fakemono; // defined in dec_audio.c #endif -#ifdef USE_SUB -extern int sub_unicode; -extern int sub_utf8; -#ifdef USE_ICONV -extern char *sub_cp; -#endif -extern int sub_pos; -#endif extern int subcc_enabled; #ifdef USE_OSD extern int osd_level; #endif -#ifdef HAVE_X11 -extern char *mDisplayName; -extern int WinID; -#endif - #ifdef HAVE_AA extern int vo_aa_parseoption(struct config * conf, char *opt, char * param); extern void vo_aa_revertoption(config_t* opt,char* param); @@ -245,16 +232,16 @@ #ifdef USE_SUB {"file", &sub_name, CONF_TYPE_STRING, 0, 0, 0, NULL, "specifies the subtitle file"}, #ifdef USE_ICONV - {"cp", &sub_cp, CONF_TYPE_STRING, 0, 0, 0, NULL, "specifies codepage of subtitles"}, + {"cp", &sub_data.cp, CONF_TYPE_STRING, 0, 0, 0, NULL, "specifies codepage of subtitles"}, #endif {"delay", &sub_delay, CONF_TYPE_FLOAT, 0, 0.0, 10.0, NULL, "delays subtitles by given number of seconds"}, {"fps", &sub_fps, CONF_TYPE_FLOAT, 0, 0.0, 10.0, NULL, "specifies frame/sec rate of subtitle file"}, {"noauto", &sub_auto, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disable autodetection of vobsub for textsubs if vobsub found"}, - {"unicode", &sub_unicode, CONF_TYPE_FLAG, 0, 0, 1, NULL, "tells MPlayerXP to handle the subtitle file as UNICODE"}, - {"nounicode", &sub_unicode, CONF_TYPE_FLAG, 0, 1, 0, NULL, "tells MPlayerXP to handle the subtitle file as non-UNICODE"}, - {"utf8", &sub_utf8, CONF_TYPE_FLAG, 0, 0, 1, NULL, "tells MPlayerXP to handle the subtitle file as UTF8"}, - {"noutf8", &sub_utf8, CONF_TYPE_FLAG, 0, 1, 0, NULL, "tells MPlayerXP to handle the subtitle file as non-UTF8"}, - {"pos",&sub_pos, CONF_TYPE_INT, CONF_RANGE, 0, 100, NULL, "specifies vertical shift of subtitles"}, + {"unicode", &sub_data.unicode, CONF_TYPE_FLAG, 0, 0, 1, NULL, "tells MPlayerXP to handle the subtitle file as UNICODE"}, + {"nounicode", &sub_data.unicode, CONF_TYPE_FLAG, 0, 1, 0, NULL, "tells MPlayerXP to handle the subtitle file as non-UNICODE"}, + {"utf8", &sub_data.utf8, CONF_TYPE_FLAG, 0, 0, 1, NULL, "tells MPlayerXP to handle the subtitle file as UTF8"}, + {"noutf8", &sub_data.utf8, CONF_TYPE_FLAG, 0, 1, 0, NULL, "tells MPlayerXP to handle the subtitle file as non-UTF8"}, + {"pos",&sub_data.pos, CONF_TYPE_INT, CONF_RANGE, 0, 100, NULL, "specifies vertical shift of subtitles"}, #endif {"cc", &subcc_enabled, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enable DVD Closed Caption (CC) subtitles"}, {"nocc", &subcc_enabled, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disable DVD Closed Caption (CC) subtitles"}, @@ -266,9 +253,9 @@ #ifdef HAVE_X11 static const config_t x11_config[]={ - {"display", &mDisplayName, CONF_TYPE_STRING, 0, 0, 0, NULL, "specifies the hostname and display number of the X server"}, - {"wid", &WinID, CONF_TYPE_INT, 0, 0, 0, NULL, "tells MPlayerXP to use existing X11 window (for using MPlayerXP as plugin)"}, - {"rootwin", &WinID, CONF_TYPE_FLAG, 0, -1, 0, NULL, "render movie in the root window (desktop background)"}, + {"display", &vo.mDisplayName, CONF_TYPE_STRING, 0, 0, 0, NULL, "specifies the hostname and display number of the X server"}, + {"wid", &vo.WinID, CONF_TYPE_INT, 0, 0, 0, NULL, "tells MPlayerXP to use existing X11 window (for using MPlayerXP as plugin)"}, + {"rootwin", &vo.WinID, CONF_TYPE_FLAG, 0, -1, 0, NULL, "render movie in the root window (desktop background)"}, #ifdef HAVE_XINERAMA {"xinerama", &xinerama_screen, CONF_TYPE_INT, CONF_RANGE, 0, 32, NULL, "tells MPlayerXP the display for movie playback"}, #endif Modified: mplayerxp/configure =================================================================== --- mplayerxp/configure 2012-10-15 16:05:13 UTC (rev 163) +++ mplayerxp/configure 2012-10-16 16:31:36 UTC (rev 164) @@ -699,10 +699,6 @@ enabled tv && print_config USE_ mp_config.h mp_config.mak tv enabled tv && inputmodules="tv $inputmodules" || noinputmodules="tv $noinputmodules" -enabled tv_v4l && require2 tv_v4l "stdlib.h linux/videodev.h" video_devdata -print_config HAVE_ mp_config.h mp_config.mak tv_v4l -enabled tv_v4l && vomodules="tv-v4l $vomodules" || novomodules="tv-v4l $novomodules" - print_config HAVE_ mp_config.h mp_config.mak audio_select enabled libvorbis && check_pkg libvorbis vorbis Modified: mplayerxp/find_sub.c =================================================================== --- mplayerxp/find_sub.c 2012-10-15 16:05:13 UTC (rev 163) +++ mplayerxp/find_sub.c 2012-10-16 16:31:36 UTC (rev 164) @@ -25,8 +25,8 @@ if ( !subtitles ) return; - if(vo_sub){ - if(key>=vo_sub->start && key<=vo_sub->end) return; // OK! + if(vo.sub){ + if(key>=vo.sub->start && key<=vo.sub->end) return; // OK! } else { if(key>nosub_range_start && key<nosub_range_end) return; // OK! } @@ -36,7 +36,7 @@ vo_osd_changed(OSDTYPE_SUBTITLE); if(key<=0){ - vo_sub=NULL; // no sub here + vo.sub=NULL; // no sub here return; } @@ -47,13 +47,13 @@ // no sub nosub_range_start=subtitles[current_sub].end; nosub_range_end=subtitles[current_sub+1].start; - vo_sub=NULL; + vo.sub=NULL; return; } // next sub? ++current_sub; - vo_sub=&subtitles[current_sub]; - if(key>=vo_sub->start && key<=vo_sub->end) return; // OK! + vo.sub=&subtitles[current_sub]; + if(key>=vo.sub->start && key<=vo.sub->end) return; // OK! } @@ -61,20 +61,20 @@ i=0;j=sub_num-1; while(j>=i){ current_sub=(i+j+1)/2; - vo_sub=&subtitles[current_sub]; - if(key<vo_sub->start) j=current_sub-1; - else if(key>vo_sub->end) i=current_sub+1; + vo.sub=&subtitles[current_sub]; + if(key<vo.sub->start) j=current_sub-1; + else if(key>vo.sub->end) i=current_sub+1; else return; // found! } -// if(key>=vo_sub->start && key<=vo_sub->end) return; // OK! +// if(key>=vo.sub->start && key<=vo.sub->end) return; // OK! // check where are we... - if(key<vo_sub->start){ + if(key<vo.sub->start){ if(current_sub<=0){ // before the first sub nosub_range_start=key-1; // tricky - nosub_range_end=vo_sub->start; - vo_sub=NULL; + nosub_range_end=vo.sub->start; + vo.sub=NULL; return; } --current_sub; @@ -82,31 +82,31 @@ // no sub nosub_range_start=subtitles[current_sub].end; nosub_range_end=subtitles[current_sub+1].start; - vo_sub=NULL; + vo.sub=NULL; return; } MSG_V("HEH???? "); } else { - if(key<=vo_sub->end) MSG_V("JAJJ! "); else + if(key<=vo.sub->end) MSG_V("JAJJ! "); else if(current_sub+1>=sub_num){ // at the end? - nosub_range_start=vo_sub->end; + nosub_range_start=vo.sub->end; nosub_range_end=0x7FFFFFFF; // MAXINT - vo_sub=NULL; + vo.sub=NULL; return; } else if(key>subtitles[current_sub].end && key<subtitles[current_sub+1].start){ // no sub nosub_range_start=subtitles[current_sub].end; nosub_range_end=subtitles[current_sub+1].start; - vo_sub=NULL; + vo.sub=NULL; return; } } - - MSG_ERR("SUB ERROR: %d ? %d --- %d [%d] \n",key,(int)vo_sub->start,(int)vo_sub->end,current_sub); - vo_sub=NULL; // no sub here + MSG_ERR("SUB ERROR: %d ? %d --- %d [%d] \n",key,(int)vo.sub->start,(int)vo.sub->end,current_sub); + + vo.sub=NULL; // no sub here } #endif Modified: mplayerxp/libmpdemux/demux_mkv.c =================================================================== --- mplayerxp/libmpdemux/demux_mkv.c 2012-10-15 16:05:13 UTC (rev 163) +++ mplayerxp/libmpdemux/demux_mkv.c 2012-10-16 16:31:36 UTC (rev 164) @@ -3156,7 +3156,7 @@ return; } - sub_utf8 = 1; + sub_data.utf8 = 1; size -= ptr1 - block; dp = new_demux_packet(size); memcpy(dp->buffer, ptr1, size); Modified: mplayerxp/libmpdemux/demux_mpxp64.c =================================================================== --- mplayerxp/libmpdemux/demux_mpxp64.c 2012-10-15 16:05:13 UTC (rev 163) +++ mplayerxp/libmpdemux/demux_mpxp64.c 2012-10-16 16:31:36 UTC (rev 164) @@ -22,6 +22,7 @@ #include "bswap.h" #include "aviheader.h" #include "../libmpcodecs/dec_audio.h" +#include "../libvo/sub.h" #include "aviprint.h" #include "mpxpav64.h" #include "demux_msg.h" @@ -428,7 +429,7 @@ { str=malloc(len); stream_read(s,str,len); - sub_cp=nls_get_screen_cp(); + sub_data.cp=nls_get_screen_cp(); demux_info_add(demuxer,infot,nls_recode2screen_cp(codepage,str,len)); free(str); } Modified: mplayerxp/libmpdemux/demux_ogg.c =================================================================== --- mplayerxp/libmpdemux/demux_ogg.c 2012-10-15 16:05:13 UTC (rev 163) +++ mplayerxp/libmpdemux/demux_ogg.c 2012-10-16 16:31:36 UTC (rev 164) @@ -21,7 +21,7 @@ #include "aviprint.h" #include "../libmpcodecs/codecs_ld.h" #include "../libmpcodecs/dec_audio.h" -#include "../libvo/sub.h" +#include "../libvo/video_out.h" #include "demux_msg.h" #define BLOCK_SIZE 4096 @@ -291,7 +291,7 @@ #ifdef USE_ICONV subcp_recode1(&ogg_sub); #endif - vo_sub = &ogg_sub; + vo.sub = &ogg_sub; vo_osd_changed(OSDTYPE_SUBTITLE); } @@ -554,7 +554,7 @@ /// Clear subtitles if necessary (for broken files) if ((clear_sub > 0) && (pts >= clear_sub)) { ogg_sub.lines = 0; - vo_sub = &ogg_sub; + vo.sub = &ogg_sub; vo_osd_changed(OSDTYPE_SUBTITLE); clear_sub = -1; } @@ -1412,7 +1412,7 @@ } if(!precision && (is_keyframe || os->vorbis) ) { ogg_sub.lines = 0; - vo_sub = &ogg_sub; + vo.sub = &ogg_sub; vo_osd_changed(OSDTYPE_SUBTITLE); clear_sub = -1; demux_ogg_add_packet(ds,os,ds->id,&op); Modified: mplayerxp/libmpdemux/demuxer.c =================================================================== --- mplayerxp/libmpdemux/demuxer.c 2012-10-15 16:05:13 UTC (rev 163) +++ mplayerxp/libmpdemux/demuxer.c 2012-10-16 16:31:36 UTC (rev 164) @@ -21,6 +21,7 @@ #include "stheader.h" #include "../libvo/fastmemcpy.h" +#include "../libvo/sub.h" #include "demux_msg.h" extern demuxer_driver_t demux_aiff; @@ -712,7 +713,7 @@ MSG_V( "Demuxer info '%s' already present as '%s'!\n",info_names[opt],((demuxer_info_t *)demuxer->info)->id[opt]); free(((demuxer_info_t *)demuxer->info)->id[opt]); } - ((demuxer_info_t *)demuxer->info)->id[opt]=nls_recode2screen_cp(sub_cp,param,strlen(param)); + ((demuxer_info_t *)demuxer->info)->id[opt]=nls_recode2screen_cp(sub_data.cp,param,strlen(param)); return 1; } Modified: mplayerxp/libmpdemux/s_dvdnav.c =================================================================== --- mplayerxp/libmpdemux/s_dvdnav.c 2012-10-15 16:05:13 UTC (rev 163) +++ mplayerxp/libmpdemux/s_dvdnav.c 2012-10-16 16:31:36 UTC (rev 164) @@ -509,12 +509,12 @@ stream_change->physical_letterbox, stream_change->physical_pan_scan, stream_change->logical); - if (vo_spudec && dvdsub_id!=stream_change->physical_wide) { + if (vo.spudec && dvdsub_id!=stream_change->physical_wide) { MSG_DBG2("d_dvdsub->id change: was %d is now %d\n", d_dvdsub->id,stream_change->physical_wide); // FIXME: need a better way to change SPU id d_dvdsub->id=dvdsub_id=stream_change->physical_wide; - if (vo_spudec) spudec_reset(vo_spudec); + if (vo.spudec) spudec_reset(vo.spudec); } break; } @@ -560,7 +560,7 @@ MSG_DBG2("DVDNAV Event: Nav SPU CLUT Change\n"); if(sp->len!=64) MSG_WARN("DVDNAV Event: Nav SPU CLUT Change: %i bytes <> 64\n",sp->len); // send new palette to SPU decoder - if (vo_spudec) spudec_update_palette(vo_spudec,(const unsigned int *)(sp->buf)); + if (vo.spudec) spudec_update_palette(vo.spudec,(const unsigned int *)(sp->buf)); break; } } Modified: mplayerxp/libmpdemux/sub_cc.c =================================================================== --- mplayerxp/libmpdemux/sub_cc.c 2012-10-15 16:05:13 UTC (rev 163) +++ mplayerxp/libmpdemux/sub_cc.c 2012-10-16 16:31:36 UTC (rev 164) @@ -151,7 +151,7 @@ static void display_buffer(const subtitle * buf) { - vo_sub=buf; + vo.sub=buf; vo_osd_changed(OSDTYPE_SUBTITLE); } Modified: mplayerxp/libmpdemux/sub_ty.c =================================================================== --- mplayerxp/libmpdemux/sub_ty.c 2012-10-15 16:05:13 UTC (rev 163) +++ mplayerxp/libmpdemux/sub_ty.c 2012-10-16 16:31:36 UTC (rev 164) @@ -17,7 +17,7 @@ #include "help_mp.h" #include "sub_cc.h" -#include "../libvo/sub.h" +#include "../libvo/video_out.h" #include "demux_msg.h" extern int sub_justify; @@ -894,7 +894,7 @@ // { // printf( "OSD:%d:%s\n", index, ty_OSD1.text[ index ] ); // } - vo_sub = &ty_OSD1; + vo.sub = &ty_OSD1; vo_osd_changed( OSDTYPE_SUBTITLE ); tyOSDUpdate = 0; } Modified: mplayerxp/libvo/font_load.c =================================================================== --- mplayerxp/libvo/font_load.c 2012-10-15 16:05:13 UTC (rev 163) +++ mplayerxp/libvo/font_load.c 2012-10-16 16:31:36 UTC (rev 164) @@ -204,7 +204,7 @@ int chr=p[0][0]; int start=atoi(p[1]); int end=atoi(p[2]); - if(sub_unicode && (chr>=0x80)) chr=(chr<<8)+p[0][1]; + if(sub_data.unicode && (chr>=0x80)) chr=(chr<<8)+p[0][1]; else if(strlen(p[0])!=1) chr=strtol(p[0],NULL,0); if(end<start) { MSG_ERR("error in font desc: end<start for char '%c'\n",chr); Modified: mplayerxp/libvo/screenshot.c =================================================================== --- mplayerxp/libvo/screenshot.c 2012-10-15 16:05:13 UTC (rev 163) +++ mplayerxp/libvo/screenshot.c 2012-10-16 16:31:36 UTC (rev 164) @@ -31,9 +31,11 @@ #define RGB 0 #define BGR 1 -static int cspace = RGB; -static unsigned image_width,image_height; - +typedef struct sshot_priv_s { + int cspace; + unsigned image_width,image_height; +}sshot_priv_t; +static sshot_priv_t sshot = { RGB, 0, 0 }; #ifdef HAVE_PNG int z_compression = Z_NO_COMPRESSION; @@ -88,14 +90,14 @@ /* set the zlib compression level */ png_set_compression_level(png.png_ptr, z_compression); - png_set_IHDR(png.png_ptr, png.info_ptr, image_width, image_height, + png_set_IHDR(png.png_ptr, png.info_ptr, sshot.image_width, sshot.image_height, 8, PNG_COLOR_TYPE_RGB, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT); MSG_V("PNG Write Info\n"); png_write_info(png.png_ptr, png.info_ptr); - if(cspace) { + if(sshot.cspace) { MSG_V("PNG Set BGR Conversion\n"); png_set_bgr(png.png_ptr); } @@ -200,9 +202,9 @@ MSG_ERR("vo_png: Can't initialize SwScaler\n"); return -1; } - image_width = w; - image_height = h; - if(!(image_data = malloc(image_width*image_height*3))) + sshot.image_width = w; + sshot.image_height = h; + if(!(image_data = malloc(sshot.image_width*sshot.image_height*3))) { MSG_ERR("vo_png: Can't allocate temporary buffer\n"); return -1; @@ -223,7 +225,7 @@ } MSG_V("PNG Compression level %i\n", z_compression); #endif - dstStride[0]=image_width*3; + dstStride[0]=sshot.image_width*3; dstStride[1]= dstStride[2]=0; dst[0]=image_data; @@ -244,9 +246,9 @@ } { - png_byte *row_pointers[image_height]; + png_byte *row_pointers[sshot.image_height]; unsigned bppmul = (bpp+7)/8; - for ( k = 0; k < image_height; k++ ) row_pointers[k] = &image_data[image_width*k*bppmul]; + for ( k = 0; k < sshot.image_height; k++ ) row_pointers[k] = &image_data[sshot.image_width*k*bppmul]; png_write_image(png.png_ptr, row_pointers); } Modified: mplayerxp/libvo/sub.c =================================================================== --- mplayerxp/libvo/sub.c 2012-10-15 16:05:13 UTC (rev 163) +++ mplayerxp/libvo/sub.c 2012-10-16 16:31:36 UTC (rev 164) @@ -34,19 +34,14 @@ "Hue" }; static const char * __sub_osd_names_short[] ={ "", "|>", "||", "[]", "<<" , ">>", "", "", "", "", "", ""}; +static int vo_osd_changed_status = 0; +static rect_highlight_t nav_hl; +static int draw_alpha_init_flag=0; +static mp_osd_obj_t* vo_osd_list=NULL; -//static int vo_font_loaded=-1; -font_desc_t* vo_font=NULL; +sub_data_t sub_data = { NULL, 0, 0, 100, 0, 0 }; -char* vo_osd_text=NULL; -int sub_unicode=0; -int sub_utf8=0; -int sub_pos=100; -int sub_bg_color=0; /* subtitles background color */ -int sub_bg_alpha=0; -static rect_highlight_t nav_hl; - void __FASTCALL__ osd_set_nav_box (uint16_t sx, uint16_t sy, uint16_t ex, uint16_t ey) { nav_hl.sx = sx; nav_hl.sy = sy; @@ -68,8 +63,8 @@ obj->bitmap_buffer = (unsigned char *)memalign(16, len); obj->alpha_buffer = (unsigned char *)memalign(16, len); } - memset(obj->bitmap_buffer, sub_bg_color, len); - memset(obj->alpha_buffer, sub_bg_alpha, len); + memset(obj->bitmap_buffer, sub_data.bg_color, len); + memset(obj->alpha_buffer, sub_data.bg_alpha, len); } // renders the buffer @@ -105,18 +100,18 @@ // return the real height of a char: static inline int __FASTCALL__ get_height(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; + 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(int c,int h) { - return vo_font?get_height(c,h):0; + return vo.font?get_height(c,h):0; } inline static void __FASTCALL__ vo_update_text_osd(mp_osd_obj_t* obj,int dxs,int dys){ - unsigned char *cp=(unsigned char *)vo_osd_text; + unsigned char *cp=(unsigned char *)vo.osd_text; int x=20; int h=0; UNUSED(dxs); @@ -126,37 +121,34 @@ while (*cp){ int c=*cp++; - x+=vo_font->width[c]+vo_font->charspace; + x+=vo.font->width[c]+vo.font->charspace; h=get_height(c,h); } - obj->bbox.x2=x-vo_font->charspace; + obj->bbox.x2=x-vo.font->charspace; obj->bbox.y2=obj->bbox.y1+h; obj->flags|=OSDFLAG_BBOX; } inline static void __FASTCALL__ vo_draw_text_osd(mp_osd_obj_t* obj,draw_osd_f draw_alpha){ - unsigned char *cp=(unsigned char *)vo_osd_text; + unsigned char *cp=(unsigned char *)vo.osd_text; int font; int x=obj->x; while (*cp){ int c=*cp++; - if ((font=vo_font->font[c])>=0 && c != ' ') + if ((font=vo.font->font[c])>=0 && c != ' ') draw_alpha(x,obj->y, - vo_font->width[c], - vo_font->pic_a[font]->h, - vo_font->pic_b[font]->bmp+vo_font->start[c], - vo_font->pic_a[font]->bmp+vo_font->start[c], - vo_font->pic_a[font]->w); - x+=vo_font->width[c]+vo_font->charspace; + vo.font->width[c], + vo.font->pic_a[font]->h, + vo.font->pic_b[font]->bmp+vo.font->start[c], + vo.font->pic_a[font]->bmp+vo.font->start[c], + vo.font->pic_a[font]->w); + x+=vo.font->width[c]+vo.font->charspace; } } -int vo_osd_progbar_type=-1; -int vo_osd_progbar_value=100; // 0..256 - // if we have n=256 bars then OSD progbar looks like below // // 0 1 2 3 ... 256 <= vo_osd_progbar_value @@ -168,21 +160,21 @@ inline static void __FASTCALL__ vo_update_text_progbar(mp_osd_obj_t* obj,int dxs,int dys){ obj->flags|=OSDFLAG_CHANGED|OSDFLAG_VISIBLE; - - if(vo_osd_progbar_type<0 || !vo_font){ + + if(vo.osd_progbar_type<0 || !vo.font){ obj->flags&=~OSDFLAG_VISIBLE; return; } - + { int h=0; - int y=(dys-vo_font->height)/2; - int delimw=vo_font->width[OSD_PB_START] - +vo_font->width[OSD_PB_END] - +vo_font->charspace; + int y=(dys-vo.font->height)/2; + int delimw=vo.font->width[OSD_PB_START] + +vo.font->width[OSD_PB_END] + +vo.font->charspace; int width=(2*dxs-3*delimw)/3; - int charw=vo_font->width[OSD_PB_0]+vo_font->charspace; + int charw=vo.font->width[OSD_PB_0]+vo.font->charspace; int elems=width/charw; - int x=(dxs-elems*charw-delimw)/2; + int x=(dxs-elems*charw-delimw)/2; h=get_height(OSD_PB_START,h); h=get_height(OSD_PB_END,h); h=get_height(OSD_PB_0,h); @@ -190,61 +182,60 @@ obj->bbox.x1=obj->x=x; obj->bbox.y1=obj->y=y; obj->bbox.x2=x+width+delimw; - obj->bbox.y2=y+h; //vo_font->height; + obj->bbox.y2=y+h; //vo.font->height; obj->flags|=OSDFLAG_BBOX; obj->params.progbar.elems=elems; } - + } inline static void __FASTCALL__ vo_draw_text_progbar(mp_osd_obj_t* obj,draw_osd_f draw_alpha){ - unsigned char *s; - unsigned char *sa; - int i,w,h,st,mark; - int x=obj->x; - int y=obj->y; - int c,font; - int charw=vo_font->width[OSD_PB_0]+vo_font->charspace; - int elems=obj->params.progbar.elems; + unsigned char *s; + unsigned char *sa; + int i,w,h,st,mark; + int x=obj->x; + int y=obj->y; + int c,font; + int charw=vo.font->width[OSD_PB_0]+vo.font->charspace; + int elems=obj->params.progbar.elems; - if (vo_osd_progbar_value<=0) - mark=0; + if (vo.osd_progbar_value<=0) + mark=0; else { - int ev=vo_osd_progbar_value*elems; + int ev=vo.osd_progbar_value*elems; mark=ev>>8; if (ev & 0xFF) mark++; if (mark>elems) mark=elems; } - - c=vo_osd_progbar_type; - if(vo_osd_progbar_type>0 && (font=vo_font->font[c])>=0) { - int xp=x-vo_font->width[c]-vo_font->spacewidth; + c=vo.osd_progbar_type; + if(vo.osd_progbar_type>0 && (font=vo.font->font[c])>=0) { + int xp=x-vo.font->width[c]-vo.font->spacewidth; draw_alpha((xp<0?0:xp),y, - vo_font->width[c], - vo_font->pic_a[font]->h, - vo_font->pic_b[font]->bmp+vo_font->start[c], - vo_font->pic_a[font]->bmp+vo_font->start[c], - vo_font->pic_a[font]->w); + vo.font->width[c], + vo.font->pic_a[font]->h, + vo.font->pic_b[font]->bmp+vo.font->start[c], + vo.font->pic_a[font]->bmp+vo.font->start[c], + vo.font->pic_a[font]->w); } - + c=OSD_PB_START; - if ((font=vo_font->font[c])>=0) + if ((font=vo.font->font[c])>=0) draw_alpha(x,y, - vo_font->width[c], - vo_font->pic_a[font]->h, - vo_font->pic_b[font]->bmp+vo_font->start[c], - vo_font->pic_a[font]->bmp+vo_font->start[c], - vo_font->pic_a[font]->w); - x+=vo_font->width[c]+vo_font->charspace; + vo.font->width[c], + vo.font->pic_a[font]->h, + vo.font->pic_b[font]->bmp+vo.font->start[c], + vo.font->pic_a[font]->bmp+vo.font->start[c], + vo.font->pic_a[font]->w); + x+=vo.font->width[c]+vo.font->charspace; c=OSD_PB_0; - if ((font=vo_font->font[c])>=0){ - w=vo_font->width[c]; - h=vo_font->pic_a[font]->h; - s=vo_font->pic_b[font]->bmp+vo_font->start[c]; - sa=vo_font->pic_a[font]->bmp+vo_font->start[c]; - st=vo_font->pic_a[font]->w; + if ((font=vo.font->font[c])>=0){ + w=vo.font->width[c]; + h=vo.font->pic_a[font]->h; + s=vo.font->pic_b[font]->bmp+vo.font->start[c]; + sa=vo.font->pic_a[font]->bmp+vo.font->start[c]; + st=vo.font->pic_a[font]->w; if ((i=mark)) do { draw_alpha(x,y,w,h,s,sa,st); x+=charw; @@ -252,12 +243,12 @@ } c=OSD_PB_1; - if ((font=vo_font->font[c])>=0){ - w=vo_font->width[c]; - h=vo_font->pic_a[font]->h; - s =vo_font->pic_b[font]->bmp+vo_font->start[c]; - sa=vo_font->pic_a[font]->bmp+vo_font->start[c]; - st=vo_font->pic_a[font]->w; + if ((font=vo.font->font[c])>=0){ + w=vo.font->width[c]; + h=vo.font->pic_a[font]->h; + s =vo.font->pic_b[font]->bmp+vo.font->start[c]; + sa=vo.font->pic_a[font]->bmp+vo.font->start[c]; + st=vo.font->pic_a[font]->w; if ((i=elems-mark)) do { draw_alpha(x,y,w,h,s,sa,st); x+=charw; @@ -265,22 +256,20 @@ } c=OSD_PB_END; - if ((font=vo_font->font[c])>=0) + if ((font=vo.font->font[c])>=0) draw_alpha(x,y, - vo_font->width[c], - vo_font->pic_a[font]->h, - vo_font->pic_b[font]->bmp+vo_font->start[c], - vo_font->pic_a[font]->bmp+vo_font->start[c], - vo_font->pic_a[font]->w); -// x+=vo_font->width[c]+vo_font->charspace; + vo.font->width[c], + vo.font->pic_a[font]->h, + vo.font->pic_b[font]->bmp+vo.font->start[c], + vo.font->pic_a[font]->bmp+vo.font->start[c], + vo.font->pic_a[font]->w); +// x+=vo.font->width[c]+vo.font->charspace; // vo_osd_progbar_value=(vo_osd_progbar_value+1)&0xFF; } -const subtitle* vo_sub=NULL; - // 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)) inline static void __FASTCALL__ vo_update_text_sub(mp_osd_obj_t* obj,int dxs,int dys){ @@ -292,39 +281,39 @@ int xsize,lastxsize=0; int xmin=dxs,xmax=0; int h,lasth; - + obj->flags|=OSDFLAG_CHANGED|OSDFLAG_VISIBLE; - - if(!vo_sub || !vo_font){ + + if(!vo.sub || !vo.font){ obj->flags&=~OSDFLAG_VISIBLE; return; } - + obj->bbox.y2=obj->y=dys; obj->params.subtitle.lines=0; // too long lines divide into a smaller ones i=k=lasth=0; - h=vo_font->height; - xsize=-vo_font->charspace; + h=vo.font->height; + xsize=-vo.font->charspace; lastStripPosition=-1; - l=vo_sub->lines; + l=vo.sub->lines; while (l) { l--; - t=vo_sub->text[i++]; + t=vo.sub->text[i++]; len=strlen(t)-1; - + for (j=0;j<=len;j++){ if ((c=t[j])>=0x80){ - if (sub_utf8){ + if (sub_data.utf8){ if ((c & 0xe0) == 0xc0) /* 2 bytes U+00080..U+0007FF*/ c = (c & 0x1f)<<6 | (t[++j] & 0x3f); else if((c & 0xf0) == 0xe0)/* 3 bytes U+00800..U+00FFFF*/ c = ((c & 0x0f)<<6 | (t[++j] & 0x3f))<<6 | (t[++j] & 0x3f); - } else if (sub_unicode) - c = (c<<8) + t[++j]; + } else if (sub_data.unicode) + c = (c<<8) + t[++j]; } if (k==MAX_UCS){ len=j; // end here @@ -335,27 +324,27 @@ lastk=k; lastStripPosition=j; lastxsize=xsize; - } else if ((font=vo_font->font[c])>=0){ - if (vo_font->pic_a[font]->h > h){ - h=vo_font->pic_a[font]->h; + } else if ((font=vo.font->font[c])>=0){ + if (vo.font->pic_a[font]->h > h){ + h=vo.font->pic_a[font]->h; } } obj->params.subtitle.utbl[k++]=c; - xsize+=vo_font->width[c]+vo_font->charspace; + xsize+=vo.font->width[c]+vo.font->charspace; if (dxs<xsize){ if (lastStripPosition>0){ j=lastStripPosition; xsize=lastxsize; k=lastk; } else { - xsize -=vo_font->width[c]+vo_font->charspace; // go back + xsize -=vo.font->width[c]+vo.font->charspace; // go back k--; // cut line here while (t[j] && t[j]!=' ') j++; // jump to the nearest space } } else if (j<len) continue; if (h>obj->y){ // out of the screen so end parsing - obj->y -= lasth - vo_font->height; // correct the y position + obj->y -= lasth - vo.font->height; // correct the y position l=0; break; } @@ -367,27 +356,27 @@ l=0; len=j; // end parsing } else if(l || j<len){ // not the last line or not the last char lastStripPosition=-1; - xsize=-vo_font->charspace; + xsize=-vo.font->charspace; lasth=h; - h=vo_font->height; + h=vo.font->height; } - obj->y -=h; // according to max of vo_font->pic_a[font]->h + obj->y -=h; // according to max of vo.font->pic_a[font]->h } } - if (obj->y >= (dys * sub_pos / 100)){ + if (obj->y >= (dys * sub_data.pos / 100)){ int old=obj->y; - obj->y = dys * sub_pos /100; + obj->y = dys * sub_data.pos /100; obj->bbox.y2-=old-obj->y; } - + // calculate bbox: obj->bbox.x1=xmin; obj->bbox.x2=xmax; obj->bbox.y1=obj->y; -// obj->bbox.y2=obj->y+obj->params.subtitle.lines*vo_font->height; +// obj->bbox.y2=obj->y+obj->params.subtitle.lines*vo.font->height; obj->flags|=OSDFLAG_BBOX; - + } inline static void __FASTCALL__ vo_draw_text_sub(mp_osd_obj_t* obj,draw_osd_f draw_alpha){ @@ -396,29 +385,22 @@ i=j=0; if ((l=obj->params.subtitle.lines)) for (;;) { - x=obj->params.subtitle.xtbl[i++]; + x=obj->params.subtitle.xtbl[i++]; while ((c=obj->params.subtitle.utbl[j++])){ - if ((font=vo_font->font[c])>=0) + if ((font=vo.font->font[c])>=0) draw_alpha(x,y, - vo_font->width[c], - vo_font->pic_a[font]->h+y<obj->dys ? vo_font->pic_a[font]->h : obj->dys-y, - vo_font->pic_b[font]->bmp+vo_font->start[c], - vo_font->pic_a[font]->bmp+vo_font->start[c], - vo_font->pic_a[font]->w); - x+=vo_font->width[c]+vo_font->charspace; + vo.font->width[c], + vo.font->pic_a[font]->h+y<obj->dys ? vo.font->pic_a[font]->h : obj->dys-y, + vo.font->pic_b[font]->bmp+vo.font->start[c], + vo.font->pic_a[font]->bmp+vo.font->start[c], + vo.font->pic_a[font]->w); + x+=vo.font->width[c]+vo.font->charspace; } if (!--l) break; - y+=vo_font->height; + y+=vo.font->height; } } -void *vo_spudec=NULL; -void *vo_vobsub=NULL; - -static int draw_alpha_init_flag=0; - -static mp_osd_obj_t* vo_osd_list=NULL; - mp_osd_obj_t* __FASTCALL__ new_osd_obj(int type){ mp_osd_obj_t* osd=malloc(sizeof(mp_osd_obj_t)); memset(osd,0,sizeof(mp_osd_obj_t)); @@ -456,19 +438,19 @@ vo_update_nav(obj,dxs,dys); break; case OSDTYPE_SPU: - if(vo_spudec && spudec_visible(vo_spudec)) + if(vo.spudec && spudec_visible(vo.spudec)) obj->flags|=OSDFLAG_VISIBLE|OSDFLAG_CHANGED; else obj->flags&=~OSDFLAG_VISIBLE; break; case OSDTYPE_VOBSUB: - if(vo_vobsub) + if(vo.vobsub) obj->flags|=OSDFLAG_VISIBLE|OSDFLAG_CHANGED; else obj->flags&=~OSDFLAG_VISIBLE; break; case OSDTYPE_OSD: - if(vo_font && vo_osd_text && vo_osd_text[0]){ + if(vo.font && vo.osd_text && vo.osd_text[0]){ vo_update_text_osd(obj,dxs,dys); // update bbox obj->flags|=OSDFLAG_VISIBLE|OSDFLAG_CHANGED; } else @@ -502,7 +484,7 @@ } if(obj->flags&OSDFLAG_CHANGED){ chg|=1<<obj->type; - MSG_DBG2("OSD chg: %d V: %s pb:%d \n",obj->type,(obj->flags&OSDFLAG_VISIBLE)?"yes":"no",vo_osd_progbar_type); + MSG_DBG2("OSD chg: %d V: %s pb:%d \n",obj->type,(obj->flags&OSDFLAG_VISIBLE)?"yes":"no",vo.osd_progbar_type); } obj=obj->next; } @@ -524,8 +506,6 @@ new_osd_obj(OSDTYPE_DVDNAV); } -int vo_osd_changed_flag=0; - void __FASTCALL__ vo_remove_text(int dxs,int dys,clear_osd_f remove){ mp_osd_obj_t* obj=vo_osd_list; vo_update_osd(dxs,dys); @@ -536,7 +516,7 @@ 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 + vo.osd_changed_flag=obj->flags&OSDFLAG_CHANGED; // temp hack remove(obj->old_bbox.x1,obj->old_bbox.y1,w,h); } // obj->flags&=~OSDFLAG_OLD_BBOX; @@ -553,16 +533,17 @@ void __FASTCALL__ vo_draw_text(int dxs,int dys,draw_osd_f draw_alpha){ mp_osd_obj_t* obj=vo_osd_list; vo_update_osd(dxs,dys); + while(obj){ if(obj->flags&OSDFLAG_VISIBLE){ obj->cleared_frames=0; - vo_osd_changed_flag=obj->flags&OSDFLAG_CHANGED; // temp hack + 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); // FIXME + spudec_draw_scaled(vo.spudec, dxs, dys, draw_alpha); // FIXME break; case OSDTYPE_VOBSUB: - if(vo_spudec) spudec_draw_scaled(vo_spudec, dxs, dys, draw_alpha); // FIXME + if(vo.spudec) spudec_draw_scaled(vo.spudec, dxs, dys, draw_alpha); // FIXME break; case OSDTYPE_OSD: vo_draw_text_osd(obj,draw_alpha); @@ -585,8 +566,6 @@ } } -static int vo_osd_changed_status = 0; - int __FASTCALL__ vo_osd_changed(int new_value) { mp_osd_obj_t* obj=vo_osd_list; Modified: mplayerxp/libvo/sub.h =================================================================== --- mplayerxp/libvo/sub.h 2012-10-15 16:05:13 UTC (rev 163) +++ mplayerxp/libvo/sub.h 2012-10-16 16:31:36 UTC (rev 164) @@ -60,21 +60,6 @@ #else -#include "../subreader.h" -#include "font_load.h" - -extern font_desc_t* vo_font; - -extern char* vo_osd_text; - -extern int vo_osd_progbar_type; -extern int vo_osd_progbar_value; // 0..255 - -extern const subtitle* vo_sub; - -extern void* vo_spudec; -extern void* vo_vobsub; - #define OSD_PLAY 0x01 #define OSD_PAUSE 0x02 #define OSD_STOP 0x03 @@ -93,17 +78,16 @@ #define OSD_PB_END 0x12 #define OSD_PB_1 0x13 -extern int sub_unicode; -extern int sub_utf8; +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; -#ifdef USE_ICONV -extern char *sub_cp; -#endif -extern int sub_pos; -extern int spu_alignment; -extern int spu_aamode; -extern float spu_gaussvar; - typedef void (* __FASTCALL__ draw_osd_f)(int x0,int y0, int w,int h,const unsigned char* src,const unsigned char *srca, int stride); typedef void (* __FASTCALL__ clear_osd_f)(int x0,int y0, int w,int h); @@ -115,7 +99,6 @@ int __FASTCALL__ vo_osd_changed(int new_value); int __FASTCALL__ get_osd_height(int c,int h); void __FASTCALL__ osd_set_nav_box (uint16_t sx, uint16_t sy, uint16_t ex, uint16_t ey); -extern int vo_osd_changed_flag; #endif #endif Modified: mplayerxp/libvo/video_out.c =================================================================== --- mplayerxp/libvo/video_out.c 2012-10-15 16:05:13 UTC (rev 163) +++ mplayerxp/libvo/video_out.c 2012-10-16 16:31:36 UTC (rev 164) @@ -43,11 +43,7 @@ #include "sub.h" #include "vo_msg.h" -//int vo_flags=0; - -vo_priv_t vo = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, - { 0, 0, 0, 0, 0, 0, 0}, 0, 0, 0, -1, 0, 0, 0.0, -1.0, }; -char *vo_subdevice = NULL; +vo_priv_t vo; static vo_format_desc vod; // @@ -119,22 +115,30 @@ #define VOFLG_VM 0x00000002UL #define VOFLG_ZOOM 0x00000004UL #define VOFLG_FLIP 0x00000008UL -static unsigned dri_flags; -static int has_dri=0; -static unsigned dri_bpp; -static dri_surface_cap_t dri_cap; -static dri_surface_t dri_surf[MAX_DRI_BUFFERS]; -static unsigned active_frame=0,xp_frame=0; -static unsigned dri_nframes=1; -static int dri_has_thread=0; -static uint32_t srcFourcc,image_format,image_width,image_height; -static uint32_t org_width,org_height,dri_d_width,dri_d_height; -static int dri_dr,dri_planes_eq,dri_is_planar,dri_accel; -static unsigned sstride=0; -static unsigned dri_off[4]; /* offsets for y,u,v if DR on non fully fitted surface */ -static unsigned ps_off[4]; /* offsets for y,u,v in panscan mode */ -static unsigned long long int frame_counter=0; +typedef struct dri_priv_s { + unsigned flags; + int has_dri; + unsigned bpp; + dri_surface_cap_t cap; + dri_surface_t surf[MAX_DRI_BUFFERS]; + unsigned active_frame,xp_frame; + unsigned nframes; + int has_thread; + int dr,planes_eq,is_planar,accel; + unsigned sstride; + uint32_t d_width,d_height; + unsigned off[4]; /* offsets for y,u,v if DR on non fully fitted surface */ +}dri_priv_t; +static dri_priv_t dri; +typedef struct vo_priv_data_s { + uint32_t srcFourcc,image_format,image_width,image_height; + uint32_t org_width,org_height; + unsigned ps_off[4]; /* offsets for y,u,v in panscan mode */ + unsigned long long int frame_counter; +}vo_priv_data_t; +static vo_priv_data_t vo_data; + void vo_print_help( void ) { unsigned i; @@ -167,10 +171,25 @@ return video_out->get_info(); } +void __FASTCALL__ vo_preinit_structs( void ) +{ + memset(&dri,0,sizeof(dri_priv_t)); + dri.nframes=1; + memset(&vo,0,sizeof(vo_priv_t)); + vo.doublebuffering=1; + vo.movie_aspect=-1.0; + vo.flip=-1; + vo.da_buffs=64; + vo.window = None; + vo.WinID=-1; + vo.osd_progbar_type=-1; + vo.osd_progbar_value=100; // 0..256 +} + int __FASTCALL__ vo_init(const char *subdevice) { MSG_DBG3("dri_vo_dbg: vo_init(%s)\n",subdevice); - frame_counter=0; + vo_data.frame_counter=0; return video_out->preinit(subdevice); } @@ -242,17 +261,17 @@ static void __FASTCALL__ dri_config(uint32_t fourcc) { unsigned i; - dri_is_planar = vo_describe_fourcc(fourcc,&vod); - dri_bpp=vod.bpp; - if(!dri_bpp) has_dri=0; /*unknown fourcc*/ - if(has_dri) + dri.is_planar = vo_describe_fourcc(fourcc,&vod); + dri.bpp=vod.bpp; + if(!dri.bpp) dri.has_dri=0; /*unknown fourcc*/ + if(dri.has_dri) { - video_out->control(VOCTRL_GET_NUM_FRAMES,&dri_nframes); - dri_nframes=min(dri_nframes,MAX_DRI_BUFFERS); - for(i=0;i<dri_nframes;i++) + video_out->control(VOCTRL_GET_NUM_FRAMES,&dri.nframes); + dri.nframes=min(dri.nframes,MAX_DRI_BUFFERS); + for(i=0;i<dri.nframes;i++) { - dri_surf[i].idx=i; - video_out->control(DRI_GET_SURFACE,&dri_surf[i]); + dri.surf[i].idx=i; + video_out->control(DRI_GET_SURFACE,&dri.surf[i]); } } } @@ -262,104 +281,104 @@ int src_is_planar; unsigned src_stride,ps_x,ps_y; vo_format_desc vd; - ps_x = (org_width - width)/2; - ps_y = (org_height - height)/2; - src_is_planar = vo_describe_fourcc(srcFourcc,&vd); - src_stride=src_is_planar?org_width:org_width*((vd.bpp+7)/8); - ps_off[0] = ps_off[1] = ps_off[2] = ps_off[3] = 0; + ps_x = (vo_data.org_width - width)/2; + ps_y = (vo_data.org_height - height)/2; + src_is_planar = vo_describe_fourcc(vo_data.srcFourcc,&vd); + src_stride=src_is_planar?vo_data.org_width:vo_data.org_width*((vd.bpp+7)/8); + vo_data.ps_off[0] = vo_data.ps_off[1] = vo_data.ps_off[2] = vo_data.ps_off[3] = 0; if(!src_is_planar) - ps_off[0] = ps_y*src_stride+ps_x*((vd.bpp+7)/8); + vo_data.ps_off[0] = ps_y*src_stride+ps_x*((vd.bpp+7)/8); else { - ps_off[0] = ps_y*src_stride+ps_x; + vo_data.ps_off[0] = ps_y*src_stride+ps_x; if(vd.bpp==12) /*YV12 series*/ { - ps_off[1] = (ps_y/2)*(src_stride/2)+ps_x/2; - ps_off[2] = (ps_y/2)*(src_stride/2)+ps_x/2; + vo_data.ps_off[1] = (ps_y/2)*(src_stride/2)+ps_x/2; + vo_data.ps_off[2] = (ps_y/2)*(src_stride/2)+ps_x/2; } else if(vd.bpp==9) /*YVU9 series*/ { - ps_off[1] = (ps_y/4)*(src_stride/4)+ps_x/4; - ps_off[2] = (ps_y/4)*(src_stride/4)+ps_x/4; + vo_data.ps_off[1] = (ps_y/4)*(src_stride/4)+ps_x/4; + vo_data.ps_off[2] = (ps_y/4)*(src_stride/4)+ps_x/4; } } } static void __FASTCALL__ dri_tune(unsigned width,unsigned height) { - sstride=dri_is_planar?width:width*((dri_bpp+7)/8); - dri_off[0] = dri_off[1] = dri_off[2] = dri_off[3] = 0; - if(!dri_is_planar) + dri.sstride=dri.is_planar?width:width*((dri.bpp+7)/8); + dri.off[0] = dri.off[1] = dri.off[2] = dri.off[3] = 0; + if(!dri.is_planar) { - dri_planes_eq = sstride == dri_cap.strides[0]; - dri_off[0] = dri_cap.y*dri_cap.strides[0]+dri_cap.x*((dri_bpp+7)/8); + dri.planes_eq = dri.sstride == dri.cap.strides[0]; + dri.off[0] = dri.cap.y*dri.cap.strides[0]+dri.cap.x*((dri.bpp+7)/8); } else { unsigned long y_off,u_off,v_off; - y_off = (unsigned long)dri_surf[0].planes[0]; - u_off = (unsigned long)min(dri_surf[0].planes[1],dri_surf[0].planes[2]); - v_off = (unsigned long)max(dri_surf[0].planes[1],dri_surf[0].planes[2]); - dri_off[0] = dri_cap.y*dri_cap.strides[0]+dri_cap.x; - if(dri_bpp==12) /*YV12 series*/ + y_off = (unsigned long)dri.surf[0].planes[0]; + u_off = (unsigned long)min(dri.surf[0].planes[1],dri.surf[0].planes[2]); + v_off = (unsigned long)max(dri.surf[0].planes[1],dri.surf[0].planes[2]); + dri.off[0] = dri.cap.y*dri.cap.strides[0]+dri.cap.x; + if(dri.bpp==12) /*YV12 series*/ { - dri_planes_eq = width == dri_cap.strides[0] && + dri.planes_eq = width == dri.cap.strides[0] && width*height == u_off - y_off && width*height*5/4 == v_off - y_off && - dri_cap.strides[0]/2 == dri_cap.strides[1] && - dri_cap.strides[0]/2 == dri_cap.strides[2]; - dri_off[1] = (dri_cap.y/2)*dri_cap.strides[1]+dri_cap.x/2; - dri_off[2] = (dri_cap.y/2)*dri_cap.strides[2]+dri_cap.x/2; + dri.cap.strides[0]/2 == dri.cap.strides[1] && + dri.cap.strides[0]/2 == dri.cap.strides[2]; + dri.off[1] = (dri.cap.y/2)*dri.cap.strides[1]+dri.cap.x/2; + dri.off[2] = (dri.cap.y/2)*dri.cap.strides[2]+dri.cap.x/2; } else - if(dri_bpp==9) /*YVU9 series*/ + if(dri.bpp==9) /*YVU9 series*/ { - dri_planes_eq = width == dri_cap.strides[0] && + dri.planes_eq = width == dri.cap.strides[0] && width*height == u_off - y_off && width*height*17/16 == v_off - y_off && - dri_cap.strides[0]/4 == dri_cap.strides[1] && - dri_cap.strides[0]/4 == dri_cap.strides[2]; - dri_off[1] = (dri_cap.y/4)*dri_cap.strides[1]+dri_cap.x/4; - dri_off[2] = (dri_cap.y/4)*dri_cap.strides[2]+dri_cap.x/4; + dri.cap.strides[0]/4 == dri.cap.strides[1] && + dri.cap.strides[0]/4 == dri.cap.strides[2]; + dri.off[1] = (dri.cap.y/4)*dri.cap.strides[1]+dri.cap.x/4; + dri.off[2] = (dri.cap.y/4)*dri.cap.strides[2]+dri.cap.x/4; } else - if(dri_bpp==8) /*Y800 series*/ - dri_planes_eq = width == dri_cap.strides[0]; + if(dri.bpp==8) /*Y800 series*/ + dri.planes_eq = width == dri.cap.strides[0]; } - dri_accel=(dri_cap.caps&(DRI_CAP_DOWNSCALER|DRI_CAP_HORZSCALER| + dri.accel=(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); - dri_dr = srcFourcc == dri_cap.fourcc && !(dri_flags & VOFLG_FLIP) && - !ps_off[0] && !ps_off[1] && !ps_off[2] && !ps_off[3]; - if(dri_dr && dri_cap.w < width) - dri_dr = dri_cap.caps&(DRI_CAP_DOWNSCALER|DRI_CAP_HORZSCALER)?1:0; - if(dri_dr && dri_cap.w > width) - dri_dr = dri_cap.caps&(DRI_CAP_UPSCALER|DRI_CAP_HORZSCALER)?1:0; - if(dri_dr && dri_cap.h < height) - dri_dr = dri_cap.caps&(DRI_CAP_DOWNSCALER|DRI_CAP_VERTSCALER)?1:0; - if(dri_dr && dri_cap.h > height) - dri_dr = dri_cap.caps&(DRI_CAP_UPSCALER|DRI_CAP_VERTSCALER)?1:0; + dri.dr = vo_data.srcFourcc == dri.cap.fourcc && !(dri.flags & VOFLG_FLIP) && + !vo_data.ps_off[0] && !vo_data.ps_off[1] && !vo_data.ps_off[2] && !vo_data.ps_off[3]; + if(dri.dr && dri.cap.w < width) + dri.dr = dri.cap.caps&(DRI_CAP_DOWNSCALER|DRI_CAP_HORZSCALER)?1:0; + if(dri.dr && dri.cap.w > width) + dri.dr = dri.cap.caps&(DRI_CAP_UPSCALER|DRI_CAP_HORZSCALER)?1:0; + if(dri.dr && dri.cap.h < height) + dri.dr = dri.cap.caps&(DRI_CAP_DOWNSCALER|DRI_CAP_VERTSCALER)?1:0; + if(dri.dr && dri.cap.h > height) + dri.dr = dri.cap.caps&(DRI_CAP_UPSCALER|DRI_CAP_VERTSCALER)?1:0; } static void __FASTCALL__ dri_reconfig( uint32_t event ) { - has_dri = 1; - video_out->control(DRI_GET_SURFACE_CAPS,&dri_cap); - dri_config(dri_cap.fourcc); + dri.has_dri = 1; + video_out->control(DRI_GET_SURFACE_CAPS,&dri.cap); + dri_config(dri.cap.fourcc); /* ugly workaround of swapped BGR-fourccs. Should be removed in the future */ - if(!has_dri) + if(!dri.has_dri) { - has_dri=1; - dri_cap.fourcc = bswap_32(dri_cap.fourcc); - dri_config(dri_cap.fourcc); + dri.has_dri=1; + dri.cap.fourcc = bswap_32(dri.cap.fourcc); + dri_config(dri.cap.fourcc); } - dri_tune(image_width,image_height); + dri_tune(vo_data.image_width,vo_data.image_height); /* TODO: smart analizer of scaling possibilities of vo_driver */ if((event & VO_EVENT_RESIZE) == VO_EVENT_RESIZE) { - vf_reinit_vo(dri_cap.w,dri_cap.h,dri_cap.fourcc,1); + vf_reinit_vo(dri.cap.w,dri.cap.h,dri.cap.fourcc,1); if(enable_xp) { UNLOCK_VDECODING(); @@ -367,7 +386,7 @@ MSG_V("dri_vo: vo_event_resize: UNLOCK_VDECODING was called\n"); } } - vf_reinit_vo(dri_cap.w,dri_cap.h,dri_cap.fourcc,0); + vf_reinit_vo(dri.cap.w,dri.cap.h,dri.cap.fourcc,0); } static int vo_inited=0; @@ -385,41 +404,41 @@ } vo_inited++; dest_fourcc = format; - org_width = width; - org_height = height; + vo_data.org_width = width; + vo_data.org_height = height; w = width; d_w = d_width; h = height; d_h = d_height; - dri_d_width = d_w; - dri_d_height = d_h; + dri.d_width = d_w; + dri.d_height = d_h; MSG_V("video_out->config(%u,%u,%u,%u,%u,'%s',%s)\n" ,w,h,d_w,d_h,fullscreen,title,vo_format_name(dest_fourcc)); retval = video_out->config(w,h,d_w,d_h,fullscreen,title,dest_fourcc,vti); - srcFourcc=format; + vo_data.srcFourcc=format; if(retval == 0) { int dri_retv; - active_frame=xp_frame=0; - dri_retv = video_out->control(DRI_GET_SURFACE_CAPS,&dri_cap); - image_format = format; - image_width = w; - image_height = h; - ps_tune(image_width,org_height); + dri.active_frame=dri.xp_frame=0; + dri_retv = video_out->control(DRI_GET_SURFACE_CAPS,&dri.cap); + vo_data.image_format = format; + vo_data.image_width = w; + vo_data.image_height = h; + ps_tune(vo_data.image_width,vo_data.org_height); if(dri_retv == VO_TRUE) dri_reconfig(0); - MSG_V("dri_vo_caps: driver does %s support DRI\n",has_dri?"":"not"); + MSG_V("dri_vo_caps: driver does %s support DRI\n",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) dri_bpp=%u\n" - ,dri_cap.caps - ,dri_cap.fourcc - ,vo_format_name(dri_cap.fourcc) - ,dri_cap.x,dri_cap.y,dri_cap.w,dri_cap.h - ,dri_cap.width,dri_cap.height - ,dri_cap.strides[0],dri_cap.strides[1] - ,dri_cap.strides[2],dri_cap.strides[3] - ,dri_bpp); + "dri_vo_caps: width_height(%u %u) strides(%u %u %u %u) dri.bpp=%u\n" + ,dri.cap.caps + ,dri.cap.fourcc + ,vo_format_name(dri.cap.fourcc) + ,dri.cap.x,dri.cap.y,dri.cap.w,dri.cap.h + ,dri.cap.width,dri.cap.height + ,dri.cap.strides[0],dri.cap.strides[1] + ,dri.cap.strides[2],dri.cap.strides[3] + ,dri.bpp); MSG_V("dri_vo_src: w,h(%u %u) d_w,d_h(%u %u)\n" "dri_vo_src: flags=%08X fourcc=%08X(%s)\n" ,width,height @@ -427,7 +446,7 @@ ,fullscreen ,format ,vo_format_name(format)); - dri_flags = fullscreen; + dri.flags = fullscreen; } return retval; } @@ -458,8 +477,8 @@ { char buf[256]; MSG_DBG3("dri_vo_dbg: vo_screenshot\n"); - sprintf(buf,"%llu",frame_counter); - return gr_screenshot(buf,dri_surf[active_frame].planes,dri_cap.strides,dri_cap.fourcc,dri_cap.width,dri_cap.height); + sprintf(buf,"%llu",vo_data.frame_counter); + return gr_screenshot(buf,dri.surf[dri.active_frame].planes,dri.cap.strides,dri.cap.fourcc,dri.cap.width,dri.cap.height); } uint32_t vo_pause( void ) @@ -479,54 +498,54 @@ 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; - mpi->xp_idx = xp_frame; + mpi->xp_idx = dri.xp_frame; if(mpi->flags & MP_IMGFLAG_PLANAR) { - width_less_stride = mpi->w <= dri_cap.strides[0] && - (mpi->w>>mpi->chroma_x_shift) <= dri_cap.strides[1] && - (mpi->w>>mpi->chroma_x_shift) <= dri_cap.strides[2]; + width_less_stride = mpi->w <= dri.cap.strides[0] && + (mpi->w>>mpi->chroma_x_shift) <= dri.cap.strides[1] && + (mpi->w>>mpi->chroma_x_shift) <= dri.cap.strides[2]; } - else width_less_stride = mpi->w*mpi->bpp <= dri_cap.strides[0]; - if(has_dri) + else width_less_stride = mpi->w*mpi->bpp <= dri.cap.strides[0]; + if(dri.has_dri) { /* static is singlebuffered decoding */ - if(mpi->type==MP_IMGTYPE_STATIC && dri_nframes>1) + if(mpi->type==MP_IMGTYPE_STATIC && dri.nframes>1) { - MSG_DBG2("dri_vo_dbg: vo_get_surface FAIL mpi->type==MP_IMGTYPE_STATIC && dri_nframes>1\n"); + MSG_DBG2("dri_vo_dbg: vo_get_surface FAIL mpi->type==MP_IMGTYPE_STATIC && dri.nframes>1\n"); return VO_FALSE; } /*I+P requires 2+ static buffers for R/W */ - if(mpi->type==MP_IMGTYPE_IP && (dri_nframes < 2 || (dri_cap.caps&DRI_CAP_VIDEO_MMAPED)==DRI_CAP_VIDEO_MMAPED)) + if(mpi->type==MP_IMGTYPE_IP && (dri.nframes < 2 || (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 && dri_nframes < 2) || (dri_cap.caps&DRI_CAP_VIDEO_MMAPED)==DRI_CAP_VIDEO_MMAPED\n"); + MSG_DBG2("dri_vo_dbg: vo_get_surface FAIL (mpi->type==MP_IMGTYPE_IP && dri.nframes < 2) || (dri.cap.caps&DRI_CAP_VIDEO_MMAPED)==DRI_CAP_VIDEO_MMAPED\n"); return VO_FALSE; } /*I+P+B requires 3+ static buffers for R/W */ - if(mpi->type==MP_IMGTYPE_IPB && (dri_nframes != 3 || (dri_cap.caps&DRI_CAP_VIDEO_MMAPED)==DRI_CAP_VIDEO_MMAPED)) + if(mpi->type==MP_IMGTYPE_IPB && (dri.nframes != 3 || (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 && dri_nframes != 3) || (dri_cap.caps&DRI_CAP_VIDEO_MMAPED)==DRI_CAP_VIDEO_MMAPED\n"); + MSG_DBG2("dri_vo_dbg: vo_get_surface FAIL (mpi->type==MP_IMGTYPE_IPB && dri.nframes != 3) || (dri.cap.caps&DRI_CAP_VIDEO_MMAPED)==DRI_CAP_VIDEO_MMAPED\n"); return VO_FALSE; } /* video surface is bad thing for reading */ - if(((mpi->flags&MP_IMGFLAG_READABLE)||(mpi->type==MP_IMGTYPE_TEMP)) && (dri_cap.caps&DRI_CAP_VIDEO_MMAPED)==DRI_CAP_VIDEO_MMAPED) + if(((mpi->flags&MP_IMGFLAG_READABLE)||(mpi->type==MP_IMGTYPE_TEMP)) && (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 && (dri_cap.caps&DRI_CAP_VIDEO_MMAPED)==DRI_CAP_VIDEO_MMAPED\n"); + MSG_DBG2("dri_vo_dbg: vo_get_surface FAIL mpi->flags&MP_IMGFLAG_READABLE && (dri.cap.caps&DRI_CAP_VIDEO_MMAPED)==DRI_CAP_VIDEO_MMAPED\n"); return VO_FALSE; } /* it seems that surfaces are equal */ - if((((mpi->flags&MP_IMGFLAG_ACCEPT_STRIDE) && width_less_stride) || dri_planes_eq) && dri_dr) + if((((mpi->flags&MP_IMGFLAG_ACCEPT_STRIDE) && width_less_stride) || dri.planes_eq) && dri.dr) { - mpi->planes[0]=dri_surf[xp_frame].planes[0]+dri_off[0]; - mpi->planes[1]=dri_surf[xp_frame].planes[1]+dri_off[1]; - mpi->planes[2]=dri_surf[xp_frame].planes[2]+dri_off[2]; - mpi->stride[0]=dri_cap.strides[0]; - mpi->stride[1]=dri_cap.strides[1]; - mpi->stride[2]=dri_cap.strides[2]; + mpi->planes[0]=dri.surf[dri.xp_frame].planes[0]+dri.off[0]; + mpi->planes[1]=dri.surf[dri.xp_frame].planes[1]+dri.off[1]; + mpi->planes[2]=dri.surf[dri.xp_frame].planes[2]+dri.off[2]; + mpi->stride[0]=dri.cap.strides[0]; + mpi->stride[1]=dri.cap.strides[1]; + mpi->stride[2]=dri.cap.strides[2]; mpi->flags|=MP_IMGFLAG_DIRECT; MSG_DBG2("dri_vo_dbg: vo_get_surface OK\n"); return VO_TRUE; } - MSG_DBG2("dri_vo_dbg: vo_get_surface FAIL (mpi->flags&MP_IMGFLAG_ACCEPT_STRIDE && width_less_stride) || dri_planes_eq) && dri_dr\n"); + MSG_DBG2("dri_vo_dbg: vo_get_surface FAIL (mpi->flags&MP_IMGFLAG_ACCEPT_STRIDE && width_less_stride) || dri.planes_eq) && dri.dr\n"); return VO_FALSE; } else return VO_FALSE; @@ -535,10 +554,10 @@ static int __FASTCALL__ adjust_size(unsigned cw,unsigned ch,unsigned *nw,unsigned *nh) { MSG_DBG3("dri_vo_dbg: adjust_size was called %u %u %u %u\n",cw,ch,*nw,*nh); - if((dri_flags & VOFLG_ZOOM) && (cw != *nw || ch != *nh) && !(dri_flags & VOFLG_FS)) + if((dri.flags & VOFLG_ZOOM) && (cw != *nw || ch != *nh) && !(dri.flags & VOFLG_FS)) { float aspect,newv; - aspect = (float)dri_d_width / (float)dri_d_height; + aspect = (float)dri.d_width / (float)dri.d_height; if(abs(cw-*nw) > abs(ch-*nh)) { newv = ((float)(*nw))/aspect; @@ -570,12 +589,12 @@ but there is only one driver (vo_x11) which changes surfaces on 'fullscreen' key */ need_repaint=0; - if(has_dri && retval == VO_TRUE && (vrest.event_type & VO_EVENT_RESIZE) == VO_EVENT_RESIZE) + if(dri.has_dri && retval == VO_TRUE && (vrest.event_type & VO_EVENT_RESIZE) == VO_EVENT_RESIZE) { need_repaint=1; dri_reconfig(vrest.event_type); } - return (need_repaint && !dri_accel) || (vrest.event_type&VO_EVENT_FORCE_UPDATE); + return (need_repaint && !dri.accel) || (vrest.event_type&VO_EVENT_FORCE_UPDATE); } uint32_t vo_fullscreen( void ) @@ -584,22 +603,22 @@ MSG_DBG3("dri_vo_dbg: vo_fullscreen\n"); etype = 0; retval = video_out->control(VOCTRL_FULLSCREEN,&etype); - if(has_dri && retval == VO_TRUE && (etype & VO_EVENT_RESIZE) == VO_EVENT_RESIZE) + if(dri.has_dri && retval == VO_TRUE && (etype & VO_EVENT_RESIZE) == VO_EVENT_RESIZE) dri_reconfig(etype); - if(retval == VO_TRUE) dri_flags ^= VOFLG_FS; + if(retval == VO_TRUE) dri.flags ^= VOFLG_FS; return retval; } uint32_t __FASTCALL__ vo_get_num_frames( unsigned *nfr ) { - *nfr = has_dri ? dri_nframes : 1; + *nfr = dri.has_dri ? dri.nframes : 1; MSG_DBG3("dri_vo_dbg: %u=vo_get_num_frames\n",*nfr); return VO_TRUE; } uint32_t __FASTCALL__ vo_get_decoding_frame_num( volatile unsigned * fr ) { - *fr = has_dri ? xp_frame : 0; + *fr = dri.has_dri ? dri.xp_frame : 0; MSG_DBG3("dri_vo_dbg: %u=vo_get_decoding_frame_num\n",*fr); return VO_TRUE; } @@ -607,28 +626,28 @@ unsigned __FASTCALL__ vo_get_decoding_next_frame( unsigned idx ) { unsigned rval; - rval = has_dri ? (idx+1)%dri_nframes : 0; + rval = dri.has_dri ? (idx+1)%dri.nframes : 0; return rval; } unsigned __FASTCALL__ vo_get_decoding_prev_frame( unsigned idx ) { unsigned rval; - rval = has_dri ? (idx-1+dri_nframes)%dri_nframes : 0; + rval = dri.has_dri ? (idx-1+dri.nframes)%dri.nframes : 0; return rval; } uint32_t __FASTCALL__ vo_set_decoding_frame_num( volatile unsigned * fr ) { MSG_DBG2("dri_vo_dbg: vo_set_decoding_frame_num(%u) for decoding to\n",*fr); - xp_frame = *fr; - dri_has_thread = 1; + dri.xp_frame = *fr; + dri.has_thread = 1; return VO_TRUE; } uint32_t __FASTCALL__ vo_get_active_frame( volatile unsigned * fr) { - *fr = has_dri ? active_frame : 0; + *fr = dri.has_dri ? dri.active_frame : 0; MSG_DBG3("dri_vo_dbg: %u=vo_get_active_frame\n",*fr); return VO_TRUE; } @@ -637,7 +656,7 @@ { 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(has_dri) + if(dri.has_dri) { uint8_t *dst[4]; const uint8_t *ps_src[4]; @@ -646,15 +665,15 @@ unsigned idx = mpi->xp_idx; for(i=0;i<4;i++) { - dst[i]=dri_surf[idx].planes[i]+dri_off[i]; - dstStride[i]=dri_cap.strides[i]; + dst[i]=dri.surf[idx].planes[i]+dri.off[i]; + dstStride[i]=dri.cap.strides[i]; dst[i]+=((mpi->y*dstStride[i])*vod.y_mul[i])/vod.y_div[i]; dst[i]+=(mpi->x*vod.x_mul[i])/vod.x_div[i]; _w[i]=(mpi->w*vod.x_mul[i])/vod.x_div[i]; _h[i]=(mpi->h*vod.y_mul[i])/vod.y_div[i]; y = i?(mpi->y>>mpi->chroma_y_shift):mpi->y; x = i?(mpi->x>>mpi->chroma_x_shift):mpi->x; - ps_src[i] = mpi->planes[i]+(y*mpi->stride[i])+x+ps_off[i]; + ps_src[i] = mpi->planes[i]+(y*mpi->stride[i])+x+vo_data.ps_off[i]; } for(i=0;i<4;i++) { if(mpi->stride[i]) { @@ -671,21 +690,21 @@ void vo_change_frame(void) { - MSG_DBG2("dri_vo_dbg: vo_change_frame [active_frame=%u]\n",active_frame); - if(vo.doublebuffering || (dri_cap.caps & DRI_CAP_VIDEO_MMAPED)!=DRI_CAP_VIDEO_MMAPED) + MSG_DBG2("dri_vo_dbg: vo_change_frame [dri.active_frame=%u]\n",dri.active_frame); + if(vo.doublebuffering || (dri.cap.caps & DRI_CAP_VIDEO_MMAPED)!=DRI_CAP_VIDEO_MMAPED) { - video_out->change_frame(active_frame); - active_frame = (active_frame+1)%dri_nframes; - if(!dri_has_thread) xp_frame = (xp_frame+1)%dri_nframes; + video_out->change_frame(dri.active_frame); + dri.active_frame = (dri.active_frame+1)%dri.nframes; + if(!dri.has_thread) dri.xp_frame = (dri.xp_frame+1)%dri.nframes; } } void vo_flush_pages(void) { - MSG_DBG3("dri_vo_dbg: vo_flush_pages [active_frame=%u]\n",active_frame); - frame_counter++; - if((dri_cap.caps & DRI_CAP_VIDEO_MMAPED)!=DRI_CAP_VIDEO_MMAPED) - video_out->control(VOCTRL_FLUSH_PAGES,&xp_frame); + MSG_DBG3("dri_vo_dbg: vo_flush_pages [dri.active_frame=%u]\n",dri.active_frame); + vo_data.frame_counter++; + if((dri.cap.caps & DRI_CAP_VIDEO_MMAPED)!=DRI_CAP_VIDEO_MMAPED) + video_out->control(VOCTRL_FLUSH_PAGES,&dri.xp_frame); } /* DRAW OSD */ @@ -695,7 +714,7 @@ unsigned i; for(i=0;i<h;i++) { - if(y0+i<dri_cap.y||y0+i>=dri_cap.y+dri_cap.h) memset(dest,filler,stride); + if(y0+i<dri.cap.y||y0+i>=dri.cap.y+dri.cap.h) memset(dest,filler,stride); dest += dstride; } } @@ -703,8 +722,8 @@ static void __FASTCALL__ clear_rect2(unsigned y0,unsigned h,uint8_t *dest,unsigned stride,unsigned dstride,uint8_t filler) { unsigned i; - unsigned y1 = dri_cap.y/2; - unsigned y2 = (dri_cap.y+dri_cap.h)/2; + unsigned y1 = dri.cap.y/2; + unsigned y2 = (dri.cap.y+dri.cap.h)/2; for(i=0;i<h;i++) { if(y0+i<y1||y0+i>=y2) memset(dest,filler,stride); @@ -715,8 +734,8 @@ static void __FASTCALL__ clear_rect4(unsigned y0,unsigned h,uint8_t *dest,unsigned stride,unsigned dstride,uint8_t filler) { unsigned i; - unsigned y1 = dri_cap.y/4; - unsigned y2 = (dri_cap.y+dri_cap.h)/4; + unsigned y1 = dri.cap.y/4; + unsigned y2 = (dri.cap.y+dri.cap.h)/4; for(i=0;i<h;i++) { if(y0+i<y1||y0+i>=y2) memset(dest,filler,stride); @@ -729,7 +748,7 @@ unsigned i; for(i=0;i<h;i++) { - if(y0+i<dri_cap.y||y0+i>=dri_cap.y+dri_cap.h) memset(dest,0,stride); + if(y0+i<dri.cap.y||y0+i>=dri.cap.y+dri.cap.h) memset(dest,0,stride); dest += dstride; } } @@ -739,7 +758,7 @@ unsigned i; for(i=0;i<h;i++) { - if(y0+i<dri_cap.y||y0+i>=dri_cap.y+dri_cap.h) + if(y0+i<dri.cap.y||y0+i>=dri.cap.y+dri.cap.h) { uint32_t *dst32; unsigned j,size32; @@ -756,8 +775,8 @@ static void __FASTCALL__ dri_remove_osd(int x0,int y0, int w,int h) { - if(x0+w<=dri_cap.width&&y0+h<=dri_cap.height) - switch(dri_cap.fourcc) + if(x0+w<=dri.cap.width&&y0+h<=dri.cap.height) + switch(dri.cap.fourcc) { case IMGFMT_RGB15: case IMGFMT_BGR15: @@ -767,40 +786,40 @@ case IMGFMT_BGR24: case IMGFMT_RGB32: case IMGFMT_BGR32: - clear_rect_rgb( y0,h,dri_surf[active_frame].planes[0]+y0*dri_c... [truncated message content] |