X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=cmdutils.c;h=3cd11ca24123c550fe4b52bcb68c12ca3c5c98ca;hb=ac71230902af1a8ebc7abf85143139ffb49838eb;hp=985931cce66fbdb66356146a195bd3c005fcf098;hpb=b315042c8ce984bec431c5965120853a843cbfa5;p=ffmpeg diff --git a/cmdutils.c b/cmdutils.c index 985931cce66..3cd11ca2412 100644 --- a/cmdutils.c +++ b/cmdutils.c @@ -32,6 +32,7 @@ #include "libavformat/avformat.h" #include "libavfilter/avfilter.h" #include "libavdevice/avdevice.h" +#include "libavresample/avresample.h" #include "libswscale/swscale.h" #include "libavutil/avstring.h" #include "libavutil/mathematics.h" @@ -320,11 +321,8 @@ void parse_options(void *optctx, int argc, char **argv, const OptionDef *options } } -/* - * Return index of option opt in argv or 0 if not found. - */ -static int locate_option(int argc, char **argv, const OptionDef *options, - const char *optname) +int locate_option(int argc, char **argv, const OptionDef *options, + const char *optname) { const OptionDef *po; int i; @@ -463,7 +461,8 @@ static int warned_cfg = 0; const char *indent = flags & INDENT? " " : ""; \ if (flags & SHOW_VERSION) { \ unsigned int version = libname##_version(); \ - av_log(NULL, level, "%slib%-9s %2d.%3d.%2d / %2d.%3d.%2d\n",\ + av_log(NULL, level, \ + "%slib%-10s %2d.%3d.%2d / %2d.%3d.%2d\n", \ indent, #libname, \ LIB##LIBNAME##_VERSION_MAJOR, \ LIB##LIBNAME##_VERSION_MINOR, \ @@ -492,6 +491,7 @@ static void print_all_libs_info(int flags, int level) PRINT_LIB_INFO(avformat, AVFORMAT, flags, level); PRINT_LIB_INFO(avdevice, AVDEVICE, flags, level); PRINT_LIB_INFO(avfilter, AVFILTER, flags, level); + PRINT_LIB_INFO(avresample, AVRESAMPLE, flags, level); PRINT_LIB_INFO(swscale, SWSCALE, flags, level); } @@ -658,9 +658,9 @@ void show_codecs(void) decode = encode = cap = 0; } if (p2 && strcmp(p->name, p2->name) == 0) { - if (p->decode) + if (av_codec_is_decoder(p)) decode = 1; - if (p->encode) + if (av_codec_is_encoder(p)) encode = 1; cap |= p->capabilities; } @@ -875,12 +875,12 @@ FILE *get_preset_file(char *filename, size_t filename_size, for (i = 0; i < 3 && !f; i++) { if (!base[i]) continue; - snprintf(filename, filename_size, "%s%s/%s.ffpreset", base[i], + snprintf(filename, filename_size, "%s%s/%s.avpreset", base[i], i != 1 ? "" : "/.avconv", preset_name); f = fopen(filename, "r"); if (!f && codec_name) { snprintf(filename, filename_size, - "%s%s/%s-%s.ffpreset", + "%s%s/%s-%s.avpreset", base[i], i != 1 ? "" : "/.avconv", codec_name, preset_name); f = fopen(filename, "r"); @@ -1021,72 +1021,6 @@ AVDictionary **setup_find_stream_info_opts(AVFormatContext *s, return opts; } -#if CONFIG_AVFILTER - -static int sink_init(AVFilterContext *ctx, const char *args, void *opaque) -{ - SinkContext *priv = ctx->priv; - - if (!opaque) - return AVERROR(EINVAL); - *priv = *(SinkContext *)opaque; - - return 0; -} - -static void null_end_frame(AVFilterLink *inlink) { } - -static int sink_query_formats(AVFilterContext *ctx) -{ - SinkContext *priv = ctx->priv; - enum PixelFormat pix_fmts[] = { priv->pix_fmt, PIX_FMT_NONE }; - - avfilter_set_common_formats(ctx, avfilter_make_format_list(pix_fmts)); - return 0; -} - -AVFilter sink = { - .name = "sink", - .priv_size = sizeof(SinkContext), - .init = sink_init, - - .query_formats = sink_query_formats, - - .inputs = (AVFilterPad[]) {{ .name = "default", - .type = AVMEDIA_TYPE_VIDEO, - .end_frame = null_end_frame, - .min_perms = AV_PERM_READ, }, - { .name = NULL }}, - .outputs = (AVFilterPad[]) {{ .name = NULL }}, -}; - -int get_filtered_video_frame(AVFilterContext *ctx, AVFrame *frame, - AVFilterBufferRef **picref_ptr, AVRational *tb) -{ - int ret; - AVFilterBufferRef *picref; - - if ((ret = avfilter_request_frame(ctx->inputs[0])) < 0) - return ret; - if (!(picref = ctx->inputs[0]->cur_buf)) - return AVERROR(ENOENT); - *picref_ptr = picref; - ctx->inputs[0]->cur_buf = NULL; - *tb = ctx->inputs[0]->time_base; - - memcpy(frame->data, picref->data, sizeof(frame->data)); - memcpy(frame->linesize, picref->linesize, sizeof(frame->linesize)); - frame->interlaced_frame = picref->video->interlaced; - frame->top_field_first = picref->video->top_field_first; - frame->key_frame = picref->video->key_frame; - frame->pict_type = picref->video->pict_type; - frame->sample_aspect_ratio = picref->video->pixel_aspect; - - return 1; -} - -#endif /* CONFIG_AVFILTER */ - void *grow_array(void *array, int elem_size, int *size, int new_size) { if (new_size >= INT_MAX / elem_size) {