From patchwork Mon Feb 22 13:19:10 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: 25893 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 C4FA744A67C for ; Mon, 22 Feb 2021 15:25:35 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id A963968AA07; Mon, 22 Feb 2021 15:25:35 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-lj1-f175.google.com (mail-lj1-f175.google.com [209.85.208.175]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C7A4A68AA07 for ; Mon, 22 Feb 2021 15:25:29 +0200 (EET) Received: by mail-lj1-f175.google.com with SMTP id e8so19027094ljj.5 for ; Mon, 22 Feb 2021 05:25:29 -0800 (PST) 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=Xp4wpPT1v3rvZ0zyfwI/q6t4DtgjY3YQybCMpdDqqAE=; b=tfniO7W/zF4uxqeQidxH7JldQmnfmFWrAm2+LqWhQ4SDZIVuTLnwFRDao7MHfz9thU NtM2+Sd8EXetbPc5CTuS5H+i8apYY0LDYT14TQSfR7Agkfmvo0Zk+mtMGrfyg1RLZCup U8XjN8GhNK6HXJPPbs27CBZ+TAfrpuhKWYSlZMSXM78M/rODRednwUUfFIuySGB6CRDN C22uGE4iySsyscgp/u9oS3Gm2FFllTrfyECcexRkBaZHQyqhcHkt5qQOmIVZA0fPuNL8 mpHt+dAlaftOwTUXaxKnppsXo3IIerxPqV3BnvfLNukGbvmm9uJaalz/DefZ0e4pZZyl YXKw== 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=Xp4wpPT1v3rvZ0zyfwI/q6t4DtgjY3YQybCMpdDqqAE=; b=Y6OdsR4tB6hA96r6miGRnXQB3o9S9ItIOICHJcDSeyMnq0EDToyB8Ug+07DzDWdPz+ TzHCq6Ehj4K4fF6wKilLEWqGCSzIAcHqyQ6n3u1vCf5jtjk8Bg9JhD88LC+DnsQIV68i fvlGX07z/t69getqU8FMjcylKqV9hj83a3WwMm+KL11tGKF1HaRJ4WwjOeFuKHkaNg8r jgH9FQ3KV1RpT7GdzHgmqqVEBHLIVSX2Y/hX4k2akSn36OQb5HsjlsK2rkQ6grdbNN4c FcM9V6c6q8ft0UGZlKHL1S+LyvvusEvAuGqKR81k1MYTfoiqcS8Rry3Dfqwifp2GclOg ZNVA== X-Gm-Message-State: AOAM530ruP5DLszjX0J8OgFgu31hg9nuF+MptQO/HMHpXM/6j3ACBPfb 5oHQOzYLlXSF9EybDc7EkN7a1GBc8Vg= X-Google-Smtp-Source: ABdhPJw33eu/2Hy/AMFvRL1VUdbI4BAfNifboGV7G2K5/OHj3BXB5Dxx66r5kEQdFSt1GjE5L3DSKQ== X-Received: by 2002:a05:651c:1294:: with SMTP id 20mr3212816ljc.261.1613999957665; Mon, 22 Feb 2021 05:19:17 -0800 (PST) Received: from localhost.localdomain (91-159-194-103.elisa-laajakaista.fi. [91.159.194.103]) by smtp.gmail.com with ESMTPSA id v26sm750256lfd.6.2021.02.22.05.19.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Feb 2021 05:19:17 -0800 (PST) From: =?utf-8?q?Jan_Ekstr=C3=B6m?= To: ffmpeg-devel@ffmpeg.org Date: Mon, 22 Feb 2021 15:19:10 +0200 Message-Id: <20210222131914.21335-1-jeebjp@gmail.com> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v5 0/4] Initial implementation of TTML encoding/muxing 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" I've intentionally kept this initial version simple (no styling etc) to focus on the basics. As this goes through review, additional features can be added (I had initial PoC for styling implemented some time around previous VDD), and there is another patch set in my queue which would then add support for muxing TTML into MP4. Changes from the fourth version: - Switched from separate escaping modes back to a single AV_ESCAPE_MODE_XML, with additional flags for single and double quote escaping for attributes (Anton noted that the AV_ESCAPE_FLAG_XML prefix makes it all long enough, so ATTR was left away from these). - Added the libavutil minor bump, which was forgotten so far. - ff_ass_split_override_codes calls are now checked for errors and a warning or error is logged depending on whether it was an invalid input error, and if AV_EF_EXPLODE was set. In case of invalid input and AV_EF_EXPLODE, a malformed ASS dialog will cause the encoder to fail. By default it will not, which matches the current behavior of all other subtitle encoders, which do not test the return value of ff_ass_split_override_codes at all, and thus just skip malformed parts of an ASS dialog. Thank you to Anton for giving the idea of the AV_EF_EXPLODE usage. - Documented that AV_EF_EXPLODE is now usable for subtitle encoders. - FF_CODEC_CAP_INIT_CLEANUP was added to ttmlenc, simplifying clean-up. - The extradata added by ttmlenc was made more specific, and a shared header containing the value and its length was added to reduce duplication. - A case which would be only due to internal error was made to return AVERROR_BUG and the relevant log line was made to note that this is an internal error. - Missing includes for "libavutil/internal.h" were added. Jan Jan Ekström (3): ffprobe: switch to av_bprint_escape for XML escaping avcodec: enable usage of AV_EF_EXPLODE for subtitle encoders {avcodec,avformat}: add TTML encoder and muxer Stefano Sabatini (1): avutil/{avstring,bprint}: add XML escaping from ffprobe to avutil Changelog | 1 + doc/general_contents.texi | 1 + fftools/ffprobe.c | 32 ++---- libavcodec/Makefile | 1 + libavcodec/allcodecs.c | 1 + libavcodec/avcodec.h | 5 +- libavcodec/options_table.h | 4 +- libavcodec/ttmlenc.c | 210 +++++++++++++++++++++++++++++++++++++ libavcodec/ttmlenc.h | 28 +++++ libavcodec/version.h | 2 +- libavformat/Makefile | 1 + libavformat/allformats.c | 1 + libavformat/ttmlenc.c | 174 ++++++++++++++++++++++++++++++ libavutil/avstring.h | 14 +++ libavutil/bprint.c | 29 +++++ libavutil/version.h | 2 +- tests/fate/subtitles.mak | 3 + tests/ref/fate/ffprobe_xml | 2 +- tests/ref/fate/sub-ttmlenc | 122 +++++++++++++++++++++ tools/ffescape.c | 7 +- 20 files changed, 611 insertions(+), 29 deletions(-) create mode 100644 libavcodec/ttmlenc.c create mode 100644 libavcodec/ttmlenc.h create mode 100644 libavformat/ttmlenc.c create mode 100644 tests/ref/fate/sub-ttmlenc