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.

82 lines
2.9KB

  1. /* ffmpeg compatibility wrappers
  2. *
  3. * Copyright 2012 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. #include <libavcodec/avcodec.h>
  30. #include <libavformat/avformat.h>
  31. #if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(53, 2, 0)
  32. static inline int avformat_open_input(AVFormatContext **ps, const char *filename, void *fmt, void **options)
  33. {
  34. return av_open_input_file(ps, filename, NULL, 0, NULL);
  35. }
  36. #endif
  37. #if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(53, 5, 0)
  38. static inline AVCodecContext *
  39. avcodec_alloc_context3(AVCodec *codec __attribute__((unused)))
  40. {
  41. return avcodec_alloc_context();
  42. }
  43. static inline AVStream *
  44. avformat_new_stream(AVFormatContext *s, AVCodec *c) {
  45. return av_new_stream(s,0);
  46. }
  47. static inline int
  48. avcodec_get_context_defaults3(AVCodecContext *s, AVCodec *codec)
  49. {
  50. avcodec_get_context_defaults(s);
  51. return 0;
  52. }
  53. #endif /* < 53.5.0 */
  54. #if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(53, 5, 6)
  55. static inline int
  56. avcodec_open2(AVCodecContext *avctx, AVCodec *codec, void **options __attribute__((unused)))
  57. {
  58. return avcodec_open(avctx, codec);
  59. }
  60. #endif /* <= 53.5.6 */
  61. #if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(53, 5, 0)
  62. static inline int
  63. avformat_find_stream_info(AVFormatContext *ic, void **options)
  64. {
  65. return av_find_stream_info(ic);
  66. }
  67. static inline void
  68. avformat_close_input(AVFormatContext **s)
  69. {
  70. av_close_input_file(*s);
  71. }
  72. #endif /* < 53.5.0 */