51 #if HAVE_SYS_RESOURCE_H
53 #include <sys/resource.h>
81 vfprintf(stdout, fmt, vl);
85 double min,
double max)
91 error =
"Expected number for %s but found: %s\n";
92 else if (d < min || d > max)
93 error =
"The value for %s was %s which is not within %f - %f\n";
94 else if (type ==
OPT_INT64 && (int64_t)d != d)
95 error =
"Expected int64 for %s but found %s\n";
96 else if (type ==
OPT_INT && (
int)d != d)
97 error =
"Expected int for %s but found %s\n";
111 is_duration ?
"duration" :
"date", context, timestr);
118 int rej_flags,
int alt_flags)
124 for (po = options; po->
name !=
NULL; po++) {
127 if (((po->
flags & req_flags) != req_flags) ||
128 (alt_flags && !(po->
flags & alt_flags)) ||
129 (po->
flags & rej_flags))
141 printf(
"-%-17s %s\n", buf, po->
help);
158 const char *p = strchr(name,
':');
159 int len = p ? p - name : strlen(name);
162 if (!strncmp(name, po->
name, len) && strlen(po->
name) == len)
169 #if HAVE_COMMANDLINETOARGVW
171 #include <shellapi.h>
173 static char** win32_argv_utf8 =
NULL;
174 static int win32_argc = 0;
187 int i, buffsize = 0, offset = 0;
189 if (win32_argv_utf8) {
190 *argc_ptr = win32_argc;
191 *argv_ptr = win32_argv_utf8;
196 argv_w = CommandLineToArgvW(GetCommandLineW(), &win32_argc);
197 if (win32_argc <= 0 || !argv_w)
201 for (i = 0; i < win32_argc; i++)
202 buffsize += WideCharToMultiByte(CP_UTF8, 0, argv_w[i], -1,
205 win32_argv_utf8 =
av_mallocz(
sizeof(
char *) * (win32_argc + 1) + buffsize);
206 argstr_flat = (
char *)win32_argv_utf8 +
sizeof(
char *) * (win32_argc + 1);
207 if (win32_argv_utf8 ==
NULL) {
212 for (i = 0; i < win32_argc; i++) {
213 win32_argv_utf8[i] = &argstr_flat[offset];
214 offset += WideCharToMultiByte(CP_UTF8, 0, argv_w[i], -1,
215 &argstr_flat[offset],
218 win32_argv_utf8[i] =
NULL;
221 *argc_ptr = win32_argc;
222 *argv_ptr = win32_argv_utf8;
242 char *p = strchr(opt,
':');
244 dstcount = (
int *)(so + 1);
245 *so =
grow_array(*so,
sizeof(**so), dstcount, *dstcount + 1);
246 (*so)[*dstcount - 1].specifier =
av_strdup(p ? p + 1 :
"");
247 dst = &(*so)[*dstcount - 1].u;
266 int ret = po->
u.
func_arg(optctx, opt, arg);
269 "Failed to set value '%s' for option '%s'\n", arg, opt);
286 if (!po->
name && opt[0] ==
'n' && opt[1] ==
'o') {
313 void (*parse_arg_function)(
void *,
const char*))
316 int optindex, handleoptions = 1, ret;
323 while (optindex < argc) {
324 opt = argv[optindex++];
326 if (handleoptions && opt[0] ==
'-' && opt[1] !=
'\0') {
327 if (opt[1] ==
'-' && opt[2] ==
'\0') {
333 if ((ret =
parse_option(optctx, opt, argv[optindex], options)) < 0)
337 if (parse_arg_function)
338 parse_arg_function(optctx, opt);
350 for (i = 0; i < g->
nb_opts; i++) {
372 for (i = 1; i < argc; i++) {
373 const char *cur_opt = argv[i];
375 if (*cur_opt++ !=
'-')
379 if (!po->
name && cur_opt[0] ==
'n' && cur_opt[1] ==
'o')
382 if ((!po->
name && !strcmp(cur_opt, optname)) ||
383 (po->
name && !strcmp(optname, po->
name)))
397 if (idx && argv[idx + 1])
401 #define FLAGS (o->type == AV_OPT_TYPE_FLAGS) ? AV_DICT_APPEND : 0
405 char opt_stripped[128];
412 if (!(p = strchr(opt,
':')))
413 p = opt + strlen(opt);
414 av_strlcpy(opt_stripped, opt,
FFMIN(
sizeof(opt_stripped), p - opt + 1));
418 ((opt[0] ==
'v' || opt[0] ==
'a' || opt[0] ==
's') &&
451 for (i = 0; i < nb_groups; i++) {
453 if (p->
sep && !strcmp(p->
sep, opt))
498 const char *key,
const char *val)
515 memset(octx, 0,
sizeof(*octx));
568 while (optindex < argc) {
569 const char *opt = argv[optindex++], *arg;
576 if (opt[0] !=
'-' || !opt[1]) {
583 #define GET_ARG(arg) \
585 arg = argv[optindex++]; \
587 av_log(NULL, AV_LOG_ERROR, "Missing argument for option '%s'.\n", opt);\
588 return AVERROR(EINVAL); \
597 groups[ret].
name, arg);
606 arg = argv[optindex++];
615 "argument '%s'.\n", po->
name, po->
help, arg);
620 if (argv[optindex]) {
624 "argument '%s'.\n", opt, argv[optindex]);
629 "with argument '%s'.\n", opt, argv[optindex]);
635 if (opt[0] ==
'n' && opt[1] ==
'o' &&
640 "argument 0.\n", po->
name, po->
help);
659 const struct {
const char *
name;
int level; } log_levels[] = {
674 if (!strcmp(log_levels[i].
name, arg)) {
680 level = strtol(arg, &tail, 10);
683 "Possible levels are numbers or:\n", arg);
696 struct rlimit rl = { lim, lim + 1 };
697 if (setrlimit(RLIMIT_CPU, &rl))
708 const char *errbuf_ptr = errbuf;
720 #define SHOW_VERSION 2
721 #define SHOW_CONFIG 4
723 #define PRINT_LIB_INFO(libname, LIBNAME, flags, level) \
724 if (CONFIG_##LIBNAME) { \
725 const char *indent = flags & INDENT? " " : ""; \
726 if (flags & SHOW_VERSION) { \
727 unsigned int version = libname##_version(); \
728 av_log(NULL, level, \
729 "%slib%-10s %2d.%3d.%2d / %2d.%3d.%2d\n", \
731 LIB##LIBNAME##_VERSION_MAJOR, \
732 LIB##LIBNAME##_VERSION_MINOR, \
733 LIB##LIBNAME##_VERSION_MICRO, \
734 version >> 16, version >> 8 & 0xff, version & 0xff); \
736 if (flags & SHOW_CONFIG) { \
737 const char *cfg = libname##_configuration(); \
738 if (strcmp(LIBAV_CONFIGURATION, cfg)) { \
740 av_log(NULL, level, \
741 "%sWARNING: library configuration mismatch\n", \
745 av_log(NULL, level, "%s%-11s configuration: %s\n", \
746 indent, #libname, cfg); \
765 "%s version " LIBAV_VERSION ", Copyright (c) %d-%d the Libav developers\n",
787 "This version of %s has nonfree parts compiled in.\n"
788 "Therefore it is not legally redistributable.\n",
791 "%s is free software; you can redistribute it and/or modify\n"
792 "it under the terms of the GNU General Public License as published by\n"
793 "the Free Software Foundation; either version 3 of the License, or\n"
794 "(at your option) any later version.\n"
796 "%s is distributed in the hope that it will be useful,\n"
797 "but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
798 "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
799 "GNU General Public License for more details.\n"
801 "You should have received a copy of the GNU General Public License\n"
802 "along with %s. If not, see <http://www.gnu.org/licenses/>.\n",
805 "%s is free software; you can redistribute it and/or modify\n"
806 "it under the terms of the GNU General Public License as published by\n"
807 "the Free Software Foundation; either version 2 of the License, or\n"
808 "(at your option) any later version.\n"
810 "%s is distributed in the hope that it will be useful,\n"
811 "but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
812 "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
813 "GNU General Public License for more details.\n"
815 "You should have received a copy of the GNU General Public License\n"
816 "along with %s; if not, write to the Free Software\n"
817 "Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA\n",
820 "%s is free software; you can redistribute it and/or modify\n"
821 "it under the terms of the GNU Lesser General Public License as published by\n"
822 "the Free Software Foundation; either version 3 of the License, or\n"
823 "(at your option) any later version.\n"
825 "%s is distributed in the hope that it will be useful,\n"
826 "but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
827 "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
828 "GNU Lesser General Public License for more details.\n"
830 "You should have received a copy of the GNU Lesser General Public License\n"
831 "along with %s. If not, see <http://www.gnu.org/licenses/>.\n",
834 "%s is free software; you can redistribute it and/or\n"
835 "modify it under the terms of the GNU Lesser General Public\n"
836 "License as published by the Free Software Foundation; either\n"
837 "version 2.1 of the License, or (at your option) any later version.\n"
839 "%s is distributed in the hope that it will be useful,\n"
840 "but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
841 "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n"
842 "Lesser General Public License for more details.\n"
844 "You should have received a copy of the GNU Lesser General Public\n"
845 "License along with %s; if not, write to the Free Software\n"
846 "Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA\n",
858 const char *last_name;
860 printf(
"File formats:\n"
861 " D. = Demuxing supported\n"
862 " .E = Muxing supported\n"
869 const char *long_name =
NULL;
872 if ((name ==
NULL || strcmp(ofmt->
name, name) < 0) &&
873 strcmp(ofmt->
name, last_name) > 0) {
880 if ((name ==
NULL || strcmp(ifmt->
name, name) < 0) &&
881 strcmp(ifmt->
name, last_name) > 0) {
886 if (name && strcmp(ifmt->
name, name) == 0)
893 printf(
" %s%s %-15s %s\n",
897 long_name ? long_name:
" ");
902 #define PRINT_CODEC_SUPPORTED(codec, field, type, list_name, term, get_name) \
903 if (codec->field) { \
904 const type *p = c->field; \
906 printf(" Supported " list_name ":"); \
907 while (*p != term) { \
909 printf(" %s", name); \
919 printf(
"%s %s [%s]:\n", encoder ?
"Encoder" :
"Decoder", c->
name,
923 printf(
" Threading capabilities: ");
930 default: printf(
"no");
break;
938 printf(
" Supported framerates:");
940 printf(
" %d/%d", fps->
num, fps->
den);
975 if (prev->
id ==
id &&
986 printf(
" (%s: ", encoder ?
"encoders" :
"decoders");
989 printf(
"%s ", codec->
name);
999 " D..... = Decoding supported\n"
1000 " .E.... = Encoding supported\n"
1001 " ..V... = Video codec\n"
1002 " ..A... = Audio codec\n"
1003 " ..S... = Subtitle codec\n"
1004 " ...I.. = Intra frame-only codec\n"
1005 " ....L. = Lossy compression\n"
1006 " .....S = Lossless compression\n"
1024 if (strcmp(codec->
name, desc->
name)) {
1031 if (strcmp(codec->
name, desc->
name)) {
1049 " S... = Subtitle\n"
1050 " .F.. = Frame-level multithreading\n"
1051 " ..S. = Slice-level multithreading\n"
1052 " ...X = Codec is experimental\n"
1054 encoder ?
"Encoders" :
"Decoders");
1065 if (strcmp(codec->
name, desc->
name))
1066 printf(
" (codec %s)", desc->
name);
1085 int show_bsfs(
void *optctx,
const char *opt,
const char *arg)
1089 printf(
"Bitstream filters:\n");
1091 printf(
"%s\n", bsf->
name);
1098 void *opaque =
NULL;
1101 printf(
"Supported file protocols:\n"
1104 printf(
"%s\n", name);
1105 printf(
"Output:\n");
1107 printf(
"%s\n", name);
1115 printf(
"Filters:\n");
1118 printf(
"%-16s %s\n", (*filter)->name, (*filter)->description);
1127 printf(
"Pixel formats:\n"
1128 "I.... = Supported Input format for conversion\n"
1129 ".O... = Supported Output format for conversion\n"
1130 "..H.. = Hardware accelerated format\n"
1131 "...P. = Paletted format\n"
1132 "....B = Bitstream format\n"
1133 "FLAGS NAME NB_COMPONENTS BITS_PER_PIXEL\n"
1137 # define sws_isSupportedInput(x) 0
1138 # define sws_isSupportedOutput(x) 0
1143 printf(
"%c%c%c%c%c %-16s %d %2d\n",
1190 "but no %s for it are available. Libav might need to be "
1191 "recompiled with additional external libraries.\n",
1192 name, encoder ?
"encoders" :
"decoders");
1212 printf(
" Common extensions: %s.\n", fmt->
extensions);
1231 printf(
" Common extensions: %s.\n", fmt->
extensions);
1233 printf(
" Mime type: %s.\n", fmt->
mime_type);
1236 printf(
" Default video codec: %s.\n", desc->
name);
1240 printf(
" Default audio codec: %s.\n", desc->
name);
1244 printf(
" Default subtitle codec: %s.\n", desc->
name);
1251 int show_help(
void *optctx,
const char *opt,
const char *arg)
1257 par = strchr(topic,
'=');
1263 }
else if (!strcmp(topic,
"decoder")) {
1265 }
else if (!strcmp(topic,
"encoder")) {
1267 }
else if (!strcmp(topic,
"demuxer")) {
1269 }
else if (!strcmp(topic,
"muxer")) {
1282 int yesno = (toupper(c) ==
'Y');
1284 while (c !=
'\n' && c != EOF)
1293 FILE *f = fopen(filename,
"rb");
1300 fseek(f, 0, SEEK_END);
1302 fseek(f, 0, SEEK_SET);
1309 ret = fread(*bufptr, 1, *size, f);
1314 filename, strerror(errno));
1320 (*bufptr)[(*size)++] =
'\0';
1348 pts = reordered_pts;
1356 const char *preset_name,
int is_path,
1357 const char *codec_name)
1361 const char *base[3] = { getenv(
"AVCONV_DATADIR"),
1366 av_strlcpy(filename, preset_name, filename_size);
1367 f = fopen(filename,
"r");
1369 for (i = 0; i < 3 && !f; i++) {
1372 snprintf(filename, filename_size,
"%s%s/%s.avpreset", base[i],
1373 i != 1 ?
"" :
"/.avconv", preset_name);
1374 f = fopen(filename,
"r");
1375 if (!f && codec_name) {
1376 snprintf(filename, filename_size,
1377 "%s%s/%s-%s.avpreset",
1378 base[i], i != 1 ?
"" :
"/.avconv", codec_name,
1380 f = fopen(filename,
"r");
1390 if (*spec <= '9' && *spec >=
'0')
1391 return strtol(spec,
NULL, 0) == st->
index;
1392 else if (*spec ==
'v' || *spec ==
'a' || *spec ==
's' || *spec ==
'd' ||
1406 if (*spec++ ==
':') {
1410 return i == st->
index;
1414 }
else if (*spec ==
'p' && *(spec + 1) ==
':') {
1418 prog_id = strtol(spec, &endptr, 0);
1423 if (*endptr++ ==
':') {
1424 int stream_idx = strtol(endptr,
NULL, 0);
1425 return stream_idx >= 0 &&
1458 switch (codec->
type) {
1474 char *p = strchr(t->
key,
':');
1479 case 1: *p = 0;
break;
1481 default:
return NULL;
1489 else if (t->
key[0] == prefix &&
1511 "Could not alloc memory for stream options.\n");
1522 if (new_size >= INT_MAX / elem_size) {
1526 if (*size < new_size) {
1532 memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size);
1545 int h_chroma_shift, v_chroma_shift;
1573 memset(buf->
base[0], 128, ret);
1576 &h_chroma_shift, &v_chroma_shift);
1579 const int h_shift = i==0 ? 0 : h_chroma_shift;
1580 const int v_shift = i==0 ? 0 : v_chroma_shift;
1583 else if (buf->
base[i])
1586 (pixel_size*edge >> h_shift), 32);
int parse_optgroup(void *optctx, OptionGroup *g)
Parse an options group and write results into optctx.
Number of sample formats. DO NOT USE if linking dynamically.
int64_t num_faulty_dts
Number of incorrect PTS values so far.
void * av_malloc(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
This structure describes decoded (raw) audio or video data.
int show_decoders(void *optctx, const char *opt, const char *arg)
Print a listing containing all the decoders supported by the program.
AVCodec * avcodec_find_encoder(enum AVCodecID id)
Find a registered encoder with a matching codec ID.
const char * name
< group name
static void finish_group(OptionParseContext *octx, int group_idx, const char *arg)
int show_license(void *optctx, const char *opt, const char *arg)
Print the license of the program to stdout.
void sws_freeContext(struct SwsContext *swsContext)
Free the swscaler context swsContext.
int(* func_arg)(void *, const char *, const char *)
int av_parse_time(int64_t *timeval, const char *timestr, int duration)
Parse timestr and return in *time a corresponding number of microseconds.
int av_image_alloc(uint8_t *pointers[4], int linesizes[4], int w, int h, enum AVPixelFormat pix_fmt, int align)
Allocate an image with size w and h and pixel format pix_fmt, and fill pointers and linesizes accordi...
int split_commandline(OptionParseContext *octx, int argc, char *argv[], const OptionDef *options, const OptionGroupDef *groups, int nb_groups)
Split the commandline into an intermediate form convenient for further processing.
void show_banner(void)
Print the program banner to stderr.
int av_get_bits_per_pixel(const AVPixFmtDescriptor *pixdesc)
Return the number of bits per pixel used by the pixel format described by pixdesc.
const AVClass * av_opt_child_class_next(const AVClass *parent, const AVClass *prev)
Iterate over potential AVOptions-enabled children of parent.
int opt_loglevel(void *optctx, const char *opt, const char *arg)
Set the libav* libraries log level.
int check_stream_specifier(AVFormatContext *s, AVStream *st, const char *spec)
Check if the given stream matches a stream specifier.
void * opaque
for some private data of the user
int index
stream index in AVFormatContext
void * priv
private data to be used by a custom free function
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
int show_protocols(void *optctx, const char *opt, const char *arg)
Print a listing containing all the protocols supported by the program.
const char * sep
Option to be used as group separator.
#define GET_CH_LAYOUT_DESC(ch_layout)
A reference-counted buffer data type used by the filter system.
int64_t last_pts
Number of incorrect DTS values so far.
int show_formats(void *optctx, const char *opt, const char *arg)
Print a listing containing all the formats supported by the program.
void av_log_set_callback(void(*callback)(void *, int, const char *, va_list))
AVDictionaryEntry * av_dict_get(AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags)
Get a dictionary entry with matching key.
#define AV_OPT_FLAG_AUDIO_PARAM
const AVClass * sws_get_class(void)
Get the AVClass for swsContext.
int show_pix_fmts(void *optctx, const char *opt, const char *arg)
Print a listing containing all the pixel formats supported by the program.
AVDictionary * filter_codec_opts(AVDictionary *opts, enum AVCodecID codec_id, AVFormatContext *s, AVStream *st, AVCodec *codec)
Filter out options for given codec.
void init_pts_correction(PtsCorrectionContext *ctx)
Reset the state of the PtsCorrectionContext.
void av_freep(void *arg)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc() and set the pointer ...
void uninit_parse_context(OptionParseContext *octx)
Free all allocated memory in an OptionParseContext.
int av_codec_is_decoder(const AVCodec *codec)
const AVCodecDescriptor * avcodec_descriptor_next(const AVCodecDescriptor *prev)
Iterate over all codec descriptors known to libavcodec.
#define AV_OPT_SEARCH_FAKE_OBJ
const AVClass * avcodec_get_class(void)
Get the AVClass for AVCodecContext.
int av_codec_is_encoder(const AVCodec *codec)
unsigned int nb_stream_indexes
void avcodec_align_dimensions(AVCodecContext *s, int *width, int *height)
Modify width and height values so that they will result in a memory buffer that is acceptable for the...
#define av_assert0(cond)
assert() equivalent, that is always enabled.
int show_codecs(void *optctx, const char *opt, const char *arg)
Print a listing containing all the codecs supported by the program.
static int decode(MimicContext *ctx, int quality, int num_coeffs, int is_iframe)
#define AV_OPT_FLAG_VIDEO_PARAM
struct FrameBuffer * next
AVComponentDescriptor comp[4]
Parameters that describe how pixels are packed.
void log_callback_help(void *ptr, int level, const char *fmt, va_list vl)
Trivial log callback.
Opaque data information usually continuous.
int opt_default(void *optctx, const char *opt, const char *arg)
Fallback for options that are not explicitly handled, these will be parsed through AVOptions...
void filter_release_buffer(AVFilterBuffer *fb)
A callback to be used for AVFilterBuffer.free.
static void init_parse_context(OptionParseContext *octx, const OptionGroupDef *groups, int nb_groups)
void init_opts(void)
Initialize the cmdutils option system, in particular allocate the *_opts contexts.
void parse_options(void *optctx, int argc, char **argv, const OptionDef *options, void(*parse_arg_function)(void *, const char *))
static void print_all_libs_info(int flags, int level)
const AVClass * avformat_get_class(void)
Get the AVClass for AVFormatContext.
void parse_loglevel(int argc, char **argv, const OptionDef *options)
Find the '-loglevel' option in the command line args and apply it.
external api for the swscale stuff
void show_help_options(const OptionDef *options, const char *msg, int req_flags, int rej_flags, int alt_flags)
Print help for all options matching specified flags.
static void print_codecs(int encoder)
unsigned int * stream_index
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 codec_get_buffer(AVCodecContext *s, AVFrame *frame)
Get a frame from the pool.
#define AV_OPT_SEARCH_CHILDREN
struct AVOutputFormat * oformat
AVDictionary ** setup_find_stream_info_opts(AVFormatContext *s, AVDictionary *codec_opts)
Setup AVCodecContext options for avformat_find_stream_info().
static int alloc_buffer(FrameBuffer **pool, AVCodecContext *s, FrameBuffer **pbuf)
AVCodec * avcodec_find_encoder_by_name(const char *name)
Find a registered encoder with the specified name.
AVDictionary * format_opts
int show_help(void *optctx, const char *opt, const char *arg)
Generic -h handler common to all avtools.
Main libavdevice API header.
struct SwsContext * sws_getContext(int srcW, int srcH, enum AVPixelFormat srcFormat, int dstW, int dstH, enum AVPixelFormat dstFormat, int flags, SwsFilter *srcFilter, SwsFilter *dstFilter, const double *param)
Allocate and return an SwsContext.
void show_help_default(const char *opt, const char *arg)
Per-avtool specific help handler.
AVCodecID
Identify the syntax and semantics of the bitstream.
#define AV_CODEC_PROP_LOSSY
void av_free(void *ptr)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc(). ...
#define AV_OPT_FLAG_SUBTITLE_PARAM
int show_sample_fmts(void *optctx, const char *opt, const char *arg)
Print a listing containing all the sample formats supported by the program.
#define sws_isSupportedOutput(x)
AVCodec * av_codec_next(const AVCodec *c)
If c is NULL, returns the first registered codec, if c is non-NULL, returns the next registered codec...
int av_pix_fmt_get_chroma_sub_sample(enum AVPixelFormat pix_fmt, int *h_shift, int *v_shift)
Utility function to access log2_chroma_w log2_chroma_h from the pixel format AVPixFmtDescriptor.
int capabilities
Codec capabilities.
uint8_t * base[AV_NUM_DATA_POINTERS]
pointer to the first allocated byte of the picture.
void av_dict_free(AVDictionary **pm)
Free all the memory allocated for an AVDictionary struct and all keys and values. ...
static void show_help_muxer(const char *name)
int parse_option(void *optctx, const char *opt, const char *arg, const OptionDef *options)
Parse one given option.
simple assert() macros that are a bit more flexible than ISO C assert().
#define PRINT_CODEC_SUPPORTED(codec, field, type, list_name, term, get_name)
#define PIX_FMT_PAL
Pixel format has a palette in data[1], values are indexes in this palette.
void av_log(void *avcl, int level, const char *fmt,...)
AVBitStreamFilter * av_bitstream_filter_next(AVBitStreamFilter *f)
const char * name
Name of the codec implementation.
#define CODEC_FLAG_EMU_EDGE
void av_log_set_level(int level)
const char * long_name
A more descriptive name for this codec.
#define LIBAV_CONFIGURATION
int show_filters(void *optctx, const char *opt, const char *arg)
Print a listing containing all the filters supported by the program.
size_t av_strlcpy(char *dst, const char *src, size_t size)
Copy the string src to dst, but no more than size - 1 bytes, and null-terminate dst.
const AVCodecDescriptor * avcodec_descriptor_get(enum AVCodecID id)
static const OptionDef * find_option(const OptionDef *po, const char *name)
int64_t guess_correct_pts(PtsCorrectionContext *ctx, int64_t reordered_pts, int64_t dts)
Attempt to guess proper monotonic timestamps for decoded video frames which might have incorrect time...
AVCodecContext * codec
Codec context associated with this stream.
int props
Codec properties, a combination of AV_CODEC_PROP_* flags.
const AVOption * av_opt_find(void *obj, const char *name, const char *unit, int opt_flags, int search_flags)
Look for an option in an object.
void free_buffer_pool(FrameBuffer **pool)
Free all the buffers in the pool.
static void filter(MpegAudioContext *s, int ch, const short *samples, int incr)
unsigned int nb_streams
A list of all streams in the file.
static void unref_buffer(FrameBuffer *buf)
enum AVPixelFormat pix_fmt
enum AVPixelFormat av_pix_fmt_desc_get_id(const AVPixFmtDescriptor *desc)
AVInputFormat * av_find_input_format(const char *short_name)
Find AVInputFormat based on the short name of the input format.
uint8_t nb_components
The number of components each pixel has, (1-4)
int show_bsfs(void *optctx, const char *opt, const char *arg)
Print a listing containing all the bit stream filters supported by the program.
int width
picture width / height.
int type
type of the buffer (to keep track of who has to deallocate data[*])
static void print_codecs_for_id(enum AVCodecID id, int encoder)
#define CODEC_CAP_FRAME_THREADS
const char * avio_enum_protocols(void **opaque, int output)
Iterate through names of available protocols.
#define GET_PIX_FMT_NAME(pix_fmt)
const OptionGroupDef * group_def
A list of option groups that all have the same group type (e.g.
#define CODEC_CAP_EXPERIMENTAL
#define PIX_FMT_BITSTREAM
All values of a component are bit-wise packed end to end.
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...
#define sws_isSupportedInput(x)
static const OptionGroupDef groups[]
AVFilter ** av_filter_next(AVFilter **filter)
If filter is NULL, returns a pointer to the first registered filter pointer, if filter is non-NULL...
Opaque data information usually sparse.
enum AVPixelFormat pix_fmt
int opt_timelimit(void *optctx, const char *opt, const char *arg)
Limit the execution time.
const AVCodecDescriptor * avcodec_descriptor_get_by_name(const char *name)
#define AV_OPT_FLAG_ENCODING_PARAM
#define AV_CODEC_PROP_LOSSLESS
AVOutputFormat * av_oformat_next(AVOutputFormat *f)
If f is NULL, returns the first registered output format, if f is non-NULL, returns the next register...
#define AV_CODEC_PROP_INTRA_ONLY
static char get_media_type_char(enum AVMediaType type)
double av_strtod(const char *numstr, char **tail)
Parse the string in numstr and return its value as a double.
#define GET_SAMPLE_RATE_NAME(rate)
#define PIX_FMT_HWACCEL
Pixel format is an HW accelerated format.
const char * long_name
Descriptive name for the codec, meant to be more human readable than name.
static const AVCodec * next_codec_for_id(enum AVCodecID id, const AVCodec *prev, int encoder)
enum AVMediaType codec_type
const AVRational * supported_framerates
array of supported framerates, or NULL if any, array is terminated by {0,0}
char * av_strdup(const char *s)
Duplicate the string s.
int linesize[AV_NUM_DATA_POINTERS]
Size, in bytes, of the data for each picture/channel plane.
int av_opt_show2(void *obj, void *av_log_obj, int req_flags, int rej_flags)
Show the obj options.
#define AV_OPT_FLAG_DECODING_PARAM
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
struct FrameBuffer ** pool
head of the buffer pool
main external API structure.
AVCodec * avcodec_find_decoder(enum AVCodecID id)
Find a registered decoder with a matching codec ID.
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...
const int program_birth_year
program birth year, defined by the program for show_banner()
#define AV_DICT_IGNORE_SUFFIX
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)
Set the given entry in *pm, overwriting an existing entry.
FILE * get_preset_file(char *filename, size_t filename_size, const char *preset_name, int is_path, const char *codec_name)
Get a file corresponding to a preset file.
const OptionGroupDef * group_def
#define PRINT_LIB_INFO(libname, LIBNAME, flags, level)
Describe the class of an AVClass context structure.
#define FF_ARRAY_ELEMS(a)
rational number numerator/denominator
const char program_name[]
program name, defined by the program for show_version().
static OutputContext octx
int64_t parse_time_or_die(const char *context, const char *timestr, int is_duration)
Parse a string specifying a time and return its corresponding value as a number of microseconds...
void * grow_array(void *array, int elem_size, int *size, int new_size)
Realloc array to hold new_size elements of elem_size.
struct SwsContext * sws_opts
uint16_t step_minus1
Number of elements between 2 horizontally consecutive pixels minus 1.
const char * name
Name of the codec described by this descriptor.
int64_t last_dts
PTS of the last frame.
static void print_codec(const AVCodec *c)
#define FF_BUFFER_TYPE_USER
size_t av_strlcat(char *dst, const char *src, size_t size)
Append the string src to the string dst, but to a total length of no more than size - 1 bytes...
#define CODEC_CAP_SLICE_THREADS
This struct describes the properties of a single codec described by an AVCodecID. ...
double parse_number_or_die(const char *context, const char *numstr, int type, double min, double max)
Parse a string and return its corresponding value as a double.
int cmdutils_read_file(const char *filename, char **bufptr, size_t *size)
Read the file with name filename, and put its content in a newly allocated 0-terminated buffer...
AVCodec * avcodec_find_decoder_by_name(const char *name)
Find a registered decoder with the specified name.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
const AVClass * priv_class
AVClass for the private context.
static int match_group_separator(const OptionGroupDef *groups, int nb_groups, const char *opt)
int av_strerror(int errnum, char *errbuf, size_t errbuf_size)
Put a description of the AVERROR code errnum in errbuf.
const OptionDef options[]
An option extracted from the commandline.
void print_error(const char *filename, int err)
Print an error message to stderr, indicating filename and a human readable description of the error c...
static const int this_year
AVDictionary * codec_opts
AVDictionary * format_opts
void * av_realloc(void *ptr, size_t size)
Allocate or reallocate a block of memory.
AVSampleFormat
Audio Sample Formats.
void uninit_opts(void)
Uninitialize the cmdutils option system, in particular free the *_opts contexts and their contents...
AVInputFormat * av_iformat_next(AVInputFormat *f)
If f is NULL, returns the first registered input format, if f is non-NULL, returns the next registere...
#define AVERROR_OPTION_NOT_FOUND
#define GROW_ARRAY(array, nb_elems)
static void prepare_app_arguments(int *argc_ptr, char ***argv_ptr)
static int write_option(void *optctx, const OptionDef *po, const char *opt, const char *arg)
void show_help_children(const AVClass *class, int flags)
Show help for all options with given flags in class and all its children.
AVDictionary * codec_opts
int read_yesno(void)
Return a positive value if a line read from standard input starts with [yY], otherwise return 0...
static void show_help_demuxer(const char *name)
void codec_release_buffer(AVCodecContext *s, AVFrame *frame)
A callback to be used for AVCodecContext.release_buffer along with codec_get_buffer().
int show_version(void *optctx, const char *opt, const char *arg)
Print the version of the program to stdout.
uint8_t ** extended_data
pointers to the data planes/channels.
struct SwsContext * sws_opts
AVPixelFormat
Pixel format.
int av_opt_set(void *obj, const char *name, const char *val, int search_flags)
void * av_mallocz(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
void * opaque
Private data of the user, can be used to carry app specific stuff.
static void show_help_codec(const char *name, int encoder)
int show_encoders(void *optctx, const char *opt, const char *arg)
Print a listing containing all the encoders supported by the program.
simple arithmetic expression evaluator
const AVPixFmtDescriptor * av_pix_fmt_desc_next(const AVPixFmtDescriptor *prev)
Iterate over all pixel format descriptors known to libavutil.
static void add_opt(OptionParseContext *octx, const OptionDef *opt, const char *key, const char *val)