Revision 8acab7ae

View differences:

libavformat/wtvdec.c
398 398

  
399 399
/**
400 400
 * Convert OLE DATE to ISO-8601 string
401
 * @return <0 on error
401 402
 */
402
static void oledate_to_iso8601(char *buf, int buf_size, int64_t value)
403
static int oledate_to_iso8601(char *buf, int buf_size, int64_t value)
403 404
{
404 405
    time_t t = 631112400LL + 86400*av_int2dbl(value);
405
    strftime(buf, buf_size, "%Y-%m-%d %H:%M:%S", gmtime(&t));
406
    struct tm result;
407
    if (!gmtime_r(&t, &result))
408
        return -1;
409
    strftime(buf, buf_size, "%Y-%m-%d %H:%M:%S", &result);
410
    return 0;
406 411
}
407 412

  
408 413
static void get_attachment(AVFormatContext *s, AVIOContext *pb, int length)
......
463 468
        else if (!strcmp(key, "WM/WMRVEncodeTime") ||
464 469
                 !strcmp(key, "WM/WMRVEndTime"))
465 470
            crazytime_to_iso8601(buf, buf_size, num);
466
        else if (!strcmp(key, "WM/WMRVExpirationDate"))
467
            oledate_to_iso8601(buf, buf_size, num);
468
        else if (!strcmp(key, "WM/WMRVBitrate"))
471
        else if (!strcmp(key, "WM/WMRVExpirationDate")) {
472
            if (oledate_to_iso8601(buf, buf_size, num) < 0 ) {
473
                av_free(buf);
474
                return;
475
            }
476
        } else if (!strcmp(key, "WM/WMRVBitrate"))
469 477
            snprintf(buf, buf_size, "%f", av_int2dbl(num));
470 478
        else
471 479
            snprintf(buf, buf_size, "%"PRIi64, num);

Also available in: Unified diff