diff mbox

[FFmpeg-devel] lavf/mpeg: Allow demuxing hevc

Message ID CAB0OVGoUPuuWdcSx2z-y_-9DEvZkaLE-YA-Vyer3aeO4V98EUw@mail.gmail.com
State Accepted
Headers show

Commit Message

Carl Eugen Hoyos Sept. 26, 2018, 8:46 p.m. UTC
Hi!

A HandBrake user provided a program stream with hevc, attached
patch allows demuxing without auto-detection.

Please comment, Carl Eugen

Comments

Jan Ekström Sept. 26, 2018, 9:18 p.m. UTC | #1
On Wed, Sep 26, 2018 at 11:46 PM, Carl Eugen Hoyos <ceffmpeg@gmail.com> wrote:
> Hi!
>
> A HandBrake user provided a program stream with hevc, attached
> patch allows demuxing without auto-detection.
>
> Please comment, Carl Eugen
>

Verified that the identifier matches ITU-T H.222 2014/10 (and what's
in mpegts.{c,h}).

> An HEVC video stream or HEVC temporal video sub-bitstream shall be an element of an ITU-T H.222.0 |
> ISO/IEC 13818-1 program and the stream_type for this elementary stream shall be equal to 0x24.

Not sure if another part of the specification notes that this should
only be utilized in MPEG-TS, but since we also have the AVC/H.264
identifier in MPEG-PS I would guess it's OK?

In general it seems like at least a few of these identifiers are
shared between both MPEG-2 Systems formats, so we might want to merge
the matching ones into a single shared list.

Best regards,
Jan
Carl Eugen Hoyos Sept. 27, 2018, 9:54 p.m. UTC | #2
2018-09-26 23:18 GMT+02:00, Jan Ekström <jeebjp@gmail.com>:
> On Wed, Sep 26, 2018 at 11:46 PM, Carl Eugen Hoyos <ceffmpeg@gmail.com>
> wrote:
>> Hi!
>>
>> A HandBrake user provided a program stream with hevc, attached
>> patch allows demuxing without auto-detection.
>>
>> Please comment, Carl Eugen
>>
>
> Verified that the identifier matches ITU-T H.222 2014/10 (and what's
> in mpegts.{c,h}).
>
>> An HEVC video stream or HEVC temporal video sub-bitstream shall be an
>> element of an ITU-T H.222.0 |
>> ISO/IEC 13818-1 program and the stream_type for this elementary stream
>> shall be equal to 0x24.

Thank you for the quote!

Patch applied, Carl Eugen
diff mbox

Patch

From c0d3208edbf2243fd7c554e1ac0fa0afe0591778 Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos <ceffmpeg@gmail.com>
Date: Wed, 26 Sep 2018 22:39:18 +0200
Subject: [PATCH] lavf/mpeg: Support demuxing HEVC in mpeg-ps.

---
 libavformat/mpeg.c |    3 +++
 libavformat/mpeg.h |    1 +
 2 files changed, 4 insertions(+)

diff --git a/libavformat/mpeg.c b/libavformat/mpeg.c
index 159ea41..d4369b4 100644
--- a/libavformat/mpeg.c
+++ b/libavformat/mpeg.c
@@ -544,6 +544,9 @@  redo:
         } else if (es_type == STREAM_TYPE_VIDEO_H264) {
             codec_id = AV_CODEC_ID_H264;
             type     = AVMEDIA_TYPE_VIDEO;
+        } else if (es_type == STREAM_TYPE_VIDEO_HEVC) {
+            codec_id = AV_CODEC_ID_HEVC;
+            type     = AVMEDIA_TYPE_VIDEO;
         } else if (es_type == STREAM_TYPE_AUDIO_AC3) {
             codec_id = AV_CODEC_ID_AC3;
             type     = AVMEDIA_TYPE_AUDIO;
diff --git a/libavformat/mpeg.h b/libavformat/mpeg.h
index 617e36c..b635295 100644
--- a/libavformat/mpeg.h
+++ b/libavformat/mpeg.h
@@ -55,6 +55,7 @@ 
 #define STREAM_TYPE_AUDIO_AAC       0x0f
 #define STREAM_TYPE_VIDEO_MPEG4     0x10
 #define STREAM_TYPE_VIDEO_H264      0x1b
+#define STREAM_TYPE_VIDEO_HEVC      0x24
 #define STREAM_TYPE_VIDEO_CAVS      0x42
 
 #define STREAM_TYPE_AUDIO_AC3       0x81
-- 
1.7.10.4