From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 5F40944A31 for ; Mon, 3 Oct 2022 16:08:26 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 6AC7468BBA7; Mon, 3 Oct 2022 19:08:23 +0300 (EEST) Received: from mail-pg1-f179.google.com (mail-pg1-f179.google.com [209.85.215.179]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 397BA68BB72 for ; Mon, 3 Oct 2022 19:08:17 +0300 (EEST) Received: by mail-pg1-f179.google.com with SMTP id 3so10063751pga.1 for ; Mon, 03 Oct 2022 09:08:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date :message-id:from:from:to:cc:subject:date; bh=wtI/UuhogxV1lnVJitLotQQWuYBagmmRMX+K+WT7W/Y=; b=MGiKkLQE3U+JQBpMzSbURa9cAAK7dSn4CxKp7+V/Scjd4MwqiNH7RL8Vm4leGaaGiD mKVPY7MDqHk39xXesYSBIe2gqxdClsJHev7NtiHBkujfK22Bu6fRnt4IvnzAfPz23AX3 mu0iWLuUnTji2e4ZshWkI/iJ+RJQxZWyNqd6re/zhWFGDLq4XfllZiP4Z9E7Lx/IAlLU tFuDMxITu3CyW1NYP46vkV1o1MosQQzGcGqP7gEq95GZVe6Qm4dB4N2zWKs00ox9m+OC tDD/y0QILgP0kJA7ReXnXR5xG1PqO9BmoIA3NWJgKvOgbu9l4KwaWF7iZKceRLh7Aw0N XRIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date :message-id:from:x-gm-message-state:from:to:cc:subject:date; bh=wtI/UuhogxV1lnVJitLotQQWuYBagmmRMX+K+WT7W/Y=; b=IhKxQr4cnMgIhAk78Znh7gkR8WNKiN15HQ7K0jHtefqTBGzEUVNudnrEAYmrQRxXQi crkj66HQQhe8tZ9fHjBNtC2m18+J4ET3P6aAwcM/fp1N7Oh1SC+fZAeLcMzckSQQDBxl eOY9rOhL5wUyjpoFNa0/IwBjAfgThohfQexKvIusufY8i1+tpb0Pgrh+d7h1ARY61p+E ipMaYwTSgl9g96uUdu8POCTyotjq9iuaZe4f4XSq9QCg/gRZZyTDp2shbCRWV0gF782C HZwTSFA9uuTPjsJFOfcaR2wUY/9DFENkitG0bc8ariFFp4F/tfo5M7p9B3egK3LZ+yM8 US0g== X-Gm-Message-State: ACrzQf3z1uvNtbtuZjSESIrj5BqQIatnZwgEuPE5A9rJvnRNhs65OaLh 0C/eeC+EtoTOpcp3rqO+Iv2pY9YgjzM= X-Google-Smtp-Source: AMsMyM7CkthoOBZFj9HVtQeT1Kvp1QGSKYfkFL5LHetjikgnJdK67VoSqLDM6NpeBtt/HIlTTl+phQ== X-Received: by 2002:a05:6a00:b8d:b0:543:6731:8b6c with SMTP id g13-20020a056a000b8d00b0054367318b6cmr23267385pfj.80.1664813295080; Mon, 03 Oct 2022 09:08:15 -0700 (PDT) Received: from [127.0.0.1] (master.gitmailbox.com. [34.83.118.50]) by smtp.gmail.com with ESMTPSA id e3-20020a17090301c300b001782f94f8ebsm7460778plh.3.2022.10.03.09.08.14 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 03 Oct 2022 09:08:14 -0700 (PDT) From: Bryce Chester Newman X-Google-Original-From: Bryce Chester Newman Message-Id: Date: Mon, 03 Oct 2022 16:08:14 +0000 Fcc: Sent MIME-Version: 1.0 To: ffmpeg-devel@ffmpeg.org Subject: [FFmpeg-devel] [PATCH] libavformat/mov: Add support for exporting poster time. X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Bryce Chester Newman Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: From: Bryce Chester Newman Export the poster_time_location if available. The poster_time_location is calculated using the poster_time / time_scale = X seconds. The value of poster_time_location indicates where in the video the poster frame is. Addresses feedback from https://www.mail-archive.com/ffmpeg-devel@ffmpeg.org/msg138122.html. Signed-off-by: Bryce Chester Newman bryce.newman@gettyimages.com --- libavformat/mov: Add support for exporting poster time. Export the poster_time_location if available. The poster_time_location is calculated using the poster_time / time_scale = X seconds. The value of poster_time_location indicates where in the video the poster frame is. Addresses feedback from https://www.mail-archive.com/ffmpeg-devel@ffmpeg.org/msg138122.html. Signed-off-by: Bryce Chester Newman bryce.newman@gettyimages.com Published-As: https://github.com/ffstaging/FFmpeg/releases/tag/pr-ffstaging-41%2Fbrycechesternewman%2Fadd_poster_time_location_mov-v1 Fetch-It-Via: git fetch https://github.com/ffstaging/FFmpeg pr-ffstaging-41/brycechesternewman/add_poster_time_location_mov-v1 Pull-Request: https://github.com/ffstaging/FFmpeg/pull/41 doc/demuxers.texi | 6 ++++++ libavformat/isom.h | 1 + libavformat/mov.c | 13 +++++++++++-- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/doc/demuxers.texi b/doc/demuxers.texi index 2b6dd86c2a..b1f4926c40 100644 --- a/doc/demuxers.texi +++ b/doc/demuxers.texi @@ -749,6 +749,12 @@ cast to int32 are used to adjust onward dts. Unit is the track time scale. Range is 0 to UINT_MAX. Default is @code{UINT_MAX - 48000*10} which allows upto a 10 second dts correction for 48 kHz audio streams while accommodating 99.9% of @code{uint32} range. + +@item poster_time_location +Export the poster_time_location if available. +The poster_time_location is calculated using the poster_time / time_scale = X seconds. +The value of poster_time_location indicates where in the video the poster frame is. +Default is false. @end table @subsection Audible AAX diff --git a/libavformat/isom.h b/libavformat/isom.h index 64fb7065d5..fb3d8d5618 100644 --- a/libavformat/isom.h +++ b/libavformat/isom.h @@ -326,6 +326,7 @@ typedef struct MOVContext { int64_t extent_offset; } *avif_info; int avif_info_size; + int poster_time_location; } MOVContext; int ff_mp4_read_descr_len(AVIOContext *pb); diff --git a/libavformat/mov.c b/libavformat/mov.c index 1f436e21d6..b914bbc96a 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -1501,6 +1501,7 @@ static int mov_read_mvhd(MOVContext *c, AVIOContext *pb, MOVAtom atom) { int i; int64_t creation_time; + int32_t poster_time; int version = avio_r8(pb); /* version */ avio_rb24(pb); /* flags */ @@ -1535,12 +1536,20 @@ static int mov_read_mvhd(MOVContext *c, AVIOContext *pb, MOVAtom atom) avio_rb32(pb); /* preview time */ avio_rb32(pb); /* preview duration */ - avio_rb32(pb); /* poster time */ + poster_time = avio_rb32(pb); /* poster time */ avio_rb32(pb); /* selection time */ avio_rb32(pb); /* selection duration */ avio_rb32(pb); /* current time */ avio_rb32(pb); /* next track ID */ + if(c->poster_time_location && poster_time && c->time_scale && c->time_scale > 0) { + av_log(c->fc, AV_LOG_TRACE, "poster_time = %i, time_scale = %i\n", poster_time, c->time_scale); + char buffer[32]; + int poster_time_location = poster_time / c->time_scale; + snprintf(buffer, sizeof(buffer), "%i", poster_time_location); + av_dict_set(&c->fc->metadata, "poster_time_location", buffer, 0); + } + return 0; } @@ -9114,7 +9123,7 @@ static const AVOption mov_options[] = { { "enable_drefs", "Enable external track support.", OFFSET(enable_drefs), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, FLAGS }, { "max_stts_delta", "treat offsets above this value as invalid", OFFSET(max_stts_delta), AV_OPT_TYPE_INT, {.i64 = UINT_MAX-48000*10 }, 0, UINT_MAX, .flags = AV_OPT_FLAG_DECODING_PARAM }, - + { "poster_time_location", "Export the poster time location.", OFFSET(poster_time_location), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, FLAGS | AV_OPT_FLAG_EXPORT }, { NULL }, }; base-commit: 5f02a261a2ddca7c79198869b45d35019baac819 -- ffmpeg-codebot _______________________________________________ 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".