rpcsx/rpcs3/Emu/Cell/Modules/cellRec.cpp

155 lines
3.3 KiB
C++
Raw Normal View History

2015-07-31 00:53:52 +02:00
#include "stdafx.h"
2016-03-21 20:43:03 +01:00
#include "Emu/Cell/PPUModule.h"
2018-01-18 20:14:56 +01:00
#include "Emu/IdManager.h"
#include "cellSysutil.h"
2015-07-31 00:53:52 +02:00
LOG_CHANNEL(cellRec);
2015-07-31 00:53:52 +02:00
2018-01-18 20:14:56 +01:00
enum
{
CELL_REC_STATUS_UNLOAD = 0,
CELL_REC_STATUS_OPEN = 1,
CELL_REC_STATUS_START = 2,
CELL_REC_STATUS_STOP = 3,
CELL_REC_STATUS_CLOSE = 4,
CELL_REC_STATUS_ERR = 10
};
2017-07-23 22:45:12 +02:00
struct CellRecSpursParam
{
2017-07-26 20:09:00 +02:00
vm::bptr<struct CellSpurs> pSpurs;
2017-07-23 22:45:12 +02:00
be_t<s32> spu_usage_rate;
u8 priority[8];
};
struct CellRecOption
{
be_t<s32> option;
union
{
be_t<s32> ppu_thread_priority;
be_t<s32> spu_thread_priority;
be_t<s32> capture_priority;
be_t<s32> use_system_spu;
be_t<s32> fit_to_youtube;
be_t<s32> xmb_bgm;
be_t<s32> mpeg4_fast_encode;
be_t<u32> ring_sec;
be_t<s32> video_input;
be_t<s32> audio_input;
be_t<s32> audio_input_mix_vol;
be_t<s32> reduce_memsize;
be_t<s32> show_xmb;
2017-07-26 20:09:00 +02:00
vm::bptr<char> metadata_filename;
vm::bptr<CellRecSpursParam> pSpursParam;
2017-07-23 22:45:12 +02:00
be_t<u64> dummy;
} value;
};
struct CellRecParam
{
be_t<s32> videoFmt;
be_t<s32> audioFmt;
be_t<s32> numOfOpt;
2017-07-26 20:09:00 +02:00
vm::bptr<CellRecOption> pOpt;
2017-07-23 22:45:12 +02:00
};
using CellRecCallback = void(s32 recStatus, s32 recError, vm::ptr<void> userdata);
struct rec_info
2018-01-18 20:14:56 +01:00
{
vm::ptr<CellRecCallback> cb;
vm::ptr<void> cbUserData;
};
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)
2015-07-31 00:53:52 +02:00
{
2017-07-23 22:45:12 +02:00
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);
2018-01-18 20:14:56 +01:00
const auto rec = g_fxo->get<rec_info>();
2018-01-18 20:14:56 +01:00
rec->cb = cb;
rec->cbUserData = cbUserData;
sysutil_register_cb([=](ppu_thread& ppu) -> s32
{
cb(ppu, CELL_REC_STATUS_OPEN, CELL_OK, cbUserData);
return CELL_OK;
});
2017-07-23 22:45:12 +02:00
return CELL_OK;
2015-07-31 00:53:52 +02:00
}
2018-01-18 20:14:56 +01:00
error_code cellRecClose(s32 isDiscard)
2015-07-31 00:53:52 +02:00
{
2017-07-23 22:45:12 +02:00
cellRec.todo("cellRecClose(isDiscard=0x%x)", isDiscard);
2018-01-18 20:14:56 +01:00
const auto rec = g_fxo->get<rec_info>();
2018-01-18 20:14:56 +01:00
sysutil_register_cb([=](ppu_thread& ppu) -> s32
{
rec->cb(ppu, CELL_REC_STATUS_CLOSE, CELL_OK, rec->cbUserData);
return CELL_OK;
});
2017-07-23 22:45:12 +02:00
return CELL_OK;
2015-07-31 00:53:52 +02:00
}
2017-07-23 22:45:12 +02:00
void cellRecGetInfo(s32 info, vm::ptr<u64> pValue)
2015-07-31 00:53:52 +02:00
{
2017-07-23 22:45:12 +02:00
cellRec.todo("cellRecGetInfo(info=0x%x, pValue=*0x%x)", info, pValue);
2015-07-31 00:53:52 +02:00
}
2018-01-18 20:14:56 +01:00
error_code cellRecStop()
2015-07-31 00:53:52 +02:00
{
2017-07-23 22:45:12 +02:00
cellRec.todo("cellRecStop()");
2018-01-18 20:14:56 +01:00
const auto rec = g_fxo->get<rec_info>();
2018-01-18 20:14:56 +01:00
sysutil_register_cb([=](ppu_thread& ppu) -> s32
{
rec->cb(ppu, CELL_REC_STATUS_STOP, CELL_OK, rec->cbUserData);
return CELL_OK;
});
2017-07-23 22:45:12 +02:00
return CELL_OK;
2015-07-31 00:53:52 +02:00
}
2018-01-18 20:14:56 +01:00
error_code cellRecStart()
2015-07-31 00:53:52 +02:00
{
2017-07-23 22:45:12 +02:00
cellRec.todo("cellRecStart()");
2018-01-18 20:14:56 +01:00
const auto rec = g_fxo->get<rec_info>();
2018-01-18 20:14:56 +01:00
sysutil_register_cb([=](ppu_thread& ppu) -> s32
{
rec->cb(ppu, CELL_REC_STATUS_START, CELL_OK, rec->cbUserData);
return CELL_OK;
});
2017-07-23 22:45:12 +02:00
return CELL_OK;
2015-07-31 00:53:52 +02:00
}
2017-07-23 22:45:12 +02:00
u32 cellRecQueryMemSize(vm::cptr<CellRecParam> pParam)
2015-07-31 00:53:52 +02:00
{
2017-07-23 22:45:12 +02:00
cellRec.todo("cellRecQueryMemSize(pParam=*0x%x)", pParam);
return 1 * 1024 * 1024; // dummy memory size
2015-07-31 00:53:52 +02:00
}
2018-01-18 20:14:56 +01:00
error_code cellRecSetInfo(s32 setInfo, u64 value)
2015-07-31 00:53:52 +02:00
{
2017-07-23 22:45:12 +02:00
cellRec.todo("cellRecSetInfo(setInfo=0x%x, value=0x%x)", setInfo, value);
return CELL_OK;
2015-07-31 00:53:52 +02:00
}
2016-03-21 20:43:03 +01:00
DECLARE(ppu_module_manager::cellRec)("cellRec", []()
2015-07-31 00:53:52 +02:00
{
REG_FUNC(cellRec, cellRecOpen);
REG_FUNC(cellRec, cellRecClose);
REG_FUNC(cellRec, cellRecGetInfo);
REG_FUNC(cellRec, cellRecStop);
REG_FUNC(cellRec, cellRecStart);
REG_FUNC(cellRec, cellRecQueryMemSize);
REG_FUNC(cellRec, cellRecSetInfo);
});