2014-09-16 23:33:00 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#include "ContainerParser.h"
|
|
|
|
|
|
|
|
#include "WebMBufferedParser.h"
|
|
|
|
#include "mozilla/Endian.h"
|
|
|
|
#include "mp4_demuxer/MoofParser.h"
|
|
|
|
#include "prlog.h"
|
2015-01-26 07:01:09 -08:00
|
|
|
#include "MediaData.h"
|
2015-01-28 22:08:58 -08:00
|
|
|
#ifdef MOZ_FMP4
|
2015-01-26 07:01:09 -08:00
|
|
|
#include "MP4Stream.h"
|
2015-01-28 22:08:58 -08:00
|
|
|
#endif
|
2015-01-26 07:01:09 -08:00
|
|
|
#include "SourceBufferResource.h"
|
2014-09-16 23:33:00 -07:00
|
|
|
|
|
|
|
#ifdef PR_LOGGING
|
|
|
|
extern PRLogModuleInfo* GetMediaSourceLog();
|
|
|
|
|
2015-02-11 23:52:13 -08:00
|
|
|
/* Polyfill __func__ on MSVC to pass to the log. */
|
|
|
|
#ifdef _MSC_VER
|
|
|
|
#define __func__ __FUNCTION__
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define STRINGIFY(x) #x
|
|
|
|
#define TOSTRING(x) STRINGIFY(x)
|
|
|
|
#define MSE_DEBUG(name, arg, ...) PR_LOG(GetMediaSourceLog(), PR_LOG_DEBUG, (TOSTRING(name) "(%p:%s)::%s: " arg, this, mType.get(), __func__, ##__VA_ARGS__))
|
2014-09-16 23:33:00 -07:00
|
|
|
#else
|
|
|
|
#define MSE_DEBUG(...)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
|
2015-02-11 23:52:13 -08:00
|
|
|
ContainerParser::ContainerParser(const nsACString& aType)
|
2015-02-01 16:41:43 -08:00
|
|
|
: mHasInitData(false)
|
2015-02-11 23:52:13 -08:00
|
|
|
, mType(aType)
|
2015-01-26 07:01:09 -08:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2014-09-16 23:33:00 -07:00
|
|
|
bool
|
2015-01-26 07:01:09 -08:00
|
|
|
ContainerParser::IsInitSegmentPresent(LargeDataBuffer* aData)
|
2014-09-16 23:33:00 -07:00
|
|
|
{
|
2015-02-11 23:52:13 -08:00
|
|
|
MSE_DEBUG(ContainerParser, "aLength=%u [%x%x%x%x]",
|
|
|
|
aData->Length(),
|
2015-01-26 07:01:09 -08:00
|
|
|
aData->Length() > 0 ? (*aData)[0] : 0,
|
|
|
|
aData->Length() > 1 ? (*aData)[1] : 0,
|
|
|
|
aData->Length() > 2 ? (*aData)[2] : 0,
|
|
|
|
aData->Length() > 3 ? (*aData)[3] : 0);
|
2014-09-16 23:33:00 -07:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
2015-01-26 07:01:09 -08:00
|
|
|
ContainerParser::IsMediaSegmentPresent(LargeDataBuffer* aData)
|
2014-09-16 23:33:00 -07:00
|
|
|
{
|
2015-02-11 23:52:13 -08:00
|
|
|
MSE_DEBUG(ContainerParser, "aLength=%u [%x%x%x%x]",
|
|
|
|
aData->Length(),
|
2015-01-26 07:01:09 -08:00
|
|
|
aData->Length() > 0 ? (*aData)[0] : 0,
|
|
|
|
aData->Length() > 1 ? (*aData)[1] : 0,
|
|
|
|
aData->Length() > 2 ? (*aData)[2] : 0,
|
|
|
|
aData->Length() > 3 ? (*aData)[3] : 0);
|
2014-09-16 23:33:00 -07:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
2015-01-26 07:01:09 -08:00
|
|
|
ContainerParser::ParseStartAndEndTimestamps(LargeDataBuffer* aData,
|
2014-09-16 23:33:00 -07:00
|
|
|
int64_t& aStart, int64_t& aEnd)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
ContainerParser::TimestampsFuzzyEqual(int64_t aLhs, int64_t aRhs)
|
|
|
|
{
|
2014-12-10 13:52:57 -08:00
|
|
|
return llabs(aLhs - aRhs) <= GetRoundingError();
|
|
|
|
}
|
|
|
|
|
|
|
|
int64_t
|
|
|
|
ContainerParser::GetRoundingError()
|
|
|
|
{
|
|
|
|
NS_WARNING("Using default ContainerParser::GetRoundingError implementation");
|
|
|
|
return 0;
|
2014-09-16 23:33:00 -07:00
|
|
|
}
|
|
|
|
|
2015-02-01 16:41:43 -08:00
|
|
|
bool
|
|
|
|
ContainerParser::HasCompleteInitData()
|
|
|
|
{
|
|
|
|
return mHasInitData && !!mInitData->Length();
|
|
|
|
}
|
|
|
|
|
2015-01-26 07:01:09 -08:00
|
|
|
LargeDataBuffer*
|
2014-09-16 23:33:00 -07:00
|
|
|
ContainerParser::InitData()
|
|
|
|
{
|
|
|
|
return mInitData;
|
|
|
|
}
|
|
|
|
|
|
|
|
class WebMContainerParser : public ContainerParser {
|
|
|
|
public:
|
2015-02-11 23:52:13 -08:00
|
|
|
explicit WebMContainerParser(const nsACString& aType)
|
|
|
|
: ContainerParser(aType)
|
|
|
|
, mParser(0)
|
|
|
|
, mOffset(0)
|
2014-09-16 23:33:00 -07:00
|
|
|
{}
|
|
|
|
|
|
|
|
static const unsigned NS_PER_USEC = 1000;
|
2014-12-10 13:52:57 -08:00
|
|
|
static const unsigned USEC_PER_SEC = 1000000;
|
2014-09-16 23:33:00 -07:00
|
|
|
|
2015-01-26 07:01:09 -08:00
|
|
|
bool IsInitSegmentPresent(LargeDataBuffer* aData)
|
2014-09-16 23:33:00 -07:00
|
|
|
{
|
2015-01-26 07:01:09 -08:00
|
|
|
ContainerParser::IsInitSegmentPresent(aData);
|
2014-09-16 23:33:00 -07:00
|
|
|
// XXX: This is overly primitive, needs to collect data as it's appended
|
|
|
|
// to the SB and handle, rather than assuming everything is present in a
|
|
|
|
// single aData segment.
|
|
|
|
// 0x1a45dfa3 // EBML
|
|
|
|
// ...
|
|
|
|
// DocType == "webm"
|
|
|
|
// ...
|
2015-02-04 01:20:15 -08:00
|
|
|
// 0x18538067 // Segment (must be "unknown" size or contain a value large
|
|
|
|
// enough to include the Segment Information and Tracks
|
|
|
|
// elements that follow)
|
2014-09-16 23:33:00 -07:00
|
|
|
// 0x1549a966 // -> Segment Info
|
|
|
|
// 0x1654ae6b // -> One or more Tracks
|
2015-01-26 07:01:09 -08:00
|
|
|
if (aData->Length() >= 4 &&
|
|
|
|
(*aData)[0] == 0x1a && (*aData)[1] == 0x45 && (*aData)[2] == 0xdf &&
|
|
|
|
(*aData)[3] == 0xa3) {
|
2014-09-16 23:33:00 -07:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2015-01-26 07:01:09 -08:00
|
|
|
bool IsMediaSegmentPresent(LargeDataBuffer* aData)
|
2014-09-16 23:33:00 -07:00
|
|
|
{
|
2015-01-26 07:01:09 -08:00
|
|
|
ContainerParser::IsMediaSegmentPresent(aData);
|
2014-09-16 23:33:00 -07:00
|
|
|
// XXX: This is overly primitive, needs to collect data as it's appended
|
|
|
|
// to the SB and handle, rather than assuming everything is present in a
|
|
|
|
// single aData segment.
|
|
|
|
// 0x1a45dfa3 // EBML
|
|
|
|
// ...
|
|
|
|
// DocType == "webm"
|
|
|
|
// ...
|
|
|
|
// 0x18538067 // Segment (must be "unknown" size)
|
|
|
|
// 0x1549a966 // -> Segment Info
|
|
|
|
// 0x1654ae6b // -> One or more Tracks
|
2015-01-26 07:01:09 -08:00
|
|
|
if (aData->Length() >= 4 &&
|
|
|
|
(*aData)[0] == 0x1f && (*aData)[1] == 0x43 && (*aData)[2] == 0xb6 &&
|
|
|
|
(*aData)[3] == 0x75) {
|
2014-09-16 23:33:00 -07:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2015-01-26 07:01:09 -08:00
|
|
|
bool ParseStartAndEndTimestamps(LargeDataBuffer* aData,
|
2014-09-16 23:33:00 -07:00
|
|
|
int64_t& aStart, int64_t& aEnd)
|
|
|
|
{
|
2015-01-26 07:01:09 -08:00
|
|
|
bool initSegment = IsInitSegmentPresent(aData);
|
2014-09-16 23:33:00 -07:00
|
|
|
if (initSegment) {
|
|
|
|
mOffset = 0;
|
|
|
|
mParser = WebMBufferedParser(0);
|
|
|
|
mOverlappedMapping.Clear();
|
2015-02-01 16:41:43 -08:00
|
|
|
mInitData = new LargeDataBuffer();
|
2015-02-04 01:20:15 -08:00
|
|
|
mResource = new SourceBufferResource(NS_LITERAL_CSTRING("video/webm"));
|
2014-09-16 23:33:00 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
// XXX if it only adds new mappings, overlapped but not available
|
|
|
|
// (e.g. overlap < 0) frames are "lost" from the reported mappings here.
|
|
|
|
nsTArray<WebMTimeDataOffset> mapping;
|
|
|
|
mapping.AppendElements(mOverlappedMapping);
|
|
|
|
mOverlappedMapping.Clear();
|
|
|
|
ReentrantMonitor dummy("dummy");
|
2015-01-26 07:01:09 -08:00
|
|
|
mParser.Append(aData->Elements(), aData->Length(), mapping, dummy);
|
2015-02-04 01:20:15 -08:00
|
|
|
if (mResource) {
|
|
|
|
mResource->AppendData(aData);
|
|
|
|
}
|
2014-09-16 23:33:00 -07:00
|
|
|
|
|
|
|
// XXX This is a bit of a hack. Assume if there are no timecodes
|
|
|
|
// present and it's an init segment that it's _just_ an init segment.
|
|
|
|
// We should be more precise.
|
2015-02-04 01:20:15 -08:00
|
|
|
if (initSegment || !HasCompleteInitData()) {
|
|
|
|
if (mParser.mInitEndOffset > 0) {
|
|
|
|
MOZ_ASSERT(mParser.mInitEndOffset <= mResource->GetLength());
|
|
|
|
if (!mInitData->SetLength(mParser.mInitEndOffset)) {
|
|
|
|
// Super unlikely OOM
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
char* buffer = reinterpret_cast<char*>(mInitData->Elements());
|
|
|
|
mResource->ReadFromCache(buffer, 0, mParser.mInitEndOffset);
|
2015-02-11 23:52:13 -08:00
|
|
|
MSE_DEBUG(WebMContainerParser, "Stashed init of %u bytes.",
|
|
|
|
mParser.mInitEndOffset);
|
2015-02-04 01:20:15 -08:00
|
|
|
mResource = nullptr;
|
|
|
|
} else {
|
2015-02-11 23:52:13 -08:00
|
|
|
MSE_DEBUG(WebMContainerParser, "Incomplete init found.");
|
2015-01-26 07:01:09 -08:00
|
|
|
}
|
2014-09-16 23:33:00 -07:00
|
|
|
mHasInitData = true;
|
|
|
|
}
|
2015-01-26 07:01:09 -08:00
|
|
|
mOffset += aData->Length();
|
2014-09-16 23:33:00 -07:00
|
|
|
|
|
|
|
if (mapping.IsEmpty()) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Exclude frames that we don't enough data to cover the end of.
|
|
|
|
uint32_t endIdx = mapping.Length() - 1;
|
|
|
|
while (mOffset < mapping[endIdx].mEndOffset && endIdx > 0) {
|
|
|
|
endIdx -= 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (endIdx == 0) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint64_t frameDuration = mapping[endIdx].mTimecode - mapping[endIdx - 1].mTimecode;
|
|
|
|
aStart = mapping[0].mTimecode / NS_PER_USEC;
|
|
|
|
aEnd = (mapping[endIdx].mTimecode + frameDuration) / NS_PER_USEC;
|
|
|
|
|
2015-02-11 23:52:13 -08:00
|
|
|
MSE_DEBUG(WebMContainerParser, "[%lld, %lld] [fso=%lld, leo=%lld, l=%u endIdx=%u]",
|
|
|
|
aStart, aEnd, mapping[0].mSyncOffset, mapping[endIdx].mEndOffset, mapping.Length(), endIdx);
|
2014-09-16 23:33:00 -07:00
|
|
|
|
|
|
|
mapping.RemoveElementsAt(0, endIdx + 1);
|
|
|
|
mOverlappedMapping.AppendElements(mapping);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2014-12-10 13:52:57 -08:00
|
|
|
int64_t GetRoundingError()
|
2014-09-16 23:33:00 -07:00
|
|
|
{
|
|
|
|
int64_t error = mParser.GetTimecodeScale() / NS_PER_USEC;
|
2014-12-10 13:52:57 -08:00
|
|
|
return error * 2;
|
2014-09-16 23:33:00 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
WebMBufferedParser mParser;
|
|
|
|
nsTArray<WebMTimeDataOffset> mOverlappedMapping;
|
|
|
|
int64_t mOffset;
|
|
|
|
};
|
|
|
|
|
2015-01-28 22:08:58 -08:00
|
|
|
#ifdef MOZ_FMP4
|
2014-09-16 23:33:00 -07:00
|
|
|
class MP4ContainerParser : public ContainerParser {
|
|
|
|
public:
|
2015-02-11 23:52:13 -08:00
|
|
|
explicit MP4ContainerParser(const nsACString& aType)
|
|
|
|
: ContainerParser(aType)
|
|
|
|
, mMonitor("MP4ContainerParser Index Monitor")
|
|
|
|
{}
|
2014-09-16 23:33:00 -07:00
|
|
|
|
2015-01-26 07:01:09 -08:00
|
|
|
bool IsInitSegmentPresent(LargeDataBuffer* aData)
|
2014-09-16 23:33:00 -07:00
|
|
|
{
|
2015-01-26 07:01:09 -08:00
|
|
|
ContainerParser::IsInitSegmentPresent(aData);
|
2014-09-16 23:33:00 -07:00
|
|
|
// Each MP4 atom has a chunk size and chunk type. The root chunk in an MP4
|
|
|
|
// file is the 'ftyp' atom followed by a file type. We just check for a
|
|
|
|
// vaguely valid 'ftyp' atom.
|
|
|
|
|
2015-01-26 07:01:09 -08:00
|
|
|
if (aData->Length() < 8) {
|
2014-09-16 23:33:00 -07:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2015-01-26 07:01:09 -08:00
|
|
|
uint32_t chunk_size = BigEndian::readUint32(aData->Elements());
|
2014-09-16 23:33:00 -07:00
|
|
|
if (chunk_size < 8) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2015-01-26 07:01:09 -08:00
|
|
|
return (*aData)[4] == 'f' && (*aData)[5] == 't' && (*aData)[6] == 'y' &&
|
|
|
|
(*aData)[7] == 'p';
|
2014-09-16 23:33:00 -07:00
|
|
|
}
|
|
|
|
|
2015-01-26 07:01:09 -08:00
|
|
|
bool IsMediaSegmentPresent(LargeDataBuffer* aData)
|
2014-11-11 19:37:43 -08:00
|
|
|
{
|
2015-01-26 07:01:09 -08:00
|
|
|
ContainerParser::IsMediaSegmentPresent(aData);
|
|
|
|
if (aData->Length() < 8) {
|
2014-11-11 19:37:43 -08:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2015-01-26 07:01:09 -08:00
|
|
|
uint32_t chunk_size = BigEndian::readUint32(aData->Elements());
|
2014-11-11 19:37:43 -08:00
|
|
|
if (chunk_size < 8) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2015-01-26 07:01:09 -08:00
|
|
|
return ((*aData)[4] == 'm' && (*aData)[5] == 'o' && (*aData)[6] == 'o' &&
|
|
|
|
(*aData)[7] == 'f') ||
|
|
|
|
((*aData)[4] == 's' && (*aData)[5] == 't' && (*aData)[6] == 'y' &&
|
|
|
|
(*aData)[7] == 'p');
|
2014-11-11 19:37:43 -08:00
|
|
|
}
|
|
|
|
|
2015-01-26 07:01:09 -08:00
|
|
|
bool ParseStartAndEndTimestamps(LargeDataBuffer* aData,
|
2014-09-16 23:33:00 -07:00
|
|
|
int64_t& aStart, int64_t& aEnd)
|
|
|
|
{
|
2014-12-21 22:04:36 -08:00
|
|
|
MonitorAutoLock mon(mMonitor); // We're not actually racing against anything,
|
|
|
|
// but mParser requires us to hold a monitor.
|
2015-01-26 07:01:09 -08:00
|
|
|
bool initSegment = IsInitSegmentPresent(aData);
|
2014-09-16 23:33:00 -07:00
|
|
|
if (initSegment) {
|
2015-01-26 07:01:09 -08:00
|
|
|
mResource = new SourceBufferResource(NS_LITERAL_CSTRING("video/mp4"));
|
|
|
|
mStream = new MP4Stream(mResource);
|
2015-01-07 15:58:55 -08:00
|
|
|
// We use a timestampOffset of 0 for ContainerParser, and require
|
|
|
|
// consumers of ParseStartAndEndTimestamps to add their timestamp offset
|
|
|
|
// manually. This allows the ContainerParser to be shared across different
|
|
|
|
// timestampOffsets.
|
2015-03-12 20:26:08 -07:00
|
|
|
mParser = new mp4_demuxer::MoofParser(mStream, 0, /* aIsAudio = */ false, &mMonitor);
|
2015-02-01 16:41:43 -08:00
|
|
|
mInitData = new LargeDataBuffer();
|
2014-09-16 23:33:00 -07:00
|
|
|
} else if (!mStream || !mParser) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2015-01-26 07:01:09 -08:00
|
|
|
mResource->AppendData(aData);
|
2014-09-16 23:33:00 -07:00
|
|
|
nsTArray<MediaByteRange> byteRanges;
|
2015-01-26 07:01:09 -08:00
|
|
|
MediaByteRange mbr =
|
|
|
|
MediaByteRange(mParser->mOffset, mResource->GetLength());
|
|
|
|
byteRanges.AppendElement(mbr);
|
2014-09-16 23:33:00 -07:00
|
|
|
mParser->RebuildFragmentedIndex(byteRanges);
|
|
|
|
|
2015-02-01 16:41:43 -08:00
|
|
|
if (initSegment || !HasCompleteInitData()) {
|
2014-09-16 23:33:00 -07:00
|
|
|
const MediaByteRange& range = mParser->mInitRange;
|
2015-02-01 16:41:43 -08:00
|
|
|
uint32_t length = range.mEnd - range.mStart;
|
|
|
|
if (length) {
|
|
|
|
if (!mInitData->SetLength(length)) {
|
|
|
|
// Super unlikely OOM
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
char* buffer = reinterpret_cast<char*>(mInitData->Elements());
|
|
|
|
mResource->ReadFromCache(buffer, range.mStart, length);
|
2015-02-11 23:52:13 -08:00
|
|
|
MSE_DEBUG(MP4ContainerParser ,"Stashed init of %u bytes.",
|
|
|
|
length);
|
2015-02-01 16:41:43 -08:00
|
|
|
} else {
|
2015-02-11 23:52:13 -08:00
|
|
|
MSE_DEBUG(MP4ContainerParser, "Incomplete init found.");
|
2015-01-26 07:01:09 -08:00
|
|
|
}
|
2014-09-16 23:33:00 -07:00
|
|
|
mHasInitData = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
mp4_demuxer::Interval<mp4_demuxer::Microseconds> compositionRange =
|
|
|
|
mParser->GetCompositionRange(byteRanges);
|
2015-01-26 07:01:09 -08:00
|
|
|
mResource->EvictData(mParser->mOffset, mParser->mOffset);
|
2014-09-16 23:33:00 -07:00
|
|
|
|
|
|
|
if (compositionRange.IsNull()) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
aStart = compositionRange.start;
|
|
|
|
aEnd = compositionRange.end;
|
2015-02-11 23:52:13 -08:00
|
|
|
MSE_DEBUG(MP4ContainerParser, "[%lld, %lld]",
|
|
|
|
aStart, aEnd);
|
2014-09-16 23:33:00 -07:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2015-01-11 12:48:23 -08:00
|
|
|
// Gaps of up to 20ms (marginally longer than a single frame at 60fps) are considered
|
|
|
|
// to be sequential frames.
|
2014-12-10 13:52:57 -08:00
|
|
|
int64_t GetRoundingError()
|
2014-11-25 19:50:29 -08:00
|
|
|
{
|
2015-01-11 12:48:23 -08:00
|
|
|
return 20000;
|
2014-11-25 19:50:29 -08:00
|
|
|
}
|
|
|
|
|
2014-09-16 23:33:00 -07:00
|
|
|
private:
|
2015-01-26 07:01:09 -08:00
|
|
|
nsRefPtr<MP4Stream> mStream;
|
2014-09-16 23:33:00 -07:00
|
|
|
nsAutoPtr<mp4_demuxer::MoofParser> mParser;
|
2014-12-21 22:04:36 -08:00
|
|
|
Monitor mMonitor;
|
2014-09-16 23:33:00 -07:00
|
|
|
};
|
2015-01-28 22:08:58 -08:00
|
|
|
#endif
|
2014-09-16 23:33:00 -07:00
|
|
|
|
|
|
|
/*static*/ ContainerParser*
|
|
|
|
ContainerParser::CreateForMIMEType(const nsACString& aType)
|
|
|
|
{
|
|
|
|
if (aType.LowerCaseEqualsLiteral("video/webm") || aType.LowerCaseEqualsLiteral("audio/webm")) {
|
2015-02-11 23:52:13 -08:00
|
|
|
return new WebMContainerParser(aType);
|
2014-09-16 23:33:00 -07:00
|
|
|
}
|
|
|
|
|
2015-01-28 22:08:58 -08:00
|
|
|
#ifdef MOZ_FMP4
|
2014-09-16 23:33:00 -07:00
|
|
|
if (aType.LowerCaseEqualsLiteral("video/mp4") || aType.LowerCaseEqualsLiteral("audio/mp4")) {
|
2015-02-11 23:52:13 -08:00
|
|
|
return new MP4ContainerParser(aType);
|
2014-09-16 23:33:00 -07:00
|
|
|
}
|
2015-01-28 22:08:58 -08:00
|
|
|
#endif
|
2015-02-11 23:52:13 -08:00
|
|
|
return new ContainerParser(aType);
|
2014-09-16 23:33:00 -07:00
|
|
|
}
|
|
|
|
|
2015-02-11 23:52:13 -08:00
|
|
|
#undef MSE_DEBUG
|
|
|
|
|
2014-09-16 23:33:00 -07:00
|
|
|
} // namespace mozilla
|