Ignore matroska projection metadata

Warn instead of fail parsing.

Closes #932.
This commit is contained in:
Mattias Wadman 2021-05-07 19:13:02 +02:00 committed by GitHub
parent 2e521c8413
commit 62f37eb3b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 2 deletions

View File

@ -159,6 +159,8 @@ const int kWebMIdPosition = 0xA7;
const int kWebMIdPrevFilename = 0x3C83AB; const int kWebMIdPrevFilename = 0x3C83AB;
const int kWebMIdPrevSize = 0xAB; const int kWebMIdPrevSize = 0xAB;
const int kWebMIdPrevUID = 0x3CB923; const int kWebMIdPrevUID = 0x3CB923;
const int kWebMIdProjection = 0x7670;
const int kWebMIdProjectionType = 0x7671;
const int kWebMIdReferenceBlock = 0xFB; const int kWebMIdReferenceBlock = 0xFB;
const int kWebMIdReferencePriority = 0xFA; const int kWebMIdReferencePriority = 0xFA;
const int kWebMIdSamplingFrequency = 0xB5; const int kWebMIdSamplingFrequency = 0xB5;

View File

@ -198,6 +198,7 @@ static const ElementIdInfo kVideoIds[] = {
{BINARY, kWebMIdColorSpace}, {BINARY, kWebMIdColorSpace},
{FLOAT, kWebMIdFrameRate}, {FLOAT, kWebMIdFrameRate},
{LIST, kWebMIdColor}, {LIST, kWebMIdColor},
{LIST, kWebMIdProjection},
}; };
static const ElementIdInfo kColorIds[] = { static const ElementIdInfo kColorIds[] = {
@ -217,6 +218,10 @@ static const ElementIdInfo kColorIds[] = {
{LIST, kWebMIdColorMasteringMetadata}, {LIST, kWebMIdColorMasteringMetadata},
}; };
static const ElementIdInfo kProjectionIds[] = {
{UINT, kWebMIdProjectionType},
};
static const ElementIdInfo kAudioIds[] = { static const ElementIdInfo kAudioIds[] = {
{FLOAT, kWebMIdSamplingFrequency}, {FLOAT, kWebMIdSamplingFrequency},
{FLOAT, kWebMIdOutputSamplingFrequency}, {FLOAT, kWebMIdOutputSamplingFrequency},
@ -401,6 +406,7 @@ static const ListElementInfo kListElementInfo[] = {
LIST_ELEMENT_INFO(kWebMIdTrackTranslate, 3, kTrackTranslateIds), LIST_ELEMENT_INFO(kWebMIdTrackTranslate, 3, kTrackTranslateIds),
LIST_ELEMENT_INFO(kWebMIdVideo, 3, kVideoIds), LIST_ELEMENT_INFO(kWebMIdVideo, 3, kVideoIds),
LIST_ELEMENT_INFO(kWebMIdColor, 4, kColorIds), LIST_ELEMENT_INFO(kWebMIdColor, 4, kColorIds),
LIST_ELEMENT_INFO(kWebMIdProjection, 4, kProjectionIds),
LIST_ELEMENT_INFO(kWebMIdAudio, 3, kAudioIds), LIST_ELEMENT_INFO(kWebMIdAudio, 3, kAudioIds),
LIST_ELEMENT_INFO(kWebMIdTrackOperation, 3, kTrackOperationIds), LIST_ELEMENT_INFO(kWebMIdTrackOperation, 3, kTrackOperationIds),
LIST_ELEMENT_INFO(kWebMIdTrackCombinePlanes, 4, kTrackCombinePlanesIds), LIST_ELEMENT_INFO(kWebMIdTrackCombinePlanes, 4, kTrackCombinePlanesIds),

View File

@ -161,11 +161,15 @@ VPCodecConfigurationRecord WebMVideoClient::GetVpCodecConfig(
} }
WebMParserClient* WebMVideoClient::OnListStart(int id) { WebMParserClient* WebMVideoClient::OnListStart(int id) {
return id == kWebMIdColor ? this : WebMParserClient::OnListStart(id); return id == kWebMIdColor || id == kWebMIdProjection
? this
: WebMParserClient::OnListStart(id);
} }
bool WebMVideoClient::OnListEnd(int id) { bool WebMVideoClient::OnListEnd(int id) {
return id == kWebMIdColor ? true : WebMParserClient::OnListEnd(id); return id == kWebMIdColor || id == kWebMIdProjection
? true
: WebMParserClient::OnListEnd(id);
} }
bool WebMVideoClient::OnUInt(int id, int64_t val) { bool WebMVideoClient::OnUInt(int id, int64_t val) {
@ -233,6 +237,9 @@ bool WebMVideoClient::OnUInt(int id, int64_t val) {
case kWebMIdColorMaxFALL: case kWebMIdColorMaxFALL:
NOTIMPLEMENTED() << "HDR is not supported yet."; NOTIMPLEMENTED() << "HDR is not supported yet.";
return true; return true;
case kWebMIdProjectionType:
LOG(WARNING) << "Ignoring ProjectionType with value " << val;
return true;
default: default:
return true; return true;
} }