[hedgewars] 03/03: Upload to unstable

Gianfranco Costamagna locutusofborg-guest at moszumanska.debian.org
Wed Jan 6 13:33:30 UTC 2016


This is an automated email from the git hooks/post-receive script.

locutusofborg-guest pushed a commit to branch master
in repository hedgewars.

commit deafeb01db7517422310d94204a86a1d85680e66
Author: Gianfranco Costamagna <costamagnagianfranco at yahoo.it>
Date:   Wed Jan 6 14:20:11 2016 +0100

    Upload to unstable
---
 debian/changelog                                   |  30 +-
 ...More-refinements-about-version-contraints.patch |  92 ------
 .../0001-Update-for-retrocompatibility.patch       | 114 --------
 .../14a48ec6c0e4e7c4c475eacc9ae3b093656c163a.patch |  56 ++++
 .../2488090353fc122b4af030ea55bbff494c204c9b.patch |  36 +++
 .../3e1856bb563ad889e113f5ba440196e1c9e07b50.patch |  25 ++
 .../5de297c5621455b9117aa7caca2785d21ae1bf04.patch |  27 ++
 .../62e5519664f25ccdbdeb51e3e08c9017c95b25c1.patch |  31 ++
 .../7bb49917ebcd9734dd5a44bffa645d3889e60e72.patch |  24 ++
 .../850e289b11dbe0415ba909ef87e13533c0e6ee41.patch |  39 +++
 .../93292d80924aeadfda9f327ba78891cc4bab6c3c.patch |  22 ++
 .../9da8e039c97c4a52161bd563b75ffa35acd75ec5.patch |  22 ++
 .../a0e5bd1d4d77c1558394d9ac6b6b8a5030ef5282.patch |  31 ++
 .../ab7e24456dd3dec808862f14d831c7abb14aadc9.patch |  29 ++
 .../ce3a58617e5732376b4ef5d47fc2be73b705a154.patch |  24 ++
 .../e8654674c5ee580b2ec8392d3ae732c10195c039.patch | 312 +++++++++++++++++++++
 .../f121e6c350a041a429a57ba4748ad673aa8420ea.patch |  31 ++
 debian/patches/ffmpeg_2.9.patch                    |  76 -----
 debian/patches/series                              |  17 +-
 19 files changed, 745 insertions(+), 293 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 31b035d..5fa388d 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,13 +1,27 @@
