From 20d28e80a5c861a9d5f449ea911ab75b4f37ad0d Mon Sep 17 00:00:00 2001 From: Jef Date: Tue, 24 Sep 2024 14:54:57 +0200 Subject: Initial community commit --- Src/Components/wac_playlists/wac_playlists.h | 5 + Src/Components/wac_playlists/wac_playlists.vcxproj | 257 ++++++++++++++++++++ .../wac_playlists/wac_playlists.vcxproj.filters | 39 +++ Src/Components/wac_playlists/wac_playlists_cb.h | 4 + .../wac_playlists/wac_playlists_entry.cpp | 261 +++++++++++++++++++++ Src/Components/wac_playlists/wac_playlists_entry.h | 115 +++++++++ .../wac_playlists/wac_playlists_playlist.h | 25 ++ .../wac_playlists/wac_playlists_playlist_cb.h | 4 + 8 files changed, 710 insertions(+) create mode 100644 Src/Components/wac_playlists/wac_playlists.h create mode 100644 Src/Components/wac_playlists/wac_playlists.vcxproj create mode 100644 Src/Components/wac_playlists/wac_playlists.vcxproj.filters create mode 100644 Src/Components/wac_playlists/wac_playlists_cb.h create mode 100644 Src/Components/wac_playlists/wac_playlists_entry.cpp create mode 100644 Src/Components/wac_playlists/wac_playlists_entry.h create mode 100644 Src/Components/wac_playlists/wac_playlists_playlist.h create mode 100644 Src/Components/wac_playlists/wac_playlists_playlist_cb.h (limited to 'Src/Components/wac_playlists') diff --git a/Src/Components/wac_playlists/wac_playlists.h b/Src/Components/wac_playlists/wac_playlists.h new file mode 100644 index 00000000..1bc842f2 --- /dev/null +++ b/Src/Components/wac_playlists/wac_playlists.h @@ -0,0 +1,5 @@ +#pragma once + +#include "wac_playlists_playlist.h" + + diff --git a/Src/Components/wac_playlists/wac_playlists.vcxproj b/Src/Components/wac_playlists/wac_playlists.vcxproj new file mode 100644 index 00000000..b84db0d1 --- /dev/null +++ b/Src/Components/wac_playlists/wac_playlists.vcxproj @@ -0,0 +1,257 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 16.0 + Win32Proj + {7399d85c-6cc7-4a19-ab66-77b1e01dfa44} + wac_playlists + 10.0.19041.0 + wac_playlists + + + + DynamicLibrary + true + v142 + Unicode + + + DynamicLibrary + false + v142 + true + Unicode + + + DynamicLibrary + true + v142 + Unicode + + + DynamicLibrary + false + v142 + true + Unicode + + + + + + + + + + + + + + + + + + + + + $(PlatformShortName)_$(Configuration)\ + $(PlatformShortName)_$(Configuration)\ + .w5s + $(IncludePath) + $(LibraryPath) + false + + + $(PlatformShortName)_$(Configuration)\ + $(PlatformShortName)_$(Configuration)\ + .w5s + $(IncludePath) + $(LibraryPath) + false + + + $(PlatformShortName)_$(Configuration)\ + $(PlatformShortName)_$(Configuration)\ + .w5s + + + $(PlatformShortName)_$(Configuration)\ + $(PlatformShortName)_$(Configuration)\ + .w5s + + + x86-windows-static-md + + + x86-windows-static-md + + + x86-windows-static-md + + + x86-windows-static-md + + + + Level3 + true + WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + true + NotUsing + pch.h + ..\..\Wasabi;%(AdditionalIncludeDirectories) + false + true + ProgramDatabase + $(IntDir)$(TargetName).pdb + + + + + true + false + false + + + %(AdditionalDependencies) + %(AdditionalLibraryDirectories) + + + Post build event: 'xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\System' + xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\System\ +xcopy /Y /D $(IntDir)$(TargetName).pdb ..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\System\ + + + + + Level3 + true + true + true + WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + true + NotUsing + + + ..\..\Wasabi;%(AdditionalIncludeDirectories) + true + None + $(IntDir)$(TargetName).pdb + + + + + true + true + false + false + + + %(AdditionalDependencies) + %(AdditionalLibraryDirectories) + + + Post build event: 'xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\System' + xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\System\ + + + + + Level3 + true + _DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + true + NotUsing + pch.h + ..\..\Wasabi;%(AdditionalIncludeDirectories) + false + true + ProgramDatabase + $(IntDir)$(TargetName).pdb + + + + + true + false + false + + + %(AdditionalDependencies) + %(AdditionalLibraryDirectories) + + + Post build event: 'xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\System' + xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\System\ +xcopy /Y /D $(IntDir)$(TargetName).pdb ..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\System\ + + + + + Level3 + true + true + true + NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + true + NotUsing + pch.h + ..\..\Wasabi;%(AdditionalIncludeDirectories) + true + None + $(IntDir)$(TargetName).pdb + + + + + true + true + true + false + + + %(AdditionalDependencies) + %(AdditionalLibraryDirectories) + + + Post build event: 'xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\System' + xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\System\ + + + + + + + + + + + + + + + {3e0bfa8a-b86a-42e9-a33f-ec294f823f7f} + + + + + + \ No newline at end of file diff --git a/Src/Components/wac_playlists/wac_playlists.vcxproj.filters b/Src/Components/wac_playlists/wac_playlists.vcxproj.filters new file mode 100644 index 00000000..6d813f01 --- /dev/null +++ b/Src/Components/wac_playlists/wac_playlists.vcxproj.filters @@ -0,0 +1,39 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + + + Source Files + + + \ No newline at end of file diff --git a/Src/Components/wac_playlists/wac_playlists_cb.h b/Src/Components/wac_playlists/wac_playlists_cb.h new file mode 100644 index 00000000..e6132a71 --- /dev/null +++ b/Src/Components/wac_playlists/wac_playlists_cb.h @@ -0,0 +1,4 @@ +#pragma once + +#include "wac_playlists_playlist_cb.h" + diff --git a/Src/Components/wac_playlists/wac_playlists_entry.cpp b/Src/Components/wac_playlists/wac_playlists_entry.cpp new file mode 100644 index 00000000..28cfc910 --- /dev/null +++ b/Src/Components/wac_playlists/wac_playlists_entry.cpp @@ -0,0 +1,261 @@ +#include "wac_playlists_entry.h" + + +wa::Components::playlists::playlist_entry::playlist_entry( const std::wstring &p_filename, const std::wstring &p_title, int p_length_ms ) +{ + this->__filename = p_filename; + this->__filetitle = p_title; + + SetLengthMilliseconds( p_length_ms ); +} + +wa::Components::playlists::playlist_entry::playlist_entry( const std::wstring &p_filename, const std::wstring &p_title, int p_length_ms, int p_size ) +{ + this->__filename = p_filename; + this->__filetitle = p_title; + + SetLengthMilliseconds( p_length_ms ); + SetSizeBytes( p_size ); +} + +wa::Components::playlists::playlist_entry::playlist_entry( const std::wstring &p_filename, const std::wstring &p_title, int p_length_ms, ifc_plentryinfo *p_info ) +{ + this->__filename = p_filename; + this->__filetitle = p_title; + + SetLengthMilliseconds( p_length_ms ); + + if ( p_info ) + { + SetMediahash( p_info->GetExtendedInfo( _CONST_PLAYLIST_INFO_MEDIAHASH ) ); + SetMetahash( p_info->GetExtendedInfo( _CONST_PLAYLIST_INFO_METAHASH ) ); + SetCloudID( p_info->GetExtendedInfo( _CONST_PLAYLIST_INFO_CLOUD_ID ) ); + SetCloudStatus( p_info->GetExtendedInfo( _CONST_PLAYLIST_INFO_CLOUD_STATUS ) ); + SetCloudDevices( p_info->GetExtendedInfo( _CONST_PLAYLIST_INFO_CLOUD_DEVICES ) ); + } +} + +wa::Components::playlists::playlist_entry::playlist_entry( const std::wstring &p_filename, const std::wstring &p_title, int p_length_ms, int p_size, ifc_plentryinfo *p_info ) +{ + this->__filename = p_filename; + this->__filetitle = p_title; + + SetLengthMilliseconds( p_length_ms ); + SetSizeBytes( p_size ); + + if ( p_info ) + { + SetMediahash( p_info->GetExtendedInfo( _CONST_PLAYLIST_INFO_MEDIAHASH ) ); + SetMetahash( p_info->GetExtendedInfo( _CONST_PLAYLIST_INFO_METAHASH ) ); + SetCloudID( p_info->GetExtendedInfo( _CONST_PLAYLIST_INFO_CLOUD_ID ) ); + SetCloudStatus( p_info->GetExtendedInfo( _CONST_PLAYLIST_INFO_CLOUD_STATUS ) ); + SetCloudDevices( p_info->GetExtendedInfo( _CONST_PLAYLIST_INFO_CLOUD_DEVICES ) ); + } +} + +wa::Components::playlists::playlist_entry::playlist_entry( const std::wstring &p_filename, const std::wstring &p_title, int p_length_ms, + const std::wstring &p_mediahash, const std::wstring &p_metahash, const std::wstring &p_cloud_id, const std::wstring &p_cloud_status, const std::wstring &p_cloud_devices ) +{ + this->__filename = p_filename; + this->__filetitle = p_title; + + SetLengthMilliseconds( p_length_ms ); + + this->__mediahash = p_mediahash; + this->__metahash = p_metahash; + + SetCloudID( p_cloud_id ); + SetCloudStatus( p_cloud_status ); + + this->__cloud_devices = p_cloud_devices; +} + +wa::Components::playlists::playlist_entry::playlist_entry( const std::wstring &p_filename, const std::wstring &p_title, int p_length_ms, int p_size, + const std::wstring &p_mediahash, const std::wstring &p_metahash, const std::wstring &p_cloud_id, const std::wstring &p_cloud_status, const std::wstring &p_cloud_devices ) +{ + this->__filename = p_filename; + this->__filetitle = p_title; + + SetLengthMilliseconds( p_length_ms ); + SetSizeBytes( p_size ); + + this->__mediahash = p_mediahash; + this->__metahash = p_metahash; + + SetCloudID( p_cloud_id ); + SetCloudStatus( p_cloud_status ); + + this->__cloud_devices = p_cloud_devices; +} + +size_t wa::Components::playlists::playlist_entry::GetFilename( std::wstring &p_filename, size_t p_filename_max_length ) +{ + if ( p_filename.empty() ) + return this->__filename.size(); + + if ( this->__filename.empty() ) + return 0; + + p_filename = this->__filename.substr( 0, p_filename_max_length ); + + return 1; +} + +size_t wa::Components::playlists::playlist_entry::GetTitle( std::wstring &p_title, size_t p_title_max_length ) +{ + if ( p_title.empty() ) + return this->__filetitle.size(); + + if ( this->__filetitle.empty() ) + return 0; + + p_title = this->__filetitle.substr( 0, p_title_max_length ); + + return 1; +} + + +size_t wa::Components::playlists::playlist_entry::GetExtendedInfo( const std::wstring &p_metadata, std::wstring &p_result, const size_t p_result_max_length ) +{ + if ( !__cloud_id.empty() ) + { + if ( p_metadata.compare( _CONST_PLAYLIST_INFO_MEDIAHASH ) == 0 ) + { + if ( !__mediahash.empty() ) + { + p_result = __mediahash.substr( 0, p_result_max_length ); + + return 1; + } + else + return 0; + } + else if ( p_metadata.compare( _CONST_PLAYLIST_INFO_METAHASH ) == 0 ) + { + if ( !__metahash.empty() ) + { + p_result = __metahash.substr( 0, p_result_max_length ); + + return 1; + } + else + return 0; + } + else if ( p_metadata.compare( _CONST_PLAYLIST_INFO_CLOUD_ID ) == 0 ) + { + if ( !__cloud_id.empty() ) + { + p_result = __cloud_id.substr( 0, p_result_max_length ); + + return 1; + } + else + return 0; + } + else if ( p_metadata.compare( _CONST_PLAYLIST_INFO_CLOUD_STATUS ) == 0 ) + { + if ( !__cloud_status.empty() ) + { + p_result = __cloud_status.substr( 0, p_result_max_length ); + + return 1; + } + else + return 0; + } + else if ( p_metadata.compare( _CONST_PLAYLIST_INFO_CLOUD_DEVICES ) == 0 ) + { + if ( !__cloud_devices.empty() ) + { + p_result = __cloud_devices.substr( 0, p_result_max_length ); + + return 1; + } + else + return 0; + } + else if ( p_metadata.compare( _CONST_PLAYLIST_INFO_CLOUD ) == 0 ) + { + if ( _wtoi( __cloud_id.c_str() ) > 0 ) + { + wchar_t l_result_buffer[ 500 ] = {0}; + + swprintf_s( l_result_buffer, p_result_max_length, L"#EXT-X-NS-CLOUD:mediahash=%s,metahash=%s,cloud_id=%s,cloud_status=%s,cloud_devices=%s", __mediahash.c_str(), __metahash.c_str(), __cloud_id.c_str(), __cloud_status.c_str(), __cloud_devices.c_str() ); + + p_result = std::wstring( l_result_buffer ); + + + return 1; + } + } + } + + return 0; +} + + +void wa::Components::playlists::playlist_entry::SetFilename( const std::wstring &p_filename ) +{ + this->__filename = p_filename; + + if ( p_filename.size() > 4 ) + __is_local_file = this->__filename.substr( 0, 4 ).compare( L"http" ) != 0; +} + +void wa::Components::playlists::playlist_entry::SetTitle( const std::wstring &p_title ) +{ + this->__filetitle = p_title; + this->__is_cached = !p_title.empty(); +} + + +void wa::Components::playlists::playlist_entry::SetLengthMilliseconds( int p_length_ms ) +{ + if ( p_length_ms <= 0 ) + this->__length_ms = -1000; + else + this->__length_ms = p_length_ms; +} + + +void wa::Components::playlists::playlist_entry::SetMediahash( const std::wstring &p_mediahash ) +{ + this->__mediahash = p_mediahash; +} + +void wa::Components::playlists::playlist_entry::SetSizeBytes( int p_size ) +{ + if ( p_size <= 0 ) + this->__size = 0; + else + this->__size = p_size; +} + +void wa::Components::playlists::playlist_entry::SetMetahash( const std::wstring &p_metahash ) +{ + this->__metahash = p_metahash; +} + +void wa::Components::playlists::playlist_entry::SetCloudID( const std::wstring &p_cloud_id ) +{ + if ( _wtoi( p_cloud_id.c_str() ) > 0 ) + this->__cloud_id = p_cloud_id; + else + this->__cloud_id.clear(); +} + +void wa::Components::playlists::playlist_entry::SetCloudStatus( const std::wstring &p_cloud_status ) +{ + if ( _wtoi( p_cloud_status.c_str() ) > 0 ) + this->__cloud_status = p_cloud_status; + else + this->__cloud_status.clear(); +} + +void wa::Components::playlists::playlist_entry::SetCloudDevices( const std::wstring &p_cloud_devices ) +{ + this->__cloud_devices = p_cloud_devices; +} + + + diff --git a/Src/Components/wac_playlists/wac_playlists_entry.h b/Src/Components/wac_playlists/wac_playlists_entry.h new file mode 100644 index 00000000..3005dc9a --- /dev/null +++ b/Src/Components/wac_playlists/wac_playlists_entry.h @@ -0,0 +1,115 @@ +#pragma once + +#ifndef _WA_PLAYLISTS_H +#define _WA_PLAYLISTS_H + +#include // for std::wstring + +#include "bfc\dispatch.h" +#include "bfc\platform\types.h" + +namespace wa +{ + namespace Components + { + namespace playlists + { + // + // CONST + // + static const std::wstring _CONST_PLAYLIST_INFO_MEDIAHASH = L"mediahash"; + static const std::wstring _CONST_PLAYLIST_INFO_METAHASH = L"metahash"; + static const std::wstring _CONST_PLAYLIST_INFO_CLOUD_ID = L"cloud_id"; + static const std::wstring _CONST_PLAYLIST_INFO_CLOUD_STATUS = L"cloud_status"; + static const std::wstring _CONST_PLAYLIST_INFO_CLOUD_DEVICES = L"cloud_devices"; + static const std::wstring _CONST_PLAYLIST_INFO_CLOUD = L"cloud"; + + + // + // ifc_plentryinfo + // + class ifc_plentryinfo : public Dispatchable + { + protected: + ifc_plentryinfo() {} + ~ifc_plentryinfo() {} + + public: + virtual const std::wstring GetExtendedInfo( const std::wstring &p_parameter ); + + DISPATCH_CODES + { + IFC_PLENTRYINFO_GETEXTENDEDINFO = 10, + }; + }; + + inline const std::wstring ifc_plentryinfo::GetExtendedInfo( const std::wstring &p_parameter ) + { + return std::wstring( _call( IFC_PLENTRYINFO_GETEXTENDEDINFO, (const wchar_t *)0, p_parameter.c_str() ) ); + } + + + // + // playlist_entry + // + class playlist_entry + { + public: + playlist_entry() {} + playlist_entry( const std::wstring &p_filename, const std::wstring &p_title, int p_length_ms ); + playlist_entry( const std::wstring &p_filename, const std::wstring &p_title, int p_length_ms, int p_size ); + playlist_entry( const std::wstring &p_filename, const std::wstring &p_title, int p_length_ms, ifc_plentryinfo *p_info ); + playlist_entry( const std::wstring &p_filename, const std::wstring &p_title, int p_length_ms, int p_size, ifc_plentryinfo *p_info ); + playlist_entry( const std::wstring &p_filename, const std::wstring &p_title, int p_length_ms, + const std::wstring &p_mediahash, const std::wstring &p_metahash, const std::wstring &p_cloud_id, const std::wstring &p_cloud_status, const std::wstring &p_cloud_devices ); + playlist_entry( const std::wstring &p_filename, const std::wstring &p_title, int p_length_ms, int p_size, + const std::wstring &p_mediahash, const std::wstring &p_metahash, const std::wstring &p_cloud_id, const std::wstring &p_cloud_status, const std::wstring &p_cloud_devices ); + + virtual ~playlist_entry() {} + + virtual size_t GetFilename( std::wstring &p_filename, const size_t p_filename_max_length ); + virtual size_t GetTitle( std::wstring &p_title, const size_t p_title_max_length ); + + virtual int GetLengthInMilliseconds() const { return this->__length_ms; } + virtual int GetSizeInBytes() const { return this->__size; } + + virtual size_t GetExtendedInfo( const std::wstring &p_metadata, std::wstring &p_result, const size_t p_result_max_length ); + + virtual void SetFilename( const std::wstring &p_filename ); + virtual void SetTitle( const std::wstring &p_title ); + + virtual void SetLengthMilliseconds( int p_length_ms ); + virtual void SetSizeBytes( int p_size ); + + virtual void SetMediahash( const std::wstring &p_mediahash ); + virtual void SetMetahash( const std::wstring &p_metahash ); + virtual void SetCloudID( const std::wstring &p_cloud_id ); + virtual void SetCloudStatus( const std::wstring &p_cloud_status ); + virtual void SetCloudDevices( const std::wstring &p_cloud_devices ); + + virtual bool isCached() const { return __is_cached; } + virtual bool isLocalFile() const { return __is_local_file; } + + + protected: + std::wstring __filename; + std::wstring __filetitle; + + std::wstring __mediahash; + std::wstring __metahash; + std::wstring __cloud_id; + std::wstring __cloud_status; + std::wstring __cloud_devices; + + int __length_ms = -1; + int __size = 0; + + bool __is_cached = false; + bool __is_local_file = false; + }; + } + } +} + + +#endif // !_WA_PLAYLISTS_H diff --git a/Src/Components/wac_playlists/wac_playlists_playlist.h b/Src/Components/wac_playlists/wac_playlists_playlist.h new file mode 100644 index 00000000..efce2971 --- /dev/null +++ b/Src/Components/wac_playlists/wac_playlists_playlist.h @@ -0,0 +1,25 @@ +#pragma once + +#include "wac_playlists_entry.h" + +#include + +namespace wa +{ + namespace components + { + namespace playlists + { + enum + { + patch_playlist, + patch_playlistloadercallback + }; + + class playlist : public MultiPatch, public MultiPatch + { + + }; + } + } +} \ No newline at end of file diff --git a/Src/Components/wac_playlists/wac_playlists_playlist_cb.h b/Src/Components/wac_playlists/wac_playlists_playlist_cb.h new file mode 100644 index 00000000..60abc260 --- /dev/null +++ b/Src/Components/wac_playlists/wac_playlists_playlist_cb.h @@ -0,0 +1,4 @@ +#pragma once + +#include "wac_playlists_entry.h" + -- cgit