Re: [libav-devel] [libav-commits] lavc: external hardware frame pool initialization

2017-10-23 Thread Diego Biurrun
On Mon, Oct 23, 2017 at 11:55:10AM +0200, wm4 wrote:
> On Sun, 22 Oct 2017 02:15:07 +0200
> Diego Biurrun  wrote:
> > On Thu, Oct 19, 2017 at 05:25:17PM +0200, wm4  wrote:
> > > lavc: external hardware frame pool initialization
> > > 
> > > --- a/libavcodec/decode.c
> > > +++ b/libavcodec/decode.c
> > > @@ -669,6 +669,88 @@ static AVHWAccel *find_hwaccel(enum AVCodecID 
> > > codec_id,
> > > +int ff_decode_get_hw_frames_ctx(AVCodecContext *avctx,
> > > +enum AVHWDeviceType dev_type)
> > > +{
> > > +ret = avcodec_get_hw_frames_parameters(avctx,
> > > +   avctx->hw_device_ctx,
> > > +   avctx->hwaccel->pix_fmt,
> > > +   avctx->hw_frames_ctx);  
> > 
> > This generates a very suspicious warning:
> > 
> > libavcodec/decode.c: In function ‘ff_decode_get_hw_frames_ctx’:
> > libavcodec/decode.c:701:44: warning: passing argument 4 of 
> > avcodec_get_hw_frames_parameters’ from incompatible pointer type 
> > [-Wincompatible-pointer-types]
> > avctx->hw_frames_ctx);
> > ^
> > In file included from libavcodec/decode.c:34:0:
> > libavcodec/avcodec.h:4094:5: note: expected ‘AVBufferRef ** {aka struct 
> > AVBufferRef **}’ but argument is of type ‘AVBufferRef * {aka struct 
> > AVBufferRef *}’
> >  int avcodec_get_hw_frames_parameters(AVCodecContext *avctx,
> >  ^~~~
> 
> Probably forgot to update and test this part. Possibly crashes in
> hw_device_ctx mode.

I'm tempted to think that part of the reason you overlooked this warning
is the fact that that file produces deprecation warning spam. Please
review my patch to address those deprecation warnings.

Diego
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Re: [libav-devel] [libav-commits] lavc: external hardware frame pool initialization

2017-10-23 Thread wm4
On Sun, 22 Oct 2017 02:15:07 +0200
Diego Biurrun  wrote:

> On Thu, Oct 19, 2017 at 05:25:17PM +0200, wm4  wrote:
> > Module: libav
> > Author:wm4 
> > Committer: Anton Khirnov 
> > Date:  Thu Oct 19 16:38:20 2017 +0200
> > 
> > lavc: external hardware frame pool initialization
> > 
> > This adds a new API, which allows the API user to query the required
> > AVHWFramesContext parameters. This also reduces code duplication across
> > the hwaccels by introducing ff_decode_get_hw_frames_ctx(), which uses
> > the new API function. It takes care of initializing the hw_frames_ctx
> > if needed, and does additional error handling and API usage checking.
> > 
> > ---
> > 
> > --- a/libavcodec/avcodec.h
> > +++ b/libavcodec/avcodec.h
> > @@ -3984,6 +3994,109 @@ int avcodec_send_frame(AVCodecContext *avctx, const 
> > AVFrame *frame);
> > +int avcodec_get_hw_frames_parameters(AVCodecContext *avctx,
> > + AVBufferRef *device_ref,
> > + enum AVPixelFormat hw_pix_fmt,
> > + AVBufferRef **out_frames_ref);
> > +
> > +
> > --- a/libavcodec/decode.c
> > +++ b/libavcodec/decode.c
> > @@ -669,6 +669,88 @@ static AVHWAccel *find_hwaccel(enum AVCodecID codec_id,
> > +int ff_decode_get_hw_frames_ctx(AVCodecContext *avctx,
> > +enum AVHWDeviceType dev_type)
> > +{
> > +ret = avcodec_get_hw_frames_parameters(avctx,
> > +   avctx->hw_device_ctx,
> > +   avctx->hwaccel->pix_fmt,
> > +   avctx->hw_frames_ctx);  
> 
> This generates a very suspicious warning:
> 
> libavcodec/decode.c: In function ‘ff_decode_get_hw_frames_ctx’:
> libavcodec/decode.c:701:44: warning: passing argument 4 of 
> avcodec_get_hw_frames_parameters’ from incompatible pointer type 
> [-Wincompatible-pointer-types]
> avctx->hw_frames_ctx);
> ^
> In file included from libavcodec/decode.c:34:0:
> libavcodec/avcodec.h:4094:5: note: expected ‘AVBufferRef ** {aka struct 
> AVBufferRef **}’ but argument is of type ‘AVBufferRef * {aka struct 
> AVBufferRef *}’
>  int avcodec_get_hw_frames_parameters(AVCodecContext *avctx,
>  ^~~~

Probably forgot to update and test this part. Possibly crashes in
hw_device_ctx mode.
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Re: [libav-devel] [libav-commits] lavc: external hardware frame pool initialization

2017-10-21 Thread Diego Biurrun
On Thu, Oct 19, 2017 at 05:25:17PM +0200, wm4  wrote:
> Module: libav
> Author:wm4 
> Committer: Anton Khirnov 
> Date:  Thu Oct 19 16:38:20 2017 +0200
> 
> lavc: external hardware frame pool initialization
> 
> This adds a new API, which allows the API user to query the required
> AVHWFramesContext parameters. This also reduces code duplication across
> the hwaccels by introducing ff_decode_get_hw_frames_ctx(), which uses
> the new API function. It takes care of initializing the hw_frames_ctx
> if needed, and does additional error handling and API usage checking.
> 
> ---
> 
> --- a/libavcodec/avcodec.h
> +++ b/libavcodec/avcodec.h
> @@ -3984,6 +3994,109 @@ int avcodec_send_frame(AVCodecContext *avctx, const 
> AVFrame *frame);
> +int avcodec_get_hw_frames_parameters(AVCodecContext *avctx,
> + AVBufferRef *device_ref,
> + enum AVPixelFormat hw_pix_fmt,
> + AVBufferRef **out_frames_ref);
> +
> +
> --- a/libavcodec/decode.c
> +++ b/libavcodec/decode.c
> @@ -669,6 +669,88 @@ static AVHWAccel *find_hwaccel(enum AVCodecID codec_id,
> +int ff_decode_get_hw_frames_ctx(AVCodecContext *avctx,
> +enum AVHWDeviceType dev_type)
> +{
> +ret = avcodec_get_hw_frames_parameters(avctx,
> +   avctx->hw_device_ctx,
> +   avctx->hwaccel->pix_fmt,
> +   avctx->hw_frames_ctx);

This generates a very suspicious warning:

libavcodec/decode.c: In function ‘ff_decode_get_hw_frames_ctx’:
libavcodec/decode.c:701:44: warning: passing argument 4 of 
avcodec_get_hw_frames_parameters’ from incompatible pointer type 
[-Wincompatible-pointer-types]
avctx->hw_frames_ctx);
^
In file included from libavcodec/decode.c:34:0:
libavcodec/avcodec.h:4094:5: note: expected ‘AVBufferRef ** {aka struct 
AVBufferRef **}’ but argument is of type ‘AVBufferRef * {aka struct AVBufferRef 
*}’
 int avcodec_get_hw_frames_parameters(AVCodecContext *avctx,
 ^~~~

Diego
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel