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
27
35 #include "libavutil/ffversion.h"
41
47
50
53
56
59
62
65
70 };
71
74
76 {
77 #if CONFIG_NONFREE
79 "This version of %s has nonfree parts compiled in.\n"
80 "Therefore it is not legally redistributable.\n",
82 #elif CONFIG_GPLV3
84 "%s is free software; you can redistribute it and/or modify\n"
85 "it under the terms of the GNU General Public License as published by\n"
86 "the Free Software Foundation; either version 3 of the License, or\n"
87 "(at your option) any later version.\n"
88 "\n"
89 "%s is distributed in the hope that it will be useful,\n"
90 "but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
91 "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
92 "GNU General Public License for more details.\n"
93 "\n"
94 "You should have received a copy of the GNU General Public License\n"
95 "along with %s. If not, see <http://www.gnu.org/licenses/>.\n",
97 #elif CONFIG_GPL
99 "%s is free software; you can redistribute it and/or modify\n"
100 "it under the terms of the GNU General Public License as published by\n"
101 "the Free Software Foundation; either version 2 of the License, or\n"
102 "(at your option) any later version.\n"
103 "\n"
104 "%s is distributed in the hope that it will be useful,\n"
105 "but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
106 "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
107 "GNU General Public License for more details.\n"
108 "\n"
109 "You should have received a copy of the GNU General Public License\n"
110 "along with %s; if not, write to the Free Software\n"
111 "Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA\n",
113 #elif CONFIG_LGPLV3
115 "%s is free software; you can redistribute it and/or modify\n"
116 "it under the terms of the GNU Lesser General Public License as published by\n"
117 "the Free Software Foundation; either version 3 of the License, or\n"
118 "(at your option) any later version.\n"
119 "\n"
120 "%s is distributed in the hope that it will be useful,\n"
121 "but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
122 "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
123 "GNU Lesser General Public License for more details.\n"
124 "\n"
125 "You should have received a copy of the GNU Lesser General Public License\n"
126 "along with %s. If not, see <http://www.gnu.org/licenses/>.\n",
128 #else
130 "%s is free software; you can redistribute it and/or\n"
131 "modify it under the terms of the GNU Lesser General Public\n"
132 "License as published by the Free Software Foundation; either\n"
133 "version 2.1 of the License, or (at your option) any later version.\n"
134 "\n"
135 "%s is distributed in the hope that it will be useful,\n"
136 "but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
137 "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n"
138 "Lesser General Public License for more details.\n"
139 "\n"
140 "You should have received a copy of the GNU Lesser General Public\n"
141 "License along with %s; if not, write to the Free Software\n"
142 "Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA\n",
144 #endif
145
146 return 0;
147 }
148
150
152 #define SHOW_VERSION 2
153 #define SHOW_CONFIG 4
154 #define SHOW_COPYRIGHT 8
155
156 #define PRINT_LIB_INFO(libname, LIBNAME, flags, level) \
157 if (CONFIG_##LIBNAME) { \
158 const char *indent = flags & INDENT? " " : ""; \
159 if (flags & SHOW_VERSION) { \
160 unsigned int version = libname##_version(); \
161 av_log(NULL, level, \
162 "%slib%-11s %2d.%3d.%3d / %2d.%3d.%3d\n", \
163 indent, #libname, \
164 LIB##LIBNAME##_VERSION_MAJOR, \
165 LIB##LIBNAME##_VERSION_MINOR, \
166 LIB##LIBNAME##_VERSION_MICRO, \
167 AV_VERSION_MAJOR(version), AV_VERSION_MINOR(version),\
168 AV_VERSION_MICRO(version)); \
169 } \
170 if (flags & SHOW_CONFIG) { \
171 const char *cfg = libname##_configuration(); \
172 if (strcmp(FFMPEG_CONFIGURATION, cfg)) { \
173 if (!warned_cfg) { \
174 av_log(NULL, level, \
175 "%sWARNING: library configuration mismatch\n", \
176 indent); \
177 warned_cfg = 1; \
178 } \
179 av_log(NULL, level, "%s%-11s configuration: %s\n", \
180 indent, #libname, cfg); \
181 } \
182 } \
183 } \
184
186 {
195 }
196
198 {
200
207
208 av_log(
NULL,
level,
"%sconfiguration: " FFMPEG_CONFIGURATION
"\n", indent);
209 }
210
212 {
214 char str[] = { FFMPEG_CONFIGURATION };
215 char *conflist, *remove_tilde, *splitconf;
216
217 // Change all the ' --' strings to '~--' so that
218 // they can be identified as tokens.
219 while ((conflist = strstr(
str,
" --")) !=
NULL) {
220 conflist[0] = '~';
221 }
222
223 // Compensate for the weirdness this would cause
224 // when passing 'pkg-config --static'.
225 while ((remove_tilde = strstr(
str,
"pkg-config~")) !=
NULL) {
226 remove_tilde[sizeof("pkg-config~") - 2] = ' ';
227 }
228
229 splitconf = strtok(
str,
"~");
231 while (splitconf !=
NULL) {
233 splitconf = strtok(
NULL,
"~");
234 }
235 }
236
238 {
241 return;
242
246 }
247
249 {
253
254 return 0;
255 }
256
258 {
261
262 return 0;
263 }
264
265 #define PRINT_CODEC_SUPPORTED(codec, field, type, list_name, term, get_name) \
266 if (codec->field) { \
267 const type *p = codec->field; \
268 \
269 printf(" Supported " list_name ":"); \
270 while (*p != term) { \
271 get_name(*p); \
272 printf(" %s", name); \
273 p++; \
274 } \
275 printf("\n"); \
276 } \
277
279 {
281
282 printf(
"%s %s [%s]:\n", encoder ?
"Encoder" :
"Decoder",
c->name,
283 c->long_name ?
c->long_name :
"");
284
285 printf(
" General capabilities: ");
314 if (!
c->capabilities)
317
320 printf(
" Threading capabilities: ");
329 default:
printf(
"none");
break;
330 }
332 }
333
335 printf(
" Supported hardware devices: ");
336 for (
int i = 0;;
i++) {
339 break;
341 }
343 }
344
345 if (
c->supported_framerates) {
347
348 printf(
" Supported framerates:");
351 fps++;
352 }
354 }
361
364
365 printf(
" Supported channel layouts:");
370 p++;
371 }
373 }
374
379 }
380 }
381
383 int encoder)
384 {
390 }
392 }
393
395 {
398
401 return;
402 }
403
406
407 if (codec)
411 int printed = 0;
412
414 printed = 1;
416 }
417
418 if (!printed) {
420 "but no %s for it are available. FFmpeg might need to be "
421 "recompiled with additional external libraries.\n",
422 name, encoder ?
"encoders" :
"decoders");
423 }
424 } else {
427 }
428 }
429
431 {
433
434 if (!fmt) {
436 return;
437 }
438
440
443
446 }
447
449 {
451
454 return;
455 }
456
458 if (!proto_class) {
460 return;
461 }
462
464 }
465
467 {
470
471 if (!fmt) {
473 return;
474 }
475
477
484 printf(
" Default video codec: %s.\n",
desc->name);
485 }
488 printf(
" Default audio codec: %s.\n",
desc->name);
489 }
492 printf(
" Default subtitle codec: %s.\n",
desc->name);
493 }
494
497 }
498
499 #if CONFIG_AVFILTER
500 static void show_help_filter(
const char *
name)
501 {
502 #if CONFIG_AVFILTER
505
508 return;
511 return;
512 }
513
514 printf(
"Filter %s\n",
f->name);
516 printf(
" %s\n",
f->description);
517
519 printf(
" slice threading supported\n");
520
523 for (
i = 0;
i < count;
i++) {
526 }
528 printf(
" dynamic (depending on the options)\n");
529 else if (!count)
530 printf(
" none (source filter)\n");
531
534 for (
i = 0;
i < count;
i++) {
537 }
539 printf(
" dynamic (depending on the options)\n");
540 else if (!count)
541 printf(
" none (sink filter)\n");
542
547 printf(
"This filter has support for timeline through the 'enable' option.\n");
548 #else
550 "can not to satisfy request\n");
551 #endif
552 }
553 #endif
554
556 {
558
561 return;
562 } else if (!bsf) {
564 return;
565 }
566
572 }
573
575 {
576 char *topic, *par;
578
580 if (!topic)
582 par = strchr(topic, '=');
583 if (par)
584 *par++ = 0;
585
586 if (!*topic) {
588 } else if (!strcmp(topic, "decoder")) {
590 } else if (!strcmp(topic, "encoder")) {
592 } else if (!strcmp(topic, "demuxer")) {
594 } else if (!strcmp(topic, "muxer")) {
596 } else if (!strcmp(topic, "protocol")) {
598 #if CONFIG_AVFILTER
599 } else if (!strcmp(topic, "filter")) {
600 show_help_filter(par);
601 #endif
602 } else if (!strcmp(topic, "bsf")) {
604 } else {
606 }
607
609 return 0;
610 }
611
613 {
616
617 printf(
" (%s: ", encoder ?
"encoders" :
"decoders");
618
621
623 }
624
626 {
629
630 return (*da)->type != (*db)->type ?
FFDIFFSIGN((*da)->type, (*db)->type) :
631 strcmp((*da)->name, (*db)->name);
632 }
633
635 {
638 unsigned nb_codecs = 0,
i = 0;
639
641 nb_codecs++;
645 }
652 return nb_codecs;
653 }
654
656 {
663 default: return '?';
664 }
665 }
666
668 {
671
673 " D..... = Decoding supported\n"
674 " .E.... = Encoding supported\n"
675 " ..V... = Video codec\n"
676 " ..A... = Audio codec\n"
677 " ..S... = Subtitle codec\n"
678 " ..D... = Data codec\n"
679 " ..T... = Attachment codec\n"
680 " ...I.. = Intra frame-only codec\n"
681 " ....L. = Lossy compression\n"
682 " .....S = Lossless compression\n"
683 " -------\n");
684 for (
i = 0;
i < nb_codecs;
i++) {
688
689 if (strstr(
desc->name,
"_deprecated"))
690 continue;
691
695
700
702
703 /* print decoders/encoders when there's more than one or their
704 * names are different from codec name */
706 if (strcmp(codec->
name,
desc->name)) {
708 break;
709 }
710 }
713 if (strcmp(codec->
name,
desc->name)) {
715 break;
716 }
717 }
718
720 }
722 return 0;
723 }
724
726 {
729
731 " V..... = Video\n"
732 " A..... = Audio\n"
733 " S..... = Subtitle\n"
734 " .F.... = Frame-level multithreading\n"
735 " ..S... = Slice-level multithreading\n"
736 " ...X.. = Codec is experimental\n"
737 " ....B. = Supports draw_horiz_band\n"
738 " .....D = Supports direct rendering method 1\n"
739 " ------\n",
740 encoder ? "Encoders" : "Decoders");
741 for (
i = 0;
i < nb_codecs;
i++) {
745
753
755 if (strcmp(codec->
name,
desc->name))
757
759 }
760 }
762 }
763
765 {
767 return 0;
768 }
769
771 {
773 return 0;
774 }
775
777 {
780
781 printf(
"Bitstream filters:\n");
785 return 0;
786 }
787
789 {
790 #if CONFIG_AVFILTER
792 char descr[64], *descr_cur;
796
798 " T.. = Timeline support\n"
799 " .S. = Slice threading\n"
800 " ..C = Command support\n"
801 " A = Audio input/output\n"
802 " V = Video input/output\n"
803 " N = Dynamic number and/or type of input/output\n"
804 " | = Source or sink filter\n");
806 descr_cur = descr;
807 for (
i = 0;
i < 2;
i++) {
808 unsigned nb_pads;
810 *(descr_cur++) = '-';
811 *(descr_cur++) = '>';
812 }
815 for (j = 0; j < nb_pads; j++) {
816 if (descr_cur >= descr + sizeof(descr) - 4)
817 break;
819 }
820 if (!j)
823 }
824 *descr_cur = 0;
825 printf(
" %c%c%c %-17s %-10s %s\n",
828 filter->process_command ?
'C' :
'.',
830 }
831 #else
832 printf(
"No filters available: libavfilter disabled\n");
833 #endif
834 return 0;
835 }
836
838 {
839 if (!avclass)
840 return 0;
842 }
843
845 {
846 void *ifmt_opaque =
NULL;
848 void *ofmt_opaque =
NULL;
850 const char *last_name;
851 int is_dev;
852
854 " D. = Demuxing supported\n"
855 " .E = Muxing supported\n"
856 " --\n", device_only ? "Devices:" : "File formats:");
857 last_name = "000";
858 for (;;) {
862 const char *long_name =
NULL;
863
868 if (!is_dev && device_only)
869 continue;
871 strcmp(ofmt->
name, last_name) > 0) {
875 }
876 }
877 }
882 if (!is_dev && device_only)
883 continue;
885 strcmp(ifmt->
name, last_name) > 0) {
889 }
892 }
893 }
895 break;
897
898 printf(
" %c%c %-15s %s\n",
902 long_name ? long_name:" ");
903 }
904 return 0;
905 }
906
908 {
910 }
911
913 {
915 }
916
918 {
920 }
921
923 {
925 }
926
928 {
931
932 printf(
"Supported file protocols:\n"
933 "Input:\n");
939 return 0;
940 }
941
943 {
947
948 printf(
"%-32s #RRGGBB\n",
"name");
949
952
953 return 0;
954 }
955
957 {
959
961 "I.... = Supported Input format for conversion\n"
962 ".O... = Supported Output format for conversion\n"
963 "..H.. = Hardware accelerated format\n"
964 "...P. = Paletted format\n"
965 "....B = Bitstream format\n"
966 "FLAGS NAME NB_COMPONENTS BITS_PER_PIXEL BIT_DEPTHS\n"
967 "-----\n");
968
969 #if !CONFIG_SWSCALE
970 # define sws_isSupportedInput(x) 0
971 # define sws_isSupportedOutput(x) 0
972 #endif
973
976 printf(
"%c%c%c%c%c %-16s %d %3d %d",
986
990 }
991 return 0;
992 }
993
995 {
998 char buf[128], buf2[128];
1000
1001 printf(
"Individual channels:\n"
1002 "NAME DESCRIPTION\n");
1003 for (
i = 0;
i < 63;
i++) {
1005 if (strstr(buf, "USR"))
1006 continue;
1008 printf(
"%-14s %s\n", buf, buf2);
1009 }
1010 printf(
"\nStandard channel layouts:\n"
1011 "NAME DECOMPOSITION\n");
1015 for (
i = 0;
i < 63;
i++) {
1017 if (idx >= 0) {
1019 printf(
"%s%s", idx ?
"+" :
"", buf2);
1020 }
1021 }
1023 }
1024 return 0;
1025 }
1026
1028 {
1030 char fmt_str[128];
1033 return 0;
1034 }
1035
1037 {
1038 for (
int i = 0;
i < 32;
i++) {
1042 }
1043 return 0;
1044 }
1045
1047 {
1050
1053
1055 return 0;
1056 }
1057
1059 {
1061 int count;
1062
1066 };
1067 static const AVClass class = {
1072 };
1073 const AVClass *pclass = &
class;
1074
1076
1079 }
1080
1082 }
1083
1085 struct tm *tm)
1086 {
1088
1089 while ((
c = *(
template++))) {
1091 if (!(
c = *(
template++)))
1092 break;
1094 case 'p':
1096 break;
1097 case 't':
1099 tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday,
1100 tm->tm_hour, tm->tm_min, tm->tm_sec);
1101 break;
1102 case '%':
1104 break;
1105 }
1106 } else {
1108 }
1109 }
1110 }
1111
1113 {
1114 va_list vl2;
1116 static int print_prefix = 1;
1117
1121 va_end(vl2);
1125 }
1126 }
1127
1129 {
1130 char *filename_template =
NULL;
1133 int prog_loglevel, envlevel = 0;
1134 time_t now;
1135 struct tm *tm;
1136 AVBPrint filename;
1137
1139 return 0;
1140 time(&now);
1141 tm = localtime(&now);
1142
1143 while (env && *env) {
1145 if (count)
1147 "Failed to parse FFREPORT environment variable: %s\n",
1149 break;
1150 }
1151 if (*env)
1152 env++;
1153 count++;
1154 if (!strcmp(
key,
"file")) {
1156 filename_template =
val;
1158 }
else if (!strcmp(
key,
"level")) {
1159 char *tail;
1161 if (*tail) {
1164 }
1165 envlevel = 1;
1166 } else {
1168 }
1171 }
1172
1180 }
1181
1183 if (!envlevel)
1185
1190 filename.str, strerror(errno));
1192 }
1195 "%s started on %04d-%02d-%02d at %02d:%02d:%02d\n"
1196 "Report written to \"%s\"\n"
1197 "Log level: %d\n",
1199 tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday,
1200 tm->tm_hour, tm->tm_min, tm->tm_sec,
1203
1204 if (file)
1206
1207 return 0;
1208 }
1209
1211 {
1213 }
1214
1216 {
1217 char *tail;
1219
1220 max = strtol(
arg, &tail, 10);
1221 if (*tail) {
1224 }
1226 return 0;
1227 }
1228
1230 {
1231 const struct {
const char *
name;
int level; } log_levels[] = {
1241 };
1242 const char *token;
1243 char *tail;
1247
1251 if (*token == '+' || *token == '-') {
1252 cmd = *token++;
1253 } else {
1254 cmd = 0;
1255 }
1257 flags = 0;
/* missing relative prefix, build absolute value */
1258 }
1260 if (cmd == '-') {
1262 } else {
1264 }
1266 if (cmd == '-') {
1268 } else {
1270 }
1271 } else {
1272 break;
1273 }
1275 }
1277 goto end;
1278 }
else if (*
arg ==
'+') {
1282 }
1283
1285 if (!strcmp(log_levels[
i].
name,
arg)) {
1286 level = log_levels[
i].level;
1287 goto end;
1288 }
1289 }
1290
1292 if (*tail) {
1294 "Possible levels are numbers or:\n",
arg);
1298 }
1299
1300 end:
1303 return 0;
1304 }
1305
1306 #if CONFIG_AVDEVICE
1308 {
1309 // print devices
1317 if (j > 0)
1319 printf(
"%s", media_type ? media_type :
"unknown");
1320 }
1321 } else {
1323 }
1325 }
1326 }
1327
1329 {
1332
1335
1336 printf(
"Auto-detected sources for %s:\n", fmt->
name);
1340 }
1341
1342 print_device_list(device_list);
1343
1347 }
1348
1350 {
1353
1356
1357 printf(
"Auto-detected sinks for %s:\n", fmt->
name);
1361 }
1362
1363 print_device_list(device_list);
1364
1368 }
1369
1371 {
1374 char *opts_str =
NULL;
1377 if (!*dev)
1379 if ((opts_str = strchr(*dev, ','))) {
1380 *(opts_str++) = '0円';
1384 }
1385 }
1386 } else
1387 printf(
"\nDevice name is not provided.\n"
1388 "You can pass devicename[,opt1=val1[,opt2=val2...]] as an argument.\n\n");
1389 return 0;
1390 }
1391
1392 int show_sources(
void *optctx,
const char *opt,
const char *
arg)
1393 {
1399
1401
1402 if ((
ret = show_sinks_sources_parse_arg(
arg, &dev, &
opts)) < 0)
1404
1405 do {
1407 if (fmt) {
1408 if (!strcmp(fmt->
name,
"lavfi"))
1409 continue; //it's pointless to probe lavfi
1411 continue;
1412 print_device_sources(fmt,
opts);
1413 }
1414 } while (fmt);
1415 do {
1417 if (fmt) {
1419 continue;
1420 print_device_sources(fmt,
opts);
1421 }
1422 } while (fmt);
1428 }
1429
1430 int show_sinks(
void *optctx,
const char *opt,
const char *
arg)
1431 {
1437
1439
1440 if ((
ret = show_sinks_sources_parse_arg(
arg, &dev, &
opts)) < 0)
1442
1443 do {
1445 if (fmt) {
1447 continue;
1448 print_device_sinks(fmt,
opts);
1449 }
1450 } while (fmt);
1451 do {
1453 if (fmt) {
1455 continue;
1456 print_device_sinks(fmt,
opts);
1457 }
1458 } while (fmt);
1464 }
1465 #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).
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.
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.
#define AV_OPT_FLAG_VIDEO_PARAM
#define GET_SAMPLE_RATE_NAME(rate)
#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.
int av_bprint_finalize(AVBPrint *buf, char **ret_str)
Finalize a print buffer.
#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.
static enum AVSampleFormat sample_fmts[]
#define AV_CODEC_CAP_HARDWARE
Codec is backed by a hardware implementation.
#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)
static struct codec_string codecs[]
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
#define GET_PIX_FMT_NAME(pix_fmt)
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 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.
filter_frame For filters that do not use the this method is called when a frame is pushed to the filter s input It can be called at any time except in a reentrant way If the input frame is enough to produce then the filter should push the output frames on the output link immediately As an exception to the previous rule if the input frame is enough to produce several output frames then the filter needs output only at least one per link The additional frames can be left buffered in the filter
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.
int nb_channels
Number of channels in this layout.
#define AV_OPT_FLAG_FILTERING_PARAM
a generic parameter which can be set by the user for filtering
int show_license(void *optctx, const char *opt, const char *arg)
Print the license of the program to stdout.
const AVInputFormat * av_input_audio_device_next(const AVInputFormat *d)
Audio input devices iterator.
int avdevice_list_output_sinks(const AVOutputFormat *device, const char *device_name, AVDictionary *device_options, AVDeviceInfoList **device_list)
void exit_program(int ret)
Wraps exit with a program-specific cleanup routine.
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.
#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.
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.
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.
#define AV_OPT_FLAG_ENCODING_PARAM
a generic parameter which can be set by the user for muxing or encoding
#define PRINT_LIB_INFO(libname, LIBNAME, flags, level)
#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.
static enum AVPixelFormat pix_fmts[]
#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.
static enum AVPixelFormat pix_fmt
static void print_codecs(int encoder)
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.
#define AV_OPT_FLAG_BSF_PARAM
a generic parameter which can be set by the user for bit stream filtering
@ 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_AUDIO_PARAM
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)
Rational number (pair of numerator and denominator).
#define GET_CODEC_NAME(id)
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.
#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_...
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.
static int av_bprint_is_complete(const AVBPrint *buf)
Test if the print buffer is complete (not truncated).
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)
const OptionDef options[]
#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.
An AVChannelLayout holds information about the channel layout of audio data.
AVClassCategory category
Category used for visualization (like color) This is only set if the category is equal for all object...
#define av_err2str(errnum)
Convenience macro, the return value should be used only directly in function arguments but never stan...
const 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.
#define GET_SAMPLE_FMT_NAME(sample_fmt)
#define PRINT_CODEC_SUPPORTED(codec, field, type, list_name, term, get_name)
const AVInputFormat * av_demuxer_iterate(void **opaque)
Iterate over all registered demuxers.
printf("static const uint8_t my_array[100] = {\n")
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.
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
const AVChannelLayout * av_channel_layout_standard(void **opaque)
Iterate over all standard channel layouts.
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_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.
int av_codec_is_encoder(const AVCodec *codec)
#define AV_CODEC_PROP_LOSSLESS
Codec supports lossless compression.
void av_log_set_level(int level)
Set the log level.
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)
AVSampleFormat
Audio sample formats.
@ AVMEDIA_TYPE_ATTACHMENT
Opaque data information usually sparse.
#define AV_OPT_FLAG_DECODING_PARAM
a generic parameter which can be set by the user for demuxing or decoding
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)
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.
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)
static unsigned get_codecs_sorted(const AVCodecDescriptor ***rcodecs)
#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 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.
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_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.
static int swscale(SwsContext *c, const uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[], int dstSliceY, int dstSliceH)
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...
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.
const AVInputFormat * av_find_input_format(const char *short_name)
Find AVInputFormat based on the short name of the input format.
int av_channel_description(char *buf, size_t buf_size, enum AVChannel channel_id)
Get a human readable string describing a given channel.
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.
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 AVOutputFormat * av_output_audio_device_next(const AVOutputFormat *d)
Audio output devices iterator.
#define AV_CODEC_CAP_SUBFRAMES
Codec can output multiple frames per AVPacket Normally demuxers return one frame at a time,...
static enum AVCodecID codec_ids[]
#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.
#define flags(name, subs,...)
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.
const AVCodecDescriptor * avcodec_descriptor_get(enum AVCodecID id)
const 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.
void av_bprint_chars(AVBPrint *buf, char c, unsigned n)
Append char c n times to a print buffer.
static void * av_x_if_null(const void *p, const void *x)
Return x default pointer in case p is NULL.
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 Aug 24 2022 21:41:14 for FFmpeg by
doxygen
1.8.17