From patchwork Sat Jul 17 02:38:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: zheng qian X-Patchwork-Id: 28951 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a5d:965a:0:0:0:0:0 with SMTP id d26csp2348248ios; Fri, 16 Jul 2021 19:39:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxDMxS0fWqW5CuhtMuSHR8PjpzqaBYXfqTVMbcd5kpyXR60Zloo+EpfAZOsoMQ/NT0TWoA9 X-Received: by 2002:aa7:db54:: with SMTP id n20mr18830937edt.21.1626489545609; Fri, 16 Jul 2021 19:39:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626489545; cv=none; d=google.com; s=arc-20160816; b=cJlAnARe1dqG946N3gWRWz7RsOP2UE02wZvhUYKsHP6Csab4nIHGOr4g8eAqrixsM4 uHWnM2/mWYApU58yT8ZQPDCEsqyBUuowkYuQc/HWnxckiJjK8qLPmGy51cXrP5Mv6nB1 Dj2OT2JxDlwHLpIPQ9bDLE/ahef6/uJWLJT56+LpuxZQ4AfwMkv4eQluZoG3tqRlQyKT 8avWijVm8UVJJsgZ1y2BOjPD3dScoUWfRTrpkBw04SUtrg5wiS5TOhhGKnlFSPZSZYAG m0GXbjjri+BN+lJMgD/1g1PkvkqNQoyylcYD4JYDGGZ88xABEwpqKP06YSGEr6ENKE4T SpnQ== 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=qDeKS2F43/jUYUYqjXfJI1A++pCMcBu/ZKm0fyNzcMY=; b=mMkPdHu/NBu65EUyR0eaPDNj7OK6f3BBQ9d8Du16k37qAOeob2BUH+9jcrricfHqkU jlgBZFweKNy1OnZVBMlkE6dNc/dRrHC9RpWJbsoMpk+2IEahBJcwWwZpnN2GxKMtLD+K 3EW/RnqnoAnO+/soAtk3eAoIS7VDYbABKB2RYyHV9ny1BWrUlh7uUhnjIvET+Fl/cFCu gMPCcIxqdj8qFzvbg4ZGEC62JExYjveXwEHKLM4gHNgNjJdhOhjeNHFnVpf28ZKXIsJc 0/ee5VgiZ9HJtNfQXB3RXh0duspyIwIugMyenH31lkjvDaFnWdkyueTpbi8urVQlZYwj v9dw== 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=0s7l2DMW; 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 ds7si12502383ejc.150.2021.07.16.19.39.05; Fri, 16 Jul 2021 19:39:05 -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=0s7l2DMW; 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 4AD6968A880; Sat, 17 Jul 2021 05:38:59 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 6AC4268A1D4 for ; Sat, 17 Jul 2021 05:38:52 +0300 (EEST) Received: by mail-pl1-f171.google.com with SMTP id x16so6224905plg.3 for ; Fri, 16 Jul 2021 19:38:52 -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=P+uis/GU9HGffGH6QHbAeKZwt6QOCy/NEjf7RNrB50Y=; b=0s7l2DMWAQq6rh6Bl8BFZQ1zcezm/sywewj9whjb9tnMPb+yv3xq1HBzBVAORwMAKc 2aWk5kvh5dQAoEUPZfp4c1g6L0MJxZmIDogyZ87/+rjTPxmjRYKqir5J1/m5PnZS6qc7 0MbWdn0KPhJrXPC+X+US2b3F63zuI4Icds8yJQlL+voMYNbL0966oejBHzgkudGv7kro UV0vOG98PRNyfdtvNvHsdaJB61kgZAZtMhqywEuKQQjnCPX6Z223nWCmbv9WlEUo4ddP E7tEWUDpS/pxUTUfXRzGhx34iSGPq2f2A0SnmfCFPnsfvoX/zZt9owTgJBBVB/+vdPbb Kmmw== 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=P+uis/GU9HGffGH6QHbAeKZwt6QOCy/NEjf7RNrB50Y=; b=c7Ikkc5bA2AtQqDgkS0MghKEgc/vCXDizK7ml2Ba/3n+2i1wQEFZbb2kDvbYUVDREO xbP9XLVPiHi8pNaWOdvUgSEa2TzHgEGY2ZrSntJGBmCR5eiB0jT+iXfuiZlZKVPee+we qvabqqHgKuzNO5BuvniiQf2825C1EHhGuIoxcjWEgG/AbR0v+mwgdUH3qY5x3uhhDkQu /YqwSg1+GDJmQZhFSeCTzGWDznRzweUUkIdDWWSq27vd8l3qWbj5aYkJogqqu5xBMFE+ jk1o7UMIT4/7HqP14TYauY5OgH0U2MAE2ool0kzLgUiSFQtXU0MCsiOX/yN76vGgvxjT Fx/g== X-Gm-Message-State: AOAM532snNR67sLvUKKjWjlSowVHg7ushIlF1sakKQf/GxDxtlRtpwpe AJgKogb6Rgr96wrDTTTkyuV4q1fgYjtF/g== X-Received: by 2002:a17:90a:4b02:: with SMTP id g2mr12455859pjh.44.1626489529914; Fri, 16 Jul 2021 19:38:49 -0700 (PDT) Received: from zhengqian-xps.lan (ngn-nat1.v4.open.ad.jp. [202.222.12.138]) by smtp.gmail.com with ESMTPSA id q18sm12909263pgj.8.2021.07.16.19.38.48 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 16 Jul 2021 19:38:49 -0700 (PDT) From: zheng qian To: ffmpeg-devel@ffmpeg.org Date: Sat, 17 Jul 2021 11:38:27 +0900 Message-Id: <20210717023829.84846-2-xqq@xqq.im> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210717023829.84846-1-xqq@xqq.im> References: <20210717023829.84846-1-xqq@xqq.im> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v3 2/4] avformat/mpegts: Recognize ARIB superimpose stream 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: g6jEzvAA8Qls Recognize ARIB superimpose stream through ARIB data coding descriptor, and re-use AV_CODEC_ID_ARIB_CAPTION codec id with an extra disposition flag AV_DISPOSITION_URGENT. Signed-off-by: zheng qian --- libavformat/mpegts.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c index a02965bacf..44a1841859 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; + int is_superimpose = 0; int picked_profile = FF_PROFILE_UNKNOWN; int data_component_id = get16(pp, desc_end); if (data_component_id < 0) @@ -2122,17 +2123,28 @@ 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) + picked_profile = FF_PROFILE_ARIB_PROFILE_A; + } else if (actual_component_tag >= 0x38 && + actual_component_tag <= 0x3F) { + // superimpose (Profile A) + is_superimpose = 1; 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) + picked_profile = FF_PROFILE_ARIB_PROFILE_C; + } else if (actual_component_tag == 0x88) { + // superimpose (Profile C) + is_superimpose = 1; picked_profile = FF_PROFILE_ARIB_PROFILE_C; } break; @@ -2147,6 +2159,9 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, AVStream *st, int stream_type st->codecpar->codec_id = AV_CODEC_ID_ARIB_CAPTION; st->codecpar->profile = picked_profile; st->internal->request_probe = 0; + if (is_superimpose) { + st->disposition |= AV_DISPOSITION_URGENT; + } } break; case 0xb0: /* DOVI video stream descriptor */