summaryrefslogtreecommitdiffstats
path: root/media/ffvpx/libavutil/dict.c
diff options
context:
space:
mode:
authorMoonchild <mcwerewolf@gmail.com>2018-02-06 12:03:37 +0100
committerGitHub <noreply@github.com>2018-02-06 12:03:37 +0100
commit5cc30e0f603a030b97b7be37a7aa5d22d13f7a07 (patch)
tree01875b465e2f7749cc8f87f1df756b2cb2ca2596 /media/ffvpx/libavutil/dict.c
parent389c60da5e01761f4a11ef539ffa26e4c1b17875 (diff)
parent30bfbb3f97bd64b7838bcb55c98fa698b1bcc9d2 (diff)
downloadUXP-5cc30e0f603a030b97b7be37a7aa5d22d13f7a07.tar
UXP-5cc30e0f603a030b97b7be37a7aa5d22d13f7a07.tar.gz
UXP-5cc30e0f603a030b97b7be37a7aa5d22d13f7a07.tar.lz
UXP-5cc30e0f603a030b97b7be37a7aa5d22d13f7a07.tar.xz
UXP-5cc30e0f603a030b97b7be37a7aa5d22d13f7a07.zip
Merge pull request #10 from trav90/media-work
Update FFmpeg code to n3.2-65-gee56777
Diffstat (limited to 'media/ffvpx/libavutil/dict.c')
-rw-r--r--media/ffvpx/libavutil/dict.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/media/ffvpx/libavutil/dict.c b/media/ffvpx/libavutil/dict.c
index f70c7e005..0ea71386e 100644
--- a/media/ffvpx/libavutil/dict.c
+++ b/media/ffvpx/libavutil/dict.c
@@ -24,6 +24,7 @@
#include "dict.h"
#include "internal.h"
#include "mem.h"
+#include "time_internal.h"
#include "bprint.h"
struct AVDictionary {
@@ -253,3 +254,19 @@ int av_dict_get_string(const AVDictionary *m, char **buffer,
}
return av_bprint_finalize(&bprint, buffer);
}
+
+int avpriv_dict_set_timestamp(AVDictionary **dict, const char *key, int64_t timestamp)
+{
+ time_t seconds = timestamp / 1000000;
+ struct tm *ptm, tmbuf;
+ ptm = gmtime_r(&seconds, &tmbuf);
+ if (ptm) {
+ char buf[32];
+ if (!strftime(buf, sizeof(buf), "%Y-%m-%dT%H:%M:%S", ptm))
+ return AVERROR_EXTERNAL;
+ av_strlcatf(buf, sizeof(buf), ".%06dZ", (int)(timestamp % 1000000));
+ return av_dict_set(dict, key, buf, 0);
+ } else {
+ return AVERROR_EXTERNAL;
+ }
+}