[shotdetect] 01/01: Add libav10 patch and compile against libav10 (Closes: #739376)

Reinhard Tartler siretart at moszumanska.debian.org
Thu Mar 27 00:09:27 UTC 2014


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

siretart pushed a commit to branch master
in repository shotdetect.

commit 854b555f36ba51ee3ff675f1b06b70c516b84d66
Author: Reinhard Tartler <siretart at tauware.de>
Date:   Wed Mar 26 19:58:24 2014 -0400

    Add libav10 patch and compile against libav10 (Closes: #739376)
---
 debian/changelog             |   7 +++
 debian/control               |   8 ++--
 debian/patches/libav10.patch | 104 +++++++++++++++++++++++++++++++++++++++++++
 debian/patches/series        |   1 +
 4 files changed, 116 insertions(+), 4 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 1ab647f..02d0221 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+shotdetect (1.0.86-3) experimental; urgency=low
+
+  * Team upload.
+  * Add libav10 patch and compile against libav10 (Closes: #739376)
+
+ -- Reinhard Tartler <siretart at tauware.de>  Wed, 26 Mar 2014 19:57:54 -0400
+
 shotdetect (1.0.86-2) unstable; urgency=low
 
   [ Giulio Paci ]
diff --git a/debian/control b/debian/control
index 51f8c70..037cd4a 100644
--- a/debian/control
+++ b/debian/control
@@ -12,10 +12,10 @@ Build-Depends: cdbs,
  libxml2-dev,
  libxslt1-dev,
  libgd-dev (>= 2.1),
- libavcodec-dev,
- libavutil-dev,
- libavformat-dev,
- libswscale-dev,
+ libavcodec-dev (>= 6:10~),
+ libavutil-dev (>= 6:10~),
+ libavformat-dev (>= 6:10~),
+ libswscale-dev (>= 6:10~),
  dpkg-dev (>= 1.16.1~)
 Standards-Version: 3.9.4
 Vcs-Git: git://anonscm.debian.org/pkg-multimedia/shotdetect.git
diff --git a/debian/patches/libav10.patch b/debian/patches/libav10.patch
new file mode 100644
index 0000000..f85bb33
--- /dev/null
+++ b/debian/patches/libav10.patch
@@ -0,0 +1,104 @@
+Index: shotdetect-1.0.86/src/film.cpp
+===================================================================
+--- shotdetect-1.0.86.orig/src/film.cpp	2014-03-01 00:39:19.000000000 +0000
++++ shotdetect-1.0.86/src/film.cpp	2014-03-01 01:02:52.009064391 +0000
+@@ -145,7 +145,7 @@
+     {
+       this->height = int (pFormatCtx->streams[videoStream]->codec->height);
+       this->width = int (pFormatCtx->streams[videoStream]->codec->width);
+-      this->fps = av_q2d (pFormatCtx->streams[videoStream]->r_frame_rate);
++      this->fps = av_q2d (pFormatCtx->streams[videoStream]->avg_frame_rate);
+       avcodec_string (buf, sizeof (buf), pFormatCtx->streams[videoStream]->codec, 0);
+       this->codec.video = buf;
+     }
+@@ -478,13 +478,21 @@
+ void
+ film::process_audio ()
+ {
++  AVFrame *frame;
+   int len1;
+   int len;
+-  int data_size;
+-  static unsigned int samples_size = 0;
++  int ret, got_output;
+   int i;
+   uint8_t *ptr;
+ 
++  /* only support s16 */
++  if (av_get_packed_sample_fmt(pCodecCtxAudio->sample_fmt) != AV_SAMPLE_FMT_S16)
++    return;
++
++  frame = av_frame_alloc();
++  if (!frame)
++    return;
++
+   ptr = packet.data;
+   len = packet.size;
+ 
+@@ -492,11 +500,9 @@
+   av_init_packet(&avpkt);
+   while (len > 0)
+     {
+-      this->audio_buf = (short *) av_fast_realloc (this->audio_buf, &samples_size, FFMAX (packet.size, AVCODEC_MAX_AUDIO_FRAME_SIZE));
+-      data_size = samples_size;
+       avpkt.data = ptr;
+       avpkt.size = len;
+-      len1 = avcodec_decode_audio3 (pCodecCtxAudio, audio_buf, &data_size, &avpkt);
++      len1 = avcodec_decode_audio4 (pCodecCtxAudio, frame, &got_output, &avpkt);
+ 
+ 
+       if (len1 < 0)
+@@ -511,20 +517,26 @@
+       len -= len1;
+       ptr += len1;
+ 
+-      if (data_size > 0)
++      if (got_output)
+ 	{
++	int block_align;
++	int16_t *left, *right;
++
++	if (av_sample_fmt_is_planar(pCodecCtxAudio->sample_fmt)) {
++	    left = (int16_t*)frame->data[0];
++	    right = (pCodecCtxAudio->channels > 1) ? (int16_t*)frame->data[1] : left;
++	    block_align = 1;
++	} else {
++	    left  = (int16_t*)frame->data[0];
++	    right = (pCodecCtxAudio->channels > 1) ? left + 1 : left;
++	    block_align = pCodecCtxAudio->channels;
++	}
+ 
+-	  samples += data_size / (pCodecCtxAudio->channels * 2);
+-	  for (i = 0; i < data_size; i += 2 * pCodecCtxAudio->channels)
++	  samples += frame->nb_samples;
++	  for (i = 0; i < frame->nb_samples; i++)
+ 	    {
+-	      sample_right = *((signed short int *) (audio_buf + i));
+-	      /*
+-	       * If there's only 1 channel, set sample_right=sample_left
+-	       */
+-	      if (pCodecCtxAudio->channels >= 1)
+-		sample_left = *((signed short int *) (audio_buf + i + 2));
+-	      else
+-		sample_left = sample_right;
++	      sample_left  = left[i * block_align];
++	      sample_right = right[i * block_align];
+ 
+ 	      /*
+ 	       * Extract minima and maxima
+@@ -561,6 +573,7 @@
+ 	    }
+ 	}
+     }
++  av_frame_free(&frame);
+ }
+ 
+ film::film()
+@@ -573,7 +586,6 @@
+   maxleft = MIN_INT;
+   ech = 0;
+   nchannel = 1;
+-  audio_buf = NULL;
+   this->first_img_set = false;
+   this->last_img_set = false;
+   this->audio_set = false;
diff --git a/debian/patches/series b/debian/patches/series
index 8af634e..a9283dd 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -3,3 +3,4 @@
 1003-fix-FTBFS-ffmpeg_1.0.x.patch
 1004-fix_comments_and_names.patch
 
+libav10.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-multimedia/shotdetect.git



More information about the pkg-multimedia-commits mailing list