From patchwork Sun Jun 13 02:34:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: zheng qian X-Patchwork-Id: 28256 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a5e:c91a:0:0:0:0:0 with SMTP id z26csp1744622iol; Sat, 12 Jun 2021 19:34:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwuQ++Y++3FxuBGyb3qzXnWAHvMiK40IiJGu7U/M0jaVfllmLvZZP98cpa5tPra+1JHIQ1N X-Received: by 2002:a17:907:2150:: with SMTP id rk16mr10066873ejb.166.1623551695050; Sat, 12 Jun 2021 19:34:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623551695; cv=none; d=google.com; s=arc-20160816; b=Y6fCHoF3/E/WnYuMYubf8hMzYfH7JeaGplvIKdKC8/AHM1sbhARdlmEPADFNppVyx6 xCDl3HvaG5NRAy2iDLO/Ql0SABGJcuujafDLSTemnDgeMb1G97NIov76rsw1WAQjMUUu 4Iqh1kUdCxdd7uy2uaKFw0jjDntQ+LiOuiCbP++CCSy0YFOCROWk366kJi0VkM0o6l2c pTaGprn49P8z14vd/n0EJqFr5aM5dVos7T1PfOFhFFS8fibgDx8QpzqY+hNuogz0qMgK 0IRDEK1LwIWwEUA6RVLLXhe7vyn9ToKr+1RID8f0iLFN1cBG7suZS9WtniTlYuJqvnf5 8atA== 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=exYBygJtQC4qrLeQa0zAfaL2VQIi0IYh1Lno4lE8iicT1wv1yRgRaKAUYGgN1DHAQV NjBwajmvq//qxeDVSG/Y/QTtSOqaz0dZGREf+SuEzk8GD89qDiGEpaAjyB3J7L0qEOnS UYR4Og7eZkTBkzWp3W0uVzxLCrl8OWYLmIB/q4Npm+EOTsjDgDSqnJRtu2sCQW3/NL6V /0le2t/IhGnN9tADhdmJs+RuvGEpFtqJwTkJ6kcp6BlkTPzcRdc5WFOMmcRfr9+aOmX+ PPE9J+PN63DaMxhHCahqVeDQ6Kl+A+1wuJizyQPS6qkLiPmF9IT6w/GUbPXr2gEUJCPY BwlA== 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=AC99dpNy; 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 r2si8792060ejp.248.2021.06.12.19.34.54; Sat, 12 Jun 2021 19:34:55 -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=AC99dpNy; 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 0784F680CED; Sun, 13 Jun 2021 05:34:40 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C6CCB680BBD for ; Sun, 13 Jun 2021 05:34:33 +0300 (EEST) Received: by mail-pl1-f170.google.com with SMTP id v12so4768787plo.10 for ; Sat, 12 Jun 2021 19:34:33 -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=AC99dpNypmlqcnkaFMt2ICazojmBuq/U3dqtuIU5nY89LZEHwWS59kJggoWPcCwwxt aCy/LYLv0K/DSi0jZk20nXn2/q0ecoRR29KH4hLOf5u5T+K6ADFC0DZgwaHNhxKC0uMN K044iIXl9/WDiwIw4/Z7HnkiYSjT5DPb5GGXfBh3RLImDUsTNOjZG3GsgVjuiEvT1K8T 8NnZiuhuSHkMcjvLzGwfuic+Zah7u0242TokQWVxMd+iHHkzEz43IAEb9AW5gEtBtYry El7m61Ho2sUxf8tOwGlXl+jcyOXJlaVwP5aK+r1TcPm1601bu3LLE6ayeiFBQFePIZqf RFtg== 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=HrHmM8ECdHgbBeyv2YXdfRTWPYp61hKVG+//CEQwMX2vvcv6hBu1RlsQP49+/dGK1f zVXg0RloRjCtr352pBiPlQ8XvGKBL8chIOvgnN0ayYyqbgoKDT52WK9JT+1Z4yiFgI45 /GiI5yGtFx6fZzNgfOHjL9cgYTGo5G5OSHGulrNu4wQsPj16uiVWeox/rAvwUL3tvXH4 77Pu/DJZUOBKw/icRwzHT35G7qeGN5GwvFeN7lGB/unvxQ6YeCJUvZ3buP5xa0AAnp9I HUvVVUKjlmRYlWBbC8Vval6IyhAY22/XoPKvvKwx36pklzTmTZhUz0YdBQ9ZulpRWeEe HWaA== X-Gm-Message-State: AOAM533XXoIFrqGxfuMcD+U7o+abwoU5KyJJIKn50prMhY51qxmHFj2O ewXJxm/UMmv1CUYuZMSXbG291Bi5fFweqA== X-Received: by 2002:a17:90a:bf11:: with SMTP id c17mr11878265pjs.165.1623551671605; Sat, 12 Jun 2021 19:34:31 -0700 (PDT) Received: from zhengqian-xps.lan (ngn-nat1.v4.open.ad.jp. [202.222.12.138]) by smtp.gmail.com with ESMTPSA id x33sm8966924pfh.108.2021.06.12.19.34.30 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 12 Jun 2021 19:34:31 -0700 (PDT) From: zheng qian To: ffmpeg-devel@ffmpeg.org Date: Sun, 13 Jun 2021 11:34:18 +0900 Message-Id: <20210613023421.23039-2-xqq@xqq.im> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210613023421.23039-1-xqq@xqq.im> References: <20210613023421.23039-1-xqq@xqq.im> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 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: CUetavyi6crN 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; }