52 #include "libavutil/ffversion.h" 
   57 #if HAVE_SYS_RESOURCE_H 
   59 #include <sys/resource.h> 
   95     vfprintf(stdout, fmt, vl);
 
  102     static int print_prefix = 1;
 
  130                            double min, 
double max)
 
  136         error = 
"Expected number for %s but found: %s\n";
 
  137     else if (d < min || d > max)
 
  138         error = 
"The value for %s was %s which is not within %f - %f\n";
 
  139     else if (type == 
OPT_INT64 && (int64_t)d != d)
 
  140         error = 
"Expected int64 for %s but found %s\n";
 
  141     else if (type == 
OPT_INT && (
int)d != d)
 
  142         error = 
"Expected int for %s but found %s\n";
 
  156                is_duration ? 
"duration" : 
"date", context, timestr);
 
  163                        int rej_flags, 
int alt_flags)
 
  169     for (po = options; po->
name; po++) {
 
  172         if (((po->
flags & req_flags) != req_flags) ||
 
  173             (alt_flags && !(po->
flags & alt_flags)) ||
 
  174             (po->
flags & rej_flags))
 
  186         printf(
"-%-17s  %s\n", buf, po->
help);
 
  205     const char *p = strchr(name, 
':');
 
  206     int len = p ? p - name : strlen(name);
 
  209         if (!strncmp(name, po->
name, len) && strlen(po->
name) == len)
 
  219 #if HAVE_COMMANDLINETOARGVW && defined(_WIN32) 
  221 #include <shellapi.h> 
  223 static char** win32_argv_utf8 = 
NULL;
 
  224 static int win32_argc = 0;
 
  237     int i, buffsize = 0, 
offset = 0;
 
  239     if (win32_argv_utf8) {
 
  240         *argc_ptr = win32_argc;
 
  241         *argv_ptr = win32_argv_utf8;
 
  246     argv_w = CommandLineToArgvW(GetCommandLineW(), &win32_argc);
 
  247     if (win32_argc <= 0 || !argv_w)
 
  251     for (i = 0; i < win32_argc; i++)
 
  252         buffsize += WideCharToMultiByte(CP_UTF8, 0, argv_w[i], -1,
 
  255     win32_argv_utf8 = 
av_mallocz(
sizeof(
char *) * (win32_argc + 1) + buffsize);
 
  256     argstr_flat     = (
char *)win32_argv_utf8 + 
sizeof(
char *) * (win32_argc + 1);
 
  257     if (!win32_argv_utf8) {
 
  262     for (i = 0; i < win32_argc; i++) {
 
  263         win32_argv_utf8[i] = &argstr_flat[
offset];
 
  264         offset += WideCharToMultiByte(CP_UTF8, 0, argv_w[i], -1,
 
  268     win32_argv_utf8[i] = 
NULL;
 
  271     *argc_ptr = win32_argc;
 
  272     *argv_ptr = win32_argv_utf8;
 
  292         char *p = strchr(opt, 
':');
 
  295         dstcount = (
int *)(so + 1);
 
  296         *so = 
grow_array(*so, 
sizeof(**so), dstcount, *dstcount + 1);
 
  300         (*so)[*dstcount - 1].specifier = str;
 
  301         dst = &(*so)[*dstcount - 1].u;
 
  325                    "Failed to set value '%s' for option '%s': %s\n",
 
  343     if (!po->
name && opt[0] == 
'n' && opt[1] == 
'o') {
 
  370                    void (*parse_arg_function)(
void *, 
const char*))
 
  373     int optindex, handleoptions = 1, 
ret;
 
  380     while (optindex < argc) {
 
  381         opt = argv[optindex++];
 
  383         if (handleoptions && opt[0] == 
'-' && opt[1] != 
'\0') {
 
  384             if (opt[1] == 
'-' && opt[2] == 
'\0') {
 
  394             if (parse_arg_function)
 
  395                 parse_arg_function(optctx, opt);
 
  407     for (i = 0; i < g->
nb_opts; i++) {
 
  413                    "%s %s -- you are trying to apply an input option to an " 
  414                    "output file or vice versa. Move this option before the " 
  415                    "file it belongs to.\n", o->
key, o->
opt->
help,
 
  439     for (i = 1; i < argc; i++) {
 
  440         const char *cur_opt = argv[i];
 
  442         if (*cur_opt++ != 
'-')
 
  446         if (!po->
name && cur_opt[0] == 
'n' && cur_opt[1] == 
'o')
 
  449         if ((!po->
name && !strcmp(cur_opt, optname)) ||
 
  450              (po->
name && !strcmp(optname, po->
name)))
 
  461     const unsigned char *p;
 
  464         if (!((*p >= 
'+' && *p <= 
':') || (*p >= 
'@' && *p <= 
'Z') ||
 
  465               *p == 
'_' || (*p >= 
'a' && *p <= 
'z')))
 
  472     for (p = a; *p; p++) {
 
  473         if (*p == 
'\\' || *p == 
'"' || *p == 
'$' || *p == 
'`')
 
  475         else if (*p < ' ' || *p > 
'~')
 
  489     if (idx && argv[idx + 1])
 
  492     if ((env = getenv(
"FFREPORT")) || idx) {
 
  497             for (i = 0; i < argc; i++) {
 
  510                             int opt_flags, 
int search_flags)
 
  518 #define FLAGS (o->type == AV_OPT_TYPE_FLAGS) ? AV_DICT_APPEND : 0 
  523     char opt_stripped[128];
 
  526 #if CONFIG_AVRESAMPLE 
  531     if (!strcmp(opt, 
"debug") || !strcmp(opt, 
"fdebug"))
 
  534     if (!(p = strchr(opt, 
':')))
 
  535         p = opt + strlen(opt);
 
  536     av_strlcpy(opt_stripped, opt, 
FFMIN(
sizeof(opt_stripped), p - opt + 1));
 
  540         ((opt[0] == 
'v' || opt[0] == 
'a' || opt[0] == 
's') &&
 
  565     if (!consumed && !strcmp(opt, 
"sws_flags")) {
 
  570 #if CONFIG_SWRESAMPLE 
  585 #if CONFIG_AVRESAMPLE 
  608     for (i = 0; i < nb_groups; i++) {
 
  610         if (p->
sep && !strcmp(p->
sep, opt))
 
  645     resample_opts = 
NULL;
 
  659                     const char *key, 
const char *
val)
 
  676     memset(octx, 0, 
sizeof(*octx));
 
  732     while (optindex < argc) {
 
  733         const char *opt = argv[optindex++], *
arg;
 
  739         if (opt[0] == 
'-' && opt[1] == 
'-' && !opt[2]) {
 
  744         if (opt[0] != 
'-' || !opt[1] || dashdash+1 == optindex) {
 
  751 #define GET_ARG(arg)                                                           \ 
  753     arg = argv[optindex++];                                                    \ 
  755         av_log(NULL, AV_LOG_ERROR, "Missing argument for option '%s'.\n", opt);\ 
  756         return AVERROR(EINVAL);                                                \ 
  765                    groups[ret].
name, arg);
 
  774                 arg = argv[optindex++];
 
  783                    "argument '%s'.\n", po->
name, po->
help, arg);
 
  788         if (argv[optindex]) {
 
  792                        "argument '%s'.\n", opt, argv[optindex]);
 
  797                        "with argument '%s'.\n", opt, argv[optindex]);
 
  803         if (opt[0] == 
'n' && opt[1] == 
'o' &&
 
  808                    "argument 0.\n", po->
name, po->
help);
 
  839     const struct { 
const char *
name; 
int level; } log_levels[] = {
 
  855     tail = strstr(arg, 
"repeat");
 
  863         arg += 6 + (arg[6]==
'+');
 
  868         if (!strcmp(log_levels[i].
name, arg)) {
 
  874     level = strtol(arg, &tail, 10);
 
  877                "Possible levels are numbers or:\n", arg);
 
  891     while ((c = *(
template++))) {
 
  893             if (!(c = *(
template++)))
 
  901                            tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday,
 
  902                            tm->tm_hour, tm->tm_min, tm->tm_sec);
 
  916     char *filename_template = 
NULL;
 
  926     tm = localtime(&now);
 
  928     while (env && *env) {
 
  932                        "Failed to parse FFREPORT environment variable: %s\n",
 
  939         if (!strcmp(key, 
"file")) {
 
  941             filename_template = 
val;
 
  943         } 
else if (!strcmp(key, 
"level")) {
 
  970                filename.str, strerror(errno));
 
  975            "%s started on %04d-%02d-%02d at %02d:%02d:%02d\n" 
  976            "Report written to \"%s\"\n",
 
  978            tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday,
 
  979            tm->tm_hour, tm->tm_min, tm->tm_sec,
 
  995     max = strtol(arg, &tail, 10);
 
 1008     struct rlimit rl = { lim, lim + 1 };
 
 1009     if (setrlimit(RLIMIT_CPU, &rl))
 
 1010         perror(
"setrlimit");
 
 1020     const char *errbuf_ptr = errbuf;
 
 1030 #define SHOW_VERSION  2 
 1031 #define SHOW_CONFIG   4 
 1032 #define SHOW_COPYRIGHT 8 
 1034 #define PRINT_LIB_INFO(libname, LIBNAME, flags, level)                  \ 
 1035     if (CONFIG_##LIBNAME) {                                             \ 
 1036         const char *indent = flags & INDENT? "  " : "";                 \ 
 1037         if (flags & SHOW_VERSION) {                                     \ 
 1038             unsigned int version = libname##_version();                 \ 
 1039             av_log(NULL, level,                                         \ 
 1040                    "%slib%-11s %2d.%3d.%3d / %2d.%3d.%3d\n",            \ 
 1042                    LIB##LIBNAME##_VERSION_MAJOR,                        \ 
 1043                    LIB##LIBNAME##_VERSION_MINOR,                        \ 
 1044                    LIB##LIBNAME##_VERSION_MICRO,                        \ 
 1045                    version >> 16, version >> 8 & 0xff, version & 0xff); \ 
 1047         if (flags & SHOW_CONFIG) {                                      \ 
 1048             const char *cfg = libname##_configuration();                \ 
 1049             if (strcmp(FFMPEG_CONFIGURATION, cfg)) {                    \ 
 1050                 if (!warned_cfg) {                                      \ 
 1051                     av_log(NULL, level,                                 \ 
 1052                             "%sWARNING: library configuration mismatch\n", \ 
 1056                 av_log(NULL, level, "%s%-11s configuration: %s\n",      \ 
 1057                         indent, #libname, cfg);                         \ 
 1077     const char *indent = flags & 
INDENT? 
"  " : 
"";
 
 1081         av_log(
NULL, level, 
" Copyright (c) %d-%d the FFmpeg developers",
 
 1084     av_log(
NULL, level, 
"%sbuilt with %s\n", indent, CC_IDENT);
 
 1086     av_log(
NULL, level, 
"%sconfiguration: " FFMPEG_CONFIGURATION 
"\n", indent);
 
 1091     const char *indent = flags & 
INDENT ? 
"  " : 
"";
 
 1092     char str[] = { FFMPEG_CONFIGURATION };
 
 1093     char *conflist, *remove_tilde, *splitconf;
 
 1097     while ((conflist = strstr(str, 
" --")) != 
NULL) {
 
 1098         strncpy(conflist, 
"~--", 3);
 
 1103     while ((remove_tilde = strstr(str, 
"pkg-config~")) != 
NULL) {
 
 1104         strncpy(remove_tilde, 
"pkg-config ", 11);
 
 1107     splitconf = strtok(str, 
"~");
 
 1108     av_log(
NULL, level, 
"\n%sconfiguration:\n", indent);
 
 1109     while (splitconf != 
NULL) {
 
 1110         av_log(
NULL, level, 
"%s%s%s\n", indent, indent, splitconf);
 
 1111         splitconf = strtok(
NULL, 
"~");
 
 1147     "This version of %s has nonfree parts compiled in.\n" 
 1148     "Therefore it is not legally redistributable.\n",
 
 1152     "%s is free software; you can redistribute it and/or modify\n" 
 1153     "it under the terms of the GNU General Public License as published by\n" 
 1154     "the Free Software Foundation; either version 3 of the License, or\n" 
 1155     "(at your option) any later version.\n" 
 1157     "%s is distributed in the hope that it will be useful,\n" 
 1158     "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" 
 1159     "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n" 
 1160     "GNU General Public License for more details.\n" 
 1162     "You should have received a copy of the GNU General Public License\n" 
 1163     "along with %s.  If not, see <http://www.gnu.org/licenses/>.\n",
 
 1167     "%s is free software; you can redistribute it and/or modify\n" 
 1168     "it under the terms of the GNU General Public License as published by\n" 
 1169     "the Free Software Foundation; either version 2 of the License, or\n" 
 1170     "(at your option) any later version.\n" 
 1172     "%s is distributed in the hope that it will be useful,\n" 
 1173     "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" 
 1174     "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n" 
 1175     "GNU General Public License for more details.\n" 
 1177     "You should have received a copy of the GNU General Public License\n" 
 1178     "along with %s; if not, write to the Free Software\n" 
 1179     "Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA\n",
 
 1183     "%s is free software; you can redistribute it and/or modify\n" 
 1184     "it under the terms of the GNU Lesser General Public License as published by\n" 
 1185     "the Free Software Foundation; either version 3 of the License, or\n" 
 1186     "(at your option) any later version.\n" 
 1188     "%s is distributed in the hope that it will be useful,\n" 
 1189     "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" 
 1190     "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n" 
 1191     "GNU Lesser General Public License for more details.\n" 
 1193     "You should have received a copy of the GNU Lesser General Public License\n" 
 1194     "along with %s.  If not, see <http://www.gnu.org/licenses/>.\n",
 
 1198     "%s is free software; you can redistribute it and/or\n" 
 1199     "modify it under the terms of the GNU Lesser General Public\n" 
 1200     "License as published by the Free Software Foundation; either\n" 
 1201     "version 2.1 of the License, or (at your option) any later version.\n" 
 1203     "%s is distributed in the hope that it will be useful,\n" 
 1204     "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" 
 1205     "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n" 
 1206     "Lesser General Public License for more details.\n" 
 1208     "You should have received a copy of the GNU Lesser General Public\n" 
 1209     "License along with %s; if not, write to the Free Software\n" 
 1210     "Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA\n",
 
 1228     const char *last_name;
 
 1232            " D. = Demuxing supported\n" 
 1233            " .E = Muxing supported\n" 
 1234            " --\n", device_only ? 
"Devices:" : 
"File formats:");
 
 1240         const char *long_name = 
NULL;
 
 1244             if (!is_dev && device_only)
 
 1246             if ((!name || strcmp(ofmt->
name, name) < 0) &&
 
 1247                 strcmp(ofmt->
name, last_name) > 0) {
 
 1255             if (!is_dev && device_only)
 
 1257             if ((!name || strcmp(ifmt->
name, name) < 0) &&
 
 1258                 strcmp(ifmt->
name, last_name) > 0) {
 
 1263             if (name && strcmp(ifmt->
name, name) == 0)
 
 1270         printf(
" %s%s %-15s %s\n",
 
 1274             long_name ? long_name:
" ");
 
 1289 #define PRINT_CODEC_SUPPORTED(codec, field, type, list_name, term, get_name) \ 
 1290     if (codec->field) {                                                      \ 
 1291         const type *p = codec->field;                                        \ 
 1293         printf("    Supported " list_name ":");                              \ 
 1294         while (*p != term) {                                                 \ 
 1296             printf(" %s", name);                                             \ 
 1306     printf(
"%s %s [%s]:\n", encoder ? 
"Encoder" : 
"Decoder", c->
name,
 
 1311         printf(
"    Threading capabilities: ");
 
 1318         default:                      printf(
"no");              
break;
 
 1326         printf(
"    Supported framerates:");
 
 1328             printf(
" %d/%d", fps->
num, fps->
den);
 
 1357         default:                    
return '?';
 
 1365         if (prev->
id == 
id &&
 
 1377     return (*da)->type != (*db)->type ? (*da)->type - (*db)->type :
 
 1378            strcmp((*da)->name, (*db)->name);
 
 1385     unsigned nb_codecs = 0, i = 0;
 
 1389     if (!(codecs = 
av_calloc(nb_codecs, 
sizeof(*codecs)))) {
 
 1406     printf(
" (%s: ", encoder ? 
"encoders" : 
"decoders");
 
 1409         printf(
"%s ", codec->
name);
 
 1420            " D..... = Decoding supported\n" 
 1421            " .E.... = Encoding supported\n" 
 1422            " ..V... = Video codec\n" 
 1423            " ..A... = Audio codec\n" 
 1424            " ..S... = Subtitle codec\n" 
 1425            " ...I.. = Intra frame-only codec\n" 
 1426            " ....L. = Lossy compression\n" 
 1427            " .....S = Lossless compression\n" 
 1429     for (i = 0; i < nb_codecs; i++) {
 
 1433         if (strstr(desc->
name, 
"_deprecated"))
 
 1450             if (strcmp(codec->
name, desc->
name)) {
 
 1457             if (strcmp(codec->
name, desc->
name)) {
 
 1477            " S..... = Subtitle\n" 
 1478            " .F.... = Frame-level multithreading\n" 
 1479            " ..S... = Slice-level multithreading\n" 
 1480            " ...X.. = Codec is experimental\n" 
 1481            " ....B. = Supports draw_horiz_band\n" 
 1482            " .....D = Supports direct rendering method 1\n" 
 1484            encoder ? 
"Encoders" : 
"Decoders");
 
 1485     for (i = 0; i < nb_codecs; i++) {
 
 1498             if (strcmp(codec->
name, desc->
name))
 
 1499                 printf(
" (codec %s)", desc->
name);
 
 1523     printf(
"Bitstream filters:\n");
 
 1525         printf(
"%s\n", bsf->
name);
 
 1532     void *opaque = 
NULL;
 
 1535     printf(
"Supported file protocols:\n" 
 1538         printf(
"%s\n", name);
 
 1539     printf(
"Output:\n");
 
 1541         printf(
"%s\n", name);
 
 1549     char descr[64], *descr_cur;
 
 1554            "  T.. = Timeline support\n" 
 1555            "  .S. = Slice threading\n" 
 1556            "  ..C = Commmand support\n" 
 1557            "  A = Audio input/output\n" 
 1558            "  V = Video input/output\n" 
 1559            "  N = Dynamic number and/or type of input/output\n" 
 1560            "  | = Source or sink filter\n");
 
 1563         for (i = 0; i < 2; i++) {
 
 1565                 *(descr_cur++) = 
'-';
 
 1566                 *(descr_cur++) = 
'>';
 
 1569             for (j = 0; pad && pad[j].
name; j++) {
 
 1570                 if (descr_cur >= descr + 
sizeof(descr) - 4)
 
 1579         printf(
" %c%c%c %-16s %-10s %s\n",
 
 1586     printf(
"No filters available: libavfilter disabled\n");
 
 1597     printf(
"%-32s #RRGGBB\n", 
"name");
 
 1600         printf(
"%-32s #%02x%02x%02x\n", name, rgb[0], rgb[1], rgb[2]);
 
 1609     printf(
"Pixel formats:\n" 
 1610            "I.... = Supported Input  format for conversion\n" 
 1611            ".O... = Supported Output format for conversion\n" 
 1612            "..H.. = Hardware accelerated format\n" 
 1613            "...P. = Paletted format\n" 
 1614            "....B = Bitstream format\n" 
 1615            "FLAGS NAME            NB_COMPONENTS BITS_PER_PIXEL\n" 
 1619 #   define sws_isSupportedInput(x)  0 
 1620 #   define sws_isSupportedOutput(x) 0 
 1625         printf(
"%c%c%c%c%c %-16s       %d            %2d\n",
 
 1642     const char *
name, *descr;
 
 1644     printf(
"Individual channels:\n" 
 1645            "NAME           DESCRIPTION\n");
 
 1646     for (i = 0; i < 63; i++) {
 
 1651         printf(
"%-14s %s\n", name, descr);
 
 1653     printf(
"\nStandard channel layouts:\n" 
 1654            "NAME           DECOMPOSITION\n");
 
 1657             printf(
"%-14s ", name);
 
 1658             for (j = 1; j; j <<= 1)
 
 1701                    "but no %s for it are available. FFmpeg might need to be " 
 1702                    "recompiled with additional external libraries.\n",
 
 1703                    name, encoder ? 
"encoders" : 
"decoders");
 
 1723         printf(
"    Common extensions: %s.\n", fmt->
extensions);
 
 1742         printf(
"    Common extensions: %s.\n", fmt->
extensions);
 
 1744         printf(
"    Mime type: %s.\n", fmt->
mime_type);
 
 1747         printf(
"    Default video codec: %s.\n", desc->
name);
 
 1751         printf(
"    Default audio codec: %s.\n", desc->
name);
 
 1755         printf(
"    Default subtitle codec: %s.\n", desc->
name);
 
 1763 static void show_help_filter(
const char *
name)
 
 1777     printf(
"Filter %s\n", f->
name);
 
 1782         printf(
"    slice threading supported\n");
 
 1784     printf(
"    Inputs:\n");
 
 1786     for (i = 0; i < 
count; i++) {
 
 1791         printf(
"        dynamic (depending on the options)\n");
 
 1793         printf(
"        none (source filter)\n");
 
 1795     printf(
"    Outputs:\n");
 
 1797     for (i = 0; i < 
count; i++) {
 
 1802         printf(
"        dynamic (depending on the options)\n");
 
 1804         printf(
"        none (sink filter)\n");
 
 1810         printf(
"This filter has support for timeline through the 'enable' option.\n");
 
 1813            "can not to satisfy request\n");
 
 1826     par = strchr(topic, 
'=');
 
 1832     } 
else if (!strcmp(topic, 
"decoder")) {
 
 1834     } 
else if (!strcmp(topic, 
"encoder")) {
 
 1836     } 
else if (!strcmp(topic, 
"demuxer")) {
 
 1838     } 
else if (!strcmp(topic, 
"muxer")) {
 
 1841     } 
else if (!strcmp(topic, 
"filter")) {
 
 1842         show_help_filter(par);
 
 1857     while (c != 
'\n' && c != EOF)
 
 1875     ret = fseek(f, 0, SEEK_END);
 
 1888     ret = fseek(f, 0, SEEK_SET);
 
 1900     ret = fread(*bufptr, 1, *size, f);
 
 1906                    filename, strerror(errno));
 
 1911         (*bufptr)[(*size)++] = 
'\0';
 
 1922                       const char *preset_name, 
int is_path,
 
 1923                       const char *codec_name)
 
 1927     const char *base[3] = { getenv(
"FFMPEG_DATADIR"),
 
 1932         av_strlcpy(filename, preset_name, filename_size);
 
 1933         f = fopen(filename, 
"r");
 
 1936         char datadir[MAX_PATH], *ls;
 
 1939         if (GetModuleFileNameA(GetModuleHandleA(
NULL), datadir, 
sizeof(datadir) - 1))
 
 1941             for (ls = datadir; ls < datadir + strlen(datadir); ls++)
 
 1942                 if (*ls == 
'\\') *ls = 
'/';
 
 1944             if (ls = strrchr(datadir, 
'/'))
 
 1947                 strncat(datadir, 
"/ffpresets",  
sizeof(datadir) - 1 - strlen(datadir));
 
 1952         for (i = 0; i < 3 && !f; i++) {
 
 1955             snprintf(filename, filename_size, 
"%s%s/%s.ffpreset", base[i],
 
 1956                      i != 1 ? 
"" : 
"/.ffmpeg", preset_name);
 
 1957             f = fopen(filename, 
"r");
 
 1958             if (!f && codec_name) {
 
 1960                          "%s%s/%s-%s.ffpreset",
 
 1961                          base[i], i != 1 ? 
"" : 
"/.ffmpeg", codec_name,
 
 1963                 f = fopen(filename, 
"r");
 
 2009         char *p = strchr(t->
key, 
':');
 
 2014             case  1: *p = 0; 
break;
 
 2025         else if (t->
key[0] == prefix &&
 
 2047                "Could not alloc memory for stream options.\n");
 
 2058     if (new_size >= INT_MAX / elem_size) {
 
 2062     if (*size < new_size) {
 
 2068         memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size);
 
 2084     printf(
"Audo-detected sources for %s:\n", fmt->
name);
 
 2087         printf(
"Cannot list sources. Not implemented.\n");
 
 2092         printf(
"Cannot list sources.\n");
 
 2096     for (i = 0; i < device_list->
nb_devices; i++) {
 
 2097         printf(
"%s %s [%s]\n", device_list->
default_device == i ? 
"*" : 
" ",
 
 2114     printf(
"Audo-detected sinks for %s:\n", fmt->
name);
 
 2117         printf(
"Cannot list sinks. Not implemented.\n");
 
 2122         printf(
"Cannot list sinks.\n");
 
 2126     for (i = 0; i < device_list->
nb_devices; i++) {
 
 2127         printf(
"%s %s [%s]\n", device_list->
default_device == i ? 
"*" : 
" ",
 
 2136 static int show_sinks_sources_parse_arg(
const char *
arg, 
char **dev, 
AVDictionary **opts)
 
 2140         char *opts_str = 
NULL;
 
 2145         if ((opts_str = strchr(*dev, 
','))) {
 
 2146             *(opts_str++) = 
'\0';
 
 2153         printf(
"\nDevice name is not provided.\n" 
 2154                 "You can pass devicename[,opt1=val1[,opt2=val2...]] as an argument.\n\n");
 
 2158 int show_sources(
void *optctx, 
const char *opt, 
const char *arg)
 
 2168     if ((ret = show_sinks_sources_parse_arg(arg, &dev, &opts)) < 0)
 
 2174             if (!strcmp(fmt->
name, 
"lavfi"))
 
 2178             print_device_sources(fmt, opts);
 
 2186             print_device_sources(fmt, opts);
 
 2196 int show_sinks(
void *optctx, 
const char *opt, 
const char *arg)
 
 2206     if ((ret = show_sinks_sources_parse_arg(arg, &dev, &opts)) < 0)
 
 2214             print_device_sinks(fmt, opts);
 
 2222             print_device_sinks(fmt, opts);