Commit 5edab1d2 authored by Michael Niedermayer's avatar Michael Niedermayer

cmdutils: remove sws_opts usage, simplify code

It has become unused as all code was switched to AVDictionary
Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 408c9cf0
...@@ -63,7 +63,6 @@ ...@@ -63,7 +63,6 @@
static int init_report(const char *env); static int init_report(const char *env);
struct SwsContext *sws_opts;
AVDictionary *sws_dict; AVDictionary *sws_dict;
AVDictionary *swr_opts; AVDictionary *swr_opts;
AVDictionary *format_opts, *codec_opts, *resample_opts; AVDictionary *format_opts, *codec_opts, *resample_opts;
...@@ -74,20 +73,11 @@ int hide_banner = 0; ...@@ -74,20 +73,11 @@ int hide_banner = 0;
void init_opts(void) void init_opts(void)
{ {
if(CONFIG_SWSCALE)
sws_opts = sws_getContext(16, 16, 0, 16, 16, 0, SWS_BICUBIC,
NULL, NULL, NULL);
av_dict_set(&sws_dict, "flags", "bicubic", 0); av_dict_set(&sws_dict, "flags", "bicubic", 0);
} }
void uninit_opts(void) void uninit_opts(void)
{ {
#if CONFIG_SWSCALE
sws_freeContext(sws_opts);
sws_opts = NULL;
#endif
av_dict_free(&swr_opts); av_dict_free(&swr_opts);
av_dict_free(&sws_dict); av_dict_free(&sws_dict);
av_dict_free(&format_opts); av_dict_free(&format_opts);
...@@ -577,11 +567,6 @@ int opt_default(void *optctx, const char *opt, const char *arg) ...@@ -577,11 +567,6 @@ int opt_default(void *optctx, const char *opt, const char *arg)
av_log(NULL, AV_LOG_ERROR, "Error setting option %s.\n", opt); av_log(NULL, AV_LOG_ERROR, "Error setting option %s.\n", opt);
return ret; return ret;
} }
ret = av_opt_set(sws_opts, opt, arg, 0);
if (ret < 0) {
av_log(NULL, AV_LOG_ERROR, "Error setting option %s for sws_opts.\n", opt);
return ret;
}
av_dict_set(&sws_dict, opt, arg, FLAGS); av_dict_set(&sws_dict, opt, arg, FLAGS);
...@@ -658,9 +643,6 @@ static void finish_group(OptionParseContext *octx, int group_idx, ...@@ -658,9 +643,6 @@ static void finish_group(OptionParseContext *octx, int group_idx,
*g = octx->cur_group; *g = octx->cur_group;
g->arg = arg; g->arg = arg;
g->group_def = l->group_def; g->group_def = l->group_def;
#if CONFIG_SWSCALE
g->sws_opts = sws_opts;
#endif
g->sws_dict = sws_dict; g->sws_dict = sws_dict;
g->swr_opts = swr_opts; g->swr_opts = swr_opts;
g->codec_opts = codec_opts; g->codec_opts = codec_opts;
...@@ -670,9 +652,6 @@ static void finish_group(OptionParseContext *octx, int group_idx, ...@@ -670,9 +652,6 @@ static void finish_group(OptionParseContext *octx, int group_idx,
codec_opts = NULL; codec_opts = NULL;
format_opts = NULL; format_opts = NULL;
resample_opts = NULL; resample_opts = NULL;
#if CONFIG_SWSCALE
sws_opts = NULL;
#endif
sws_dict = NULL; sws_dict = NULL;
swr_opts = NULL; swr_opts = NULL;
init_opts(); init_opts();
...@@ -729,9 +708,6 @@ void uninit_parse_context(OptionParseContext *octx) ...@@ -729,9 +708,6 @@ void uninit_parse_context(OptionParseContext *octx)
av_dict_free(&l->groups[j].codec_opts); av_dict_free(&l->groups[j].codec_opts);
av_dict_free(&l->groups[j].format_opts); av_dict_free(&l->groups[j].format_opts);
av_dict_free(&l->groups[j].resample_opts); av_dict_free(&l->groups[j].resample_opts);
#if CONFIG_SWSCALE
sws_freeContext(l->groups[j].sws_opts);
#endif
av_dict_free(&l->groups[j].sws_dict); av_dict_free(&l->groups[j].sws_dict);
av_dict_free(&l->groups[j].swr_opts); av_dict_free(&l->groups[j].swr_opts);
......
...@@ -46,7 +46,6 @@ extern const int program_birth_year; ...@@ -46,7 +46,6 @@ extern const int program_birth_year;
extern AVCodecContext *avcodec_opts[AVMEDIA_TYPE_NB]; extern AVCodecContext *avcodec_opts[AVMEDIA_TYPE_NB];
extern AVFormatContext *avformat_opts; extern AVFormatContext *avformat_opts;
extern struct SwsContext *sws_opts;
extern AVDictionary *sws_dict; extern AVDictionary *sws_dict;
extern AVDictionary *swr_opts; extern AVDictionary *swr_opts;
extern AVDictionary *format_opts, *codec_opts, *resample_opts; extern AVDictionary *format_opts, *codec_opts, *resample_opts;
...@@ -278,7 +277,6 @@ typedef struct OptionGroup { ...@@ -278,7 +277,6 @@ typedef struct OptionGroup {
AVDictionary *codec_opts; AVDictionary *codec_opts;
AVDictionary *format_opts; AVDictionary *format_opts;
AVDictionary *resample_opts; AVDictionary *resample_opts;
struct SwsContext *sws_opts;
AVDictionary *sws_dict; AVDictionary *sws_dict;
AVDictionary *swr_opts; AVDictionary *swr_opts;
} OptionGroup; } OptionGroup;
......
...@@ -102,7 +102,7 @@ const int program_birth_year = 2003; ...@@ -102,7 +102,7 @@ const int program_birth_year = 2003;
#define CURSOR_HIDE_DELAY 1000000 #define CURSOR_HIDE_DELAY 1000000
static int64_t sws_flags = SWS_BICUBIC; static unsigned sws_flags = SWS_BICUBIC;
typedef struct MyAVPacketList { typedef struct MyAVPacketList {
AVPacket pkt; AVPacket pkt;
...@@ -1677,7 +1677,18 @@ static int queue_picture(VideoState *is, AVFrame *src_frame, double pts, double ...@@ -1677,7 +1677,18 @@ static int queue_picture(VideoState *is, AVFrame *src_frame, double pts, double
av_picture_copy(&pict, (AVPicture *)src_frame, av_picture_copy(&pict, (AVPicture *)src_frame,
src_frame->format, vp->width, vp->height); src_frame->format, vp->width, vp->height);
#else #else
av_opt_get_int(sws_opts, "sws_flags", 0, &sws_flags); {
AVDictionaryEntry *e = av_dict_get(sws_dict, "sws_flags", NULL, 0);
if (e) {
const AVClass *class = sws_get_class();
const AVOption *o = av_opt_find(&class, "sws_flags", NULL, 0,
AV_OPT_SEARCH_FAKE_OBJ);
int ret = av_opt_eval_flags(&class, o, e->value, &sws_flags);
if (ret < 0)
exit(1);
}
}
is->img_convert_ctx = sws_getCachedContext(is->img_convert_ctx, is->img_convert_ctx = sws_getCachedContext(is->img_convert_ctx,
vp->width, vp->height, src_frame->format, vp->width, vp->height, vp->width, vp->height, src_frame->format, vp->width, vp->height,
AV_PIX_FMT_YUV420P, sws_flags, NULL, NULL, NULL); AV_PIX_FMT_YUV420P, sws_flags, NULL, NULL, NULL);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment