From: Marton Balint <cus@passwd.hu>
To: ffmpeg-devel@ffmpeg.org
Cc: Marton Balint <cus@passwd.hu>
Subject: [FFmpeg-devel] [PATCH 2/6] avformat/mov: restrict unix timestamp hack to version 0 mdhd/mvhd
Date: Sun, 16 Apr 2023 00:05:54 +0200
Message-ID: <20230415220558.16122-2-cus@passwd.hu> (raw)
In-Reply-To: <20230415220558.16122-1-cus@passwd.hu>
Commit 23eeffcd48a15e73fb2649b712870b6d101c5471 added a hack to support invalid
files where the creation date was encoded as a classic unix timestamp. Let's
reduce the scope of the hack by only applying it to version 0 mdhd/mvhd atoms.
Also warn the user of such possibly broken files.
Signed-off-by: Marton Balint <cus@passwd.hu>
---
libavformat/mov.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 5d00ff6e8b..1b3c1d7683 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -1524,10 +1524,13 @@ static void mov_metadata_creation_time(MOVContext *c, AVIOContext *pb, AVDiction
} else {
time = avio_rb32(pb);
avio_rb32(pb); /* modification time */
+ if (time > 0 && time < 2082844800) {
+ av_log(c->fc, AV_LOG_WARNING, "Detected creation time before 1970, parsing as unix timestamp.\n");
+ time += 2082844800;
+ }
}
if (time) {
- if (time >= 2082844800)
- time -= 2082844800; /* seconds between 1904-01-01 and Epoch */
+ time -= 2082844800; /* seconds between 1904-01-01 and Epoch */
if ((int64_t)(time * 1000000ULL) / 1000000 != time) {
av_log(c->fc, AV_LOG_DEBUG, "creation_time is not representable\n");
--
2.35.3
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
next prev parent reply other threads:[~2023-04-15 22:06 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-15 22:05 [FFmpeg-devel] [PATCH 1/6] avformat/mov: factorize reading creation time metadata Marton Balint
2023-04-15 22:05 ` Marton Balint [this message]
2023-04-15 22:05 ` [FFmpeg-devel] [PATCH 3/6] avformat/movenc: factorize determining mdhd/mvhd/tkhd version Marton Balint
2023-04-15 22:05 ` [FFmpeg-devel] [PATCH 4/6] avformat/smoothstreamingenc: do not override movflag defaults Marton Balint
2023-04-15 22:05 ` [FFmpeg-devel] [PATCH 5/6] tests: do not override movflags defaults Marton Balint
2023-04-15 22:05 ` [FFmpeg-devel] [PATCH 6/6] doc/muxers: reorder and cleanup mov muxer options Marton Balint
2023-04-23 18:46 ` [FFmpeg-devel] [PATCH 1/6] avformat/mov: factorize reading creation time metadata Marton Balint
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230415220558.16122-2-cus@passwd.hu \
--to=cus@passwd.hu \
--cc=ffmpeg-devel@ffmpeg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git