diff options
Diffstat (limited to 'libavdevice/fbdev.c')
-rw-r--r-- | libavdevice/fbdev.c | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/libavdevice/fbdev.c b/libavdevice/fbdev.c index 099a486..20c2ab8 100644 --- a/libavdevice/fbdev.c +++ b/libavdevice/fbdev.c @@ -3,20 +3,20 @@ * Copyright (c) 2009 Giliard B. de Freitas <giliarde@gmail.com> * Copyright (C) 2002 Gunnar Monell <gmo@linux.nu> * - * This file is part of Libav. + * This file is part of FFmpeg. * - * Libav is free software; you can redistribute it and/or + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * - * Libav is distributed in the hope that it will be useful, + * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with Libav; if not, write to the Free Software + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -42,7 +42,7 @@ #include "libavutil/opt.h" #include "libavutil/parseutils.h" #include "libavutil/pixdesc.h" -#include "libavformat/avformat.h" +#include "avdevice.h" struct rgb_pixfmt_map_entry { int bits_per_pixel; @@ -193,20 +193,22 @@ static int fbdev_read_packet(AVFormatContext *avctx, AVPacket *pkt) fbdev->time_frame = av_gettime(); /* wait based on the frame rate */ - curtime = av_gettime(); - delay = fbdev->time_frame - curtime; - av_dlog(avctx, - "time_frame:%"PRId64" curtime:%"PRId64" delay:%"PRId64"\n", - fbdev->time_frame, curtime, delay); - if (delay > 0) { + while (1) { + curtime = av_gettime(); + delay = fbdev->time_frame - curtime; + av_dlog(avctx, + "time_frame:%"PRId64" curtime:%"PRId64" delay:%"PRId64"\n", + fbdev->time_frame, curtime, delay); + if (delay <= 0) { + fbdev->time_frame += INT64_C(1000000) / av_q2d(fbdev->framerate_q); + break; + } if (avctx->flags & AVFMT_FLAG_NONBLOCK) return AVERROR(EAGAIN); ts.tv_sec = delay / 1000000; ts.tv_nsec = (delay % 1000000) * 1000; while (nanosleep(&ts, &ts) < 0 && errno == EINTR); } - /* compute the time of the next frame */ - fbdev->time_frame += INT64_C(1000000) / av_q2d(fbdev->framerate_q); if ((ret = av_new_packet(pkt, fbdev->frame_size)) < 0) return ret; @@ -223,7 +225,6 @@ static int fbdev_read_packet(AVFormatContext *avctx, AVPacket *pkt) fbdev->varinfo.yoffset * fbdev->fixinfo.line_length; pout = pkt->data; - // TODO it'd be nice if the lines were aligned for (i = 0; i < fbdev->height; i++) { memcpy(pout, pin, fbdev->frame_linesize); pin += fbdev->fixinfo.line_length; |