aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/previewopus_extractor.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/previewopus_extractor.c')
-rw-r--r--src/plugins/previewopus_extractor.c41
1 files changed, 38 insertions, 3 deletions
diff --git a/src/plugins/previewopus_extractor.c b/src/plugins/previewopus_extractor.c
index d718908..7a96f29 100644
--- a/src/plugins/previewopus_extractor.c
+++ b/src/plugins/previewopus_extractor.c
@@ -296,7 +296,12 @@ static void init_packet(AVPacket *packet)
296/** Initialize one audio frame for reading from the input file */ 296/** Initialize one audio frame for reading from the input file */
297static int init_input_frame(AVFrame **frame) 297static int init_input_frame(AVFrame **frame)
298{ 298{
299 if (!(*frame = avcodec_alloc_frame())) { 299#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55,28,1)
300 *frame = av_frame_alloc ();
301#else
302 *frame = avcodec_alloc_frame();
303#endif
304 if (NULL == *frame) {
300#if DEBUG 305#if DEBUG
301 fprintf(stderr, "Could not allocate input frame\n"); 306 fprintf(stderr, "Could not allocate input frame\n");
302#endif 307#endif
@@ -655,7 +660,11 @@ cleanup:
655 av_freep(&converted_input_samples[0]); 660 av_freep(&converted_input_samples[0]);
656 free(converted_input_samples); 661 free(converted_input_samples);
657 } 662 }
663#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55,28,1)
664 av_frame_free (&input_frame);
665#else
658 avcodec_free_frame(&input_frame); 666 avcodec_free_frame(&input_frame);
667#endif
659 668
660 return ret; 669 return ret;
661} 670}
@@ -671,7 +680,12 @@ static int init_output_frame(AVFrame **frame,
671 int error; 680 int error;
672 681
673 /** Create a new frame to store the audio samples. */ 682 /** Create a new frame to store the audio samples. */
674 if (!(*frame = avcodec_alloc_frame())) { 683#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55,28,1)
684 *frame = av_frame_alloc ();
685#else
686 *frame = avcodec_alloc_frame();
687#endif
688 if (NULL == *frame) {
675#if DEBUG 689#if DEBUG
676 fprintf(stderr, "Could not allocate output frame\n"); 690 fprintf(stderr, "Could not allocate output frame\n");
677#endif 691#endif
@@ -702,7 +716,11 @@ static int init_output_frame(AVFrame **frame,
702#if DEBUG 716#if DEBUG
703 fprintf(stderr, "Could allocate output frame samples (error '%s')\n", get_error_text(error)); 717 fprintf(stderr, "Could allocate output frame samples (error '%s')\n", get_error_text(error));
704#endif 718#endif
719#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55,28,1)
720 av_frame_free (frame);
721#else
705 avcodec_free_frame(frame); 722 avcodec_free_frame(frame);
723#endif
706 return error; 724 return error;
707 } 725 }
708 726
@@ -783,17 +801,29 @@ static int load_encode_and_write(AVAudioFifo *fifo,
783#if DEBUG 801#if DEBUG
784 fprintf(stderr, "Could not read data from FIFO\n"); 802 fprintf(stderr, "Could not read data from FIFO\n");
785#endif 803#endif
804#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55,28,1)
805 av_frame_free (&output_frame);
806#else
786 avcodec_free_frame(&output_frame); 807 avcodec_free_frame(&output_frame);
808#endif
787 return AVERROR_EXIT; 809 return AVERROR_EXIT;
788 } 810 }
789 811
790 /** Encode one frame worth of audio samples. */ 812 /** Encode one frame worth of audio samples. */
791 if (encode_audio_frame(output_frame, output_format_context, 813 if (encode_audio_frame(output_frame, output_format_context,
792 output_codec_context, &data_written)) { 814 output_codec_context, &data_written)) {
815#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55,28,1)
816 av_frame_free (&output_frame);
817#else
793 avcodec_free_frame(&output_frame); 818 avcodec_free_frame(&output_frame);
819#endif
794 return AVERROR_EXIT; 820 return AVERROR_EXIT;
795 } 821 }
822#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55,28,1)
823 av_frame_free (&output_frame);
824#else
796 avcodec_free_frame(&output_frame); 825 avcodec_free_frame(&output_frame);
826#endif
797 return 0; 827 return 0;
798} 828}
799/** Write the trailer of the output file container. */ 829/** Write the trailer of the output file container. */
@@ -907,7 +937,12 @@ extract_audio (struct EXTRACTOR_ExtractContext *ec)
907 return; 937 return;
908 } 938 }
909 939
910 if (NULL == (frame = avcodec_alloc_frame ())) 940#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55,28,1)
941 frame = av_frame_alloc ();
942#else
943 frame = avcodec_alloc_frame();
944#endif
945 if (NULL == frame)
911 { 946 {
912#if DEBUG 947#if DEBUG
913 fprintf (stderr, 948 fprintf (stderr,