diff options
author | Marton Balint <cus@passwd.hu> | 2021-05-12 20:26:54 +0200 |
---|---|---|
committer | Marton Balint <cus@passwd.hu> | 2021-05-20 20:39:14 +0200 |
commit | f597041d57bae314977705dca7d83c819bde6651 (patch) | |
tree | f918e78dc24de9e3fe183c6cacdd2f8fe3a2af58 /libavformat/flvdec.c | |
parent | 9b131e8500709fc7e66bf9049fc0a8f2c302cf9e (diff) | |
download | ffmpeg-f597041d57bae314977705dca7d83c819bde6651.tar.gz |
avformat/flvdec: use milisecond precision for parsing timestamps
Also use helper function to set the timestamp. Maybe we could also use
nanosecond precision, but there were some float rounding concerns.
Signed-off-by: Marton Balint <cus@passwd.hu>
Diffstat (limited to 'libavformat/flvdec.c')
-rw-r--r-- | libavformat/flvdec.c | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c index ddaceaafe4..6bd6c8c944 100644 --- a/libavformat/flvdec.c +++ b/libavformat/flvdec.c @@ -28,6 +28,7 @@ #include "libavutil/channel_layout.h" #include "libavutil/dict.h" #include "libavutil/opt.h" +#include "libavutil/internal.h" #include "libavutil/intfloat.h" #include "libavutil/mathematics.h" #include "libavutil/time_internal.h" @@ -682,17 +683,9 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream, } else if (amf_type == AMF_DATA_TYPE_STRING) { av_dict_set(&s->metadata, key, str_val, 0); } else if (amf_type == AMF_DATA_TYPE_DATE) { - time_t time; - struct tm t; - char datestr[128]; - time = date.milliseconds / 1000; // to seconds - gmtime_r(&time, &t); - // timezone is ignored, since there is no easy way to offset the UTC // timestamp into the specified timezone - strftime(datestr, sizeof(datestr), "%Y-%m-%dT%H:%M:%SZ", &t); - - av_dict_set(&s->metadata, key, datestr, 0); + avpriv_dict_set_timestamp(&s->metadata, key, 1000 * (int64_t)date.milliseconds); } } |