changeset 4492:56ea2b1028fe libavformat

matroskadec: use new metadata API to export some simple information
author aurel
date Sun, 15 Feb 2009 15:25:14 +0000
parents 673107cf7fe6
children 40499405ef63
files matroskadec.c
diffstat 1 files changed, 8 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/matroskadec.c	Sun Feb 15 14:34:23 2009 +0000
+++ b/matroskadec.c	Sun Feb 15 15:25:14 2009 +0000
@@ -154,6 +154,8 @@
     uint64_t end;
     uint64_t uid;
     char    *title;
+
+    AVChapter *chapter;
 } MatroskaChapter;
 
 typedef struct {
@@ -1103,9 +1105,7 @@
     if (matroska->duration)
         matroska->ctx->duration = matroska->duration * matroska->time_scale
                                   * 1000 / AV_TIME_BASE;
-    if (matroska->title)
-        strncpy(matroska->ctx->title, matroska->title,
-                sizeof(matroska->ctx->title)-1);
+    av_metadata_set(&s->metadata, "title", matroska->title);
     matroska_convert_tags(s, &matroska->tags);
 
     tracks = matroska->tracks.elem;
@@ -1294,7 +1294,7 @@
         st->codec->codec_id = codec_id;
         st->start_time = 0;
         if (strcmp(track->language, "und"))
-            av_strlcpy(st->language, track->language, 4);
+            av_metadata_set(&st->metadata, "language", track->language);
 
         if (track->flag_default)
             st->disposition |= AV_DISPOSITION_DEFAULT;
@@ -1346,7 +1346,7 @@
             AVStream *st = av_new_stream(s, 0);
             if (st == NULL)
                 break;
-            st->filename          = av_strdup(attachements[j].filename);
+            av_metadata_set(&st->metadata, "filename",attachements[j].filename);
             st->codec->codec_id = CODEC_ID_NONE;
             st->codec->codec_type = CODEC_TYPE_ATTACHMENT;
             st->codec->extradata  = av_malloc(attachements[j].bin.size);
@@ -1369,9 +1369,12 @@
     for (i=0; i<chapters_list->nb_elem; i++)
         if (chapters[i].start != AV_NOPTS_VALUE && chapters[i].uid
             && (max_start==0 || chapters[i].start > max_start)) {
+            chapters[i].chapter =
             ff_new_chapter(s, chapters[i].uid, (AVRational){1, 1000000000},
                            chapters[i].start, chapters[i].end,
                            chapters[i].title);
+            av_metadata_set(&chapters[i].chapter->metadata,
+                            "title", chapters[i].title);
             max_start = chapters[i].start;
         }