| 149 | } |
| 150 | |
| 151 | static void validateMpeg(const fl::vector<fl::u8>& data) { |
| 152 | fl::string error; |
| 153 | fl::Mpeg1Info info = fl::Mpeg1::parseMpeg1Info(data, &error); |
| 154 | FL_CHECK_MESSAGE(info.isValid, "MPEG1 metadata parse failed: " << error); |
| 155 | if (info.isValid) { |
| 156 | FL_CHECK_GT(info.width, 0); |
| 157 | FL_CHECK_GT(info.height, 0); |
| 158 | FL_MESSAGE("MPEG1: " << info.width << "x" << info.height |
| 159 | << " fps=" << info.frameRate); |
| 160 | } |
| 161 | |
| 162 | if (fl::Mpeg1::isSupported()) { |
| 163 | fl::Mpeg1Config config; |
| 164 | config.mode = fl::Mpeg1Config::SingleFrame; |
| 165 | fl::string dec_error; |
| 166 | auto decoder = fl::Mpeg1::createDecoder(config, &dec_error); |
| 167 | FL_REQUIRE_MESSAGE(decoder, "MPEG1 decoder creation failed: " << dec_error); |
| 168 | auto stream = fl::make_shared<fl::memorybuf>(data.size()); |
| 169 | stream->write(data); |
| 170 | FL_CHECK(decoder->begin(stream)); |
| 171 | auto result = decoder->decode(); |
| 172 | if (result == fl::DecodeResult::Success) { |
| 173 | fl::Frame frame = decoder->getCurrentFrame(); |
| 174 | FL_CHECK(frame.isValid()); |
| 175 | FL_CHECK_GT(frame.getWidth(), 0); |
| 176 | FL_CHECK_GT(frame.getHeight(), 0); |
| 177 | FL_MESSAGE("MPEG1 first frame: " << frame.getWidth() << "x" << frame.getHeight()); |
| 178 | } |
| 179 | decoder->end(); |
| 180 | } else { |
| 181 | FL_MESSAGE("MPEG1 decoder not supported on this platform"); |
| 182 | } |
| 183 | } |
| 184 | |
| 185 | static void validateGif(const fl::vector<fl::u8>& data) { |
| 186 | fl::string error; |
no test coverage detected