From patchwork Thu Jul 30 14:58:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lance Wang X-Patchwork-Id: 21387 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 1853E449BE4 for ; Thu, 30 Jul 2020 18:24:29 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id E843168B4F3; Thu, 30 Jul 2020 18:24:28 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pl1-f195.google.com (mail-pl1-f195.google.com [209.85.214.195]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 3E07D68B4F3 for ; Thu, 30 Jul 2020 18:24:22 +0300 (EEST) Received: by mail-pl1-f195.google.com with SMTP id w17so14441277ply.11 for ; Thu, 30 Jul 2020 08:24:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=t46nQEMFCT1ZuVmCWvYwe+XCSBPkk1LLBv3Gn1jVmkA=; b=TDKiO8ipA2nmGr+VzQY8w1s8wwNBX+J7A2P9Cof8AVB3YZN+ZR1wWJdq6gsV4b8nio DSh5iHqWDYJ+WXL1KRLpBibX5WSpDinQ5rltHsRYYjUCxLSVkeFISE5QVVqQDPmZvX18 UzSYz6rhrsRJbnwK/RAd89JtNCclskxElMukUzQNGCpD2u0P6lHn8YxlnBqI9XdQmH/c necgp2iIC8CX5S9IZOBfpcg0RFK6OEc+WLMMGqa5vTXi897bcKXNG9UNE/tCx5rupjm5 4L20I6qa7vHLddr5J+2unnSGtmCxcVt1HCQomyQSOicVn30qilnR4UdvO/1s2cpU6zok HErQ== 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; bh=t46nQEMFCT1ZuVmCWvYwe+XCSBPkk1LLBv3Gn1jVmkA=; b=J9Uc8AJE8E5hA3hW/vUWZ/qh5y5BTcswgBpEg/PAPW3cDzblSGHxDpygcPr3aS+uYi 4cU6TSUTAzp7uvMzYcyPTRrqJlb8Msox6ADfq9TTZtuzj2tLvladvyNrQYCh5lXbhNIu 5Foj909Qm9KjI563Shd6VgtXMPigD8G8/N8diNDP/7rPw5L13o2T3oIxuxIQj+jcUpYe qUJaKGNtwUiKYgZUUQkickR+/FNNFeMuhWjw679BB5dpktJKnNKuwW5F+nd5D+1nmiPo EPGbODv9E+RpLB0EL4TIdZAINCjE7PYK6W/hHMQBNDc5ySzFvgaZx0lMNSofreE5f4uu NQNA== X-Gm-Message-State: AOAM5314M9L0CZh8bF9JDhGSZc6eYp4qqrWh6XYTTjv6Qm3scMZnFCPA ZvSiJixCARA83NQDH2IfcQTtSe1c X-Google-Smtp-Source: ABdhPJzV9nXcPfbzdmqHtrObFGO8iSdIjU1Ez9XdFBSZev5blPJbj6teUHXriI9pc2m2fLAkjkyvSg== X-Received: by 2002:a63:ce41:: with SMTP id r1mr35908821pgi.203.1596121143694; Thu, 30 Jul 2020 07:59:03 -0700 (PDT) Received: from vpn2.localdomain ([161.117.202.209]) by smtp.gmail.com with ESMTPSA id d5sm5620864pju.15.2020.07.30.07.59.01 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Jul 2020 07:59:02 -0700 (PDT) From: lance.lmwang@gmail.com To: ffmpeg-devel@ffmpeg.org Date: Thu, 30 Jul 2020 22:58:54 +0800 Message-Id: <1596121138-20997-1-git-send-email-lance.lmwang@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1595948614-10861-1-git-send-email-lance.lmwang@gmail.com> References: <1595948614-10861-1-git-send-email-lance.lmwang@gmail.com> Subject: [FFmpeg-devel] [PATCH v2 1/5] avutil/mpegts_audio_desc_metadata: add helper function for AC3 descriptor 0x6a 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 Cc: Limin Wang MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" From: Limin Wang Signed-off-by: Limin Wang --- libavutil/Makefile | 2 ++ libavutil/mpegts_audio_desc_metadata.c | 33 ++++++++++++++++++++ libavutil/mpegts_audio_desc_metadata.h | 57 ++++++++++++++++++++++++++++++++++ 3 files changed, 92 insertions(+) create mode 100644 libavutil/mpegts_audio_desc_metadata.c create mode 100644 libavutil/mpegts_audio_desc_metadata.h diff --git a/libavutil/Makefile b/libavutil/Makefile index 9b08372..4b4aa68 100644 --- a/libavutil/Makefile +++ b/libavutil/Makefile @@ -57,6 +57,7 @@ HEADERS = adler32.h \ md5.h \ mem.h \ motion_vector.h \ + mpegts_audio_desc_metadata.h \ murmur3.h \ opt.h \ parseutils.h \ @@ -140,6 +141,7 @@ OBJS = adler32.o \ mastering_display_metadata.o \ md5.o \ mem.o \ + mpegts_audio_desc_metadata.o \ murmur3.o \ opt.o \ parseutils.o \ diff --git a/libavutil/mpegts_audio_desc_metadata.c b/libavutil/mpegts_audio_desc_metadata.c new file mode 100644 index 0000000..14d9100 --- /dev/null +++ b/libavutil/mpegts_audio_desc_metadata.c @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2020 Limin Wang + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ +#include "mpegts_audio_desc_metadata.h" +#include "mem.h" + +AVDescriptor6A *av_desc6a_alloc(size_t *size) +{ + AVDescriptor6A *desc6a = (AVDescriptor6A*)av_mallocz(sizeof(*desc6a)); + + if (!desc6a) + return NULL; + if (size) + *size = sizeof(*desc6a); + return desc6a; + +} diff --git a/libavutil/mpegts_audio_desc_metadata.h b/libavutil/mpegts_audio_desc_metadata.h new file mode 100644 index 0000000..ae0567e --- /dev/null +++ b/libavutil/mpegts_audio_desc_metadata.h @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2020 Limin Wang + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * MPEGTS audio stream descriptor + */ + +#ifndef AVUTIL_MPEGTS_AUDIO_DESC_METADATA_H +#define AVUTIL_MPEGTS_AUDIO_DESC_METADATA_H +#include +#include + +/* ETSI 300 468 descriptor 0x6A(AC-3) + * Refer to: ETSI EN 300 468 V1.11.1 (2010-04) (SI in DVB systems) + * + * @note The struct must be allocated with av_desc6a_alloc() and + * its size is not a part of the public ABI. + */ +typedef struct AVDescriptor6A { + uint8_t component_type_flag; + uint8_t bsid_flag; + uint8_t mainid_flag; + uint8_t asvc_flag; + uint8_t reserved_flags; + uint8_t component_type; + uint8_t bsid; + uint8_t mainid; + uint8_t asvc; +} AVDescriptor6A; + +/** + * Allocate a AVDescriptor6A structure and initialize its + * fields to default values. + * + * @return the newly allocated struct or NULL on failure + */ +AVDescriptor6A *av_desc6a_alloc(size_t *size); + +#endif /* AVUTIL_MPEGTS_AUDIO_DESC_METADATA_H */ From patchwork Thu Jul 30 14:58:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lance Wang X-Patchwork-Id: 21383 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 BEDD94492E1 for ; Thu, 30 Jul 2020 18:05:39 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 9B3C968B29C; Thu, 30 Jul 2020 18:05:39 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-io1-f50.google.com (mail-io1-f50.google.com [209.85.166.50]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2678168AEBC for ; Thu, 30 Jul 2020 18:05:33 +0300 (EEST) Received: by mail-io1-f50.google.com with SMTP id l17so28524986iok.7 for ; Thu, 30 Jul 2020 08:05:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=1W1MLxAwNcNZ6E91XjW9ClyTfh8ON80E+RksSjJTJH0=; b=C+0LJmrHnihcH3xaMxwrV6km6ItyTLqS3F8KHqDtVHuhjL46RSD9KxkS0neVmSCdz+ MvwkumbnmzHyQY5/IG7Zmf2b4CpeMbtdeyLzoF75YzB5HKCOZ/Sm5kJCq0TBbvQ2dqIf o/cuhCmw8F8r6z404Iu94mmq33JJtn7E+uL+k+Eoe982BVbH1+oFDotAUji2MJBRt50c 0l/kErdZgChjy1fhcgENa645C0vXObEGjq0+iLpW+p3ORoVty+HZRnK+5umo4hYKEqQR qZqjRFCDJy/IxZUwOdK+yDWFzSIy5lTEnZEHLIPUHZA7esmjs0tP0VwoMyVRgnWpdrgl 7SUQ== 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; bh=1W1MLxAwNcNZ6E91XjW9ClyTfh8ON80E+RksSjJTJH0=; b=lbYupMLoOUjUZ48F5OJ9SZk0T6KG3QA9y+kH8H69CTcF/P0X7q25tT1JTkG/7ocZ8l kJwdT/7ceJnX45IHzsRt3bTQvdJU9ecygLgyhCbr/1+kP21C4xYlMXwwaUucyliRyCS4 PobHIFiNGB9Qtyg92crmDVsa2t0wcvWHitV2P0l2vtqjl/U4raDUNSQ0byHqJKpkmATm j6QOTVViQTgb2pXiyBFDfScgIwD7XSS+MUJm5ftAZ1cHIXb3zUxtK6cc0aA8kGCN5Qjf Y4YFTXZPaIDRIErM/xKKOTLo2NaS4Pl8t3LPS4dN2RLwSWO1s0BKEpHGreEqiZ7n8hq5 URzQ== X-Gm-Message-State: AOAM530IyfSqvvc5D1F/i33UqnC/uD58JfxwubuGf21m895918QNx/zI McfAjHEgp5FdWd9IQRQvu9gR2K/Q X-Google-Smtp-Source: ABdhPJx2gOHtuLaoI/pvUibM8B5ukjoXER+M9tOumO/4JAHSo1LQ9stzDAzhZmOgIhCs6sJ16vOX4Q== X-Received: by 2002:a63:be47:: with SMTP id g7mr34459894pgo.7.1596121145333; Thu, 30 Jul 2020 07:59:05 -0700 (PDT) Received: from vpn2.localdomain ([161.117.202.209]) by smtp.gmail.com with ESMTPSA id d5sm5620864pju.15.2020.07.30.07.59.03 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Jul 2020 07:59:04 -0700 (PDT) From: lance.lmwang@gmail.com To: ffmpeg-devel@ffmpeg.org Date: Thu, 30 Jul 2020 22:58:55 +0800 Message-Id: <1596121138-20997-2-git-send-email-lance.lmwang@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1596121138-20997-1-git-send-email-lance.lmwang@gmail.com> References: <1595948614-10861-1-git-send-email-lance.lmwang@gmail.com> <1596121138-20997-1-git-send-email-lance.lmwang@gmail.com> Subject: [FFmpeg-devel] [PATCH v2 2/5] API: add AV_PKT_DATA_MPEGTS_DESC_6A to AVPacketSideDataType 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 Cc: Limin Wang MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" From: Limin Wang Signed-off-by: Limin Wang --- doc/APIchanges | 3 +++ libavcodec/avpacket.c | 1 + libavcodec/packet.h | 7 +++++++ libavcodec/version.h | 2 +- 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/doc/APIchanges b/doc/APIchanges index 72a4833..12e65a2 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -15,6 +15,9 @@ libavutil: 2017-10-21 API changes, most recent first: +2020-07-xx - xxxxxxxxxx - lavc 58.99.100 - packet.h + Add AV_PKT_DATA_MPEGTS_DESC_6A. + 2020-07-xx - xxxxxxxxxx - lavu 56.57.100 - cpu.h Add AV_CPU_FLAG_MMI and AV_CPU_FLAG_MSA. diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c index 4801163..94c81ab 100644 --- a/libavcodec/avpacket.c +++ b/libavcodec/avpacket.c @@ -401,6 +401,7 @@ const char *av_packet_side_data_name(enum AVPacketSideDataType type) case AV_PKT_DATA_ICC_PROFILE: return "ICC Profile"; case AV_PKT_DATA_DOVI_CONF: return "DOVI configuration record"; case AV_PKT_DATA_S12M_TIMECODE: return "SMPTE ST 12-1:2014 timecode"; + case AV_PKT_DATA_MPEGTS_DESC_6A: return "ETSI 300 468 descriptor 0x6A(AC-3)"; } return NULL; } diff --git a/libavcodec/packet.h b/libavcodec/packet.h index 0a19a0e..451a8f1 100644 --- a/libavcodec/packet.h +++ b/libavcodec/packet.h @@ -291,6 +291,13 @@ enum AVPacketSideDataType { AV_PKT_DATA_S12M_TIMECODE, /** + * ETSI 300 468 descriptor 0x6A(AC-3) + * Refer to: ETSI EN 300 468 V1.11.1 (2010-04) (SI in DVB systems) + * Tags are stored in struct AVDescriptor6A. + */ + AV_PKT_DATA_MPEGTS_DESC_6A, + + /** * The number of side data types. * This is not part of the public API/ABI in the sense that it may * change when new side data types are added. diff --git a/libavcodec/version.h b/libavcodec/version.h index d06ce16..f669196 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -28,7 +28,7 @@ #include "libavutil/version.h" #define LIBAVCODEC_VERSION_MAJOR 58 -#define LIBAVCODEC_VERSION_MINOR 98 +#define LIBAVCODEC_VERSION_MINOR 99 #define LIBAVCODEC_VERSION_MICRO 100 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ From patchwork Thu Jul 30 14:58:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lance Wang X-Patchwork-Id: 21388 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 7695D44B9B6 for ; Thu, 30 Jul 2020 18:27:04 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4B00B68B502; Thu, 30 Jul 2020 18:27:04 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-qv1-f66.google.com (mail-qv1-f66.google.com [209.85.219.66]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2A63268B4FB for ; Thu, 30 Jul 2020 18:26:57 +0300 (EEST) Received: by mail-qv1-f66.google.com with SMTP id r19so4175743qvw.11 for ; Thu, 30 Jul 2020 08:26:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=IbOrL6h7v4Z8BsSmiXl3EOueOGOsGwlQ/yQx2OditlI=; b=iCfjMg9NZzzgp94K8IVpIuHoCTFvJ+6TcMMQKGe8K4QsBTJvVO2CwyAz5xCqft/GdK +hWTI5U8cADB0dvkyklB4mKnP3SDuN9QFlwznKPICHKOmdPF9jJSHR7/oPupOPNGugVh +70w9larp0jCtH/INXjfgBgBjE2HS0hT79/eflkKw5+rf6PCbrnHoALdlpEl+rNXzGII 1eYmAz5PtC+c9pafDdF+HCoLovS6JudlYplcXHHjNm1pSYFBNiO2yrEdz6bEmZ7Qf8/m w5q6MURclDcTf4i6hZ9r4RoI8mr9nywkK4uX/lul6A5kJUkO2qmLyKRbRRxX0JIOKslr nxmg== 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; bh=IbOrL6h7v4Z8BsSmiXl3EOueOGOsGwlQ/yQx2OditlI=; b=topPlFhYJuxLwH4nx25Tby6BsXoeusT+CKrw4Kn2oKFTkp9aipvGwRPxZ6y5tI+y+d b/SPx5/Hol/zE+qT4SKlE0+CqY47cPeVp1ydlwUoInSLuLUvIzZoqR9FsZnlmrgtQkF6 OfPQ/VzRwnLDq0q1eNs+kUcWypcoty7NBSoedFE+2ldoMsNhP030D2O/IU4w/G+BAet2 W0sid2pW7WtwqiYBjyKo4MZIJyidfIE2sMib0kdAeASePLEDXOPRHzbK36k2RGK0qU8f D/hUAAdELfiwUaaUvljVao6hx6Cg7x+/PVFYsQxX/X7200XZ3V03ibu6H1wk5odHshoR JLJA== X-Gm-Message-State: AOAM531jppap3lXIx9GS9aBZE5TmsCTJBubsYcj2Ay09QRCWptjw/gw0 EbxDhmMn1dGc459AJQOOGoKnPFOv X-Google-Smtp-Source: ABdhPJx7MWhKGHqm/LitiTD49P/USbsHrTDS/8fW+/s8XC/7+1YbHQuD+oKPZLnciz11Fi6mWz8tUg== X-Received: by 2002:a62:b417:: with SMTP id h23mr3495746pfn.118.1596121146906; Thu, 30 Jul 2020 07:59:06 -0700 (PDT) Received: from vpn2.localdomain ([161.117.202.209]) by smtp.gmail.com with ESMTPSA id d5sm5620864pju.15.2020.07.30.07.59.05 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Jul 2020 07:59:06 -0700 (PDT) From: lance.lmwang@gmail.com To: ffmpeg-devel@ffmpeg.org Date: Thu, 30 Jul 2020 22:58:56 +0800 Message-Id: <1596121138-20997-3-git-send-email-lance.lmwang@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1596121138-20997-1-git-send-email-lance.lmwang@gmail.com> References: <1595948614-10861-1-git-send-email-lance.lmwang@gmail.com> <1596121138-20997-1-git-send-email-lance.lmwang@gmail.com> Subject: [FFmpeg-devel] [PATCH v2 3/5] avformat/dump: dump AV_PKT_DATA_MPEGTS_6A_DESC side data 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 Cc: Limin Wang MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" From: Limin Wang Signed-off-by: Limin Wang --- libavformat/dump.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/libavformat/dump.c b/libavformat/dump.c index 6d29d85..249789a 100644 --- a/libavformat/dump.c +++ b/libavformat/dump.c @@ -28,6 +28,7 @@ #include "libavutil/log.h" #include "libavutil/mastering_display_metadata.h" #include "libavutil/dovi_meta.h" +#include "libavutil//mpegts_audio_desc_metadata.h" #include "libavutil/mathematics.h" #include "libavutil/opt.h" #include "libavutil/avstring.h" @@ -424,6 +425,19 @@ static void dump_s12m_timecode(void *ctx, const AVPacketSideData *sd) } } +static void dump_desc6a_conf(void *ctx, const AVPacketSideData *sd) +{ + const AVDescriptor6A *desc6a = (const AVDescriptor6A *)sd->data; + + av_log(ctx, AV_LOG_INFO, "component_type_flag: %u, bsid_flag: %u, " + "mainid_flag: %u, asvc_flag: %u, " + "component_type: %u, bsid: %u, mainid: %u, asvc: %u", + desc6a->component_type_flag, desc6a->bsid_flag, + desc6a->mainid_flag, desc6a->asvc_flag, + desc6a->component_type, desc6a->bsid, desc6a->mainid, desc6a->asvc); +} + + static void dump_sidedata(void *ctx, const AVStream *st, const char *indent) { int i; @@ -494,6 +508,10 @@ static void dump_sidedata(void *ctx, const AVStream *st, const char *indent) av_log(ctx, AV_LOG_INFO, "SMPTE ST 12-1:2014: "); dump_s12m_timecode(ctx, sd); break; + case AV_PKT_DATA_MPEGTS_DESC_6A: + av_log(ctx, AV_LOG_INFO, "ETSI 300 468 descriptor 0x6A(AC-3): "); + dump_desc6a_conf(ctx, sd); + break; default: av_log(ctx, AV_LOG_INFO, "unknown side data type %d (%d bytes)", sd->type, sd->size); From patchwork Thu Jul 30 14:58:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lance Wang X-Patchwork-Id: 21381 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 85E0844B9D8 for ; Thu, 30 Jul 2020 17:59:17 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 5169C68B6A5; Thu, 30 Jul 2020 17:59:17 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pj1-f45.google.com (mail-pj1-f45.google.com [209.85.216.45]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E60A168B5E0 for ; Thu, 30 Jul 2020 17:59:10 +0300 (EEST) Received: by mail-pj1-f45.google.com with SMTP id lx9so4749502pjb.2 for ; Thu, 30 Jul 2020 07:59:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=zKOyCPjLN9emxMU6rCOGukT3WE+8OIAbaAAwcEOI2ZU=; b=YbhvQbrIMEvS3lPQd1EFGOGqE81cyE/jw9Em8xhHbqsrAt+riJUrgkvse9L2wPzZEb fwKb05SRGMatMr11tKTeHb8eHz7jRHWyZcMuMbGt3SQ+RzHIr9gt1dxoYJxFOBaoD56d yVu3IFPP6x3cZtfILfbabt3/l/fXLSMuZeWx9r6kN9cAXQ7PMR+Y4WBs20kBhpeYr+sf sGWXHGqFTh/g0CIkjLOe8CWM/tszxD9cm2gpq/gKEBWI8ujIqlHIIk5cdANGMRABNzoN 1bzQP1C7c0ZsAKm7sz+rDAq+T/ljvaliZ3hxfJK7BjNdnXj96FivZGt3Zt6toVkhLaEn yqGA== 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; bh=zKOyCPjLN9emxMU6rCOGukT3WE+8OIAbaAAwcEOI2ZU=; b=pIuBQbuCCc3bGjLJMaq1myPPFJ9s2n2XcGdtBTP75F6SX9+UFBQiMWx9Xlv6hh1Vlg hC+v2jH/pVVw3wrAnBRSmN2k6AKuHXfqCV22RD+3p3+KGbTGoxtz2hfdERjOYyukU2K9 hP1yCIRgj7wwFprhsNsdGumOJsEO6wSjCqM/6kf2z+hzv+y40UPhH6+NhKt63k/yW6bT KKEDbosjR4cDYBKmKOrYOjSOCNTTrwBqrPtFhn7ya1gZH8nIAjb0WrZiIQsHMztFWjZm 6EzYeK1EBimFzqxBq5gb5z1AzdrMq6thO3LUi5cP4bRlGEnr04lOcKpFEVGiRrLgkOnG FliA== X-Gm-Message-State: AOAM5319rPQUzZyQkW3ap9zlfn43U4q0oGNpYy0bWDi9r9SW1/2E7ztC 9f2dYvA3+68dIr0wZnRaLl2WoPiQ X-Google-Smtp-Source: ABdhPJxd91MVkBo7I4ApwlTBaLX/qkSOo4z47loBoFdhUCHpWShGo/aA4/FyR/H+1AnVhD/WiC2frw== X-Received: by 2002:a62:52d6:: with SMTP id g205mr3835650pfb.144.1596121148399; Thu, 30 Jul 2020 07:59:08 -0700 (PDT) Received: from vpn2.localdomain ([161.117.202.209]) by smtp.gmail.com with ESMTPSA id d5sm5620864pju.15.2020.07.30.07.59.07 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Jul 2020 07:59:07 -0700 (PDT) From: lance.lmwang@gmail.com To: ffmpeg-devel@ffmpeg.org Date: Thu, 30 Jul 2020 22:58:57 +0800 Message-Id: <1596121138-20997-4-git-send-email-lance.lmwang@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1596121138-20997-1-git-send-email-lance.lmwang@gmail.com> References: <1595948614-10861-1-git-send-email-lance.lmwang@gmail.com> <1596121138-20997-1-git-send-email-lance.lmwang@gmail.com> Subject: [FFmpeg-devel] [PATCH v2 4/5] avformat/mpegts: parse and export descriptor 6a side data 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 Cc: Limin Wang MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" From: Limin Wang Signed-off-by: Limin Wang --- libavformat/mpegts.c | 57 +++++++++++++++++++++++++++++++++++++++++++++---- tests/ref/fate/ts-demux | 2 +- 2 files changed, 54 insertions(+), 5 deletions(-) diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c index c6fd3e1..720ed34 100644 --- a/libavformat/mpegts.c +++ b/libavformat/mpegts.c @@ -29,6 +29,7 @@ #include "libavutil/opt.h" #include "libavutil/avassert.h" #include "libavutil/dovi_meta.h" +#include "libavutil/mpegts_audio_desc_metadata.h" #include "libavcodec/bytestream.h" #include "libavcodec/get_bits.h" #include "libavcodec/opus.h" @@ -2073,16 +2074,64 @@ 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 ret; + uint8_t buf; + size_t desc6a_size; + AVDescriptor6A *desc6a; + + if (desc_end - *pp < 1) + return AVERROR_INVALIDDATA; + + desc6a = av_desc6a_alloc(&desc6a_size); + if (!desc6a) + return AVERROR(ENOMEM); + buf = get8(pp, desc_end); + desc6a->component_type_flag = (buf >> 7) & 0x1; + desc6a->bsid_flag = (buf >> 6) & 0x1; + desc6a->mainid_flag = (buf >> 5) & 0x1; + desc6a->asvc_flag = (buf >> 4) & 0x1; + if (desc6a->component_type_flag) { int service_type_mask = 0x38; // 0b00111000 - int service_type = ((component_type & service_type_mask) >> 3); + int service_type; + + if (desc_end - *pp < 1) { + av_free(desc6a); + return AVERROR_INVALIDDATA; + } + desc6a->component_type = get8(pp, desc_end); + service_type = ((desc6a->component_type & service_type_mask) >> 3); if (service_type == 0x02 /* 0b010 */) { st->disposition |= AV_DISPOSITION_DESCRIPTIONS; av_log(ts ? ts->stream : fc, AV_LOG_DEBUG, "New track disposition for id %u: %u\n", st->id, st->disposition); } } + if (desc6a->bsid_flag) { + if (desc_end - *pp < 1) { + av_free(desc6a); + return AVERROR_INVALIDDATA; + } + desc6a->bsid = get8(pp, desc_end); + } + if (desc6a->mainid_flag) { + if (desc_end - *pp < 1) { + av_free(desc6a); + return AVERROR_INVALIDDATA; + } + desc6a->mainid = get8(pp, desc_end); + } + if (desc6a->asvc_flag) { + if (desc_end - *pp < 1) { + av_free(desc6a); + return AVERROR_INVALIDDATA; + } + desc6a->asvc_flag = get8(pp, desc_end); + } + ret = av_stream_add_side_data(st, AV_PKT_DATA_MPEGTS_DESC_6A, + (uint8_t *)desc6a, desc6a_size); + if (ret < 0) { + av_free(desc6a); + return ret; + } } break; case 0x7a: /* enhanced_ac-3_descriptor */ diff --git a/tests/ref/fate/ts-demux b/tests/ref/fate/ts-demux index cdf34d6..dfe0374 100644 --- a/tests/ref/fate/ts-demux +++ b/tests/ref/fate/ts-demux @@ -10,7 +10,7 @@ #sample_rate 1: 48000 #channel_layout 1: 60f #channel_layout_name 1: 5.1(side) -1, 0, 0, 2880, 1536, 0x773ffeea, S=1, 1, 0x00bd00bd +1, 0, 0, 2880, 1536, 0x773ffeea, S=2, 1, 0x00bd00bd, 9, 0x00000000 1, 2880, 2880, 2880, 1536, 0x6dc10748 1, 5760, 5760, 2880, 1536, 0xbab5129c 1, 8640, 8640, 2880, 1536, 0x602f034b, S=1, 1, 0x00bd00bd From patchwork Thu Jul 30 14:58:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lance Wang X-Patchwork-Id: 21384 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 C423C44AB77 for ; Thu, 30 Jul 2020 18:07:25 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 971E568B310; Thu, 30 Jul 2020 18:07:25 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pj1-f68.google.com (mail-pj1-f68.google.com [209.85.216.68]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 174BA68B29C for ; Thu, 30 Jul 2020 18:07:19 +0300 (EEST) Received: by mail-pj1-f68.google.com with SMTP id mt12so4444764pjb.4 for ; Thu, 30 Jul 2020 08:07:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=vGQuUmm4CH7LuDNP9VhL4c5ThM2yayq5zHfQMoqboSE=; b=NTmg4Lf+RINMANDk8eUFc5YarTy3eOReSgK6qgoewQzM9G3RkHUPMfVuScR487HRbH hcCFioQLc51I7unSGr+qF9qUZpDV67Hbn9OcO0YXFAwKyh6vFuuvWZiZrCjsxhW3nhbj EgPXSvcJRS2732kpkZGZ07LAFlAB9I1lUYCFasLiwXgCsUzJIBSI9kMW/E2I4xlFYFxn 8pw3Bqi6pzZkZb7vO4Sy7ET0uQAmFb4+QT3qRhOw4wiJXrP7jieANMgPvYTa/c6aFZs1 V+dwA9okOgpsfyxfNOwoS+RaPGJnANbgAku5dfLotanvvfAobhdHoiMwp6hsgjWAWf/R thHA== 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; bh=vGQuUmm4CH7LuDNP9VhL4c5ThM2yayq5zHfQMoqboSE=; b=chzM8z0XVWAG/BJfvedLGbyATQg2F7BwwH5PgXkYMYgBbXUxx2VAJUiPPIPAmEuCg4 2ccKpn1btGtzw8jWIlPqSWd/Za71VWUV+BG55i+uEwTo6d+eJJcDNTykkiGK4gGR7dxV T09KOb+z5DKtgoHr2j/nm1puFytaOItNYy8OyBHCNEe/oOIfBUIyuC8J0Dqgf8UNo8Ir hLs3mjsM64BAUsZbNHFEp2bSEo2TzIHUcHucdcz6C+QIvcLRbDNoAPDKcXNY0kufwURp jDGGVUV1NT5bjDRgYjYBdEiapaa2rUYQ4aA3CNNkPQfY7qkenGqh1W6vagjM4X3HIB+i rs7g== X-Gm-Message-State: AOAM530Ep6whZlBQc6GKQJOlMg7Je76i7SbMR9jZauO4PQIV2jqWOty8 r6TC40pFO+5OUvYiqVLochwc46LH X-Google-Smtp-Source: ABdhPJzk2iCtLiJpmwXyOp0IdEzsWGIoAwaYjfa4oyOHmu7R2F+Wa9nAo0EBnF4Eca/fk5Qj0xzfBA== X-Received: by 2002:a62:9254:: with SMTP id o81mr3615286pfd.73.1596121149963; Thu, 30 Jul 2020 07:59:09 -0700 (PDT) Received: from vpn2.localdomain ([161.117.202.209]) by smtp.gmail.com with ESMTPSA id d5sm5620864pju.15.2020.07.30.07.59.08 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Jul 2020 07:59:09 -0700 (PDT) From: lance.lmwang@gmail.com To: ffmpeg-devel@ffmpeg.org Date: Thu, 30 Jul 2020 22:58:58 +0800 Message-Id: <1596121138-20997-5-git-send-email-lance.lmwang@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1596121138-20997-1-git-send-email-lance.lmwang@gmail.com> References: <1595948614-10861-1-git-send-email-lance.lmwang@gmail.com> <1596121138-20997-1-git-send-email-lance.lmwang@gmail.com> Subject: [FFmpeg-devel] [PATCH v2 5/5] avformat/mpegtsenc: support 0x6a descriptor for AC-3 by side data if have 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 Cc: Limin Wang MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" From: Limin Wang Signed-off-by: Limin Wang --- libavformat/mpegtsenc.c | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c index 718ddab..f4f4e3d 100644 --- a/libavformat/mpegtsenc.c +++ b/libavformat/mpegtsenc.c @@ -26,6 +26,7 @@ #include "libavutil/intreadwrite.h" #include "libavutil/mathematics.h" #include "libavutil/opt.h" +#include "libavutil//mpegts_audio_desc_metadata.h" #include "libavcodec/internal.h" @@ -244,6 +245,8 @@ typedef struct MpegTSWriteStream { /* For Opus */ int opus_queued_samples; int opus_pending_trim_start; + + AVDescriptor6A desc6a; } MpegTSWriteStream; static void mpegts_write_pat(AVFormatContext *s) @@ -486,9 +489,22 @@ static int mpegts_write_pmt(AVFormatContext *s, MpegTSService *service) case AVMEDIA_TYPE_AUDIO: if (ts->flags & MPEGTS_FLAG_SYSTEM_B) { if (codec_id == AV_CODEC_ID_AC3) { + int len = 1; + + if (ts_st->desc6a.component_type_flag) len++; + if (ts_st->desc6a.bsid_flag) len++; + if (ts_st->desc6a.mainid_flag) len++; + if (ts_st->desc6a.asvc_flag) len++; + *q++=0x6a; // AC3 descriptor see A038 DVB SI - *q++=1; // 1 byte, all flags sets to 0 - *q++=0; // omit all fields... + *q++ = len; + *q++ = ts_st->desc6a.component_type_flag << 7 | ts_st->desc6a.bsid_flag << 6 | + ts_st->desc6a.mainid_flag << 5 | ts_st->desc6a.asvc_flag << 4; + + if (ts_st->desc6a.component_type_flag) *q++ = ts_st->desc6a.component_type; + if (ts_st->desc6a.bsid_flag) *q++ = ts_st->desc6a.bsid; + if (ts_st->desc6a.mainid_flag) *q++ = ts_st->desc6a.mainid; + if (ts_st->desc6a.asvc_flag) *q++ = ts_st->desc6a.asvc; } else if (codec_id == AV_CODEC_ID_EAC3) { *q++=0x7a; // EAC3 descriptor see A038 DVB SI *q++=1; // 1 byte, all flags sets to 0 @@ -1075,6 +1091,7 @@ static int mpegts_init(AVFormatContext *s) ts_st->first_pts_check = 1; ts_st->cc = 15; ts_st->discontinuity = ts->flags & MPEGTS_FLAG_DISCONT; + memset(&ts_st->desc6a, 0, sizeof(ts_st->desc6a)); if (st->codecpar->codec_id == AV_CODEC_ID_AAC && st->codecpar->extradata_size > 0) { AVStream *ast; @@ -1843,6 +1860,13 @@ static int mpegts_write_packet_internal(AVFormatContext *s, AVPacket *pkt) * need to count the samples of that too! */ av_log(s, AV_LOG_WARNING, "Got MPEG-TS formatted Opus data, unhandled"); } + } else if (st->codecpar->codec_id == AV_CODEC_ID_AC3) { + AVDescriptor6A *side_data; + int sd_size; + side_data = (AVDescriptor6A *) av_packet_get_side_data(pkt, + AV_PKT_DATA_MPEGTS_DESC_6A, &sd_size); + if (side_data && sd_size == sizeof(*side_data)) + memcpy(&ts_st->desc6a, side_data, sizeof(*side_data)); } if (ts_st->payload_size && (ts_st->payload_size + size > ts->pes_payload_size ||