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:
Thomas Goyne 2010-08-02 06:31:38 +00:00
parent f0aa85dfbb
commit 71fb04cd29
65 changed files with 276 additions and 1308 deletions

View file

@ -495,10 +495,6 @@
RelativePath="..\..\src\audio_provider_hd.h"
>
</File>
<File
RelativePath="..\..\src\audio_provider_manager.h"
>
</File>
<File
RelativePath="..\..\src\audio_provider_pcm.cpp"
>
@ -1443,10 +1439,6 @@
RelativePath="..\..\src\spellchecker_hunspell.h"
>
</File>
<File
RelativePath="..\..\src\spellchecker_manager.h"
>
</File>
<File
RelativePath="..\..\src\thesaurus.cpp"
>
@ -1571,10 +1563,6 @@
RelativePath="..\..\src\subtitles_provider_libass.h"
>
</File>
<File
RelativePath="..\..\src\subtitles_provider_manager.h"
>
</File>
</Filter>
<Filter
Name="Visual Tools"

View file

@ -34,9 +34,6 @@
/// @ingroup audio_ui
///
///////////
// Headers
#include "config.h"
#ifndef AGI_PRE
@ -55,6 +52,7 @@
#include "audio_karaoke.h"
#include "frame_main.h"
#include "hotkeys.h"
#include "include/aegisub/audio_player.h"
#include "libresrc/libresrc.h"
#include "main.h"
#include "toggle_bitmap.h"

View file

@ -57,6 +57,8 @@
#include "compat.h"
#include "fft.h"
#include "hotkeys.h"
#include "include/aegisub/audio_player.h"
#include "include/aegisub/audio_provider.h"
#include "main.h"
#include "standard_paths.h"
#include "subs_edit_box.h"
@ -895,14 +897,14 @@ void AudioDisplay::SetFile(wxString file) {
is_dummy = true;
provider = new DummyAudioProvider(150*60*1000, true); // 150 minutes noise
} else {
provider = AudioProviderFactoryManager::GetAudioProvider(file);
provider = AudioProviderFactory::GetProvider(file);
}
#else
provider = AudioProviderFactoryManager::GetAudioProvider(file);
provider = AudioProviderFactory::GetProvider(file);
#endif
// Get player
player = AudioPlayerFactoryManager::GetAudioPlayer();
player = AudioPlayerFactory::GetAudioPlayer();
player->SetDisplayTimer(&UpdateTimer);
player->SetProvider(provider);
player->OpenStream();

View file

@ -44,10 +44,10 @@
#include <wx/window.h>
#endif
#include "audio_player_manager.h"
#include "audio_provider_manager.h"
#include "audio_renderer_spectrum.h"
class AudioPlayer;
class AudioProvider;
class AssDialogue;
class SubtitlesGrid;
class AudioBox;

View file

