summaryrefslogtreecommitdiff
path: root/vpx
diff options
context:
space:
mode:
Diffstat (limited to 'vpx')
-rw-r--r--vpx/internal/vpx_codec_internal.h1
-rw-r--r--vpx/src/vpx_codec.c5
-rw-r--r--vpx/src/vpx_decoder.c14
-rw-r--r--vpx/src/vpx_encoder.c16
4 files changed, 21 insertions, 15 deletions
diff --git a/vpx/internal/vpx_codec_internal.h b/vpx/internal/vpx_codec_internal.h
index d7c580060..02f20791a 100644
--- a/vpx/internal/vpx_codec_internal.h
+++ b/vpx/internal/vpx_codec_internal.h
@@ -336,7 +336,6 @@ typedef struct vpx_codec_priv_cb_pair {
*/
struct vpx_codec_priv {
unsigned int sz;
- struct vpx_codec_alg_priv *alg_priv;
const char *err_detail;
vpx_codec_flags_t init_flags;
struct {
diff --git a/vpx/src/vpx_codec.c b/vpx/src/vpx_codec.c
index d175eae64..5a495ce81 100644
--- a/vpx/src/vpx_codec.c
+++ b/vpx/src/vpx_codec.c
@@ -88,8 +88,7 @@ vpx_codec_err_t vpx_codec_destroy(vpx_codec_ctx_t *ctx) {
else if (!ctx->iface || !ctx->priv)
res = VPX_CODEC_ERROR;
else {
- if (ctx->priv->alg_priv)
- ctx->iface->destroy(ctx->priv->alg_priv);
+ ctx->iface->destroy((vpx_codec_alg_priv_t *)ctx->priv);
ctx->iface = NULL;
ctx->name = NULL;
@@ -125,7 +124,7 @@ vpx_codec_err_t vpx_codec_control_(vpx_codec_ctx_t *ctx,
va_list ap;
va_start(ap, ctrl_id);
- res = entry->fn(ctx->priv->alg_priv, ap);
+ res = entry->fn((vpx_codec_alg_priv_t *)ctx->priv, ap);
va_end(ap);
break;
}
diff --git a/vpx/src/vpx_decoder.c b/vpx/src/vpx_decoder.c
index fdcc9c1b1..802d8edd8 100644
--- a/vpx/src/vpx_decoder.c
+++ b/vpx/src/vpx_decoder.c
@@ -18,6 +18,10 @@
#define SAVE_STATUS(ctx,var) (ctx?(ctx->err = var):var)
+static vpx_codec_alg_priv_t *get_alg_priv(vpx_codec_ctx_t *ctx) {
+ return (vpx_codec_alg_priv_t *)ctx->priv;
+}
+
vpx_codec_err_t vpx_codec_dec_init_ver(vpx_codec_ctx_t *ctx,
vpx_codec_iface_t *iface,
const vpx_codec_dec_cfg_t *cfg,
@@ -94,7 +98,7 @@ vpx_codec_err_t vpx_codec_get_stream_info(vpx_codec_ctx_t *ctx,
si->w = 0;
si->h = 0;
- res = ctx->iface->dec.get_si(ctx->priv->alg_priv, si);
+ res = ctx->iface->dec.get_si(get_alg_priv(ctx), si);
}
return SAVE_STATUS(ctx, res);
@@ -115,8 +119,8 @@ vpx_codec_err_t vpx_codec_decode(vpx_codec_ctx_t *ctx,
else if (!ctx->iface || !ctx->priv)
res = VPX_CODEC_ERROR;
else {
- res = ctx->iface->dec.decode(ctx->priv->alg_priv, data, data_sz,
- user_priv, deadline);
+ res = ctx->iface->dec.decode(get_alg_priv(ctx), data, data_sz, user_priv,
+ deadline);
}
return SAVE_STATUS(ctx, res);
@@ -129,7 +133,7 @@ vpx_image_t *vpx_codec_get_frame(vpx_codec_ctx_t *ctx,
if (!ctx || !iter || !ctx->iface || !ctx->priv)
img = NULL;
else
- img = ctx->iface->dec.get_frame(ctx->priv->alg_priv, iter);
+ img = ctx->iface->dec.get_frame(get_alg_priv(ctx), iter);
return img;
}
@@ -185,7 +189,7 @@ vpx_codec_err_t vpx_codec_set_frame_buffer_functions(
!(ctx->iface->caps & VPX_CODEC_CAP_EXTERNAL_FRAME_BUFFER)) {
res = VPX_CODEC_ERROR;
} else {
- res = ctx->iface->dec.set_fb_fn(ctx->priv->alg_priv, cb_get, cb_release,
+ res = ctx->iface->dec.set_fb_fn(get_alg_priv(ctx), cb_get, cb_release,
cb_priv);
}
diff --git a/vpx/src/vpx_encoder.c b/vpx/src/vpx_encoder.c
index 736a8daa2..1903b5575 100644
--- a/vpx/src/vpx_encoder.c
+++ b/vpx/src/vpx_encoder.c
@@ -20,6 +20,10 @@
#define SAVE_STATUS(ctx,var) (ctx?(ctx->err = var):var)
+static vpx_codec_alg_priv_t *get_alg_priv(vpx_codec_ctx_t *ctx) {
+ return (vpx_codec_alg_priv_t *)ctx->priv;
+}
+
vpx_codec_err_t vpx_codec_enc_init_ver(vpx_codec_ctx_t *ctx,
vpx_codec_iface_t *iface,
const vpx_codec_enc_cfg_t *cfg,
@@ -216,7 +220,7 @@ vpx_codec_err_t vpx_codec_encode(vpx_codec_ctx_t *ctx,
FLOATING_POINT_INIT();
if (num_enc == 1)
- res = ctx->iface->enc.encode(ctx->priv->alg_priv, img, pts,
+ res = ctx->iface->enc.encode(get_alg_priv(ctx), img, pts,
duration, flags, deadline);
else {
/* Multi-resolution encoding:
@@ -230,7 +234,7 @@ vpx_codec_err_t vpx_codec_encode(vpx_codec_ctx_t *ctx,
if (img) img += num_enc - 1;
for (i = num_enc - 1; i >= 0; i--) {
- if ((res = ctx->iface->enc.encode(ctx->priv->alg_priv, img, pts,
+ if ((res = ctx->iface->enc.encode(get_alg_priv(ctx), img, pts,
duration, flags, deadline)))
break;
@@ -259,7 +263,7 @@ const vpx_codec_cx_pkt_t *vpx_codec_get_cx_data(vpx_codec_ctx_t *ctx,
else if (!(ctx->iface->caps & VPX_CODEC_CAP_ENCODER))
ctx->err = VPX_CODEC_INCAPABLE;
else
- pkt = ctx->iface->enc.get_cx_data(ctx->priv->alg_priv, iter);
+ pkt = ctx->iface->enc.get_cx_data(get_alg_priv(ctx), iter);
}
if (pkt && pkt->kind == VPX_CODEC_CX_FRAME_PKT) {
@@ -327,7 +331,7 @@ const vpx_image_t *vpx_codec_get_preview_frame(vpx_codec_ctx_t *ctx) {
else if (!ctx->iface->enc.get_preview)
ctx->err = VPX_CODEC_INCAPABLE;
else
- img = ctx->iface->enc.get_preview(ctx->priv->alg_priv);
+ img = ctx->iface->enc.get_preview(get_alg_priv(ctx));
}
return img;
@@ -345,7 +349,7 @@ vpx_fixed_buf_t *vpx_codec_get_global_headers(vpx_codec_ctx_t *ctx) {
else if (!ctx->iface->enc.get_glob_hdrs)
ctx->err = VPX_CODEC_INCAPABLE;
else
- buf = ctx->iface->enc.get_glob_hdrs(ctx->priv->alg_priv);
+ buf = ctx->iface->enc.get_glob_hdrs(get_alg_priv(ctx));
}
return buf;
@@ -361,7 +365,7 @@ vpx_codec_err_t vpx_codec_enc_config_set(vpx_codec_ctx_t *ctx,
else if (!(ctx->iface->caps & VPX_CODEC_CAP_ENCODER))
res = VPX_CODEC_INCAPABLE;
else
- res = ctx->iface->enc.cfg_set(ctx->priv->alg_priv, cfg);
+ res = ctx->iface->enc.cfg_set(get_alg_priv(ctx), cfg);
return SAVE_STATUS(ctx, res);
}