Do we have coverage for this on FATE? I'll send a bunch of patches for
AMF shortly.

On Wed, Jan 03, 2018 at 12:55:53PM -0500, Mikhail Mironov wrote:
> --- a/configure
> +++ b/configure
> @@ -231,6 +231,7 @@ External library support:
>  
>    The following libraries provide various hardware acceleration features:
> +  --enable-amf     AMF video encoding code [auto]
>    --enable-cuda    Nvidia CUDA (dynamically linked)
>    --enable-cuvid   Nvidia CUVID video decode acceleration
>    --enable-d3d11va Microsoft Direct3D 11 video acceleration [auto]

That's a copy and paste error, amf is not autodetected, it needs to be
enabled explicitly.

> @@ -2238,6 +2240,7 @@ wmv3_vaapi_hwaccel_select="vc1_vaapi_hwaccel"
>  
>  # hardware-accelerated codecs
> +amf_deps_any="dlopen LoadLibrary"
>  nvenc_deps_any="libdl LoadLibrary"
>  omx_deps="libdl pthreads"
>  omx_rpi_select="omx"
> @@ -4573,6 +4578,11 @@ for func in $MATH_FUNCS; do
>  
>  # these are off by default, so fail if requested and not available
> +
> +enabled amf &&
> +    check_cpp_condition "AMF/core/Version.h" \
> +        "(AMF_VERSION_MAJOR << 48 | AMF_VERSION_MINOR << 32 | 
> AMF_VERSION_RELEASE << 16 | AMF_VERSION_BUILD_NUM) >= 0x0001000400040001" ||
> +    disable amf

See the comment just above the line you added. You need to fail (i.e. call
the die() function), not just disable AMF.

> --- /dev/null
> +++ b/libavcodec/amfenc.c
> @@ -0,0 +1,608 @@
> +static int amf_copy_buffer(AVCodecContext *avctx, AVPacket *pkt, AMFBuffer 
> *buffer)
> +{
> +    //if ((ret = ff_alloc_packet2(avctx, pkt, size, 0)) < 0) {
> +    if  (ret = ff_alloc_packet(pkt, size)) {

commented-out cruft

> --- /dev/null
> +++ b/libavcodec/amfenc.h
> @@ -0,0 +1,158 @@
> +
> +#ifndef AVCODEC_AMFENC_H
> +#define AVCODEC_AMFENC_H
> +
> +#include <AMF/core/Factory.h>
> +
> +#include <AMF/components/VideoEncoderVCE.h>
> +#include <AMF/components/VideoEncoderHEVC.h>
> +
> +#include "libavutil/fifo.h"
> +
> +#include "config.h"
> +#include "avcodec.h"

config.h is not used in this header; it's better to move it elsewhere.

> +/**
> +* AMF encoder context
> +*/
> +typedef struct AmfContext {
> +    AVClass            *avclass;
> +    // access to AMF runtime
> +    amf_handle          library; ///< handle to DLL library
> +    AMFFactory         *factory; ///< pointer to AMF factory
> +    AMFDebug           *debug;   ///< pointer to AMF debug interface
> +    AMFTrace           *trace;   ///< pointer to AMF trace interface
> +
> +    amf_uint64          version; ///< version of AMF runtime
> +    AmfTraceWriter      tracer;  ///< AMF writer registered with AMF
> +    AMFContext         *context; ///< AMF context
> +    //encoder
> +    AMFComponent       *encoder; ///< AMF encoder object
> +    amf_bool            eof;     ///< flag indicating EOF happened
> +    AMF_SURFACE_FORMAT  format;  ///< AMF surface format
> +
> +    AVBufferRef        *hw_device_ctx; ///< pointer to HW accelerator 
> (decoder)
> +    AVBufferRef        *hw_frames_ctx; ///< pointer to HW accelerator (frame 
> allocator)
> +} AmfContext;
> +
> +/**
> +* Common encoder initization function
> +*/
> +int ff_amf_encode_init(AVCodecContext *avctx);
> +/**
> +* Common encoder termination function
> +*/
> +int ff_amf_encode_close(AVCodecContext *avctx);
> +
> +/**
> +* Ecoding one frame - common function for all AMF encoders
> +*/
> +int ff_amf_send_frame(AVCodecContext *avctx, const AVFrame *frame);
> +int ff_amf_receive_packet(AVCodecContext *avctx, AVPacket *avpkt);

Most of these comments are redundant and pointless.

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

Reply via email to