Commit f6065c18 authored by Lucas Beeler's avatar Lucas Beeler

Adds special-case, date and time correction logic that works around a date...

Adds special-case, date and time correction logic that works around a date encoding problem present in some HTC Android phones. Closes #3314.
parent 725d941b
......@@ -21,7 +21,7 @@ public class VideoMetadata : MediaMetadata {
if (quicktime.is_supported()) {
timestamp = quicktime.get_creation_date_time();
title = quicktime.get_title();
// TODO is there an quicktime.get_comment ??
// TODO: is there an quicktime.get_comment ??
comment = null;
return;
}
......@@ -54,7 +54,7 @@ private class QuickTimeMetadataLoader {
// Quicktime calendar date/time format is number of seconds since January 1, 1904.
// This converts to UNIX time (66 years + 17 leap days).
public static const ulong QUICKTIME_EPOCH_ADJUSTMENT = 2082844800;
public const time_t QUICKTIME_EPOCH_ADJUSTMENT = 2082844800;
private File file = null;
......@@ -113,7 +113,7 @@ private class QuickTimeMetadataLoader {
private ulong get_creation_date_time_for_quicktime() {
QuickTimeAtom test = new QuickTimeAtom(file);
ulong timestamp = 0;
time_t timestamp = 0;
try {
test.open_file();
......@@ -154,7 +154,19 @@ private class QuickTimeMetadataLoader {
} catch (GLib.Error e) {
debug("Error while closing Quicktime file: %s", e.message);
}
return timestamp;
// Some Android phones package videos recorded with their internal cameras in a 3GP
// container that looks suspiciously like a QuickTime container but really isn't -- for
// the timestamps of these Android 3GP videos are relative to the UNIX epoch
// (January 1, 1970) instead of the QuickTime epoch (January 1, 1904). So, if we detect a
// QuickTime movie with a negative timestamp, we can be pretty sure it isn't a valid
// QuickTime movie that was shot before 1904 but is instead a non-compliant 3GP video
// file. If we detect such a video, we correct its time. See this Redmine ticket
// (http://redmine.yorba.org/issues/3314) for more information.
if (timestamp < 0)
timestamp += QUICKTIME_EPOCH_ADJUSTMENT;
return (ulong) timestamp;
}
}
......
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