From patchwork Mon Jul 19 11:40:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Jan_Ekstr=C3=B6m?= X-Patchwork-Id: 28972 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a5d:965a:0:0:0:0:0 with SMTP id d26csp4309749ios; Mon, 19 Jul 2021 04:46:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJym5TVWdlJLVEtRRaMYoppHwbg7LceYdCEGPo+kF/eiRWzJapUEbjzPVMO6j90+9XRJjfFe X-Received: by 2002:a05:6402:2919:: with SMTP id ee25mr34855651edb.222.1626695174262; Mon, 19 Jul 2021 04:46:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626695174; cv=none; d=google.com; s=arc-20160816; b=TbUW82yQ+OX86OMLVYVTdZ4vwIMxY0GkVH9DvtMxIyUcRckhYJMip9dslEkj0L5DLc U50WEP/jhyhlFTDBgM/Cako+6AucePkUb6wAT/ATDhtH6c8l90FRUYoED8bd/308ZB9l nyHese2psk9X3XBojuwLLQ9I1agJILlC2ZwHxNwxFKaw3WnoJ62/efEvdSWWhbKk7UHW EoGxKdoOsgcPbSllrD/kl6IorYk3K0ZfkP11/IYxPGsxEBsQI1sevGqkL8HMR2aSCRhM LT9AiqP+7eenw519SDom4N/MGlvOrQ+n2hAjotAX+Rz/4d7zyWHETX6DEbYh/GUkDv8a evqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:message-id:date:to:from :dkim-signature:delivered-to; bh=bJbAYFrdEvESekDVsU+KPpNZ+Uot5S1gkXsUBSMxyb4=; b=EbWZCb5aNdivsb2P+iXuO34MVjKftXHXrpira+R3xSaBGQ90ku3f0AnAdcxlFMWLbU k5fx+yeuhSwPStUxsE1WZO7KD15Swt5ztRcMW/Z7zjMRtrIzqznsiRChw/H9wDTohtel lSJz8DSkVtaRrqFM262iQyf6wZnWuCo4P+YP2I4p0lwEV+5+rICaQNnXcnal599u3CPZ xRCtRhnghVPjTGCrbDkAUi553CequH07i2RxHNpLaSwKF7eADWhONSKaqZh4ie3c56QS PC4W5c7BrY+VrQt9tAyBKJn8kCbRrR6igW8N3A2NknXdv+2x1HPd46pfL4RehgioRNRM ejTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=nzC5DW2l; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id ox14si20601289ejb.694.2021.07.19.04.46.14; Mon, 19 Jul 2021 04:46:14 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=nzC5DW2l; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 3711168AD0A; Mon, 19 Jul 2021 14:46:11 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-ed1-f41.google.com (mail-ed1-f41.google.com [209.85.208.41]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 55EF1689DD9 for ; Mon, 19 Jul 2021 14:46:04 +0300 (EEST) Received: by mail-ed1-f41.google.com with SMTP id l26so23500402eda.10 for ; Mon, 19 Jul 2021 04:46:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=v3VtI/O3VOOCJE28vl/i1G3FUhEErrNGy0FhXEJQ02o=; b=nzC5DW2lUXH2GUPlE74Si4BX+Uu2uTl1axhYTP7JIyfWTzf+eo+emrW1aLw+Liwofw IQpHW8feapbThDHheTdCxTEA/K/8TxNqlnoZlMPkl90FMlHQUsiDVrPogqaQ5MwThhpe n3XOPfmtcr2cwwxnERXAWqVWR3j9TqM7fOL3ZVrNyQbEGfzGHRn+tjJq3Jz/F9vEAG9i n6Z3QX1x8QEgh7R/uA/yDMsnua2/Cps6nM8HMwsnpq+j7AMX9dy5CDseDeTQUNtN5MYx o8Axqds7Sf3hl3CEp1kSF6Gj60Xy9iVMh9tvfoWugdENbTZ6M/ibY5wWhVDOT1xgPjNB GXbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=v3VtI/O3VOOCJE28vl/i1G3FUhEErrNGy0FhXEJQ02o=; b=k9LTCuiu60w4DYcl+prCT8MO1Ml0SABV3rrUTTo/w/MB43hHhW4NDV7aqtP7ewEMB/ pVE9rvURLCCm/8jIF19Nc6J6Dld+Uf+CEoSleyGbBagqPpG+z7pRGecTcm9eAkeT0foB YeZoVse6F/aIFtSnzTC/4KXR4by8xBo4U6If4mLbkwQwL0H5b5TgxlFrdeEkvPgLCNad JLf6TH7NrqYvqhhgzMBdvo2sfv9RSNip0YCsnA9LbKyvOm5OYYhn3VjGIypejCvgl2rD VJZel16+TgzEpLjVoLLXgd5Es1r/i07nbwqdXUOZoYUrkF4G/fJjZhsQGBM9M8xtDhED hTEg== X-Gm-Message-State: AOAM531InpnDXU4xozyWRdQeglfvKRclUexr/3ssddHdn9y0mdk0NNMZ nQTgEtIoBFNRedx4A4c2jjTB17M/S4vkeg== X-Received: by 2002:a05:651c:1507:: with SMTP id e7mr22155876ljf.9.1626694851368; Mon, 19 Jul 2021 04:40:51 -0700 (PDT) Received: from localhost.localdomain (91-159-194-103.elisa-laajakaista.fi. [91.159.194.103]) by smtp.gmail.com with ESMTPSA id x7sm1266768lfu.17.2021.07.19.04.40.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Jul 2021 04:40:50 -0700 (PDT) From: =?utf-8?q?Jan_Ekstr=C3=B6m?= To: ffmpeg-devel@ffmpeg.org Date: Mon, 19 Jul 2021 14:40:43 +0300 Message-Id: <20210719114045.44039-1-jeebjp@gmail.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 0/2] TTML in MP4, part 1 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: TnjLTirwvFIF To keep it simpler this first part includes only non-fragmented use cases if the built-in sample squashing is utilized. Contains the basic mapping code as well as the function that writes out the squashed documents. Works with both subtitle-only output as well as with other streams. In a separate patch set I will add additional complexity on top by introducing fragmentation matching based on the other streams in the mux (since most things that ingest fragmented MP4 with subtitles want the fragment time ranges to match between the video/audio streams and subtitles in the mux). Changes from v1: * Misc. small changes according to review from Martin. * Removed the {start,end}_ts variables for the packet queue, they are not required for the functionality that is being added currently and simplify the code. * Track start/end calculation based on other tracks was removed. This will become required when fragmentation support is added (as the fragmentation will have to be matched against A/V tracks), but for now a track should only be interested of its own state. Jan Jan Ekström (2): avformat/ttml: split TTML paragraph based or not check into header avformat/movenc: add support for TTML muxing libavformat/Makefile | 2 +- libavformat/isom.h | 3 + libavformat/movenc.c | 167 +++++++++++++++++++++++++- libavformat/movenc.h | 5 + libavformat/movenc_ttml.c | 195 +++++++++++++++++++++++++++++++ libavformat/movenc_ttml.h | 31 +++++ libavformat/ttmlenc.c | 9 +- libavformat/ttmlenc.h | 39 +++++++ tests/fate/subtitles.mak | 4 + tests/ref/fate/sub-ttml-mp4-dfxp | 44 +++++++ tests/ref/fate/sub-ttml-mp4-stpp | 44 +++++++ 11 files changed, 533 insertions(+), 10 deletions(-) create mode 100644 libavformat/movenc_ttml.c create mode 100644 libavformat/movenc_ttml.h create mode 100644 libavformat/ttmlenc.h create mode 100644 tests/ref/fate/sub-ttml-mp4-dfxp create mode 100644 tests/ref/fate/sub-ttml-mp4-stpp