summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjstebbins <[email protected]>2011-01-20 03:39:44 +0000
committerjstebbins <[email protected]>2011-01-20 03:39:44 +0000
commit089ed18952310566bb8d6a5dc85cdcc4f80ca5f4 (patch)
tree93ffce7bd6122164220cfbb658f95a90b1bb09d3
parent0d0845ba565911dea50d1869e4e33bfdc906989f (diff)
patch ffmpeg mov demuxer to handle LE UTF16 chapter names
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3759 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r--contrib/ffmpeg/A00-mov-utf16-chapters.patch25
1 files changed, 25 insertions, 0 deletions
diff --git a/contrib/ffmpeg/A00-mov-utf16-chapters.patch b/contrib/ffmpeg/A00-mov-utf16-chapters.patch
new file mode 100644
index 000000000..1dfde74e6
--- /dev/null
+++ b/contrib/ffmpeg/A00-mov-utf16-chapters.patch
@@ -0,0 +1,25 @@
+diff --git a/libavformat/mov.c b/libavformat/mov.c
+index 4370b48..b28c9ae 100644
+--- a/libavformat/mov.c
++++ b/libavformat/mov.c
+@@ -2334,6 +2334,20 @@ static void mov_read_chapters(AVFormatContext *s)
+ av_freep(&title);
+ title = utf8;
+ }
++ else if (AV_RL16(title+2) == 0xfeff) {
++ uint8_t *utf8 = av_malloc(2*len+3);
++
++ i8 = i16 = 0;
++ while (i16 < len) {
++ uint32_t ch;
++ uint8_t tmp;
++ GET_UTF16(ch, i16 < len ? AV_RL16(title + (i16+=2)) : 0, break;)
++ PUT_UTF8(ch, tmp, if (i8 < 2*len) utf8[2+i8++] = tmp;)
++ }
++ utf8[2+i8] = 0;
++ av_freep(&title);
++ title = utf8;
++ }
+
+ ff_new_chapter(s, i, st->time_base, sample->timestamp, end, title+2);
+ av_freep(&title);