xine-lib: xine-lib-1.2.13/src/video_out/video_out_fb.c File Reference

xine-lib 1.2.13-20230125hg15249

Data Structures | Macros | Typedefs | Functions | Variables
video_out_fb.c File Reference

Frame buffer xine driver. More...

`#include <stdio.h>`
`#include <stdlib.h>`
`#include <string.h>`
`#include <math.h>`
`#include <unistd.h>`
`#include <sys/types.h>`
`#include <sys/stat.h>`
`#include <fcntl.h>`
`#include <errno.h>`
`#include <sys/ipc.h>`
`#include <sys/shm.h>`
`#include <sys/time.h>`
`#include <sys/ioctl.h>`
`#include <sys/mman.h>`
`#include <pthread.h>`
`#include <netinet/in.h>`
`#include <linux/fb.h>`
`#include <linux/kd.h>`
`#include <linux/vt.h>`
`#include "xine.h"`
`#include <xine/video_out.h>`
`#include <xine/xine_internal.h>`
`#include "yuv2rgb.h"`
`#include <xine/xineutils.h>`
`#include <xine/vo_scale.h>`

## Data Structures
struct | fb_frame_s
struct | fb_driver_s
struct | fb_class_t

## Macros
#define | RECOMMENDED_NUM_BUFFERS 5
#define | MAXIMUM_NUM_BUFFERS 25
#define | LOG_MODULE "video_out_fb"
#define | LOG_VERBOSE

## Typedefs
typedef struct fb_frame_s | fb_frame_t
typedef struct fb_driver_s | fb_driver_t

## Functions
static uint32_t | fb_get_capabilities (vo_driver_t *this_gen)
static void | fb_frame_proc_slice (vo_frame_t *vo_img, uint8_t **src)
static void | fb_frame_field (vo_frame_t *vo_img, int which_field)
static void | fb_frame_dispose (vo_frame_t *vo_img)
static vo_frame_t * | fb_alloc_frame (vo_driver_t *this_gen)
static void | fb_compute_ideal_size (fb_driver_t *this, fb_frame_t *frame)
static void | fb_compute_rgb_size (fb_driver_t *this, fb_frame_t *frame)
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)
static void | fb_update_frame_format (vo_driver_t *this_gen, vo_frame_t *frame_gen, uint32_t width, uint32_t height, double ratio, int format, int flags)
static void | fb_overlay_clut_yuv2rgb (fb_driver_t *this, vo_overlay_t *overlay, fb_frame_t *frame)
static void | fb_overlay_blend (vo_driver_t *this_gen, vo_frame_t *frame_gen, vo_overlay_t *overlay)
static int | fb_redraw_needed (vo_driver_t *this_gen)
static void | fb_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen)
static int | fb_get_property (vo_driver_t *this_gen, int property)
static int | fb_set_property (vo_driver_t *this_gen, int property, int value)
static void | fb_get_property_min_max (vo_driver_t *this_gen, int property, int *min, int *max)
static int | fb_gui_data_exchange (vo_driver_t *this_gen, int data_type, void *data)
static void | fb_dispose (vo_driver_t *this_gen)
static int | get_fb_var_screeninfo (int fd, struct fb_var_screeninfo *var, xine_t *xine)
static int | get_fb_fix_screeninfo (int fd, struct fb_fix_screeninfo *fix, xine_t *xine)
static int | set_fb_palette (int fd, const struct fb_var_screeninfo *var)
static void | register_callbacks (fb_driver_t *this)
static int | open_fb_device (config_values_t *config, xine_t *xine)
static int | mode_visual (fb_driver_t *this, config_values_t *config, struct fb_var_screeninfo *var, struct fb_fix_screeninfo *fix)
static int | setup_yuv2rgb (fb_driver_t *this, config_values_t *config, struct fb_var_screeninfo *var, struct fb_fix_screeninfo *fix)
static void | setup_buffers (fb_driver_t *this, struct fb_var_screeninfo *var)
static vo_driver_t * | fb_open_plugin (video_driver_class_t *class_gen, const void *visual_gen)
static void * | fb_init_class (xine_t *xine, const void *visual_gen)

## Variables
static const vo_info_t | vo_info_fb
const plugin_info_t xine_plugin_info[] | EXPORTED