-hedgewars (0.9.22-dfsg-3) unstable; urgency=medium
-
-  [ Andreas Cadhalpun ]
-  * d/p/ffmpeg_2.9.patch: update for ffmpeg_2.9 compatibility (Closes: #803825).
-  * d/p/0001-More-refinements-about-version-contraints.patch:
-    refine the version constraints
+hedgewars (0.9.22-dfsg-3) unstable; urgency=low
+
+  [ Andreas Cadhalpun, Vittorio Giovara, Gianfranco Costamagna ]
+  * update for ffmpeg_2.9 compatibility (Closes: #803825).
+    (cherry-pick from upstream, the patches from the bug report
+     weren't working on older libav implementation, e.g. ubuntu precise)
+    - debian/patches/e8654674c5ee580b2ec8392d3ae732c10195c039.patch:
+    - debian/patches/62e5519664f25ccdbdeb51e3e08c9017c95b25c1.patch:
+    - debian/patches/5de297c5621455b9117aa7caca2785d21ae1bf04.patch:
+    - debian/patches/9da8e039c97c4a52161bd563b75ffa35acd75ec5.patch:
+    - debian/patches/ab7e24456dd3dec808862f14d831c7abb14aadc9.patch:
+    - debian/patches/7bb49917ebcd9734dd5a44bffa645d3889e60e72.patch:
+    - debian/patches/2488090353fc122b4af030ea55bbff494c204c9b.patch:
+    - debian/patches/3e1856bb563ad889e113f5ba440196e1c9e07b50.patch:
+    - debian/patches/850e289b11dbe0415ba909ef87e13533c0e6ee41.patch:
+    - debian/patches/14a48ec6c0e4e7c4c475eacc9ae3b093656c163a.patch:
+    - debian/patches/a0e5bd1d4d77c1558394d9ac6b6b8a5030ef5282.patch:
+    - debian/patches/ce3a58617e5732376b4ef5d47fc2be73b705a154.patch:
+    - debian/patches/93292d80924aeadfda9f327ba78891cc4bab6c3c.patch:
+    - debian/patches/f121e6c350a041a429a57ba4748ad673aa8420ea.patch:
 
   [ Gianfranco Costamagna ]
-  * d/p/0001-Update-for-retrocompatibility.patch
-    update ffmpeg_2.9.patch to work also with older ffmpeg/libav implementations.
+  * change priority for dbg package.
+  * Fix watch file.
 
  -- Gianfranco Costamagna <locutusofborg at debian.org>  Tue, 03 Nov 2015 10:38:33 +0100
 
diff --git a/debian/patches/0001-More-refinements-about-version-contraints.patch b/debian/patches/0001-More-refinements-about-version-contraints.patch
deleted file mode 100644
index 5558930..0000000
--- a/debian/patches/0001-More-refinements-about-version-contraints.patch
+++ /dev/null
@@ -1,92 +0,0 @@
-From f7b192c76aa933c327b4b22d94e0033b855f9330 Mon Sep 17 00:00:00 2001
-From: Andreas Cadhalpun <andreas.cadhalpun at googlemail.com>
-Date: Wed, 4 Nov 2015 10:44:27 +0100
-Subject: [PATCH] More refinements about version contraints
-
----
- QTfrontend/util/LibavInteraction.cpp |  2 +-
- hedgewars/avwrapper/avwrapper.c      | 14 +++++++-------
- 2 files changed, 8 insertions(+), 8 deletions(-)
-
-diff --git a/QTfrontend/util/LibavInteraction.cpp b/QTfrontend/util/LibavInteraction.cpp
-index 425368c..0a3cbc8 100644
---- a/QTfrontend/util/LibavInteraction.cpp
-+++ b/QTfrontend/util/LibavInteraction.cpp
-@@ -106,7 +106,7 @@ LibavInteraction::LibavInteraction() : QObject()
-             if (!pCodec->pix_fmts)
-                 continue;
-             bool yuv420Supported = false;
--#if LIBAVCODEC_VERSION_MAJOR > 56
-+#if LIBAVUTIL_VERSION_MAJOR > 51
-             for (const AVPixelFormat* pfmt = pCodec->pix_fmts; *pfmt != -1; pfmt++)
-                 if (*pfmt == AV_PIX_FMT_YUV420P)
- #else
-diff --git a/hedgewars/avwrapper/avwrapper.c b/hedgewars/avwrapper/avwrapper.c
-index 264014a..171fda7 100644
---- a/hedgewars/avwrapper/avwrapper.c
-+++ b/hedgewars/avwrapper/avwrapper.c
-@@ -158,7 +158,7 @@ static void AddAudioStream()
-     else
-         g_NumSamples = g_pAudio->frame_size;
-     g_pSamples = (int16_t*)av_malloc(g_NumSamples*g_Channels*sizeof(int16_t));
--#if LIBAVCODEC_VERSION_MAJOR > 56
-+#if LIBAVUTIL_VERSION_MAJOR > 52
-     g_pAFrame = av_frame_alloc();
- #else
-     g_pAFrame = avcodec_alloc_frame();
-@@ -245,7 +245,7 @@ static int AddVideoStream()
-     g_pVideo->time_base.den = g_Framerate.num;
-     g_pVideo->time_base.num = g_Framerate.den;
-     //g_pVideo->gop_size = 12; /* emit one intra frame every twelve frames at most */
--#if LIBAVCODEC_VERSION_MAJOR > 56
-+#if LIBAVUTIL_VERSION_MAJOR > 51
-     g_pVideo->pix_fmt = AV_PIX_FMT_YUV420P;
- #else
-     g_pVideo->pix_fmt = PIX_FMT_YUV420P;
-@@ -307,7 +307,7 @@ static int AddVideoStream()
- #endif
-         return FatalError("Could not open video codec %s", g_pVCodec->long_name);
- 
--#if LIBAVCODEC_VERSION_MAJOR > 56
-+#if LIBAVUTIL_VERSION_MAJOR > 52
-     g_pVFrame = av_frame_alloc();
- #else
-     g_pVFrame = avcodec_alloc_frame();
-@@ -330,14 +330,14 @@ static int WriteFrame(AVFrame* pFrame)
-     // write interleaved audio frame
-     if (g_pAStream)
-     {
--#if LIBAVCODEC_VERSION_MAJOR > 56
-+#if LIBAVFORMAT_VERSION_MAJOR > 55
-         VideoTime = (double)av_stream_get_end_pts(g_pVStream)*g_pVStream->time_base.num/g_pVStream->time_base.den;
- #else
-         VideoTime = (double)g_pVStream->pts.val*g_pVStream->time_base.num/g_pVStream->time_base.den;
- #endif
-         do
-         {
--#if LIBAVCODEC_VERSION_MAJOR > 56
-+#if LIBAVFORMAT_VERSION_MAJOR > 55
-             AudioTime = (double)av_stream_get_end_pts(g_pAStream)*g_pAStream->time_base.num/g_pAStream->time_base.den;
- #else
-             AudioTime = (double)g_pAStream->pts.val*g_pAStream->time_base.num/g_pAStream->time_base.den;
-@@ -547,7 +547,7 @@ AVWRAP_DECL int AVWrapper_Close()
-         avcodec_close(g_pVideo);
-         av_free(g_pVideo);
-         av_free(g_pVStream);
--#if LIBAVCODEC_VERSION_MAJOR > 56
-+#if LIBAVUTIL_VERSION_MAJOR > 52
-         av_frame_free(&g_pVFrame);
- #else
-         av_free(g_pVFrame);
-@@ -558,7 +558,7 @@ AVWRAP_DECL int AVWrapper_Close()
-         avcodec_close(g_pAudio);
-         av_free(g_pAudio);
-         av_free(g_pAStream);
--#if LIBAVCODEC_VERSION_MAJOR > 56
-+#if LIBAVUTIL_VERSION_MAJOR > 52
-         av_frame_free(&g_pAFrame);
- #else
-         av_free(g_pAFrame);
--- 
-2.1.4
-
diff --git a/debian/patches/0001-Update-for-retrocompatibility.patch b/debian/patches/0001-Update-for-retrocompatibility.patch
deleted file mode 100644
index 4df490a..0000000
--- a/debian/patches/0001-Update-for-retrocompatibility.patch
+++ /dev/null
@@ -1,114 +0,0 @@
-From 6f39de46e460eff795bc4fd68797f2d89fdaaf30 Mon Sep 17 00:00:00 2001
-From: Gianfranco Costamagna <costamagnagianfranco at yahoo.it>
-Date: Tue, 3 Nov 2015 11:10:32 +0100
-Subject: [PATCH] Update for retrocompatibility
-
----
- QTfrontend/util/LibavInteraction.cpp |  5 +++++
- hedgewars/avwrapper/avwrapper.c      | 29 +++++++++++++++++++++++++++++
- 2 files changed, 34 insertions(+)
-
-diff --git a/QTfrontend/util/LibavInteraction.cpp b/QTfrontend/util/LibavInteraction.cpp
-index 1a997dc..425368c 100644
---- a/QTfrontend/util/LibavInteraction.cpp
-+++ b/QTfrontend/util/LibavInteraction.cpp
-@@ -106,8 +106,13 @@ LibavInteraction::LibavInteraction() : QObject()
-             if (!pCodec->pix_fmts)
-                 continue;
-             bool yuv420Supported = false;
-+#if LIBAVCODEC_VERSION_MAJOR > 56
-             for (const AVPixelFormat* pfmt = pCodec->pix_fmts; *pfmt != -1; pfmt++)
-                 if (*pfmt == AV_PIX_FMT_YUV420P)
-+#else
-+            for (const PixelFormat* pfmt = pCodec->pix_fmts; *pfmt != -1; pfmt++)
-+                if (*pfmt == PIX_FMT_YUV420P)
-+#endif
-                 {
-                     yuv420Supported = true;
-                     break;
-diff --git a/hedgewars/avwrapper/avwrapper.c b/hedgewars/avwrapper/avwrapper.c
-index 0678883..264014a 100644
---- a/hedgewars/avwrapper/avwrapper.c
-+++ b/hedgewars/avwrapper/avwrapper.c
-@@ -158,7 +158,11 @@ static void AddAudioStream()
-     else
-         g_NumSamples = g_pAudio->frame_size;
-     g_pSamples = (int16_t*)av_malloc(g_NumSamples*g_Channels*sizeof(int16_t));
-+#if LIBAVCODEC_VERSION_MAJOR > 56
-     g_pAFrame = av_frame_alloc();
-+#else
-+    g_pAFrame = avcodec_alloc_frame();
-+#endif
-     if (!g_pAFrame)
-     {
-         Log("Could not allocate frame\n");
-@@ -241,7 +245,11 @@ static int AddVideoStream()
-     g_pVideo->time_base.den = g_Framerate.num;
-     g_pVideo->time_base.num = g_Framerate.den;
-     //g_pVideo->gop_size = 12; /* emit one intra frame every twelve frames at most */
-+#if LIBAVCODEC_VERSION_MAJOR > 56
-     g_pVideo->pix_fmt = AV_PIX_FMT_YUV420P;
-+#else
-+    g_pVideo->pix_fmt = PIX_FMT_YUV420P;
-+#endif
- 
-     // set quality
-     if (g_VQuality > 100)
-@@ -299,7 +307,12 @@ static int AddVideoStream()
- #endif
-         return FatalError("Could not open video codec %s", g_pVCodec->long_name);
- 
-+#if LIBAVCODEC_VERSION_MAJOR > 56
-     g_pVFrame = av_frame_alloc();
-+#else
-+    g_pVFrame = avcodec_alloc_frame();
-+#endif
-+
-     if (!g_pVFrame)
-         return FatalError("Could not allocate frame");
- 
-@@ -317,10 +330,18 @@ static int WriteFrame(AVFrame* pFrame)
-     // write interleaved audio frame
-     if (g_pAStream)
-     {
-+#if LIBAVCODEC_VERSION_MAJOR > 56
-         VideoTime = (double)av_stream_get_end_pts(g_pVStream)*g_pVStream->time_base.num/g_pVStream->time_base.den;
-+#else
-+        VideoTime = (double)g_pVStream->pts.val*g_pVStream->time_base.num/g_pVStream->time_base.den;
-+#endif
-         do
-         {
-+#if LIBAVCODEC_VERSION_MAJOR > 56
-             AudioTime = (double)av_stream_get_end_pts(g_pAStream)*g_pAStream->time_base.num/g_pAStream->time_base.den;
-+#else
-+            AudioTime = (double)g_pAStream->pts.val*g_pAStream->time_base.num/g_pAStream->time_base.den;
-+#endif
-             ret = WriteAudioFrame();
-         }
-         while (AudioTime < VideoTime && ret);
-@@ -526,14 +547,22 @@ AVWRAP_DECL int AVWrapper_Close()
-         avcodec_close(g_pVideo);
-         av_free(g_pVideo);
-         av_free(g_pVStream);
-+#if LIBAVCODEC_VERSION_MAJOR > 56
-         av_frame_free(&g_pVFrame);
-+#else
-+        av_free(g_pVFrame);
-+#endif
-     }
-     if (g_pAStream)
-     {
-         avcodec_close(g_pAudio);
-         av_free(g_pAudio);
-         av_free(g_pAStream);
-+#if LIBAVCODEC_VERSION_MAJOR > 56
-         av_frame_free(&g_pAFrame);
-+#else
-+        av_free(g_pAFrame);
-+#endif
-         av_free(g_pSamples);
-         fclose(g_pSoundFile);
-     }
--- 
-2.1.4
-
diff --git a/debian/patches/14a48ec6c0e4e7c4c475eacc9ae3b093656c163a.patch b/debian/patches/14a48ec6c0e4e7c4c475eacc9ae3b093656c163a.patch
new file mode 100644
index 0000000..ccf0df2
--- /dev/null
+++ b/debian/patches/14a48ec6c0e4e7c4c475eacc9ae3b093656c163a.patch
@@ -0,0 +1,56 @@
+From 14a48ec6c0e4e7c4c475eacc9ae3b093656c163a Mon Sep 17 00:00:00 2001
+From: Vittorio Giovara <vittorio.giovara at gmail.com>
+Date: Tue, 10 Nov 2015 13:53:15 +0100
+Subject: [PATCH] videorec: Appropriately rescale timestamps and duration
+
+Applies to both audio and video for them to be in sync.
+
+--HG--
+extra : hg-git-rename-source : git
+---
+ hedgewars/avwrapper/avwrapper.c | 18 ++++++++++++++----
+ 1 file changed, 14 insertions(+), 4 deletions(-)
+
+diff --git a/hedgewars/avwrapper/avwrapper.c b/hedgewars/avwrapper/avwrapper.c
+index cc7d712..f041af3 100644
+--- a/hedgewars/avwrapper/avwrapper.c
++++ b/hedgewars/avwrapper/avwrapper.c
+@@ -66,6 +66,17 @@ static uint8_t g_OutBuffer[OUTBUFFER_SIZE];
+ #if LIBAVCODEC_VERSION_MAJOR < 56
+ #define av_frame_alloc                      avcodec_alloc_frame
+ #define av_frame_free                       av_freep
++#define av_packet_rescale_ts                rescale_ts
++
++static void rescale_ts(AVPacket *pkt, AVRational ctb, AVRational stb)
++{
++    if (pkt->pts != AV_NOPTS_VALUE)
++        pkt->pts = av_rescale_q(pkt->pts, ctb, stb);
++    if (pkt->dts != AV_NOPTS_VALUE)
++        pkt->dts = av_rescale_q(pkt->dts, ctb, stb);
++    if (pkt->duration > 0)
++        pkt->duration = av_rescale_q(pkt->duration, ctb, stb);
++}
+ #endif
+ 
+ #if LIBAVCODEC_VERSION_MAJOR < 57
+@@ -216,6 +227,8 @@ static int WriteAudioFrame()
+         return FatalError("avcodec_encode_audio2 failed");
+     if (!got_packet)
+         return 0;
++
++    av_packet_rescale_ts(&Packet, g_pAudio->time_base, g_pAStream->time_base);
+ #else
+     if (NumSamples == 0)
+         return 0;
+@@ -374,10 +387,7 @@ static int WriteFrame(AVFrame* pFrame)
+         if (!got_packet)
+             return 0;
+ 
+-        if (Packet.pts != AV_NOPTS_VALUE)
+-            Packet.pts = av_rescale_q(Packet.pts, g_pVideo->time_base, g_pVStream->time_base);
+-        if (Packet.dts != AV_NOPTS_VALUE)
+-            Packet.dts = av_rescale_q(Packet.dts, g_pVideo->time_base, g_pVStream->time_base);
++        av_packet_rescale_ts(&Packet, g_pVideo->time_base, g_pVStream->time_base);
+ #else
+         Packet.size = avcodec_encode_video(g_pVideo, g_OutBuffer, OUTBUFFER_SIZE, pFrame);
+         if (Packet.size < 0)
diff --git a/debian/patches/2488090353fc122b4af030ea55bbff494c204c9b.patch b/debian/patches/2488090353fc122b4af030ea55bbff494c204c9b.patch
new file mode 100644
index 0000000..244444e
--- /dev/null
+++ b/debian/patches/2488090353fc122b4af030ea55bbff494c204c9b.patch
@@ -0,0 +1,36 @@
+From 2488090353fc122b4af030ea55bbff494c204c9b Mon Sep 17 00:00:00 2001
+From: Vittorio Giovara <vittorio.giovara at gmail.com>
+Date: Tue, 10 Nov 2015 13:53:12 +0100
+Subject: [PATCH] videorec: Fix flushing encoders
+
+When passing NULL frames, encoders empty their queues, but we have
+to stop polling from them when they don't any more data.
+
+--HG--
+extra : hg-git-rename-source : git
+---
+ hedgewars/avwrapper/avwrapper.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/hedgewars/avwrapper/avwrapper.c b/hedgewars/avwrapper/avwrapper.c
+index d6a07ab..232398c 100644
+--- a/hedgewars/avwrapper/avwrapper.c
++++ b/hedgewars/avwrapper/avwrapper.c
+@@ -508,7 +508,7 @@ AVWRAP_DECL int AVWrapper_Close()
+     {
+         do
+             ret = WriteFrame(NULL);
+-        while (ret >= 0);
++        while (ret > 0);
+         if (ret < 0)
+             return ret;
+     }
+@@ -517,7 +517,7 @@ AVWRAP_DECL int AVWrapper_Close()
+     {
+         ret = WriteAudioFrame();
+     }
+-    while(ret >= 0);
++    while(ret > 0);
+     if (ret < 0)
+         return ret;
+ 
diff --git a/debian/patches/3e1856bb563ad889e113f5ba440196e1c9e07b50.patch b/debian/patches/3e1856bb563ad889e113f5ba440196e1c9e07b50.patch
new file mode 100644
index 0000000..f305d7f
--- /dev/null
+++ b/debian/patches/3e1856bb563ad889e113f5ba440196e1c9e07b50.patch
@@ -0,0 +1,25 @@
+From 3e1856bb563ad889e113f5ba440196e1c9e07b50 Mon Sep 17 00:00:00 2001
+From: Vittorio Giovara <vittorio.giovara at gmail.com>
+Date: Tue, 10 Nov 2015 13:53:13 +0100
+Subject: [PATCH] videorec: Fully set frame properties
+
+--HG--
+extra : hg-git-rename-source : git
+---
+ hedgewars/avwrapper/avwrapper.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/hedgewars/avwrapper/avwrapper.c b/hedgewars/avwrapper/avwrapper.c
+index 232398c..3941ab6 100644
+--- a/hedgewars/avwrapper/avwrapper.c
++++ b/hedgewars/avwrapper/avwrapper.c
+@@ -311,6 +311,9 @@ static int AddVideoStream()
+     if (!g_pVFrame)
+         return FatalError("Could not allocate frame");
+ 
++    g_pVFrame->width = g_Width;
++    g_pVFrame->height = g_Height;
++    g_pVFrame->format = AV_PIX_FMT_YUV420P;
+     g_pVFrame->linesize[0] = g_Width;
+     g_pVFrame->linesize[1] = g_Width/2;
+     g_pVFrame->linesize[2] = g_Width/2;
diff --git a/debian/patches/5de297c5621455b9117aa7caca2785d21ae1bf04.patch b/debian/patches/5de297c5621455b9117aa7caca2785d21ae1bf04.patch
new file mode 100644
index 0000000..ddf815e
--- /dev/null
+++ b/debian/patches/5de297c5621455b9117aa7caca2785d21ae1bf04.patch
@@ -0,0 +1,27 @@
+From 5de297c5621455b9117aa7caca2785d21ae1bf04 Mon Sep 17 00:00:00 2001
+From: Vittorio Giovara <vittorio.giovara at gmail.com>
+Date: Thu, 12 Nov 2015 02:41:40 +0100
+Subject: [PATCH] libavinteraction: Adjust version guard for
+ av_codec_is_encoder()
+
+---
+ QTfrontend/util/LibavInteraction.cpp | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/QTfrontend/util/LibavInteraction.cpp b/QTfrontend/util/LibavInteraction.cpp
+index d5fbe37..0c62aa4 100644
+--- a/QTfrontend/util/LibavInteraction.cpp
++++ b/QTfrontend/util/LibavInteraction.cpp
+@@ -33,8 +33,11 @@ extern "C"
+ #include "HWApplication.h"
+ 
+ // compatibility section
+-#if LIBAVCODEC_VERSION_MAJOR < 55
++#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(54, 8, 0)
+ #define av_codec_is_encoder(x)          x->encode
++#endif
++
++#if LIBAVCODEC_VERSION_MAJOR < 55
+ #define AVCodecID                       CodecID
+ #endif
+ 
diff --git a/debian/patches/62e5519664f25ccdbdeb51e3e08c9017c95b25c1.patch b/debian/patches/62e5519664f25ccdbdeb51e3e08c9017c95b25c1.patch
new file mode 100644
index 0000000..4e74667
--- /dev/null
+++ b/debian/patches/62e5519664f25ccdbdeb51e3e08c9017c95b25c1.patch
@@ -0,0 +1,31 @@
+From 62e5519664f25ccdbdeb51e3e08c9017c95b25c1 Mon Sep 17 00:00:00 2001
+From: Vittorio Giovara <vittorio.giovara at gmail.com>
+Date: Wed, 4 Nov 2015 16:53:38 +0100
+Subject: [PATCH] Specify the enum type for Pixel and Sample formats
+
+---
+ QTfrontend/util/LibavInteraction.cpp | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/QTfrontend/util/LibavInteraction.cpp b/QTfrontend/util/LibavInteraction.cpp
+index ab76292..d5fbe37 100644
+--- a/QTfrontend/util/LibavInteraction.cpp
++++ b/QTfrontend/util/LibavInteraction.cpp
+@@ -116,7 +116,7 @@ LibavInteraction::LibavInteraction() : QObject()
+             if (!pCodec->pix_fmts)
+                 continue;
+             bool yuv420Supported = false;
+-            for (const AVPixelFormat* pfmt = pCodec->pix_fmts; *pfmt != -1; pfmt++)
++            for (const enum AVPixelFormat* pfmt = pCodec->pix_fmts; *pfmt != -1; pfmt++)
+                 if (*pfmt == AV_PIX_FMT_YUV420P)
+                 {
+                     yuv420Supported = true;
+@@ -131,7 +131,7 @@ LibavInteraction::LibavInteraction() : QObject()
+             if (!pCodec->sample_fmts)
+                 continue;
+             bool s16Supported = false;
+-            for (const AVSampleFormat* pfmt = pCodec->sample_fmts; *pfmt != -1; pfmt++)
++            for (const enum AVSampleFormat* pfmt = pCodec->sample_fmts; *pfmt != -1; pfmt++)
+                 if (*pfmt == AV_SAMPLE_FMT_S16)
+                 {
+                     s16Supported = true;
diff --git a/debian/patches/7bb49917ebcd9734dd5a44bffa645d3889e60e72.patch b/debian/patches/7bb49917ebcd9734dd5a44bffa645d3889e60e72.patch
new file mode 100644
index 0000000..7bc0089
--- /dev/null
+++ b/debian/patches/7bb49917ebcd9734dd5a44bffa645d3889e60e72.patch
@@ -0,0 +1,24 @@
+From 7bb49917ebcd9734dd5a44bffa645d3889e60e72 Mon Sep 17 00:00:00 2001
+From: Vittorio Giovara <vittorio.giovara at gmail.com>
+Date: Tue, 10 Nov 2015 13:53:10 +0100
+Subject: [PATCH] videorec: Make sure the audio packet is considered empty
+
+--HG--
+extra : hg-git-rename-source : git
+---
+ hedgewars/avwrapper/avwrapper.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/hedgewars/avwrapper/avwrapper.c b/hedgewars/avwrapper/avwrapper.c
+index 20b0785..d6a07ab 100644
+--- a/hedgewars/avwrapper/avwrapper.c
++++ b/hedgewars/avwrapper/avwrapper.c
+@@ -192,6 +192,8 @@ static int WriteAudioFrame()
+ 
+     AVPacket Packet;
+     av_init_packet(&Packet);
++    Packet.data = NULL;
++    Packet.size = 0;
+ 
+     int NumSamples = fread(g_pSamples, 2*g_Channels, g_NumSamples, g_pSoundFile);
+ 
diff --git a/debian/patches/850e289b11dbe0415ba909ef87e13533c0e6ee41.patch b/debian/patches/850e289b11dbe0415ba909ef87e13533c0e6ee41.patch
new file mode 100644
index 0000000..7483f43
--- /dev/null
+++ b/debian/patches/850e289b11dbe0415ba909ef87e13533c0e6ee41.patch
@@ -0,0 +1,39 @@
+From 850e289b11dbe0415ba909ef87e13533c0e6ee41 Mon Sep 17 00:00:00 2001
+From: Vittorio Giovara <vittorio.giovara at gmail.com>
+Date: Tue, 10 Nov 2015 13:53:14 +0100
+Subject: [PATCH] videorec: Always initialize audio and video time bases
+
+In both context and stream.
+
+--HG--
+extra : hg-git-rename-source : git
+---
+ hedgewars/avwrapper/avwrapper.c | 8 ++++++--
+ 1 file changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/hedgewars/avwrapper/avwrapper.c b/hedgewars/avwrapper/avwrapper.c
+index 3941ab6..cc7d712 100644
+--- a/hedgewars/avwrapper/avwrapper.c
++++ b/hedgewars/avwrapper/avwrapper.c
+@@ -149,6 +149,10 @@ static void AddAudioStream()
+     g_pAudio->sample_rate = g_Frequency;
+     g_pAudio->channels = g_Channels;
+ 
++    // set time base as invers of sample rate
++    g_pAudio->time_base.den = g_pAStream->time_base.den = g_Frequency;
++    g_pAudio->time_base.num = g_pAStream->time_base.num = 1;
++
+     // set quality
+     g_pAudio->bit_rate = 160000;
+ 
+@@ -254,8 +258,8 @@ static int AddVideoStream()
+        of which frame timestamps are represented. for fixed-fps content,
+        timebase should be 1/framerate and timestamp increments should be
+        identically 1. */
+-    g_pVideo->time_base.den = g_Framerate.num;
+-    g_pVideo->time_base.num = g_Framerate.den;
++    g_pVideo->time_base.den = g_pVStream->time_base.den = g_Framerate.num;
++    g_pVideo->time_base.num = g_pVStream->time_base.num = g_Framerate.den;
+     //g_pVideo->gop_size = 12; /* emit one intra frame every twelve frames at most */
+     g_pVideo->pix_fmt = AV_PIX_FMT_YUV420P;
+ 
diff --git a/debian/patches/93292d80924aeadfda9f327ba78891cc4bab6c3c.patch b/debian/patches/93292d80924aeadfda9f327ba78891cc4bab6c3c.patch
new file mode 100644
index 0000000..82bf8c8
--- /dev/null
+++ b/debian/patches/93292d80924aeadfda9f327ba78891cc4bab6c3c.patch
@@ -0,0 +1,22 @@
+From 93292d80924aeadfda9f327ba78891cc4bab6c3c Mon Sep 17 00:00:00 2001
+From: koda <vittorio.giovara at gmail.com>
+Date: Mon, 16 Nov 2015 13:59:04 +0100
+Subject: [PATCH] avwrapper: Adjust prefixed symobols version guard
+
+---
+ hedgewars/avwrapper/avwrapper.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/hedgewars/avwrapper/avwrapper.c b/hedgewars/avwrapper/avwrapper.c
+index 9ed00b4..3441f0f 100644
+--- a/hedgewars/avwrapper/avwrapper.c
++++ b/hedgewars/avwrapper/avwrapper.c
+@@ -79,7 +79,7 @@ static void rescale_ts(AVPacket *pkt, AVRational ctb, AVRational stb)
+ }
+ #endif
+ 
+-#if LIBAVCODEC_VERSION_MAJOR < 57
++#if LIBAVCODEC_VERSION_MAJOR < 56
+ #define AV_CODEC_CAP_DELAY                  CODEC_CAP_DELAY
+ #define AV_CODEC_CAP_VARIABLE_FRAME_SIZE    CODEC_CAP_VARIABLE_FRAME_SIZE
+ #define AV_CODEC_FLAG_GLOBAL_HEADER         CODEC_FLAG_GLOBAL_HEADER
diff --git a/debian/patches/9da8e039c97c4a52161bd563b75ffa35acd75ec5.patch b/debian/patches/9da8e039c97c4a52161bd563b75ffa35acd75ec5.patch
new file mode 100644
index 0000000..c7b22f8
--- /dev/null
+++ b/debian/patches/9da8e039c97c4a52161bd563b75ffa35acd75ec5.patch
@@ -0,0 +1,22 @@
+From 9da8e039c97c4a52161bd563b75ffa35acd75ec5 Mon Sep 17 00:00:00 2001
+From: Vittorio Giovara <vittorio.giovara at gmail.com>
+Date: Wed, 4 Nov 2015 16:53:43 +0100
+Subject: [PATCH] Let initialization happen in the appropriate function
+
+---
+ hedgewars/avwrapper/avwrapper.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/hedgewars/avwrapper/avwrapper.c b/hedgewars/avwrapper/avwrapper.c
+index b28c5db..2e90cce 100644
+--- a/hedgewars/avwrapper/avwrapper.c
++++ b/hedgewars/avwrapper/avwrapper.c
+@@ -190,7 +190,7 @@ static int WriteAudioFrame()
+     if (!g_pAStream)
+         return 0;
+ 
+-    AVPacket Packet = { 0 };
++    AVPacket Packet;
+     av_init_packet(&Packet);
+ 
+     int NumSamples = fread(g_pSamples, 2*g_Channels, g_NumSamples, g_pSoundFile);
diff --git a/debian/patches/a0e5bd1d4d77c1558394d9ac6b6b8a5030ef5282.patch b/debian/patches/a0e5bd1d4d77c1558394d9ac6b6b8a5030ef5282.patch
new file mode 100644
index 0000000..bfc6e39
--- /dev/null
+++ b/debian/patches/a0e5bd1d4d77c1558394d9ac6b6b8a5030ef5282.patch
@@ -0,0 +1,31 @@
+From a0e5bd1d4d77c1558394d9ac6b6b8a5030ef5282 Mon Sep 17 00:00:00 2001
+From: Vittorio Giovara <vittorio.giovara at gmail.com>
+Date: Tue, 10 Nov 2015 13:53:16 +0100
+Subject: [PATCH] videorec: Use future API for raw video encoding
+
+--HG--
+extra : hg-git-rename-source : git
+---
+ hedgewars/avwrapper/avwrapper.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/hedgewars/avwrapper/avwrapper.c b/hedgewars/avwrapper/avwrapper.c
+index f041af3..1f48af4 100644
+--- a/hedgewars/avwrapper/avwrapper.c
++++ b/hedgewars/avwrapper/avwrapper.c
+@@ -365,6 +365,7 @@ static int WriteFrame(AVFrame* pFrame)
+     Packet.size = 0;
+ 
+     g_pVFrame->pts++;
++#if LIBAVCODEC_VERSION_MAJOR < 58
+     if (g_pFormat->flags & AVFMT_RAWPICTURE)
+     {
+         /* raw video case. The API will change slightly in the near
+@@ -379,6 +380,7 @@ static int WriteFrame(AVFrame* pFrame)
+         return 0;
+     }
+     else
++#endif
+     {
+ #if LIBAVCODEC_VERSION_MAJOR >= 54
+         int got_packet;
diff --git a/debian/patches/ab7e24456dd3dec808862f14d831c7abb14aadc9.patch b/debian/patches/ab7e24456dd3dec808862f14d831c7abb14aadc9.patch
new file mode 100644
index 0000000..65dcf89
--- /dev/null
+++ b/debian/patches/ab7e24456dd3dec808862f14d831c7abb14aadc9.patch
@@ -0,0 +1,29 @@
+From ab7e24456dd3dec808862f14d831c7abb14aadc9 Mon Sep 17 00:00:00 2001
+From: koda <vittorio.giovara at gmail.com>
+Date: Sat, 7 Nov 2015 15:07:33 +0100
+Subject: [PATCH] videorec: Drop setting x264 preset
+
+It is the default one anyway.
+---
+ hedgewars/avwrapper/avwrapper.c | 8 +-------
+ 1 file changed, 1 insertion(+), 7 deletions(-)
+
+diff --git a/hedgewars/avwrapper/avwrapper.c b/hedgewars/avwrapper/avwrapper.c
+index 2e90cce..20b0785 100644
+--- a/hedgewars/avwrapper/avwrapper.c
++++ b/hedgewars/avwrapper/avwrapper.c
+@@ -302,13 +302,7 @@ static int AddVideoStream()
+ #endif
+ 
+     // open the codec
+-#if LIBAVCODEC_VERSION_MAJOR >= 53
+-    AVDictionary* pDict = NULL;
+-    if (strcmp(g_pVCodec->name, "libx264") == 0)
+-        av_dict_set(&pDict, "preset", "medium", 0);
+-#endif
+-
+-    if (avcodec_open2(g_pVideo, g_pVCodec, &pDict) < 0)
++    if (avcodec_open2(g_pVideo, g_pVCodec, NULL) < 0)
+         return FatalError("Could not open video codec %s", g_pVCodec->long_name);
+ 
+     g_pVFrame = av_frame_alloc();
diff --git a/debian/patches/ce3a58617e5732376b4ef5d47fc2be73b705a154.patch b/debian/patches/ce3a58617e5732376b4ef5d47fc2be73b705a154.patch
new file mode 100644
index 0000000..8f09c43
--- /dev/null
+++ b/debian/patches/ce3a58617e5732376b4ef5d47fc2be73b705a154.patch
@@ -0,0 +1,24 @@
+From ce3a58617e5732376b4ef5d47fc2be73b705a154 Mon Sep 17 00:00:00 2001
+From: Vittorio Giovara <vittorio.giovara at gmail.com>
+Date: Tue, 10 Nov 2015 13:53:40 +0100
+Subject: [PATCH] videorec: Drop a commented out option
+
+--HG--
+extra : hg-git-rename-source : git
+---
+ hedgewars/avwrapper/avwrapper.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/hedgewars/avwrapper/avwrapper.c b/hedgewars/avwrapper/avwrapper.c
+index 1f48af4..9ed00b4 100644
+--- a/hedgewars/avwrapper/avwrapper.c
++++ b/hedgewars/avwrapper/avwrapper.c
+@@ -273,7 +273,7 @@ static int AddVideoStream()
+        identically 1. */
+     g_pVideo->time_base.den = g_pVStream->time_base.den = g_Framerate.num;
+     g_pVideo->time_base.num = g_pVStream->time_base.num = g_Framerate.den;
+-    //g_pVideo->gop_size = 12; /* emit one intra frame every twelve frames at most */
++
+     g_pVideo->pix_fmt = AV_PIX_FMT_YUV420P;
+ 
+     // set quality
diff --git a/debian/patches/e8654674c5ee580b2ec8392d3ae732c10195c039.patch b/debian/patches/e8654674c5ee580b2ec8392d3ae732c10195c039.patch
new file mode 100644
index 0000000..d791586
--- /dev/null
+++ b/debian/patches/e8654674c5ee580b2ec8392d3ae732c10195c039.patch
@@ -0,0 +1,312 @@
+From e8654674c5ee580b2ec8392d3ae732c10195c039 Mon Sep 17 00:00:00 2001
+From: Vittorio Giovara <vittorio.giovara at gmail.com>
+Date: Wed, 4 Nov 2015 16:53:33 +0100
+Subject: [PATCH] Update libav API, keeping forward and backward compatibility
+
+---
+ QTfrontend/util/LibavInteraction.cpp | 38 +++++++++---------
+ hedgewars/avwrapper/avwrapper.c      | 76 +++++++++++++++++++++---------------
+ 2 files changed, 64 insertions(+), 50 deletions(-)
+
+diff --git a/QTfrontend/util/LibavInteraction.cpp b/QTfrontend/util/LibavInteraction.cpp
+index 7f2ed30..ab76292 100644
+--- a/QTfrontend/util/LibavInteraction.cpp
++++ b/QTfrontend/util/LibavInteraction.cpp
+@@ -21,7 +21,9 @@
+ #if VIDEOREC
+ extern "C"
+ {
++#include "libavcodec/avcodec.h"
+ #include "libavformat/avformat.h"
++#include "libavutil/avutil.h"
+ }
+ 
+ #include <QVector>
+@@ -30,13 +32,25 @@ extern "C"
+ 
+ #include "HWApplication.h"
+ 
+-#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(54, 25, 0)
+-#define CodecID AVCodecID
++// compatibility section
++#if LIBAVCODEC_VERSION_MAJOR < 55
++#define av_codec_is_encoder(x)          x->encode
++#define AVCodecID                       CodecID
++#endif
++
++#if LIBAVFORMAT_VERSION_MAJOR < 54
++#define avformat_find_stream_info(x, y) av_find_stream_info(x)
++#define avformat_close_input(x)         av_close_input_file(*(x))
++#endif
++
++#if LIBAVUTIL_VERSION_MAJOR < 54
++#define AVPixelFormat                   PixelFormat
++#define AV_PIX_FMT_YUV420P              PIX_FMT_YUV420P
+ #endif
+ 
+ struct Codec
+ {
+-    CodecID id;
++    AVCodecID id;
+     bool isAudio;
+     QString shortName; // used for identification
+     QString longName; // used for displaying to user
+@@ -56,7 +70,7 @@ QList<Codec> codecs;
+ QMap<QString,Format> formats;
+ 
+ // test if given format supports given codec
+-bool FormatQueryCodec(AVOutputFormat *ofmt, enum CodecID codec_id)
++bool FormatQueryCodec(AVOutputFormat *ofmt, enum AVCodecID codec_id)
+ {
+ #if LIBAVFORMAT_VERSION_MAJOR >= 54
+     return avformat_query_codec(ofmt, codec_id, FF_COMPLIANCE_NORMAL) == 1;
+@@ -76,11 +90,7 @@ LibavInteraction::LibavInteraction() : QObject()
+     AVCodec* pCodec = NULL;
+     while ((pCodec = av_codec_next(pCodec)))
+     {
+-#if LIBAVCODEC_VERSION_MAJOR >= 54
+         if (!av_codec_is_encoder(pCodec))
+-#else
+-        if (!pCodec->encode)
+-#endif
+             continue;
+ 
+         if (pCodec->type != AVMEDIA_TYPE_VIDEO && pCodec->type != AVMEDIA_TYPE_AUDIO)
+@@ -106,8 +116,8 @@ LibavInteraction::LibavInteraction() : QObject()
+             if (!pCodec->pix_fmts)
+                 continue;
+             bool yuv420Supported = false;
+-            for (const PixelFormat* pfmt = pCodec->pix_fmts; *pfmt != -1; pfmt++)
+-                if (*pfmt == PIX_FMT_YUV420P)
++            for (const AVPixelFormat* pfmt = pCodec->pix_fmts; *pfmt != -1; pfmt++)
++                if (*pfmt == AV_PIX_FMT_YUV420P)
+                 {
+                     yuv420Supported = true;
+                     break;
+@@ -274,11 +284,7 @@ QString LibavInteraction::getFileInfo(const QString & filepath)
+     QByteArray utf8path = filepath.toUtf8();
+     if (avformat_open_input(&pContext, utf8path.data(), NULL, NULL) < 0)
+         return "";
+-#if LIBAVFORMAT_VERSION_MAJOR < 53
+-    if (av_find_stream_info(pContext) < 0)
+-#else
+     if (avformat_find_stream_info(pContext, NULL) < 0)
+-#endif
+         return "";
+ 
+     int s = float(pContext->duration)/AV_TIME_BASE;
+@@ -312,11 +318,7 @@ QString LibavInteraction::getFileInfo(const QString & filepath)
+     AVDictionaryEntry* pComment = av_dict_get(pContext->metadata, "comment", NULL, 0);
+     if (pComment)
+         desc += QString("\n") + pComment->value;
+-#if LIBAVFORMAT_VERSION_MAJOR < 53
+-    av_close_input_file(pContext);
+-#else
+     avformat_close_input(&pContext);
+-#endif
+     return desc;
+ }
+ 
+diff --git a/hedgewars/avwrapper/avwrapper.c b/hedgewars/avwrapper/avwrapper.c
+index 9077de3..b28c5db 100644
+--- a/hedgewars/avwrapper/avwrapper.c
++++ b/hedgewars/avwrapper/avwrapper.c
+@@ -21,13 +21,12 @@
+ #include <stdint.h>
+ #include <string.h>
+ #include <stdarg.h>
++
++#include "libavcodec/avcodec.h"
+ #include "libavformat/avformat.h"
++#include "libavutil/avutil.h"
+ #include "libavutil/mathematics.h"
+ 
+-#ifndef AVIO_FLAG_WRITE
+-#define AVIO_FLAG_WRITE AVIO_WRONLY
+-#endif
+-
+ #if (defined _MSC_VER)
+ #define AVWRAP_DECL __declspec(dllexport)
+ #elif ((__GNUC__ >= 3) && (!__EMX__) && (!sun))
+@@ -57,11 +56,38 @@ static int16_t* g_pSamples;
+ static int g_NumSamples;
+ 
+ 
++// compatibility section
+ #if LIBAVCODEC_VERSION_MAJOR < 54
+ #define OUTBUFFER_SIZE 200000
+ static uint8_t g_OutBuffer[OUTBUFFER_SIZE];
++#define avcodec_open2(x, y, z)              avcodec_open(x, y)
++#endif
++
++#if LIBAVCODEC_VERSION_MAJOR < 56
++#define av_frame_alloc                      avcodec_alloc_frame
++#define av_frame_free                       av_freep
++#endif
++
++#if LIBAVCODEC_VERSION_MAJOR < 57
++#define AV_CODEC_CAP_DELAY                  CODEC_CAP_DELAY
++#define AV_CODEC_CAP_VARIABLE_FRAME_SIZE    CODEC_CAP_VARIABLE_FRAME_SIZE
++#define AV_CODEC_FLAG_GLOBAL_HEADER         CODEC_FLAG_GLOBAL_HEADER
++#define AV_CODEC_FLAG_QSCALE                CODEC_FLAG_QSCALE
++#endif
++
++#if LIBAVFORMAT_VERSION_MAJOR < 53
++#define AVIO_FLAG_WRITE                     AVIO_WRONLY
++#endif
++
++#if LIBAVFORMAT_VERSION_MAJOR < 54
++#define avformat_new_stream(x, y)           av_new_stream(x, y->type == AVMEDIA_TYPE_AUDIO)
++#endif
++
++#if LIBAVUTIL_VERSION_MAJOR < 54
++#define AV_PIX_FMT_YUV420P                  PIX_FMT_YUV420P
+ #endif
+ 
++
+ // pointer to function from hwengine (uUtils.pas)
+ static void (*AddFileLogRaw)(const char* pString);
+ 
+@@ -105,11 +131,7 @@ static void Log(const char* pFmt, ...)
+ 
+ static void AddAudioStream()
+ {
+-#if LIBAVFORMAT_VERSION_MAJOR >= 53
+     g_pAStream = avformat_new_stream(g_pContainer, g_pACodec);
+-#else
+-    g_pAStream = av_new_stream(g_pContainer, 1);
+-#endif
+     if(!g_pAStream)
+     {
+         Log("Could not allocate audio stream\n");
+@@ -131,26 +153,22 @@ static void AddAudioStream()
+     g_pAudio->bit_rate = 160000;
+ 
+     // for codecs that support variable bitrate use it, it should be better
+-    g_pAudio->flags |= CODEC_FLAG_QSCALE;
++    g_pAudio->flags |= AV_CODEC_FLAG_QSCALE;
+     g_pAudio->global_quality = 1*FF_QP2LAMBDA;
+ 
+     // some formats want stream headers to be separate
+     if (g_pFormat->flags & AVFMT_GLOBALHEADER)
+-        g_pAudio->flags |= CODEC_FLAG_GLOBAL_HEADER;
++        g_pAudio->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
+ 
+     // open it
+-#if LIBAVCODEC_VERSION_MAJOR >= 53
+     if (avcodec_open2(g_pAudio, g_pACodec, NULL) < 0)
+-#else
+-    if (avcodec_open(g_pAudio, g_pACodec) < 0)
+-#endif
+     {
+         Log("Could not open audio codec %s\n", g_pACodec->long_name);
+         return;
+     }
+ 
+ #if LIBAVCODEC_VERSION_MAJOR >= 54
+-    if (g_pACodec->capabilities & CODEC_CAP_VARIABLE_FRAME_SIZE)
++    if (g_pACodec->capabilities & AV_CODEC_CAP_VARIABLE_FRAME_SIZE)
+ #else
+     if (g_pAudio->frame_size == 0)
+ #endif
+@@ -158,7 +176,7 @@ static void AddAudioStream()
+     else
+         g_NumSamples = g_pAudio->frame_size;
+     g_pSamples = (int16_t*)av_malloc(g_NumSamples*g_Channels*sizeof(int16_t));
+-    g_pAFrame = avcodec_alloc_frame();
++    g_pAFrame = av_frame_alloc();
+     if (!g_pAFrame)
+     {
+         Log("Could not allocate frame\n");
+@@ -217,11 +235,7 @@ static int WriteAudioFrame()
+ // add a video output stream
+ static int AddVideoStream()
+ {
+-#if LIBAVFORMAT_VERSION_MAJOR >= 53
+     g_pVStream = avformat_new_stream(g_pContainer, g_pVCodec);
+-#else
+-    g_pVStream = av_new_stream(g_pContainer, 0);
+-#endif
+     if (!g_pVStream)
+         return FatalError("Could not allocate video stream");
+ 
+@@ -241,20 +255,20 @@ static int AddVideoStream()
+     g_pVideo->time_base.den = g_Framerate.num;
+     g_pVideo->time_base.num = g_Framerate.den;
+     //g_pVideo->gop_size = 12; /* emit one intra frame every twelve frames at most */
+-    g_pVideo->pix_fmt = PIX_FMT_YUV420P;
++    g_pVideo->pix_fmt = AV_PIX_FMT_YUV420P;
+ 
+     // set quality
+     if (g_VQuality > 100)
+         g_pVideo->bit_rate = g_VQuality;
+     else
+     {
+-        g_pVideo->flags |= CODEC_FLAG_QSCALE;
++        g_pVideo->flags |= AV_CODEC_FLAG_QSCALE;
+         g_pVideo->global_quality = g_VQuality*FF_QP2LAMBDA;
+     }
+ 
+     // some formats want stream headers to be separate
+     if (g_pFormat->flags & AVFMT_GLOBALHEADER)
+-        g_pVideo->flags |= CODEC_FLAG_GLOBAL_HEADER;
++        g_pVideo->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
+ 
+ #if LIBAVCODEC_VERSION_MAJOR < 53
+     // for some versions of ffmpeg x264 options must be set explicitly
+@@ -292,14 +306,12 @@ static int AddVideoStream()
+     AVDictionary* pDict = NULL;
+     if (strcmp(g_pVCodec->name, "libx264") == 0)
+         av_dict_set(&pDict, "preset", "medium", 0);
++#endif
+ 
+     if (avcodec_open2(g_pVideo, g_pVCodec, &pDict) < 0)
+-#else
+-    if (avcodec_open(g_pVideo, g_pVCodec) < 0)
+-#endif
+         return FatalError("Could not open video codec %s", g_pVCodec->long_name);
+ 
+-    g_pVFrame = avcodec_alloc_frame();
++    g_pVFrame = av_frame_alloc();
+     if (!g_pVFrame)
+         return FatalError("Could not allocate frame");
+ 
+@@ -317,10 +329,10 @@ static int WriteFrame(AVFrame* pFrame)
+     // write interleaved audio frame
+     if (g_pAStream)
+     {
+-        VideoTime = (double)g_pVStream->pts.val*g_pVStream->time_base.num/g_pVStream->time_base.den;
++        VideoTime = (double)g_pVFrame->pts * g_pVStream->time_base.num/g_pVStream->time_base.den;
+         do
+         {
+-            AudioTime = (double)g_pAStream->pts.val*g_pAStream->time_base.num/g_pAStream->time_base.den;
++            AudioTime = (double)g_pAFrame->pts * g_pAStream->time_base.num/g_pAStream->time_base.den;
+             ret = WriteAudioFrame();
+         }
+         while (AudioTime < VideoTime && ret);
+@@ -496,7 +508,7 @@ AVWRAP_DECL int AVWrapper_Close()
+ {
+     int ret;
+     // output buffered frames
+-    if (g_pVCodec->capabilities & CODEC_CAP_DELAY)
++    if (g_pVCodec->capabilities & AV_CODEC_CAP_DELAY)
+     {
+         do
+             ret = WriteFrame(NULL);
+@@ -526,14 +538,14 @@ AVWRAP_DECL int AVWrapper_Close()
+         avcodec_close(g_pVideo);
+         av_free(g_pVideo);
+         av_free(g_pVStream);
+-        av_free(g_pVFrame);
++        av_frame_free(&g_pVFrame);
+     }
+     if (g_pAStream)
+     {
+         avcodec_close(g_pAudio);
+         av_free(g_pAudio);
+         av_free(g_pAStream);
+-        av_free(g_pAFrame);
++        av_frame_free(&g_pAFrame);
+         av_free(g_pSamples);
+         fclose(g_pSoundFile);
+     }
diff --git a/debian/patches/f121e6c350a041a429a57ba4748ad673aa8420ea.patch b/debian/patches/f121e6c350a041a429a57ba4748ad673aa8420ea.patch
new file mode 100644
index 0000000..582d896
--- /dev/null
+++ b/debian/patches/f121e6c350a041a429a57ba4748ad673aa8420ea.patch
@@ -0,0 +1,31 @@
+From f121e6c350a041a429a57ba4748ad673aa8420ea Mon Sep 17 00:00:00 2001
+From: koda <vittorio.giovara at gmail.com>
+Date: Mon, 16 Nov 2015 18:28:10 +0100
+Subject: [PATCH] avwrapper: Explicitly check for macro existence
+
+---
+ hedgewars/avwrapper/avwrapper.c | 8 +++++++-
+ 1 file changed, 7 insertions(+), 1 deletion(-)
+
+diff --git a/hedgewars/avwrapper/avwrapper.c b/hedgewars/avwrapper/avwrapper.c
+index 3441f0f..346b3a8 100644
+--- a/hedgewars/avwrapper/avwrapper.c
++++ b/hedgewars/avwrapper/avwrapper.c
+@@ -79,10 +79,16 @@ static void rescale_ts(AVPacket *pkt, AVRational ctb, AVRational stb)
+ }
+ #endif
+ 
+-#if LIBAVCODEC_VERSION_MAJOR < 56
++#ifndef AV_CODEC_CAP_DELAY
+ #define AV_CODEC_CAP_DELAY                  CODEC_CAP_DELAY
++#endif
++#ifndef AV_CODEC_CAP_VARIABLE_FRAME_SIZE
+ #define AV_CODEC_CAP_VARIABLE_FRAME_SIZE    CODEC_CAP_VARIABLE_FRAME_SIZE
++#endif
++#ifndef AV_CODEC_FLAG_GLOBAL_HEADER
+ #define AV_CODEC_FLAG_GLOBAL_HEADER         CODEC_FLAG_GLOBAL_HEADER
++#endif
++#ifndef AV_CODEC_FLAG_QSCALE
+ #define AV_CODEC_FLAG_QSCALE                CODEC_FLAG_QSCALE
+ #endif
+ 
diff --git a/debian/patches/ffmpeg_2.9.patch b/debian/patches/ffmpeg_2.9.patch
deleted file mode 100644
index 8c07dd0..0000000
--- a/debian/patches/ffmpeg_2.9.patch
+++ /dev/null
@@ -1,76 +0,0 @@
-Description: Replace deprecated FFmpeg API
-Author: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>
-Last-Update: <2015-11-02>
-
---- hedgewars-0.9.22-dfsg.orig/QTfrontend/util/LibavInteraction.cpp
-+++ hedgewars-0.9.22-dfsg/QTfrontend/util/LibavInteraction.cpp
-@@ -106,8 +106,8 @@ LibavInteraction::LibavInteraction() : Q
-             if (!pCodec->pix_fmts)
-                 continue;
-             bool yuv420Supported = false;
--            for (const PixelFormat* pfmt = pCodec->pix_fmts; *pfmt != -1; pfmt++)
--                if (*pfmt == PIX_FMT_YUV420P)
-+            for (const AVPixelFormat* pfmt = pCodec->pix_fmts; *pfmt != -1; pfmt++)
-+                if (*pfmt == AV_PIX_FMT_YUV420P)
-                 {
-                     yuv420Supported = true;
-                     break;
---- hedgewars-0.9.22-dfsg.orig/hedgewars/avwrapper/avwrapper.c
-+++ hedgewars-0.9.22-dfsg/hedgewars/avwrapper/avwrapper.c
-@@ -158,7 +158,7 @@ static void AddAudioStream()
-     else
-         g_NumSamples = g_pAudio->frame_size;
-     g_pSamples = (int16_t*)av_malloc(g_NumSamples*g_Channels*sizeof(int16_t));
--    g_pAFrame = avcodec_alloc_frame();
-+    g_pAFrame = av_frame_alloc();
-     if (!g_pAFrame)
-     {
-         Log("Could not allocate frame\n");
-@@ -241,7 +241,7 @@ static int AddVideoStream()
-     g_pVideo->time_base.den = g_Framerate.num;
-     g_pVideo->time_base.num = g_Framerate.den;
-     //g_pVideo->gop_size = 12; /* emit one intra frame every twelve frames at most */
--    g_pVideo->pix_fmt = PIX_FMT_YUV420P;
-+    g_pVideo->pix_fmt = AV_PIX_FMT_YUV420P;
- 
-     // set quality
-     if (g_VQuality > 100)
-@@ -299,7 +299,7 @@ static int AddVideoStream()
- #endif
-         return FatalError("Could not open video codec %s", g_pVCodec->long_name);
- 
--    g_pVFrame = avcodec_alloc_frame();
-+    g_pVFrame = av_frame_alloc();
-     if (!g_pVFrame)
-         return FatalError("Could not allocate frame");
- 
-@@ -317,10 +317,10 @@ static int WriteFrame(AVFrame* pFrame)
-     // write interleaved audio frame
-     if (g_pAStream)
-     {
--        VideoTime = (double)g_pVStream->pts.val*g_pVStream->time_base.num/g_pVStream->time_base.den;
-+        VideoTime = (double)av_stream_get_end_pts(g_pVStream)*g_pVStream->time_base.num/g_pVStream->time_base.den;
-         do
-         {
--            AudioTime = (double)g_pAStream->pts.val*g_pAStream->time_base.num/g_pAStream->time_base.den;
-+            AudioTime = (double)av_stream_get_end_pts(g_pAStream)*g_pAStream->time_base.num/g_pAStream->time_base.den;
-             ret = WriteAudioFrame();
-         }
-         while (AudioTime < VideoTime && ret);
-@@ -526,14 +526,14 @@ AVWRAP_DECL int AVWrapper_Close()
-         avcodec_close(g_pVideo);
-         av_free(g_pVideo);
-         av_free(g_pVStream);
--        av_free(g_pVFrame);
-+        av_frame_free(&g_pVFrame);
-     }
-     if (g_pAStream)
-     {
-         avcodec_close(g_pAudio);
-         av_free(g_pAudio);
-         av_free(g_pAStream);
--        av_free(g_pAFrame);
-+        av_frame_free(&g_pAFrame);
-         av_free(g_pSamples);
-         fclose(g_pSoundFile);
-     }
diff --git a/debian/patches/series b/debian/patches/series
index 662a516..6283151 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,3 +1,14 @@
-ffmpeg_2.9.patch
-0001-Update-for-retrocompatibility.patch
-0001-More-refinements-about-version-contraints.patch
+e8654674c5ee580b2ec8392d3ae732c10195c039.patch
+62e5519664f25ccdbdeb51e3e08c9017c95b25c1.patch
+5de297c5621455b9117aa7caca2785d21ae1bf04.patch
+9da8e039c97c4a52161bd563b75ffa35acd75ec5.patch
+ab7e24456dd3dec808862f14d831c7abb14aadc9.patch
+7bb49917ebcd9734dd5a44bffa645d3889e60e72.patch
+2488090353fc122b4af030ea55bbff494c204c9b.patch
+3e1856bb563ad889e113f5ba440196e1c9e07b50.patch
+850e289b11dbe0415ba909ef87e13533c0e6ee41.patch
+14a48ec6c0e4e7c4c475eacc9ae3b093656c163a.patch
+a0e5bd1d4d77c1558394d9ac6b6b8a5030ef5282.patch
+ce3a58617e5732376b4ef5d47fc2be73b705a154.patch
+93292d80924aeadfda9f327ba78891cc4bab6c3c.patch
+f121e6c350a041a429a57ba4748ad673aa8420ea.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/collab-maint/hedgewars.git



More information about the Pkg-games-commits mailing list