From patchwork Fri Apr 13 13:44:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?=C5=81ukasz_Krzciuk?= X-Patchwork-Id: 8436 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.1.70 with SMTP id c67csp784823jad; Fri, 13 Apr 2018 06:44:52 -0700 (PDT) X-Google-Smtp-Source: AIpwx48Mr1HSBR9a/crPcVGA6BKmIBvMSJ0hMhJiLOn1yqUVUcTF9Z8nK7E2EFB5ctJBKGVeLhAg X-Received: by 10.223.165.66 with SMTP id j2mr4063666wrb.32.1523627092200; Fri, 13 Apr 2018 06:44:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523627092; cv=none; d=google.com; s=arc-20160816; b=K/LI3upphnABTfzdgPcjVCHedTFeyGvYVK2EmotttTT3hpHEWDvgZwsTcOjFBoClIA RKuR/sGDdZUC79E2LIRbKl2RaT/Giykll/ZaW7C8XwmlKnvz5/sWpsoh/ZOd0FGx8Pwc C+mWXCKzMy4nK2vWs4NzRtDXqsvA6mz9xXCIgN0pLmBXYr5s7eKoVQtsW437cVAAR0id nPAHVqzP/dulVGQtn8pj1Do+Y8am7EqNHg6YDtSbjzXvNZAC8SGdw0ouaqFvfacIsX6l ZdAMUhX3w+VacHFWnYSQy5C35KMspKdi0oyFqOWtp2ZzZoOTP3+iCT4knjF8pckovHai WQyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:subject:to :message-id:date:from:mime-version:dkim-signature:delivered-to :arc-authentication-results; bh=t197DQ3snyygcGUhXVcxRdVxy/LlLb086luj/Sw71GI=; b=NZUvY2olASCcjMnEy564R1xCdozvnGOeqtO6f5RND5PCiLmgYsRME7LsCHCoUfWc2g BwqJp+8jr6OHu8PZ9WEEWCQdp4wIrkzSbTdwvAkSLVThZuqstzixf6ZjQQbzUYVaB50f 6Hnktnf+NdX9NRGyxZ8eQfiP+fvXFWLVPA3wv53ISJykhFbRJwcz6NQ/NG2uarvhXAwm 3+yP8o9VM3hz/u3aihcz1nL6xKti6kx9vZ+EpS+Sp0+VoDN1iDsg4IcnPpBhseXgmeJk xJfYtY//GL+5XEfeXxYb3qxhHvwEmhbLPqqJxHUBeBS1gsI18PKjvOJ+vjoRJ9CS8fIb fwlg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@vewd-com.20150623.gappssmtp.com header.s=20150623 header.b=c36C7R+E; 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 m71si272173wma.134.2018.04.13.06.44.51; Fri, 13 Apr 2018 06:44:52 -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=@vewd-com.20150623.gappssmtp.com header.s=20150623 header.b=c36C7R+E; 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 E7854689FFF; Fri, 13 Apr 2018 16:44:24 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-io0-f176.google.com (mail-io0-f176.google.com [209.85.223.176]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2BC45689FD3 for ; Fri, 13 Apr 2018 16:44:18 +0300 (EEST) Received: by mail-io0-f176.google.com with SMTP id d7so10268845ioc.11 for ; Fri, 13 Apr 2018 06:44:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vewd-com.20150623.gappssmtp.com; s=20150623; h=mime-version:from:date:message-id:subject:to; bh=zB2KdJB+m336AX4j9e3bZnFqZ1tdfm2Pp2+m2uUOOcM=; b=c36C7R+EE7TGoVx3NNb1BXh4AM372zG1lsGbmfNVyvwKpnBHvpa4y7qO+DYAD8ZF2A jXJOEgb5sdujJ/H9mlU8A8x0CgX5ciQ/IB/alZ+oARjgwjOSQKDQw981QVYYopLUx4nj nZtST2H53wSSBcsu6N9e88QBeEQei2xJgJFyNX4Zak3GMo3jv4o173H7h810L6444qnH EtZ1SvdsCAHw9e+gw8ODpDZTVfR+uzof8hU83X67jF456tw+SEaDF0xPZZ+iVf/SfDPw SEztGKOcKDEW/+oLlhtnBRpi1K6FHlyvyx6qLao21UoMr15GxdYud8umiDGIsqXin3Ur D7zw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=zB2KdJB+m336AX4j9e3bZnFqZ1tdfm2Pp2+m2uUOOcM=; b=eTMRXhi+HSByMTQSpO8vc1/gex2sGSmgtRlT2z8krcwKAIN8OzkiPwz3mCy/I6fGSq 1vOfygEskgCpz75HqSfu50fRy0ipVNPcHI9d+N5QMAz+TNuHt70WXDC2pP2XsNglrFBC a45eljOoqGcFYF6gzwhHs7bf5ruX2w0+FCwVlY5kUi0LxDnEADNxLktnPwi5OR8CZf1D 0dSuFIj+dcmVbnzxywEGWi/i/ud1c2BxzGZ1qhvFEteDyfY0V+3FTrFJv80FKbLGZClx z0vLEd3ClM4E7y9NoJODwBU0P0mzcnYkQTQ0KcsJY1bjrdXHLFzTcTMZX9VOQucZSoiv 7e9w== X-Gm-Message-State: ALQs6tBZN8TRY5R2VdkYC6U6cfgxG+cAaqcgh5o3lG57YkehkcixxQK+ gOqq1/xOUJogfbifpMEIVxoZLS1HzdgINeYv1YZoDARr X-Received: by 10.107.57.66 with SMTP id g63mr12969548ioa.258.1523627081497; Fri, 13 Apr 2018 06:44:41 -0700 (PDT) MIME-Version: 1.0 Received: by 10.2.133.14 with HTTP; Fri, 13 Apr 2018 06:44:40 -0700 (PDT) From: =?UTF-8?Q?=C5=81ukasz_Krzciuk?= Date: Fri, 13 Apr 2018 15:44:40 +0200 Message-ID: To: ffmpeg-devel@ffmpeg.org X-Content-Filtered-By: Mailman/MimeDel 2.1.20 Subject: [FFmpeg-devel] avformat/mpegts: set AV_DISPOSITION_DESCRIPTIONS for OIPF cases 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" Hi, this change is needed according to OIPF spec: 8.4.2 AVComponent, audioDescription case: 1. an audio component with an ISO_639_language_descriptor in the PMT with the audio_type field set to 0x03 2. a supplementary_audio_descriptor with the editorial_classification field set to 0x01 3. an ac-3_descriptor or an enhanced_ac-3_descriptor with a component_type field with the service_type flags set to Visually Impaired Regards, *Łukasz Krzciuk* Developer Vewd ul. Grabarska 2, Pegaz 2A, 50-079 Wrocław, Polska From 12ef5cdd9c443b1601dc98d910feac87233b1040 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Krzciuk?= Date: Fri, 13 Apr 2018 14:57:57 +0200 Subject: [PATCH] avformat/mpegts: set AV_DISPOSITION_DESCRIPTIONS for OIPF cases 1. an audio component with an ISO_639_language_descriptor in the PMT with the audio_type field set to 0x03 2. a supplementary_audio_descriptor with the editorial_classification field set to 0x01 3. an ac-3_descriptor or an enhanced_ac-3_descriptor with a component_type field with the service_type flags set to Visually Impaired --- libavformat/mpegts.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c index 37a6aa8..df2b3aa 100644 --- a/libavformat/mpegts.c +++ b/libavformat/mpegts.c @@ -1835,6 +1835,7 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, AVStream *st, int stream_type break; case 0x03: st->disposition |= AV_DISPOSITION_VISUAL_IMPAIRED; + st->disposition |= AV_DISPOSITION_DESCRIPTIONS; break; } } @@ -1910,6 +1911,7 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, AVStream *st, int stream_type switch ((flags >> 2) & 0x1F) { /* editorial_classification */ case 0x01: st->disposition |= AV_DISPOSITION_VISUAL_IMPAIRED; + st->disposition |= AV_DISPOSITION_DESCRIPTIONS; break; case 0x02: st->disposition |= AV_DISPOSITION_HEARING_IMPAIRED; @@ -1934,6 +1936,34 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, AVStream *st, int stream_type } } break; + case 0x6a: /* ac-3_descriptor */ + { + int component_type_flag = get8(pp, desc_end) & (1 << 7); + if (component_type_flag) { + int component_type = get8(pp, desc_end); + int service_type_mask = 0x38; // 0b00111000 + int service_type = ((component_type & service_type_mask) >> 3); + if (service_type == 0x02 /* 0b010 */) { + st->disposition |= AV_DISPOSITION_DESCRIPTIONS; + av_log(ts->stream, AV_LOG_INFO, "New track disposition for id %u: %u\n", st->id, st->disposition); + } + } + } + break; + case 0x7a: /* enhanced_ac-3_descriptor */ + { + int component_type_flag = get8(pp, desc_end) & (1 << 7); + if (component_type_flag) { + int component_type = get8(pp, desc_end); + int service_type_mask = 0x38; // 0b00111000 + int service_type = ((component_type & service_type_mask) >> 3); + if (service_type == 0x02 /* 0b010 */) { + st->disposition |= AV_DISPOSITION_DESCRIPTIONS; + av_log(ts->stream, AV_LOG_INFO, "New track disposition for id %u: %u\n", st->id, st->disposition); + } + } + } + break; default: break; } -- 2.8.3