~emersion/go-kdf

79a7724854a503bb8530d73ea3c3232208e93bd1 — Simon Ser 1 year, 4 months ago 5e3a93a
ffmpeg: add format list
3 files changed, 987 insertions(+), 0 deletions(-)

A ffmpeg/ffmpeg.go
A ffmpeg/formats.go
A ffmpeg/gen_formats.go
A ffmpeg/ffmpeg.go => ffmpeg/ffmpeg.go +17 -0
@@ 0,0 1,17 @@
package ffmpeg

//go:generate go run ./gen_formats.go

import (
	"git.sr.ht/~emersion/go-kdf"
)

type Format int

const FormatNone Format = -1

var FormatTable map[string]Format = formatTable

func GetBlock(format Format) *kdf.Block {
	return nil
}

A ffmpeg/formats.go => ffmpeg/formats.go +843 -0
@@ 0,0 1,843 @@
// Generated by gen_formats.go - DO NOT EDIT
// libavutil 57.28.100

package ffmpeg

const (
	FormatYUV420P Format = iota
	FormatYUYV422
	FormatRGB24
	FormatBGR24
	FormatYUV422P
	FormatYUV444P
	FormatYUV410P
	FormatYUV411P
	FormatGRAY8
	FormatMONOWHITE
	FormatMONOBLACK
	FormatPAL8
	FormatYUVJ420P
	FormatYUVJ422P
	FormatYUVJ444P
	FormatUYVY422
	FormatUYYVYY411
	FormatBGR8
	FormatBGR4
	FormatBGR4_BYTE
	FormatRGB8
	FormatRGB4
	FormatRGB4_BYTE
	FormatNV12
	FormatNV21
	FormatARGB
	FormatRGBA
	FormatABGR
	FormatBGRA
	FormatGRAY16BE
	FormatGRAY16LE
	FormatYUV440P
	FormatYUVJ440P
	FormatYUVA420P
	FormatRGB48BE
	FormatRGB48LE
	FormatRGB565BE
	FormatRGB565LE
	FormatRGB555BE
	FormatRGB555LE
	FormatBGR565BE
	FormatBGR565LE
	FormatBGR555BE
	FormatBGR555LE
	FormatVAAPI
	FormatYUV420P16LE
	FormatYUV420P16BE
	FormatYUV422P16LE
	FormatYUV422P16BE
	FormatYUV444P16LE
	FormatYUV444P16BE
	FormatDXVA2_VLD
	FormatRGB444LE
	FormatRGB444BE
	FormatBGR444LE
	FormatBGR444BE
	FormatYA8
	FormatBGR48BE
	FormatBGR48LE
	FormatYUV420P9BE
	FormatYUV420P9LE
	FormatYUV420P10BE
	FormatYUV420P10LE
	FormatYUV422P10BE
	FormatYUV422P10LE
	FormatYUV444P9BE
	FormatYUV444P9LE
	FormatYUV444P10BE
	FormatYUV444P10LE
	FormatYUV422P9BE
	FormatYUV422P9LE
	FormatGBRP
	FormatGBRP9BE
	FormatGBRP9LE
	FormatGBRP10BE
	FormatGBRP10LE
	FormatGBRP16BE
	FormatGBRP16LE
	FormatYUVA422P
	FormatYUVA444P
	FormatYUVA420P9BE
	FormatYUVA420P9LE
	FormatYUVA422P9BE
	FormatYUVA422P9LE
	FormatYUVA444P9BE
	FormatYUVA444P9LE
	FormatYUVA420P10BE
	FormatYUVA420P10LE
	FormatYUVA422P10BE
	FormatYUVA422P10LE
	FormatYUVA444P10BE
	FormatYUVA444P10LE
	FormatYUVA420P16BE
	FormatYUVA420P16LE
	FormatYUVA422P16BE
	FormatYUVA422P16LE
	FormatYUVA444P16BE
	FormatYUVA444P16LE
	FormatVDPAU
	FormatXYZ12LE
	FormatXYZ12BE
	FormatNV16
	FormatNV20LE
	FormatNV20BE
	FormatRGBA64BE
	FormatRGBA64LE
	FormatBGRA64BE
	FormatBGRA64LE
	FormatYVYU422
	FormatYA16BE
	FormatYA16LE
	FormatGBRAP
	FormatGBRAP16BE
	FormatGBRAP16LE
	FormatQSV
	FormatMMAL
	FormatD3D11VA_VLD
	FormatCUDA
	Format0RGB
	FormatRGB0
	Format0BGR
	FormatBGR0
	FormatYUV420P12BE
	FormatYUV420P12LE
	FormatYUV420P14BE
	FormatYUV420P14LE
	FormatYUV422P12BE
	FormatYUV422P12LE
	FormatYUV422P14BE
	FormatYUV422P14LE
	FormatYUV444P12BE
	FormatYUV444P12LE
	FormatYUV444P14BE
	FormatYUV444P14LE
	FormatGBRP12BE
	FormatGBRP12LE
	FormatGBRP14BE
	FormatGBRP14LE
	FormatYUVJ411P
	FormatBAYER_BGGR8
	FormatBAYER_RGGB8
	FormatBAYER_GBRG8
	FormatBAYER_GRBG8
	FormatBAYER_BGGR16LE
	FormatBAYER_BGGR16BE
	FormatBAYER_RGGB16LE
	FormatBAYER_RGGB16BE
	FormatBAYER_GBRG16LE
	FormatBAYER_GBRG16BE
	FormatBAYER_GRBG16LE
	FormatBAYER_GRBG16BE
	FormatXVMC
	FormatYUV440P10LE
	FormatYUV440P10BE
	FormatYUV440P12LE
	FormatYUV440P12BE
	FormatAYUV64LE
	FormatAYUV64BE
	FormatVIDEOTOOLBOX
	FormatP010LE
	FormatP010BE
	FormatGBRAP12BE
	FormatGBRAP12LE
	FormatGBRAP10BE
	FormatGBRAP10LE
	FormatMEDIACODEC
	FormatGRAY12BE
	FormatGRAY12LE
	FormatGRAY10BE
	FormatGRAY10LE
	FormatP016LE
	FormatP016BE
	FormatD3D11
	FormatGRAY9BE
	FormatGRAY9LE
	FormatGBRPF32BE
	FormatGBRPF32LE
	FormatGBRAPF32BE
	FormatGBRAPF32LE
	FormatDRM_PRIME
	FormatOPENCL
	FormatGRAY14BE
	FormatGRAY14LE
	FormatGRAYF32BE
	FormatGRAYF32LE
	FormatYUVA422P12BE
	FormatYUVA422P12LE
	FormatYUVA444P12BE
	FormatYUVA444P12LE
	FormatNV24
	FormatNV42
	FormatVULKAN
	FormatY210BE
	FormatY210LE
	FormatX2RGB10LE
	FormatX2RGB10BE
	FormatX2BGR10LE
	FormatX2BGR10BE
	FormatP210BE
	FormatP210LE
	FormatP410BE
	FormatP410LE
	FormatP216BE
	FormatP216LE
	FormatP416BE
	FormatP416LE
)

