On Mon, 11 Dec 2017 22:10:24 +0000
Mark Thompson <s...@jkqxz.net> wrote:

> On 11/12/17 12:34, Matthieu Bouron wrote:
> >>
> >> New patch attached fixing errors in get_format() by keeping the original
> >> AVCodecHWConfigInternal (ad-hoc) and adding a new one (hw-device) with the
> >> device_type field set to the MediaCodec.
> >>
> >> The updated patchset works without errors with both the old hwaccel method 
> >> and
> >> the new device_ctx method.  
> > 
> > From 2bbdae2141ba8ca8db54175f4440ac8190f5953d Mon Sep 17 00:00:00 2001
> > From: Aman Gupta <a...@tmm1.net>
> > Date: Sun, 3 Dec 2017 17:32:22 -0800
> > Subject: [PATCH 2/2] libavcodec/mediacodec: use AVMediaCodecDeviceContext
> >  hw_device_ctx if set
> > 
> > Signed-off-by: Matthieu Bouron <matthieu.bou...@gmail.com>
> > ---
> >  libavcodec/mediacodecdec.c        |  8 ++++++++
> >  libavcodec/mediacodecdec_common.c | 14 +++++++++++++-
> >  2 files changed, 21 insertions(+), 1 deletion(-)
> > 
> > diff --git a/libavcodec/mediacodecdec.c b/libavcodec/mediacodecdec.c
> > index 86cc629430..c8ad0b80e7 100644
> > --- a/libavcodec/mediacodecdec.c
> > +++ b/libavcodec/mediacodecdec.c
> > @@ -543,6 +543,14 @@ static const AVCodecHWConfigInternal 
> > *mediacodec_hw_configs[] = {
> >          },
> >          .hwaccel         = NULL,
> >      },
> > +    &(const AVCodecHWConfigInternal) {
> > +        .public          = {
> > +            .pix_fmt     = AV_PIX_FMT_MEDIACODEC,
> > +            .methods     = AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX,  
> 
> This wants to be combined with the previous entry (or together the methods): 
> ff_get_format() looks for the first entry matching the pix_fmt, so it will 
> never find this one.  I think this might work anyway because AD_HOC is 
> technically "do whatever you like, I can't check it", but it also wouldn't 
> notice e.g. a non-matching device in that case.

Hm, I guess I agree. From an API user perspective, each AVCodecHWConfig
entry should cover the underlying mechanism fully. So if like in this
case, the underlying code/method is the same (mediacodec stuff), then
all methods for using it share the same AVCodecHWConfig entry.

The only cases where AVCodecs have multiple config entries are
hwaccels, where each hwaccel is backed by a completely different method.

Don't know how this works if a full stream decoder supports multiple
device types, though.
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to