From patchwork Mon Jan 13 04:11:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andriy Gelman X-Patchwork-Id: 17316 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id F3C4544AF4A for ; Mon, 13 Jan 2020 06:33:25 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id B9E0868B0DA; Mon, 13 Jan 2020 06:33:25 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-qv1-f42.google.com (mail-qv1-f42.google.com [209.85.219.42]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id AB12168B060 for ; Mon, 13 Jan 2020 06:33:18 +0200 (EET) Received: by mail-qv1-f42.google.com with SMTP id y8so3469237qvk.6 for ; Sun, 12 Jan 2020 20:33:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=XykeuKZj/nj4HBFx4cx5+/KoEWXHkYY4TQRVsbGyvZ8=; b=pr9BCmiy9ja9QGrVx6U33qbmx8rmhy7HEvPQaruuoXd1TJOkYi0meBsNkH5Bbk6ovR ovg0g452k5WtaKJBh/1VZmB4QYpFYFqKlH9fb7rc0y8W274/sIxEW+NG5jwGhcklGHGR hpGoyQlDu/rIQEwy2KJ0TMjwqqNT60xxMvoSrB9PJ1kzaJKLhgVglDAftSB4xdufZHNe bTrrC14aeKMKc9YENAHYHkQ6a+pRPUT9/gAitZ+rp2FV+E0SVTdt7atlNWezdLPLsI6O 7mERseWvZj8nGZBghgYRTejosQp9UFSgPxTtJCyWcQeAWBW1nhov+6KVju08ZXiICe6W iTqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=XykeuKZj/nj4HBFx4cx5+/KoEWXHkYY4TQRVsbGyvZ8=; b=LqDXCQlRU8tPWaMaVoeJZZmAJ4w6pdHBAadeOvVg3qGnifrHuBBVQjn8SO5TMCL0qE Re3NAEb1S4XQ4mdwJBdcAAMpLg7r9d1aXllvJIxgE514bpV6zdzaN+XWEOsrVOY9UKBi x3R0tdzbUoyUV0leOAX565gNY4rrVIwN+qw+pdAsAWq3spjrPRX3zz/EiOTBthxmZIr5 18X1+JO4OG6laKFoiyNhmJTQyJUnkV9mcz9uX97DCIhXomcJD6qZxqe8FR68FwGEuNmm RCNwCZfHc3aczNlarc3maerxWO97+GHuVCmFvl5LrdXSq1CdbQAJtcFIPbA7FKDurtkD HBzg== X-Gm-Message-State: APjAAAXZ7Hpheu7GeJTehNviD1s0pvfC6BrsY+9eRmn8ytQULgW5+UvI RiVf8MkNX7XXhiUAi6nM198kI90A X-Google-Smtp-Source: APXvYqxoAuOsBMI27NTfNEOaaikVDhvDh2Fnk6QmewW1XLvIa6rMc9IJXOC4ggBB5G1ER+VnuKD5AA== X-Received: by 2002:ad4:514d:: with SMTP id g13mr9573252qvq.190.1578888717584; Sun, 12 Jan 2020 20:11:57 -0800 (PST) Received: from localhost.localdomain (c-71-232-27-28.hsd1.ma.comcast.net. [71.232.27.28]) by smtp.gmail.com with ESMTPSA id u57sm5087630qth.68.2020.01.12.20.11.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Jan 2020 20:11:57 -0800 (PST) From: Andriy Gelman X-Google-Original-From: Andriy Gelman To: ffmpeg-devel@ffmpeg.org Date: Sun, 12 Jan 2020 23:11:29 -0500 Message-Id: <20200113041130.30126-5-andriy.gelman@gmail.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20200113041130.30126-1-andriy.gelman@gmail.com> References: <20200113041130.30126-1-andriy.gelman@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 5/6] avcodec/v4l2_m2m: Use consistent logging context 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 Cc: Andriy Gelman Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" From: Andriy Gelman Before this commit v4l2_m2m used two different logging contexts (from V4L2m2mPriv and AVCodecContext). For consistency always use AVCodecContext. Signed-off-by: Andriy Gelman --- libavcodec/v4l2_context.c | 2 +- libavcodec/v4l2_m2m.c | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/libavcodec/v4l2_context.c b/libavcodec/v4l2_context.c index 5b8d5f225cd..655e634324e 100644 --- a/libavcodec/v4l2_context.c +++ b/libavcodec/v4l2_context.c @@ -50,7 +50,7 @@ static inline V4L2m2mContext *ctx_to_m2mctx(V4L2Context *ctx) static inline AVClass *logger(V4L2Context *ctx) { - return ctx_to_m2mctx(ctx)->priv; + return ctx_to_m2mctx(ctx)->avctx; } static inline unsigned int v4l2_get_width(struct v4l2_format *fmt) diff --git a/libavcodec/v4l2_m2m.c b/libavcodec/v4l2_m2m.c index b5a9fd10347..6f62e694125 100644 --- a/libavcodec/v4l2_m2m.c +++ b/libavcodec/v4l2_m2m.c @@ -63,7 +63,7 @@ static inline int v4l2_mplane_video(struct v4l2_capability *cap) static int v4l2_prepare_contexts(V4L2m2mContext* s, int probe) { struct v4l2_capability cap; - void *log_ctx = s->priv; + void *log_ctx = s->avctx; int ret; s->capture.done = s->output.done = 0; @@ -99,7 +99,7 @@ static int v4l2_prepare_contexts(V4L2m2mContext* s, int probe) static int v4l2_probe_driver(V4L2m2mContext* s) { - void *log_ctx = s->priv; + void *log_ctx = s->avctx; int ret; s->fd = open(s->devname, O_RDWR | O_NONBLOCK, 0); @@ -135,7 +135,7 @@ done: static int v4l2_configure_contexts(V4L2m2mContext* s) { - void *log_ctx = s->priv; + void *log_ctx = s->avctx; int ret; struct v4l2_format ofmt, cfmt; @@ -204,7 +204,7 @@ error: ******************************************************************************/ int ff_v4l2_m2m_codec_reinit(V4L2m2mContext* s) { - void *log_ctx = s->priv; + void *log_ctx = s->avctx; int ret; av_log(log_ctx, AV_LOG_DEBUG, "reinit context\n"); @@ -340,11 +340,11 @@ int ff_v4l2_m2m_codec_end(V4L2m2mPriv *priv) ret = ff_v4l2_context_set_status(&s->output, VIDIOC_STREAMOFF); if (ret) - av_log(priv, AV_LOG_ERROR, "VIDIOC_STREAMOFF %s\n", s->output.name); + av_log(s->avctx, AV_LOG_ERROR, "VIDIOC_STREAMOFF %s\n", s->output.name); ret = ff_v4l2_context_set_status(&s->capture, VIDIOC_STREAMOFF); if (ret) - av_log(priv, AV_LOG_ERROR, "VIDIOC_STREAMOFF %s\n", s->capture.name); + av_log(s->avctx, AV_LOG_ERROR, "VIDIOC_STREAMOFF %s\n", s->capture.name); ff_v4l2_context_release(&s->output); @@ -373,7 +373,7 @@ int ff_v4l2_m2m_codec_init(V4L2m2mPriv *priv) continue; snprintf(node, sizeof(node), "/dev/%s", entry->d_name); - av_log(priv, AV_LOG_DEBUG, "probing device %s\n", node); + av_log(s->avctx, AV_LOG_DEBUG, "probing device %s\n", node); strncpy(s->devname, node, strlen(node) + 1); ret = v4l2_probe_driver(s); if (!ret) @@ -383,13 +383,13 @@ int ff_v4l2_m2m_codec_init(V4L2m2mPriv *priv) closedir(dirp); if (ret) { - av_log(priv, AV_LOG_ERROR, "Could not find a valid device\n"); + av_log(s->avctx, AV_LOG_ERROR, "Could not find a valid device\n"); memset(s->devname, 0, sizeof(s->devname)); return ret; } - av_log(priv, AV_LOG_INFO, "Using device %s\n", node); + av_log(s->avctx, AV_LOG_INFO, "Using device %s\n", node); return v4l2_configure_contexts(s); }