var formatTable = map[string]Format{
	"0BGR":           Format0BGR,
	"0RGB":           Format0RGB,
	"ABGR":           FormatABGR,
	"ARGB":           FormatARGB,
	"AYUV64BE":       FormatAYUV64BE,
	"AYUV64LE":       FormatAYUV64LE,
	"BAYER_BGGR16BE": FormatBAYER_BGGR16BE,
	"BAYER_BGGR16LE": FormatBAYER_BGGR16LE,
	"BAYER_BGGR8":    FormatBAYER_BGGR8,
	"BAYER_GBRG16BE": FormatBAYER_GBRG16BE,
	"BAYER_GBRG16LE": FormatBAYER_GBRG16LE,
	"BAYER_GBRG8":    FormatBAYER_GBRG8,
	"BAYER_GRBG16BE": FormatBAYER_GRBG16BE,
	"BAYER_GRBG16LE": FormatBAYER_GRBG16LE,
	"BAYER_GRBG8":    FormatBAYER_GRBG8,
	"BAYER_RGGB16BE": FormatBAYER_RGGB16BE,
	"BAYER_RGGB16LE": FormatBAYER_RGGB16LE,
	"BAYER_RGGB8":    FormatBAYER_RGGB8,
	"BGR0":           FormatBGR0,
	"BGR24":          FormatBGR24,
	"BGR4":           FormatBGR4,
	"BGR444BE":       FormatBGR444BE,
	"BGR444LE":       FormatBGR444LE,
	"BGR48BE":        FormatBGR48BE,
	"BGR48LE":        FormatBGR48LE,
	"BGR4_BYTE":      FormatBGR4_BYTE,
	"BGR555BE":       FormatBGR555BE,
	"BGR555LE":       FormatBGR555LE,
	"BGR565BE":       FormatBGR565BE,
	"BGR565LE":       FormatBGR565LE,
	"BGR8":           FormatBGR8,
	"BGRA":           FormatBGRA,
	"BGRA64BE":       FormatBGRA64BE,
	"BGRA64LE":       FormatBGRA64LE,
	"CUDA":           FormatCUDA,
	"D3D11":          FormatD3D11,
	"D3D11VA_VLD":    FormatD3D11VA_VLD,
	"DRM_PRIME":      FormatDRM_PRIME,
	"DXVA2_VLD":      FormatDXVA2_VLD,
	"GBRAP":          FormatGBRAP,
	"GBRAP10BE":      FormatGBRAP10BE,
	"GBRAP10LE":      FormatGBRAP10LE,
	"GBRAP12BE":      FormatGBRAP12BE,
	"GBRAP12LE":      FormatGBRAP12LE,
	"GBRAP16BE":      FormatGBRAP16BE,
	"GBRAP16LE":      FormatGBRAP16LE,
	"GBRAPF32BE":     FormatGBRAPF32BE,
	"GBRAPF32LE":     FormatGBRAPF32LE,
	"GBRP":           FormatGBRP,
	"GBRP10BE":       FormatGBRP10BE,
	"GBRP10LE":       FormatGBRP10LE,
	"GBRP12BE":       FormatGBRP12BE,
	"GBRP12LE":       FormatGBRP12LE,
	"GBRP14BE":       FormatGBRP14BE,
	"GBRP14LE":       FormatGBRP14LE,
	"GBRP16BE":       FormatGBRP16BE,
	"GBRP16LE":       FormatGBRP16LE,
	"GBRP9BE":        FormatGBRP9BE,
	"GBRP9LE":        FormatGBRP9LE,
	"GBRPF32BE":      FormatGBRPF32BE,
	"GBRPF32LE":      FormatGBRPF32LE,
	"GRAY10BE":       FormatGRAY10BE,
	"GRAY10LE":       FormatGRAY10LE,
	"GRAY12BE":       FormatGRAY12BE,
	"GRAY12LE":       FormatGRAY12LE,
	"GRAY14BE":       FormatGRAY14BE,
	"GRAY14LE":       FormatGRAY14LE,
	"GRAY16BE":       FormatGRAY16BE,
	"GRAY16LE":       FormatGRAY16LE,
	"GRAY8":          FormatGRAY8,
	"GRAY9BE":        FormatGRAY9BE,
	"GRAY9LE":        FormatGRAY9LE,
	"GRAYF32BE":      FormatGRAYF32BE,
	"GRAYF32LE":      FormatGRAYF32LE,
	"MEDIACODEC":     FormatMEDIACODEC,
	"MMAL":           FormatMMAL,
	"MONOBLACK":      FormatMONOBLACK,
	"MONOWHITE":      FormatMONOWHITE,
	"NV12":           FormatNV12,
	"NV16":           FormatNV16,
	"NV20BE":         FormatNV20BE,
	"NV20LE":         FormatNV20LE,
	"NV21":           FormatNV21,
	"NV24":           FormatNV24,
	"NV42":           FormatNV42,
	"OPENCL":         FormatOPENCL,
	"P010BE":         FormatP010BE,
	"P010LE":         FormatP010LE,
	"P016BE":         FormatP016BE,
	"P016LE":         FormatP016LE,
	"P210BE":         FormatP210BE,
	"P210LE":         FormatP210LE,
	"P216BE":         FormatP216BE,
	"P216LE":         FormatP216LE,
	"P410BE":         FormatP410BE,
	"P410LE":         FormatP410LE,
	"P416BE":         FormatP416BE,
	"P416LE":         FormatP416LE,
	"PAL8":           FormatPAL8,
	"QSV":            FormatQSV,
	"RGB0":           FormatRGB0,
	"RGB24":          FormatRGB24,
	"RGB4":           FormatRGB4,
	"RGB444BE":       FormatRGB444BE,
	"RGB444LE":       FormatRGB444LE,
	"RGB48BE":        FormatRGB48BE,
	"RGB48LE":        FormatRGB48LE,
	"RGB4_BYTE":      FormatRGB4_BYTE,
	"RGB555BE":       FormatRGB555BE,
	"RGB555LE":       FormatRGB555LE,
	"RGB565BE":       FormatRGB565BE,
	"RGB565LE":       FormatRGB565LE,
	"RGB8":           FormatRGB8,
	"RGBA":           FormatRGBA,
	"RGBA64BE":       FormatRGBA64BE,
	"RGBA64LE":       FormatRGBA64LE,
	"UYVY422":        FormatUYVY422,
	"UYYVYY411":      FormatUYYVYY411,
	"VAAPI":          FormatVAAPI,
	"VDPAU":          FormatVDPAU,
	"VIDEOTOOLBOX":   FormatVIDEOTOOLBOX,
	"VULKAN":         FormatVULKAN,
	"X2BGR10BE":      FormatX2BGR10BE,
	"X2BGR10LE":      FormatX2BGR10LE,
	"X2RGB10BE":      FormatX2RGB10BE,
	"X2RGB10LE":      FormatX2RGB10LE,
	"XVMC":           FormatXVMC,
	"XYZ12BE":        FormatXYZ12BE,
	"XYZ12LE":        FormatXYZ12LE,
	"Y210BE":         FormatY210BE,
	"Y210LE":         FormatY210LE,
	"YA16BE":         FormatYA16BE,
	"YA16LE":         FormatYA16LE,
	"YA8":            FormatYA8,
	"YUV410P":        FormatYUV410P,
	"YUV411P":        FormatYUV411P,
	"YUV420P":        FormatYUV420P,
	"YUV420P10BE":    FormatYUV420P10BE,
	"YUV420P10LE":    FormatYUV420P10LE,
	"YUV420P12BE":    FormatYUV420P12BE,
	"YUV420P12LE":    FormatYUV420P12LE,
	"YUV420P14BE":    FormatYUV420P14BE,
	"YUV420P14LE":    FormatYUV420P14LE,
	"YUV420P16BE":    FormatYUV420P16BE,
	"YUV420P16LE":    FormatYUV420P16LE,
	"YUV420P9BE":     FormatYUV420P9BE,
	"YUV420P9LE":     FormatYUV420P9LE,
	"YUV422P":        FormatYUV422P,
	"YUV422P10BE":    FormatYUV422P10BE,
	"YUV422P10LE":    FormatYUV422P10LE,
	"YUV422P12BE":    FormatYUV422P12BE,
	"YUV422P12LE":    FormatYUV422P12LE,
	"YUV422P14BE":    FormatYUV422P14BE,
	"YUV422P14LE":    FormatYUV422P14LE,
	"YUV422P16BE":    FormatYUV422P16BE,
	"YUV422P16LE":    FormatYUV422P16LE,
	"YUV422P9BE":     FormatYUV422P9BE,
	"YUV422P9LE":     FormatYUV422P9LE,
	"YUV440P":        FormatYUV440P,
	"YUV440P10BE":    FormatYUV440P10BE,
	"YUV440P10LE":    FormatYUV440P10LE,
	"YUV440P12BE":    FormatYUV440P12BE,
	"YUV440P12LE":    FormatYUV440P12LE,
	"YUV444P":        FormatYUV444P,
	"YUV444P10BE":    FormatYUV444P10BE,
	"YUV444P10LE":    FormatYUV444P10LE,
	"YUV444P12BE":    FormatYUV444P12BE,
	"YUV444P12LE":    FormatYUV444P12LE,
	"YUV444P14BE":    FormatYUV444P14BE,
	"YUV444P14LE":    FormatYUV444P14LE,
	"YUV444P16BE":    FormatYUV444P16BE,
	"YUV444P16LE":    FormatYUV444P16LE,
	"YUV444P9BE":     FormatYUV444P9BE,
	"YUV444P9LE":     FormatYUV444P9LE,
	"YUVA420P":       FormatYUVA420P,
	"YUVA420P10BE":   FormatYUVA420P10BE,
	"YUVA420P10LE":   FormatYUVA420P10LE,
	"YUVA420P16BE":   FormatYUVA420P16BE,
	"YUVA420P16LE":   FormatYUVA420P16LE,
	"YUVA420P9BE":    FormatYUVA420P9BE,
	"YUVA420P9LE":    FormatYUVA420P9LE,
	"YUVA422P":       FormatYUVA422P,
	"YUVA422P10BE":   FormatYUVA422P10BE,
	"YUVA422P10LE":   FormatYUVA422P10LE,
	"YUVA422P12BE":   FormatYUVA422P12BE,
	"YUVA422P12LE":   FormatYUVA422P12LE,
	"YUVA422P16BE":   FormatYUVA422P16BE,
	"YUVA422P16LE":   FormatYUVA422P16LE,
	"YUVA422P9BE":    FormatYUVA422P9BE,
	"YUVA422P9LE":    FormatYUVA422P9LE,
	"YUVA444P":       FormatYUVA444P,
	"YUVA444P10BE":   FormatYUVA444P10BE,
	"YUVA444P10LE":   FormatYUVA444P10LE,
	"YUVA444P12BE":   FormatYUVA444P12BE,
	"YUVA444P12LE":   FormatYUVA444P12LE,
	"YUVA444P16BE":   FormatYUVA444P16BE,
	"YUVA444P16LE":   FormatYUVA444P16LE,
	"YUVA444P9BE":    FormatYUVA444P9BE,
	"YUVA444P9LE":    FormatYUVA444P9LE,
	"YUVJ411P":       FormatYUVJ411P,
	"YUVJ420P":       FormatYUVJ420P,
	"YUVJ422P":       FormatYUVJ422P,
	"YUVJ440P":       FormatYUVJ440P,
	"YUVJ444P":       FormatYUVJ444P,
	"YUYV422":        FormatYUYV422,
	"YVYU422":        FormatYVYU422,
}

