1 /*
2 * Copyright (c) 2012 Stefano Sabatini
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 "config.h"
22 #if HAVE_UNISTD_H
23 #include <unistd.h> /* getopt */
24 #endif
25
30
31 #undef printf
32 #undef fprintf
33
34 #if !HAVE_GETOPT
36 #endif
37
39 {
40 printf("Show the relationships between rawvideo pixel formats and FourCC tags.\n");
41 printf("usage: fourcc2pixfmt [OPTIONS]\n");
42 printf("\n"
43 "Options:\n"
44 "-l list the pixel format for each fourcc\n"
45 "-L list the fourccs for each pixel format\n"
46 "-p PIX_FMT given a pixel format, print the list of associated fourccs (one per line)\n"
47 "-h print this help\n");
48 }
49
51 {
52 int i;
53
56 char buf[32];
58 printf("%s%c", buf, sep);
59 }
60 }
61 }
62
63 int main(
int argc,
char **argv)
64 {
65 int i, list_fourcc_pix_fmt = 0, list_pix_fmt_fourccs = 0;
66 const char *pix_fmt_name =
NULL;
68
69 if (argc == 1) {
71 return 0;
72 }
73
74 while ((c =
getopt(argc, argv,
"hp:lL")) != -1) {
75 switch (c) {
76 case 'h':
78 return 0;
79 case 'l':
80 list_fourcc_pix_fmt = 1;
81 break;
82 case 'L':
83 list_pix_fmt_fourccs = 1;
84 break;
85 case 'p':
87 break;
88 case '?':
90 return 1;
91 }
92 }
93
94 if (list_fourcc_pix_fmt) {
96 char buf[32];
99 }
100 }
101
102 if (list_pix_fmt_fourccs) {
106 continue;
107 printf(
"%s: ", pix_desc->
name);
109 printf("\n");
110 }
111 }
112
113 if (pix_fmt_name) {
116 fprintf(stderr, "Invalid pixel format selected '%s'\n", pix_fmt_name);
117 return 1;
118 }
120 }
121
122 return 0;
123 }