|
|
@@ -79,7 +79,7 @@ static enum PixelFormat get_pixfmt_from_fb_varinfo(struct fb_var_screeninfo *var |
|
|
|
typedef struct { |
|
|
|
AVClass *class; ///< class for private options |
|
|
|
int frame_size; ///< size in bytes of a grabbed frame |
|
|
|
AVRational fps; ///< framerate |
|
|
|
AVRational framerate_q; ///< framerate |
|
|
|
char *framerate; ///< framerate string set by a private option |
|
|
|
int64_t time_frame; ///< time for the next frame to output (in 1/1000000 units) |
|
|
|
|
|
|
@@ -102,14 +102,14 @@ av_cold static int fbdev_read_header(AVFormatContext *avctx, |
|
|
|
enum PixelFormat pix_fmt; |
|
|
|
int ret, flags = O_RDONLY; |
|
|
|
|
|
|
|
ret = av_parse_video_rate(&fbdev->fps, fbdev->framerate); |
|
|
|
ret = av_parse_video_rate(&fbdev->framerate_q, fbdev->framerate); |
|
|
|
if (ret < 0) { |
|
|
|
av_log(avctx, AV_LOG_ERROR, "Couldn't parse framerate.\n"); |
|
|
|
return ret; |
|
|
|
} |
|
|
|
#if FF_API_FORMAT_PARAMETERS |
|
|
|
if (ap->time_base.num) |
|
|
|
fbdev->fps = (AVRational){ap->time_base.den, ap->time_base.num}; |
|
|
|
fbdev->framerate_q = (AVRational){ap->time_base.den, ap->time_base.num}; |
|
|
|
#endif |
|
|
|
|
|
|
|
if (!(st = av_new_stream(avctx, 0))) |
|
|
@@ -168,15 +168,15 @@ av_cold static int fbdev_read_header(AVFormatContext *avctx, |
|
|
|
st->codec->width = fbdev->width; |
|
|
|
st->codec->height = fbdev->heigth; |
|
|
|
st->codec->pix_fmt = pix_fmt; |
|
|
|
st->codec->time_base = (AVRational){fbdev->fps.den, fbdev->fps.num}; |
|
|
|
st->codec->time_base = (AVRational){fbdev->framerate_q.den, fbdev->framerate_q.num}; |
|
|
|
st->codec->bit_rate = |
|
|
|
fbdev->width * fbdev->heigth * fbdev->bytes_per_pixel * av_q2d(fbdev->fps) * 8; |
|
|
|
fbdev->width * fbdev->heigth * fbdev->bytes_per_pixel * av_q2d(fbdev->framerate_q) * 8; |
|
|
|
|
|
|
|
av_log(avctx, AV_LOG_INFO, |
|
|
|
"w:%d h:%d bpp:%d pixfmt:%s fps:%d/%d bit_rate:%d\n", |
|
|
|
fbdev->width, fbdev->heigth, fbdev->varinfo.bits_per_pixel, |
|
|
|
av_pix_fmt_descriptors[pix_fmt].name, |
|
|
|
fbdev->fps.num, fbdev->fps.den, |
|
|
|
fbdev->framerate_q.num, fbdev->framerate_q.den, |
|
|
|
st->codec->bit_rate); |
|
|
|
return 0; |
|
|
|
|
|
|
@@ -210,7 +210,7 @@ static int fbdev_read_packet(AVFormatContext *avctx, AVPacket *pkt) |
|
|
|
while (nanosleep(&ts, &ts) < 0 && errno == EINTR); |
|
|
|
} |
|
|
|
/* compute the time of the next frame */ |
|
|
|
fbdev->time_frame += INT64_C(1000000) / av_q2d(fbdev->fps); |
|
|
|
fbdev->time_frame += INT64_C(1000000) / av_q2d(fbdev->framerate_q); |
|
|
|
|
|
|
|
if ((ret = av_new_packet(pkt, fbdev->frame_size)) < 0) |
|
|
|
return ret; |
|
|
|