[FFmpeg-devel] [PATCH 10/12] avcodec: add MediaCodec encoder

Tomas Härdin git at haerdin.se
Thu Oct 27 12:56:01 EEST 2022


tor 2022-10-27 klockan 10:49 +0800 skrev zhilizhao(赵志立):
> 
> 
> > On Oct 27, 2022, at 05:17, Tomas Härdin <git at haerdin.se> wrote:
> > 
> > mån 2022-10-24 klockan 11:16 +0800 skrev Zhao Zhili:
> > > 
> > > +typedef struct MediaCodecEncContext {
> > > +    AVClass *avclass;
> > > +    FFAMediaCodec *codec;
> > > +    int use_ndk_codec;
> > > +    FFANativeWindow *window;
> > > +
> > > +    int fps;
> > > +    int width;
> > > +    int height;
> > > +
> > > +    uint8_t *extradata;
> > > +    int extradata_size;
> > 
> > Why not extradata in AVCodecContext?
> 
> The extradata (BUFFER_FLAG_CODEC_CONFIG) is popped after codec
> init, I’m not sure if it’s OK to touch AVCodecContext->extradata
> after code init.

You mean that it isn't populated until after a frame has been encoded?
There's no way to specify resolution, pixel format etc to get the
extradata without encoding?

> Secondly, it isn’t specified in Android doc, but better be safe
> to handle the case of BUFFER_FLAG_CODEC_CONFIG show up multiple
> times.

Surely there's a way to signal this? I suppose one can always add a bsf
after the encoder. I'm actually not sure.
> 

> > Some tests would be nice
> 
> Did you mean fate test or manual test?
> 
> It’s an external codec wrapper, so maybe not in fate.

It would be nice if FATE could test this on machines where the hardware
is available. We had a brief discussion on IRC about this yesterday.
Just checking which encoders actually work, what profiles are supported
and so on. Maybe tabulate it somewhere. Sometimes manufacturers specify
what codecs and profiles are supported, sometimes not.

/Tomas



More information about the ffmpeg-devel mailing list