func (format Format) String() string {
	switch format {
	case FormatNone:
		return "NONE"
	case FormatYUV420P:
		return "YUV420P"
	case FormatYUYV422:
		return "YUYV422"
	case FormatRGB24:
		return "RGB24"
	case FormatBGR24:
		return "BGR24"
	case FormatYUV422P:
		return "YUV422P"
	case FormatYUV444P:
		return "YUV444P"
	case FormatYUV410P:
		return "YUV410P"
	case FormatYUV411P:
		return "YUV411P"
	case FormatGRAY8:
		return "GRAY8"
	case FormatMONOWHITE:
		return "MONOWHITE"
	case FormatMONOBLACK:
		return "MONOBLACK"
	case FormatPAL8:
		return "PAL8"
	case FormatYUVJ420P:
		return "YUVJ420P"
	case FormatYUVJ422P:
		return "YUVJ422P"
	case FormatYUVJ444P:
		return "YUVJ444P"
	case FormatUYVY422:
		return "UYVY422"
	case FormatUYYVYY411:
		return "UYYVYY411"
	case FormatBGR8:
		return "BGR8"
	case FormatBGR4:
		return "BGR4"
	case FormatBGR4_BYTE:
		return "BGR4_BYTE"
	case FormatRGB8:
		return "RGB8"
	case FormatRGB4:
		return "RGB4"
	case FormatRGB4_BYTE:
		return "RGB4_BYTE"
	case FormatNV12:
		return "NV12"
	case FormatNV21:
		return "NV21"
	case FormatARGB:
		return "ARGB"
	case FormatRGBA:
		return "RGBA"
	case FormatABGR:
		return "ABGR"
	case FormatBGRA:
		return "BGRA"
	case FormatGRAY16BE:
		return "GRAY16BE"
	case FormatGRAY16LE:
		return "GRAY16LE"
	case FormatYUV440P:
		return "YUV440P"
	case FormatYUVJ440P:
		return "YUVJ440P"
	case FormatYUVA420P:
		return "YUVA420P"
	case FormatRGB48BE:
		return "RGB48BE"
	case FormatRGB48LE:
		return "RGB48LE"
	case FormatRGB565BE:
		return "RGB565BE"
	case FormatRGB565LE:
		return "RGB565LE"
	case FormatRGB555BE:
		return "RGB555BE"
	case FormatRGB555LE:
		return "RGB555LE"
	case FormatBGR565BE:
		return "BGR565BE"
	case FormatBGR565LE:
		return "BGR565LE"
	case FormatBGR555BE:
		return "BGR555BE"
	case FormatBGR555LE:
		return "BGR555LE"
	case FormatVAAPI:
		return "VAAPI"
	case FormatYUV420P16LE:
		return "YUV420P16LE"
	case FormatYUV420P16BE:
		return "YUV420P16BE"
	case FormatYUV422P16LE:
		return "YUV422P16LE"
	case FormatYUV422P16BE:
		return "YUV422P16BE"
	case FormatYUV444P16LE:
		return "YUV444P16LE"
	case FormatYUV444P16BE:
		return "YUV444P16BE"
	case FormatDXVA2_VLD:
		return "DXVA2_VLD"
	case FormatRGB444LE:
		return "RGB444LE"
	case FormatRGB444BE:
		return "RGB444BE"
	case FormatBGR444LE:
		return "BGR444LE"
	case FormatBGR444BE:
		return "BGR444BE"
	case FormatYA8:
		return "YA8"
	case FormatBGR48BE:
		return "BGR48BE"
	case FormatBGR48LE:
		return "BGR48LE"
	case FormatYUV420P9BE:
		return "YUV420P9BE"
	case FormatYUV420P9LE:
		return "YUV420P9LE"
	case FormatYUV420P10BE:
		return "YUV420P10BE"
	case FormatYUV420P10LE:
		return "YUV420P10LE"
	case FormatYUV422P10BE:
		return "YUV422P10BE"
	case FormatYUV422P10LE:
		return "YUV422P10LE"
	case FormatYUV444P9BE:
		return "YUV444P9BE"
	case FormatYUV444P9LE:
		return "YUV444P9LE"
	case FormatYUV444P10BE:
		return "YUV444P10BE"
	case FormatYUV444P10LE:
		return "YUV444P10LE"
	case FormatYUV422P9BE:
		return "YUV422P9BE"
	case FormatYUV422P9LE:
		return "YUV422P9LE"
	case FormatGBRP:
		return "GBRP"
	case FormatGBRP9BE:
		return "GBRP9BE"
	case FormatGBRP9LE:
		return "GBRP9LE"
	case FormatGBRP10BE:
		return "GBRP10BE"
	case FormatGBRP10LE:
		return "GBRP10LE"
	case FormatGBRP16BE:
		return "GBRP16BE"
	case FormatGBRP16LE:
		return "GBRP16LE"
	case FormatYUVA422P:
		return "YUVA422P"
	case FormatYUVA444P:
		return "YUVA444P"
	case FormatYUVA420P9BE:
		return "YUVA420P9BE"
	case FormatYUVA420P9LE:
		return "YUVA420P9LE"
	case FormatYUVA422P9BE:
		return "YUVA422P9BE"
	case FormatYUVA422P9LE:
		return "YUVA422P9LE"
	case FormatYUVA444P9BE:
		return "YUVA444P9BE"
	case FormatYUVA444P9LE:
		return "YUVA444P9LE"
	case FormatYUVA420P10BE:
		return "YUVA420P10BE"
	case FormatYUVA420P10LE:
		return "YUVA420P10LE"
	case FormatYUVA422P10BE:
		return "YUVA422P10BE"
	case FormatYUVA422P10LE:
		return "YUVA422P10LE"
	case FormatYUVA444P10BE:
		return "YUVA444P10BE"
	case FormatYUVA444P10LE:
		return "YUVA444P10LE"
	case FormatYUVA420P16BE:
		return "YUVA420P16BE"
	case FormatYUVA420P16LE:
		return "YUVA420P16LE"
	case FormatYUVA422P16BE:
		return "YUVA422P16BE"
	case FormatYUVA422P16LE:
		return "YUVA422P16LE"
	case FormatYUVA444P16BE:
		return "YUVA444P16BE"
	case FormatYUVA444P16LE:
		return "YUVA444P16LE"
	case FormatVDPAU:
		return "VDPAU"
	case FormatXYZ12LE:
		return "XYZ12LE"
	case FormatXYZ12BE:
		return "XYZ12BE"
	case FormatNV16:
		return "NV16"
	case FormatNV20LE:
		return "NV20LE"
	case FormatNV20BE:
		return "NV20BE"
	case FormatRGBA64BE:
		return "RGBA64BE"
	case FormatRGBA64LE:
		return "RGBA64LE"
	case FormatBGRA64BE:
		return "BGRA64BE"
	case FormatBGRA64LE:
		return "BGRA64LE"
	case FormatYVYU422:
		return "YVYU422"
	case FormatYA16BE:
		return "YA16BE"
	case FormatYA16LE:
		return "YA16LE"
	case FormatGBRAP:
		return "GBRAP"
	case FormatGBRAP16BE:
		return "GBRAP16BE"
	case FormatGBRAP16LE:
		return "GBRAP16LE"
	case FormatQSV:
		return "QSV"
	case FormatMMAL:
		return "MMAL"
	case FormatD3D11VA_VLD:
		return "D3D11VA_VLD"
	case FormatCUDA:
		return "CUDA"
	case Format0RGB:
		return "0RGB"
	case FormatRGB0:
		return "RGB0"
	case Format0BGR:
		return "0BGR"
	case FormatBGR0:
		return "BGR0"
	case FormatYUV420P12BE:
		return "YUV420P12BE"
	case FormatYUV420P12LE:
		return "YUV420P12LE"
	case FormatYUV420P14BE:
		return "YUV420P14BE"
	case FormatYUV420P14LE:
		return "YUV420P14LE"
	case FormatYUV422P12BE:
		return "YUV422P12BE"
	case FormatYUV422P12LE:
		return "YUV422P12LE"
	case FormatYUV422P14BE:
		return "YUV422P14BE"
	case FormatYUV422P14LE:
		return "YUV422P14LE"
	case FormatYUV444P12BE:
		return "YUV444P12BE"
	case FormatYUV444P12LE:
		return "YUV444P12LE"
	case FormatYUV444P14BE:
		return "YUV444P14BE"
	case FormatYUV444P14LE:
		return "YUV444P14LE"
	case FormatGBRP12BE:
		return "GBRP12BE"
	case FormatGBRP12LE:
		return "GBRP12LE"
	case FormatGBRP14BE:
		return "GBRP14BE"
	case FormatGBRP14LE:
		return "GBRP14LE"
	case FormatYUVJ411P:
		return "YUVJ411P"
	case FormatBAYER_BGGR8:
		return "BAYER_BGGR8"
	case FormatBAYER_RGGB8:
		return "BAYER_RGGB8"
	case FormatBAYER_GBRG8:
		return "BAYER_GBRG8"
	case FormatBAYER_GRBG8:
		return "BAYER_GRBG8"
	case FormatBAYER_BGGR16LE:
		return "BAYER_BGGR16LE"
	case FormatBAYER_BGGR16BE:
		return "BAYER_BGGR16BE"
	case FormatBAYER_RGGB16LE:
		return "BAYER_RGGB16LE"
	case FormatBAYER_RGGB16BE:
		return "BAYER_RGGB16BE"
	case FormatBAYER_GBRG16LE:
		return "BAYER_GBRG16LE"
	case FormatBAYER_GBRG16BE:
		return "BAYER_GBRG16BE"
	case FormatBAYER_GRBG16LE:
		return "BAYER_GRBG16LE"
	case FormatBAYER_GRBG16BE:
		return "BAYER_GRBG16BE"
	case FormatXVMC:
		return "XVMC"
	case FormatYUV440P10LE:
		return "YUV440P10LE"
	case FormatYUV440P10BE:
		return "YUV440P10BE"
	case FormatYUV440P12LE:
		return "YUV440P12LE"
	case FormatYUV440P12BE:
		return "YUV440P12BE"
	case FormatAYUV64LE:
		return "AYUV64LE"
	case FormatAYUV64BE:
		return "AYUV64BE"
	case FormatVIDEOTOOLBOX:
		return "VIDEOTOOLBOX"
	case FormatP010LE:
		return "P010LE"
	case FormatP010BE:
		return "P010BE"
	case FormatGBRAP12BE:
		return "GBRAP12BE"
	case FormatGBRAP12LE:
		return "GBRAP12LE"
	case FormatGBRAP10BE:
		return "GBRAP10BE"
	case FormatGBRAP10LE:
		return "GBRAP10LE"
	case FormatMEDIACODEC:
		return "MEDIACODEC"
	case FormatGRAY12BE:
		return "GRAY12BE"
	case FormatGRAY12LE:
		return "GRAY12LE"
	case FormatGRAY10BE:
		return "GRAY10BE"
	case FormatGRAY10LE:
		return "GRAY10LE"
	case FormatP016LE:
		return "P016LE"
	case FormatP016BE:
		return "P016BE"
	case FormatD3D11:
		return "D3D11"
	case FormatGRAY9BE:
		return "GRAY9BE"
	case FormatGRAY9LE:
		return "GRAY9LE"
	case FormatGBRPF32BE:
		return "GBRPF32BE"
	case FormatGBRPF32LE:
		return "GBRPF32LE"
	case FormatGBRAPF32BE:
		return "GBRAPF32BE"
	case FormatGBRAPF32LE:
		return "GBRAPF32LE"
	case FormatDRM_PRIME:
		return "DRM_PRIME"
	case FormatOPENCL:
		return "OPENCL"
	case FormatGRAY14BE:
		return "GRAY14BE"
	case FormatGRAY14LE:
		return "GRAY14LE"
	case FormatGRAYF32BE:
		return "GRAYF32BE"
	case FormatGRAYF32LE:
		return "GRAYF32LE"
	case FormatYUVA422P12BE:
		return "YUVA422P12BE"
	case FormatYUVA422P12LE:
		return "YUVA422P12LE"
	case FormatYUVA444P12BE:
		return "YUVA444P12BE"
	case FormatYUVA444P12LE:
		return "YUVA444P12LE"
	case FormatNV24:
		return "NV24"
	case FormatNV42:
		return "NV42"
	case FormatVULKAN:
		return "VULKAN"
	case FormatY210BE:
		return "Y210BE"
	case FormatY210LE:
		return "Y210LE"
	case FormatX2RGB10LE:
		return "X2RGB10LE"
	case FormatX2RGB10BE:
		return "X2RGB10BE"
	case FormatX2BGR10LE:
		return "X2BGR10LE"
	case FormatX2BGR10BE:
		return "X2BGR10BE"
	case FormatP210BE:
		return "P210BE"
	case FormatP210LE:
		return "P210LE"
	case FormatP410BE:
		return "P410BE"
	case FormatP410LE:
		return "P410LE"
	case FormatP216BE:
		return "P216BE"
	case FormatP216LE:
		return "P216LE"
	case FormatP416BE:
		return "P416BE"
	case FormatP416LE:
		return "P416LE"
	default:
		return "unknown"
	}
}

