On Tue, Sep 26, 2017 at 2:36 AM, Aman Gupta <ffm...@tmm1.net> wrote: > From: Aman Gupta <a...@tmm1.net> > > This callback will be used by the VideoToolbox H264 hwaccel so that it > can receive SPS and PPS NALUs. VideoToolbox requires PPS changes to be > fed into the decoder session, and for the session to be recreated when > the SPS changes. > --- > libavcodec/avcodec.h | 12 ++++++++++++ > libavcodec/h264dec.c | 14 ++++++++++++++ > 2 files changed, 26 insertions(+) > > diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h > index 5c84974e03..14bb509f66 100644 > --- a/libavcodec/avcodec.h > +++ b/libavcodec/avcodec.h > @@ -3921,6 +3921,18 @@ typedef struct AVHWAccel { > int (*start_frame)(AVCodecContext *avctx, const uint8_t *buf, uint32_t > buf_size); > > /** > + * Callback for parameter data. > + * > + * Used for SPS/PPS in H264 streams. > + * > + * @param avctx the codec context > + * @param buf the slice data buffer base > + * @param buf_size the size of the slice in bytes > + * @return zero if successful, a negative value otherwise > + */ > + int (*decode_params)(AVCodecContext *avctx, const uint8_t *buf, uint32_t > buf_size); > + > + /** > * Callback for each slice. > * > * Meaningful slice information (codec specific) is guaranteed to > diff --git a/libavcodec/h264dec.c b/libavcodec/h264dec.c > index a8263f2e19..ab95beb020 100644 > --- a/libavcodec/h264dec.c > +++ b/libavcodec/h264dec.c > @@ -738,6 +738,13 @@ FF_ENABLE_DEPRECATION_WARNINGS > break; > case H264_NAL_SPS: { > GetBitContext tmp_gb = nal->gb; > + if (avctx->hwaccel && avctx->hwaccel->decode_params) { > + ret = avctx->hwaccel->decode_params(avctx, > + nal->data, > + nal->size);
You probably want nal->raw_data and raw_size here (and below), hardware typically works on raw (escaped) data. _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel