From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 0729D47DF2 for ; Fri, 27 Oct 2023 16:49:22 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4C12468CB3F; Fri, 27 Oct 2023 19:49:21 +0300 (EEST) Received: from mail.overt.org (mail.overt.org [72.14.183.176]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id AD74568C97F for ; Fri, 27 Oct 2023 19:49:14 +0300 (EEST) Received: from authenticated-user (mail.overt.org [72.14.183.176]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.overt.org (Postfix) with ESMTPSA id 59069605D4 for ; Fri, 27 Oct 2023 11:49:13 -0500 (CDT) Date: Fri, 27 Oct 2023 09:49:12 -0700 To: ffmpeg-devel@ffmpeg.org Message-ID: <20231027094912.0f2dd8fd@fido7> In-Reply-To: References: <20231027153701.246497-1-quinkblack@foxmail.com> MIME-Version: 1.0 Subject: Re: [FFmpeg-devel] [PATCH 2/2] avutil/hwcontext_vaapi: return ENOSYS for unsupported operation X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Philip Langdale via ffmpeg-devel Reply-To: FFmpeg development discussions and patches Cc: Philip Langdale Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On Fri, 27 Oct 2023 23:37:01 +0800 Zhao Zhili wrote: > From: Zhao Zhili > > av_hwframe_transfer_data try with src_ctx first. If the operation > failed with AVERROR(ENOSYS), it will try again with dst_ctx. Return > AVERROR(EINVAL) makes the second step being skipped. > --- > libavutil/hwcontext_vaapi.c | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) > > diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c > index 558fed94c6..bb28bcf588 100644 > --- a/libavutil/hwcontext_vaapi.c > +++ b/libavutil/hwcontext_vaapi.c > @@ -217,7 +217,7 @@ static int > vaapi_get_image_format(AVHWDeviceContext *hwdev, return 0; > } > } > - return AVERROR(EINVAL); > + return AVERROR(ENOSYS); > } > > static int vaapi_frames_get_constraints(AVHWDeviceContext *hwdev, > @@ -805,19 +805,19 @@ static int vaapi_map_frame(AVHWFramesContext > *hwfc, > if (!ctx->derive_works && (flags & AV_HWFRAME_MAP_DIRECT)) { > // Requested direct mapping but it is not possible. > - return AVERROR(EINVAL); > + return AVERROR(ENOSYS); > } > if (dst->format == AV_PIX_FMT_NONE) > dst->format = hwfc->sw_format; > if (dst->format != hwfc->sw_format && (flags & > AV_HWFRAME_MAP_DIRECT)) { // Requested direct mapping but the formats > do not match. > - return AVERROR(EINVAL); > + return AVERROR(ENOSYS); > } > > err = vaapi_get_image_format(hwfc->device_ctx, dst->format, > &image_format); if (err < 0) { > // Requested format is not a valid output format. > - return AVERROR(EINVAL); > + return err; > } > > map = av_malloc(sizeof(*map)); > @@ -992,7 +992,7 @@ static int vaapi_map_to_memory(AVHWFramesContext > *hwfc, AVFrame *dst, if (dst->format != AV_PIX_FMT_NONE) { > err = vaapi_get_image_format(hwfc->device_ctx, dst->format, > NULL); if (err < 0) > - return AVERROR(ENOSYS); > + return err; > } > > err = vaapi_map_frame(hwfc, dst, src, flags); LGTM. --phil _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".