summaryrefslogtreecommitdiff
path: root/src/video_out/video_out_fb.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/video_out/video_out_fb.c')
-rw-r--r--src/video_out/video_out_fb.c127
1 files changed, 40 insertions, 87 deletions
diff --git a/src/video_out/video_out_fb.c b/src/video_out/video_out_fb.c
index e88def112..3ca39b89d 100644
--- a/src/video_out/video_out_fb.c
+++ b/src/video_out/video_out_fb.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2000-2003 the xine project and Fredrik Noring
+ * Copyright (C) 2000-2007 the xine project and Fredrik Noring
*
* This file is part of xine, a free video player.
*
@@ -18,28 +18,28 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
* $Id: video_out_fb.c,v 1.49 2006/12/19 19:10:51 dsalt Exp $
- *
- * video_out_fb.c, frame buffer xine driver by Miguel Freitas
+ */
+
+/**
+ * @file
+ * @brief Frame buffer xine driver
*
- * Contributors:
+ * @author Miguel Freitas
*
- * Fredrik Noring <noring@nocrew.org>: Zero copy buffers and clean up.
+ * @author Fredrik Noring <noring@nocrew.org>:
+ * Zero copy buffers and clean up.
*
- * based on xine's video_out_xshm.c...
- * ...based on mpeg2dec code from
- * Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
+ * @author Aaron Holtzman <aholtzma@ess.engr.uvic.ca>:
+ * Based on xine's video_out_xshm.c, based on mpeg2dec code from
*
- * ideas from ppmtofb - Display P?M graphics on framebuffer devices
- * by Geert Uytterhoeven and Chris Lawrence
+ * @author Geert Uytterhoeven and Chris Lawrence:
+ * Ideas from ppmtofb - Display P?M graphics on framebuffer devices.
*
- * Note: Use this with fbxine. It may work with the regular xine too,
- * provided the visual type is changed (see below).
+ * @note Use this with fbxine.
*
- * TODO: VT switching (configurable)
+ * @todo VT Switching (configurable)
*/
-/* #define USE_X11_VISUAL */
-
#define RECOMMENDED_NUM_BUFFERS 5
#define MAXIMUM_NUM_BUFFERS 25
@@ -99,7 +99,6 @@ typedef struct fb_frame_s
yuv2rgb_t *yuv2rgb; /* yuv2rgb converter for this frame */
uint8_t *rgb_dst;
int yuv_stride;
- int stripe_height, stripe_inc;
int bytes_per_line;
@@ -182,7 +181,6 @@ static void fb_frame_proc_slice(vo_frame_t *vo_img, uint8_t **src)
else
frame->yuv2rgb->yuy22rgb_fun(frame->yuv2rgb,
frame->rgb_dst, src[0]);
- frame->rgb_dst += frame->stripe_inc;
}
static void fb_frame_field(vo_frame_t *vo_img, int which_field)
@@ -193,21 +191,18 @@ static void fb_frame_field(vo_frame_t *vo_img, int which_field)
{
case VO_TOP_FIELD:
frame->rgb_dst = frame->data;
- frame->stripe_inc = 2*frame->stripe_height *
- frame->bytes_per_line;
break;
case VO_BOTTOM_FIELD:
frame->rgb_dst = frame->data +
frame->bytes_per_line ;
- frame->stripe_inc = 2*frame->stripe_height *
- frame->bytes_per_line;
break;
case VO_BOTH_FIELDS:
frame->rgb_dst = frame->data;
break;
}
+ frame->yuv2rgb->next_slice (frame->yuv2rgb, NULL);
}
static void fb_frame_dispose(vo_frame_t *vo_img)
@@ -304,11 +299,11 @@ static void setup_colorspace_converter(fb_frame_t *frame, int flags)
frame->yuv2rgb->
configure(frame->yuv2rgb,
frame->sc.delivered_width,
- 16,
+ frame->sc.delivered_height,
2 * frame->vo_frame.pitches[0],
2 * frame->vo_frame.pitches[1],
frame->sc.output_width,
- frame->stripe_height,
+ frame->sc.output_height,
frame->bytes_per_line * 2);
frame->yuv_stride = frame->bytes_per_line * 2;
break;
@@ -317,60 +312,24 @@ static void setup_colorspace_converter(fb_frame_t *frame, int flags)
frame->yuv2rgb->
configure(frame->yuv2rgb,
frame->sc.delivered_width,
- 16,
+ frame->sc.delivered_height,
frame->vo_frame.pitches[0],
frame->vo_frame.pitches[1],
frame->sc.output_width,
- frame->stripe_height,
+ frame->sc.output_height,
frame->bytes_per_line);
frame->yuv_stride = frame->bytes_per_line;
break;
}
}
-static void reset_dest_pointers(fb_frame_t *frame, int flags)
-{
- switch(flags)
- {
- case VO_TOP_FIELD:
- frame->rgb_dst = frame->data;
- frame->stripe_inc = 2 * frame->stripe_height *
- frame->bytes_per_line;
- break;
-
- case VO_BOTTOM_FIELD:
- frame->rgb_dst = frame->data +
- frame->bytes_per_line ;
- frame->stripe_inc = 2 * frame->stripe_height *
- frame->bytes_per_line;
- break;
-
- case VO_BOTH_FIELDS:
- frame->rgb_dst = frame->data;
- frame->stripe_inc = frame->stripe_height *
- frame->bytes_per_line;
- break;
- }
-}
-
static void frame_reallocate(fb_driver_t *this, fb_frame_t *frame,
uint32_t width, uint32_t height, int format)
{
- if(frame->chunk[0])
- {
- free(frame->chunk[0]);
- frame->chunk[0] = NULL;
- }
- if(frame->chunk[1])
- {
- free(frame->chunk[1]);
- frame->chunk[1] = NULL;
- }
- if(frame->chunk[2])
- {
- free(frame->chunk[2]);
- frame->chunk[2] = NULL;
- }
+ free(frame->chunk[0]);
+ free(frame->chunk[1]);
+ free(frame->chunk[2]);
+ memset(frame->chunk, 0, sizeof(frame->chunk[0])*3);
if(this->use_zero_copy)
{
@@ -380,10 +339,9 @@ static void frame_reallocate(fb_driver_t *this, fb_frame_t *frame,
}
else
{
- if(frame->data)
- free(frame->data);
- frame->data = xine_xmalloc(frame->sc.output_width *
- frame->sc.output_height *
+ free(frame->data);
+ frame->data = xine_xcalloc(frame->sc.output_width *
+ frame->sc.output_height,
this->bytes_per_pixel);
}
@@ -457,8 +415,6 @@ static void fb_update_frame_format(vo_driver_t *this_gen,
frame_reallocate(this, frame, width, height, format);
- frame->stripe_height = 16 * frame->sc.output_height /
- frame->sc.delivered_height;
if(this->use_zero_copy)
frame->bytes_per_line = this->fb_bytes_per_line;
else
@@ -468,13 +424,13 @@ static void fb_update_frame_format(vo_driver_t *this_gen,
setup_colorspace_converter(frame, flags);
}
- reset_dest_pointers(frame, flags);
+ fb_frame_field(frame_gen, flags);
}
static void fb_overlay_clut_yuv2rgb(fb_driver_t *this,
vo_overlay_t *overlay, fb_frame_t *frame)
{
- int i;
+ size_t i;
clut_t* clut = (clut_t*)overlay->color;
if(!overlay->rgb_clut)
@@ -842,7 +798,7 @@ static void register_callbacks(fb_driver_t *this)
static int open_fb_device(config_values_t *config, xine_t *xine)
{
- static char devkey[] = "video.device.fb_device"; /* Why static? */
+ static const char devkey[] = "video.device.fb_device";
char *device_name;
int fd;
@@ -924,7 +880,7 @@ static int mode_visual(fb_driver_t *this, config_values_t *config,
}
}
- xprintf(this->xine, XINE_VERBOSITY_LOG, _("video_out_fb: Your video mode was not recognized, sorry.\n"));
+ xprintf(this->xine, XINE_VERBOSITY_LOG, _("%s: Your video mode was not recognized, sorry.\n"), LOG_MODULE);
return 0;
}
@@ -981,16 +937,16 @@ static void setup_buffers(fb_driver_t *this,
this->cur_frame = this->old_frame = 0;
xprintf(this->xine, XINE_VERBOSITY_LOG,
- _("video_out_fb: %d video RAM buffers are available.\n"), this->total_num_native_buffers);
+ _("%s: %d video RAM buffers are available.\n"), LOG_MODULE, this->total_num_native_buffers);
if(this->total_num_native_buffers < RECOMMENDED_NUM_BUFFERS)
{
this->use_zero_copy = 0;
xprintf(this->xine, XINE_VERBOSITY_LOG,
- _("WARNING: video_out_fb: Zero copy buffers are DISABLED because only %d buffers\n"
+ _("WARNING: %s: Zero copy buffers are DISABLED because only %d buffers\n"
" are available which is less than the recommended %d buffers. Lowering\n"
" the frame buffer resolution might help.\n"),
- this->total_num_native_buffers, RECOMMENDED_NUM_BUFFERS);
+ LOG_MODULE, this->total_num_native_buffers, RECOMMENDED_NUM_BUFFERS);
}
else
{
@@ -998,8 +954,8 @@ static void setup_buffers(fb_driver_t *this,
this->fb_var.yoffset = this->fb_var.yres;
if(ioctl(this->fd, FBIOPAN_DISPLAY, &this->fb_var) == -1) {
xprintf(this->xine, XINE_VERBOSITY_LOG,
- _("WARNING: video_out_fb: Zero copy buffers are DISABLED because kernel driver\n"
- " do not support screen panning (used for frame flips).\n"));
+ _("WARNING: %s: Zero copy buffers are DISABLED because kernel driver\n"
+ " do not support screen panning (used for frame flips).\n"), LOG_MODULE);
} else {
this->fb_var.yoffset = 0;
ioctl(this->fd, FBIOPAN_DISPLAY, &this->fb_var);
@@ -1067,12 +1023,13 @@ static vo_driver_t *fb_open_plugin(video_driver_class_t *class_gen,
if(this->depth > 16)
xprintf(this->xine, XINE_VERBOSITY_LOG,
- _("WARNING: video_out_fb: current display depth is %d. For better performance\n"
- " a depth of 16 bpp is recommended!\n\n"), this->depth);
+ _("WARNING: %s: current display depth is %d. For better performance\n"
+ " a depth of 16 bpp is recommended!\n\n"), LOG_MODULE, this->depth);
xprintf(class->xine, XINE_VERBOSITY_DEBUG,
- "video_out_fb: video mode depth is %d (%d bpp),\n"
+ "%s: video mode depth is %d (%d bpp),\n"
" red: %d/%d, green: %d/%d, blue: %d/%d\n",
+ LOG_MODULE,
this->depth, this->bpp,
this->fb_var.red.length, this->fb_var.red.offset,
this->fb_var.green.length, this->fb_var.green.offset,
@@ -1125,11 +1082,7 @@ static void *fb_init_class(xine_t *xine, void *visual_gen)
static const vo_info_t vo_info_fb =
{
1, /* priority */
-#ifdef USE_X11_VISUAL
- XINE_VISUAL_TYPE_X11 /* visual type */
-#else
XINE_VISUAL_TYPE_FB /* visual type */
-#endif
};
/* exported plugin catalog entry */