+ return AVERROR_INVALIDDATA;
+ }
+
+ return 0;
+}
+
+int ff_hevc_decode_nal_sps(HEVCContext *s)
+{
+ HEVCSPS *sps;
+ AVBufferRef *sps_buf = av_buffer_allocz(sizeof(*sps));
+ unsigned int sps_id;
+ int ret;
+
+ if (!sps_buf)
+ return AVERROR(ENOMEM);
+ sps = (HEVCSPS*)sps_buf->data;
+
+ av_log(s->avctx, AV_LOG_DEBUG, "Decoding SPS\n");
+
+ ret = ff_hevc_parse_sps(sps, &s->HEVClc->gb, &sps_id,
+ s->apply_defdispwin,
+ s->vps_list, s->avctx);
+ if (ret < 0) {
+ av_buffer_unref(&sps_buf);
+ return ret;