compat/w32pthreads.h | 4 +++- compat/winrtapiconvert.h | 42 ++++++++++++++++++++++++++++++++++++++ configure | 33 +++++++++++++++++------------- doc/platform.texi | 10 +++++++-- libavutil/arm/float_dsp_init_vfp.c | 2 +- libavutil/file.c | 3 +++ libavutil/random_seed.c | 7 +++++++ libavutil/time.c | 3 +++ 8 files changed, 86 insertions(+), 18 deletions(-) diff --git a/compat/w32pthreads.h b/compat/w32pthreads.h index 87e816f..1523850 100644 --- a/compat/w32pthreads.h +++ b/compat/w32pthreads.h @@ -38,7 +38,9 @@ #define WIN32_LEAN_AND_MEAN #include #include - +#if HAVE_WINRTAPI +#include "winrtapiconvert.h" +#endif #include "libavutil/attributes.h" #include "libavutil/common.h" #include "libavutil/internal.h" diff --git a/compat/winrtapiconvert.h b/compat/winrtapiconvert.h new file mode 100644 index 0000000..d7236cb --- /dev/null +++ b/compat/winrtapiconvert.h @@ -0,0 +1,42 @@ +/* + * Windows Runtime API convert + * Copyright (c) 2014 Jesse Jiang + * Copyright (c) 2014 PPLive Inc. + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * WinRT API convert + */ + +#ifndef FFMPEG_COMPAT_WINRTAPICONVERT_H +#define FFMPEG_COMPAT_WINRTAPICONVERT_H +#include +#include + +#define Sleep(x) WaitForSingleObjectEx(GetCurrentProcess(),x,FALSE) + +#define _beginthreadex(a, b, c, d, e, f) CreateThread(a, b, c, d, e, f) + +// d is dwMaximumSizeHigh ,e is dwMaximumSizeLow as theay are all 0 in codes so CreateFileMappingFromApp should be 0 +#define CreateFileMapping(a, b, c, d, e, f) CreateFileMappingFromApp(a, b, c, e, f) +// same as CreateFileMapping +#define MapViewOfFile(a, b, c, d, e) MapViewOfFileFromApp(a, b, d, e) + +#endif /*FFMPEG_COMPAT_WINRTAPICONVERT_H*/ \ No newline at end of file diff --git a/configure b/configure index c0aa718..2f2b37b 100755 --- a/configure +++ b/configure @@ -147,7 +147,8 @@ Component options: --disable-fft disable FFT code --disable-faan disable floating point AAN (I)DCT code --disable-pixelutils disable pixel utils in libavutil - + --disable-winrtapi disable windows runtime API + Hardware accelerators: --disable-dxva2 disable DXVA2 code [autodetect] --disable-vaapi disable VAAPI code [autodetect] @@ -1823,6 +1824,7 @@ HAVE_LIST=" threads vdpau_x11 xlib + winrtapi " # options emitted with CONFIG_ prefix but not available on the command line @@ -1895,6 +1897,7 @@ CMDLINE_SELECT=" optimizations rpath stripping + winrtapi " PATHS_LIST=" @@ -2397,7 +2400,6 @@ avi_muxer_select="riffenc" avisynth_demuxer_deps="avisynth" avisynth_demuxer_select="riffdec" caf_demuxer_select="riffdec" -dash_muxer_select="mp4_muxer" dirac_demuxer_select="dirac_parser" dts_demuxer_select="dca_parser" dtshd_demuxer_select="dca_parser" @@ -2578,7 +2580,7 @@ ladspa_filter_deps="ladspa dlopen" ladspa_filter_extralibs='$ldl' mcdeint_filter_deps="avcodec gpl" movie_filter_deps="avcodec avformat" -mp_filter_deps="gpl avcodec swscale" +mp_filter_deps="gpl avcodec swscale inline_asm" mpdecimate_filter_deps="gpl" mpdecimate_filter_select="pixelutils" mptestsrc_filter_deps="gpl" @@ -2609,6 +2611,7 @@ vidstabtransform_filter_deps="libvidstab" pixfmts_super2xsai_test_deps="super2xsai_filter" tinterlace_merge_test_deps="tinterlace_filter" tinterlace_pad_test_deps="tinterlace_filter" +xbr_filter_deps="gpl" zmq_filter_deps="libzmq" zoompan_filter_deps="swscale" @@ -3902,7 +3905,6 @@ if test "$?" != 0; then fi add_cppflags -D_ISOC99_SOURCE -add_cxxflags -D__STDC_CONSTANT_MACROS check_cflags -std=c99 check_cc -D_FILE_OFFSET_BITS=64 < @@ -3950,9 +3952,6 @@ case "$arch" in ;; x86) check_64bit x86_32 x86_64 'sizeof(void *) > 4' - # Treat x32 as x64 for now. Note it also needs spic=$shared - test "$subarch" = "x86_32" && check_cpp_condition stddef.h 'defined(__x86_64__)' && - subarch=x86_64 if test "$subarch" = "x86_64"; then spic=$shared fi @@ -4440,9 +4439,8 @@ if enabled_any arm aarch64 || enabled_all ppc altivec && enabled asm; then [ $target_os = "darwin" ] && gaspp_as_type="apple-$gaspp_as_type" - test "${as#*gas-preprocessor.pl}" != "$as" || - check_cmd gas-preprocessor.pl -arch $arch -as-type $gaspp_as_type -- ${as:=$cc} $as_noop && - gas="${gas:=gas-preprocessor.pl} -arch $arch -as-type $gaspp_as_type -- ${as:=$cc}" + check_cmd gas-preprocessor.pl -arch $arch -as-type $gaspp_as_type -- $as $as_noop && + gas="gas-preprocessor.pl -arch $arch -as-type $gaspp_as_type -- $as" if ! check_gas ; then as=${gas:=$as} @@ -4458,8 +4456,6 @@ fi check_inline_asm inline_asm_labels '"1:\n"' -check_inline_asm inline_asm_nonlocal_labels '"Label:\n"' - if enabled aarch64; then enabled armv8 && check_insn armv8 'prfm pldl1strm, [x0]' # internal assembler in clang 3.3 does not support this instruction @@ -4737,6 +4733,12 @@ check_func_headers windows.h SetConsoleTextAttribute check_func_headers windows.h Sleep check_func_headers windows.h VirtualAlloc check_struct windows.h "CONDITION_VARIABLE" Ptr +if enabled winrtapi; then + disable SetConsoleTextAttribute + disable GetProcessAffinityMask + disable VirtualAlloc +fi + check_func_headers glob.h glob enabled xlib && check_func_headers "X11/Xlib.h X11/extensions/Xvlib.h" XvGetPortAttribute -lXv -lX11 -lXext @@ -4770,7 +4772,10 @@ check_header asm/types.h check_lib2 "windows.h shellapi.h" CommandLineToArgvW -lshell32 check_lib2 "windows.h wincrypt.h" CryptGenRandom -ladvapi32 check_lib2 "windows.h psapi.h" GetProcessMemoryInfo -lpsapi - +if enabled winrtapi; then + disable CryptGenRandom +fi + check_struct "sys/time.h sys/resource.h" "struct rusage" ru_maxrss if ! disabled w32threads && ! enabled pthreads; then @@ -5782,4 +5787,4 @@ pkgconfig_generate libavfilter "FFmpeg audio/video filtering library" "$LIBAVF pkgconfig_generate libpostproc "FFmpeg postprocessing library" "$LIBPOSTPROC_VERSION" "" pkgconfig_generate libavresample "Libav audio resampling library" "$LIBAVRESAMPLE_VERSION" "$LIBM" pkgconfig_generate libswscale "FFmpeg image rescaling library" "$LIBSWSCALE_VERSION" "$LIBM" -pkgconfig_generate libswresample "FFmpeg audio resampling library" "$LIBSWRESAMPLE_VERSION" "$LIBM" +pkgconfig_generate libswresample "FFmpeg audio resampling library" "$LIBSWRESAMPLE_VERSION" "$LIBM" \ No newline at end of file diff --git a/doc/platform.texi b/doc/platform.texi index ca76492..e513b71 100644 --- a/doc/platform.texi +++ b/doc/platform.texi @@ -121,7 +121,7 @@ libavformat) as DLLs. @end itemize -@section Microsoft Visual C++ or Intel C++ Compiler for Windows +@section Microsoft Visual C++ or Intel C++ Compiler for Windows, Windows Store App or Windows phone FFmpeg can be built with MSVC 2012 or earlier using a C99-to-C89 conversion utility and wrapper, or with MSVC 2013 and ICL natively. @@ -137,6 +137,8 @@ You will need the following prerequisites: @item @uref{http://yasm.tortall.net/, YASM} @item @uref{http://gnuwin32.sourceforge.net/packages/bc.htm, bc for Windows} if you want to run @uref{fate.html, FATE}. +@item @uref{https://github.com/FFmpeg/gas-preprocessor/, gas-preprocessor.pl} if +you want to build ARM version, for Windows Store App ARM or Windows Phone. @end itemize To set up a proper environment in MSYS, you need to run @code{msys.bat} from @@ -144,7 +146,7 @@ the Visual Studio or Intel Compiler command prompt. Place @code{yasm.exe} somewhere in your @code{PATH}. If using MSVC 2012 or earlier, place @code{c99wrap.exe} and @code{c99conv.exe} somewhere in your -@code{PATH} as well. +@code{PATH} as well. Place gas-preprocessor.pl somewhere in your @code{PATH}. Next, make sure any other headers and libs you want to use, such as zlib, are located in a spot that the compiler can see. Do so by modifying the @code{LIB} @@ -197,6 +199,10 @@ erroneously included when building FFmpeg. can see. @end enumerate +@item If you wish to comiple for Windows Runtime, which used for Windows Store or +Windows Phone, add @code{--enable-winrtapi} to your configure options. you must to +use static library ffmpeg for Windows Runtime. + @item FFmpeg has been tested with the following on i686 and x86_64: @itemize @item Visual Studio 2010 Pro and Express diff --git a/libavutil/arm/float_dsp_init_vfp.c b/libavutil/arm/float_dsp_init_vfp.c index 45508b8..e15abf3 100644 --- a/libavutil/arm/float_dsp_init_vfp.c +++ b/libavutil/arm/float_dsp_init_vfp.c @@ -32,7 +32,7 @@ void ff_vector_fmul_window_vfp(float *dst, const float *src0, void ff_vector_fmul_reverse_vfp(float *dst, const float *src0, const float *src1, int len); -void ff_butterflies_float_vfp(float *restrict v1, float *restrict v2, int len); +void ff_butterflies_float_vfp(float *av_restrict v1, float *av_restrict v2, int len); av_cold void ff_float_dsp_init_vfp(AVFloatDSPContext *fdsp, int cpu_flags) { diff --git a/libavutil/file.c b/libavutil/file.c index 359d290..bf8795a 100644 --- a/libavutil/file.c +++ b/libavutil/file.c @@ -33,6 +33,9 @@ #include #elif HAVE_MAPVIEWOFFILE #include +#if HAVE_WINRTAPI +#include "compat/winrtapiconvert.h" +#endif #endif typedef struct { diff --git a/libavutil/random_seed.c b/libavutil/random_seed.c index 8aa8c38..54da5e4 100644 --- a/libavutil/random_seed.c +++ b/libavutil/random_seed.c @@ -30,6 +30,9 @@ #include #include #endif +#if HAVE_WINRTAPI +#include +#endif #include #include #include @@ -121,6 +124,10 @@ uint32_t av_get_random_seed(void) } #endif +#if HAVE_WINRTAPI + return rand(); +#endif + if (read_random(&seed, "/dev/urandom") == sizeof(seed)) return seed; if (read_random(&seed, "/dev/random") == sizeof(seed)) diff --git a/libavutil/time.c b/libavutil/time.c index dbaee02..82c77cd 100644 --- a/libavutil/time.c +++ b/libavutil/time.c @@ -31,6 +31,9 @@ #endif #if HAVE_WINDOWS_H #include +#if HAVE_WINRTAPI +#include "compat/winrtapiconvert.h" +#endif #endif #include "time.h"