Commit adbb75db authored by Michael Niedermayer's avatar Michael Niedermayer

mov: fix time types related to mov_metadata_creation_time

Fixes Ticket1817
Based on patch by: Przemyslaw Wesolek <przemyslaw.wesolek@go.art.pl>
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 7b8fd298
...@@ -780,14 +780,16 @@ static int mov_read_moof(MOVContext *c, AVIOContext *pb, MOVAtom atom) ...@@ -780,14 +780,16 @@ static int mov_read_moof(MOVContext *c, AVIOContext *pb, MOVAtom atom)
return mov_read_default(c, pb, atom); return mov_read_default(c, pb, atom);
} }
static void mov_metadata_creation_time(AVDictionary **metadata, time_t time) static void mov_metadata_creation_time(AVDictionary **metadata, int64_t time)
{ {
char buffer[32]; char buffer[32];
if (time) { if (time) {
struct tm *ptm; struct tm *ptm;
time_t timet;
if(time >= 2082844800) if(time >= 2082844800)
time -= 2082844800; /* seconds between 1904-01-01 and Epoch */ time -= 2082844800; /* seconds between 1904-01-01 and Epoch */
ptm = gmtime(&time); timet = time;
ptm = gmtime(&timet);
if (!ptm) return; if (!ptm) return;
strftime(buffer, sizeof(buffer), "%Y-%m-%d %H:%M:%S", ptm); strftime(buffer, sizeof(buffer), "%Y-%m-%d %H:%M:%S", ptm);
av_dict_set(metadata, "creation_time", buffer, 0); av_dict_set(metadata, "creation_time", buffer, 0);
...@@ -801,7 +803,7 @@ static int mov_read_mdhd(MOVContext *c, AVIOContext *pb, MOVAtom atom) ...@@ -801,7 +803,7 @@ static int mov_read_mdhd(MOVContext *c, AVIOContext *pb, MOVAtom atom)
int version; int version;
char language[4] = {0}; char language[4] = {0};
unsigned lang; unsigned lang;
time_t creation_time; int64_t creation_time;
if (c->fc->nb_streams < 1) if (c->fc->nb_streams < 1)
return 0; return 0;
...@@ -836,7 +838,7 @@ static int mov_read_mdhd(MOVContext *c, AVIOContext *pb, MOVAtom atom) ...@@ -836,7 +838,7 @@ static int mov_read_mdhd(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_read_mvhd(MOVContext *c, AVIOContext *pb, MOVAtom atom) static int mov_read_mvhd(MOVContext *c, AVIOContext *pb, MOVAtom atom)
{ {
time_t creation_time; int64_t creation_time;
int version = avio_r8(pb); /* version */ int version = avio_r8(pb); /* version */
avio_rb24(pb); /* flags */ avio_rb24(pb); /* flags */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment