Audio plugin host https://kx.studio/carla
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.

96 lines
3.2KB

  1. /* ffmpeg compatibility wrappers
  2. *
  3. * Copyright 2012,2013 Robin Gareus <robin@gareus.org>
  4. *
  5. * Permission is hereby granted, free of charge, to any person obtaining a copy
  6. * of this software and associated documentation files (the "Software"), to deal
  7. * in the Software without restriction, including without limitation the rights
  8. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  9. * copies of the Software, and to permit persons to whom the Software is
  10. * furnished to do so, subject to the following conditions:
  11. *
  12. * 1. Redistributions of source code must retain the above copyright notice, this
  13. * list of conditions and the following disclaimer.
  14. * 2. Redistributions in binary form must reproduce the above copyright notice,
  15. * this list of conditions and the following disclaimer in the documentation
  16. * and/or other materials provided with the distribution.
  17. *
  18. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  19. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  20. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  21. * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
  22. * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  23. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  24. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  25. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  26. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  27. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  28. */
  29. #ifndef FFCOMPAT_H
  30. #define FFCOMPAT_H
  31. #include <libavcodec/avcodec.h>
  32. #include <libavformat/avformat.h>
  33. #include <libavutil/avutil.h>
  34. #ifndef AVCODEC_MAX_AUDIO_FRAME_SIZE
  35. #define AVCODEC_MAX_AUDIO_FRAME_SIZE 192000
  36. #endif
  37. #if LIBAVUTIL_VERSION_INT < AV_VERSION_INT(50, 0, 0)
  38. #define AVMEDIA_TYPE_AUDIO CODEC_TYPE_AUDIO
  39. #endif
  40. #if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(53, 2, 0)
  41. static inline int avformat_open_input(AVFormatContext **ps, const char *filename, void *fmt, void **options)
  42. {
  43. return av_open_input_file(ps, filename, NULL, 0, NULL);
  44. }
  45. #endif /* avformat < 53.2.0 */
  46. #if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(53, 5, 0)
  47. static inline AVCodecContext *
  48. avcodec_alloc_context3(AVCodec *codec __attribute__((unused)))
  49. {
  50. return avcodec_alloc_context();
  51. }
  52. static inline AVStream *
  53. avformat_new_stream(AVFormatContext *s, AVCodec *c) {
  54. return av_new_stream(s,0);
  55. }
  56. static inline int
  57. avcodec_get_context_defaults3(AVCodecContext *s, AVCodec *codec)
  58. {
  59. avcodec_get_context_defaults(s);
  60. return 0;
  61. }
  62. #endif /* < 53.5.0 */
  63. #if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(53, 5, 6)
  64. static inline int
  65. avcodec_open2(AVCodecContext *avctx, AVCodec *codec, void **options __attribute__((unused)))
  66. {
  67. return avcodec_open(avctx, codec);
  68. }
  69. #endif /* <= 53.5.6 */
  70. #if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(53, 5, 0)
  71. static inline int
  72. avformat_find_stream_info(AVFormatContext *ic, void **options)
  73. {
  74. return av_find_stream_info(ic);
  75. }
  76. static inline void
  77. avformat_close_input(AVFormatContext **s)
  78. {
  79. av_close_input_file(*s);
  80. }
  81. #endif /* < 53.5.0 */
  82. #endif /* FFCOMPAT_H */