summaryrefslogtreecommitdiff
path: root/libavdevice/dv1394.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/dv1394.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/dv1394.c')
-rw-r--r--libavdevice/dv1394.c35
1 files changed, 28 insertions, 7 deletions
diff --git a/libavdevice/dv1394.c b/libavdevice/dv1394.c
index a9bc058dc9..7fa73bdf95 100644
--- a/libavdevice/dv1394.c
+++ b/libavdevice/dv1394.c
@@ -30,6 +30,8 @@
#include <time.h>
#include <strings.h>
+#include "libavutil/log.h"
+#include "libavutil/opt.h"
#include "libavformat/avformat.h"
#undef DV1394_DEBUG
@@ -38,6 +40,7 @@
#include "dv1394.h"
struct dv1394_data {
+ AVClass *class;
int fd;
int channel;
int format;
@@ -90,15 +93,17 @@ static int dv1394_read_header(AVFormatContext * context, AVFormatParameters * ap
if (!dv->dv_demux)
goto failed;
- if (ap->standard && !strcasecmp(ap->standard, "pal"))
- dv->format = DV1394_PAL;
- else
- dv->format = DV1394_NTSC;
+#if FF_API_FORMAT_PARAMETERS
+ if (ap->standard) {
+ if (!strcasecmp(ap->standard, "pal"))
+ dv->format = DV1394_PAL;
+ else
+ dv->format = DV1394_NTSC;
+ }
if (ap->channel)
dv->channel = ap->channel;
- else
- dv->channel = DV1394_DEFAULT_CHANNEL;
+#endif
/* Open and initialize DV1394 device */
dv->fd = open(context->filename, O_RDONLY);
@@ -227,6 +232,21 @@ static int dv1394_close(AVFormatContext * context)
return 0;
}
+static const AVOption options[] = {
+ { "standard", "", offsetof(struct dv1394_data, format), FF_OPT_TYPE_INT, {.dbl = DV1394_NTSC}, DV1394_PAL, DV1394_NTSC, AV_OPT_FLAG_DECODING_PARAM, "standard" },
+ { "PAL", "", 0, FF_OPT_TYPE_CONST, {.dbl = DV1394_PAL}, 0, 0, AV_OPT_FLAG_DECODING_PARAM, "standard" },
+ { "NTSC", "", 0, FF_OPT_TYPE_CONST, {.dbl = DV1394_NTSC}, 0, 0, AV_OPT_FLAG_DECODING_PARAM, "standard" },
+ { "channel", "", offsetof(struct dv1394_data, channel), FF_OPT_TYPE_INT, {.dbl = DV1394_DEFAULT_CHANNEL}, 0, INT_MAX, AV_OPT_FLAG_DECODING_PARAM },
+ { NULL },
+};
+
+static const AVClass dv1394_class = {
+ .class_name = "DV1394 indev",
+ .item_name = av_default_item_name,
+ .option = options,
+ .version = LIBAVUTIL_VERSION_INT,
+};
+
AVInputFormat ff_dv1394_demuxer = {
.name = "dv1394",
.long_name = NULL_IF_CONFIG_SMALL("DV1394 A/V grab"),
@@ -234,5 +254,6 @@ AVInputFormat ff_dv1394_demuxer = {
.read_header = dv1394_read_header,
.read_packet = dv1394_read_packet,
.read_close = dv1394_close,
- .flags = AVFMT_NOFILE
+ .flags = AVFMT_NOFILE,
+ .priv_class = &dv1394_class,
};