[FFmpeg-devel] [PATCH] lavd/v4l2: reduce code duplication by using enqueue_buffer()
Giorgio Vazzana
mywing81 at gmail.com
Sat Mar 9 11:59:09 CET 2013
2013/3/8 Stefano Sabatini <stefasab at gmail.com>:
> On date Friday 2013-03-08 15:18:54 +0100, Giorgio Vazzana encoded:
>> Hi,
>>
>> commit message says it all. Please review.
>>
>> Giorgio Vazzana
>
>> From ba419f7f485f0187653a5e747a65fa2d454c34af Mon Sep 17 00:00:00 2001
>> From: Giorgio Vazzana <mywing81 at gmail.com>
>> Date: Fri, 8 Mar 2013 15:11:52 +0100
>> Subject: [PATCH] lavd/v4l2: reduce code duplication by using enqueue_buffer()
>>
>> ---
>> libavdevice/v4l2.c | 12 ++----------
>> 1 files changed, 2 insertions(+), 10 deletions(-)
>>
>> diff --git a/libavdevice/v4l2.c b/libavdevice/v4l2.c
>> index b1a9c75..6915b06 100644
>> --- a/libavdevice/v4l2.c
>> +++ b/libavdevice/v4l2.c
>> @@ -663,17 +663,9 @@ static int mmap_start(AVFormatContext *ctx)
>> int i, res;
>>
>> for (i = 0; i < s->buffers; i++) {
>> - struct v4l2_buffer buf = {
>> - .type = V4L2_BUF_TYPE_VIDEO_CAPTURE,
>> - .index = i,
>> - .memory = V4L2_MEMORY_MMAP
>> - };
>> -
>> - if (v4l2_ioctl(s->fd, VIDIOC_QBUF, &buf) < 0) {
>> - res = AVERROR(errno);
>> - av_log(ctx, AV_LOG_ERROR, "ioctl(VIDIOC_QBUF): %s\n", av_err2str(res));
>> + res = enqueue_buffer(s->fd, i);
>> + if (res < 0)
>> return res;
>> - }
>> }
>
> Patch looks good, but it doesn't apply to current master after the
> last merge.
Dropped then.
> Please test if there are regressions (and BTW we need a
> v4l2 maintainer).
Ok, I gave a look at the new ref-counted buffers and atomic
operations. The new code/logic in v4l2.c seems fine to me, and I could
not see any regression from a quick test, but I'll keep testing and
report if I find something.
I only noticed minor simplifications that can be done and something
about the error handling. Before I send patches I wanted to ask what's
the policy here... do we aim at reduce the diff with the fork or are
we allowed to change things?
More information about the ffmpeg-devel
mailing list