From patchwork Sun Dec 23 00:12:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marton Balint X-Patchwork-Id: 11526 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 07E0D44DED9 for ; Sun, 23 Dec 2018 02:13:12 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id B3F4068ADF6; Sun, 23 Dec 2018 02:13:08 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from iq.passwd.hu (iq.passwd.hu [217.27.212.140]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 5470E68ADD6 for ; Sun, 23 Dec 2018 02:13:03 +0200 (EET) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 166ADE1611; Sun, 23 Dec 2018 01:13:07 +0100 (CET) X-Virus-Scanned: amavisd-new at passwd.hu Received: from iq.passwd.hu ([127.0.0.1]) by localhost (iq.passwd.hu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id lVM8oOkF0-2Y; Sun, 23 Dec 2018 01:13:06 +0100 (CET) Received: from bluegene.passwd.hu (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 2F82DE160E; Sun, 23 Dec 2018 01:13:06 +0100 (CET) From: Marton Balint To: ffmpeg-devel@ffmpeg.org Date: Sun, 23 Dec 2018 01:12:56 +0100 Message-Id: <20181223001256.31893-3-cus@passwd.hu> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20181223001256.31893-1-cus@passwd.hu> References: <20181223001256.31893-1-cus@passwd.hu> Subject: [FFmpeg-devel] [PATCH 3/3] avformat/mxfenc: support writing subsecond precision timestamps X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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: Marton Balint MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Signed-off-by: Marton Balint --- libavformat/mxfenc.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c index 5e7bd212dc..032ee3bf3d 100644 --- a/libavformat/mxfenc.c +++ b/libavformat/mxfenc.c @@ -2332,8 +2332,9 @@ static int mxf_parse_mpeg2_frame(AVFormatContext *s, AVStream *st, return !!sc->codec_ul; } -static uint64_t mxf_parse_timestamp(time_t timestamp) +static uint64_t mxf_parse_timestamp(int64_t timestamp64) { + time_t timestamp = timestamp64 / 1000000; struct tm tmbuf; struct tm *time = gmtime_r(×tamp, &tmbuf); if (!time) @@ -2343,7 +2344,8 @@ static uint64_t mxf_parse_timestamp(time_t timestamp) (uint64_t) time->tm_mday << 32 | time->tm_hour << 24 | time->tm_min << 16 | - time->tm_sec << 8; + time->tm_sec << 8 | + (timestamp64 % 1000000) / 4000; } static void mxf_gen_umid(AVFormatContext *s) @@ -2580,7 +2582,7 @@ static int mxf_write_header(AVFormatContext *s) sc->order = AV_RB32(sc->track_essence_element_key+12); } - if (ff_parse_creation_time_metadata(s, ×tamp, 1) > 0) + if (ff_parse_creation_time_metadata(s, ×tamp, 0) > 0) mxf->timestamp = mxf_parse_timestamp(timestamp); mxf->duration = -1;