diff options
author | Anton Khirnov <anton@khirnov.net> | 2011-05-26 17:13:09 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2011-05-27 06:52:51 +0200 |
commit | 284bac2e7770685831a8389e8f2eaae977d4daa4 (patch) | |
tree | 68ac2b4a9cc42e6cc10d9c28450a57e6c08c6680 | |
parent | 33e036967253b83621f378a75d3e4ed199bf4508 (diff) | |
download | ffmpeg-284bac2e7770685831a8389e8f2eaae977d4daa4.tar.gz |
libdc1394: return meaninful error codes.
-rw-r--r-- | libavdevice/libdc1394.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/libavdevice/libdc1394.c b/libavdevice/libdc1394.c index 336c465311..50fc033d42 100644 --- a/libavdevice/libdc1394.c +++ b/libavdevice/libdc1394.c @@ -116,6 +116,7 @@ static inline int dc1394_read_common(AVFormatContext *c, AVFormatParameters *ap, int width = !ap->width ? 320 : ap->width; int height = !ap->height ? 240 : ap->height; int frame_rate = !ap->time_base.num ? 30000 : av_rescale(1000, ap->time_base.den, ap->time_base.num); + int ret = 0; for (fmt = dc1394_frame_formats; fmt->width; fmt++) if (fmt->pix_fmt == pix_fmt && fmt->width == width && fmt->height == height) @@ -128,13 +129,16 @@ static inline int dc1394_read_common(AVFormatContext *c, AVFormatParameters *ap, if (!fps->frame_rate || !fmt->width) { av_log(c, AV_LOG_ERROR, "Can't find matching camera format for %s, %dx%d@%d:1000fps\n", avcodec_get_pix_fmt_name(pix_fmt), width, height, frame_rate); + ret = AVERROR(EINVAL); goto out; } /* create a video stream */ vst = av_new_stream(c, 0); - if (!vst) + if (!vst) { + ret = AVERROR(ENOMEM); goto out; + } av_set_pts_info(vst, 64, 1, 1000); vst->codec->codec_type = AVMEDIA_TYPE_VIDEO; vst->codec->codec_id = CODEC_ID_RAWVIDEO; @@ -156,9 +160,8 @@ static inline int dc1394_read_common(AVFormatContext *c, AVFormatParameters *ap, vst->codec->bit_rate = av_rescale(dc1394->packet.size * 8, fps->frame_rate, 1000); *select_fps = fps; *select_fmt = fmt; - return 0; out: - return -1; + return ret; } #if HAVE_LIBDC1394_1 |