Skip to content

Commit

Permalink
Resend volume setting on audio codec change
Browse files Browse the repository at this point in the history
  • Loading branch information
popcornmix committed Oct 23, 2013
1 parent ec440e9 commit 01c5c2b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
7 changes: 7 additions & 0 deletions OMXPlayerAudio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ OMXPlayerAudio::OMXPlayerAudio()
m_fifo_size = 2.0f;
m_live = false;
m_layout = PCM_LAYOUT_2_0;
m_CurrentVolume = 0.0f;
m_amplification = 0;
m_mute = false;

pthread_cond_init(&m_packet_cond, NULL);
pthread_cond_init(&m_audio_cond, NULL);
Expand Down Expand Up @@ -455,6 +458,10 @@ bool OMXPlayerAudio::OpenDecoder()
m_codec_name.c_str(), m_hints.channels, m_hints.samplerate, m_hints.bitspersample);
}
}
// setup current volume settings
m_decoder->SetVolume(m_CurrentVolume);
m_decoder->SetMute(m_mute);
m_decoder->SetDynamicRangeCompression(m_amplification);

return true;
}
Expand Down
11 changes: 7 additions & 4 deletions OMXPlayerAudio.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ class OMXPlayerAudio : public OMXThread
unsigned int m_max_data_size;
float m_fifo_size;
COMXAudioCodecOMX *m_pAudioCodec;
float m_CurrentVolume;
long m_amplification;
bool m_mute;
bool m_player_error;

void Lock();
Expand Down Expand Up @@ -110,10 +113,10 @@ class OMXPlayerAudio : public OMXThread
unsigned int GetCached() { return m_cached_size; };
unsigned int GetMaxCached() { return m_max_data_size; };
unsigned int GetLevel() { return m_max_data_size ? 100 * m_cached_size / m_max_data_size : 0; };
void SetVolume(float fVolume) { if(m_decoder) m_decoder->SetVolume(fVolume); }
float GetVolume() { return m_decoder ? m_decoder->GetVolume() : 0.0f; }
void SetMute(bool bOnOff) { if(m_decoder) m_decoder->SetMute(bOnOff); }
void SetDynamicRangeCompression(long drc) { if(m_decoder) m_decoder->SetDynamicRangeCompression(drc); }
void SetVolume(float fVolume) { m_CurrentVolume = fVolume; if(m_decoder) m_decoder->SetVolume(fVolume); }
float GetVolume() { return m_CurrentVolume; }
void SetMute(bool bOnOff) { m_mute = bOnOff; if(m_decoder) m_decoder->SetMute(bOnOff); }
void SetDynamicRangeCompression(long drc) { m_amplification = drc; if(m_decoder) m_decoder->SetDynamicRangeCompression(drc); }
bool Error() { return !m_player_error; };
};
#endif

0 comments on commit 01c5c2b

Please sign in to comment.