Index: vo_fbdev.c =================================================================== RCS file: /cvsroot/mplayer/main/libvo/vo_fbdev.c,v retrieving revision 1.79 diff -u -r1.79 vo_fbdev.c --- vo_fbdev.c 19 Apr 2003 18:57:16 -0000 1.79 +++ vo_fbdev.c 1 Jun 2003 22:36:47 -0000 @@ -28,6 +28,7 @@ #include "fastmemcpy.h" #include "sub.h" #include "../postproc/rgb2rgb.h" +#include "../libmpcodecs/vf_scale.h" #ifdef CONFIG_VIDIX #include "vosub_vidix.h" #endif @@ -609,7 +610,7 @@ * Chris Lawrence's code. * (modified a bit to fit in my code...) */ -struct fb_cmap *make_directcolor_cmap(struct fb_var_screeninfo *var) +static struct fb_cmap *make_directcolor_cmap(struct fb_var_screeninfo *var) { /* Hopefully any DIRECTCOLOR device will have a big enough palette * to handle mapping the full color depth. @@ -684,11 +685,17 @@ } #endif -static int fb_preinit(void) +static int fb_preinit(int reset) { static int fb_preinit_done = 0; static int fb_works = 0; + if (reset) + { + fb_preinit_done = 0; + return 0; + } + if (fb_preinit_done) return fb_works; @@ -1093,9 +1100,6 @@ } if (fs || vm) memset(frame_buffer, '\0', fb_line_len * fb_yres); - - if (format == IMGFMT_YV12) - yuv2rgb_init(fb_bpp, MODE_RGB); } if (vt_doit && (vt_fd = open("/dev/tty", O_WRONLY)) == -1) { printf(FBDEV "can't open /dev/tty: %s\n", strerror(errno)); @@ -1109,6 +1113,8 @@ if (vt_doit) vt_set_textarea(last_row, fb_yres); + sws_rgb2rgb_init(get_sws_cpuflags()); + return 0; } @@ -1116,7 +1122,7 @@ { int ret = VFCAP_OSD|VFCAP_CSP_SUPPORTED; /* osd/sub is supported on every bpp */ - if (!fb_preinit()) + if (!fb_preinit(0)) return 0; #ifdef CONFIG_VIDIX if(vidix_name) @@ -1132,8 +1138,6 @@ else if (bpp == 24 && fb_bpp == 32) return ret; } - //if (format == IMGFMT_YV12) - // return ret; return 0; } @@ -1143,35 +1147,15 @@ unsigned char *dst; int dstride; -#ifdef USE_CONVERT2FB - if (pixel_format == IMGFMT_YV12) { - dst = L123123875 + (fb_xres * y0 + x0) * fb_pixel_size; - dstride = fb_xres * fb_pixel_size; - } - else -#endif - { dst = next_frame + (in_width * y0 + x0) * fb_pixel_size; dstride = in_width * fb_pixel_size; - } (*draw_alpha_p)(w, h, src, srca, stride, dst, dstride); } static uint32_t draw_frame(uint8_t *src[]) { - if (pixel_format == IMGFMT_YV12) { -#ifdef USE_CONVERT2FB - yuv2rgb(L123123875, src[0], src[1], src[2], fb_xres, - fb_yres, fb_xres * fb_pixel_size, - in_width, in_width / 2); -#else - yuv2rgb(next_frame, src[0], src[1], src[2], in_width, - in_height, in_width * fb_pixel_size, - in_width, in_width / 2); -#endif - - } else if (flip) { + if (flip) { int h = in_height; int len = in_width * fb_pixel_size; char *d = next_frame + (in_height - 1) * len; @@ -1198,26 +1182,6 @@ static uint32_t draw_slice(uint8_t *src[], int stride[], int w, int h, int x, int y) { - uint8_t *dest; - -#ifdef USE_CONVERT2FB - if (pixel_format == IMGFMT_YV12) { - if(x < fb_xres && y < fb_yres) { - if(x+w > fb_xres) w= fb_xres-x; - if(y+h > fb_yres) h= fb_yres-y; - - dest = L123123875 + (fb_xres * y + x) * fb_pixel_size; - yuv2rgb(dest, src[0], src[1], src[2], w, h, fb_xres * fb_pixel_size, - stride[0], stride[1]); - } - - return 0; - } -#endif - - dest = next_frame + (in_width * y + x) * fb_pixel_size; - yuv2rgb(dest, src[0], src[1], src[2], w, h, in_width * fb_pixel_size, - stride[0], stride[1]); return 0; } @@ -1225,15 +1189,15 @@ { } -static void put_frame(void) +static void draw_osd(void) +{ + vo_draw_text(in_width, in_height, draw_alpha); +} + +static void flip_page(void) { int i, out_offset = 0, in_offset = 0; -#ifdef USE_CONVERT2FB - if(pixel_format == IMGFMT_YV12) - return; -#endif - for (i = 0; i < in_height; i++) { memcpy(L123123875 + out_offset, next_frame + in_offset, in_width * fb_pixel_size); @@ -1242,20 +1206,11 @@ } } -static void draw_osd(void) -{ - vo_draw_text(in_width, in_height, draw_alpha); -} - -static void flip_page(void) -{ - put_frame(); -} - static void uninit(void) { if (verbose > 0) printf(FBDEV "uninit\n"); + fb_preinit(1); if (fb_cmap_changed) { if (ioctl(fb_dev_fd, FBIOPUTCMAP, &fb_oldcmap)) printf(FBDEV "Can't restore original cmap\n"); @@ -1291,7 +1246,7 @@ if(verbose > 2) printf("vo_subdevice: initialization returns: %i\n",pre_init_err); #endif - if(!pre_init_err) return (pre_init_err=(fb_preinit()?0:-1)); + if(!pre_init_err) return (pre_init_err=(fb_preinit(0)?0:-1)); return(-1); }