Commit e60b018c authored by Rodger Combs's avatar Rodger Combs Committed by Michael Niedermayer

lavf/segment: add an option to allow breaking on non-keyframes

Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent e1009665
......@@ -111,6 +111,7 @@ typedef struct SegmentContext {
int64_t initial_offset; ///< initial timestamps offset, expressed in microseconds
char *reference_stream_specifier; ///< reference stream specifier
int reference_stream_index;
int break_non_keyframes;
SegmentListEntry cur_entry;
SegmentListEntry *segment_list_entries;
......@@ -780,7 +781,7 @@ static int seg_write_packet(AVFormatContext *s, AVPacket *pkt)
pkt->stream_index == seg->reference_stream_index ? seg->frame_count : -1);
if (pkt->stream_index == seg->reference_stream_index &&
pkt->flags & AV_PKT_FLAG_KEY &&
(pkt->flags & AV_PKT_FLAG_KEY || seg->break_non_keyframes) &&
seg->segment_frame_count > 0 &&
(seg->cut_pending || seg->frame_count >= start_frame ||
(pkt->pts != AV_NOPTS_VALUE &&
......@@ -920,6 +921,7 @@ static const AVOption options[] = {
{ "segment_start_number", "set the sequence number of the first segment", OFFSET(segment_idx), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, E },
{ "segment_wrap_number", "set the number of wrap before the first segment", OFFSET(segment_idx_wrap_nb), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, E },
{ "strftime", "set filename expansion with strftime at segment creation", OFFSET(use_strftime), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, 1, E },
{ "break_non_keyframes", "allow breaking segments on non-keyframes", OFFSET(break_non_keyframes), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1, E },
{ "individual_header_trailer", "write header/trailer to each segment", OFFSET(individual_header_trailer), AV_OPT_TYPE_INT, {.i64 = 1}, 0, 1, E },
{ "write_header_trailer", "write a header to the first segment and a trailer to the last one", OFFSET(write_header_trailer), AV_OPT_TYPE_INT, {.i64 = 1}, 0, 1, E },
......
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