Refactor FFmpegNativeDecoder

This commit is contained in:
copecone committed 2026-10-09 20:24:28 +09:00
1 parent ba83935190
commit 5d805b85ad
1 file changed
+4 -1
+4 -1
View File
@@ -68,7 +68,7 @@ internal sealed unsafe class FFmpegNativeDecoder : IDisposable
/// <summary>
/// Candidate hardware device configuration discovered via <c>avcodec_get_hw_config</c>.
/// </summary>
private struct HwConfigCandidate
private record struct HwConfigCandidate
{
public AVHWDeviceType DeviceType;
public AVPixelFormat PixelFormat;
@@ -475,6 +475,7 @@ internal sealed unsafe class FFmpegNativeDecoder : IDisposable
/// <returns>True if hardware decoding was successfully configured and opened; false to fall back.</returns>
private bool TryInitializeHwDecoder(AVCodec* decoder, AVStream* stream)
{
// ReSharper disable once InconsistentNaming
// Collect all supported hardware configs from decoder
const int AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX = 0x01;
var candidates = new List<HwConfigCandidate>();
@@ -1012,6 +1013,7 @@ internal sealed unsafe class FFmpegNativeDecoder : IDisposable
/// <summary>
/// Reads the next video frame and copies its NV12 Y and interleaved UV channel data to unmanaged memory pointers.
/// </summary>
// ReSharper disable once InconsistentNaming
public bool TryReadNV12Frame(
IntPtr yBuffer, int yStride,
IntPtr uvBuffer, int uvStride,
@@ -1064,6 +1066,7 @@ internal sealed unsafe class FFmpegNativeDecoder : IDisposable
/// For native YUV420P sources, color conversion is bypassed and memory is copied directly.
/// Non-YUV420P frames (including NV12 from HW decoding) or mismatched dimensions are converted via libswscale.
/// </summary>
// ReSharper disable once InconsistentNaming
public bool TryReadYUV420PFrame(
byte* yBuffer, int yStride,
byte* uBuffer, int uStride,