[FFmpeg-devel] [PATCH 10/12] avcodec: add MediaCodec encoder
"zhilizhao(赵志立)"
quinkblack at foxmail.com
Thu Oct 27 15:41:59 EEST 2022
> On Oct 27, 2022, at 17:56, Tomas Härdin <git at haerdin.se> wrote:
>
> 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?
That’s the case from my test on Google Pixel 3. There is no ‘csd’ inside
MediaFormat returned by ff_AMediaCodec_getOutputFormat(), until a frame
has been sent. It may depends on the device and OS.
>
>> 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.
We can use AV_PKT_DATA_NEW_EXTRADATA to signal that along with
AVCodecContext->extradata. We still need to save extradata to a place
other than AVCodecContext->extradata temporarily.
>>
>
>>> 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.
I’m planing to add more options for codec configure and select codec by
name. Run FATE on Android is doable.
>
> /Tomas
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".
More information about the ffmpeg-devel
mailing list