@ -34,9 +34,6 @@
/// @ingroup audio_output
///
///////////
// Headers
#include "config.h"
#ifdef WITH_ALSA
@ -46,7 +43,6 @@
#include "audio_player_dsound.h"
#include "audio_player_dsound2.h"
#endif
#include "audio_player_manager.h"
#ifdef WITH_OPENAL
#include "audio_player_openal.h"
#endif
@ -62,8 +58,6 @@
#include "compat.h"
#include "main.h"
/// @brief Constructor
///
AudioPlayer::AudioPlayer() {
@ -71,8 +65,6 @@ AudioPlayer::AudioPlayer() {
displayTimer = NULL;
}
/// @brief Destructor
///
AudioPlayer::~AudioPlayer() {
@ -82,44 +74,6 @@ AudioPlayer::~AudioPlayer() {
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
///
void AudioPlayer::RequestStop() {
@ -128,16 +82,12 @@ void AudioPlayer::RequestStop() {
AddPendingEvent(event); // thread safe
}
/////////
// Event
DEFINE_EVENT_TYPE(wxEVT_STOP_AUDIO)
BEGIN_EVENT_TABLE(AudioPlayer, wxEvtHandler)
EVT_COMMAND (1000, wxEVT_STOP_AUDIO, AudioPlayer::OnStopAudio)
END_EVENT_TABLE()
/// @brief DOCME
/// @param event
///
@ -145,31 +95,23 @@ void AudioPlayer::OnStopAudio(wxCommandEvent &event) {
Stop(false);
}
/// @brief Get player
/// @return
///
AudioPlayer* AudioPlayerFactoryManager::GetAudioPlayer() {
// List of providers
wxArrayString list = GetFactoryList(lagi_wxString(OPT_GET("Audio/Player")->GetString()));
AudioPlayer* AudioPlayerFactory::GetAudioPlayer() {
std::vector<std::string> list = GetClasses(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;
for (unsigned int i=0;i<list.Count();i++) {
for (unsigned int i=0;i<list.size();i++) {
try {
AudioPlayer *player = GetFactory(list[i])->CreatePlayer();
AudioPlayer *player = Create(list[i]);
if (player) return player;
}
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 (...) { error += list[i] + _T(" factory: Unknown error\n"); }
}
// Failed
throw error;
}
@ -177,40 +119,26 @@ AudioPlayer* AudioPlayerFactoryManager::GetAudioPlayer() {
/// @brief Register all factories
///
void AudioPlayerFactoryManager::RegisterProviders() {
void AudioPlayerFactory::RegisterProviders() {
#ifdef WITH_ALSA
RegisterFactory(new AlsaPlayerFactory(),_T("ALSA"));
Register<AlsaPlayer>("ALSA");
#endif
#ifdef WITH_DIRECTSOUND
RegisterFactory(new DirectSoundPlayerFactory(),_T("DirectSound-old"));
RegisterFactory(new DirectSoundPlayer2Factory(),_T("DirectSound"));
Register<DirectSoundPlayer>("DirectSound-old");
Register<DirectSoundPlayer2>("DirectSound");
#endif
#ifdef WITH_OPENAL
RegisterFactory(new OpenALPlayerFactory(),_T("OpenAL"));
Register<OpenALPlayer>("OpenAL");
#endif
#ifdef WITH_PORTAUDIO
RegisterFactory(new PortAudioPlayerFactory(),_T("PortAudio"));
Register<PortAudioPlayer>("PortAudio");
#endif
#ifdef WITH_PULSEAUDIO
RegisterFactory(new PulseAudioPlayerFactory(),_T("PulseAudio"));
Register<PulseAudioPlayer>("PulseAudio");
#endif
#ifdef WITH_OSS
RegisterFactory(new OSSPlayerFactory(),_T("OSS"));
Register<OSSPlayer>("OSS");
#endif
}
/// @brief Clear all factories
///
void AudioPlayerFactoryManager::ClearProviders() {
ClearFactories();
}
/// DOCME
template <class AudioPlayerFactory> std::map<wxString,AudioPlayerFactory*>* FactoryManager<AudioPlayerFactory>::factories=NULL;
template<> AudioPlayerFactory::map *FactoryBase<AudioPlayer *(*)()>::classes = NULL;

View file

@ -40,14 +40,9 @@
#ifdef WITH_ALSA
///////////
// Headers
#include <libaegisub/log.h>
#include "audio_player_alsa.h"
#include "audio_player_manager.h"
#include "audio_provider_manager.h"
#include "main.h"
#include "compat.h"
#include "frame_main.h"
@ -65,8 +60,6 @@ AlsaPlayer::AlsaPlayer()
provider = 0;
}
/// @brief Destructor
///
AlsaPlayer::~AlsaPlayer()
@ -74,8 +67,6 @@ AlsaPlayer::~AlsaPlayer()
CloseStream();
}
/// @brief Open stream
///
void AlsaPlayer::OpenStream()
@ -105,8 +96,6 @@ void AlsaPlayer::OpenStream()
open = true;
}
/// @brief DOCME
///
void AlsaPlayer::SetUpHardware()
@ -202,8 +191,6 @@ void AlsaPlayer::SetUpHardware()
snd_pcm_hw_params_free(hwparams);
}
/// @brief DOCME
///
void AlsaPlayer::SetUpAsync()
@ -249,8 +236,6 @@ void AlsaPlayer::SetUpAsync()
}
}
/// @brief Close stream
/// @return
///
@ -270,8 +255,6 @@ void AlsaPlayer::CloseStream()
open = false;
}
/// @brief Play
/// @param start
/// @param count
@ -301,8 +284,6 @@ void AlsaPlayer::Play(int64_t start,int64_t count)
if (displayTimer && !displayTimer->IsRunning()) displayTimer->Start(15);
}
/// @brief Stop
/// @param timerToo
/// @return
@ -326,8 +307,6 @@ void AlsaPlayer::Stop(bool timerToo)
}
}
/// @brief DOCME
/// @return
///
@ -336,8 +315,6 @@ bool AlsaPlayer::IsPlaying()
return playing;
}
/// @brief Set end
/// @param pos
///
@ -346,8 +323,6 @@ void AlsaPlayer::SetEndPosition(int64_t pos)
end_frame = pos;
}
/// @brief Set current position
/// @param pos
///
@ -356,8 +331,6 @@ void AlsaPlayer::SetCurrentPosition(int64_t pos)
cur_frame = pos;
}
/// @brief DOCME
/// @return
///
@ -366,8 +339,6 @@ int64_t AlsaPlayer::GetStartPosition()
return start_frame;
}
/// @brief DOCME
/// @return
///
@ -376,8 +347,6 @@ int64_t AlsaPlayer::GetEndPosition()
return end_frame;
}
/// @brief Get current position
/// @return
///
@ -390,8 +359,6 @@ int64_t AlsaPlayer::GetCurrentPosition()
return cur_frame - delay;
}
/// @brief DOCME
/// @param pcm_callback
///
@ -439,7 +406,4 @@ void AlsaPlayer::async_write_handler(snd_async_handler_t *pcm_callback)
free(buf);
}
#endif // WITH_ALSA

