39 struct fb_var_screeninfo
varinfo;
40 struct fb_fix_screeninfo
fixinfo;
49 int ret,
flags = O_RDWR;
65 "Could not open framebuffer device '%s': %s\n",
70 if (ioctl(fbdev->
fd, FBIOGET_VSCREENINFO, &fbdev->
varinfo) < 0) {
76 if (ioctl(fbdev->
fd, FBIOGET_FSCREENINFO, &fbdev->
fixinfo) < 0) {
89 fbdev->
data = mmap(
NULL, fbdev->
fixinfo.smem_len, PROT_WRITE, MAP_SHARED, fbdev->
fd, 0);
90 if (fbdev->
data == MAP_FAILED) {
112 int video_width = par->
width;
113 int video_height = par->
height;
115 int src_line_size = video_width * bytes_per_pixel;
118 if (ioctl(fbdev->
fd, FBIOGET_VSCREENINFO, &fbdev->
varinfo) < 0)
124 if (fb_pix_fmt != video_pix_fmt) {
131 bytes_to_copy =
FFMIN(fbdev->
varinfo.xres, video_width) * bytes_per_pixel;
135 bytes_per_pixel * fbdev->
varinfo.xoffset +
140 if (-fbdev->
xoffset >= video_width)
142 bytes_to_copy += fbdev->
xoffset * bytes_per_pixel;
143 pin -= fbdev->
xoffset * bytes_per_pixel;
147 if (
diff >= video_width)
149 bytes_to_copy -=
diff * bytes_per_pixel;
151 pout += bytes_per_pixel * fbdev->
xoffset;
157 if (-fbdev->
yoffset >= video_height)
160 pin -= fbdev->
yoffset * src_line_size;
164 if (
diff >= video_height)
172 for (
i = 0;
i < disp_height;
i++) {
173 memcpy(pout, pin, bytes_to_copy);
174 pout += fbdev->
fixinfo.line_length;
175 pin += src_line_size;
194#define OFFSET(x) offsetof(FBDevContext, x)
195#define ENC AV_OPT_FLAG_ENCODING_PARAM
197 {
"xoffset",
"set x coordinate of top left corner",
OFFSET(xoffset),
AV_OPT_TYPE_INT, {.i64 = 0}, INT_MIN, INT_MAX,
ENC },
198 {
"yoffset",
"set y coordinate of top left corner",
OFFSET(yoffset),
AV_OPT_TYPE_INT, {.i64 = 0}, INT_MIN, INT_MAX,
ENC },
203 .class_name =
"fbdev outdev",
const FFOutputFormat ff_fbdev_muxer
static av_cold void close(AVCodecParserContext *s)
Main libavdevice API header.
#define flags(name, subs,...)
#define i(width, name, range_min, range_max)
static enum AVPixelFormat pix_fmt
const char * ff_fbdev_default_device(void)
enum AVPixelFormat ff_get_pixfmt_from_fb_varinfo(struct fb_var_screeninfo *varinfo)
int ff_fbdev_get_device_list(AVDeviceInfoList *device_list)
static const AVClass fbdev_class
static int fbdev_get_device_list(AVFormatContext *s, AVDeviceInfoList *device_list)
static av_cold int fbdev_write_trailer(AVFormatContext *h)
static int fbdev_write_packet(AVFormatContext *h, AVPacket *pkt)
static int fbdev_get_device_list(AVFormatContext *s, AVDeviceInfoList *device_list)
static av_cold int fbdev_write_header(AVFormatContext *h)
@ AV_OPT_TYPE_INT
Underlying C type is int.
#define av_err2str(errnum)
Convenience macro, the return value should be used only directly in function arguments but never stan...
#define AV_LOG_WARNING
Something somehow does not look correct.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
const char * av_default_item_name(void *ptr)
Return the context name.
#define LIBAVUTIL_VERSION_INT
int avpriv_open(const char *filename, int flags,...)
A wrapper for open() setting O_CLOEXEC.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
@ AV_CLASS_CATEGORY_DEVICE_VIDEO_OUTPUT
const char * av_get_pix_fmt_name(enum AVPixelFormat pix_fmt)
Return the short name for a pixel format, NULL in case pix_fmt is unknown.
AVPixelFormat
Pixel format.
Describe the class of an AVClass context structure.
This struct describes the properties of an encoded stream.
int height
The height of the video frame in pixels.
int bits_per_coded_sample
The number of bits per sample in the codedwords.
int width
The width of the video frame in pixels.
This structure stores compressed data.
int yoffset
y coordinate of top left corner
int fd
framebuffer device file descriptor
int xoffset
x coordinate of top left corner
struct fb_fix_screeninfo fixinfo
fixed info;
struct fb_var_screeninfo varinfo
variable info;
uint8_t * data
framebuffer data
static av_always_inline int diff(const struct color_info *a, const struct color_info *b, const int trans_thresh)