SHA256
Refactor FFmpegNativeDecoder
This commit is contained in:
1 file changed
+4
-1
@@ -68,7 +68,7 @@ internal sealed unsafe class FFmpegNativeDecoder : IDisposable
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Candidate hardware device configuration discovered via <c>avcodec_get_hw_config</c>.
|
/// Candidate hardware device configuration discovered via <c>avcodec_get_hw_config</c>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private struct HwConfigCandidate
|
private record struct HwConfigCandidate
|
||||||
{
|
{
|
||||||
public AVHWDeviceType DeviceType;
|
public AVHWDeviceType DeviceType;
|
||||||
public AVPixelFormat PixelFormat;
|
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>
|
/// <returns>True if hardware decoding was successfully configured and opened; false to fall back.</returns>
|
||||||
private bool TryInitializeHwDecoder(AVCodec* decoder, AVStream* stream)
|
private bool TryInitializeHwDecoder(AVCodec* decoder, AVStream* stream)
|
||||||
{
|
{
|
||||||
|
// ReSharper disable once InconsistentNaming
|
||||||
// Collect all supported hardware configs from decoder
|
// Collect all supported hardware configs from decoder
|
||||||
const int AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX = 0x01;
|
const int AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX = 0x01;
|
||||||
var candidates = new List<HwConfigCandidate>();
|
var candidates = new List<HwConfigCandidate>();
|
||||||
@@ -1012,6 +1013,7 @@ internal sealed unsafe class FFmpegNativeDecoder : IDisposable
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Reads the next video frame and copies its NV12 Y and interleaved UV channel data to unmanaged memory pointers.
|
/// Reads the next video frame and copies its NV12 Y and interleaved UV channel data to unmanaged memory pointers.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
// ReSharper disable once InconsistentNaming
|
||||||
public bool TryReadNV12Frame(
|
public bool TryReadNV12Frame(
|
||||||
IntPtr yBuffer, int yStride,
|
IntPtr yBuffer, int yStride,
|
||||||
IntPtr uvBuffer, int uvStride,
|
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.
|
/// 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.
|
/// Non-YUV420P frames (including NV12 from HW decoding) or mismatched dimensions are converted via libswscale.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
// ReSharper disable once InconsistentNaming
|
||||||
public bool TryReadYUV420PFrame(
|
public bool TryReadYUV420PFrame(
|
||||||
byte* yBuffer, int yStride,
|
byte* yBuffer, int yStride,
|
||||||
byte* uBuffer, int uStride,
|
byte* uBuffer, int uStride,
|
||||||
|
|||||||
Reference in new issue
Block a user