| 1367 | } |
| 1368 | |
| 1369 | error_code cellVdecGetPictureExt(ppu_thread& ppu, u32 handle, |
| 1370 | vm::cptr<CellVdecPicFormat2> format, |
| 1371 | vm::ptr<u8> outBuff, u32 arg4) |
| 1372 | { |
| 1373 | ppu.state += cpu_flag::wait; |
| 1374 | |
| 1375 | cellVdec.trace("cellVdecGetPictureExt(handle=0x%x, format=*0x%x, " |
| 1376 | "outBuff=*0x%x, arg4=*0x%x)", |
| 1377 | handle, format, outBuff, arg4); |
| 1378 | |
| 1379 | const auto vdec = idm::get_unlocked<vdec_context>(handle); |
| 1380 | |
| 1381 | if (!vdec || !format) |
| 1382 | { |
| 1383 | return CELL_VDEC_ERROR_ARG; |
| 1384 | } |
| 1385 | |
| 1386 | { |
| 1387 | std::lock_guard lock{vdec->mutex}; |
| 1388 | |
| 1389 | if (vdec->seq_state == sequence_state::closed || |
| 1390 | vdec->seq_state > sequence_state::ending) |
| 1391 | { |
| 1392 | return {CELL_VDEC_ERROR_SEQ, vdec->seq_state.load()}; |
| 1393 | } |
| 1394 | } |
| 1395 | |
| 1396 | if (format->formatType > 4 || |
| 1397 | (format->formatType <= CELL_VDEC_PICFMT_RGBA32_ILV && |
| 1398 | format->colorMatrixType > CELL_VDEC_COLOR_MATRIX_TYPE_BT709)) |
| 1399 | { |
| 1400 | return CELL_VDEC_ERROR_ARG; |
| 1401 | } |
| 1402 | |
| 1403 | if (arg4 && arg4 != 8 && arg4 != 0xc) |
| 1404 | { |
| 1405 | return CELL_VDEC_ERROR_ARG; |
| 1406 | } |
| 1407 | |
| 1408 | if (arg4 || format->unk0 || format->unk1) |
| 1409 | { |
| 1410 | fmt::throw_exception("cellVdecGetPictureExt: Unknown arguments " |
| 1411 | "(arg4=*0x%x, unk0=0x%x, unk1=0x%x)", |
| 1412 | arg4, format->unk0, format->unk1); |
| 1413 | } |
| 1414 | |
| 1415 | vdec_frame frame; |
| 1416 | bool notify = false; |
| 1417 | u64 sequence_id{}; |
| 1418 | |
| 1419 | { |
| 1420 | std::lock_guard lock(vdec->mutex); |
| 1421 | |
| 1422 | if (vdec->out_queue.empty()) |
| 1423 | { |
| 1424 | return CELL_VDEC_ERROR_EMPTY; |
| 1425 | } |
| 1426 |
no test coverage detected