On 02/12/17 23:14, Aman Gupta wrote:
> From: Aman Gupta <a...@tmm1.net>
> 
> ---
>  libavcodec/mediacodecdec_common.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/libavcodec/mediacodecdec_common.c 
> b/libavcodec/mediacodecdec_common.c
> index cb2f6ae5e5..e524ffe0e4 100644
> --- a/libavcodec/mediacodecdec_common.c
> +++ b/libavcodec/mediacodecdec_common.c
> @@ -24,6 +24,7 @@
>  #include <sys/types.h>
>  
>  #include "libavutil/common.h"
> +#include "libavutil/hwcontext_mediacodec.h"
>  #include "libavutil/mem.h"
>  #include "libavutil/log.h"
>  #include "libavutil/pixfmt.h"
> @@ -475,8 +476,12 @@ int ff_mediacodec_dec_init(AVCodecContext *avctx, 
> MediaCodecDecContext *s,
>      pix_fmt = ff_get_format(avctx, pix_fmts);
>      if (pix_fmt == AV_PIX_FMT_MEDIACODEC) {
>          AVMediaCodecContext *user_ctx = avctx->hwaccel_context;
> +        AVMediaCodecDeviceContext *device_ctx = avctx->hw_device_ctx;

Er, no.  AVCodecContext.hw_device_ctx is an AVBufferRef containing an 
AVHWDeviceContext - you need to dereference through it to get the 
AVMediaCodecDeviceContext.

>  
> -        if (user_ctx && user_ctx->surface) {
> +        if (device_ctx && device_ctx->surface) {
> +            s->surface = ff_mediacodec_surface_ref(device_ctx->surface, 
> avctx);
> +            av_log(avctx, AV_LOG_INFO, "Using surface %p\n", s->surface);
> +        } else if (user_ctx && user_ctx->surface) {
>              s->surface = ff_mediacodec_surface_ref(user_ctx->surface, avctx);
>              av_log(avctx, AV_LOG_INFO, "Using surface %p\n", s->surface);
>          }
> 

You want to add the hw-config metadata as well, I think.

- Mark
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to