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
4 changed files with 0 additions and 36 deletions
|
@ -143,9 +143,6 @@ VideoBox::VideoBox(wxWindow *parent, bool isDetached, agi::Context *context)
|
||||||
|
|
||||||
UpdateTimeBoxes();
|
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->AddSeekListener(&VideoBox::UpdateTimeBoxes, this));
|
||||||
slots.push_back(context->videoController->AddKeyframesListener(&VideoBox::UpdateTimeBoxes, this));
|
slots.push_back(context->videoController->AddKeyframesListener(&VideoBox::UpdateTimeBoxes, this));
|
||||||
slots.push_back(context->videoController->AddTimecodesListener(&VideoBox::UpdateTimeBoxes, this));
|
slots.push_back(context->videoController->AddTimecodesListener(&VideoBox::UpdateTimeBoxes, this));
|
||||||
|
@ -159,11 +156,6 @@ VideoBox::~VideoBox() {
|
||||||
context->selectionController->RemoveSelectionListener(this);
|
context->selectionController->RemoveSelectionListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void VideoBox::OnButton(wxCommandEvent &evt) {
|
|
||||||
context->videoController->EnableAudioSync(!wxGetMouseState().CmdDown());
|
|
||||||
evt.Skip();
|
|
||||||
}
|
|
||||||
|
|
||||||
void VideoBox::UpdateTimeBoxes() {
|
void VideoBox::UpdateTimeBoxes() {
|
||||||
if (!context->videoController->IsLoaded()) return;
|
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
|
wxTextCtrl *VideoSubsPos; ///< Time relative to the active subtitle line
|
||||||
wxComboBox *zoomBox;
|
wxComboBox *zoomBox;
|
||||||
|
|
||||||
/// Handle a click on the play/pause buttons
|
|
||||||
void OnButton(wxCommandEvent &evt);
|
|
||||||
|
|
||||||
/// Update VideoPosition and VideoSubsPos
|
/// Update VideoPosition and VideoSubsPos
|
||||||
void UpdateTimeBoxes();
|
void UpdateTimeBoxes();
|
||||||
|
|
||||||
|
|
|
@ -75,7 +75,6 @@ VideoContext::VideoContext()
|
||||||
, startMS(0)
|
, startMS(0)
|
||||||
, endFrame(0)
|
, endFrame(0)
|
||||||
, nextFrame(-1)
|
, nextFrame(-1)
|
||||||
, keepAudioSync(true)
|
|
||||||
, frame_n(0)
|
, frame_n(0)
|
||||||
, arValue(1.)
|
, arValue(1.)
|
||||||
, arType(0)
|
, arType(0)
|
||||||
|
@ -431,26 +430,10 @@ void VideoContext::OnPlayTimer(wxTimerEvent &) {
|
||||||
return;
|
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
|
// Jump to next frame
|
||||||
frame_n = nextFrame;
|
frame_n = nextFrame;
|
||||||
GetFrameAsync(frame_n);
|
GetFrameAsync(frame_n);
|
||||||
Seek(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 {
|
double VideoContext::GetARFromType(int type) const {
|
||||||
|
|
|
@ -107,9 +107,6 @@ class VideoContext : public wxEvtHandler {
|
||||||
/// DOCME
|
/// DOCME
|
||||||
int nextFrame;
|
int nextFrame;
|
||||||
|
|
||||||
/// DOCME
|
|
||||||
bool keepAudioSync;
|
|
||||||
|
|
||||||
/// DOCME
|
/// DOCME
|
||||||
int frame_n;
|
int frame_n;
|
||||||
|
|
||||||
|
@ -174,11 +171,6 @@ public:
|
||||||
/// @brief Does the video file loaded have muxed subtitles that we can load?
|
/// @brief Does the video file loaded have muxed subtitles that we can load?
|
||||||
bool HasSubtitles() const { return hasSubtitles; }
|
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
|
/// @brief Get the width of the currently open video
|
||||||
int GetWidth() const;
|
int GetWidth() const;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue