diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-04-01 15:13:02 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-04-01 15:13:07 +0200 |
commit | 599866f5d5e6d27657a3f4f5d4c1bc8785143c99 (patch) | |
tree | 3a5f0ffeecd3842ea29830db371f52dda1ca4748 | |
parent | ce841bc0326327b73659d7157ebcf25f235ef470 (diff) | |
parent | 52853077ee49db8ecb6f83d0f9a177708b5d93a6 (diff) | |
download | ffmpeg-599866f5d5e6d27657a3f4f5d4c1bc8785143c99.tar.gz |
Merge remote-tracking branch 'cigaes/master'
* cigaes/master:
lavfi/af_asetnsamples: fix EOF handling.
lavu/opt: make sure av_opt_set_bin() handles NULL/0.
lavd/v4l2: fully init an ioctl argument.
lavfi: detect merge failure for unknown layouts.
Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavdevice/v4l2.c | 3 | ||||
-rw-r--r-- | libavfilter/af_asetnsamples.c | 5 | ||||
-rw-r--r-- | libavfilter/formats.c | 4 | ||||
-rw-r--r-- | libavutil/opt.c | 7 |
4 files changed, 11 insertions, 8 deletions
diff --git a/libavdevice/v4l2.c b/libavdevice/v4l2.c index 284b495cd9..34e3d9cf42 100644 --- a/libavdevice/v4l2.c +++ b/libavdevice/v4l2.c @@ -949,11 +949,10 @@ static int v4l2_read_header(AVFormatContext *s1) } if (!s->width && !s->height) { - struct v4l2_format fmt; + struct v4l2_format fmt = { .type = V4L2_BUF_TYPE_VIDEO_CAPTURE }; av_log(s1, AV_LOG_VERBOSE, "Querying the device for the current frame size\n"); - fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; if (v4l2_ioctl(s->fd, VIDIOC_G_FMT, &fmt) < 0) { res = AVERROR(errno); av_log(s1, AV_LOG_ERROR, "ioctl(VIDIOC_G_FMT): %s\n", av_err2str(res)); diff --git a/libavfilter/af_asetnsamples.c b/libavfilter/af_asetnsamples.c index 08e5279989..e004453642 100644 --- a/libavfilter/af_asetnsamples.c +++ b/libavfilter/af_asetnsamples.c @@ -171,9 +171,8 @@ static int request_frame(AVFilterLink *outlink) } while (!asns->req_fullfilled && ret >= 0); if (ret == AVERROR_EOF) { - do { - ret = push_samples(outlink); - } while (ret > 0); + ret = push_samples(outlink); + return ret < 0 ? ret : ret > 0 ? 0 : AVERROR_EOF; } return ret; diff --git a/libavfilter/formats.c b/libavfilter/formats.c index 43718e4655..ea2462793e 100644 --- a/libavfilter/formats.c +++ b/libavfilter/formats.c @@ -184,6 +184,10 @@ AVFilterChannelLayouts *ff_merge_channel_layouts(AVFilterChannelLayouts *a, for (i = j = 0; i < b->nb_channel_layouts; i++) if (KNOWN(b->channel_layouts[i])) b->channel_layouts[j++] = b->channel_layouts[i]; + /* Not optimal: the unknown layouts of b may become known after + another merge. */ + if (!j) + return NULL; b->nb_channel_layouts = j; } MERGE_REF(b, a, channel_layouts, AVFilterChannelLayouts, fail); diff --git a/libavutil/opt.c b/libavutil/opt.c index fb3b724bd6..ab73913a39 100644 --- a/libavutil/opt.c +++ b/libavutil/opt.c @@ -420,8 +420,8 @@ int av_opt_set_bin(void *obj, const char *name, const uint8_t *val, int len, int if (o->type != AV_OPT_TYPE_BINARY) return AVERROR(EINVAL); - ptr = av_malloc(len); - if (!ptr) + ptr = len ? av_malloc(len) : NULL; + if (len && !ptr) return AVERROR(ENOMEM); dst = (uint8_t **)(((uint8_t *)target_obj) + o->offset); @@ -430,7 +430,8 @@ int av_opt_set_bin(void *obj, const char *name, const uint8_t *val, int len, int av_free(*dst); *dst = ptr; *lendst = len; - memcpy(ptr, val, len); + if (len) + memcpy(ptr, val, len); return 0; } |