23 #include <sys/ioctl.h>
37 struct fb_var_screeninfo varinfo;
38 struct fb_fix_screeninfo fixinfo;
63 "Could not open framebuffer device '%s': %s\n",
68 if (ioctl(fbdev->
fd, FBIOGET_VSCREENINFO, &fbdev->
varinfo) < 0) {
74 if (ioctl(fbdev->
fd, FBIOGET_FSCREENINFO, &fbdev->
fixinfo) < 0) {
87 fbdev->
data = mmap(NULL, fbdev->
fixinfo.smem_len, PROT_WRITE, MAP_SHARED, fbdev->
fd, 0);
88 if (fbdev->
data == MAP_FAILED) {
109 int video_width = codec_ctx->
width;
110 int video_height = codec_ctx->
height;
112 int src_line_size = video_width * bytes_per_pixel;
115 if (ioctl(fbdev->
fd, FBIOGET_VSCREENINFO, &fbdev->
varinfo) < 0)
121 if (fb_pix_fmt != video_pix_fmt) {
128 bytes_to_copy =
FFMIN(fbdev->
varinfo.xres, video_width) * bytes_per_pixel;
132 bytes_per_pixel * fbdev->
varinfo.xoffset +
137 if (-fbdev->
xoffset >= video_width)
139 bytes_to_copy += fbdev->
xoffset * bytes_per_pixel;
140 pin -= fbdev->
xoffset * bytes_per_pixel;
144 if (diff >= video_width)
146 bytes_to_copy -= diff * bytes_per_pixel;
148 pout += bytes_per_pixel * fbdev->
xoffset;
154 if (-fbdev->
yoffset >= video_height)
157 pin -= fbdev->
yoffset * src_line_size;
161 if (diff >= video_height)
169 for (i = 0; i < disp_height; i++) {
170 memcpy(pout, pin, bytes_to_copy);
171 pout += fbdev->
fixinfo.line_length;
172 pin += src_line_size;
186 #define OFFSET(x) offsetof(FBDevContext, x)
187 #define ENC AV_OPT_FLAG_ENCODING_PARAM
189 {
"xoffset",
"set x coordinate of top left corner",
OFFSET(xoffset),
AV_OPT_TYPE_INT, {.i64 = 0}, INT_MIN, INT_MAX,
ENC },
190 {
"yoffset",
"set y coordinate of top left corner",
OFFSET(yoffset),
AV_OPT_TYPE_INT, {.i64 = 0}, INT_MIN, INT_MAX,
ENC },
211 .priv_class = &fbdev_class,