diff options
author | Stefano Sabatini <stefasab@gmail.com> | 2013-01-23 00:23:47 +0100 |
---|---|---|
committer | Stefano Sabatini <stefasab@gmail.com> | 2013-01-23 18:32:01 +0100 |
commit | ca68acd7ac3720b76efcf37219700e76e111062c (patch) | |
tree | a12717771c4bf467eaba2058b407e10478e0ecdb /libavformat/segment.c | |
parent | 8b8ac78ef3a1e4934652665357905ea915a2d97f (diff) | |
download | ffmpeg-ca68acd7ac3720b76efcf37219700e76e111062c.tar.gz |
lavf/segment: mark #EXT-X-ENDLIST in M3U8 only at the end of stream
Should fix immediate playback termination.
In particular, should fix trac ticket #2172.
Diffstat (limited to 'libavformat/segment.c')
-rw-r--r-- | libavformat/segment.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/libavformat/segment.c b/libavformat/segment.c index d26bfecfcf..a3e49f4a80 100644 --- a/libavformat/segment.c +++ b/libavformat/segment.c @@ -258,7 +258,7 @@ static void segment_list_print_entry(AVIOContext *list_ioctx, } } -static int segment_end(AVFormatContext *s, int write_trailer) +static int segment_end(AVFormatContext *s, int write_trailer, int is_last) { SegmentContext *seg = s->priv_data; AVFormatContext *oc = seg->avf; @@ -300,7 +300,7 @@ static int segment_end(AVFormatContext *s, int write_trailer) goto end; for (entry = seg->segment_list_entries; entry; entry = entry->next) segment_list_print_entry(seg->list_pb, seg->list_type, entry); - if (seg->list_type == LIST_TYPE_M3U8) + if (seg->list_type == LIST_TYPE_M3U8 && is_last) avio_printf(seg->list_pb, "#EXT-X-ENDLIST\n"); } else { segment_list_print_entry(seg->list_pb, seg->list_type, &seg->cur_entry); @@ -664,7 +664,7 @@ static int seg_write_packet(AVFormatContext *s, AVPacket *pkt) (pkt->pts != AV_NOPTS_VALUE && av_compare_ts(pkt->pts, st->time_base, end_pts-seg->time_delta, AV_TIME_BASE_Q) >= 0))) { - ret = segment_end(s, seg->individual_header_trailer); + ret = segment_end(s, seg->individual_header_trailer, 0); if (!ret) ret = segment_start(s, seg->individual_header_trailer); @@ -729,13 +729,13 @@ static int seg_write_trailer(struct AVFormatContext *s) int ret; if (!seg->write_header_trailer) { - if ((ret = segment_end(s, 0)) < 0) + if ((ret = segment_end(s, 0, 1)) < 0) goto fail; open_null_ctx(&oc->pb); ret = av_write_trailer(oc); close_null_ctx(oc->pb); } else { - ret = segment_end(s, 1); + ret = segment_end(s, 1, 1); } fail: if (seg->list) |