mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-01 14:58:14 +00:00
Tell media engine to change channel when psmf specifi stream.
This commit is contained in:
1 parent
82395001ec
commit
3773122316
3 files changed
+46
-2
No files matched your search
@@ -203,6 +203,7 @@ static bool isCurrentMpegAnalyzed;
|
||||
static int actionPostPut;
|
||||
static std::map<u32, MpegContext *> mpegMap;
|
||||
static u32 lastMpegHandle = 0;
|
||||
static u32 RegisteredMpeg = -1;
|
||||
|
||||
MpegContext *getMpegCtx(u32 mpegAddr) {
|
||||
u32 mpeg = Memory::Read_U32(mpegAddr);
|
||||
@@ -326,6 +327,7 @@ void __MpegInit() {
|
||||
isCurrentMpegAnalyzed = false;
|
||||
isMpegInit = false;
|
||||
actionPostPut = __KernelRegisterActionType(PostPutAction::Create);
|
||||
RegisteredMpeg = -1;
|
||||
|
||||
#ifdef USING_FFMPEG
|
||||
avcodec_register_all();
|
||||
@@ -343,6 +345,7 @@ void __MpegDoState(PointerWrap &p) {
|
||||
p.Do(isCurrentMpegAnalyzed);
|
||||
p.Do(isMpegInit);
|
||||
p.Do(actionPostPut);
|
||||
p.Do(RegisteredMpeg);
|
||||
__KernelRestoreActionType(actionPostPut, PostPutAction::Create);
|
||||
|
||||
p.Do(mpegMap);
|
||||
@@ -572,6 +575,39 @@ u32 sceMpegQueryStreamSize(u32 bufferAddr, u32 sizeAddr)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void setRegisteredMpeg(u32 mpeg) {
|
||||
RegisteredMpeg = mpeg;
|
||||
}
|
||||
|
||||
u32 getRegisteredMpeg() {
|
||||
return RegisteredMpeg;
|
||||
}
|
||||
|
||||
void __MpegChangeVideoChannel(int channel) {
|
||||
u32 mpeg = getRegisteredMpeg();
|
||||
if (mpeg == (u32)-1)
|
||||
return;
|
||||
MpegContext *ctx = getMpegCtx(mpeg);
|
||||
if (!ctx)
|
||||
return;
|
||||
if (ctx->mediaengine->setVideoStream(channel)) {
|
||||
INFO_LOG(ME,"Change video channel to %d", channel);
|
||||
} else {
|
||||
WARN_LOG(ME,"Fail to change video channel to %d", channel);
|
||||
}
|
||||
}
|
||||
|
||||
void __MpegChangeAudioChannel(int channel) {
|
||||
u32 mpeg = getRegisteredMpeg();
|
||||
if (mpeg == (u32)-1)
|
||||
return;
|
||||
MpegContext *ctx = getMpegCtx(mpeg);
|
||||
if (!ctx)
|
||||
return;
|
||||
ctx->mediaengine->setAudioStream(channel);
|
||||
INFO_LOG(ME,"Change audio channel to %d", channel);
|
||||
}
|
||||
|
||||
int sceMpegRegistStream(u32 mpeg, u32 streamType, u32 streamNum)
|
||||
{
|
||||
MpegContext *ctx = getMpegCtx(mpeg);
|
||||
@@ -582,6 +618,8 @@ int sceMpegRegistStream(u32 mpeg, u32 streamType, u32 streamNum)
|
||||
|
||||
INFO_LOG(ME, "sceMpegRegistStream(%08x, %i, %i)", mpeg, streamType, streamNum);
|
||||
|
||||
setRegisteredMpeg(mpeg);
|
||||
|
||||
switch (streamType) {
|
||||
case MPEG_AVC_STREAM:
|
||||
ctx->avcRegistered = true;
|
||||
@@ -772,6 +810,7 @@ u32 sceMpegUnRegistStream(u32 mpeg, int streamUid)
|
||||
info.sid = -1 ;
|
||||
info.needsReset = true;
|
||||
ctx->isAnalyzed = false;
|
||||
setRegisteredMpeg(-1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -97,4 +97,7 @@ void __MpegInit();
|
||||
void __MpegDoState(PointerWrap &p);
|
||||
void __MpegShutdown();
|
||||
|
||||
void __MpegChangeVideoChannel(int channel);
|
||||
void __MpegChangeAudioChannel(int channel);
|
||||
|
||||
void Register_sceMpeg();
|
||||
@@ -385,7 +385,8 @@ void Psmf::setStreamNum(int num) {
|
||||
switch (type) {
|
||||
case PSMF_AVC_STREAM:
|
||||
if (currentVideoStreamNum != num) {
|
||||
// TODO: Tell video mediaengine or something about channel.
|
||||
// Tell video mediaengine about channel.
|
||||
__MpegChangeVideoChannel(channel);
|
||||
currentVideoStreamNum = num;
|
||||
}
|
||||
break;
|
||||
@@ -393,7 +394,8 @@ void Psmf::setStreamNum(int num) {
|
||||
case PSMF_ATRAC_STREAM:
|
||||
case PSMF_PCM_STREAM:
|
||||
if (currentAudioStreamNum != num) {
|
||||
// TODO: Tell audio mediaengine or something about channel.
|
||||
// Tell audio mediaengine about channel.
|
||||
__MpegChangeAudioChannel(channel);
|
||||
currentAudioStreamNum = num;
|
||||
}
|
||||
break;
|
||||
|
||||
Reference in new issue
Block a user