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.

138 lines
3.7KB

  1. /*
  2. * This file is part of FFmpeg.
  3. *
  4. * FFmpeg is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU Lesser General Public
  6. * License as published by the Free Software Foundation; either
  7. * version 2.1 of the License, or (at your option) any later version.
  8. *
  9. * FFmpeg is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. * Lesser General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU Lesser General Public
  15. * License along with FFmpeg; if not, write to the Free Software
  16. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  17. */
  18. #include "config.h"
  19. #include "libavutil/common.h"
  20. #include "libavutil/log.h"
  21. #include "avcodec.h"
  22. #include "bsf.h"
  23. extern const AVBitStreamFilter ff_aac_adtstoasc_bsf;
  24. extern const AVBitStreamFilter ff_chomp_bsf;
  25. extern const AVBitStreamFilter ff_dump_extradata_bsf;
  26. extern const AVBitStreamFilter ff_dca_core_bsf;
  27. extern const AVBitStreamFilter ff_h264_mp4toannexb_bsf;
  28. extern const AVBitStreamFilter ff_hevc_mp4toannexb_bsf;
  29. extern const AVBitStreamFilter ff_imx_dump_header_bsf;
  30. extern const AVBitStreamFilter ff_mjpeg2jpeg_bsf;
  31. extern const AVBitStreamFilter ff_mjpega_dump_header_bsf;
  32. extern const AVBitStreamFilter ff_mp3_header_decompress_bsf;
  33. extern const AVBitStreamFilter ff_mpeg4_unpack_bframes_bsf;
  34. extern const AVBitStreamFilter ff_mov2textsub_bsf;
  35. extern const AVBitStreamFilter ff_noise_bsf;
  36. extern const AVBitStreamFilter ff_remove_extradata_bsf;
  37. extern const AVBitStreamFilter ff_text2movsub_bsf;
  38. extern const AVBitStreamFilter ff_vp9_superframe_bsf;
  39. static const AVBitStreamFilter *bitstream_filters[] = {
  40. #if CONFIG_AAC_ADTSTOASC_BSF
  41. &ff_aac_adtstoasc_bsf,
  42. #endif
  43. #if CONFIG_CHOMP_BSF
  44. &ff_chomp_bsf,
  45. #endif
  46. #if CONFIG_DUMP_EXTRADATA_BSF
  47. &ff_dump_extradata_bsf,
  48. #endif
  49. #if CONFIG_DCA_CORE_BSF
  50. &ff_dca_core_bsf,
  51. #endif
  52. #if CONFIG_H264_MP4TOANNEXB_BSF
  53. &ff_h264_mp4toannexb_bsf,
  54. #endif
  55. #if CONFIG_HEVC_MP4TOANNEXB_BSF
  56. &ff_hevc_mp4toannexb_bsf,
  57. #endif
  58. #if CONFIG_IMX_DUMP_HEADER_BSF
  59. &ff_imx_dump_header_bsf,
  60. #endif
  61. #if CONFIG_MJPEG2JPEG_BSF
  62. &ff_mjpeg2jpeg_bsf,
  63. #endif
  64. #if CONFIG_MJPEGA_DUMP_HEADER_BSF
  65. &ff_mjpega_dump_header_bsf,
  66. #endif
  67. #if CONFIG_MP3_HEADER_DECOMPRESS_BSF
  68. &ff_mp3_header_decompress_bsf,
  69. #endif
  70. #if CONFIG_MPEG4_UNPACK_BFRAMES_BSF
  71. &ff_mpeg4_unpack_bframes_bsf,
  72. #endif
  73. #if CONFIG_MOV2TEXTSUB_BSF
  74. &ff_mov2textsub_bsf,
  75. #endif
  76. #if CONFIG_NOISE_BSF
  77. &ff_noise_bsf,
  78. #endif
  79. #if CONFIG_REMOVE_EXTRADATA_BSF
  80. &ff_remove_extradata_bsf,
  81. #endif
  82. #if CONFIG_TEXT2MOVSUB_BSF
  83. &ff_text2movsub_bsf,
  84. #endif
  85. #if CONFIG_VP9_SUPERFRAME_BSF
  86. &ff_vp9_superframe_bsf,
  87. #endif
  88. NULL,
  89. };
  90. const AVBitStreamFilter *av_bsf_next(void **opaque)
  91. {
  92. uintptr_t i = (uintptr_t)*opaque;
  93. const AVBitStreamFilter *f = bitstream_filters[i];
  94. if (f)
  95. *opaque = (void*)(i + 1);
  96. return f;
  97. }
  98. const AVBitStreamFilter *av_bsf_get_by_name(const char *name)
  99. {
  100. int i;
  101. for (i = 0; bitstream_filters[i]; i++) {
  102. const AVBitStreamFilter *f = bitstream_filters[i];
  103. if (!strcmp(f->name, name))
  104. return f;
  105. }
  106. return NULL;
  107. }
  108. const AVClass *ff_bsf_child_class_next(const AVClass *prev)
  109. {
  110. int i;
  111. /* find the filter that corresponds to prev */
  112. for (i = 0; prev && bitstream_filters[i]; i++) {
  113. if (bitstream_filters[i]->priv_class == prev) {
  114. i++;
  115. break;
  116. }
  117. }
  118. /* find next filter with priv options */
  119. for (; bitstream_filters[i]; i++)
  120. if (bitstream_filters[i]->priv_class)
  121. return bitstream_filters[i]->priv_class;
  122. return NULL;
  123. }