## Detailed Description

Frame buffer xine driver.

Author
  Miguel Freitas
  Fredrik Noring norin.nosp@m.g@no.nosp@m.crew..nosp@m.org: Zero copy buffers and clean up.
  Aaron Holtzman aholt.nosp@m.zma@.nosp@m.ess.e.nosp@m.ngr..nosp@m.uvic..nosp@m.ca: Based on xine's video_out_xshm.c, based on mpeg2dec code from
  Geert Uytterhoeven and Chris Lawrence: Ideas from ppmtofb - Display P?M graphics on framebuffer devices.

Note
  Use this with fbxine.

Todo
  VT Switching (configurable)

## Macro Definition Documentation

## ◆ LOG_MODULE

#define LOG_MODULE "video_out_fb"

Referenced by fb_open_plugin(), mode_visual(), and setup_buffers().

## ◆ LOG_VERBOSE

#define LOG_VERBOSE

## ◆ MAXIMUM_NUM_BUFFERS

#define MAXIMUM_NUM_BUFFERS 25

Referenced by get_fb_var_screeninfo().

## ◆ RECOMMENDED_NUM_BUFFERS

#define RECOMMENDED_NUM_BUFFERS 5

Referenced by setup_buffers().

## Typedef Documentation

## ◆ fb_driver_t

typedef struct fb_driver_s fb_driver_t

## ◆ fb_frame_t

typedef struct fb_frame_s fb_frame_t

## Function Documentation

## ◆ fb_alloc_frame()

static vo_frame_t * fb_alloc_frame | ( | vo_driver_t * | this_gen | ) |
| static

References vo_frame_s::dispose, vo_frame_s::driver, fb_frame_dispose(), fb_frame_field(), fb_frame_proc_slice(), vo_frame_s::field, vo_frame_s::mutex, NULL, vo_frame_s::proc_frame, vo_frame_s::proc_slice, fb_frame_s::sc, fb_frame_s::video_mem, fb_frame_s::vo_frame, xine_container_of, fb_frame_s::yoffset, and fb_frame_s::yuv2rgb.

Referenced by register_callbacks().

## ◆ fb_compute_ideal_size()

static void fb_compute_ideal_size | ( | fb_driver_t * | this,
|  | fb_frame_t * | frame )
| static

References _x_vo_scale_compute_ideal_size(), and fb_frame_s::sc.

Referenced by fb_update_frame_format().

## ◆ fb_compute_rgb_size()

static void fb_compute_rgb_size | ( | fb_driver_t * | this,
|  | fb_frame_t * | frame )
| static

References _x_vo_scale_compute_output_size(), vo_scale_s::delivered_height, vo_scale_s::delivered_width, lprintf, vo_scale_s::output_height, vo_scale_s::output_width, and fb_frame_s::sc.

Referenced by fb_update_frame_format().

## ◆ fb_display_frame()

static void fb_display_frame | ( | vo_driver_t * | this_gen,
|  | vo_frame_t * | frame_gen )
| static

References _x_vo_scale_redraw_needed(), fb_frame_s::bytes_per_line, bytes_per_pixel, fb_frame_s::data, vo_scale_s::delivered_height, vo_scale_s::delivered_width, vo_frame_s::free, vo_scale_s::output_height, vo_scale_s::output_width, vo_scale_s::output_xoffset, vo_scale_s::output_yoffset, fb_frame_s::sc, fb_frame_s::video_mem, fb_frame_s::vo_frame, xine_container_of, xine_fast_memcpy, XINE_VERBOSITY_DEBUG, xprintf, and fb_frame_s::yoffset.

Referenced by register_callbacks().

## ◆ fb_dispose()

static void fb_dispose | ( | vo_driver_t * | this_gen | ) |
| static

References _x_alphablend_free(), _x_vo_scale_cleanup(), and xine_container_of.

Referenced by fb_open_plugin(), and register_callbacks().

## ◆ fb_frame_dispose()

static void fb_frame_dispose | ( | vo_frame_t * | vo_img | ) |
| static

References fb_frame_s::data, yuv2rgb_s::dispose, vo_frame_s::driver, xine_container_of, and fb_frame_s::yuv2rgb.

Referenced by fb_alloc_frame().

## ◆ fb_frame_field()

