Files
go-astiav/pixel_format_descriptor.go
Maizer 15c6928fe3 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.
2025-05-23 16:01:02 +02:00

27 lines
746 B
Go

package astiav
//#include <libavutil/pixdesc.h>
import "C"
// https://ffmpeg.org/doxygen/7.0/structAVPixFmtDescriptor.html
type PixelFormatDescriptor struct {
c *C.AVPixFmtDescriptor
}
func newPixelFormatDescriptorFromC(c *C.AVPixFmtDescriptor) *PixelFormatDescriptor {
if c == nil {
return nil
}
return &PixelFormatDescriptor{c: c}
}
// https://ffmpeg.org/doxygen/7.0/structAVPixFmtDescriptor.html#a10736c3f1288eb87b23ede3ffdefb435
func (pfd *PixelFormatDescriptor) Name() string {
return C.GoString(pfd.c.name)
}
// https://ffmpeg.org/doxygen/7.0/structAVPixFmtDescriptor.html#a5047d1e6b045f637345dbc305bf4357d
func (pfd *PixelFormatDescriptor) Flags() PixelFormatDescriptorFlags {
return PixelFormatDescriptorFlags(pfd.c.flags)
}