summaryrefslogtreecommitdiffstats
path: root/contrib/ffmpeg/A05-mkv-chapters.patch
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/ffmpeg/A05-mkv-chapters.patch')
-rw-r--r--contrib/ffmpeg/A05-mkv-chapters.patch57
1 files changed, 57 insertions, 0 deletions
diff --git a/contrib/ffmpeg/A05-mkv-chapters.patch b/contrib/ffmpeg/A05-mkv-chapters.patch
index e69de29bb..f4082be1d 100644
--- a/contrib/ffmpeg/A05-mkv-chapters.patch
+++ b/contrib/ffmpeg/A05-mkv-chapters.patch
@@ -0,0 +1,57 @@
+From c4d83dfad34d69a86bf04ded97ae3fda087bfa25 Mon Sep 17 00:00:00 2001
+From: John Stebbins <[email protected]>
+Date: Fri, 10 May 2013 08:45:55 -0700
+Subject: [PATCH 1/9] matroskaenc: Allow chapters to be written in trailer
+
+This allows creation of frame accurate chapter marks from sources like
+DVD and BD where the precise chapter location is not known until the
+chapter mark has been reached during reading.
+---
+ libavformat/matroskaenc.c | 10 +++++++++-
+ 1 file changed, 9 insertions(+), 1 deletion(-)
+
+diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
+index b37d10c..99de151 100644
+--- a/libavformat/matroskaenc.c
++++ b/libavformat/matroskaenc.c
+@@ -94,6 +94,7 @@ typedef struct MatroskaMuxContext {
+ AVPacket cur_audio_pkt;
+
+ int have_attachments;
++ int wrote_chapters;
+ } MatroskaMuxContext;
+
+
+@@ -688,7 +689,7 @@ static int mkv_write_chapters(AVFormatContext *s)
+ AVRational scale = {1, 1E9};
+ int i, ret;
+
+- if (!s->nb_chapters)
++ if (!s->nb_chapters || mkv->wrote_chapters)
+ return 0;
+
+ ret = mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_CHAPTERS, avio_tell(pb));
+@@ -721,6 +722,8 @@ static int mkv_write_chapters(AVFormatContext *s)
+ }
+ end_ebml_master(pb, editionentry);
+ end_ebml_master(pb, chapters);
++
++ mkv->wrote_chapters = 1;
+ return 0;
+ }
+
+@@ -1259,6 +1262,11 @@ static int mkv_write_trailer(AVFormatContext *s)
+ end_ebml_master(pb, mkv->cluster);
+ }
+
++ if (mkv->mode != MODE_WEBM) {
++ ret = mkv_write_chapters(s);
++ if (ret < 0) return ret;
++ }
++
+ if (pb->seekable) {
+ if (mkv->cues->num_entries) {
+ cuespos = mkv_write_cues(pb, mkv->cues, s->nb_streams);
+--
+1.8.1.4
+