WebM VP8 Codec SDK
vpx/vpx_decoder.h
Go to the documentation of this file.
00001 /*
00002  *  Copyright (c) 2010 The WebM project authors. All Rights Reserved.
00003  *
00004  *  Use of this source code is governed by a BSD-style license
00005  *  that can be found in the LICENSE file in the root of the source
00006  *  tree. An additional intellectual property rights grant can be found
00007  *  in the file PATENTS.  All contributing project authors may
00008  *  be found in the AUTHORS file in the root of the source tree.
00009  */
00010 
00011 
00027 #ifdef __cplusplus
00028 extern "C" {
00029 #endif
00030 
00031 #ifndef VPX_DECODER_H
00032 #define VPX_DECODER_H
00033 #include "vpx_codec.h"
00034 
00043 #define VPX_DECODER_ABI_VERSION (2 + VPX_CODEC_ABI_VERSION) 
00053 #define VPX_CODEC_CAP_PUT_SLICE  0x10000 
00054 #define VPX_CODEC_CAP_PUT_FRAME  0x20000 
00055 #define VPX_CODEC_CAP_POSTPROC   0x40000 
00056 #define VPX_CODEC_CAP_ERROR_CONCEALMENT   0x80000 
00058 #define VPX_CODEC_CAP_INPUT_FRAGMENTS   0x100000 
00068 #define VPX_CODEC_CAP_FRAME_THREADING   0x200000 
00071 #define VPX_CODEC_USE_POSTPROC   0x10000 
00072 #define VPX_CODEC_USE_ERROR_CONCEALMENT 0x20000 
00074 #define VPX_CODEC_USE_INPUT_FRAGMENTS   0x40000 
00077 #define VPX_CODEC_USE_FRAME_THREADING   0x80000 
00086   typedef struct vpx_codec_stream_info {
00087     unsigned int sz;     
00088     unsigned int w;      
00089     unsigned int h;      
00090     unsigned int is_kf;  
00091   } vpx_codec_stream_info_t;
00092 
00093   /* REQUIRED FUNCTIONS
00094    *
00095    * The following functions are required to be implemented for all decoders.
00096    * They represent the base case functionality expected of all decoders.
00097    */
00098 
00099 
00105   typedef struct vpx_codec_dec_cfg {
00106     unsigned int threads; 
00107     unsigned int w;      
00108     unsigned int h;      
00109   } vpx_codec_dec_cfg_t; 
00138   vpx_codec_err_t vpx_codec_dec_init_ver(vpx_codec_ctx_t      *ctx,
00139                                          vpx_codec_iface_t    *iface,
00140                                          vpx_codec_dec_cfg_t  *cfg,
00141                                          vpx_codec_flags_t     flags,
00142                                          int                   ver);
00143 
00148 #define vpx_codec_dec_init(ctx, iface, cfg, flags) \
00149   vpx_codec_dec_init_ver(ctx, iface, cfg, flags, VPX_DECODER_ABI_VERSION)
00150 
00151 
00169   vpx_codec_err_t vpx_codec_peek_stream_info(vpx_codec_iface_t       *iface,
00170                                              const uint8_t           *data,
00171                                              unsigned int             data_sz,
00172                                              vpx_codec_stream_info_t *si);
00173 
00174 
00188   vpx_codec_err_t vpx_codec_get_stream_info(vpx_codec_ctx_t         *ctx,
00189                                             vpx_codec_stream_info_t *si);
00190 
00191 
00222   vpx_codec_err_t vpx_codec_decode(vpx_codec_ctx_t    *ctx,
00223                                    const uint8_t        *data,
00224                                    unsigned int            data_sz,
00225                                    void               *user_priv,
00226                                    long                deadline);
00227 
00228 
00244   vpx_image_t *vpx_codec_get_frame(vpx_codec_ctx_t  *ctx,
00245                                    vpx_codec_iter_t *iter);
00246 
00247 
00262   typedef void (*vpx_codec_put_frame_cb_fn_t)(void        *user_priv,
00263                                               const vpx_image_t *img);
00264 
00265 
00281   vpx_codec_err_t vpx_codec_register_put_frame_cb(vpx_codec_ctx_t             *ctx,
00282                                                   vpx_codec_put_frame_cb_fn_t  cb,
00283                                                   void                        *user_priv);
00284 
00285 
00302   typedef void (*vpx_codec_put_slice_cb_fn_t)(void         *user_priv,
00303                                               const vpx_image_t      *img,
00304                                               const vpx_image_rect_t *valid,
00305                                               const vpx_image_rect_t *update);
00306 
00307 
00323   vpx_codec_err_t vpx_codec_register_put_slice_cb(vpx_codec_ctx_t             *ctx,
00324                                                   vpx_codec_put_slice_cb_fn_t  cb,
00325                                                   void                        *user_priv);
00326 
00327 
00332 #endif
00333 
00334 #ifdef __cplusplus
00335 }
00336 #endif