Add AVPixFmtDescriptor to retrieve flags for AVPixelFormat (#154)

* 1. Adds hardware_frames_constraints to retrieve valid HWPixelFormats and SWPixelFormats for specific hardware frame configurations.

2. Implements a HardwareFramesConstraints method in hardware_device_context to obtain these constraints for a given hardware frames context.

* Add AVPixFmtDescriptor to retrieve flags for AVPixelFormat

feat(PixelFormat): Expose `AVPixFmtDescriptor` via `Descriptor()` method

This commit introduces support for `AVPixFmtDescriptor`, which provides
detailed information about an `AVPixelFormat`, including its flags.

A new `Descriptor()` method has been added to the `PixelFormat` type
(or class) to retrieve its corresponding `AVPixFmtDescriptor`. This allows
for easier access to extended properties of pixel formats.
This commit is contained in:
Maizer
2025-05-23 22:01:02 +08:00
committed by GitHub
parent b9f3da6912
commit 15c6928fe3
8 changed files with 98 additions and 0 deletions

View File

@@ -141,6 +141,15 @@ func TestPacketFlags(t *testing.T) {
require.False(t, fs.Has(PacketFlag(2)))
}
func TestPixelFormatDescriptorFlags(t *testing.T) {
fs := NewPixelFormatDescriptorFlags(PixelFormatDescriptorFlag(1))
require.True(t, fs.Has(PixelFormatDescriptorFlag(1)))
fs = fs.Add(PixelFormatDescriptorFlag(2))
require.True(t, fs.Has(PixelFormatDescriptorFlag(2)))
fs = fs.Del(PixelFormatDescriptorFlag(2))
require.False(t, fs.Has(PixelFormatDescriptorFlag(2)))
}
func TestSeekFlags(t *testing.T) {
fs := NewSeekFlags(SeekFlag(1))
require.True(t, fs.Has(SeekFlag(1)))