pixdesc_query.c 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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(isRGBinBytes)
  37. DECLARE_WRAPPER(isBGRinBytes)
  38. DECLARE_WRAPPER(isBayer)
  39. DECLARE_WRAPPER(isAnyRGB)
  40. DECLARE_WRAPPER(isALPHA)
  41. DECLARE_WRAPPER(isPacked)
  42. DECLARE_WRAPPER(isPlanar)
  43. DECLARE_WRAPPER(isPackedRGB)
  44. DECLARE_WRAPPER(isPlanarRGB)
  45. DECLARE_WRAPPER(usePal)
  46. static const struct {
  47. const char *class;
  48. int (*cond)(enum AVPixelFormat pix_fmt);
  49. } query_tab[] = {
  50. {"is16BPS", is16BPS_func},
  51. {"isNBPS", isNBPS_func},
  52. {"isBE", isBE_func},
  53. {"isYUV", isYUV_func},
  54. {"isPlanarYUV", isPlanarYUV_func},
  55. {"isRGB", isRGB_func},
  56. {"Gray", isGray_func},
  57. {"RGBinInt", isRGBinInt_func},
  58. {"BGRinInt", isBGRinInt_func},
  59. {"RGBinBytes", isRGBinBytes_func},
  60. {"BGRinBytes", isBGRinBytes_func},
  61. {"Bayer", isBayer_func},
  62. {"AnyRGB", isAnyRGB_func},
  63. {"ALPHA", isALPHA_func},
  64. {"Packed", isPacked_func},
  65. {"Planar", isPlanar_func},
  66. {"PackedRGB", isPackedRGB_func},
  67. {"PlanarRGB", isPlanarRGB_func},
  68. {"usePal", usePal_func},
  69. };
  70. int main(void)
  71. {
  72. int i;
  73. for (i = 0; i < FF_ARRAY_ELEMS(query_tab); i++) {
  74. const AVPixFmtDescriptor *pix_desc = NULL;
  75. printf("%s:\n", query_tab[i].class);
  76. while ((pix_desc = av_pix_fmt_desc_next(pix_desc))) {
  77. enum AVPixelFormat pix_fmt = av_pix_fmt_desc_get_id(pix_desc);
  78. if (query_tab[i].cond(pix_fmt))
  79. printf(" %s\n", pix_desc->name);
  80. }
  81. printf("\n");
  82. }
  83. return 0;
  84. }