A ffmpeg/gen_formats.go => ffmpeg/gen_formats.go +127 -0
@@ 0,0 1,127 @@
//go:build generate

package main

import (
	//"fmt"
	"log"
	"path/filepath"
	"strings"

	"github.com/dave/jennifer/jen"
	"github.com/rjeczalik/pkgconfig"
	"modernc.org/cc/v4"
)

func main() {
	pc, err := pkgconfig.LookupPC("libavutil")
	if err != nil {
		log.Fatalf("failed to lookup pkg-config for libavutil: %v", err)
	}

	cfg, err := cc.NewConfig("", "", pc.Cflags...)
	if err != nil {
		log.Fatalf("failed to create new config: %v", err)
	}

	sources := []cc.Source{
		{Name: "<predefined>", Value: cfg.Predefined},
		{Name: "<builtin>", Value: cc.Builtin},
		{Name: "<user>", Value: "#include <libavutil/pixfmt.h>"},
	}

	ast, err := cc.Parse(cfg, sources)
	if err != nil {
		log.Fatalf("failed to translate source: %v", err)
	}

	var formatNames []string
	for tu := ast.TranslationUnit; tu != nil; tu = tu.TranslationUnit {
		if tu.ExternalDeclaration == nil {
			continue
		}
		if tu.ExternalDeclaration.Case != cc.ExternalDeclarationDecl {
			continue
		}
		decl := tu.ExternalDeclaration.Declaration

		if filepath.Base(decl.Position().Filename) != "pixfmt.h" {
			continue
		}

		for declSpec := decl.DeclarationSpecifiers; declSpec != nil; declSpec = declSpec.DeclarationSpecifiers {
			if declSpec.Case != cc.DeclarationSpecifiersTypeSpec {
				continue
			}
			typeSpec := declSpec.TypeSpecifier
			if typeSpec.Case != cc.TypeSpecifierEnum {
				continue
			}
			enumSpec := typeSpec.EnumSpecifier

			if name := enumSpec.Token2.SrcStr(); name != "AVPixelFormat" {
				continue
			}

			for enumList := enumSpec.EnumeratorList; enumList != nil; enumList = enumList.EnumeratorList {
				enum := enumList.Enumerator
				if enum.ConstantExpression != nil {
					continue // TODO
				}
				name := strings.TrimPrefix(enum.Token.SrcStr(), "AV_PIX_FMT_")
				if name == "NB" {
					continue
				}
				formatNames = append(formatNames, name)
			}
		}
	}

	f := jen.NewFile("ffmpeg")
	f.HeaderComment("Generated by gen_formats.go - DO NOT EDIT")
	f.HeaderComment("libavutil " + pc.Version)

	var (
		defs  []jen.Code
		cases []jen.Code
	)
	table := make(jen.Dict)

	cases = append(cases, jen.Case(jen.Id("FormatNone")).Block(
		jen.Return(jen.Lit("NONE")),
	))

	for i, name := range formatNames {
		id := "Format" + name

		if i == 0 {
			defs = append(defs, jen.Id(id).Id("Format").Op("=").Id("iota"))
		} else {
			defs = append(defs, jen.Id(id))
		}

		cases = append(cases, jen.Case(jen.Id(id)).Block(
			jen.Return(jen.Lit(name)),
		))

		table[jen.Lit(name)] = jen.Id(id)
	}

	cases = append(cases, jen.Default().Block(
		jen.Return(jen.Lit("unknown")),
	))

	f.Const().Defs(defs...).Line()

	f.Var().Id("formatTable").Op("=").Map(jen.String()).Id("Format").Values(table)

	f.Func().Params(
		jen.Id("format").Id("Format"),
	).Id("String").Params().String().Block(
		jen.Switch(jen.Id("format")).Block(cases...),
	)

	if err := f.Save("formats.go"); err != nil {
		log.Fatalf("failed to save generated code: %v", err)
	}
}