summaryrefslogtreecommitdiff
path: root/libavformat/matroskaenc.c
diff options
context:
space:
mode:
authorMatthieu Bouron <matthieu.bouron@stupeflix.com>2016-06-23 17:57:34 +0200
committerMatthieu Bouron <matthieu.bouron@stupeflix.com>2016-06-23 17:57:34 +0200
commitdc62016c4b77a48284b24ad927eb68035b133925 (patch)
treefbff705b0c08386ce5574075a000bfb46839e554 /libavformat/matroskaenc.c
parenta86fe0d73827de47f77b90cf9227b992207b11b9 (diff)
parent71852a1ba89abc8749e309d9d662c49d47e19531 (diff)
Merge commit '71852a1ba89abc8749e309d9d662c49d47e19531'
* commit '71852a1ba89abc8749e309d9d662c49d47e19531': matroskaenc: Provide output bytestream markers Merged-by: Matthieu Bouron <matthieu.bouron@stupeflix.com>
Diffstat (limited to 'libavformat/matroskaenc.c')
-rw-r--r--libavformat/matroskaenc.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 6252de88be..53353bdc51 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -119,6 +119,7 @@ typedef struct MatroskaMuxContext {
AVPacket cur_audio_pkt;
int have_attachments;
+ int have_video;
int reserve_cues_space;
int cluster_size_limit;
@@ -1055,6 +1056,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
@@ -2035,6 +2037,11 @@ static int mkv_write_packet(AVFormatContext *s, AVPacket *pkt)
mkv_start_new_cluster(s, pkt);
}
+ 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) {
// for DASH audio, a CuePoint has to be added when there is a new cluster.