build(deps): Update to FFmpeg 8.0 branch (#4143)

This commit is contained in:
Cameron Gutman
2025-08-10 12:22:00 -05:00
committed by GitHub
parent fc7b9e30c8
commit 02036920ac
4 changed files with 24 additions and 13 deletions

View File

@@ -51,10 +51,10 @@ if(NOT DEFINED FFMPEG_PREPARED_BINARIES)
endif() endif()
set(FFMPEG_LIBRARIES set(FFMPEG_LIBRARIES
"${FFMPEG_PREPARED_BINARIES}/lib/libavcodec.a" "${FFMPEG_PREPARED_BINARIES}/lib/libavcodec.a"
"${FFMPEG_PREPARED_BINARIES}/lib/libswscale.a"
"${FFMPEG_PREPARED_BINARIES}/lib/libavutil.a" "${FFMPEG_PREPARED_BINARIES}/lib/libavutil.a"
"${FFMPEG_PREPARED_BINARIES}/lib/libcbs.a" "${FFMPEG_PREPARED_BINARIES}/lib/libcbs.a"
"${FFMPEG_PREPARED_BINARIES}/lib/libSvtAv1Enc.a" "${FFMPEG_PREPARED_BINARIES}/lib/libSvtAv1Enc.a"
"${FFMPEG_PREPARED_BINARIES}/lib/libswscale.a"
"${FFMPEG_PREPARED_BINARIES}/lib/libx264.a" "${FFMPEG_PREPARED_BINARIES}/lib/libx264.a"
"${FFMPEG_PREPARED_BINARIES}/lib/libx265.a" "${FFMPEG_PREPARED_BINARIES}/lib/libx265.a"
${HDR10_PLUS_LIBRARY} ${HDR10_PLUS_LIBRARY}
@@ -62,9 +62,9 @@ if(NOT DEFINED FFMPEG_PREPARED_BINARIES)
else() else()
set(FFMPEG_LIBRARIES set(FFMPEG_LIBRARIES
"${FFMPEG_PREPARED_BINARIES}/lib/libavcodec.a" "${FFMPEG_PREPARED_BINARIES}/lib/libavcodec.a"
"${FFMPEG_PREPARED_BINARIES}/lib/libswscale.a"
"${FFMPEG_PREPARED_BINARIES}/lib/libavutil.a" "${FFMPEG_PREPARED_BINARIES}/lib/libavutil.a"
"${FFMPEG_PREPARED_BINARIES}/lib/libcbs.a" "${FFMPEG_PREPARED_BINARIES}/lib/libcbs.a"
"${FFMPEG_PREPARED_BINARIES}/lib/libswscale.a"
${FFMPEG_PLATFORM_LIBRARIES}) ${FFMPEG_PLATFORM_LIBRARIES})
endif() endif()

View File

@@ -191,7 +191,7 @@ namespace va {
return VAProfileH264High; return VAProfileH264High;
} else if (ctx->codec_id == AV_CODEC_ID_HEVC) { } else if (ctx->codec_id == AV_CODEC_ID_HEVC) {
switch (ctx->profile) { switch (ctx->profile) {
case FF_PROFILE_HEVC_REXT: case AV_PROFILE_HEVC_REXT:
switch (av_pix_fmt_desc_get(ctx->sw_pix_fmt)->comp[0].depth) { switch (av_pix_fmt_desc_get(ctx->sw_pix_fmt)->comp[0].depth) {
case 10: case 10:
return VAProfileHEVCMain444_10; return VAProfileHEVCMain444_10;
@@ -199,16 +199,16 @@ namespace va {
return VAProfileHEVCMain444; return VAProfileHEVCMain444;
} }
break; break;
case FF_PROFILE_HEVC_MAIN_10: case AV_PROFILE_HEVC_MAIN_10:
return VAProfileHEVCMain10; return VAProfileHEVCMain10;
case FF_PROFILE_HEVC_MAIN: case AV_PROFILE_HEVC_MAIN:
return VAProfileHEVCMain; return VAProfileHEVCMain;
} }
} else if (ctx->codec_id == AV_CODEC_ID_AV1) { } else if (ctx->codec_id == AV_CODEC_ID_AV1) {
switch (ctx->profile) { switch (ctx->profile) {
case FF_PROFILE_AV1_HIGH: case AV_PROFILE_AV1_HIGH:
return VAProfileAV1Profile1; return VAProfileAV1Profile1;
case FF_PROFILE_AV1_MAIN: case AV_PROFILE_AV1_MAIN:
return VAProfileAV1Profile0; return VAProfileAV1Profile0;
} }
} }

View File

@@ -315,6 +315,12 @@ namespace video {
avcodec_encode_session_t(avcodec_encode_session_t &&other) noexcept = default; avcodec_encode_session_t(avcodec_encode_session_t &&other) noexcept = default;
~avcodec_encode_session_t() { ~avcodec_encode_session_t() {
// Flush any remaining frames in the encoder
if (avcodec_send_frame(avcodec_ctx.get(), nullptr) == 0) {
packet_raw_avcodec pkt;
while (avcodec_receive_packet(avcodec_ctx.get(), pkt.av_packet) == 0);
}
// Order matters here because the context relies on the hwdevice still being valid // Order matters here because the context relies on the hwdevice still being valid
avcodec_ctx.reset(); avcodec_ctx.reset();
device.reset(); device.reset();
@@ -536,7 +542,7 @@ namespace video {
{"forced-idr"s, 1}, {"forced-idr"s, 1},
{"zerolatency"s, 1}, {"zerolatency"s, 1},
{"surfaces"s, 1}, {"surfaces"s, 1},
{"filler_data"s, false}, {"cbr_padding"s, false},
{"preset"s, &config::video.nv_legacy.preset}, {"preset"s, &config::video.nv_legacy.preset},
{"tune"s, NV_ENC_TUNING_INFO_ULTRA_LOW_LATENCY}, {"tune"s, NV_ENC_TUNING_INFO_ULTRA_LOW_LATENCY},
{"rc"s, NV_ENC_PARAMS_RC_CBR}, {"rc"s, NV_ENC_PARAMS_RC_CBR},
@@ -557,6 +563,7 @@ namespace video {
{"forced-idr"s, 1}, {"forced-idr"s, 1},
{"zerolatency"s, 1}, {"zerolatency"s, 1},
{"surfaces"s, 1}, {"surfaces"s, 1},
{"cbr_padding"s, false},
{"preset"s, &config::video.nv_legacy.preset}, {"preset"s, &config::video.nv_legacy.preset},
{"tune"s, NV_ENC_TUNING_INFO_ULTRA_LOW_LATENCY}, {"tune"s, NV_ENC_TUNING_INFO_ULTRA_LOW_LATENCY},
{"rc"s, NV_ENC_PARAMS_RC_CBR}, {"rc"s, NV_ENC_PARAMS_RC_CBR},
@@ -582,6 +589,7 @@ namespace video {
{"forced-idr"s, 1}, {"forced-idr"s, 1},
{"zerolatency"s, 1}, {"zerolatency"s, 1},
{"surfaces"s, 1}, {"surfaces"s, 1},
{"cbr_padding"s, false},
{"preset"s, &config::video.nv_legacy.preset}, {"preset"s, &config::video.nv_legacy.preset},
{"tune"s, NV_ENC_TUNING_INFO_ULTRA_LOW_LATENCY}, {"tune"s, NV_ENC_TUNING_INFO_ULTRA_LOW_LATENCY},
{"rc"s, NV_ENC_PARAMS_RC_CBR}, {"rc"s, NV_ENC_PARAMS_RC_CBR},
@@ -730,6 +738,7 @@ namespace video {
{"filler_data"s, false}, {"filler_data"s, false},
{"forced_idr"s, 1}, {"forced_idr"s, 1},
{"latency"s, "lowest_latency"s}, {"latency"s, "lowest_latency"s},
{"async_depth"s, 1},
{"skip_frame"s, 0}, {"skip_frame"s, 0},
{"log_to_dbg"s, []() { {"log_to_dbg"s, []() {
return config::sunshine.min_log_level < 2 ? 1 : 0; return config::sunshine.min_log_level < 2 ? 1 : 0;
@@ -753,6 +762,7 @@ namespace video {
{"filler_data"s, false}, {"filler_data"s, false},
{"forced_idr"s, 1}, {"forced_idr"s, 1},
{"latency"s, 1}, {"latency"s, 1},
{"async_depth"s, 1},
{"skip_frame"s, 0}, {"skip_frame"s, 0},
{"log_to_dbg"s, []() { {"log_to_dbg"s, []() {
return config::sunshine.min_log_level < 2 ? 1 : 0; return config::sunshine.min_log_level < 2 ? 1 : 0;
@@ -791,6 +801,7 @@ namespace video {
{"filler_data"s, false}, {"filler_data"s, false},
{"forced_idr"s, 1}, {"forced_idr"s, 1},
{"latency"s, 1}, {"latency"s, 1},
{"async_depth"s, 1},
{"frame_skipping"s, 0}, {"frame_skipping"s, 0},
{"log_to_dbg"s, []() { {"log_to_dbg"s, []() {
return config::sunshine.min_log_level < 2 ? 1 : 0; return config::sunshine.min_log_level < 2 ? 1 : 0;
@@ -1526,22 +1537,22 @@ namespace video {
case 0: case 0:
// 10-bit h264 encoding is not supported by our streaming protocol // 10-bit h264 encoding is not supported by our streaming protocol
assert(!config.dynamicRange); assert(!config.dynamicRange);
ctx->profile = (config.chromaSamplingType == 1) ? FF_PROFILE_H264_HIGH_444_PREDICTIVE : FF_PROFILE_H264_HIGH; ctx->profile = (config.chromaSamplingType == 1) ? AV_PROFILE_H264_HIGH_444_PREDICTIVE : AV_PROFILE_H264_HIGH;
break; break;
case 1: case 1:
if (config.chromaSamplingType == 1) { if (config.chromaSamplingType == 1) {
// HEVC uses the same RExt profile for both 8 and 10 bit YUV 4:4:4 encoding // HEVC uses the same RExt profile for both 8 and 10 bit YUV 4:4:4 encoding
ctx->profile = FF_PROFILE_HEVC_REXT; ctx->profile = AV_PROFILE_HEVC_REXT;
} else { } else {
ctx->profile = config.dynamicRange ? FF_PROFILE_HEVC_MAIN_10 : FF_PROFILE_HEVC_MAIN; ctx->profile = config.dynamicRange ? AV_PROFILE_HEVC_MAIN_10 : AV_PROFILE_HEVC_MAIN;
} }
break; break;
case 2: case 2:
// AV1 supports both 8 and 10 bit encoding with the same Main profile // AV1 supports both 8 and 10 bit encoding with the same Main profile
// but YUV 4:4:4 sampling requires High profile // but YUV 4:4:4 sampling requires High profile
ctx->profile = (config.chromaSamplingType == 1) ? FF_PROFILE_AV1_HIGH : FF_PROFILE_AV1_MAIN; ctx->profile = (config.chromaSamplingType == 1) ? AV_PROFILE_AV1_HIGH : AV_PROFILE_AV1_MAIN;
break; break;
} }