[FFmpeg-devel,v4,06/14] avcodec: add decode_params callback to AVHWAccel struct

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

Details

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

Commit Message

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

---
 libavcodec/avcodec.h | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

Comments

Michael Niedermayer Nov. 12, 2017, 3:43 p.m.
On Sat, Nov 11, 2017 at 06:44:34PM +0000, Aman Gupta wrote:
> On Sat, Nov 11, 2017 at 3:54 AM Michael Niedermayer <michael@niedermayer.cc>
> wrote:
> 
> > On Fri, Nov 10, 2017 at 01:40:51PM -0800, Aman Gupta wrote:
> > > From: Aman Gupta <aman@tmm1.net>
> > >
> > > ---
> > >  libavcodec/avcodec.h | 14 ++++++++++++++
> > >  1 file changed, 14 insertions(+)
> > >
> > > diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
> > > index c4134424f0..2bd46faa50 100644
> > > --- a/libavcodec/avcodec.h
> > > +++ b/libavcodec/avcodec.h
> > > @@ -3459,6 +3459,20 @@ typedef struct AVHWAccel {
> > >       */
> > >      int (*start_frame)(AVCodecContext *avctx, const uint8_t *buf,
> > uint32_t buf_size);
> > >
> > > +    /**
> > > +     * Callback for parameter data (SPS/PPS/VPS etc).
> > > +     *
> > > +     * Useful for hardware decoders which keep persistent state about
> > the
> > > +     * video parameters, and need to receive any changes to update that
> > state.
> > > +     *
> > > +     * @param avctx the codec context
> >
> > > +     * @param type the parameter type
> >
> > thats a bit terse
> > one couldnt use this with just this information.
> > is this the nal unit type ? if so then saying this would be clearer
> 
> 
> Will label as nal unit type, thanks.
> 
> 
> >
> >
> > > +     * @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, int type, const uint8_t
> > *buf, uint32_t buf_size);
> >
> > uint32_t possibly should be something else, either unsigned or size_t
> 
> 
> I copied decode_slice, which also uses uint32_t
> 
> Should I change this one or leave it consistent?

i dont think changing some but leaving others makes much sense
either all could be left 32bit or all changed in a seperate patch

[...]

Patch hide | download patch | download mbox

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index c4134424f0..2bd46faa50 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -3459,6 +3459,20 @@  typedef struct AVHWAccel {
      */
     int (*start_frame)(AVCodecContext *avctx, const uint8_t *buf, uint32_t buf_size);
 
+    /**
+     * Callback for parameter data (SPS/PPS/VPS etc).
+     *
+     * Useful for hardware decoders which keep persistent state about the
+     * video parameters, and need to receive any changes to update that state.
+     *
+     * @param avctx the codec context
+     * @param type the parameter type
+     * @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, int type, const uint8_t *buf, uint32_t buf_size);
+
     /**
      * Callback for each slice.
      *