From patchwork Sat Aug 4 00:40:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukas Rusak X-Patchwork-Id: 9887 Delivered-To: ffmpegpatchwork@gmail.com Received: by 2002:a02:104:0:0:0:0:0 with SMTP id c4-v6csp740846jad; Fri, 3 Aug 2018 18:03:09 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdKgDhdcOM+6Ab7bMj+oxV9J+qXNfpGJlbM6Dzwp9+tuXyDbnU7PfcFACnkizrkpw2uUesB X-Received: by 2002:adf:b202:: with SMTP id u2-v6mr3896880wra.19.1533344589229; Fri, 03 Aug 2018 18:03:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533344589; cv=none; d=google.com; s=arc-20160816; b=fwKI8bqIyDdDNE1eUIHrc345JzcAV/NkF4n8ChfJxN43a376UhJcZyLmK0FRUoqZn7 ONKLGXvmOXQQrDuQZ62inlQgr3y3lzNskWeHE4u+s/RK9LaehNgxkI40GYbdn/DmNwKh 8fHOM2GA1tnHSGK9T+wMPEdon3GL/MLQGUVuOCOAiemX07utfnES+VlRnis1ke/HBPB5 X4T4fg8e0oYGy4fVG4BCLkOma0P+8cS1BdgX2jPg+y+bPzLdi21CUAvPhvXCpk4r3Mqi Q1ZGBq2+EJ1o/yqAFnpRh3xYeC5A7v/cRXqCARD8pCcGujQdMhrwLpxSR8uZHUq8TMDd Q0Fg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to:arc-authentication-results; bh=8aoTjZWkhfz6Rjzy9G5kVXRCY5BorcO7FIYOcCqpCJY=; b=lF5KpnQOJtzcIo4sAkbG8y9zfFxpquLH6tJ+xu105/Kfo+0jtqoIJTnHcFJ+8Gshlu MHu2LDNg3x/j0lZhaYVqBX/ClxNwSRLcrunc0m3CAMBsGKO9AMl7h0gWWDr/0ylXb8Ue gHtA/l83B1Mj8LMh9KMZRCnp+qH4lqyEgqePl02+t8gwVxl0E1LsaTXOJ1JompkiFOLh llSEqG18Wdm7DtSdiwx4oDWAdk+R2189FSdUwmiAKGJPDrAzeuWz+nkyHdazlpVFe7aN vEBsOdapN4Ix0wj47oxU2tH0Zv/goNc/nQqLTgGSQt4xm3THvMEM1RHCRhm2p4419JxX HuRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=hLHi1GNL; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id e18-v6si4088875wru.149.2018.08.03.18.03.08; Fri, 03 Aug 2018 18:03:09 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=hLHi1GNL; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D6F90689C5E; Sat, 4 Aug 2018 04:02:48 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pg1-f172.google.com (mail-pg1-f172.google.com [209.85.215.172]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4969968083A for ; Sat, 4 Aug 2018 04:02:42 +0300 (EEST) Received: by mail-pg1-f172.google.com with SMTP id a11-v6so3584330pgw.6 for ; Fri, 03 Aug 2018 18:03:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=QoK2jW9p/fmpH5iiSKwtQEouirblSB3ZlnAHcC9Utuo=; b=hLHi1GNLi20xi1p4+PapDOYpl0VC1yDtazwC5qgLyCLwvRsEThs0Dz0ejoRdTB7zpH n3oHM+A2vc2OrVeHQaTg641oYw9XBXB0lPvQLIQMsSAccvF22CgNNRwUEa0CY/dhWJ4r pGUKGQZmd/9OAtHKakozqtPvzLLFTMZ/qt0+ZkDyNypnOvjkJpDiM+1Fi4zjmMJYjB3m TbQItc7Wpr1CXhqhGfS+3gI0yBGJp3eQLfMMpUnpnSNKWEVR+8u5cRSd5hOuhJWHt7Af byeLFujxRpCX+JxkIldICibzSAM+QPKbxjF63QASYVtHXNRYGoE+2PXPzwnnT+kbFwdq /HOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=QoK2jW9p/fmpH5iiSKwtQEouirblSB3ZlnAHcC9Utuo=; b=H5I5zFMKLd/RXkJdvmRqMt3etHjYMV4N/V6lmwiZtDk/e2uXSSIrL5FfSjJ0kOkb87 UCt2OvXeAixUthQu0M8tsiMlGAU4y5w7wC0WOtAdSrkxyMS+whBd8f0J+qYDEJLauxU+ aESXPIGh5sGlN1dCxh8E4ZC+sbXLSAywMti+a9Eg8A1vF8xOII7kj7V/JMwPfuLafnYo IGAwU+xmkyuiC+c0FWXpLge4O7ih/HZJqDW5ZVJCgjMiih2O3i7lyS6dxbkamopZYB1F QQ1+DxPiTPwiYlBBM4wwlHt3k4zq1uzkx8MdH5algz4JqdE4ixfRk/ZcfuTRwdZk3Ma8 arUg== X-Gm-Message-State: AOUpUlEHeCzlGpIWBv5CYvqNMTvYRG7rUfSblpJYCrnBwA5Z5rAjvEpB ErY3yI0rQYsVDtWjFRU7m1ndb8oK X-Received: by 2002:a62:1016:: with SMTP id y22-v6mr6836704pfi.109.1533343236588; Fri, 03 Aug 2018 17:40:36 -0700 (PDT) Received: from localhost.localdomain (d154-20-200-72.bchsia.telus.net. [154.20.200.72]) by smtp.gmail.com with ESMTPSA id e8-v6sm1107265pfj.16.2018.08.03.17.40.35 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 03 Aug 2018 17:40:35 -0700 (PDT) From: Lukas Rusak To: ffmpeg-devel@ffmpeg.org Date: Fri, 3 Aug 2018 17:40:30 -0700 Message-Id: <20180804004031.12143-3-lorusak@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180804004031.12143-1-lorusak@gmail.com> References: <20180804004031.12143-1-lorusak@gmail.com> Subject: [FFmpeg-devel] [PATCH 3/4] libavcodec: v4l2m2m: adjust formatting X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" just some simple formatting fixes that unify the code quality --- libavcodec/v4l2_buffers.c | 23 +++++++++++++++-------- libavcodec/v4l2_buffers.h | 1 - 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/libavcodec/v4l2_buffers.c b/libavcodec/v4l2_buffers.c index e5c46ac81e..897c3c4636 100644 --- a/libavcodec/v4l2_buffers.c +++ b/libavcodec/v4l2_buffers.c @@ -401,7 +401,8 @@ static int v4l2_bufref_to_buf(V4L2Buffer *out, int plane, const uint8_t* data, i bytesused = FFMIN(size, out->plane_info[plane].length); length = out->plane_info[plane].length; - memcpy(out->plane_info[plane].mm_addr, data, FFMIN(size, out->plane_info[plane].length)); + memcpy(out->plane_info[plane].mm_addr, data, + FFMIN(size, out->plane_info[plane].length)); if (V4L2_TYPE_IS_MULTIPLANAR(out->buf.type)) { out->planes[plane].bytesused = bytesused; @@ -425,7 +426,10 @@ int ff_v4l2_buffer_avframe_to_buf(const AVFrame *frame, V4L2Buffer* out) int i, ret; for(i = 0; i < out->num_planes; i++) { - ret = v4l2_bufref_to_buf(out, i, frame->buf[i]->data, frame->buf[i]->size, frame->buf[i]); + ret = v4l2_bufref_to_buf(out, i, + frame->buf[i]->data, + frame->buf[i]->size, + frame->buf[i]); if (ret) return ret; } @@ -480,8 +484,8 @@ int ff_v4l2_buffer_buf_to_avframe(AVFrame *frame, V4L2Buffer *avbuf) /* 2. get frame information */ frame->key_frame = !!(avbuf->buf.flags & V4L2_BUF_FLAG_KEYFRAME); frame->color_primaries = v4l2_get_color_primaries(avbuf); - frame->colorspace = v4l2_get_color_space(avbuf); frame->color_range = v4l2_get_color_range(avbuf); + frame->colorspace = v4l2_get_color_space(avbuf); frame->color_trc = v4l2_get_color_trc(avbuf); frame->pts = v4l2_get_pts(avbuf); @@ -507,7 +511,8 @@ int ff_v4l2_buffer_buf_to_avpkt(AVPacket *pkt, V4L2Buffer *avbuf) if (ret) return ret; - pkt->size = V4L2_TYPE_IS_MULTIPLANAR(avbuf->buf.type) ? avbuf->buf.m.planes[0].bytesused : avbuf->buf.bytesused; + pkt->size = V4L2_TYPE_IS_MULTIPLANAR(avbuf->buf.type) ? + avbuf->buf.m.planes[0].bytesused : avbuf->buf.bytesused; pkt->data = pkt->buf->data; if (avbuf->buf.flags & V4L2_BUF_FLAG_KEYFRAME) @@ -563,6 +568,7 @@ int ff_v4l2_buffer_initialize(V4L2Buffer* avbuf, int index) /* in MP, the V4L2 API states that buf.length means num_planes */ if (avbuf->num_planes >= avbuf->buf.length) break; + if (avbuf->buf.m.planes[avbuf->num_planes].length) avbuf->num_planes++; } @@ -579,12 +585,14 @@ int ff_v4l2_buffer_initialize(V4L2Buffer* avbuf, int index) avbuf->plane_info[i].length = avbuf->buf.m.planes[i].length; avbuf->plane_info[i].mm_addr = mmap(NULL, avbuf->buf.m.planes[i].length, PROT_READ | PROT_WRITE, MAP_SHARED, - buf_to_m2mctx(avbuf)->fd, avbuf->buf.m.planes[i].m.mem_offset); + buf_to_m2mctx(avbuf)->fd, + avbuf->buf.m.planes[i].m.mem_offset); } else { avbuf->plane_info[i].length = avbuf->buf.length; avbuf->plane_info[i].mm_addr = mmap(NULL, avbuf->buf.length, PROT_READ | PROT_WRITE, MAP_SHARED, - buf_to_m2mctx(avbuf)->fd, avbuf->buf.m.offset); + buf_to_m2mctx(avbuf)->fd, + avbuf->buf.m.offset); } if (avbuf->plane_info[i].mm_addr == MAP_FAILED) @@ -594,9 +602,8 @@ int ff_v4l2_buffer_initialize(V4L2Buffer* avbuf, int index) avbuf->status = V4L2BUF_AVAILABLE; if (V4L2_TYPE_IS_MULTIPLANAR(ctx->type)) { - avbuf->buf.m.planes = avbuf->planes; avbuf->buf.length = avbuf->num_planes; - + avbuf->buf.m.planes = avbuf->planes; } else { avbuf->buf.bytesused = avbuf->planes[0].bytesused; avbuf->buf.length = avbuf->planes[0].length; diff --git a/libavcodec/v4l2_buffers.h b/libavcodec/v4l2_buffers.h index a8a50ecc65..c609a6c676 100644 --- a/libavcodec/v4l2_buffers.h +++ b/libavcodec/v4l2_buffers.h @@ -131,5 +131,4 @@ int ff_v4l2_buffer_initialize(V4L2Buffer* avbuf, int index); */ int ff_v4l2_buffer_enqueue(V4L2Buffer* avbuf); - #endif // AVCODEC_V4L2_BUFFERS_H