[FFmpeg-cvslog] matroskaenc: Provide output bytestream markers
Martin Storsjö
git at videolan.org
Thu Jun 23 18:01:29 CEST 2016
ffmpeg | branch: master | Martin Storsjö <martin at martin.st> | Wed May 4 22:31:28 2016 +0300| [71852a1ba89abc8749e309d9d662c49d47e19531] | committer: Martin Storsjö
matroskaenc: Provide output bytestream markers
Signed-off-by: Martin Storsjö <martin at martin.st>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=71852a1ba89abc8749e309d9d662c49d47e19531
---
libavformat/matroskaenc.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 2260d42..dd5552c 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -105,6 +105,7 @@ typedef struct MatroskaMuxContext {
AVPacket cur_audio_pkt;
int have_attachments;
+ int have_video;
int reserve_cues_space;
int cluster_size_limit;
@@ -843,6 +844,7 @@ static int mkv_write_track(AVFormatContext *s, MatroskaMuxContext *mkv,
switch (par->codec_type) {
case AVMEDIA_TYPE_VIDEO:
+ mkv->have_video = 1;
put_ebml_uint(pb, MATROSKA_ID_TRACKTYPE, MATROSKA_TRACK_TYPE_VIDEO);
if (st->avg_frame_rate.num > 0 && st->avg_frame_rate.den > 0)
put_ebml_uint(pb, MATROSKA_ID_TRACKDEFAULTDURATION, 1E9 / av_q2d(st->avg_frame_rate));
@@ -1635,6 +1637,11 @@ static int mkv_write_packet(AVFormatContext *s, AVPacket *pkt)
avio_flush(s->pb);
}
+ if (!mkv->cluster_pos)
+ avio_write_marker(s->pb,
+ av_rescale_q(pkt->dts, s->streams[pkt->stream_index]->time_base, AV_TIME_BASE_Q),
+ keyframe && (mkv->have_video ? codec_type == AVMEDIA_TYPE_VIDEO : 1) ? AVIO_DATA_MARKER_SYNC_POINT : AVIO_DATA_MARKER_BOUNDARY_POINT);
+
// check if we have an audio packet cached
if (mkv->cur_audio_pkt.size > 0) {
ret = mkv_write_packet_internal(s, &mkv->cur_audio_pkt);
More information about the ffmpeg-cvslog
mailing list