static void fb_frame_field | ( | vo_frame_t * | vo_img,
|  | int | which_field )
| static

References fb_frame_s::bytes_per_line, fb_frame_s::data, yuv2rgb_s::next_slice, NULL, fb_frame_s::rgb_dst, VO_BOTH_FIELDS, VO_BOTTOM_FIELD, VO_TOP_FIELD, xine_container_of, and fb_frame_s::yuv2rgb.

Referenced by fb_alloc_frame(), and fb_update_frame_format().

## ◆ fb_frame_proc_slice()

static void fb_frame_proc_slice | ( | vo_frame_t * | vo_img,
|  | uint8_t ** | src )
| static

References vo_frame_s::crop_bottom, vo_frame_s::crop_left, vo_frame_s::crop_right, vo_frame_s::crop_top, fb_frame_s::format, vo_frame_s::proc_called, fb_frame_s::rgb_dst, fb_frame_s::vo_frame, xine_container_of, XINE_IMGFMT_YV12, fb_frame_s::yuv2rgb, yuv2rgb_s::yuv2rgb_fun, and yuv2rgb_s::yuy22rgb_fun.

Referenced by fb_alloc_frame().

## ◆ fb_get_capabilities()

static uint32_t fb_get_capabilities | ( | vo_driver_t * | this_gen | ) |
| static

References VO_CAP_BRIGHTNESS, VO_CAP_CONTRAST, VO_CAP_SATURATION, VO_CAP_YUY2, and VO_CAP_YV12.

Referenced by register_callbacks().

## ◆ fb_get_property()

static int fb_get_property | ( | vo_driver_t * | this_gen,
|  | int | property )
| static

References VO_PROP_ASPECT_RATIO, VO_PROP_BRIGHTNESS, VO_PROP_CONTRAST, VO_PROP_OUTPUT_HEIGHT, VO_PROP_OUTPUT_WIDTH, VO_PROP_OUTPUT_XOFFSET, VO_PROP_OUTPUT_YOFFSET, VO_PROP_SATURATION, VO_PROP_WINDOW_HEIGHT, VO_PROP_WINDOW_WIDTH, xine_container_of, XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by register_callbacks().

## ◆ fb_get_property_min_max()

static void fb_get_property_min_max | ( | vo_driver_t * | this_gen,
|  | int | property,
|  | int * | min,
|  | int * | max )
| static

References VO_PROP_BRIGHTNESS, VO_PROP_CONTRAST, and VO_PROP_SATURATION.

Referenced by register_callbacks().

## ◆ fb_gui_data_exchange()

static int fb_gui_data_exchange | ( | vo_driver_t * | this_gen,
|  | int | data_type,
|  | void * | data )
| static

Referenced by register_callbacks().

## ◆ fb_init_class()

static void * fb_init_class | ( | xine_t * | xine,
|  | const void * | visual_gen )
| static

References default_video_driver_class_dispose, video_driver_class_s::description, video_driver_class_s::dispose, fb_class_t::driver_class, fb_open_plugin(), video_driver_class_s::identifier, N_, NULL, video_driver_class_s::open_plugin, and fb_class_t::xine.

## ◆ fb_open_plugin()

static vo_driver_t * fb_open_plugin | ( | video_driver_class_t * | class_gen,
|  | const void * | visual_gen )
| static

References _, _x_alphablend_init(), _x_vo_scale_init(), xine_s::config, fb_dispose(), fb_visual_t::frame_output_cb, get_fb_fix_screeninfo(), get_fb_var_screeninfo(), LOG_MODULE, NULL, open_fb_device(), register_callbacks(), set_fb_palette(), setup_buffers(), setup_yuv2rgb(), fb_visual_t::user_data, config_values_s::xine, fb_class_t::xine, XINE_VERBOSITY_DEBUG, XINE_VERBOSITY_LOG, XINE_VO_ASPECT_AUTO, and xprintf.

Referenced by fb_init_class().

## ◆ fb_overlay_blend()

static void fb_overlay_blend | ( | vo_driver_t * | this_gen,
|  | vo_frame_t * | frame_gen,
|  | vo_overlay_t * | overlay )
| static

