use avcodec_decode_video2 instead of avcodec_decode_video

---
 cinelerra/ffmpeg.C     |   13 +++++++++++++
 cinelerra/fileffmpeg.C |   14 ++++++++++++++
 quicktime/div3.c       |   14 +++++++++++++-
 quicktime/qtffmpeg.c   |   13 +++++++++++++
 4 files changed, 53 insertions(+), 1 deletion(-)

diff -uprN a/cinelerra/ffmpeg.C b/cinelerra/ffmpeg.C
--- a/cinelerra/ffmpeg.C        2013-01-15 17:40:42.000000000 +0530
+++ b/cinelerra/ffmpeg.C        2013-01-15 23:25:55.000000000 +0530
@@ -355,11 +355,24 @@ int FFMPEG::decode(uint8_t *data, long d
        // NOTE: frame must already have data space allocated
        
        got_picture = 0;
+#if LIBAVCODEC_VERSION_INT < ((53<<16)+(35<<8)+0)
        int length = avcodec_decode_video(context,
                                          picture,
                                          &got_picture,
                                          data,
                                          data_size);
+#else
+       AVPacket av_pkt;
+       int length;
+
+       av_init_packet(&av_pkt);
+       av_pkt.data = data;
+       av_pkt.size = data_size;
+       length = avcodec_decode_video2(context,
+                                         picture,
+                                         &got_picture,
+                                         &av_pkt);
+#endif
        
        if (length < 0) {
                printf("FFMPEG::decode error decoding frame\n");
diff -uprN a/cinelerra/fileffmpeg.C b/cinelerra/fileffmpeg.C
--- a/cinelerra/fileffmpeg.C    2013-01-15 23:30:44.000000000 +0530
+++ b/cinelerra/fileffmpeg.C    2013-01-15 23:51:11.000000000 +0530
@@ -471,11 +471,18 @@ int FileFFMPEG::read_frame(VFrame *frame

               decoder_context->reordered_opaque = packet_pts;
               int result =
+#if LIBAVCODEC_VERSION_INT < ((53<<16)+(35<<8)+0)
                 avcodec_decode_video(decoder_context,
                                      (AVFrame*)ffmpeg_frame,
                                      &got_pic,
                                      packet.data,
                                      packet.size);
+#else
+                avcodec_decode_video2(decoder_context,
+                                     (AVFrame*)ffmpeg_frame,
+                                     &got_pic,
+                                     &packet);
+#endif
               av_free_packet(&packet);

               //fprintf(stderr,">>>VID results: reordered=%.03f
pts=%.03f dts=%.03f result=%d got_pic=%d %s %s %s\n",
@@ -583,11 +590,18 @@ int FileFFMPEG::read_frame(VFrame *frame

           decoder_context->reordered_opaque = packet.pts;
           int result =
+#if LIBAVCODEC_VERSION_INT < ((53<<16)+(35<<8)+0)
             avcodec_decode_video(decoder_context,
                                  (AVFrame*)ffmpeg_frame,
                                  &got_pic,
                                  packet.data,
                                  packet.size);
+#else
+            avcodec_decode_video2(decoder_context,
+                                 (AVFrame*)ffmpeg_frame,
+                                 &got_pic,
+                                 &packet);
+#endif
           av_free_packet(&packet);

           if(!((AVFrame*)ffmpeg_frame)->data[0] || !result) got_pic = 0;
diff -uprN a/quicktime/div3.c b/quicktime/div3.c
--- a/quicktime/div3.c  2012-12-03 21:13:46.000000000 +0530
+++ b/quicktime/div3.c  2013-01-15 23:43:30.000000000 +0530
@@ -151,16 +151,28 @@ static int decode_wrapper(quicktime_div3
 {
        int got_picture = 0;
        int result;
-
+#if LIBAVCODEC_VERSION_INT >= ((53<<16)+(35<<8)+0)     
+       AVPacket av_pkt;
+#endif
        if(!codec->got_key && !quicktime_div3_is_key(data, size)) return 0;

        if(quicktime_div3_is_key(data, size)) codec->got_key = 1;

+#if LIBAVCODEC_VERSION_INT < ((53<<16)+(35<<8)+0)      
        result = avcodec_decode_video(codec->decoder_context,
                &codec->picture,
                &got_picture,
                codec->work_buffer,
                size);
+#else
+       av_init_packet(&av_pkt);
+       av_pkt.data = codec->work_buffer;
+       av_pkt.size = size;
+       result = avcodec_decode_video2(codec->decoder_context,
+               &codec->picture,
+               &got_picture,
+               &av_pkt);
+#endif
 #ifdef ARCH_X86
        asm("emms");
 #endif
diff -uprN a/quicktime/qtffmpeg.c b/quicktime/qtffmpeg.c
--- a/quicktime/qtffmpeg.c      2013-01-15 17:46:24.000000000 +0530
+++ b/quicktime/qtffmpeg.c      2013-01-15 23:48:07.000000000 +0530
@@ -195,11 +195,24 @@ static int decode_wrapper(quicktime_t *f
                        ffmpeg->decoder_context[current_field]->skip_frame =
AVDISCARD_NONREF /* AVDISCARD_BIDIR */;
                else
                        ffmpeg->decoder_context[current_field]->skip_frame = 
AVDISCARD_DEFAULT;
+#if LIBAVCODEC_VERSION_INT < ((53<<16)+(35<<8)+0)
                result = 
avcodec_decode_video(ffmpeg->decoder_context[current_field],
                        &ffmpeg->picture[current_field],
                        &got_picture,
                        ffmpeg->work_buffer,
                        bytes + header_bytes);
+#else
+               {
+               AVPacket av_pkt;
+               av_init_packet(&av_pkt);
+               av_pkt.data = ffmpeg->work_buffer;
+               av_pkt.size = bytes + header_bytes;
+               result = 
avcodec_decode_video2(ffmpeg->decoder_context[current_field],
+                       &ffmpeg->picture[current_field],
+                       &got_picture,
+                       &av_pkt);
+               }
+#endif
_______________________________________________
Cinelerra mailing list
[email protected]
https://lists.skolelinux.org/listinfo/cinelerra

Reply via email to