Commit 1a054bd1 authored by Lukasz Marek's avatar Lukasz Marek

ffserver_config: do not store preset name

Preset are translated to AVOptions.
It is not required to reparse anymore.

Fixes CID #1254667
Signed-off-by: 's avatarLukasz Marek <lukasz.m.luki2@gmail.com>
parent 33d6f90e
...@@ -1017,18 +1017,11 @@ static int ffserver_parse_config_stream(FFServerConfig *config, const char *cmd, ...@@ -1017,18 +1017,11 @@ static int ffserver_parse_config_stream(FFServerConfig *config, const char *cmd,
goto nomem; goto nomem;
} else if (!av_strcasecmp(cmd, "AVPresetVideo") || } else if (!av_strcasecmp(cmd, "AVPresetVideo") ||
!av_strcasecmp(cmd, "AVPresetAudio")) { !av_strcasecmp(cmd, "AVPresetAudio")) {
char **preset = NULL;
ffserver_get_arg(arg, sizeof(arg), p); ffserver_get_arg(arg, sizeof(arg), p);
if (!av_strcasecmp(cmd, "AVPresetVideo")) { if (!av_strcasecmp(cmd, "AVPresetVideo"))
preset = &config->video_preset;
ffserver_opt_preset(arg, config->dummy_vctx, config, line_num); ffserver_opt_preset(arg, config->dummy_vctx, config, line_num);
} else { else
preset = &config->audio_preset;
ffserver_opt_preset(arg, config->dummy_actx, config, line_num); ffserver_opt_preset(arg, config->dummy_actx, config, line_num);
}
*preset = av_strdup(arg);
if (!preset)
return AVERROR(ENOMEM);
} else if (!av_strcasecmp(cmd, "VideoTag")) { } else if (!av_strcasecmp(cmd, "VideoTag")) {
ffserver_get_arg(arg, sizeof(arg), p); ffserver_get_arg(arg, sizeof(arg), p);
if (strlen(arg) == 4) { if (strlen(arg) == 4) {
...@@ -1130,8 +1123,6 @@ static int ffserver_parse_config_stream(FFServerConfig *config, const char *cmd, ...@@ -1130,8 +1123,6 @@ static int ffserver_parse_config_stream(FFServerConfig *config, const char *cmd,
av_dict_free(&config->video_conf); av_dict_free(&config->video_conf);
av_dict_free(&config->audio_opts); av_dict_free(&config->audio_opts);
av_dict_free(&config->audio_conf); av_dict_free(&config->audio_conf);
av_freep(&config->video_preset);
av_freep(&config->audio_preset);
avcodec_free_context(&config->dummy_vctx); avcodec_free_context(&config->dummy_vctx);
avcodec_free_context(&config->dummy_actx); avcodec_free_context(&config->dummy_actx);
*pstream = NULL; *pstream = NULL;
...@@ -1148,8 +1139,6 @@ static int ffserver_parse_config_stream(FFServerConfig *config, const char *cmd, ...@@ -1148,8 +1139,6 @@ static int ffserver_parse_config_stream(FFServerConfig *config, const char *cmd,
av_dict_free(&config->video_conf); av_dict_free(&config->video_conf);
av_dict_free(&config->audio_opts); av_dict_free(&config->audio_opts);
av_dict_free(&config->audio_conf); av_dict_free(&config->audio_conf);
av_freep(&config->video_preset);
av_freep(&config->audio_preset);
avcodec_free_context(&config->dummy_vctx); avcodec_free_context(&config->dummy_vctx);
avcodec_free_context(&config->dummy_actx); avcodec_free_context(&config->dummy_actx);
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
......
...@@ -113,8 +113,6 @@ typedef struct FFServerConfig { ...@@ -113,8 +113,6 @@ typedef struct FFServerConfig {
AVDictionary *video_conf; /* Values stored in video AVCodecContext.fields */ AVDictionary *video_conf; /* Values stored in video AVCodecContext.fields */
AVDictionary *audio_opts; /* AVOptions for audio encoder */ AVDictionary *audio_opts; /* AVOptions for audio encoder */
AVDictionary *audio_conf; /* Values stored in audio AVCodecContext.fields */ AVDictionary *audio_conf; /* Values stored in audio AVCodecContext.fields */
char *video_preset;
char *audio_preset;
AVCodecContext *dummy_actx; /* Used internally to test audio AVOptions. */ AVCodecContext *dummy_actx; /* Used internally to test audio AVOptions. */
AVCodecContext *dummy_vctx; /* Used internally to test video AVOptions. */ AVCodecContext *dummy_vctx; /* Used internally to test video AVOptions. */
int no_audio; int no_audio;
......
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