From patchwork Tue Nov 28 04:46:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philip Langdale X-Patchwork-Id: 6414 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.161.94 with SMTP id m30csp2729874jah; Mon, 27 Nov 2017 20:46:32 -0800 (PST) X-Google-Smtp-Source: AGs4zMa7KcfB+hB//0DKdTi61m7X13xVQdJqQVLGSlfKMFVeLtTwCv6WddtauXRVMADSleqCObxM X-Received: by 10.223.153.20 with SMTP id x20mr32304927wrb.219.1511844392358; Mon, 27 Nov 2017 20:46:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511844392; cv=none; d=google.com; s=arc-20160816; b=vRaAWRsaCxra5bREE8jr+K/oubWKYV3ABL28r+hBLWwFIVFbmP9UyhMxyFUHh4wLnu +VcMY/j92UZdl9XzpF7/Q3F/3BF6qmqMKIzw5hFjJjTHH8slTA8Ho/AcrpSa5PUJiuZR jwq5FZgTVjg6kF1MFtldYKO2hH5BKzjPOwWlAL0MUlxu96DpyWeGNYYRBmSjub59Ni0c 3uE7kKcmajaMc863C2O/gaL/pfgkrTyOCAQ+IbsKGA5S9LAEFihbvk/CbIvy41reKsvm hwAubGZcmu+LMyZofzxOhd/uwCVHJMpIQ9Ia5hK+TqccGZRPkYyZdLYb7Dj6Pcp2OFXq N1uA== 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:cc: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=D78sRjVi2JN9u0DJ1wqlEDr70C1BdR88XxJslqlBAwg=; b=oYdbUWDpHOXMLxarvNBb3tn3TV0YyBiFQS+Yf2Ct8n2MWbLfEy8UTWnKSYUx0o0HLu uitEHOAO9PG+7VFAO9vfyLMH+GF6f7PYIJgPitlXi9RiD82NA074P/LvXPNevM7J2Rau 1Kdo6Kw7nYpR+MLtuZ+SPrCCPMnF80+WY/fOvUVzRGa2zjHcLbqBnDTDOY3Ygo5Izvyp /eRNcpSnc/LCWIBhda174e5SwypOLkUCsmqu+RJxe/9J4V0J0jjGJMIDPumbxpO66RUs jFit1o1Qot+W10KvCEfJAx574qXgqkqDW4j2w1vnGxirTBlUMniCjF0TiHylrFzrGKvi kzTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@overt.org header.s=mail header.b=u6ffNEGr; 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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id b1si24136195wrf.391.2017.11.27.20.46.31; Mon, 27 Nov 2017 20:46:32 -0800 (PST) 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=@overt.org header.s=mail header.b=u6ffNEGr; 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 Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 5F07E689FC5; Tue, 28 Nov 2017 06:46:22 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-io0-f228.google.com (mail-io0-f228.google.com [209.85.223.228]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 1921468995F for ; Tue, 28 Nov 2017 06:46:14 +0200 (EET) Received: by mail-io0-f228.google.com with SMTP id 79so31345762ioi.3 for ; Mon, 27 Nov 2017 20:46:16 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id:in-reply-to:references; bh=2JUWYnXfcp5ZQb/RpmlUN2iwvRUWeR7TdM7jJh+GU/0=; b=BuWr6/Q1sn/hL97/DRpbaX2spoNN7fkRpPwzMKkBIYRkderC7KPpKpRn3J8TJGW2pp uW582Ypk+quQ8kqGqx6VDkwit50ww4i4S0RsOe5l7qPZyi4DHA+hkqTnRo2o6ynPcSfH Kl+3+2/FwYag1OGYI9Xiu1oKHG1rydhgTpkXhmv96Gk08DVBbVYS2udJ5xG0xRvct7Gb y14Z1DrzlvybReUoJb3bAE5/1gsW1stUv01++tB5UH6nq87E9C69iyZpNzqR++0xJVFZ XGLt0jpkS0fBlGnHw4xO7+2dC7BKroE0roWq2VhyPizCkahuknmH/4gWGZ+H0hT2Qs2Z Dnyw== X-Gm-Message-State: AJaThX6ewrSEKdnFXMsPtPk0LoZppIyCtiqsB53K8q8lmGKQIBxnwxYN S5rA1PRFdnBnMZOUf8CPY2c6xpDfQJMvCFz1jcc+VFVBsf3rIQ== X-Received: by 10.107.11.226 with SMTP id 95mr43801211iol.78.1511844375036; Mon, 27 Nov 2017 20:46:15 -0800 (PST) Received: from mail.overt.org (155.208.178.107.bc.googleusercontent.com. [107.178.208.155]) by smtp-relay.gmail.com with ESMTPS id 67sm5400420ita.0.2017.11.27.20.46.14 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 27 Nov 2017 20:46:15 -0800 (PST) X-Relaying-Domain: gapps.overt.org Received: from authenticated-user (mail.overt.org [107.178.208.155]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.overt.org (Postfix) with ESMTPSA id 58C227853C; Tue, 28 Nov 2017 04:46:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=overt.org; s=mail; t=1511844374; bh=yoIPt17W/d0Z8uenKi4fdwW2jGUQBSUM2YEtaicH0V4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=u6ffNEGr1bj/aoBoWSsdvwpzRC+OXBghnSn3XWpdFK9xG9P/OwjDOaE2ZO9PxO5QL 0Bgb1Z78j1nvgatzXZFUP9sVtyB1rAZXSUg80+770zUJ1ynMhAMTEADcDvmsOJeY6Y 4XitDHoMk867Jc8UfIYCU6PVLNOkgFYE6qHQPRSN+yvbcjpKzuYcZQv6HP6WXGfUWt gubgndWvDjOiD9XSOqvVF66CCFvBKIIl2IZOPjEkVPVp4lpZvmQYVnMhxBLwNxZCyz +SCst2hcA+llHLJI9NXuyqJvN8unS8s9awiml485Ggh6t4mhyUJi83Qoc4o1QYtcS5 J2a1YLfUduKOA== From: Philip Langdale To: ffmpeg-devel@ffmpeg.org Date: Mon, 27 Nov 2017 20:46:00 -0800 Message-Id: <20171128044601.5963-2-philipl@overt.org> In-Reply-To: <20171128044601.5963-1-philipl@overt.org> References: <20171128044601.5963-1-philipl@overt.org> Subject: [FFmpeg-devel] [PATCH 1/2] avcodec: Add metadata to identify hardware backed codecs 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: Philip Langdale MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" If hardware acceleration is implemented through an HWAccel, then it's easy to recognise, but some hardware implementations are best suited to implementation as full decoders, and these are not easy to identify. Clients typically need hardcoded lists of codecs, and usually need to rely on related codecs using a particular naming convention. To make it easier to discover these codecs dynamically, we can introduce an explicit AV_CODEC_CAP_HARDWARE that indicates the codec is hardware-backed. We also introduce a 'provider' field into AVCodec that allows for an identifier to be attached to these codecs for simple matching. The provider could also be used to identify the use of an external software library. Unfortunately, we know of at least one case where an external interface might silently end up using a separate software implementation (libmfx) and so we introduce AV_CODEC_CAP_MAYBE_NOT_HARDWARE so say that you can't trust it 100%. It's silly but what can you do? The expected use-case here is allowing a client application to enumerate hardware decoding options for a given format and to allow a user to select one based on a recognisable identifier (the provider). Signed-off-by: Philip Langdale --- Changelog | 1 + doc/APIchanges | 5 +++++ libavcodec/avcodec.h | 19 +++++++++++++++++++ 3 files changed, 25 insertions(+) diff --git a/Changelog b/Changelog index 76d6fad56b..a99edbf4b7 100644 --- a/Changelog +++ b/Changelog @@ -21,6 +21,7 @@ version : - video mix filter - video normalize filter - audio lv2 wrapper filter +- Added codec metadata to identify hardware backed decoders version 3.4: diff --git a/doc/APIchanges b/doc/APIchanges index 44a740e51f..7856cb13a1 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -15,6 +15,11 @@ libavutil: 2017-10-21 API changes, most recent first: +2017-12-xx - xxxxxxx - lavc 58.7.100 - avcodec.h + Add AV_CODEC_CAP_HARDWARE + Add AV_CODEC_CAP_MAYBE_NOT_HARDWARE + Add AVCodec.provider + 2017-xx-xx - xxxxxxx - lavc 58.6.100 - avcodec.h Add const to AVCodecContext.hwaccel. diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index c1e68b1d13..04cfa48665 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -1036,6 +1036,16 @@ typedef struct RcOverride{ * choice for probing. */ #define AV_CODEC_CAP_AVOID_PROBING (1 << 17) +/** + * Codec is backed by a hardware implementation. Typically used to + * identify a non-hwaccel hardware decoder. + */ +#define AV_CODEC_CAP_HARDWARE (1 << 18) +/** + * Codec is normally backed by a hardware implementation, but the + * external abstraction could be software backed. + */ +#define AV_CODEC_CAP_MAYBE_NOT_HARDWARE (1 << 19) /** * Codec is intra only. */ @@ -3475,6 +3485,15 @@ typedef struct AVCodec { * The user can only access this field via avcodec_get_hw_config(). */ const struct AVCodecHWConfigInternal **hw_configs; + + /** + * String that helps identify the external provider for the codec. + * For example, if some external hardware decoder provides support + * for a variety of codecs, they could each set the same provider + * value to signify their relationship. Could also be used to + * identify the use of an external software implementation. + */ + const char *provider; } AVCodec; #if FF_API_CODEC_GET_SET