| 920 | u32 cellRecQueryMemSize(vm::cptr<CellRecParam> pParam); // Forward declaration |
| 921 | |
| 922 | error_code cellRecOpen(vm::cptr<char> pDirName, vm::cptr<char> pFileName, vm::cptr<CellRecParam> pParam, u32 container, vm::ptr<CellRecCallback> cb, vm::ptr<void> cbUserData) |
| 923 | { |
| 924 | cellRec.todo("cellRecOpen(pDirName=%s, pFileName=%s, pParam=*0x%x, container=0x%x, cb=*0x%x, cbUserData=*0x%x)", pDirName, pFileName, pParam, container, cb, cbUserData); |
| 925 | |
| 926 | auto& rec = g_fxo->get<rec_info>(); |
| 927 | |
| 928 | if (rec.state != rec_state::closed) |
| 929 | { |
| 930 | return CELL_REC_ERROR_INVALID_STATE; |
| 931 | } |
| 932 | |
| 933 | if (!pParam || !pDirName || !pFileName) |
| 934 | { |
| 935 | return CELL_REC_ERROR_INVALID_VALUE; |
| 936 | } |
| 937 | |
| 938 | std::string options; |
| 939 | |
| 940 | for (s32 i = 0; i < pParam->numOfOpt; i++) |
| 941 | { |
| 942 | if (i > 0) |
| 943 | options += ", "; |
| 944 | fmt::append(options, "%d", pParam->pOpt[i].option); |
| 945 | } |
| 946 | |
| 947 | cellRec.notice("cellRecOpen: pParam={ videoFmt=0x%x, audioFmt=0x%x, numOfOpt=0x%x, options=[ %s ] }", pParam->videoFmt, pParam->audioFmt, pParam->numOfOpt, options); |
| 948 | |
| 949 | const u32 mem_size = cellRecQueryMemSize(pParam); |
| 950 | |
| 951 | if (container == SYS_MEMORY_CONTAINER_ID_INVALID) |
| 952 | { |
| 953 | if (mem_size != 0) |
| 954 | { |
| 955 | return CELL_REC_ERROR_INVALID_VALUE; |
| 956 | } |
| 957 | } |
| 958 | else |
| 959 | { |
| 960 | // NOTE: Most likely tries to allocate a complete container. But we use g_fxo instead. |
| 961 | // TODO: how much data do we actually need ? |
| 962 | rec.video_input_buffer = vm::cast(vm::alloc(mem_size, vm::main)); |
| 963 | rec.audio_input_buffer = vm::cast(vm::alloc(mem_size, vm::main)); |
| 964 | |
| 965 | if (!rec.video_input_buffer || !rec.audio_input_buffer) |
| 966 | { |
| 967 | return CELL_REC_ERROR_OUT_OF_MEMORY; |
| 968 | } |
| 969 | } |
| 970 | |
| 971 | switch (pParam->videoFmt) |
| 972 | { |
| 973 | case CELL_REC_PARAM_VIDEO_FMT_MPEG4_SMALL_512K_30FPS: |
| 974 | case CELL_REC_PARAM_VIDEO_FMT_MPEG4_SMALL_768K_30FPS: |
| 975 | case CELL_REC_PARAM_VIDEO_FMT_MPEG4_MIDDLE_512K_30FPS: |
| 976 | case CELL_REC_PARAM_VIDEO_FMT_MPEG4_MIDDLE_768K_30FPS: |
| 977 | case CELL_REC_PARAM_VIDEO_FMT_MPEG4_LARGE_512K_30FPS: |
| 978 | case CELL_REC_PARAM_VIDEO_FMT_MPEG4_LARGE_768K_30FPS: |
| 979 | case CELL_REC_PARAM_VIDEO_FMT_MPEG4_LARGE_1024K_30FPS: |
nothing calls this directly
no test coverage detected