#include "libavformat/network.h"
#endif
#if HAVE_SYS_RESOURCE_H
+#include <sys/time.h>
#include <sys/resource.h>
#endif
const AVOption *o;
char opt_stripped[128];
const char *p;
- const AVClass *cc = avcodec_get_class(), *fc = avformat_get_class(), *sc = sws_get_class();
+ const AVClass *cc = avcodec_get_class(), *fc = avformat_get_class();
+#if CONFIG_SWSCALE
+ const AVClass *sc = sws_get_class();
+#endif
if (!(p = strchr(opt, ':')))
p = opt + strlen(opt);
else if ((o = av_opt_find(&fc, opt, NULL, 0,
AV_OPT_SEARCH_CHILDREN | AV_OPT_SEARCH_FAKE_OBJ)))
av_dict_set(&format_opts, opt, arg, FLAGS);
+#if CONFIG_SWSCALE
else if ((o = av_opt_find(&sc, opt, NULL, 0,
AV_OPT_SEARCH_CHILDREN | AV_OPT_SEARCH_FAKE_OBJ))) {
// XXX we only support sws_flags, not arbitrary sws options
return ret;
}
}
+#endif
if (o)
return 0;
int show_pix_fmts(void *optctx, const char *opt, const char *arg)
{
- enum AVPixelFormat pix_fmt;
+ const AVPixFmtDescriptor *pix_desc = NULL;
printf("Pixel formats:\n"
"I.... = Supported Input format for conversion\n"
# define sws_isSupportedOutput(x) 0
#endif
- for (pix_fmt = 0; pix_fmt < AV_PIX_FMT_NB; pix_fmt++) {
- const AVPixFmtDescriptor *pix_desc = &av_pix_fmt_descriptors[pix_fmt];
+ while ((pix_desc = av_pix_fmt_desc_next(pix_desc))) {
+ enum AVPixelFormat pix_fmt = av_pix_fmt_desc_get_id(pix_desc);
printf("%c%c%c%c%c %-16s %d %2d\n",
sws_isSupportedInput (pix_fmt) ? 'I' : '.',
sws_isSupportedOutput(pix_fmt) ? 'O' : '.',
ret = AVERROR_EOF;
} else {
ret = 0;
- (*bufptr)[*size++] = '\0';
+ (*bufptr)[(*size)++] = '\0';
}
fclose(f);
static int alloc_buffer(FrameBuffer **pool, AVCodecContext *s, FrameBuffer **pbuf)
{
- FrameBuffer *buf = av_mallocz(sizeof(*buf));
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->pix_fmt);
+ FrameBuffer *buf;
int i, ret;
- const int pixel_size = av_pix_fmt_descriptors[s->pix_fmt].comp[0].step_minus1+1;
+ int pixel_size;
int h_chroma_shift, v_chroma_shift;
int edge = 32; // XXX should be avcodec_get_edge_width(), but that fails on svq1
int w = s->width, h = s->height;
+ if (!desc)
+ return AVERROR(EINVAL);
+ pixel_size = desc->comp[0].step_minus1 + 1;
+
+ buf = av_mallocz(sizeof(*buf));
if (!buf)
return AVERROR(ENOMEM);