diff options
author | Michael Niedermayer | 2011-05-26 03:00:37 +0200 |
---|---|---|
committer | Michael Niedermayer | 2011-05-26 03:28:22 +0200 |
commit | 39e4206dc672a596c742809c1466f8643a787208 (patch) | |
tree | 36b642fc5221090e5bd8d7bc1968a966a5c6c104 /libavdevice/libdc1394.c | |
parent | 189db9c9829b970b3e28006c9f00d6960f71cff1 (diff) | |
parent | a2ee2843c09a6116b090020eff8213b86ea98bdb (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/libdc1394.c')
-rw-r--r-- | libavdevice/libdc1394.c | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/libavdevice/libdc1394.c b/libavdevice/libdc1394.c index abd82dc981..838f01993a 100644 --- a/libavdevice/libdc1394.c +++ b/libavdevice/libdc1394.c @@ -22,6 +22,8 @@ #include "config.h" #include "libavformat/avformat.h" +#include "libavutil/log.h" +#include "libavutil/opt.h" #if HAVE_LIBDC1394_2 #include <dc1394/dc1394.h> @@ -45,9 +47,11 @@ #undef free typedef struct dc1394_data { + AVClass *class; #if HAVE_LIBDC1394_1 raw1394handle_t handle; dc1394_cameracapture camera; + int channel; #elif HAVE_LIBDC1394_2 dc1394_t *d; dc1394camera_t *camera; @@ -155,6 +159,11 @@ static int dc1394_v1_read_header(AVFormatContext *c, AVFormatParameters * ap) if (dc1394_read_common(c,ap,&fmt,&fps) != 0) return -1; +#if FF_API_FORMAT_PARAMETERS + if (ap->channel) + dc1394->channel = ap->channel; +#endif + /* Now let us prep the hardware. */ dc1394->handle = dc1394_create_handle(0); /* FIXME: gotta have ap->port */ if (!dc1394->handle) { @@ -162,11 +171,11 @@ static int dc1394_v1_read_header(AVFormatContext *c, AVFormatParameters * ap) goto out; } camera_nodes = dc1394_get_camera_nodes(dc1394->handle, &res, 1); - if (!camera_nodes || camera_nodes[ap->channel] == DC1394_NO_CAMERA) { - av_log(c, AV_LOG_ERROR, "There's no IIDC camera on the channel %d\n", ap->channel); + if (!camera_nodes || camera_nodes[dc1394->channel] == DC1394_NO_CAMERA) { + av_log(c, AV_LOG_ERROR, "There's no IIDC camera on the channel %d\n", dc1394->channel); goto out_handle; } - res = dc1394_dma_setup_capture(dc1394->handle, camera_nodes[ap->channel], + res = dc1394_dma_setup_capture(dc1394->handle, camera_nodes[dc1394->channel], 0, FORMAT_VGA_NONCOMPRESSED, fmt->frame_size_id, @@ -236,6 +245,20 @@ static int dc1394_v1_close(AVFormatContext * context) return 0; } +static const AVOption options[] = { +#if HAVE_LIBDC1394_1 + { "channel", "", offsetof(dc1394_data, channel), FF_OPT_TYPE_INT, {.dbl = 0}, 0, INT_MAX, AV_OPT_FLAG_DECODING_PARAM }, +#endif + { NULL }, +}; + +static const AVClass libdc1394_class = { + .class_name = "libdc1394 indev", + .item_name = av_default_item_name, + .option = options, + .version = LIBAVUTIL_VERSION_INT, +}; + #elif HAVE_LIBDC1394_2 static int dc1394_v2_read_header(AVFormatContext *c, AVFormatParameters * ap) { @@ -356,6 +379,7 @@ AVInputFormat ff_libdc1394_demuxer = { .read_packet = dc1394_v2_read_packet, .read_close = dc1394_v2_close, .flags = AVFMT_NOFILE + .priv_class = &libdc1394_class, }; #endif @@ -367,6 +391,7 @@ AVInputFormat ff_libdc1394_demuxer = { .read_header = dc1394_v1_read_header, .read_packet = dc1394_v1_read_packet, .read_close = dc1394_v1_close, - .flags = AVFMT_NOFILE + .flags = AVFMT_NOFILE, + .priv_class = &libdc1394_class, }; #endif |