Revert vcpkg ffmpeg (#8751)

* Revert "fix linux ffmpeg link, still link ffmpeg in hwcodec (#8747)"

This reverts commit 48464835f5.

* Revert "fix linux armv7 ffmpeg arch, linux x64 sciter add hwcodec feature (#8744)"

This reverts commit b68d7a3054.

* Revert "arm linux remove cuda-llvm option (#8735)"

This reverts commit bc672b3367.

* Reapply "try fix arm64 linux ci and publish error log (#8730)" (#8732)

This reverts commit e283d33f28.

* Revert "try fix arm64 linux ci and publish error log (#8730)"

This reverts commit a4565bf0da.

* Revert "F-Droid: enable hwcodec for future builds (#8726)"

This reverts commit 188f85b042.

* Revert "remove unused vcpkg ffmpeg code (#8725)"

This reverts commit 72c96f22b6.

* Revert "install ffmpeg lib with vcpkg (#8724)"

This reverts commit 0143eaf601.

* update hwcodec to reverted

Signed-off-by: 21pages <sunboeasy@gmail.com>

---------

Signed-off-by: 21pages <sunboeasy@gmail.com>
This commit is contained in:
21pages
2024-07-18 22:28:35 +08:00
committed by GitHub
parent 04c175c62e
commit 5c16a8302e
20 changed files with 15 additions and 1577 deletions

View File

@@ -1,71 +0,0 @@
From 4d0d20d96ad458cfec0444b9be0182ca6085ee0c Mon Sep 17 00:00:00 2001
From: 21pages <pages21@163.com>
Date: Sat, 24 Feb 2024 16:02:44 +0800
Subject: [PATCH 2/2] libavcodec/amfenc: reconfig when bitrate change
Signed-off-by: 21pages <pages21@163.com>
---
libavcodec/amfenc.c | 20 ++++++++++++++++++++
libavcodec/amfenc.h | 1 +
2 files changed, 21 insertions(+)
diff --git a/libavcodec/amfenc.c b/libavcodec/amfenc.c
index a033e1220e..3eab01a903 100644
--- a/libavcodec/amfenc.c
+++ b/libavcodec/amfenc.c
@@ -222,6 +222,7 @@ static int amf_init_context(AVCodecContext *avctx)
ctx->hwsurfaces_in_queue = 0;
ctx->hwsurfaces_in_queue_max = 16;
+ ctx->av_bitrate = avctx->bit_rate;
// configure AMF logger
// the return of these functions indicates old state and do not affect behaviour
@@ -575,6 +576,23 @@ static void amf_release_buffer_with_frame_ref(AMFBuffer *frame_ref_storage_buffe
frame_ref_storage_buffer->pVtbl->Release(frame_ref_storage_buffer);
}
+static int reconfig_encoder(AVCodecContext *avctx)
+{
+ AmfContext *ctx = avctx->priv_data;
+ AMF_RESULT res = AMF_OK;
+
+ if (ctx->av_bitrate != avctx->bit_rate) {
+ av_log(ctx, AV_LOG_INFO, "change bitrate from %d to %d\n", ctx->av_bitrate, avctx->bit_rate);
+ ctx->av_bitrate = avctx->bit_rate;
+ if (avctx->codec->id == AV_CODEC_ID_H264) {
+ AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_TARGET_BITRATE, avctx->bit_rate);
+ } else if (avctx->codec->id == AV_CODEC_ID_HEVC) {
+ AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_TARGET_BITRATE, avctx->bit_rate);
+ }
+ }
+ return 0;
+}
+
int ff_amf_receive_packet(AVCodecContext *avctx, AVPacket *avpkt)
{
AmfContext *ctx = avctx->priv_data;
@@ -586,6 +604,8 @@ int ff_amf_receive_packet(AVCodecContext *avctx, AVPacket *avpkt)
AVFrame *frame = ctx->delayed_frame;
int block_and_wait;
+ reconfig_encoder(avctx);
+
if (!ctx->encoder)
return AVERROR(EINVAL);
diff --git a/libavcodec/amfenc.h b/libavcodec/amfenc.h
index e92120ea39..31172645f2 100644
--- a/libavcodec/amfenc.h
+++ b/libavcodec/amfenc.h
@@ -107,6 +107,7 @@ typedef struct AmfContext {
int me_half_pel;
int me_quarter_pel;
int aud;
+ int64_t av_bitrate;
// HEVC - specific options
--
2.43.0.windows.1