Skip to content

Commit

Permalink
AudioSync: Allow the audio sync offset to be set directly.
Browse files Browse the repository at this point in the history
Again, not currently plugged into anything - so not actionable.
  • Loading branch information
Mark Kendall committed Nov 16, 2011
1 parent 8bced84 commit cb14f67
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
7 changes: 5 additions & 2 deletions mythtv/libs/libmythtv/mythplayer.cpp
Expand Up @@ -3204,9 +3204,12 @@ PIPLocation MythPlayer::GetNextPIPLocation(void) const
return kPIP_END;
}

int64_t MythPlayer::AdjustAudioTimecodeOffset(int64_t v)
int64_t MythPlayer::AdjustAudioTimecodeOffset(int64_t v, int newsync)
{
tc_wrap[TC_AUDIO] += v;
if ((newsync >= -1000) && (newsync <= 1000))
tc_wrap[TC_AUDIO] = newsync;
else
tc_wrap[TC_AUDIO] += v;
gCoreContext->SaveSetting("AudioSyncOffset", tc_wrap[TC_AUDIO]);
return tc_wrap[TC_AUDIO];
}
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/mythplayer.h
Expand Up @@ -462,7 +462,7 @@ class MTV_PUBLIC MythPlayer
void SetTeletextPage(uint page);

// Time Code adjustment stuff
int64_t AdjustAudioTimecodeOffset(int64_t v);
int64_t AdjustAudioTimecodeOffset(int64_t v, int newsync = -9999);
int64_t GetAudioTimecodeOffset(void) const
{ return tc_wrap[TC_AUDIO]; }

Expand Down
7 changes: 5 additions & 2 deletions mythtv/libs/libmythtv/tv_play.cpp
Expand Up @@ -8000,7 +8000,7 @@ void TV::ToggleUpmix(PlayerContext *ctx)
}

// dir in 10ms jumps
void TV::ChangeAudioSync(PlayerContext *ctx, int dir)
void TV::ChangeAudioSync(PlayerContext *ctx, int dir, int newsync)
{
long long newval;

Expand All @@ -8012,7 +8012,10 @@ void TV::ChangeAudioSync(PlayerContext *ctx, int dir)
}

audiosyncAdjustment = true;
newval = ctx->player->AdjustAudioTimecodeOffset(dir * 10);
if ((newsync >= -1000) && (newsync <= 1000))
newval = ctx->player->AdjustAudioTimecodeOffset(0, newsync);
else
newval = ctx->player->AdjustAudioTimecodeOffset(dir * 10);
ctx->UnlockDeletePlayer(__FILE__, __LINE__);

if (!browsehelper->IsBrowsing())
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/tv_play.h
Expand Up @@ -405,7 +405,7 @@ class MTV_PUBLIC TV : public QObject
const QStringList &actions);

void ToggleUpmix(PlayerContext*);
void ChangeAudioSync(PlayerContext*, int dir);
void ChangeAudioSync(PlayerContext*, int dir, int newsync = -9999);
bool AudioSyncHandleAction(PlayerContext*, const QStringList &actions);

float StopFFRew(PlayerContext*);
Expand Down

0 comments on commit cb14f67

Please sign in to comment.