Line | Branch | Exec | Source |
---|---|---|---|
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 | |||
21 | #include <stdlib.h> | ||
22 | |||
23 | #include "libavutil/mem.h" | ||
24 | #include "libswscale/swscale_internal.h" | ||
25 | |||
26 | static const struct { | ||
27 | const char *class; | ||
28 | int (*cond)(enum AVPixelFormat pix_fmt); | ||
29 | } query_tab[] = { | ||
30 | {"is16BPS", is16BPS}, | ||
31 | {"isNBPS", isNBPS}, | ||
32 | {"isBE", isBE}, | ||
33 | {"isYUV", isYUV}, | ||
34 | {"isPlanarYUV", isPlanarYUV}, | ||
35 | {"isSemiPlanarYUV", isSemiPlanarYUV}, | ||
36 | {"isRGB", isRGB}, | ||
37 | {"Gray", isGray}, | ||
38 | {"RGBinInt", isRGBinInt}, | ||
39 | {"BGRinInt", isBGRinInt}, | ||
40 | {"Bayer", isBayer}, | ||
41 | {"AnyRGB", isAnyRGB}, | ||
42 | {"ALPHA", isALPHA}, | ||
43 | {"Packed", isPacked}, | ||
44 | {"Planar", isPlanar}, | ||
45 | {"PackedRGB", isPackedRGB}, | ||
46 | {"PlanarRGB", isPlanarRGB}, | ||
47 | {"usePal", usePal}, | ||
48 | {"DataInHighBits", isDataInHighBits}, | ||
49 | {"SwappedChroma", isSwappedChroma}, | ||
50 | }; | ||
51 | |||
52 | 5092 | static int cmp_str(const void *a, const void *b) | |
53 | { | ||
54 | 5092 | const char *s1 = *(const char **)a; | |
55 | 5092 | const char *s2 = *(const char **)b; | |
56 | 5092 | return strcmp(s1, s2); | |
57 | } | ||
58 | |||
59 | 1 | int main(void) | |
60 | { | ||
61 | int i, j; | ||
62 | |||
63 |
2/2✓ Branch 0 taken 20 times.
✓ Branch 1 taken 1 times.
|
21 | for (i = 0; i < FF_ARRAY_ELEMS(query_tab); i++) { |
64 | 20 | const char **pix_fmts = NULL; | |
65 | 20 | int nb_pix_fmts = 0; | |
66 | 20 | const AVPixFmtDescriptor *pix_desc = NULL; | |
67 | |||
68 |
2/2✓ Branch 1 taken 4860 times.
✓ Branch 2 taken 20 times.
|
4880 | while ((pix_desc = av_pix_fmt_desc_next(pix_desc))) { |
69 | 4860 | enum AVPixelFormat pix_fmt = av_pix_fmt_desc_get_id(pix_desc); | |
70 |
2/2✓ Branch 1 taken 1109 times.
✓ Branch 2 taken 3751 times.
|
4860 | if (query_tab[i].cond(pix_fmt)) { |
71 | 1109 | const char *pix_name = pix_desc->name; | |
72 |
2/2✓ Branch 0 taken 6 times.
✓ Branch 1 taken 1103 times.
|
1109 | if (pix_fmt == AV_PIX_FMT_RGB32) pix_name = "rgb32"; |
73 |
2/2✓ Branch 0 taken 6 times.
✓ Branch 1 taken 1097 times.
|
1103 | else if (pix_fmt == AV_PIX_FMT_RGB32_1) pix_name = "rgb32_1"; |
74 |
2/2✓ Branch 0 taken 6 times.
✓ Branch 1 taken 1091 times.
|
1097 | else if (pix_fmt == AV_PIX_FMT_BGR32) pix_name = "bgr32"; |
75 |
2/2✓ Branch 0 taken 6 times.
✓ Branch 1 taken 1085 times.
|
1091 | else if (pix_fmt == AV_PIX_FMT_BGR32_1) pix_name = "bgr32_1"; |
76 | |||
77 | 1109 | av_dynarray_add(&pix_fmts, &nb_pix_fmts, (void *)pix_name); | |
78 | } | ||
79 | } | ||
80 | |||
81 |
1/2✓ Branch 0 taken 20 times.
✗ Branch 1 not taken.
|
20 | if (pix_fmts) { |
82 | 20 | qsort(pix_fmts, nb_pix_fmts, sizeof(*pix_fmts), cmp_str); | |
83 | |||
84 | 20 | printf("%s:\n", query_tab[i].class); | |
85 |
2/2✓ Branch 0 taken 1109 times.
✓ Branch 1 taken 20 times.
|
1129 | for (j = 0; j < nb_pix_fmts; j++) |
86 | 1109 | printf(" %s\n", pix_fmts[j]); | |
87 | 20 | printf("\n"); | |
88 | |||
89 | 20 | av_free(pix_fmts); | |
90 | } | ||
91 | } | ||
92 | 1 | return 0; | |
93 | } | ||
94 |