[SCM] dvbcut/master: add patch from rpmfusion to allow compilation with libav 9

siretart at users.alioth.debian.org siretart at users.alioth.debian.org
Sat Mar 2 19:45:36 UTC 2013


The following commit has been merged in the master branch:
commit a9fcb0d400af166da84ca8d0e6e6a45d086e57ac
Author: Reinhard Tartler <siretart at tauware.de>
Date:   Sat Mar 2 20:12:27 2013 +0100

    add patch from rpmfusion to allow compilation with libav 9

diff --git a/debian/patches/libav9.patch b/debian/patches/libav9.patch
new file mode 100644
index 0000000..fab3a21
--- /dev/null
+++ b/debian/patches/libav9.patch
@@ -0,0 +1,179 @@
+From: David Timms <iinet.net.au at dtimms> 
+Description: add ffmpeg-0.11.1 patch
+Origin: rpmfusion, http://download1.rpmfusion.org/free/fedora/releases/18/Everything/source/SRPMS/dvbcut-0.6.1-8.svn179.fc18.src.rpm
+Updated-by: Reinhard Tartler <siretart at tauware.de>
+
+--- a/src/lavfmuxer.cpp
++++ b/src/lavfmuxer.cpp
+@@ -43,9 +43,16 @@ lavfmuxer::lavfmuxer(const char *format,
+   if (!avfc)
+     return;
+ 
++#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(53, 35, 0)
++// todo: what here ?
++//  maybe: AVFormatContext::audio_preload but no direct access.
++//    AVOptions
++//    iformat
++#else
+   avfc->preload= (int)(.5*AV_TIME_BASE);
+-  avfc->max_delay= (int)(.7*AV_TIME_BASE);
+   avfc->mux_rate=10080000;
++#endif
++  avfc->max_delay= (int)(.7*AV_TIME_BASE);
+ 
+   avfc->oformat=fmt;
+   strncpy(avfc->filename, filename, sizeof(avfc->filename));
+@@ -53,7 +60,7 @@ lavfmuxer::lavfmuxer(const char *format,
+   int id=0;
+ 
+   st[VIDEOSTREAM].stream_index=id;
+-  AVStream *s=st[VIDEOSTREAM].avstr=av_new_stream(avfc,id++);
++  AVStream *s=st[VIDEOSTREAM].avstr=avformat_new_stream(avfc, NULL);
+   strpres[VIDEOSTREAM]=true;
+   av_free(s->codec);
+   mpg.setvideoencodingparameters();
+@@ -67,12 +74,12 @@ lavfmuxer::lavfmuxer(const char *format,
+     if (audiostreammask & (1u<<i)) {
+       int astr=audiostream(i);
+       st[astr].stream_index=id;
+-      s=st[astr].avstr=av_new_stream(avfc,id++);
++      s=st[astr].avstr=avformat_new_stream(avfc, NULL);
+       strpres[astr]=true;
+       if (s->codec)
+         av_free(s->codec);
+-      s->codec = avcodec_alloc_context();
+-      avcodec_get_context_defaults(s->codec);
++      s->codec = avcodec_alloc_context3(NULL);
++      avcodec_get_context_defaults3(s->codec, NULL);
+       s->codec->codec_type=AVMEDIA_TYPE_AUDIO;
+       s->codec->codec_id = (mpg.getstreamtype(astr)==streamtype::ac3audio) ?
+ 	CODEC_ID_AC3 : CODEC_ID_MP2;
+@@ -87,8 +94,8 @@ lavfmuxer::lavfmuxer(const char *format,
+ 	  break;
+ 
+ 	if (sd->getitemlistsize() > 1) {
+-	  if (!avcodec_open(s->codec,
+-			    avcodec_find_decoder(s->codec->codec_id))) {
++	  if (!avcodec_open2(s->codec,
++			     avcodec_find_decoder(s->codec->codec_id), NULL)) {
+ 	    int16_t samples[AVCODEC_MAX_AUDIO_FRAME_SIZE/sizeof(int16_t)];
+ 	    int frame_size=sizeof(samples);
+ 	    //fprintf(stderr, "** decode audio size=%d\n", sd->inbytes());
+@@ -115,19 +122,36 @@ lavfmuxer::lavfmuxer(const char *format,
+       }
+     }
+ 
++#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(53, 35, 0)
++  // error: 'av_set_parameters' was not declared in this scope
++  if (!(fmt->flags & AVFMT_NOFILE)&&(avio_open(&avfc->pb, filename, AVIO_FLAG_WRITE) < 0)) {
++#else
+   if ((av_set_parameters(avfc, NULL) < 0) || (!(fmt->flags & AVFMT_NOFILE)&&(url_fopen(&avfc->pb, filename, URL_WRONLY) < 0))) {
++#endif  
+     av_free(avfc);
+     avfc=0;
+     return;
+     }
++#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(53, 35, 0)
++// todo: what here ?
++//  maybe: AVFormatContext::audio_preload but no direct access.
++//    AVOptions
++//    iformat
++#else
+   avfc->preload= (int)(.5*AV_TIME_BASE);
+-  avfc->max_delay= (int)(.7*AV_TIME_BASE);
+   avfc->mux_rate=10080000;
++#endif
++  avfc->max_delay= (int)(.7*AV_TIME_BASE);
+ 
+-
++#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(53, 35, 0)
++  av_dump_format(avfc, 0, filename, 1);
++  fileopened=true;
++  avformat_write_header(avfc, NULL);
++#else
+   dump_format(avfc, 0, filename, 1);
+   fileopened=true;
+   av_write_header(avfc);
++#endif
+   }
+ 
+ 
+@@ -137,7 +161,9 @@ lavfmuxer::~lavfmuxer()
+     if (fileopened) {
+       av_write_trailer(avfc);
+       if (!(fmt->flags & AVFMT_NOFILE))
+-#if LIBAVFORMAT_VERSION_INT >= ((52<<16)+(0<<8)+0)
++#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(53, 35, 0)
++        avio_close(avfc->pb);
++#elif LIBAVFORMAT_VERSION_INT >= ((52<<16)+(0<<8)+0)
+         url_fclose(avfc->pb);
+ #else
+         url_fclose(&avfc->pb);
+--- a/src/mpgfile.cpp
++++ b/src/mpgfile.cpp
+@@ -115,7 +115,7 @@ void mpgfile::decodegop(int start, int s
+     sd->discard(idx[streampic].getpos().packetoffset());
+   }
+ 
+-  if (int rv=avcodec_open(S->avcc, S->dec))
++  if (int rv=avcodec_open2(S->avcc, S->dec, NULL))
+   {
+     fprintf(stderr,"avcodec_open returned %d\n",rv);
+     return;
+@@ -717,7 +717,7 @@ void mpgfile::recodevideo(muxer &mux, in
+     return;
+   s[VIDEOSTREAM].setvideoencodingparameters();
+ 
+-  if (int rv=avcodec_open(avcc, s[VIDEOSTREAM].enc))
++  if (int rv=avcodec_open2(avcc, s[VIDEOSTREAM].enc, NULL))
+   {
+     if (log)
+       log->printerror("avcodec_open(mpeg2video_encoder) returned %d",rv);
+@@ -741,8 +741,11 @@ void mpgfile::recodevideo(muxer &mux, in
+       f->pts=idx[idx.indexnr(start+p)].getpts()-startpts;
+       f->coded_picture_number=f->display_picture_number=p;
+       f->key_frame=(p==0)?1:0;
++#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(53, 35, 0)      
++      f->pict_type=(p==0)?AV_PICTURE_TYPE_I : AV_PICTURE_TYPE_P;
++#else
+       f->pict_type=(p==0)?FF_I_TYPE:FF_P_TYPE;
+-
++#endif
+       out = avcodec_encode_video(avcc, buf,
+                                  m2v.getsize(), f);
+ 
+--- a/src/avframe.h
++++ b/src/avframe.h
+@@ -22,7 +22,8 @@
+ #define _DVBCUT_AVFRAME_H
+ 
+ extern "C" {
+-#include <avcodec.h>
++#include <libavcodec/avcodec.h>
++#include <libavutil/mem.h>
+ #ifdef HAVE_LIB_SWSCALE
+ #include <swscale.h>
+ #endif
+--- a/src/stream.h
++++ b/src/stream.h
+@@ -24,7 +24,8 @@
+ #include <string>
+ 
+ extern "C" {
+-#include <avcodec.h>
++#include <libavcodec/avcodec.h>
++#include <libavutil/mem.h>
+ }
+ 
+ class stream
+@@ -52,8 +53,8 @@ protected:
+     {
+     if (avcc)
+       av_free(avcc);
+-    avcc=avcodec_alloc_context();
+-    avcodec_get_context_defaults(avcc);
++    avcc=avcodec_alloc_context3(NULL);
++    avcodec_get_context_defaults3(avcc, NULL);
+     }
+   void setvideoencodingparameters(bool interlaced=false)
+     {
diff --git a/debian/patches/series b/debian/patches/series
index 1e33765..542d3b1 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -2,3 +2,4 @@ port-to-qt4.patch
 fix-ftbfs-libav0.7.patch
 fix_gcc_4.7.patch
 updateimagedisplayfix.patch
+libav9.patch

-- 
dvbcut packaging



More information about the pkg-multimedia-commits mailing list