Lines Matching refs:ctx

23 #define SAVE_STATUS(ctx, var) (ctx ? (ctx->err = var) : var)
25 static vpx_codec_alg_priv_t *get_alg_priv(vpx_codec_ctx_t *ctx) {
26 return (vpx_codec_alg_priv_t *)ctx->priv;
29 vpx_codec_err_t vpx_codec_enc_init_ver(vpx_codec_ctx_t *ctx,
37 else if (!ctx || !iface || !cfg)
49 ctx->iface = iface;
50 ctx->name = iface->name;
51 ctx->priv = NULL;
52 ctx->init_flags = flags;
53 ctx->config.enc = cfg;
54 res = ctx->iface->init(ctx, NULL);
57 ctx->err_detail = ctx->priv ? ctx->priv->err_detail : NULL;
58 vpx_codec_destroy(ctx);
62 return SAVE_STATUS(ctx, res);
66 vpx_codec_ctx_t *ctx, vpx_codec_iface_t *iface, vpx_codec_enc_cfg_t *cfg,
72 else if (!ctx || !iface || !cfg || (num_enc > 16 || num_enc < 1))
110 ctx->iface = iface;
111 ctx->name = iface->name;
112 ctx->priv = NULL;
113 ctx->init_flags = flags;
114 ctx->config.enc = cfg;
115 res = ctx->iface->init(ctx, &mr_cfg);
119 const char *error_detail = ctx->priv ? ctx->priv->err_detail : NULL;
120 /* Destroy current ctx */
121 ctx->err_detail = error_detail;
122 vpx_codec_destroy(ctx);
124 /* Destroy already allocated high-level ctx */
126 ctx--;
127 ctx->err_detail = error_detail;
128 vpx_codec_destroy(ctx);
136 return SAVE_STATUS(ctx, res);
139 ctx++;
143 ctx--;
147 return SAVE_STATUS(ctx, res);
196 vpx_codec_err_t vpx_codec_encode(vpx_codec_ctx_t *ctx, const vpx_image_t *img,
202 if (!ctx || (img && !duration))
204 else if (!ctx->iface || !ctx->priv)
206 else if (!(ctx->iface->caps & VPX_CODEC_CAP_ENCODER))
209 unsigned int num_enc = ctx->priv->enc.total_encoders;
217 res = ctx->iface->enc.encode(get_alg_priv(ctx), img, pts, duration, flags,
227 ctx += num_enc - 1;
231 if ((res = ctx->iface->enc.encode(get_alg_priv(ctx), img, pts, duration,
235 ctx--;
238 ctx++;
244 return SAVE_STATUS(ctx, res);
247 const vpx_codec_cx_pkt_t *vpx_codec_get_cx_data(vpx_codec_ctx_t *ctx,
251 if (ctx) {
253 ctx->err = VPX_CODEC_INVALID_PARAM;
254 else if (!ctx->iface || !ctx->priv)
255 ctx->err = VPX_CODEC_ERROR;
256 else if (!(ctx->iface->caps & VPX_CODEC_CAP_ENCODER))
257 ctx->err = VPX_CODEC_INCAPABLE;
259 pkt = ctx->iface->enc.get_cx_data(get_alg_priv(ctx), iter);
266 vpx_codec_priv_t *const priv = ctx->priv;
293 vpx_codec_err_t vpx_codec_set_cx_data_buf(vpx_codec_ctx_t *ctx,
297 if (!ctx || !ctx->priv) return VPX_CODEC_INVALID_PARAM;
300 ctx->priv->enc.cx_data_dst_buf = *buf;
301 ctx->priv->enc.cx_data_pad_before = pad_before;
302 ctx->priv->enc.cx_data_pad_after = pad_after;
304 ctx->priv->enc.cx_data_dst_buf.buf = NULL;
305 ctx->priv->enc.cx_data_dst_buf.sz = 0;
306 ctx->priv->enc.cx_data_pad_before = 0;
307 ctx->priv->enc.cx_data_pad_after = 0;
313 const vpx_image_t *vpx_codec_get_preview_frame(vpx_codec_ctx_t *ctx) {
316 if (ctx) {
317 if (!ctx->iface || !ctx->priv)
318 ctx->err = VPX_CODEC_ERROR;
319 else if (!(ctx->iface->caps & VPX_CODEC_CAP_ENCODER))
320 ctx->err = VPX_CODEC_INCAPABLE;
321 else if (!ctx->iface->enc.get_preview)
322 ctx->err = VPX_CODEC_INCAPABLE;
324 img = ctx->iface->enc.get_preview(get_alg_priv(ctx));
330 vpx_fixed_buf_t *vpx_codec_get_global_headers(vpx_codec_ctx_t *ctx) {
333 if (ctx) {
334 if (!ctx->iface || !ctx->priv)
335 ctx->err = VPX_CODEC_ERROR;
336 else if (!(ctx->iface->caps & VPX_CODEC_CAP_ENCODER))
337 ctx->err = VPX_CODEC_INCAPABLE;
338 else if (!ctx->iface->enc.get_glob_hdrs)
339 ctx->err = VPX_CODEC_INCAPABLE;
341 buf = ctx->iface->enc.get_glob_hdrs(get_alg_priv(ctx));
347 vpx_codec_err_t vpx_codec_enc_config_set(vpx_codec_ctx_t *ctx,
351 if (!ctx || !ctx->iface || !ctx->priv || !cfg)
353 else if (!(ctx->iface->caps & VPX_CODEC_CAP_ENCODER))
356 res = ctx->iface->enc.cfg_set(get_alg_priv(ctx), cfg);
358 return SAVE_STATUS(ctx, res);