Skip to content

libadm throws an error if formalLabel is not 0 or 1 #187

@rsjbailey

Description

@rsjbailey

An audioTrackFormat representing some custom codec might have user-defined formatLabel and formatDefinition attributes (see 2076-2 page 80).

libadm throws a parsing error if it encounters anything other than formatDefinition=0000 formatLabel=Undefined or formatDefinition=0001 formatLabel=PCM despite other values being valid.

FormatDescriptor parseFormatLabel(const std::string& label) {
if (label == "0000") {
return FormatDefinition::UNDEFINED;
} else if (label == "0001") {
return FormatDefinition::PCM;
} else {
std::stringstream errorString;
errorString << "invalid formatLabel: " << label;
throw std::runtime_error(errorString.str());
}
}
FormatDescriptor parseFormatDefinition(const std::string& definition) {
if (definition == "Undefined") {
return FormatDefinition::UNDEFINED;
} else if (definition == "PCM") {
return FormatDefinition::PCM;
} else {
std::stringstream errorString;
errorString << "invalid formatDefinition: " << definition;
throw std::runtime_error(errorString.str());
}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions