Return AOM_CODEC_INCAPABLE on capability failure
All decoder functions should return the AOM_CODEC_INCAPABLE error code
if the algorithm does not have the requested capability.
Change the --disable-multithread configure option to the
-DCONFIG_MULTITHREAD=0 cmake option.
Change "PUT_SLICE and PUT_FRAME events are posted" to "put_slice and
put_frame callbacks are invoked".
Also fix some other minor comment errors.
Change-Id: I7516f7fcb896b186a60eb4512917a207f793b892
diff --git a/aom/aom_decoder.h b/aom/aom_decoder.h
index af20e98..3b802ab 100644
--- a/aom/aom_decoder.h
+++ b/aom/aom_decoder.h
@@ -107,8 +107,8 @@
* function directly, to ensure that the ABI version number parameter
* is properly initialized.
*
- * If the library was configured with --disable-multithread, this call
- * is not thread safe and should be guarded with a lock if being used
+ * If the library was configured with cmake -DCONFIG_MULTITHREAD=0, this
+ * call is not thread safe and should be guarded with a lock if being used
* in a multithreaded context.
*
* \param[in] ctx Pointer to this instance's context.
@@ -179,15 +179,15 @@
/*!\brief Decode data
*
* Processes a buffer of coded data. If the processing results in a new
- * decoded frame becoming available, PUT_SLICE and PUT_FRAME events may be
- * generated, as appropriate. Encoded data \ref MUST be passed in DTS (decode
+ * decoded frame becoming available, put_slice and put_frame callbacks may be
+ * invoked, as appropriate. Encoded data \ref MUST be passed in DTS (decode
* time stamp) order. Frames produced will always be in PTS (presentation
* time stamp) order.
*
* \param[in] ctx Pointer to this instance's context
* \param[in] data Pointer to this block of new coded data. If
- * NULL, a AOM_CODEC_CB_PUT_FRAME event is posted
- * for the previously decoded frame.
+ * NULL, the put_frame callback is invoked for
+ * the previously decoded frame.
* \param[in] data_sz Size of the coded data, in bytes.
* \param[in] user_priv Application specific data to associate with
* this frame.
@@ -220,11 +220,10 @@
/*!\defgroup cap_put_frame Frame-Based Decoding Functions
*
- * The following functions are required to be implemented for all decoders
- * that advertise the AOM_CODEC_CAP_PUT_FRAME capability. Calling these
- * functions
- * for codecs that don't advertise this capability will result in an error
- * code being returned, usually AOM_CODEC_ERROR
+ * The following function is required to be implemented for all decoders
+ * that advertise the AOM_CODEC_CAP_PUT_FRAME capability. Calling this
+ * function for codecs that don't advertise this capability will result in
+ * an error code being returned, usually AOM_CODEC_INCAPABLE.
* @{
*/
@@ -248,8 +247,9 @@
* \retval #AOM_CODEC_OK
* Callback successfully registered.
* \retval #AOM_CODEC_ERROR
- * Decoder context not initialized, or algorithm not capable of
- * posting slice completion.
+ * Decoder context not initialized.
+ * \retval #AOM_CODEC_INCAPABLE
+ * Algorithm not capable of posting frame completion.
*/
aom_codec_err_t aom_codec_register_put_frame_cb(aom_codec_ctx_t *ctx,
aom_codec_put_frame_cb_fn_t cb,
@@ -259,18 +259,17 @@
/*!\defgroup cap_put_slice Slice-Based Decoding Functions
*
- * The following functions are required to be implemented for all decoders
- * that advertise the AOM_CODEC_CAP_PUT_SLICE capability. Calling these
- * functions
- * for codecs that don't advertise this capability will result in an error
- * code being returned, usually AOM_CODEC_ERROR
+ * The following function is required to be implemented for all decoders
+ * that advertise the AOM_CODEC_CAP_PUT_SLICE capability. Calling this
+ * function for codecs that don't advertise this capability will result in
+ * an error code being returned, usually AOM_CODEC_INCAPABLE.
* @{
*/
/*!\brief put slice callback prototype
*
* This callback is invoked by the decoder to notify the application of
- * the availability of partially decoded image data. The
+ * the availability of partially decoded image data.
*/
typedef void (*aom_codec_put_slice_cb_fn_t)(void *user_priv,
const aom_image_t *img,
@@ -289,8 +288,9 @@
* \retval #AOM_CODEC_OK
* Callback successfully registered.
* \retval #AOM_CODEC_ERROR
- * Decoder context not initialized, or algorithm not capable of
- * posting slice completion.
+ * Decoder context not initialized.
+ * \retval #AOM_CODEC_INCAPABLE
+ * Algorithm not capable of posting slice completion.
*/
aom_codec_err_t aom_codec_register_put_slice_cb(aom_codec_ctx_t *ctx,
aom_codec_put_slice_cb_fn_t cb,
@@ -300,10 +300,10 @@
/*!\defgroup cap_external_frame_buffer External Frame Buffer Functions
*
- * The following section is required to be implemented for all decoders
+ * The following function is required to be implemented for all decoders
* that advertise the AOM_CODEC_CAP_EXTERNAL_FRAME_BUFFER capability.
* Calling this function for codecs that don't advertise this capability
- * will result in an error code being returned, usually AOM_CODEC_ERROR.
+ * will result in an error code being returned, usually AOM_CODEC_INCAPABLE.
*
* \note
* Currently this only works with AV1.
@@ -328,13 +328,13 @@
* \retval #AOM_CODEC_INVALID_PARAM
* One or more of the callbacks were NULL.
* \retval #AOM_CODEC_ERROR
- * Decoder context not initialized, or algorithm not capable of
- * using external frame buffers.
+ * Decoder context not initialized.
+ * \retval #AOM_CODEC_INCAPABLE
+ * Algorithm not capable of using external frame buffers.
*
* \note
* When decoding AV1, the application may be required to pass in at least
- * #AOM_MAXIMUM_WORK_BUFFERS external frame
- * buffers.
+ * #AOM_MAXIMUM_WORK_BUFFERS external frame buffers.
*/
aom_codec_err_t aom_codec_set_frame_buffer_functions(
aom_codec_ctx_t *ctx, aom_get_frame_buffer_cb_fn_t cb_get,
diff --git a/aom/internal/aom_codec_internal.h b/aom/internal/aom_codec_internal.h
index 4c43048..cc38215 100644
--- a/aom/internal/aom_codec_internal.h
+++ b/aom/internal/aom_codec_internal.h
@@ -172,16 +172,15 @@
/*!\brief decode data function pointer prototype
*
* Processes a buffer of coded data. If the processing results in a new
- * decoded frame becoming available, #AOM_CODEC_CB_PUT_SLICE and
- * #AOM_CODEC_CB_PUT_FRAME events are generated as appropriate. This
- * function is called by the generic aom_codec_decode() wrapper function,
- * so plugins implementing this interface may trust the input parameters
- * to be properly initialized.
+ * decoded frame becoming available, put_slice and put_frame callbacks
+ * are invoked as appropriate. This function is called by the generic
+ * aom_codec_decode() wrapper function, so plugins implementing this
+ * interface may trust the input parameters to be properly initialized.
*
* \param[in] ctx Pointer to this instance's context
* \param[in] data Pointer to this block of new coded data. If
- * NULL, a #AOM_CODEC_CB_PUT_FRAME event is posted
- * for the previously decoded frame.
+ * NULL, the put_frame callback is invoked for
+ * the previously decoded frame.
* \param[in] data_sz Size of the coded data, in bytes.
*
* \return Returns #AOM_CODEC_OK if the coded data was processed completely
diff --git a/aom/src/aom_decoder.c b/aom/src/aom_decoder.c
index 282ec8a..029c082 100644
--- a/aom/src/aom_decoder.c
+++ b/aom/src/aom_decoder.c
@@ -127,9 +127,10 @@
if (!ctx || !cb)
res = AOM_CODEC_INVALID_PARAM;
- else if (!ctx->iface || !ctx->priv ||
- !(ctx->iface->caps & AOM_CODEC_CAP_PUT_FRAME))
+ else if (!ctx->iface || !ctx->priv)
res = AOM_CODEC_ERROR;
+ else if (!(ctx->iface->caps & AOM_CODEC_CAP_PUT_FRAME))
+ res = AOM_CODEC_INCAPABLE;
else {
ctx->priv->dec.put_frame_cb.u.put_frame = cb;
ctx->priv->dec.put_frame_cb.user_priv = user_priv;
@@ -146,9 +147,10 @@
if (!ctx || !cb)
res = AOM_CODEC_INVALID_PARAM;
- else if (!ctx->iface || !ctx->priv ||
- !(ctx->iface->caps & AOM_CODEC_CAP_PUT_SLICE))
+ else if (!ctx->iface || !ctx->priv)
res = AOM_CODEC_ERROR;
+ else if (!(ctx->iface->caps & AOM_CODEC_CAP_PUT_SLICE))
+ res = AOM_CODEC_INCAPABLE;
else {
ctx->priv->dec.put_slice_cb.u.put_slice = cb;
ctx->priv->dec.put_slice_cb.user_priv = user_priv;
@@ -165,9 +167,10 @@
if (!ctx || !cb_get || !cb_release) {
res = AOM_CODEC_INVALID_PARAM;
- } else if (!ctx->iface || !ctx->priv ||
- !(ctx->iface->caps & AOM_CODEC_CAP_EXTERNAL_FRAME_BUFFER)) {
+ } else if (!ctx->iface || !ctx->priv) {
res = AOM_CODEC_ERROR;
+ } else if (!(ctx->iface->caps & AOM_CODEC_CAP_EXTERNAL_FRAME_BUFFER)) {
+ res = AOM_CODEC_INCAPABLE;
} else {
res = ctx->iface->dec.set_fb_fn(get_alg_priv(ctx), cb_get, cb_release,
cb_priv);