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>
This commit is contained in:
Michael Niedermayer 2013-04-01 15:13:02 +02:00
commit 599866f5d5
4 changed files with 11 additions and 8 deletions

View File

@ -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));

View File

@ -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;

View File

@ -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);

View File

@ -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;
}