23 #include <sys/ioctl.h>
38 struct fb_var_screeninfo varinfo;
39 struct fb_fix_screeninfo fixinfo;
48 int ret,
flags = O_RDWR;
64 "Could not open framebuffer device '%s': %s\n",
69 if (ioctl(fbdev->
fd, FBIOGET_VSCREENINFO, &fbdev->
varinfo) < 0) {
75 if (ioctl(fbdev->
fd, FBIOGET_FSCREENINFO, &fbdev->
fixinfo) < 0) {
88 fbdev->
data = mmap(
NULL, fbdev->
fixinfo.smem_len, PROT_WRITE, MAP_SHARED, fbdev->
fd, 0);
89 if (fbdev->
data == MAP_FAILED) {
110 int video_width = codec_ctx->
width;
111 int video_height = codec_ctx->
height;
113 int src_line_size = video_width * bytes_per_pixel;
116 if (ioctl(fbdev->
fd, FBIOGET_VSCREENINFO, &fbdev->
varinfo) < 0)
122 if (fb_pix_fmt != video_pix_fmt) {
129 bytes_to_copy =
FFMIN(fbdev->
varinfo.xres, video_width) * bytes_per_pixel;
133 bytes_per_pixel * fbdev->
varinfo.xoffset +
138 if (-fbdev->
xoffset >= video_width)
140 bytes_to_copy += fbdev->
xoffset * bytes_per_pixel;
141 pin -= fbdev->
xoffset * bytes_per_pixel;
145 if (diff >= video_width)
147 bytes_to_copy -= diff * bytes_per_pixel;
149 pout += bytes_per_pixel * fbdev->
xoffset;
155 if (-fbdev->
yoffset >= video_height)
158 pin -= fbdev->
yoffset * src_line_size;
162 if (diff >= video_height)
170 for (i = 0; i < disp_height; i++) {
171 memcpy(pout, pin, bytes_to_copy);
172 pout += fbdev->
fixinfo.line_length;
173 pin += src_line_size;
192 #define OFFSET(x) offsetof(FBDevContext, x)
193 #define ENC AV_OPT_FLAG_ENCODING_PARAM
195 {
"xoffset",
"set x coordinate of top left corner",
OFFSET(xoffset),
AV_OPT_TYPE_INT, {.i64 = 0}, INT_MIN, INT_MAX,
ENC },
196 {
"yoffset",
"set y coordinate of top left corner",
OFFSET(yoffset),
AV_OPT_TYPE_INT, {.i64 = 0}, INT_MIN, INT_MAX,
ENC },
219 .priv_class = &fbdev_class,
static enum AVPixelFormat pix_fmt
ptrdiff_t const GLvoid * data
#define AV_LOG_WARNING
Something somehow does not look correct.
#define LIBAVUTIL_VERSION_INT
memory handling functions
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
const char * ff_fbdev_default_device()
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
struct fb_var_screeninfo varinfo
variable info;
AVStream ** streams
A list of all streams in the file.
int avpriv_open(const char *filename, int flags,...)
A wrapper for open() setting O_CLOEXEC.
int bits_per_coded_sample
bits per sample/pixel from the demuxer (needed for huffyuv).
AVOutputFormat ff_fbdev_muxer
Main libavdevice API header.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
static const AVOption options[]
struct fb_fix_screeninfo fixinfo
fixed info;
AVCodecContext * codec
Codec context associated with this stream.
unsigned int nb_streams
Number of elements in AVFormatContext.streams.
char filename[1024]
input or output filename
int yoffset
y coordinate of top left corner
int width
picture width / height.
static int write_trailer(AVFormatContext *s1)
static av_cold int fbdev_write_header(AVFormatContext *h)
#define av_err2str(errnum)
Convenience macro, the return value should be used only directly in function arguments but never stan...
int xoffset
x coordinate of top left corner
static av_cold int fbdev_write_trailer(AVFormatContext *h)
enum AVMediaType codec_type
main external API structure.
int ff_fbdev_get_device_list(AVDeviceInfoList *device_list)
Describe the class of an AVClass context structure.
static int fbdev_get_device_list(AVFormatContext *s, AVDeviceInfoList *device_list)
static int fbdev_write_packet(AVFormatContext *h, AVPacket *pkt)
static int get_device_list(AVOpenCLDeviceList *device_list)
enum AVPixelFormat ff_get_pixfmt_from_fb_varinfo(struct fb_var_screeninfo *varinfo)
static av_always_inline int diff(const uint32_t a, const uint32_t b)
void * priv_data
Format private data.
static const AVClass fbdev_class
static void write_header(FFV1Context *f)
uint8_t * data
framebuffer data
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.
This structure stores compressed data.
static int write_packet(AVFormatContext *s1, AVPacket *pkt)
int fd
framebuffer device file descriptor