View file

@ -37,9 +37,6 @@
#ifdef WITH_ALSA
///////////
// Headers
#include <alsa/asoundlib.h>
#include "include/aegisub/audio_player.h"
@ -148,22 +145,4 @@ public:
double GetVolume() { return volume; }
};
/// DOCME
/// @class AlsaPlayerFactory
/// @brief DOCME
///
/// DOCME
class AlsaPlayerFactory : public AudioPlayerFactory {
public:
/// @brief DOCME
///
AudioPlayer *CreatePlayer() { return new AlsaPlayer(); }
};
#endif

View file

@ -183,25 +183,5 @@ public:
/// @return
///
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

View file

@ -34,15 +34,12 @@
/// @ingroup audio_output
///
#ifdef WITH_DIRECTSOUND
#include "include/aegisub/audio_player.h"
class DirectSoundPlayer2Thread;
/// @class DirectSoundPlayer2
/// @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
/// send commands to the playback thread.
class DirectSoundPlayer2 : public AudioPlayer {
/// The playback thread
DirectSoundPlayer2Thread *thread;
@ -86,18 +82,4 @@ public:
void SetVolume(double vol);
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

View file

@ -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)

View file

@ -34,19 +34,13 @@
/// @ingroup audio_output
///
#include "config.h"
#ifdef WITH_OPENAL
///////////
// Headers
#include <libaegisub/log.h>
#include "audio_player_manager.h"
#include "audio_player_openal.h"
#include "audio_provider_manager.h"
#include "frame_main.h"
#include "utils.h"
@ -61,14 +55,11 @@
#include <AL/alc.h>
#endif
// Auto-link to OpenAL lib for MSVC
#ifdef _MSC_VER
#pragma comment(lib, "openal32.lib")
#endif
/// @brief Constructor
///
OpenALPlayer::OpenALPlayer()
@ -80,8 +71,6 @@ OpenALPlayer::OpenALPlayer()
provider = 0;
}
/// @brief Destructor
///
OpenALPlayer::~OpenALPlayer()
@ -375,6 +364,3 @@ int64_t OpenALPlayer::GetCurrentPosition()
#endif // WITH_OPENAL

View file

@ -36,11 +36,6 @@
#ifdef WITH_OPENAL
///////////
// Headers
#include "audio_player_manager.h"
#include "include/aegisub/audio_player.h"
#include "include/aegisub/audio_provider.h"
#include "utils.h"
@ -56,8 +51,6 @@
#include <AL/alc.h>
#endif
/// DOCME
/// @class OpenALPlayer
/// @brief DOCME
@ -164,23 +157,4 @@ public:
///
double GetVolume() { return volume; }
};
/// DOCME
/// @class OpenALPlayerFactory
/// @brief DOCME
///
/// DOCME
class OpenALPlayerFactory : public AudioPlayerFactory {
public:
/// @brief DOCME
///
AudioPlayer *CreatePlayer() { return new OpenALPlayer(); }
};
#endif

View file

@ -37,13 +37,9 @@
#ifdef WITH_OSS
///////////
// Headers
#include <libaegisub/log.h>
#include "audio_player_manager.h"
#include "audio_player_oss.h"
#include "audio_provider_manager.h"
#include "frame_main.h"
#include "compat.h"
#include "main.h"

View file

