From patchwork Wed Aug 2 08:40:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Timmerman X-Patchwork-Id: 4600 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.46.211 with SMTP id u202csp954121vsu; Wed, 2 Aug 2017 01:47:57 -0700 (PDT) X-Received: by 10.28.232.24 with SMTP id f24mr3249630wmh.4.1501663677795; Wed, 02 Aug 2017 01:47:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1501663677; cv=none; d=google.com; s=arc-20160816; b=AJagHyRizO39OIKNQ6mKCBkHoaGDyQ+jNcclF0qfVtaSbKWNh091FigHAN7StZ+GQ1 nsYrZkUfeaAAnpWcWNp1XMgvEtu+FNHh3JBhIiKb0i2PH2R07Jcc/1/i9S4HWV438yFX RwLPNtz8++f2Dmd3Hochsu7jsewQpfGhW3rfJAm7TfBKc9ZlQa4kwVsSEcT9oj7mY7ET x29ELc3hQ+Bdv2d08KUF7Yc4jP2UyKyEeeu2f5QR8U7MAL8Ech3W/v4KRG6F1m38MQhk Hw29l0J3ttsf/ozK+YF18bYjicfOZ6Lh5gvhRPHBLf7CctihWPxb4cvTFqnOKc95CtXL HI7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding: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=tZqg2V206/ehPFkN3WfTlFD6fgYrn8FgMsuYjCZUGwc=; b=E3Vc3cRKjBS3FfjjnChaKaL9eZH8Q3sM2Kb0QCjgTDpWov81474YTknfNdofZACzsa uX1Y9nXrR1V4Z9AlsOn5Fh+vIc0IZQThpuploc+EKE9R9kCF3XajcwIlVOJzxunkXZ1n 8PeBvFhnHBbwHCNo3uiw/kw7vpwFi84S7lXH84UnY+OV9d3UNIxUk+oj9Vs4IfYzfsAy QIcsSvV+cgLSRMDBqqOJI1wfFTgcLQBmUI7mYgktA6jt3sYeWr5n6WSIc1PbPJwJAFzd S4OEsc/Roowzt2/OkPy92g9vbV2mnAlJ9moNjX5PgR8Avbjhq7qmlqJ/nesVnY9K4KHJ JhOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.b=asY/sC6X; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id q19si2966434wme.274.2017.08.02.01.47.56; Wed, 02 Aug 2017 01:47:57 -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=@gmail.com header.b=asY/sC6X; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 0999068A45B; Wed, 2 Aug 2017 11:47:51 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-vk0-f42.google.com (mail-vk0-f42.google.com [209.85.213.42]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 5552968A334 for ; Wed, 2 Aug 2017 11:47:44 +0300 (EEST) Received: by mail-vk0-f42.google.com with SMTP id n125so15419350vke.1 for ; Wed, 02 Aug 2017 01:47:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=ou1cYaHQFhfZyV95f2U0xmncNhnieVHnBsPO6Q4BEvQ=; b=asY/sC6Xb2vjRK+kRDTUUHT11lxGmeg3Ssa3vRfl4LxhrvJwtncgN1A+sfOu+ek8RC 4jzqIHnqWMzzhxyGwavDlMeWUEUTKzlsQEy5igpCf8sClR3JOb4a9CJ/TmHIWq/h99vT Awl7xyZftytokQW6pm3K2YCf/WRJi9W5DOH4IN24sKDxB5VdmyxTKLwS0ZuM1mkLFomT CKQL5xRt0Vhanp7mwVLV5zhavm6/k9vSSauoWyVPCAq+vVjFV6RRgwxqqzx174I9IP0H E8JHaosD7uIIUSyOngRXY69Tg8EcGU47t6eUILM7AW7NNqe/4Av61Tjg5q1R3baH+XYm WSlA== 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=ou1cYaHQFhfZyV95f2U0xmncNhnieVHnBsPO6Q4BEvQ=; b=bytbErjmME3UFNTVASGWnQIWbkHy6Cw2WJ2ITJK2ScYe+bgE1BmQR4GyzxRKerHxlR QLeXZejnDCBtHqC2cuke/Ryiy/Zx07FHG1R0B1JzLGZnes8H8tcy8cUZk58GRM5PuWo1 01TlwEQxJkAfE6Dt64NWR5Pbt2HMI9rDBri+JPKVzpY2My1CN9XL8agOi0f9slLZnMh8 slYpeKpzW2SxJnjaEm2LCW17duFVezF+i5rJFpHl7VNU4CuWLJ+u5a7PyE5sxc8uqJJL 0JBIJdR2O6GiqwHXXwehXsobLf2UPQS4hwAze1JYCby28jK0Y4yO1OB1+qxw7K5NEp+w loiQ== X-Gm-Message-State: AIVw110CWgyhi8k9voTdq/lGwVR1IhVfDeSKlW+k+z4M54lO6DnOyaQ7 KKIQUrIJUXfXdfGbWXoDu8EZ0xaqLRNY6Oc= X-Received: by 10.31.54.12 with SMTP id d12mr13847128vka.209.1501663248778; Wed, 02 Aug 2017 01:40:48 -0700 (PDT) MIME-Version: 1.0 Received: by 10.176.28.83 with HTTP; Wed, 2 Aug 2017 01:40:48 -0700 (PDT) From: Mark Timmerman Date: Wed, 2 Aug 2017 10:40:48 +0200 Message-ID: To: ffmpeg-devel@ffmpeg.org Subject: [FFmpeg-devel] [PATCH] mpegtsenc add synchronous metadata - retry 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" Add synchronous metadata to mpegtsenc * Added AV_CODEC_ID_SYNCHRONOUS_METADATA * PMT will have metadata_descriptor and metadata_std_descriptor in accordance with MISB ST 1402.2 * stream_type will be 0x15 metadata carried in PES packets * stream_id will be 0xfc metadata stream Users must supply Metadata Access Unit to the packet before writing. --- libavcodec/avcodec.h | 1 + libavformat/mpegtsenc.c | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) default: @@ -641,6 +642,27 @@ static int mpegts_write_pmt(AVFormatContext *s, MpegTSService *service) *q++ = 'L'; *q++ = 'V'; *q++ = 'A'; + } else if (st->codecpar->codec_id == AV_CODEC_ID_SYNCHRONOUS_METADATA) { + const char *tag = "KLVA"; + *q++ = 0x26; /* desctiptor_tag = metadata_descriptor */ + *q++ = 9; /* desctiptor_length */ + put16(&q, 0x0100); /* metadata application format */ + *q++ = 0xff; /* metadata format */ + putstr8(&q, tag, 0); + *q++ = 0; /* metadata service ID */ + *q++ = 0xF; /* decoder_config_flags|DSM-CC flag|reserved */ + + *q++ = 0x27; /* desctiptor_tag = metadata_std_descriptor */ + *q++ = 9; /* desctiptor_length */ + *q++ = 0xc0; + *q++ = 0x00; + *q++ = 0x00; + *q++ = 0xc0; + *q++ = 0x00; + *q++ = 0x00; + *q++ = 0xc0; + *q++ = 0x00; + *q++ = 0x00; } else if (st->codecpar->codec_id == AV_CODEC_ID_TIMED_ID3) { const char *tag = "ID3 "; *q++ = 0x26; /* metadata descriptor */ diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index c594993..fe4e538 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -682,6 +682,7 @@ enum AVCodecID { AV_CODEC_ID_DVD_NAV, AV_CODEC_ID_TIMED_ID3, AV_CODEC_ID_BIN_DATA, + AV_CODEC_ID_SYNCHRONOUS_METADATA, AV_CODEC_ID_PROBE = 0x19000, ///< codec_id is not known (like AV_CODEC_ID_NONE) but lavf should attempt to identify it diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c index fdfa544..35907da 100644 --- a/libavformat/mpegtsenc.c +++ b/libavformat/mpegtsenc.c @@ -387,6 +387,7 @@ static int mpegts_write_pmt(AVFormatContext *s, MpegTSService *service) stream_type = STREAM_TYPE_PRIVATE_DATA; break; case AV_CODEC_ID_TIMED_ID3: + case AV_CODEC_ID_SYNCHRONOUS_METADATA: stream_type = STREAM_TYPE_METADATA; break;