From c51ba3aed9353577eb8b5cdec3138756362e3067 Mon Sep 17 00:00:00 2001 From: reimar Date: Tue, 30 Dec 2008 17:00:11 +0000 Subject: Support F- and numpad keys for w32_common based vos. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28214 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/w32_common.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'libvo') diff --git a/libvo/w32_common.c b/libvo/w32_common.c index 6fbeaaa4b0..8063352d7e 100644 --- a/libvo/w32_common.c +++ b/libvo/w32_common.c @@ -51,6 +51,16 @@ static const struct keymap vk_map[] = { {VK_INSERT, KEY_INSERT}, {VK_DELETE, KEY_DELETE}, {VK_HOME, KEY_HOME}, {VK_END, KEY_END}, {VK_PRIOR, KEY_PAGE_UP}, {VK_NEXT, KEY_PAGE_DOWN}, + // F-keys + {VK_F1, KEY_F+1}, {VK_F2, KEY_F+2}, {VK_F3, KEY_F+3}, {VK_F4, KEY_F+4}, + {VK_F5, KEY_F+5}, {VK_F6, KEY_F+6}, {VK_F7, KEY_F+7}, {VK_F8, KEY_F+8}, + {VK_F9, KEY_F+9}, {VK_F10, KEY_F+10}, {VK_F11, KEY_F+11}, {VK_F1, KEY_F+12}, + // numpad + {VK_NUMPAD0, KEY_KP0}, {VK_NUMPAD1, KEY_KP1}, {VK_NUMPAD2, KEY_KP2}, + {VK_NUMPAD3, KEY_KP3}, {VK_NUMPAD4, KEY_KP4}, {VK_NUMPAD5, KEY_KP5}, + {VK_NUMPAD6, KEY_KP6}, {VK_NUMPAD7, KEY_KP7}, {VK_NUMPAD8, KEY_KP8}, + {VK_NUMPAD9, KEY_KP9}, {VK_DECIMAL, KEY_KPDEC}, + {0, 0} }; -- cgit v1.2.3 From 80cf4355292d1975018d7d449520530293b985f4 Mon Sep 17 00:00:00 2001 From: gpoirier Date: Tue, 30 Dec 2008 21:39:42 +0000 Subject: Add an option to vo_macosx to set a custom buffer_name. This allows to have multiple instances of MPlayerOSX running without stepping on each other's toes. Patch by Adrian Stutz % adrian A sttz P ch % Original thread: date: Tue, Dec 9, 2008 at 2:46 PM subject: [MPlayer-dev-eng] [PATCH] vo_macosx: option to set shared buffer name to allow multiple instances git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28215 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/vo_macosx.m | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) (limited to 'libvo') diff --git a/libvo/vo_macosx.m b/libvo/vo_macosx.m index 34043de579..e9043fc8b4 100644 --- a/libvo/vo_macosx.m +++ b/libvo/vo_macosx.m @@ -45,6 +45,8 @@ OSType pixelFormat; //shared memory int shm_fd; BOOL shared_buffer = false; +#define DEFAULT_BUFFER_NAME "mplayerosx" +static char *buffer_name; //Screen int screen_id; @@ -164,10 +166,13 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_ } else { + mp_msg(MSGT_VO, MSGL_INFO, "VO: [macosx] writing output to a shared buffer " + "named \"%s\".\n",buffer_name); + movie_aspect = (float)d_width/(float)d_height; // create shared memory - shm_fd = shm_open("mplayerosx", O_CREAT | O_RDWR, S_IRUSR | S_IWUSR); + shm_fd = shm_open(buffer_name, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR); if (shm_fd == -1) { mp_msg(MSGT_VO, MSGL_FATAL, @@ -180,7 +185,7 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_ { mp_msg(MSGT_VO, MSGL_FATAL, "vo_macosx: failed to size shared memory, possibly already in use. Error: %s\n", strerror(errno)); - shm_unlink("mplayerosx"); + shm_unlink(buffer_name); return 1; } @@ -191,12 +196,12 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_ { mp_msg(MSGT_VO, MSGL_FATAL, "vo_macosx: failed to map shared memory. Error: %s\n", strerror(errno)); - shm_unlink("mplayerosx"); + shm_unlink(buffer_name); return 1; } //connnect to mplayerosx - mplayerosxProxy=[NSConnection rootProxyForConnectionWithRegisteredName:@"mplayerosx" host:nil]; + mplayerosxProxy=[NSConnection rootProxyForConnectionWithRegisteredName:[NSString stringWithCString:buffer_name] host:nil]; if ([mplayerosxProxy conformsToProtocol:@protocol(MPlayerOSXVOProto)]) { [mplayerosxProxy setProtocolForProxy:@protocol(MPlayerOSXVOProto)]; mplayerosxProto = (id )mplayerosxProxy; @@ -288,7 +293,7 @@ static void uninit(void) if (munmap(image_data, image_width*image_height*image_bytes) == -1) mp_msg(MSGT_VO, MSGL_FATAL, "uninit: munmap failed. Error: %s\n", strerror(errno)); - if (shm_unlink("mplayerosx") == -1) + if (shm_unlink(buffer_name) == -1) mp_msg(MSGT_VO, MSGL_FATAL, "uninit: shm_unlink failed. Error: %s\n", strerror(errno)); } @@ -314,11 +319,15 @@ static void uninit(void) image_datas[1] = NULL; image_data = NULL; } + + if (buffer_name) free(buffer_name); + buffer_name = NULL; } static opt_t subopts[] = { {"device_id", OPT_ARG_INT, &screen_id, (opt_test_f)int_non_neg}, {"shared_buffer", OPT_ARG_BOOL, &shared_buffer, NULL}, +{"buffer_name", OPT_ARG_MSTRZ,&buffer_name, NULL}, {NULL} }; @@ -328,16 +337,21 @@ static int preinit(const char *arg) // set defaults screen_id = 0; shared_buffer = false; + buffer_name = DEFAULT_BUFFER_NAME; if (subopt_parse(arg, subopts) != 0) { mp_msg(MSGT_VO, MSGL_FATAL, "\n-vo macosx command line help:\n" - "Example: mplayer -vo macosx:device_id=1:shared_buffer\n" + "Example: mplayer -vo macosx:device_id=1:shared_buffer:buffer_name=mybuff\n" "\nOptions:\n" " device_id=<0-...>\n" " Set screen device id for fullscreen.\n" " shared_buffer\n" " Write output to a shared memory buffer instead of displaying it.\n" + " buffer_name=\n" + " Name of the shared buffer created with shm_open() as well as\n" + " the name of the NSConnection MPlayer will try to open.\n" + " Setting buffer_name implicitly enables shared_buffer.\n" "\n" ); return -1; } @@ -347,6 +361,9 @@ static int preinit(const char *arg) NSApp = [NSApplication sharedApplication]; isLeopardOrLater = floor(NSAppKitVersionNumber) > 824; + if (strcmp(buffer_name, DEFAULT_BUFFER_NAME)) + shared_buffer = true; + if(!shared_buffer) { #if !defined (CONFIG_MACOSX_FINDER) || !defined (CONFIG_SDL) -- cgit v1.2.3 From 7b6424637050d1dafd1fa93bcdd7ad42bfda0bb2 Mon Sep 17 00:00:00 2001 From: diego Date: Fri, 2 Jan 2009 13:25:00 +0000 Subject: Remove unused debug code. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28234 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/font_load.c | 9 --------- 1 file changed, 9 deletions(-) (limited to 'libvo') diff --git a/libvo/font_load.c b/libvo/font_load.c index 16a82dffc2..a18459b036 100644 --- a/libvo/font_load.c +++ b/libvo/font_load.c @@ -335,12 +335,3 @@ fail_out: free(desc); return NULL; } - -#if 0 -int main(void){ - -read_font_desc("high_arpi.desc",1); - -} -#endif - -- cgit v1.2.3 From d19fef9187b4c925577ee1ab6011e8d1041f548a Mon Sep 17 00:00:00 2001 From: diego Date: Fri, 2 Jan 2009 14:41:38 +0000 Subject: Conditionally define render_one_glyph and kerning dummy functions in font_load.c when FreeType is not enabled instead of conditionally defining them in font_load.h. This moves the workaround closer to where the actual problem is. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28235 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/font_load.c | 5 +++++ libvo/font_load.h | 9 --------- 2 files changed, 5 insertions(+), 9 deletions(-) (limited to 'libvo') diff --git a/libvo/font_load.c b/libvo/font_load.c index a18459b036..ba747dc7dc 100644 --- a/libvo/font_load.c +++ b/libvo/font_load.c @@ -335,3 +335,8 @@ fail_out: free(desc); return NULL; } + +#ifndef CONFIG_FREETYPE +void render_one_glyph(font_desc_t *desc, int c) {} +int kerning(font_desc_t *desc, int prevc, int c) { return 0; } +#endif diff --git a/libvo/font_load.h b/libvo/font_load.h index df3000efb5..ad355e6b4c 100644 --- a/libvo/font_load.h +++ b/libvo/font_load.h @@ -64,8 +64,6 @@ typedef struct font_desc { extern font_desc_t* vo_font; extern font_desc_t* sub_font; -#ifdef CONFIG_FREETYPE - extern char *subtitle_font_encoding; extern float text_font_scale_factor; extern float osd_font_scale_factor; @@ -92,13 +90,6 @@ void load_font_ft(int width, int height, font_desc_t **desc, const char *name, f void blur(unsigned char *buffer, unsigned short *tmp2, int width, int height, int stride, int *m2, int r, int mwidth); -#else - -static void render_one_glyph(font_desc_t *desc, int c) {} -static int kerning(font_desc_t *desc, int prevc, int c) { return 0; } - -#endif - raw_file* load_raw(char *name,int verbose); font_desc_t* read_font_desc(const char* fname,float factor,int verbose); -- cgit v1.2.3 From 339746a776f83e0d8bff0aeb7cc8939aad1c7921 Mon Sep 17 00:00:00 2001 From: diego Date: Fri, 2 Jan 2009 17:06:09 +0000 Subject: Sync with latest round of xvmc changes in FFmpeg. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28237 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/vo_xvmc.c | 39 ++++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 19 deletions(-) (limited to 'libvo') diff --git a/libvo/vo_xvmc.c b/libvo/vo_xvmc.c index 1eead7bf94..6e63868942 100644 --- a/libvo/vo_xvmc.c +++ b/libvo/vo_xvmc.c @@ -84,13 +84,13 @@ static XvMCMacroBlockArray mv_blocks; #define MAX_SURFACES 8 static int number_of_surfaces=0; static XvMCSurface surface_array[MAX_SURFACES]; -static xvmc_render_state_t * surface_render; +static struct xvmc_render_state * surface_render; -static xvmc_render_state_t * p_render_surface_to_show=NULL; -static xvmc_render_state_t * p_render_surface_visible=NULL; +static struct xvmc_render_state * p_render_surface_to_show=NULL; +static struct xvmc_render_state * p_render_surface_visible=NULL; //display queue, kinda render ahead -static xvmc_render_state_t * show_queue[MAX_SURFACES]; +static struct xvmc_render_state * show_queue[MAX_SURFACES]; static int free_element; @@ -118,7 +118,7 @@ static const struct{ static void xvmc_free(void); static void xvmc_clean_surfaces(void); static int count_free_surfaces(); -static xvmc_render_state_t * find_free_surface(); +static struct xvmc_render_state * find_free_surface(); static const vo_info_t info = { "XVideo Motion Compensation", @@ -346,13 +346,13 @@ surface_found: } static uint32_t xvmc_draw_image(mp_image_t *mpi){ -xvmc_render_state_t * rndr; + struct xvmc_render_state * rndr; assert(mpi!=NULL); assert(mpi->flags &MP_IMGFLAG_DIRECT); // assert(mpi->flags &MP_IMGFLAGS_DRAWBACK); - rndr = (xvmc_render_state_t*)mpi->priv;//there is copy in plane[2] + rndr = (struct xvmc_render_state*)mpi->priv;//there is copy in plane[2] assert( rndr != NULL ); assert( rndr->magic == MP_XVMC_RENDER_MAGIC ); if( mp_msg_test(MSGT_VO,MSGL_DBG4) ) @@ -520,8 +520,8 @@ int vm = flags & VOFLAG_MODESWITCHING; printf("vo_xvmc: mv_blocks allocated\n"); if(surface_render==NULL) - surface_render=malloc(MAX_SURFACES*sizeof(xvmc_render_state_t));//easy mem debug - memset(surface_render,0,MAX_SURFACES*sizeof(xvmc_render_state_t)); + surface_render=malloc(MAX_SURFACES*sizeof(struct xvmc_render_state));//easy mem debug + memset(surface_render,0,MAX_SURFACES*sizeof(struct xvmc_render_state)); for(i=0; imagic == MP_XVMC_RENDER_MAGIC ); @@ -1187,8 +1188,8 @@ int rez; //XvMCHide hides the surface on next retrace, so //check if the surface is not still displaying -static void check_osd_source(xvmc_render_state_t * src_rndr){ -xvmc_render_state_t * osd_rndr; +static void check_osd_source(struct xvmc_render_state * src_rndr){ +struct xvmc_render_state * osd_rndr; int stat; //If this is source surface, check does the OSD rendering is compleate if(src_rndr->state & MP_XVMC_STATE_OSD_SOURCE){ @@ -1211,10 +1212,10 @@ int i,num; return num; } -static xvmc_render_state_t * find_free_surface(){ +static struct xvmc_render_state * find_free_surface(){ int i,t; int stat; -xvmc_render_state_t * visible_rndr; +struct xvmc_render_state * visible_rndr; visible_rndr = NULL; for(i=0; i Date: Sat, 3 Jan 2009 22:33:04 +0000 Subject: Fix deinit problem due to r28215 original thread: date: Fri, Jan 2, 2009 at 10:00 PM subject: [PATCH] Fix deinit problem due to r28215 (was Re: [MPlayer-cvslog] r28215 - in trunk: DOCS/man/en/mplayer.1 libvo/vo_macosx.m) git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28239 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/vo_macosx.m | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'libvo') diff --git a/libvo/vo_macosx.m b/libvo/vo_macosx.m index e9043fc8b4..b049cf080c 100644 --- a/libvo/vo_macosx.m +++ b/libvo/vo_macosx.m @@ -337,7 +337,7 @@ static int preinit(const char *arg) // set defaults screen_id = 0; shared_buffer = false; - buffer_name = DEFAULT_BUFFER_NAME; + buffer_name = NULL; if (subopt_parse(arg, subopts) != 0) { mp_msg(MSGT_VO, MSGL_FATAL, @@ -361,7 +361,9 @@ static int preinit(const char *arg) NSApp = [NSApplication sharedApplication]; isLeopardOrLater = floor(NSAppKitVersionNumber) > 824; - if (strcmp(buffer_name, DEFAULT_BUFFER_NAME)) + if (!buffer_name) + buffer_name = strdup(DEFAULT_BUFFER_NAME); + else shared_buffer = true; if(!shared_buffer) -- cgit v1.2.3 From 824abb5a65c1de35259818956e22a24c33f318b4 Mon Sep 17 00:00:00 2001 From: diego Date: Mon, 5 Jan 2009 14:48:03 +0000 Subject: Add missing 'void' keyword to parameterless function declarations. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28267 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/gl_common.c | 2 +- libvo/mga_common.c | 2 +- libvo/vo_gif89a.c | 2 +- libvo/vo_s3fb.c | 10 +++++----- libvo/vo_xvmc.c | 14 +++++++------- libvo/vo_xvr100.c | 8 ++++---- 6 files changed, 19 insertions(+), 19 deletions(-) (limited to 'libvo') diff --git a/libvo/gl_common.c b/libvo/gl_common.c index fd85c3d6bf..596f99c0b9 100644 --- a/libvo/gl_common.c +++ b/libvo/gl_common.c @@ -1522,7 +1522,7 @@ void releaseGlContext(int *vinfo, HGLRC *context) { *context = 0; } -void swapGlBuffers() { +void swapGlBuffers(void) { HDC vo_hdc = GetDC(vo_w32_window); SwapBuffers(vo_hdc); ReleaseDC(vo_w32_window, vo_hdc); diff --git a/libvo/mga_common.c b/libvo/mga_common.c index 6d222a215f..3bc613930f 100644 --- a/libvo/mga_common.c +++ b/libvo/mga_common.c @@ -208,7 +208,7 @@ query_format(uint32_t format) } #ifndef VO_XMGA -static void mga_fullscreen() +static void mga_fullscreen(void) { uint32_t w,h; if ( !vo_fs ) { diff --git a/libvo/vo_gif89a.c b/libvo/vo_gif89a.c index 5e59a3dcef..b7a9894591 100644 --- a/libvo/vo_gif89a.c +++ b/libvo/vo_gif89a.c @@ -244,7 +244,7 @@ static int config(uint32_t s_width, uint32_t s_height, uint32_t d_width, } // we do not draw osd. -void draw_osd() {} +void draw_osd(void) {} // we do not handle events. static void check_events(void) {} diff --git a/libvo/vo_s3fb.c b/libvo/vo_s3fb.c index f321539202..930dcc80c4 100644 --- a/libvo/vo_s3fb.c +++ b/libvo/vo_s3fb.c @@ -71,7 +71,7 @@ static uint32_t in_width, in_height, in_format, in_depth, in_s3_format, static char *inpage, *inpage0, *smem = NULL; static void (*alpha_func)(); -static void clear_screen(); +static void clear_screen(void); /* streams registers */ #define PSTREAM_CONTROL_REG 0x8180 @@ -116,7 +116,7 @@ void writecrtc(int reg, int value) { } // enable S3 registers -int enable() { +int enable(void) { int fd; if (v) @@ -148,7 +148,7 @@ int enable() { return 0; } -void disable() { +void disable(void) { if (v) { writecrtc(0x53, v->cr53); writecrtc(0x39, v->cr39); @@ -227,7 +227,7 @@ int yuv_on(int format, int src_w, int src_h, int dst_x, int dst_y, int dst_w, in return offset; } -void yuv_off() { +void yuv_off(void) { writecrtc(0x67, readcrtc(0x67) & ~0xc); memset(v->mmio + 0x8180, 0, 0x80); OUTREG(0x81b8, 0x900); @@ -328,7 +328,7 @@ static void uninit(void) } } -static void clear_screen() +static void clear_screen(void) { if (inpage0) { int n; diff --git a/libvo/vo_xvmc.c b/libvo/vo_xvmc.c index 6e63868942..a0f01113e7 100644 --- a/libvo/vo_xvmc.c +++ b/libvo/vo_xvmc.c @@ -117,8 +117,8 @@ static const struct{ static void xvmc_free(void); static void xvmc_clean_surfaces(void); -static int count_free_surfaces(); -static struct xvmc_render_state * find_free_surface(); +static int count_free_surfaces(void); +static struct xvmc_render_state * find_free_surface(void); static const vo_info_t info = { "XVideo Motion Compensation", @@ -175,7 +175,7 @@ static void allocate_xvimage(int xvimage_width,int xvimage_height,int xv_format) return; } -static void deallocate_xvimage() +static void deallocate_xvimage(void) { #ifdef HAVE_SHM if ( Shmem_Flag ) @@ -699,7 +699,7 @@ static int draw_frame(uint8_t *srcp[]){ assert(0); } -static void init_osd_yuv_pal(){ +static void init_osd_yuv_pal(void) { char * palette; int rez; int i,j; @@ -745,7 +745,7 @@ int rez; printf("vo_xvmc: XvMCClearSubpicture failed!\n"); } -static void OSD_init(){ +static void OSD_init(void) { unsigned short osd_height, osd_width; int rez; @@ -1201,7 +1201,7 @@ int stat; src_rndr->state &= ~MP_XVMC_STATE_OSD_SOURCE; } } -static int count_free_surfaces(){ +static int count_free_surfaces(void) { int i,num; num=0; for(i=0; i pfb_dstwidth) { pfb_wx0 = (pfb_xres - pfb_dstwidth) / 2; pfb_wx1 = pfb_wx0 + pfb_dstwidth; @@ -321,7 +321,7 @@ static void uninit(void) munmap(pfb_vregs, PFB_REGS_MMAPLEN); } -static uint32_t pfb_fullscreen() { +static uint32_t pfb_fullscreen(void) { if (!pfb_fs) { aspect(&pfb_dstwidth,&pfb_dstheight, A_ZOOM); pfb_fs = 1; -- cgit v1.2.3 From d3b5452f49adfb4f41b9e62ae9aee30387e0f563 Mon Sep 17 00:00:00 2001 From: eugeni Date: Tue, 6 Jan 2009 16:44:47 +0000 Subject: Support loading font faces other then the first one in a font file. With -fontconfig, it is possible to select a face with index higher than 0 in a multi-face font file. Currently, with the old rendering code, this information is lost and the first face is loaded. With this change, index supplied by fontconfig is used for font loading. Patch by Adrian Stutz, adrian sttz ch. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28276 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/font_load.h | 2 +- libvo/font_load_ft.c | 14 ++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) (limited to 'libvo') diff --git a/libvo/font_load.h b/libvo/font_load.h index ad355e6b4c..532476e6d6 100644 --- a/libvo/font_load.h +++ b/libvo/font_load.h @@ -79,7 +79,7 @@ extern int force_load_font; int init_freetype(void); int done_freetype(void); -font_desc_t* read_font_desc_ft(const char* fname,int movie_width, int movie_height, float font_scale_factor); +font_desc_t* read_font_desc_ft(const char* fname,int face_index,int movie_width, int movie_height, float font_scale_factor); void free_font_desc(font_desc_t *desc); void render_one_glyph(font_desc_t *desc, int c); diff --git a/libvo/font_load_ft.c b/libvo/font_load_ft.c index f5926ca277..68494a16d2 100644 --- a/libvo/font_load_ft.c +++ b/libvo/font_load_ft.c @@ -893,11 +893,11 @@ void free_font_desc(font_desc_t *desc) free(desc); } -static int load_sub_face(const char *name, FT_Face *face) +static int load_sub_face(const char *name, int face_index, FT_Face *face) { int err = -1; - if (name) err = FT_New_Face(library, name, 0, face); + if (name) err = FT_New_Face(library, name, face_index, face); if (err) { char *font_file = get_path("subfont.ttf"); @@ -940,7 +940,7 @@ int kerning(font_desc_t *desc, int prevc, int c) return f266ToInt(kern.x); } -font_desc_t* read_font_desc_ft(const char *fname, int movie_width, int movie_height, float font_scale_factor) +font_desc_t* read_font_desc_ft(const char *fname, int face_index, int movie_width, int movie_height, float font_scale_factor) { font_desc_t *desc = NULL; @@ -1002,7 +1002,7 @@ font_desc_t* read_font_desc_ft(const char *fname, int movie_width, int movie_hei // t=GetTimer(); /* generate the subtitle font */ - err = load_sub_face(fname, &face); + err = load_sub_face(fname, face_index, &face); if (err) { mp_msg(MSGT_OSD, MSGL_WARN, MSGTR_LIBVO_FONT_LOAD_FT_SubFaceFailed); goto gen_osd; @@ -1128,6 +1128,7 @@ void load_font_ft(int width, int height, font_desc_t** fontp, const char *font_n FcPattern *fc_pattern; FcPattern *fc_pattern2; FcChar8 *s; + int face_index; FcBool scalable; #endif font_desc_t *vo_font = *fontp; @@ -1163,10 +1164,11 @@ void load_font_ft(int width, int height, font_desc_t** fontp, const char *font_n } // s doesn't need to be freed according to fontconfig docs FcPatternGetString(fc_pattern, FC_FILE, 0, &s); - *fontp=read_font_desc_ft(s, width, height, font_scale_factor); + FcPatternGetInteger(fc_pattern, FC_INDEX, 0, &face_index); + *fontp=read_font_desc_ft(s, face_index, width, height, font_scale_factor); FcPatternDestroy(fc_pattern); } else #endif - *fontp=read_font_desc_ft(font_name, width, height, font_scale_factor); + *fontp=read_font_desc_ft(font_name, 0, width, height, font_scale_factor); } -- cgit v1.2.3 From 0fa2d1abd78aba49a33b0f6dd6f7f2738a179d4e Mon Sep 17 00:00:00 2001 From: cehoyos Date: Fri, 9 Jan 2009 15:25:24 +0000 Subject: Factor calc_drwXY out of vo_xv and vo_xvmc. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28285 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/vo_xv.c | 20 ++------------------ libvo/vo_xvmc.c | 18 +----------------- libvo/x11_common.c | 18 ++++++++++++++++++ libvo/x11_common.h | 1 + 4 files changed, 22 insertions(+), 35 deletions(-) (limited to 'libvo') diff --git a/libvo/vo_xv.c b/libvo/vo_xv.c index 2c30bddb50..7b1aeabd8e 100644 --- a/libvo/vo_xv.c +++ b/libvo/vo_xv.c @@ -140,22 +140,6 @@ static void draw_alpha_null(int x0, int y0, int w, int h, static void deallocate_xvimage(int foo); -static void calc_drwXY(uint32_t *drwX, uint32_t *drwY) { - *drwX = *drwY = 0; - if (vo_fs) { - aspect(&vo_dwidth, &vo_dheight, A_ZOOM); - vo_dwidth = FFMIN(vo_dwidth, vo_screenwidth); - vo_dheight = FFMIN(vo_dheight, vo_screenheight); - *drwX = (vo_screenwidth - vo_dwidth) / 2; - *drwY = (vo_screenheight - vo_dheight) / 2; - mp_msg(MSGT_VO, MSGL_V, "[xv-fs] dx: %d dy: %d dw: %d dh: %d\n", - *drwX, *drwY, vo_dwidth, vo_dheight); - } else if (WinID == 0) { - *drwX = vo_dx; - *drwY = vo_dy; - } -} - /* * connect to server, create and map window, * allocate colors and (shared) memory @@ -286,7 +270,7 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width, current_ip_buf = 0; if ((flags & VOFLAG_FULLSCREEN) && WinID <= 0) vo_fs = 1; - calc_drwXY(&drwX, &drwY); + vo_calc_drwXY(&drwX, &drwY); panscan_calc(); @@ -391,7 +375,7 @@ static void check_events(void) if (e & VO_EVENT_RESIZE) { - calc_drwXY(&drwX, &drwY); + vo_calc_drwXY(&drwX, &drwY); } if (e & VO_EVENT_EXPOSE || e & VO_EVENT_RESIZE) diff --git a/libvo/vo_xvmc.c b/libvo/vo_xvmc.c index a0f01113e7..29ce3b6471 100644 --- a/libvo/vo_xvmc.c +++ b/libvo/vo_xvmc.c @@ -431,22 +431,6 @@ opt_t subopts [] = return 0; } -static void calc_drwXY(uint32_t *drwX, uint32_t *drwY) { - *drwX = *drwY = 0; - if (vo_fs) { - aspect(&vo_dwidth, &vo_dheight, A_ZOOM); - vo_dwidth = FFMIN(vo_dwidth, vo_screenwidth); - vo_dheight = FFMIN(vo_dheight, vo_screenheight); - *drwX = (vo_screenwidth - vo_dwidth) / 2; - *drwY = (vo_screenheight - vo_dheight) / 2; - mp_msg(MSGT_VO, MSGL_V, "[xvmc-fs] dx: %d dy: %d dw: %d dh: %d\n", - *drwX, *drwY, vo_dwidth, vo_dheight); - } else if (WinID == 0) { - *drwX = vo_dx; - *drwY = vo_dy; - } -} - static int config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t flags, char *title, uint32_t format){ @@ -674,7 +658,7 @@ skip_surface_allocation: } if ((flags & VOFLAG_FULLSCREEN) && WinID <= 0) vo_fs = 1; - calc_drwXY(&drwX, &drwY); + vo_calc_drwXY(&drwX, &drwY); panscan_calc(); diff --git a/libvo/x11_common.c b/libvo/x11_common.c index 9b6ee47b9b..919dec5c1f 100644 --- a/libvo/x11_common.c +++ b/libvo/x11_common.c @@ -8,6 +8,7 @@ #include "config.h" #include "mp_msg.h" #include "mp_fifo.h" +#include "libavutil/common.h" #include "x11_common.h" #ifdef X11_FULLSCREEN @@ -1854,6 +1855,23 @@ uint32_t vo_x11_get_equalizer(char *name, int *value) return VO_TRUE; } +void vo_calc_drwXY(uint32_t *drwX, uint32_t *drwY) +{ + *drwX = *drwY = 0; + if (vo_fs) { + aspect(&vo_dwidth, &vo_dheight, A_ZOOM); + vo_dwidth = FFMIN(vo_dwidth, vo_screenwidth); + vo_dheight = FFMIN(vo_dheight, vo_screenheight); + *drwX = (vo_screenwidth - vo_dwidth) / 2; + *drwY = (vo_screenheight - vo_dheight) / 2; + mp_msg(MSGT_VO, MSGL_V, "[vo-fs] dx: %d dy: %d dw: %d dh: %d\n", + *drwX, *drwY, vo_dwidth, vo_dheight); + } else if (WinID == 0) { + *drwX = vo_dx; + *drwY = vo_dy; + } +} + #ifdef CONFIG_XV int vo_xv_set_eq(uint32_t xv_port, char *name, int value) { diff --git a/libvo/x11_common.h b/libvo/x11_common.h index b4f1e4ae9f..d4b18c89ea 100644 --- a/libvo/x11_common.h +++ b/libvo/x11_common.h @@ -129,5 +129,6 @@ void vo_vm_close(void); void update_xinerama_info(void); int vo_find_depth_from_visuals(Display *dpy, int screen, Visual **visual_return); +void vo_calc_drwXY(uint32_t *drwX, uint32_t *drwY); #endif /* MPLAYER_X11_COMMON_H */ -- cgit v1.2.3 From 20109f0a2eec40b7081a6a8b6864b92aa56cbc7c Mon Sep 17 00:00:00 2001 From: diego Date: Fri, 9 Jan 2009 20:50:25 +0000 Subject: Fix build: calc_drwXY was factorized into vo_calc_drwXY. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28286 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/vo_xvmc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libvo') diff --git a/libvo/vo_xvmc.c b/libvo/vo_xvmc.c index 29ce3b6471..9446f64393 100644 --- a/libvo/vo_xvmc.c +++ b/libvo/vo_xvmc.c @@ -1019,7 +1019,7 @@ int e=vo_x11_check_events(mDisplay); { e |= VO_EVENT_EXPOSE; - calc_drwXY(&drwX, &drwY); + vo_calc_drwXY(&drwX, &drwY); } if ( e & VO_EVENT_EXPOSE ) { -- cgit v1.2.3 From 07fb95d10b00e2cc515b9c6cb9dfcfa42f3b4f4a Mon Sep 17 00:00:00 2001 From: reimar Date: Sat, 10 Jan 2009 13:47:41 +0000 Subject: Change vo_draw_text to a vo_draw_text_ext function which draws DVD navigation highlights at the correct position with the high-resolution OSD of -vo gl. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28290 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/sub.c | 50 ++++++++++++++++++++++++++++++++++++++++---------- libvo/sub.h | 3 +++ libvo/vo_gl.c | 3 ++- 3 files changed, 45 insertions(+), 11 deletions(-) (limited to 'libvo') diff --git a/libvo/sub.c b/libvo/sub.c index 4319f191a4..94c38545dc 100644 --- a/libvo/sub.c +++ b/libvo/sub.c @@ -224,13 +224,32 @@ void osd_set_nav_box (uint16_t sx, uint16_t sy, uint16_t ex, uint16_t ey) { nav_hl.ey = ey; } -inline static void vo_update_nav (mp_osd_obj_t *obj, int dxs, int dys) { +inline static void vo_update_nav (mp_osd_obj_t *obj, int dxs, int dys, int left_border, int top_border, + int right_border, int bottom_border, int orig_w, int orig_h) { int len; - - obj->bbox.x1 = obj->x = nav_hl.sx; - obj->bbox.y1 = obj->y = nav_hl.sy; - obj->bbox.x2 = nav_hl.ex; - obj->bbox.y2 = nav_hl.ey; + int sx = nav_hl.sx, sy = nav_hl.sy; + int ex = nav_hl.ex, ey = nav_hl.ey; + int scaled_w = dxs - left_border - right_border; + int scaled_h = dys - top_border - bottom_border; + if (scaled_w != orig_w) { + sx = sx * scaled_w / orig_w; + ex = ex * scaled_w / orig_w; + } + if (scaled_h != orig_h) { + sy = sy * scaled_h / orig_h; + ey = ey * scaled_h / orig_h; + } + sx += left_border; ex += left_border; + sy += top_border; ey += top_border; + sx = FFMIN(FFMAX(sx, 0), dxs); + ex = FFMIN(FFMAX(ex, 0), dxs); + sy = FFMIN(FFMAX(sy, 0), dys); + ey = FFMIN(FFMAX(ey, 0), dys); + + obj->bbox.x1 = obj->x = sx; + obj->bbox.y1 = obj->y = sy; + obj->bbox.x2 = ex; + obj->bbox.y2 = ey; alloc_buf (obj); len = obj->stride * (obj->bbox.y2 - obj->bbox.y1); @@ -1060,7 +1079,8 @@ void free_osd_list(void){ #define FONT_LOAD_DEFER 6 -int vo_update_osd(int dxs,int dys){ +int vo_update_osd_ext(int dxs,int dys, int left_border, int top_border, + int right_border, int bottom_border, int orig_w, int orig_h){ mp_osd_obj_t* obj=vo_osd_list; int chg=0; #ifdef CONFIG_FREETYPE @@ -1115,7 +1135,7 @@ int vo_update_osd(int dxs,int dys){ switch(obj->type){ #ifdef CONFIG_DVDNAV case OSDTYPE_DVDNAV: - vo_update_nav(obj,dxs,dys); + vo_update_nav(obj,dxs,dys, left_border, top_border, right_border, bottom_border, orig_w, orig_h); break; #endif case OSDTYPE_SUBTITLE: @@ -1179,6 +1199,10 @@ int vo_update_osd(int dxs,int dys){ return chg; } +int vo_update_osd(int dxs, int dys) { + return vo_update_osd_ext(dxs, dys, 0, 0, 0, 0, dxs, dys); +} + void vo_init_osd(void){ if(!draw_alpha_init_flag){ draw_alpha_init_flag=1; @@ -1221,9 +1245,11 @@ void vo_remove_text(int dxs,int dys,void (*remove)(int x0,int y0, int w,int h)){ } } -void vo_draw_text(int dxs,int dys,void (*draw_alpha)(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride)){ +void vo_draw_text_ext(int dxs, int dys, int left_border, int top_border, + int right_border, int bottom_border, int orig_w, int orig_h, + void (*draw_alpha)(int x0, int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride)) { mp_osd_obj_t* obj=vo_osd_list; - vo_update_osd(dxs,dys); + vo_update_osd_ext(dxs, dys, left_border, top_border, right_border, bottom_border, orig_w, orig_h); while(obj){ if(obj->flags&OSDFLAG_VISIBLE){ vo_osd_changed_flag=obj->flags&OSDFLAG_CHANGED; // temp hack @@ -1251,6 +1277,10 @@ void vo_draw_text(int dxs,int dys,void (*draw_alpha)(int x0,int y0, int w,int h, } } +void vo_draw_text(int dxs, int dys, void (*draw_alpha)(int x0, int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride)) { + vo_draw_text_ext(dxs, dys, 0, 0, 0, 0, dxs, dys, draw_alpha); +} + static int vo_osd_changed_status = 0; int vo_osd_changed(int new_value) diff --git a/libvo/sub.h b/libvo/sub.h index 591a166692..b16cd77a60 100644 --- a/libvo/sub.h +++ b/libvo/sub.h @@ -106,6 +106,9 @@ extern int spu_aamode; extern float spu_gaussvar; void vo_draw_text(int dxs,int dys,void (*draw_alpha)(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride)); +void vo_draw_text_ext(int dxs, int dys, int left_border, int top_border, + int right_border, int bottom_border, int orig_w, int orig_h, + void (*draw_alpha)(int x0, int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride)); void vo_remove_text(int dxs,int dys,void (*remove)(int x0,int y0, int w,int h)); void vo_init_osd(void); diff --git a/libvo/vo_gl.c b/libvo/vo_gl.c index 6560b325fb..30402233af 100644 --- a/libvo/vo_gl.c +++ b/libvo/vo_gl.c @@ -612,7 +612,8 @@ static void draw_osd(void) clearOSD(); osd_w = scaled_osd ? image_width : vo_dwidth; osd_h = scaled_osd ? image_height : vo_dheight; - vo_draw_text(osd_w, osd_h, create_osd_texture); + vo_draw_text_ext(osd_w, osd_h, ass_border_x, ass_border_y, ass_border_x, ass_border_y, + image_width, image_height, create_osd_texture); } if (vo_doublebuffering) do_render_osd(); } -- cgit v1.2.3