summaryrefslogtreecommitdiff
blob: d232ee22337e1b5c44e3fa2d1edc944d4c700b62 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
--- a/src/gfxoutputdrv/ffmpegdrv.c
+++ b/src/gfxoutputdrv/ffmpegdrv.c
@@ -46,6 +46,13 @@
 #include "util.h"
 #include "soundmovie.h"
 
+/** \brief  Helper macro to determine ffmpeg version
+ */
+#if (LIBAVCODEC_VERSION_MAJOR >= 58) && (LIBAVCODEC_VERSION_MINOR >= 18)
+# define HAVE_FFMPEG4
+#endif
+
+
 static gfxoutputdrv_codec_t avi_audio_codeclist[] = {
     { AV_CODEC_ID_MP2, "MP2" },
     { AV_CODEC_ID_MP3, "MP3" },
@@ -354,7 +361,11 @@
     }
 
     audio_is_open = 1;
+#ifdef HAVE_FFMPEG4
+    if (c->codec->capabilities & AV_CODEC_CAP_VARIABLE_FRAME_SIZE) {
+#else
     if (c->codec->capabilities & CODEC_CAP_VARIABLE_FRAME_SIZE) {
+#endif
         audio_inbuf_samples = 10000;
     } else {
         audio_inbuf_samples = c->frame_size;
@@ -447,8 +458,13 @@
     audio_st.samples_count = 0;
 
     /* Some formats want stream headers to be separate. */
-    if (ffmpegdrv_oc->oformat->flags & AVFMT_GLOBALHEADER)
+    if (ffmpegdrv_oc->oformat->flags & AVFMT_GLOBALHEADER) {
+#ifdef HAVE_FFMPEG4
+        c->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
+#else
         c->flags |= CODEC_FLAG_GLOBAL_HEADER;
+#endif
+    }
 
     /* create resampler context */
 #ifndef HAVE_FFMPEG_AVRESAMPLE
@@ -781,7 +797,11 @@
 
     /* Some formats want stream headers to be separate. */
     if (ffmpegdrv_oc->oformat->flags & AVFMT_GLOBALHEADER) {
+#ifdef HAVE_FFMPEG4
+        c->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
+#else
         c->flags |= CODEC_FLAG_GLOBAL_HEADER;
+#endif
     }
 
     if (audio_init_done) {
@@ -961,6 +981,7 @@
 
     video_st.frame->pts = video_st.next_pts++;
 
+#ifdef AVFMT_RAWPICTURE
     if (ffmpegdrv_oc->oformat->flags & AVFMT_RAWPICTURE) {
         AVPacket pkt;
         VICE_P_AV_INIT_PACKET(&pkt);
@@ -971,7 +992,9 @@
         pkt.pts = pkt.dts = video_st.frame->pts;
 
         ret = VICE_P_AV_INTERLEAVED_WRITE_FRAME(ffmpegdrv_oc, &pkt);
-    } else {
+    } else
+#endif
+    {
         AVPacket pkt = { 0 };
         int got_packet;