From 5a593d2193ae79bdf223b2ff9cb18dae3da048e1 Mon Sep 17 00:00:00 2001 From: arpi Date: Sun, 23 Sep 2001 18:42:39 +0000 Subject: [PATCH] software OSD support git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@1944 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/vo_mpegpes.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/libvo/vo_mpegpes.c b/libvo/vo_mpegpes.c index 4ddf821a95..6337b10f42 100644 --- a/libvo/vo_mpegpes.c +++ b/libvo/vo_mpegpes.c @@ -58,6 +58,8 @@ static int outbuf_size = 100000; static int s_pos_x,s_pos_y; static int d_pos_x,d_pos_y; +static int osd_w,osd_h; + static AVPicture picture; static AVCodec *codec=NULL; static AVCodecContext codec_context; @@ -183,16 +185,20 @@ if(format==IMGFMT_YV12){ } #endif + osd_w=s_width; d_pos_x=(codec_context.width-(int)s_width)/2; if(d_pos_x<0){ s_pos_x=-d_pos_x;d_pos_x=0; + osd_w=codec_context.width; } else s_pos_x=0; + osd_h=s_height; d_pos_y=(codec_context.height-(int)s_height)/2; if(d_pos_y<0){ s_pos_y=-d_pos_y;d_pos_y=0; + osd_h=codec_context.height; } else s_pos_y=0; - + printf("[vo] position mapping: %d;%d => %d;%d\n",s_pos_x,s_pos_y,d_pos_x,d_pos_y); /* open it */ @@ -228,8 +234,21 @@ get_info(void) return &vo_info; } +#ifdef USE_LIBAVCODEC +static void draw_alpha(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride){ + int x,y; + vo_draw_alpha_yv12(w,h,src,srca,stride, + picture.data[0]+(x0+d_pos_x)+(y0+d_pos_y)*picture.linesize[0],picture.linesize[0]); +} +#endif + static void draw_osd(void) { +#ifdef USE_LIBAVCODEC + if(picture_buf){ // YV12 only: + vo_draw_text(osd_w,osd_h,draw_alpha); + } +#endif } #define NFD 2