From patchwork Mon Apr 26 09:34:21 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: 27417 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:5014:0:0:0:0:0 with SMTP id e20csp3807893iob; Mon, 26 Apr 2021 02:42:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxNZJjxMUQX7ZSHyVT/gaynoaZOQKln596uV9aebnwzJ0bJdZ7Qs4O9EBBn0+ClZnz1HEjd X-Received: by 2002:a17:906:98d6:: with SMTP id zd22mr18115231ejb.17.1619430173081; Mon, 26 Apr 2021 02:42:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619430173; cv=none; d=google.com; s=arc-20160816; b=uvHQQLMO2h0AfZNkKf3Os+dEUxh2ag04GD1HyknSOdYwQS5eN+Vdnm/884rPE8j45q /WsdF2S3+d4Gl7Pyjkp+ePf9HKDohl94L+lPBK7XfEmFTHT4+qXK+Oj4dhXD+khIyrXp jGWpgxhoVt0E1fv7PzBpsy0/aOh3CzHebDIrueUxWjeykBg+4fF9+LKMS6R68YecG2eP gpLqQK8PtqK1NBrH4qzx+QmgUVRlxpyLVz84AQFJO3rO3+JYW3zWUZApBicm9hP/uUYQ 609rQVYO9Ls9v1kN+xj6Y5oOj0Ih2BsTf0KxIeuJd0n+8n7SLTXMxAJr4xzog3e5Jb+c 5U1g== 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=1iDkt6Q/7JnnYm0QNM8PCxz413wcMl0mxycx5WVoE30=; b=Bj7AGscRWgCYnIDRjKozfVyy7MoHUnaaOHgM8pAS9L6I+aW962W823vKmGoMlQWw6S Z6TwHF6aYiGiFI0ZjglzB/o6DLLBewRosetaEZNJXIT/gtFtXXv0bRU1JP4YzUV1v5kh 8CkyY4tEp5bZJhVVu2UybBIoLvnc3HUQoE6HuWgw9xIj9URTobJ1Sx7P9GohLwhqzSE2 nZx2hQhOsqf7gq4Y6NrOonSHHniJLulnmxlXnxvCL31aPR25Vo42FgtSwGJtACm4JfeM y9bNPhUod0+VY/Z3ZivpQNYLzKEVHu25RDIRiG2U6fRVzNu3tbj/UbTb58xKFgc8OpA4 K8eA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=a+Fn8LDD; 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 za7si13246910ejb.52.2021.04.26.02.42.52; Mon, 26 Apr 2021 02:42:53 -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=a+Fn8LDD; 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 D1E87680836; Mon, 26 Apr 2021 12:42:49 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-lj1-f174.google.com (mail-lj1-f174.google.com [209.85.208.174]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 67438680CEC for ; Mon, 26 Apr 2021 12:42:43 +0300 (EEST) Received: by mail-lj1-f174.google.com with SMTP id o16so63285543ljp.3 for ; Mon, 26 Apr 2021 02:42:43 -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=FAd4/fOSCmYHLFyH/Nb+LhpLWlz+ckP36l8i/urP+zU=; b=a+Fn8LDDfVp1jqYmu8wIkQ/il3cJ5XDWjIxDUCGsnrhO2YzcYyre5OS+r9UnEboCWk 1NRhuZ5h881nXQ1xpErCX14uSuygWH8XqUAW9bFVoKY0wWFLsiqKoR1Lh07FC4GOmYqm 4Hp3W2OZWclWex5sVOOH5f/EkYDDVTtLpbOU714DSJDzmo1dns+bkhI12fjn6ta8fyjO tuv3RotlS85Cyj3Jw9T5AeJi2Vev/LjWVdCjYgrVHzIH/YRUz6sX7VMPuFRJWMFiSP2k hsuGWWvOsXLYBYokOjAkFOkuivWHg5y15YsnTCsUCmOT+IblhYJSeAWXLP8XlfQHXbVg fICg== 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=FAd4/fOSCmYHLFyH/Nb+LhpLWlz+ckP36l8i/urP+zU=; b=C1ZePc1Ie9cdbAiE2rLuP3sx6mSJ0uHQGlwlpEVCRFWJO1BKXPBdgNoS9afGU0el8g KxkzOjV7FSGswuTQYU8U0Ff31p+cvIG4+i6wpSs/VcX4xeXPe2J/LKlHMy4A9wz8T5yw 8hL75vtShz3zMe0IXFOTN1W1wX20kEUR3dRn8t/c1roIYRk/fuNzCdtcWVf7kTNBf68/ qzCGtS8yDjDL8FPY1PPXuhk/QFl27v8qXaNN04RPWNJvvSKMay1Q7848XTt8yeJRaxeO PR6RjGAvXTtUS8uYU2PZKciCRCGIX9Jzc8JFgNhn8UdbnNq97Pv8V5SWWoiS+Y/fFCcg 4ikQ== X-Gm-Message-State: AOAM533ji0TU6WcZmj6n6JIqwt77nDNhDEplRps4DChG4X1Zz4wvTZOg zOf6Hu+393TiTrN/OxtKg5Bl7LctSp0= X-Received: by 2002:a2e:9597:: with SMTP id w23mr12465915ljh.270.1619429668884; Mon, 26 Apr 2021 02:34:28 -0700 (PDT) Received: from localhost.localdomain (91-159-194-103.elisa-laajakaista.fi. [91.159.194.103]) by smtp.gmail.com with ESMTPSA id m7sm1402883ljp.102.2021.04.26.02.34.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Apr 2021 02:34:28 -0700 (PDT) From: =?utf-8?q?Jan_Ekstr=C3=B6m?= To: ffmpeg-devel@ffmpeg.org Date: Mon, 26 Apr 2021 12:34:21 +0300 Message-Id: <20210426093425.17900-1-jeebjp@gmail.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v3 0/4] Initial region (styling) support for TTML 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: CbaTYwaYSkqD Now sets alignment, font size, font family and the region's position and size according to the ASS styles passed to the encoder. Regions are relatively important in TTML, since the spec-defined default region is in raster location (similar to the default with HTML) - it starts from the top left corner and covers the whole screen. Mapping of the ASS script resolution to the cell resolution and using cells as sizing metric is not perfect, but while TTML does have a pixel based reference sizing by means of setting an extent to the root tt element, it is specifically disallowed in the EBU-TT profile, as well as apparently generally frowned upon as opposed to defining the cell resolution. In general, mapping to cell resolution seems to give "close enough" results, though. FATE test output still passes https://github.com/skynav/ttt/ validation, and visually the result can be verified against such renderers as http://sandflow.com/imsc1_1/index.html . Changes from v2: * Noticed that taking a pointer to an already dereferenced style in libavcodec/ttmlenc.c is unnecessary and complicates the style-writing function for no real reason. Thus, made the function just take in the struct, as opposed to a pointer to a struct. Will still be pushing this patch set in soon, posting this minor revision of the patch set just so that it is in the mailing list archives and patchwork's automation can poke at it. Jan Jan Ekström (4): avcodec/ttmlenc: split header writing into its own function avformat/ttmlenc: enable writing out additional header values avcodec/ttmlenc: add initial support for regions and styles avcodec/ttmlenc: add support for region positioning and sizing libavcodec/ttmlenc.c | 264 ++++++++++++++++++++++++++++++++++--- libavcodec/ttmlenc.h | 6 + libavformat/ttmlenc.c | 70 +++++++++- tests/ref/fate/sub-ttmlenc | 88 +++++++------ 4 files changed, 368 insertions(+), 60 deletions(-)