Merge commit '67afcefb35932b420998f6f3fda46c7c85848a3f'
authorMichael Niedermayer <michaelni@gmx.at>
Sun, 11 May 2014 23:57:02 +0000 (01:57 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Sun, 11 May 2014 23:57:02 +0000 (01:57 +0200)
* commit '67afcefb35932b420998f6f3fda46c7c85848a3f':
  lavc: Add new VDA hwaccel

Conflicts:
configure
libavcodec/vda.h
libavcodec/vda_h264.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
1  2 
configure
libavcodec/Makefile
libavcodec/allcodecs.c
libavcodec/h264_slice.c
libavcodec/vda.c
libavcodec/vda.h
libavcodec/vda_h264.c
libavcodec/vda_internal.h

diff --cc configure
+++ b/configure
@@@ -2192,25 -1894,14 +2192,27 @@@ h264_dxva2_hwaccel_deps="dxva2
  h264_dxva2_hwaccel_select="h264_decoder"
  h264_vaapi_hwaccel_deps="vaapi"
  h264_vaapi_hwaccel_select="h264_decoder"
 +h264_vda_decoder_deps="vda"
 +h264_vda_decoder_select="h264_decoder"
  h264_vda_hwaccel_deps="vda"
  h264_vda_hwaccel_select="h264_decoder"
+ h264_vda_old_hwaccel_deps="vda"
+ h264_vda_old_hwaccel_select="h264_decoder"
 +h264_vdpau_decoder_deps="vdpau"
 +h264_vdpau_decoder_select="h264_decoder"
  h264_vdpau_hwaccel_deps="vdpau"
  h264_vdpau_hwaccel_select="h264_decoder"
 +mpeg_vdpau_decoder_deps="vdpau"
 +mpeg_vdpau_decoder_select="mpeg2video_decoder"
 +mpeg_xvmc_hwaccel_deps="xvmc"
 +mpeg_xvmc_hwaccel_select="mpeg2video_decoder"
 +mpeg1_vdpau_decoder_deps="vdpau"
 +mpeg1_vdpau_decoder_select="mpeg1video_decoder"
  mpeg1_vdpau_hwaccel_deps="vdpau"
  mpeg1_vdpau_hwaccel_select="mpeg1video_decoder"
 +mpeg1_xvmc_hwaccel_deps="xvmc"
 +mpeg1_xvmc_hwaccel_select="mpeg1video_decoder"
 +mpeg2_crystalhd_decoder_select="crystalhd"
  mpeg2_dxva2_hwaccel_deps="dxva2"
  mpeg2_dxva2_hwaccel_select="mpeg2video_decoder"
  mpeg2_vaapi_hwaccel_deps="vaapi"
Simple merge
@@@ -79,10 -79,9 +79,11 @@@ void avcodec_register_all(void
      REGISTER_HWACCEL(H264_DXVA2,        h264_dxva2);
      REGISTER_HWACCEL(H264_VAAPI,        h264_vaapi);
      REGISTER_HWACCEL(H264_VDA,          h264_vda);
+     REGISTER_HWACCEL(H264_VDA_OLD,      h264_vda_old);
      REGISTER_HWACCEL(H264_VDPAU,        h264_vdpau);
 +    REGISTER_HWACCEL(MPEG1_XVMC,        mpeg1_xvmc);
      REGISTER_HWACCEL(MPEG1_VDPAU,       mpeg1_vdpau);
 +    REGISTER_HWACCEL(MPEG2_XVMC,        mpeg2_xvmc);
      REGISTER_HWACCEL(MPEG2_DXVA2,       mpeg2_dxva2);
      REGISTER_HWACCEL(MPEG2_VAAPI,       mpeg2_vaapi);
      REGISTER_HWACCEL(MPEG2_VDPAU,       mpeg2_vdpau);
Simple merge
index 0000000,f71fb16..170580f
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,72 +1,72 @@@
 - * This file is part of Libav.
+ /*
 - * Libav is free software; you can redistribute it and/or
++ * This file is part of FFmpeg.
+  *
 - * Libav is distributed in the hope that it will be useful,
++ * FFmpeg is free software; you can redistribute it and/or
+  * modify it under the terms of the GNU Lesser General Public
+  * License as published by the Free Software Foundation; either
+  * version 2.1 of the License, or (at your option) any later version.
+  *
 - * License along with Libav; if not, write to the Free Software
++ * FFmpeg is distributed in the hope that it will be useful,
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+  * Lesser General Public License for more details.
+  *
+  * You should have received a copy of the GNU Lesser General Public
++ * License along with FFmpeg; if not, write to the Free Software
+  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+  */
+ #include "config.h"
+ #include "libavutil/mem.h"
+ #include "vda.h"
+ #include "vda_internal.h"
+ #if CONFIG_H264_VDA_HWACCEL
+ AVVDAContext *av_vda_alloc_context(void)
+ {
+     AVVDAContext *ret = av_mallocz(sizeof(*ret));
+     if (ret)
+         ret->output_callback = ff_vda_output_callback;
+     return ret;
+ }
+ int av_vda_default_init(AVCodecContext *avctx)
+ {
+     avctx->hwaccel_context = av_vda_alloc_context();
+     if (!avctx->hwaccel_context)
+         return AVERROR(ENOMEM);
+     return ff_vda_default_init(avctx);
+ }
+ void av_vda_default_free(AVCodecContext *avctx)
+ {
+     ff_vda_default_free(avctx);
+     av_freep(&avctx->hwaccel_context);
+ }
+ void ff_vda_default_free(AVCodecContext *avctx)
+ {
+     AVVDAContext *vda = avctx->hwaccel_context;
+     if (vda && vda->decoder)
+         VDADecoderDestroy(vda->decoder);
+ }
+ #else
+ AVVDAContext *av_vda_alloc_context(void)
+ {
+     return NULL;
+ }
+ int av_vda_default_init(AVCodecContext *avctx)
+ {
+     return AVERROR(ENOSYS);
+ }
+ void av_vda_default_free(AVCodecContext *ctx)
+ {
+ }
+ #endif
@@@ -29,6 -29,9 +29,8 @@@
   * Public libavcodec VDA header.
   */
  
 -#include "libavcodec/version.h"
+ #include "libavcodec/avcodec.h"
  #include <stdint.h>
  
  // emmintrin.h is unable to compile with -std=c99 -Werror=missing-prototypes
   * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
   */
  
 +#include <CoreFoundation/CFDictionary.h>
  #include <CoreFoundation/CFNumber.h>
  #include <CoreFoundation/CFData.h>
 -#include <CoreFoundation/CFString.h>
  
 +#include "vda.h"
  #include "libavutil/avutil.h"
  #include "h264.h"
 -#include "vda.h"
 +
 +struct vda_buffer {
 +    CVPixelBufferRef cv_buffer;
 +};
+ #include "internal.h"
+ #include "vda_internal.h"
  
  typedef struct VDAContext {
      // The current bitstream buffer.
  
      // The reference size used for fast reallocation.
      int                  allocated_size;
+     CVImageBufferRef frame;
  } VDAContext;
  
 -/* Decoder callback that adds the VDA frame to the queue in display order. */
 +/* Decoder callback that adds the vda frame to the queue in display order. */
  static void vda_decoder_callback(void *vda_hw_ctx,
                                   CFDictionaryRef user_info,
                                   OSStatus status,
@@@ -127,14 -124,7 +131,14 @@@ static int vda_old_h264_decode_slice(AV
      return 0;
  }
  
- static int vda_h264_end_frame(AVCodecContext *avctx)
 +static void vda_h264_release_buffer(void *opaque, uint8_t *data)
 +{
 +    struct vda_buffer *context = opaque;
 +    CVPixelBufferRelease(context->cv_buffer);
 +    av_free(context);
 +}
 +
+ static int vda_old_h264_end_frame(AVCodecContext *avctx)
  {
      H264Context *h                      = avctx->priv_data;
      VDAContext *vda                     = avctx->internal->hwaccel_priv_data;
index 0000000,9d0ed80..457916b
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,33 +1,33 @@@
 - * This file is part of Libav.
+ /*
 - * Libav is free software; you can redistribute it and/or
++ * This file is part of FFmpeg.
+  *
 - * Libav is distributed in the hope that it will be useful,
++ * FFmpeg is free software; you can redistribute it and/or
+  * modify it under the terms of the GNU Lesser General Public
+  * License as published by the Free Software Foundation; either
+  * version 2.1 of the License, or (at your option) any later version.
+  *
 - * License along with Libav; if not, write to the Free Software
++ * FFmpeg is distributed in the hope that it will be useful,
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+  * Lesser General Public License for more details.
+  *
+  * You should have received a copy of the GNU Lesser General Public
++ * License along with FFmpeg; if not, write to the Free Software
+  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+  */
+ #ifndef AVCODEC_VDA_INTERNAL_H
+ #define AVCODEC_VDA_INTERNAL_H
+ #include "vda.h"
+ void ff_vda_output_callback(void *vda_hw_ctx,
+                             CFDictionaryRef user_info,
+                             OSStatus status,
+                             uint32_t infoFlags,
+                             CVImageBufferRef image_buffer);
+ int ff_vda_default_init(AVCodecContext *avctx);
+ void ff_vda_default_free(AVCodecContext *avctx);
+ #endif /* AVCODEC_VDA_INTERNAL_H */