$OpenBSD: patch-export_aud_aux_c,v 1.8 2019/02/18 10:05:39 ajacoutot Exp $

Update for newer FFmpeg API.

Index: export/aud_aux.c
--- export/aud_aux.c.orig
+++ export/aud_aux.c
@@ -326,10 +326,10 @@ static int tc_audio_init_ffmpeg(vob_t *vob, int o_code
 
     switch (o_codec) {
       case   0x50:
-        codeid = CODEC_ID_MP2;
+        codeid = AV_CODEC_ID_MP2;
         break;
       case 0x2000:
-        codeid = CODEC_ID_AC3;
+        codeid = AV_CODEC_ID_AC3;
         break;
       default:
         tc_warn("cannot init ffmpeg with %x", o_codec);
@@ -346,7 +346,7 @@ static int tc_audio_init_ffmpeg(vob_t *vob, int o_code
 
     //-- set parameters (bitrate, channels and sample-rate) --
     //--------------------------------------------------------
-    avcodec_get_context_defaults(&mpa_ctx);
+    avcodec_get_context_defaults3(&mpa_ctx, mpa_codec);
 #if LIBAVCODEC_VERSION_MAJOR < 53
     mpa_ctx.codec_type  = CODEC_TYPE_AUDIO;
 #else
@@ -359,11 +359,11 @@ static int tc_audio_init_ffmpeg(vob_t *vob, int o_code
     //-- open codec --
     //----------------
     TC_LOCK_LIBAVCODEC;
-    ret = avcodec_open(&mpa_ctx, mpa_codec);
+    ret = avcodec_open2(&mpa_ctx, mpa_codec, NULL);
     TC_UNLOCK_LIBAVCODEC;
     if (ret < 0) {
         tc_warn("tc_audio_init_ffmpeg: could not open %s codec !",
-                (codeid == CODEC_ID_MP2) ?"mpa" :"ac3");
+                (codeid == AV_CODEC_ID_MP2) ?"mpa" :"ac3");
         return(TC_EXPORT_ERROR);
     }
 
