Mercurial > mplayer.hg
comparison libvo/vo_mpegpes.c @ 1943:24c248fbdb0f
software OSD support
author | arpi |
---|---|
date | Sun, 23 Sep 2001 18:42:39 +0000 |
parents | d8dc5e438965 |
children | b1d663f54725 |
comparison
equal
deleted
inserted
replaced
1942:853be3ebe862 | 1943:24c248fbdb0f |
---|---|
55 static unsigned char *outbuf=NULL; | 55 static unsigned char *outbuf=NULL; |
56 static int outbuf_size = 100000; | 56 static int outbuf_size = 100000; |
57 | 57 |
58 static int s_pos_x,s_pos_y; | 58 static int s_pos_x,s_pos_y; |
59 static int d_pos_x,d_pos_y; | 59 static int d_pos_x,d_pos_y; |
60 | |
61 static int osd_w,osd_h; | |
60 | 62 |
61 static AVPicture picture; | 63 static AVPicture picture; |
62 static AVCodec *codec=NULL; | 64 static AVCodec *codec=NULL; |
63 static AVCodecContext codec_context; | 65 static AVCodecContext codec_context; |
64 extern int avcodec_inited; | 66 extern int avcodec_inited; |
181 codec_context.width=704; | 183 codec_context.width=704; |
182 codec_context.height=576; | 184 codec_context.height=576; |
183 } | 185 } |
184 #endif | 186 #endif |
185 | 187 |
188 osd_w=s_width; | |
186 d_pos_x=(codec_context.width-(int)s_width)/2; | 189 d_pos_x=(codec_context.width-(int)s_width)/2; |
187 if(d_pos_x<0){ | 190 if(d_pos_x<0){ |
188 s_pos_x=-d_pos_x;d_pos_x=0; | 191 s_pos_x=-d_pos_x;d_pos_x=0; |
192 osd_w=codec_context.width; | |
189 } else s_pos_x=0; | 193 } else s_pos_x=0; |
190 | 194 |
195 osd_h=s_height; | |
191 d_pos_y=(codec_context.height-(int)s_height)/2; | 196 d_pos_y=(codec_context.height-(int)s_height)/2; |
192 if(d_pos_y<0){ | 197 if(d_pos_y<0){ |
193 s_pos_y=-d_pos_y;d_pos_y=0; | 198 s_pos_y=-d_pos_y;d_pos_y=0; |
199 osd_h=codec_context.height; | |
194 } else s_pos_y=0; | 200 } else s_pos_y=0; |
195 | 201 |
196 printf("[vo] position mapping: %d;%d => %d;%d\n",s_pos_x,s_pos_y,d_pos_x,d_pos_y); | 202 printf("[vo] position mapping: %d;%d => %d;%d\n",s_pos_x,s_pos_y,d_pos_x,d_pos_y); |
197 | 203 |
198 /* open it */ | 204 /* open it */ |
199 if (avcodec_open(&codec_context, codec) < 0) { | 205 if (avcodec_open(&codec_context, codec) < 0) { |
200 fprintf(stderr, "could not open codec\n"); | 206 fprintf(stderr, "could not open codec\n"); |
226 get_info(void) | 232 get_info(void) |
227 { | 233 { |
228 return &vo_info; | 234 return &vo_info; |
229 } | 235 } |
230 | 236 |
237 #ifdef USE_LIBAVCODEC | |
238 static void draw_alpha(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride){ | |
239 int x,y; | |
240 vo_draw_alpha_yv12(w,h,src,srca,stride, | |
241 picture.data[0]+(x0+d_pos_x)+(y0+d_pos_y)*picture.linesize[0],picture.linesize[0]); | |
242 } | |
243 #endif | |
244 | |
231 static void draw_osd(void) | 245 static void draw_osd(void) |
232 { | 246 { |
247 #ifdef USE_LIBAVCODEC | |
248 if(picture_buf){ // YV12 only: | |
249 vo_draw_text(osd_w,osd_h,draw_alpha); | |
250 } | |
251 #endif | |
233 } | 252 } |
234 | 253 |
235 #define NFD 2 | 254 #define NFD 2 |
236 | 255 |
237 static void my_write(unsigned char* data,int len){ | 256 static void my_write(unsigned char* data,int len){ |