| 3006 | } |
| 3007 | |
| 3008 | VideoCodec parseVideoCodec( tinyxml2::XMLElement const * element ) |
| 3009 | { |
| 3010 | int const line = element->GetLineNum(); |
| 3011 | std::map<std::string, std::string> attributes = getAttributes( element ); |
| 3012 | checkAttributes( "vk.xml", line, attributes, { { "name", {} } }, { { "extend", {} }, { "value", {} } } ); |
| 3013 | std::vector<tinyxml2::XMLElement const *> children = getChildElements( element ); |
| 3014 | checkElements( "vk.xml", |
| 3015 | line, |
| 3016 | children, |
| 3017 | { { "videocapabilities", MultipleAllowed::Yes } }, |
| 3018 | { { "videoformat", MultipleAllowed::Yes }, { "videoprofiles", MultipleAllowed::No } } ); |
| 3019 | |
| 3020 | VideoCodec videoCodec{ .xmlLine = line }; |
| 3021 | for ( auto const & attribute : attributes ) |
| 3022 | { |
| 3023 | if ( attribute.first == "extend" ) |
| 3024 | { |
| 3025 | checkNoList( attribute.second, line ); |
| 3026 | videoCodec.extend = attribute.second; |
| 3027 | } |
| 3028 | else if ( attribute.first == "name" ) |
| 3029 | { |
| 3030 | checkNoList( attribute.second, line ); |
| 3031 | videoCodec.name = attribute.second; |
| 3032 | } |
| 3033 | else if ( attribute.first == "value" ) |
| 3034 | { |
| 3035 | checkNoList( attribute.second, line ); |
| 3036 | videoCodec.value = attribute.second; |
| 3037 | // CHECK: value after extensions |
| 3038 | } |
| 3039 | } |
| 3040 | |
| 3041 | for ( auto child : children ) |
| 3042 | { |
| 3043 | std::string value = child->Value(); |
| 3044 | if ( value == "videocapabilities" ) |
| 3045 | { |
| 3046 | VideoCapabilities videoCapabilities = parseVideoCapabilities( child ); |
| 3047 | checkForError( "vk.xml", |
| 3048 | std::ranges::none_of( videoCodec.videoCapabilities, |
| 3049 | [&videoCapabilities]( VideoCapabilities const & vc ) { return vc.structure == videoCapabilities.structure; } ), |
| 3050 | videoCapabilities.xmlLine, |
| 3051 | "videocodec <" + videoCodec.name + "> already lists videocapabilities on <" + videoCapabilities.structure + ">" ); |
| 3052 | videoCodec.videoCapabilities.push_back( std::move( videoCapabilities ) ); |
| 3053 | } |
| 3054 | else if ( value == "videoformat" ) |
| 3055 | { |
| 3056 | VideoFormat videoFormat = parseVideoFormat( child ); |
| 3057 | checkForError( "vk.xml", |
| 3058 | videoFormat.name.empty() || !containsByName( videoCodec.videoFormats, videoFormat.name ), |
| 3059 | videoFormat.xmlLine, |
| 3060 | "videocodec <" + videoCodec.name + "> already lists a videoformat <" + videoFormat.name + ">" ); |
| 3061 | videoCodec.videoFormats.push_back( std::move( videoFormat ) ); |
| 3062 | } |
| 3063 | else if ( value == "videoprofiles" ) |
| 3064 | { |
| 3065 | videoCodec.videoProfiles = std::make_optional<VideoProfiles>( parseVideoProfiles( child ) ); |
no test coverage detected