Hi,
the attached patch should fix this bug.

-- 
Anton Khirnov
Index: dvbcut-0.5.4+svn178/src/lavfmuxer.cpp
===================================================================
--- dvbcut-0.5.4+svn178.orig/src/lavfmuxer.cpp	2014-03-01 10:17:16.111644198 +0000
+++ dvbcut-0.5.4+svn178/src/lavfmuxer.cpp	2014-03-01 10:24:11.361903077 +0000
@@ -82,7 +82,7 @@
       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;
+	AV_CODEC_ID_AC3 : AV_CODEC_ID_MP2;
       s->codec->rc_buffer_size = 224*1024*8;
 
       // Must read some packets to get codec parameters
@@ -96,26 +96,18 @@
 	if (sd->getitemlistsize() > 1) {
 	  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());
-#if LIBAVCODEC_VERSION_INT > ((52<<16)+(25<<8)+0)
+            AVFrame *frame = av_frame_alloc();
 	    AVPacket pkt;
+            int got_output;
+
  	    av_init_packet( &pkt );
 	    pkt.data = (uint8_t*) sd->getdata();
 	    pkt.size = sd->inbytes();
-	    avcodec_decode_audio3
-	      (s->codec,samples,&frame_size, &pkt);
-#else
-#if LIBAVCODEC_VERSION_INT >= ((52<<16)+(0<<8)+0)
-	    avcodec_decode_audio2
-#else
-	    avcodec_decode_audio
-#endif
-	      (s->codec,samples,&frame_size,
-	       (uint8_t*) sd->getdata(),sd->inbytes());
+
+            avcodec_decode_audio4(s->codec, frame, &got_output, &pkt);
+
+            av_frame_free(&frame);
 	    avcodec_close(s->codec);
-#endif
 	  }
 	  break;
 	}
Index: dvbcut-0.5.4+svn178/src/mpgfile.cpp
===================================================================
--- dvbcut-0.5.4+svn178.orig/src/mpgfile.cpp	2014-03-01 10:14:22.000000000 +0000
+++ dvbcut-0.5.4+svn178/src/mpgfile.cpp	2014-03-01 10:29:11.491320162 +0000
@@ -267,9 +267,9 @@
     S->id=vid;
     S->allocavcc();
     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);
+    S->avcc->codec_id=AV_CODEC_ID_MPEG2VIDEO;
+    S->dec=avcodec_find_decoder(AV_CODEC_ID_MPEG2VIDEO);
+    S->enc=avcodec_find_encoder(AV_CODEC_ID_MPEG2VIDEO);
     S->type=streamtype::mpeg2video;
     }
 
@@ -731,8 +731,12 @@
   pts_t startpts=idx[idx.indexnr(start)].getpts();
   while (outpicture<stop)
   {
+    AVPacket pkt;
     u_int8_t *buf=(u_int8_t*)m2v.writeptr();
-    int out;
+    int ret, got_output;
+
+    pkt.data = buf;
+    pkt.size = m2v.getsize();
 
     if (!framelist.empty())
     {
@@ -746,33 +750,31 @@
 #else
       f->pict_type=(p==0)?FF_I_TYPE:FF_P_TYPE;
 #endif
-      out = avcodec_encode_video(avcc, buf,
-                                 m2v.getsize(), f);
+      ret = avcodec_encode_video2(avcc, &pkt, f, &got_output);
 
       delete framelist.front();
       framelist.pop_front();
       ++p;
 
-      if (out<=0)
+      if (ret < 0 || !got_output)
         continue;
     }
     else
     {
       fprintf(stderr,"trying to call avcodec_encode_video with frame=0\n");
-      out = avcodec_encode_video(avcc, buf,
-                                 m2v.getsize(), 0);
+      ret = avcodec_encode_video2(avcc, &pkt, NULL, &got_output);
       fprintf(stderr,"...back I am.\n");
 
-      if (out<=0)
+      if (ret < 0 || !got_output)
         break;
     }
 
     pts_t vidpts=idx[idx.indexnr(outpicture)].getpts()-offset;
     pts_t viddts=mux.getdts(VIDEOSTREAM);
     mux.setdts(VIDEOSTREAM,vidpts);
-    fixtimecode(buf,out,vidpts);
-    mux.putpacket(VIDEOSTREAM,buf,out,vidpts,viddts,
-                  (avcc->coded_frame && avcc->coded_frame->key_frame)?MUXER_FLAG_KEY:0 );
+    fixtimecode(pkt.data, pkt.size, vidpts);
+    mux.putpacket(VIDEOSTREAM,pkt.data,pkt.size,vidpts,viddts,
+                  (pkt.flags & AV_PKT_FLAG_KEY)?MUXER_FLAG_KEY:0 );
     ++outpicture;
 
     if (log && savepics>0)
_______________________________________________
pkg-multimedia-maintainers mailing list
pkg-multimedia-maintainers@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-multimedia-maintainers

Reply via email to