diff --git a/FFmpegSource2/ffswscale.cpp b/FFmpegSource2/ffswscale.cpp index c3334bb59..10e5e2344 100644 --- a/FFmpegSource2/ffswscale.cpp +++ b/FFmpegSource2/ffswscale.cpp @@ -21,6 +21,46 @@ #include "ffswscale.h" #include "utils.h" +int CSNameToPIXFMT(const char * ACSName, int ADefault) { + if (!_stricmp(ACSName, "")) + return ADefault; + if (!_stricmp(ACSName, "YV12")) + return PIX_FMT_YUV420P; + if (!_stricmp(ACSName, "YUY2")) + return PIX_FMT_YUYV422; + if (!_stricmp(ACSName, "RGB24")) + return PIX_FMT_BGR24; + if (!_stricmp(ACSName, "RGB32")) + return PIX_FMT_RGB32; + return PIX_FMT_NONE; +} + +int ResizerNameToSWSResizer(const char *AResizerName) { + if (!_stricmp(AResizerName, "FAST_BILINEAR")) + return SWS_FAST_BILINEAR; + if (!_stricmp(AResizerName, "BILINEAR")) + return SWS_BILINEAR; + if (!_stricmp(AResizerName, "BICUBIC")) + return SWS_BICUBIC; + if (!_stricmp(AResizerName, "X")) + return SWS_X; + if (!_stricmp(AResizerName, "POINT")) + return SWS_POINT; + if (!_stricmp(AResizerName, "AREA")) + return SWS_AREA; + if (!_stricmp(AResizerName, "BICUBLIN")) + return SWS_BICUBLIN; + if (!_stricmp(AResizerName, "GAUSS")) + return SWS_GAUSS; + if (!_stricmp(AResizerName, "SINC")) + return SWS_SINC; + if (!_stricmp(AResizerName, "LANCZOS")) + return SWS_LANCZOS; + if (!_stricmp(AResizerName, "SPLINE")) + return SWS_SPLINE; + return 0; +} + SWScale::SWScale(PClip Child, int ResizeToWidth, int ResizeToHeight, const char *ResizerName, const char *ConvertToFormatName, IScriptEnvironment *Env) : GenericVideoFilter(Child) { Context = NULL; OrigWidth = vi.width; diff --git a/FFmpegSource2/indexing.cpp b/FFmpegSource2/indexing.cpp index 14af03a14..aba8641fb 100644 --- a/FFmpegSource2/indexing.cpp +++ b/FFmpegSource2/indexing.cpp @@ -27,6 +27,11 @@ #include "indexing.h" #include "wave64writer.h" +#ifndef WIN32 +# define _ftelli64 ftello +# define _fseeki64 fseeko +#endif + class AudioContext { public: Wave64Writer *W64W; diff --git a/FFmpegSource2/stdiostream.c b/FFmpegSource2/stdiostream.c index 68c2f2f73..f1966b30a 100644 --- a/FFmpegSource2/stdiostream.c +++ b/FFmpegSource2/stdiostream.c @@ -20,6 +20,11 @@ #include "stdiostream.h" +#ifndef WIN32 +# define _ftelli64 ftello +# define _fseeki64 fseeko +#endif + /* StdIoStream methods */ /* read count bytes into buffer starting at file position pos diff --git a/FFmpegSource2/utils.cpp b/FFmpegSource2/utils.cpp index 2e1ed0307..3c382db06 100644 --- a/FFmpegSource2/utils.cpp +++ b/FFmpegSource2/utils.cpp @@ -22,6 +22,11 @@ #include #include +#ifndef WIN32 +# define _ftelli64 ftello +# define _fseeki64 fseeko +#endif + int GetCPUFlags() { int CPUInfo[4]; __cpuid(CPUInfo, 0); @@ -37,46 +42,6 @@ int GetCPUFlags() { return Flags; } -int CSNameToPIXFMT(const char * ACSName, int ADefault) { - if (!_strcmpi(ACSName, "")) - return ADefault; - if (!_strcmpi(ACSName, "YV12")) - return PIX_FMT_YUV420P; - if (!_strcmpi(ACSName, "YUY2")) - return PIX_FMT_YUYV422; - if (!_strcmpi(ACSName, "RGB24")) - return PIX_FMT_BGR24; - if (!_strcmpi(ACSName, "RGB32")) - return PIX_FMT_RGB32; - return PIX_FMT_NONE; -} - -int ResizerNameToSWSResizer(const char *AResizerName) { - if (!_strcmpi(AResizerName, "FAST_BILINEAR")) - return SWS_FAST_BILINEAR; - if (!_strcmpi(AResizerName, "BILINEAR")) - return SWS_BILINEAR; - if (!_strcmpi(AResizerName, "BICUBIC")) - return SWS_BICUBIC; - if (!_strcmpi(AResizerName, "X")) - return SWS_X; - if (!_strcmpi(AResizerName, "POINT")) - return SWS_POINT; - if (!_strcmpi(AResizerName, "AREA")) - return SWS_AREA; - if (!_strcmpi(AResizerName, "BICUBLIN")) - return SWS_BICUBLIN; - if (!_strcmpi(AResizerName, "GAUSS")) - return SWS_GAUSS; - if (!_strcmpi(AResizerName, "SINC")) - return SWS_SINC; - if (!_strcmpi(AResizerName, "LANCZOS")) - return SWS_LANCZOS; - if (!_strcmpi(AResizerName, "SPLINE")) - return SWS_SPLINE; - return 0; -} - int ReadFrame(uint64_t FilePos, unsigned int &FrameSize, CompressedStream *CS, MatroskaReaderContext &Context, char *ErrorMsg, unsigned MsgSize) { if (CS) { char CSBuffer[4096]; diff --git a/FFmpegSource2/utils.h b/FFmpegSource2/utils.h index ca3ac8b11..4cc3d5585 100644 --- a/FFmpegSource2/utils.h +++ b/FFmpegSource2/utils.h @@ -48,8 +48,6 @@ public: }; int GetCPUFlags(); -int CSNameToPIXFMT(const char * ACSName, int ADefault); -int ResizerNameToSWSResizer(const char *AResizerName); int ReadFrame(uint64_t FilePos, unsigned int &FrameSize, CompressedStream *CS, MatroskaReaderContext &Context, char *ErrorMsg, unsigned MsgSize); bool AudioFMTIsFloat(SampleFormat FMT); CodecID MatroskaToFFCodecID(TrackInfo *TI); diff --git a/FFmpegSource2/wave64writer.cpp b/FFmpegSource2/wave64writer.cpp index 29ede63e4..ab2c88031 100644 --- a/FFmpegSource2/wave64writer.cpp +++ b/FFmpegSource2/wave64writer.cpp @@ -19,6 +19,7 @@ // THE SOFTWARE. #include "wave64writer.h" +#include #define WAVE_FORMAT_IEEE_FLOAT 0x0003 #define WAVE_FORMAT_PCM 1 @@ -80,7 +81,7 @@ void Wave64Writer::WriteHeader(bool Initial, bool IsFloat) { memcpy(Header + 0, GuidRIFF, 16); if (Initial) { - Header[2] = 0x7F00000000000000; + Header[2] = 0x7F00000000000000ull; } else { Header[2] = BytesWritten + sizeof(Header); } @@ -95,7 +96,7 @@ void Wave64Writer::WriteHeader(bool Initial, bool IsFloat) { memcpy(Header + 11, Guiddata, 16); if (Initial) - Header[13] = 0x7E00000000000000; + Header[13] = 0x7E00000000000000ull; else Header[13] = BytesWritten + 24;