You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-15 14:13:16 +02:00
wtvdec: return error when filetime_to_iso8601/crazytime_to_iso8601 conversion fails
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
committed by
Michael Niedermayer
parent
d35a986404
commit
c4e0e74438
@@ -368,28 +368,30 @@ static int read_probe(AVProbeData *p)
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert win32 FILETIME to ISO-8601 string
|
* Convert win32 FILETIME to ISO-8601 string
|
||||||
|
* @return <0 on error
|
||||||
*/
|
*/
|
||||||
static void filetime_to_iso8601(char *buf, int buf_size, int64_t value)
|
static int filetime_to_iso8601(char *buf, int buf_size, int64_t value)
|
||||||
{
|
{
|
||||||
time_t t = (value / 10000000LL) - 11644473600LL;
|
time_t t = (value / 10000000LL) - 11644473600LL;
|
||||||
struct tm *tm = gmtime(&t);
|
struct tm *tm = gmtime(&t);
|
||||||
if (tm)
|
if (!tm)
|
||||||
|
return -1;
|
||||||
strftime(buf, buf_size, "%Y-%m-%d %H:%M:%S", gmtime(&t));
|
strftime(buf, buf_size, "%Y-%m-%d %H:%M:%S", gmtime(&t));
|
||||||
else
|
return 0;
|
||||||
buf[0] = '\0';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert crazy time (100ns since 1 Jan 0001) to ISO-8601 string
|
* Convert crazy time (100ns since 1 Jan 0001) to ISO-8601 string
|
||||||
|
* @return <0 on error
|
||||||
*/
|
*/
|
||||||
static void crazytime_to_iso8601(char *buf, int buf_size, int64_t value)
|
static int crazytime_to_iso8601(char *buf, int buf_size, int64_t value)
|
||||||
{
|
{
|
||||||
time_t t = (value / 10000000LL) - 719162LL*86400LL;
|
time_t t = (value / 10000000LL) - 719162LL*86400LL;
|
||||||
struct tm *tm = gmtime(&t);
|
struct tm *tm = gmtime(&t);
|
||||||
if (tm)
|
if (!tm)
|
||||||
|
return -1;
|
||||||
strftime(buf, buf_size, "%Y-%m-%d %H:%M:%S", gmtime(&t));
|
strftime(buf, buf_size, "%Y-%m-%d %H:%M:%S", gmtime(&t));
|
||||||
else
|
return 0;
|
||||||
buf[0] = '\0';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -460,10 +462,16 @@ static void get_tag(AVFormatContext *s, AVIOContext *pb, const char *key, int ty
|
|||||||
int64_t num = avio_rl64(pb);
|
int64_t num = avio_rl64(pb);
|
||||||
if (!strcmp(key, "WM/EncodingTime") ||
|
if (!strcmp(key, "WM/EncodingTime") ||
|
||||||
!strcmp(key, "WM/MediaOriginalBroadcastDateTime"))
|
!strcmp(key, "WM/MediaOriginalBroadcastDateTime"))
|
||||||
filetime_to_iso8601(buf, buf_size, num);
|
if (filetime_to_iso8601(buf, buf_size, num) < 0) {
|
||||||
|
av_free(buf);
|
||||||
|
return;
|
||||||
|
}
|
||||||
else if (!strcmp(key, "WM/WMRVEncodeTime") ||
|
else if (!strcmp(key, "WM/WMRVEncodeTime") ||
|
||||||
!strcmp(key, "WM/WMRVEndTime"))
|
!strcmp(key, "WM/WMRVEndTime"))
|
||||||
crazytime_to_iso8601(buf, buf_size, num);
|
if (crazytime_to_iso8601(buf, buf_size, num) < 0) {
|
||||||
|
av_free(buf);
|
||||||
|
return;
|
||||||
|
}
|
||||||
else if (!strcmp(key, "WM/WMRVExpirationDate")) {
|
else if (!strcmp(key, "WM/WMRVExpirationDate")) {
|
||||||
if (oledate_to_iso8601(buf, buf_size, num) < 0 ) {
|
if (oledate_to_iso8601(buf, buf_size, num) < 0 ) {
|
||||||
av_free(buf);
|
av_free(buf);
|
||||||
|
Reference in New Issue
Block a user