MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / main

Function main

tools/fourcc2pixfmt.c:57–115  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

55}
56
57int main(int argc, char **argv)
58{
59 int i, list_fourcc_pix_fmt = 0, list_pix_fmt_fourccs = 0;
60 const PixelFormatTag *pix_fmt_tags = raw_pix_fmt_tags;
61 const char *pix_fmt_name = NULL;
62 int c;
63
64 if (argc == 1) {
65 usage();
66 return 0;
67 }
68
69 while ((c = getopt(argc, argv, "hp:lL")) != -1) {
70 switch (c) {
71 case 'h':
72 usage();
73 return 0;
74 case 'l':
75 list_fourcc_pix_fmt = 1;
76 break;
77 case 'L':
78 list_pix_fmt_fourccs = 1;
79 break;
80 case 'p':
81 pix_fmt_name = optarg;
82 break;
83 case '?':
84 usage();
85 return 1;
86 }
87 }
88
89 if (list_fourcc_pix_fmt)
90 for (i = 0; pix_fmt_tags[i].pix_fmt != AV_PIX_FMT_NONE; i++)
91 printf("%s: %s\n", av_fourcc2str(pix_fmt_tags[i].fourcc),
92 av_get_pix_fmt_name(pix_fmt_tags[i].pix_fmt));
93
94 if (list_pix_fmt_fourccs) {
95 for (i = 0; av_pix_fmt_desc_get(i); i++) {
96 const AVPixFmtDescriptor *pix_desc = av_pix_fmt_desc_get(i);
97 if (!pix_desc->name || pix_desc->flags & AV_PIX_FMT_FLAG_HWACCEL)
98 continue;
99 printf("%s: ", pix_desc->name);
100 print_pix_fmt_fourccs(i, pix_fmt_tags, ' ');
101 printf("\n");
102 }
103 }
104
105 if (pix_fmt_name) {
106 enum AVPixelFormat pix_fmt = av_get_pix_fmt(pix_fmt_name);
107 if (pix_fmt == AV_PIX_FMT_NONE) {
108 fprintf(stderr, "Invalid pixel format selected '%s'\n", pix_fmt_name);
109 return 1;
110 }
111 print_pix_fmt_fourccs(pix_fmt, pix_fmt_tags, '\n');
112 }
113
114 return 0;

Callers

nothing calls this directly

Calls 6

getoptFunction · 0.85
av_get_pix_fmt_nameFunction · 0.85
av_pix_fmt_desc_getFunction · 0.85
print_pix_fmt_fourccsFunction · 0.85
av_get_pix_fmtFunction · 0.85
usageFunction · 0.70

Tested by

no test coverage detected