| 264 | } |
| 265 | |
| 266 | bool decoderHM::getNextFrameFromDecoder() |
| 267 | { |
| 268 | DEBUG_DECHM("decoderHM::getNextFrameFromDecoder"); |
| 269 | |
| 270 | currentHMPic = this->lib.libHMDec_get_picture(decoder); |
| 271 | if (currentHMPic == nullptr) |
| 272 | { |
| 273 | decoderState = DecoderState::NeedsMoreData; |
| 274 | return false; |
| 275 | } |
| 276 | |
| 277 | // Check the validity of the picture |
| 278 | auto picSize = Size(this->lib.libHMDEC_get_picture_width(currentHMPic, LIBHMDEC_LUMA), |
| 279 | this->lib.libHMDEC_get_picture_height(currentHMPic, LIBHMDEC_LUMA)); |
| 280 | if (!picSize.isValid()) |
| 281 | DEBUG_DECHM("decoderHM::getNextFrameFromDecoder got invalid size"); |
| 282 | auto subsampling = |
| 283 | convertFromInternalSubsampling(this->lib.libHMDEC_get_chroma_format(currentHMPic)); |
| 284 | if (subsampling == video::yuv::Subsampling::UNKNOWN) |
| 285 | DEBUG_DECHM("decoderHM::getNextFrameFromDecoder got invalid chroma format"); |
| 286 | auto bitDepth = functions::clipToUnsigned( |
| 287 | this->lib.libHMDEC_get_internal_bit_depth(currentHMPic, LIBHMDEC_LUMA)); |
| 288 | if (bitDepth < 8 || bitDepth > 16) |
| 289 | DEBUG_DECHM("decoderHM::getNextFrameFromDecoder got invalid bit depth"); |
| 290 | |
| 291 | if (!frameSize.isValid() && !formatYUV.isValid()) |
| 292 | { |
| 293 | // Set the values |
| 294 | frameSize = picSize; |
| 295 | formatYUV = video::yuv::PixelFormatYUV(subsampling, bitDepth); |
| 296 | } |
| 297 | else |
| 298 | { |
| 299 | // Check the values against the previously set values |
| 300 | if (frameSize != picSize) |
| 301 | return setErrorB("Received a frame of different size"); |
| 302 | if (formatYUV.getSubsampling() != subsampling) |
| 303 | return setErrorB("Received a frame with different subsampling"); |
| 304 | if (formatYUV.getBitsPerSample() != bitDepth) |
| 305 | return setErrorB("Received a frame with different bit depth"); |
| 306 | } |
| 307 | |
| 308 | DEBUG_DECHM("decoderHM::getNextFrameFromDecoder got a valid frame"); |
| 309 | return true; |
| 310 | } |
| 311 | |
| 312 | bool decoderHM::pushData(QByteArray &data) |
| 313 | { |
nothing calls this directly
no test coverage detected