forked from mia/Aegisub
Eliminate a use of VideoContext::Get in AudioMarkerProviderKeyframes
Originally committed to SVN as r5660.
This commit is contained in:
parent
6bf4a95428
commit
77d02d269d
1 changed files with 12 additions and 6 deletions
|
@ -117,8 +117,8 @@ class AudioMarkerProviderKeyframes : public AudioMarkerProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
AudioMarkerProviderKeyframes(AudioController *controller)
|
AudioMarkerProviderKeyframes(AudioController *controller, agi::Context *c)
|
||||||
: vc(VideoContext::Get())
|
: vc(c->videoController)
|
||||||
, keyframe_slot(vc->AddKeyframesListener(&AudioMarkerProviderKeyframes::Update, this))
|
, keyframe_slot(vc->AddKeyframesListener(&AudioMarkerProviderKeyframes::Update, this))
|
||||||
, audio_open_slot(controller->AddAudioOpenListener(&AudioMarkerProviderKeyframes::Update, this))
|
, audio_open_slot(controller->AddAudioOpenListener(&AudioMarkerProviderKeyframes::Update, this))
|
||||||
, timecode_slot(vc->AddTimecodesListener(&AudioMarkerProviderKeyframes::Update, this))
|
, timecode_slot(vc->AddTimecodesListener(&AudioMarkerProviderKeyframes::Update, this))
|
||||||
|
@ -146,7 +146,6 @@ AudioController::AudioController(agi::Context *context)
|
||||||
, subtitle_save_slot(context->ass->AddFileSaveListener(&AudioController::OnSubtitlesSave, this))
|
, subtitle_save_slot(context->ass->AddFileSaveListener(&AudioController::OnSubtitlesSave, this))
|
||||||
, player(0)
|
, player(0)
|
||||||
, provider(0)
|
, provider(0)
|
||||||
, keyframes_marker_provider(new AudioMarkerProviderKeyframes(this))
|
|
||||||
, playback_mode(PM_NotPlaying)
|
, playback_mode(PM_NotPlaying)
|
||||||
, playback_timer(this)
|
, playback_timer(this)
|
||||||
{
|
{
|
||||||
|
@ -156,8 +155,6 @@ AudioController::AudioController(agi::Context *context)
|
||||||
Bind(wxEVT_POWER_SUSPENDED, &AudioController::OnComputerSuspending, this);
|
Bind(wxEVT_POWER_SUSPENDED, &AudioController::OnComputerSuspending, this);
|
||||||
Bind(wxEVT_POWER_RESUME, &AudioController::OnComputerResuming, this);
|
Bind(wxEVT_POWER_RESUME, &AudioController::OnComputerResuming, this);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
keyframes_marker_provider->AddMarkerMovedListener(std::tr1::bind(std::tr1::ref(AnnounceMarkerMoved)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -300,6 +297,15 @@ void AudioController::OpenAudio(const wxString &url)
|
||||||
|
|
||||||
config::mru->Add("Audio", STD_STR(url));
|
config::mru->Add("Audio", STD_STR(url));
|
||||||
|
|
||||||
|
if (!keyframes_marker_provider.get())
|
||||||
|
{
|
||||||
|
// This is lazy-loaded as the video controller may not exist yet when
|
||||||
|
// the audio controller is created
|
||||||
|
keyframes_marker_provider.reset(new AudioMarkerProviderKeyframes(this, context));
|
||||||
|
keyframes_marker_provider->AddMarkerMovedListener(std::tr1::bind(std::tr1::ref(AnnounceMarkerMoved)));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// Tell listeners about this.
|
// Tell listeners about this.
|
||||||
AnnounceAudioOpen(provider);
|
AnnounceAudioOpen(provider);
|
||||||
}
|
}
|
||||||
|
@ -458,7 +464,7 @@ SampleRange AudioController::GetPrimaryPlaybackRange() const
|
||||||
void AudioController::GetMarkers(const SampleRange &range, AudioMarkerVector &markers) const
|
void AudioController::GetMarkers(const SampleRange &range, AudioMarkerVector &markers) const
|
||||||
{
|
{
|
||||||
/// @todo Find all sources of markers
|
/// @todo Find all sources of markers
|
||||||
keyframes_marker_provider->GetMarkers(range, markers);
|
if (keyframes_marker_provider.get()) keyframes_marker_provider->GetMarkers(range, markers);
|
||||||
if (timing_controller.get()) timing_controller->GetMarkers(range, markers);
|
if (timing_controller.get()) timing_controller->GetMarkers(range, markers);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue