From patchwork Sat May 21 17:21:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: TADANO Tokumei X-Patchwork-Id: 35885 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:9992:b0:82:461d:f3b with SMTP id ve18csp1150983pzb; Sat, 21 May 2022 10:22:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxU1S3VtzhiesdaWMu2dWy32u5cOAOyIQe+FfcpJHCSnGp+Iu2Jror/fJU8iobw+Gvba8Mg X-Received: by 2002:a05:6402:787:b0:42a:a2af:f3f8 with SMTP id d7-20020a056402078700b0042aa2aff3f8mr16257962edy.363.1653153731308; Sat, 21 May 2022 10:22:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653153731; cv=none; d=google.com; s=arc-20160816; b=BgcEokg7n8EIFQZJ3GUlov0ob+a8HC+w/3DnU6sr4QetRYI7TNGUPcBLQt8TIcGt5t 68NJNCfYPZUZNrI2uN+7zCtz2+NzVmeDo4KMf3GgAR63RMRbdrpWEQDYb52LN0Mg7z33 IfiSMywVobEN/gE+krRs9r/nL3vceM2oxzHLkOYoDHmI6D//rb1uTgu0y6jDVqAvVt0H zHKdytdii46WFUsETkJC3jpu8oBOd7TzAEWeHn59OxiZky2HCiw17MXFBVWeqBi5T0yT I6uvptW76fqfC/9H5LYVXTywMKsWEPm6SLEu2ZX3EZLz+DN+s3uBWzgt1/D8SecsvAGd iJyw== 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=KqiLG1oYQIXh4UOq54wgxVEVUlMZozrRZ52GtMPhcm8=; b=0Kgmewh8NLTvptGQFPwvk7Qu731ZrndkjbTsVvplWZ3r17mzTSBSsPcm3QsKwYlng3 G81g7BeYiiaGUcF0L1Fq6XdtKYTidi/g+US8eURTYYXNGpXfhu/b0HEGJ4IGLUmfj+2B B1QgFuc/5+Zuq0DUbcgK3LyJxrZ2L36jlHbDeMpOZuWeAJ/xnCFmkcZSKxxqFGuz+jR3 U1o1j3UH+FuBLGmCZVLzcp8sXDcBtiUOwcOJXQzvbmi0XEJmNskbYdS3VeD4rJk2zo+B FFOujxpFp0r10ebrpSLUfI7/i37tlmqakKdAyDXDFOVsl2561W7JsTJTljr7W0SIY3Uj rXrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@nifty.com header.s=dec2015msa header.b=gvJ5OJT4; 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 z19-20020a50e693000000b0042ab173ec9bsi10710637edm.508.2022.05.21.10.22.11; Sat, 21 May 2022 10:22:11 -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=gvJ5OJT4; 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 A1D9F68B476; Sat, 21 May 2022 20:21:48 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from conssluserg-06.nifty.com (conssluserg-06.nifty.com [210.131.2.91]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id ABCB168B475 for ; Sat, 21 May 2022 20:21:39 +0300 (EEST) Received: from osamu-pc.kimura.local (M106073025034.v4.enabler.ne.jp [106.73.25.34]) (authenticated) by conssluserg-06.nifty.com with ESMTP id 24LHLUvv028168; Sun, 22 May 2022 02:21:31 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-06.nifty.com 24LHLUvv028168 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1653153691; bh=BdWy/cpR4MZOMkRm0eIFMgsqh2uK1XWHkhg7RfnyK9U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gvJ5OJT4dRyCHlVbxDFOrjdBFIBHodGSLGx4KC41Sskb0RWR/606QszLBGlyrRq/J 8K3Ijcx1h3WaJlRd5NEiXgwc+oSwVP44K7igBjSzygRguaslrfoMRw6lgSK+ChKc0G znV/S1zwodrhFAKRDON/jgItwmb2ZdBkUil9ZIf/WATLhCiPhRxl5KgETJOTvTe3xK ewxJtVNaWT0q00SntSY3uS/I3F6+gGRtJkQRllNGrkl6UcsWP7dpyglPjTtPx43upY i/ej/j/3ZxsRRuAqtb3rBqVxNwSXI7bwcfG2dO+849DFMC9MqPI233f8x8w99jstxF 5XfYzftB6MtBw== X-Nifty-SrcIP: [106.73.25.34] From: TADANO Tokumei To: ffmpeg-devel@ffmpeg.org Date: Sun, 22 May 2022 02:21:28 +0900 Message-Id: <20220521172128.716289-4-aimingoff@pc.nifty.jp> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220521172128.716289-1-aimingoff@pc.nifty.jp> References: <20220521172128.716289-1-aimingoff@pc.nifty.jp> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v3 3/3] 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: b4JdmSVguBJ4 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. Signed-off-by: TADANO Tokumei --- libavformat/mpegts.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c index 6e761c07f1..ead833c264 100644 --- a/libavformat/mpegts.c +++ b/libavformat/mpegts.c @@ -2145,6 +2145,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; @@ -2155,7 +2156,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: @@ -2174,8 +2180,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 */