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.

87 lines
2.7KB

  1. /*
  2. * Copyright (c) 2017 Clément Bœsch <u pkh me>
  3. *
  4. * This file is part of FFmpeg.
  5. *
  6. * FFmpeg is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Lesser General Public
  8. * License as published by the Free Software Foundation; either
  9. * version 2.1 of the License, or (at your option) any later version.
  10. *
  11. * FFmpeg is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Lesser General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General Public
  17. * License along with FFmpeg; if not, write to the Free Software
  18. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  19. */
  20. #include "libswscale/swscale_internal.h"
  21. /* TODO: drop this wrapper when all the is*() becomes functions */
  22. #define DECLARE_WRAPPER(macro) \
  23. static int macro##_func(enum AVPixelFormat pix_fmt) \
  24. { \
  25. return macro(pix_fmt); \
  26. }
  27. DECLARE_WRAPPER(is16BPS)
  28. DECLARE_WRAPPER(isNBPS)
  29. DECLARE_WRAPPER(isBE)
  30. DECLARE_WRAPPER(isYUV)
  31. DECLARE_WRAPPER(isPlanarYUV)
  32. DECLARE_WRAPPER(isRGB)
  33. DECLARE_WRAPPER(isGray)
  34. DECLARE_WRAPPER(isRGBinInt)
  35. DECLARE_WRAPPER(isBGRinInt)
  36. DECLARE_WRAPPER(isBayer)
  37. DECLARE_WRAPPER(isAnyRGB)
  38. DECLARE_WRAPPER(isALPHA)
  39. DECLARE_WRAPPER(isPacked)
  40. DECLARE_WRAPPER(isPlanar)
  41. DECLARE_WRAPPER(isPackedRGB)
  42. DECLARE_WRAPPER(isPlanarRGB)
  43. DECLARE_WRAPPER(usePal)
  44. static const struct {
  45. const char *class;
  46. int (*cond)(enum AVPixelFormat pix_fmt);
  47. } query_tab[] = {
  48. {"is16BPS", is16BPS_func},
  49. {"isNBPS", isNBPS_func},
  50. {"isBE", isBE_func},
  51. {"isYUV", isYUV_func},
  52. {"isPlanarYUV", isPlanarYUV_func},
  53. {"isRGB", isRGB_func},
  54. {"Gray", isGray_func},
  55. {"RGBinInt", isRGBinInt_func},
  56. {"BGRinInt", isBGRinInt_func},
  57. {"Bayer", isBayer_func},
  58. {"AnyRGB", isAnyRGB_func},
  59. {"ALPHA", isALPHA_func},
  60. {"Packed", isPacked_func},
  61. {"Planar", isPlanar_func},
  62. {"PackedRGB", isPackedRGB_func},
  63. {"PlanarRGB", isPlanarRGB_func},
  64. {"usePal", usePal_func},
  65. };
  66. int main(void)
  67. {
  68. int i;
  69. for (i = 0; i < FF_ARRAY_ELEMS(query_tab); i++) {
  70. const AVPixFmtDescriptor *pix_desc = NULL;
  71. printf("%s:\n", query_tab[i].class);
  72. while ((pix_desc = av_pix_fmt_desc_next(pix_desc))) {
  73. enum AVPixelFormat pix_fmt = av_pix_fmt_desc_get_id(pix_desc);
  74. if (query_tab[i].cond(pix_fmt))
  75. printf(" %s\n", pix_desc->name);
  76. }
  77. printf("\n");
  78. }
  79. return 0;
  80. }