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.

122 lines
3.2KB

  1. /*
  2. * This file is part of Libav.
  3. *
  4. * Libav 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. * Libav 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 Libav; 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_h264_mp4toannexb_bsf;
  27. extern const AVBitStreamFilter ff_hevc_mp4toannexb_bsf;
  28. extern const AVBitStreamFilter ff_imx_dump_header_bsf;
  29. extern const AVBitStreamFilter ff_mjpeg2jpeg_bsf;
  30. extern const AVBitStreamFilter ff_mjpega_dump_header_bsf;
  31. extern const AVBitStreamFilter ff_mov2textsub_bsf;
  32. extern const AVBitStreamFilter ff_text2movsub_bsf;
  33. extern const AVBitStreamFilter ff_noise_bsf;
  34. extern const AVBitStreamFilter ff_remove_extradata_bsf;
  35. static const AVBitStreamFilter *bitstream_filters[] = {
  36. #if CONFIG_AAC_ADTSTOASC_BSF
  37. &ff_aac_adtstoasc_bsf,
  38. #endif
  39. #if CONFIG_CHOMP_BSF
  40. &ff_chomp_bsf,
  41. #endif
  42. #if CONFIG_DUMP_EXTRADATA_BSF
  43. &ff_dump_extradata_bsf,
  44. #endif
  45. #if CONFIG_H264_MP4TOANNEXB_BSF
  46. &ff_h264_mp4toannexb_bsf,
  47. #endif
  48. #if CONFIG_HEVC_MP4TOANNEXB_BSF
  49. &ff_hevc_mp4toannexb_bsf,
  50. #endif
  51. #if CONFIG_IMX_DUMP_HEADER_BSF
  52. &ff_imx_dump_header_bsf,
  53. #endif
  54. #if CONFIG_MJPEG2JPEG_BSF
  55. &ff_mjpeg2jpeg_bsf,
  56. #endif
  57. #if CONFIG_MJPEGA_DUMP_HEADER_BSF
  58. &ff_mjpeg2jpeg_bsf,
  59. #endif
  60. #if CONFIG_MOV2TEXTSUB_BSF
  61. &ff_mov2textsub_bsf,
  62. #endif
  63. #if CONFIG_TEXT2MOVSUB_BSF
  64. &ff_text2movsub_bsf,
  65. #endif
  66. #if CONFIG_NOISE_BSF
  67. &ff_noise_bsf,
  68. #endif
  69. #if CONFIG_REMOVE_EXTRADATA_BSF
  70. &ff_remove_extradata_bsf,
  71. #endif
  72. NULL,
  73. };
  74. const AVBitStreamFilter *av_bsf_next(void **opaque)
  75. {
  76. uintptr_t i = (uintptr_t)*opaque;
  77. const AVBitStreamFilter *f = bitstream_filters[i];
  78. if (f)
  79. *opaque = (void*)(i + 1);
  80. return f;
  81. }
  82. const AVBitStreamFilter *av_bsf_get_by_name(const char *name)
  83. {
  84. int i;
  85. for (i = 0; bitstream_filters[i]; i++) {
  86. const AVBitStreamFilter *f = bitstream_filters[i];
  87. if (!strcmp(f->name, name))
  88. return f;
  89. }
  90. return NULL;
  91. }
  92. const AVClass *ff_bsf_child_class_next(const AVClass *prev)
  93. {
  94. int i;
  95. /* find the filter that corresponds to prev */
  96. for (i = 0; prev && bitstream_filters[i]; i++) {
  97. if (bitstream_filters[i]->priv_class == prev) {
  98. i++;
  99. break;
  100. }
  101. }
  102. /* find next filter with priv options */
  103. for (; bitstream_filters[i]; i++)
  104. if (bitstream_filters[i]->priv_class)
  105. return bitstream_filters[i]->priv_class;
  106. return NULL;
  107. }