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

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

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