23 #include <sys/ioctl.h>
37 struct fb_var_screeninfo varinfo;
38 struct fb_fix_screeninfo fixinfo;
57 "Could not open framebuffer device '%s': %s\n",
62 if (ioctl(fbdev->
fd, FBIOGET_VSCREENINFO, &fbdev->
varinfo) < 0) {
68 if (ioctl(fbdev->
fd, FBIOGET_FSCREENINFO, &fbdev->
fixinfo) < 0) {
81 fbdev->
data = mmap(NULL, fbdev->
fixinfo.smem_len, PROT_WRITE, MAP_SHARED, fbdev->
fd, 0);
82 if (fbdev->
data == MAP_FAILED) {
103 int video_width = codec_ctx->
width;
104 int video_height = codec_ctx->
height;
106 int src_line_size = video_width * bytes_per_pixel;
109 if (ioctl(fbdev->
fd, FBIOGET_VSCREENINFO, &fbdev->
varinfo) < 0)
115 if (fb_pix_fmt != video_pix_fmt) {
122 bytes_to_copy =
FFMIN(fbdev->
varinfo.xres, video_width) * bytes_per_pixel;
126 bytes_per_pixel * fbdev->
varinfo.xoffset +
131 if (-fbdev->
xoffset >= video_width)
133 bytes_to_copy += fbdev->
xoffset * bytes_per_pixel;
134 pin -= fbdev->
xoffset * bytes_per_pixel;
138 if (diff >= video_width)
140 bytes_to_copy -= diff * bytes_per_pixel;
142 pout += bytes_per_pixel * fbdev->
xoffset;
148 if (-fbdev->
yoffset >= video_height)
151 pin -= fbdev->
yoffset * src_line_size;
155 if (diff >= video_height)
163 for (i = 0; i < disp_height; i++) {
164 memcpy(pout, pin, bytes_to_copy);
165 pout += fbdev->
fixinfo.line_length;
166 pin += src_line_size;
180 #define OFFSET(x) offsetof(FBDevContext, x)
181 #define ENC AV_OPT_FLAG_ENCODING_PARAM
183 {
"xoffset",
"set x coordinate of top left corner",
OFFSET(xoffset),
AV_OPT_TYPE_INT, {.i64 = 0}, INT_MIN, INT_MAX,
ENC },
184 {
"yoffset",
"set y coordinate of top left corner",
OFFSET(yoffset),
AV_OPT_TYPE_INT, {.i64 = 0}, INT_MIN, INT_MAX,
ENC },
205 .priv_class = &fbdev_class,