mirror of https://github.com/odrling/Aegisub
Remove the audio resync code from VideoContext. It didn't actually work with the threaded video provider and should be unneccesary as video now always plays back at full speed (dropping frames if needed).
Originally committed to SVN as r5965.
This commit is contained in:
parent
8ab9ba77ae
commit
c26e61f209
|
@ -143,9 +143,6 @@ VideoBox::VideoBox(wxWindow *parent, bool isDetached, agi::Context *context)
|
|||
|
||||
UpdateTimeBoxes();
|
||||
|
||||
Bind(wxEVT_COMMAND_BUTTON_CLICKED, &VideoBox::OnButton, this);
|
||||
Bind(wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, &VideoBox::OnButton, this);
|
||||
|
||||
slots.push_back(context->videoController->AddSeekListener(&VideoBox::UpdateTimeBoxes, this));
|
||||
slots.push_back(context->videoController->AddKeyframesListener(&VideoBox::UpdateTimeBoxes, this));
|
||||
slots.push_back(context->videoController->AddTimecodesListener(&VideoBox::UpdateTimeBoxes, this));
|
||||
|
@ -159,11 +156,6 @@ VideoBox::~VideoBox() {
|
|||
context->selectionController->RemoveSelectionListener(this);
|
||||
}
|
||||
|
||||
void VideoBox::OnButton(wxCommandEvent &evt) {
|
||||
context->videoController->EnableAudioSync(!wxGetMouseState().CmdDown());
|
||||
evt.Skip();
|
||||
}
|
||||
|
||||
void VideoBox::UpdateTimeBoxes() {
|
||||
if (!context->videoController->IsLoaded()) return;
|
||||
|
||||
|
|
|
@ -67,9 +67,6 @@ class VideoBox : public wxPanel, private SelectionListener<AssDialogue> {
|
|||
wxTextCtrl *VideoSubsPos; ///< Time relative to the active subtitle line
|
||||
wxComboBox *zoomBox;
|
||||
|
||||
/// Handle a click on the play/pause buttons
|
||||
void OnButton(wxCommandEvent &evt);
|
||||
|
||||
/// Update VideoPosition and VideoSubsPos
|
||||
void UpdateTimeBoxes();
|
||||
|
||||
|
|
|
@ -75,7 +75,6 @@ VideoContext::VideoContext()
|
|||
, startMS(0)
|
||||
, endFrame(0)
|
||||
, nextFrame(-1)
|
||||
, keepAudioSync(true)
|
||||
, frame_n(0)
|
||||
, arValue(1.)
|
||||
, arType(0)
|
||||
|
@ -431,26 +430,10 @@ void VideoContext::OnPlayTimer(wxTimerEvent &) {
|
|||
return;
|
||||
}
|
||||
|
||||
|
||||
// Next frame is before or over 2 frames ahead, so force audio resync
|
||||
if (context->audioController->IsPlaying() && keepAudioSync && (nextFrame < frame_n || nextFrame > frame_n + 2)) {
|
||||
context->audioController->ResyncPlaybackPosition(context->audioController->SamplesFromMilliseconds(TimeAtFrame(nextFrame)));
|
||||
}
|
||||
|
||||
// Jump to next frame
|
||||
frame_n = nextFrame;
|
||||
GetFrameAsync(frame_n);
|
||||
Seek(frame_n);
|
||||
|
||||
// Sync audio
|
||||
if (keepAudioSync && nextFrame % 10 == 0 && context->audioController->IsPlaying()) {
|
||||
int64_t audPos = context->audioController->SamplesFromMilliseconds(TimeAtFrame(nextFrame));
|
||||
int64_t curPos = context->audioController->GetPlaybackPosition();
|
||||
int delta = int(audPos-curPos);
|
||||
if (delta < 0) delta = -delta;
|
||||
int maxDelta = context->audioController->SamplesFromMilliseconds(1000);
|
||||
if (delta > maxDelta) context->audioController->ResyncPlaybackPosition(audPos);
|
||||
}
|
||||
}
|
||||
|
||||
double VideoContext::GetARFromType(int type) const {
|
||||
|
|
|
@ -107,9 +107,6 @@ class VideoContext : public wxEvtHandler {
|
|||
/// DOCME
|
||||
int nextFrame;
|
||||
|
||||
/// DOCME
|
||||
bool keepAudioSync;
|
||||
|
||||
/// DOCME
|
||||
int frame_n;
|
||||
|
||||
|
@ -174,11 +171,6 @@ public:
|
|||
/// @brief Does the video file loaded have muxed subtitles that we can load?
|
||||
bool HasSubtitles() const { return hasSubtitles; }
|
||||
|
||||
/// @brief DOCME
|
||||
/// @param sync
|
||||
/// @return
|
||||
void EnableAudioSync(bool sync = true) { keepAudioSync = sync; }
|
||||
|
||||
/// @brief Get the width of the currently open video
|
||||
int GetWidth() const;
|
||||
|
||||
|
|
Loading…
Reference in New Issue