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 483B749449 for ; Tue, 12 Mar 2024 11:44:52 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 2DFDE68CE33; Tue, 12 Mar 2024 13:44:50 +0200 (EET) Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04olkn2019.outbound.protection.outlook.com [40.92.73.19]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 641C668CE1C for ; Tue, 12 Mar 2024 13:44:43 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=C9uLk86Xcv726AIHVp4bU+t2YBXoNnnmJHrhBxWjXXgSKpADRKQVzHYxl4G7/mZw+DPhReE/CRBdKMgP0qkMaM9c7VZjRwe8LvtaVrKGwPjc0wx+s+E7jqYJbpQa2KVjexJ6rw6BmfkaydtwNuwOIPfYKxSur+J0tHQzTu/G/5/v+FxgxgqDreEEgIH1qS+KtxKNi7ifT7uzvEvBCxWzb7+PhWXuF7rcXQqnhvHlxzSCsP+rbfJ9+McIZcVR6FkunmCyONu0ZHhw3n9k50LrArLNKNrVbfYYEbFvdWD9JzqLDISAIiQj49LfNp9KgiABzGfTbA7rJ2sFGOjjdK4BAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=xZUMNX3PcHPbCmWyAKwpZcHglhHYjZh3KAHYXvF5gvU=; b=OQUxBbonB6UpruK6SV5rILjINYR8gCACTWLvuPcm3EZWlD1955rx+yX77+mt1gFlXJg+3eK9wPmTyFWjgt2yzVW2SceKrj3MypPaa2XoRnEKyqr9tXYbF5WmluCNFEokN0qVjHWAhdXWXOm9jl3MXVF2ZCjsfl68bDs2/W9K5rF4KxNFeRiM+rarXNz9RTGp/9egkvQ1HPcegzOKwFQs4swTfdLQ9jNi0cnRNGCTIl0QS16wsEQLrJQCOpqx97H6sFyT68FBx7ivwoiXJmQT5NGuhv6SvLmxvfGr0BEuTw39AWM8us84zFKO470iqCxSEEBAGDalW02wHCPkQWSIzg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=xZUMNX3PcHPbCmWyAKwpZcHglhHYjZh3KAHYXvF5gvU=; b=QRvfBCgHBmveUQesKpA6xUOM+vipXVrGojQGX9+iHXVQveu3HhdiDo7aXu7LkfoTs+Q5W3TTXM+CSy2OzAJNsfV9N3Vf5I7GlQuDpumdh2i3JnBVnUp78U/B1W57eWcd/pcQzeW/SxQm5NV7vguVaHPsjzBoobJ8jl7f9dBPQGed2X+Z7XY0mS2huYoCP2770d5ryx6HobpO85s8yORSA12GJ28lNZddSk11Qvy1ahQZMZsH4SHD2QfKlmkVEVcJOtYl/MLJdo0lBalKnHoprfaXqLJmdigevAM8bTYKGAm6pglbhX3n+s8IHiTL79tgq+1YiwL/RNmumYMd015Huw== Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) by AS4P250MB0558.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:4ba::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7362.36; Tue, 12 Mar 2024 11:44:40 +0000 Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::228d:8c6f:ed10:82eb]) by AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::228d:8c6f:ed10:82eb%7]) with mapi id 15.20.7362.035; Tue, 12 Mar 2024 11:44:38 +0000 Message-ID: Date: Tue, 12 Mar 2024 12:44:35 +0100 User-Agent: Mozilla Thunderbird Content-Language: en-US To: ffmpeg-devel@ffmpeg.org References: <20240312060005.2111135-1-marth64@proxyid.net> <20240312060005.2111135-6-marth64@proxyid.net> From: Andreas Rheinhardt In-Reply-To: <20240312060005.2111135-6-marth64@proxyid.net> X-TMN: [4nM3k9jzVQgvTSscfR67pEV6P8YpJUFEANuCQYOYD4E=] X-ClientProxiedBy: ZR2P278CA0006.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:50::12) To AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) X-Microsoft-Original-Message-ID: <13142adc-dfb3-4b4a-965f-f346d7d9662a@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8P250MB0744:EE_|AS4P250MB0558:EE_ X-MS-Office365-Filtering-Correlation-Id: 4388ec39-49f6-4c4e-31fb-08dc4289cc54 X-MS-Exchange-SLBlob-MailProps: YfhX3sd/0TWU+YiOcCO3KzwBTDGS95vW/BJfnpzEQ6wLVyA7WAMb28DzeH9tChM7vad6WAVl2lBfLnAspEUmqX0+lCQPjuo7HXOFcWMtXIzU0PN+quby7I0zfJ1sr60GO7gVPF4URChO0L8t10jvOWHBBzPGjx9C9mMr9+0ZPE+hcdSn+PSSwaYHZF9ekzeCRdvfJirvTZJYpPyNdxT0WzRLjezcLcAC2ImFJBGarwLRG5drNZhKOh9NSS4xMhuStVfAAXGb8+RgRLOxQzF0BfgFoe0c4XANfCH1E9zgZL02YPnWdkfvUmsJ9nFJF/fR2dMwzpbHktv7YulL0ScQcoAmv+plb1QWi1UCKN1IbaUk3Y5DJqUpOAlTFySBABM9sVK0dDFpBxOHEBbnqX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8?B?NnlNNkpVL2FKZ00xZG80dGFXT3lKcXZ2Wk9qOG5CYzBrSkRoMGxLaUFnPT0=?= X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4388ec39-49f6-4c4e-31fb-08dc4289cc54 X-MS-Exchange-CrossTenant-AuthSource: AS8P250MB0744.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Mar 2024 11:44:38.7764 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS4P250MB0558 Subject: Re: [FFmpeg-devel] [PATCH v3 5/6] avformat/rcwtdec: add RCWT Closed Captions demuxer 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 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: Marth64: > Raw Captions With Time (RCWT) is a format native to ccextractor, a commonly > used open source tool for processing 608/708 Closed Captions (CC) sources. > RCWT can be used to archive the original CC bitstream. The muxer was added > in January 2024. In this commit, add the demuxer. > > One can now demux RCWT files for rendering in ccaption_dec or interoperate > with ccextractor (which produces RCWT). Using the muxer/demuxer combination, > the CC bits can be kept for further processing or rendering with either tool. > This can be an effective approach to backup original CC presentations. > > Prior to this, the next best solution was FFmpeg's SCC muxer, but SCC itself > is not compatible with ccextractor (which is a de facto OSS CC processing tool) > and it is a proprietary format. > > Tests will follow. > > Signed-off-by: Marth64 > --- > libavformat/Makefile | 1 + > libavformat/allformats.c | 1 + > libavformat/rcwtdec.c | 158 +++++++++++++++++++++++++++++++++++++++ > 3 files changed, 160 insertions(+) > create mode 100644 libavformat/rcwtdec.c > > diff --git a/libavformat/Makefile b/libavformat/Makefile > index 8811a0ffc9..2092ca9f38 100644 > --- a/libavformat/Makefile > +++ b/libavformat/Makefile > @@ -493,6 +493,7 @@ OBJS-$(CONFIG_QOA_DEMUXER) += qoadec.o > OBJS-$(CONFIG_R3D_DEMUXER) += r3d.o > OBJS-$(CONFIG_RAWVIDEO_DEMUXER) += rawvideodec.o > OBJS-$(CONFIG_RAWVIDEO_MUXER) += rawenc.o > +OBJS-$(CONFIG_RCWT_DEMUXER) += rcwtdec.o subtitles.o > OBJS-$(CONFIG_RCWT_MUXER) += rcwtenc.o subtitles.o > OBJS-$(CONFIG_REALTEXT_DEMUXER) += realtextdec.o subtitles.o > OBJS-$(CONFIG_REDSPARK_DEMUXER) += redspark.o > diff --git a/libavformat/allformats.c b/libavformat/allformats.c > index 0a0e76138f..b89a49b6ec 100644 > --- a/libavformat/allformats.c > +++ b/libavformat/allformats.c > @@ -391,6 +391,7 @@ extern const FFInputFormat ff_qoa_demuxer; > extern const FFInputFormat ff_r3d_demuxer; > extern const FFInputFormat ff_rawvideo_demuxer; > extern const FFOutputFormat ff_rawvideo_muxer; > +extern const FFInputFormat ff_rcwt_demuxer; > extern const FFOutputFormat ff_rcwt_muxer; > extern const FFInputFormat ff_realtext_demuxer; > extern const FFInputFormat ff_redspark_demuxer; > diff --git a/libavformat/rcwtdec.c b/libavformat/rcwtdec.c > new file mode 100644 > index 0000000000..f553f13366 > --- /dev/null > +++ b/libavformat/rcwtdec.c > @@ -0,0 +1,158 @@ > +/* > + * RCWT (Raw Captions With Time) demuxer > + * > + * This file is part of FFmpeg. > + * > + * FFmpeg is free software; you can redistribute it and/or > + * modify it under the terms of the GNU Lesser General Public > + * License as published by the Free Software Foundation; either > + * version 2.1 of the License, or (at your option) any later version. > + * > + * FFmpeg is distributed in the hope that it will be useful, > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > + * Lesser General Public License for more details. > + * > + * You should have received a copy of the GNU Lesser General Public > + * License along with FFmpeg; if not, write to the Free Software > + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA > + */ > + > +/* > + * RCWT (Raw Captions With Time) is a format native to ccextractor, a commonly > + * used open source tool for processing 608/708 Closed Captions (CC) sources. > + * It can be used to archive the original, raw CC bitstream and to produce > + * a source file for later CC processing or conversion. As a result, > + * it also allows for interopability with ccextractor for processing CC data > + * extracted via ffmpeg. The format is simple to parse and can be used > + * to retain all lines and variants of CC. > + * > + * This demuxer implements the specification as of March 2024, which has > + * been stable and unchanged since April 2014. > + * > + * A free specification of RCWT can be found here: > + * @url{https://github.com/CCExtractor/ccextractor/blob/master/docs/BINARY_FILE_FORMAT.TXT} > + */ > + > +#include "avformat.h" > +#include "demux.h" > +#include "internal.h" > +#include "subtitles.h" > +#include "libavutil/avstring.h" > +#include "libavutil/intreadwrite.h" What are these two headers used for? (Didn't you add the same unused headers to the muxer?) > + > +#define RCWT_CLUSTER_MAX_BLOCKS 65535 > +#define RCWT_BLOCK_SIZE 3 > +#define RCWT_HEADER_SIZE 11 > + > +typedef struct RCWTContext { > + FFDemuxSubtitlesQueue q; > +} RCWTContext; > + > +static int rcwt_read_header(AVFormatContext *avf) > +{ > + RCWTContext *rcwt = avf->priv_data; > + > + AVPacket *sub = NULL; > + AVStream *st; > + uint8_t header[RCWT_HEADER_SIZE] = {0}; > + int nb_bytes = 0; > + > + int64_t cluster_pts = AV_NOPTS_VALUE; > + int cluster_nb_blocks = 0; > + int cluster_size = 0; > + uint8_t *cluster_buf; Use smaller scope for these. > + > + /* validate the header */ > + nb_bytes = avio_read(avf->pb, header, RCWT_HEADER_SIZE); > + if (nb_bytes != RCWT_HEADER_SIZE || AV_RB16(header) != 0xCCCC || header[2] != 0xED) { > + av_log(avf, AV_LOG_ERROR, "Input is not an RCWT file\n"); > + return AVERROR_INVALIDDATA; > + } Such checks belong in a probe function (where it already is); the demuxer is simply supposed to demux based upon the assumption that the file is of the format. > + > + if ((header[3] != 0xCC && header[3] != 0xFF) || header[4] != 0x00) { > + av_log(avf, AV_LOG_ERROR, "Input writing application is not supported, only " > + "0xCC00 (ccextractor) or 0xFF00 (FFmpeg) are compatible\n"); > + return AVERROR_INVALIDDATA; This will basically make it impossible to create a new application for writing this format (or rather: it will force this new muxer to lie for compatibility reasons). > + } > + > + if (AV_RB16(header + 6) != 0x0001) { > + av_log(avf, AV_LOG_ERROR, "Input RCWT version is not compatible " > + "(only version 0.001 is known)\n"); > + return AVERROR_INVALIDDATA; > + } > + > + if (header[3] == 0xFF && header[5] != 0x60) { > + av_log(avf, AV_LOG_ERROR, "Input was written by a different version of FFmpeg " > + "and unsupported, consider upgrading\n"); > + return AVERROR_INVALIDDATA; > + } > + > + /* setup AVStream */ > + st = avformat_new_stream(avf, NULL); > + if (!st) > + return AVERROR(ENOMEM); > + > + st->codecpar->codec_type = AVMEDIA_TYPE_SUBTITLE; > + st->codecpar->codec_id = AV_CODEC_ID_EIA_608; > + > + avpriv_set_pts_info(st, 64, 1, 1000); > + > + /* demux */ > + while (!avio_feof(avf->pb)) { > + cluster_pts = avio_rl64(avf->pb); > + cluster_nb_blocks = avio_rl16(avf->pb); > + if (cluster_nb_blocks == 0) > + continue; > + > + cluster_size = cluster_nb_blocks * RCWT_BLOCK_SIZE; > + cluster_buf = av_calloc(cluster_nb_blocks, RCWT_BLOCK_SIZE); Why are you zeroing when you are overwriting everything lateron anyway? > + if (!cluster_buf) > + return AVERROR(ENOMEM); > + > + nb_bytes = avio_read(avf->pb, cluster_buf, cluster_size); > + if (nb_bytes != cluster_size) { > + av_freep(&cluster_buf); > + av_log(avf, AV_LOG_ERROR, "Input cluster has invalid size " > + "(expected=%d actual=%d pos=%ld)\n", > + cluster_size, nb_bytes, avio_tell(avf->pb)); Not really useful message. > + return AVERROR_INVALIDDATA; You should better use ffio_read() and return the error. > + } > + > + sub = ff_subtitles_queue_insert(&rcwt->q, cluster_buf, cluster_size, 0); > + if (!sub) { > + av_freep(&cluster_buf); > + return AVERROR(ENOMEM); > + } > + > + sub->pos = avio_tell(avf->pb); > + sub->pts = cluster_pts; > + > + av_freep(&cluster_buf); > + cluster_buf = NULL; The muxer splits packets with >= 2^16 blocks. Should the demuxer recombine such packets? > + } > + > + ff_subtitles_queue_finalize(avf, &rcwt->q); > + > + return 0; > +} > + > +static int rcwt_probe(const AVProbeData *p) > +{ > + return p->buf_size > RCWT_HEADER_SIZE && > + AV_RB16(p->buf) == 0xCCCC && AV_RB8(p->buf + 2) == 0xED ? 50 : 0; > +} > + > +const FFInputFormat ff_rcwt_demuxer = { > + .p.name = "rcwt", > + .p.long_name = NULL_IF_CONFIG_SMALL("RCWT (Raw Captions With Time)"), > + .p.extensions = "bin", > + .p.flags = AVFMT_TS_DISCONT, > + .priv_data_size = sizeof(RCWTContext), > + .flags_internal = FF_FMT_INIT_CLEANUP, > + .read_probe = rcwt_probe, > + .read_header = rcwt_read_header, > + .read_packet = ff_subtitles_read_packet, > + .read_seek2 = ff_subtitles_read_seek, > + .read_close = ff_subtitles_read_close > +}; _______________________________________________ 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".