1474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org/*
2474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org *  Copyright (c) 2010 The WebM project authors. All Rights Reserved.
3474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org *
4474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org *  Use of this source code is governed by a BSD-style license
5474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org *  that can be found in the LICENSE file in the root of the source
6474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org *  tree. An additional intellectual property rights grant can be found
7474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org *  in the file PATENTS.  All contributing project authors may
8474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org *  be found in the AUTHORS file in the root of the source tree.
9474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org */
10474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org
11474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org
12474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org/*!\file
13474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org * \brief Describes the decoder algorithm interface for algorithm
14474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org *        implementations.
15474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org *
16474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org * This file defines the private structures and data types that are only
17474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org * relevant to implementing an algorithm, as opposed to using it.
18474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org *
19474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org * To create a decoder algorithm class, an interface structure is put
20474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org * into the global namespace:
21474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org *     <pre>
22474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org *     my_codec.c:
23474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org *       vpx_codec_iface_t my_codec = {
24474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org *           "My Codec v1.0",
25474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org *           VPX_CODEC_ALG_ABI_VERSION,
26474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org *           ...
27474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org *       };
28474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org *     </pre>
29474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org *
30474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org * An application instantiates a specific decoder instance by using
31474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org * vpx_codec_init() and a pointer to the algorithm's interface structure:
32474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org *     <pre>
33474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org *     my_app.c:
34474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org *       extern vpx_codec_iface_t my_codec;
35474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org *       {
36474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org *           vpx_codec_ctx_t algo;
37474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org *           res = vpx_codec_init(&algo, &my_codec);
38474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org *       }
39474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org *     </pre>
40474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org *
41474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org * Once initialized, the instance is manged using other functions from
42474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org * the vpx_codec_* family.
43474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org */
448b26fe55f3e4daa2311dbd2d95e8ac2b4e080685johannkoenig@chromium.org#ifndef VPX_INTERNAL_VPX_CODEC_INTERNAL_H_
458b26fe55f3e4daa2311dbd2d95e8ac2b4e080685johannkoenig@chromium.org#define VPX_INTERNAL_VPX_CODEC_INTERNAL_H_
46474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org#include "../vpx_decoder.h"
47474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org#include "../vpx_encoder.h"
48474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org#include <stdarg.h>
49474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org
50dddee1ec7cedf276305b107429f684539b105276johannkoenig@chromium.org#ifdef __cplusplus
51dddee1ec7cedf276305b107429f684539b105276johannkoenig@chromium.orgextern "C" {
52dddee1ec7cedf276305b107429f684539b105276johannkoenig@chromium.org#endif
53474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org
54474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org/*!\brief Current ABI version number
55474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org *
56474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org * \internal
57474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org * If this file is altered in any way that changes the ABI, this value
58474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org * must be bumped.  Examples include, but are not limited to, changing
59474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org * types, removing or reassigning enums, adding/removing/rearranging
60474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org * fields to structures
61474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org */
6276e516e2154f353aa02c504bac88afb0f95fefa7johannkoenig@chromium.org#define VPX_CODEC_INTERNAL_ABI_VERSION (5) /**<\hideinitializer*/
63474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org
64474eb7536515fb785e925cc9375d22817c416851hclam@chromium.orgtypedef struct vpx_codec_alg_priv  vpx_codec_alg_priv_t;
65167514562bbce1eb0566271d6cb41d90d2b5ffa0hclam@chromium.orgtypedef struct vpx_codec_priv_enc_mr_cfg vpx_codec_priv_enc_mr_cfg_t;
66474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org
67474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org/*!\brief init function pointer prototype
68474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org *
69474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org * Performs algorithm-specific initialization of the decoder context. This
70474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org * function is called by the generic vpx_codec_init() wrapper function, so
71474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org * plugins implementing this interface may trust the input parameters to be
72474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org * properly initialized.
73474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org *
74474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org * \param[in] ctx   Pointer to this instance's context
75474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org * \retval #VPX_CODEC_OK
76474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org *     The input stream was recognized and decoder initialized.
77474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org * \retval #VPX_CODEC_MEM_ERROR
78474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org *     Memory operation failed.
79474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org */
80167514562bbce1eb0566271d6cb41d90d2b5ffa0hclam@chromium.orgtypedef vpx_codec_err_t (*vpx_codec_init_fn_t)(vpx_codec_ctx_t *ctx,
816fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org                                               vpx_codec_priv_enc_mr_cfg_t *data);
82474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org
83474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org/*!\brief destroy function pointer prototype
84474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org *
85474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org * Performs algorithm-specific destruction of the decoder context. This
86474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org * function is called by the generic vpx_codec_destroy() wrapper function,
87474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org * so plugins implementing this interface may trust the input parameters
88474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org * to be properly initialized.
89474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org *
90474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org * \param[in] ctx   Pointer to this instance's context
91474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org * \retval #VPX_CODEC_OK
92474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org *     The input stream was recognized and decoder initialized.
93474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org * \retval #VPX_CODEC_MEM_ERROR
94474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org *     Memory operation failed.
95474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org */
96474eb7536515fb785e925cc9375d22817c416851hclam@chromium.orgtypedef vpx_codec_err_t (*vpx_codec_destroy_fn_t)(vpx_codec_alg_priv_t *ctx);
97474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org
98474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org/*!\brief parse stream info function pointer prototype
99474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org *
10047265f8fe3a36a426773454ad90d20c9aa616c24johannkoenig@chromium.org * Performs high level parsing of the bitstream. This function is called by the
10147265f8fe3a36a426773454ad90d20c9aa616c24johannkoenig@chromium.org * generic vpx_codec_peek_stream_info() wrapper function, so plugins
10247265f8fe3a36a426773454ad90d20c9aa616c24johannkoenig@chromium.org * implementing this interface may trust the input parameters to be properly
10347265f8fe3a36a426773454ad90d20c9aa616c24johannkoenig@chromium.org * initialized.
104474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org *
105474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org * \param[in]      data    Pointer to a block of data to parse
106474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org * \param[in]      data_sz Size of the data buffer
107474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org * \param[in,out]  si      Pointer to stream info to update. The size member
108474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org *                         \ref MUST be properly initialized, but \ref MAY be
109474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org *                         clobbered by the algorithm. This parameter \ref MAY
110474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org *                         be NULL.
111474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org *
112474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org * \retval #VPX_CODEC_OK
113474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org *     Bitstream is parsable and stream information updated
114474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org */
115474eb7536515fb785e925cc9375d22817c416851hclam@chromium.orgtypedef vpx_codec_err_t (*vpx_codec_peek_si_fn_t)(const uint8_t         *data,
1166fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org                                                  unsigned int           data_sz,
1176fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org                                                  vpx_codec_stream_info_t *si);
118474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org
119474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org/*!\brief Return information about the current stream.
120474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org *
121474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org * Returns information about the stream that has been parsed during decoding.
122474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org *
123474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org * \param[in]      ctx     Pointer to this instance's context
124474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org * \param[in,out]  si      Pointer to stream info to update. The size member
125474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org *                         \ref MUST be properly initialized, but \ref MAY be
126474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org *                         clobbered by the algorithm. This parameter \ref MAY
127474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org *                         be NULL.
128474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org *
129474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org * \retval #VPX_CODEC_OK
130474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org *     Bitstream is parsable and stream information updated
131474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org */
132474eb7536515fb785e925cc9375d22817c416851hclam@chromium.orgtypedef vpx_codec_err_t (*vpx_codec_get_si_fn_t)(vpx_codec_alg_priv_t    *ctx,
1336fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org                                                 vpx_codec_stream_info_t *si);
134474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org
135474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org/*!\brief control function pointer prototype
136474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org *
137474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org * This function is used to exchange algorithm specific data with the decoder
138474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org * instance. This can be used to implement features specific to a particular
139474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org * algorithm.
140474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org *
141474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org * This function is called by the generic vpx_codec_control() wrapper
142474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org * function, so plugins implementing this interface may trust the input
143474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org * parameters to be properly initialized. However,  this interface does not
144474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org * provide type safety for the exchanged data or assign meanings to the
145474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org * control codes. Those details should be specified in the algorithm's
146474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org * header file. In particular, the ctrl_id parameter is guaranteed to exist
147474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org * in the algorithm's control mapping table, and the data parameter may be NULL.
148474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org *
149474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org *
150474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org * \param[in]     ctx              Pointer to this instance's context
151474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org * \param[in]     ctrl_id          Algorithm specific control identifier
152474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org * \param[in,out] data             Data to exchange with algorithm instance.
153474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org *
154474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org * \retval #VPX_CODEC_OK
155474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org *     The internal state data was deserialized.
156474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org */
15788b47b29cc274dd19cddc37c1ce1834d97df282efgalligan@chromium.orgtypedef vpx_codec_err_t (*vpx_codec_control_fn_t)(vpx_codec_alg_priv_t *ctx,
15888b47b29cc274dd19cddc37c1ce1834d97df282efgalligan@chromium.org                                                  va_list ap);
159474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org
160474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org/*!\brief control function pointer mapping
161474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org *
162474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org * This structure stores the mapping between control identifiers and
163474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org * implementing functions. Each algorithm provides a list of these
164474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org * mappings. This list is searched by the vpx_codec_control() wrapper
165474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org * function to determine which function to invoke. The special
166474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org * value {0, NULL} is used to indicate end-of-list, and must be
167474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org * present. The special value {0, <non-null>} can be used as a catch-all
168474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org * mapping. This implies that ctrl_id values chosen by the algorithm
169474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org * \ref MUST be non-zero.
170474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org */
1716fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.orgtypedef const struct vpx_codec_ctrl_fn_map {
17288b47b29cc274dd19cddc37c1ce1834d97df282efgalligan@chromium.org  int ctrl_id;
17388b47b29cc274dd19cddc37c1ce1834d97df282efgalligan@chromium.org  vpx_codec_control_fn_t fn;
174474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org} vpx_codec_ctrl_fn_map_t;
175474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org
176474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org/*!\brief decode data function pointer prototype
177474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org *
178474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org * Processes a buffer of coded data. If the processing results in a new
179474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org * decoded frame becoming available, #VPX_CODEC_CB_PUT_SLICE and
180474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org * #VPX_CODEC_CB_PUT_FRAME events are generated as appropriate. This
181474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org * function is called by the generic vpx_codec_decode() wrapper function,
182474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org * so plugins implementing this interface may trust the input parameters
183474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org * to be properly initialized.
184474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org *
185474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org * \param[in] ctx          Pointer to this instance's context
186474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org * \param[in] data         Pointer to this block of new coded data. If
187474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org *                         NULL, a #VPX_CODEC_CB_PUT_FRAME event is posted
188474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org *                         for the previously decoded frame.
189474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org * \param[in] data_sz      Size of the coded data, in bytes.
190474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org *
191474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org * \return Returns #VPX_CODEC_OK if the coded data was processed completely
192474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org *         and future pictures can be decoded without error. Otherwise,
193474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org *         see the descriptions of the other error codes in ::vpx_codec_err_t
194474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org *         for recoverability capabilities.
195474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org */
196474eb7536515fb785e925cc9375d22817c416851hclam@chromium.orgtypedef vpx_codec_err_t (*vpx_codec_decode_fn_t)(vpx_codec_alg_priv_t  *ctx,
1976fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org                                                 const uint8_t         *data,
1986fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org                                                 unsigned int     data_sz,
1996fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org                                                 void        *user_priv,
2006fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org                                                 long         deadline);
201474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org
202474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org/*!\brief Decoded frames iterator
203474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org *
204474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org * Iterates over a list of the frames available for display. The iterator
205474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org * storage should be initialized to NULL to start the iteration. Iteration is
206474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org * complete when this function returns NULL.
207474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org *
208474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org * The list of available frames becomes valid upon completion of the
209474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org * vpx_codec_decode call, and remains valid until the next call to vpx_codec_decode.
210474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org *
211474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org * \param[in]     ctx      Pointer to this instance's context
212474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org * \param[in out] iter     Iterator storage, initialized to NULL
213474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org *
214474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org * \return Returns a pointer to an image, if one is ready for display. Frames
215474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org *         produced will always be in PTS (presentation time stamp) order.
216474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org */
2176fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.orgtypedef vpx_image_t *(*vpx_codec_get_frame_fn_t)(vpx_codec_alg_priv_t *ctx,
2186fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org                                                 vpx_codec_iter_t     *iter);
219474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org
22076e516e2154f353aa02c504bac88afb0f95fefa7johannkoenig@chromium.org/*!\brief Pass in external frame buffers for the decoder to use.
22176e516e2154f353aa02c504bac88afb0f95fefa7johannkoenig@chromium.org *
22276e516e2154f353aa02c504bac88afb0f95fefa7johannkoenig@chromium.org * Registers functions to be called when libvpx needs a frame buffer
22376e516e2154f353aa02c504bac88afb0f95fefa7johannkoenig@chromium.org * to decode the current frame and a function to be called when libvpx does
22476e516e2154f353aa02c504bac88afb0f95fefa7johannkoenig@chromium.org * not internally reference the frame buffer. This set function must
22576e516e2154f353aa02c504bac88afb0f95fefa7johannkoenig@chromium.org * be called before the first call to decode or libvpx will assume the
22676e516e2154f353aa02c504bac88afb0f95fefa7johannkoenig@chromium.org * default behavior of allocating frame buffers internally.
22776e516e2154f353aa02c504bac88afb0f95fefa7johannkoenig@chromium.org *
22876e516e2154f353aa02c504bac88afb0f95fefa7johannkoenig@chromium.org * \param[in] ctx          Pointer to this instance's context
22976e516e2154f353aa02c504bac88afb0f95fefa7johannkoenig@chromium.org * \param[in] cb_get       Pointer to the get callback function
23076e516e2154f353aa02c504bac88afb0f95fefa7johannkoenig@chromium.org * \param[in] cb_release   Pointer to the release callback function
23176e516e2154f353aa02c504bac88afb0f95fefa7johannkoenig@chromium.org * \param[in] cb_priv      Callback's private data
23276e516e2154f353aa02c504bac88afb0f95fefa7johannkoenig@chromium.org *
23376e516e2154f353aa02c504bac88afb0f95fefa7johannkoenig@chromium.org * \retval #VPX_CODEC_OK
23476e516e2154f353aa02c504bac88afb0f95fefa7johannkoenig@chromium.org *     External frame buffers will be used by libvpx.
23576e516e2154f353aa02c504bac88afb0f95fefa7johannkoenig@chromium.org * \retval #VPX_CODEC_INVALID_PARAM
23676e516e2154f353aa02c504bac88afb0f95fefa7johannkoenig@chromium.org *     One or more of the callbacks were NULL.
23776e516e2154f353aa02c504bac88afb0f95fefa7johannkoenig@chromium.org * \retval #VPX_CODEC_ERROR
23876e516e2154f353aa02c504bac88afb0f95fefa7johannkoenig@chromium.org *     Decoder context not initialized, or algorithm not capable of
23976e516e2154f353aa02c504bac88afb0f95fefa7johannkoenig@chromium.org *     using external frame buffers.
24076e516e2154f353aa02c504bac88afb0f95fefa7johannkoenig@chromium.org *
24176e516e2154f353aa02c504bac88afb0f95fefa7johannkoenig@chromium.org * \note
24276e516e2154f353aa02c504bac88afb0f95fefa7johannkoenig@chromium.org * When decoding VP9, the application may be required to pass in at least
24376e516e2154f353aa02c504bac88afb0f95fefa7johannkoenig@chromium.org * #VP9_MAXIMUM_REF_BUFFERS + #VPX_MAXIMUM_WORK_BUFFERS external frame
24476e516e2154f353aa02c504bac88afb0f95fefa7johannkoenig@chromium.org * buffers.
24576e516e2154f353aa02c504bac88afb0f95fefa7johannkoenig@chromium.org */
24676e516e2154f353aa02c504bac88afb0f95fefa7johannkoenig@chromium.orgtypedef vpx_codec_err_t (*vpx_codec_set_fb_fn_t)(
24776e516e2154f353aa02c504bac88afb0f95fefa7johannkoenig@chromium.org    vpx_codec_alg_priv_t *ctx,
24876e516e2154f353aa02c504bac88afb0f95fefa7johannkoenig@chromium.org    vpx_get_frame_buffer_cb_fn_t cb_get,
24976e516e2154f353aa02c504bac88afb0f95fefa7johannkoenig@chromium.org    vpx_release_frame_buffer_cb_fn_t cb_release, void *cb_priv);
250474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org
251474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org
252474eb7536515fb785e925cc9375d22817c416851hclam@chromium.orgtypedef vpx_codec_err_t (*vpx_codec_encode_fn_t)(vpx_codec_alg_priv_t  *ctx,
2536fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org                                                 const vpx_image_t     *img,
2546fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org                                                 vpx_codec_pts_t        pts,
2556fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org                                                 unsigned long          duration,
2566fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org                                                 vpx_enc_frame_flags_t  flags,
2576fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org                                                 unsigned long          deadline);
2586fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.orgtypedef const vpx_codec_cx_pkt_t *(*vpx_codec_get_cx_data_fn_t)(vpx_codec_alg_priv_t *ctx,
2596fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org                                                                vpx_codec_iter_t     *iter);
260474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org
261474eb7536515fb785e925cc9375d22817c416851hclam@chromium.orgtypedef vpx_codec_err_t
262474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org(*vpx_codec_enc_config_set_fn_t)(vpx_codec_alg_priv_t       *ctx,
263474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org                                 const vpx_codec_enc_cfg_t  *cfg);
264474eb7536515fb785e925cc9375d22817c416851hclam@chromium.orgtypedef vpx_fixed_buf_t *
265474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org(*vpx_codec_get_global_headers_fn_t)(vpx_codec_alg_priv_t   *ctx);
266474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org
267474eb7536515fb785e925cc9375d22817c416851hclam@chromium.orgtypedef vpx_image_t *
268474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org(*vpx_codec_get_preview_frame_fn_t)(vpx_codec_alg_priv_t   *ctx);
269474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org
270167514562bbce1eb0566271d6cb41d90d2b5ffa0hclam@chromium.orgtypedef vpx_codec_err_t
271167514562bbce1eb0566271d6cb41d90d2b5ffa0hclam@chromium.org(*vpx_codec_enc_mr_get_mem_loc_fn_t)(const vpx_codec_enc_cfg_t     *cfg,
2726fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org                                     void **mem_loc);
273167514562bbce1eb0566271d6cb41d90d2b5ffa0hclam@chromium.org
274474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org/*!\brief usage configuration mapping
275474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org *
276474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org * This structure stores the mapping between usage identifiers and
277474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org * configuration structures. Each algorithm provides a list of these
278474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org * mappings. This list is searched by the vpx_codec_enc_config_default()
279474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org * wrapper function to determine which config to return. The special value
280474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org * {-1, {0}} is used to indicate end-of-list, and must be present. At least
281474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org * one mapping must be present, in addition to the end-of-list.
282474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org *
283474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org */
2846fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.orgtypedef const struct vpx_codec_enc_cfg_map {
2856fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  int                 usage;
2866fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  vpx_codec_enc_cfg_t cfg;
287474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org} vpx_codec_enc_cfg_map_t;
288474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org
289474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org/*!\brief Decoder algorithm interface interface
290474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org *
291474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org * All decoders \ref MUST expose a variable of this type.
292474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org */
2936fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.orgstruct vpx_codec_iface {
2946fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  const char               *name;        /**< Identification String  */
2956fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  int                       abi_version; /**< Implemented ABI version */
2966fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  vpx_codec_caps_t          caps;    /**< Decoder capabilities */
2976fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  vpx_codec_init_fn_t       init;    /**< \copydoc ::vpx_codec_init_fn_t */
2986fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  vpx_codec_destroy_fn_t    destroy;     /**< \copydoc ::vpx_codec_destroy_fn_t */
2996fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  vpx_codec_ctrl_fn_map_t  *ctrl_maps;   /**< \copydoc ::vpx_codec_ctrl_fn_map_t */
3006fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  struct vpx_codec_dec_iface {
3016fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org    vpx_codec_peek_si_fn_t    peek_si;     /**< \copydoc ::vpx_codec_peek_si_fn_t */
30247265f8fe3a36a426773454ad90d20c9aa616c24johannkoenig@chromium.org    vpx_codec_get_si_fn_t     get_si;      /**< \copydoc ::vpx_codec_get_si_fn_t */
3036fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org    vpx_codec_decode_fn_t     decode;      /**< \copydoc ::vpx_codec_decode_fn_t */
3046fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org    vpx_codec_get_frame_fn_t  get_frame;   /**< \copydoc ::vpx_codec_get_frame_fn_t */
30576e516e2154f353aa02c504bac88afb0f95fefa7johannkoenig@chromium.org    vpx_codec_set_fb_fn_t     set_fb_fn;   /**< \copydoc ::vpx_codec_set_fb_fn_t */
3066fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  } dec;
3076fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  struct vpx_codec_enc_iface {
30841294d96d7dbf9bc215b09832a8336c5fb158f0bjohannkoenig@chromium.org    int                                cfg_map_count;
3096fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org    vpx_codec_enc_cfg_map_t           *cfg_maps;      /**< \copydoc ::vpx_codec_enc_cfg_map_t */
3106fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org    vpx_codec_encode_fn_t              encode;        /**< \copydoc ::vpx_codec_encode_fn_t */
3116fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org    vpx_codec_get_cx_data_fn_t         get_cx_data;   /**< \copydoc ::vpx_codec_get_cx_data_fn_t */
3126fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org    vpx_codec_enc_config_set_fn_t      cfg_set;       /**< \copydoc ::vpx_codec_enc_config_set_fn_t */
3136fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org    vpx_codec_get_global_headers_fn_t  get_glob_hdrs; /**< \copydoc ::vpx_codec_get_global_headers_fn_t */
3146fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org    vpx_codec_get_preview_frame_fn_t   get_preview;   /**< \copydoc ::vpx_codec_get_preview_frame_fn_t */
3156fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org    vpx_codec_enc_mr_get_mem_loc_fn_t  mr_get_mem_loc;   /**< \copydoc ::vpx_codec_enc_mr_get_mem_loc_fn_t */
3166fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  } enc;
317474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org};
318474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org
319474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org/*!\brief Callback function pointer / user data pair storage */
3206fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.orgtypedef struct vpx_codec_priv_cb_pair {
3216fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  union {
3226fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org    vpx_codec_put_frame_cb_fn_t    put_frame;
3236fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org    vpx_codec_put_slice_cb_fn_t    put_slice;
3246fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  } u;
3256fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  void                            *user_priv;
326474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org} vpx_codec_priv_cb_pair_t;
327474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org
328474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org
329474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org/*!\brief Instance private storage
330474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org *
331474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org * This structure is allocated by the algorithm's init function. It can be
332474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org * extended in one of two ways. First, a second, algorithm specific structure
333474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org * can be allocated and the priv member pointed to it. Alternatively, this
334474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org * structure can be made the first member of the algorithm specific structure,
335474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org * and the pointer cast to the proper type.
336474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org */
3376fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.orgstruct vpx_codec_priv {
3386fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  const char                     *err_detail;
3396fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  vpx_codec_flags_t               init_flags;
3406fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  struct {
3416fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org    vpx_codec_priv_cb_pair_t    put_frame_cb;
3426fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org    vpx_codec_priv_cb_pair_t    put_slice_cb;
3436fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  } dec;
3446fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  struct {
345d95585fb0ec024f6abd96f7b02e0df58019d46afjohannkoenig@chromium.org    vpx_fixed_buf_t             cx_data_dst_buf;
3466fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org    unsigned int                cx_data_pad_before;
3476fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org    unsigned int                cx_data_pad_after;
3486fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org    vpx_codec_cx_pkt_t          cx_data_pkt;
3496fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org    unsigned int                total_encoders;
3506fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  } enc;
351474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org};
352474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org
353167514562bbce1eb0566271d6cb41d90d2b5ffa0hclam@chromium.org/*
354167514562bbce1eb0566271d6cb41d90d2b5ffa0hclam@chromium.org * Multi-resolution encoding internal configuration
355167514562bbce1eb0566271d6cb41d90d2b5ffa0hclam@chromium.org */
356167514562bbce1eb0566271d6cb41d90d2b5ffa0hclam@chromium.orgstruct vpx_codec_priv_enc_mr_cfg
357167514562bbce1eb0566271d6cb41d90d2b5ffa0hclam@chromium.org{
358167514562bbce1eb0566271d6cb41d90d2b5ffa0hclam@chromium.org    unsigned int           mr_total_resolutions;
359167514562bbce1eb0566271d6cb41d90d2b5ffa0hclam@chromium.org    unsigned int           mr_encoder_id;
360167514562bbce1eb0566271d6cb41d90d2b5ffa0hclam@chromium.org    struct vpx_rational    mr_down_sampling_factor;
361167514562bbce1eb0566271d6cb41d90d2b5ffa0hclam@chromium.org    void*                  mr_low_res_mode_info;
362167514562bbce1eb0566271d6cb41d90d2b5ffa0hclam@chromium.org};
363167514562bbce1eb0566271d6cb41d90d2b5ffa0hclam@chromium.org
364474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org#undef VPX_CTRL_USE_TYPE
365474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org#define VPX_CTRL_USE_TYPE(id, typ) \
36641294d96d7dbf9bc215b09832a8336c5fb158f0bjohannkoenig@chromium.org  static VPX_INLINE typ id##__value(va_list args) {return va_arg(args, typ);}
367474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org
368474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org#undef VPX_CTRL_USE_TYPE_DEPRECATED
369474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org#define VPX_CTRL_USE_TYPE_DEPRECATED(id, typ) \
37041294d96d7dbf9bc215b09832a8336c5fb158f0bjohannkoenig@chromium.org  static VPX_INLINE typ id##__value(va_list args) {return va_arg(args, typ);}
371474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org
372474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org#define CAST(id, arg) id##__value(arg)
373474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org
374474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org/* CODEC_INTERFACE convenience macro
375474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org *
376474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org * By convention, each codec interface is a struct with extern linkage, where
377474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org * the symbol is suffixed with _algo. A getter function is also defined to
378474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org * return a pointer to the struct, since in some cases it's easier to work
379474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org * with text symbols than data symbols (see issue #169). This function has
380474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org * the same name as the struct, less the _algo suffix. The CODEC_INTERFACE
381474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org * macro is provided to define this getter function automatically.
382474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org */
383474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org#define CODEC_INTERFACE(id)\
3846fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  vpx_codec_iface_t* id(void) { return &id##_algo; }\
3856fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  vpx_codec_iface_t  id##_algo
386474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org
387474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org
388474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org/* Internal Utility Functions
389474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org *
390474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org * The following functions are intended to be used inside algorithms as
391474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org * utilities for manipulating vpx_codec_* data structures.
392474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org */
3936fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.orgstruct vpx_codec_pkt_list {
3946fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  unsigned int            cnt;
3956fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  unsigned int            max;
3966fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  struct vpx_codec_cx_pkt pkts[1];
397474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org};
398474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org
399474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org#define vpx_codec_pkt_list_decl(n)\
4006fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  union {struct vpx_codec_pkt_list head;\
4016fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org    struct {struct vpx_codec_pkt_list head;\
4026fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org      struct vpx_codec_cx_pkt    pkts[n];} alloc;}
403474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org
404474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org#define vpx_codec_pkt_list_init(m)\
4056fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  (m)->alloc.head.cnt = 0,\
4066fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org                        (m)->alloc.head.max = sizeof((m)->alloc.pkts) / sizeof((m)->alloc.pkts[0])
407474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org
408474eb7536515fb785e925cc9375d22817c416851hclam@chromium.orgint
409474eb7536515fb785e925cc9375d22817c416851hclam@chromium.orgvpx_codec_pkt_list_add(struct vpx_codec_pkt_list *,
410474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org                       const struct vpx_codec_cx_pkt *);
411474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org
4126fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.orgconst vpx_codec_cx_pkt_t *
413474eb7536515fb785e925cc9375d22817c416851hclam@chromium.orgvpx_codec_pkt_list_get(struct vpx_codec_pkt_list *list,
414474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org                       vpx_codec_iter_t           *iter);
415474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org
416474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org
417474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org#include <stdio.h>
418474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org#include <setjmp.h>
419dddee1ec7cedf276305b107429f684539b105276johannkoenig@chromium.org
4206fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.orgstruct vpx_internal_error_info {
4216fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  vpx_codec_err_t  error_code;
4226fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  int              has_detail;
4236fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  char             detail[80];
4246fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  int              setjmp;
4256fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org  jmp_buf          jmp;
426474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org};
427474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org
42841294d96d7dbf9bc215b09832a8336c5fb158f0bjohannkoenig@chromium.orgvoid vpx_internal_error(struct vpx_internal_error_info *info,
42941294d96d7dbf9bc215b09832a8336c5fb158f0bjohannkoenig@chromium.org                        vpx_codec_err_t                 error,
43041294d96d7dbf9bc215b09832a8336c5fb158f0bjohannkoenig@chromium.org                        const char                     *fmt,
43141294d96d7dbf9bc215b09832a8336c5fb158f0bjohannkoenig@chromium.org                        ...);
43241294d96d7dbf9bc215b09832a8336c5fb158f0bjohannkoenig@chromium.org
433dddee1ec7cedf276305b107429f684539b105276johannkoenig@chromium.org#ifdef __cplusplus
434dddee1ec7cedf276305b107429f684539b105276johannkoenig@chromium.org}  // extern "C"
435dddee1ec7cedf276305b107429f684539b105276johannkoenig@chromium.org#endif
436dddee1ec7cedf276305b107429f684539b105276johannkoenig@chromium.org
4378b26fe55f3e4daa2311dbd2d95e8ac2b4e080685johannkoenig@chromium.org#endif  // VPX_INTERNAL_VPX_CODEC_INTERNAL_H_
438