diff options
Diffstat (limited to 'src/video_out/video_out_fb.c')
-rw-r--r-- | src/video_out/video_out_fb.c | 84 |
1 files changed, 35 insertions, 49 deletions
diff --git a/src/video_out/video_out_fb.c b/src/video_out/video_out_fb.c index 78d23cd91..08663ae61 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. * @@ -16,28 +16,28 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA + */ + +/** + * @file + * @brief Frame buffer xine driver * - * video_out_fb.c, frame buffer xine driver by Miguel Freitas - * - * 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 @@ -324,21 +324,10 @@ static void setup_colorspace_converter(fb_frame_t *frame, int flags) 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) { @@ -348,10 +337,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); } @@ -440,7 +428,7 @@ static void fb_update_frame_format(vo_driver_t *this_gen, 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) @@ -808,7 +796,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; @@ -890,7 +878,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; } @@ -947,16 +935,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 { @@ -964,8 +952,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); @@ -1033,12 +1021,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, @@ -1091,11 +1080,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 */ @@ -1104,3 +1089,4 @@ const plugin_info_t xine_plugin_info[] EXPORTED = { { PLUGIN_VIDEO_OUT, 21, "fb", XINE_VERSION_CODE, &vo_info_fb, fb_init_class }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; + |