Signed-off-by: Lukasz Marek <lukasz.m.lu...@gmail.com> --- ffserver_config.c | 80 +------------------------------------------------------ ffserver_config.h | 2 -- 2 files changed, 1 insertion(+), 81 deletions(-)
diff --git a/ffserver_config.c b/ffserver_config.c index f11db03..6989bd8 100644 --- a/ffserver_config.c +++ b/ffserver_config.c @@ -252,61 +252,6 @@ static enum AVCodecID opt_codec(const char *name, enum AVMediaType type) return codec->id; } -static int ffserver_opt_default(const char *opt, const char *arg, - AVCodecContext *avctx, int type) -{ - int ret = 0; - const AVOption *o = av_opt_find(avctx, opt, NULL, type, 0); - if(o) - ret = av_opt_set(avctx, opt, arg, 0); - return ret; -} - -static int ffserver_opt_preset(const char *arg, - AVCodecContext *avctx, int type, - enum AVCodecID *audio_id, enum AVCodecID *video_id) -{ - FILE *f=NULL; - char filename[1000], tmp[1000], tmp2[1000], line[1000]; - int ret = 0; - AVCodec *codec = NULL; - - if (avctx) - codec = avcodec_find_encoder(avctx->codec_id); - - if (!(f = get_preset_file(filename, sizeof(filename), arg, 0, - codec ? codec->name : NULL))) { - fprintf(stderr, "File for preset '%s' not found\n", arg); - return AVERROR(EINVAL); - } - - while(!feof(f)){ - int e= fscanf(f, "%999[^\n]\n", line) - 1; - if(line[0] == '#' && !e) - continue; - e|= sscanf(line, "%999[^=]=%999[^\n]\n", tmp, tmp2) - 2; - if(e){ - fprintf(stderr, "%s: Invalid syntax: '%s'\n", filename, line); - ret = AVERROR(EINVAL); - break; - } - if (audio_id && !strcmp(tmp, "acodec")) { - *audio_id = opt_codec(tmp2, AVMEDIA_TYPE_AUDIO); - } else if (video_id && !strcmp(tmp, "vcodec")){ - *video_id = opt_codec(tmp2, AVMEDIA_TYPE_VIDEO); - } else if(!strcmp(tmp, "scodec")) { - /* opt_subtitle_codec(tmp2); */ - } else if (avctx && (ret = ffserver_opt_default(tmp, tmp2, avctx, type)) < 0) { - fprintf(stderr, "%s: Invalid option or argument: '%s', parsed as '%s' = '%s'\n", filename, line, tmp, tmp2); - break; - } - } - - fclose(f); - - return ret; -} - static AVOutputFormat *ffserver_guess_format(const char *short_name, const char *filename, const char *mime_type) { AVOutputFormat *fmt = av_guess_format(short_name, filename, mime_type); @@ -867,18 +812,7 @@ static int ffserver_parse_config_stream(FFServerConfig *config, const char *cmd, goto nomem; } else if (!av_strcasecmp(cmd, "AVPresetVideo") || !av_strcasecmp(cmd, "AVPresetAudio")) { - char **preset = NULL; - ffserver_get_arg(arg, sizeof(arg), p); - if (!av_strcasecmp(cmd, "AVPresetVideo")) { - preset = &config->video_preset; - ffserver_opt_preset(arg, NULL, 0, NULL, &config->video_id); - } else { - preset = &config->audio_preset; - ffserver_opt_preset(arg, NULL, 0, &config->audio_id, NULL); - } - *preset = av_strdup(arg); - if (!preset) - return AVERROR(ENOMEM); + WARNING("Preset options have no effect, you should remove it\n"); } else if (!av_strcasecmp(cmd, "VideoTag")) { ffserver_get_arg(arg, sizeof(arg), p); if (strlen(arg) == 4) { @@ -953,20 +887,12 @@ static int ffserver_parse_config_stream(FFServerConfig *config, const char *cmd, if (stream->feed && stream->fmt && strcmp(stream->fmt->name, "ffm") != 0) { if (config->audio_id != AV_CODEC_ID_NONE) { AVCodecContext *audio_enc = avcodec_alloc_context3(avcodec_find_encoder(config->audio_id)); - if (config->audio_preset && - ffserver_opt_preset(arg, audio_enc, AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_ENCODING_PARAM, - NULL, NULL) < 0) - ERROR("Could not apply preset '%s'\n", arg); if (ffserver_apply_stream_config(audio_enc, config->audio_conf, &config->audio_opts) < 0) config->errors++; add_codec(stream, audio_enc); } if (config->video_id != AV_CODEC_ID_NONE) { AVCodecContext *video_enc = avcodec_alloc_context3(avcodec_find_encoder(config->video_id)); - if (config->video_preset && - ffserver_opt_preset(arg, video_enc, AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_ENCODING_PARAM, - NULL, NULL) < 0) - ERROR("Could not apply preset '%s'\n", arg); if (ffserver_apply_stream_config(video_enc, config->video_conf, &config->video_opts) < 0) config->errors++; add_codec(stream, video_enc); @@ -976,8 +902,6 @@ static int ffserver_parse_config_stream(FFServerConfig *config, const char *cmd, av_dict_free(&config->video_conf); av_dict_free(&config->audio_opts); av_dict_free(&config->audio_conf); - av_freep(&config->video_preset); - av_freep(&config->audio_preset); *pstream = NULL; } else if (!av_strcasecmp(cmd, "File") || !av_strcasecmp(cmd, "ReadOnlyFile")) { ffserver_get_arg(stream->feed_filename, sizeof(stream->feed_filename), p); @@ -991,8 +915,6 @@ static int ffserver_parse_config_stream(FFServerConfig *config, const char *cmd, av_dict_free(&config->video_conf); av_dict_free(&config->audio_opts); av_dict_free(&config->audio_conf); - av_freep(&config->video_preset); - av_freep(&config->audio_preset); return AVERROR(ENOMEM); } diff --git a/ffserver_config.h b/ffserver_config.h index ac75b06..f29f07f 100644 --- a/ffserver_config.h +++ b/ffserver_config.h @@ -113,8 +113,6 @@ typedef struct FFServerConfig { AVDictionary *video_conf; /* Values stored in video AVCodecContext.fields */ AVDictionary *audio_opts; /* AVOptions for audio encoder */ AVDictionary *audio_conf; /* Values stored in audio AVCodecContext.fields */ - char *video_preset; - char *audio_preset; } FFServerConfig; void ffserver_get_arg(char *buf, int buf_size, const char **pp); -- 1.9.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel