[FFmpeg-devel] [PATCH] avformat: add MMTP parser and MMT/TLV demuxer

Michael Niedermayer michael at niedermayer.cc
Fri Apr 28 23:44:21 EEST 2023


On Sat, Apr 29, 2023 at 02:31:28AM +0900, SuperFashi wrote:
> This patch adds an MPEG Media Transport Protocol (MMTP) parser, as defined in ISO/IEC 23008-1, and an MMT protocol over TLV packets (MMT/TLV) demuxer, as defined in ARIB STD-B32. Currently, it supports hevc, aac (loas), and arib-ttml demuxing.
> 
> Since MMTP is designed to transmit over IP, there is no size information within each MMTP packet, and there is no filesystem format defined alongside the protocol. One of the solution is a simple container format using type–length–value packets, which is defined in ARIB STD-B32.
> 
> Another known container format for MMTP is using packet capture (pcap) files which records network packets. This patch does not include the demuxer for this container format.
> 
> Signed-off-by: SuperFashi <admin at superfashi.com>


fails to build

libavformat/mmtp.c: In function ‘parse_video_component_descriptor’:
libavformat/mmtp.c:216:36: error: ‘VIDEO_COMPONENT_DESCRIPTOR_ID’ undeclared (first use in this function); did you mean ‘VIDEO_COMPONENT_DESCRIPTOR’?
         av_assert1(AV_RB16(buf) == VIDEO_COMPONENT_DESCRIPTOR_ID);
                                    ^
libavformat/mmtp.c:33:5: note: in definition of macro ‘LIMIT_READ’
     block; \
     ^~~~~
[...]


> +#include <stdbool.h>
> +

> +#define LIMIT_READ(consume, block) \
> +    if (size < (consume)) return AVERROR_INVALIDDATA; \
> +    block; \
> +    buf += (consume); \
> +    size -= (consume);

This makes the code hard to debug and read


> +
> +#define MUST_CONSUME(consume) \
> +    av_assert1((consume) <= size); \
> +    buf += (consume); \
> +    size -= (consume);

this could maybe use some bytestream reader
either way a function should be cleaner than a macro

thx

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

What does censorship reveal? It reveals fear. -- Julian Assange
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20230428/f5064a8a/attachment.sig>


More information about the ffmpeg-devel mailing list