00001 /* 00002 * VDA HW acceleration 00003 * 00004 * copyright (c) 2011 Sebastien Zwickert 00005 * 00006 * This file is part of FFmpeg. 00007 * 00008 * FFmpeg is free software; you can redistribute it and/or 00009 * modify it under the terms of the GNU Lesser General Public 00010 * License as published by the Free Software Foundation; either 00011 * version 2.1 of the License, or (at your option) any later version. 00012 * 00013 * FFmpeg is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00016 * Lesser General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU Lesser General Public 00019 * License along with FFmpeg; if not, write to the Free Software 00020 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00021 */ 00022 00023 #ifndef AVCODEC_VDA_H 00024 #define AVCODEC_VDA_H 00025 00032 #include <stdint.h> 00033 00034 // emmintrin.h is unable to compile with -std=c99 -Werror=missing-prototypes 00035 // http://openradar.appspot.com/8026390 00036 #undef __GNUC_STDC_INLINE__ 00037 00038 #define Picture QuickdrawPicture 00039 #include <VideoDecodeAcceleration/VDADecoder.h> 00040 #undef Picture 00041 00042 #include "libavcodec/version.h" 00043 00044 #if FF_API_VDA_ASYNC 00045 #include <pthread.h> 00046 #endif 00047 00055 #if FF_API_VDA_ASYNC 00056 00061 typedef struct { 00068 int64_t pts; 00069 00076 CVPixelBufferRef cv_buffer; 00077 00084 struct vda_frame *next_frame; 00085 } vda_frame; 00086 #endif 00087 00094 struct vda_context { 00101 VDADecoder decoder; 00102 00109 CVPixelBufferRef cv_buffer; 00110 00117 int use_sync_decoding; 00118 00119 #if FF_API_VDA_ASYNC 00120 00128 vda_frame *queue; 00129 00138 pthread_mutex_t queue_mutex; 00139 #endif 00140 00147 int width; 00148 00155 int height; 00156 00163 int format; 00164 00171 OSType cv_pix_fmt_type; 00172 00179 uint8_t *priv_bitstream; 00180 00187 int priv_bitstream_size; 00188 00195 int priv_allocated_size; 00196 }; 00197 00199 int ff_vda_create_decoder(struct vda_context *vda_ctx, 00200 uint8_t *extradata, 00201 int extradata_size); 00202 00204 int ff_vda_destroy_decoder(struct vda_context *vda_ctx); 00205 00206 #if FF_API_VDA_ASYNC 00207 00212 vda_frame *ff_vda_queue_pop(struct vda_context *vda_ctx); 00213 00219 void ff_vda_release_vda_frame(vda_frame *frame); 00220 #endif 00221 00226 #endif /* AVCODEC_VDA_H */