[FFmpeg-devel] [PATCH] lavd/v4l2: reduce code duplication by using enqueue_buffer()

Michael Niedermayer michaelni at gmx.at
Sat Mar 9 14:06:59 CET 2013


On Sat, Mar 09, 2013 at 11:59:09AM +0100, Giorgio Vazzana wrote:
> 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?

for code thats maintained on our side, change as much as you like
unless the maintainer has a different preferrance
The idea here is that the maintainer should make sure all improvments
and bugfixes from all contributors get integrated and its entirely
upto him on how he achives that (similar or not similar to libav)

for code that has diverged from libav so much that we cant merge
changes easily anymore, change as much as you like, the only
point in similarity is ease of merging changes.

for code that is actively maintained in libav and not maintained in
ffmpeg and that is similar enough so that merges are trivial it would
make sense to attempt to keep differences small and work together
with whoever actively maintains the code.
iam not aware of much success with "working together" though so this
part is more hypothetical sadly.

about v4l2 i dont think anyone maintains that on the libav side

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

He who knows, does not speak. He who speaks, does not know. -- Lao Tsu
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130309/66485931/attachment.asc>


More information about the ffmpeg-devel mailing list