Bug 1388288 - Make Flac and Ogg decoders build in non-Unified mode. r=jya

FLAC_MAX_CHANNELS is used in FlacDemuxer and in FrameParser, so move it,
and all the other FLAC_{MIN,MAX}* #defines to FrameParser.h. The other
defines don't technically need to be there, but it's nicer to have them
all defined together.

MozReview-Commit-ID: LVZzXvBSvMq

--HG--
extra : rebase_source : 1c8e5c111232856ef5589f214c00d510ece9af00
This commit is contained in:
Chris Pearce 2017-08-08 15:46:37 +08:00
parent 5270e8c4f7
commit 2317493000
3 changed files with 14 additions and 16 deletions

View File

@ -28,14 +28,6 @@ namespace flac {
// flac::FrameHeader - Holds the flac frame header and its parsing
// state.
#define FLAC_MAX_CHANNELS 8
#define FLAC_MIN_BLOCKSIZE 16
#define FLAC_MAX_BLOCKSIZE 65535
#define FLAC_MIN_FRAME_SIZE 11
#define FLAC_MAX_FRAME_HEADER_SIZE 16
#define FLAC_MAX_FRAME_SIZE (FLAC_MAX_FRAME_HEADER_SIZE \
+FLAC_MAX_BLOCKSIZE*FLAC_MAX_CHANNELS*3)
class FrameHeader
{
public:

View File

@ -16,6 +16,14 @@
namespace mozilla
{
#define FLAC_MAX_CHANNELS 8
#define FLAC_MIN_BLOCKSIZE 16
#define FLAC_MAX_BLOCKSIZE 65535
#define FLAC_MIN_FRAME_SIZE 11
#define FLAC_MAX_FRAME_HEADER_SIZE 16
#define FLAC_MAX_FRAME_SIZE (FLAC_MAX_FRAME_HEADER_SIZE \
+FLAC_MAX_BLOCKSIZE*FLAC_MAX_CHANNELS*3)
class OpusParser;
// Decode a Flac Metadata block contained in either a ogg packet

View File

@ -675,8 +675,7 @@ OggDemuxer::ReadOggChain(const media::TimeUnit& aLastEndTime)
newVorbisState->GetInfo()->GetAsAudioInfo()->mChannels)) {
SetupTarget(&mVorbisState, newVorbisState);
LOG(LogLevel::Debug,
("New vorbis ogg link, serial=%d\n", mVorbisState->mSerial));
OGG_DEBUG("New vorbis ogg link, serial=%d\n", mVorbisState->mSerial);
if (msgInfo) {
InitTrack(msgInfo, &mInfo.mAudio, true);
@ -711,8 +710,7 @@ OggDemuxer::ReadOggChain(const media::TimeUnit& aLastEndTime)
newFlacState->GetInfo()->GetAsAudioInfo()->mChannels)) {
SetupTarget(&mFlacState, newFlacState);
LOG(LogLevel::Debug,
("New flac ogg link, serial=%d\n", mFlacState->mSerial));
OGG_DEBUG("New flac ogg link, serial=%d\n", mFlacState->mSerial);
if (msgInfo) {
InitTrack(msgInfo, &mInfo.mAudio, true);
@ -1178,8 +1176,8 @@ OggDemuxer::SeekToKeyframeUsingIndex(TrackInfo::TrackType aType, int64_t aTarget
// Index must be invalid.
return RollbackIndexedSeek(aType, tell);
}
LOG(LogLevel::Debug, ("Seeking using index to keyframe at offset %" PRId64 "\n",
keyframe.mKeyPoint.mOffset));
OGG_DEBUG("Seeking using index to keyframe at offset %" PRId64 "\n",
keyframe.mKeyPoint.mOffset);
nsresult res = Resource(aType)->Seek(nsISeekableStream::NS_SEEK_SET,
keyframe.mKeyPoint.mOffset);
NS_ENSURE_SUCCESS(res, SEEK_FATAL_ERROR);
@ -1201,8 +1199,8 @@ OggDemuxer::SeekToKeyframeUsingIndex(TrackInfo::TrackType aType, int64_t aTarget
skippedBytes);
NS_ENSURE_TRUE(syncres != PAGE_SYNC_ERROR, SEEK_FATAL_ERROR);
if (syncres != PAGE_SYNC_OK || skippedBytes != 0) {
LOG(LogLevel::Debug, ("Indexed-seek failure: Ogg Skeleton Index is invalid "
"or sync error after seek"));
OGG_DEBUG("Indexed-seek failure: Ogg Skeleton Index is invalid "
"or sync error after seek");
return RollbackIndexedSeek(aType, tell);
}
uint32_t serial = ogg_page_serialno(&page);