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 8EDD142A79 for ; Thu, 12 May 2022 10:26:51 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id E470C68B439; Thu, 12 May 2022 13:26:48 +0300 (EEST) Received: from out203-205-221-245.mail.qq.com (out203-205-221-245.mail.qq.com [203.205.221.245]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C93C268B0EE for ; Thu, 12 May 2022 13:26:40 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1652351195; bh=3XS1XO/o5L4Rzju/DkgCbdz48RNGtAbgkxeWW73L8x0=; h=From:To:Cc:Subject:Date; b=PHgL4Dpv7HEWr+xKjr71ok9CXO8h/5y5L4zyEOeTeEG5f7X1+3eV0Qs61eugYHg7v 9TYiImRXGRIEFx3R+KPlT1Vh1s5nJuYBHqpP+QOJKA4yHLn7VOF0szyoGakdPVwjQh 2mLx8tR7hZxFH4pOgLrIoyOy1t5Guwk4T85yZIwE= Received: from ZHILIZHAO-MB2.tencent.com ([113.118.102.173]) by newxmesmtplogicsvrsza7.qq.com (NewEsmtp) with SMTP id 6A1BFAD3; Thu, 12 May 2022 18:26:33 +0800 X-QQ-mid: xmsmtpt1652351193t7qfm1diu Message-ID: X-QQ-XMAILINFO: Ms5xyImz3IR/HWYy2B5XOURBVWtun0NZDFtBCdnowwF0cY5FnswElJXXKGvDO3 b4hijifrBv/p++dbwRB3lR2SZC4DmaCqOGRBUFoj1STF8EKHwtr1D3zLKC+OJQ8ji/gDkh1a3OnT /Oe2EdprY19GzKIg+XJAza+zau8MJz29gNvNgvVxfsNH0YxKNu6mzGmU4XpZTrGMmlAjam4O8pCy MJ7xXHbPIXsI12ioJkk0L5Cm8Kedh7+UUhzSHt+TE1UCn/gCZfre3GMUWT9ZJeMQJPgL1q1werYW W9AGQaY4J8IZC/MxidDmzqJIPH6qUeq/CeBEwS63O1ppw3+h8q51VPszeJ4LYWBXrll0l/8x/YEW cjy7yGb8i/LZIs29+YS13ThhlUbgMn2+4n2+kqCN/70SmZA+ofqQDTNb1alVELTsCyzEW+jl0ZXl WQZYKAh6wwcWahyx7LNmcR01QjbIXaZdtErlXCA4pg2047IR4j9eiBYRhcuL/5f+i9f3vYgqnowG xjr/CKdVlKaJfUJBxKjC8HY2SnMe5m4yYn6Y665QKX54PygI8JCSkZSt4gYR+pvw04/piccbUZdF KfQycuhDYQ67OmrmP6D8n+eL6cMZ9JyrpxYSIZ2P8pVCfppsG8KMXWBCcz4LQZ2JNFYkKKcbf9F4 7Iv6A+mEy8sZsbqFP7fNMFPUnNGOPUO9peDgM77vCC/+Jj4fwz+LYEDkJlFbDMbgmjWDpTuMAciR pUJ+Oz3AXEo/jeij/0gxQRmEOCPFod6GrehGqS0oHsJrRrQLCGlIk2q0I24aICl5cN9goiOgAYfG g80kiD6SXGYxTzRJKE0uoJ4h/9/RpeyXVnfVZJd0TUpFy7S137pp2BO5pusOpDOz7N00T/Zr//ph 2AbTmhUP/ww7nBQPnidZ+rRo7UuHUSFa/RbsFzdvs/QnwJGvuAKTRmdOod0O+uheSRjuBDoMyW From: Zhao Zhili To: ffmpeg-devel@ffmpeg.org Date: Thu, 12 May 2022 18:26:30 +0800 X-OQ-MSGID: <20220512102630.69280-1-quinkblack@foxmail.com> X-Mailer: git-send-email 2.35.3 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] avcodec/amfenc: add query_timeout option for h264/hevc 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: , Reply-To: FFmpeg development discussions and patches Cc: 21pages , Zhao Zhili 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: From: 21pages Signed-off-by: 21pages Co-authored-by: Zhao Zhili --- libavcodec/amfenc.h | 1 + libavcodec/amfenc_h264.c | 4 ++++ libavcodec/amfenc_hevc.c | 4 ++++ libavcodec/version.h | 2 +- 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/libavcodec/amfenc.h b/libavcodec/amfenc.h index 1ab98d2f78..e92120ea39 100644 --- a/libavcodec/amfenc.h +++ b/libavcodec/amfenc.h @@ -87,6 +87,7 @@ typedef struct AmfContext { int quality; int b_frame_delta_qp; int ref_b_frame_delta_qp; + int64_t query_timeout; // Dynamic options, can be set after Init() call diff --git a/libavcodec/amfenc_h264.c b/libavcodec/amfenc_h264.c index efb04589f6..ccf4aaf496 100644 --- a/libavcodec/amfenc_h264.c +++ b/libavcodec/amfenc_h264.c @@ -121,6 +121,7 @@ static const AVOption options[] = { { "aud", "Inserts AU Delimiter NAL unit", OFFSET(aud) ,AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE }, { "log_to_dbg", "Enable AMF logging to debug output", OFFSET(log_to_dbg) , AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE }, + { "query_timeout", "Timeout for QueryOutput call in ms", OFFSET(query_timeout), AV_OPT_TYPE_INT64, { .i64 = -1 }, 0, 60000, VE }, { NULL } }; @@ -155,6 +156,9 @@ static av_cold int amf_encode_init_h264(AVCodecContext *avctx) AMF_ASSIGN_PROPERTY_RATE(res, ctx->encoder, AMF_VIDEO_ENCODER_FRAMERATE, framerate); + if (ctx->query_timeout >= 0) + AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_QUERY_TIMEOUT, ctx->query_timeout); + switch (avctx->profile) { case FF_PROFILE_H264_BASELINE: profile = AMF_VIDEO_ENCODER_PROFILE_BASELINE; diff --git a/libavcodec/amfenc_hevc.c b/libavcodec/amfenc_hevc.c index 8ab9330730..864274d4ae 100644 --- a/libavcodec/amfenc_hevc.c +++ b/libavcodec/amfenc_hevc.c @@ -89,6 +89,7 @@ static const AVOption options[] = { { "aud", "Inserts AU Delimiter NAL unit", OFFSET(aud) ,AV_OPT_TYPE_BOOL,{ .i64 = 0 }, 0, 1, VE }, { "log_to_dbg", "Enable AMF logging to debug output", OFFSET(log_to_dbg), AV_OPT_TYPE_BOOL,{ .i64 = 0 }, 0, 1, VE }, + { "query_timeout", "Timeout for QueryOutput call in ms", OFFSET(query_timeout), AV_OPT_TYPE_INT64, { .i64 = -1 }, 0, 60000, VE }, { NULL } }; @@ -122,6 +123,9 @@ static av_cold int amf_encode_init_hevc(AVCodecContext *avctx) AMF_ASSIGN_PROPERTY_RATE(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_FRAMERATE, framerate); + if (ctx->query_timeout >= 0) + AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_QUERY_TIMEOUT, ctx->query_timeout); + switch (avctx->profile) { case FF_PROFILE_HEVC_MAIN: profile = AMF_VIDEO_ENCODER_HEVC_PROFILE_MAIN; diff --git a/libavcodec/version.h b/libavcodec/version.h index 87b7284a95..b564e2d849 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -30,7 +30,7 @@ #include "version_major.h" #define LIBAVCODEC_VERSION_MINOR 28 -#define LIBAVCODEC_VERSION_MICRO 100 +#define LIBAVCODEC_VERSION_MICRO 101 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ LIBAVCODEC_VERSION_MINOR, \ -- 2.35.3 _______________________________________________ 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".