MCPcopy Create free account
hub / github.com/RPCSX/rpcsx / cellRecClose

Function cellRecClose

ps3fw/cellRec.cpp:1318–1413  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1316}
1317
1318error_code cellRecClose(s32 isDiscard)
1319{
1320 cellRec.todo("cellRecClose(isDiscard=0x%x)", isDiscard);
1321
1322 auto& rec = g_fxo->get<rec_info>();
1323
1324 if (rec.state == rec_state::closed)
1325 {
1326 return CELL_REC_ERROR_INVALID_STATE;
1327 }
1328
1329 sysutil_register_cb([=, &rec](ppu_thread& ppu) -> s32
1330 {
1331 bool is_valid_range = true;
1332
1333 if (isDiscard)
1334 {
1335 // No need to flush the encoder
1336 rec.stop_video_provider(false);
1337 rec.encoder->stop(false);
1338
1339 if (rec.sink)
1340 {
1341 rec.sink->stop(true);
1342 }
1343
1344 if (fs::is_file(rec.param.filename))
1345 {
1346 cellRec.warning("cellRecClose: removing discarded recording '%s'", rec.param.filename);
1347
1348 if (!fs::remove_file(rec.param.filename))
1349 {
1350 cellRec.error("cellRecClose: failed to remove recording '%s'", rec.param.filename);
1351 }
1352 }
1353 }
1354 else
1355 {
1356 // Flush to make sure we encode all remaining frames
1357 rec.stop_video_provider(true);
1358 rec.encoder->stop(true);
1359 rec.recording_time_total = rec.encoder->get_timestamp_ms(rec.encoder->last_video_pts());
1360
1361 if (rec.sink)
1362 {
1363 rec.sink->stop(true);
1364 }
1365
1366 const s64 start_pts = rec.encoder->get_pts(rec.param.scene_metadata.start_time);
1367 const s64 end_pts = rec.encoder->get_pts(rec.param.scene_metadata.end_time);
1368 const s64 last_pts = rec.encoder->last_video_pts();
1369
1370 is_valid_range = start_pts >= 0 && end_pts <= last_pts;
1371 }
1372
1373 vm::dealloc(rec.video_input_buffer.addr(), vm::main);
1374 vm::dealloc(rec.audio_input_buffer.addr(), vm::main);
1375

Callers

nothing calls this directly

Calls 15

sysutil_register_cbFunction · 0.85
deallocFunction · 0.85
stop_video_providerMethod · 0.80
errorMethod · 0.80
get_timestamp_msMethod · 0.80
last_video_ptsMethod · 0.80
get_ptsMethod · 0.80
use_internal_videoMethod · 0.80
use_internal_audioMethod · 0.80
set_video_sinkMethod · 0.80
stopMethod · 0.45
addrMethod · 0.45

Tested by

no test coverage detected