Go to the documentation of this file.
21 #include <VideoToolbox/VideoToolbox.h>
44 ret = VTPixelRotationSessionCreate(kCFAllocatorDefault, &
s->session);
58 VTPixelRotationSessionInvalidate(
s->session);
59 CFRelease(
s->session);
87 src = (CVPixelBufferRef)in->
data[3];
88 dst = (CVPixelBufferRef)
out->data[3];
89 ret = VTPixelRotationSessionRotateImage(
s->session,
src, dst);
121 hw_frame_ctx_out->
width = outlink->
w;
122 hw_frame_ctx_out->
height = outlink->
h;
131 "Failed to init videotoolbox frame context, %s\n",
145 CFStringRef rotation = kVTRotation_0;
146 CFBooleanRef vflip = kCFBooleanFalse;
147 CFBooleanRef hflip = kCFBooleanFalse;
156 "w:%d h:%d -> w:%d h:%d (passthrough mode)\n",
165 rotation = kVTRotation_CCW90;
166 vflip = kCFBooleanTrue;
170 rotation = kVTRotation_CCW90;
174 rotation = kVTRotation_CW90;
178 rotation = kVTRotation_CW90;
179 vflip = kCFBooleanTrue;
183 rotation = kVTRotation_180;
186 hflip = kCFBooleanTrue;
189 vflip = kCFBooleanTrue;
196 err = VTSessionSetProperty(
s->session, kVTPixelRotationPropertyKey_Rotation,
202 err = VTSessionSetProperty(
s->session, kVTPixelRotationPropertyKey_FlipVerticalOrientation,
208 err = VTSessionSetProperty(
s->session, kVTPixelRotationPropertyKey_FlipHorizontalOrientation,
223 #define OFFSET(x) offsetof(TransposeVtContext, x)
224 #define FLAGS (AV_OPT_FLAG_FILTERING_PARAM | AV_OPT_FLAG_VIDEO_PARAM)
226 {
"dir",
"set transpose direction",
228 {
"cclock_flip",
"rotate counter-clockwise with vertical flip",
230 {
"clock",
"rotate clockwise",
232 {
"cclock",
"rotate counter-clockwise",
234 {
"clock_flip",
"rotate clockwise with vertical flip",
236 {
"reversal",
"rotate by half-turn",
238 {
"hflip",
"flip horizontally",
240 {
"vflip",
"flip vertically",
243 {
"passthrough",
"do not apply transposition if the input matches the specified geometry",
245 {
"none",
"always apply transposition",
247 {
"portrait",
"preserve portrait geometry",
249 {
"landscape",
"preserve landscape geometry",
274 .
name =
"transpose_vt",
282 .priv_class = &transpose_vt_class,
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.
VTPixelRotationSessionRef session
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
#define FF_FILTER_FLAG_HWFRAME_AWARE
The filter is aware of hardware frames, and any hardware frame context should not be automatically pr...
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
uint8_t * data
The data buffer.
enum AVPixelFormat format
The pixel format identifying the underlying HW surface type.
The exact code depends on how similar the blocks are and how related they are to the and needs to apply these operations to the correct inlink or outlink if there are several Macros are available to factor that when no extra processing is inlink
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
int av_hwframe_ctx_init(AVBufferRef *ref)
Finalize the context before use.
This structure describes decoded (raw) audio or video data.
static int transpose_vt_config_output(AVFilterLink *outlink)
AVBufferRef * av_hwframe_ctx_alloc(AVBufferRef *device_ref_in)
Allocate an AVHWFramesContext tied to a given device context.
static av_cold int transpose_vt_init(AVFilterContext *avctx)
#define AV_LOG_VERBOSE
Detailed information.
AVBufferRef * av_buffer_ref(const AVBufferRef *buf)
Create a new reference to an AVBuffer.
const char * name
Filter name.
int width
The allocated dimensions of the frames in this pool.
A link between two filters.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
void * priv
private data for use by the filter
static int transpose_vt_recreate_hw_ctx(AVFilterLink *outlink)
A filter pad used for either input or output.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define FILTER_INPUTS(array)
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a link
Describe the class of an AVClass context structure.
enum AVPixelFormat sw_format
The pixel format identifying the actual data layout of the hardware frames.
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
void av_buffer_unref(AVBufferRef **buf)
Free a given reference and automatically free the buffer if there are no more references to it.
AVBufferRef * device_ref
A reference to the parent AVHWDeviceContext.
AVFilterLink ** inputs
array of pointers to input links
static av_cold void transpose_vt_uninit(AVFilterContext *avctx)
@ TRANSPOSE_PT_TYPE_PORTRAIT
int(* init)(AVBSFContext *ctx)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
#define av_err2str(errnum)
Convenience macro, the return value should be used only directly in function arguments but never stan...
#define AVFILTER_FLAG_HWDEVICE
The filter can create hardware frames using AVFilterContext.hw_device_ctx.
AVFILTER_DEFINE_CLASS(transpose_vt)
static int transpose_vt_filter_frame(AVFilterLink *link, AVFrame *in)
AVFilterContext * src
source filter
#define AVERROR_EXTERNAL
Generic error in an external library.
const AVFilter ff_vf_transpose_vt
#define FILTER_SINGLE_PIXFMT(pix_fmt_)
@ AV_PIX_FMT_VIDEOTOOLBOX
hardware decoding through Videotoolbox
static void uninit(AVBSFContext *ctx)
int w
agreed upon image width
AVBufferRef * hw_frames_ctx
For hwaccel pixel formats, this should be a reference to the AVHWFramesContext describing the frames.
const char * name
Pad name.
This struct describes a set or pool of "hardware" frames (i.e.
int h
agreed upon image height
@ TRANSPOSE_PT_TYPE_LANDSCAPE
static const AVFilterPad transpose_vt_inputs[]
#define FILTER_OUTPUTS(array)
static const AVOption transpose_vt_options[]
int ff_filter_init_hw_frames(AVFilterContext *avctx, AVFilterLink *link, int default_pool_size)
Perform any additional setup required for hardware frames.
static const AVFilterPad transpose_vt_outputs[]