[SCM] libav/experimental: Chapter demuxing support. (untested as I have no nuts with chapters) Isn't that much simpler than Matroska?

siretart at users.alioth.debian.org siretart at users.alioth.debian.org
Sun Jun 30 16:21:07 UTC 2013


The following commit has been merged in the experimental branch:
commit 883fe4d5bb3f47e70d251b1dc112980b4587606f
Author: Michael Niedermayer <michaelni at gmx.at>
Date:   Fri May 23 13:52:54 2008 +0000

    Chapter demuxing support. (untested as I have no nuts with chapters)
    Isn't that much simpler than Matroska?
    
    Originally committed as revision 13263 to svn://svn.ffmpeg.org/ffmpeg/trunk

diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c
index 772a527..7259a36 100644
--- a/libavformat/nutdec.c
+++ b/libavformat/nutdec.c
@@ -393,6 +393,7 @@ static int decode_info_header(NUTContext *nut){
     int64_t value, end;
     char name[256], str_value[1024], type_str[256];
     const char *type;
+    AVChapter *chapter= NULL;
 
     end= get_packetheader(nut, bc, 1, INFO_STARTCODE);
     end += url_ftell(bc);
@@ -402,6 +403,13 @@ static int decode_info_header(NUTContext *nut){
     chapter_start= ff_get_v(bc);
     chapter_len  = ff_get_v(bc);
     count        = ff_get_v(bc);
+
+    if(chapter_id && !stream_id_plus1){
+        int64_t start= chapter_start / nut->time_base_count;
+        chapter= ff_new_chapter(s, chapter_id, start, start + chapter_len, NULL);
+        chapter->time_base= nut->time_base[chapter_start % nut->time_base_count];
+    }
+
     for(i=0; i<count; i++){
         get_str(bc, name, sizeof(name));
         value= get_s(bc);
@@ -442,6 +450,10 @@ static int decode_info_header(NUTContext *nut){
             else if(!strcmp(name, "Disposition"))
                 set_disposition_bits(s, str_value, stream_id_plus1 - 1);
         }
+        if(chapter && !strcmp(type, "UTF-8")){
+            if(!strcmp(name, "Title"))
+                chapter->title= av_strdup(str_value);
+        }
     }
 
     if(skip_reserved(bc, end) || get_checksum(bc)){

-- 
Libav/FFmpeg packaging



More information about the pkg-multimedia-commits mailing list