34 #include <sys/ioctl.h>
92 struct fb_var_screeninfo varinfo;
93 struct fb_fix_screeninfo fixinfo;
103 int ret,
flags = O_RDONLY;
119 if ((fbdev->
fd = open(avctx->
filename, flags)) == -1) {
122 "Could not open framebuffer device '%s': %s\n",
127 if (ioctl(fbdev->
fd, FBIOGET_VSCREENINFO, &fbdev->
varinfo) < 0) {
130 "FBIOGET_VSCREENINFO: %s\n", strerror(errno));
134 if (ioctl(fbdev->
fd, FBIOGET_FSCREENINFO, &fbdev->
fixinfo) < 0) {
137 "FBIOGET_FSCREENINFO: %s\n", strerror(errno));
145 "Framebuffer pixel format not supported.\n");
155 fbdev->
data = mmap(
NULL, fbdev->
fixinfo.smem_len, PROT_READ, MAP_SHARED, fbdev->
fd, 0);
156 if (fbdev->
data == MAP_FAILED) {
172 "w:%d h:%d bpp:%d pixfmt:%s fps:%d/%d bit_rate:%d\n",
187 int64_t curtime, delay;
199 "time_frame:%"PRId64
" curtime:%"PRId64
" delay:%"PRId64
"\n",
204 ts.tv_sec = delay / 1000000;
205 ts.tv_nsec = (delay % 1000000) * 1000;
206 while (nanosleep(&ts, &ts) < 0 && errno == EINTR);
215 if (ioctl(fbdev->
fd, FBIOGET_VSCREENINFO, &fbdev->
varinfo) < 0)
217 "Error refreshing variable info: %s\n", strerror(errno));
227 for (i = 0; i < fbdev->
height; i++) {
229 pin += fbdev->
fixinfo.line_length;
246 #define OFFSET(x) offsetof(FBDevContext, x)
247 #define DEC AV_OPT_FLAG_DECODING_PARAM
268 .priv_class = &fbdev_class,
int height
assumed frame resolution
int av_parse_video_rate(AVRational *rate, const char *arg)
Parse str and store the detected values in *rate.
char * framerate
framerate string set by a private option
packed RGB 8:8:8, 24bpp, RGBRGB...
memory handling functions
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
AVInputFormat ff_fbdev_demuxer
av_dlog(ac->avr,"%d samples - audio_convert: %s to %s (%s)\n", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt), use_generic?ac->func_descr_generic:ac->func_descr)
int frame_linesize
linesize of the output frame, it is assumed to be constant
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented...
int frame_size
size in bytes of a grabbed frame
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;
packed ABGR 8:8:8:8, 32bpp, ABGRABGR...
int64_t time_frame
time for the next frame to output (in 1/1000000 units)
static double av_q2d(AVRational a)
Convert rational to double.
static av_cold int read_close(AVFormatContext *ctx)
int av_new_packet(AVPacket *pkt, int size)
Allocate the payload of a packet and initialize its fields with default values.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
enum AVPixelFormat pixfmt
void av_log(void *avcl, int level, const char *fmt,...)
AVStream * avformat_new_stream(AVFormatContext *s, AVCodec *c)
Add a new stream to a media file.
packed ARGB 8:8:8:8, 32bpp, ARGBARGB...
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
struct fb_fix_screeninfo fixinfo
fixed info;
AVCodecContext * codec
Codec context associated with this stream.
struct AVRational AVRational
rational number numerator/denominator
int bit_rate
the average bitrate
char filename[1024]
input or output filename
int width
picture width / height.
packed RGB 8:8:8, 24bpp, BGRBGR...
enum AVPixelFormat pix_fmt
AVRational framerate_q
framerate
static int read_header(FFV1Context *f)
int64_t av_gettime(void)
Get the current time in microseconds.
enum AVMediaType codec_type
static av_cold int fbdev_read_header(AVFormatContext *avctx)
static int fbdev_read_packet(AVFormatContext *avctx, AVPacket *pkt)
static void close(AVCodecParserContext *s)
static int read_packet(AVFormatContext *ctx, AVPacket *pkt)
static av_cold int fbdev_read_close(AVFormatContext *avctx)
Describe the class of an AVClass context structure.
#define FF_ARRAY_ELEMS(a)
rational number numerator/denominator
uint8_t * data
framebuffer data
static enum AVPixelFormat get_pixfmt_from_fb_varinfo(struct fb_var_screeninfo *varinfo)
static struct rgb_pixfmt_map_entry rgb_pixfmt_map[]
void * priv_data
Format private data.
#define AVFMT_FLAG_NONBLOCK
static const AVClass fbdev_class
static const AVOption options[]
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.
int fd
framebuffer device file descriptor
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...