summaryrefslogtreecommitdiff
path: root/libavformat/gxfenc.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2011-07-07 11:25:03 +0200
committerAnton Khirnov <anton@khirnov.net>2011-07-12 15:30:10 +0200
commit5f847bf61dca1fd1a2f65a2f56c9a99d1cb716ab (patch)
treec6efb65d184923aa8b5e2eaa87336a59bdec4a1f /libavformat/gxfenc.c
parentb12c2592525c3d8e12265a3d923a945d6f699a5b (diff)
lavf: deprecate AVFormatContext.timestamp
It's replaced by 'creation_time' metadata tag.
Diffstat (limited to 'libavformat/gxfenc.c')
-rw-r--r--libavformat/gxfenc.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/libavformat/gxfenc.c b/libavformat/gxfenc.c
index 5a3ff39ab2..2d4136ab86 100644
--- a/libavformat/gxfenc.c
+++ b/libavformat/gxfenc.c
@@ -394,6 +394,20 @@ static int gxf_write_umf_material_description(AVFormatContext *s)
GXFContext *gxf = s->priv_data;
AVIOContext *pb = s->pb;
int timecode_base = gxf->time_base.den == 60000 ? 60 : 50;
+ int64_t timestamp = 0;
+ AVDictionaryEntry *t;
+
+#if FF_API_TIMESTAMP
+ if (s->timestamp)
+ timestamp = s->timestamp;
+ else
+#endif
+ if (t = av_dict_get(s->metadata, "creation_time", NULL, 0)) {
+ struct tm time = {0};
+ strptime(t->value, "%Y - %m - %dT%T", &time);
+ timestamp = mktime(&time);
+ }
+
// XXX drop frame
uint32_t timecode =
@@ -409,8 +423,8 @@ static int gxf_write_umf_material_description(AVFormatContext *s)
avio_wl32(pb, gxf->nb_fields); /* mark out */
avio_wl32(pb, 0); /* timecode mark in */
avio_wl32(pb, timecode); /* timecode mark out */
- avio_wl64(pb, s->timestamp); /* modification time */
- avio_wl64(pb, s->timestamp); /* creation time */
+ avio_wl64(pb, timestamp); /* modification time */
+ avio_wl64(pb, timestamp); /* creation time */
avio_wl16(pb, 0); /* reserved */
avio_wl16(pb, 0); /* reserved */
avio_wl16(pb, gxf->audio_tracks);