2005-06-25 09:04:08 +00:00
|
|
|
/*
|
|
|
|
* *BSD video grab interface
|
|
|
|
* Copyright (c) 2002 Steve O'Hara-Smith
|
|
|
|
* based on
|
|
|
|
* Linux video grab interface
|
2014-08-26 23:13:52 +00:00
|
|
|
* Copyright (c) 2000, 2001 Fabrice Bellard
|
2005-06-25 09:04:08 +00:00
|
|
|
* and
|
|
|
|
* simple_grab.c Copyright (c) 1999 Roger Hardiman
|
|
|
|
*
|
2006-10-07 15:30:46 +00:00
|
|
|
* This file is part of FFmpeg.
|
|
|
|
*
|
|
|
|
* FFmpeg is free software; you can redistribute it and/or
|
2005-06-25 09:04:08 +00:00
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
2006-10-07 15:30:46 +00:00
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
2005-06-25 09:04:08 +00:00
|
|
|
*
|
2006-10-07 15:30:46 +00:00
|
|
|
* FFmpeg is distributed in the hope that it will be useful,
|
2005-06-25 09:04:08 +00:00
|
|
|
* 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
|
2006-10-07 15:30:46 +00:00
|
|
|
* License along with FFmpeg; if not, write to the Free Software
|
2006-01-12 22:43:26 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
2005-06-25 09:04:08 +00:00
|
|
|
*/
|
2008-05-09 11:56:36 +00:00
|
|
|
|
2011-11-29 18:28:15 +00:00
|
|
|
#include "libavformat/internal.h"
|
2013-08-06 18:19:27 +00:00
|
|
|
#include "libavutil/internal.h"
|
2011-05-23 18:45:36 +00:00
|
|
|
#include "libavutil/log.h"
|
|
|
|
#include "libavutil/opt.h"
|
2011-05-24 05:43:01 +00:00
|
|
|
#include "libavutil/parseutils.h"
|
2013-03-13 10:48:09 +00:00
|
|
|
#include "libavutil/time.h"
|
2009-01-13 23:44:16 +00:00
|
|
|
#if HAVE_DEV_BKTR_IOCTL_METEOR_H && HAVE_DEV_BKTR_IOCTL_BT848_H
|
2006-06-10 12:30:51 +00:00
|
|
|
# include <dev/bktr/ioctl_meteor.h>
|
|
|
|
# include <dev/bktr/ioctl_bt848.h>
|
2009-01-13 23:44:16 +00:00
|
|
|
#elif HAVE_MACHINE_IOCTL_METEOR_H && HAVE_MACHINE_IOCTL_BT848_H
|
2006-12-24 03:53:15 +00:00
|
|
|
# include <machine/ioctl_meteor.h>
|
|
|
|
# include <machine/ioctl_bt848.h>
|
2009-09-22 14:44:44 +00:00
|
|
|
#elif HAVE_DEV_VIDEO_METEOR_IOCTL_METEOR_H && HAVE_DEV_VIDEO_BKTR_IOCTL_BT848_H
|
2005-06-25 09:04:08 +00:00
|
|
|
# include <dev/video/meteor/ioctl_meteor.h>
|
|
|
|
# include <dev/video/bktr/ioctl_bt848.h>
|
2006-12-24 03:53:15 +00:00
|
|
|
#elif HAVE_DEV_IC_BT8XX_H
|
2005-06-25 09:04:08 +00:00
|
|
|
# include <dev/ic/bt8xx.h>
|
|
|
|
#endif
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <fcntl.h>
|
|
|
|
#include <sys/ioctl.h>
|
|
|
|
#include <sys/mman.h>
|
|
|
|
#include <sys/time.h>
|
|
|
|
#include <signal.h>
|
2010-03-12 17:29:19 +00:00
|
|
|
#include <stdint.h>
|
2011-05-26 17:11:25 +00:00
|
|
|
#include "avdevice.h"
|
2005-06-25 09:04:08 +00:00
|
|
|
|
2014-07-17 15:51:27 +00:00
|
|
|
typedef struct VideoData {
|
2011-05-23 18:45:36 +00:00
|
|
|
AVClass *class;
|
2005-06-25 09:04:08 +00:00
|
|
|
int video_fd;
|
|
|
|
int tuner_fd;
|
|
|
|
int width, height;
|
2010-03-12 17:29:19 +00:00
|
|
|
uint64_t per_frame;
|
2011-05-23 18:45:36 +00:00
|
|
|
int standard;
|
2011-05-24 19:16:47 +00:00
|
|
|
char *framerate; /**< Set by a private option. */
|
2005-06-25 09:04:08 +00:00
|
|
|
} VideoData;
|
|
|
|
|
|
|
|
|
|
|
|
#define PAL 1
|
|
|
|
#define PALBDGHI 1
|
|
|
|
#define NTSC 2
|
|
|
|
#define NTSCM 2
|
|
|
|
#define SECAM 3
|
|
|
|
#define PALN 4
|
|
|
|
#define PALM 5
|
|
|
|
#define NTSCJ 6
|
|
|
|
|
|
|
|
/* PAL is 768 x 576. NTSC is 640 x 480 */
|
|
|
|
#define PAL_HEIGHT 576
|
|
|
|
#define SECAM_HEIGHT 576
|
|
|
|
#define NTSC_HEIGHT 480
|
|
|
|
|
|
|
|
#ifndef VIDEO_FORMAT
|
|
|
|
#define VIDEO_FORMAT NTSC
|
|
|
|
#endif
|
|
|
|
|
2014-08-28 22:32:32 +00:00
|
|
|
static const int bktr_dev[] = { METEOR_DEV0, METEOR_DEV1, METEOR_DEV2,
|
2005-06-25 09:04:08 +00:00
|
|
|
METEOR_DEV3, METEOR_DEV_SVIDEO };
|
|
|
|
|
|
|
|
uint8_t *video_buf;
|
|
|
|
size_t video_buf_size;
|
2010-03-12 17:29:19 +00:00
|
|
|
uint64_t last_frame_time;
|
2005-06-25 09:04:08 +00:00
|
|
|
volatile sig_atomic_t nsignals;
|
|
|
|
|
|
|
|
|
|
|
|
static void catchsignal(int signal)
|
|
|
|
{
|
|
|
|
nsignals++;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2010-03-12 17:29:19 +00:00
|
|
|
static av_cold int bktr_init(const char *video_device, int width, int height,
|
2005-06-25 09:04:08 +00:00
|
|
|
int format, int *video_fd, int *tuner_fd, int idev, double frequency)
|
|
|
|
{
|
|
|
|
struct meteor_geomet geo;
|
|
|
|
int h_max;
|
|
|
|
long ioctl_frequency;
|
|
|
|
char *arg;
|
|
|
|
int c;
|
2016-10-21 12:17:07 +00:00
|
|
|
struct sigaction act, old;
|
2015-02-10 14:06:51 +00:00
|
|
|
int ret;
|
|
|
|
char errbuf[128];
|
2005-06-25 09:04:08 +00:00
|
|
|
|
|
|
|
if (idev < 0 || idev > 4)
|
|
|
|
{
|
|
|
|
arg = getenv ("BKTR_DEV");
|
|
|
|
if (arg)
|
|
|
|
idev = atoi (arg);
|
|
|
|
if (idev < 0 || idev > 4)
|
|
|
|
idev = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (format < 1 || format > 6)
|
|
|
|
{
|
|
|
|
arg = getenv ("BKTR_FORMAT");
|
|
|
|
if (arg)
|
|
|
|
format = atoi (arg);
|
|
|
|
if (format < 1 || format > 6)
|
|
|
|
format = VIDEO_FORMAT;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (frequency <= 0)
|
|
|
|
{
|
|
|
|
arg = getenv ("BKTR_FREQUENCY");
|
|
|
|
if (arg)
|
|
|
|
frequency = atof (arg);
|
|
|
|
if (frequency <= 0)
|
|
|
|
frequency = 0.0;
|
|
|
|
}
|
|
|
|
|
2016-10-21 12:17:07 +00:00
|
|
|
memset(&act, 0, sizeof(act));
|
2005-06-25 09:04:08 +00:00
|
|
|
sigemptyset(&act.sa_mask);
|
|
|
|
act.sa_handler = catchsignal;
|
|
|
|
sigaction(SIGUSR1, &act, &old);
|
|
|
|
|
2013-08-06 18:19:27 +00:00
|
|
|
*tuner_fd = avpriv_open("/dev/tuner0", O_RDONLY);
|
2005-06-25 09:04:08 +00:00
|
|
|
if (*tuner_fd < 0)
|
2007-11-19 10:33:05 +00:00
|
|
|
av_log(NULL, AV_LOG_ERROR, "Warning. Tuner not opened, continuing: %s\n", strerror(errno));
|
2005-06-25 09:04:08 +00:00
|
|
|
|
2013-08-09 07:16:57 +00:00
|
|
|
*video_fd = avpriv_open(video_device, O_RDONLY);
|
2005-06-25 09:04:08 +00:00
|
|
|
if (*video_fd < 0) {
|
2015-02-10 14:06:51 +00:00
|
|
|
ret = AVERROR(errno);
|
|
|
|
av_strerror(ret, errbuf, sizeof(errbuf));
|
|
|
|
av_log(NULL, AV_LOG_ERROR, "%s: %s\n", video_device, errbuf);
|
|
|
|
return ret;
|
2005-06-25 09:04:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
geo.rows = height;
|
|
|
|
geo.columns = width;
|
|
|
|
geo.frames = 1;
|
|
|
|
geo.oformat = METEOR_GEO_YUV_422 | METEOR_GEO_YUV_12;
|
|
|
|
|
|
|
|
switch (format) {
|
|
|
|
case PAL: h_max = PAL_HEIGHT; c = BT848_IFORM_F_PALBDGHI; break;
|
|
|
|
case PALN: h_max = PAL_HEIGHT; c = BT848_IFORM_F_PALN; break;
|
|
|
|
case PALM: h_max = PAL_HEIGHT; c = BT848_IFORM_F_PALM; break;
|
|
|
|
case SECAM: h_max = SECAM_HEIGHT; c = BT848_IFORM_F_SECAM; break;
|
|
|
|
case NTSC: h_max = NTSC_HEIGHT; c = BT848_IFORM_F_NTSCM; break;
|
|
|
|
case NTSCJ: h_max = NTSC_HEIGHT; c = BT848_IFORM_F_NTSCJ; break;
|
|
|
|
default: h_max = PAL_HEIGHT; c = BT848_IFORM_F_PALBDGHI; break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (height <= h_max / 2)
|
|
|
|
geo.oformat |= METEOR_GEO_EVEN_ONLY;
|
|
|
|
|
|
|
|
if (ioctl(*video_fd, METEORSETGEO, &geo) < 0) {
|
2015-02-10 14:06:51 +00:00
|
|
|
ret = AVERROR(errno);
|
|
|
|
av_strerror(ret, errbuf, sizeof(errbuf));
|
|
|
|
av_log(NULL, AV_LOG_ERROR, "METEORSETGEO: %s\n", errbuf);
|
|
|
|
return ret;
|
2005-06-25 09:04:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (ioctl(*video_fd, BT848SFMT, &c) < 0) {
|
2015-02-10 14:06:51 +00:00
|
|
|
ret = AVERROR(errno);
|
|
|
|
av_strerror(ret, errbuf, sizeof(errbuf));
|
|
|
|
av_log(NULL, AV_LOG_ERROR, "BT848SFMT: %s\n", errbuf);
|
|
|
|
return ret;
|
2005-06-25 09:04:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
c = bktr_dev[idev];
|
|
|
|
if (ioctl(*video_fd, METEORSINPUT, &c) < 0) {
|
2015-02-10 14:06:51 +00:00
|
|
|
ret = AVERROR(errno);
|
|
|
|
av_strerror(ret, errbuf, sizeof(errbuf));
|
|
|
|
av_log(NULL, AV_LOG_ERROR, "METEORSINPUT: %s\n", errbuf);
|
|
|
|
return ret;
|
2005-06-25 09:04:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
video_buf_size = width * height * 12 / 8;
|
|
|
|
|
2005-12-17 18:14:38 +00:00
|
|
|
video_buf = (uint8_t *)mmap((caddr_t)0, video_buf_size,
|
2005-06-25 09:04:08 +00:00
|
|
|
PROT_READ, MAP_SHARED, *video_fd, (off_t)0);
|
|
|
|
if (video_buf == MAP_FAILED) {
|
2015-02-10 14:06:51 +00:00
|
|
|
ret = AVERROR(errno);
|
|
|
|
av_strerror(ret, errbuf, sizeof(errbuf));
|
|
|
|
av_log(NULL, AV_LOG_ERROR, "mmap: %s\n", errbuf);
|
|
|
|
return ret;
|
2005-06-25 09:04:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (frequency != 0.0) {
|
2005-12-17 18:14:38 +00:00
|
|
|
ioctl_frequency = (unsigned long)(frequency*16);
|
2005-06-25 09:04:08 +00:00
|
|
|
if (ioctl(*tuner_fd, TVTUNER_SETFREQ, &ioctl_frequency) < 0)
|
2007-11-19 10:33:05 +00:00
|
|
|
av_log(NULL, AV_LOG_ERROR, "TVTUNER_SETFREQ: %s\n", strerror(errno));
|
2005-06-25 09:04:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
c = AUDIO_UNMUTE;
|
|
|
|
if (ioctl(*tuner_fd, BT848_SAUDIO, &c) < 0)
|
2007-11-19 10:33:05 +00:00
|
|
|
av_log(NULL, AV_LOG_ERROR, "TVTUNER_SAUDIO: %s\n", strerror(errno));
|
2005-06-25 09:04:08 +00:00
|
|
|
|
|
|
|
c = METEOR_CAP_CONTINOUS;
|
|
|
|
ioctl(*video_fd, METEORCAPTUR, &c);
|
|
|
|
|
|
|
|
c = SIGUSR1;
|
|
|
|
ioctl(*video_fd, METEORSSIGNAL, &c);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-03-12 17:29:19 +00:00
|
|
|
static void bktr_getframe(uint64_t per_frame)
|
2005-06-25 09:04:08 +00:00
|
|
|
{
|
2010-03-12 17:29:19 +00:00
|
|
|
uint64_t curtime;
|
2005-06-25 09:04:08 +00:00
|
|
|
|
|
|
|
curtime = av_gettime();
|
|
|
|
if (!last_frame_time
|
|
|
|
|| ((last_frame_time + per_frame) > curtime)) {
|
|
|
|
if (!usleep(last_frame_time + per_frame + per_frame / 8 - curtime)) {
|
|
|
|
if (!nsignals)
|
|
|
|
av_log(NULL, AV_LOG_INFO,
|
|
|
|
"SLEPT NO signals - %d microseconds late\n",
|
|
|
|
(int)(av_gettime() - last_frame_time - per_frame));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
nsignals = 0;
|
|
|
|
last_frame_time = curtime;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* note: we support only one picture read at a time */
|
|
|
|
static int grab_read_packet(AVFormatContext *s1, AVPacket *pkt)
|
|
|
|
{
|
|
|
|
VideoData *s = s1->priv_data;
|
|
|
|
|
|
|
|
if (av_new_packet(pkt, video_buf_size) < 0)
|
2007-02-13 18:26:14 +00:00
|
|
|
return AVERROR(EIO);
|
2005-06-25 09:04:08 +00:00
|
|
|
|
|
|
|
bktr_getframe(s->per_frame);
|
|
|
|
|
2006-02-01 11:31:33 +00:00
|
|
|
pkt->pts = av_gettime();
|
2005-06-25 09:04:08 +00:00
|
|
|
memcpy(pkt->data, video_buf, video_buf_size);
|
|
|
|
|
|
|
|
return video_buf_size;
|
|
|
|
}
|
|
|
|
|
2012-01-12 12:20:36 +00:00
|
|
|
static int grab_read_header(AVFormatContext *s1)
|
2005-06-25 09:04:08 +00:00
|
|
|
{
|
|
|
|
VideoData *s = s1->priv_data;
|
|
|
|
AVStream *st;
|
2011-06-03 08:54:10 +00:00
|
|
|
AVRational framerate;
|
2011-05-26 18:14:53 +00:00
|
|
|
int ret = 0;
|
2005-06-25 09:04:08 +00:00
|
|
|
|
2011-06-03 05:36:14 +00:00
|
|
|
if (!s->framerate)
|
|
|
|
switch (s->standard) {
|
|
|
|
case PAL: s->framerate = av_strdup("pal"); break;
|
|
|
|
case NTSC: s->framerate = av_strdup("ntsc"); break;
|
|
|
|
case SECAM: s->framerate = av_strdup("25"); break;
|
|
|
|
default:
|
|
|
|
av_log(s1, AV_LOG_ERROR, "Unknown standard.\n");
|
|
|
|
ret = AVERROR(EINVAL);
|
|
|
|
goto out;
|
|
|
|
}
|
2011-06-03 08:54:10 +00:00
|
|
|
if ((ret = av_parse_video_rate(&framerate, s->framerate)) < 0) {
|
2011-06-03 08:50:28 +00:00
|
|
|
av_log(s1, AV_LOG_ERROR, "Could not parse framerate '%s'.\n", s->framerate);
|
2011-05-24 19:16:47 +00:00
|
|
|
goto out;
|
|
|
|
}
|
2005-06-25 09:04:08 +00:00
|
|
|
|
2011-06-18 09:43:24 +00:00
|
|
|
st = avformat_new_stream(s1, NULL);
|
2011-05-26 18:14:53 +00:00
|
|
|
if (!st) {
|
|
|
|
ret = AVERROR(ENOMEM);
|
|
|
|
goto out;
|
|
|
|
}
|
2011-11-29 18:28:15 +00:00
|
|
|
avpriv_set_pts_info(st, 64, 1, 1000000); /* 64 bits pts in use */
|
2005-06-25 09:04:08 +00:00
|
|
|
|
2011-06-03 08:54:10 +00:00
|
|
|
s->per_frame = ((uint64_t)1000000 * framerate.den) / framerate.num;
|
2005-06-25 09:04:08 +00:00
|
|
|
|
lavf: replace AVStream.codec with AVStream.codecpar
Currently, AVStream contains an embedded AVCodecContext instance, which
is used by demuxers to export stream parameters to the caller and by
muxers to receive stream parameters from the caller. It is also used
internally as the codec context that is passed to parsers.
In addition, it is also widely used by the callers as the decoding (when
demuxer) or encoding (when muxing) context, though this has been
officially discouraged since Libav 11.
There are multiple important problems with this approach:
- the fields in AVCodecContext are in general one of
* stream parameters
* codec options
* codec state
However, it's not clear which ones are which. It is consequently
unclear which fields are a demuxer allowed to set or a muxer allowed to
read. This leads to erratic behaviour depending on whether decoding or
encoding is being performed or not (and whether it uses the AVStream
embedded codec context).
- various synchronization issues arising from the fact that the same
context is used by several different APIs (muxers/demuxers,
parsers, bitstream filters and encoders/decoders) simultaneously, with
there being no clear rules for who can modify what and the different
processes being typically delayed with respect to each other.
- avformat_find_stream_info() making it necessary to support opening
and closing a single codec context multiple times, thus
complicating the semantics of freeing various allocated objects in the
codec context.
Those problems are resolved by replacing the AVStream embedded codec
context with a newly added AVCodecParameters instance, which stores only
the stream parameters exported by the demuxers or read by the muxers.
2014-06-18 18:42:52 +00:00
|
|
|
st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO;
|
|
|
|
st->codecpar->format = AV_PIX_FMT_YUV420P;
|
|
|
|
st->codecpar->codec_id = AV_CODEC_ID_RAWVIDEO;
|
2016-04-10 19:58:15 +00:00
|
|
|
st->codecpar->width = s->width;
|
|
|
|
st->codecpar->height = s->height;
|
lavf: replace AVStream.codec with AVStream.codecpar
Currently, AVStream contains an embedded AVCodecContext instance, which
is used by demuxers to export stream parameters to the caller and by
muxers to receive stream parameters from the caller. It is also used
internally as the codec context that is passed to parsers.
In addition, it is also widely used by the callers as the decoding (when
demuxer) or encoding (when muxing) context, though this has been
officially discouraged since Libav 11.
There are multiple important problems with this approach:
- the fields in AVCodecContext are in general one of
* stream parameters
* codec options
* codec state
However, it's not clear which ones are which. It is consequently
unclear which fields are a demuxer allowed to set or a muxer allowed to
read. This leads to erratic behaviour depending on whether decoding or
encoding is being performed or not (and whether it uses the AVStream
embedded codec context).
- various synchronization issues arising from the fact that the same
context is used by several different APIs (muxers/demuxers,
parsers, bitstream filters and encoders/decoders) simultaneously, with
there being no clear rules for who can modify what and the different
processes being typically delayed with respect to each other.
- avformat_find_stream_info() making it necessary to support opening
and closing a single codec context multiple times, thus
complicating the semantics of freeing various allocated objects in the
codec context.
Those problems are resolved by replacing the AVStream embedded codec
context with a newly added AVCodecParameters instance, which stores only
the stream parameters exported by the demuxers or read by the muxers.
2014-06-18 18:42:52 +00:00
|
|
|
st->avg_frame_rate = framerate;
|
2005-06-25 09:04:08 +00:00
|
|
|
|
2017-12-29 22:29:52 +00:00
|
|
|
if (bktr_init(s1->url, s->width, s->height, s->standard,
|
2012-01-07 18:07:42 +00:00
|
|
|
&s->video_fd, &s->tuner_fd, -1, 0.0) < 0) {
|
2011-05-26 18:14:53 +00:00
|
|
|
ret = AVERROR(EIO);
|
|
|
|
goto out;
|
|
|
|
}
|
2005-06-25 09:04:08 +00:00
|
|
|
|
|
|
|
nsignals = 0;
|
|
|
|
last_frame_time = 0;
|
|
|
|
|
2011-05-26 18:14:53 +00:00
|
|
|
out:
|
|
|
|
return ret;
|
2005-06-25 09:04:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int grab_read_close(AVFormatContext *s1)
|
|
|
|
{
|
|
|
|
VideoData *s = s1->priv_data;
|
|
|
|
int c;
|
|
|
|
|
|
|
|
c = METEOR_CAP_STOP_CONT;
|
|
|
|
ioctl(s->video_fd, METEORCAPTUR, &c);
|
|
|
|
close(s->video_fd);
|
|
|
|
|
|
|
|
c = AUDIO_MUTE;
|
|
|
|
ioctl(s->tuner_fd, BT848_SAUDIO, &c);
|
|
|
|
close(s->tuner_fd);
|
|
|
|
|
|
|
|
munmap((caddr_t)video_buf, video_buf_size);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2011-05-24 05:43:01 +00:00
|
|
|
#define OFFSET(x) offsetof(VideoData, x)
|
|
|
|
#define DEC AV_OPT_FLAG_DECODING_PARAM
|
2011-05-23 18:45:36 +00:00
|
|
|
static const AVOption options[] = {
|
2012-08-31 10:22:31 +00:00
|
|
|
{ "standard", "", offsetof(VideoData, standard), AV_OPT_TYPE_INT, {.i64 = VIDEO_FORMAT}, PAL, NTSCJ, AV_OPT_FLAG_DECODING_PARAM, "standard" },
|
2012-08-31 09:45:52 +00:00
|
|
|
{ "PAL", "", 0, AV_OPT_TYPE_CONST, {.i64 = PAL}, 0, 0, AV_OPT_FLAG_DECODING_PARAM, "standard" },
|
|
|
|
{ "NTSC", "", 0, AV_OPT_TYPE_CONST, {.i64 = NTSC}, 0, 0, AV_OPT_FLAG_DECODING_PARAM, "standard" },
|
|
|
|
{ "SECAM", "", 0, AV_OPT_TYPE_CONST, {.i64 = SECAM}, 0, 0, AV_OPT_FLAG_DECODING_PARAM, "standard" },
|
|
|
|
{ "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" },
|
2012-05-20 11:57:03 +00:00
|
|
|
{ "video_size", "A string describing frame size, such as 640x480 or hd720.", OFFSET(width), AV_OPT_TYPE_IMAGE_SIZE, {.str = "vga"}, 0, 0, DEC },
|
2011-10-04 05:38:01 +00:00
|
|
|
{ "framerate", "", OFFSET(framerate), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC },
|
2011-05-23 18:45:36 +00:00
|
|
|
{ NULL },
|
|
|
|
};
|
|
|
|
|
|
|
|
static const AVClass bktr_class = {
|
|
|
|
.class_name = "BKTR grab interface",
|
|
|
|
.item_name = av_default_item_name,
|
|
|
|
.option = options,
|
|
|
|
.version = LIBAVUTIL_VERSION_INT,
|
2014-02-22 22:32:51 +00:00
|
|
|
.category = AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT,
|
2011-05-23 18:45:36 +00:00
|
|
|
};
|
|
|
|
|
2011-01-25 22:03:28 +00:00
|
|
|
AVInputFormat ff_bktr_demuxer = {
|
2011-09-23 18:50:11 +00:00
|
|
|
.name = "bktr",
|
|
|
|
.long_name = NULL_IF_CONFIG_SMALL("video grab"),
|
|
|
|
.priv_data_size = sizeof(VideoData),
|
|
|
|
.read_header = grab_read_header,
|
|
|
|
.read_packet = grab_read_packet,
|
|
|
|
.read_close = grab_read_close,
|
|
|
|
.flags = AVFMT_NOFILE,
|
|
|
|
.priv_class = &bktr_class,
|
2005-06-25 09:04:08 +00:00
|
|
|
};
|