[FFmpeg-devel,v4,12/14] avcodec/videotoolbox: pass through hevc param changes to the decoder

Submitted by Aman Gupta on Nov. 10, 2017, 9:40 p.m.

Details

Message ID 20171110214059.84891-12-ffmpeg@tmm1.net
State New
Headers show

Commit Message

Aman Gupta Nov. 10, 2017, 9:40 p.m.
From: Aman Gupta <aman@tmm1.net>

This includes the SEI_PREFIX/SEI_SUFFIX NALUs, which can contain
updates like HEVC_SEI_TYPE_ACTIVE_PARAMETER_SETS. Previously, hevc
samples with this SEI present would not playback correctly.

See for example https://github.com/lhc70000/iina/issues/1123
---
 libavcodec/videotoolbox.c | 9 +++++++++
 1 file changed, 9 insertions(+)

Patch hide | download patch | download mbox

diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c
index fc33dce608..9eb06e619f 100644
--- a/libavcodec/videotoolbox.c
+++ b/libavcodec/videotoolbox.c
@@ -654,6 +654,14 @@  static int videotoolbox_h264_end_frame(AVCodecContext *avctx)
     return ret;
 }
 
+static int videotoolbox_hevc_decode_params(AVCodecContext *avctx,
+                                           int type,
+                                           const uint8_t *buffer,
+                                           uint32_t size)
+{
+    return ff_videotoolbox_h264_decode_slice(avctx, buffer, size);
+}
+
 static int videotoolbox_hevc_end_frame(AVCodecContext *avctx)
 {
     HEVCContext *h = avctx->priv_data;
@@ -1026,6 +1034,7 @@  AVHWAccel ff_hevc_videotoolbox_hwaccel = {
     .alloc_frame    = ff_videotoolbox_alloc_frame,
     .start_frame    = ff_videotoolbox_h264_start_frame,
     .decode_slice   = ff_videotoolbox_h264_decode_slice,
+    .decode_params  = videotoolbox_hevc_decode_params,
     .end_frame      = videotoolbox_hevc_end_frame,
     .init           = videotoolbox_common_init,
     .uninit         = ff_videotoolbox_uninit,