@ -37,10 +37,6 @@
#include "config.h"
#ifdef WITH_OSS
///////////
// Headers
#ifndef AGI_PRE
#include <sys/ioctl.h>
#endif
@ -58,13 +54,8 @@
#include "include/aegisub/audio_provider.h"
#include "utils.h"
//////////////
// Prototypes
class OSSPlayer;
/// DOCME
/// @class OSSPlayerThread
/// @brief DOCME
@ -153,21 +144,4 @@ public:
///
double GetVolume() { return volume; }
};
/// DOCME
/// @class OSSPlayerFactory
/// @brief DOCME
///
/// DOCME
class OSSPlayerFactory : public AudioPlayerFactory {
public:
/// @brief DOCME
///
AudioPlayer *CreatePlayer() { return new OSSPlayer(); }
};
#endif

View file

@ -37,9 +37,6 @@
#ifdef WITH_PORTAUDIO
///////////
// Headers
#include "include/aegisub/audio_player.h"
#include "include/aegisub/audio_provider.h"
#include "utils.h"
@ -47,7 +44,6 @@ extern "C" {
#include <portaudio.h>
}
/// @class PortAudioPlayer
/// @brief PortAudio Player
///
@ -126,16 +122,4 @@ public:
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

View file

@ -34,20 +34,15 @@
/// @ingroup audio_output
///
#include "config.h"
#ifdef WITH_PULSEAUDIO
///////////
// Headers
#ifndef AGI_PRE
#include <stdio.h>
#endif
#include "audio_player_pulse.h"
#include "audio_provider_manager.h"
#include "utils.h"
@ -451,7 +446,4 @@ void PulseAudioPlayer::pa_stream_notify(pa_stream *p, PulseAudioPlayer *thread)
thread->stream_notify.Post();
}
#endif // WITH_PULSEAUDIO

View file

@ -34,12 +34,7 @@
/// @ingroup audio_output
///
#ifdef WITH_PULSEAUDIO
///////////
// Headers
#ifndef AGI_PRE
#include <stdio.h>
#endif
@ -50,14 +45,8 @@
#include "include/aegisub/audio_provider.h"
#include "utils.h"
//////////////
// Prototypes
class PulseAudioPlayer;
/// DOCME
/// @class PulseAudioPlayer
/// @brief DOCME
@ -170,22 +159,4 @@ public:
double GetVolume() { return volume; }
};
/// DOCME
/// @class PulseAudioPlayerFactory
/// @brief DOCME
///
/// DOCME
class PulseAudioPlayerFactory : public AudioPlayerFactory {
public:
/// @brief DOCME
///
AudioPlayer *CreatePlayer() { return new PulseAudioPlayer(); }
};
#endif

View file

