[Mplayer-cvslog] CVS: main/libvo vo_fbdev.c,1.1,1.2
Szabolcs Berecz
szabii at users.sourceforge.net
Wed Mar 28 18:35:16 CEST 2001
Update of /cvsroot/mplayer/main/libvo
In directory usw-pr-cvs1:/tmp/cvs-serv23853
Modified Files:
vo_fbdev.c
Log Message:
maybe it can play avi :)
Index: vo_fbdev.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_fbdev.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** vo_fbdev.c 2001/03/28 12:08:44 1.1
--- vo_fbdev.c 2001/03/28 16:35:14 1.2
***************
*** 36,39 ****
--- 36,41 ----
static uint8_t *frame_buffer;
static int fb_bpp;
+ struct fb_fix_screeninfo fb_fix_info;
+ struct fb_var_screeninfo fb_var_info;
static int in_width;
***************
*** 45,53 ****
static uint32_t pixel_format;
! static int init_done = 0;
! static uint32_t init(uint32_t width, uint32_t height, uint32_t d_width,
! uint32_t d_height, uint32_t fullscreen, char *title,
! uint32_t format)
{
int fd, vt;
--- 47,53 ----
static uint32_t pixel_format;
! static int fb_init_done = 0;
! static int fb_init(void)
{
int fd, vt;
***************
*** 55,61 ****
struct vt_stat vt_state;
struct vt_mode vt_mode;
- struct fb_fix_screeninfo fix_info;
- struct fb_var_screeninfo var_info;
/* get a free vt */
if ((fd = open("/dev/tty0", O_WRONLY, 0)) == -1) {
--- 55,60 ----
struct vt_stat vt_state;
struct vt_mode vt_mode;
+ #if 0
/* get a free vt */
if ((fd = open("/dev/tty0", O_WRONLY, 0)) == -1) {
***************
*** 68,72 ****
}
close(fd);
!
/* open the vt */
snprintf(vt_name, 10, "/dev/tty%d", vt);
--- 67,72 ----
}
close(fd);
! #endif
! #if 0
/* open the vt */
snprintf(vt_name, 10, "/dev/tty%d", vt);
***************
*** 85,88 ****
--- 85,89 ----
close(fd);
}
+ #endif
#if 0
/* switch to the new vt */
***************
*** 104,139 ****
}
#endif
-
if (!fb_dev_name && !(fb_dev_name = getenv("FRAMEBUFFER")))
fb_dev_name = "/dev/fb0";
if ((fb_dev_fd = open(fb_dev_name, O_RDWR)) == -1) {
! printf("Can't open %s: %s\n", fb_dev_name, strerror(errno));
return 1;
}
! if (ioctl(fb_dev_fd, FBIOGET_VSCREENINFO, &var_info)) {
! printf("Can't get VSCREENINFO: %s\n", strerror(errno));
return 1;
}
!
! if (ioctl(fb_dev_fd, FBIOGET_FSCREENINFO, &fix_info)) {
! printf("Can't get VSCREENINFO: %s\n", strerror(errno));
return 1;
}
! switch (fix_info.type) {
case FB_TYPE_VGA_PLANES:
! printf("FB_TYPE_VGA_PLANES not supported.\n");
return 1;
break;
case FB_TYPE_PLANES:
! printf("FB_TYPE_PLANES not supported.\n");
return 1;
break;
case FB_TYPE_INTERLEAVED_PLANES:
! printf("FB_TYPE_INTERLEAVED_PLANES not supported.\n");
return 1;
break;
#ifdef FB_TYPE_TEXT
case FB_TYPE_TEXT:
! printf("FB_TYPE_TEXT not supported.\n");
return 1;
break;
--- 105,139 ----
}
#endif
if (!fb_dev_name && !(fb_dev_name = getenv("FRAMEBUFFER")))
fb_dev_name = "/dev/fb0";
+ printf("fb_init: using %s\n", fb_dev_name);
if ((fb_dev_fd = open(fb_dev_name, O_RDWR)) == -1) {
! printf("fb_init: Can't open %s: %s\n", fb_dev_name, strerror(errno));
return 1;
}
! if (ioctl(fb_dev_fd, FBIOGET_VSCREENINFO, &fb_var_info)) {
! printf("fb_init: Can't get VSCREENINFO: %s\n", strerror(errno));
return 1;
}
! if (ioctl(fb_dev_fd, FBIOGET_FSCREENINFO, &fb_fix_info)) {
! printf("fb_init: Can't get VSCREENINFO: %s\n", strerror(errno));
return 1;
}
! switch (fb_fix_info.type) {
case FB_TYPE_VGA_PLANES:
! printf("fb_init: FB_TYPE_VGA_PLANES not supported.\n");
return 1;
break;
case FB_TYPE_PLANES:
! printf("fb_init: FB_TYPE_PLANES not supported.\n");
return 1;
break;
case FB_TYPE_INTERLEAVED_PLANES:
! printf("fb_init: FB_TYPE_INTERLEAVED_PLANES not supported.\n");
return 1;
break;
#ifdef FB_TYPE_TEXT
case FB_TYPE_TEXT:
! printf("fb_init: FB_TYPE_TEXT not supported.\n");
return 1;
break;
***************
*** 141,163 ****
case FB_TYPE_PACKED_PIXELS:
/* OK */
break;
default:
! printf("unknown FB_TYPE: %d\n", fix_info.type);
return 1;
}
! fb_size = fix_info.smem_len;
if ((frame_buffer = (uint8_t *) mmap(0, fb_size, PROT_READ | PROT_WRITE,
MAP_SHARED, fb_dev_fd, 0)) == (uint8_t *) -1) {
! printf("Can't mmap %s: %s\n", fb_dev_name, strerror(errno));
return 1;
}
close(fb_dev_fd);
! fb_bpp = var_info.bits_per_pixel;
! screen_width = fix_info.line_length;
! printf("vo_fbdev: frame_buffer @ %p\n", frame_buffer);
! printf("vo_fbdev: frame_buffer size: %d bytes\n", fb_size);
! printf("vo_fbdev: bits_per_pixel: %d\n", fb_bpp);
! printf("vo_fbdev: visual: %d\n", fix_info.visual);
in_width = width;
--- 141,177 ----
case FB_TYPE_PACKED_PIXELS:
/* OK */
+ printf("fb_init: FB_TYPE_PACKED_PIXELS: OK\n");
break;
default:
! printf("fb_init: unknown FB_TYPE: %d\n", fb_fix_info.type);
return 1;
}
! fb_bpp = fb_var_info.bits_per_pixel;
! screen_width = fb_fix_info.line_length;
! fb_size = fb_fix_info.smem_len;
if ((frame_buffer = (uint8_t *) mmap(0, fb_size, PROT_READ | PROT_WRITE,
MAP_SHARED, fb_dev_fd, 0)) == (uint8_t *) -1) {
! printf("fb_init: Can't mmap %s: %s\n", fb_dev_name, strerror(errno));
return 1;
}
close(fb_dev_fd);
!
! printf("fb_init: framebuffer @ %p\n", frame_buffer);
! printf("fb_init: framebuffer size: %d bytes\n", fb_size);
! printf("fb_init: bpp: %d\n", fb_bpp);
! printf("fb_init: pixel per line: %d\n", screen_width / (fb_bpp / 8));
! printf("fb_init: visual: %d\n", fb_fix_info.visual);
!
! fb_init_done = 1;
! return 0;
! }
! static uint32_t init(uint32_t width, uint32_t height, uint32_t d_width,
! uint32_t d_height, uint32_t fullscreen, char *title,
! uint32_t format)
! {
! if (!fb_init_done)
! if (fb_init())
! return 1;
in_width = width;
***************
*** 173,177 ****
if (format == IMGFMT_YV12)
yuv2rgb_init(fb_bpp, MODE_RGB);
- init_done = 1;
return 0;
}
--- 187,190 ----
***************
*** 179,207 ****
static uint32_t query_format(uint32_t format)
{
! if (format == IMGFMT_YV12)
! return 1;
! if (format == IMGFMT_RGB32 && fb_bpp == 32)
! return 1;
switch (format) {
case IMGFMT_YV12:
! return 1;
case IMGFMT_RGB32:
if (fb_bpp == 32)
! return 1;
break;
case IMGFMT_RGB24:
if (fb_bpp == 24)
! return 1;
break;
case IMGFMT_RGB16:
if (fb_bpp == 16)
! return 1;
break;
case IMGFMT_RGB15:
if (fb_bpp == 15)
! return 1;
break;
}
return 0;
}
--- 192,243 ----
static uint32_t query_format(uint32_t format)
{
! if (!fb_init_done)
! if (fb_init())
! return 0;
! printf("vo_fbdev: query_format(%#x): ", format);
! if (format & IMGFMT_BGR_MASK == IMGFMT_BGR)
! goto not_supported;
switch (format) {
case IMGFMT_YV12:
! goto supported;
case IMGFMT_RGB32:
if (fb_bpp == 32)
! goto supported;
break;
case IMGFMT_RGB24:
if (fb_bpp == 24)
! goto supported;
break;
case IMGFMT_RGB16:
if (fb_bpp == 16)
! goto supported;
break;
case IMGFMT_RGB15:
if (fb_bpp == 15)
! goto supported;
! break;
! case IMGFMT_BGR|32:
! if (fb_bpp == 32)
! goto supported;
break;
+ case IMGFMT_BGR|24:
+ if (fb_bpp == 24)
+ goto supported;
+ break;
+ case IMGFMT_BGR|16:
+ if (fb_bpp == 16)
+ goto supported;
+ break;
+ case IMGFMT_BGR|15:
+ if (fb_bpp == 15)
+ goto supported;
+ break;
}
+ not_supported:
+ printf("not_supported\n");
return 0;
+ supported:
+ printf("supported\n");
+ return 1;
}
***************
*** 240,247 ****
in_height, in_width * (fb_bpp / 8),
in_width, in_width / 2);
! } else {
int i;
! for (i = 0; i < in_height; i++)
! memcpy(next_frame, src[0], in_width * (fb_bpp / 8));
}
return 0;
--- 276,289 ----
in_height, in_width * (fb_bpp / 8),
in_width, in_width / 2);
! } else if ((pixel_format & IMGFMT_RGB_MASK) == IMGFMT_RGB) {
int i;
! uint8_t *dst = next_frame;
! uint8_t *s = src[0];
! for (i = 0; i < in_height; i++) {
! memcpy(next_frame, s, in_width * (fb_bpp / 8));
! dst += screen_width;
! s += in_width * (fb_bpp / 8);
! }
! } else {
}
return 0;
_______________________________________________
Mplayer-cvslog mailing list
Mplayer-cvslog at lists.sourceforge.net
http://lists.sourceforge.net/lists/listinfo/mplayer-cvslog
More information about the MPlayer-cvslog
mailing list