Commit c66d4687 authored by Steven Liu's avatar Steven Liu

avformat/hlsenc: avformat/hlsenc: simplified code

simplified code for get dirname string in hls_delete_old_segments
Signed-off-by: 's avatarSteven Liu <lq@chinaffmpeg.org>
parent fa78a6ab
...@@ -505,18 +505,13 @@ static int hls_delete_old_segments(AVFormatContext *s, HLSContext *hls, ...@@ -505,18 +505,13 @@ static int hls_delete_old_segments(AVFormatContext *s, HLSContext *hls,
} }
if (segment && !hls->use_localtime_mkdir) { if (segment && !hls->use_localtime_mkdir) {
if (hls->segment_filename) { dirname = hls->segment_filename ? av_strdup(hls->segment_filename): av_strdup(vs->avf->url);
dirname = av_strdup(hls->segment_filename);
} else {
dirname = av_strdup(vs->avf->url);
}
if (!dirname) { if (!dirname) {
ret = AVERROR(ENOMEM); ret = AVERROR(ENOMEM);
goto fail; goto fail;
} }
p = (char *)av_basename(dirname); p = (char *)av_basename(dirname);
*p = '\0'; *p = '\0';
} }
/* if %v is present in the file's directory /* if %v is present in the file's directory
......
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