References _x_blend_rgb16(), _x_blend_rgb24(), _x_blend_rgb32(), fb_frame_s::data, vo_scale_s::delivered_height, vo_scale_s::delivered_width, fb_overlay_clut_yuv2rgb(), vo_overlay_s::hili_rgb_clut, vo_scale_s::output_height, vo_scale_s::output_width, vo_frame_s::overlay_offset_x, vo_frame_s::overlay_offset_y, vo_overlay_s::rgb_clut, vo_overlay_s::rle, fb_frame_s::sc, and xine_container_of.

Referenced by register_callbacks().

## ◆ fb_overlay_clut_yuv2rgb()

static void fb_overlay_clut_yuv2rgb | ( | fb_driver_t * | this,
|  | vo_overlay_t * | overlay,
|  | fb_frame_t * | frame )
| static

References clut_s::cb, vo_overlay_s::color, clut_s::cr, vo_overlay_s::hili_color, vo_overlay_s::hili_rgb_clut, vo_overlay_s::rgb_clut, clut_s::y, fb_frame_s::yuv2rgb, and yuv2rgb_s::yuv2rgb_single_pixel_fun.

Referenced by fb_overlay_blend().

## ◆ fb_redraw_needed()

static int fb_redraw_needed | ( | vo_driver_t * | this_gen | ) |
| static

Referenced by register_callbacks().

## ◆ fb_set_property()

static int fb_set_property | ( | vo_driver_t * | this_gen,
|  | int | property,
|  | int | value )
| static

References _x_vo_scale_aspect_ratio_name_table, CM_DEFAULT, NULL, VO_PROP_ASPECT_RATIO, VO_PROP_BRIGHTNESS, VO_PROP_CONTRAST, VO_PROP_DISCARD_FRAMES, VO_PROP_SATURATION, xine_container_of, XINE_VERBOSITY_DEBUG, XINE_VO_ASPECT_AUTO, XINE_VO_ASPECT_NUM_RATIOS, and xprintf.

Referenced by register_callbacks().

## ◆ fb_update_frame_format()

static void fb_update_frame_format | ( | vo_driver_t * | this_gen,
|  | vo_frame_t * | frame_gen,
|  | uint32_t | width,
|  | uint32_t | height,
|  | double | ratio,
|  | int | format,
|  | int | flags )
| static

References fb_frame_s::bytes_per_line, bytes_per_pixel, vo_scale_s::delivered_height, vo_scale_s::delivered_ratio, vo_scale_s::delivered_width, fb_compute_ideal_size(), fb_compute_rgb_size(), fb_frame_field(), fb_frame_s::flags, fb_frame_s::format, frame_reallocate(), height, lprintf, vo_scale_s::output_width, fb_frame_s::sc, setup_colorspace_converter(), vo_scale_s::user_ratio, VO_BOTH_FIELDS, width, and xine_container_of.

Referenced by register_callbacks().

## ◆ frame_reallocate()

static void frame_reallocate | ( | fb_driver_t * | this,
|  | fb_frame_t * | frame,
|  | uint32_t | width,
|  | uint32_t | height,
|  | int | format )
| static

References vo_frame_s::base, bytes_per_pixel, fb_frame_s::data, height, vo_scale_s::output_height, vo_scale_s::output_width, vo_scale_s::output_xoffset, vo_scale_s::output_yoffset, vo_frame_s::pitches, fb_frame_s::sc, fb_frame_s::video_mem, fb_frame_s::vo_frame, width, xine_freep_aligned, XINE_IMGFMT_YV12, and xine_mallocz_aligned().

Referenced by fb_update_frame_format().

## ◆ get_fb_fix_screeninfo()

static int get_fb_fix_screeninfo | ( | int | fd,
|  | struct fb_fix_screeninfo * | fix,
|  | xine_t * | xine )
| static

References _, XINE_VERBOSITY_DEBUG, XINE_VERBOSITY_LOG, and xprintf.

Referenced by fb_open_plugin().

## ◆ get_fb_var_screeninfo()

static int get_fb_var_screeninfo | ( | int | fd,
|  | struct fb_var_screeninfo * | var,
|  | xine_t * | xine )
| static

References MAXIMUM_NUM_BUFFERS, XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by fb_open_plugin().

## ◆ mode_visual()

