forked from mia/Aegisub
Rework most of the various factories to not need an explicit helper class for each class constructable via a factory.
Originally committed to SVN as r4716.
This commit is contained in:
parent
f0aa85dfbb
commit
71fb04cd29
65 changed files with 276 additions and 1308 deletions
|
@ -495,10 +495,6 @@
|
||||||
RelativePath="..\..\src\audio_provider_hd.h"
|
RelativePath="..\..\src\audio_provider_hd.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath="..\..\src\audio_provider_manager.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\src\audio_provider_pcm.cpp"
|
RelativePath="..\..\src\audio_provider_pcm.cpp"
|
||||||
>
|
>
|
||||||
|
@ -1443,10 +1439,6 @@
|
||||||
RelativePath="..\..\src\spellchecker_hunspell.h"
|
RelativePath="..\..\src\spellchecker_hunspell.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath="..\..\src\spellchecker_manager.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\src\thesaurus.cpp"
|
RelativePath="..\..\src\thesaurus.cpp"
|
||||||
>
|
>
|
||||||
|
@ -1571,10 +1563,6 @@
|
||||||
RelativePath="..\..\src\subtitles_provider_libass.h"
|
RelativePath="..\..\src\subtitles_provider_libass.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath="..\..\src\subtitles_provider_manager.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter
|
<Filter
|
||||||
Name="Visual Tools"
|
Name="Visual Tools"
|
||||||
|
|
|
@ -34,9 +34,6 @@
|
||||||
/// @ingroup audio_ui
|
/// @ingroup audio_ui
|
||||||
///
|
///
|
||||||
|
|
||||||
|
|
||||||
///////////
|
|
||||||
// Headers
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#ifndef AGI_PRE
|
#ifndef AGI_PRE
|
||||||
|
@ -55,6 +52,7 @@
|
||||||
#include "audio_karaoke.h"
|
#include "audio_karaoke.h"
|
||||||
#include "frame_main.h"
|
#include "frame_main.h"
|
||||||
#include "hotkeys.h"
|
#include "hotkeys.h"
|
||||||
|
#include "include/aegisub/audio_player.h"
|
||||||
#include "libresrc/libresrc.h"
|
#include "libresrc/libresrc.h"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "toggle_bitmap.h"
|
#include "toggle_bitmap.h"
|
||||||
|
|
|
@ -57,6 +57,8 @@
|
||||||
#include "compat.h"
|
#include "compat.h"
|
||||||
#include "fft.h"
|
#include "fft.h"
|
||||||
#include "hotkeys.h"
|
#include "hotkeys.h"
|
||||||
|
#include "include/aegisub/audio_player.h"
|
||||||
|
#include "include/aegisub/audio_provider.h"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "standard_paths.h"
|
#include "standard_paths.h"
|
||||||
#include "subs_edit_box.h"
|
#include "subs_edit_box.h"
|
||||||
|
@ -895,14 +897,14 @@ void AudioDisplay::SetFile(wxString file) {
|
||||||
is_dummy = true;
|
is_dummy = true;
|
||||||
provider = new DummyAudioProvider(150*60*1000, true); // 150 minutes noise
|
provider = new DummyAudioProvider(150*60*1000, true); // 150 minutes noise
|
||||||
} else {
|
} else {
|
||||||
provider = AudioProviderFactoryManager::GetAudioProvider(file);
|
provider = AudioProviderFactory::GetProvider(file);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
provider = AudioProviderFactoryManager::GetAudioProvider(file);
|
provider = AudioProviderFactory::GetProvider(file);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Get player
|
// Get player
|
||||||
player = AudioPlayerFactoryManager::GetAudioPlayer();
|
player = AudioPlayerFactory::GetAudioPlayer();
|
||||||
player->SetDisplayTimer(&UpdateTimer);
|
player->SetDisplayTimer(&UpdateTimer);
|
||||||
player->SetProvider(provider);
|
player->SetProvider(provider);
|
||||||
player->OpenStream();
|
player->OpenStream();
|
||||||
|
|
|
@ -44,10 +44,10 @@
|
||||||
#include <wx/window.h>
|
#include <wx/window.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "audio_player_manager.h"
|
|
||||||
#include "audio_provider_manager.h"
|
|
||||||
#include "audio_renderer_spectrum.h"
|
#include "audio_renderer_spectrum.h"
|
||||||
|
|
||||||
|
class AudioPlayer;
|
||||||
|
class AudioProvider;
|
||||||
class AssDialogue;
|
class AssDialogue;
|
||||||
class SubtitlesGrid;
|
class SubtitlesGrid;
|
||||||
class AudioBox;
|
class AudioBox;
|
||||||
|
|
|
@ -34,9 +34,6 @@
|
||||||
/// @ingroup audio_output
|
/// @ingroup audio_output
|
||||||
///
|
///
|
||||||
|
|
||||||
|
|
||||||
///////////
|
|
||||||
// Headers
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#ifdef WITH_ALSA
|
#ifdef WITH_ALSA
|
||||||
|
@ -46,7 +43,6 @@
|
||||||
#include "audio_player_dsound.h"
|
#include "audio_player_dsound.h"
|
||||||
#include "audio_player_dsound2.h"
|
#include "audio_player_dsound2.h"
|
||||||
#endif
|
#endif
|
||||||
#include "audio_player_manager.h"
|
|
||||||
#ifdef WITH_OPENAL
|
#ifdef WITH_OPENAL
|
||||||
#include "audio_player_openal.h"
|
#include "audio_player_openal.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -62,8 +58,6 @@
|
||||||
#include "compat.h"
|
#include "compat.h"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Constructor
|
/// @brief Constructor
|
||||||
///
|
///
|
||||||
AudioPlayer::AudioPlayer() {
|
AudioPlayer::AudioPlayer() {
|
||||||
|
@ -71,8 +65,6 @@ AudioPlayer::AudioPlayer() {
|
||||||
displayTimer = NULL;
|
displayTimer = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Destructor
|
/// @brief Destructor
|
||||||
///
|
///
|
||||||
AudioPlayer::~AudioPlayer() {
|
AudioPlayer::~AudioPlayer() {
|
||||||
|
@ -82,44 +74,6 @@ AudioPlayer::~AudioPlayer() {
|
||||||
CloseStream();
|
CloseStream();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Set provider
|
|
||||||
/// @param _provider
|
|
||||||
///
|
|
||||||
void AudioPlayer::SetProvider(AudioProvider *_provider) {
|
|
||||||
provider = _provider;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Get provider
|
|
||||||
/// @return
|
|
||||||
///
|
|
||||||
AudioProvider *AudioPlayer::GetProvider() {
|
|
||||||
return provider;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Get mutex
|
|
||||||
/// @return
|
|
||||||
///
|
|
||||||
wxMutex *AudioPlayer::GetMutex() {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Set timer
|
|
||||||
/// @param timer
|
|
||||||
///
|
|
||||||
void AudioPlayer::SetDisplayTimer(wxTimer *timer) {
|
|
||||||
displayTimer = timer;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Ask to stop later
|
/// @brief Ask to stop later
|
||||||
///
|
///
|
||||||
void AudioPlayer::RequestStop() {
|
void AudioPlayer::RequestStop() {
|
||||||
|
@ -128,16 +82,12 @@ void AudioPlayer::RequestStop() {
|
||||||
AddPendingEvent(event); // thread safe
|
AddPendingEvent(event); // thread safe
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/////////
|
|
||||||
// Event
|
|
||||||
DEFINE_EVENT_TYPE(wxEVT_STOP_AUDIO)
|
DEFINE_EVENT_TYPE(wxEVT_STOP_AUDIO)
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(AudioPlayer, wxEvtHandler)
|
BEGIN_EVENT_TABLE(AudioPlayer, wxEvtHandler)
|
||||||
EVT_COMMAND (1000, wxEVT_STOP_AUDIO, AudioPlayer::OnStopAudio)
|
EVT_COMMAND (1000, wxEVT_STOP_AUDIO, AudioPlayer::OnStopAudio)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
|
||||||
/// @brief DOCME
|
/// @brief DOCME
|
||||||
/// @param event
|
/// @param event
|
||||||
///
|
///
|
||||||
|
@ -145,31 +95,23 @@ void AudioPlayer::OnStopAudio(wxCommandEvent &event) {
|
||||||
Stop(false);
|
Stop(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Get player
|
/// @brief Get player
|
||||||
/// @return
|
/// @return
|
||||||
///
|
///
|
||||||
AudioPlayer* AudioPlayerFactoryManager::GetAudioPlayer() {
|
AudioPlayer* AudioPlayerFactory::GetAudioPlayer() {
|
||||||
// List of providers
|
std::vector<std::string> list = GetClasses(OPT_GET("Audio/Player")->GetString());
|
||||||
wxArrayString list = GetFactoryList(lagi_wxString(OPT_GET("Audio/Player")->GetString()));
|
if (list.empty()) throw _T("No audio players are available.");
|
||||||
|
|
||||||
// None available
|
|
||||||
if (list.Count() == 0) throw _T("No audio players are available.");
|
|
||||||
|
|
||||||
// Get provider
|
|
||||||
wxString error;
|
wxString error;
|
||||||
for (unsigned int i=0;i<list.Count();i++) {
|
for (unsigned int i=0;i<list.size();i++) {
|
||||||
try {
|
try {
|
||||||
AudioPlayer *player = GetFactory(list[i])->CreatePlayer();
|
AudioPlayer *player = Create(list[i]);
|
||||||
if (player) return player;
|
if (player) return player;
|
||||||
}
|
}
|
||||||
catch (wxString err) { error += list[i] + _T(" factory: ") + err + _T("\n"); }
|
catch (wxString err) { error += list[i] + _T(" factory: ") + err + _T("\n"); }
|
||||||
catch (const wxChar *err) { error += list[i] + _T(" factory: ") + wxString(err) + _T("\n"); }
|
catch (const wxChar *err) { error += list[i] + _T(" factory: ") + wxString(err) + _T("\n"); }
|
||||||
catch (...) { error += list[i] + _T(" factory: Unknown error\n"); }
|
catch (...) { error += list[i] + _T(" factory: Unknown error\n"); }
|
||||||
}
|
}
|
||||||
|
|
||||||
// Failed
|
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -177,40 +119,26 @@ AudioPlayer* AudioPlayerFactoryManager::GetAudioPlayer() {
|
||||||
|
|
||||||
/// @brief Register all factories
|
/// @brief Register all factories
|
||||||
///
|
///
|
||||||
void AudioPlayerFactoryManager::RegisterProviders() {
|
void AudioPlayerFactory::RegisterProviders() {
|
||||||
#ifdef WITH_ALSA
|
#ifdef WITH_ALSA
|
||||||
RegisterFactory(new AlsaPlayerFactory(),_T("ALSA"));
|
Register<AlsaPlayer>("ALSA");
|
||||||
#endif
|
#endif
|
||||||
#ifdef WITH_DIRECTSOUND
|
#ifdef WITH_DIRECTSOUND
|
||||||
RegisterFactory(new DirectSoundPlayerFactory(),_T("DirectSound-old"));
|
Register<DirectSoundPlayer>("DirectSound-old");
|
||||||
RegisterFactory(new DirectSoundPlayer2Factory(),_T("DirectSound"));
|
Register<DirectSoundPlayer2>("DirectSound");
|
||||||
#endif
|
#endif
|
||||||
#ifdef WITH_OPENAL
|
#ifdef WITH_OPENAL
|
||||||
RegisterFactory(new OpenALPlayerFactory(),_T("OpenAL"));
|
Register<OpenALPlayer>("OpenAL");
|
||||||
#endif
|
#endif
|
||||||
#ifdef WITH_PORTAUDIO
|
#ifdef WITH_PORTAUDIO
|
||||||
RegisterFactory(new PortAudioPlayerFactory(),_T("PortAudio"));
|
Register<PortAudioPlayer>("PortAudio");
|
||||||
#endif
|
#endif
|
||||||
#ifdef WITH_PULSEAUDIO
|
#ifdef WITH_PULSEAUDIO
|
||||||
RegisterFactory(new PulseAudioPlayerFactory(),_T("PulseAudio"));
|
Register<PulseAudioPlayer>("PulseAudio");
|
||||||
#endif
|
#endif
|
||||||
#ifdef WITH_OSS
|
#ifdef WITH_OSS
|
||||||
RegisterFactory(new OSSPlayerFactory(),_T("OSS"));
|
Register<OSSPlayer>("OSS");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<> AudioPlayerFactory::map *FactoryBase<AudioPlayer *(*)()>::classes = NULL;
|
||||||
|
|
||||||
/// @brief Clear all factories
|
|
||||||
///
|
|
||||||
void AudioPlayerFactoryManager::ClearProviders() {
|
|
||||||
ClearFactories();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// DOCME
|
|
||||||
template <class AudioPlayerFactory> std::map<wxString,AudioPlayerFactory*>* FactoryManager<AudioPlayerFactory>::factories=NULL;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -40,14 +40,9 @@
|
||||||
|
|
||||||
#ifdef WITH_ALSA
|
#ifdef WITH_ALSA
|
||||||
|
|
||||||
|
|
||||||
///////////
|
|
||||||
// Headers
|
|
||||||
#include <libaegisub/log.h>
|
#include <libaegisub/log.h>
|
||||||
|
|
||||||
#include "audio_player_alsa.h"
|
#include "audio_player_alsa.h"
|
||||||
#include "audio_player_manager.h"
|
|
||||||
#include "audio_provider_manager.h"
|
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "compat.h"
|
#include "compat.h"
|
||||||
#include "frame_main.h"
|
#include "frame_main.h"
|
||||||
|
@ -65,8 +60,6 @@ AlsaPlayer::AlsaPlayer()
|
||||||
provider = 0;
|
provider = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Destructor
|
/// @brief Destructor
|
||||||
///
|
///
|
||||||
AlsaPlayer::~AlsaPlayer()
|
AlsaPlayer::~AlsaPlayer()
|
||||||
|
@ -74,8 +67,6 @@ AlsaPlayer::~AlsaPlayer()
|
||||||
CloseStream();
|
CloseStream();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Open stream
|
/// @brief Open stream
|
||||||
///
|
///
|
||||||
void AlsaPlayer::OpenStream()
|
void AlsaPlayer::OpenStream()
|
||||||
|
@ -105,8 +96,6 @@ void AlsaPlayer::OpenStream()
|
||||||
open = true;
|
open = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief DOCME
|
/// @brief DOCME
|
||||||
///
|
///
|
||||||
void AlsaPlayer::SetUpHardware()
|
void AlsaPlayer::SetUpHardware()
|
||||||
|
@ -202,8 +191,6 @@ void AlsaPlayer::SetUpHardware()
|
||||||
snd_pcm_hw_params_free(hwparams);
|
snd_pcm_hw_params_free(hwparams);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief DOCME
|
/// @brief DOCME
|
||||||
///
|
///
|
||||||
void AlsaPlayer::SetUpAsync()
|
void AlsaPlayer::SetUpAsync()
|
||||||
|
@ -249,8 +236,6 @@ void AlsaPlayer::SetUpAsync()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Close stream
|
/// @brief Close stream
|
||||||
/// @return
|
/// @return
|
||||||
///
|
///
|
||||||
|
@ -270,8 +255,6 @@ void AlsaPlayer::CloseStream()
|
||||||
open = false;
|
open = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Play
|
/// @brief Play
|
||||||
/// @param start
|
/// @param start
|
||||||
/// @param count
|
/// @param count
|
||||||
|
@ -301,8 +284,6 @@ void AlsaPlayer::Play(int64_t start,int64_t count)
|
||||||
if (displayTimer && !displayTimer->IsRunning()) displayTimer->Start(15);
|
if (displayTimer && !displayTimer->IsRunning()) displayTimer->Start(15);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Stop
|
/// @brief Stop
|
||||||
/// @param timerToo
|
/// @param timerToo
|
||||||
/// @return
|
/// @return
|
||||||
|
@ -326,8 +307,6 @@ void AlsaPlayer::Stop(bool timerToo)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief DOCME
|
/// @brief DOCME
|
||||||
/// @return
|
/// @return
|
||||||
///
|
///
|
||||||
|
@ -336,8 +315,6 @@ bool AlsaPlayer::IsPlaying()
|
||||||
return playing;
|
return playing;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Set end
|
/// @brief Set end
|
||||||
/// @param pos
|
/// @param pos
|
||||||
///
|
///
|
||||||
|
@ -346,8 +323,6 @@ void AlsaPlayer::SetEndPosition(int64_t pos)
|
||||||
end_frame = pos;
|
end_frame = pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Set current position
|
/// @brief Set current position
|
||||||
/// @param pos
|
/// @param pos
|
||||||
///
|
///
|
||||||
|
@ -356,8 +331,6 @@ void AlsaPlayer::SetCurrentPosition(int64_t pos)
|
||||||
cur_frame = pos;
|
cur_frame = pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief DOCME
|
/// @brief DOCME
|
||||||
/// @return
|
/// @return
|
||||||
///
|
///
|
||||||
|
@ -366,8 +339,6 @@ int64_t AlsaPlayer::GetStartPosition()
|
||||||
return start_frame;
|
return start_frame;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief DOCME
|
/// @brief DOCME
|
||||||
/// @return
|
/// @return
|
||||||
///
|
///
|
||||||
|
@ -376,8 +347,6 @@ int64_t AlsaPlayer::GetEndPosition()
|
||||||
return end_frame;
|
return end_frame;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Get current position
|
/// @brief Get current position
|
||||||
/// @return
|
/// @return
|
||||||
///
|
///
|
||||||
|
@ -390,8 +359,6 @@ int64_t AlsaPlayer::GetCurrentPosition()
|
||||||
return cur_frame - delay;
|
return cur_frame - delay;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief DOCME
|
/// @brief DOCME
|
||||||
/// @param pcm_callback
|
/// @param pcm_callback
|
||||||
///
|
///
|
||||||
|
@ -439,7 +406,4 @@ void AlsaPlayer::async_write_handler(snd_async_handler_t *pcm_callback)
|
||||||
free(buf);
|
free(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif // WITH_ALSA
|
#endif // WITH_ALSA
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -37,9 +37,6 @@
|
||||||
|
|
||||||
#ifdef WITH_ALSA
|
#ifdef WITH_ALSA
|
||||||
|
|
||||||
|
|
||||||
///////////
|
|
||||||
// Headers
|
|
||||||
#include <alsa/asoundlib.h>
|
#include <alsa/asoundlib.h>
|
||||||
|
|
||||||
#include "include/aegisub/audio_player.h"
|
#include "include/aegisub/audio_player.h"
|
||||||
|
@ -148,22 +145,4 @@ public:
|
||||||
double GetVolume() { return volume; }
|
double GetVolume() { return volume; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// DOCME
|
|
||||||
/// @class AlsaPlayerFactory
|
|
||||||
/// @brief DOCME
|
|
||||||
///
|
|
||||||
/// DOCME
|
|
||||||
class AlsaPlayerFactory : public AudioPlayerFactory {
|
|
||||||
public:
|
|
||||||
|
|
||||||
/// @brief DOCME
|
|
||||||
///
|
|
||||||
AudioPlayer *CreatePlayer() { return new AlsaPlayer(); }
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -183,25 +183,5 @@ public:
|
||||||
/// @return
|
/// @return
|
||||||
///
|
///
|
||||||
double GetVolume() { return volume; }
|
double GetVolume() { return volume; }
|
||||||
|
|
||||||
//wxMutex *GetMutex() { return &DSMutex; }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// DOCME
|
|
||||||
/// @class DirectSoundPlayerFactory
|
|
||||||
/// @brief DOCME
|
|
||||||
///
|
|
||||||
/// DOCME
|
|
||||||
class DirectSoundPlayerFactory : public AudioPlayerFactory {
|
|
||||||
public:
|
|
||||||
|
|
||||||
/// @brief DOCME
|
|
||||||
///
|
|
||||||
AudioPlayer *CreatePlayer() { return new DirectSoundPlayer(); }
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -34,15 +34,12 @@
|
||||||
/// @ingroup audio_output
|
/// @ingroup audio_output
|
||||||
///
|
///
|
||||||
|
|
||||||
|
|
||||||
#ifdef WITH_DIRECTSOUND
|
#ifdef WITH_DIRECTSOUND
|
||||||
|
|
||||||
#include "include/aegisub/audio_player.h"
|
#include "include/aegisub/audio_player.h"
|
||||||
|
|
||||||
|
|
||||||
class DirectSoundPlayer2Thread;
|
class DirectSoundPlayer2Thread;
|
||||||
|
|
||||||
|
|
||||||
/// @class DirectSoundPlayer2
|
/// @class DirectSoundPlayer2
|
||||||
/// @brief New implementation of DirectSound-based audio player
|
/// @brief New implementation of DirectSound-based audio player
|
||||||
///
|
///
|
||||||
|
@ -50,7 +47,6 @@ class DirectSoundPlayer2Thread;
|
||||||
/// and performs all playback operations, and use the player object as a proxy to
|
/// and performs all playback operations, and use the player object as a proxy to
|
||||||
/// send commands to the playback thread.
|
/// send commands to the playback thread.
|
||||||
class DirectSoundPlayer2 : public AudioPlayer {
|
class DirectSoundPlayer2 : public AudioPlayer {
|
||||||
|
|
||||||
/// The playback thread
|
/// The playback thread
|
||||||
DirectSoundPlayer2Thread *thread;
|
DirectSoundPlayer2Thread *thread;
|
||||||
|
|
||||||
|
@ -86,18 +82,4 @@ public:
|
||||||
void SetVolume(double vol);
|
void SetVolume(double vol);
|
||||||
double GetVolume();
|
double GetVolume();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @class DirectSoundPlayer2Factory
|
|
||||||
/// @brief Factory class for DirectSoundPlayer2
|
|
||||||
class DirectSoundPlayer2Factory : public AudioPlayerFactory {
|
|
||||||
public:
|
|
||||||
|
|
||||||
/// @brief Create a DirectSoundPlayer2 object
|
|
||||||
AudioPlayer *CreatePlayer() { return new DirectSoundPlayer2(); }
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,81 +0,0 @@
|
||||||
// Copyright (c) 2005-2007, Rodrigo Braz Monteiro
|
|
||||||
// All rights reserved.
|
|
||||||
//
|
|
||||||
// Redistribution and use in source and binary forms, with or without
|
|
||||||
// modification, are permitted provided that the following conditions are met:
|
|
||||||
//
|
|
||||||
// * Redistributions of source code must retain the above copyright notice,
|
|
||||||
// this list of conditions and the following disclaimer.
|
|
||||||
// * Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
// this list of conditions and the following disclaimer in the documentation
|
|
||||||
// and/or other materials provided with the distribution.
|
|
||||||
// * Neither the name of the Aegisub Group nor the names of its contributors
|
|
||||||
// may be used to endorse or promote products derived from this software
|
|
||||||
// without specific prior written permission.
|
|
||||||
//
|
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
|
||||||
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
||||||
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
||||||
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
||||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
||||||
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
||||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
// POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
//
|
|
||||||
// Aegisub Project http://www.aegisub.org/
|
|
||||||
//
|
|
||||||
// $Id$
|
|
||||||
|
|
||||||
/// @file audio_player_manager.h
|
|
||||||
/// @brief Manage available audio output implementations
|
|
||||||
/// @ingroup audio_output
|
|
||||||
///
|
|
||||||
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
|
|
||||||
///////////
|
|
||||||
// Headers
|
|
||||||
#ifndef AGI_PRE
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
#include <wx/event.h>
|
|
||||||
#include <wx/thread.h>
|
|
||||||
#include <wx/timer.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "factory_manager.h"
|
|
||||||
#include "include/aegisub/audio_player.h"
|
|
||||||
|
|
||||||
|
|
||||||
//////////////
|
|
||||||
// Prototypes
|
|
||||||
class AudioProvider;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// DOCME
|
|
||||||
/// @class AudioPlayerFactoryManager
|
|
||||||
/// @brief DOCME
|
|
||||||
///
|
|
||||||
/// DOCME
|
|
||||||
class AudioPlayerFactoryManager : public FactoryManager<AudioPlayerFactory> {
|
|
||||||
public:
|
|
||||||
static AudioPlayer *GetAudioPlayer();
|
|
||||||
static void RegisterProviders();
|
|
||||||
static void ClearProviders();
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/////////
|
|
||||||
// Event
|
|
||||||
DECLARE_EVENT_TYPE(wxEVT_STOP_AUDIO, -1)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -34,19 +34,13 @@
|
||||||
/// @ingroup audio_output
|
/// @ingroup audio_output
|
||||||
///
|
///
|
||||||
|
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#ifdef WITH_OPENAL
|
#ifdef WITH_OPENAL
|
||||||
|
|
||||||
|
|
||||||
///////////
|
|
||||||
// Headers
|
|
||||||
#include <libaegisub/log.h>
|
#include <libaegisub/log.h>
|
||||||
|
|
||||||
#include "audio_player_manager.h"
|
|
||||||
#include "audio_player_openal.h"
|
#include "audio_player_openal.h"
|
||||||
#include "audio_provider_manager.h"
|
|
||||||
#include "frame_main.h"
|
#include "frame_main.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
|
@ -61,14 +55,11 @@
|
||||||
#include <AL/alc.h>
|
#include <AL/alc.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// Auto-link to OpenAL lib for MSVC
|
// Auto-link to OpenAL lib for MSVC
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#pragma comment(lib, "openal32.lib")
|
#pragma comment(lib, "openal32.lib")
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Constructor
|
/// @brief Constructor
|
||||||
///
|
///
|
||||||
OpenALPlayer::OpenALPlayer()
|
OpenALPlayer::OpenALPlayer()
|
||||||
|
@ -80,8 +71,6 @@ OpenALPlayer::OpenALPlayer()
|
||||||
provider = 0;
|
provider = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Destructor
|
/// @brief Destructor
|
||||||
///
|
///
|
||||||
OpenALPlayer::~OpenALPlayer()
|
OpenALPlayer::~OpenALPlayer()
|
||||||
|
@ -375,6 +364,3 @@ int64_t OpenALPlayer::GetCurrentPosition()
|
||||||
|
|
||||||
|
|
||||||
#endif // WITH_OPENAL
|
#endif // WITH_OPENAL
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -36,11 +36,6 @@
|
||||||
|
|
||||||
|
|
||||||
#ifdef WITH_OPENAL
|
#ifdef WITH_OPENAL
|
||||||
|
|
||||||
|
|
||||||
///////////
|
|
||||||
// Headers
|
|
||||||
#include "audio_player_manager.h"
|
|
||||||
#include "include/aegisub/audio_player.h"
|
#include "include/aegisub/audio_player.h"
|
||||||
#include "include/aegisub/audio_provider.h"
|
#include "include/aegisub/audio_provider.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
@ -56,8 +51,6 @@
|
||||||
#include <AL/alc.h>
|
#include <AL/alc.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// DOCME
|
/// DOCME
|
||||||
/// @class OpenALPlayer
|
/// @class OpenALPlayer
|
||||||
/// @brief DOCME
|
/// @brief DOCME
|
||||||
|
@ -164,23 +157,4 @@ public:
|
||||||
///
|
///
|
||||||
double GetVolume() { return volume; }
|
double GetVolume() { return volume; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// DOCME
|
|
||||||
/// @class OpenALPlayerFactory
|
|
||||||
/// @brief DOCME
|
|
||||||
///
|
|
||||||
/// DOCME
|
|
||||||
class OpenALPlayerFactory : public AudioPlayerFactory {
|
|
||||||
public:
|
|
||||||
|
|
||||||
/// @brief DOCME
|
|
||||||
///
|
|
||||||
AudioPlayer *CreatePlayer() { return new OpenALPlayer(); }
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -37,13 +37,9 @@
|
||||||
|
|
||||||
#ifdef WITH_OSS
|
#ifdef WITH_OSS
|
||||||
|
|
||||||
///////////
|
|
||||||
// Headers
|
|
||||||
#include <libaegisub/log.h>
|
#include <libaegisub/log.h>
|
||||||
|
|
||||||
#include "audio_player_manager.h"
|
|
||||||
#include "audio_player_oss.h"
|
#include "audio_player_oss.h"
|
||||||
#include "audio_provider_manager.h"
|
|
||||||
#include "frame_main.h"
|
#include "frame_main.h"
|
||||||
#include "compat.h"
|
#include "compat.h"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
|
|
|
@ -37,10 +37,6 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#ifdef WITH_OSS
|
#ifdef WITH_OSS
|
||||||
|
|
||||||
|
|
||||||
///////////
|
|
||||||
// Headers
|
|
||||||
#ifndef AGI_PRE
|
#ifndef AGI_PRE
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -58,13 +54,8 @@
|
||||||
#include "include/aegisub/audio_provider.h"
|
#include "include/aegisub/audio_provider.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
|
|
||||||
//////////////
|
|
||||||
// Prototypes
|
|
||||||
class OSSPlayer;
|
class OSSPlayer;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// DOCME
|
/// DOCME
|
||||||
/// @class OSSPlayerThread
|
/// @class OSSPlayerThread
|
||||||
/// @brief DOCME
|
/// @brief DOCME
|
||||||
|
@ -153,21 +144,4 @@ public:
|
||||||
///
|
///
|
||||||
double GetVolume() { return volume; }
|
double GetVolume() { return volume; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// DOCME
|
|
||||||
/// @class OSSPlayerFactory
|
|
||||||
/// @brief DOCME
|
|
||||||
///
|
|
||||||
/// DOCME
|
|
||||||
class OSSPlayerFactory : public AudioPlayerFactory {
|
|
||||||
public:
|
|
||||||
|
|
||||||
/// @brief DOCME
|
|
||||||
///
|
|
||||||
AudioPlayer *CreatePlayer() { return new OSSPlayer(); }
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -37,9 +37,6 @@
|
||||||
|
|
||||||
#ifdef WITH_PORTAUDIO
|
#ifdef WITH_PORTAUDIO
|
||||||
|
|
||||||
|
|
||||||
///////////
|
|
||||||
// Headers
|
|
||||||
#include "include/aegisub/audio_player.h"
|
#include "include/aegisub/audio_player.h"
|
||||||
#include "include/aegisub/audio_provider.h"
|
#include "include/aegisub/audio_provider.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
@ -47,7 +44,6 @@ extern "C" {
|
||||||
#include <portaudio.h>
|
#include <portaudio.h>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// @class PortAudioPlayer
|
/// @class PortAudioPlayer
|
||||||
/// @brief PortAudio Player
|
/// @brief PortAudio Player
|
||||||
///
|
///
|
||||||
|
@ -126,16 +122,4 @@ public:
|
||||||
|
|
||||||
wxArrayString GetOutputDevices(wxString favorite);
|
wxArrayString GetOutputDevices(wxString favorite);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/// @class PortAudioPlayerFactory
|
|
||||||
/// @brief PortAudio Player Factory
|
|
||||||
class PortAudioPlayerFactory : public AudioPlayerFactory {
|
|
||||||
public:
|
|
||||||
|
|
||||||
/// @brief Create player
|
|
||||||
/// @return New PortAudio Player
|
|
||||||
AudioPlayer *CreatePlayer() { return new PortAudioPlayer(); }
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif //ifdef WITH_PORTAUDIO
|
#endif //ifdef WITH_PORTAUDIO
|
||||||
|
|
|
@ -34,20 +34,15 @@
|
||||||
/// @ingroup audio_output
|
/// @ingroup audio_output
|
||||||
///
|
///
|
||||||
|
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#ifdef WITH_PULSEAUDIO
|
#ifdef WITH_PULSEAUDIO
|
||||||
|
|
||||||
|
|
||||||
///////////
|
|
||||||
// Headers
|
|
||||||
#ifndef AGI_PRE
|
#ifndef AGI_PRE
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "audio_player_pulse.h"
|
#include "audio_player_pulse.h"
|
||||||
#include "audio_provider_manager.h"
|
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -451,7 +446,4 @@ void PulseAudioPlayer::pa_stream_notify(pa_stream *p, PulseAudioPlayer *thread)
|
||||||
thread->stream_notify.Post();
|
thread->stream_notify.Post();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif // WITH_PULSEAUDIO
|
#endif // WITH_PULSEAUDIO
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -34,12 +34,7 @@
|
||||||
/// @ingroup audio_output
|
/// @ingroup audio_output
|
||||||
///
|
///
|
||||||
|
|
||||||
|
|
||||||
#ifdef WITH_PULSEAUDIO
|
#ifdef WITH_PULSEAUDIO
|
||||||
|
|
||||||
|
|
||||||
///////////
|
|
||||||
// Headers
|
|
||||||
#ifndef AGI_PRE
|
#ifndef AGI_PRE
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -50,14 +45,8 @@
|
||||||
#include "include/aegisub/audio_provider.h"
|
#include "include/aegisub/audio_provider.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
|
|
||||||
//////////////
|
|
||||||
// Prototypes
|
|
||||||
class PulseAudioPlayer;
|
class PulseAudioPlayer;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// DOCME
|
/// DOCME
|
||||||
/// @class PulseAudioPlayer
|
/// @class PulseAudioPlayer
|
||||||
/// @brief DOCME
|
/// @brief DOCME
|
||||||
|
@ -170,22 +159,4 @@ public:
|
||||||
double GetVolume() { return volume; }
|
double GetVolume() { return volume; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// DOCME
|
|
||||||
/// @class PulseAudioPlayerFactory
|
|
||||||
/// @brief DOCME
|
|
||||||
///
|
|
||||||
/// DOCME
|
|
||||||
class PulseAudioPlayerFactory : public AudioPlayerFactory {
|
|
||||||
public:
|
|
||||||
|
|
||||||
/// @brief DOCME
|
|
||||||
///
|
|
||||||
AudioPlayer *CreatePlayer() { return new PulseAudioPlayer(); }
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -35,15 +35,12 @@
|
||||||
///
|
///
|
||||||
|
|
||||||
|
|
||||||
///////////
|
|
||||||
// Headers
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#ifndef AGI_PRE
|
#ifndef AGI_PRE
|
||||||
#include <wx/thread.h>
|
#include <wx/thread.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "audio_display.h"
|
|
||||||
#ifdef WITH_AVISYNTH
|
#ifdef WITH_AVISYNTH
|
||||||
#include "audio_provider_avs.h"
|
#include "audio_provider_avs.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -57,71 +54,17 @@
|
||||||
#include "compat.h"
|
#include "compat.h"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Constructor
|
/// @brief Constructor
|
||||||
///
|
///
|
||||||
AudioProvider::AudioProvider() {
|
AudioProvider::AudioProvider() : raw(NULL) {
|
||||||
raw = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Destructor
|
/// @brief Destructor
|
||||||
///
|
///
|
||||||
AudioProvider::~AudioProvider() {
|
AudioProvider::~AudioProvider() {
|
||||||
// Clear buffers
|
|
||||||
delete[] raw;
|
delete[] raw;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Get number of channels
|
|
||||||
/// @return
|
|
||||||
///
|
|
||||||
int AudioProvider::GetChannels() {
|
|
||||||
return channels;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Get number of samples
|
|
||||||
/// @return
|
|
||||||
///
|
|
||||||
int64_t AudioProvider::GetNumSamples() {
|
|
||||||
return num_samples;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Get sample rate
|
|
||||||
/// @return
|
|
||||||
///
|
|
||||||
int AudioProvider::GetSampleRate() {
|
|
||||||
return sample_rate;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Get bytes per sample
|
|
||||||
/// @return
|
|
||||||
///
|
|
||||||
int AudioProvider::GetBytesPerSample() {
|
|
||||||
return bytes_per_sample;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Get filename
|
|
||||||
/// @return
|
|
||||||
///
|
|
||||||
wxString AudioProvider::GetFilename() {
|
|
||||||
return filename;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Get waveform
|
/// @brief Get waveform
|
||||||
/// @param min
|
/// @param min
|
||||||
/// @param peak
|
/// @param peak
|
||||||
|
@ -193,8 +136,6 @@ void AudioProvider::GetWaveForm(int *min,int *peak,int64_t start,int w,int h,int
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Get audio with volume
|
/// @brief Get audio with volume
|
||||||
/// @param buf
|
/// @param buf
|
||||||
/// @param start
|
/// @param start
|
||||||
|
@ -230,15 +171,12 @@ void AudioProvider::GetAudioWithVolume(void *buf, int64_t start, int64_t count,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Get provider
|
/// @brief Get provider
|
||||||
/// @param filename
|
/// @param filename
|
||||||
/// @param cache
|
/// @param cache
|
||||||
/// @return
|
/// @return
|
||||||
///
|
///
|
||||||
AudioProvider *AudioProviderFactoryManager::GetAudioProvider(wxString filename, int cache) {
|
AudioProvider *AudioProviderFactory::GetProvider(wxString filename, int cache) {
|
||||||
// Prepare provider
|
|
||||||
AudioProvider *provider = NULL;
|
AudioProvider *provider = NULL;
|
||||||
|
|
||||||
if (!OPT_GET("Provider/Audio/PCM/Disable")->GetBool()) {
|
if (!OPT_GET("Provider/Audio/PCM/Disable")->GetBool()) {
|
||||||
|
@ -248,27 +186,22 @@ AudioProvider *AudioProviderFactoryManager::GetAudioProvider(wxString filename,
|
||||||
if (provider->GetBytesPerSample() == 2 && provider->GetSampleRate() >= 32000 && provider->GetChannels() == 1)
|
if (provider->GetBytesPerSample() == 2 && provider->GetSampleRate() >= 32000 && provider->GetChannels() == 1)
|
||||||
return provider;
|
return provider;
|
||||||
else {
|
else {
|
||||||
provider = CreateConvertAudioProvider(provider);
|
return CreateConvertAudioProvider(provider);
|
||||||
return provider;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// List of providers
|
// List of providers
|
||||||
wxArrayString list = GetFactoryList(lagi_wxString(OPT_GET("Audio/Provider")->GetString()));
|
std::vector<std::string> list = GetClasses(OPT_GET("Audio/Provider")->GetString());
|
||||||
|
|
||||||
// None available
|
if (list.empty()) throw _T("No audio providers are available.");
|
||||||
if (list.Count() == 0) throw _T("No audio providers are available.");
|
|
||||||
|
|
||||||
// Get provider
|
// Get provider
|
||||||
wxString error;
|
wxString error;
|
||||||
for (unsigned int i=0;i<list.Count();i++) {
|
for (unsigned int i=0;i<list.size();i++) {
|
||||||
try {
|
try {
|
||||||
AudioProvider *prov = GetFactory(list[i])->CreateProvider(filename.wc_str());
|
provider = Create(list[i], filename);
|
||||||
if (prov) {
|
if (provider) break;
|
||||||
provider = prov;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (wxString err) { error += list[i] + _T(" factory: ") + err + _T("\n"); }
|
catch (wxString err) { error += list[i] + _T(" factory: ") + err + _T("\n"); }
|
||||||
catch (const wxChar *err) { error += list[i] + _T(" factory: ") + wxString(err) + _T("\n"); }
|
catch (const wxChar *err) { error += list[i] + _T(" factory: ") + wxString(err) + _T("\n"); }
|
||||||
|
@ -296,11 +229,10 @@ AudioProvider *AudioProviderFactoryManager::GetAudioProvider(wxString filename,
|
||||||
// Reassign
|
// Reassign
|
||||||
if (final) {
|
if (final) {
|
||||||
delete provider;
|
delete provider;
|
||||||
provider = final;
|
return final;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return
|
|
||||||
return provider;
|
return provider;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -308,26 +240,13 @@ AudioProvider *AudioProviderFactoryManager::GetAudioProvider(wxString filename,
|
||||||
|
|
||||||
/// @brief Register all providers
|
/// @brief Register all providers
|
||||||
///
|
///
|
||||||
void AudioProviderFactoryManager::RegisterProviders() {
|
void AudioProviderFactory::RegisterProviders() {
|
||||||
#ifdef WITH_AVISYNTH
|
#ifdef WITH_AVISYNTH
|
||||||
RegisterFactory(new AvisynthAudioProviderFactory(),_T("Avisynth"));
|
Register<AvisynthAudioProvider>("Avisynth");
|
||||||
#endif
|
#endif
|
||||||
#ifdef WITH_FFMPEGSOURCE
|
#ifdef WITH_FFMPEGSOURCE
|
||||||
RegisterFactory(new FFmpegSourceAudioProviderFactory(),_T("FFmpegSource"));
|
Register<FFmpegSourceAudioProvider>("FFmpegSource");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<> AudioProviderFactory::map *FactoryBase<AudioProvider *(*)(wxString)>::classes = NULL;
|
||||||
|
|
||||||
/// @brief Clear all providers
|
|
||||||
///
|
|
||||||
void AudioProviderFactoryManager::ClearProviders() {
|
|
||||||
ClearFactories();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// DOCME
|
|
||||||
template <class AudioProviderFactory> std::map<wxString,AudioProviderFactory*>* FactoryManager<AudioProviderFactory>::factories=NULL;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -34,9 +34,6 @@
|
||||||
/// @ingroup audio_input
|
/// @ingroup audio_input
|
||||||
///
|
///
|
||||||
|
|
||||||
|
|
||||||
///////////
|
|
||||||
// Headers
|
|
||||||
#ifdef WITH_AVISYNTH
|
#ifdef WITH_AVISYNTH
|
||||||
#include <Mmreg.h>
|
#include <Mmreg.h>
|
||||||
#include "include/aegisub/audio_provider.h"
|
#include "include/aegisub/audio_provider.h"
|
||||||
|
@ -69,31 +66,12 @@ public:
|
||||||
wxString GetFilename();
|
wxString GetFilename();
|
||||||
|
|
||||||
|
|
||||||
/// @brief // Only exists for x86 Windows, always delivers machine (little) endian
|
/// @brief Only exists for x86 Windows, always delivers machine (little) endian
|
||||||
/// @return
|
/// @return
|
||||||
///
|
///
|
||||||
bool AreSamplesNativeEndian() { return true; }
|
bool AreSamplesNativeEndian() const { return true; }
|
||||||
|
|
||||||
void GetAudio(void *buf, int64_t start, int64_t count);
|
void GetAudio(void *buf, int64_t start, int64_t count);
|
||||||
void GetWaveForm(int *min,int *peak,int64_t start,int w,int h,int samples,float scale);
|
void GetWaveForm(int *min,int *peak,int64_t start,int w,int h,int samples,float scale);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// DOCME
|
|
||||||
/// @class AvisynthAudioProviderFactory
|
|
||||||
/// @brief DOCME
|
|
||||||
///
|
|
||||||
/// DOCME
|
|
||||||
class AvisynthAudioProviderFactory : public AudioProviderFactory {
|
|
||||||
public:
|
|
||||||
|
|
||||||
/// @brief DOCME
|
|
||||||
/// @param file
|
|
||||||
///
|
|
||||||
AudioProvider *CreateProvider(wxString file) { return new AvisynthAudioProvider(file); }
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -34,9 +34,6 @@
|
||||||
/// @ingroup audio_input
|
/// @ingroup audio_input
|
||||||
///
|
///
|
||||||
|
|
||||||
|
|
||||||
///////////
|
|
||||||
// Headers
|
|
||||||
#include "include/aegisub/audio_provider.h"
|
#include "include/aegisub/audio_provider.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -66,7 +63,7 @@ public:
|
||||||
/// @brief // That's one of the points of it! // By its nature, the ConvertAudioProvider always delivers machine endian:
|
/// @brief // That's one of the points of it! // By its nature, the ConvertAudioProvider always delivers machine endian:
|
||||||
/// @return
|
/// @return
|
||||||
///
|
///
|
||||||
bool AreSamplesNativeEndian() { return true; }
|
bool AreSamplesNativeEndian() const { return true; }
|
||||||
|
|
||||||
void GetAudio(void *buf, int64_t start, int64_t count);
|
void GetAudio(void *buf, int64_t start, int64_t count);
|
||||||
|
|
||||||
|
@ -76,6 +73,3 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
AudioProvider *CreateConvertAudioProvider(AudioProvider *source_provider);
|
AudioProvider *CreateConvertAudioProvider(AudioProvider *source_provider);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -59,11 +59,7 @@ public:
|
||||||
|
|
||||||
/// @brief // Downmixing requires samples to be native endian beforehand
|
/// @brief // Downmixing requires samples to be native endian beforehand
|
||||||
///
|
///
|
||||||
bool AreSamplesNativeEndian() { return true; }
|
bool AreSamplesNativeEndian() const { return true; }
|
||||||
|
|
||||||
void GetAudio(void *buf, int64_t start, int64_t count);
|
void GetAudio(void *buf, int64_t start, int64_t count);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -34,12 +34,8 @@
|
||||||
/// @ingroup audio_input
|
/// @ingroup audio_input
|
||||||
///
|
///
|
||||||
|
|
||||||
|
|
||||||
///////////
|
|
||||||
// Headers
|
|
||||||
#include "include/aegisub/audio_provider.h"
|
#include "include/aegisub/audio_provider.h"
|
||||||
|
|
||||||
|
|
||||||
/// DOCME
|
/// DOCME
|
||||||
/// @class DummyAudioProvider
|
/// @class DummyAudioProvider
|
||||||
/// @brief DOCME
|
/// @brief DOCME
|
||||||
|
@ -58,9 +54,7 @@ public:
|
||||||
|
|
||||||
/// @brief DOCME
|
/// @brief DOCME
|
||||||
///
|
///
|
||||||
bool AreSamplesNativeEndian() { return true; }
|
bool AreSamplesNativeEndian() const { return true; }
|
||||||
|
|
||||||
void GetAudio(void *buf, int64_t start, int64_t count);
|
void GetAudio(void *buf, int64_t start, int64_t count);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -34,8 +34,6 @@
|
||||||
/// @ingroup audio_input ffms
|
/// @ingroup audio_input ffms
|
||||||
///
|
///
|
||||||
|
|
||||||
///////////
|
|
||||||
// Headers
|
|
||||||
#ifdef WITH_FFMPEGSOURCE
|
#ifdef WITH_FFMPEGSOURCE
|
||||||
#include "include/aegisub/audio_provider.h"
|
#include "include/aegisub/audio_provider.h"
|
||||||
#include "ffmpegsource_common.h"
|
#include "ffmpegsource_common.h"
|
||||||
|
@ -62,24 +60,8 @@ public:
|
||||||
/// @brief Checks sample endianness
|
/// @brief Checks sample endianness
|
||||||
/// @return Returns true.
|
/// @return Returns true.
|
||||||
/// FFMS always delivers native endian samples.
|
/// FFMS always delivers native endian samples.
|
||||||
bool AreSamplesNativeEndian() { return true; }
|
bool AreSamplesNativeEndian() const { return true; }
|
||||||
|
|
||||||
virtual void GetAudio(void *buf, int64_t start, int64_t count);
|
virtual void GetAudio(void *buf, int64_t start, int64_t count);
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/// @class FFmpegSourceAudioProviderFactory
|
|
||||||
/// @brief Creates a FFmpegSource audio provider.
|
|
||||||
class FFmpegSourceAudioProviderFactory : public AudioProviderFactory {
|
|
||||||
public:
|
|
||||||
/// @brief Creates a FFmpegSource audio provider.
|
|
||||||
/// @param video The audio filename to open.
|
|
||||||
/// @return Returns the audio provider.
|
|
||||||
AudioProvider *CreateProvider(wxString file) { return new FFmpegSourceAudioProvider(file); }
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* WITH_FFMPEGSOURCE */
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -34,9 +34,6 @@
|
||||||
/// @ingroup audio_input
|
/// @ingroup audio_input
|
||||||
///
|
///
|
||||||
|
|
||||||
|
|
||||||
///////////
|
|
||||||
// Headers
|
|
||||||
#ifndef AGI_PRE
|
#ifndef AGI_PRE
|
||||||
#include <wx/file.h>
|
#include <wx/file.h>
|
||||||
#include <wx/thread.h>
|
#include <wx/thread.h>
|
||||||
|
@ -44,8 +41,6 @@
|
||||||
|
|
||||||
#include "include/aegisub/audio_provider.h"
|
#include "include/aegisub/audio_provider.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// DOCME
|
/// DOCME
|
||||||
/// @class HDAudioProvider
|
/// @class HDAudioProvider
|
||||||
/// @brief DOCME
|
/// @brief DOCME
|
||||||
|
@ -79,9 +74,7 @@ public:
|
||||||
|
|
||||||
/// @brief DOCME
|
/// @brief DOCME
|
||||||
///
|
///
|
||||||
bool AreSamplesNativeEndian() { return samples_native_endian; }
|
bool AreSamplesNativeEndian() const { return samples_native_endian; }
|
||||||
|
|
||||||
void GetAudio(void *buf, int64_t start, int64_t count);
|
void GetAudio(void *buf, int64_t start, int64_t count);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,63 +0,0 @@
|
||||||
// Copyright (c) 2006, Rodrigo Braz Monteiro
|
|
||||||
// All rights reserved.
|
|
||||||
//
|
|
||||||
// Redistribution and use in source and binary forms, with or without
|
|
||||||
// modification, are permitted provided that the following conditions are met:
|
|
||||||
//
|
|
||||||
// * Redistributions of source code must retain the above copyright notice,
|
|
||||||
// this list of conditions and the following disclaimer.
|
|
||||||
// * Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
// this list of conditions and the following disclaimer in the documentation
|
|
||||||
// and/or other materials provided with the distribution.
|
|
||||||
// * Neither the name of the Aegisub Group nor the names of its contributors
|
|
||||||
// may be used to endorse or promote products derived from this software
|
|
||||||
// without specific prior written permission.
|
|
||||||
//
|
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
|
||||||
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
||||||
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
||||||
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
||||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
||||||
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
||||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
// POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
//
|
|
||||||
// Aegisub Project http://www.aegisub.org/
|
|
||||||
//
|
|
||||||
// $Id$
|
|
||||||
|
|
||||||
/// @file audio_provider_manager.h
|
|
||||||
/// @brief Manage available audio provider implementations
|
|
||||||
/// @ingroup audio_input
|
|
||||||
///
|
|
||||||
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
|
|
||||||
///////////
|
|
||||||
// Headers
|
|
||||||
#ifndef AGI_PRE
|
|
||||||
#include <stdint.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "include/aegisub/audio_provider.h"
|
|
||||||
#include "factory_manager.h"
|
|
||||||
|
|
||||||
|
|
||||||
/// DOCME
|
|
||||||
/// @class AudioProviderFactoryManager
|
|
||||||
/// @brief DOCME
|
|
||||||
///
|
|
||||||
/// DOCME
|
|
||||||
class AudioProviderFactoryManager : public FactoryManager<AudioProviderFactory> {
|
|
||||||
public:
|
|
||||||
static void RegisterProviders();
|
|
||||||
static AudioProvider *GetAudioProvider(wxString filename, int cache=-1);
|
|
||||||
static void ClearProviders();
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
|
@ -436,7 +436,7 @@ public:
|
||||||
/// @brief DOCME
|
/// @brief DOCME
|
||||||
/// @return
|
/// @return
|
||||||
///
|
///
|
||||||
bool AreSamplesNativeEndian()
|
bool AreSamplesNativeEndian() const
|
||||||
{
|
{
|
||||||
// 8 bit samples don't consider endianness
|
// 8 bit samples don't consider endianness
|
||||||
if (bytes_per_sample < 2) return true;
|
if (bytes_per_sample < 2) return true;
|
||||||
|
@ -657,7 +657,7 @@ public:
|
||||||
/// @brief DOCME
|
/// @brief DOCME
|
||||||
/// @return
|
/// @return
|
||||||
///
|
///
|
||||||
bool AreSamplesNativeEndian()
|
bool AreSamplesNativeEndian() const
|
||||||
{
|
{
|
||||||
// 8 bit samples don't consider endianness
|
// 8 bit samples don't consider endianness
|
||||||
if (bytes_per_sample < 2) return true;
|
if (bytes_per_sample < 2) return true;
|
||||||
|
|
|
@ -34,9 +34,6 @@
|
||||||
/// @ingroup audio_input
|
/// @ingroup audio_input
|
||||||
///
|
///
|
||||||
|
|
||||||
|
|
||||||
///////////
|
|
||||||
// Headers
|
|
||||||
#ifndef AGI_PRE
|
#ifndef AGI_PRE
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
@ -116,7 +113,3 @@ public:
|
||||||
|
|
||||||
// Construct the right PCM audio provider (if any) for the file
|
// Construct the right PCM audio provider (if any) for the file
|
||||||
AudioProvider *CreatePCMAudioProvider(const wxString &filename);
|
AudioProvider *CreatePCMAudioProvider(const wxString &filename);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -34,20 +34,14 @@
|
||||||
/// @ingroup audio_input
|
/// @ingroup audio_input
|
||||||
///
|
///
|
||||||
|
|
||||||
|
|
||||||
///////////
|
|
||||||
// Headers
|
|
||||||
#include "include/aegisub/audio_provider.h"
|
#include "include/aegisub/audio_provider.h"
|
||||||
|
|
||||||
|
|
||||||
/// DOCME
|
/// DOCME
|
||||||
/// @class RAMAudioProvider
|
/// @class RAMAudioProvider
|
||||||
/// @brief DOCME
|
/// @brief DOCME
|
||||||
///
|
///
|
||||||
/// DOCME
|
/// DOCME
|
||||||
class RAMAudioProvider : public AudioProvider {
|
class RAMAudioProvider : public AudioProvider {
|
||||||
private:
|
|
||||||
|
|
||||||
/// DOCME
|
/// DOCME
|
||||||
char** blockcache;
|
char** blockcache;
|
||||||
|
|
||||||
|
@ -63,12 +57,6 @@ public:
|
||||||
RAMAudioProvider(AudioProvider *source);
|
RAMAudioProvider(AudioProvider *source);
|
||||||
~RAMAudioProvider();
|
~RAMAudioProvider();
|
||||||
|
|
||||||
|
bool AreSamplesNativeEndian() const { return samples_native_endian; }
|
||||||
/// @brief DOCME
|
|
||||||
///
|
|
||||||
bool AreSamplesNativeEndian() { return samples_native_endian; }
|
|
||||||
|
|
||||||
void GetAudio(void *buf, int64_t start, int64_t count);
|
void GetAudio(void *buf, int64_t start, int64_t count);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -53,6 +53,7 @@
|
||||||
|
|
||||||
#include <libaegisub/log.h>
|
#include <libaegisub/log.h>
|
||||||
|
|
||||||
|
#include "include/aegisub/audio_provider.h"
|
||||||
#include "audio_renderer_spectrum.h"
|
#include "audio_renderer_spectrum.h"
|
||||||
#include "colorspace.h"
|
#include "colorspace.h"
|
||||||
#include "fft.h"
|
#include "fft.h"
|
||||||
|
|
|
@ -36,15 +36,11 @@
|
||||||
///
|
///
|
||||||
/// Calculate and render a frequency-power spectrum for PCM audio data.
|
/// Calculate and render a frequency-power spectrum for PCM audio data.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef AGI_PRE
|
#ifndef AGI_PRE
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "audio_provider_manager.h"
|
class AudioProvider;
|
||||||
|
|
||||||
|
|
||||||
// Specified and implemented in cpp file, interface is private to spectrum code
|
// Specified and implemented in cpp file, interface is private to spectrum code
|
||||||
class AudioSpectrumCacheManager;
|
class AudioSpectrumCacheManager;
|
||||||
|
|
|
@ -50,7 +50,7 @@
|
||||||
#include "help_button.h"
|
#include "help_button.h"
|
||||||
#include "libresrc/libresrc.h"
|
#include "libresrc/libresrc.h"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "spellchecker_manager.h"
|
#include "include/aegisub/spellchecker.h"
|
||||||
#include "subs_edit_box.h"
|
#include "subs_edit_box.h"
|
||||||
#include "subs_edit_ctrl.h"
|
#include "subs_edit_ctrl.h"
|
||||||
#include "subs_grid.h"
|
#include "subs_grid.h"
|
||||||
|
@ -96,7 +96,7 @@ DialogSpellChecker::DialogSpellChecker(wxFrame *parent)
|
||||||
SetIcon(BitmapToIcon(GETIMAGE(spellcheck_toolbutton_24)));
|
SetIcon(BitmapToIcon(GETIMAGE(spellcheck_toolbutton_24)));
|
||||||
|
|
||||||
// Get spell checker
|
// Get spell checker
|
||||||
spellchecker = SpellCheckerFactoryManager::GetSpellChecker();
|
spellchecker = SpellCheckerFactory::GetSpellChecker();
|
||||||
if (!spellchecker) {
|
if (!spellchecker) {
|
||||||
wxMessageBox(_T("No spellchecker available."),_T("Error"),wxICON_ERROR);
|
wxMessageBox(_T("No spellchecker available."),_T("Error"),wxICON_ERROR);
|
||||||
Destroy();
|
Destroy();
|
||||||
|
|
|
@ -57,7 +57,7 @@
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "subs_grid.h"
|
#include "subs_grid.h"
|
||||||
#include "subs_preview.h"
|
#include "subs_preview.h"
|
||||||
#include "subtitles_provider_manager.h"
|
#include "include/aegisub/subtitles_provider.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "validators.h"
|
#include "validators.h"
|
||||||
|
|
||||||
|
@ -361,7 +361,7 @@ DialogStyleEditor::DialogStyleEditor (wxWindow *parent, AssStyle *_style, Subtit
|
||||||
// Preview
|
// Preview
|
||||||
SubsPreview = NULL;
|
SubsPreview = NULL;
|
||||||
PreviewText = NULL;
|
PreviewText = NULL;
|
||||||
if (SubtitlesProviderFactoryManager::ProviderAvailable()) {
|
if (!SubtitlesProviderFactory::GetClasses().empty()) {
|
||||||
PreviewText = new wxTextCtrl(this,TEXT_PREVIEW,lagi_wxString(OPT_GET("Tool/Style Editor/Preview Text")->GetString()));
|
PreviewText = new wxTextCtrl(this,TEXT_PREVIEW,lagi_wxString(OPT_GET("Tool/Style Editor/Preview Text")->GetString()));
|
||||||
previewButton = new ColourButton(this,BUTTON_PREVIEW_COLOR,wxSize(45,16),lagi_wxColour(OPT_GET("Colour/Style Editor/Background/Preview")->GetColour()));
|
previewButton = new ColourButton(this,BUTTON_PREVIEW_COLOR,wxSize(45,16),lagi_wxColour(OPT_GET("Colour/Style Editor/Background/Preview")->GetColour()));
|
||||||
SubsPreview = new SubtitlesPreview(this,-1,wxDefaultPosition,wxSize(100,60),wxSUNKEN_BORDER,lagi_wxColour(OPT_GET("Colour/Style Editor/Background/Preview")->GetColour()));
|
SubsPreview = new SubtitlesPreview(this,-1,wxDefaultPosition,wxSize(100,60),wxSUNKEN_BORDER,lagi_wxColour(OPT_GET("Colour/Style Editor/Background/Preview")->GetColour()));
|
||||||
|
|
|
@ -34,17 +34,12 @@
|
||||||
/// @ingroup secondary_ui
|
/// @ingroup secondary_ui
|
||||||
///
|
///
|
||||||
|
|
||||||
|
|
||||||
///////////
|
|
||||||
// Headers
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#ifndef AGI_PRE
|
#ifndef AGI_PRE
|
||||||
#include <wx/stattext.h>
|
#include <wx/stattext.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "audio_box.h"
|
|
||||||
#include "audio_provider_manager.h"
|
|
||||||
#include "dialog_video_details.h"
|
#include "dialog_video_details.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "video_context.h"
|
#include "video_context.h"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2007-2008, Rodrigo Braz Monteiro
|
// Copyright (c) 2010, Thomas Goyne <plorkyeran@aegisub.org>
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
//
|
//
|
||||||
// Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
|
@ -34,117 +34,111 @@
|
||||||
/// @ingroup utility
|
/// @ingroup utility
|
||||||
///
|
///
|
||||||
|
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
|
||||||
///////////
|
|
||||||
// Headers
|
|
||||||
#ifndef AGI_PRE
|
#ifndef AGI_PRE
|
||||||
|
#include <cctype>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#include <wx/arrstr.h>
|
|
||||||
#include <wx/string.h>
|
#include <wx/string.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
template <class func>
|
||||||
/////////////////
|
class FactoryBase {
|
||||||
// Factory class
|
|
||||||
template <class T>
|
|
||||||
|
|
||||||
/// DOCME
|
|
||||||
/// @class FactoryManager
|
|
||||||
/// @brief DOCME
|
|
||||||
///
|
|
||||||
/// DOCME
|
|
||||||
class FactoryManager {
|
|
||||||
protected:
|
protected:
|
||||||
|
typedef std::map<std::string, std::pair<bool, func> > map;
|
||||||
|
typedef typename map::iterator iterator;
|
||||||
|
|
||||||
/// DOCME
|
static map *classes;
|
||||||
static std::map<wxString,T*> *factories;
|
|
||||||
|
|
||||||
|
static void DoRegister(func function, std::string name, bool hide, std::vector<std::string> &subtypes) {
|
||||||
|
if (!classes) classes = new map;
|
||||||
|
|
||||||
/// @brief DOCME
|
if (subtypes.empty()) {
|
||||||
///
|
classes->insert(std::make_pair(name, std::make_pair(hide, function)));
|
||||||
static void ClearFactories() {
|
|
||||||
if (factories && !factories->empty()) {
|
|
||||||
typename std::map<wxString,T*>::iterator iter;
|
|
||||||
for (iter = factories->begin(); iter != factories->end(); iter++) {
|
|
||||||
delete iter->second;
|
|
||||||
}
|
|
||||||
factories->clear();
|
|
||||||
}
|
}
|
||||||
delete factories;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief // Register one factory type (with possible subtypes)
|
|
||||||
/// @param factory
|
|
||||||
/// @param name
|
|
||||||
/// @param subTypes
|
|
||||||
///
|
|
||||||
static void RegisterFactory(T* factory,wxString name, wxArrayString subTypes=wxArrayString()) {
|
|
||||||
// Create factories if it doesn't exist
|
|
||||||
if (factories == NULL) factories = new std::map<wxString,T*>;
|
|
||||||
|
|
||||||
// Prepare subtypes
|
|
||||||
if (subTypes.GetCount() == 0) subTypes.Add(_T(""));
|
|
||||||
else {
|
else {
|
||||||
for (unsigned int i=0;i<subTypes.GetCount();i++) {
|
for (size_t i = 0; i < subtypes.size(); i++) {
|
||||||
subTypes[i] = _T("/") + subTypes[i];
|
classes->insert(std::make_pair(name + '/' + subtypes[i], std::make_pair(hide, function)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Insert each subtype
|
|
||||||
for (unsigned int i=0;i<subTypes.GetCount();i++) {
|
|
||||||
factories->insert(std::make_pair(name.Lower() + subTypes[i],factory));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static func Find(std::string name) {
|
||||||
|
if (!classes) return NULL;
|
||||||
|
|
||||||
/// @brief // Get a factory with name
|
iterator factory = classes->find(name);
|
||||||
/// @param name
|
if (factory != classes->end()) return factory->second.second;
|
||||||
/// @return
|
|
||||||
///
|
|
||||||
static T *GetFactory(wxString name) {
|
|
||||||
// No factories
|
|
||||||
if (factories == NULL) {
|
|
||||||
factories = new std::map<wxString,T*>;
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Search for factory that matches
|
|
||||||
typename std::map<wxString,T*>::iterator cur;
|
|
||||||
for (cur = factories->begin();cur != factories->end();cur++) {
|
|
||||||
if (cur->first.StartsWith(name)) return cur->second;
|
|
||||||
}
|
|
||||||
|
|
||||||
// None found
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
static void Clear() {
|
||||||
/// @brief // Virtual destructor
|
delete classes;
|
||||||
///
|
}
|
||||||
virtual ~FactoryManager() {
|
static std::vector<std::string> GetClasses(std::string favourite="") {
|
||||||
ClearFactories();
|
std::vector<std::string> list;
|
||||||
};
|
if (!classes) return list;
|
||||||
|
std::string cmp;
|
||||||
|
std::transform(favourite.begin(), favourite.end(), favourite.begin(), ::tolower);
|
||||||
/// @brief // Get list of all factories, with favourite as first
|
for (iterator cur=classes->begin();cur!=classes->end();cur++) {
|
||||||
/// @param favourite
|
cmp.clear();
|
||||||
///
|
std::transform(cur->first.begin(), cur->first.end(), std::back_inserter(cmp), ::tolower);
|
||||||
static wxArrayString GetFactoryList(wxString favourite=_T("")) {
|
if (cmp == favourite) list.insert(list.begin(), cur->first);
|
||||||
if (factories == NULL) factories = new std::map<wxString,T*>;
|
else if (!cur->second.first) list.push_back(cur->first);
|
||||||
wxArrayString list;
|
|
||||||
favourite = favourite.Lower();
|
|
||||||
for (typename std::map<wxString,T*>::iterator cur=factories->begin();cur!=factories->end();cur++) {
|
|
||||||
if (cur->first == favourite) list.Insert(cur->first,0);
|
|
||||||
else list.Add(cur->first);
|
|
||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
virtual ~FactoryBase() {
|
||||||
|
delete classes;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template<class Base>
|
||||||
|
class Factory0 : public FactoryBase<Base *(*)()> {
|
||||||
|
typedef Base *(*func)();
|
||||||
|
template<class T>
|
||||||
|
static Base* create() {
|
||||||
|
return new T;
|
||||||
|
}
|
||||||
|
public:
|
||||||
|
static Base* Create(std::string name) {
|
||||||
|
func factory = FactoryBase<func>::Find(name);
|
||||||
|
if (factory) {
|
||||||
|
return factory();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
static void Register(std::string name, bool hide = false, std::vector<std::string> subTypes = std::vector<std::string>()) {
|
||||||
|
DoRegister(&Factory0<Base>::create<T>, name, hide, subTypes);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<class Base, class Arg1>
|
||||||
|
class Factory1 : public FactoryBase<Base *(*)(Arg1)> {
|
||||||
|
typedef Base *(*func)(Arg1);
|
||||||
|
template<class T>
|
||||||
|
static Base* create(Arg1 a1) {
|
||||||
|
return new T(a1);
|
||||||
|
}
|
||||||
|
public:
|
||||||
|
static Base* Create(std::string name, Arg1 a1) {
|
||||||
|
func factory = FactoryBase<func>::Find(name);
|
||||||
|
if (factory) {
|
||||||
|
return factory(a1);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
static void Register(std::string name, bool hide = false, std::vector<std::string> subTypes = std::vector<std::string>()) {
|
||||||
|
DoRegister(&Factory1<Base, Arg1>::create<T>, name, hide, subTypes);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
|
@ -34,7 +34,6 @@
|
||||||
/// @ingroup main_ui
|
/// @ingroup main_ui
|
||||||
|
|
||||||
|
|
||||||
////////////////// Include headers
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#ifndef AGI_PRE
|
#ifndef AGI_PRE
|
||||||
|
@ -79,6 +78,7 @@
|
||||||
#include "dialog_video_details.h"
|
#include "dialog_video_details.h"
|
||||||
#include "frame_main.h"
|
#include "frame_main.h"
|
||||||
#include "hotkeys.h"
|
#include "hotkeys.h"
|
||||||
|
#include "include/aegisub/audio_player.h"
|
||||||
#include "keyframe.h"
|
#include "keyframe.h"
|
||||||
#include "libresrc/libresrc.h"
|
#include "libresrc/libresrc.h"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
|
|
|
@ -34,37 +34,26 @@
|
||||||
/// @ingroup main_headers audio_output
|
/// @ingroup main_headers audio_output
|
||||||
///
|
///
|
||||||
|
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
|
||||||
///////////
|
|
||||||
// Headers
|
|
||||||
#ifndef AGI_PRE
|
#ifndef AGI_PRE
|
||||||
#include <wx/event.h>
|
#include <wx/event.h>
|
||||||
#include <wx/thread.h>
|
#include <wx/thread.h>
|
||||||
#include <wx/timer.h>
|
#include <wx/timer.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "aegisub.h"
|
#include "factory_manager.h"
|
||||||
|
|
||||||
|
|
||||||
//////////////
|
|
||||||
// Prototypes
|
|
||||||
class AudioProvider;
|
class AudioProvider;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @class AudioPlayer
|
/// @class AudioPlayer
|
||||||
/// @brief DOCME
|
/// @brief DOCME
|
||||||
///
|
///
|
||||||
/// DOCME
|
/// DOCME
|
||||||
class AudioPlayer : public wxEvtHandler {
|
class AudioPlayer : public wxEvtHandler {
|
||||||
private:
|
|
||||||
void OnStopAudio(wxCommandEvent &event);
|
void OnStopAudio(wxCommandEvent &event);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
/// DOCME
|
/// DOCME
|
||||||
AudioProvider *provider;
|
AudioProvider *provider;
|
||||||
|
|
||||||
|
@ -98,27 +87,20 @@ public:
|
||||||
virtual void SetEndPosition(int64_t pos)=0;
|
virtual void SetEndPosition(int64_t pos)=0;
|
||||||
virtual void SetCurrentPosition(int64_t pos)=0;
|
virtual void SetCurrentPosition(int64_t pos)=0;
|
||||||
|
|
||||||
virtual wxMutex *GetMutex();
|
virtual wxMutex *GetMutex() { return NULL; }
|
||||||
|
|
||||||
virtual void SetProvider(AudioProvider *provider);
|
virtual void SetProvider(AudioProvider *new_provider) { provider = new_provider; }
|
||||||
AudioProvider *GetProvider();
|
AudioProvider *GetProvider() const { return provider; }
|
||||||
|
|
||||||
void SetDisplayTimer(wxTimer *timer);
|
void SetDisplayTimer(wxTimer *timer) { displayTimer = timer; }
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class AudioPlayerFactory : public Factory0<AudioPlayer> {
|
||||||
|
|
||||||
/// @class AudioPlayerFactory
|
|
||||||
/// @brief DOCME
|
|
||||||
///
|
|
||||||
/// DOCME
|
|
||||||
class AudioPlayerFactory {
|
|
||||||
public:
|
public:
|
||||||
|
static void RegisterProviders();
|
||||||
/// @brief DOCME
|
static AudioPlayer *GetAudioPlayer();
|
||||||
///
|
|
||||||
virtual ~AudioPlayerFactory() {}
|
|
||||||
virtual AudioPlayer *CreatePlayer()=0;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
DECLARE_EVENT_TYPE(wxEVT_STOP_AUDIO, -1)
|
||||||
|
|
|
@ -34,24 +34,13 @@
|
||||||
/// @ingroup main_headers audio_input
|
/// @ingroup main_headers audio_input
|
||||||
///
|
///
|
||||||
|
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
|
||||||
///////////
|
|
||||||
// Headers
|
|
||||||
#ifndef AGI_PRE
|
#ifndef AGI_PRE
|
||||||
#include <wx/string.h>
|
#include <wx/string.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "aegisub.h"
|
#include "factory_manager.h"
|
||||||
|
|
||||||
|
|
||||||
//////////////
|
|
||||||
// Prototypes
|
|
||||||
class VideoProvider;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @class AudioProvider
|
/// @class AudioProvider
|
||||||
/// @brief DOCME
|
/// @brief DOCME
|
||||||
|
@ -88,30 +77,26 @@ public:
|
||||||
AudioProvider();
|
AudioProvider();
|
||||||
virtual ~AudioProvider();
|
virtual ~AudioProvider();
|
||||||
|
|
||||||
virtual wxString GetFilename();
|
virtual wxString GetFilename() const { return filename; };
|
||||||
virtual void GetAudio(void *buf, int64_t start, int64_t count)=0;
|
virtual void GetAudio(void *buf, int64_t start, int64_t count)=0;
|
||||||
void GetAudioWithVolume(void *buf, int64_t start, int64_t count, double volume);
|
void GetAudioWithVolume(void *buf, int64_t start, int64_t count, double volume);
|
||||||
|
|
||||||
int64_t GetNumSamples();
|
int64_t GetNumSamples() const { return num_samples; }
|
||||||
int GetSampleRate();
|
int GetSampleRate() const { return sample_rate; }
|
||||||
int GetBytesPerSample();
|
int GetBytesPerSample() const { return bytes_per_sample; }
|
||||||
int GetChannels();
|
int GetChannels() const { return channels; }
|
||||||
virtual bool AreSamplesNativeEndian() = 0;
|
virtual bool AreSamplesNativeEndian() const = 0;
|
||||||
|
|
||||||
void GetWaveForm(int *min,int *peak,int64_t start,int w,int h,int samples,float scale);
|
void GetWaveForm(int *min,int *peak,int64_t start,int w,int h,int samples,float scale);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// DOCME
|
||||||
|
|
||||||
/// @class AudioProviderFactory
|
/// @class AudioProviderFactory
|
||||||
/// @brief DOCME
|
/// @brief DOCME
|
||||||
///
|
///
|
||||||
/// DOCME
|
/// DOCME
|
||||||
class AudioProviderFactory {
|
class AudioProviderFactory : public Factory1<AudioProvider, wxString> {
|
||||||
public:
|
public:
|
||||||
|
static void RegisterProviders();
|
||||||
/// @brief DOCME
|
static AudioProvider *GetProvider(wxString filename, int cache=-1);
|
||||||
///
|
|
||||||
virtual ~AudioProviderFactory() {}
|
|
||||||
virtual AudioProvider *CreateProvider(wxString filename)=0;
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -34,19 +34,14 @@
|
||||||
/// @ingroup main_headers spelling
|
/// @ingroup main_headers spelling
|
||||||
///
|
///
|
||||||
|
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
|
||||||
///////////
|
|
||||||
// Headers
|
|
||||||
#ifndef AGI_PRE
|
#ifndef AGI_PRE
|
||||||
#include <wx/arrstr.h>
|
#include <wx/arrstr.h>
|
||||||
#include <wx/string.h>
|
#include <wx/string.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "aegisub.h"
|
#include "factory_manager.h"
|
||||||
|
|
||||||
|
|
||||||
/// @class SpellChecker
|
/// @class SpellChecker
|
||||||
/// @brief DOCME
|
/// @brief DOCME
|
||||||
|
@ -54,16 +49,10 @@
|
||||||
/// DOCME
|
/// DOCME
|
||||||
class SpellChecker {
|
class SpellChecker {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/// @brief DOCME
|
|
||||||
///
|
|
||||||
SpellChecker() {}
|
|
||||||
|
|
||||||
/// @brief DOCME
|
/// @brief DOCME
|
||||||
///
|
///
|
||||||
virtual ~SpellChecker() {}
|
virtual ~SpellChecker() {}
|
||||||
|
|
||||||
|
|
||||||
/// @brief DOCME
|
/// @brief DOCME
|
||||||
/// @param word
|
/// @param word
|
||||||
/// @return
|
/// @return
|
||||||
|
@ -83,19 +72,13 @@ public:
|
||||||
virtual void SetLanguage(wxString language)=0;
|
virtual void SetLanguage(wxString language)=0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// DOCME
|
||||||
|
/// @class SpellCheckerFactoryManager
|
||||||
/// @class SpellCheckerFactory
|
|
||||||
/// @brief DOCME
|
/// @brief DOCME
|
||||||
///
|
///
|
||||||
/// DOCME
|
/// DOCME
|
||||||
class SpellCheckerFactory {
|
class SpellCheckerFactory : public Factory0<SpellChecker> {
|
||||||
public:
|
public:
|
||||||
|
static SpellChecker *GetSpellChecker();
|
||||||
/// @brief DOCME
|
static void RegisterProviders();
|
||||||
///
|
|
||||||
virtual ~SpellCheckerFactory() {}
|
|
||||||
virtual SpellChecker *CreateSpellChecker()=0;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -34,20 +34,12 @@
|
||||||
/// @ingroup main_headers subtitle_rendering
|
/// @ingroup main_headers subtitle_rendering
|
||||||
///
|
///
|
||||||
|
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
///////////
|
#include "factory_manager.h"
|
||||||
// Headers
|
|
||||||
#include "aegisub.h"
|
|
||||||
#include "video_frame.h"
|
|
||||||
|
|
||||||
|
|
||||||
//////////////
|
|
||||||
// Prototypes
|
|
||||||
class AssFile;
|
class AssFile;
|
||||||
|
class AegiVideoFrame;
|
||||||
|
|
||||||
|
|
||||||
/// @class SubtitlesProvider
|
/// @class SubtitlesProvider
|
||||||
/// @brief DOCME
|
/// @brief DOCME
|
||||||
|
@ -55,7 +47,7 @@ class AssFile;
|
||||||
/// DOCME
|
/// DOCME
|
||||||
class SubtitlesProvider {
|
class SubtitlesProvider {
|
||||||
public:
|
public:
|
||||||
virtual ~SubtitlesProvider();
|
virtual ~SubtitlesProvider() { };
|
||||||
|
|
||||||
virtual void LoadSubtitles(AssFile *subs)=0;
|
virtual void LoadSubtitles(AssFile *subs)=0;
|
||||||
|
|
||||||
|
@ -63,22 +55,16 @@ public:
|
||||||
/// @param dst
|
/// @param dst
|
||||||
/// @param time
|
/// @param time
|
||||||
///
|
///
|
||||||
virtual void DrawSubtitles(AegiVideoFrame &dst,double time) {}
|
virtual void DrawSubtitles(AegiVideoFrame &dst,double time)=0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// DOCME
|
||||||
|
/// @class SubtitlesProviderFactoryManager
|
||||||
/// @class SubtitlesProviderFactory
|
|
||||||
/// @brief DOCME
|
/// @brief DOCME
|
||||||
///
|
///
|
||||||
/// DOCME
|
/// DOCME
|
||||||
class SubtitlesProviderFactory {
|
class SubtitlesProviderFactory : public Factory1<SubtitlesProvider, std::string> {
|
||||||
public:
|
public:
|
||||||
|
static SubtitlesProvider *GetProvider();
|
||||||
/// @brief DOCME
|
static void RegisterProviders();
|
||||||
///
|
|
||||||
virtual ~SubtitlesProviderFactory() {}
|
|
||||||
virtual SubtitlesProvider *CreateProvider(wxString subType=_T(""))=0;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -69,16 +69,3 @@ public:
|
||||||
/// @return Returns true if caching is desired, false otherwise.
|
/// @return Returns true if caching is desired, false otherwise.
|
||||||
virtual bool WantsCaching() const { return false; }
|
virtual bool WantsCaching() const { return false; }
|
||||||
};
|
};
|
||||||
|
|
||||||
/// @class VideoProviderFactory
|
|
||||||
/// @brief DOCME
|
|
||||||
///
|
|
||||||
/// DOCME
|
|
||||||
class VideoProviderFactory {
|
|
||||||
public:
|
|
||||||
|
|
||||||
/// @brief DOCME
|
|
||||||
///
|
|
||||||
virtual ~VideoProviderFactory() {}
|
|
||||||
virtual VideoProvider *CreateProvider(wxString video)=0;
|
|
||||||
};
|
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
ghost@aladdin.com
|
ghost@aladdin.com
|
||||||
|
|
||||||
*/
|
*/
|
||||||
/* $Id: md5.h,v 1.4 2002/04/13 19:20:28 lpd Exp $ */
|
/* $Id$ */
|
||||||
/*
|
/*
|
||||||
Independent implementation of MD5 (RFC 1321).
|
Independent implementation of MD5 (RFC 1321).
|
||||||
|
|
||||||
|
|
|
@ -34,16 +34,13 @@
|
||||||
/// @ingroup main
|
/// @ingroup main
|
||||||
///
|
///
|
||||||
|
|
||||||
|
|
||||||
///////////
|
|
||||||
// Headers
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include "audio_player_manager.h"
|
#include "include/aegisub/audio_player.h"
|
||||||
#include "audio_provider_manager.h"
|
#include "include/aegisub/audio_provider.h"
|
||||||
|
#include "include/aegisub/spellchecker.h"
|
||||||
|
#include "include/aegisub/subtitles_provider.h"
|
||||||
#include "plugin_manager.h"
|
#include "plugin_manager.h"
|
||||||
#include "spellchecker_manager.h"
|
|
||||||
#include "subtitles_provider_manager.h"
|
|
||||||
#include "video_provider_manager.h"
|
#include "video_provider_manager.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -59,15 +56,14 @@ PluginManager::PluginManager() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Destructor
|
/// @brief Destructor
|
||||||
///
|
///
|
||||||
PluginManager::~PluginManager() {
|
PluginManager::~PluginManager() {
|
||||||
VideoProviderFactoryManager::ClearProviders();
|
VideoProviderFactory::Clear();
|
||||||
AudioProviderFactoryManager::ClearProviders();
|
AudioProviderFactory::Clear();
|
||||||
AudioPlayerFactoryManager::ClearProviders();
|
AudioPlayerFactory::Clear();
|
||||||
SubtitlesProviderFactoryManager::ClearProviders();
|
SubtitlesProviderFactory::Clear();
|
||||||
SpellCheckerFactoryManager::ClearProviders();
|
SpellCheckerFactory::Clear();
|
||||||
|
|
||||||
#ifdef WITH_AUTO4_LUA
|
#ifdef WITH_AUTO4_LUA
|
||||||
if (lua) {
|
if (lua) {
|
||||||
|
@ -85,11 +81,11 @@ PluginManager::~PluginManager() {
|
||||||
void PluginManager::RegisterBuiltInPlugins() {
|
void PluginManager::RegisterBuiltInPlugins() {
|
||||||
if (!init) {
|
if (!init) {
|
||||||
// Managers
|
// Managers
|
||||||
VideoProviderFactoryManager::RegisterProviders();
|
VideoProviderFactory::RegisterProviders();
|
||||||
AudioProviderFactoryManager::RegisterProviders();
|
AudioProviderFactory::RegisterProviders();
|
||||||
AudioPlayerFactoryManager::RegisterProviders();
|
AudioPlayerFactory::RegisterProviders();
|
||||||
SubtitlesProviderFactoryManager::RegisterProviders();
|
SubtitlesProviderFactory::RegisterProviders();
|
||||||
SpellCheckerFactoryManager::RegisterProviders();
|
SpellCheckerFactory::RegisterProviders();
|
||||||
|
|
||||||
// Automation languages
|
// Automation languages
|
||||||
#ifdef WITH_AUTO4_LUA
|
#ifdef WITH_AUTO4_LUA
|
||||||
|
@ -101,5 +97,3 @@ void PluginManager::RegisterBuiltInPlugins() {
|
||||||
// Done
|
// Done
|
||||||
init = true;
|
init = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,8 @@
|
||||||
|
|
||||||
|
|
||||||
#ifndef AGI_PRE
|
#ifndef AGI_PRE
|
||||||
|
#include <iterator>
|
||||||
|
|
||||||
#include <wx/checkbox.h>
|
#include <wx/checkbox.h>
|
||||||
#include <wx/combobox.h>
|
#include <wx/combobox.h>
|
||||||
#include <wx/filefn.h>
|
#include <wx/filefn.h>
|
||||||
|
@ -37,10 +39,10 @@
|
||||||
#include "libresrc/libresrc.h"
|
#include "libresrc/libresrc.h"
|
||||||
#include "preferences.h"
|
#include "preferences.h"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "subtitles_provider_manager.h"
|
#include "include/aegisub/audio_player.h"
|
||||||
|
#include "include/aegisub/audio_provider.h"
|
||||||
|
#include "include/aegisub/subtitles_provider.h"
|
||||||
#include "video_provider_manager.h"
|
#include "video_provider_manager.h"
|
||||||
#include "audio_player_manager.h"
|
|
||||||
#include "audio_provider_manager.h"
|
|
||||||
|
|
||||||
/// Define make all platform-specific options visible in a single view.
|
/// Define make all platform-specific options visible in a single view.
|
||||||
#define SHOW_ALL 1
|
#define SHOW_ALL 1
|
||||||
|
@ -296,15 +298,20 @@ Advanced_Interface::Advanced_Interface(wxTreebook *book): OptionPage(book, _("Ba
|
||||||
SetSizerAndFit(sizer);
|
SetSizerAndFit(sizer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static wxArrayString vec_to_arrstr(std::vector<std::string> const& vec) {
|
||||||
|
wxArrayString arrstr;
|
||||||
|
std::copy(vec.begin(), vec.end(), std::back_inserter(arrstr));
|
||||||
|
return arrstr;
|
||||||
|
}
|
||||||
|
|
||||||
/// Advanced Audio preferences subpage
|
/// Advanced Audio preferences subpage
|
||||||
Advanced_Audio::Advanced_Audio(wxTreebook *book): OptionPage(book, _("Audio"), PAGE_SUB) {
|
Advanced_Audio::Advanced_Audio(wxTreebook *book): OptionPage(book, _("Audio"), PAGE_SUB) {
|
||||||
wxFlexGridSizer *expert = PageSizer(_("Expert"));
|
wxFlexGridSizer *expert = PageSizer(_("Expert"));
|
||||||
|
|
||||||
wxArrayString ap_choice = AudioProviderFactoryManager::GetFactoryList();
|
wxArrayString ap_choice = vec_to_arrstr(AudioProviderFactory::GetClasses());
|
||||||
OptionChoice(expert, _("Audio provider"), ap_choice, "Audio/Provider");
|
OptionChoice(expert, _("Audio provider"), ap_choice, "Audio/Provider");
|
||||||
|
|
||||||
wxArrayString apl_choice = AudioPlayerFactoryManager::GetFactoryList();
|
wxArrayString apl_choice = vec_to_arrstr(AudioPlayerFactory::GetClasses());
|
||||||
OptionChoice(expert, _("Audio player"), apl_choice, "Audio/Player");
|
OptionChoice(expert, _("Audio player"), apl_choice, "Audio/Player");
|
||||||
|
|
||||||
wxFlexGridSizer *cache = PageSizer(_("Cache"));
|
wxFlexGridSizer *cache = PageSizer(_("Cache"));
|
||||||
|
@ -340,10 +347,10 @@ Advanced_Audio::Advanced_Audio(wxTreebook *book): OptionPage(book, _("Audio"), P
|
||||||
Advanced_Video::Advanced_Video(wxTreebook *book): OptionPage(book, _("Video")) {
|
Advanced_Video::Advanced_Video(wxTreebook *book): OptionPage(book, _("Video")) {
|
||||||
wxFlexGridSizer *expert = PageSizer(_("Expert"));
|
wxFlexGridSizer *expert = PageSizer(_("Expert"));
|
||||||
|
|
||||||
wxArrayString vp_choice = VideoProviderFactoryManager::GetFactoryList();
|
wxArrayString vp_choice = vec_to_arrstr(VideoProviderFactory::GetClasses());
|
||||||
OptionChoice(expert, _("Video provider"), vp_choice, "Video/Provider");
|
OptionChoice(expert, _("Video provider"), vp_choice, "Video/Provider");
|
||||||
|
|
||||||
wxArrayString sp_choice = SubtitlesProviderFactoryManager::GetFactoryList();
|
wxArrayString sp_choice = vec_to_arrstr(SubtitlesProviderFactory::GetClasses());
|
||||||
OptionChoice(expert, _("Subtitle provider"), sp_choice, "Subtitle/Provider");
|
OptionChoice(expert, _("Subtitle provider"), sp_choice, "Subtitle/Provider");
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -37,10 +37,9 @@
|
||||||
#include "libresrc/libresrc.h"
|
#include "libresrc/libresrc.h"
|
||||||
#include "preferences.h"
|
#include "preferences.h"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "subtitles_provider_manager.h"
|
#include "include/aegisub/audio_player.h"
|
||||||
|
#include "include/aegisub/audio_provider.h"
|
||||||
#include "video_provider_manager.h"
|
#include "video_provider_manager.h"
|
||||||
#include "audio_player_manager.h"
|
|
||||||
#include "audio_provider_manager.h"
|
|
||||||
|
|
||||||
#include "preferences_base.h"
|
#include "preferences_base.h"
|
||||||
|
|
||||||
|
|
|
@ -34,9 +34,6 @@
|
||||||
/// @ingroup spelling
|
/// @ingroup spelling
|
||||||
///
|
///
|
||||||
|
|
||||||
|
|
||||||
///////////
|
|
||||||
// Headers
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#ifdef WITH_HUNSPELL
|
#ifdef WITH_HUNSPELL
|
||||||
|
@ -44,26 +41,22 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "compat.h"
|
#include "compat.h"
|
||||||
|
#include "include/aegisub/spellchecker.h"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "spellchecker_manager.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Get spell checker
|
/// @brief Get spell checker
|
||||||
/// @return
|
/// @return
|
||||||
///
|
///
|
||||||
SpellChecker *SpellCheckerFactoryManager::GetSpellChecker() {
|
SpellChecker *SpellCheckerFactory::GetSpellChecker() {
|
||||||
// List of providers
|
// List of providers
|
||||||
wxArrayString list = GetFactoryList(lagi_wxString(OPT_GET("Tool/Spell Checker/Backend")->GetString()));
|
std::vector<std::string> list = GetClasses(OPT_GET("Tool/Spell Checker/Backend")->GetString());
|
||||||
|
if (list.empty()) return NULL;
|
||||||
// None available
|
|
||||||
if (list.Count() == 0) return 0; //throw _T("No spell checkers are available.");
|
|
||||||
|
|
||||||
// Get provider
|
// Get provider
|
||||||
wxString error;
|
wxString error;
|
||||||
for (unsigned int i=0;i<list.Count();i++) {
|
for (unsigned int i=0;i<list.size();i++) {
|
||||||
try {
|
try {
|
||||||
SpellChecker *checker = GetFactory(list[i])->CreateSpellChecker();
|
SpellChecker *checker = Create(list[i]);
|
||||||
if (checker) return checker;
|
if (checker) return checker;
|
||||||
}
|
}
|
||||||
catch (wxString err) { error += list[i] + _T(" factory: ") + err + _T("\n"); }
|
catch (wxString err) { error += list[i] + _T(" factory: ") + err + _T("\n"); }
|
||||||
|
@ -75,27 +68,12 @@ SpellChecker *SpellCheckerFactoryManager::GetSpellChecker() {
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Register all providers
|
/// @brief Register all providers
|
||||||
///
|
///
|
||||||
void SpellCheckerFactoryManager::RegisterProviders() {
|
void SpellCheckerFactory::RegisterProviders() {
|
||||||
#ifdef WITH_HUNSPELL
|
#ifdef WITH_HUNSPELL
|
||||||
RegisterFactory(new HunspellSpellCheckerFactory(),_T("Hunspell"));
|
Register<HunspellSpellChecker>("Hunspell");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<> SpellCheckerFactory::map *FactoryBase<SpellChecker *(*)()>::classes = NULL;
|
||||||
|
|
||||||
/// @brief Clear all providers
|
|
||||||
///
|
|
||||||
void SpellCheckerFactoryManager::ClearProviders() {
|
|
||||||
ClearFactories();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// DOCME
|
|
||||||
template <class SpellCheckerFactory> std::map<wxString,SpellCheckerFactory*>* FactoryManager<SpellCheckerFactory>::factories=NULL;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,6 @@ namespace agi {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// @class HunspellSpellChecker
|
/// @class HunspellSpellChecker
|
||||||
/// @brief Hunspell spell checker
|
/// @brief Hunspell spell checker
|
||||||
///
|
///
|
||||||
|
@ -88,19 +87,4 @@ public:
|
||||||
void SetLanguage(wxString language);
|
void SetLanguage(wxString language);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @class HunspellSpellCheckerFactory
|
|
||||||
/// @brief Hunspell SpellChecker Factory
|
|
||||||
///
|
|
||||||
class HunspellSpellCheckerFactory : public SpellCheckerFactory {
|
|
||||||
public:
|
|
||||||
|
|
||||||
/// @brief Create new Hunspell Spell checker.
|
|
||||||
///
|
|
||||||
SpellChecker *CreateSpellChecker() { return new HunspellSpellChecker(); }
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,59 +0,0 @@
|
||||||
// Copyright (c) 2006, Rodrigo Braz Monteiro
|
|
||||||
// All rights reserved.
|
|
||||||
//
|
|
||||||
// Redistribution and use in source and binary forms, with or without
|
|
||||||
// modification, are permitted provided that the following conditions are met:
|
|
||||||
//
|
|
||||||
// * Redistributions of source code must retain the above copyright notice,
|
|
||||||
// this list of conditions and the following disclaimer.
|
|
||||||
// * Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
// this list of conditions and the following disclaimer in the documentation
|
|
||||||
// and/or other materials provided with the distribution.
|
|
||||||
// * Neither the name of the Aegisub Group nor the names of its contributors
|
|
||||||
// may be used to endorse or promote products derived from this software
|
|
||||||
// without specific prior written permission.
|
|
||||||
//
|
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
|
||||||
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
||||||
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
||||||
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
||||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
||||||
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
||||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
// POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
//
|
|
||||||
// Aegisub Project http://www.aegisub.org/
|
|
||||||
//
|
|
||||||
// $Id$
|
|
||||||
|
|
||||||
/// @file spellchecker_manager.h
|
|
||||||
/// @brief Factory class for spell checkers
|
|
||||||
/// @ingroup spelling
|
|
||||||
///
|
|
||||||
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
|
|
||||||
///////////
|
|
||||||
// Headers
|
|
||||||
#include "factory_manager.h"
|
|
||||||
#include "include/aegisub/spellchecker.h"
|
|
||||||
|
|
||||||
|
|
||||||
/// DOCME
|
|
||||||
/// @class SpellCheckerFactoryManager
|
|
||||||
/// @brief DOCME
|
|
||||||
///
|
|
||||||
/// DOCME
|
|
||||||
class SpellCheckerFactoryManager : public FactoryManager<SpellCheckerFactory> {
|
|
||||||
public:
|
|
||||||
static SpellChecker *GetSpellChecker();
|
|
||||||
static void RegisterProviders();
|
|
||||||
static void ClearProviders();
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@
|
||||||
#include "ass_dialogue.h"
|
#include "ass_dialogue.h"
|
||||||
#include "compat.h"
|
#include "compat.h"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "spellchecker_manager.h"
|
#include "include/aegisub/spellchecker.h"
|
||||||
#include "subs_edit_box.h"
|
#include "subs_edit_box.h"
|
||||||
#include "subs_edit_ctrl.h"
|
#include "subs_edit_ctrl.h"
|
||||||
#include "subs_grid.h"
|
#include "subs_grid.h"
|
||||||
|
@ -88,7 +88,7 @@ enum {
|
||||||
///
|
///
|
||||||
SubsTextEditCtrl::SubsTextEditCtrl(wxWindow* parent, wxSize wsize, long style, SubtitlesGrid *grid)
|
SubsTextEditCtrl::SubsTextEditCtrl(wxWindow* parent, wxSize wsize, long style, SubtitlesGrid *grid)
|
||||||
: ScintillaTextCtrl(parent, wxID_ANY, "", wxDefaultPosition, wsize, style)
|
: ScintillaTextCtrl(parent, wxID_ANY, "", wxDefaultPosition, wsize, style)
|
||||||
, spellchecker(SpellCheckerFactoryManager::GetSpellChecker())
|
, spellchecker(SpellCheckerFactory::GetSpellChecker())
|
||||||
, thesaurus(Thesaurus::GetThesaurus())
|
, thesaurus(Thesaurus::GetThesaurus())
|
||||||
, grid(grid)
|
, grid(grid)
|
||||||
{
|
{
|
||||||
|
|
|
@ -45,10 +45,13 @@
|
||||||
#include <wx/tokenzr.h>
|
#include <wx/tokenzr.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "include/aegisub/audio_provider.h"
|
||||||
#include "ass_file.h"
|
#include "ass_file.h"
|
||||||
#include "ass_karaoke.h"
|
#include "ass_karaoke.h"
|
||||||
#include "ass_override.h"
|
#include "ass_override.h"
|
||||||
#include "ass_style.h"
|
#include "ass_style.h"
|
||||||
|
#include "audio_box.h"
|
||||||
|
#include "audio_display.h"
|
||||||
#include "charset_conv.h"
|
#include "charset_conv.h"
|
||||||
#include "dialog_paste_over.h"
|
#include "dialog_paste_over.h"
|
||||||
#include "frame_main.h"
|
#include "frame_main.h"
|
||||||
|
|
|
@ -44,9 +44,6 @@
|
||||||
#include <wx/wx.h>
|
#include <wx/wx.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "audio_box.h"
|
|
||||||
#include "audio_display.h"
|
|
||||||
#include "audio_provider_manager.h"
|
|
||||||
#include "base_grid.h"
|
#include "base_grid.h"
|
||||||
|
|
||||||
class AssFile;
|
class AssFile;
|
||||||
|
@ -54,7 +51,6 @@ class AssEntry;
|
||||||
class AssDialogue;
|
class AssDialogue;
|
||||||
class SubsEditBox;
|
class SubsEditBox;
|
||||||
class FrameMain;
|
class FrameMain;
|
||||||
class AudioDisplay;
|
|
||||||
|
|
||||||
typedef std::list<AssEntry*>::iterator entryIter;
|
typedef std::list<AssEntry*>::iterator entryIter;
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@
|
||||||
#include "ass_file.h"
|
#include "ass_file.h"
|
||||||
#include "ass_style.h"
|
#include "ass_style.h"
|
||||||
#include "subs_preview.h"
|
#include "subs_preview.h"
|
||||||
#include "subtitles_provider_manager.h"
|
#include "include/aegisub/subtitles_provider.h"
|
||||||
#include "video_provider_dummy.h"
|
#include "video_provider_dummy.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -139,7 +139,7 @@ void SubtitlesPreview::OnSize(wxSizeEvent &evt) {
|
||||||
bmp.reset(new wxBitmap(w, h, -1));
|
bmp.reset(new wxBitmap(w, h, -1));
|
||||||
vid.reset(new DummyVideoProvider(0.0, 10, w, h, backColour, true));
|
vid.reset(new DummyVideoProvider(0.0, 10, w, h, backColour, true));
|
||||||
try {
|
try {
|
||||||
provider.reset(SubtitlesProviderFactoryManager::GetProvider());
|
provider.reset(SubtitlesProviderFactory::GetProvider());
|
||||||
}
|
}
|
||||||
catch (...) {
|
catch (...) {
|
||||||
wxMessageBox(
|
wxMessageBox(
|
||||||
|
|
|
@ -42,7 +42,7 @@
|
||||||
#include "ass_dialogue.h"
|
#include "ass_dialogue.h"
|
||||||
#include "ass_file.h"
|
#include "ass_file.h"
|
||||||
#include "subtitle_format_dvd.h"
|
#include "subtitle_format_dvd.h"
|
||||||
#include "subtitles_provider_manager.h"
|
#include "include/aegisub/subtitles_provider.h"
|
||||||
#include "video_provider_dummy.h"
|
#include "video_provider_dummy.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -115,7 +115,7 @@ void DVDSubtitleFormat::GetSubPictureList(std::vector<SubPicture> &pics) {
|
||||||
pics.resize(count);
|
pics.resize(count);
|
||||||
|
|
||||||
SubtitlesProvider *provider = NULL;
|
SubtitlesProvider *provider = NULL;
|
||||||
provider = SubtitlesProviderFactoryManager::GetProvider();
|
provider = SubtitlesProviderFactory::GetProvider();
|
||||||
provider->LoadSubtitles(GetAssFile());
|
provider->LoadSubtitles(GetAssFile());
|
||||||
//TessDllAPI tess;
|
//TessDllAPI tess;
|
||||||
|
|
||||||
|
|
|
@ -34,9 +34,6 @@
|
||||||
/// @ingroup subtitle_rendering
|
/// @ingroup subtitle_rendering
|
||||||
///
|
///
|
||||||
|
|
||||||
|
|
||||||
///////////
|
|
||||||
// Headers
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include "compat.h"
|
#include "compat.h"
|
||||||
|
@ -47,47 +44,22 @@
|
||||||
#ifdef WITH_LIBASS
|
#ifdef WITH_LIBASS
|
||||||
#include "subtitles_provider_libass.h"
|
#include "subtitles_provider_libass.h"
|
||||||
#endif
|
#endif
|
||||||
#include "subtitles_provider_manager.h"
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Destructor
|
|
||||||
///
|
|
||||||
SubtitlesProvider::~SubtitlesProvider() {
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Check if provider available (doesn't verify provider works!)
|
|
||||||
/// @return
|
|
||||||
///
|
|
||||||
bool SubtitlesProviderFactoryManager::ProviderAvailable() {
|
|
||||||
// List of providers
|
|
||||||
wxArrayString list = GetFactoryList(lagi_wxString(OPT_GET("Subtitle/Provider")->GetString()));
|
|
||||||
|
|
||||||
// None available
|
|
||||||
return (list.Count() > 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Get provider
|
/// @brief Get provider
|
||||||
/// @return
|
/// @return
|
||||||
///
|
///
|
||||||
SubtitlesProvider* SubtitlesProviderFactoryManager::GetProvider() {
|
SubtitlesProvider* SubtitlesProviderFactory::GetProvider() {
|
||||||
// List of providers
|
std::vector<std::string> list = GetClasses(OPT_GET("Subtitle/Provider")->GetString());
|
||||||
wxArrayString list = GetFactoryList(lagi_wxString(OPT_GET("Subtitle/Provider")->GetString()));
|
if (list.empty()) throw _T("No subtitle providers are available.");
|
||||||
|
|
||||||
// None available
|
|
||||||
if (list.Count() == 0) throw _T("No subtitle providers are available.");
|
|
||||||
|
|
||||||
// Get provider
|
// Get provider
|
||||||
wxString error;
|
wxString error;
|
||||||
for (unsigned int i=0;i<list.Count();i++) {
|
for (unsigned int i=0;i<list.size();i++) {
|
||||||
try {
|
try {
|
||||||
size_t pos = list[i].Find(_T('/'));
|
size_t pos = list[i].find('/');
|
||||||
wxString name = list[i].Left(pos);
|
std::string name = list[i].substr(0, pos);
|
||||||
wxString subType = list[i].Mid(pos+1);
|
std::string subType = pos < list[i].size() - 1 ? list[i].substr(pos + 1) : "";
|
||||||
SubtitlesProvider *provider = GetFactory(list[i])->CreateProvider(subType);
|
SubtitlesProvider *provider = Create(list[i], subType);
|
||||||
if (provider) return provider;
|
if (provider) return provider;
|
||||||
}
|
}
|
||||||
catch (wxString err) { error += list[i] + _T(" factory: ") + err + _T("\n"); }
|
catch (wxString err) { error += list[i] + _T(" factory: ") + err + _T("\n"); }
|
||||||
|
@ -99,31 +71,15 @@ SubtitlesProvider* SubtitlesProviderFactoryManager::GetProvider() {
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Register providers
|
/// @brief Register providers
|
||||||
///
|
///
|
||||||
void SubtitlesProviderFactoryManager::RegisterProviders() {
|
void SubtitlesProviderFactory::RegisterProviders() {
|
||||||
#ifdef WITH_CSRI
|
#ifdef WITH_CSRI
|
||||||
CSRISubtitlesProviderFactory *csri = new CSRISubtitlesProviderFactory();
|
Register<CSRISubtitlesProvider>("CSRI", false, CSRISubtitlesProvider::GetSubTypes());
|
||||||
RegisterFactory(csri,_T("CSRI"),csri->GetSubTypes());
|
|
||||||
#endif
|
#endif
|
||||||
#ifdef WITH_LIBASS
|
#ifdef WITH_LIBASS
|
||||||
RegisterFactory(new LibassSubtitlesProviderFactory(),_T("libass"));
|
Register<LibassSubtitlesProvider>("libass");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<> SubtitlesProviderFactory::map *FactoryBase<SubtitlesProvider *(*)(std::string)>::classes = NULL;
|
||||||
|
|
||||||
/// @brief Clear providers
|
|
||||||
///
|
|
||||||
void SubtitlesProviderFactoryManager::ClearProviders() {
|
|
||||||
ClearFactories();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// DOCME
|
|
||||||
template <class SubtitlesProviderFactory> std::map<wxString,SubtitlesProviderFactory*>* FactoryManager<SubtitlesProviderFactory>::factories=NULL;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -34,12 +34,8 @@
|
||||||
/// @ingroup subtitle_rendering
|
/// @ingroup subtitle_rendering
|
||||||
///
|
///
|
||||||
|
|
||||||
|
|
||||||
///////////
|
|
||||||
// Headers
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
|
||||||
#ifdef WITH_CSRI
|
#ifdef WITH_CSRI
|
||||||
|
|
||||||
#include "ass_file.h"
|
#include "ass_file.h"
|
||||||
|
@ -50,39 +46,29 @@
|
||||||
/// @brief Constructor
|
/// @brief Constructor
|
||||||
/// @param type
|
/// @param type
|
||||||
///
|
///
|
||||||
CSRISubtitlesProvider::CSRISubtitlesProvider(wxString type) {
|
CSRISubtitlesProvider::CSRISubtitlesProvider(std::string type) : subType(type) {
|
||||||
subType = type;
|
|
||||||
instance = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Destructor
|
/// @brief Destructor
|
||||||
///
|
///
|
||||||
CSRISubtitlesProvider::~CSRISubtitlesProvider() {
|
CSRISubtitlesProvider::~CSRISubtitlesProvider() {
|
||||||
if (!tempfile.empty()) wxRemoveFile(tempfile);
|
if (!tempfile.empty()) wxRemoveFile(tempfile);
|
||||||
if (instance) csri_close(instance);
|
|
||||||
instance = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Load subtitles
|
/// @brief Load subtitles
|
||||||
/// @param subs
|
/// @param subs
|
||||||
///
|
///
|
||||||
void CSRISubtitlesProvider::LoadSubtitles(AssFile *subs) {
|
void CSRISubtitlesProvider::LoadSubtitles(AssFile *subs) {
|
||||||
// Close
|
|
||||||
if (instance) csri_close(instance);
|
|
||||||
instance = NULL;
|
|
||||||
|
|
||||||
// CSRI variables
|
// CSRI variables
|
||||||
csri_rend *cur,*renderer=NULL;
|
csri_rend *cur,*renderer=NULL;
|
||||||
csri_info *info;
|
|
||||||
|
|
||||||
// Select renderer
|
// Select renderer
|
||||||
bool canOpenMem = true;
|
bool canOpenMem = true;
|
||||||
for (cur = csri_renderer_default();cur;cur=csri_renderer_next(cur)) {
|
for (cur = csri_renderer_default();cur;cur=csri_renderer_next(cur)) {
|
||||||
info = csri_renderer_info(cur);
|
std::string name(csri_renderer_info(cur)->name);
|
||||||
wxString name(info->name,wxConvUTF8);
|
|
||||||
if (name == subType) {
|
if (name == subType) {
|
||||||
renderer = cur;
|
renderer = cur;
|
||||||
if (name.StartsWith(_T("vsfilter"))) canOpenMem = false;
|
if (name.find("vsfilter") != name.npos) canOpenMem = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -99,7 +85,7 @@ void CSRISubtitlesProvider::LoadSubtitles(AssFile *subs) {
|
||||||
if (canOpenMem) {
|
if (canOpenMem) {
|
||||||
std::vector<char> data;
|
std::vector<char> data;
|
||||||
subs->SaveMemory(data,wxSTRING_ENCODING);
|
subs->SaveMemory(data,wxSTRING_ENCODING);
|
||||||
instance = csri_open_mem(renderer,&data[0],data.size(),NULL);
|
instance.reset(csri_open_mem(renderer,&data[0],data.size(),NULL), &csri_close);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Open from disk
|
// Open from disk
|
||||||
|
@ -110,7 +96,7 @@ void CSRISubtitlesProvider::LoadSubtitles(AssFile *subs) {
|
||||||
tempfile += L".ass";
|
tempfile += L".ass";
|
||||||
}
|
}
|
||||||
subs->Save(tempfile,false,false,wxSTRING_ENCODING);
|
subs->Save(tempfile,false,false,wxSTRING_ENCODING);
|
||||||
instance = csri_open_file(renderer,tempfile.utf8_str(),NULL);
|
instance.reset(csri_open_file(renderer,tempfile.utf8_str(),NULL), &csri_close);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,7 +107,7 @@ void CSRISubtitlesProvider::LoadSubtitles(AssFile *subs) {
|
||||||
///
|
///
|
||||||
void CSRISubtitlesProvider::DrawSubtitles(AegiVideoFrame &dst,double time) {
|
void CSRISubtitlesProvider::DrawSubtitles(AegiVideoFrame &dst,double time) {
|
||||||
// Check if CSRI loaded properly
|
// Check if CSRI loaded properly
|
||||||
if (!instance) return;
|
if (!instance.get()) return;
|
||||||
|
|
||||||
// Load data into frame
|
// Load data into frame
|
||||||
csri_frame frame;
|
csri_frame frame;
|
||||||
|
@ -146,31 +132,19 @@ void CSRISubtitlesProvider::DrawSubtitles(AegiVideoFrame &dst,double time) {
|
||||||
format.width = dst.w;
|
format.width = dst.w;
|
||||||
format.height = dst.h;
|
format.height = dst.h;
|
||||||
format.pixfmt = frame.pixfmt;
|
format.pixfmt = frame.pixfmt;
|
||||||
int error = csri_request_fmt(instance,&format);
|
int error = csri_request_fmt(instance.get(),&format);
|
||||||
if (error) return;
|
if (error) return;
|
||||||
|
|
||||||
// Render
|
// Render
|
||||||
csri_render(instance,&frame,time);
|
csri_render(instance.get(),&frame,time);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Get CSRI subtypes
|
/// @brief Get CSRI subtypes
|
||||||
///
|
///
|
||||||
wxArrayString CSRISubtitlesProviderFactory::GetSubTypes() {
|
std::vector<std::string> CSRISubtitlesProvider::GetSubTypes() {
|
||||||
csri_info *info;
|
std::vector<std::string> final;
|
||||||
wxArrayString final;
|
|
||||||
for (csri_rend *cur = csri_renderer_default();cur;cur = csri_renderer_next(cur)) {
|
for (csri_rend *cur = csri_renderer_default();cur;cur = csri_renderer_next(cur)) {
|
||||||
// Get renderer name
|
final.push_back(csri_renderer_info(cur)->name);
|
||||||
info = csri_renderer_info(cur);
|
|
||||||
const char* buffer = info->name;
|
|
||||||
|
|
||||||
// wxWidgets isn't initialized, so h4x into a wxString
|
|
||||||
int len = strlen(buffer);
|
|
||||||
wxString str;
|
|
||||||
str.Alloc(len+1);
|
|
||||||
for (int i=0;i<len;i++) {
|
|
||||||
str.Append((wxChar)buffer[i]);
|
|
||||||
}
|
|
||||||
final.Add(str);
|
|
||||||
}
|
}
|
||||||
return final;
|
return final;
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,13 +36,14 @@
|
||||||
|
|
||||||
#ifdef WITH_CSRI
|
#ifdef WITH_CSRI
|
||||||
|
|
||||||
#include "include/aegisub/subtitles_provider.h"
|
#ifndef AGI_PRE
|
||||||
#ifdef WIN32
|
#include <tr1/memory>
|
||||||
/// DOCME
|
#include <vector>
|
||||||
#define CSRIAPI
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __WINDOWS__
|
#include "include/aegisub/subtitles_provider.h"
|
||||||
|
#ifdef WIN32
|
||||||
|
#define CSRIAPI
|
||||||
#include "../../contrib/csri/include/csri/csri.h"
|
#include "../../contrib/csri/include/csri/csri.h"
|
||||||
#else
|
#else
|
||||||
#include <csri/csri.h>
|
#include <csri/csri.h>
|
||||||
|
@ -55,32 +56,19 @@
|
||||||
/// DOCME
|
/// DOCME
|
||||||
class CSRISubtitlesProvider : public SubtitlesProvider {
|
class CSRISubtitlesProvider : public SubtitlesProvider {
|
||||||
/// DOCME
|
/// DOCME
|
||||||
wxString subType;
|
std::string subType;
|
||||||
|
|
||||||
/// DOCME
|
/// DOCME
|
||||||
csri_inst *instance;
|
std::tr1::shared_ptr<csri_inst> instance;
|
||||||
|
|
||||||
wxString tempfile;
|
wxString tempfile;
|
||||||
public:
|
public:
|
||||||
CSRISubtitlesProvider(wxString subType);
|
CSRISubtitlesProvider(std::string subType);
|
||||||
~CSRISubtitlesProvider();
|
~CSRISubtitlesProvider();
|
||||||
|
|
||||||
void LoadSubtitles(AssFile *subs);
|
void LoadSubtitles(AssFile *subs);
|
||||||
void DrawSubtitles(AegiVideoFrame &dst,double time);
|
void DrawSubtitles(AegiVideoFrame &dst,double time);
|
||||||
};
|
|
||||||
|
|
||||||
/// DOCME
|
static std::vector<std::string> GetSubTypes();
|
||||||
/// @class CSRISubtitlesProviderFactory
|
|
||||||
/// @brief DOCME
|
|
||||||
///
|
|
||||||
/// DOCME
|
|
||||||
class CSRISubtitlesProviderFactory : public SubtitlesProviderFactory {
|
|
||||||
public:
|
|
||||||
/// @brief DOCME
|
|
||||||
/// @param subType
|
|
||||||
///
|
|
||||||
SubtitlesProvider *CreateProvider(wxString subType=_T("")) { return new CSRISubtitlesProvider(subType); }
|
|
||||||
wxArrayString GetSubTypes();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -34,11 +34,8 @@
|
||||||
/// @ingroup subtitle_rendering
|
/// @ingroup subtitle_rendering
|
||||||
///
|
///
|
||||||
|
|
||||||
///////////
|
|
||||||
// Headers
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
|
||||||
#ifdef WITH_LIBASS
|
#ifdef WITH_LIBASS
|
||||||
|
|
||||||
#ifndef AGI_PRE
|
#ifndef AGI_PRE
|
||||||
|
@ -61,7 +58,6 @@ extern "C" {
|
||||||
#include "video_context.h"
|
#include "video_context.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Handle libass messages
|
/// @brief Handle libass messages
|
||||||
///
|
///
|
||||||
static void msg_callback(int level, const char *fmt, va_list args, void *data) {
|
static void msg_callback(int level, const char *fmt, va_list args, void *data) {
|
||||||
|
@ -74,11 +70,9 @@ static void msg_callback(int level, const char *fmt, va_list args, void *data) {
|
||||||
LOG_D("subtitle/provider/libass") << buf;
|
LOG_D("subtitle/provider/libass") << buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Constructor
|
/// @brief Constructor
|
||||||
///
|
///
|
||||||
LibassSubtitlesProvider::LibassSubtitlesProvider() {
|
LibassSubtitlesProvider::LibassSubtitlesProvider(std::string) {
|
||||||
// Initialize library
|
// Initialize library
|
||||||
static bool first = true;
|
static bool first = true;
|
||||||
if (first) {
|
if (first) {
|
||||||
|
@ -117,15 +111,11 @@ LibassSubtitlesProvider::LibassSubtitlesProvider() {
|
||||||
ass_set_fonts(ass_renderer, NULL, "Sans", 1, config_path, 1);
|
ass_set_fonts(ass_renderer, NULL, "Sans", 1, config_path, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Destructor
|
/// @brief Destructor
|
||||||
///
|
///
|
||||||
LibassSubtitlesProvider::~LibassSubtitlesProvider() {
|
LibassSubtitlesProvider::~LibassSubtitlesProvider() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Load subtitles
|
/// @brief Load subtitles
|
||||||
/// @param subs
|
/// @param subs
|
||||||
///
|
///
|
||||||
|
@ -140,8 +130,6 @@ void LibassSubtitlesProvider::LoadSubtitles(AssFile *subs) {
|
||||||
if (!ass_track) throw _T("libass failed to load subtitles.");
|
if (!ass_track) throw _T("libass failed to load subtitles.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// DOCME
|
/// DOCME
|
||||||
#define _r(c) ((c)>>24)
|
#define _r(c) ((c)>>24)
|
||||||
|
|
||||||
|
@ -210,10 +198,7 @@ void LibassSubtitlesProvider::DrawSubtitles(AegiVideoFrame &frame,double time) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// DOCME
|
/// DOCME
|
||||||
ASS_Library* LibassSubtitlesProvider::ass_library;
|
ASS_Library* LibassSubtitlesProvider::ass_library;
|
||||||
|
|
||||||
|
|
||||||
#endif // WITH_LIBASS
|
#endif // WITH_LIBASS
|
||||||
|
|
|
@ -34,12 +34,9 @@
|
||||||
/// @ingroup subtitle_rendering
|
/// @ingroup subtitle_rendering
|
||||||
///
|
///
|
||||||
|
|
||||||
///////////
|
|
||||||
// Headers
|
|
||||||
|
|
||||||
#ifdef WITH_LIBASS
|
#ifdef WITH_LIBASS
|
||||||
|
|
||||||
#include "subtitles_provider_manager.h"
|
#include "include/aegisub/subtitles_provider.h"
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#ifdef __VISUALC__
|
#ifdef __VISUALC__
|
||||||
#include "stdint.h"
|
#include "stdint.h"
|
||||||
|
@ -55,8 +52,6 @@ extern "C" {
|
||||||
///
|
///
|
||||||
/// DOCME
|
/// DOCME
|
||||||
class LibassSubtitlesProvider : public SubtitlesProvider {
|
class LibassSubtitlesProvider : public SubtitlesProvider {
|
||||||
private:
|
|
||||||
|
|
||||||
/// DOCME
|
/// DOCME
|
||||||
static ASS_Library* ass_library;
|
static ASS_Library* ass_library;
|
||||||
|
|
||||||
|
@ -67,27 +62,10 @@ private:
|
||||||
ASS_Track* ass_track;
|
ASS_Track* ass_track;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
LibassSubtitlesProvider();
|
LibassSubtitlesProvider(std::string);
|
||||||
~LibassSubtitlesProvider();
|
~LibassSubtitlesProvider();
|
||||||
|
|
||||||
void LoadSubtitles(AssFile *subs);
|
void LoadSubtitles(AssFile *subs);
|
||||||
void DrawSubtitles(AegiVideoFrame &dst,double time);
|
void DrawSubtitles(AegiVideoFrame &dst,double time);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// DOCME
|
|
||||||
/// @class LibassSubtitlesProviderFactory
|
|
||||||
/// @brief DOCME
|
|
||||||
///
|
|
||||||
/// DOCME
|
|
||||||
class LibassSubtitlesProviderFactory : public SubtitlesProviderFactory {
|
|
||||||
public:
|
|
||||||
|
|
||||||
/// @brief DOCME
|
|
||||||
/// @param subType
|
|
||||||
///
|
|
||||||
SubtitlesProvider *CreateProvider(wxString subType=_T("")) { return new LibassSubtitlesProvider(); }
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,62 +0,0 @@
|
||||||
// Copyright (c) 2007, Rodrigo Braz Monteiro
|
|
||||||
// All rights reserved.
|
|
||||||
//
|
|
||||||
// Redistribution and use in source and binary forms, with or without
|
|
||||||
// modification, are permitted provided that the following conditions are met:
|
|
||||||
//
|
|
||||||
// * Redistributions of source code must retain the above copyright notice,
|
|
||||||
// this list of conditions and the following disclaimer.
|
|
||||||
// * Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
// this list of conditions and the following disclaimer in the documentation
|
|
||||||
// and/or other materials provided with the distribution.
|
|
||||||
// * Neither the name of the Aegisub Group nor the names of its contributors
|
|
||||||
// may be used to endorse or promote products derived from this software
|
|
||||||
// without specific prior written permission.
|
|
||||||
//
|
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
|
||||||
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
||||||
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
||||||
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
||||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
||||||
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
||||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
// POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
//
|
|
||||||
// Aegisub Project http://www.aegisub.org/
|
|
||||||
//
|
|
||||||
// $Id$
|
|
||||||
|
|
||||||
/// @file subtitles_provider_manager.h
|
|
||||||
/// @brief Keep track of installed subtitle renderers
|
|
||||||
/// @ingroup subtitle_rendering
|
|
||||||
///
|
|
||||||
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
|
|
||||||
///////////
|
|
||||||
// Headers
|
|
||||||
#include "factory_manager.h"
|
|
||||||
#include "include/aegisub/subtitles_provider.h"
|
|
||||||
#include "video_frame.h"
|
|
||||||
|
|
||||||
|
|
||||||
/// DOCME
|
|
||||||
/// @class SubtitlesProviderFactoryManager
|
|
||||||
/// @brief DOCME
|
|
||||||
///
|
|
||||||
/// DOCME
|
|
||||||
class SubtitlesProviderFactoryManager : public FactoryManager<SubtitlesProviderFactory> {
|
|
||||||
public:
|
|
||||||
static SubtitlesProvider *GetProvider();
|
|
||||||
static void RegisterProviders();
|
|
||||||
static void ClearProviders();
|
|
||||||
static bool ProviderAvailable();
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@
|
||||||
#include "ass_exporter.h"
|
#include "ass_exporter.h"
|
||||||
#include "ass_file.h"
|
#include "ass_file.h"
|
||||||
#include "compat.h"
|
#include "compat.h"
|
||||||
#include "subtitles_provider_manager.h"
|
#include "include/aegisub/subtitles_provider.h"
|
||||||
#include "video_provider_manager.h"
|
#include "video_provider_manager.h"
|
||||||
|
|
||||||
// Test if a line is a dialogue line which is not visible at the given time
|
// Test if a line is a dialogue line which is not visible at the given time
|
||||||
|
@ -152,8 +152,8 @@ void *ThreadedFrameSource::Entry() {
|
||||||
|
|
||||||
ThreadedFrameSource::ThreadedFrameSource(wxString videoFileName, wxEvtHandler *parent)
|
ThreadedFrameSource::ThreadedFrameSource(wxString videoFileName, wxEvtHandler *parent)
|
||||||
: wxThread()
|
: wxThread()
|
||||||
, provider(SubtitlesProviderFactoryManager::GetProvider())
|
, provider(SubtitlesProviderFactory::GetProvider())
|
||||||
, videoProvider(VideoProviderFactoryManager::GetProvider(videoFileName))
|
, videoProvider(VideoProviderFactory::GetProvider(videoFileName))
|
||||||
, parent(parent)
|
, parent(parent)
|
||||||
, nextTime(-1.)
|
, nextTime(-1.)
|
||||||
, jobReady(jobMutex)
|
, jobReady(jobMutex)
|
||||||
|
|
|
@ -59,6 +59,8 @@
|
||||||
#include "ass_time.h"
|
#include "ass_time.h"
|
||||||
#include "audio_display.h"
|
#include "audio_display.h"
|
||||||
#include "compat.h"
|
#include "compat.h"
|
||||||
|
#include "include/aegisub/audio_player.h"
|
||||||
|
#include "include/aegisub/audio_provider.h"
|
||||||
#include "include/aegisub/video_provider.h"
|
#include "include/aegisub/video_provider.h"
|
||||||
#include "keyframe.h"
|
#include "keyframe.h"
|
||||||
#include <libaegisub/access.h>
|
#include <libaegisub/access.h>
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
//
|
//
|
||||||
// Aegisub Project http://www.aegisub.org/
|
// Aegisub Project http://www.aegisub.org/
|
||||||
//
|
//
|
||||||
// $Id: video_out_gl.h 3613 2009-10-05 00:06:11Z plorkyeran $
|
// $Id$
|
||||||
|
|
||||||
/// @file video_out_gl.h
|
/// @file video_out_gl.h
|
||||||
/// @brief OpenGL based video renderer
|
/// @brief OpenGL based video renderer
|
||||||
|
|
|
@ -95,19 +95,4 @@ public:
|
||||||
wxString GetWarning() const;
|
wxString GetWarning() const;
|
||||||
wxString GetDecoderName() const { return wxString(L"Avisynth/") + decoderName; }
|
wxString GetDecoderName() const { return wxString(L"Avisynth/") + decoderName; }
|
||||||
};
|
};
|
||||||
|
|
||||||
/// DOCME
|
|
||||||
/// @class AvisynthVideoProviderFactory
|
|
||||||
/// @brief DOCME
|
|
||||||
///
|
|
||||||
/// DOCME
|
|
||||||
class AvisynthVideoProviderFactory : public VideoProviderFactory {
|
|
||||||
public:
|
|
||||||
|
|
||||||
/// @brief DOCME
|
|
||||||
/// @param video
|
|
||||||
///
|
|
||||||
VideoProvider *CreateProvider(wxString video) { return new AvisynthVideoProvider(video); }
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -86,15 +86,4 @@ public:
|
||||||
/// @return Returns true.
|
/// @return Returns true.
|
||||||
bool WantsCaching() const { return true; }
|
bool WantsCaching() const { return true; }
|
||||||
};
|
};
|
||||||
|
|
||||||
/// @class FFmpegSourceVideoProviderFactory
|
|
||||||
/// @brief Creates a FFmpegSource video provider.
|
|
||||||
class FFmpegSourceVideoProviderFactory : public VideoProviderFactory {
|
|
||||||
public:
|
|
||||||
/// @brief Creates a FFmpegSource video provider.
|
|
||||||
/// @param video The video filename to open.
|
|
||||||
/// @return Returns the video provider.
|
|
||||||
VideoProvider *CreateProvider(wxString video) { return new FFmpegSourceVideoProvider(video); }
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* WITH_FFMPEGSOURCE */
|
#endif /* WITH_FFMPEGSOURCE */
|
||||||
|
|
|
@ -57,7 +57,7 @@
|
||||||
/// @param video
|
/// @param video
|
||||||
/// @return
|
/// @return
|
||||||
///
|
///
|
||||||
VideoProvider *VideoProviderFactoryManager::GetProvider(wxString video) {
|
VideoProvider *VideoProviderFactory::GetProvider(wxString video) {
|
||||||
// First check special case of dummy video
|
// First check special case of dummy video
|
||||||
if (video.StartsWith(_T("?dummy:"))) {
|
if (video.StartsWith(_T("?dummy:"))) {
|
||||||
return new DummyVideoProvider(video.wc_str());
|
return new DummyVideoProvider(video.wc_str());
|
||||||
|
@ -73,21 +73,23 @@ VideoProvider *VideoProviderFactoryManager::GetProvider(wxString video) {
|
||||||
LOG_E("manager/video/provider/yuv4mpeg") << "Provider creation failed with reason: "<< temp.c_str() << " trying other providers";
|
LOG_E("manager/video/provider/yuv4mpeg") << "Provider creation failed with reason: "<< temp.c_str() << " trying other providers";
|
||||||
}
|
}
|
||||||
catch (...) {
|
catch (...) {
|
||||||
LOG_E("manager/video/provider/yuv4mpeg") << "Provider creation failed (uknown reason) trying other providers";
|
LOG_E("manager/video/provider/yuv4mpeg") << "Provider creation failed (unknown reason) trying other providers";
|
||||||
}
|
}
|
||||||
|
|
||||||
// List of providers
|
// List of providers
|
||||||
wxArrayString list = GetFactoryList(lagi_wxString(OPT_GET("Video/Provider")->GetString()));
|
std::vector<std::string> list = GetClasses(OPT_GET("Video/Provider")->GetString());
|
||||||
|
if (video.StartsWith("?dummy")) list.insert(list.begin(), "Dummy");
|
||||||
|
list.insert(list.begin(), "YUV4MPEG");
|
||||||
|
|
||||||
// None available
|
// None available
|
||||||
if (list.Count() == 0) throw _T("No video providers are available.");
|
if (list.empty()) throw _T("No video providers are available.");
|
||||||
|
|
||||||
// Get provider
|
// Get provider
|
||||||
wxString error;
|
wxString error;
|
||||||
for (unsigned int i=0;i<list.Count();i++) {
|
for (unsigned int i=0;i<list.size();i++) {
|
||||||
try {
|
try {
|
||||||
// Create provider
|
// Create provider
|
||||||
VideoProvider *provider = GetFactory(list[i])->CreateProvider(video);
|
VideoProvider *provider = Create(list[i], video);
|
||||||
if (provider) {
|
if (provider) {
|
||||||
// Cache if necessary
|
// Cache if necessary
|
||||||
if (provider->WantsCaching()) {
|
if (provider->WantsCaching()) {
|
||||||
|
@ -105,30 +107,18 @@ VideoProvider *VideoProviderFactoryManager::GetProvider(wxString video) {
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Register all providers
|
/// @brief Register all providers
|
||||||
///
|
///
|
||||||
void VideoProviderFactoryManager::RegisterProviders() {
|
void VideoProviderFactory::RegisterProviders() {
|
||||||
#ifdef WITH_AVISYNTH
|
#ifdef WITH_AVISYNTH
|
||||||
RegisterFactory(new AvisynthVideoProviderFactory(),_T("Avisynth"));
|
Register<AvisynthVideoProvider>("Avisynth");
|
||||||
#endif
|
#endif
|
||||||
#ifdef WITH_FFMPEGSOURCE
|
#ifdef WITH_FFMPEGSOURCE
|
||||||
RegisterFactory(new FFmpegSourceVideoProviderFactory(),_T("FFmpegSource"));
|
Register<FFmpegSourceVideoProvider>("FFmpegSource");
|
||||||
#endif
|
#endif
|
||||||
|
Register<DummyVideoProvider>("Dummy", true);
|
||||||
|
Register<YUV4MPEGVideoProvider>("YUV4MPEG", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Clear all providers
|
|
||||||
///
|
|
||||||
void VideoProviderFactoryManager::ClearProviders() {
|
|
||||||
ClearFactories();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// DOCME
|
/// DOCME
|
||||||
template <class VideoProviderFactory> std::map<wxString,VideoProviderFactory*>* FactoryManager<VideoProviderFactory>::factories=NULL;
|
template<> VideoProviderFactory::map *FactoryBase<VideoProvider *(*)(wxString)>::classes = NULL;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -34,30 +34,11 @@
|
||||||
/// @ingroup video_input
|
/// @ingroup video_input
|
||||||
///
|
///
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//////////
|
|
||||||
// Headers
|
|
||||||
#ifndef AGI_PRE
|
|
||||||
#include <wx/intl.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "factory_manager.h"
|
#include "factory_manager.h"
|
||||||
#include "include/aegisub/video_provider.h"
|
#include "include/aegisub/video_provider.h"
|
||||||
#include "video_frame.h"
|
|
||||||
|
|
||||||
|
class VideoProviderFactory : public Factory1<VideoProvider, wxString> {
|
||||||
/// DOCME
|
|
||||||
/// @class VideoProviderFactoryManager
|
|
||||||
/// @brief DOCME
|
|
||||||
///
|
|
||||||
/// DOCME
|
|
||||||
class VideoProviderFactoryManager : public FactoryManager<VideoProviderFactory> {
|
|
||||||
public:
|
public:
|
||||||
static void RegisterProviders();
|
|
||||||
static VideoProvider *GetProvider(wxString video);
|
static VideoProvider *GetProvider(wxString video);
|
||||||
static void ClearProviders();
|
static void RegisterProviders();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue