Created
June 24, 2014 18:40
-
-
Save FlyingJester/1db5fea179a18a2a52ee to your computer and use it in GitHub Desktop.
Excerpt from ADTS Utils, showing a unique combination of C++11, XPCOM, and raw bit-twiddling.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| nsresult MediaCodecADTSHeader::SetFrequency(unsigned aFrequency) | |
| { | |
| mFrequencyIndex = std::distance(sValidFrequencies.begin(), | |
| std::find(sValidFrequencies.begin(), | |
| sValidFrequencies.end(), | |
| aFrequency)); | |
| uint64_t fr = mFrequencyIndex | 0x0F; | |
| fr <<= (56-22); | |
| mRawData &= 0xFFFFC3FFFFFFFF; | |
| mRawData |= fr; | |
| return NS_OK; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment