summaryrefslogtreecommitdiff
path: root/libavcodec/vt_internal.h
diff options
context:
space:
mode:
authorAman Gupta <aman@tmm1.net>2017-11-10 12:25:39 -0800
committerAman Gupta <aman@tmm1.net>2017-11-13 14:32:48 -0800
commit9519983c0f39d01fd86544dc56adbbf15bdd3c3c (patch)
tree626c230412f199e7ebdbd2f2df90048cd5f925bc /libavcodec/vt_internal.h
parent872add08540fb36b2d2ca75df86da7d8ac9579a1 (diff)
avcodec/videotoolbox: use decode_params to propagate H264 PPS changes and restart on SPS changes
This fixes decoding of H264 video samples with SPS and PPS changes. See for example https://s3.amazonaws.com/tmm1/videotoolbox/spschange.ts, which previously stalled the decoder and failed to produce any new frames after the SPS change. Also see https://s3.amazonaws.com/tmm1/videotoolbox/ppschange.ts, which uses multiple PPS and would previously cause VT decode failures. If the VideoToolbox session needs to be restarted, and videotoolbox_start() fails for some reason (for instance, if the video is interlaced and the decoder is running on iOS), avcodec will return AVERROR_EXTERNAL. This can be used by the API user to switch to another decoder. Signed-off-by: Aman Gupta <aman@tmm1.net>
Diffstat (limited to 'libavcodec/vt_internal.h')
-rw-r--r--libavcodec/vt_internal.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/libavcodec/vt_internal.h b/libavcodec/vt_internal.h
index 607dd7a6d0..fc27dad9f9 100644
--- a/libavcodec/vt_internal.h
+++ b/libavcodec/vt_internal.h
@@ -38,6 +38,12 @@ typedef struct VTContext {
// Non-NULL if the new hwaccel API is used. This is only a separate struct
// to ease compatibility with the old API.
struct AVVideotoolboxContext *vt_ctx;
+
+ // Current H264 parameters (used to trigger decoder restart on SPS changes).
+ uint8_t *sps;
+ uint32_t sps_len;
+ unsigned int sps_capa;
+ bool reconfig_needed;
} VTContext;
int ff_videotoolbox_alloc_frame(AVCodecContext *avctx, AVFrame *frame);