MoviePlayLib/TaskMovie: Adapted new findings
This commit is contained in:
@@ -152,6 +152,7 @@
|
||||
<ClCompile Include="graphics\color_change_dw.cpp" />
|
||||
<ClCompile Include="mdl\disp_manager.cpp" />
|
||||
<ClCompile Include="mdl\draw_object.cpp" />
|
||||
<ClCompile Include="movie_play_lib\movie_play_lib.cpp" />
|
||||
<ClCompile Include="pv_game\dsc.cpp" />
|
||||
<ClCompile Include="pv_game\firstread.cpp" />
|
||||
<ClCompile Include="pv_game\pvpp.cpp" />
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
/*
|
||||
by korenkonder
|
||||
GitHub/GitLab: korenkonder
|
||||
*/
|
||||
|
||||
#include "movie_play_lib.hpp"
|
||||
|
||||
namespace MoviePlayLib {
|
||||
void(FASTCALL* trace)(const wchar_t* fmt, ...)
|
||||
= (void(FASTCALL*)(const wchar_t* fmt, ...))0x00000001404241F0;
|
||||
}
|
||||
@@ -17,22 +17,22 @@
|
||||
|
||||
struct texture;
|
||||
|
||||
#define MOVIE_PLAY_LIB_PRINT_FUNC_BEGIN MoviePlayLib::PrintDebug(L">%S(%p)\n", __FUNCTION__, this)
|
||||
#define MOVIE_PLAY_LIB_PRINT_FUNC_END MoviePlayLib::PrintDebug(L"<%S(%p)\n", __FUNCTION__, this)
|
||||
#define MOVIE_PLAY_LIB_TRACE_BEGIN MoviePlayLib::trace(L">%S(%p)\n", __FUNCTION__, this)
|
||||
#define MOVIE_PLAY_LIB_TRACE_END MoviePlayLib::trace(L"<%S(%p)\n", __FUNCTION__, this)
|
||||
|
||||
namespace MoviePlayLib {
|
||||
enum class State {
|
||||
None = 0x0,
|
||||
Init,
|
||||
Open,
|
||||
Wait,
|
||||
Pause,
|
||||
Play,
|
||||
Stop,
|
||||
Max,
|
||||
enum Status {
|
||||
Status_NotInitialized = 0,
|
||||
Status_Initializing,
|
||||
Status_Initialized,
|
||||
Status_Starting,
|
||||
Status_Started,
|
||||
Status_Stopping,
|
||||
Status_Stopped,
|
||||
Status_Shutdown,
|
||||
};
|
||||
|
||||
struct AudioParams {
|
||||
struct AudioVolumes {
|
||||
float_t spk_l_volume;
|
||||
float_t spk_r_volume;
|
||||
float_t field_8;
|
||||
@@ -41,44 +41,44 @@ namespace MoviePlayLib {
|
||||
float_t hph_r_volume;
|
||||
};
|
||||
|
||||
struct MediaStats {
|
||||
struct PlayerStat {
|
||||
double_t duration;
|
||||
bool audio_present;
|
||||
bool video_present;
|
||||
uint32_t width;
|
||||
uint32_t height;
|
||||
uint32_t frame_size_width;
|
||||
uint32_t frame_size_height;
|
||||
float_t frame_rate;
|
||||
float_t pixel_aspect_ratio;
|
||||
uint32_t sample_rate;
|
||||
bool enable_audio;
|
||||
bool enable_video;
|
||||
uint32_t present_width;
|
||||
uint32_t present_height;
|
||||
uint32_t raw_width;
|
||||
uint32_t raw_height;
|
||||
float_t framerate;
|
||||
float_t pixelaspect;
|
||||
uint32_t sample_freq;
|
||||
uint32_t channels;
|
||||
HRESULT curr_error;
|
||||
IUnknown* curr_object;
|
||||
uint32_t audio_mf_samples_wait_count;
|
||||
uint32_t video_mf_samples_wait_count;
|
||||
uint32_t audio_mf_samples_count;
|
||||
uint32_t video_mf_samples_count;
|
||||
double_t audio_sample_time;
|
||||
double_t video_sample_time;
|
||||
double_t audio_process_sample_time;
|
||||
double_t video_process_sample_time;
|
||||
double_t audio_process_output_time;
|
||||
double_t video_process_output_time;
|
||||
double_t video_process_blt_time;
|
||||
double_t audio_time_advance;
|
||||
double_t video_time_advance;
|
||||
double_t audio_output_time;
|
||||
double_t video_output_time;
|
||||
HRESULT error;
|
||||
void* error_object;
|
||||
uint32_t source_audio_queue_count;
|
||||
uint32_t source_video_queue_count;
|
||||
uint32_t decode_audio_queue_count;
|
||||
uint32_t decode_video_queue_count;
|
||||
double_t source_audio_sample_time;
|
||||
double_t source_video_sample_time;
|
||||
double_t decode_audio_sample_time;
|
||||
double_t decode_video_sample_time;
|
||||
double_t decode_audio_elapse;
|
||||
double_t decode_video_elapse;
|
||||
double_t decode_video_conv_elapse;
|
||||
double_t schedule_audio_drift;
|
||||
double_t schedule_video_drift;
|
||||
double_t audio_send_elapse;
|
||||
double_t video_lock_elapse;
|
||||
};
|
||||
|
||||
struct VideoParams {
|
||||
int32_t width;
|
||||
int32_t height;
|
||||
int32_t frame_size_width;
|
||||
int32_t frame_size_height;
|
||||
float_t frame_rate;
|
||||
float_t pixel_aspect_ratio;
|
||||
struct VideoInfo {
|
||||
int32_t present_width;
|
||||
int32_t present_height;
|
||||
int32_t raw_width;
|
||||
int32_t raw_height;
|
||||
float_t framerate;
|
||||
float_t pixelaspect;
|
||||
};
|
||||
|
||||
class DECLSPEC_UUID("BE82EF2E-4B9F-4470-9C6F-F78E002FCDEF")
|
||||
@@ -88,28 +88,28 @@ namespace MoviePlayLib {
|
||||
virtual HRESULT Close() = 0;
|
||||
virtual HRESULT Flush() = 0;
|
||||
virtual HRESULT Open() = 0;
|
||||
virtual HRESULT SetMFSample(IMFSample* mf_sample) = 0;
|
||||
virtual HRESULT ProcessSample(IMFSample * pSample) = 0;
|
||||
};
|
||||
|
||||
class DECLSPEC_UUID("4A5C73B9-FBFE-4A00-A298-FD3FAB0C5AF1")
|
||||
IAudioRenderer : public IMediaRenderer {
|
||||
public:
|
||||
virtual HRESULT GetParams(AudioParams* value) = 0;
|
||||
virtual HRESULT SetParams(const AudioParams* value) = 0;
|
||||
virtual HRESULT GetVolumes(AudioVolumes * out_volumes) = 0;
|
||||
virtual HRESULT SetVolumes(const AudioVolumes * in_volumes) = 0;
|
||||
};
|
||||
|
||||
class DECLSPEC_UUID("D19AC022-EA49-4B6F-9D51-673C1C15ECE8")
|
||||
IGLDXInteropTexture : public IUnknown {
|
||||
public:
|
||||
virtual texture* GetTexture() = 0;
|
||||
virtual texture* GetGLTexture() = 0;
|
||||
};
|
||||
|
||||
class DECLSPEC_UUID("D4FA34F6-D03C-4F21-8591-6858161CA5D7")
|
||||
IMediaClock : public IUnknown {
|
||||
public:
|
||||
virtual HRESULT TimeEnd() = 0;
|
||||
virtual HRESULT TimeBegin() = 0;
|
||||
virtual HRESULT SetTime(INT64 value) = 0;
|
||||
virtual HRESULT Stop() = 0;
|
||||
virtual HRESULT Start() = 0;
|
||||
virtual HRESULT SetTime(INT64 hnsTime) = 0;
|
||||
virtual INT64 GetTime() = 0;
|
||||
};
|
||||
|
||||
@@ -120,14 +120,14 @@ namespace MoviePlayLib {
|
||||
virtual HRESULT Close() = 0;
|
||||
virtual HRESULT Flush() = 0;
|
||||
virtual HRESULT Open() = 0;
|
||||
virtual HRESULT GetMFMediaType(IMFMediaType** mf_media_type) = 0;
|
||||
virtual void SendMFSample(IMFSample* mf_sample) = 0;
|
||||
virtual BOOL SignalEvent() = 0;
|
||||
virtual BOOL CanShutdown() = 0;
|
||||
virtual UINT32 GetMFSamplesWaitCount() = 0;
|
||||
virtual UINT32 GetMFSamplesCount() = 0;
|
||||
virtual INT64 GetSampleTime() = 0;
|
||||
virtual void GetMFSample(IMFSample*& mf_sample) = 0;
|
||||
virtual HRESULT GetMediaType(IMFMediaType * *pType) = 0;
|
||||
virtual void PushSample(IMFSample * pSample) = 0;
|
||||
virtual BOOL RequestSample() = 0;
|
||||
virtual BOOL IsEndOfStream() = 0;
|
||||
virtual UINT32 GetInputQueueCount() = 0;
|
||||
virtual UINT32 GetOutputQueueCount() = 0;
|
||||
virtual INT64 PeekSampleTime() = 0;
|
||||
virtual void GetSample(IMFSample * &ppOutSample) = 0;
|
||||
};
|
||||
|
||||
class DECLSPEC_UUID("0D41578B-4514-407D-B654-870BCCDC630A")
|
||||
@@ -135,32 +135,34 @@ namespace MoviePlayLib {
|
||||
public:
|
||||
virtual HRESULT Shutdown() = 0;
|
||||
virtual HRESULT Stop() = 0;
|
||||
virtual HRESULT Start(INT64 time) = 0;
|
||||
virtual HRESULT Start(INT64 hnsTime) = 0;
|
||||
virtual UINT64 GetDuration() = 0;
|
||||
virtual HRESULT GetAudioMFMediaType(IMFMediaType** ptr) = 0;
|
||||
virtual HRESULT GetVideoMFMediaType(IMFMediaType** ptr) = 0;
|
||||
virtual HRESULT SetAudioMediaTransform(IMediaTransform* media_transform) = 0;
|
||||
virtual HRESULT SetVideoMediaTransform(IMediaTransform* media_transform) = 0;
|
||||
virtual HRESULT GetAudioMediaType(IMFMediaType * *ppType) = 0;
|
||||
virtual HRESULT GetVideoMediaType(IMFMediaType * *ppType) = 0;
|
||||
virtual HRESULT SetAudioDecoder(IMediaTransform * pDecoder) = 0;
|
||||
virtual HRESULT SetVideoDecoder(IMediaTransform * pDecoder) = 0;
|
||||
};
|
||||
|
||||
class DECLSPEC_UUID("12AC5FCE-C816-47FE-84B4-4915D6B42FA7")
|
||||
IPlayer : public IUnknown {
|
||||
public:
|
||||
virtual HRESULT Open(const wchar_t* path) = 0;
|
||||
virtual HRESULT Open(const char* path) = 0;
|
||||
virtual HRESULT Open(const wchar_t* filePath) = 0;
|
||||
virtual HRESULT Open(const char* filePath) = 0;
|
||||
virtual HRESULT Close() = 0;
|
||||
virtual HRESULT SetMediaClock(IMediaClock* media_clock) = 0;
|
||||
virtual State GetState() = 0;
|
||||
virtual HRESULT SetTimeSource(IMediaClock * pClock) = 0;
|
||||
virtual Status GetStatus() = 0;
|
||||
virtual HRESULT Play() = 0;
|
||||
virtual HRESULT Pause() = 0;
|
||||
virtual double_t GetDuration() = 0;
|
||||
virtual double_t GetTime() = 0;
|
||||
virtual HRESULT SetTime(double_t value) = 0;
|
||||
virtual HRESULT GetAudioParams(AudioParams* value) = 0;
|
||||
virtual HRESULT SetAudioParams(const AudioParams* value) = 0;
|
||||
virtual HRESULT GetVideoParams(VideoParams* value) = 0;
|
||||
virtual HRESULT GetD3D9Texture(IDirect3DDevice9* d3d_device, IDirect3DTexture9** ptr) = 0;
|
||||
virtual HRESULT GetD3D11Texture(ID3D11Device* d3d_device, ID3D11Texture2D** ptr) = 0;
|
||||
virtual HRESULT GetGLDXIntreropTexture(IGLDXInteropTexture** value) = 0;
|
||||
virtual double_t GetCurrentPosition() = 0;
|
||||
virtual HRESULT SetCurrentPosition(double_t pos) = 0;
|
||||
virtual HRESULT GetVolumes(AudioVolumes * out_volumes) = 0;
|
||||
virtual HRESULT SetVolumes(const AudioVolumes * in_volumes) = 0;
|
||||
virtual HRESULT GetVideoInfo(VideoInfo * out_info) = 0;
|
||||
virtual HRESULT GetTextureD3D9Ex(IDirect3DDevice9 * pDevice, IDirect3DTexture9 * *ppOutTexture) = 0;
|
||||
virtual HRESULT GetTextureD3D11(ID3D11Device * pDevice, ID3D11Texture2D * *ppOutTexture) = 0;
|
||||
virtual HRESULT GetTextureOGL(IGLDXInteropTexture * *ppOutTexture) = 0;
|
||||
};
|
||||
|
||||
extern void(FASTCALL* trace)(const wchar_t* fmt, ...);
|
||||
}
|
||||
|
||||
+124
-116
@@ -16,29 +16,28 @@
|
||||
|
||||
class TaskMovie : public app::Task {
|
||||
public:
|
||||
enum class State {
|
||||
Wait = 0,
|
||||
Init,
|
||||
Disp,
|
||||
Stop,
|
||||
Max,
|
||||
enum State {
|
||||
State_Wait = 0,
|
||||
State_Init,
|
||||
State_Disp,
|
||||
State_Stop,
|
||||
State_Shutdown,
|
||||
};
|
||||
|
||||
enum class DispType {
|
||||
None = 0,
|
||||
SpriteTextute,
|
||||
Textute,
|
||||
Max,
|
||||
enum DispType {
|
||||
DispType_None = 0,
|
||||
DispType_SpriteTextute,
|
||||
DispType_Textute,
|
||||
};
|
||||
|
||||
struct PlayerVideoParams {
|
||||
int64_t width;
|
||||
int64_t height;
|
||||
int64_t frame_size_width;
|
||||
int64_t frame_size_height;
|
||||
struct PlayerVideoInfo {
|
||||
int64_t present_width;
|
||||
int64_t present_height;
|
||||
int64_t raw_width;
|
||||
int64_t raw_height;
|
||||
};
|
||||
|
||||
static_assert(sizeof(TaskMovie::PlayerVideoParams) == 0x20, "\"TaskMovie::PlayerVideoParams\" struct should have a size of 0x20");
|
||||
static_assert(sizeof(TaskMovie::PlayerVideoInfo) == 0x20, "\"TaskMovie::PlayerVideoInfo\" struct should have a size of 0x20");
|
||||
|
||||
struct DispParams {
|
||||
rectangle rect;
|
||||
@@ -58,21 +57,24 @@ public:
|
||||
static_assert(sizeof(TaskMovie::SprParams) == 0x24, "\"TaskMovie::SprParams\" struct should have a size of 0x24");
|
||||
|
||||
struct Player {
|
||||
bool pause;
|
||||
bool pause_flag;
|
||||
float_t volume;
|
||||
bool set_audio_params;
|
||||
bool volume_req;
|
||||
State state;
|
||||
MoviePlayLib::IPlayer* player;
|
||||
MoviePlayLib::IMediaClock* external_clock;
|
||||
MoviePlayLib::State player_state;
|
||||
MoviePlayLib::VideoParams video_params;
|
||||
MoviePlayLib::IGLDXInteropTexture* interop_texture;
|
||||
MoviePlayLib::Status player_state;
|
||||
MoviePlayLib::VideoInfo video_info;
|
||||
MoviePlayLib::IGLDXInteropTexture* gl_texture;
|
||||
double_t duration;
|
||||
double_t time;
|
||||
|
||||
void Ctrl();
|
||||
void GetInteropTexture(texture*& ptr);
|
||||
void UpdateInteropTexture(TaskMovie::PlayerVideoParams* player_video_params);
|
||||
void GetGLTexture(texture*& ptr);
|
||||
void UpdateGLTexture(TaskMovie::PlayerVideoInfo* player_video_info);
|
||||
|
||||
protected:
|
||||
bool set_volume_internal(float_t vol);
|
||||
};
|
||||
|
||||
static_assert(sizeof(TaskMovie::Player) == 0x58, "\"TaskMovie::Player\" struct should have a size of 0x58");
|
||||
@@ -82,7 +84,7 @@ public:
|
||||
SprParams spr_params;
|
||||
State state;
|
||||
Player* player;
|
||||
PlayerVideoParams* player_video_params;
|
||||
PlayerVideoInfo* player_video_info;
|
||||
texture* tex;
|
||||
bool pause;
|
||||
bool wait_play;
|
||||
@@ -104,11 +106,11 @@ struct TaskMoviePlayerNoInterop {
|
||||
|
||||
void Create();
|
||||
void Ctrl(TaskMovie* task_movie, TaskMovie::Player* player,
|
||||
TaskMovie::PlayerVideoParams* player_video_params);
|
||||
TaskMovie::PlayerVideoInfo* player_video_info);
|
||||
void GetD3D11Texture(TaskMovie::Player* player, texture*& ptr);
|
||||
void Release();
|
||||
void ReleaseTexture();
|
||||
void UpdateD3D11Texture(TaskMovie::Player* player, TaskMovie::PlayerVideoParams* player_video_params);
|
||||
void UpdateD3D11Texture(TaskMovie::Player* player, TaskMovie::PlayerVideoInfo* player_video_info);
|
||||
|
||||
static TaskMoviePlayerNoInterop* Get(TaskMovie::Player* player);
|
||||
};
|
||||
@@ -119,7 +121,7 @@ static texture* (FASTCALL* sub_14041E560)()
|
||||
= (texture * (FASTCALL*)())0x000000014041E560;
|
||||
|
||||
HOOK(bool, FASTCALL, TaskMovie__ctrl, 0x000000014041E570, TaskMovie* This) {
|
||||
This->state = TaskMovie::State::Wait;
|
||||
This->state = TaskMovie::State_Wait;
|
||||
if (This->player) {
|
||||
This->player->Ctrl();
|
||||
This->state = This->player->state;
|
||||
@@ -128,26 +130,26 @@ HOOK(bool, FASTCALL, TaskMovie__ctrl, 0x000000014041E570, TaskMovie* This) {
|
||||
if (This->CheckState()) {
|
||||
TaskMoviePlayerNoInterop* no_interop = TaskMoviePlayerNoInterop::Get(This->player);
|
||||
if (no_interop) {
|
||||
no_interop->Ctrl(This, This->player, This->player_video_params);
|
||||
no_interop->Ctrl(This, This->player, This->player_video_info);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (This->player->interop_texture) {
|
||||
This->player->interop_texture->Release();
|
||||
This->player->interop_texture = 0;
|
||||
if (This->player->gl_texture) {
|
||||
This->player->gl_texture->Release();
|
||||
This->player->gl_texture = 0;
|
||||
}
|
||||
|
||||
This->player->UpdateInteropTexture(This->player_video_params);
|
||||
if (This->player_video_params->frame_size_width && This->player_video_params->frame_size_height) {
|
||||
This->player->UpdateGLTexture(This->player_video_info);
|
||||
if (This->player_video_info->raw_width && This->player_video_info->raw_height) {
|
||||
if (!This->tex)
|
||||
This->tex = (texture*)sub_14041E560();
|
||||
if (This->disp_type != TaskMovie::DispType::None)
|
||||
This->player->GetInteropTexture(This->tex);
|
||||
if (This->disp_type != TaskMovie::DispType_None)
|
||||
This->player->GetGLTexture(This->tex);
|
||||
}
|
||||
|
||||
if (This->player && !This->player->interop_texture
|
||||
&& !no_interop && This->disp_type != TaskMovie::DispType::None) {
|
||||
HRESULT hr = This->player->player->GetGLDXIntreropTexture(&This->player->interop_texture);
|
||||
if (This->player && !This->player->gl_texture
|
||||
&& !no_interop && This->disp_type != TaskMovie::DispType_None) {
|
||||
HRESULT hr = This->player->player->GetTextureOGL(&This->player->gl_texture);
|
||||
if (hr < S_FALSE)
|
||||
task_movie_player_no_interop.insert({ This->player, {} }).first->second.Create();
|
||||
}
|
||||
@@ -176,9 +178,9 @@ HOOK(bool, FASTCALL, TaskMovie__Shutdown, 0x000000014041F500, TaskMovie* This) {
|
||||
if (no_interop)
|
||||
no_interop->ReleaseTexture();
|
||||
|
||||
if (player->interop_texture) {
|
||||
player->interop_texture->Release();
|
||||
player->interop_texture = 0;
|
||||
if (player->gl_texture) {
|
||||
player->gl_texture->Release();
|
||||
player->gl_texture = 0;
|
||||
}
|
||||
|
||||
This->tex = 0;
|
||||
@@ -186,9 +188,9 @@ HOOK(bool, FASTCALL, TaskMovie__Shutdown, 0x000000014041F500, TaskMovie* This) {
|
||||
if (no_interop)
|
||||
no_interop->ReleaseTexture();
|
||||
|
||||
if (player->interop_texture) {
|
||||
player->interop_texture->Release();
|
||||
player->interop_texture = 0;
|
||||
if (player->gl_texture) {
|
||||
player->gl_texture->Release();
|
||||
player->gl_texture = 0;
|
||||
}
|
||||
|
||||
if (player->player) {
|
||||
@@ -231,14 +233,14 @@ void TaskMoviePlayerNoInterop::Create() {
|
||||
}
|
||||
|
||||
void TaskMoviePlayerNoInterop::Ctrl(TaskMovie* task_movie,
|
||||
TaskMovie::Player* player, TaskMovie::PlayerVideoParams* player_video_params) {
|
||||
UpdateD3D11Texture(player, player_video_params);
|
||||
TaskMovie::Player* player, TaskMovie::PlayerVideoInfo* player_video_info) {
|
||||
UpdateD3D11Texture(player, player_video_info);
|
||||
|
||||
if (player_video_params->frame_size_width && player_video_params->frame_size_height) {
|
||||
if (player_video_info->raw_width && player_video_info->raw_height) {
|
||||
if (!task_movie->tex)
|
||||
task_movie->tex = sub_14041E560();
|
||||
|
||||
if (task_movie->disp_type != TaskMovie::DispType::None)
|
||||
if (task_movie->disp_type != TaskMovie::DispType_None)
|
||||
GetD3D11Texture(player, task_movie->tex);
|
||||
}
|
||||
}
|
||||
@@ -283,8 +285,8 @@ void TaskMoviePlayerNoInterop::GetD3D11Texture(TaskMovie::Player* player, textur
|
||||
}
|
||||
|
||||
ptr = tex;
|
||||
ptr->width = player->video_params.frame_size_width;
|
||||
ptr->height = player->video_params.frame_size_height;
|
||||
ptr->width = player->video_info.raw_width;
|
||||
ptr->height = player->video_info.raw_height;
|
||||
}
|
||||
|
||||
void TaskMoviePlayerNoInterop::Release() {
|
||||
@@ -328,10 +330,10 @@ void TaskMoviePlayerNoInterop::ReleaseTexture() {
|
||||
}
|
||||
|
||||
void TaskMoviePlayerNoInterop::UpdateD3D11Texture(TaskMovie::Player* player,
|
||||
TaskMovie::PlayerVideoParams* player_video_params) {
|
||||
TaskMovie::PlayerVideoInfo* player_video_info) {
|
||||
ID3D11Texture2D* d3d_texture = 0;
|
||||
if (player->player)
|
||||
player->player->GetD3D11Texture(d3d11_device, &d3d_texture);
|
||||
player->player->GetTextureD3D11(d3d11_device, &d3d_texture);
|
||||
|
||||
if (!d3d_texture)
|
||||
return;
|
||||
@@ -390,20 +392,20 @@ void TaskMoviePlayerNoInterop::UpdateD3D11Texture(TaskMovie::Player* player,
|
||||
d3d_texture = 0;
|
||||
}
|
||||
|
||||
if (!player_video_params)
|
||||
if (!player_video_info)
|
||||
return;
|
||||
|
||||
if (player->state == TaskMovie::State::Disp) {
|
||||
player_video_params->width = player->video_params.width;
|
||||
player_video_params->height = player->video_params.height;
|
||||
player_video_params->frame_size_width = player->video_params.frame_size_width;
|
||||
player_video_params->frame_size_height = player->video_params.frame_size_height;
|
||||
if (player->state == TaskMovie::State_Disp) {
|
||||
player_video_info->present_width = player->video_info.present_width;
|
||||
player_video_info->present_height = player->video_info.present_height;
|
||||
player_video_info->raw_width = player->video_info.raw_width;
|
||||
player_video_info->raw_height = player->video_info.raw_height;
|
||||
}
|
||||
else {
|
||||
player_video_params->width = 0;
|
||||
player_video_params->height = 0;
|
||||
player_video_params->frame_size_width = 0;
|
||||
player_video_params->frame_size_height = 0;
|
||||
player_video_info->present_width = 0;
|
||||
player_video_info->present_height = 0;
|
||||
player_video_info->raw_width = 0;
|
||||
player_video_info->raw_height = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -415,111 +417,117 @@ inline TaskMoviePlayerNoInterop* TaskMoviePlayerNoInterop::Get(TaskMovie::Player
|
||||
}
|
||||
|
||||
void TaskMovie::Player::Ctrl() {
|
||||
player_state = MoviePlayLib::State::Wait;
|
||||
player_state = MoviePlayLib::Status_Starting;
|
||||
time = 0.0f;
|
||||
|
||||
if (player && !*(uint32_t*)0x00000001411A1840) {
|
||||
player_state = player->GetState();
|
||||
time = player->GetTime();
|
||||
player_state = player->GetStatus();
|
||||
time = player->GetCurrentPosition();
|
||||
}
|
||||
|
||||
switch (player_state) {
|
||||
case MoviePlayLib::State::None:
|
||||
case MoviePlayLib::State::Init:
|
||||
state = TaskMovie::State::Init;
|
||||
case MoviePlayLib::Status_NotInitialized:
|
||||
case MoviePlayLib::Status_Initializing:
|
||||
state = TaskMovie::State_Init;
|
||||
break;
|
||||
case MoviePlayLib::State::Open:
|
||||
player->GetVideoParams(&video_params);
|
||||
case MoviePlayLib::Status_Initialized:
|
||||
player->GetVideoInfo(&video_info);
|
||||
|
||||
duration = player->GetDuration();
|
||||
player->Play();
|
||||
|
||||
state = TaskMovie::State::Init;
|
||||
state = TaskMovie::State_Init;
|
||||
break;
|
||||
case MoviePlayLib::State::Wait:
|
||||
state = TaskMovie::State::Wait;
|
||||
case MoviePlayLib::Status_Starting:
|
||||
state = TaskMovie::State_Wait;
|
||||
break;
|
||||
case MoviePlayLib::State::Pause:
|
||||
if (!pause)
|
||||
case MoviePlayLib::Status_Started:
|
||||
if (!pause_flag)
|
||||
player->Play();
|
||||
|
||||
state = TaskMovie::State::Disp;
|
||||
state = TaskMovie::State_Disp;
|
||||
break;
|
||||
case MoviePlayLib::State::Play:
|
||||
case MoviePlayLib::Status_Stopping:
|
||||
{
|
||||
TaskMoviePlayerNoInterop* no_interop = TaskMoviePlayerNoInterop::Get(this);
|
||||
if (no_interop) {
|
||||
if (no_interop->d3d11_texture && no_interop->d3d11_tex && pause)
|
||||
if (no_interop->d3d11_texture && no_interop->d3d11_tex && pause_flag)
|
||||
player->Pause();
|
||||
|
||||
state = TaskMovie::State::Disp;
|
||||
state = TaskMovie::State_Disp;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (interop_texture && interop_texture->GetTexture() && pause)
|
||||
if (gl_texture && gl_texture->GetGLTexture() && pause_flag)
|
||||
player->Pause();
|
||||
|
||||
state = TaskMovie::State::Disp;
|
||||
state = TaskMovie::State_Disp;
|
||||
break;
|
||||
case MoviePlayLib::State::Stop:
|
||||
case MoviePlayLib::Status_Stopped:
|
||||
if (time <= 0.0f || time >= duration)
|
||||
state = TaskMovie::State::Stop;
|
||||
state = TaskMovie::State_Stop;
|
||||
break;
|
||||
}
|
||||
|
||||
if (state == TaskMovie::State::Disp && player && set_audio_params) {
|
||||
MoviePlayLib::AudioParams audio_params;
|
||||
audio_params.spk_l_volume = volume;
|
||||
audio_params.spk_r_volume = volume;
|
||||
audio_params.field_8 = 0.0f;
|
||||
audio_params.field_C = 0.0f;
|
||||
audio_params.hph_l_volume = volume;
|
||||
audio_params.hph_r_volume = volume;
|
||||
if (player->SetAudioParams(&audio_params) >= 0)
|
||||
set_audio_params = false;
|
||||
}
|
||||
if (state == TaskMovie::State_Disp && player && volume_req)
|
||||
set_volume_internal(volume);
|
||||
}
|
||||
|
||||
void TaskMovie::Player::GetInteropTexture(texture*& ptr) {
|
||||
if (!interop_texture)
|
||||
void TaskMovie::Player::GetGLTexture(texture*& ptr) {
|
||||
if (!gl_texture)
|
||||
return;
|
||||
|
||||
texture* tex = interop_texture->GetTexture();
|
||||
texture* tex = gl_texture->GetGLTexture();
|
||||
if (!tex)
|
||||
return;
|
||||
|
||||
ptr = tex;
|
||||
ptr->width = video_params.frame_size_width;
|
||||
ptr->height = video_params.frame_size_height;
|
||||
ptr->width = video_info.raw_width;
|
||||
ptr->height = video_info.raw_height;
|
||||
}
|
||||
|
||||
void TaskMovie::Player::UpdateInteropTexture(TaskMovie::PlayerVideoParams* player_video_params) {
|
||||
if (interop_texture) {
|
||||
interop_texture->Release();
|
||||
interop_texture = 0;
|
||||
void TaskMovie::Player::UpdateGLTexture(TaskMovie::PlayerVideoInfo* player_video_info) {
|
||||
if (gl_texture) {
|
||||
gl_texture->Release();
|
||||
gl_texture = 0;
|
||||
}
|
||||
|
||||
if (player)
|
||||
player->GetGLDXIntreropTexture(&interop_texture);
|
||||
player->GetTextureOGL(&gl_texture);
|
||||
|
||||
if (!player_video_params)
|
||||
if (!player_video_info)
|
||||
return;
|
||||
|
||||
if (state == TaskMovie::State::Disp) {
|
||||
player_video_params->width = video_params.width;
|
||||
player_video_params->height = video_params.height;
|
||||
player_video_params->frame_size_width = video_params.frame_size_width;
|
||||
player_video_params->frame_size_height = video_params.frame_size_height;
|
||||
if (state == TaskMovie::State_Disp) {
|
||||
player_video_info->present_width = video_info.present_width;
|
||||
player_video_info->present_height = video_info.present_height;
|
||||
player_video_info->raw_width = video_info.raw_width;
|
||||
player_video_info->raw_height = video_info.raw_height;
|
||||
}
|
||||
else {
|
||||
player_video_params->width = 0;
|
||||
player_video_params->height = 0;
|
||||
player_video_params->frame_size_width = 0;
|
||||
player_video_params->frame_size_height = 0;
|
||||
player_video_info->present_width = 0;
|
||||
player_video_info->present_height = 0;
|
||||
player_video_info->raw_width = 0;
|
||||
player_video_info->raw_height = 0;
|
||||
}
|
||||
}
|
||||
|
||||
bool TaskMovie::Player::set_volume_internal(float_t vol) {
|
||||
MoviePlayLib::AudioVolumes volumes;
|
||||
volumes.spk_l_volume = vol;
|
||||
volumes.spk_r_volume = vol;
|
||||
volumes.field_8 = 0.0f;
|
||||
volumes.field_C = 0.0f;
|
||||
volumes.hph_l_volume = vol;
|
||||
volumes.hph_r_volume = vol;
|
||||
|
||||
HRESULT hr = player->SetVolumes(&volumes);
|
||||
if (SUCCEEDED(hr))
|
||||
volume_req = false;
|
||||
return SUCCEEDED(hr);
|
||||
}
|
||||
|
||||
bool TaskMovie::CheckState() {
|
||||
return state == TaskMovie::State::Init || state == TaskMovie::State::Disp;
|
||||
return state == TaskMovie::State_Init || state == TaskMovie::State_Disp;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user