[hedgewars] 01/01: Update for FFmpeg 2.9

Gianfranco Costamagna locutusofborg-guest at moszumanska.debian.org
Tue Nov 3 13:55:47 UTC 2015


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

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

commit fc42df231a27cc6cef8295b740700ef307087515
Author: Gianfranco Costamagna <costamagnagianfranco at yahoo.it>
Date:   Tue Nov 3 14:55:10 2015 +0100

    Update for FFmpeg 2.9
---
 debian/changelog                                   |  11 ++
 .../0001-Update-for-retrocompatibility.patch       | 114 +++++++++++++++++++++
 debian/patches/ffmpeg_2.9.patch                    |  76 ++++++++++++++
 debian/patches/series                              |   2 +
 4 files changed, 203 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index 5294c81..c5dacd4 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,14 @@
+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).
+
+  [ Gianfranco Costamagna ]
+  * debian/patches/0001-Update-for-retrocompatibility.patch
+    update ffmpeg_2.9.patch to work also with older ffmpeg/libav implementations.
+
+ -- Gianfranco Costamagna <locutusofborg at debian.org>  Tue, 03 Nov 2015 10:38:33 +0100
+
 hedgewars (0.9.22-dfsg-2) unstable; urgency=medium
 
   * Replace Droplet.ogg CC-3.0 alternative with a 0s ogg file.
diff --git a/debian/patches/0001-Update-for-retrocompatibility.patch b/debian/patches/0001-Update-for-retrocompatibility.patch
new file mode 100644
index 0000000..4df490a
--- /dev/null
+++ b/debian/patches/0001-Update-for-retrocompatibility.patch
@@ -0,0 +1,114 @@
+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/ffmpeg_2.9.patch b/debian/patches/ffmpeg_2.9.patch
new file mode 100644
index 0000000..8c07dd0
--- /dev/null
+++ b/debian/patches/ffmpeg_2.9.patch
@@ -0,0 +1,76 @@
+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
new file mode 100644
index 0000000..edb810d
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1,2 @@
+ffmpeg_2.9.patch
+0001-Update-for-retrocompatibility.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