FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Functions | Variables
hwcontext_videotoolbox.c File Reference
#include "config.h"
#include <stdint.h>
#include <string.h>
#include <VideoToolbox/VideoToolbox.h>
#include "buffer.h"
#include "common.h"
#include "hwcontext.h"
#include "hwcontext_internal.h"
#include "hwcontext_videotoolbox.h"
#include "mem.h"
#include "pixfmt.h"
#include "pixdesc.h"

Go to the source code of this file.

Functions

enum AVPixelFormat av_map_videotoolbox_format_to_pixfmt (uint32_t cv_fmt)
 Convert a VideoToolbox (actually CoreVideo) format to AVPixelFormat. More...
 
uint32_t av_map_videotoolbox_format_from_pixfmt (enum AVPixelFormat pix_fmt)
 Convert an AVPixelFormat to a VideoToolbox (actually CoreVideo) format. More...
 
static int vt_get_buffer (AVHWFramesContext *ctx, AVFrame *frame)
 
static int vt_transfer_get_formats (AVHWFramesContext *ctx, enum AVHWFrameTransferDirection dir, enum AVPixelFormat **formats)
 
static void vt_unmap (AVHWFramesContext *ctx, HWMapDescriptor *hwmap)
 
static int vt_map_frame (AVHWFramesContext *ctx, AVFrame *dst, const AVFrame *src, int flags)
 
static int vt_transfer_data_from (AVHWFramesContext *hwfc, AVFrame *dst, const AVFrame *src)
 
static int vt_transfer_data_to (AVHWFramesContext *hwfc, AVFrame *dst, const AVFrame *src)
 
static int vt_device_create (AVHWDeviceContext *ctx, const char *device, AVDictionary *opts, int flags)
 

Variables

struct {
   uint32_t   cv_fmt
 
   enum AVPixelFormat   pix_fmt
 
cv_pix_fmts []
 
const HWContextType ff_hwcontext_type_videotoolbox
 

Function Documentation

enum AVPixelFormat av_map_videotoolbox_format_to_pixfmt ( uint32_t  cv_fmt)

Convert a VideoToolbox (actually CoreVideo) format to AVPixelFormat.

Returns AV_PIX_FMT_NONE if no known equivalent was found.

Definition at line 47 of file hwcontext_videotoolbox.c.

Referenced by vt_map_frame().

uint32_t av_map_videotoolbox_format_from_pixfmt ( enum AVPixelFormat  pix_fmt)

Convert an AVPixelFormat to a VideoToolbox (actually CoreVideo) format.

Returns 0 if no known equivalent was found.

Definition at line 57 of file hwcontext_videotoolbox.c.

static int vt_get_buffer ( AVHWFramesContext ctx,
AVFrame frame 
)
static

Definition at line 67 of file hwcontext_videotoolbox.c.

static int vt_transfer_get_formats ( AVHWFramesContext ctx,
enum AVHWFrameTransferDirection  dir,
enum AVPixelFormat **  formats 
)
static

Definition at line 81 of file hwcontext_videotoolbox.c.

static void vt_unmap ( AVHWFramesContext ctx,
HWMapDescriptor hwmap 
)
static

Definition at line 96 of file hwcontext_videotoolbox.c.

Referenced by vt_map_frame().

static int vt_map_frame ( AVHWFramesContext ctx,
AVFrame dst,
const AVFrame src,
int  flags 
)
static

Definition at line 103 of file hwcontext_videotoolbox.c.

Referenced by vt_transfer_data_from(), and vt_transfer_data_to().

static int vt_transfer_data_from ( AVHWFramesContext hwfc,
AVFrame dst,
const AVFrame src 
)
static

Definition at line 159 of file hwcontext_videotoolbox.c.

static int vt_transfer_data_to ( AVHWFramesContext hwfc,
AVFrame dst,
const AVFrame src 
)
static

Definition at line 190 of file hwcontext_videotoolbox.c.

static int vt_device_create ( AVHWDeviceContext ctx,
const char *  device,
AVDictionary opts,
int  flags 
)
static

Definition at line 221 of file hwcontext_videotoolbox.c.

Variable Documentation

uint32_t cv_fmt

Definition at line 36 of file hwcontext_videotoolbox.c.

enum AVPixelFormat pix_fmt

Definition at line 37 of file hwcontext_videotoolbox.c.

const { ... } cv_pix_fmts[]
Initial value:
= {
{ kCVPixelFormatType_420YpCbCr8Planar, AV_PIX_FMT_YUV420P },
{ kCVPixelFormatType_422YpCbCr8, AV_PIX_FMT_UYVY422 },
{ kCVPixelFormatType_32BGRA, AV_PIX_FMT_BGRA },
}
packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1
Definition: pixfmt.h:82
packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
Definition: pixfmt.h:96
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition: pixfmt.h:62

Referenced by av_map_videotoolbox_format_from_pixfmt(), and av_map_videotoolbox_format_to_pixfmt().

const HWContextType ff_hwcontext_type_videotoolbox
Initial value:
= {
.name = "videotoolbox",
.device_create = vt_device_create,
.frames_get_buffer = vt_get_buffer,
.transfer_get_formats = vt_transfer_get_formats,
.transfer_data_to = vt_transfer_data_to,
.transfer_data_from = vt_transfer_data_from,
.pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_VIDEOTOOLBOX, AV_PIX_FMT_NONE },
}
hardware decoding through Videotoolbox
Definition: pixfmt.h:296
static int vt_transfer_data_to(AVHWFramesContext *hwfc, AVFrame *dst, const AVFrame *src)
static int vt_transfer_get_formats(AVHWFramesContext *ctx, enum AVHWFrameTransferDirection dir, enum AVPixelFormat **formats)
static int vt_transfer_data_from(AVHWFramesContext *hwfc, AVFrame *dst, const AVFrame *src)
static int vt_get_buffer(AVHWFramesContext *ctx, AVFrame *frame)
static int vt_device_create(AVHWDeviceContext *ctx, const char *device, AVDictionary *opts, int flags)
AVPixelFormat
Pixel format.
Definition: pixfmt.h:60

Definition at line 232 of file hwcontext_videotoolbox.c.