Skip to content

Commit 2b18e13

Browse files
committed
[PR 12715] Separate VP and RP process info
1 parent 9b189cb commit 2b18e13

11 files changed

+219
-89
lines changed

cmake/treedata/common/retroplayer.txt

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
xbmc/cores/RetroPlayer cores/RetroPlayer
22
xbmc/cores/RetroPlayer/guicontrols cores/RetroPlayer/guicontrols
3+
xbmc/cores/RetroPlayer/process cores/RetroPlayer/process
34
xbmc/cores/RetroPlayer/rendering cores/RetroPlayer/rendering
45
xbmc/cores/RetroPlayer/rendering/VideoRenderers cores/RetroPlayer/rendering/VideoRenderers

xbmc/cores/RetroPlayer/CMakeLists.txt

-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ set(SOURCES RetroPlayer.cpp
77
set(HEADERS RetroPlayer.h
88
RetroPlayerAudio.h
99
RetroPlayerAutoSave.h
10-
RetroPlayerDefines.h
1110
RetroPlayerInput.h
1211
RetroPlayerVideo.h)
1312

xbmc/cores/RetroPlayer/RetroPlayer.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@
2626
#include "addons/AddonManager.h"
2727
#include "cores/DataCacheCore.h"
2828
#include "cores/RetroPlayer/guicontrols/GUIGameControlManager.h"
29+
#include "cores/RetroPlayer/process/RPProcessInfo.h"
2930
#include "cores/RetroPlayer/rendering/GUIRenderSettings.h"
3031
#include "cores/RetroPlayer/rendering/RPRenderManager.h"
31-
#include "cores/VideoPlayer/Process/ProcessInfo.h"
3232
#include "dialogs/GUIDialogYesNo.h"
3333
#include "filesystem/File.h"
3434
#include "games/addons/playback/IGameClientPlayback.h"
@@ -64,10 +64,10 @@ using namespace RETRO;
6464
CRetroPlayer::CRetroPlayer(IPlayerCallback& callback) :
6565
IPlayer(callback),
6666
m_renderManager(new CRPRenderManager),
67-
m_processInfo(CProcessInfo::CreateInstance())
67+
m_processInfo(CRPProcessInfo::CreateInstance())
6868
{
6969
m_processInfo->SetDataCache(&CServiceBroker::GetDataCacheCore());
70-
m_processInfo->SetTempo(1.0);
70+
m_processInfo->ResetInfo();
7171
}
7272

7373
CRetroPlayer::~CRetroPlayer()

xbmc/cores/RetroPlayer/RetroPlayer.h

+2-3
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@
2626

2727
#include <memory>
2828

29-
class CProcessInfo;
30-
3129
namespace KODI
3230
{
3331
namespace RETRO
@@ -36,6 +34,7 @@ namespace RETRO
3634
class CRetroPlayerAutoSave;
3735
class CRetroPlayerInput;
3836
class CRetroPlayerVideo;
37+
class CRPProcessInfo;
3938
class CRPRenderManager;
4039

4140
class CRetroPlayer : public IPlayer
@@ -164,7 +163,7 @@ namespace RETRO
164163
State m_state = State::STARTING;
165164
double m_priorSpeed = 0.0f; // Speed of gameplay before entering OSD
166165
std::unique_ptr<CRPRenderManager> m_renderManager;
167-
std::unique_ptr<CProcessInfo> m_processInfo;
166+
std::unique_ptr<CRPProcessInfo> m_processInfo;
168167
std::unique_ptr<CRetroPlayerAudio> m_audio;
169168
std::unique_ptr<CRetroPlayerVideo> m_video;
170169
std::unique_ptr<CRetroPlayerInput> m_input;

xbmc/cores/RetroPlayer/RetroPlayerAudio.cpp

+8-66
Original file line numberDiff line numberDiff line change
@@ -20,24 +20,18 @@
2020

2121
#include "ServiceBroker.h"
2222
#include "RetroPlayerAudio.h"
23-
#include "RetroPlayerDefines.h"
2423
#include "cores/AudioEngine/Interfaces/AE.h"
2524
#include "cores/AudioEngine/Interfaces/AEStream.h"
2625
#include "cores/AudioEngine/Utils/AEChannelInfo.h"
2726
#include "cores/AudioEngine/Utils/AEUtil.h"
28-
#include "cores/VideoPlayer/DVDCodecs/Audio/DVDAudioCodec.h"
29-
#include "cores/VideoPlayer/DVDCodecs/DVDFactoryCodec.h"
30-
#include "cores/VideoPlayer/DVDDemuxers/DVDDemux.h"
31-
#include "cores/VideoPlayer/DVDClock.h"
32-
#include "cores/VideoPlayer/DVDStreamInfo.h"
33-
#include "cores/VideoPlayer/Process/ProcessInfo.h"
27+
#include "cores/RetroPlayer/process/RPProcessInfo.h"
3428
#include "threads/Thread.h"
3529
#include "utils/log.h"
3630

3731
using namespace KODI;
3832
using namespace RETRO;
3933

40-
CRetroPlayerAudio::CRetroPlayerAudio(CProcessInfo& processInfo) :
34+
CRetroPlayerAudio::CRetroPlayerAudio(CRPProcessInfo& processInfo) :
4135
m_processInfo(processInfo),
4236
m_pAudioStream(nullptr),
4337
m_bAudioEnabled(true)
@@ -101,70 +95,23 @@ bool CRetroPlayerAudio::OpenPCMStream(AEDataFormat format, unsigned int samplera
10195
return false;
10296
}
10397

98+
m_processInfo.SetAudioChannels(audioFormat.m_channelLayout);
99+
m_processInfo.SetAudioSampleRate(audioFormat.m_sampleRate);
100+
m_processInfo.SetAudioBitsPerSample(CAEUtil::DataFormatToUsedBits(audioFormat.m_dataFormat));
101+
104102
return true;
105103
}
106104

107105
bool CRetroPlayerAudio::OpenEncodedStream(AVCodecID codec, unsigned int samplerate, const CAEChannelInfo& channelLayout)
108106
{
109-
CDemuxStreamAudio audioStream;
110-
111-
// Stream
112-
audioStream.uniqueId = GAME_STREAM_AUDIO_ID;
113-
audioStream.codec = codec;
114-
audioStream.type = STREAM_AUDIO;
115-
audioStream.source = STREAM_SOURCE_DEMUX;
116-
audioStream.realtime = true;
117-
118-
// Audio
119-
audioStream.iChannels = channelLayout.Count();
120-
audioStream.iSampleRate = samplerate;
121-
audioStream.iChannelLayout = CAEUtil::GetAVChannelLayout(channelLayout);
122-
123-
CDVDStreamInfo hint(audioStream);
124-
m_pAudioCodec.reset(CDVDFactoryCodec::CreateAudioCodec(hint, m_processInfo, false, false, CAEStreamInfo::STREAM_TYPE_NULL));
125-
126-
if (!m_pAudioCodec)
127-
{
128-
CLog::Log(LOGERROR, "RetroPlayerAudio: Failed to create audio codec (codec=%d, samplerate=%u)", codec, samplerate);
129-
return false;
130-
}
131-
132-
return true;
107+
return true; //! @todo
133108
}
134109

135110
void CRetroPlayerAudio::AddData(const uint8_t* data, unsigned int size)
136111
{
137112
if (m_bAudioEnabled)
138113
{
139-
if (m_pAudioCodec)
140-
{
141-
DemuxPacket packet(const_cast<uint8_t*>(data), size, DVD_NOPTS_VALUE, DVD_NOPTS_VALUE);
142-
int consumed = m_pAudioCodec->AddData(packet);
143-
if (consumed < 0)
144-
{
145-
CLog::Log(LOGERROR, "CRetroPlayerAudio::AddData - Decode Error (%d)", consumed);
146-
m_pAudioCodec.reset();
147-
return;
148-
}
149-
150-
DVDAudioFrame audioframe;
151-
m_pAudioCodec->GetData(audioframe);
152-
153-
if (audioframe.nb_frames != 0)
154-
{
155-
// Open audio stream if not already open
156-
if (!m_pAudioStream)
157-
{
158-
const AEAudioFormat& format = audioframe.format;
159-
if (!OpenPCMStream(format.m_dataFormat, format.m_sampleRate, format.m_channelLayout))
160-
m_pAudioCodec.reset();
161-
}
162-
163-
if (m_pAudioStream)
164-
m_pAudioStream->AddData(audioframe.data, 0, audioframe.nb_frames);
165-
}
166-
}
167-
else if (m_pAudioStream)
114+
if (m_pAudioStream)
168115
{
169116
const unsigned int frameSize = m_pAudioStream->GetChannelCount() * (CAEUtil::DataFormatToBits(m_pAudioStream->GetDataFormat()) >> 3);
170117
m_pAudioStream->AddData(&data, 0, size / frameSize);
@@ -174,11 +121,6 @@ void CRetroPlayerAudio::AddData(const uint8_t* data, unsigned int size)
174121

175122
void CRetroPlayerAudio::CloseStream()
176123
{
177-
if (m_pAudioCodec)
178-
{
179-
m_pAudioCodec->Dispose();
180-
m_pAudioCodec.reset();
181-
}
182124
if (m_pAudioStream)
183125
{
184126
CServiceBroker::GetActiveAE().FreeStream(m_pAudioStream);

xbmc/cores/RetroPlayer/RetroPlayerAudio.h

+4-5
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,18 @@
2323

2424
#include <memory>
2525

26-
class CDVDAudioCodec;
27-
class CProcessInfo;
2826
class IAEStream;
2927

3028
namespace KODI
3129
{
3230
namespace RETRO
3331
{
32+
class CRPProcessInfo;
33+
3434
class CRetroPlayerAudio : public GAME::IGameAudioCallback
3535
{
3636
public:
37-
explicit CRetroPlayerAudio(CProcessInfo& processInfo);
37+
explicit CRetroPlayerAudio(CRPProcessInfo& processInfo);
3838
~CRetroPlayerAudio() override;
3939

4040
// implementation of IGameAudioCallback
@@ -47,9 +47,8 @@ namespace RETRO
4747
void Enable(bool bEnabled) { m_bAudioEnabled = bEnabled; }
4848

4949
private:
50-
CProcessInfo& m_processInfo;
50+
CRPProcessInfo& m_processInfo;
5151
IAEStream* m_pAudioStream;
52-
std::unique_ptr<CDVDAudioCodec> m_pAudioCodec;
5352
bool m_bAudioEnabled;
5453
};
5554
}

xbmc/cores/RetroPlayer/RetroPlayerVideo.cpp

+4-8
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,14 @@
1919
*/
2020

2121
#include "RetroPlayerVideo.h"
22-
#include "RetroPlayerDefines.h"
22+
#include "cores/RetroPlayer/process/RPProcessInfo.h"
2323
#include "cores/RetroPlayer/rendering/RPRenderManager.h"
24-
#include "cores/VideoPlayer/Process/ProcessInfo.h" //! @todo
2524
#include "utils/log.h"
2625

27-
#include <atomic> //! @todo
28-
2926
using namespace KODI;
3027
using namespace RETRO;
3128

32-
CRetroPlayerVideo::CRetroPlayerVideo(CRPRenderManager& renderManager, CProcessInfo& processInfo) :
29+
CRetroPlayerVideo::CRetroPlayerVideo(CRPRenderManager& renderManager, CRPProcessInfo& processInfo) :
3330
m_renderManager(renderManager),
3431
m_processInfo(processInfo)
3532
{
@@ -46,16 +43,15 @@ bool CRetroPlayerVideo::OpenPixelStream(AVPixelFormat pixfmt, unsigned int width
4643
{
4744
CLog::Log(LOGINFO, "RetroPlayerVideo: Creating video stream with pixel format: %i, %dx%d", pixfmt, width, height);
4845

49-
//! @todo
50-
//m_processInfo.SetVideoPixelFormat(CDVDVideoCodecFFmpeg::GetPixelFormatName(pixfmt));
46+
m_processInfo.SetVideoPixelFormat(pixfmt);
5147
m_processInfo.SetVideoDimensions(width, height);
5248

5349
return m_renderManager.Configure(pixfmt, width, height, orientationDeg);
5450
}
5551

5652
bool CRetroPlayerVideo::OpenEncodedStream(AVCodecID codec)
5753
{
58-
return false;
54+
return false; //! @todo
5955
}
6056

6157
void CRetroPlayerVideo::AddData(const uint8_t* data, unsigned int size)

xbmc/cores/RetroPlayer/RetroPlayerVideo.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,18 @@
2222
#include "games/addons/GameClientCallbacks.h"
2323

2424
class CPixelConverter;
25-
class CProcessInfo;
2625

2726
namespace KODI
2827
{
2928
namespace RETRO
3029
{
30+
class CRPProcessInfo;
3131
class CRPRenderManager;
3232

3333
class CRetroPlayerVideo : public GAME::IGameVideoCallback
3434
{
3535
public:
36-
CRetroPlayerVideo(CRPRenderManager& m_renderManager, CProcessInfo& m_processInfo);
36+
CRetroPlayerVideo(CRPRenderManager& m_renderManager, CRPProcessInfo& m_processInfo);
3737

3838
~CRetroPlayerVideo() override;
3939

@@ -46,7 +46,7 @@ namespace RETRO
4646
private:
4747
// Construction parameters
4848
CRPRenderManager& m_renderManager;
49-
CProcessInfo& m_processInfo;
49+
CRPProcessInfo& m_processInfo;
5050
};
5151
}
5252
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
set(SOURCES RPProcessInfo.cpp
2+
)
3+
4+
set(HEADERS RPProcessInfo.h
5+
)
6+
7+
core_add_library(rp-process)

0 commit comments

Comments
 (0)