Lines Matching defs:ctx
112 static int vt_frames_get_constraints(AVHWDeviceContext *ctx,
162 static int vt_pool_alloc(AVHWFramesContext *ctx)
164 VTFramesContext *fctx = ctx->internal->priv;
176 cv_pixfmt = av_map_videotoolbox_format_from_pixfmt(ctx->sw_format);
192 w = CFNumberCreate(NULL, kCFNumberSInt32Type, &ctx->width);
193 h = CFNumberCreate(NULL, kCFNumberSInt32Type, &ctx->height);
209 av_log(ctx, AV_LOG_ERROR, "Error creating CVPixelBufferPool: %d\n", err);
223 AVHWFramesContext *ctx = opaque;
224 VTFramesContext *fctx = ctx->internal->priv;
232 av_log(ctx, AV_LOG_ERROR, "Failed to create pixel buffer from pool: %d\n", err);
245 static void vt_frames_uninit(AVHWFramesContext *ctx)
247 VTFramesContext *fctx = ctx->internal->priv;
254 static int vt_frames_init(AVHWFramesContext *ctx)
259 if (ctx->sw_format == supported_formats[i])
263 av_log(ctx, AV_LOG_ERROR, "Pixel format '%s' is not supported\n",
264 av_get_pix_fmt_name(ctx->sw_format));
268 if (!ctx->pool) {
269 ctx->internal->pool_internal = av_buffer_pool_init2(
270 sizeof(CVPixelBufferRef), ctx, vt_pool_alloc_buffer, NULL);
271 if (!ctx->internal->pool_internal)
275 ret = vt_pool_alloc(ctx);
282 static int vt_get_buffer(AVHWFramesContext *ctx, AVFrame *frame)
284 frame->buf[0] = av_buffer_pool_get(ctx->pool);
290 frame->width = ctx->width;
291 frame->height = ctx->height;
296 static int vt_transfer_get_formats(AVHWFramesContext *ctx,
304 fmts[0] = ctx->sw_format;
311 static void vt_unmap(AVHWFramesContext *ctx, HWMapDescriptor *hwmap)
589 static int vt_map_frame(AVHWFramesContext *ctx, AVFrame *dst, const AVFrame *src,
602 av_log(ctx, AV_LOG_ERROR, "Unsupported or mismatching pixel format: %s\n",
607 if (CVPixelBufferGetWidth(pixbuf) != ctx->width ||
608 CVPixelBufferGetHeight(pixbuf) != ctx->height) {
609 av_log(ctx, AV_LOG_ERROR, "Inconsistent frame dimensions.\n");
618 av_log(ctx, AV_LOG_ERROR, "Error locking the pixel buffer.\n");
735 static int vt_device_create(AVHWDeviceContext *ctx, const char *device,
739 av_log(ctx, AV_LOG_ERROR, "Device selection unsupported.\n");