From patchwork Tue Oct 18 10:40:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: TADANO Tokumei X-Patchwork-Id: 38770 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:4a86:b0:9d:28a3:170e with SMTP id fn6csp2035782pzb; Tue, 18 Oct 2022 03:41:36 -0700 (PDT) X-Google-Smtp-Source: AMsMyM55qfcAQ5LkxQp481WsYCoev54mVc1h+Rr2A2fr3KuGkzC7swew25do4oFEm56pipgQsroQ X-Received: by 2002:a17:907:9493:b0:78d:1eca:1cda with SMTP id dm19-20020a170907949300b0078d1eca1cdamr1873050ejc.407.1666089695997; Tue, 18 Oct 2022 03:41:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666089695; cv=none; d=google.com; s=arc-20160816; b=UdAXdsw1LnsJTZswyiMB+Ms3LR7qO3FU7MFdsmRyaKyQs0ElySXp2Xfmt1yPxPfk20 j+cJQYhXVl6QbE7BH7G3djhesKu9YYg07MnptPU2OVPmQOvUthYT9vPUdd513qTexZfg dbLZcVocBy4zhxTpal6ViykCxjkgT9FByZyNgQlU6yECCnFWmuRCloP5GAgdchZvongO AqD/UVpxuyBjGkQc+spM04EzKoPelcof4FJXHkgp/w3zKDHSyglKjd/Agu1A7tfIOZMN qP6Ax0chrd1uyqOPHySqFiux3spp1mSU9eCRGs56kzxWQpn8rgvFxMnWvkOzOKk+2Kja YoQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:dkim-filter:delivered-to; bh=7+Amee/yPmd2wDVVs5Sm/TxKLOM71/l7E5DGv/zJgMM=; b=hbrS4cvrL2j1wracnZidwNHzWqLo08trz3QMw2AKSKtP0gptDjBytRAnqdWOwrrKzn kv5vtxF2fShkawmuIPKM9opYQhX/zBODyINiw05GUkku2FtQySNtX/r+Neo+y5HNAbto zu6kuW9+WEuFQdO8AXEdB2o3kyfq2LyjBqXURLXTpg0Hncj27PhaH79alJ1B+ZsT4wPd piS/ppKkdkmZMYpx2ALzlHIJj14AfhiSAkJHAbTPiGbcJt6W8DTMcxvbFKGg+rTB3CUV I7FpJ3Z4FvFuBsMAFmEtzYDkQq+XX2wgVPz86RRt1ZTNmISBnXAQejjNZRMlzUi1VQEO eSTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@nifty.com header.s=dec2015msa header.b=VvUjG3It; 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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id hr18-20020a1709073f9200b0073d626e2ef8si10388256ejc.461.2022.10.18.03.41.35; Tue, 18 Oct 2022 03:41:35 -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=@nifty.com header.s=dec2015msa header.b=VvUjG3It; 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 Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4AD4668BC19; Tue, 18 Oct 2022 13:41:21 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from conssluserg-01.nifty.com (conssluserg-01.nifty.com [210.131.2.80]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 60F2D68BC19 for ; Tue, 18 Oct 2022 13:41:11 +0300 (EEST) Received: from osamu-pc.. (M106073025034.v4.enabler.ne.jp [106.73.25.34]) (authenticated) by conssluserg-01.nifty.com with ESMTP id 29IAelI3017112; Tue, 18 Oct 2022 19:40:48 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-01.nifty.com 29IAelI3017112 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1666089649; bh=I2MivJCQlqssC4ZTfnMwKGMKP5P/otkwGgubArfMKsg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VvUjG3ItTCpsV+A7vTPxE/tmcNiUHwzlu/6dVe4WrLnoP5XxEs19Ts7eIZ0xNyEt/ frQ3B9tEi2vgNhqpKdYz+nHVnBuYPtSFeZdNsRzwjhh+TQ6wXtTbkxU1V9ql8tF0kM 2xziM33nsw3klNX66gMy9IZkn9v57gSfuNkXoCE9/nbMakEwm5L80cdiiU3ecO9k2D 1ZyKGcJndjkbHqZAoOTsgf46cIHFHRNzpceVGj3Kcu6dPG5z1CyGNW1HlThvD3kVZZ 1uXLWjRCrcqJg+wsa/nHD3DJqiSMkwfkhWp1mdZ9+GSqDdjNSWw3WKEI4C6BFp62Ps pTSRA2yF7djqQ== X-Nifty-SrcIP: [106.73.25.34] From: TADANO Tokumei To: ffmpeg-devel@ffmpeg.org Date: Tue, 18 Oct 2022 19:40:27 +0900 Message-Id: <20221018104028.34644-4-aimingoff@pc.nifty.jp> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221018104028.34644-1-aimingoff@pc.nifty.jp> References: <20221018104028.34644-1-aimingoff@pc.nifty.jp> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v6 3/4] lavf/mpegts.c: set some properties for ARIB caption 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 Cc: TADANO Tokumei Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: 96ROI8kmYja7 Some additional properties are set for ARIB caption. * need_parsing = 0 ARIB caption doesn't require any parser. This avoids "parser not found" warning message. * need_context_update = 1 When any profiles are changed, set this flag to notify. * codecpar->width / codecpar->height Find best video stream and set frame size for ARIB_PROFILE_A type of ARIB caption. --- libavformat/mpegts.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c index d97702fcd7..87d419857e 100644 --- a/libavformat/mpegts.c +++ b/libavformat/mpegts.c @@ -2146,6 +2146,7 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, AVStream *st, int stream_type // Vol. 3, Section 2, 4.2.8.1 int actual_component_tag = sti->stream_identifier - 1; int picked_profile = FF_PROFILE_UNKNOWN; + AVStream *v_st = NULL; int data_component_id = get16(pp, desc_end); if (data_component_id < 0) return AVERROR_INVALIDDATA; @@ -2156,7 +2157,12 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, AVStream *st, int stream_type // non-mobile captioning service ("profile A"). if (actual_component_tag >= 0x30 && actual_component_tag <= 0x37) { + int v_index; picked_profile = FF_PROFILE_ARIB_PROFILE_A; + v_index = av_find_best_stream(fc, AVMEDIA_TYPE_VIDEO, + -1, 1, NULL, 0); + if (v_index >= 0) + v_st = fc->streams[v_index]; } break; case 0x0012: @@ -2175,8 +2181,19 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, AVStream *st, int stream_type st->codecpar->codec_type = AVMEDIA_TYPE_SUBTITLE; st->codecpar->codec_id = AV_CODEC_ID_ARIB_CAPTION; - st->codecpar->profile = picked_profile; + if (st->codecpar->profile != picked_profile) { + st->codecpar->profile = picked_profile; + sti->need_context_update = 1; + } + if (v_st && + (st->codecpar->width != v_st->codecpar->width || + st->codecpar->height != v_st->codecpar->height)) { + st->codecpar->width = v_st->codecpar->width; + st->codecpar->height = v_st->codecpar->height; + sti->need_context_update = 1; + } sti->request_probe = 0; + sti->need_parsing = 0; } break; case 0xb0: /* DOVI video stream descriptor */