recording: cleanup audio config members

and fix some annyoing msvc warnings
This commit is contained in:
Megamouse 2023-11-16 00:18:35 +01:00
parent 49f910a56b
commit ff434f9d38
7 changed files with 16 additions and 14 deletions

View File

@ -223,8 +223,8 @@ struct cell_audio_config
AudioChannelCnt audio_downmix = AudioChannelCnt::SURROUND_7_1;
AudioChannelCnt backend_ch_cnt = AudioChannelCnt::SURROUND_7_1;
u32 audio_channels = 0;
u32 audio_sampling_rate = 0;
u32 audio_channels = 2;
u32 audio_sampling_rate = DEFAULT_AUDIO_SAMPLING_RATE;
u32 audio_block_period = 0;
u32 audio_sample_size = 0;
f64 audio_min_buffer_duration = 0.0;

View File

@ -165,7 +165,11 @@ public:
rec_video_sink() : utils::video_sink()
{
m_framerate = rec_framerate;
m_sample_rate = 48000; // TODO
}
void set_sample_rate(u32 sample_rate)
{
m_sample_rate = sample_rate;
}
void stop(bool flush = true) override
@ -702,7 +706,7 @@ void rec_info::start_video_provider()
// The audio samples originate from cellAudio and are stored in a ringbuffer.
utils::video_sink::encoder_sample sample = sink->get_sample();
if (!sample.data.empty() && sample.channels >= 2 && sample.sample_count >= CELL_REC_AUDIO_BLOCK_SAMPLES)
if (!sample.data.empty() && sample.channels >= channels && sample.sample_count >= CELL_REC_AUDIO_BLOCK_SAMPLES)
{
s64 pts = encoder->get_audio_pts(sample.timestamp_us);
@ -1248,6 +1252,7 @@ error_code cellRecOpen(vm::cptr<char> pDirName, vm::cptr<char> pFileName, vm::cp
rec.sink = std::make_shared<rec_video_sink>();
rec.sink->use_internal_audio = rec.param.use_internal_audio();
rec.sink->use_internal_video = rec.param.use_internal_video();
rec.sink->set_sample_rate(rec.sample_rate);
}
rec.encoder = std::make_shared<utils::video_encoder>();

View File

@ -639,7 +639,7 @@ error_code cellSailPlayerInitialize2(ppu_thread& ppu,
pSelf->paused = true;
{
CellSailEvent event;
CellSailEvent event{};
event.u32x2.major = CELL_SAIL_EVENT_PLAYER_STATE_CHANGED;
event.u32x2.minor = 0;
pSelf->callback(ppu, pSelf->callbackArg, event, CELL_SAIL_PLAYER_STATE_INITIALIZED, 0);
@ -778,7 +778,7 @@ error_code cellSailPlayerBoot(ppu_thread& ppu, vm::ptr<CellSailPlayer> pSelf, u6
cellSail.warning("cellSailPlayerBoot(pSelf=*0x%x, userParam=%d)", pSelf, userParam);
{
CellSailEvent event;
CellSailEvent event{};
event.u32x2.major = CELL_SAIL_EVENT_PLAYER_STATE_CHANGED;
event.u32x2.minor = 0;
pSelf->callback(ppu, pSelf->callbackArg, event, CELL_SAIL_PLAYER_STATE_BOOT_TRANSITION, 0);
@ -788,7 +788,7 @@ error_code cellSailPlayerBoot(ppu_thread& ppu, vm::ptr<CellSailPlayer> pSelf, u6
pSelf->booted = true;
{
CellSailEvent event;
CellSailEvent event{};
event.u32x2.major = CELL_SAIL_EVENT_PLAYER_CALL_COMPLETED;
event.u32x2.minor = CELL_SAIL_PLAYER_CALL_BOOT;
pSelf->callback(ppu, pSelf->callbackArg, event, 0, 0);

View File

@ -28,9 +28,7 @@ struct cfg_recording final : cfg::node
node_audio(cfg::node* _this) : cfg::node(_this, "Audio") {}
cfg::uint<0x10000, 0x17000> audio_codec{this, "AVCodecID", 86019}; // AVCodecID::AV_CODEC_ID_AC3
cfg::uint<0, 8> channels{this, "Channels", 2};
cfg::uint<0, 25000000> audio_bps{this, "Audio Bitrate", 320000};
cfg::uint<0, 25000000> sample_rate{this, "Sample Rate", 48000};
} audio{ this };

View File

@ -295,7 +295,7 @@ namespace psf
for (const auto& entry : psf)
{
def_table_t index;
def_table_t index{};
index.key_off = ::narrow<u32>(key_offset);
index.param_fmt = entry.second.type();
index.param_len = entry.second.size();
@ -313,7 +313,7 @@ namespace psf
key_offset = utils::align(key_offset, 4);
// Generate header
header_t header;
header_t header{};
header.magic = "\0PSF"_u32;
header.version = 0x101;
header.off_key_table = ::narrow<u32>(sizeof(header_t) + sizeof(def_table_t) * psf.size());

View File

@ -504,8 +504,7 @@ void gs_frame::toggle_recording()
m_video_encoder->set_max_b_frames(g_cfg_recording.video.max_b_frames);
m_video_encoder->set_gop_size(g_cfg_recording.video.gop_size);
m_video_encoder->set_output_format(output_format);
m_video_encoder->set_sample_rate(g_cfg_recording.audio.sample_rate);
//m_video_encoder->set_audio_channels(static_cast<u32>(g_fxo->get<cell_audio>().cfg.backend_ch_cnt));
m_video_encoder->set_sample_rate(g_fxo->get<cell_audio>().cfg.audio_sampling_rate);
m_video_encoder->set_audio_channels(static_cast<u32>(g_fxo->get<cell_audio>().cfg.audio_channels));
m_video_encoder->set_audio_bitrate(g_cfg_recording.audio.audio_bps);
m_video_encoder->set_audio_codec(g_cfg_recording.audio.audio_codec);

View File

@ -73,7 +73,7 @@ namespace utils
u32 set_next_index(bool next);
shared_mutex m_mtx;
const s32 sample_rate = 48000;
static constexpr s32 sample_rate = 48000;
std::vector<u8> data;
atomic_t<u64> m_size = 0;
atomic_t<u32> track_fully_decoded{0};