summaryrefslogtreecommitdiff
path: root/libavdevice/bktr.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-05-26 03:00:37 +0200
committerMichael Niedermayer <michaelni@gmx.at>2011-05-26 03:28:22 +0200
commit39e4206dc672a596c742809c1466f8643a787208 (patch)
tree36b642fc5221090e5bd8d7bc1968a966a5c6c104 /libavdevice/bktr.c
parent189db9c9829b970b3e28006c9f00d6960f71cff1 (diff)
parenta2ee2843c09a6116b090020eff8213b86ea98bdb (diff)
Merge remote-tracking branch 'qatar/master'
* qatar/master: (32 commits) doc: create separate section for audio encoders swscale: Remove orphaned, commented-out function declaration. swscale: Eliminate rgb24toyv12_c() duplication. Remove h263_msmpeg4 from MpegEncContext. APIchanges: Fill in git hash for fps_probe_size (30315a8) avformat: Add fpsprobesize as an AVOption. avoptions: Return explicitly NAN or {0,0} if the option isn't found rtmp: Reindent rtmp: Don't try to do av_malloc(0) tty: replace AVFormatParameters.sample_rate abuse with a private option. Fix end time of last chapter in compute_chapters_end ffmpeg: get rid of useless AVInputStream.nb_streams. ffmpeg: simplify managing input files and streams ffmpeg: purge redundant AVInputStream.index. lavf: deprecate AVFormatParameters.channel. libdc1394: add a private option for channel. dv1394: add a private option for channel. v4l2: reindent. v4l2: add a private option for channel. lavf: deprecate AVFormatParameters.standard. ... Conflicts: doc/APIchanges doc/encoders.texi ffmpeg.c libavdevice/alsa-audio.h libavformat/version.h libavutil/opt.c libswscale/rgb2rgb.h libswscale/rgb2rgb_template.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavdevice/bktr.c')
-rw-r--r--libavdevice/bktr.c34
1 files changed, 29 insertions, 5 deletions
diff --git a/libavdevice/bktr.c b/libavdevice/bktr.c
index 6378ce7873..0e57258f14 100644
--- a/libavdevice/bktr.c
+++ b/libavdevice/bktr.c
@@ -25,6 +25,8 @@
*/
#include "libavformat/avformat.h"
+#include "libavutil/log.h"
+#include "libavutil/opt.h"
#if HAVE_DEV_BKTR_IOCTL_METEOR_H && HAVE_DEV_BKTR_IOCTL_BT848_H
# include <dev/bktr/ioctl_meteor.h>
# include <dev/bktr/ioctl_bt848.h>
@@ -47,12 +49,14 @@
#include <strings.h>
typedef struct {
+ AVClass *class;
int video_fd;
int tuner_fd;
int width, height;
int frame_rate;
int frame_rate_base;
uint64_t per_frame;
+ int standard;
} VideoData;
@@ -245,7 +249,6 @@ static int grab_read_header(AVFormatContext *s1, AVFormatParameters *ap)
int width, height;
int frame_rate;
int frame_rate_base;
- int format = -1;
if (ap->width <= 0 || ap->height <= 0 || ap->time_base.den <= 0)
return -1;
@@ -274,16 +277,18 @@ static int grab_read_header(AVFormatContext *s1, AVFormatParameters *ap)
st->codec->time_base.den = frame_rate;
st->codec->time_base.num = frame_rate_base;
+#if FF_API_FORMAT_PARAMETERS
if (ap->standard) {
if (!strcasecmp(ap->standard, "pal"))
- format = PAL;
+ s->standard = PAL;
else if (!strcasecmp(ap->standard, "secam"))
- format = SECAM;
+ s->standard = SECAM;
else if (!strcasecmp(ap->standard, "ntsc"))
- format = NTSC;
+ s->standard = NTSC;
}
+#endif
- if (bktr_init(s1->filename, width, height, format,
+ if (bktr_init(s1->filename, width, height, s->standard,
&(s->video_fd), &(s->tuner_fd), -1, 0.0) < 0)
return AVERROR(EIO);
@@ -311,6 +316,24 @@ static int grab_read_close(AVFormatContext *s1)
return 0;
}
+static const AVOption options[] = {
+ { "standard", "", offsetof(VideoData, standard), FF_OPT_TYPE_INT, {.dbl = VIDEO_FORMAT}, PAL, NTSCJ, AV_OPT_FLAG_DECODING_PARAM, "standard" },
+ { "PAL", "", 0, FF_OPT_TYPE_CONST, {.dbl = PAL}, 0, 0, AV_OPT_FLAG_DECODING_PARAM, "standard" },
+ { "NTSC", "", 0, FF_OPT_TYPE_CONST, {.dbl = NTSC}, 0, 0, AV_OPT_FLAG_DECODING_PARAM, "standard" },
+ { "SECAM", "", 0, FF_OPT_TYPE_CONST, {.dbl = SECAM}, 0, 0, AV_OPT_FLAG_DECODING_PARAM, "standard" },
+ { "PALN", "", 0, FF_OPT_TYPE_CONST, {.dbl = PALN}, 0, 0, AV_OPT_FLAG_DECODING_PARAM, "standard" },
+ { "PALM", "", 0, FF_OPT_TYPE_CONST, {.dbl = PALM}, 0, 0, AV_OPT_FLAG_DECODING_PARAM, "standard" },
+ { "NTSCJ", "", 0, FF_OPT_TYPE_CONST, {.dbl = NTSCJ}, 0, 0, AV_OPT_FLAG_DECODING_PARAM, "standard" },
+ { NULL },
+};
+
+static const AVClass bktr_class = {
+ .class_name = "BKTR grab interface",
+ .item_name = av_default_item_name,
+ .option = options,
+ .version = LIBAVUTIL_VERSION_INT,
+};
+
AVInputFormat ff_bktr_demuxer = {
"bktr",
NULL_IF_CONFIG_SMALL("video grab"),
@@ -320,4 +343,5 @@ AVInputFormat ff_bktr_demuxer = {
grab_read_packet,
grab_read_close,
.flags = AVFMT_NOFILE,
+ .priv_class = &bktr_class,
};