Commit 6db81e93 authored by Andreas Rheinhardt's avatar Andreas Rheinhardt

avformat/hlsenc: Simplify setting base_output_dirname

Signed-off-by: 's avatarAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
parent 21553d20
......@@ -2908,24 +2908,18 @@ static int hls_init(AVFormatContext *s)
return ret;
}
fmp4_init_filename_len = strlen(vs->m3u8_name) +
strlen(vs->fmp4_init_filename) + 1;
vs->base_output_dirname = av_malloc(fmp4_init_filename_len);
if (!vs->base_output_dirname)
return AVERROR(ENOMEM);
av_strlcpy(vs->base_output_dirname, vs->m3u8_name,
fmp4_init_filename_len);
p = strrchr(vs->base_output_dirname, '/');
p = strrchr(vs->m3u8_name, '/');
if (p) {
*(p + 1) = '\0';
av_strlcat(vs->base_output_dirname, vs->fmp4_init_filename,
fmp4_init_filename_len);
char tmp = *(++p);
*p = '\0';
vs->base_output_dirname = av_asprintf("%s%s", vs->m3u8_name,
vs->fmp4_init_filename);
*p = tmp;
} else {
av_strlcpy(vs->base_output_dirname, vs->fmp4_init_filename,
fmp4_init_filename_len);
vs->base_output_dirname = av_strdup(vs->fmp4_init_filename);
}
if (!vs->base_output_dirname)
return AVERROR(ENOMEM);
}
}
......
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