Bug 1417795 - remove mp4_demuxer namespace part3. r=kinetik

MozReview-Commit-ID: 9fM2VjY4Ckk

--HG--
extra : rebase_source : 24d971d44e1d9bd8b1589b4b542d792f75df376d
This commit is contained in:
Alfredo.Yang 2017-11-17 08:53:25 +08:00
parent a0056437d9
commit d6a0eb9d74
15 changed files with 32 additions and 38 deletions

View File

@ -6,9 +6,7 @@
#include "BitReader.h"
using namespace mozilla;
namespace mp4_demuxer
namespace mozilla
{
BitReader::BitReader(const mozilla::MediaByteBuffer* aBuffer)
@ -159,4 +157,4 @@ BitReader::FillReservoir()
mReservoir <<= 32 - mNumBitsLeft;
}
} // namespace mp4_demuxer
} // namespace mozilla

View File

@ -7,7 +7,7 @@
#include "MediaData.h"
namespace mp4_demuxer
namespace mozilla
{
class BitReader
@ -45,6 +45,6 @@ private:
size_t mNumBitsLeft; // Number of bits left in reservoir.
};
} // namespace mp4_demuxer
} // namespace mozilla
#endif // BIT_READER_H_
#endif // BIT_READER_H_

View File

@ -12,7 +12,7 @@
#include "mozilla/Logging.h"
#include "mozilla/Result.h"
namespace mp4_demuxer {
namespace mozilla {
extern mozilla::LazyLogModule gMP4MetadataLog;
@ -309,6 +309,6 @@ private:
size_t mLength;
};
} // namespace mp4_demuxer
} // namespace mozilla
#endif

View File

@ -8,7 +8,7 @@
#include "mozilla/EndianUtils.h"
#include "nsTArray.h"
namespace mp4_demuxer {
namespace mozilla {
class ByteWriter
{
@ -70,6 +70,6 @@ private:
nsTArray<uint8_t>& mPtr;
};
} // namespace mp4_demuxer
} // namespace mozilla
#endif

View File

