#include "asf.h"
#include "asfcrypt.h"
+#ifdef __TIZEN__
+#include <time.h>
+#endif
+
typedef struct ASFPayload {
uint8_t type;
uint16_t size;
avio_seek(s->pb, off + len, SEEK_SET);
}
+#ifdef __TIZEN__
+static void asf_set_create_time(AVFormatContext *s, uint64_t create_time)
+{
+ struct tm tmbuf;
+ struct tm *tm;
+ char buf[64];
+ time_t creation_time = create_time;
+
+ // creation date is in 100 ns units from 1 Jan 1601, conversion to s
+ creation_time /= 10000000;
+ // there are 11644473600 seconds between 1 Jan 1601 and 1 Jan 1970
+ creation_time -= 11644473600;
+ tm = gmtime_r(&creation_time, &tmbuf);
+ if (tm) {
+ if (!strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S", tm))
+ buf[0] = '\0';
+ } else
+ buf[0] = '\0';
+ if (buf[0]) {
+ if (av_dict_set(&s->metadata, "creation_time", buf, 0) < 0)
+ av_log(s, AV_LOG_WARNING, "av_dict_set failed.\n");
+ }
+}
+#endif
+
static int asf_read_file_properties(AVFormatContext *s)
{
ASFContext *asf = s->priv_data;
ff_get_guid(pb, &asf->hdr.guid);
asf->hdr.file_size = avio_rl64(pb);
asf->hdr.create_time = avio_rl64(pb);
+#ifdef __TIZEN__
+ asf_set_create_time(s, asf->hdr.create_time);
+#endif
avio_rl64(pb); /* number of packets */
asf->hdr.play_time = avio_rl64(pb);
asf->hdr.send_time = avio_rl64(pb);
if (!(asf->hdr.flags & 0x01)) { // if we aren't streaming...
int64_t fsize = avio_size(pb);
+#ifndef __TIZEN__
if (fsize <= 0 || (int64_t)asf->hdr.file_size <= 0 ||
FFABS(fsize - (int64_t)asf->hdr.file_size) < FFMIN(fsize, asf->hdr.file_size)/20)
+#endif
st->duration = asf->hdr.play_time /
(10000000 / 1000) - start_time;
}