#include "libavformat/avformat.h"
#include "libavfilter/avfilter.h"
#include "libavdevice/avdevice.h"
+#include "libavresample/avresample.h"
#include "libswscale/swscale.h"
-#if CONFIG_POSTPROC
-#include "libpostproc/postprocess.h"
-#endif
#include "libavutil/avstring.h"
#include "libavutil/mathematics.h"
#include "libavutil/parseutils.h"
struct SwsContext *sws_opts;
AVDictionary *format_opts, *codec_opts;
-static const int this_year = 2011;
+static const int this_year = 2012;
void init_opts(void)
{
}
}
-/*
- * 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;
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, \
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);
-#if CONFIG_POSTPROC
- PRINT_LIB_INFO(postproc, POSTPROC, flags, level);
-#endif
}
void show_banner(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;
}
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");
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) {