decode_audio3 instead of vanished decode_audio2. decode_audio3 is a
deprecated function, needs to be changed to decode_audio4 soon.

---
 cinelerra/fileffmpeg.C |   14 ++++++++++++++
 quicktime/wma.c        |   16 ++++++++++++++++
 2 files changed, 30 insertions(+)
---
diff -uprN a/cinelerra/fileffmpeg.C b/cinelerra/fileffmpeg.C
--- a/cinelerra/fileffmpeg.C    2013-01-16 02:41:13.000000000 +0530
+++ b/cinelerra/fileffmpeg.C    2013-01-16 02:43:41.000000000 +0530
@@ -786,11 +786,18 @@ int FileFFMPEG::read_samples(double *buf
             while(packet_len > 0){
               int data_size = AVCODEC_MAX_AUDIO_FRAME_SIZE;
               if(!ffmpeg_samples) ffmpeg_samples =
(short*)malloc(AVCODEC_MAX_AUDIO_FRAME_SIZE);
+#if LIBAVCODEC_VERSION_INT < ((53<<16)+(35<<8)+0)
               int bytes_decoded = avcodec_decode_audio2(decoder_context,
                                                         ffmpeg_samples,
                                                         &data_size,
                                                         packet_ptr,
                                                         packet_len);
+#else
+              int bytes_decoded = avcodec_decode_audio3(decoder_context,
+                                                        ffmpeg_samples,
+                                                        &data_size,
+                                                                               
                                &packet);
+#endif
               if(bytes_decoded < 0){
                 /* Do not set error; this is standard operating
                    procedure for eg mp3, where a packet often begins in
@@ -872,11 +879,18 @@ int FileFFMPEG::read_samples(double *buf
           uint8_t *packet_ptr = packet.data;
           int data_size = AVCODEC_MAX_AUDIO_FRAME_SIZE;
           if(!ffmpeg_samples) ffmpeg_samples =
(short*)realloc(ffmpeg_samples, data_size);
+#if LIBAVCODEC_VERSION_INT < ((53<<16)+(35<<8)+0)
           int bytes_decoded = avcodec_decode_audio2(decoder_context,
                                                     ffmpeg_samples,
                                                     &data_size,
                                                     packet_ptr,
                                                     packet_len);
+#else
+          int bytes_decoded = avcodec_decode_audio3(decoder_context,
+                                                    ffmpeg_samples,
+                                                    &data_size,
+                                                                               
                        &packet);
+#endif
           if(bytes_decoded < 0){
             error = 1;
           }else{
diff -uprN a/quicktime/wma.c b/quicktime/wma.c
--- a/quicktime/wma.c   2013-01-16 02:41:13.000000000 +0530
+++ b/quicktime/wma.c   2013-01-16 02:41:38.000000000 +0530
@@ -111,6 +111,9 @@ static int decode(quicktime_t *file,
        int result = 0;
        int i, j;
        int sample_size = 2 * track_map->channels;
+#if LIBAVCODEC_VERSION_INT >= ((53<<16)+(35<<8)+0)
+       AVPacket av_pkt;
+#endif

        if(output_i) bzero(output_i, sizeof(int16_t) * samples);
        if(output_f) bzero(output_f, sizeof(float) * samples);
@@ -196,12 +199,25 @@ printf("decode 2 %x %llx %llx\n", chunk_
                        codec->packet_buffer,
                        chunk_size);
 #else
+#if LIBAVCODEC_VERSION_INT < ((53<<16)+(35<<8)+0)
                bytes_decoded = AVCODEC_MAX_AUDIO_FRAME_SIZE;
                result = avcodec_decode_audio2(codec->decoder_context,
                        (int16_t*)(codec->work_buffer + codec->output_size * 
sample_size),
                        &bytes_decoded,
                        codec->packet_buffer,
                        chunk_size);
+#else
+               memset(&av_pkt, 0, sizeof(AVPacket));
+               av_init_packet(&av_pkt);
+               av_pkt.data = codec->packet_buffer;
+               av_pkt.size = chunk_size;
+               result = avcodec_decode_audio3(codec->decoder_context,
+                       (int16_t*)(codec->work_buffer + codec->output_size * 
sample_size),
+                       &bytes_decoded,
+                       &av_pkt);
+               av_pkt.data = NULL;
+               av_pkt.size = 0;
+#endif
 #endif

                pthread_mutex_unlock(&ffmpeg_lock);
_______________________________________________
Cinelerra mailing list
[email protected]
https://lists.skolelinux.org/listinfo/cinelerra

Reply via email to