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

Function cellCameraGetBufferSize

ps3fw/cellCamera.cpp:1024–1084  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1022}
1023
1024error_code cellCameraGetBufferSize(s32 dev_num, vm::ptr<CellCameraInfoEx> info)
1025{
1026 cellCamera.notice("cellCameraGetBufferSize(dev_num=%d, info=*0x%x)", dev_num, info);
1027
1028 auto& g_camera = g_fxo->get<camera_thread>();
1029
1030 if (!g_camera.init)
1031 {
1032 return CELL_CAMERA_ERROR_NOT_INIT;
1033 }
1034
1035 if (g_cfg.io.camera == camera_handler::null)
1036 {
1037 return not_an_error(CELL_CAMERA_ERROR_DEVICE_NOT_FOUND);
1038 }
1039
1040 if (!check_dev_num(dev_num))
1041 {
1042 return CELL_CAMERA_ERROR_PARAM;
1043 }
1044
1045 if (g_camera.is_open)
1046 {
1047 return CELL_CAMERA_ERROR_ALREADY_OPEN;
1048 }
1049
1050 if (!info)
1051 {
1052 return CELL_CAMERA_ERROR_PARAM;
1053 }
1054
1055 if (auto res = check_camera_info(*info))
1056 {
1057 return res;
1058 }
1059
1060 if (!cellCameraIsAttached(dev_num))
1061 {
1062 return CELL_CAMERA_ERROR_DEVICE_NOT_FOUND;
1063 }
1064
1065 if (auto status = cellCameraSetAttribute(dev_num, CELL_CAMERA_READMODE, info->read_mode, 0))
1066 {
1067 return status;
1068 }
1069
1070 if (error_code error = check_resolution(dev_num))
1071 {
1072 return error;
1073 }
1074
1075 std::lock_guard lock(g_camera.mutex);
1076
1077 g_camera.info = *info;
1078 info->bytesize = get_video_buffer_size(g_camera.info);
1079
1080 cellCamera.notice("cellCameraGetBufferSize info: format=%d, resolution=%d, framerate=%d, bytesize=%d, width=%d, height=%d, dev_num=%d, guid=%d",
1081 info->format, info->resolution, info->framerate, info->bytesize, info->width, info->height, info->dev_num, info->guid);

Callers

nothing calls this directly

Calls 6

check_dev_numFunction · 0.85
check_camera_infoFunction · 0.85
cellCameraIsAttachedFunction · 0.85
cellCameraSetAttributeFunction · 0.85
check_resolutionFunction · 0.85
get_video_buffer_sizeFunction · 0.85

Tested by

no test coverage detected