FFmpegSource2: more portability
Originally committed to SVN as r2355.
This commit is contained in:
parent
811483bc7a
commit
78d4c92a89
6 changed files with 58 additions and 44 deletions
|
@ -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;
|
||||
|
|
|
@ -27,6 +27,11 @@
|
|||
#include "indexing.h"
|
||||
#include "wave64writer.h"
|
||||
|
||||
#ifndef WIN32
|
||||
# define _ftelli64 ftello
|
||||
# define _fseeki64 fseeko
|
||||
#endif
|
||||
|
||||
class AudioContext {
|
||||
public:
|
||||
Wave64Writer *W64W;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -22,6 +22,11 @@
|
|||
#include <string.h>
|
||||
#include <intrin.h>
|
||||
|
||||
#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];
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
// THE SOFTWARE.
|
||||
|
||||
#include "wave64writer.h"
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
|
||||
|
|
Loading…
Reference in a new issue