static int mode_visual | ( | fb_driver_t * | this,
|  | config_values_t * | config,
|  | struct fb_var_screeninfo * | var,
|  | struct fb_fix_screeninfo * | fix )
| static

References _, LOG_MODULE, MODE_15_BGR, MODE_15_RGB, MODE_16_BGR, MODE_16_RGB, MODE_24_BGR, MODE_24_RGB, MODE_32_BGR, MODE_32_RGB, MODE_8_BGR, MODE_8_RGB, XINE_VERBOSITY_LOG, and xprintf.

Referenced by setup_yuv2rgb().

## ◆ open_fb_device()

static int open_fb_device | ( | config_values_t * | config,
|  | xine_t * | xine )
| static

References _, NULL, config_values_s::register_filename, config_values_s::update_string, XINE_CONFIG_SECURITY, XINE_CONFIG_STRING_IS_DEVICE_NAME, xine_open_cloexec(), XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by fb_open_plugin().

## ◆ register_callbacks()

static void register_callbacks | ( | fb_driver_t * | this | ) |
| static

References vo_frame_s::dispose, fb_alloc_frame(), fb_display_frame(), fb_dispose(), fb_get_capabilities(), fb_get_property(), fb_get_property_min_max(), fb_gui_data_exchange(), fb_overlay_blend(), fb_redraw_needed(), fb_set_property(), and fb_update_frame_format().

Referenced by fb_open_plugin().

## ◆ set_fb_palette()

static int set_fb_palette | ( | int | fd,
|  | const struct fb_var_screeninfo * | var )
| static

References NULL.

Referenced by fb_open_plugin().

## ◆ setup_buffers()

static void setup_buffers | ( | fb_driver_t * | this,
|  | struct fb_var_screeninfo * | var )
| static

References _, bytes_per_pixel, LOG_MODULE, RECOMMENDED_NUM_BUFFERS, XINE_VERBOSITY_DEBUG, XINE_VERBOSITY_LOG, and xprintf.

Referenced by fb_open_plugin().

## ◆ setup_colorspace_converter()

static void setup_colorspace_converter | ( | fb_frame_t * | frame,
|  | int | flags )
| static

References fb_frame_s::bytes_per_line, vo_scale_s::delivered_height, vo_scale_s::delivered_width, vo_scale_s::output_height, vo_scale_s::output_width, vo_frame_s::pitches, fb_frame_s::sc, VO_BOTH_FIELDS, VO_BOTTOM_FIELD, fb_frame_s::vo_frame, VO_TOP_FIELD, fb_frame_s::yuv2rgb, and fb_frame_s::yuv_stride.

Referenced by fb_update_frame_format().

## ◆ setup_yuv2rgb()

static int setup_yuv2rgb | ( | fb_driver_t * | this,
|  | config_values_t * | config,
|  | struct fb_var_screeninfo * | var,
|  | struct fb_fix_screeninfo * | fix )
| static

References CM_DEFAULT, mode_visual(), and yuv2rgb_factory_init().

Referenced by fb_open_plugin().

## Variable Documentation

## ◆ EXPORTED

const plugin_info_t xine_plugin_info [] EXPORTED

Initial value:
= {
{ PLUGIN_VIDEO_OUT, 22, "fb", XINE_VERSION_CODE, &vo_info_fb, fb_init_class },
{ PLUGIN_NONE, 0, NULL, 0, NULL, NULL }
}
fb_init_class
static void * fb_init_class(xine_t *xine, const void *visual_gen)
Definition video_out_fb.c:1085
vo_info_fb
static const vo_info_t vo_info_fb
Definition video_out_fb.c:1105
XINE_VERSION_CODE
#define XINE_VERSION_CODE
Definition xine_internal.h:57
NULL
NULL
Definition xine_plugin.c:78
PLUGIN_NONE
#define PLUGIN_NONE
Definition xine_plugin.h:29
PLUGIN_VIDEO_OUT
#define PLUGIN_VIDEO_OUT
Definition xine_plugin.h:36

## ◆ vo_info_fb

const vo_info_t vo_info_fb
| static

Initial value:
= {
.priority = 1,
.visual_type = XINE_VISUAL_TYPE_FB,
}
XINE_VISUAL_TYPE_FB
#define XINE_VISUAL_TYPE_FB
Definition xine.h:157