@ -35,15 +35,12 @@
///
///////////
// Headers
#include "config.h"
#ifndef AGI_PRE
#include <wx/thread.h>
#endif
#include "audio_display.h"
#ifdef WITH_AVISYNTH
#include "audio_provider_avs.h"
#endif
@ -57,71 +54,17 @@
#include "compat.h"
#include "main.h"
/// @brief Constructor
///
AudioProvider::AudioProvider() {
raw = NULL;
AudioProvider::AudioProvider() : raw(NULL) {
}
/// @brief Destructor
///
AudioProvider::~AudioProvider() {
// Clear buffers
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
/// @param min
/// @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
/// @param buf
/// @param start
@ -230,15 +171,12 @@ void AudioProvider::GetAudioWithVolume(void *buf, int64_t start, int64_t count,
}
}
/// @brief Get provider
/// @param filename
/// @param cache
/// @return
///
AudioProvider *AudioProviderFactoryManager::GetAudioProvider(wxString filename, int cache) {
// Prepare provider
AudioProvider *AudioProviderFactory::GetProvider(wxString filename, int cache) {
AudioProvider *provider = NULL;
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)
return provider;
else {
provider = CreateConvertAudioProvider(provider);
return provider;
return CreateConvertAudioProvider(provider);
}
}
}
// 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.Count() == 0) throw _T("No audio providers are available.");
if (list.empty()) throw _T("No audio providers are available.");
// Get provider
wxString error;
for (unsigned int i=0;i<list.Count();i++) {
for (unsigned int i=0;i<list.size();i++) {
try {
AudioProvider *prov = GetFactory(list[i])->CreateProvider(filename.wc_str());
if (prov) {
provider = prov;
break;
}
provider = Create(list[i], filename);
if (provider) break;
}
catch (wxString err) { error += list[i] + _T(" factory: ") + 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
if (final) {
delete provider;
provider = final;
return final;
}
}
// Return
return provider;
}
@ -308,26 +240,13 @@ AudioProvider *AudioProviderFactoryManager::GetAudioProvider(wxString filename,
/// @brief Register all providers
///
void AudioProviderFactoryManager::RegisterProviders() {
void AudioProviderFactory::RegisterProviders() {
#ifdef WITH_AVISYNTH
RegisterFactory(new AvisynthAudioProviderFactory(),_T("Avisynth"));
Register<AvisynthAudioProvider>("Avisynth");
#endif
#ifdef WITH_FFMPEGSOURCE
RegisterFactory(new FFmpegSourceAudioProviderFactory(),_T("FFmpegSource"));
Register<FFmpegSourceAudioProvider>("FFmpegSource");
#endif
}
/// @brief Clear all providers
///
void AudioProviderFactoryManager::ClearProviders() {
ClearFactories();
}
/// DOCME
template <class AudioProviderFactory> std::map<wxString,AudioProviderFactory*>* FactoryManager<AudioProviderFactory>::factories=NULL;
template<> AudioProviderFactory::map *FactoryBase<AudioProvider *(*)(wxString)>::classes = NULL;

View file

@ -34,9 +34,6 @@
/// @ingroup audio_input
///
///////////
// Headers
#ifdef WITH_AVISYNTH
#include <Mmreg.h>
#include "include/aegisub/audio_provider.h"
@ -69,31 +66,12 @@ public:
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
///
bool AreSamplesNativeEndian() { return true; }
bool AreSamplesNativeEndian() const { return true; }
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);
};
/// DOCME
/// @class AvisynthAudioProviderFactory
/// @brief DOCME
///
/// DOCME
class AvisynthAudioProviderFactory : public AudioProviderFactory {
public:
/// @brief DOCME
/// @param file
///
AudioProvider *CreateProvider(wxString file) { return new AvisynthAudioProvider(file); }
};
#endif

View file

@ -34,9 +34,6 @@
/// @ingroup audio_input
///
///////////
// Headers
#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:
/// @return
///
bool AreSamplesNativeEndian() { return true; }
bool AreSamplesNativeEndian() const { return true; }
void GetAudio(void *buf, int64_t start, int64_t count);
@ -76,6 +73,3 @@ public:
};
AudioProvider *CreateConvertAudioProvider(AudioProvider *source_provider);

View file

@ -59,11 +59,7 @@ public:
/// @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);
};

View file

@ -34,12 +34,8 @@
/// @ingroup audio_input
///
///////////
// Headers
#include "include/aegisub/audio_provider.h"
/// DOCME
/// @class DummyAudioProvider
/// @brief DOCME
@ -58,9 +54,7 @@ public:
/// @brief DOCME
///
bool AreSamplesNativeEndian() { return true; }
bool AreSamplesNativeEndian() const { return true; }
void GetAudio(void *buf, int64_t start, int64_t count);
};

View file

@ -34,8 +34,6 @@
/// @ingroup audio_input ffms
///
///////////
// Headers
#ifdef WITH_FFMPEGSOURCE
#include "include/aegisub/audio_provider.h"
#include "ffmpegsource_common.h"
@ -62,24 +60,8 @@ public:
/// @brief Checks sample endianness
/// @return Returns true.
/// 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);
};
/// @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 */
#endif

View file

@ -34,9 +34,6 @@
/// @ingroup audio_input
///
///////////
// Headers
#ifndef AGI_PRE
#include <wx/file.h>
#include <wx/thread.h>
@ -44,8 +41,6 @@
#include "include/aegisub/audio_provider.h"
/// DOCME
/// @class HDAudioProvider
/// @brief DOCME
@ -79,9 +74,7 @@ public:
/// @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);
};

View file

@ -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();
};

View file

@ -436,7 +436,7 @@ public:
/// @brief DOCME
/// @return
///
bool AreSamplesNativeEndian()
bool AreSamplesNativeEndian() const
{
// 8 bit samples don't consider endianness
if (bytes_per_sample < 2) return true;
@ -657,7 +657,7 @@ public:
/// @brief DOCME
/// @return
///
bool AreSamplesNativeEndian()
bool AreSamplesNativeEndian() const
{
// 8 bit samples don't consider endianness
if (bytes_per_sample < 2) return true;