Commit e80d569d authored by James Zern's avatar James Zern

Conditionally build enc/dec specific API sources

vpx_codec.mk: Select required sources based on CONFIG_{EN,DE}CODERS.
Relocate _dec_init_ver to vpx_decoder.c to match vpx_encoder.

Change-Id: I6a171bc497499040912b2fb17786fba21a8ebc56
parent 57d59f6e
......@@ -12,8 +12,7 @@
* \brief Provides the high level interface to wrap decoder algorithms.
*
*/
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include "vpx/vpx_integer.h"
#include "vpx/internal/vpx_codec_internal.h"
#include "vpx_version.h"
......@@ -87,53 +86,6 @@ const char *vpx_codec_error_detail(vpx_codec_ctx_t *ctx)
}
vpx_codec_err_t vpx_codec_dec_init_ver(vpx_codec_ctx_t *ctx,
vpx_codec_iface_t *iface,
vpx_codec_dec_cfg_t *cfg,
vpx_codec_flags_t flags,
int ver)
{
vpx_codec_err_t res;
if (ver != VPX_DECODER_ABI_VERSION)
res = VPX_CODEC_ABI_MISMATCH;
else if (!ctx || !iface)
res = VPX_CODEC_INVALID_PARAM;
else if (iface->abi_version != VPX_CODEC_INTERNAL_ABI_VERSION)
res = VPX_CODEC_ABI_MISMATCH;
else if ((flags & VPX_CODEC_USE_XMA) && !(iface->caps & VPX_CODEC_CAP_XMA))
res = VPX_CODEC_INCAPABLE;
else if ((flags & VPX_CODEC_USE_POSTPROC) && !(iface->caps & VPX_CODEC_CAP_POSTPROC))
res = VPX_CODEC_INCAPABLE;
else
{
memset(ctx, 0, sizeof(*ctx));
ctx->iface = iface;
ctx->name = iface->name;
ctx->priv = NULL;
ctx->init_flags = flags;
ctx->config.dec = cfg;
res = VPX_CODEC_OK;
if (!(flags & VPX_CODEC_USE_XMA))
{
res = ctx->iface->init(ctx);
if (res)
{
ctx->err_detail = ctx->priv ? ctx->priv->err_detail : NULL;
vpx_codec_destroy(ctx);
}
if (ctx->priv)
ctx->priv->iface = ctx->iface;
}
}
return SAVE_STATUS(ctx, res);
}
vpx_codec_err_t vpx_codec_destroy(vpx_codec_ctx_t *ctx)
{
vpx_codec_err_t res;
......
......@@ -12,11 +12,58 @@
* \brief Provides the high level interface to wrap decoder algorithms.
*
*/
#include <stdlib.h>
#include <string.h>
#include "vpx/internal/vpx_codec_internal.h"
#define SAVE_STATUS(ctx,var) (ctx?(ctx->err = var):var)
vpx_codec_err_t vpx_codec_dec_init_ver(vpx_codec_ctx_t *ctx,
vpx_codec_iface_t *iface,
vpx_codec_dec_cfg_t *cfg,
vpx_codec_flags_t flags,
int ver)
{
vpx_codec_err_t res;
if (ver != VPX_DECODER_ABI_VERSION)
res = VPX_CODEC_ABI_MISMATCH;
else if (!ctx || !iface)
res = VPX_CODEC_INVALID_PARAM;
else if (iface->abi_version != VPX_CODEC_INTERNAL_ABI_VERSION)
res = VPX_CODEC_ABI_MISMATCH;
else if ((flags & VPX_CODEC_USE_XMA) && !(iface->caps & VPX_CODEC_CAP_XMA))
res = VPX_CODEC_INCAPABLE;
else if ((flags & VPX_CODEC_USE_POSTPROC) && !(iface->caps & VPX_CODEC_CAP_POSTPROC))
res = VPX_CODEC_INCAPABLE;
else
{
memset(ctx, 0, sizeof(*ctx));
ctx->iface = iface;
ctx->name = iface->name;
ctx->priv = NULL;
ctx->init_flags = flags;
ctx->config.dec = cfg;
res = VPX_CODEC_OK;
if (!(flags & VPX_CODEC_USE_XMA))
{
res = ctx->iface->init(ctx);
if (res)
{
ctx->err_detail = ctx->priv ? ctx->priv->err_detail : NULL;
vpx_codec_destroy(ctx);
}
if (ctx->priv)
ctx->priv->iface = ctx->iface;
}
}
return SAVE_STATUS(ctx, res);
}
vpx_codec_err_t vpx_codec_peek_stream_info(vpx_codec_iface_t *iface,
const uint8_t *data,
unsigned int data_sz,
......
......@@ -10,17 +10,17 @@
API_EXPORTS += exports
API_SRCS-yes += internal/vpx_codec_internal.h
API_SRCS-yes += vpx_codec.h
API_SRCS-yes += vpx_codec.mk
API_SRCS-yes += vpx_codec_impl_top.h
API_SRCS-yes += vpx_codec_impl_bottom.h
API_SRCS-yes += vpx_decoder.h
API_SRCS-yes += vpx_decoder_compat.h
API_SRCS-yes += vpx_encoder.h
API_SRCS-yes += vpx_image.h
API_SRCS-yes += src/vpx_codec.c
API_SRCS-yes += src/vpx_decoder.c
API_SRCS-yes += src/vpx_decoder_compat.c
API_SRCS-yes += src/vpx_image.c
API_SRCS-yes += src/vpx_encoder.c
API_SRCS-$(CONFIG_DECODERS) += src/vpx_decoder.c
API_SRCS-$(CONFIG_DECODERS) += src/vpx_decoder_compat.c
API_SRCS-$(CONFIG_DECODERS) += vpx_decoder.h
API_SRCS-$(CONFIG_DECODERS) += vpx_decoder_compat.h
API_SRCS-$(CONFIG_ENCODERS) += src/vpx_encoder.c
API_SRCS-$(CONFIG_ENCODERS) += vpx_encoder.h
API_SRCS-yes += internal/vpx_codec_internal.h
API_SRCS-yes += src/vpx_codec.c
API_SRCS-yes += src/vpx_image.c
API_SRCS-yes += vpx_codec.h
API_SRCS-yes += vpx_codec.mk
API_SRCS-yes += vpx_codec_impl_bottom.h
API_SRCS-yes += vpx_codec_impl_top.h
API_SRCS-yes += vpx_image.h
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment