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 */