You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
1.2 KiB

  1. --- a/src/ffmpeg.c
  2. +++ b/src/ffmpeg.c
  3. @@ -50,6 +50,10 @@
  4. #include <ctype.h>
  5. #include "ffmpeg.h"
  6. +#ifndef AVCODEC_MAX_AUDIO_FRAME_SIZE
  7. +#define AVCODEC_MAX_AUDIO_FRAME_SIZE 192000
  8. +#endif
  9. +
  10. #ifndef CODEC_TYPE_AUDIO
  11. #define CODEC_TYPE_AUDIO AVMEDIA_TYPE_AUDIO
  12. #endif
  13. @@ -96,7 +100,7 @@ static int stream_component_open(priv_t
  14. enc->err_recognition = 1;
  15. #endif
  16. - if (!codec || avcodec_open(enc, codec) < 0)
  17. + if (!codec || avcodec_open2(enc, codec, NULL) < 0)
  18. return -1;
  19. if (enc->codec_type != AVMEDIA_TYPE_AUDIO) {
  20. lsx_fail("ffmpeg CODEC %x is not an audio CODEC", enc->codec_type);
  21. @@ -267,7 +271,11 @@ static int stopread(sox_format_t * ft)
  22. /*
  23. * add an audio output stream
  24. */
  25. +#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(54, 28, 0)
  26. +static AVStream *add_audio_stream(sox_format_t * ft, AVFormatContext *oc, enum AVCodecID codec_id)
  27. +#else
  28. static AVStream *add_audio_stream(sox_format_t * ft, AVFormatContext *oc, enum CodecID codec_id)
  29. +#endif
  30. {
  31. AVCodecContext *c;
  32. AVStream *st;
  33. @@ -306,7 +314,7 @@ static int open_audio(priv_t * ffmpeg, A
  34. }
  35. /* open it */
  36. - if (avcodec_open(c, codec) < 0) {
  37. + if (avcodec_open2(c, codec, NULL) < 0) {
  38. lsx_fail("ffmpeg could not open CODEC");
  39. return SOX_EOF;
  40. }