avformat/hlsenc: avformat/hlsenc: simplified code

simplified code for get dirname string in hls_delete_old_segments

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
This commit is contained in:
Steven Liu 2019-08-20 11:46:10 +08:00
parent fa78a6abb3
commit c66d468795
1 changed files with 1 additions and 6 deletions

View File

@ -505,18 +505,13 @@ static int hls_delete_old_segments(AVFormatContext *s, HLSContext *hls,
}
if (segment && !hls->use_localtime_mkdir) {
if (hls->segment_filename) {
dirname = av_strdup(hls->segment_filename);
} else {
dirname = av_strdup(vs->avf->url);
}
dirname = hls->segment_filename ? av_strdup(hls->segment_filename): av_strdup(vs->avf->url);
if (!dirname) {
ret = AVERROR(ENOMEM);
goto fail;
}
p = (char *)av_basename(dirname);
*p = '\0';
}
/* if %v is present in the file's directory