diff options
author | Reynaldo H. Verdejo Pinochet <reynaldo@osg.samsung.com> | 2014-12-06 02:38:30 +0300 |
---|---|---|
committer | Reynaldo H. Verdejo Pinochet <reynaldo@osg.samsung.com> | 2014-12-06 08:24:53 +0300 |
commit | da95fe4ef81c120de0bf566c1881bec89f8f086f (patch) | |
tree | 6f73c7d7e293ef9537e38d6ac6f3c81cdc0cce9b /ffserver_config.c | |
parent | 4a27f05d1450e2de5b537e8889b737a5a4b4e432 (diff) |
ffserver_config: reflow _parse_ffconfig()
Signed-off-by: Reynaldo H. Verdejo Pinochet <reynaldo@osg.samsung.com>
Diffstat (limited to 'ffserver_config.c')
-rw-r--r-- | ffserver_config.c | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/ffserver_config.c b/ffserver_config.c index 8ea86aabcc..1e79a5d920 100644 --- a/ffserver_config.c +++ b/ffserver_config.c @@ -1157,7 +1157,6 @@ int ffserver_parse_ffconfig(const char *filename, FFServerConfig *config) av_assert0(config); - config->line_num = 0; f = fopen(filename, "r"); if (!f) { ret = AVERROR(errno); @@ -1167,14 +1166,14 @@ int ffserver_parse_ffconfig(const char *filename, FFServerConfig *config) } config->first_stream = NULL; - last_stream = &config->first_stream; config->first_feed = NULL; - last_feed = &config->first_feed; config->errors = config->warnings = 0; - for(;;) { - if (fgets(line, sizeof(line), f) == NULL) - break; + last_stream = &config->first_stream; + last_feed = &config->first_feed; + + config->line_num = 0; + while (fgets(line, sizeof(line), f) != NULL) { config->line_num++; p = line; while (av_isspace(*p)) @@ -1189,14 +1188,14 @@ int ffserver_parse_ffconfig(const char *filename, FFServerConfig *config) if (opening && (stream || feed || redirect)) { ERROR("Already in a tag\n"); } else { - if ((ret = ffserver_parse_config_feed(config, cmd, &p, &feed)) < 0) + ret = ffserver_parse_config_feed(config, cmd, &p, &feed); + if (ret < 0) break; if (opening) { - /* add in stream list */ + /* add in stream & feed list */ *last_stream = feed; - last_stream = &feed->next; - /* add in feed list */ *last_feed = feed; + last_stream = &feed->next; last_feed = &feed->next_feed; } } @@ -1205,7 +1204,8 @@ int ffserver_parse_ffconfig(const char *filename, FFServerConfig *config) if (opening && (stream || feed || redirect)) { ERROR("Already in a tag\n"); } else { - if ((ret = ffserver_parse_config_stream(config, cmd, &p, &stream)) < 0) + ret = ffserver_parse_config_stream(config, cmd, &p, &stream); + if (ret < 0) break; if (opening) { /* add in stream list */ @@ -1218,7 +1218,9 @@ int ffserver_parse_ffconfig(const char *filename, FFServerConfig *config) if (opening && (stream || feed || redirect)) ERROR("Already in a tag\n"); else { - if ((ret = ffserver_parse_config_redirect(config, cmd, &p, &redirect)) < 0) + ret = ffserver_parse_config_redirect(config, cmd, &p, + &redirect); + if (ret < 0) break; if (opening) { /* add in stream list */ |