diff options
author | Anton Khirnov <anton@khirnov.net> | 2011-07-07 11:25:03 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2011-07-12 15:30:10 +0200 |
commit | 5f847bf61dca1fd1a2f65a2f56c9a99d1cb716ab (patch) | |
tree | c6efb65d184923aa8b5e2eaa87336a59bdec4a1f /libavformat/dvenc.c | |
parent | b12c2592525c3d8e12265a3d923a945d6f699a5b (diff) | |
download | ffmpeg-5f847bf61dca1fd1a2f65a2f56c9a99d1cb716ab.tar.gz |
lavf: deprecate AVFormatContext.timestamp
It's replaced by 'creation_time' metadata tag.
Diffstat (limited to 'libavformat/dvenc.c')
-rw-r--r-- | libavformat/dvenc.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/libavformat/dvenc.c b/libavformat/dvenc.c index 504e3ee26f..1e59bd9cc7 100644 --- a/libavformat/dvenc.c +++ b/libavformat/dvenc.c @@ -43,7 +43,7 @@ struct DVMuxContext { AVStream *ast[2]; /* stereo audio streams */ AVFifoBuffer *audio_data[2]; /* FIFO for storing excessive amounts of PCM */ int frames; /* current frame number */ - time_t start_time; /* recording start time */ + int64_t start_time; /* recording start time */ int has_audio; /* frame under contruction has audio */ int has_video; /* frame under contruction has video */ uint8_t frame_buf[DV_MAX_FRAME_SIZE]; /* frame under contruction */ @@ -290,6 +290,7 @@ static DVMuxContext* dv_init_mux(AVFormatContext* s) { DVMuxContext *c = s->priv_data; AVStream *vst = NULL; + AVDictionaryEntry *t; int i; /* we support at most 1 video and 2 audio streams */ @@ -337,7 +338,16 @@ static DVMuxContext* dv_init_mux(AVFormatContext* s) c->frames = 0; c->has_audio = 0; c->has_video = 0; - c->start_time = (time_t)s->timestamp; +#if FF_API_TIMESTAMP + if (s->timestamp) + c->start_time = 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); + c->start_time = mktime(&time); + } for (i=0; i < c->n_ast; i++) { if (c->ast[i] && !(c->audio_data[i]=av_fifo_alloc(100*AVCODEC_MAX_AUDIO_FRAME_SIZE))) { |