Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / third_party / libvpx / source / libvpx / vpx / internal / vpx_codec_internal.h
index 6c644f0..82d2bc3 100644 (file)
@@ -47,6 +47,9 @@
 #include "../vpx_encoder.h"
 #include <stdarg.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 /*!\brief Current ABI version number
  *
@@ -151,9 +154,8 @@ typedef vpx_codec_err_t (*vpx_codec_get_si_fn_t)(vpx_codec_alg_priv_t    *ctx,
  * \retval #VPX_CODEC_OK
  *     The internal state data was deserialized.
  */
-typedef vpx_codec_err_t (*vpx_codec_control_fn_t)(vpx_codec_alg_priv_t  *ctx,
-                                                  int                  ctrl_id,
-                                                  va_list              ap);
+typedef vpx_codec_err_t (*vpx_codec_control_fn_t)(vpx_codec_alg_priv_t *ctx,
+                                                  va_list ap);
 
 /*!\brief control function pointer mapping
  *
@@ -167,8 +169,8 @@ typedef vpx_codec_err_t (*vpx_codec_control_fn_t)(vpx_codec_alg_priv_t  *ctx,
  * \ref MUST be non-zero.
  */
 typedef const struct vpx_codec_ctrl_fn_map {
-  int                    ctrl_id;
-  vpx_codec_control_fn_t   fn;
+  int ctrl_id;
+  vpx_codec_control_fn_t fn;
 } vpx_codec_ctrl_fn_map_t;
 
 /*!\brief decode data function pointer prototype
@@ -217,35 +219,34 @@ typedef vpx_image_t *(*vpx_codec_get_frame_fn_t)(vpx_codec_alg_priv_t *ctx,
 
 /*!\brief Pass in external frame buffers for the decoder to use.
  *
- * Registers a given function to be called when the current frame to
- * decode will be bigger than the external frame buffer size. This
- * function must be called before the first call to decode or libvpx
- * will assume the default behavior of allocating frame buffers internally.
- * Frame buffers with a size of 0 are valid.
+ * Registers functions to be called when libvpx needs a frame buffer
+ * to decode the current frame and a function to be called when libvpx does
+ * not internally reference the frame buffer. This set function must
+ * be called before the first call to decode or libvpx will assume the
+ * default behavior of allocating frame buffers internally.
  *
  * \param[in] ctx          Pointer to this instance's context
- * \param[in] fb_list      Pointer to array of frame buffers
- * \param[in] fb_count     Number of elements in frame buffer array
- * \param[in] cb           Pointer to the callback function
- * \param[in] user_priv    User's private data
+ * \param[in] cb_get       Pointer to the get callback function
+ * \param[in] cb_release   Pointer to the release callback function
+ * \param[in] cb_priv      Callback's private data
  *
  * \retval #VPX_CODEC_OK
  *     External frame buffers will be used by libvpx.
  * \retval #VPX_CODEC_INVALID_PARAM
- *     fb_count was less than the value needed by the codec.
+ *     One or more of the callbacks were NULL.
  * \retval #VPX_CODEC_ERROR
  *     Decoder context not initialized, or algorithm not capable of
  *     using external frame buffers.
  *
  * \note
- * When decoding VP9, the application must pass in at least
+ * When decoding VP9, the application may be required to pass in at least
  * #VP9_MAXIMUM_REF_BUFFERS + #VPX_MAXIMUM_WORK_BUFFERS external frame
  * buffers.
  */
-typedef vpx_codec_err_t (*vpx_codec_set_frame_buffers_fn_t)(
+typedef vpx_codec_err_t (*vpx_codec_set_fb_fn_t)(
     vpx_codec_alg_priv_t *ctx,
-    vpx_codec_frame_buffer_t *fb_list, int fb_count,
-    vpx_realloc_frame_buffer_cb_fn_t cb, void *user_priv);
+    vpx_get_frame_buffer_cb_fn_t cb_get,
+    vpx_release_frame_buffer_cb_fn_t cb_release, void *cb_priv);
 
 /*\brief eXternal Memory Allocation memory map get iterator
  *
@@ -336,7 +337,7 @@ struct vpx_codec_iface {
     vpx_codec_get_si_fn_t     get_si;      /**< \copydoc ::vpx_codec_get_si_fn_t */
     vpx_codec_decode_fn_t     decode;      /**< \copydoc ::vpx_codec_decode_fn_t */
     vpx_codec_get_frame_fn_t  get_frame;   /**< \copydoc ::vpx_codec_get_frame_fn_t */
-    vpx_codec_set_frame_buffers_fn_t set_fb; /**< \copydoc ::vpx_codec_set_frame_buffers_fn_t */
+    vpx_codec_set_fb_fn_t     set_fb_fn;   /**< \copydoc ::vpx_codec_set_fb_fn_t */
   } dec;
   struct vpx_codec_enc_iface {
     vpx_codec_enc_cfg_map_t           *cfg_maps;      /**< \copydoc ::vpx_codec_enc_cfg_map_t */
@@ -401,35 +402,12 @@ struct vpx_codec_priv_enc_mr_cfg
 #undef VPX_CTRL_USE_TYPE
 #define VPX_CTRL_USE_TYPE(id, typ) \
   static typ id##__value(va_list args) {return va_arg(args, typ);} \
-  static typ id##__convert(void *x)\
-  {\
-    union\
-    {\
-      void *x;\
-      typ   d;\
-    } u;\
-    u.x = x;\
-    return u.d;\
-  }
-
 
 #undef VPX_CTRL_USE_TYPE_DEPRECATED
 #define VPX_CTRL_USE_TYPE_DEPRECATED(id, typ) \
   static typ id##__value(va_list args) {return va_arg(args, typ);} \
-  static typ id##__convert(void *x)\
-  {\
-    union\
-    {\
-      void *x;\
-      typ   d;\
-    } u;\
-    u.x = x;\
-    return u.d;\
-  }
 
 #define CAST(id, arg) id##__value(arg)
-#define RECAST(id, x) id##__convert(x)
-
 
 /* CODEC_INTERFACE convenience macro
  *
@@ -476,6 +454,7 @@ vpx_codec_pkt_list_get(struct vpx_codec_pkt_list *list,
 
 #include <stdio.h>
 #include <setjmp.h>
+
 struct vpx_internal_error_info {
   vpx_codec_err_t  error_code;
   int              has_detail;
@@ -532,4 +511,8 @@ vpx_codec_err_t vpx_validate_mmaps(const vpx_codec_stream_info_t *si,
                                    const vpx_codec_mmap_t *mmaps,
                                    const mem_req_t *mem_reqs, int nreqs,
                                    vpx_codec_flags_t init_flags);
+#ifdef __cplusplus
+}  // extern "C"
+#endif
+
 #endif  // VPX_INTERNAL_VPX_CODEC_INTERNAL_H_