| 194 | } |
| 195 | |
| 196 | H264Info H264::parseH264Info(fl::span<const fl::u8> mp4Data, fl::string* error_message) { |
| 197 | H264Info info; |
| 198 | |
| 199 | Mp4TrackInfo track = parseMp4(mp4Data, error_message); |
| 200 | if (!track.isValid) return info; |
| 201 | |
| 202 | // Use dimensions from avc1 box |
| 203 | info.width = track.width; |
| 204 | info.height = track.height; |
| 205 | info.profile = track.profile; |
| 206 | info.level = track.level; |
| 207 | |
| 208 | // Parse SPS for more detailed info if available |
| 209 | if (!track.sps.empty()) { |
| 210 | fl::string spsError; |
| 211 | H264Info spsInfo = parseSPS(track.sps[0], &spsError); |
| 212 | if (spsInfo.isValid) { |
| 213 | // SPS-parsed dimensions are more authoritative |
| 214 | info.width = spsInfo.width; |
| 215 | info.height = spsInfo.height; |
| 216 | info.profile = spsInfo.profile; |
| 217 | info.level = spsInfo.level; |
| 218 | info.numRefFrames = spsInfo.numRefFrames; |
| 219 | } |
| 220 | } |
| 221 | |
| 222 | info.isValid = true; |
| 223 | return info; |
| 224 | } |
| 225 | |
| 226 | } // namespace fl |
| 227 | |