Files
ffmpeg-dev-go/avutil_hwcontext_videotoolbox.go
2023-10-30 20:46:52 +08:00

29 lines
1.1 KiB
Go

// Copyright (c) 2023 QRTC. All rights reserved.
// Use of this source code is governed by a MIT
// license that can be found in the LICENSE file.
//go:build ffmpeg_hw_videotoolbox
package ffmpeg
/*
#include <libavutil/hwcontext_videotoolbox.h>
*/
import "C"
// AvMapVideotoolboxFormatToPixfmt converts a VideoToolbox (actually CoreVideo) format to AVPixelFormat.
func AvMapVideotoolboxFormatToPixfmt(cvFmt uint32) AVPixelFormat {
return (AVPixelFormat)(C.av_map_videotoolbox_format_to_pixfmt((C.uint32_t)(cvFmt)))
}
// AvMapVideotoolboxFormatFromPixfmt converts an AVPixelFormat to a VideoToolbox (actually CoreVideo) format.
func AvMapVideotoolboxFormatFromPixfmt(pixFmt AVPixelFormat) uint32 {
return (uint32)(C.av_map_videotoolbox_format_from_pixfmt((C.enum_AVPixelFormat)(pixFmt)))
}
// AvMapVideotoolboxFormatFromPixfmt2 same as av_map_videotoolbox_format_from_pixfmt function, but can map and
// return full range pixel formats via a flag.
func AvMapVideotoolboxFormatFromPixfmt2(pixFmt AVPixelFormat, fullRange bool) uint32 {
return (uint32)(C.av_map_videotoolbox_format_from_pixfmt2((C.enum_AVPixelFormat)(pixFmt), C.bool(fullRange)))
}