#include "libavutil/intreadwrite.h"
#include "libavutil/intfloat.h"
#include "libavutil/dict.h"
+#include "libavutil/time_internal.h"
#include "avformat.h"
#include "internal.h"
#include "riff.h"
#define SHIFT_SECTOR_BITS(a) ((int64_t)(a) << WTV_SECTOR_BITS)
-typedef struct {
+typedef struct WtvFile {
AVIOContext *pb_filesystem; /** file system (AVFormatContext->pb) */
int sector_bits; /** sector shift bits; used to convert sector number into pb_filesystem offset */
*
*/
-typedef struct {
+typedef struct WtvStream {
int seen_data;
} WtvStream;
-typedef struct {
+typedef struct WtvContext {
AVIOContext *pb; /** timeline file */
int64_t epoch;
int64_t pts; /** pts for next data chunk */
static void filetime_to_iso8601(char *buf, int buf_size, int64_t value)
{
time_t t = (value / 10000000LL) - 11644473600LL;
- struct tm *tm = gmtime(&t);
- if (tm)
- strftime(buf, buf_size, "%Y-%m-%d %H:%M:%S", tm);
- else
+ struct tm tmbuf;
+ struct tm *tm = gmtime_r(&t, &tmbuf);
+ if (tm) {
+ if (!strftime(buf, buf_size, "%Y-%m-%d %H:%M:%S", tm))
+ buf[0] = '\0';
+ } else
buf[0] = '\0';
}
static void crazytime_to_iso8601(char *buf, int buf_size, int64_t value)
{
time_t t = (value / 10000000LL) - 719162LL*86400LL;
- struct tm *tm = gmtime(&t);
- if (tm)
- strftime(buf, buf_size, "%Y-%m-%d %H:%M:%S", tm);
- else
+ struct tm tmbuf;
+ struct tm *tm = gmtime_r(&t, &tmbuf);
+ if (tm) {
+ if (!strftime(buf, buf_size, "%Y-%m-%d %H:%M:%S", tm))
+ buf[0] = '\0';
+ } else
buf[0] = '\0';
}
static void oledate_to_iso8601(char *buf, int buf_size, int64_t value)
{
time_t t = 631112400LL + 86400*av_int2double(value);
- struct tm *tm = gmtime(&t);
- if (tm)
- strftime(buf, buf_size, "%Y-%m-%d %H:%M:%S", tm);
- else
+ struct tm tmbuf;
+ struct tm *tm = gmtime_r(&t, &tmbuf);
+ if (tm) {
+ if (!strftime(buf, buf_size, "%Y-%m-%d %H:%M:%S", tm))
+ buf[0] = '\0';
+ } else
buf[0] = '\0';
}
if (!st)
return NULL;
if (!ff_guidcmp(formattype, format_waveformatex)) {
- int ret = ff_get_wav_header(pb, st->codec, size);
+ int ret = ff_get_wav_header(s, pb, st->codec, size);
if (ret < 0)
return NULL;
} else {