[FFmpeg-devel] [PATCH v3 1/1] avcodec: implemented Media Foundation encoder wrapper

Michael Niedermayer michael at niedermayer.cc
Tue Nov 13 19:51:43 EET 2018


On Tue, Nov 13, 2018 at 12:23:42PM +0100, Paweł Wegner wrote:
> On Tue, Nov 13, 2018 at 11:40 AM Michael Niedermayer <michael at niedermayer.cc>
> wrote:
> 
> > On Tue, Nov 13, 2018 at 09:50:17AM +0100, Paweł Wegner wrote:
> > > On Tue, Nov 13, 2018 at 12:39 AM Michael Niedermayer
> > <michael at niedermayer.cc>
> > > wrote:
> > >
> > > > On Mon, Nov 12, 2018 at 02:42:36PM +0100, Paweł Wegner wrote:
> > > > > Implemented the following encoders:
> > > > > * ff_h264_mf_encoder
> > > > > * ff_hevc_mf_encoder
> > > > > * ff_aac_mf_encoder
> > > > > * ff_ac3_mf_encoder
> > > > > * ff_mp3_mf_encoder
> > > > >
> > > > > The code is based on the PLEX's FFmpeg fork which can be found here:
> > > > > https://files.plexapp.com/elan/ffmpeg/plex-ffmpeg-2017-12-17.txz
> > > > >
> > > > > Signed-off-by: Paweł Wegner <pawel.wegner95 at gmail.com>
> > > > > ---
> > > > >  configure              |   11 +
> > > > >  libavcodec/Makefile    |    1 +
> > > > >  libavcodec/allcodecs.c |    5 +
> > > > >  libavcodec/mf_utils.c  |  734 ++++++++++++++++++++++++
> > > > >  libavcodec/mf_utils.h  |  207 +++++++
> > > > >  libavcodec/mfenc.c     | 1242
> > ++++++++++++++++++++++++++++++++++++++++
> > > > >  6 files changed, 2200 insertions(+)
> > > > >  create mode 100644 libavcodec/mf_utils.c
> > > > >  create mode 100644 libavcodec/mf_utils.h
> > > > >  create mode 100644 libavcodec/mfenc.c
> > > >
> > > > breaks build for mingw64
> > >
> > >
> > > > CC      libavcodec/mf_utils.o
> > > > In file included from /usr/share/mingw-w64/include/wmcodecdsp.h:613:0,
> > > >                  from src/libavcodec/mf_utils.h:26,
> > > >                  from src/libavcodec/mf_utils.c:24:
> > > > /usr/share/mingw-w64/include/strmif.h:15380:2: warning: #warning COM
> > > > interfaces layout in this header has not been verified. [-Wcpp]
> > > >  #warning COM interfaces layout in this header has not been verified.
> > > >   ^
> > > > /usr/share/mingw-w64/include/strmif.h:15381:2: warning: #warning COM
> > > > interfaces with incorrect layout may not work at all. [-Wcpp]
> > > >  #warning COM interfaces with incorrect layout may not work at all.
> > > >   ^
> > > > /usr/share/mingw-w64/include/strmif.h:15410:2: warning: #warning COM
> > > > interfaces layout in this header has not been verified. [-Wcpp]
> > > >  #warning COM interfaces layout in this header has not been verified.
> > > >   ^
> > > > /usr/share/mingw-w64/include/strmif.h:15411:2: warning: #warning COM
> > > > interfaces with incorrect layout may not work at all. [-Wcpp]
> > > >  #warning COM interfaces with incorrect layout may not work at all.
> > > >   ^
> > > >
> > > I can silence these warnings by doing #undef __GNU_C__ before the MF
> > > inclusion; but would that really be better?
> > > This is where this comes from:
> > >
> > https://github.com/Alexpux/mingw-w64/blob/master/mingw-w64-headers/include/mfplay.h#L59
> > >
> > >
> > > > In file included from /usr/share/mingw-w64/include/wmcodecdsp.h:613:0,
> > > >                  from src/libavcodec/mf_utils.h:26,
> > > >                  from src/libavcodec/mf_utils.c:24:
> > > > /usr/share/mingw-w64/include/strmif.h:15382:9: note: #pragma message:
> > > > Interface IAMAsyncReaderTimestampScaling has unverified layout.
> > > >  __MINGW_BROKEN_INTERFACE(INTERFACE)
> > > > ...
> > > >
> > > This one comes from mingw as well; and can be worked around the same way.
> >
> > sorry i have cut the compiler output incorrectly
> > heres the full output, there are multiple real errors, not just warnings:
> >
> >
> >
> > In file included from /usr/share/mingw-w64/include/wmcodecdsp.h:613:0,
> >                  from src/libavcodec/mf_utils.h:26,
> >                  from src/libavcodec/mf_utils.c:24:
> > /usr/share/mingw-w64/include/strmif.h:15380:2: warning: #warning COM
> > interfaces layout in this header has not been verified. [-Wcpp]
> >  #warning COM interfaces layout in this header has not been verified.
> >   ^
> > /usr/share/mingw-w64/include/strmif.h:15381:2: warning: #warning COM
> > interfaces with incorrect layout may not work at all. [-Wcpp]
> >  #warning COM interfaces with incorrect layout may not work at all.
> >   ^
> > /usr/share/mingw-w64/include/strmif.h:15410:2: warning: #warning COM
> > interfaces layout in this header has not been verified. [-Wcpp]
> >  #warning COM interfaces layout in this header has not been verified.
> >   ^
> > /usr/share/mingw-w64/include/strmif.h:15411:2: warning: #warning COM
> > interfaces with incorrect layout may not work at all. [-Wcpp]
> >  #warning COM interfaces with incorrect layout may not work at all.
> >   ^
> > In file included from /usr/share/mingw-w64/include/wmcodecdsp.h:613:0,
> >                  from src/libavcodec/mf_utils.h:26,
> >                  from src/libavcodec/mf_utils.c:24:
> > /usr/share/mingw-w64/include/strmif.h:15382:9: note: #pragma message:
> > Interface IAMAsyncReaderTimestampScaling has unverified layout.
> >  __MINGW_BROKEN_INTERFACE(INTERFACE)
> >          ^
> > In file included from /usr/share/mingw-w64/include/wmcodecdsp.h:613:0,
> >                  from src/libavcodec/mf_utils.h:26,
> >                  from src/libavcodec/mf_utils.c:24:
> > /usr/share/mingw-w64/include/strmif.h:15412:9: note: #pragma message:
> > Interface IAMPluginControl has unverified layout.
> >  __MINGW_BROKEN_INTERFACE(INTERFACE)
> >          ^
> > src/libavcodec/mf_utils.c: In function ‘ff_hr_str_buf’:
> > src/libavcodec/mf_utils.c:96:10: error:
> > ‘MF_E_TRANSFORM_CANNOT_CHANGE_MEDIATYPE_WHILE_PROCESSING’ undeclared (first
> > use in this function)
> >      HR(MF_E_TRANSFORM_CANNOT_CHANGE_MEDIATYPE_WHILE_PROCESSING)
> >           ^
> > src/libavcodec/mf_utils.c:96:10: note: each undeclared identifier is
> > reported only once for each function it appears in
> > src/libavcodec/mf_utils.c:98:10: error: ‘MF_E_UNSUPPORTED_D3D_TYPE’
> > undeclared (first use in this function)
> >      HR(MF_E_UNSUPPORTED_D3D_TYPE)
> >           ^
> > src/libavcodec/mf_utils.c:99:10: error: ‘MF_E_TRANSFORM_NEED_MORE_INPUT’
> > undeclared (first use in this function)
> >      HR(MF_E_TRANSFORM_NEED_MORE_INPUT)
> >           ^
> > src/libavcodec/mf_utils.c:100:10: error: ‘MF_E_TRANSFORM_STREAM_CHANGE’
> > undeclared (first use in this function)
> >      HR(MF_E_TRANSFORM_STREAM_CHANGE)
> >           ^
> > src/libavcodec/mf_utils.c: In function ‘ff_create_memory_sample’:
> > src/libavcodec/mf_utils.c:125:5: error: implicit declaration of function
> > ‘MFCreateAlignedMemoryBuffer’ [-Werror=implicit-function-declaration]
> >      hr = MFCreateAlignedMemoryBuffer(size, align - 1, &buffer);
> >      ^
> > src/libavcodec/mf_utils.c: At top level:
> > src/libavcodec/mf_utils.c:280:8: error: ‘MFVideoFormat_H264_ES’ undeclared
> > here (not in a function)
> >      GUID_ENTRY(MFVideoFormat_H264_ES),
> >         ^
> > src/libavcodec/mf_utils.c:281:8: error: ‘MFVideoFormat_HEVC’ undeclared
> > here (not in a function)
> >      GUID_ENTRY(MFVideoFormat_HEVC),
> >         ^
> > src/libavcodec/mf_utils.c:282:8: error: ‘MFVideoFormat_HEVC_ES’ undeclared
> > here (not in a function)
> >      GUID_ENTRY(MFVideoFormat_HEVC_ES),
> >         ^
> > src/libavcodec/mf_utils.c:283:8: error: ‘MFVideoFormat_MPEG2’ undeclared
> > here (not in a function)
> >      GUID_ENTRY(MFVideoFormat_MPEG2),
> >         ^
> > src/libavcodec/mf_utils.c:290:8: error: ‘MFAudioFormat_Dolby_AC3’
> > undeclared here (not in a function)
> >      GUID_ENTRY(MFAudioFormat_Dolby_AC3),
> >         ^
> > src/libavcodec/mf_utils.c:291:8: error: ‘MFAudioFormat_Dolby_DDPlus’
> > undeclared here (not in a function)
> >      GUID_ENTRY(MFAudioFormat_Dolby_DDPlus),
> >         ^
> > src/libavcodec/mf_utils.c: In function ‘ff_guid_str_buf’:
> > src/libavcodec/mf_utils.c:389:9: warning: ‘av_get_codec_tag_string’ is
> > deprecated (declared at src/libavcodec/avcodec.h:5583)
> > [-Wdeprecated-declarations]
> >          av_get_codec_tag_string(tag, sizeof(tag), fourcc);
> >          ^
> > src/libavcodec/mf_utils.c: In function ‘ff_codec_to_mf_subtype’:
> > src/libavcodec/mf_utils.c:589:28: warning: return from incompatible
> > pointer type [enabled by default]
> >      case AV_CODEC_ID_HEVC:              return &MFVideoFormat_HEVC;
> >                             ^
> > src/libavcodec/mf_utils.c:591:34: warning: return from incompatible
> > pointer type [enabled by default]
> >      case AV_CODEC_ID_MPEG2VIDEO:        return &MFVideoFormat_MPEG2;
> >                                   ^
> > src/libavcodec/mf_utils.c:600:27: warning: return from incompatible
> > pointer type [enabled by default]
> >      case AV_CODEC_ID_AC3:               return &MFAudioFormat_Dolby_AC3;
> >                            ^
> > src/libavcodec/mf_utils.c:601:28: warning: return from incompatible
> > pointer type [enabled by default]
> >      case AV_CODEC_ID_EAC3:              return
> > &MFAudioFormat_Dolby_DDPlus;
> >                             ^
> > src/libavcodec/mf_utils.c: In function ‘ff_instantiate_mf’:
> > src/libavcodec/mf_utils.c:658:13: error: ‘MFT_ENUM_FLAG_SORTANDFILTER’
> > undeclared (first use in this function)
> >      flags = MFT_ENUM_FLAG_SORTANDFILTER;
> >              ^
> > src/libavcodec/mf_utils.c:658:11: warning: assignment makes integer from
> > pointer without a cast [enabled by default]
> >      flags = MFT_ENUM_FLAG_SORTANDFILTER;
> >            ^
> > src/libavcodec/mf_utils.c:661:18: error: ‘MFT_ENUM_FLAG_HARDWARE’
> > undeclared (first use in this function)
> >          flags |= MFT_ENUM_FLAG_HARDWARE;
> >                   ^
> > src/libavcodec/mf_utils.c:661:15: error: invalid operands to binary |
> > (have ‘UINT32’ and ‘struct GUID_Entry *’)
> >          flags |= MFT_ENUM_FLAG_HARDWARE;
> >                ^
> > src/libavcodec/mf_utils.c:661:9: warning: statement with no effect
> > [-Wunused-value]
> >          flags |= MFT_ENUM_FLAG_HARDWARE;
> >          ^
> > src/libavcodec/mf_utils.c:663:18: error: ‘MFT_ENUM_FLAG_SYNCMFT’
> > undeclared (first use in this function)
> >          flags |= MFT_ENUM_FLAG_SYNCMFT;
> >                   ^
> > src/libavcodec/mf_utils.c:663:15: error: invalid operands to binary |
> > (have ‘UINT32’ and ‘struct GUID_Entry *’)
> >          flags |= MFT_ENUM_FLAG_SYNCMFT;
> >                ^
> > src/libavcodec/mf_utils.c:663:9: warning: statement with no effect
> > [-Wunused-value]
> >          flags |= MFT_ENUM_FLAG_SYNCMFT;
> >          ^
> > cc1: some warnings being treated as errors
> > make: *** [libavcodec/mf_utils.o] Error 1
> >
> What is your MinGW version? I'm using x86_64-w64-mingw32-g++ (GCC)
> 7.3-posix 20180312

ii  gcc-mingw-w64-x86-64                                                    4.8.2-10ubuntu2+12                       amd64                                    GNU C compiler for MinGW-w64 targeting Win64



> If there is some MinGW version which has to be supported I can insert
> necessary compatibility checks.

its not about a specific version, code should not fail to build like this
in general the most recent feature code needs has to be checked for and
the code disabled if that isnt supported by the environment.
Its of course possible to add support for older versions but whatever
is done a plain configure + make must not fail building a file in the middle


[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

"I am not trying to be anyone's saviour, I'm trying to think about the
 future and not be sad" - Elon Musk

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20181113/ad7939f2/attachment.sig>


More information about the ffmpeg-devel mailing list