Browse Source

avformat/matroskadec: use gmtime_r() for thread saftey

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
tags/n2.5
Michael Niedermayer 11 years ago
parent
commit
a52cb42ba6
1 changed files with 2 additions and 1 deletions
  1. +2
    -1
      libavformat/matroskadec.c

+ 2
- 1
libavformat/matroskadec.c View File

@@ -46,6 +46,7 @@
#include "libavutil/intreadwrite.h"
#include "libavutil/lzo.h"
#include "libavutil/mathematics.h"
#include "libavutil/time_internal.h"

#include "libavcodec/bytestream.h"
#include "libavcodec/flac.h"
@@ -1507,7 +1508,7 @@ static void matroska_metadata_creation_time(AVDictionary **metadata, int64_t dat
char buffer[32];
/* Convert to seconds and adjust by number of seconds between 2001-01-01 and Epoch */
time_t creation_time = date_utc / 1000000000 + 978307200;
struct tm *ptm = gmtime(&creation_time);
struct tm tmpbuf, *ptm = gmtime_r(&creation_time, &tmpbuf);
if (!ptm) return;
if (strftime(buffer, sizeof(buffer), "%Y-%m-%d %H:%M:%S", ptm))
av_dict_set(metadata, "creation_time", buffer, 0);


Loading…
Cancel
Save