diff options
Diffstat (limited to 'libavdevice/bktr.c')
-rw-r--r-- | libavdevice/bktr.c | 34 |
1 files changed, 13 insertions, 21 deletions
diff --git a/libavdevice/bktr.c b/libavdevice/bktr.c index 8042c38..c8a8953 100644 --- a/libavdevice/bktr.c +++ b/libavdevice/bktr.c @@ -3,28 +3,27 @@ * Copyright (c) 2002 Steve O'Hara-Smith * based on * Linux video grab interface - * Copyright (c) 2000,2001 Gerard Lantau + * Copyright (c) 2000, 2001 Fabrice Bellard * and * simple_grab.c Copyright (c) 1999 Roger Hardiman * - * 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 */ -#include "libavformat/avformat.h" #include "libavformat/internal.h" #include "libavutil/internal.h" #include "libavutil/log.h" @@ -50,6 +49,7 @@ #include <sys/time.h> #include <signal.h> #include <stdint.h> +#include "avdevice.h" typedef struct VideoData { AVClass *class; @@ -58,7 +58,6 @@ typedef struct VideoData { int width, height; uint64_t per_frame; int standard; - char *video_size; /**< String describing video size, set by a private option. */ char *framerate; /**< Set by a private option. */ } VideoData; @@ -81,7 +80,7 @@ typedef struct VideoData { #define VIDEO_FORMAT NTSC #endif -static int bktr_dev[] = { METEOR_DEV0, METEOR_DEV1, METEOR_DEV2, +static const int bktr_dev[] = { METEOR_DEV0, METEOR_DEV1, METEOR_DEV2, METEOR_DEV3, METEOR_DEV_SVIDEO }; uint8_t *video_buf; @@ -104,7 +103,7 @@ static av_cold int bktr_init(const char *video_device, int width, int height, long ioctl_frequency; char *arg; int c; - struct sigaction act = { 0 }, old; + struct sigaction act = { {0} }, old; int ret; char errbuf[128]; @@ -260,15 +259,9 @@ static int grab_read_header(AVFormatContext *s1) { VideoData *s = s1->priv_data; AVStream *st; - int width, height; AVRational framerate; int ret = 0; - if ((ret = av_parse_video_size(&width, &height, s->video_size)) < 0) { - av_log(s1, AV_LOG_ERROR, "Could not parse video size '%s'.\n", s->video_size); - goto out; - } - if (!s->framerate) switch (s->standard) { case PAL: s->framerate = av_strdup("pal"); break; @@ -291,20 +284,18 @@ static int grab_read_header(AVFormatContext *s1) } avpriv_set_pts_info(st, 64, 1, 1000000); /* 64 bits pts in use */ - s->width = width; - s->height = height; s->per_frame = ((uint64_t)1000000 * framerate.den) / framerate.num; st->codec->codec_type = AVMEDIA_TYPE_VIDEO; st->codec->pix_fmt = AV_PIX_FMT_YUV420P; st->codec->codec_id = AV_CODEC_ID_RAWVIDEO; - st->codec->width = width; - st->codec->height = height; + st->codec->width = s->width; + st->codec->height = s->height; st->codec->time_base.den = framerate.num; st->codec->time_base.num = framerate.den; - if (bktr_init(s1->filename, width, height, s->standard, + if (bktr_init(s1->filename, s->width, s->height, s->standard, &s->video_fd, &s->tuner_fd, -1, 0.0) < 0) { ret = AVERROR(EIO); goto out; @@ -345,7 +336,7 @@ static const AVOption options[] = { { "PALN", "", 0, AV_OPT_TYPE_CONST, {.i64 = PALN}, 0, 0, AV_OPT_FLAG_DECODING_PARAM, "standard" }, { "PALM", "", 0, AV_OPT_TYPE_CONST, {.i64 = PALM}, 0, 0, AV_OPT_FLAG_DECODING_PARAM, "standard" }, { "NTSCJ", "", 0, AV_OPT_TYPE_CONST, {.i64 = NTSCJ}, 0, 0, AV_OPT_FLAG_DECODING_PARAM, "standard" }, - { "video_size", "A string describing frame size, such as 640x480 or hd720.", OFFSET(video_size), AV_OPT_TYPE_STRING, {.str = "vga"}, 0, 0, DEC }, + { "video_size", "A string describing frame size, such as 640x480 or hd720.", OFFSET(width), AV_OPT_TYPE_IMAGE_SIZE, {.str = "vga"}, 0, 0, DEC }, { "framerate", "", OFFSET(framerate), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC }, { NULL }, }; @@ -355,6 +346,7 @@ static const AVClass bktr_class = { .item_name = av_default_item_name, .option = options, .version = LIBAVUTIL_VERSION_INT, + .category = AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT, }; AVInputFormat ff_bktr_demuxer = { |