FFmpeg: fftools/opt_common.c Source File
Go to the documentation of this file. 1 /*
2 * Option handlers shared between the tools.
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
23 #include <stdio.h>
24
28
36 #include "libavutil/ffversion.h"
42
48
51
54
57
60
63
64
69 };
70
73
75 {
76 #if CONFIG_NONFREE
78 "This version of %s has nonfree parts compiled in.\n"
79 "Therefore it is not legally redistributable.\n",
81 #elif CONFIG_GPLV3
83 "%s is free software; you can redistribute it and/or modify\n"
84 "it under the terms of the GNU General Public License as published by\n"
85 "the Free Software Foundation; either version 3 of the License, or\n"
86 "(at your option) any later version.\n"
87 "\n"
88 "%s is distributed in the hope that it will be useful,\n"
89 "but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
90 "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
91 "GNU General Public License for more details.\n"
92 "\n"
93 "You should have received a copy of the GNU General Public License\n"
94 "along with %s. If not, see <http://www.gnu.org/licenses/>.\n",
96 #elif CONFIG_GPL
98 "%s is free software; you can redistribute it and/or modify\n"
99 "it under the terms of the GNU General Public License as published by\n"
100 "the Free Software Foundation; either version 2 of the License, or\n"
101 "(at your option) any later version.\n"
102 "\n"
103 "%s is distributed in the hope that it will be useful,\n"
104 "but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
105 "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
106 "GNU General Public License for more details.\n"
107 "\n"
108 "You should have received a copy of the GNU General Public License\n"
109 "along with %s; if not, write to the Free Software\n"
110 "Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA\n",
112 #elif CONFIG_LGPLV3
114 "%s is free software; you can redistribute it and/or modify\n"
115 "it under the terms of the GNU Lesser General Public License as published by\n"
116 "the Free Software Foundation; either version 3 of the License, or\n"
117 "(at your option) any later version.\n"
118 "\n"
119 "%s is distributed in the hope that it will be useful,\n"
120 "but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
121 "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
122 "GNU Lesser General Public License for more details.\n"
123 "\n"
124 "You should have received a copy of the GNU Lesser General Public License\n"
125 "along with %s. If not, see <http://www.gnu.org/licenses/>.\n",
127 #else
129 "%s is free software; you can redistribute it and/or\n"
130 "modify it under the terms of the GNU Lesser General Public\n"
131 "License as published by the Free Software Foundation; either\n"
132 "version 2.1 of the License, or (at your option) any later version.\n"
133 "\n"
134 "%s is distributed in the hope that it will be useful,\n"
135 "but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
136 "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n"
137 "Lesser General Public License for more details.\n"
138 "\n"
139 "You should have received a copy of the GNU Lesser General Public\n"
140 "License along with %s; if not, write to the Free Software\n"
141 "Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA\n",
143 #endif
144
145 return 0;
146 }
147
149
151 #define SHOW_VERSION 2
152 #define SHOW_CONFIG 4
153 #define SHOW_COPYRIGHT 8
154
155 #define PRINT_LIB_INFO(libname, LIBNAME, flags, level) \
156 if (CONFIG_##LIBNAME) { \
157 const char *indent = flags & INDENT? " " : ""; \
158 if (flags & SHOW_VERSION) { \
159 unsigned int version = libname##_version(); \
160 av_log(NULL, level, \
161 "%slib%-11s %2d.%3d.%3d / %2d.%3d.%3d\n", \
162 indent, #libname, \
163 LIB##LIBNAME##_VERSION_MAJOR, \
164 LIB##LIBNAME##_VERSION_MINOR, \
165 LIB##LIBNAME##_VERSION_MICRO, \
166 AV_VERSION_MAJOR(version), AV_VERSION_MINOR(version),\
167 AV_VERSION_MICRO(version)); \
168 } \
169 if (flags & SHOW_CONFIG) { \
170 const char *cfg = libname##_configuration(); \
171 if (strcmp(FFMPEG_CONFIGURATION, cfg)) { \
172 if (!warned_cfg) { \
173 av_log(NULL, level, \
174 "%sWARNING: library configuration mismatch\n", \
175 indent); \
176 warned_cfg = 1; \
177 } \
178 av_log(NULL, level, "%s%-11s configuration: %s\n", \
179 indent, #libname, cfg); \
180 } \
181 } \
182 } \
183
185 {
193 }
194
196 {
198
205
206 av_log(
NULL,
level,
"%sconfiguration: " FFMPEG_CONFIGURATION
"\n", indent);
207 }
208
210 {
212 char str[] = { FFMPEG_CONFIGURATION };
213 char *conflist, *remove_tilde, *splitconf;
214
215 // Change all the ' --' strings to '~--' so that
216 // they can be identified as tokens.
217 while ((conflist = strstr(str,
" --")) !=
NULL) {
218 conflist[0] = '~';
219 }
220
221 // Compensate for the weirdness this would cause
222 // when passing 'pkg-config --static'.
223 while ((remove_tilde = strstr(str,
"pkg-config~")) !=
NULL) {
224 remove_tilde[sizeof("pkg-config~") - 2] = ' ';
225 }
226
227 splitconf = strtok(str, "~");
229 while (splitconf !=
NULL) {
231 splitconf = strtok(
NULL,
"~");
232 }
233 }
234
236 {
239 return;
240
244 }
245
247 {
251
252 return 0;
253 }
254
256 {
259
260 return 0;
261 }
262
263 #define PRINT_CODEC_SUPPORTED(codec, config, type, name, elem, fmt, ...) \
264 do { \
265 int num = 0; \
266 const type *elem = NULL; \
267 avcodec_get_supported_config(NULL, codec, config, 0, \
268 (const void **) &elem, &num); \
269 if (elem) { \
270 printf(" Supported " name ":"); \
271 for (int i = 0; i < num; i++) { \
272 printf(" " fmt, __VA_ARGS__); \
273 elem++; \
274 } \
275 printf("\n"); \
276 } \
277 } while (0)
278
280 {
285 return "unknown/invalid";
286 return bp->str;
287 }
288
290 {
293
294 printf(
"%s %s [%s]:\n", encoder ?
"Encoder" :
"Decoder",
c->name,
295 c->long_name ?
c->long_name :
"");
296
297 printf(
" General capabilities: ");
324 if (!
c->capabilities)
327
330 printf(
" Threading capabilities: ");
339 default:
printf(
"none");
break;
340 }
342 }
343
345 printf(
" Supported hardware devices: ");
346 for (
int i = 0;;
i++) {
350 break;
354 }
356 }
357
359 fps,
"%d/%d", fps->
num, fps->den);
363 rate, "%d", *rate);
366
369 "channel layouts",
layout,
"%s",
372
377 }
378 }
379
381 int encoder)
382 {
388 }
390 }
391
393 {
396
399 return;
400 }
401
404
405 if (codec)
409 int printed = 0;
410
412 printed = 1;
414 }
415
416 if (!printed) {
418 "but no %s for it are available. FFmpeg might need to be "
419 "recompiled with additional external libraries.\n",
420 name, encoder ?
"encoders" :
"decoders");
421 }
422 } else {
425 }
426 }
427
429 {
431
432 if (!fmt) {
434 return;
435 }
436
438
441
444 }
445
447 {
449
452 return;
453 }
454
456 if (!proto_class) {
458 return;
459 }
460
462 }
463
465 {
468
469 if (!fmt) {
471 return;
472 }
473
475
482 printf(
" Default video codec: %s.\n",
desc->name);
483 }
486 printf(
" Default audio codec: %s.\n",
desc->name);
487 }
490 printf(
" Default subtitle codec: %s.\n",
desc->name);
491 }
492
495 }
496
497 #if CONFIG_AVFILTER
498 static void show_help_filter(
const char *
name)
499 {
500 #if CONFIG_AVFILTER
503
506 return;
509 return;
510 }
511
512 printf(
"Filter %s\n",
f->name);
514 printf(
" %s\n",
f->description);
515
517 printf(
" slice threading supported\n");
518
521 for (
i = 0;
i < count;
i++) {
524 }
526 printf(
" dynamic (depending on the options)\n");
527 else if (!count)
528 printf(
" none (source filter)\n");
529
532 for (
i = 0;
i < count;
i++) {
535 }
537 printf(
" dynamic (depending on the options)\n");
538 else if (!count)
539 printf(
" none (sink filter)\n");
540
545 printf(
"This filter has support for timeline through the 'enable' option.\n");
546 #else
548 "can not to satisfy request\n");
549 #endif
550 }
551 #endif
552
554 {
556
559 return;
560 } else if (!bsf) {
562 return;
563 }
564
568 printf(
" Supported codecs:");
571 id++;
572 }
574 }
577 }
578
580 {
581 char *topic, *par;
583
585 if (!topic)
587 par = strchr(topic, '=');
588 if (par)
589 *par++ = 0;
590
591 if (!*topic) {
593 } else if (!strcmp(topic, "decoder")) {
595 } else if (!strcmp(topic, "encoder")) {
597 } else if (!strcmp(topic, "demuxer")) {
599 } else if (!strcmp(topic, "muxer")) {
601 } else if (!strcmp(topic, "protocol")) {
603 #if CONFIG_AVFILTER
604 } else if (!strcmp(topic, "filter")) {
605 show_help_filter(par);
606 #endif
607 } else if (!strcmp(topic, "bsf")) {
609 } else {
611 }
612
614 return 0;
615 }
616
618 {
621
622 printf(
" (%s:", encoder ?
"encoders" :
"decoders");
623
626
628 }
629
631 {
634
635 return (*da)->type != (*db)->type ?
FFDIFFSIGN((*da)->type, (*db)->type) :
636 strcmp((*da)->name, (*db)->name);
637 }
638
640 {
643 unsigned nb_codecs = 0,
i = 0;
644
646 nb_codecs++;
655 return nb_codecs;
656 }
657
659 {
666 default: return '?';
667 }
668 }
669
671 {
675
676 if (nb_codecs < 0)
677 return nb_codecs;
678
680 " D..... = Decoding supported\n"
681 " .E.... = Encoding supported\n"
682 " ..V... = Video codec\n"
683 " ..A... = Audio codec\n"
684 " ..S... = Subtitle codec\n"
685 " ..D... = Data codec\n"
686 " ..T... = Attachment codec\n"
687 " ...I.. = Intra frame-only codec\n"
688 " ....L. = Lossy compression\n"
689 " .....S = Lossless compression\n"
690 " -------\n");
691 for (
i = 0;
i < nb_codecs;
i++) {
695
696 if (strstr(
desc->name,
"_deprecated"))
697 continue;
698
706
708
709 /* print decoders/encoders when there's more than one or their
710 * names are different from codec name */
712 if (strcmp(codec->
name,
desc->name)) {
714 break;
715 }
716 }
719 if (strcmp(codec->
name,
desc->name)) {
721 break;
722 }
723 }
724
726 }
728 return 0;
729 }
730
732 {
735
736 if (nb_codecs < 0)
737 return nb_codecs;
738
740 " V..... = Video\n"
741 " A..... = Audio\n"
742 " S..... = Subtitle\n"
743 " .F.... = Frame-level multithreading\n"
744 " ..S... = Slice-level multithreading\n"
745 " ...X.. = Codec is experimental\n"
746 " ....B. = Supports draw_horiz_band\n"
747 " .....D = Supports direct rendering method 1\n"
748 " ------\n",
749 encoder ? "Encoders" : "Decoders");
750 for (
i = 0;
i < nb_codecs;
i++) {
754
763
765 if (strcmp(codec->
name,
desc->name))
767
769 }
770 }
772 return 0;
773 }
774
776 {
778 }
779
781 {
783 }
784
786 {
789
790 printf(
"Bitstream filters:\n");
794 return 0;
795 }
796
798 {
799 #if CONFIG_AVFILTER
801 char descr[64], *descr_cur;
805
807 " T.. = Timeline support\n"
808 " .S. = Slice threading\n"
809 " A = Audio input/output\n"
810 " V = Video input/output\n"
811 " N = Dynamic number and/or type of input/output\n"
812 " | = Source or sink filter\n"
813 " ------\n");
815 descr_cur = descr;
816 for (
i = 0;
i < 2;
i++) {
817 unsigned nb_pads;
819 *(descr_cur++) = '-';
820 *(descr_cur++) = '>';
821 }
824 for (j = 0; j < nb_pads; j++) {
825 if (descr_cur >= descr + sizeof(descr) - 4)
826 break;
828 }
829 if (!j)
832 }
833 *descr_cur = 0;
834 printf(
" %c%c %-17s %-10s %s\n",
838 }
839 #else
840 printf(
"No filters available: libavfilter disabled\n");
841 #endif
842 return 0;
843 }
844
846 {
847 if (!avclass)
848 return 0;
850 }
851
853 {
854 void *ifmt_opaque =
NULL;
856 void *ofmt_opaque =
NULL;
858 const char *last_name;
859 int is_dev;
860 const char *is_device_placeholder = device_only ? "" : ".";
861
863 " D.%s = Demuxing supported\n"
864 " .E%s = Muxing supported\n"
865 "%s"
866 " ---\n",
867 device_only ? "Devices" : "Formats",
868 is_device_placeholder, is_device_placeholder,
869 device_only ? "": " ..d = Is a device\n");
870
871 last_name = "000";
872 for (;;) {
875 int device = 0;
877 const char *long_name =
NULL;
878
883 if (!is_dev && device_only)
884 continue;
886 strcmp(ofmt->
name, last_name) > 0) {
890 device = is_dev;
891 }
892 }
893 }
898 if (!is_dev && device_only)
899 continue;
901 strcmp(ifmt->
name, last_name) > 0) {
905 device = is_dev;
906 }
909 device = is_dev;
910 }
911 }
912 }
914 break;
916
917 printf(
" %c%c%s %-15s %s\n",
920 device_only ? "" : (device ? "d" : " "),
922 long_name ? long_name : " ");
923 }
924 return 0;
925 }
926
928 {
930 }
931
933 {
935 }
936
938 {
940 }
941
943 {
945 }
946
948 {
951
952 printf(
"Supported file protocols:\n"
953 "Input:\n");
959 return 0;
960 }
961
963 {
967
968 printf(
"%-32s #RRGGBB\n",
"name");
969
972
973 return 0;
974 }
975
977 {
979
981 "I.... = Supported Input format for conversion\n"
982 ".O... = Supported Output format for conversion\n"
983 "..H.. = Hardware accelerated format\n"
984 "...P. = Paletted format\n"
985 "....B = Bitstream format\n"
986 "FLAGS NAME NB_COMPONENTS BITS_PER_PIXEL BIT_DEPTHS\n"
987 "-----\n");
988
989 #if !CONFIG_SWSCALE
990 # define sws_isSupportedInput(x) 0
991 # define sws_isSupportedOutput(x) 0
992 #endif
993
996 printf(
"%c%c%c%c%c %-16s %d %3d %d",
1006
1010 }
1011 return 0;
1012 }
1013
1015 {
1018 char buf[128], buf2[128];
1020
1021 printf(
"Individual channels:\n"
1022 "NAME DESCRIPTION\n");
1023 for (
i = 0;
i < 63;
i++) {
1025 if (strstr(buf, "USR"))
1026 continue;
1028 printf(
"%-14s %s\n", buf, buf2);
1029 }
1030 printf(
"\nStandard channel layouts:\n"
1031 "NAME DECOMPOSITION\n");
1035 for (
i = 0;
i < 63;
i++) {
1037 if (idx >= 0) {
1039 printf(
"%s%s", idx ?
"+" :
"", buf2);
1040 }
1041 }
1043 }
1044 return 0;
1045 }
1046
1048 {
1050 char fmt_str[128];
1053 return 0;
1054 }
1055
1057 {
1058 for (
int i = 0;
i < 32;
i++) {
1060 if (str)
1062 }
1063 return 0;
1064 }
1065
1067 {
1070
1073
1075 return 0;
1076 }
1077
1079 {
1081 int count;
1082
1086 };
1087 static const AVClass class = {
1092 };
1093 const AVClass *pclass = &
class;
1094
1096
1099 }
1100
1102 }
1103
1105 struct tm *tm)
1106 {
1108
1109 while ((
c = *(
template++))) {
1111 if (!(
c = *(
template++)))
1112 break;
1114 case 'p':
1116 break;
1117 case 't':
1119 tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday,
1120 tm->tm_hour, tm->tm_min, tm->tm_sec);
1121 break;
1122 case '%':
1124 break;
1125 }
1126 } else {
1128 }
1129 }
1130 }
1131
1133 {
1134 va_list vl2;
1136 static int print_prefix = 1;
1137
1141 va_end(vl2);
1145 }
1146 }
1147
1149 {
1150 char *filename_template =
NULL;
1153 int prog_loglevel, envlevel = 0;
1154 time_t now;
1155 struct tm *tm;
1156 AVBPrint filename;
1157
1159 return 0;
1160 time(&now);
1161 tm = localtime(&now);
1162
1163 while (env && *env) {
1165 if (count)
1167 "Failed to parse FFREPORT environment variable: %s\n",
1169 break;
1170 }
1171 if (*env)
1172 env++;
1173 count++;
1174 if (!strcmp(
key,
"file")) {
1176 filename_template =
val;
1178 }
else if (!strcmp(
key,
"level")) {
1179 char *tail;
1181 if (*tail) {
1187 }
1188 envlevel = 1;
1189 } else {
1191 }
1194 }
1195
1203 }
1204
1206 if (!envlevel)
1208
1213 filename.str, strerror(errno));
1215 }
1218 "%s started on %04d-%02d-%02d at %02d:%02d:%02d\n"
1219 "Report written to \"%s\"\n"
1220 "Log level: %d\n",
1222 tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday,
1223 tm->tm_hour, tm->tm_min, tm->tm_sec,
1226
1227 if (file)
1229
1230 return 0;
1231 }
1232
1234 {
1236 }
1237
1239 {
1240 char *tail;
1242
1243 max = strtol(
arg, &tail, 10);
1244 if (*tail) {
1247 }
1249 return 0;
1250 }
1251
1253 {
1254 const struct {
const char *
name;
int level; } log_levels[] = {
1264 };
1265 const char *token;
1266 char *tail;
1270
1274 if (*token == '+' || *token == '-') {
1275 cmd = *token++;
1276 } else {
1277 cmd = 0;
1278 }
1280 flags = 0;
/* missing relative prefix, build absolute value */
1281 }
1283 if (cmd == '-') {
1285 } else {
1287 }
1289 if (cmd == '-') {
1291 } else {
1293 }
1295 if (cmd == '-') {
1297 } else {
1299 }
1301 if (cmd == '-') {
1303 } else {
1305 }
1306 } else {
1307 break;
1308 }
1310 }
1312 goto end;
1313 }
else if (*
arg ==
'+') {
1317 }
1318
1320 if (!strcmp(log_levels[
i].
name,
arg)) {
1321 level = log_levels[
i].level;
1322 goto end;
1323 }
1324 }
1325
1327 if (*tail) {
1329 "Possible levels are numbers or:\n",
arg);
1338 }
1339
1340 end:
1343 return 0;
1344 }
1345
1346 #if CONFIG_AVDEVICE
1348 {
1349 // print devices
1357 if (j > 0)
1359 printf(
"%s", media_type ? media_type :
"unknown");
1360 }
1361 } else {
1363 }
1365 }
1366 }
1367
1369 {
1372
1375
1376 printf(
"Auto-detected sources for %s:\n", fmt->
name);
1380 }
1381
1382 print_device_list(device_list);
1383
1387 }
1388
1390 {
1393
1396
1397 printf(
"Auto-detected sinks for %s:\n", fmt->
name);
1401 }
1402
1403 print_device_list(device_list);
1404
1408 }
1409
1411 {
1414 char *opts_str =
NULL;
1417 if (!*dev)
1419 if ((opts_str = strchr(*dev, ','))) {
1420 *(opts_str++) = '0円';
1424 }
1425 }
1426 } else
1427 printf(
"\nDevice name is not provided.\n"
1428 "You can pass devicename[,opt1=val1[,opt2=val2...]] as an argument.\n\n");
1429 return 0;
1430 }
1431
1432 int show_sources(
void *optctx,
const char *opt,
const char *
arg)
1433 {
1439
1441
1442 if ((
ret = show_sinks_sources_parse_arg(
arg, &dev, &
opts)) < 0)
1444
1445 do {
1447 if (fmt) {
1448 if (!strcmp(fmt->
name,
"lavfi"))
1449 continue; //it's pointless to probe lavfi
1451 continue;
1452 print_device_sources(fmt,
opts);
1453 }
1454 } while (fmt);
1455 do {
1457 if (fmt) {
1459 continue;
1460 print_device_sources(fmt,
opts);
1461 }
1462 } while (fmt);
1468 }
1469
1470 int show_sinks(
void *optctx,
const char *opt,
const char *
arg)
1471 {
1477
1479
1480 if ((
ret = show_sinks_sources_parse_arg(
arg, &dev, &
opts)) < 0)
1482
1483 do {
1485 if (fmt) {
1487 continue;
1488 print_device_sinks(fmt,
opts);
1489 }
1490 } while (fmt);
1491 do {
1493 if (fmt) {
1495 continue;
1496 print_device_sinks(fmt,
opts);
1497 }
1498 } while (fmt);
1504 }
1505 #endif /* CONFIG_AVDEVICE */
int show_demuxers(void *optctx, const char *opt, const char *arg)
Print a listing containing all the demuxer supported by the program (including devices).
static FILE * fopen_utf8(const char *path, const char *mode)
void av_force_cpu_flags(int arg)
Disables cpu detection and forces the specified flags.
void show_help_default(const char *opt, const char *arg)
Per-fftool specific help handler.
#define AV_LOG_WARNING
Something somehow does not look correct.
AVPixelFormat
Pixel format.
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default minimum maximum flags name is the option name
unsigned avfilter_filter_pad_count(const AVFilter *filter, int is_output)
Get the number of elements in an AVFilter's inputs or outputs array.
static int av_bprint_is_complete(const AVBPrint *buf)
Test if the print buffer is complete (not truncated).
Filter the word "frame" indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
const AVClass * avio_protocol_get_class(const char *name)
Get AVClass by names of available protocols.
__device__ int printf(const char *,...)
#define AV_IS_INPUT_DEVICE(category)
const char * avfilter_pad_get_name(const AVFilterPad *pads, int pad_idx)
Get the name of an AVFilterPad.
const char * long_name
Descriptive name for the codec, meant to be more human readable than name.
int show_filters(void *optctx, const char *opt, const char *arg)
Print a listing containing all the filters supported by the program.
#define sws_isSupportedOutput(x)
#define AV_CODEC_PROP_LOSSY
Codec supports lossy compression.
char * av_get_sample_fmt_string(char *buf, int buf_size, enum AVSampleFormat sample_fmt)
Generate a string corresponding to the sample format with sample_fmt, or a header if sample_fmt is ne...
void av_bprint_init(AVBPrint *buf, unsigned size_init, unsigned size_max)
void av_cpu_force_count(int count)
Overrides cpu count detection and forces the specified count.
#define AV_LOG_QUIET
Print no output.
#define AV_CODEC_CAP_HARDWARE
Codec is backed by a hardware implementation.
@ AV_CODEC_CONFIG_SAMPLE_RATE
int, terminated by 0
#define AV_LOG_PANIC
Something went really wrong and we will crash now.
char * device_name
device name, format depends on device
static void print_program_info(int flags, int level)
const char * name
Name of the codec described by this descriptor.
const char program_name[]
program name, defined by the program for show_version().
static int is_device(const AVClass *avclass)
int nb_devices
number of autodetected devices
const AVCodec * avcodec_find_encoder(enum AVCodecID id)
Find a registered encoder with a matching codec ID.
int show_devices(void *optctx, const char *opt, const char *arg)
Print a listing containing all the devices supported by the program.
static void log_callback_report(void *ptr, int level, const char *fmt, va_list vl)
static int show_formats_devices(void *optctx, const char *opt, const char *arg, int device_only, int muxdemuxers)
int capabilities
Codec capabilities.
int init_report(const char *env, FILE **file)
int opt_report(void *optctx, const char *opt, const char *arg)
int depth
Number of bits in the component.
const AVPixFmtDescriptor * av_pix_fmt_desc_next(const AVPixFmtDescriptor *prev)
Iterate over all pixel format descriptors known to libavutil.
int show_pix_fmts(void *optctx, const char *opt, const char *arg)
Print a listing containing all the pixel formats supported by the program.
const char * avio_enum_protocols(void **opaque, int output)
Iterate through names of available protocols.
static void print_codecs_for_id(enum AVCodecID id, int encoder)
#define AV_LOG_VERBOSE
Detailed information.
void(* filter)(uint8_t *src, int stride, int qscale)
#define PRINT_CODEC_SUPPORTED(codec, config, type, name, elem, fmt,...)
void show_help_children(const AVClass *class, int flags)
Show help for all options with given flags in class and all its children.
int av_get_bits_per_pixel(const AVPixFmtDescriptor *pixdesc)
Return the number of bits per pixel used by the pixel format described by pixdesc.
static char get_media_type_char(enum AVMediaType type)
int show_buildconf(void *optctx, const char *opt, const char *arg)
Print the build configuration of the program to stdout.
int show_dispositions(void *optctx, const char *opt, const char *arg)
Print a listing containing all supported stream dispositions.
int av_get_cpu_flags(void)
Return the flags which specify extensions supported by the CPU.
@ AV_CODEC_CONFIG_PIX_FORMAT
AVPixelFormat, terminated by AV_PIX_FMT_NONE.
int show_license(void *optctx, const char *opt, const char *arg)
Print the license of the program to stdout.
int av_channel_layout_describe_bprint(const AVChannelLayout *channel_layout, AVBPrint *bp)
bprint variant of av_channel_layout_describe().
const av_cold AVInputFormat * av_input_audio_device_next(const AVInputFormat *d)
Audio input devices iterator.
#define AV_LOG_PRINT_TIME
Include system time in log output.
int avdevice_list_output_sinks(const AVOutputFormat *device, const char *device_name, AVDictionary *device_options, AVDeviceInfoList **device_list)
void av_max_alloc(size_t max)
Set the maximum size that may be allocated in one block.
int show_encoders(void *optctx, const char *opt, const char *arg)
Print a listing containing all the encoders supported by the program.
int av_opt_get_key_value(const char **ropts, const char *key_val_sep, const char *pairs_sep, unsigned flags, char **rkey, char **rval)
Extract a key-value pair from the beginning of a string.
#define AV_PIX_FMT_FLAG_HWACCEL
Pixel format is an HW accelerated format.
const AVFilter * av_filter_iterate(void **opaque)
Iterate over all registered filters.
int av_parse_cpu_caps(unsigned *flags, const char *s)
Parse CPU caps from a string and update the given AV_CPU_* flags based on that.
#define AV_BPRINT_SIZE_AUTOMATIC
static double val(void *priv, double ch)
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf type
static int report_file_level
#define AVFILTER_FLAG_DYNAMIC_INPUTS
The number of the filter inputs is not determined just by AVFilter.inputs.
int show_version(void *optctx, const char *opt, const char *arg)
Print the version of the program to stdout.
int show_codecs(void *optctx, const char *opt, const char *arg)
Print a listing containing all the codecs supported by the program.
static void show_help_muxer(const char *name)
A filter pad used for either input or output.
#define FFDIFFSIGN(x, y)
Comparator.
#define AV_OPT_FLAG_AUDIO_PARAM
AVDeviceInfo ** devices
list of autodetected devices
static const AVCodec * next_codec_for_id(enum AVCodecID id, void **iter, int encoder)
#define AV_LOG_TRACE
Extremely verbose debugging, useful for libav* development.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define AV_CODEC_CAP_EXPERIMENTAL
Codec is experimental and is thus avoided in favor of non experimental encoders.
#define FF_ARRAY_ELEMS(a)
int avdevice_list_input_sources(const AVInputFormat *device, const char *device_name, AVDictionary *device_options, AVDeviceInfoList **device_list)
List devices.
int av_channel_layout_describe(const AVChannelLayout *channel_layout, char *buf, size_t buf_size)
Get a human-readable string describing the channel layout properties.
void av_log_format_line(void *ptr, int level, const char *fmt, va_list vl, char *line, int line_size, int *print_prefix)
Format a line of log the same way as the default callback.
static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame, FILE *outfile)
static FILE * report_file
static int compare_codec_desc(const void *a, const void *b)
This struct describes the properties of a single codec described by an AVCodecID.
@ AV_CODEC_CONFIG_SAMPLE_FORMAT
AVSampleFormat, terminated by AV_SAMPLE_FMT_NONE.
#define PRINT_LIB_INFO(libname, LIBNAME, flags, level)
static enum AVPixelFormat pix_fmt
#define AV_CODEC_CAP_OTHER_THREADS
Codec supports multithreading through a method other than slice- or frame-level multithreading.
#define av_assert0(cond)
assert() equivalent, that is always enabled.
const AVChannelLayout * av_channel_layout_standard(void **opaque)
Iterate over all standard channel layouts.
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
int show_bsfs(void *optctx, const char *opt, const char *arg)
Print a listing containing all the bit stream filters supported by the program.
void show_banner(int argc, char **argv, const OptionDef *options)
Print the program banner to stderr.
const char * av_hwdevice_get_type_name(enum AVHWDeviceType type)
Get the string name of an AVHWDeviceType.
enum AVCodecID * codec_ids
A list of codec ids supported by the filter, terminated by AV_CODEC_ID_NONE.
const char * av_get_sample_fmt_name(enum AVSampleFormat sample_fmt)
Return the name of sample_fmt, or NULL if sample_fmt is not recognized.
@ AVMEDIA_TYPE_DATA
Opaque data information usually continuous.
enum AVMediaType * media_types
array indicating what media types(s), if any, a device can provide.
#define AV_OPT_FLAG_BSF_PARAM
A generic parameter which can be set by the user for bit stream filtering.
#define AV_LOG_PRINT_DATETIME
Include system date and time in log output.
int nb_media_types
length of media_types array, 0 if device cannot provide any media types
#define AV_IS_OUTPUT_DEVICE(category)
#define AV_CODEC_CAP_FRAME_THREADS
Codec supports frame-level multithreading.
int av_log_get_level(void)
Get the current log level.
static void print_codec(const AVCodec *c)
#define AV_CODEC_PROP_INTRA_ONLY
Codec uses only intra compression.
const AVFilter * avfilter_get_by_name(const char *name)
Get a filter definition matching the given name.
#define LIBAVUTIL_VERSION_INT
Describe the class of an AVClass context structure.
const AVCodec * avcodec_find_decoder_by_name(const char *name)
Find a registered decoder with the specified name.
static void print_all_libs_info(int flags, int level)
uint8_t nb_components
The number of components each pixel has, (1-4)
@ AV_CODEC_CONFIG_FRAME_RATE
AVRational, terminated by {0, 0}.
Rational number (pair of numerator and denominator).
const char * av_default_item_name(void *ptr)
Return the context name.
void av_log_set_flags(int arg)
int opt_loglevel(void *optctx, const char *opt, const char *arg)
Set the libav* libraries log level.
const AVClass * priv_class
A class for the private data, used to declare bitstream filter private AVOptions.
static const struct codec_string codecs[]
#define AV_CODEC_CAP_VARIABLE_FRAME_SIZE
Audio encoder supports receiving a different number of samples in each call.
uint64_t flags
Combination of AV_PIX_FMT_FLAG_...
#define AV_OPT_FLAG_ENCODING_PARAM
A generic parameter which can be set by the user for muxing or encoding.
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
int show_sample_fmts(void *optctx, const char *opt, const char *arg)
Print a listing containing all the sample formats supported by the program.
AVCodecID
Identify the syntax and semantics of the bitstream.
const AVCodec * avcodec_find_decoder(enum AVCodecID id)
Find a registered decoder with a matching codec ID.
#define AVFILTER_FLAG_DYNAMIC_OUTPUTS
The number of the filter outputs is not determined just by AVFilter.outputs.
#define AV_CODEC_CAP_CHANNEL_CONF
Codec should fill in channel configuration and samplerate instead of container.
int show_layouts(void *optctx, const char *opt, const char *arg)
Print a listing containing all the standard channel layouts supported by the program.
int locate_option(int argc, char **argv, const OptionDef *options, const char *optname)
Return index of option opt in argv or 0 if not found.
int av_codec_is_decoder(const AVCodec *codec)
static const char * get_channel_layout_desc(const AVChannelLayout *layout, AVBPrint *bp)
@ AV_CODEC_CONFIG_CHANNEL_LAYOUT
AVChannelLayout, terminated by {0}.
#define AV_OPT_FLAG_FILTERING_PARAM
A generic parameter which can be set by the user for filtering.
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
@ AV_SAMPLE_FMT_NB
Number of sample formats. DO NOT USE if linking dynamically.
void av_log_set_callback(void(*callback)(void *, int, const char *, va_list))
Set the logging callback.
int av_bprint_finalize(AVBPrint *buf, char **ret_str)
Finalize a print buffer.
An AVChannelLayout holds information about the channel layout of audio data.
AVClassCategory category
Category used for visualization (like color).
#define av_err2str(errnum)
Convenience macro, the return value should be used only directly in function arguments but never stan...
const av_cold AVOutputFormat * av_output_video_device_next(const AVOutputFormat *d)
Video output devices iterator.
#define AV_PIX_FMT_FLAG_BITSTREAM
All values of a component are bit-wise packed end to end.
Structure describes basic parameters of the device.
const AVInputFormat * av_demuxer_iterate(void **opaque)
Iterate over all registered demuxers.
int av_log_get_flags(void)
void avdevice_free_list_devices(AVDeviceInfoList **device_list)
Convenient function to free result of avdevice_list_devices().
int show_protocols(void *optctx, const char *opt, const char *arg)
Print a listing containing all the protocols supported by the program.
int av_channel_description(char *buf, size_t buf_size, enum AVChannel channel_id)
Get a human readable string describing a given channel.
static void encode(AVCodecContext *ctx, AVFrame *frame, AVPacket *pkt, FILE *output)
The reader does not expect b to be semantically here and if the code is changed by maybe adding a a division or other the signedness will almost certainly be mistaken To avoid this confusion a new type was SUINT is the C unsigned type but it holds a signed int to use the same example SUINT a
int show_decoders(void *optctx, const char *opt, const char *arg)
Print a listing containing all the decoders supported by the program.
#define AV_CODEC_CAP_SLICE_THREADS
Codec supports slice-based (or partition-based) multithreading.
enum AVPixelFormat av_pix_fmt_desc_get_id(const AVPixFmtDescriptor *desc)
void av_dict_free(AVDictionary **pm)
Free all the memory allocated for an AVDictionary struct and all keys and values.
int av_strstart(const char *str, const char *pfx, const char **ptr)
Return non-zero if pfx is a prefix of str.
#define va_copy(dst, src)
char * device_description
human friendly name
static void show_help_bsf(const char *name)
#define sws_isSupportedInput(x)
#define AV_LOG_INFO
Standard information.
const AVCodecDescriptor * avcodec_descriptor_next(const AVCodecDescriptor *prev)
Iterate over all codec descriptors known to libavcodec.
int av_codec_is_encoder(const AVCodec *codec)
Filter the word "frame" indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel layout
#define AV_CODEC_PROP_LOSSLESS
Codec supports lossless compression.
void av_log_set_level(int level)
Set the log level.
static int get_codecs_sorted(const AVCodecDescriptor ***rcodecs)
int show_colors(void *optctx, const char *opt, const char *arg)
Print a listing containing all the color names and values recognized by the program.
#define i(width, name, range_min, range_max)
int av_channel_name(char *buf, size_t buf_size, enum AVChannel channel_id)
Get a human readable string in an abbreviated form describing a given channel.
AVSampleFormat
Audio sample formats.
static int print_codecs(int encoder)
@ AVMEDIA_TYPE_ATTACHMENT
Opaque data information usually sparse.
#define AV_OPT_FLAG_VIDEO_PARAM
static void show_help_demuxer(const char *name)
const char * name
Name of the codec implementation.
int opt_max_alloc(void *optctx, const char *opt, const char *arg)
void * av_calloc(size_t nmemb, size_t size)
const AVCodec * av_codec_iterate(void **opaque)
Iterate over all registered codecs.
static void show_help_protocol(const char *name)
#define AV_LOG_FATAL
Something went wrong and recovery is not possible.
const AVBitStreamFilter * av_bsf_iterate(void **opaque)
Iterate over all registered bitstream filters.
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
int av_opt_eval_int(void *obj, const AVOption *o, const char *val, int *int_out)
void log_callback_help(void *ptr, int level, const char *fmt, va_list vl)
Trivial log callback.
int show_muxers(void *optctx, const char *opt, const char *arg)
Print a listing containing all the muxers supported by the program (including devices).
void av_bprintf(AVBPrint *buf, const char *fmt,...)
int opt_cpucount(void *optctx, const char *opt, const char *arg)
Override the cpucount.
#define AV_LOG_SKIP_REPEATED
Skip repeated messages, this requires the user app to use av_log() instead of (f)printf as the 2 woul...
enum AVMediaType avfilter_pad_get_type(const AVFilterPad *pads, int pad_idx)
Get the type of an AVFilterPad.
const char * av_get_media_type_string(enum AVMediaType media_type)
Return a string describing the media_type enum, NULL if media_type is unknown.
const AVOutputFormat * av_muxer_iterate(void **opaque)
Iterate over all registered muxers.
int default_device
index of default device or -1 if no default
int show_formats(void *optctx, const char *opt, const char *arg)
Print a listing containing all the formats supported by the program (including devices).
int av_channel_layout_index_from_channel(const AVChannelLayout *channel_layout, enum AVChannel channel)
Get the index of a given channel in a channel layout.
@ AV_OPT_TYPE_INT
Underlying C type is int.
void av_bprint_clear(AVBPrint *buf)
Reset the string to "" but keep internal allocated data.
int av_match_name(const char *name, const char *names)
Match instances of a name in a comma-separated list of names.
int av_dict_parse_string(AVDictionary **pm, const char *str, const char *key_val_sep, const char *pairs_sep, int flags)
Parse the key/value pairs list and add the parsed entries to a dictionary.
static void print_buildconf(int flags, int level)
int opt_cpuflags(void *optctx, const char *opt, const char *arg)
Override the cpuflags.
AVComponentDescriptor comp[4]
Parameters that describe how pixels are packed.
#define AV_CODEC_CAP_DELAY
Encoder or decoder requires flushing with NULL input at the end in order to give the complete and cor...
const AVInputFormat * av_find_input_format(const char *short_name)
Find AVInputFormat based on the short name of the input format.
const AVCodecHWConfig * avcodec_get_hw_config(const AVCodec *codec, int index)
Retrieve supported hardware configurations for a codec.
#define AV_CODEC_CAP_PARAM_CHANGE
Codec supports changed parameters at any point.
static void expand_filename_template(AVBPrint *bp, const char *template, struct tm *tm)
#define AVFILTER_FLAG_SLICE_THREADS
The filter supports multithreading by splitting frames into multiple parts and processing them concur...
char * av_strdup(const char *s)
Duplicate a string.
#define AV_OPT_FLAG_DECODING_PARAM
A generic parameter which can be set by the user for demuxing or decoding.
void av_log_default_callback(void *ptr, int level, const char *fmt, va_list vl)
Default logging callback.
const AVOutputFormat * av_guess_format(const char *short_name, const char *filename, const char *mime_type)
Return the output format in the list of registered output formats which best matches the provided par...
const av_cold AVOutputFormat * av_output_audio_device_next(const AVOutputFormat *d)
Audio output devices iterator.
#define AV_CODEC_CAP_HYBRID
Codec is potentially backed by a hardware implementation, but not necessarily.
const char * av_get_known_color_name(int color_idx, const uint8_t **rgbp)
Get the name of a color from the internal table of hard-coded named colors.
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
#define AVFILTER_FLAG_SUPPORT_TIMELINE
Handy mask to test whether the filter supports or no the timeline feature (internally or generically)...
static void show_help_codec(const char *name, int encoder)
int show_help(void *optctx, const char *opt, const char *arg)
Generic -h handler common to all fftools.
static const SheerTable rgb[2]
#define AV_CODEC_CAP_DRAW_HORIZ_BAND
Decoder can use draw_horiz_band callback.
#define AV_CODEC_CAP_AVOID_PROBING
Decoder is not a preferred choice for probing.
void av_bprint_chars(AVBPrint *buf, char c, unsigned n)
Append char c n times to a print buffer.
const AVCodecDescriptor * avcodec_descriptor_get(enum AVCodecID id)
const av_cold AVInputFormat * av_input_video_device_next(const AVInputFormat *d)
Video input devices iterator.
const AVCodecDescriptor * avcodec_descriptor_get_by_name(const char *name)
#define AV_CODEC_CAP_SMALL_LAST_FRAME
Codec can be fed a final frame with a smaller size.
#define AV_PIX_FMT_FLAG_PAL
Pixel format has a palette in data[1], values are indexes in this palette.
#define AV_LOG_PRINT_LEVEL
Include the log severity in messages originating from codecs.
static void * av_x_if_null(const void *p, const void *x)
Return x default pointer in case p is NULL.
const char * av_get_pix_fmt_name(enum AVPixelFormat pix_fmt)
Return the short name for a pixel format, NULL in case pix_fmt is unknown.
const AVCodec * avcodec_find_encoder_by_name(const char *name)
Find a registered encoder with the specified name.
const int program_birth_year
program birth year, defined by the program for show_banner()
const AVBitStreamFilter * av_bsf_get_by_name(const char *name)
Generated on Wed Oct 15 2025 19:21:36 for FFmpeg by
doxygen
1.8.17