[FFmpeg-devel] [PATCH v2 0/1] avcodec/mf: implemented Media Foundation wrapper

Hendrik Leppkes h.leppkes at gmail.com
Tue Nov 6 16:39:53 EET 2018


On Mon, Oct 29, 2018 at 10:27 AM Paweł Wegner <pawel.wegner95 at gmail.com> wrote:
>
> Thanks for the tip; I took Media Foundation support from PLEX's FFmpeg fork.
> The newer patch revision contains hw decoding through Media Foundation.
>
> Paweł Wegner (1):
>   avcodec/mf: implemented Media Foundation wrapper
>
>  configure                      |   48 +-
>  fftools/Makefile               |    1 +
>  fftools/ffmpeg.h               |    2 +
>  fftools/ffmpeg_mf.c            |  116 ++
>  fftools/ffmpeg_opt.c           |    3 +
>  libavcodec/Makefile            |    1 +
>  libavcodec/allcodecs.c         |   28 +
>  libavcodec/hwaccels.h          |   12 +
>  libavcodec/mf.c                | 2160 ++++++++++++++++++++++++++++++++
>  libavcodec/mf_utils.c          |  734 +++++++++++
>  libavcodec/mf_utils.h          |  207 +++
>  libavutil/Makefile             |    3 +
>  libavutil/hwcontext.c          |    3 +
>  libavutil/hwcontext.h          |    1 +
>  libavutil/hwcontext_internal.h |    1 +
>  libavutil/hwcontext_mf.c       |  440 +++++++
>  libavutil/hwcontext_mf.h       |  122 ++
>  libavutil/pixdesc.c            |    4 +
>  libavutil/pixfmt.h             |    2 +
>  19 files changed, 3887 insertions(+), 1 deletion(-)
>  create mode 100644 fftools/ffmpeg_mf.c
>  create mode 100644 libavcodec/mf.c
>  create mode 100644 libavcodec/mf_utils.c
>  create mode 100644 libavcodec/mf_utils.h
>  create mode 100644 libavutil/hwcontext_mf.c
>  create mode 100644 libavutil/hwcontext_mf.h
>

The patch has a lot of issues and will not be commited without a lot of work.

Just some of the bigger points:

(1) You have by your own statements not written this patch, yet it
claims your authorship. You should correct that and fully credit any
authors.
(2) The HWContext is really messy. We have a concept of a derived
hardware contexts that internally is build ontop of another hardware
layer, so a "MF" Context that uses either D3D9 or D3D11 should really
build on that, not wrap its own 9/11 hardware interfaces.
(2b) Its doubtful going with a HWContext for that is even the right
approach, since its just an abstraction around generic data packages,
not necessarily hardware, but I haven't checked the intrinsic details
on how to do that otherwise
(3) The patch should also be split to be more readable, the hwcontext
and the avcodec parts for example make natural splitting points
(4) We don't do fake HWAccels anymore for accelerted encoders/decoders
(5) The code has a lot of style issues and could use a lot of cleanup
and commenting, especially in the internal headers and structures, so
its actually maintainable.
(6) Consider splitting mf.c into  mfcommon, mfdec and mfenc or
something otherwise suitable. 2000+ lines in one file is often
something that can be avoided by a proper structure.

- Hendrik


More information about the ffmpeg-devel mailing list