From patchwork Sat Jun 12 09:30:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: zheng qian X-Patchwork-Id: 28248 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a5e:c91a:0:0:0:0:0 with SMTP id z26csp1187653iol; Sat, 12 Jun 2021 03:00:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwKfrsmpBndgqosIDDy8hAWLkR4TZYPDCq3XkLF1w8nxqQtSqd+bTBmY39jmPGZutR7glsf X-Received: by 2002:a17:906:390f:: with SMTP id f15mr7444910eje.270.1623492047455; Sat, 12 Jun 2021 03:00:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623492047; cv=none; d=google.com; s=arc-20160816; b=0L/ow2kMsqrGFJSpVXx09+Sus0aNMoj6CvcsSlxc7zfH5h22Rpx4E38Zn1YtsIkfts khhJJjfCSzqBX6xKqQRJFUECZ2qhjk/SCeiwxk8tqGWgMPAFLxjVt1x+Wo2GGEnMevF/ X3LBFgwAtTudbJSVYuUYzon92hd9m7Tlg95V9wwmv2z0EP73HucqZc/lNr0Sb/yOHA8m Pr9mNoElprznoUTZz3iSECGZkTlkE46QjCKQEpOWvje7KmUhJsXlD6IU2gZDwWLCndnT xV+oGt6U6sCBSyJxUr0hrjyTthqr/SmwYnDkA++tQWCZtdNImtS+p51SLBSTopPoi6M2 cWGA== 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:delivered-to; bh=4tfsUzd0gr3vvo85G+p9m26VxWsl0XKcX/HrP7JDias=; b=JXJGtFPKhy6Ce41rwcVWUfCEyDUTHBUqmLyRTXC4cjTFvNH/2pJrZ4+EIIicy7Ik9C BVAxmGkGHceNiQrnlWgKGyK0FG3GAAoKXVRmCGavgBNG3DS8Ie4EX1qm5N1NJo+wgcy4 DPtvSnXFk9QoA4t+PtJW2a8rcpScXjeTpYvB7IqeCMTfb1JcHdixg+I5jvYM3vsAeVU7 B4u79esHbJNzzgRie9/jw0PevvEuQZowp1HFXJZRPR2C3ImuuH2ZltDOfwLKp7P8NLBs UW7JLPjAqTkB2n/3rdP+2CUSJk9WH/Bv0wPs5HG3rlWSvpv+6dyBLZJZDid98C52Lrzw p1uQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@xqq-im.20150623.gappssmtp.com header.s=20150623 header.b=UIng4oly; 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 s17si7292982ejm.137.2021.06.12.03.00.47; Sat, 12 Jun 2021 03:00:47 -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=@xqq-im.20150623.gappssmtp.com header.s=20150623 header.b=UIng4oly; 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 0C4CD6899A7; Sat, 12 Jun 2021 13:00:45 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pg1-f182.google.com (mail-pg1-f182.google.com [209.85.215.182]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 06396680BD5 for ; Sat, 12 Jun 2021 13:00:39 +0300 (EEST) Received: by mail-pg1-f182.google.com with SMTP id e20so4559186pgg.0 for ; Sat, 12 Jun 2021 03:00:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xqq-im.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=o+1r1V56J6xCdphLJ05BwnZUesiOBtYJMZKasUx2Olk=; b=UIng4oly/n6eBvTtnEDZEZ34Magk7g4H53QhErPOv5NpJrU/6eSrFCnV/pcgDoqszv +exD0vF6aRXXhCQDUHNbL2l0gJTm+YdVMh+gtL3YrXtJKzDXlYXxjA5a8/UUTB0jeHUT CXGvha1arj3T0muK9/4zhaDHgDu4X+JvmOQI036By14Ft8pxhASvXgybyy/XslW56RJN g9hbTfS3ZQJhoPA1j5ejjdyBTtcBp8J8qhNAJMxibC/Ce53fr6XuPT/6VhbtpGt/U3op glVPC7kkYZk+giHqMZAP50RPQv8Uma5d/LwC1Hfi8+j9Iu5McIvpL/RVmuHn2ws/Q6I5 DxbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=o+1r1V56J6xCdphLJ05BwnZUesiOBtYJMZKasUx2Olk=; b=RHYXPMaGXZCG5slXCJ0Ye91fijcJiq8fwNKo9IZUjvLpzhrULEhNKY6iO9f6ES57uG EBjaJ/l3PdE0RaMh/s0fg5GSS+4C2j/tg1cm6jT8RnAsiT/Hui2PBy5AB4jtxSNbTRpl q0nuTEnz/hKx9Q4u029aJQ6uWb/uOJm54ekhgXKpcvr4l/hAG8jTsXIB4wBmWKXeSHiJ 8yQ8rTxWu4O2OZwRPcgTCq/l6q8Cbw/OfwSXS9ncEjQXBjDmuRb0UVl88gDs3D5n0NpV 8Q5X3Zn+bgPAbjUKuBL0E+2nIUEtDQtS+U1LV7tzYA3alal86/vF7V3tUKm5ekH1BI+h VMcA== X-Gm-Message-State: AOAM530qL5/N1i+xRRu8JL3ABwTaxNn7b9y5Bzdwd84B85eU1wHvx+wC ekRrLQ2FVItifeNpoIP1csUVNVe8KVyLSg== X-Received: by 2002:a63:690:: with SMTP id 138mr7766112pgg.33.1623490268785; Sat, 12 Jun 2021 02:31:08 -0700 (PDT) Received: from zhengqian-xps.lan (ngn-nat1.v4.open.ad.jp. [202.222.12.138]) by smtp.gmail.com with ESMTPSA id z3sm487719pfb.127.2021.06.12.02.31.07 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 12 Jun 2021 02:31:08 -0700 (PDT) From: zheng qian To: ffmpeg-devel@ffmpeg.org Date: Sat, 12 Jun 2021 18:30:29 +0900 Message-Id: <20210612093032.64034-2-xqq@xqq.im> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210612093032.64034-1-xqq@xqq.im> References: <20210612093032.64034-1-xqq@xqq.im> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/5] avformat/mpegts: Recognize arib_superimpose by ARIB data coding descriptor 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: zheng qian Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: WovA8mwc+1bI Signed-off-by: zheng qian --- libavformat/mpegts.c | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c index a02965bacf..6c5fb53c51 100644 --- a/libavformat/mpegts.c +++ b/libavformat/mpegts.c @@ -2106,8 +2106,8 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, AVStream *st, int stream_type } break; case 0xfd: /* ARIB data coding type descriptor */ - // STD-B24, fascicle 3, chapter 4 defines private_stream_1 - // for captions + // STD-B24, fascicle 3, chapter 4 defines + // private_stream_1 for captions, and private_stream_2 for superimpose if (stream_type == STREAM_TYPE_PRIVATE_DATA) { // This structure is defined in STD-B10, part 1, listing 5.4 and // part 2, 6.2.20). @@ -2115,6 +2115,7 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, AVStream *st, int stream_type // Component tag limits are documented in TR-B14, fascicle 2, // Vol. 3, Section 2, 4.2.8.1 int actual_component_tag = st->internal->stream_identifier - 1; + enum AVCodecID arib_codec_id = AV_CODEC_ID_NONE; int picked_profile = FF_PROFILE_UNKNOWN; int data_component_id = get16(pp, desc_end); if (data_component_id < 0) @@ -2122,17 +2123,30 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, AVStream *st, int stream_type switch (data_component_id) { case 0x0008: - // [0x30..0x37] are component tags utilized for + // [0x30..0x37] and [0x38..0x3F] are component tags utilized for // non-mobile captioning service ("profile A"). if (actual_component_tag >= 0x30 && actual_component_tag <= 0x37) { + // caption (Profile A) + arib_codec_id = AV_CODEC_ID_ARIB_CAPTION; + picked_profile = FF_PROFILE_ARIB_PROFILE_A; + } else if (actual_component_tag >= 0x38 && + actual_component_tag <= 0x3F) { + // superimpose (Profile A) + arib_codec_id = AV_CODEC_ID_ARIB_SUPERIMPOSE; picked_profile = FF_PROFILE_ARIB_PROFILE_A; } break; case 0x0012: - // component tag 0x87 signifies a mobile/partial reception + // component tag 0x87 and 0x88 signifies a mobile/partial reception // (1seg) captioning service ("profile C"). if (actual_component_tag == 0x87) { + // caption (Profile C) + arib_codec_id = AV_CODEC_ID_ARIB_CAPTION; + picked_profile = FF_PROFILE_ARIB_PROFILE_C; + } else if (actual_component_tag == 0x88) { + // superimpose (Profile C) + arib_codec_id = AV_CODEC_ID_ARIB_SUPERIMPOSE; picked_profile = FF_PROFILE_ARIB_PROFILE_C; } break; @@ -2140,11 +2154,11 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, AVStream *st, int stream_type break; } - if (picked_profile == FF_PROFILE_UNKNOWN) + if (arib_codec_id == AV_CODEC_ID_NONE || picked_profile == FF_PROFILE_UNKNOWN) break; st->codecpar->codec_type = AVMEDIA_TYPE_SUBTITLE; - st->codecpar->codec_id = AV_CODEC_ID_ARIB_CAPTION; + st->codecpar->codec_id = arib_codec_id; st->codecpar->profile = picked_profile; st->internal->request_probe = 0; }