Update API usage to deal with current vs new FFmpeg API.
Index: Makefile
===================================================================
RCS file: /home/cvs/ports/games/renpy/Makefile,v
retrieving revision 1.11
diff -u -p -u -p -r1.11 Makefile
--- Makefile 23 Apr 2018 22:47:41 -0000 1.11
+++ Makefile 18 Feb 2019 00:16:47 -0000
@@ -6,7 +6,7 @@ V = 6.17.7
MODPY_EGG_VERSION = ${V}.521
DISTNAME = renpy-${V}-source
PKGNAME = ${DISTNAME:S/-source//}
-REVISION = 1
+REVISION = 2
CATEGORIES = games
Index: patches/patch-module_ffdecode_c
===================================================================
RCS file: /home/cvs/ports/games/renpy/patches/patch-module_ffdecode_c,v
retrieving revision 1.3
diff -u -p -u -p -r1.3 patch-module_ffdecode_c
--- patches/patch-module_ffdecode_c 1 Apr 2018 09:30:18 -0000 1.3
+++ patches/patch-module_ffdecode_c 18 Feb 2019 00:15:57 -0000
@@ -1,11 +1,12 @@
$OpenBSD: patch-module_ffdecode_c,v 1.3 2018/04/01 09:30:18 landry Exp $
-Fix build with pygame 1.9.3
+- Fix build with pygame 1.9.3
+- Update for newer FFmpeg API
Index: module/ffdecode.c
--- module/ffdecode.c.orig
+++ module/ffdecode.c
-@@ -19,6 +19,7 @@
+@@ -19,10 +19,12 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
USA
*/
@@ -13,3 +14,89 @@ Index: module/ffdecode.c
#include <pygame/pygame.h>
#include <math.h>
#include <limits.h>
+ #include <libavutil/avstring.h>
++#include <libavutil/time.h>
+ #include <libavformat/avformat.h>
+ #include <libavcodec/avcodec.h>
+ #include <libswscale/swscale.h>
+@@ -101,8 +103,8 @@ typedef struct VideoState {
+ compensation */
+
+ #ifndef HAS_RESAMPLE
+- uint8_t audio_buf1[(AVCODEC_MAX_AUDIO_FRAME_SIZE * 3) / 2] __attribute__
((aligned (16))) ;
+- uint8_t audio_buf2[(AVCODEC_MAX_AUDIO_FRAME_SIZE * 3) / 2] __attribute__
((aligned (16))) ;
++ uint8_t audio_buf1[(192000 * 3) / 2] __attribute__ ((aligned (16))) ;
++ uint8_t audio_buf2[(192000 * 3) / 2] __attribute__ ((aligned (16))) ;
+ #else
+ uint8_t *audio_buf1;
+ #endif
+@@ -627,13 +629,13 @@ static void alloc_picture(void *opaque, PyObject *pysu
+
+ pixel = SDL_MapRGBA(surf->format, 1, 2, 3, 4);
+ if (bytes[0] == 4 && bytes[1] == 1) {
+- vp->fmt = PIX_FMT_ARGB;
++ vp->fmt = AV_PIX_FMT_ARGB;
+ } else if (bytes[0] == 4 && bytes[1] == 3) {
+- vp->fmt = PIX_FMT_ABGR;
++ vp->fmt = AV_PIX_FMT_ABGR;
+ } else if (bytes[0] == 1) {
+- vp->fmt = PIX_FMT_RGBA;
++ vp->fmt = AV_PIX_FMT_RGBA;
+ } else {
+- vp->fmt = PIX_FMT_BGRA;
++ vp->fmt = AV_PIX_FMT_BGRA;
+ }
+
+ pixel = SDL_MapRGBA(surf->format, 0, 0, 0, 255);
+@@ -756,7 +758,7 @@ static int video_thread(void *arg)
+ double pts;
+
+ for(;;) {
+- frame = avcodec_alloc_frame();
++ frame = av_frame_alloc();
+
+ while (is->paused && !is->videoq.abort_request) {
+ SDL_Delay(2);
+@@ -816,10 +818,10 @@ static int audio_decode_frame(VideoState *is, double *
+ int resample_changed, audio_resample;
+
+ if (!is->frame) {
+- if (!(is->frame = avcodec_alloc_frame()))
++ if (!(is->frame = av_frame_alloc()))
+ return AVERROR(ENOMEM);
+ } else
+- avcodec_get_frame_defaults(is->frame);
++ av_frame_unref(is->frame);
+
+ if (flush_complete)
+ break;
+@@ -836,7 +838,7 @@ static int audio_decode_frame(VideoState *is, double *
+
+ if (!got_frame) {
+ /* stop sending empty packets if the decoder is finished */
+- if (!pkt_temp->data && dec->codec->capabilities &
CODEC_CAP_DELAY)
++ if (!pkt_temp->data && dec->codec->capabilities &
AV_CODEC_CAP_DELAY)
+ flush_complete = 1;
+ continue;
+ }
+@@ -1231,9 +1233,9 @@ static int stream_component_open(VideoState *is, int s
+ /* prepare audio output */
+ if (enc->codec_type == AVMEDIA_TYPE_AUDIO) {
+ if (enc->channels > 0) {
+- enc->request_channels = FFMIN(2, enc->channels);
++ enc->request_channel_layout =
av_get_default_channel_layout(FFMIN(2, enc->channels));
+ } else {
+- enc->request_channels = 2;
++ enc->request_channel_layout = av_get_default_channel_layout(2);
+ }
+ }
+
+@@ -1242,7 +1244,7 @@ static int stream_component_open(VideoState *is, int s
+ enc->debug = debug;
+ enc->workaround_bugs = workaround_bugs;
+ enc->idct_algo= idct;
+- if(fast) enc->flags2 |= CODEC_FLAG2_FAST;
++ if(fast) enc->flags2 |= AV_CODEC_FLAG2_FAST;
+ enc->skip_frame= skip_frame;
+ enc->skip_idct= skip_idct;
+ enc->skip_loop_filter= skip_loop_filter;