From patchwork Sat Feb 2 13:31:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Jan_Ekstr=C3=B6m?= X-Patchwork-Id: 11955 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id E0A5344651E for ; Sat, 2 Feb 2019 15:39:03 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id CE9CC68A77B; Sat, 2 Feb 2019 15:39:03 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-lf1-f44.google.com (mail-lf1-f44.google.com [209.85.167.44]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C33A468A67D for ; Sat, 2 Feb 2019 15:38:57 +0200 (EET) Received: by mail-lf1-f44.google.com with SMTP id x201so5823666lff.10 for ; Sat, 02 Feb 2019 05:38:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=i31q8EppjO6K3Bnu86u99Qh8GNxR871NCXmhX1eVfZI=; b=k9hFySOehj5a80PnHRzuMchtbR0a7M5GB9YPdp3/PEnLmJAuYYktF7UQNoR97amLRx wjTG92pa3hCxwTF45fG7JfZcV018f4cB33Q5FvKFDYIOBRGl9JBB1wjEfY1fjdj9bn5f QDHjEDYXAEW8CLyDwSlSUGaxK+RGUlIlWg66KBXMf1JpocG8UYz5BApduYYvvP28o03A o2769c2vkpIvl0TcTOoPzSPwuG6w6NR01+2uBgpZ2yz8mN62b9/IbCJm7noUdB/Lw9IQ nvXeSHpQpRZXv6yuezsMNc4U6CMg/YKlNPTPGP80YYjRjaIjDCnSKkdlzeqRi9YDKOsz w6og== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=i31q8EppjO6K3Bnu86u99Qh8GNxR871NCXmhX1eVfZI=; b=BCRWr92tC4GWYz6nq4TQboCAbb0KIRZddnGc9HAjaqKdmUHcIRzUYWdZ0BP3OMGR7X C+qJz/tOscTCMnxnGR/M2hT5YbIkWutOZmkk0Cjd7OPXEcPD7ZGhN2CPj+/rMbPboUfc +NXWbDuKqcOoox4yVo5JGS70Kkt3RfwHa5qtZW+oWGLtQ2GndMZhuS440jIquO9WjJRe kEndNkqeQUa7UYhPPs6zIr9mXb2m7/dsBFskNIPx8qcnOWW8DoV6PeCePtYMtNrfxJmp utrI4pb+cL/j/iEvytfzJjtGQZna8IbJSq5C/56YAY/uqQVRrL5gcwkGPOW7XvowbZEp IQjw== X-Gm-Message-State: AHQUAua1zgWVeghaRZJCD0bfZaAOju+0sSjZlDU9TovRtRe32Gf0p2rJ kjY7+20RSYVrcf8mxIqnKQkIem8Y X-Google-Smtp-Source: AHgI3IYXE3sIgkJTpvSh0/tGStIf16gPbGF9NOW25c++59PVNBW62sN+omXQSgUxjNBuPhBExfZMhA== X-Received: by 2002:ac2:4254:: with SMTP id m20mr3205739lfl.131.1549114300493; Sat, 02 Feb 2019 05:31:40 -0800 (PST) Received: from localhost.localdomain (91-159-194-103.elisa-laajakaista.fi. [91.159.194.103]) by smtp.gmail.com with ESMTPSA id e142sm96058lfg.90.2019.02.02.05.31.39 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 02 Feb 2019 05:31:39 -0800 (PST) From: =?UTF-8?q?Jan=20Ekstr=C3=B6m?= To: ffmpeg-devel@ffmpeg.org Date: Sat, 2 Feb 2019 15:31:36 +0200 Message-Id: <20190202133136.28596-3-jeebjp@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190202133136.28596-1-jeebjp@gmail.com> References: <20190202133136.28596-1-jeebjp@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/2] lavf/mpegts: add reading of ARIB data coding descriptor X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" This enables us to read the data coding type utilized for a specific private data stream, of which we currently are interested in ARIB caption streams. The component tag limitations are according to ARIB TR-B14, and the component IDs are defined in ARIB STD-B10. --- libavformat/mpegts.c | 47 +++++++++++++++++++++++++++++++++++++++++++ libavformat/version.h | 2 +- 2 files changed, 48 insertions(+), 1 deletion(-) diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c index 300db110d4..a170b3e1b6 100644 --- a/libavformat/mpegts.c +++ b/libavformat/mpegts.c @@ -2013,6 +2013,53 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, AVStream *st, int stream_type } } break; + case 0xfd: /* ARIB data coding type descriptor */ + if (stream_type != STREAM_TYPE_PRIVATE_DATA) + // STD-B24, fascicle 3, chapter 4 defines private_stream_1 + // for captions + break; + + { + // This structure is defined in STD-B10, part 1, listing 5.4 and + // part 2, 6.2.20). + // Listing of data_component_ids is in STD-B10, part 2, Annex J. + // Component tag limits are documented in TR-B14, fascicle 2, + // Vol. 3, Section 2, 4.2.8.1 + int actual_component_tag = st->stream_identifier - 1; + int picked_profile = FF_PROFILE_UNKNOWN; + int data_component_id = get16(pp, desc_end); + if (data_component_id < 0) + return AVERROR_INVALIDDATA; + + switch (data_component_id) { + case 0x0008: + // [0x30..0x37] are component tags utilized for + // non-mobile captioning service ("profile A"). + if (actual_component_tag >= 0x30 && + actual_component_tag <= 0x37) { + picked_profile = FF_PROFILE_ARIB_PROFILE_A; + } + break; + case 0x0012: + // component tag 0x87 signifies a mobile/partial reception + // (1seg) captioning service ("profile C"). + if (actual_component_tag == 0x87) { + picked_profile = FF_PROFILE_ARIB_PROFILE_C; + } + break; + default: + break; + } + + if (picked_profile == FF_PROFILE_UNKNOWN) + break; + + st->codecpar->codec_type = AVMEDIA_TYPE_SUBTITLE; + st->codecpar->codec_id = AV_CODEC_ID_ARIB_CAPTION; + st->codecpar->profile = picked_profile; + st->request_probe = 0; + } + break; default: break; } diff --git a/libavformat/version.h b/libavformat/version.h index 4408ecaa06..2e83eb4f23 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -33,7 +33,7 @@ // Also please add any ticket numbers that you believe might be affected here #define LIBAVFORMAT_VERSION_MAJOR 58 #define LIBAVFORMAT_VERSION_MINOR 26 -#define LIBAVFORMAT_VERSION_MICRO 100 +#define LIBAVFORMAT_VERSION_MICRO 101 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ LIBAVFORMAT_VERSION_MINOR, \