mirror of https://github.com/odrling/Aegisub
FFMS2: More ICL warning inspired fixes
Originally committed to SVN as r2960.
This commit is contained in:
parent
ccf24ae3af
commit
dd1c706d5c
|
@ -99,11 +99,11 @@ int64_t TAudioCache::FillRequest(int64_t Start, int64_t Samples, uint8_t *Dst) {
|
||||||
FFAudio::FFAudio() {
|
FFAudio::FFAudio() {
|
||||||
CurrentSample = 0;
|
CurrentSample = 0;
|
||||||
DecodingBuffer = new uint8_t[AVCODEC_MAX_AUDIO_FRAME_SIZE * 10];
|
DecodingBuffer = new uint8_t[AVCODEC_MAX_AUDIO_FRAME_SIZE * 10];
|
||||||
};
|
}
|
||||||
|
|
||||||
FFAudio::~FFAudio() {
|
FFAudio::~FFAudio() {
|
||||||
delete[] DecodingBuffer;
|
delete[] DecodingBuffer;
|
||||||
};
|
}
|
||||||
|
|
||||||
void FFLAVFAudio::Free(bool CloseCodec) {
|
void FFLAVFAudio::Free(bool CloseCodec) {
|
||||||
if (CloseCodec)
|
if (CloseCodec)
|
||||||
|
|
|
@ -54,7 +54,7 @@ public:
|
||||||
~TAudioBlock();
|
~TAudioBlock();
|
||||||
};
|
};
|
||||||
|
|
||||||
class TAudioCache : protected std::list<TAudioBlock *> {
|
class TAudioCache : private std::list<TAudioBlock *> {
|
||||||
private:
|
private:
|
||||||
int MaxCacheBlocks;
|
int MaxCacheBlocks;
|
||||||
int BytesPerSample;
|
int BytesPerSample;
|
||||||
|
@ -67,7 +67,7 @@ public:
|
||||||
int64_t FillRequest(int64_t Start, int64_t Samples, uint8_t *Dst);
|
int64_t FillRequest(int64_t Start, int64_t Samples, uint8_t *Dst);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct FFAudio {
|
class FFAudio {
|
||||||
protected:
|
protected:
|
||||||
TAudioCache AudioCache;
|
TAudioCache AudioCache;
|
||||||
int64_t CurrentSample;
|
int64_t CurrentSample;
|
||||||
|
@ -77,7 +77,7 @@ protected:
|
||||||
TAudioProperties AP;
|
TAudioProperties AP;
|
||||||
public:
|
public:
|
||||||
FFAudio();
|
FFAudio();
|
||||||
~FFAudio();
|
virtual ~FFAudio();
|
||||||
FFTrack *GetFFTrack() { return &Frames; }
|
FFTrack *GetFFTrack() { return &Frames; }
|
||||||
const TAudioProperties& GetTAudioProperties() { return AP; }
|
const TAudioProperties& GetTAudioProperties() { return AP; }
|
||||||
virtual int GetAudio(void *Buf, int64_t Start, int64_t Count, char *ErrorMsg, unsigned MsgSize) = 0;
|
virtual int GetAudio(void *Buf, int64_t Start, int64_t Count, char *ErrorMsg, unsigned MsgSize) = 0;
|
||||||
|
|
|
@ -24,13 +24,13 @@
|
||||||
#include "ffswscale.h"
|
#include "ffswscale.h"
|
||||||
#include "ffpp.h"
|
#include "ffpp.h"
|
||||||
|
|
||||||
int GetNumberOfLogicalCPUs() {
|
static int GetNumberOfLogicalCPUs() {
|
||||||
SYSTEM_INFO SI;
|
SYSTEM_INFO SI;
|
||||||
GetSystemInfo(&SI);
|
GetSystemInfo(&SI);
|
||||||
return SI.dwNumberOfProcessors;
|
return SI.dwNumberOfProcessors;
|
||||||
}
|
}
|
||||||
|
|
||||||
AVSValue __cdecl CreateFFIndex(AVSValue Args, void* UserData, IScriptEnvironment* Env) {
|
static AVSValue __cdecl CreateFFIndex(AVSValue Args, void* UserData, IScriptEnvironment* Env) {
|
||||||
FFMS_Init();
|
FFMS_Init();
|
||||||
|
|
||||||
char ErrorMsg[1024];
|
char ErrorMsg[1024];
|
||||||
|
@ -79,7 +79,7 @@ AVSValue __cdecl CreateFFIndex(AVSValue Args, void* UserData, IScriptEnvironment
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AVSValue __cdecl CreateFFVideoSource(AVSValue Args, void* UserData, IScriptEnvironment* Env) {
|
static AVSValue __cdecl CreateFFVideoSource(AVSValue Args, void* UserData, IScriptEnvironment* Env) {
|
||||||
FFMS_Init();
|
FFMS_Init();
|
||||||
|
|
||||||
char ErrorMsg[1024];
|
char ErrorMsg[1024];
|
||||||
|
@ -157,7 +157,7 @@ AVSValue __cdecl CreateFFVideoSource(AVSValue Args, void* UserData, IScriptEnvir
|
||||||
return Filter;
|
return Filter;
|
||||||
}
|
}
|
||||||
|
|
||||||
AVSValue __cdecl CreateFFAudioSource(AVSValue Args, void* UserData, IScriptEnvironment* Env) {
|
static AVSValue __cdecl CreateFFAudioSource(AVSValue Args, void* UserData, IScriptEnvironment* Env) {
|
||||||
FFMS_Init();
|
FFMS_Init();
|
||||||
|
|
||||||
char ErrorMsg[1024];
|
char ErrorMsg[1024];
|
||||||
|
@ -211,19 +211,19 @@ AVSValue __cdecl CreateFFAudioSource(AVSValue Args, void* UserData, IScriptEnvir
|
||||||
return Filter;
|
return Filter;
|
||||||
}
|
}
|
||||||
|
|
||||||
AVSValue __cdecl CreateFFPP(AVSValue Args, void* UserData, IScriptEnvironment* Env) {
|
static AVSValue __cdecl CreateFFPP(AVSValue Args, void* UserData, IScriptEnvironment* Env) {
|
||||||
return new FFPP(Args[0].AsClip(), Args[1].AsString(""), Env);
|
return new FFPP(Args[0].AsClip(), Args[1].AsString(""), Env);
|
||||||
}
|
}
|
||||||
|
|
||||||
AVSValue __cdecl CreateSWScale(AVSValue Args, void* UserData, IScriptEnvironment* Env) {
|
static AVSValue __cdecl CreateSWScale(AVSValue Args, void* UserData, IScriptEnvironment* Env) {
|
||||||
return new SWScale(Args[0].AsClip(), Args[1].AsInt(0), Args[2].AsInt(0), Args[3].AsString("BICUBIC"), Args[4].AsString(""), Env);
|
return new SWScale(Args[0].AsClip(), Args[1].AsInt(0), Args[2].AsInt(0), Args[3].AsString("BICUBIC"), Args[4].AsString(""), Env);
|
||||||
}
|
}
|
||||||
|
|
||||||
AVSValue __cdecl FFGetLogLevel(AVSValue Args, void* UserData, IScriptEnvironment* Env) {
|
static AVSValue __cdecl FFGetLogLevel(AVSValue Args, void* UserData, IScriptEnvironment* Env) {
|
||||||
return FFMS_GetLogLevel();
|
return FFMS_GetLogLevel();
|
||||||
}
|
}
|
||||||
|
|
||||||
AVSValue __cdecl FFSetLogLevel(AVSValue Args, void* UserData, IScriptEnvironment* Env) {
|
static AVSValue __cdecl FFSetLogLevel(AVSValue Args, void* UserData, IScriptEnvironment* Env) {
|
||||||
FFMS_SetLogLevel(Args[0].AsInt());
|
FFMS_SetLogLevel(Args[0].AsInt());
|
||||||
return FFMS_GetLogLevel();
|
return FFMS_GetLogLevel();
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,8 +25,10 @@
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
# define EXTERN_C extern "C"
|
# define EXTERN_C extern "C"
|
||||||
|
# define FFMS_CLASS_TYPE class
|
||||||
#else
|
#else
|
||||||
# define EXTERN_C
|
# define EXTERN_C
|
||||||
|
# define FFMS_CLASS_TYPE struct
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
@ -41,18 +43,18 @@
|
||||||
# define FFMS_API(ret) EXTERN_C ret FFMS_CC
|
# define FFMS_API(ret) EXTERN_C ret FFMS_CC
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct FFVideo;
|
FFMS_CLASS_TYPE FFVideo;
|
||||||
struct FFAudio;
|
FFMS_CLASS_TYPE FFAudio;
|
||||||
struct FFIndexer;
|
FFMS_CLASS_TYPE FFIndexer;
|
||||||
struct FFIndex;
|
FFMS_CLASS_TYPE FFIndex;
|
||||||
struct FFTrack;
|
FFMS_CLASS_TYPE FFTrack;
|
||||||
|
|
||||||
enum FFMS_SeekMode {
|
enum FFMS_SeekMode {
|
||||||
FFMS_SEEK_LINEAR_NO_RW = -1,
|
FFMS_SEEK_LINEAR_NO_RW = -1,
|
||||||
FFMS_SEEK_LINEAR = 0,
|
FFMS_SEEK_LINEAR = 0,
|
||||||
FFMS_SEEK_NORMAL = 1,
|
FFMS_SEEK_NORMAL = 1,
|
||||||
FFMS_SEEK_UNSAFE = 2,
|
FFMS_SEEK_UNSAFE = 2,
|
||||||
FFMS_SEEK_AGGRESSIVE = 3,
|
FFMS_SEEK_AGGRESSIVE = 3
|
||||||
};
|
};
|
||||||
|
|
||||||
enum FFMS_TrackType {
|
enum FFMS_TrackType {
|
||||||
|
@ -61,7 +63,7 @@ enum FFMS_TrackType {
|
||||||
FFMS_TYPE_AUDIO,
|
FFMS_TYPE_AUDIO,
|
||||||
FFMS_TYPE_DATA,
|
FFMS_TYPE_DATA,
|
||||||
FFMS_TYPE_SUBTITLE,
|
FFMS_TYPE_SUBTITLE,
|
||||||
FFMS_TYPE_ATTACHMENT,
|
FFMS_TYPE_ATTACHMENT
|
||||||
};
|
};
|
||||||
|
|
||||||
// This is a subset of the original AVFrame only containing the most used parts.
|
// This is a subset of the original AVFrame only containing the most used parts.
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
#include "ffswscale.h"
|
#include "ffswscale.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
PixelFormat CSNameToPIXFMT(const char * ACSName, PixelFormat ADefault) {
|
static PixelFormat CSNameToPIXFMT(const char * ACSName, PixelFormat ADefault) {
|
||||||
if (!_stricmp(ACSName, ""))
|
if (!_stricmp(ACSName, ""))
|
||||||
return ADefault;
|
return ADefault;
|
||||||
if (!_stricmp(ACSName, "YV12"))
|
if (!_stricmp(ACSName, "YV12"))
|
||||||
|
@ -35,7 +35,7 @@ PixelFormat CSNameToPIXFMT(const char * ACSName, PixelFormat ADefault) {
|
||||||
return PIX_FMT_NONE;
|
return PIX_FMT_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ResizerNameToSWSResizer(const char *AResizerName) {
|
static int ResizerNameToSWSResizer(const char *AResizerName) {
|
||||||
if (!_stricmp(AResizerName, "FAST_BILINEAR"))
|
if (!_stricmp(AResizerName, "FAST_BILINEAR"))
|
||||||
return SWS_FAST_BILINEAR;
|
return SWS_FAST_BILINEAR;
|
||||||
if (!_stricmp(AResizerName, "BILINEAR"))
|
if (!_stricmp(AResizerName, "BILINEAR"))
|
||||||
|
|
|
@ -44,7 +44,7 @@ extern "C" {
|
||||||
# include "guids.h"
|
# include "guids.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct FFVideo {
|
class FFVideo {
|
||||||
private:
|
private:
|
||||||
pp_context_t *PPContext;
|
pp_context_t *PPContext;
|
||||||
pp_mode_t *PPMode;
|
pp_mode_t *PPMode;
|
||||||
|
|
|
@ -346,9 +346,7 @@ FFIndex *FFHaaliIndexer::DoIndexing(const char *AudioFile, char *ErrorMsg, unsig
|
||||||
if (dbsize > 0 && (DumpMask & (1 << CurrentTrack))) {
|
if (dbsize > 0 && (DumpMask & (1 << CurrentTrack))) {
|
||||||
// Delay writer creation until after an audio frame has been decoded. This ensures that all parameters are known when writing the headers.
|
// Delay writer creation until after an audio frame has been decoded. This ensures that all parameters are known when writing the headers.
|
||||||
if (!AudioContexts[CurrentTrack].W64W) {
|
if (!AudioContexts[CurrentTrack].W64W) {
|
||||||
TAudioProperties AP;
|
|
||||||
AVCodecContext *CTX = AudioContexts[CurrentTrack].CTX;
|
AVCodecContext *CTX = AudioContexts[CurrentTrack].CTX;
|
||||||
AP.BitsPerSample = CTX->bits_per_coded_sample;
|
|
||||||
char ABuf[50];
|
char ABuf[50];
|
||||||
std::string WN(AudioFile);
|
std::string WN(AudioFile);
|
||||||
_snprintf(ABuf, sizeof(ABuf), ".%02d.delay.%d.w64", CurrentTrack, 0);
|
_snprintf(ABuf, sizeof(ABuf), ".%02d.delay.%d.w64", CurrentTrack, 0);
|
||||||
|
|
|
@ -324,9 +324,6 @@ int ReadFrame(uint64_t FilePos, unsigned int &FrameSize, CompressedStream *CS, M
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
FrameSize = 0;
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AudioFMTIsFloat(SampleFormat FMT){
|
bool AudioFMTIsFloat(SampleFormat FMT){
|
||||||
|
|
|
@ -58,7 +58,7 @@ struct TFrameInfo {
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
struct FFTrack : public std::vector<TFrameInfo> {
|
class FFTrack : public std::vector<TFrameInfo> {
|
||||||
public:
|
public:
|
||||||
FFMS_TrackType TT;
|
FFMS_TrackType TT;
|
||||||
TTrackTimeBase TB;
|
TTrackTimeBase TB;
|
||||||
|
@ -73,7 +73,7 @@ public:
|
||||||
FFTrack(int64_t Num, int64_t Den, FFMS_TrackType TT);
|
FFTrack(int64_t Num, int64_t Den, FFMS_TrackType TT);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct FFIndex : public std::vector<FFTrack> {
|
class FFIndex : public std::vector<FFTrack> {
|
||||||
public:
|
public:
|
||||||
int Decoder;
|
int Decoder;
|
||||||
int WriteIndex(const char *IndexFile, char *ErrorMsg, unsigned MsgSize);
|
int WriteIndex(const char *IndexFile, char *ErrorMsg, unsigned MsgSize);
|
||||||
|
|
Loading…
Reference in New Issue