diff options
author | Rodger Combs <rodger.combs@gmail.com> | 2015-03-28 19:25:18 -0600 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2015-03-29 14:44:21 +0200 |
commit | 481f0f153ac3abe9de445de6972530f450aa9d8c (patch) | |
tree | 664f078f757a80a047b7b60dc74907cfe26d627c /libavformat | |
parent | bcf44c91c30940822bd8bcd612c2a5ab0a3440f2 (diff) | |
download | ffmpeg-481f0f153ac3abe9de445de6972530f450aa9d8c.tar.gz |
libavformat/segment: don't leave the list pb open when not in use
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/segment.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/libavformat/segment.c b/libavformat/segment.c index b65a2ebdba..06bc459205 100644 --- a/libavformat/segment.c +++ b/libavformat/segment.c @@ -357,17 +357,17 @@ static int segment_end(AVFormatContext *s, int write_trailer, int is_last) av_freep(&entry); } - avio_closep(&seg->list_pb); if ((ret = segment_list_open(s)) < 0) goto end; for (entry = seg->segment_list_entries; entry; entry = entry->next) segment_list_print_entry(seg->list_pb, seg->list_type, entry, s); if (seg->list_type == LIST_TYPE_M3U8 && is_last) avio_printf(seg->list_pb, "#EXT-X-ENDLIST\n"); + avio_closep(&seg->list_pb); } else { segment_list_print_entry(seg->list_pb, seg->list_type, &seg->cur_entry, s); + avio_flush(seg->list_pb); } - avio_flush(seg->list_pb); } av_log(s, AV_LOG_VERBOSE, "segment:'%s' count:%d ended\n", @@ -635,8 +635,9 @@ static int seg_write_header(AVFormatContext *s) else if (av_match_ext(seg->list, "ffcat,ffconcat")) seg->list_type = LIST_TYPE_FFCONCAT; else seg->list_type = LIST_TYPE_FLAT; } - if ((ret = segment_list_open(s)) < 0) - goto fail; + if (!seg->list_size && seg->list_type != LIST_TYPE_M3U8) + if ((ret = segment_list_open(s)) < 0) + goto fail; } if (seg->list_type == LIST_TYPE_EXT) av_log(s, AV_LOG_WARNING, "'ext' list type option is deprecated in favor of 'csv'\n"); |