mirror of
https://github.com/KytyPS5/KytyPS5.git
synced 2026-10-28 13:56:59 +01:00
ajm: share control handling to fully reset gapless decoders
Co-authored-by: Mac <me@itsmemac.com>
This commit is contained in:
+5
-22
@@ -682,16 +682,9 @@ static AjmDecodeResult AjmControlInstance(uint32_t instance, uint64_t flags,
|
|||||||
|
|
||||||
static AjmDecodeResult AjmSetGaplessDecode(uint32_t instance, const void* gapless_decode,
|
static AjmDecodeResult AjmSetGaplessDecode(uint32_t instance, const void* gapless_decode,
|
||||||
int reset) {
|
int reset) {
|
||||||
std::scoped_lock lock(g_ajm_instances_mutex);
|
const auto flags = AJM_FLAG_SIDEBAND_GAPLESS | (reset != 0 ? AJM_FLAG_CONTROL_RESET : 0);
|
||||||
auto* state = AjmFindInstanceLocked(instance);
|
return AjmControlInstance(instance, flags, gapless_decode, sizeof(AjmSidebandGaplessDecode),
|
||||||
if (state == nullptr || state->decoder == nullptr || gapless_decode == nullptr) {
|
nullptr, nullptr);
|
||||||
AjmDecodeResult result {};
|
|
||||||
result.result = AJM_RESULT_INVALID_PARAMETER;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
state->gapless.Set(*static_cast<const AjmSidebandGaplessDecode*>(gapless_decode), reset != 0);
|
|
||||||
return state->decoder->MakeResult();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static AjmDecodeResult AjmGetGaplessDecode(uint32_t instance,
|
static AjmDecodeResult AjmGetGaplessDecode(uint32_t instance,
|
||||||
@@ -930,18 +923,8 @@ int KYTY_SYSV_ABI AjmBatchJobClearContext(AjmBatchInfo* info, uint32_t instance,
|
|||||||
PRINT_NAME();
|
PRINT_NAME();
|
||||||
EXIT_NOT_IMPLEMENTED(info == nullptr);
|
EXIT_NOT_IMPLEMENTED(info == nullptr);
|
||||||
|
|
||||||
AjmDecodeResult decode_result {};
|
const auto decode_result =
|
||||||
{
|
AjmControlInstance(instance, AJM_FLAG_CONTROL_RESET, nullptr, 0, nullptr, nullptr);
|
||||||
std::scoped_lock lock(g_ajm_instances_mutex);
|
|
||||||
auto* state = AjmFindInstanceLocked(instance);
|
|
||||||
if (state != nullptr && state->decoder != nullptr) {
|
|
||||||
state->gapless.Reset();
|
|
||||||
state->decoder->Reset();
|
|
||||||
decode_result = state->decoder->MakeResult();
|
|
||||||
} else {
|
|
||||||
decode_result.result = AJM_RESULT_INVALID_PARAMETER;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
AjmWriteResult(result, AJM_SIDEBAND_RESULT_SIZE, decode_result);
|
AjmWriteResult(result, AJM_SIDEBAND_RESULT_SIZE, decode_result);
|
||||||
LOGF("\t instance = 0x%08" PRIx32 "\n", instance);
|
LOGF("\t instance = 0x%08" PRIx32 "\n", instance);
|
||||||
|
|||||||
Reference in New Issue
Block a user