$OpenBSD: patch-import_import_ffmpeg_c,v 1.4 2014/05/05 11:51:37 brad Exp $

Update for newer FFmpeg API.

--- import/import_ffmpeg.c.orig	Sat Nov 19 11:50:27 2011
+++ import/import_ffmpeg.c	Fri Apr 25 22:30:34 2014
@@ -225,6 +225,7 @@ MOD_open {
   int extra_data_size = 0;
   long sret;
   int ret;
+  AVDictionary *opts = NULL;
 
   if (param->flag == TC_VIDEO) {
 
@@ -302,7 +303,7 @@ do_avi:
 
     // Set these to the expected values so that ffmpeg's decoder can
     // properly detect interlaced input.
-    lavc_dec_context = avcodec_alloc_context();
+    lavc_dec_context = avcodec_alloc_context3(lavc_dec_codec);
     if (lavc_dec_context == NULL) {
       tc_log_error(MOD_NAME, "Could not allocate enough memory.");
       return TC_IMPORT_ERROR;
@@ -311,11 +312,7 @@ do_avi:
     lavc_dec_context->height = y_dim;
 
     if (vob->decolor) lavc_dec_context->flags |= CODEC_FLAG_GRAY;
-#if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0)
-    lavc_dec_context->error_resilience  = 2;
-#else
-    lavc_dec_context->error_recognition = 2;
-#endif
+    av_dict_set(&opts, "err_detect", "compliant", 0);
     lavc_dec_context->error_concealment = 3;
     lavc_dec_context->workaround_bugs = FF_BUG_AUTODETECT;
     lavc_dec_context->codec_tag= (fourCC[0]<<24) | (fourCC[1]<<16) |
@@ -344,7 +341,7 @@ do_avi:
     }
 
     TC_LOCK_LIBAVCODEC;
-    ret = avcodec_open(lavc_dec_context, lavc_dec_codec);
+    ret = avcodec_open2(lavc_dec_context, lavc_dec_codec, &opts);
     TC_UNLOCK_LIBAVCODEC;
     if (ret < 0) {
       tc_log_warn(MOD_NAME, "Could not initialize the '%s' codec.",
