[FFmpeg-cvslog] libdc1394: return meaninful error codes.
Anton Khirnov
git at videolan.org
Fri May 27 23:57:11 CEST 2011
ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Thu May 26 17:13:09 2011 +0200| [284bac2e7770685831a8389e8f2eaae977d4daa4] | committer: Anton Khirnov
libdc1394: return meaninful error codes.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=284bac2e7770685831a8389e8f2eaae977d4daa4
---
libavdevice/libdc1394.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/libavdevice/libdc1394.c b/libavdevice/libdc1394.c
index 336c465..50fc033 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
More information about the ffmpeg-cvslog
mailing list