diff options
author | Vladimir Pantelic <pan@nt.tu-darmstadt.de> | 2010-03-08 13:13:18 +0000 |
---|---|---|
committer | Benoit Fouet <benoit.fouet@free.fr> | 2010-03-08 13:13:18 +0000 |
commit | 88b51ea9483bca1fa21795d07677d733e1f6a042 (patch) | |
tree | 374e0f15ed0737ef8819bf9366578013d5105ab8 /libavformat/asfdec.c | |
parent | 9b066ecbf01362fb3e7596604301f3c492c3b893 (diff) | |
download | ffmpeg-88b51ea9483bca1fa21795d07677d733e1f6a042.tar.gz |
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
Originally committed as revision 22326 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/asfdec.c')
-rw-r--r-- | libavformat/asfdec.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c index 3a2f0e0916..80ac0c29a5 100644 --- a/libavformat/asfdec.c +++ b/libavformat/asfdec.c @@ -82,6 +82,7 @@ static void print_guid(const ff_asf_guid *g) 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(AVFormatContext *s, AVFormatParameters *ap) 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; |