[FFmpeg-cvslog] r22326 - in trunk/libavformat: asf.c asf.h asfdec.c

benoit subversion
Mon Mar 8 14:13:18 CET 2010


Author: benoit
Date: Mon Mar  8 14:13:18 2010
New Revision: 22326

Log:
Use ASF supports "markers" which are a name and a time stamp to create
lavf chapters.
Patch by Vladimir Pantelic pan (arobase) nt tu (dash) darmstadt de

Modified:
   trunk/libavformat/asf.c
   trunk/libavformat/asf.h
   trunk/libavformat/asfdec.c

Modified: trunk/libavformat/asf.c
==============================================================================
--- trunk/libavformat/asf.c	Mon Mar  8 13:58:22 2010	(r22325)
+++ trunk/libavformat/asf.c	Mon Mar  8 14:13:18 2010	(r22326)
@@ -106,6 +106,10 @@ const ff_asf_guid ff_asf_metadata_header
         0xea, 0xcb, 0xf8, 0xc5, 0xaf, 0x5b, 0x77, 0x48, 0x84, 0x67, 0xaa, 0x8c, 0x44, 0xfa, 0x4c, 0xca
 };
 
+const ff_asf_guid ff_asf_marker_header = {
+        0x01, 0xCD, 0x87, 0xF4, 0x51, 0xA9, 0xCF, 0x11, 0x8E, 0xE6, 0x00, 0xC0, 0x0C, 0x20, 0x53, 0x65
+};
+
 /* I am not a number !!! This GUID is the one found on the PC used to
    generate the stream */
 const ff_asf_guid ff_asf_my_guid = {

Modified: trunk/libavformat/asf.h
==============================================================================
--- trunk/libavformat/asf.h	Mon Mar  8 13:58:22 2010	(r22325)
+++ trunk/libavformat/asf.h	Mon Mar  8 14:13:18 2010	(r22326)
@@ -158,6 +158,7 @@ extern const ff_asf_guid ff_asf_simple_i
 extern const ff_asf_guid ff_asf_ext_stream_embed_stream_header;
 extern const ff_asf_guid ff_asf_ext_stream_audio_stream;
 extern const ff_asf_guid ff_asf_metadata_header;
+extern const ff_asf_guid ff_asf_marker_header;
 extern const ff_asf_guid ff_asf_my_guid;
 extern const ff_asf_guid ff_asf_language_guid;
 extern const ff_asf_guid ff_asf_content_encryption;

Modified: trunk/libavformat/asfdec.c
==============================================================================
--- trunk/libavformat/asfdec.c	Mon Mar  8 13:58:22 2010	(r22325)
+++ trunk/libavformat/asfdec.c	Mon Mar  8 14:13:18 2010	(r22326)
@@ -82,6 +82,7 @@ static void print_guid(const ff_asf_guid
     else PRINT_IF_GUID(g, ff_asf_ext_stream_embed_stream_header);
     else PRINT_IF_GUID(g, ff_asf_ext_stream_audio_stream);
     else PRINT_IF_GUID(g, ff_asf_metadata_header);
+    else PRINT_IF_GUID(g, ff_asf_marker_header);
     else PRINT_IF_GUID(g, stream_bitrate_guid);
     else PRINT_IF_GUID(g, ff_asf_language_guid);
     else
@@ -520,6 +521,32 @@ static int asf_read_header(AVFormatConte
             get_guid(pb, &g);
             v1 = get_le32(pb);
             v2 = get_le16(pb);
+        } else if (!guidcmp(&g, &ff_asf_marker_header)) {
+            int i, count, name_len;
+            char name[1024];
+
+            get_le64(pb);            // reserved 16 bytes
+            get_le64(pb);            // ...
+            count = get_le32(pb);    // markers count
+            get_le16(pb);            // reserved 2 bytes
+            name_len = get_le16(pb); // name length
+            for(i=0;i<name_len;i++){
+                get_byte(pb); // skip the name
+            }
+
+            for(i=0;i<count;i++){
+                int64_t pres_time;
+                int name_len;
+
+                get_le64(pb);             // offset, 8 bytes
+                pres_time = get_le64(pb); // presentation time
+                get_le16(pb);             // entry length
+                get_le32(pb);             // send time
+                get_le32(pb);             // flags
+                name_len = get_le32(pb);  // name length
+                get_str16_nolen(pb, name_len * 2, name, sizeof(name));
+                ff_new_chapter(s, i, (AVRational){1, 10000000}, pres_time, AV_NOPTS_VALUE, name );
+            }
 #if 0
         } else if (!guidcmp(&g, &ff_asf_codec_comment_header)) {
             int len, v1, n, num;



More information about the ffmpeg-cvslog mailing list