@ -46,7 +46,7 @@ public:
// valid CRC.
bool Parse(const uint8_t* aPacket, size_t aBytes)
{
mp4_demuxer::BitReader br(aPacket, aBytes * 8);
BitReader br(aPacket, aBytes * 8);
// Frame sync code.
if ((br.ReadBits(15) & 0x7fff) != 0x7ffc) {

View File

@ -12,8 +12,6 @@
#include "BufferReader.h"
#include "mozilla/ResultExtensions.h"
using mp4_demuxer::BufferReader;
namespace mozilla
{

View File

@ -465,7 +465,7 @@ private:
StopAt aStop)
{
const MediaContainerType mType(aType); // for logging macro.
mp4_demuxer::BufferReader reader(aData);
BufferReader reader(aData);
mp4_demuxer::AtomType initAtom("moov");
mp4_demuxer::AtomType mediaAtom("moof");
mp4_demuxer::AtomType dataAtom("mdat");

View File

@ -24,7 +24,7 @@ extern mozilla::LazyLogModule gMediaDemuxerLog;
using mozilla::media::TimeUnit;
using mozilla::media::TimeInterval;
using mozilla::media::TimeIntervals;
using mp4_demuxer::BufferReader;
using mozilla::BufferReader;
namespace mozilla {

View File

@ -21,8 +21,6 @@ extern mozilla::LazyLogModule gMediaDemuxerLog;
#define MP3LOGV(msg, ...) \
MOZ_LOG(gMediaDemuxerLog, LogLevel::Verbose, ("MP3Demuxer " msg, ##__VA_ARGS__))
using mp4_demuxer::BufferReader;
namespace mozilla {
// FrameParser

View File

@ -84,7 +84,7 @@ public:
// Parses contents of given BufferReader for a valid ID3v2 header.
// Returns the total ID3v2 tag size if successful and zero otherwise.
Result<uint32_t, nsresult> Parse(mp4_demuxer::BufferReader* aReader);
Result<uint32_t, nsresult> Parse(BufferReader* aReader);
// Resets the state to allow for a new parsing session.
void Reset();
@ -228,20 +228,20 @@ public:
// The offset of the passed ByteReader needs to point to an MPEG frame
// begin, as a VBRI-style header is searched at a fixed offset relative to
// frame begin. Returns whether a valid VBR header was found in the range.
bool Parse(mp4_demuxer::BufferReader* aReader);
bool Parse(BufferReader* aReader);
private:
// Parses contents of given ByteReader for a valid Xing header.
// The initial ByteReader offset will be preserved.
// Returns whether a valid Xing header was found in the range.
Result<bool, nsresult> ParseXing(mp4_demuxer::BufferReader* aReader);
Result<bool, nsresult> ParseXing(BufferReader* aReader);
// Parses contents of given ByteReader for a valid VBRI header.
// The initial ByteReader offset will be preserved. It also needs to point
// to the beginning of a valid MPEG frame, as VBRI headers are searched
// at a fixed offset relative to frame begin.
// Returns whether a valid VBRI header was found in the range.
Result<bool, nsresult> ParseVBRI(mp4_demuxer::BufferReader* aReader);
Result<bool, nsresult> ParseVBRI(BufferReader* aReader);
// The total number of frames expected as parsed from a VBR header.
Maybe<uint32_t> mNumAudioFrames;
@ -316,13 +316,13 @@ public:
// true if one was found. After returning, the variable passed to
// 'aBytesToSkip' holds the amount of bytes to be skipped (if any) in order to
// jump across a large ID3v2 tag spanning multiple buffers.
Result<bool, nsresult> Parse(mp4_demuxer::BufferReader* aReader, uint32_t* aBytesToSkip);
Result<bool, nsresult> Parse(BufferReader* aReader, uint32_t* aBytesToSkip);
// Parses contents of given BufferReader for a valid VBR header.
// The offset of the passed BufferReader needs to point to an MPEG frame begin,
// as a VBRI-style header is searched at a fixed offset relative to frame
// begin. Returns whether a valid VBR header was found.
bool ParseVBRHeader(mp4_demuxer::BufferReader* aReader);
bool ParseVBRHeader(BufferReader* aReader);
private:
// ID3 header parser.

View File

@ -22,11 +22,13 @@
using mozilla::media::TimeUnit;
namespace mozilla {
LazyLogModule gMP4MetadataLog("MP4Metadata");
}
namespace mp4_demuxer
{
LazyLogModule gMP4MetadataLog("MP4Metadata");
// the owner of mIndice is rust mp4 paser, so lifetime of this class
// SHOULD NOT longer than rust parser.
class IndiceWrapperRust : public IndiceWrapper

View File

@ -77,7 +77,7 @@ RefPtr<MediaDataDecoder::DecodePromise>
WaveDataDecoder::ProcessDecode(MediaRawData* aSample)
{
size_t aLength = aSample->Size();
mp4_demuxer::BufferReader aReader(aSample->Data(), aLength);
BufferReader aReader(aSample->Data(), aLength);
int64_t aOffset = aSample->mOffset;
int32_t frames = aLength * 8 / mInfo.mBitDepth / mInfo.mChannels;

View File

@ -11,13 +11,13 @@
template <class T> struct already_AddRefed;
namespace mozilla {
class BufferReader;
class MediaRawData;
class MediaByteBuffer;
}
namespace mp4_demuxer
{
class BufferReader;
class AnnexB
{
@ -42,7 +42,7 @@ public:
private:
// AVCC box parser helper.
static mozilla::Result<mozilla::Ok, nsresult>
ConvertSPSOrPPS(BufferReader& aReader, uint8_t aCount, mozilla::MediaByteBuffer* aAnnexB);
ConvertSPSOrPPS(mozilla::BufferReader& aReader, uint8_t aCount, mozilla::MediaByteBuffer* aAnnexB);
};
} // namespace mp4_demuxer

View File

@ -7,6 +7,10 @@
#include "DecoderData.h"
namespace mozilla {
class BitReader;
}
namespace mp4_demuxer {
// Spec 7.4.2.1
@ -34,8 +38,6 @@ enum NAL_TYPES {
H264_NAL_SLICE_EXT_DVC = 21,
};
class BitReader;
struct SPSData
{
bool operator==(const SPSData& aOther) const;
@ -485,9 +487,9 @@ private:
const uint8_t* aNAL, size_t aLength);
/* Decode SPS NAL RBSP and fill SPSData structure */
static bool DecodeSPS(const mozilla::MediaByteBuffer* aSPS, SPSData& aDest);
static bool vui_parameters(BitReader& aBr, SPSData& aDest);
static bool vui_parameters(mozilla::BitReader& aBr, SPSData& aDest);
// Read HRD parameters, all data is ignored.
static void hrd_parameters(BitReader& aBr);
static void hrd_parameters(mozilla::BitReader& aBr);
static uint8_t NumSPS(const mozilla::MediaByteBuffer* aExtraData);
// Decode SEI payload and return true if the SEI NAL indicates a recovery
// point.

View File

@ -8,12 +8,8 @@
#include "MediaDataDemuxer.h"
#include "MediaResource.h"
namespace mp4_demuxer {
class BufferReader;
}
using mp4_demuxer::BufferReader;
namespace mozilla {
class BufferReader;
static const uint32_t FRMT_CODE = 0x666d7420;
static const uint32_t DATA_CODE = 0x64617461;