diff --git a/CMakeLists.txt b/CMakeLists.txt index 928334c..84f110b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,7 +9,7 @@ set(META_APP_AUTHOR "Martchus") set(META_APP_URL "https://github.com/${META_APP_AUTHOR}/${META_PROJECT_NAME}") set(META_APP_DESCRIPTION "C++ library for reading and writing MP4 (iTunes), ID3, Vorbis, Opus, FLAC and Matroska tags") set(META_VERSION_MAJOR 9) -set(META_VERSION_MINOR 2) +set(META_VERSION_MINOR 3) set(META_VERSION_PATCH 0) set(META_REQUIRED_CPP_UNIT_VERSION 1.14.0) set(META_ADD_DEFAULT_CPP_UNIT_TEST_APPLICATION ON) diff --git a/abstracttrack.cpp b/abstracttrack.cpp index 92c1fbc..10b0559 100644 --- a/abstracttrack.cpp +++ b/abstracttrack.cpp @@ -144,55 +144,91 @@ string AbstractTrack::label() const return ss.str(); } -/*! - * \brief Returns a short description about the track. - * - * The description contains the abbreviated format and further information depending on the media - * type (eg. display size in case of video, language in case of audio/text). It is intended to be joined - * with descriptions of other tracks to get a short technical description about the file. - * - * Examples (exact format might change in the future!): - * - H.264-720p - * - HE-AAC-6ch-eng - */ -string AbstractTrack::description() const +/// \cond +string AbstractTrack::makeDescription(bool verbose) const { // use abbreviated format - const char *format = m_format.shortAbbreviation(); - if (!format || !*format) { + const auto format = MediaFormat(m_format.general, verbose ? m_format.sub : 0, verbose ? m_format.extension : 0); + const char *formatName = format.shortAbbreviation(); + if (!formatName || !*formatName) { // fall back to media type name if no abbreviation available - format = mediaTypeName(); + formatName = mediaTypeName(); } - // find additional info - const char *additionalInfo = nullptr; + // find additional info and level + const char *additionalInfoRef = nullptr; + string level; switch (m_mediaType) { case MediaType::Video: if (!displaySize().isNull()) { - additionalInfo = displaySize().abbreviation(); + additionalInfoRef = displaySize().abbreviation(); } else if (!pixelSize().isNull()) { - additionalInfo = pixelSize().abbreviation(); + additionalInfoRef = pixelSize().abbreviation(); + } + if (verbose) { + switch (format.general) { + case GeneralMediaFormat::Mpeg4Video: + case GeneralMediaFormat::Avc: + case GeneralMediaFormat::Hevc: + if (version()) { + level = "@L" + numberToString(version()); + } + break; + default: + ; + } } break; case MediaType::Audio: case MediaType::Text: if (channelCount()) { if (!language().empty() && language() != "und") { - return argsToString(format, '-', channelCount(), "ch-", language()); + return argsToString(formatName, '-', channelCount(), "ch-", language()); } else { - return argsToString(format, '-', channelCount(), 'c', 'h'); + return argsToString(formatName, '-', channelCount(), 'c', 'h'); } } else if (!language().empty() && language() != "und") { - additionalInfo = language().data(); + additionalInfoRef = language().data(); } break; default:; } - if (additionalInfo) { - return argsToString(format, '-', additionalInfo); + if (additionalInfoRef) { + return argsToString(formatName, level, '-', additionalInfoRef); } - return format; + return argsToString(formatName, level); +} +/// \endcond + +/*! + * \brief Returns a description about the track. + * + * The description contains the abbreviated format and further information depending on the media + * type (eg. display size in case of video, language in case of audio/text). It is intended to be joined + * with descriptions of other tracks to get a short technical description about the file. + * + * Examples (exact format might change in the future!): + * - H.264-High-10@5.1-720p + * - HE-AAC-6ch-eng + */ +string AbstractTrack::description() const +{ + return makeDescription(true); +} + +/*! + * \brief Returns a short description about the track. + * + * See description() for details. + * + * Examples (exact format might change in the future!): + * - H.264-720p + * - HE-AAC-6ch-eng + */ +string AbstractTrack::shortDescription() const +{ + return makeDescription(false); } /*! diff --git a/abstracttrack.h b/abstracttrack.h index f943656..d1e1e6f 100644 --- a/abstracttrack.h +++ b/abstracttrack.h @@ -106,6 +106,7 @@ public: const Margin &cropping() const; std::string label() const; std::string description() const; + std::string shortDescription() const; void parseHeader(Diagnostics &diag); bool isHeaderValid() const; @@ -165,6 +166,9 @@ protected: bool m_usedWhenPreviewing; std::uint32_t m_colorSpace; Margin m_cropping; + +private: + std::string makeDescription(bool verbose) const; }; /*! diff --git a/mediaformat.cpp b/mediaformat.cpp index a3d3184..c5b0302 100644 --- a/mediaformat.cpp +++ b/mediaformat.cpp @@ -490,7 +490,38 @@ const char *MediaFormat::abbreviation() const case GeneralMediaFormat::Amr: return "AMR"; case GeneralMediaFormat::Avc: - return "H.264"; + switch (sub) { + case AvcCavlc444IntraProfile: + return "H.264 CAVLC 4:4:4 Intra"; + case AvcBaselineProfile: + return "H.264 Basline"; + case AvcMainProfile: + return "H.264 Main"; + case AvcScalableBaselineProfile: + return "H.264 Scalable Basline"; + case AvcScalableHighProfile: + return "H.264 Scalable High"; + case AvcExtendedProfile: + return "H.264 Extended"; + case AvcHighProfile: + return "H.264 High"; + case AvcHigh10Profile: + return "H.264 High 10"; + case AvcHighMultiviewProfile: + return "H.264 Multiview"; + case AvcHigh422Profile: + return "H.264 High 4:2:2"; + case AvcStereoHighProfile: + return "H.264 Stereo High"; + case AvcHighMultiviewDepthProfile: + return "H.264 Multiview Depth High"; + case AvcHigh444Profile: + return "H.264 High 4:4:4"; + case AvcHigh444PredictiveProfile: + return "H.264 High 4:4:4 Predictive"; + default: + return "H.264"; + } case GeneralMediaFormat::Av1: return "AV1"; case GeneralMediaFormat::Bitmap: @@ -622,7 +653,7 @@ const char *MediaFormat::abbreviation() const case Mpeg4AdvancedSimpleProfile4: case Mpeg4AdvancedSimpleProfile5: case Mpeg4AdvancedSimpleProfile3b: - return "H.263"; + return "MPEG-4 ASP"; case Mpeg4AvcProfile: return "H.264"; default: @@ -777,7 +808,38 @@ const char *MediaFormat::shortAbbreviation() const case GeneralMediaFormat::Amr: return "AMR"; case GeneralMediaFormat::Avc: - return "H.264"; + switch (sub) { + case AvcCavlc444IntraProfile: + return "H.264-CAVLC"; + case AvcBaselineProfile: + return "H.264-Basline"; + case AvcMainProfile: + return "H.264-Main"; + case AvcScalableBaselineProfile: + return "H.264-Scalable-Basline"; + case AvcScalableHighProfile: + return "H.264-Scalable-High"; + case AvcExtendedProfile: + return "H.264-Extended"; + case AvcHighProfile: + return "H.264-High"; + case AvcHigh10Profile: + return "H.264-High-10"; + case AvcHighMultiviewProfile: + return "H.264-Multiview"; + case AvcHigh422Profile: + return "H.264-High-4:2:2"; + case AvcStereoHighProfile: + return "H.264-Stereo-High"; + case AvcHighMultiviewDepthProfile: + return "H.264-Multiview-Depth-High"; + case AvcHigh444Profile: + return "H.264-High-4:4:4"; + case AvcHigh444PredictiveProfile: + return "H.264-High-4:4:4-Predictive"; + default: + return "H.264"; + } case GeneralMediaFormat::Av1: return "AV1"; case GeneralMediaFormat::Bitmap: @@ -882,7 +944,7 @@ const char *MediaFormat::shortAbbreviation() const case Mpeg4AdvancedSimpleProfile4: case Mpeg4AdvancedSimpleProfile5: case Mpeg4AdvancedSimpleProfile3b: - return "H.263"; + return "MPEG-4-ASP"; case Mpeg4AvcProfile: return "H.264"; default: diff --git a/mp4/mp4ids.h b/mp4/mp4ids.h index 3b7f47d..77c4a2f 100644 --- a/mp4/mp4ids.h +++ b/mp4/mp4ids.h @@ -184,7 +184,7 @@ enum KnownValue : std::uint32_t { AppleGif = 0x67696620, /**< gif */ AppleGraphics = 0x736D630, /**< ?6Ö0 */ AppleGsm101 = 0x6167736D, /**< agsm */ - AppleH261 = 0x68323631, /**< h261 */ + AppleH261 = 0x68323631, /**< H.261 */ AppleIntermediateCodec = 0x69636F64, /**< icod */ AppleLossless = 0x616C6163, /**< alac */ AppleMacpaint = 0x504E5447, /**< PNTG */ @@ -279,7 +279,7 @@ enum KnownValue : std::uint32_t { Glass = 0x676C6173, /**< glas */ GradientWipe = 0x6D617474, /**< matt */ Graphics = 0x736D6320, /**< smc : Graphics */ - H263Quicktime = 0x68323633, /**< h263: H.263/MPEG-4 ASP video (Quicktime) */ + H263Quicktime = 0x68323633, /**< h263: H.263 (Quicktime) */ H2633GPP = 0x73323633, /**< s263: H.263 (3GPP format) */ H264Decoder1 = 0x44415643, /**< DAVC */ H264Decoder2 = 0x48323634, /**< H264 */