forked from mia/Aegisub
Add option to set FFMS2 logging level (i.e. how much spam FFmpeg prints to STDERR).
Option is called "ffmpegsource log level" and possible values are (in order of increasing spam) quiet, panic, fatal, error, warning, info, verbose, debug. The default is quiet, and I strongly recommend avoiding anything above warning. Originally committed to SVN as r3248.
This commit is contained in:
parent
af6492d867
commit
f59dcf19f6
5 changed files with 46 additions and 0 deletions
|
@ -67,6 +67,8 @@ FFmpegSourceAudioProvider::FFmpegSourceAudioProvider(wxString filename) {
|
||||||
|
|
||||||
AudioSource = NULL;
|
AudioSource = NULL;
|
||||||
|
|
||||||
|
SetLogLevel();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
LoadAudio(filename);
|
LoadAudio(filename);
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
|
|
|
@ -106,6 +106,7 @@ FFIndex *FFmpegSourceProvider::DoIndexing(FFIndexer *Indexer, const wxString &Ca
|
||||||
return Index;
|
return Index;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///////////
|
///////////
|
||||||
// Find all tracks of the given typo and return their track numbers and respective codec names
|
// Find all tracks of the given typo and return their track numbers and respective codec names
|
||||||
std::map<int,wxString> FFmpegSourceProvider::GetTracksOfType(FFIndexer *Indexer, FFMS_TrackType Type) {
|
std::map<int,wxString> FFmpegSourceProvider::GetTracksOfType(FFIndexer *Indexer, FFMS_TrackType Type) {
|
||||||
|
@ -122,6 +123,7 @@ std::map<int,wxString> FFmpegSourceProvider::GetTracksOfType(FFIndexer *Indexer,
|
||||||
return TrackList;
|
return TrackList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///////////
|
///////////
|
||||||
// Ask user for which track he wants to load
|
// Ask user for which track he wants to load
|
||||||
int FFmpegSourceProvider::AskForTrackSelection(const std::map<int,wxString> &TrackList, FFMS_TrackType Type) {
|
int FFmpegSourceProvider::AskForTrackSelection(const std::map<int,wxString> &TrackList, FFMS_TrackType Type) {
|
||||||
|
@ -147,6 +149,31 @@ int FFmpegSourceProvider::AskForTrackSelection(const std::map<int,wxString> &Tra
|
||||||
return TrackNumbers[Choice];
|
return TrackNumbers[Choice];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///////////
|
||||||
|
// Set ffms2 log level according to setting in config.dat
|
||||||
|
void FFmpegSourceProvider::SetLogLevel() {
|
||||||
|
wxString LogLevel = Options.AsText(_T("FFmpegSource log level"));
|
||||||
|
|
||||||
|
if (!LogLevel.CmpNoCase(_T("panic")))
|
||||||
|
FFMS_SetLogLevel(FFMS_LOG_PANIC);
|
||||||
|
else if (!LogLevel.CmpNoCase(_T("fatal")))
|
||||||
|
FFMS_SetLogLevel(FFMS_LOG_FATAL);
|
||||||
|
else if (!LogLevel.CmpNoCase(_T("error")))
|
||||||
|
FFMS_SetLogLevel(FFMS_LOG_ERROR);
|
||||||
|
else if (!LogLevel.CmpNoCase(_T("warning")))
|
||||||
|
FFMS_SetLogLevel(FFMS_LOG_WARNING);
|
||||||
|
else if (!LogLevel.CmpNoCase(_T("info")))
|
||||||
|
FFMS_SetLogLevel(FFMS_LOG_INFO);
|
||||||
|
else if (!LogLevel.CmpNoCase(_T("verbose")))
|
||||||
|
FFMS_SetLogLevel(FFMS_LOG_VERBOSE);
|
||||||
|
else if (!LogLevel.CmpNoCase(_T("debug")))
|
||||||
|
FFMS_SetLogLevel(FFMS_LOG_DEBUG);
|
||||||
|
else
|
||||||
|
FFMS_SetLogLevel(FFMS_LOG_QUIET);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/////////////////////
|
/////////////////////
|
||||||
// Creates a name for the ffmpegsource2 index and prepares the folder if it doesn't exist
|
// Creates a name for the ffmpegsource2 index and prepares the folder if it doesn't exist
|
||||||
// method by amz
|
// method by amz
|
||||||
|
|
|
@ -52,6 +52,19 @@
|
||||||
class FFmpegSourceProvider {
|
class FFmpegSourceProvider {
|
||||||
friend class FFmpegSourceCacheCleaner;
|
friend class FFmpegSourceCacheCleaner;
|
||||||
public:
|
public:
|
||||||
|
// constants stolen from avutil/log.h
|
||||||
|
// hope the ffmpeg devs don't change them around too much
|
||||||
|
enum FFMS_LogLevel {
|
||||||
|
FFMS_LOG_QUIET = -8,
|
||||||
|
FFMS_LOG_PANIC = 0,
|
||||||
|
FFMS_LOG_FATAL = 8,
|
||||||
|
FFMS_LOG_ERROR = 16,
|
||||||
|
FFMS_LOG_WARNING = 24,
|
||||||
|
FFMS_LOG_INFO = 32,
|
||||||
|
FFMS_LOG_VERBOSE = 40,
|
||||||
|
FFMS_LOG_DEBUG = 48,
|
||||||
|
};
|
||||||
|
|
||||||
struct IndexingProgressDialog {
|
struct IndexingProgressDialog {
|
||||||
volatile bool IndexingCanceled;
|
volatile bool IndexingCanceled;
|
||||||
DialogProgress *ProgressDialog;
|
DialogProgress *ProgressDialog;
|
||||||
|
@ -66,6 +79,7 @@ public:
|
||||||
std::map<int,wxString> GetTracksOfType(FFIndexer *Indexer, FFMS_TrackType Type);
|
std::map<int,wxString> GetTracksOfType(FFIndexer *Indexer, FFMS_TrackType Type);
|
||||||
int AskForTrackSelection(const std::map<int,wxString>& TrackList, FFMS_TrackType Type);
|
int AskForTrackSelection(const std::map<int,wxString>& TrackList, FFMS_TrackType Type);
|
||||||
wxString GetCacheFilename(const wxString& filename);
|
wxString GetCacheFilename(const wxString& filename);
|
||||||
|
void SetLogLevel();
|
||||||
|
|
||||||
virtual ~FFmpegSourceProvider() {}
|
virtual ~FFmpegSourceProvider() {}
|
||||||
};
|
};
|
||||||
|
|
|
@ -176,6 +176,7 @@ void OptionsManager::LoadDefaults(bool onlyDefaults,bool doOverride) {
|
||||||
SetInt(_T("FFmpegSource max cache size"),42);
|
SetInt(_T("FFmpegSource max cache size"),42);
|
||||||
SetInt(_T("FFmpegSource max cache files"),20);
|
SetInt(_T("FFmpegSource max cache files"),20);
|
||||||
SetInt(_T("FFmpegSource always index all tracks"), true);
|
SetInt(_T("FFmpegSource always index all tracks"), true);
|
||||||
|
SetText(_T("FFmpegSource log level"), _T("quiet"));
|
||||||
|
|
||||||
// Audio Options
|
// Audio Options
|
||||||
SetModificationType(MOD_AUTOMATIC);
|
SetModificationType(MOD_AUTOMATIC);
|
||||||
|
|
|
@ -75,6 +75,8 @@ FFmpegSourceVideoProvider::FFmpegSourceVideoProvider(wxString filename) {
|
||||||
MsgSize = sizeof(FFMSErrMsg);
|
MsgSize = sizeof(FFMSErrMsg);
|
||||||
ErrorMsg = _T("FFmpegSource video provider: ");
|
ErrorMsg = _T("FFmpegSource video provider: ");
|
||||||
|
|
||||||
|
SetLogLevel();
|
||||||
|
|
||||||
// and here we go
|
// and here we go
|
||||||
try {
|
try {
|
||||||
LoadVideo(filename);
|
LoadVideo(filename);
|
||||||
|
|
Loading…
Reference in a new issue