I recently switched from Debian Squeeze to Ubuntu 12.04 and had to
recompile dvbcut. Attached is a patch to make r179 compile on Ubuntu.

Regards, Olaf
Index: src/lavfmuxer.h
===================================================================
--- src/lavfmuxer.h	(revision 179)
+++ src/lavfmuxer.h	(working copy)
@@ -73,7 +73,7 @@
     avp.dts=dts;
     avp.stream_index=st[str].stream_index;
     if (flags & MUXER_FLAG_KEY)
-      avp.flags |= PKT_FLAG_KEY;
+      avp.flags |= AV_PKT_FLAG_KEY;
 
     int rv=av_interleaved_write_frame(avfc,&avp);
 
Index: src/mpgfile.cpp
===================================================================
--- src/mpgfile.cpp	(revision 179)
+++ src/mpgfile.cpp	(working copy)
@@ -154,15 +154,19 @@
 
     if (!firstsequence || idx[streampic].getsequencenumber()>=seqnr)
     {
-      const uint8_t *data=(const uint8_t*)sd->getdata();
+      AVPacket avpkt;
+      av_init_packet(&avpkt);
+      avpkt.data = (uint8_t*)sd->getdata();
+      avpkt.size = bytes;
+      // HACK for CorePNG to decode as normal PNG by default
+      avpkt.flags = AV_PKT_FLAG_KEY;
       int frameFinished=0;
 
-      int decodebytes=bytes;
-      while (decodebytes>0)
+      while (avpkt.size>0)
       {
         frameFinished=0;
-        int bytesDecoded=avcodec_decode_video(S->avcc, avf, &frameFinished,
-                                              (uint8_t*) data, decodebytes);
+        int bytesDecoded=avcodec_decode_video2(S->avcc, avf, &frameFinished,
+                                               &avpkt);
         if (bytesDecoded<0)
         {
           fprintf(stderr,"libavcodec error while decoding frame #%d\n",pic);
@@ -170,8 +174,8 @@
           return;
         }
 
-        data+=bytesDecoded;
-        decodebytes-=bytesDecoded;
+        avpkt.data+=bytesDecoded;
+        avpkt.size-=bytesDecoded;
 
         if (frameFinished)
         {
@@ -184,7 +188,7 @@
             if (pic>=stop)
             {
               frameFinished=0;
-              decodebytes=0;
+              avpkt.size=0;
               break;
             }
           }
@@ -200,8 +204,14 @@
 
   if (pic < stop)
   {
+    AVPacket avpkt;
+    av_init_packet(&avpkt);
+    avpkt.data = NULL;
+    avpkt.size = 0;
+    // HACK for CorePNG to decode as normal PNG by default
+    avpkt.flags = AV_PKT_FLAG_KEY;
     int frameFinished=0;
-    avcodec_decode_video(S->avcc, avf, &frameFinished, NULL, 0);
+    avcodec_decode_video2(S->avcc, avf, &frameFinished, &avpkt);
     if (frameFinished)
     {
       if (last_cpn!=avf->coded_picture_number)
@@ -248,7 +258,7 @@
     stream *S=&s[VIDEOSTREAM];
     S->id=vid;
     S->allocavcc();
-    S->avcc->codec_type=CODEC_TYPE_VIDEO;
+    S->avcc->codec_type=AVMEDIA_TYPE_VIDEO;
     S->avcc->codec_id=CODEC_ID_MPEG2VIDEO;
     S->dec=avcodec_find_decoder(CODEC_ID_MPEG2VIDEO);
     S->enc=avcodec_find_encoder(CODEC_ID_MPEG2VIDEO);
Index: src/lavfmuxer.cpp
===================================================================
--- src/lavfmuxer.cpp	(revision 179)
+++ src/lavfmuxer.cpp	(working copy)
@@ -34,12 +34,12 @@
 lavfmuxer::lavfmuxer(const char *format, uint32_t audiostreammask, mpgfile &mpg, const char *filename)
     : muxer(), avfc(0), fileopened(false)
   {
-  fmt = guess_format(format, NULL, NULL);
+  fmt = av_guess_format(format, NULL, NULL);
   if (!fmt) {
     return;
     }
 
-  avfc=av_alloc_format_context();
+  avfc=avformat_alloc_context();
   if (!avfc)
     return;
 
@@ -73,7 +73,7 @@
         av_free(s->codec);
       s->codec = avcodec_alloc_context();
       avcodec_get_context_defaults(s->codec);
-      s->codec->codec_type=CODEC_TYPE_AUDIO;
+      s->codec->codec_type=AVMEDIA_TYPE_AUDIO;
       s->codec->codec_id = (mpg.getstreamtype(astr)==streamtype::ac3audio) ?
 	CODEC_ID_AC3 : CODEC_ID_MP2;
       s->codec->rc_buffer_size = 224*1024*8;
@@ -92,13 +92,21 @@
 	    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());
-#if LIBAVCODEC_VERSION_INT >= ((52<<16)+(0<<8)+0)
-	    avcodec_decode_audio2
+#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(53, 35, 0)
+            AVPacket avpkt;
+            av_init_packet(&avpkt);
+            avpkt.data = (uint8_t*)sd->getdata();
+            avpkt.size = sd->inbytes();
+            // HACK for CorePNG to decode as normal PNG by default
+            avpkt.flags = AV_PKT_FLAG_KEY;
+            avcodec_decode_audio3(s->codec,samples,&frame_size, &avpkt);
+#elif LIBAVCODEC_VERSION_INT >= ((52<<16)+(0<<8)+0)
+	    avcodec_decode_audio2(s->codec,samples,&frame_size,
+	                          (uint8_t*) sd->getdata(),sd->inbytes());
 #else
-	    avcodec_decode_audio
+	    avcodec_decode_audio(s->codec,samples,&frame_size,
+	                         (uint8_t*) sd->getdata(),sd->inbytes());
 #endif
-	      (s->codec,samples,&frame_size,
-	       (uint8_t*) sd->getdata(),sd->inbytes());
 	    avcodec_close(s->codec);
 	  }
 	  break;
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
DVBCUT-devel mailing list
DVBCUT-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dvbcut-devel

Reply via email to