summaryrefslogtreecommitdiff
path: root/libavdevice/libdc1394.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-05-27 23:47:05 +0200
committerMichael Niedermayer <michaelni@gmx.at>2011-05-27 23:48:22 +0200
commit8381ab143779d25611a1bb05d674bc39fe940f77 (patch)
tree74773be2c947475433dcc47898aec49a0c4b198b /libavdevice/libdc1394.c
parentb8773e44d56667edea2d68d067d0c156522ca304 (diff)
parent79aeade6f6f8fbd7ce1da619fdd475e5db88ae24 (diff)
Merge remote-tracking branch 'qatar/master'
* qatar/master: (29 commits) ARM: disable ff_vector_fmul_vfp on VFPv3 systems ARM: check for VFPv3 swscale: Remove unused variables in x86 code. doc: Drop DJGPP section, Libav now compiles out-of-the-box on FreeDOS. x86: Add appropriate ifdefs around certain AVX functions. cmdutils: use sws_freeContext() instead of av_freep(). swscale: delay allocation of formatConvBuffer(). swscale: fix build with --disable-swscale-alpha. movenc: Deprecate the global RTP hinting flag, use a private AVOption instead movenc: Add an AVClass for setting muxer specific options swscale: fix non-bitexact yuv2yuv[X2]() MMX/MMX2 functions. configure: report yasm/nasm presence properly tcp: make connect() timeout properly rawdec: factor video demuxer definitions into a macro. rtspdec: add initial_pause private option. lavf: deprecate AVFormatParameters.width/height. tty: add video_size private option. rawdec: add video_size private option. x11grab: add video_size private option. x11grab: factorize returning error codes. ... Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavdevice/libdc1394.c')
-rw-r--r--libavdevice/libdc1394.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/libavdevice/libdc1394.c b/libavdevice/libdc1394.c
index f4af08174a..bbb606b935 100644
--- a/libavdevice/libdc1394.c
+++ b/libavdevice/libdc1394.c
@@ -28,6 +28,7 @@
#include <stdlib.h>
#include <string.h>
+#include "libavutil/parseutils.h"
#include <dc1394/dc1394.h>
@@ -40,6 +41,7 @@ typedef struct dc1394_data {
dc1394video_frame_t *frame;
int current_frame;
int fps;
+ char *video_size; /**< String describing video size, set by a private option. */
AVPacket packet;
} dc1394_data;
@@ -76,7 +78,10 @@ struct dc1394_frame_rate {
{ 0, 0 } /* gotta be the last one */
};
+#define OFFSET(x) offsetof(dc1394_data, x)
+#define DEC AV_OPT_FLAG_DECODING_PARAM
static const AVOption options[] = {
+ { "video_size", "A string describing frame size, such as 640x480 or hd720.", OFFSET(video_size), FF_OPT_TYPE_STRING, {.str = "qvga"}, 0, 0, DEC },
{ NULL },
};
@@ -103,6 +108,7 @@ static int dc1394_read_header(AVFormatContext *c, AVFormatParameters * ap)
int score, max_score;
int final_width, final_height, final_pix_fmt, final_frame_rate;
int res, i, j;
+ int ret=-1;
/* Now let us prep the hardware. */
dc1394->d = dc1394_new();
@@ -127,6 +133,14 @@ static int dc1394_read_header(AVFormatContext *c, AVFormatParameters * ap)
av_log(c, AV_LOG_ERROR, "Could not get video formats.\n");
goto out_camera;
}
+
+ if (dc1394->video_size) {
+ if ((ret = av_parse_video_size(&ap->width, &ap->height, dc1394->video_size)) < 0) {
+ av_log(c, AV_LOG_ERROR, "Couldn't parse video size.\n");
+ goto out;
+ }
+ }
+
/* Choose the best mode. */
rate = (ap->time_base.num ? av_rescale(1000, ap->time_base.den, ap->time_base.num) : -1);
max_score = -1;
@@ -290,7 +304,7 @@ out_camera:
dc1394_camera_free (dc1394->camera);
out:
dc1394_free(dc1394->d);
- return -1;
+ return ret;
}
static int dc1394_read_packet(AVFormatContext *c, AVPacket *pkt)