Bug 1288329: [ogg] P4. Fix coding style. r=gerald,jwwang

MozReview-Commit-ID: 1bAE92BECRD

--HG--
extra : rebase_source : 586e6b91e374bdc49fe4b2e6b72cf2c90a563cf2
This commit is contained in:
Jean-Yves Avenard 2016-07-29 10:47:03 +10:00
Родитель e884bc2dfb
Коммит cf4fb9d4df
2 изменённых файлов: 32 добавлений и 32 удалений

Просмотреть файл

@ -30,7 +30,8 @@ extern mozilla::LazyLogModule gMediaDemuxerLog;
#define SEEK_LOG(type, msg)
#endif
namespace mozilla {
namespace mozilla
{
using media::TimeUnit;
using media::TimeInterval;
@ -48,7 +49,8 @@ static const uint32_t OGG_SEEK_FUZZ_USECS = 500000;
// The specification recommends 80 ms.
static const int64_t OGG_SEEK_OPUS_PREROLL = 80 * USECS_PER_MS;
class OggHeaders {
class OggHeaders
{
public:
OggHeaders() {}
~OggHeaders()
@ -760,8 +762,7 @@ OggDemuxer::ReadOggChain(const media::TimeUnit& aLastEndTime)
newVorbisState = static_cast<VorbisState*>(codecState.get());
} else if (mOpusState && (codecState->GetType() == OggCodecState::TYPE_OPUS)) {
newOpusState = static_cast<OpusState*>(codecState.get());
}
else {
} else {
return false;
}
@ -824,8 +825,7 @@ OggDemuxer::ReadOggChain(const media::TimeUnit& aLastEndTime)
SetChained();
mInfo.mMediaSeekable = false;
mDecodedAudioDuration += aLastEndTime;
if (mTimedMetadataEvent)
{
if (mTimedMetadataEvent) {
mTimedMetadataEvent->Notify(
TimedMetadata(mDecodedAudioDuration,
Move(tags),
@ -1257,8 +1257,7 @@ OggDemuxer::SeekToKeyframeUsingIndex(TrackInfo::TrackType aType, int64_t aTarget
SkeletonState::nsSeekTarget keyframe;
if (NS_FAILED(mSkeletonState->IndexedSeekTarget(aTarget,
tracks,
keyframe)))
{
keyframe))) {
// Could not locate a keypoint for the target in the index.
return SEEK_INDEX_FAIL;
}
@ -1268,8 +1267,7 @@ OggDemuxer::SeekToKeyframeUsingIndex(TrackInfo::TrackType aType, int64_t aTarget
// Seek to the keypoint returned by the index.
if (keyframe.mKeyPoint.mOffset > Resource(aType)->GetLength() ||
keyframe.mKeyPoint.mOffset < 0)
{
keyframe.mKeyPoint.mOffset < 0) {
// Index must be invalid.
return RollbackIndexedSeek(aType, tell);
}
@ -1308,8 +1306,7 @@ OggDemuxer::SeekToKeyframeUsingIndex(TrackInfo::TrackType aType, int64_t aTarget
}
OggCodecState* codecState = mCodecStore.Get(serial);
if (codecState && codecState->mActive &&
ogg_stream_pagein(&codecState->mState, &page) != 0)
{
ogg_stream_pagein(&codecState->mState, &page) != 0) {
// Couldn't insert page into the ogg resource, or somehow the resource
// is no longer active.
return RollbackIndexedSeek(aType, tell);
@ -1529,10 +1526,7 @@ OggDemuxer::GetPageChecksum(ogg_page* page)
return 0;
}
const unsigned char* p = page->header + 22;
uint32_t c = p[0] +
(p[1] << 8) +
(p[2] << 16) +
(p[3] << 24);
uint32_t c = p[0] + (p[1] << 8) + (p[2] << 16) + (p[3] << 24);
return c;
}
@ -1549,11 +1543,14 @@ OggDemuxer::RangeStartTime(TrackInfo::TrackType aType, int64_t aOffset)
return startTime;
}
struct nsDemuxerAutoOggSyncState {
nsDemuxerAutoOggSyncState() {
struct nsDemuxerAutoOggSyncState
{
nsDemuxerAutoOggSyncState()
{
ogg_sync_init(&mState);
}
~nsDemuxerAutoOggSyncState() {
~nsDemuxerAutoOggSyncState()
{
ogg_sync_clear(&mState);
}
ogg_sync_state mState;

Просмотреть файл

@ -61,7 +61,8 @@ private:
// Seeks to the keyframe preceding the target time using available
// keyframe indexes.
enum IndexedSeekResult {
enum IndexedSeekResult
{
SEEK_OK, // Success.
SEEK_INDEX_FAIL, // Failure due to no index, or invalid index.
SEEK_FATAL_ERROR // Error returned by a stream operation.
@ -75,23 +76,24 @@ private:
// and the timestamps of the start and end of that range, that is cached.
// Used to denote the extremities of a range in which we can seek quickly
// (because it's cached).
class SeekRange {
class SeekRange
{
public:
SeekRange()
: mOffsetStart(0),
mOffsetEnd(0),
mTimeStart(0),
mTimeEnd(0)
: mOffsetStart(0)
, mOffsetEnd(0)
, mTimeStart(0)
, mTimeEnd(0)
{}
SeekRange(int64_t aOffsetStart,
int64_t aOffsetEnd,
int64_t aTimeStart,
int64_t aTimeEnd)
: mOffsetStart(aOffsetStart),
mOffsetEnd(aOffsetEnd),
mTimeStart(aTimeStart),
mTimeEnd(aTimeEnd)
: mOffsetStart(aOffsetStart)
, mOffsetEnd(aOffsetEnd)
, mTimeStart(aTimeStart)
, mTimeEnd(aTimeEnd)
{}
bool IsNull() const {
@ -154,7 +156,8 @@ private:
// is about 4300 bytes, so we read the file in chunks larger than that.
static const int PAGE_STEP = 8192;
enum PageSyncResult {
enum PageSyncResult
{
PAGE_SYNC_ERROR = 1,
PAGE_SYNC_END_OF_RANGE= 2,
PAGE_SYNC_OK = 3
@ -245,7 +248,6 @@ private:
// started playback at aOffset.
int64_t RangeStartTime(TrackInfo::TrackType aType, int64_t aOffset);
MediaInfo mInfo;
nsTArray<RefPtr<OggTrackDemuxer>> mDemuxers;
@ -309,7 +311,8 @@ private:
// Booleans to indicate if we have audio and/or video data
bool HasVideo() const;
bool HasAudio() const;
bool HasSkeleton() const {
bool HasSkeleton() const
{
return mSkeletonState != 0 && mSkeletonState->mActive;
}
bool HaveStartTime () const;