diff options
Diffstat (limited to 'plugins')
299 files changed, 52448 insertions, 0 deletions
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foo_12.vcxproj.filters b/plugins/ListeningTo/src/players/foo_mlt/foo_12.vcxproj.filters new file mode 100644 index 0000000000..305f177152 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foo_12.vcxproj.filters @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{22ed77cf-77c7-4527-951a-294e087f53a5}</UniqueIdentifier>
+ <Extensions>cpp;c;cxx;rc;def;r;odl;idl;hpj;bat</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{718b5639-b56c-427f-a4f5-ef2e8e812493}</UniqueIdentifier>
+ <Extensions>h;hpp;hxx;hm;inl</Extensions>
+ </Filter>
+ <Filter Include="Resource Files">
+ <UniqueIdentifier>{d573a90b-1e87-42f8-ac88-66b7313ae2f0}</UniqueIdentifier>
+ <Extensions>ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="foo_mlt.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ </ItemGroup>
+</Project>
\ No newline at end of file diff --git a/plugins/ListeningTo/src/players/foo_mlt/foo_14.vcxproj.filters b/plugins/ListeningTo/src/players/foo_mlt/foo_14.vcxproj.filters new file mode 100644 index 0000000000..305f177152 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foo_14.vcxproj.filters @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{22ed77cf-77c7-4527-951a-294e087f53a5}</UniqueIdentifier>
+ <Extensions>cpp;c;cxx;rc;def;r;odl;idl;hpj;bat</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{718b5639-b56c-427f-a4f5-ef2e8e812493}</UniqueIdentifier>
+ <Extensions>h;hpp;hxx;hm;inl</Extensions>
+ </Filter>
+ <Filter Include="Resource Files">
+ <UniqueIdentifier>{d573a90b-1e87-42f8-ac88-66b7313ae2f0}</UniqueIdentifier>
+ <Extensions>ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="foo_mlt.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ </ItemGroup>
+</Project>
\ No newline at end of file diff --git a/plugins/ListeningTo/src/players/foo_mlt/foo_mlt.cpp b/plugins/ListeningTo/src/players/foo_mlt/foo_mlt.cpp new file mode 100644 index 0000000000..dde1dfe15d --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foo_mlt.cpp @@ -0,0 +1,392 @@ +/*
+Copyright (C) 2005-2009 Ricardo Pescuma Domenecci
+
+This is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this file; see the file license.txt. If
+not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.
+*/
+
+#include "foobar2000/SDK/foobar2000.h"
+#include "foobar2000/helpers/helpers.h"
+#include "m_listeningto.h"
+#include <windows.h>
+#include <process.h>
+
+
+using namespace pfc;
+
+
+// Globals //////////////////////////////////////////////////////////////////////////////
+
+
+#define MIRANDA_DW_PROTECTION 0x8754
+
+#define DATA_SIZE 1024
+
+UINT timer = 0;
+WCHAR lastSongData[DATA_SIZE] = L"";
+
+static bool g_off = true; //global state for sending listeningto infos
+
+
+// Functions ////////////////////////////////////////////////////////////////////////////
+
+
+BOOL CALLBACK EnumWindowsProc(HWND hwnd, LPARAM lParam)
+{
+ // Find the windows
+ TCHAR class_name[256];
+ if (GetClassName(hwnd, class_name, 256))
+ {
+ class_name[255] = _T('\0');
+
+ if (lstrcmpi(MIRANDA_WINDOWCLASS, class_name) == 0)
+ {
+ COPYDATASTRUCT *cds = (COPYDATASTRUCT *) lParam;
+ SendMessage(hwnd, WM_COPYDATA, (WPARAM) NULL, (LPARAM) cds);
+ }
+ }
+
+ return TRUE;
+}
+
+inline void SendData(WCHAR *text)
+{
+ static WCHAR lastMsg[DATA_SIZE] = L"";
+
+ if (wcscmp(lastMsg, text) == 0)
+ return;
+
+ // Prepare the struct
+ COPYDATASTRUCT cds;
+ cds.dwData = MIRANDA_DW_PROTECTION;
+ cds.lpData = text;
+ cds.cbData = (wcslen(text) + 1) * sizeof(WCHAR);
+
+ EnumWindows(EnumWindowsProc, (LPARAM) &cds);
+
+ wcsncpy(lastMsg, text, DATA_SIZE);
+ lastMsg[DATA_SIZE-1] = L'\0';
+}
+
+
+void Concat(WCHAR *data, size_t &size, const char *str, size_t len = 0)
+{
+ if (size < 3 * sizeof(WCHAR))
+ return;
+
+ if (str != NULL)
+ {
+ if (len == 0)
+ len = strlen(str);
+
+ if (size >= len + 3)
+ {
+ size -= MultiByteToWideChar(CP_UTF8, 0, str, len * sizeof(char), &data[DATA_SIZE - size], size * sizeof(WCHAR));
+ data[DATA_SIZE - size] = L'\0';
+ }
+ }
+
+ wcscat(data, L"\\0");
+ size -= 2;
+}
+
+
+void Concat(WCHAR *data, size_t &size)
+{
+ if (size < 3 * sizeof(WCHAR))
+ return;
+
+ wcscat(data, L"\\0");
+ size -= 2;
+}
+
+
+void Concat(WCHAR *data, size_t &size, const WCHAR *str, size_t len = 0)
+{
+ if (size < 3 * sizeof(WCHAR))
+ return;
+
+ if (str != NULL)
+ {
+ if (len == 0)
+ len = wcslen(str);
+
+ if (size >= len + 3)
+ {
+ wcscpy(&data[DATA_SIZE - size], str);
+ size -= len;
+ data[DATA_SIZE - size] = L'\0';
+ }
+ }
+
+ wcscat(data, L"\\0");
+ size -= 2;
+}
+
+
+void GetMetadata(const file_info *info, char *field, WCHAR *data, size_t &size)
+{
+ const char *val = info->meta_get(field, 0);
+ if (val != NULL && val[0] != '\0')
+ {
+ Concat(data, size, val);
+ }
+ else
+ {
+ Concat(data, size);
+ }
+}
+
+
+void KillTimer(UINT id = 0)
+{
+ if (id != 0)
+ {
+ KillTimer(NULL, id);
+ }
+ if (timer != 0)
+ {
+ if (timer != id)
+ KillTimer(NULL, timer);
+ timer = 0;
+ }
+}
+
+
+void CALLBACK SendEmptyData(HWND hWnd = 0, UINT nMsg = 0, UINT nIDEvent = 0, DWORD dwTime = 0)
+{
+ KillTimer(nIDEvent);
+
+ // L"<Status 0-stoped 1-playing>\\0<Player>\\0<Type>\\0<Title>\\0<Artist>\\0<Album>\\0<Track>\\0<Year>\\0<Genre>\\0<Length (secs)>\\0\\0"
+ SendData(L"0\\0foobar2000\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0");
+}
+
+
+void SetTimer()
+{
+ KillTimer();
+ timer = SetTimer(NULL, 1, 1000, SendEmptyData);
+}
+
+
+BOOL IsRadio(metadb_handle_ptr p_track)
+{
+ const char *filename = p_track->get_path();
+ return (filename != NULL && strstr(filename, "://") != 0 && strncmp(filename, "file://", 7) != 0);
+}
+
+
+void SendDataMusic(const char *filename, const file_info *info)
+{
+ WCHAR data[DATA_SIZE];
+ size_t size = DATA_SIZE;
+ data[0] = L'\0';
+
+ // L"<Status 0-stoped 1-playing>\\0<Player>\\0<Type>\\0<Title>\\0<Artist>\\0<Album>\\0<Track>\\0<Year>\\0<Genre>\\0<Length (secs)>\\0\\0"
+ Concat(data, size, "1");
+ Concat(data, size, "foobar2000");
+ Concat(data, size, "Music");
+
+ const char *val = info->meta_get("TITLE", 0);
+ if (val != NULL && val[0] != '\0')
+ {
+ Concat(data, size, val);
+ }
+ else if (filename != NULL && filename[0] != '\0')
+ {
+ const char *name = strrchr(filename, '\\');
+ if (name == NULL)
+ strrchr(filename, '/');
+
+ if (name == NULL)
+ {
+ Concat(data, size);
+ }
+ else
+ {
+ const char *dot = strrchr(name, '.');
+ Concat(data, size, name + 1, dot == NULL ? 0 : dot - name - 1);
+ }
+ }
+ else
+ {
+ Concat(data, size);
+ }
+
+ GetMetadata(info, "ARTIST", data, size);
+ GetMetadata(info, "ALBUM", data, size);
+ GetMetadata(info, "TRACKNUMBER", data, size);
+ GetMetadata(info, "DATE", data, size);
+ GetMetadata(info, "GENRE", data, size);
+
+ int len = (int) info->get_length();
+ if (len > 0)
+ {
+ char tmp[10];
+ Concat(data, size, itoa(len, tmp, 10));
+ }
+ else
+ {
+ Concat(data, size);
+ }
+
+ Concat(data, size);
+
+ SendData(data);
+ wcsncpy(lastSongData, data, DATA_SIZE);
+ lastSongData[DATA_SIZE-1] = L'\0';
+}
+
+void SendDataRadio(const file_info *info, const file_info *info2)
+{
+ WCHAR data[DATA_SIZE];
+ size_t size = DATA_SIZE;
+ data[0] = L'\0';
+
+ // L"<Status 0-stoped 1-playing>\\0<Player>\\0<Type>\\0<Title>\\0<Artist>\\0<Album>\\0<Track>\\0<Year>\\0<Genre>\\0<Length (secs)>\\0<Station name>\\0"
+ Concat(data, size, "1");
+ Concat(data, size, "foobar2000");
+ Concat(data, size, "Radio");
+
+ GetMetadata(info, "TITLE", data, size);
+ GetMetadata(info, "ARTIST", data, size);
+ GetMetadata(info, "ALBUM", data, size);
+ GetMetadata(info, "TRACKNUMBER", data, size);
+ GetMetadata(info, "DATE", data, size);
+ GetMetadata(info2, "GENRE", data, size);
+
+ int len = (int) info->get_length();
+ if (len > 0)
+ {
+ char tmp[10];
+ Concat(data, size, itoa(len, tmp, 10));
+ }
+ else
+ {
+ Concat(data, size);
+ }
+
+ // Station name
+ GetMetadata(info2, "TITLE", data, size);
+
+ SendData(data);
+ wcsncpy(lastSongData, data, DATA_SIZE);
+ lastSongData[DATA_SIZE-1] = L'\0';
+}
+
+
+// Foobar ////////////////////////////////////////////////////////////////////////////
+
+class play_callback_miranda : public play_callback_static
+{
+ virtual void on_playback_starting(play_control::t_track_command p_command, bool p_paused) {}
+ virtual void on_playback_new_track(metadb_handle_ptr p_track)
+ {
+ if (g_off) return;
+
+ KillTimer();
+ if (IsRadio(p_track))
+ return;
+
+ in_metadb_sync_fromhandle l_sync(p_track);
+
+ const file_info *info;
+ if (p_track->get_info_locked(info))
+ SendDataMusic(p_track->get_path(), info);
+ }
+ virtual void on_playback_stop(play_control::t_stop_reason p_reason)
+ {
+ if (g_off) return;
+ SetTimer();
+ }
+ virtual void on_playback_seek(double p_time) {}
+ virtual void on_playback_pause(bool p_state)
+ {
+ if (g_off) return;
+ if (p_state)
+ {
+ SetTimer();
+ }
+ else
+ {
+ KillTimer();
+ if (lastSongData[0] != L'\0')
+ SendData(lastSongData);
+ }
+ }
+ virtual void on_playback_edited(metadb_handle_ptr p_track) {}
+ virtual void on_playback_dynamic_info(const file_info & info) {}
+ virtual void on_playback_dynamic_info_track(const file_info & info)
+ {
+ if (g_off) return;
+ metadb_handle_ptr p_track;
+ static_api_ptr_t<play_control>()->get_now_playing(p_track);
+ if (p_track.is_valid())
+ {
+ if (IsRadio(p_track))
+ {
+ in_metadb_sync_fromhandle l_sync(p_track);
+
+ const file_info *info2;
+ if (!p_track->get_info_locked(info2))
+ return;
+
+ SendDataRadio(&info, info2);
+ }
+ p_track.release();
+ }
+ }
+ virtual void on_playback_time(double p_time) {}
+ virtual void on_volume_change(float p_new_val) {};
+
+ virtual unsigned get_flags()
+ {
+ return flag_on_playback_new_track | flag_on_playback_pause | flag_on_playback_stop | flag_on_playback_dynamic_info_track;
+ }
+};
+
+
+static play_callback_static_factory_t<play_callback_miranda> miranda_callback_factory;
+
+class myinitquit : public initquit {
+public:
+ void on_init()
+ {
+ //check if foo_comserver2 is present and set g_off to false if foo_mlt go active
+ //TODO:detect foo_comserver2 from component list (can also check for other plugins)
+ CLSID clsid;
+ if(S_OK != CLSIDFromProgID(L"Foobar2000.Application.0.7", &clsid)) {
+ g_off = false;
+ SetTimer();
+ }
+ }
+ void on_quit()
+ {
+ if (!g_off && FindWindow(MIRANDA_WINDOWCLASS, NULL) != NULL)
+ SendData(L"0\\0foobar2000\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0");
+ }
+};
+
+static initquit_factory_t<myinitquit> g_myinitquit_factory;
+
+DECLARE_COMPONENT_VERSION("Miranda ListeningTo foobar2000 Plugin",
+"1.1.1",
+"compiled with foo_SDK-2010-10-02\r\n\
+Sending listeningto information to Mitanda IM client\r\n\
+if no foo_comserver2 is present.\r\n\
+Copyright (C) 2006-2010 Ricardo Pescuma Domenecci\r\n\
+http://www.miranda-im.org\r\n\
+http://pescuma.org/miranda/listeningto"
+)
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foo_mlt_10.vcxproj b/plugins/ListeningTo/src/players/foo_mlt/foo_mlt_10.vcxproj new file mode 100644 index 0000000000..6cd934eef5 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foo_mlt_10.vcxproj @@ -0,0 +1,162 @@ +<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectName>ListeningTo_foo_mlt</ProjectName>
+ <ProjectGuid>{94734E61-D980-4A5F-AAAA-65105755CE24}</ProjectGuid>
+ <RootNamespace>foo_mlt</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseOfMfc>false</UseOfMfc>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseOfMfc>false</UseOfMfc>
+ <CharacterSet>MultiByte</CharacterSet>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup>
+ <_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\Plugins\Listeningto\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\Obj\$(ProjectName)\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\Plugins\Listeningto\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\Obj\$(ProjectName)\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
+ <TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">foo_mlt</TargetName>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Midl>
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MkTypLibCompatible>true</MkTypLibCompatible>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <TargetEnvironment>Win32</TargetEnvironment>
+ <TypeLibraryName>.\Release/foo_mlt.tlb</TypeLibraryName>
+ <HeaderFileName>
+ </HeaderFileName>
+ </Midl>
+ <ClCompile>
+ <Optimization>MaxSpeed</Optimization>
+ <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
+ <PreprocessorDefinitions>NDEBUG;_WINDOWS;_USRDLL;UNICODE;_UNICODE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <StringPooling>true</StringPooling>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <WarningLevel>Level3</WarningLevel>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <AdditionalIncludeDirectories>..\..\..\..\ExternalAPI</AdditionalIncludeDirectories>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <Culture>0x0416</Culture>
+ </ResourceCompile>
+ <Link>
+ <AdditionalDependencies>foobar2000\shared\shared.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <ModuleDefinitionFile>
+ </ModuleDefinitionFile>
+ <RandomizedBaseAddress>false</RandomizedBaseAddress>
+ <DataExecutionPrevention>
+ </DataExecutionPrevention>
+ <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
+ <TargetMachine>MachineX86</TargetMachine>
+ <OptimizeReferences>true</OptimizeReferences>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <AdditionalLibraryDirectories>$(SolutionDir)\lib</AdditionalLibraryDirectories>
+ </Link>
+ <Bscmake>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ </Bscmake>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Midl>
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MkTypLibCompatible>true</MkTypLibCompatible>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <TargetEnvironment>Win32</TargetEnvironment>
+ <TypeLibraryName>.\Debug/foo_mlt.tlb</TypeLibraryName>
+ <HeaderFileName>
+ </HeaderFileName>
+ </Midl>
+ <ClCompile>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>_DEBUG;_WINDOWS;_USRDLL;UNICODE;_UNICODE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MinimalRebuild>true</MinimalRebuild>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+ <BrowseInformation>true</BrowseInformation>
+ <WarningLevel>Level3</WarningLevel>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <Culture>0x0416</Culture>
+ </ResourceCompile>
+ <Link>
+ <AdditionalDependencies>foobar2000\shared\shared.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <ModuleDefinitionFile>
+ </ModuleDefinitionFile>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <RandomizedBaseAddress>false</RandomizedBaseAddress>
+ <DataExecutionPrevention>
+ </DataExecutionPrevention>
+ <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
+ <TargetMachine>MachineX86</TargetMachine>
+ <AdditionalLibraryDirectories>$(SolutionDir)\lib</AdditionalLibraryDirectories>
+ </Link>
+ <Bscmake>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ </Bscmake>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClCompile Include="foo_mlt.cpp">
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="foobar2000\foobar2000_component_client\foobar2000_component_client_10.vcxproj">
+ <Project>{71ad2674-065b-48f5-b8b0-e1f9d3892081}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ <ProjectReference Include="foobar2000\helpers\foobar2000_sdk_helpers_10.vcxproj">
+ <Project>{ee47764e-a202-4f85-a767-abdab4aff35f}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ <ProjectReference Include="foobar2000\SDK\foobar2000_SDK_10.vcxproj">
+ <Project>{e8091321-d79d-4575-86ef-064ea1a4a20d}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ <ProjectReference Include="pfc\pfc_10.vcxproj">
+ <Project>{ebfffb4e-261d-44d3-b89c-957b31a0bf9c}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
\ No newline at end of file diff --git a/plugins/ListeningTo/src/players/foo_mlt/foo_mlt_10.vcxproj.filters b/plugins/ListeningTo/src/players/foo_mlt/foo_mlt_10.vcxproj.filters new file mode 100644 index 0000000000..305f177152 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foo_mlt_10.vcxproj.filters @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{22ed77cf-77c7-4527-951a-294e087f53a5}</UniqueIdentifier>
+ <Extensions>cpp;c;cxx;rc;def;r;odl;idl;hpj;bat</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{718b5639-b56c-427f-a4f5-ef2e8e812493}</UniqueIdentifier>
+ <Extensions>h;hpp;hxx;hm;inl</Extensions>
+ </Filter>
+ <Filter Include="Resource Files">
+ <UniqueIdentifier>{d573a90b-1e87-42f8-ac88-66b7313ae2f0}</UniqueIdentifier>
+ <Extensions>ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="foo_mlt.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ </ItemGroup>
+</Project>
\ No newline at end of file diff --git a/plugins/ListeningTo/src/players/foo_mlt/foo_mlt_12.vcxproj b/plugins/ListeningTo/src/players/foo_mlt/foo_mlt_12.vcxproj new file mode 100644 index 0000000000..8e722a8042 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foo_mlt_12.vcxproj @@ -0,0 +1,162 @@ +<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectName>ListeningTo_foo_mlt</ProjectName>
+ <ProjectGuid>{94734E61-D980-4A5F-AAAA-65105755CE24}</ProjectGuid>
+ <RootNamespace>foo_mlt</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseOfMfc>false</UseOfMfc>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseOfMfc>false</UseOfMfc>
+ <CharacterSet>MultiByte</CharacterSet>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup>
+ <_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\Plugins\Listeningto\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\Obj\$(ProjectName)\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\Plugins\Listeningto\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\Obj\$(ProjectName)\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
+ <TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">foo_mlt</TargetName>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Midl>
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MkTypLibCompatible>true</MkTypLibCompatible>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <TargetEnvironment>Win32</TargetEnvironment>
+ <TypeLibraryName>.\Release/foo_mlt.tlb</TypeLibraryName>
+ <HeaderFileName>
+ </HeaderFileName>
+ </Midl>
+ <ClCompile>
+ <Optimization>MaxSpeed</Optimization>
+ <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
+ <PreprocessorDefinitions>NDEBUG;_WINDOWS;_USRDLL;UNICODE;_UNICODE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <StringPooling>true</StringPooling>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <WarningLevel>Level3</WarningLevel>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <AdditionalIncludeDirectories>..\..\..\..\ExternalAPI</AdditionalIncludeDirectories>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <Culture>0x0416</Culture>
+ </ResourceCompile>
+ <Link>
+ <AdditionalDependencies>foobar2000\shared\shared.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <ModuleDefinitionFile>
+ </ModuleDefinitionFile>
+ <RandomizedBaseAddress>false</RandomizedBaseAddress>
+ <DataExecutionPrevention>
+ </DataExecutionPrevention>
+ <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
+ <TargetMachine>MachineX86</TargetMachine>
+ <OptimizeReferences>true</OptimizeReferences>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <AdditionalLibraryDirectories>$(SolutionDir)\lib</AdditionalLibraryDirectories>
+ </Link>
+ <Bscmake>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ </Bscmake>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Midl>
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MkTypLibCompatible>true</MkTypLibCompatible>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <TargetEnvironment>Win32</TargetEnvironment>
+ <TypeLibraryName>.\Debug/foo_mlt.tlb</TypeLibraryName>
+ <HeaderFileName>
+ </HeaderFileName>
+ </Midl>
+ <ClCompile>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>_DEBUG;_WINDOWS;_USRDLL;UNICODE;_UNICODE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MinimalRebuild>true</MinimalRebuild>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+ <BrowseInformation>true</BrowseInformation>
+ <WarningLevel>Level3</WarningLevel>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <Culture>0x0416</Culture>
+ </ResourceCompile>
+ <Link>
+ <AdditionalDependencies>foobar2000\shared\shared.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <ModuleDefinitionFile>
+ </ModuleDefinitionFile>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <RandomizedBaseAddress>false</RandomizedBaseAddress>
+ <DataExecutionPrevention>
+ </DataExecutionPrevention>
+ <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
+ <TargetMachine>MachineX86</TargetMachine>
+ <AdditionalLibraryDirectories>$(SolutionDir)\lib</AdditionalLibraryDirectories>
+ </Link>
+ <Bscmake>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ </Bscmake>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClCompile Include="foo_mlt.cpp">
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="foobar2000\foobar2000_component_client\foobar2000_component_client_12.vcxproj">
+ <Project>{71ad2674-065b-48f5-b8b0-e1f9d3892081}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ <ProjectReference Include="foobar2000\helpers\foobar2000_sdk_helpers_12.vcxproj">
+ <Project>{ee47764e-a202-4f85-a767-abdab4aff35f}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ <ProjectReference Include="foobar2000\SDK\foobar2000_SDK_12.vcxproj">
+ <Project>{e8091321-d79d-4575-86ef-064ea1a4a20d}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ <ProjectReference Include="pfc\pfc_12.vcxproj">
+ <Project>{ebfffb4e-261d-44d3-b89c-957b31a0bf9c}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
\ No newline at end of file diff --git a/plugins/ListeningTo/src/players/foo_mlt/foo_mlt_14.vcxproj b/plugins/ListeningTo/src/players/foo_mlt/foo_mlt_14.vcxproj new file mode 100644 index 0000000000..adbd7ac8c3 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foo_mlt_14.vcxproj @@ -0,0 +1,162 @@ +<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectName>ListeningTo_foo_mlt</ProjectName>
+ <ProjectGuid>{94734E61-D980-4A5F-AAAA-65105755CE24}</ProjectGuid>
+ <RootNamespace>foo_mlt</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseOfMfc>false</UseOfMfc>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseOfMfc>false</UseOfMfc>
+ <CharacterSet>MultiByte</CharacterSet>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup>
+ <_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\Plugins\Listeningto\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\Obj\$(ProjectName)\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\Plugins\Listeningto\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\Obj\$(ProjectName)\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
+ <TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">foo_mlt</TargetName>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Midl>
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MkTypLibCompatible>true</MkTypLibCompatible>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <TargetEnvironment>Win32</TargetEnvironment>
+ <TypeLibraryName>.\Release/foo_mlt.tlb</TypeLibraryName>
+ <HeaderFileName>
+ </HeaderFileName>
+ </Midl>
+ <ClCompile>
+ <Optimization>MaxSpeed</Optimization>
+ <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
+ <PreprocessorDefinitions>NDEBUG;_WINDOWS;_USRDLL;UNICODE;_UNICODE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <StringPooling>true</StringPooling>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <WarningLevel>Level3</WarningLevel>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <AdditionalIncludeDirectories>..\..\..\..\ExternalAPI</AdditionalIncludeDirectories>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <Culture>0x0416</Culture>
+ </ResourceCompile>
+ <Link>
+ <AdditionalDependencies>foobar2000\shared\shared.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <ModuleDefinitionFile>
+ </ModuleDefinitionFile>
+ <RandomizedBaseAddress>false</RandomizedBaseAddress>
+ <DataExecutionPrevention>
+ </DataExecutionPrevention>
+ <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
+ <TargetMachine>MachineX86</TargetMachine>
+ <OptimizeReferences>true</OptimizeReferences>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <AdditionalLibraryDirectories>$(SolutionDir)\lib</AdditionalLibraryDirectories>
+ </Link>
+ <Bscmake>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ </Bscmake>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Midl>
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MkTypLibCompatible>true</MkTypLibCompatible>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <TargetEnvironment>Win32</TargetEnvironment>
+ <TypeLibraryName>.\Debug/foo_mlt.tlb</TypeLibraryName>
+ <HeaderFileName>
+ </HeaderFileName>
+ </Midl>
+ <ClCompile>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>_DEBUG;_WINDOWS;_USRDLL;UNICODE;_UNICODE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MinimalRebuild>true</MinimalRebuild>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+ <BrowseInformation>true</BrowseInformation>
+ <WarningLevel>Level3</WarningLevel>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <Culture>0x0416</Culture>
+ </ResourceCompile>
+ <Link>
+ <AdditionalDependencies>foobar2000\shared\shared.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <ModuleDefinitionFile>
+ </ModuleDefinitionFile>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <RandomizedBaseAddress>false</RandomizedBaseAddress>
+ <DataExecutionPrevention>
+ </DataExecutionPrevention>
+ <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
+ <TargetMachine>MachineX86</TargetMachine>
+ <AdditionalLibraryDirectories>$(SolutionDir)\lib</AdditionalLibraryDirectories>
+ </Link>
+ <Bscmake>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ </Bscmake>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClCompile Include="foo_mlt.cpp">
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="foobar2000\foobar2000_component_client\foobar2000_component_client_14.vcxproj">
+ <Project>{71ad2674-065b-48f5-b8b0-e1f9d3892081}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ <ProjectReference Include="foobar2000\helpers\foobar2000_sdk_helpers_14.vcxproj">
+ <Project>{ee47764e-a202-4f85-a767-abdab4aff35f}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ <ProjectReference Include="foobar2000\SDK\foobar2000_SDK_14.vcxproj">
+ <Project>{e8091321-d79d-4575-86ef-064ea1a4a20d}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ <ProjectReference Include="pfc\pfc_14.vcxproj">
+ <Project>{ebfffb4e-261d-44d3-b89c-957b31a0bf9c}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
\ No newline at end of file diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/abort_callback.cpp b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/abort_callback.cpp new file mode 100644 index 0000000000..affc69ff2d --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/abort_callback.cpp @@ -0,0 +1,17 @@ +#include "foobar2000.h"
+
+void abort_callback::check() const {
+ if (is_aborting()) throw exception_aborted();
+}
+
+void abort_callback::sleep(double p_timeout_seconds) const {
+ if (!sleep_ex(p_timeout_seconds)) throw exception_aborted();
+}
+
+bool abort_callback::sleep_ex(double p_timeout_seconds) const {
+#ifdef _WIN32
+ return !win32_event::g_wait_for(get_abort_event(),p_timeout_seconds);
+#else
+#error PORTME
+#endif
+}
\ No newline at end of file diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/abort_callback.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/abort_callback.h new file mode 100644 index 0000000000..0d6ea6ee63 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/abort_callback.h @@ -0,0 +1,80 @@ +#ifndef _foobar2000_sdk_abort_callback_h_
+#define _foobar2000_sdk_abort_callback_h_
+
+namespace foobar2000_io {
+
+PFC_DECLARE_EXCEPTION(exception_aborted,pfc::exception,"User abort");
+
+#ifdef _WIN32
+typedef HANDLE abort_callback_event;
+#else
+#error PORTME
+#endif
+
+//! This class is used to signal underlying worker code whether user has decided to abort a potentially time-consuming operation. It is commonly required by all file related operations. Code that receives an abort_callback object should periodically check it and abort any operations being performed if it is signaled, typically throwing exception_aborted. \n
+//! See abort_callback_impl for an implementation.
+class NOVTABLE abort_callback
+{
+public:
+ //! Returns whether user has requested the operation to be aborted.
+ virtual bool is_aborting() const = 0;
+
+ //! Retrieves event object that can be used with some OS calls. The even object becomes signaled when abort is triggered. On win32, this is equivalent to win32 event handle (see: CreateEvent). \n
+ //! You must not close this handle or call any methods that change this handle's state (SetEvent() or ResetEvent()), you can only wait for it.
+ virtual abort_callback_event get_abort_event() const = 0;
+
+ //! Checks if user has requested the operation to be aborted, and throws exception_aborted if so.
+ void check() const;
+
+ //! For compatibility with old code. Do not call.
+ inline void check_e() const {check();}
+
+
+ //! Sleeps p_timeout_seconds or less when aborted, throws exception_aborted on abort.
+ void sleep(double p_timeout_seconds) const;
+ //! Sleeps p_timeout_seconds or less when aborted, returns true when execution should continue, false when not.
+ bool sleep_ex(double p_timeout_seconds) const;
+protected:
+ abort_callback() {}
+ ~abort_callback() {}
+};
+
+
+
+//! Implementation of abort_callback interface.
+class abort_callback_impl : public abort_callback {
+public:
+ abort_callback_impl() : m_aborting(false) {
+ m_event.create(true,false);
+ }
+ inline void abort() {set_state(true);}
+ inline void reset() {set_state(false);}
+
+ void set_state(bool p_state) {m_aborting = p_state; m_event.set_state(p_state);}
+
+ bool is_aborting() const {return m_aborting;}
+
+ abort_callback_event get_abort_event() const {return m_event.get();}
+
+private:
+ abort_callback_impl(const abort_callback_impl &) {throw pfc::exception_not_implemented();}
+ const abort_callback_impl & operator=(const abort_callback_impl&) {throw pfc::exception_not_implemented();}
+
+ volatile bool m_aborting;
+#ifdef WIN32
+ win32_event m_event;
+#endif
+};
+
+//! Dummy abort_callback that never gets aborted. Slightly more efficient than the regular one especially when you need to regularly create temporary instances of it.
+class abort_callback_dummy : public abort_callback {
+public:
+ bool is_aborting() const { return false; }
+
+ abort_callback_event get_abort_event() const { return GetInfiniteWaitEvent();}
+};
+}
+
+using namespace foobar2000_io;
+
+#endif //_foobar2000_sdk_abort_callback_h_
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/advconfig.cpp b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/advconfig.cpp new file mode 100644 index 0000000000..301f82afc1 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/advconfig.cpp @@ -0,0 +1,39 @@ +#include "foobar2000.h"
+
+
+t_uint32 advconfig_entry::get_preferences_flags_() {
+ {
+ advconfig_entry_string_v2::ptr ex;
+ if (service_query_t(ex)) return ex->get_preferences_flags();
+ }
+ {
+ advconfig_entry_checkbox_v2::ptr ex;
+ if (service_query_t(ex)) return ex->get_preferences_flags();
+ }
+ return 0;
+}
+
+bool advconfig_entry_checkbox::get_default_state_() {
+ {
+ advconfig_entry_checkbox_v2::ptr ex;
+ if (service_query_t(ex)) return ex->get_default_state();
+ }
+
+ bool backup = get_state();
+ reset();
+ bool rv = get_state();
+ set_state(backup);
+ return rv;
+}
+
+void advconfig_entry_string::get_default_state_(pfc::string_base & out) {
+ {
+ advconfig_entry_string_v2::ptr ex;
+ if (service_query_t(ex)) {ex->get_default_state(out); return;}
+ }
+ pfc::string8 backup;
+ get_state(backup);
+ reset();
+ get_state(out);
+ set_state(backup);
+}
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/advconfig.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/advconfig.h new file mode 100644 index 0000000000..60961ec7ef --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/advconfig.h @@ -0,0 +1,304 @@ +//! Entrypoint class for adding items to Advanced Preferences page. \n
+//! Implementations must derive from one of subclasses: advconfig_branch, advconfig_entry_checkbox, advconfig_entry_string. \n
+//! Implementations are typically registered using static service_factory_single_t<myclass>, or using provided helper classes in case of standard implementations declared in this header.
+class NOVTABLE advconfig_entry : public service_base {
+public:
+ virtual void get_name(pfc::string_base & p_out) = 0;
+ virtual GUID get_guid() = 0;
+ virtual GUID get_parent() = 0;
+ virtual void reset() = 0;
+ virtual double get_sort_priority() = 0;
+
+ t_uint32 get_preferences_flags_();
+
+ static bool g_find(service_ptr_t<advconfig_entry>& out, const GUID & id) {
+ service_enum_t<advconfig_entry> e; service_ptr_t<advconfig_entry> ptr; while(e.next(ptr)) { if (ptr->get_guid() == id) {out = ptr; return true;} } return false;
+ }
+
+ static const GUID guid_root;
+ static const GUID guid_branch_tagging,guid_branch_decoding,guid_branch_tools,guid_branch_playback,guid_branch_display;
+
+ FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(advconfig_entry);
+};
+
+//! Creates a new branch in Advanced Preferences. \n
+//! Implementation: see advconfig_branch_impl / advconfig_branch_factory.
+class NOVTABLE advconfig_branch : public advconfig_entry {
+public:
+ FB2K_MAKE_SERVICE_INTERFACE(advconfig_branch,advconfig_entry);
+};
+
+//! Creates a checkbox/radiocheckbox entry in Advanced Preferences. \n
+//! The difference between checkboxes and radiocheckboxes is different icon (obviously) and that checking a radiocheckbox unchecks all other radiocheckboxes in the same branch. \n
+//! Implementation: see advconfig_entry_checkbox_impl / advconfig_checkbox_factory_t.
+class NOVTABLE advconfig_entry_checkbox : public advconfig_entry {
+public:
+ virtual bool get_state() = 0;
+ virtual void set_state(bool p_state) = 0;
+ virtual bool is_radio() = 0;
+
+ bool get_default_state_();
+
+ FB2K_MAKE_SERVICE_INTERFACE(advconfig_entry_checkbox,advconfig_entry);
+};
+
+class NOVTABLE advconfig_entry_checkbox_v2 : public advconfig_entry_checkbox {
+ FB2K_MAKE_SERVICE_INTERFACE(advconfig_entry_checkbox_v2, advconfig_entry_checkbox)
+public:
+ virtual bool get_default_state() = 0;
+ virtual t_uint32 get_preferences_flags() {return 0;} //signals whether changing this setting should trigger playback restart or app restart; see: preferences_state::* constants
+};
+
+//! Creates a string/integer editbox entry in Advanced Preferences.\n
+//! Implementation: see advconfig_entry_string_impl / advconfig_string_factory.
+class NOVTABLE advconfig_entry_string : public advconfig_entry {
+public:
+ virtual void get_state(pfc::string_base & p_out) = 0;
+ virtual void set_state(const char * p_string,t_size p_length = ~0) = 0;
+ virtual t_uint32 get_flags() = 0;
+
+ void get_default_state_(pfc::string_base & out);
+
+ enum {
+ flag_is_integer = 1 << 0,
+ flag_is_signed = 1 << 1,
+ };
+
+ FB2K_MAKE_SERVICE_INTERFACE(advconfig_entry_string,advconfig_entry);
+};
+
+class NOVTABLE advconfig_entry_string_v2 : public advconfig_entry_string {
+ FB2K_MAKE_SERVICE_INTERFACE(advconfig_entry_string_v2, advconfig_entry_string)
+public:
+ virtual void get_default_state(pfc::string_base & out) = 0;
+ virtual void validate(pfc::string_base & val) {}
+ virtual t_uint32 get_preferences_flags() {return 0;} //signals whether changing this setting should trigger playback restart or app restart; see: preferences_state::* constants
+};
+
+
+//! Standard implementation of advconfig_branch. \n
+//! Usage: no need to use this class directly - use advconfig_branch_factory instead.
+class advconfig_branch_impl : public advconfig_branch {
+public:
+ advconfig_branch_impl(const char * p_name,const GUID & p_guid,const GUID & p_parent,double p_priority) : m_name(p_name), m_guid(p_guid), m_parent(p_parent), m_priority(p_priority) {}
+ void get_name(pfc::string_base & p_out) {p_out = m_name;}
+ GUID get_guid() {return m_guid;}
+ GUID get_parent() {return m_parent;}
+ void reset() {}
+ double get_sort_priority() {return m_priority;}
+private:
+ pfc::string8 m_name;
+ GUID m_guid,m_parent;
+ const double m_priority;
+};
+
+//! Standard implementation of advconfig_entry_checkbox. \n
+//! p_is_radio parameter controls whether we're implementing a checkbox or a radiocheckbox (see advconfig_entry_checkbox description for more details).
+template<bool p_is_radio = false>
+class advconfig_entry_checkbox_impl : public advconfig_entry_checkbox_v2 {
+public:
+ advconfig_entry_checkbox_impl(const char * p_name,const GUID & p_guid,const GUID & p_parent,double p_priority,bool p_initialstate)
+ : m_name(p_name), m_initialstate(p_initialstate), m_state(p_guid,p_initialstate), m_parent(p_parent), m_priority(p_priority) {}
+
+ void get_name(pfc::string_base & p_out) {p_out = m_name;}
+ GUID get_guid() {return m_state.get_guid();}
+ GUID get_parent() {return m_parent;}
+ void reset() {m_state = m_initialstate;}
+ bool get_state() {return m_state;}
+ void set_state(bool p_state) {m_state = p_state;}
+ bool is_radio() {return p_is_radio;}
+ double get_sort_priority() {return m_priority;}
+ bool get_state_() const {return m_state;}
+ bool get_default_state() {return m_initialstate;}
+ bool get_default_state_() const {return m_initialstate;}
+private:
+ pfc::string8 m_name;
+ const bool m_initialstate;
+ cfg_bool m_state;
+ GUID m_parent;
+ const double m_priority;
+};
+
+//! Service factory helper around standard advconfig_branch implementation. Use this class to register your own Advanced Preferences branches. \n
+//! Usage: static advconfig_branch_factory mybranch(name, branchID, parentBranchID, priority);
+class advconfig_branch_factory : public service_factory_single_t<advconfig_branch_impl> {
+public:
+ advconfig_branch_factory(const char * p_name,const GUID & p_guid,const GUID & p_parent,double p_priority)
+ : service_factory_single_t<advconfig_branch_impl>(p_name,p_guid,p_parent,p_priority) {}
+};
+
+//! Service factory helper around standard advconfig_entry_checkbox implementation. Use this class to register your own Advanced Preferences checkbox/radiocheckbox entries. \n
+//! Usage: static advconfig_entry_checkbox<isRadioBox> mybox(name, itemID, parentID, priority, initialstate);
+template<bool p_is_radio>
+class advconfig_checkbox_factory_t : public service_factory_single_t<advconfig_entry_checkbox_impl<p_is_radio> > {
+public:
+ advconfig_checkbox_factory_t(const char * p_name,const GUID & p_guid,const GUID & p_parent,double p_priority,bool p_initialstate)
+ : service_factory_single_t<advconfig_entry_checkbox_impl<p_is_radio> >(p_name,p_guid,p_parent,p_priority,p_initialstate) {}
+
+ bool get() const {return get_static_instance().get_state_();}
+ void set(bool val) {get_static_instance().set_state(val);}
+ operator bool() const {return get();}
+ bool operator=(bool val) {set(val); return val;}
+};
+
+//! Service factory helper around standard advconfig_entry_checkbox implementation, specialized for checkboxes (rather than radiocheckboxes). See advconfig_checkbox_factory_t<> for more details.
+typedef advconfig_checkbox_factory_t<false> advconfig_checkbox_factory;
+//! Service factory helper around standard advconfig_entry_checkbox implementation, specialized for radiocheckboxes (rather than standard checkboxes). See advconfig_checkbox_factory_t<> for more details.
+typedef advconfig_checkbox_factory_t<true> advconfig_radio_factory;
+
+
+//! Standard advconfig_entry_string implementation. Use advconfig_string_factory to register your own string entries in Advanced Preferences instead of using this class directly.
+class advconfig_entry_string_impl : public advconfig_entry_string_v2 {
+public:
+ advconfig_entry_string_impl(const char * p_name,const GUID & p_guid,const GUID & p_parent,double p_priority,const char * p_initialstate, t_uint32 p_prefFlags)
+ : m_name(p_name), m_parent(p_parent), m_priority(p_priority), m_initialstate(p_initialstate), m_state(p_guid,p_initialstate), m_prefFlags(p_prefFlags) {}
+ void get_name(pfc::string_base & p_out) {p_out = m_name;}
+ GUID get_guid() {return m_state.get_guid();}
+ GUID get_parent() {return m_parent;}
+ void reset() {core_api::ensure_main_thread();m_state = m_initialstate;}
+ double get_sort_priority() {return m_priority;}
+ void get_state(pfc::string_base & p_out) {core_api::ensure_main_thread();p_out = m_state;}
+ void set_state(const char * p_string,t_size p_length = ~0) {core_api::ensure_main_thread();m_state.set_string(p_string,p_length);}
+ t_uint32 get_flags() {return 0;}
+ void get_default_state(pfc::string_base & out) {out = m_initialstate;}
+ t_uint32 get_preferences_flags() {return m_prefFlags;}
+private:
+ const pfc::string8 m_initialstate, m_name;
+ cfg_string m_state;
+ const double m_priority;
+ const GUID m_parent;
+ const t_uint32 m_prefFlags;
+};
+
+//! Service factory helper around standard advconfig_entry_string implementation. Use this class to register your own string entries in Advanced Preferences. \n
+//! Usage: static advconfig_string_factory mystring(name, itemID, branchID, priority, initialValue);
+class advconfig_string_factory : public service_factory_single_t<advconfig_entry_string_impl> {
+public:
+ advconfig_string_factory(const char * p_name,const GUID & p_guid,const GUID & p_parent,double p_priority,const char * p_initialstate, t_uint32 p_prefFlags = 0)
+ : service_factory_single_t<advconfig_entry_string_impl>(p_name,p_guid,p_parent,p_priority,p_initialstate, p_prefFlags) {}
+
+ void get(pfc::string_base & out) {get_static_instance().get_state(out);}
+ void set(const char * in) {get_static_instance().set_state(in);}
+};
+
+
+//! Special advconfig_entry_string implementation - implements integer entries. Use advconfig_integer_factory to register your own integer entries in Advanced Preferences instead of using this class directly.
+class advconfig_entry_integer_impl : public advconfig_entry_string_v2 {
+public:
+ advconfig_entry_integer_impl(const char * p_name,const GUID & p_guid,const GUID & p_parent,double p_priority,t_uint64 p_initialstate,t_uint64 p_min,t_uint64 p_max, t_uint32 p_prefFlags)
+ : m_name(p_name), m_parent(p_parent), m_priority(p_priority), m_initval(p_initialstate), m_min(p_min), m_max(p_max), m_state(p_guid,p_initialstate), m_prefFlags(p_prefFlags) {}
+ void get_name(pfc::string_base & p_out) {p_out = m_name;}
+ GUID get_guid() {return m_state.get_guid();}
+ GUID get_parent() {return m_parent;}
+ void reset() {m_state = m_initval;}
+ double get_sort_priority() {return m_priority;}
+ void get_state(pfc::string_base & p_out) {p_out = pfc::format_uint(m_state.get_value());}
+ void set_state(const char * p_string,t_size p_length) {set_state_int(pfc::atoui64_ex(p_string,p_length));}
+ t_uint32 get_flags() {return advconfig_entry_string::flag_is_integer;}
+
+ t_uint64 get_state_int() const {return m_state;}
+ void set_state_int(t_uint64 val) {m_state = pfc::clip_t<t_uint64>(val,m_min,m_max);}
+
+ void get_default_state(pfc::string_base & out) {
+ out = pfc::format_uint(m_initval);
+ }
+ void validate(pfc::string_base & val) {
+ val = pfc::format_uint( pfc::clip_t<t_uint64>(pfc::atoui64_ex(val,~0), m_min, m_max) );
+ }
+ t_uint32 get_preferences_flags() {return m_prefFlags;}
+private:
+ cfg_int_t<t_uint64> m_state;
+ const double m_priority;
+ const t_uint64 m_initval, m_min, m_max;
+ const GUID m_parent;
+ const pfc::string8 m_name;
+ const t_uint32 m_prefFlags;
+};
+
+//! Service factory helper around integer-specialized advconfig_entry_string implementation. Use this class to register your own integer entries in Advanced Preferences. \n
+//! Usage: static advconfig_integer_factory myint(name, itemID, parentID, priority, initialValue, minValue, maxValue);
+class advconfig_integer_factory : public service_factory_single_t<advconfig_entry_integer_impl> {
+public:
+ advconfig_integer_factory(const char * p_name,const GUID & p_guid,const GUID & p_parent,double p_priority,t_uint64 p_initialstate,t_uint64 p_min,t_uint64 p_max, t_uint32 p_prefFlags = 0)
+ : service_factory_single_t<advconfig_entry_integer_impl>(p_name,p_guid,p_parent,p_priority,p_initialstate,p_min,p_max,p_prefFlags) {}
+
+ t_uint64 get() const {return get_static_instance().get_state_int();}
+ void set(t_uint64 val) {get_static_instance().set_state_int(val);}
+
+ operator t_uint64() const {return get();}
+ t_uint64 operator=(t_uint64 val) {set(val); return val;}
+};
+
+
+//! Not currently used, reserved for future use.
+class NOVTABLE advconfig_entry_enum : public advconfig_entry {
+public:
+ virtual t_size get_value_count() = 0;
+ virtual void enum_value(pfc::string_base & p_out,t_size p_index) = 0;
+ virtual t_size get_state() = 0;
+ virtual void set_state(t_size p_value) = 0;
+
+ FB2K_MAKE_SERVICE_INTERFACE(advconfig_entry_enum,advconfig_entry);
+};
+
+
+
+
+//! Special version if advconfig_entry_string_impl that allows the value to be retrieved from worker threads.
+class advconfig_entry_string_impl_MT : public advconfig_entry_string_v2 {
+public:
+ advconfig_entry_string_impl_MT(const char * p_name,const GUID & p_guid,const GUID & p_parent,double p_priority,const char * p_initialstate, t_uint32 p_prefFlags)
+ : m_name(p_name), m_parent(p_parent), m_priority(p_priority), m_initialstate(p_initialstate), m_state(p_guid,p_initialstate), m_prefFlags(p_prefFlags) {}
+ void get_name(pfc::string_base & p_out) {p_out = m_name;}
+ GUID get_guid() {return m_state.get_guid();}
+ GUID get_parent() {return m_parent;}
+ void reset() {
+ insync(m_sync);
+ m_state = m_initialstate;
+ }
+ double get_sort_priority() {return m_priority;}
+ void get_state(pfc::string_base & p_out) {
+ insync(m_sync);
+ p_out = m_state;
+ }
+ void set_state(const char * p_string,t_size p_length = ~0) {
+ insync(m_sync);
+ m_state.set_string(p_string,p_length);
+ }
+ t_uint32 get_flags() {return 0;}
+ void get_default_state(pfc::string_base & out) {out = m_initialstate;}
+ t_uint32 get_preferences_flags() {return m_prefFlags;}
+private:
+ const pfc::string8 m_initialstate, m_name;
+ cfg_string m_state;
+ critical_section m_sync;
+ const double m_priority;
+ const GUID m_parent;
+ const t_uint32 m_prefFlags;
+};
+
+//! Special version if advconfig_string_factory that allows the value to be retrieved from worker threads.
+class advconfig_string_factory_MT : public service_factory_single_t<advconfig_entry_string_impl_MT> {
+public:
+ advconfig_string_factory_MT(const char * p_name,const GUID & p_guid,const GUID & p_parent,double p_priority,const char * p_initialstate, t_uint32 p_prefFlags = 0)
+ : service_factory_single_t<advconfig_entry_string_impl_MT>(p_name,p_guid,p_parent,p_priority,p_initialstate, p_prefFlags) {}
+
+ void get(pfc::string_base & out) {get_static_instance().get_state(out);}
+ void set(const char * in) {get_static_instance().set_state(in);}
+};
+
+
+
+
+/*
+ Advanced Preferences variable declaration examples
+
+ static advconfig_string_factory mystring("name goes here",myguid,parentguid,0,"asdf");
+ to retrieve state: pfc::string8 val; mystring.get(val);
+
+ static advconfig_checkbox_factory mycheckbox("name goes here",myguid,parentguid,0,false);
+ to retrieve state: mycheckbox.get();
+
+ static advconfig_integer_factory myint("name goes here",myguid,parentguid,0,initialValue,minimumValue,maximumValue);
+ to retrieve state: myint.get();
+*/
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/album_art.cpp b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/album_art.cpp new file mode 100644 index 0000000000..1fea648a0e --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/album_art.cpp @@ -0,0 +1,17 @@ +#include "foobar2000.h"
+
+bool album_art_editor::g_get_interface(service_ptr_t<album_art_editor> & out,const char * path) {
+ service_enum_t<album_art_editor> e; ptr ptr;
+ pfc::string_extension ext(path);
+ while(e.next(ptr)) {
+ if (ptr->is_our_path(path,ext)) {
+ out = ptr; return true;
+ }
+ }
+ return false;
+}
+
+bool album_art_editor::g_is_supported_path(const char * path) {
+ ptr ptr;
+ return g_get_interface(ptr,path);
+}
\ No newline at end of file diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/album_art.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/album_art.h new file mode 100644 index 0000000000..12ba9287a1 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/album_art.h @@ -0,0 +1,313 @@ +//! Common class for handling picture data. \n
+//! Type of contained picture data is unknown and to be determined according to memory block contents by code parsing/rendering the picture. Commonly encountered types are: BMP, PNG, JPEG and GIF. \n
+//! Implementation: use album_art_data_impl.
+class NOVTABLE album_art_data : public service_base {
+public:
+ //! Retrieves a pointer to a memory block containing the picture.
+ virtual const void * get_ptr() const = 0;
+ //! Retrieves size of the memory block containing the picture.
+ virtual t_size get_size() const = 0;
+
+ //! Determine whether two album_art_data objects store the same picture data.
+ static bool equals(album_art_data const & v1, album_art_data const & v2) {
+ const t_size s = v1.get_size();
+ if (s != v2.get_size()) return false;
+ return memcmp(v1.get_ptr(), v2.get_ptr(),s) == 0;
+ }
+ bool operator==(const album_art_data & other) const {return equals(*this,other);}
+ bool operator!=(const album_art_data & other) const {return !equals(*this,other);}
+
+ FB2K_MAKE_SERVICE_INTERFACE(album_art_data,service_base);
+};
+
+typedef service_ptr_t<album_art_data> album_art_data_ptr;
+
+//! Implements album_art_data.
+class album_art_data_impl : public album_art_data {
+public:
+ const void * get_ptr() const {return m_content.get_ptr();}
+ t_size get_size() const {return m_content.get_size();}
+
+ void * get_ptr() {return m_content.get_ptr();}
+ void set_size(t_size p_size) {m_content.set_size(p_size);}
+
+ //! Reads picture data from the specified stream object.
+ void from_stream(stream_reader * p_stream,t_size p_bytes,abort_callback & p_abort) {
+ set_size(p_bytes); p_stream->read_object(get_ptr(),p_bytes,p_abort);
+ }
+
+ //! Creates an album_art_data object from picture data contained in a memory buffer.
+ static album_art_data_ptr g_create(const void * p_buffer,t_size p_bytes) {
+ service_ptr_t<album_art_data_impl> instance = new service_impl_t<album_art_data_impl>();
+ instance->set_size(p_bytes);
+ memcpy(instance->get_ptr(),p_buffer,p_bytes);
+ return instance;
+ }
+ //! Creates an album_art_data object from picture data contained in a stream.
+ static album_art_data_ptr g_create(stream_reader * p_stream,t_size p_bytes,abort_callback & p_abort) {
+ service_ptr_t<album_art_data_impl> instance = new service_impl_t<album_art_data_impl>();
+ instance->from_stream(p_stream,p_bytes,p_abort);
+ return instance;
+ }
+
+private:
+ pfc::array_t<t_uint8> m_content;
+};
+
+//! Namespace containing identifiers of album art types.
+namespace album_art_ids {
+ //! Front cover.
+ static const GUID cover_front = { 0xf1e66f4e, 0xfe09, 0x4b94, { 0x91, 0xa3, 0x67, 0xc2, 0x3e, 0xd1, 0x44, 0x5e } };
+ //! Back cover.
+ static const GUID cover_back = { 0xcb552d19, 0x86d5, 0x434c, { 0xac, 0x77, 0xbb, 0x24, 0xed, 0x56, 0x7e, 0xe4 } };
+ //! Picture of a disc or other storage media.
+ static const GUID disc = { 0x3dba9f36, 0xf928, 0x4fa4, { 0x87, 0x9c, 0xd3, 0x40, 0x47, 0x59, 0x58, 0x7e } };
+ //! Album-specific icon (NOT a file type icon).
+ static const GUID icon = { 0x74cdf5b4, 0x7053, 0x4b3d, { 0x9a, 0x3c, 0x54, 0x69, 0xf5, 0x82, 0x6e, 0xec } };
+ //! Artist picture.
+ static const GUID artist = { 0x9a654042, 0xacd1, 0x43f7, { 0xbf, 0xcf, 0xd3, 0xec, 0xf, 0xfe, 0x40, 0xfa } };
+
+};
+
+PFC_DECLARE_EXCEPTION(exception_album_art_not_found,exception_io_not_found,"Album Art Not Found");
+PFC_DECLARE_EXCEPTION(exception_album_art_unsupported_entry,exception_io_data,"Unsupported Album Art Entry");
+
+//! Class encapsulating access to album art stored in a media file. Use album_art_extractor class obtain album_art_extractor_instance referring to specified media file.
+class NOVTABLE album_art_extractor_instance : public service_base {
+public:
+ //! Throws exception_album_art_not_found when the requested album art entry could not be found in the referenced media file.
+ virtual album_art_data_ptr query(const GUID & p_what,abort_callback & p_abort) = 0;
+
+ FB2K_MAKE_SERVICE_INTERFACE(album_art_extractor_instance,service_base);
+};
+
+//! Class encapsulating access to album art stored in a media file. Use album_art_editor class to obtain album_art_editor_instance referring to specified media file.
+class NOVTABLE album_art_editor_instance : public album_art_extractor_instance {
+public:
+ //! Throws exception_album_art_unsupported_entry when the file format we're dealing with does not support specific entry.
+ virtual void set(const GUID & p_what,album_art_data_ptr p_data,abort_callback & p_abort) = 0;
+
+ //! Removes the requested entry. Fails silently when the entry doesn't exist.
+ virtual void remove(const GUID & p_what) = 0;
+
+ //! Finalizes file tag update operation.
+ virtual void commit(abort_callback & p_abort) = 0;
+
+
+ FB2K_MAKE_SERVICE_INTERFACE(album_art_editor_instance,album_art_extractor_instance);
+};
+
+typedef service_ptr_t<album_art_extractor_instance> album_art_extractor_instance_ptr;
+typedef service_ptr_t<album_art_editor_instance> album_art_editor_instance_ptr;
+
+//! Entrypoint class for accessing album art extraction functionality. Register your own implementation to allow album art extraction from your media file format. \n
+//! If you want to extract album art from a media file, it's recommended that you use album_art_manager API instead of calling album_art_extractor directly.
+class NOVTABLE album_art_extractor : public service_base {
+public:
+ //! Returns whether the specified file is one of formats supported by our album_art_extractor implementation.
+ //! @param p_path Path to file being queried.
+ //! @param p_extension Extension of file being queried (also present in p_path parameter) - provided as a separate parameter for performance reasons.
+ virtual bool is_our_path(const char * p_path,const char * p_extension) = 0;
+
+ //! Instantiates album_art_extractor_instance providing access to album art stored in a specified media file. \n
+ //! Throws one of I/O exceptions on failure; exception_album_art_not_found when the file has no album art record at all.
+ //! @param p_filehint Optional; specifies a file interface to use for accessing the specified file; can be null - in that case, the implementation will open and close the file internally.
+ virtual album_art_extractor_instance_ptr open(file_ptr p_filehint,const char * p_path,abort_callback & p_abort) = 0;
+
+ FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(album_art_extractor);
+};
+
+//! Entrypoint class for accessing album art editing functionality. Register your own implementation to allow album art editing on your media file format.
+class NOVTABLE album_art_editor : public service_base {
+public:
+ //! Returns whether the specified file is one of formats supported by our album_art_editor implementation.
+ //! @param p_path Path to file being queried.
+ //! @param p_extension Extension of file being queried (also present in p_path parameter) - provided as a separate parameter for performance reasons.
+ virtual bool is_our_path(const char * p_path,const char * p_extension) = 0;
+
+ //! Instantiates album_art_editor_instance providing access to album art stored in a specified media file. \n
+ //! @param p_filehint Optional; specifies a file interface to use for accessing the specified file; can be null - in that case, the implementation will open and close the file internally.
+ virtual album_art_editor_instance_ptr open(file_ptr p_filehint,const char * p_path,abort_callback & p_abort) = 0;
+
+ //! Helper; attempts to retrieve an album_art_editor service pointer that supports the specified file.
+ //! @returns True on success, false on failure (no registered album_art_editor supports this file type).
+ static bool g_get_interface(service_ptr_t<album_art_editor> & out,const char * path);
+ //! Helper; returns whether one of registered album_art_editor implementations is capable of opening the specified file.
+ static bool g_is_supported_path(const char * path);
+
+ FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(album_art_editor);
+};
+
+//! Primary API for interfacing with foobar2000 core's album art extraction functionality. \n
+//! Use static_api_ptr_t<album_art_manager>()->instantiate() to obtain a pointer to album_art_manager_instance. \n
+//! The main difference between using album_art_manager_instance and calling album_art_extractor methods directly is that
+//! album_art_manager_instance will fall back to returning pictures found in the folder containing the specified media file
+//! in case requested album art entries can't be extracted from the media file itself.
+class NOVTABLE album_art_manager_instance : public service_base {
+public:
+ //! @returns True when the newly requested file has different album art than the old one, false when album art we're referencing is the same as before.
+ virtual bool open(const char * p_file,abort_callback & p_abort) = 0;
+ //! Resets internal data.
+ virtual void close() = 0;
+
+ //! Queries album art data for currently open media file. Throws exception_album_art_not_found when the requested album art entry isn't present.
+ virtual album_art_data_ptr query(const GUID & p_what,abort_callback & p_abort) = 0;
+
+ //! Queries for stub image to display when there's no album art to show. \n
+ //! May fail with exception_album_art_not_found as well when we have no stub image configured.
+ virtual album_art_data_ptr query_stub_image(abort_callback & p_abort) = 0;
+
+ FB2K_MAKE_SERVICE_INTERFACE(album_art_manager_instance,service_base);
+};
+
+typedef service_ptr_t<album_art_manager_instance> album_art_manager_instance_ptr;
+
+//! Entrypoint API for accessing album art loading functionality provided by foobar2000 core. Usage: static_api_ptr_t<album_art_manager>. \n
+//! This API was introduced in 0.9.5.
+class NOVTABLE album_art_manager : public service_base {
+public:
+ virtual album_art_manager_instance_ptr instantiate() = 0;
+
+ FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(album_art_manager);
+};
+
+
+//! Helper - simple implementation of album_art_extractor_instance.
+class album_art_extractor_instance_simple : public album_art_extractor_instance {
+public:
+ void set(const GUID & p_what,album_art_data_ptr p_content) {m_content.set(p_what,p_content);}
+ bool have_item(const GUID & p_what) {return m_content.have_item(p_what);}
+ album_art_data_ptr query(const GUID & p_what,abort_callback & p_abort) {
+ album_art_data_ptr temp;
+ if (!m_content.query(p_what,temp)) throw exception_album_art_not_found();
+ return temp;
+ }
+ bool is_empty() const {return m_content.get_count() == 0;}
+ bool remove(const GUID & p_what) {
+ return m_content.remove(p_what);
+ }
+private:
+ pfc::map_t<GUID,album_art_data_ptr> m_content;
+};
+
+//! Helper API for extracting album art from APEv2 tags - introduced in 0.9.5.
+class NOVTABLE tag_processor_album_art_utils : public service_base {
+public:
+
+ //! Throws one of I/O exceptions on failure; exception_album_art_not_found when the file has no album art record at all.
+ virtual album_art_extractor_instance_ptr open(file_ptr p_file,abort_callback & p_abort) = 0;
+
+ //! Currently not implemented. Reserved for future use.
+ virtual album_art_editor_instance_ptr edit(file_ptr p_file,abort_callback & p_abort) = 0;
+
+ FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(tag_processor_album_art_utils)
+};
+
+//! Helper implementation of album_art_extractor - reads album art from arbitrary file formats that comply with APEv2 tagging specification.
+class album_art_extractor_impl_stdtags : public album_art_extractor {
+public:
+ //! @param exts Semicolon-separated list of file format extensions to support.
+ album_art_extractor_impl_stdtags(const char * exts) {
+ pfc::splitStringSimple_toList(m_extensions,';',exts);
+ }
+
+ bool is_our_path(const char * p_path,const char * p_extension) {
+ return m_extensions.have_item(p_extension);
+ }
+
+ album_art_extractor_instance_ptr open(file_ptr p_filehint,const char * p_path,abort_callback & p_abort) {
+ PFC_ASSERT( is_our_path(p_path, pfc::string_extension(p_path) ) );
+ file_ptr l_file ( p_filehint );
+ if (l_file.is_empty()) filesystem::g_open_read(l_file, p_path, p_abort);
+ return static_api_ptr_t<tag_processor_album_art_utils>()->open( l_file, p_abort );
+ }
+private:
+ pfc::avltree_t<pfc::string,pfc::string::comparatorCaseInsensitiveASCII> m_extensions;
+};
+
+
+
+//! Helper - a more advanced implementation of album_art_extractor_instance.
+class album_art_extractor_instance_fileref : public album_art_extractor_instance {
+public:
+ album_art_extractor_instance_fileref(file::ptr f) : m_file(f) {}
+
+ void set(const GUID & p_what,t_filesize p_offset, t_filesize p_size) {
+ const t_fileref ref = {p_offset, p_size};
+ m_data.set(p_what, ref);
+ m_cache.remove(p_what);
+ }
+
+ bool have_item(const GUID & p_what) {
+ return m_data.have_item(p_what);
+ }
+
+ album_art_data_ptr query(const GUID & p_what,abort_callback & p_abort) {
+ album_art_data_ptr item;
+ if (m_cache.query(p_what,item)) return item;
+ t_fileref ref;
+ if (!m_data.query(p_what, ref)) throw exception_album_art_not_found();
+ m_file->seek(ref.m_offset, p_abort);
+ item = album_art_data_impl::g_create(m_file.get_ptr(), pfc::downcast_guarded<t_size>(ref.m_size), p_abort);
+ m_cache.set(p_what, item);
+ return item;
+ }
+ bool is_empty() const {return m_data.get_count() == 0;}
+private:
+ struct t_fileref {
+ t_filesize m_offset, m_size;
+ };
+ const file::ptr m_file;
+ pfc::map_t<GUID, t_fileref> m_data;
+ pfc::map_t<GUID, album_art_data::ptr> m_cache;
+};
+
+
+class NOVTABLE album_art_path_list : public service_base {
+ FB2K_MAKE_SERVICE_INTERFACE(album_art_path_list, service_base)
+public:
+ virtual const char * get_path(t_size index) const = 0;
+ virtual t_size get_count() const = 0;
+};
+
+class album_art_path_list_impl : public album_art_path_list {
+public:
+ template<typename t_in> album_art_path_list_impl(const t_in & in) {pfc::list_to_array(m_data, in);}
+ const char * get_path(t_size index) const {return m_data[index];}
+ t_size get_count() const {return m_data.get_size();}
+private:
+ pfc::array_t<pfc::string8> m_data;
+};
+
+class album_art_path_list_dummy : public album_art_path_list {
+public:
+ const char * get_path(t_size index) const {uBugCheck();}
+ t_size get_count() const {return 0;}
+};
+
+class NOVTABLE album_art_extractor_instance_v2 : public album_art_extractor_instance {
+ FB2K_MAKE_SERVICE_INTERFACE(album_art_extractor_instance_v2, album_art_extractor_instance)
+public:
+ virtual album_art_path_list::ptr query_paths(const GUID & p_what, abort_callback & p_abort) = 0;
+};
+
+
+
+//! \since 1.0
+class NOVTABLE album_art_manager_v2 : public service_base {
+ FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(album_art_manager_v2)
+public:
+ //! Instantiates an album art extractor object for the specified group of items.
+ virtual album_art_extractor_instance_v2::ptr open(metadb_handle_list_cref items, pfc::list_base_const_t<GUID> const & ids, abort_callback & abort) = 0;
+
+ //! Instantiates an album art extractor object that retrieves stub images.
+ virtual album_art_extractor_instance_v2::ptr open_stub(abort_callback & abort) = 0;
+};
+
+
+//! \since 1.0
+class NOVTABLE album_art_fallback : public service_base {
+ FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(album_art_fallback)
+public:
+ virtual album_art_extractor_instance_v2::ptr open(metadb_handle_list_cref items, pfc::list_base_const_t<GUID> const & ids, abort_callback & abort) = 0;
+};
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/app_close_blocker.cpp b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/app_close_blocker.cpp new file mode 100644 index 0000000000..6611e0b568 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/app_close_blocker.cpp @@ -0,0 +1,12 @@ +#include "foobar2000.h"
+
+bool app_close_blocker::g_query()
+{
+ service_ptr_t<app_close_blocker> ptr;
+ service_enum_t<app_close_blocker> e;
+ while(e.next(ptr))
+ {
+ if (!ptr->query()) return false;
+ }
+ return true;
+}
\ No newline at end of file diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/app_close_blocker.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/app_close_blocker.h new file mode 100644 index 0000000000..10437d875f --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/app_close_blocker.h @@ -0,0 +1,65 @@ +//! (DEPRECATED) This service is used to signal whether something is currently preventing main window from being closed and app from being shut down.
+class NOVTABLE app_close_blocker : public service_base
+{
+public:
+ //! Checks whether this service is currently preventing main window from being closed and app from being shut down.
+ virtual bool query() = 0;
+
+ //! Static helper function, checks whether any of registered app_close_blocker services is currently preventing main window from being closed and app from being shut down.
+ static bool g_query();
+
+ FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(app_close_blocker);
+};
+
+//! An interface encapsulating a task preventing the foobar2000 application from being closed. Instances of this class need to be registered using app_close_blocking_task_manager methods. \n
+//! Implementation: it's recommended that you derive from app_close_blocking_task_impl class instead of deriving from app_close_blocking_task directly, it manages registration/unregistration behind-the-scenes.
+class NOVTABLE app_close_blocking_task {
+public:
+ virtual void query_task_name(pfc::string_base & out) = 0;
+
+protected:
+ app_close_blocking_task() {}
+ ~app_close_blocking_task() {}
+
+ PFC_CLASS_NOT_COPYABLE_EX(app_close_blocking_task);
+};
+
+//! Entrypoint class for registering app_close_blocking_task instances. Introduced in 0.9.5.1. \n
+//! Usage: static_api_ptr_t<app_close_blocking_task_manager>(). May fail if user runs pre-0.9.5.1. It's recommended that you use app_close_blocking_task_impl class instead of calling app_close_blocking_task_manager directly.
+class NOVTABLE app_close_blocking_task_manager : public service_base {
+public:
+ virtual void register_task(app_close_blocking_task * task) = 0;
+ virtual void unregister_task(app_close_blocking_task * task) = 0;
+
+
+ FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(app_close_blocking_task_manager);
+};
+
+//! Helper; implements standard functionality required by app_close_blocking_task implementations - registers/unregisters the task on construction/destruction.
+class app_close_blocking_task_impl : public app_close_blocking_task {
+public:
+ app_close_blocking_task_impl() { static_api_ptr_t<app_close_blocking_task_manager>()->register_task(this);}
+ ~app_close_blocking_task_impl() { static_api_ptr_t<app_close_blocking_task_manager>()->unregister_task(this);}
+
+ void query_task_name(pfc::string_base & out) { out = "<unnamed task>"; }
+};
+
+class app_close_blocking_task_impl_dynamic : public app_close_blocking_task {
+public:
+ app_close_blocking_task_impl_dynamic() : m_taskActive() {}
+ ~app_close_blocking_task_impl_dynamic() { toggle_blocking(false); }
+
+ void query_task_name(pfc::string_base & out) { out = "<unnamed task>"; }
+
+protected:
+ void toggle_blocking(bool state) {
+ if (state != m_taskActive) {
+ static_api_ptr_t<app_close_blocking_task_manager> api;
+ if (state) api->register_task(this);
+ else api->unregister_task(this);
+ m_taskActive = state;
+ }
+ }
+private:
+ bool m_taskActive;
+};
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/audio_chunk.cpp b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/audio_chunk.cpp new file mode 100644 index 0000000000..6e4882dc03 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/audio_chunk.cpp @@ -0,0 +1,341 @@ +#include "foobar2000.h"
+
+void audio_chunk::set_data(const audio_sample * src,t_size samples,unsigned nch,unsigned srate,unsigned channel_config)
+{
+ t_size size = samples * nch;
+ set_data_size(size);
+ if (src)
+ pfc::memcpy_t(get_data(),src,size);
+ else
+ pfc::memset_t(get_data(),(audio_sample)0,size);
+ set_sample_count(samples);
+ set_channels(nch,channel_config);
+ set_srate(srate);
+}
+
+static bool check_exclusive(unsigned val, unsigned mask)
+{
+ return (val&mask)!=0 && (val&mask)!=mask;
+}
+
+namespace {
+
+ template<class T,bool b_swap,bool b_signed,bool b_pad> class msvc6_sucks_v2 { public:
+ inline static void do_fixedpoint_convert(const void * source,unsigned bps,t_size count,audio_sample* buffer)
+ {
+ const char * src = (const char *) source;
+ unsigned bytes = bps>>3;
+ t_size n;
+ T max = ((T)1)<<(bps-1);
+
+ T negmask = - max;
+
+ ASSUME(bytes<=sizeof(T));
+
+ const double div = 1.0 / (double)(1<<(bps-1));
+ for(n=0;n<count;n++) {
+ T temp;
+ if (b_pad)
+ {
+ temp = 0;
+ memcpy(&temp,src,bytes);
+ if (b_swap) pfc::byteswap_raw(&temp,bytes);
+ }
+ else
+ {
+ temp = * reinterpret_cast<const T*>(src);
+ if (b_swap) temp = pfc::byteswap_t(temp);
+ }
+
+
+
+ if (!b_signed) temp ^= max;
+
+ if (b_pad)
+ {
+ if (temp & max) temp |= negmask;
+ }
+
+ if (b_pad)
+ src += bytes;
+ else
+ src += sizeof(T);
+
+
+ buffer[n] = (audio_sample) ( (double)temp * div );
+ }
+ }
+ };
+
+ template <class T,bool b_pad> class msvc6_sucks { public:
+ inline static void do_fixedpoint_convert(bool b_swap,bool b_signed,const void * source,unsigned bps,t_size count,audio_sample* buffer)
+ {
+ if (sizeof(T)==1)
+ {
+ if (b_signed)
+ {
+ msvc6_sucks_v2<T,false,true,b_pad>::do_fixedpoint_convert(source,bps,count,buffer);
+ }
+ else
+ {
+ msvc6_sucks_v2<T,false,false,b_pad>::do_fixedpoint_convert(source,bps,count,buffer);
+ }
+ }
+ else if (b_swap)
+ {
+ if (b_signed)
+ {
+ msvc6_sucks_v2<T,true,true,b_pad>::do_fixedpoint_convert(source,bps,count,buffer);
+ }
+ else
+ {
+ msvc6_sucks_v2<T,true,false,b_pad>::do_fixedpoint_convert(source,bps,count,buffer);
+ }
+ }
+ else
+ {
+ if (b_signed)
+ {
+ msvc6_sucks_v2<T,false,true,b_pad>::do_fixedpoint_convert(source,bps,count,buffer);
+ }
+ else
+ {
+ msvc6_sucks_v2<T,false,false,b_pad>::do_fixedpoint_convert(source,bps,count,buffer);
+ }
+ }
+ }
+ };
+
+
+};
+
+
+void audio_chunk::set_data_fixedpoint_ex(const void * source,t_size size,unsigned srate,unsigned nch,unsigned bps,unsigned flags,unsigned p_channel_config)
+{
+ PFC_ASSERT( check_exclusive(flags,FLAG_SIGNED|FLAG_UNSIGNED) );
+ PFC_ASSERT( check_exclusive(flags,FLAG_LITTLE_ENDIAN|FLAG_BIG_ENDIAN) );
+
+ bool need_swap = !!(flags & FLAG_BIG_ENDIAN);
+ if (pfc::byte_order_is_big_endian) need_swap = !need_swap;
+
+ t_size count = size / (bps/8);
+ set_data_size(count);
+ audio_sample * buffer = get_data();
+ bool b_signed = !!(flags & FLAG_SIGNED);
+
+ switch(bps)
+ {
+ case 8:
+ msvc6_sucks<t_int8,false>::do_fixedpoint_convert(need_swap,b_signed,source,bps,count,buffer);
+ break;
+ case 16:
+ if (!need_swap && b_signed) audio_math::convert_from_int16((const t_int16*)source,count,buffer,1.0);
+ else msvc6_sucks<t_int16,false>::do_fixedpoint_convert(need_swap,b_signed,source,bps,count,buffer);
+ break;
+ case 24:
+ msvc6_sucks<t_int32,true>::do_fixedpoint_convert(need_swap,b_signed,source,bps,count,buffer);
+ break;
+ case 32:
+ if (!need_swap && b_signed) audio_math::convert_from_int32((const t_int32*)source,count,buffer,1.0);
+ else msvc6_sucks<t_int32,false>::do_fixedpoint_convert(need_swap,b_signed,source,bps,count,buffer);
+ break;
+ default:
+ //unknown size, cant convert
+ pfc::memset_t(buffer,(audio_sample)0,count);
+ break;
+ }
+ set_sample_count(count/nch);
+ set_srate(srate);
+ set_channels(nch,p_channel_config);
+}
+
+template<class t_float>
+static void process_float_multi(audio_sample * p_out,const t_float * p_in,const t_size p_count)
+{
+ t_size n;
+ for(n=0;n<p_count;n++)
+ p_out[n] = (audio_sample)p_in[n];
+}
+
+template<class t_float>
+static void process_float_multi_swap(audio_sample * p_out,const t_float * p_in,const t_size p_count)
+{
+ t_size n;
+ for(n=0;n<p_count;n++) {
+ p_out[n] = (audio_sample) pfc::byteswap_t(p_in[n]);
+ }
+}
+
+void audio_chunk::set_data_floatingpoint_ex(const void * ptr,t_size size,unsigned srate,unsigned nch,unsigned bps,unsigned flags,unsigned p_channel_config)
+{
+ PFC_ASSERT(bps==32 || bps==64);
+ PFC_ASSERT( check_exclusive(flags,FLAG_LITTLE_ENDIAN|FLAG_BIG_ENDIAN) );
+ PFC_ASSERT( ! (flags & (FLAG_SIGNED|FLAG_UNSIGNED) ) );
+
+ bool use_swap = pfc::byte_order_is_big_endian ? !!(flags & FLAG_LITTLE_ENDIAN) : !!(flags & FLAG_BIG_ENDIAN);
+
+ const t_size count = size / (bps/8);
+ set_data_size(count);
+ audio_sample * out = get_data();
+
+ if (bps == 32)
+ {
+ if (use_swap)
+ process_float_multi_swap(out,reinterpret_cast<const float*>(ptr),count);
+ else
+ process_float_multi(out,reinterpret_cast<const float*>(ptr),count);
+ }
+ else if (bps == 64)
+ {
+ if (use_swap)
+ process_float_multi_swap(out,reinterpret_cast<const double*>(ptr),count);
+ else
+ process_float_multi(out,reinterpret_cast<const double*>(ptr),count);
+ }
+ else throw exception_io_data("invalid bit depth");
+
+ set_sample_count(count/nch);
+ set_srate(srate);
+ set_channels(nch,p_channel_config);
+}
+
+bool audio_chunk::is_valid() const
+{
+ unsigned nch = get_channels();
+ if (nch==0 || nch>256) return false;
+ if (!g_is_valid_sample_rate(get_srate())) return false;
+ t_size samples = get_sample_count();
+ if (samples==0 || samples >= 0x80000000 / (sizeof(audio_sample) * nch) ) return false;
+ t_size size = get_data_size();
+ if (samples * nch > size) return false;
+ if (!get_data()) return false;
+ return true;
+}
+
+
+void audio_chunk::pad_with_silence_ex(t_size samples,unsigned hint_nch,unsigned hint_srate) {
+ if (is_empty())
+ {
+ if (hint_srate && hint_nch) {
+ return set_data(0,samples,hint_nch,hint_srate);
+ } else throw exception_io_data();
+ }
+ else
+ {
+ if (hint_srate && hint_srate != get_srate()) samples = MulDiv_Size(samples,get_srate(),hint_srate);
+ if (samples > get_sample_count())
+ {
+ t_size old_size = get_sample_count() * get_channels();
+ t_size new_size = samples * get_channels();
+ set_data_size(new_size);
+ pfc::memset_t(get_data() + old_size,(audio_sample)0,new_size - old_size);
+ set_sample_count(samples);
+ }
+ }
+}
+
+void audio_chunk::pad_with_silence(t_size samples) {
+ if (samples > get_sample_count())
+ {
+ t_size old_size = get_sample_count() * get_channels();
+ t_size new_size = pfc::multiply_guarded(samples,get_channels());
+ set_data_size(new_size);
+ pfc::memset_t(get_data() + old_size,(audio_sample)0,new_size - old_size);
+ set_sample_count(samples);
+ }
+}
+
+void audio_chunk::set_silence(t_size samples) {
+ t_size items = samples * get_channels();
+ set_data_size(items);
+ pfc::memset_null_t(get_data(), items);
+ set_sample_count(samples);
+}
+void audio_chunk::insert_silence_fromstart(t_size samples) {
+ t_size old_size = get_sample_count() * get_channels();
+ t_size delta = samples * get_channels();
+ t_size new_size = old_size + delta;
+ set_data_size(new_size);
+ audio_sample * ptr = get_data();
+ pfc::memmove_t(ptr+delta,ptr,old_size);
+ pfc::memset_t(ptr,(audio_sample)0,delta);
+ set_sample_count(get_sample_count() + samples);
+}
+
+t_size audio_chunk::skip_first_samples(t_size samples_delta)
+{
+ t_size samples_old = get_sample_count();
+ if (samples_delta >= samples_old)
+ {
+ set_sample_count(0);
+ set_data_size(0);
+ return samples_old;
+ }
+ else
+ {
+ t_size samples_new = samples_old - samples_delta;
+ unsigned nch = get_channels();
+ audio_sample * ptr = get_data();
+ pfc::memmove_t(ptr,ptr+nch*samples_delta,nch*samples_new);
+ set_sample_count(samples_new);
+ set_data_size(nch*samples_new);
+ return samples_delta;
+ }
+}
+
+audio_sample audio_chunk::get_peak(audio_sample p_peak) const {
+ return pfc::max_t(p_peak, get_peak());
+}
+
+audio_sample audio_chunk::get_peak() const {
+ return audio_math::calculate_peak(get_data(),get_sample_count() * get_channels());
+}
+
+void audio_chunk::scale(audio_sample p_value)
+{
+ audio_sample * ptr = get_data();
+ audio_math::scale(ptr,get_sample_count() * get_channels(),ptr,p_value);
+}
+
+
+static void render_8bit(const audio_sample * in, t_size inLen, void * out) {
+ t_int8 * outWalk = reinterpret_cast<t_int8*>(out);
+ for(t_size walk = 0; walk < inLen; ++walk) {
+ *outWalk++ = (t_int8)pfc::clip_t<t_int32>(audio_math::rint32( in[walk] * 0x80 ), -128, 127);
+ }
+}
+static void render_24bit(const audio_sample * in, t_size inLen, void * out) {
+ t_uint8 * outWalk = reinterpret_cast<t_uint8*>(out);
+ for(t_size walk = 0; walk < inLen; ++walk) {
+ const t_int32 v = pfc::clip_t<t_int32>(audio_math::rint32( in[walk] * 0x800000 ), -128 * 256 * 256, 128 * 256 * 256 - 1);
+ *(outWalk ++) = (t_uint8) (v & 0xFF);
+ *(outWalk ++) = (t_uint8) ((v >> 8) & 0xFF);
+ *(outWalk ++) = (t_uint8) ((v >> 16) & 0xFF);
+ }
+}
+
+bool audio_chunk::to_raw_data(mem_block_container & out, t_uint32 bps) const {
+ const t_size samples = get_sample_count();
+ const t_size dataLen = pfc::multiply_guarded(samples, (t_size)get_channel_count());
+ switch(bps) {
+ case 8:
+ out.set_size(dataLen);
+ render_8bit(get_data(), dataLen, out.get_ptr());
+ break;
+ case 16:
+ out.set_size(dataLen * 2);
+ audio_math::convert_to_int16(get_data(), dataLen, reinterpret_cast<t_int16*>(out.get_ptr()), 1.0);
+ break;
+ case 24:
+ out.set_size(dataLen * 3);
+ render_24bit(get_data(), dataLen, out.get_ptr());
+ break;
+ case 32:
+ PFC_STATIC_ASSERT( sizeof(audio_sample) == 4 );
+ out.set(get_data(), dataLen * sizeof(audio_sample));
+ break;
+ default:
+ return false;
+ }
+ return true;
+}
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/audio_chunk.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/audio_chunk.h new file mode 100644 index 0000000000..7aab0dbfa1 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/audio_chunk.h @@ -0,0 +1,346 @@ +//! Thrown when audio_chunk sample rate or channel mapping changes in mid-stream and the code receiving audio_chunks can't deal with that scenario.
+PFC_DECLARE_EXCEPTION(exception_unexpected_audio_format_change, exception_io_data, "Unexpected audio format change" );
+
+//! Interface to container of a chunk of audio data. See audio_chunk_impl for an implementation.
+class NOVTABLE audio_chunk {
+public:
+
+ enum {
+ sample_rate_min = 1000, sample_rate_max = 2822400
+ };
+ static bool g_is_valid_sample_rate(t_uint32 p_val) {return p_val >= sample_rate_min && p_val <= sample_rate_max;}
+
+ //! Channel map flag declarations. Note that order of interleaved channel data in the stream is same as order of these flags.
+ enum
+ {
+ channel_front_left = 1<<0,
+ channel_front_right = 1<<1,
+ channel_front_center = 1<<2,
+ channel_lfe = 1<<3,
+ channel_back_left = 1<<4,
+ channel_back_right = 1<<5,
+ channel_front_center_left = 1<<6,
+ channel_front_center_right = 1<<7,
+ channel_back_center = 1<<8,
+ channel_side_left = 1<<9,
+ channel_side_right = 1<<10,
+ channel_top_center = 1<<11,
+ channel_top_front_left = 1<<12,
+ channel_top_front_center = 1<<13,
+ channel_top_front_right = 1<<14,
+ channel_top_back_left = 1<<15,
+ channel_top_back_center = 1<<16,
+ channel_top_back_right = 1<<17,
+
+ channel_config_mono = channel_front_center,
+ channel_config_stereo = channel_front_left | channel_front_right,
+ channel_config_5point1 = channel_front_left | channel_front_right | channel_back_left | channel_back_right | channel_front_center | channel_lfe,
+ channel_config_7point1 = channel_config_5point1 | channel_side_left | channel_side_right,
+
+ defined_channel_count = 18,
+ };
+
+ //! Helper function; guesses default channel map for the specified channel count. Returns 0 on failure.
+ static unsigned g_guess_channel_config(unsigned count);
+ //! Helper function; determines channel map for the specified channel count according to Xiph specs. Throws exception_io_data on failure.
+ static unsigned g_guess_channel_config_xiph(unsigned count);
+
+#ifdef _WIN32
+ //! Helper function; translates audio_chunk channel map to WAVEFORMATEXTENSIBLE channel map.
+ static DWORD g_channel_config_to_wfx(unsigned p_config);
+ //! Helper function; translates WAVEFORMATEXTENSIBLE channel map to audio_chunk channel map.
+ static unsigned g_channel_config_from_wfx(DWORD p_wfx);
+#endif
+
+ //! Extracts flag describing Nth channel from specified map. Usable to figure what specific channel in a stream means.
+ static unsigned g_extract_channel_flag(unsigned p_config,unsigned p_index);
+ //! Counts channels specified by channel map.
+ static unsigned g_count_channels(unsigned p_config);
+ //! Calculates index of a channel specified by p_flag in a stream where channel map is described by p_config.
+ static unsigned g_channel_index_from_flag(unsigned p_config,unsigned p_flag);
+
+
+
+ //! Retrieves audio data buffer pointer (non-const version). Returned pointer is for temporary use only; it is valid until next set_data_size call, or until the object is destroyed. \n
+ //! Size of returned buffer is equal to get_data_size() return value (in audio_samples). Amount of actual data may be smaller, depending on sample count and channel count. Conditions where sample count * channel count are greater than data size should not be possible.
+ virtual audio_sample * get_data() = 0;
+ //! Retrieves audio data buffer pointer (const version). Returned pointer is for temporary use only; it is valid until next set_data_size call, or until the object is destroyed. \n
+ //! Size of returned buffer is equal to get_data_size() return value (in audio_samples). Amount of actual data may be smaller, depending on sample count and channel count. Conditions where sample count * channel count are greater than data size should not be possible.
+ virtual const audio_sample * get_data() const = 0;
+ //! Retrieves size of allocated buffer space, in audio_samples.
+ virtual t_size get_data_size() const = 0;
+ //! Resizes audio data buffer to specified size. Throws std::bad_alloc on failure.
+ virtual void set_data_size(t_size p_new_size) = 0;
+
+ //! Retrieves sample rate of contained audio data.
+ virtual unsigned get_srate() const = 0;
+ //! Sets sample rate of contained audio data.
+ virtual void set_srate(unsigned val) = 0;
+ //! Retrieves channel count of contained audio data.
+ virtual unsigned get_channels() const = 0;
+ //! Helper - for consistency - same as get_channels().
+ inline unsigned get_channel_count() const {return get_channels();}
+ //! Retrieves channel map of contained audio data. Conditions where number of channels specified by channel map don't match get_channels() return value should not be possible.
+ virtual unsigned get_channel_config() const = 0;
+ //! Sets channel count / channel map.
+ virtual void set_channels(unsigned p_count,unsigned p_config) = 0;
+
+ //! Retrieves number of valid samples in the buffer. \n
+ //! Note that a "sample" means a unit of interleaved PCM data representing states of each channel at given point of time, not a single PCM value. \n
+ //! For an example, duration of contained audio data is equal to sample count / sample rate, while actual size of contained data is equal to sample count * channel count.
+ virtual t_size get_sample_count() const = 0;
+
+ //! Sets number of valid samples in the buffer. WARNING: sample count * channel count should never be above allocated buffer size.
+ virtual void set_sample_count(t_size val) = 0;
+
+ //! Helper, same as get_srate().
+ inline unsigned get_sample_rate() const {return get_srate();}
+ //! Helper, same as set_srate().
+ inline void set_sample_rate(unsigned val) {set_srate(val);}
+
+ //! Helper; sets channel count to specified value and uses default channel map for this channel count.
+ void set_channels(unsigned val) {set_channels(val,g_guess_channel_config(val));}
+
+
+ //! Helper; resizes audio data buffer when its current size is smaller than requested.
+ inline void grow_data_size(t_size p_requested) {if (p_requested > get_data_size()) set_data_size(p_requested);}
+
+
+ //! Retrieves duration of contained audio data, in seconds.
+ inline double get_duration() const
+ {
+ double rv = 0;
+ t_size srate = get_srate (), samples = get_sample_count();
+ if (srate>0 && samples>0) rv = (double)samples/(double)srate;
+ return rv;
+ }
+
+ //! Returns whether the chunk is empty (contains no audio data).
+ inline bool is_empty() const {return get_channels()==0 || get_srate()==0 || get_sample_count()==0;}
+
+ //! Returns whether the chunk contents are valid (for bug check purposes).
+ bool is_valid() const;
+
+ //! Returns actual amount of audio data contained in the buffer (sample count * channel count). Must not be greater than data size (see get_data_size()).
+ inline t_size get_data_length() const {return get_sample_count() * get_channels();}
+
+ //! Resets all audio_chunk data.
+ inline void reset() {
+ set_sample_count(0);
+ set_srate(0);
+ set_channels(0);
+ set_data_size(0);
+ }
+
+ //! Helper, sets chunk data to contents of specified buffer, with specified number of channels / sample rate / channel map.
+ void set_data(const audio_sample * src,t_size samples,unsigned nch,unsigned srate,unsigned channel_config);
+
+ //! Helper, sets chunk data to contents of specified buffer, with specified number of channels / sample rate, using default channel map for specified channel count.
+ inline void set_data(const audio_sample * src,t_size samples,unsigned nch,unsigned srate) {set_data(src,samples,nch,srate,g_guess_channel_config(nch));}
+
+ //! Helper, sets chunk data to contents of specified buffer, using default win32/wav conventions for signed/unsigned switch.
+ inline void set_data_fixedpoint(const void * ptr,t_size bytes,unsigned srate,unsigned nch,unsigned bps,unsigned channel_config) {
+ set_data_fixedpoint_ex(ptr,bytes,srate,nch,bps,(bps==8 ? FLAG_UNSIGNED : FLAG_SIGNED) | flags_autoendian(), channel_config);
+ }
+
+ inline void set_data_fixedpoint_unsigned(const void * ptr,t_size bytes,unsigned srate,unsigned nch,unsigned bps,unsigned channel_config) {
+ return set_data_fixedpoint_ex(ptr,bytes,srate,nch,bps,FLAG_UNSIGNED | flags_autoendian(), channel_config);
+ }
+
+ inline void set_data_fixedpoint_signed(const void * ptr,t_size bytes,unsigned srate,unsigned nch,unsigned bps,unsigned channel_config) {
+ return set_data_fixedpoint_ex(ptr,bytes,srate,nch,bps,FLAG_SIGNED | flags_autoendian(), channel_config);
+ }
+
+ enum
+ {
+ FLAG_LITTLE_ENDIAN = 1,
+ FLAG_BIG_ENDIAN = 2,
+ FLAG_SIGNED = 4,
+ FLAG_UNSIGNED = 8,
+ };
+
+ inline static unsigned flags_autoendian() {
+ return pfc::byte_order_is_big_endian ? FLAG_BIG_ENDIAN : FLAG_LITTLE_ENDIAN;
+ }
+
+ void set_data_fixedpoint_ex(const void * ptr,t_size bytes,unsigned p_sample_rate,unsigned p_channels,unsigned p_bits_per_sample,unsigned p_flags,unsigned p_channel_config);//p_flags - see FLAG_* above
+
+ void set_data_floatingpoint_ex(const void * ptr,t_size bytes,unsigned p_sample_rate,unsigned p_channels,unsigned p_bits_per_sample,unsigned p_flags,unsigned p_channel_config);//signed/unsigned flags dont apply
+
+ inline void set_data_32(const float * src,t_size samples,unsigned nch,unsigned srate) {return set_data(src,samples,nch,srate);}
+
+ void pad_with_silence_ex(t_size samples,unsigned hint_nch,unsigned hint_srate);
+ void pad_with_silence(t_size samples);
+ void insert_silence_fromstart(t_size samples);
+ t_size skip_first_samples(t_size samples);
+ void set_silence(t_size samples);
+
+ //! Simple function to get original PCM stream back. Assumes host's endianness, integers are signed - including the 8bit mode; 32bit mode assumed to be float.
+ //! @returns false when the conversion could not be performed because of unsupported bit depth etc.
+ bool to_raw_data(class mem_block_container & out, t_uint32 bps) const;
+
+
+ //! Helper, calculates peak value of data in the chunk. The optional parameter specifies initial peak value, to simplify calling code.
+ audio_sample get_peak(audio_sample p_peak) const;
+ audio_sample get_peak() const;
+
+ //! Helper function; scales entire chunk content by specified value.
+ void scale(audio_sample p_value);
+
+ //! Helper; copies content of another audio chunk to this chunk.
+ void copy(const audio_chunk & p_source) {
+ set_data(p_source.get_data(),p_source.get_sample_count(),p_source.get_channels(),p_source.get_srate(),p_source.get_channel_config());
+ }
+
+ const audio_chunk & operator=(const audio_chunk & p_source) {
+ copy(p_source);
+ return *this;
+ }
+protected:
+ audio_chunk() {}
+ ~audio_chunk() {}
+};
+
+//! Implementation of audio_chunk. Takes pfc allocator template as template parameter.
+template<template<typename> class t_alloc = pfc::alloc_standard>
+class audio_chunk_impl_t : public audio_chunk {
+ typedef audio_chunk_impl_t<t_alloc> t_self;
+ pfc::array_t<audio_sample,t_alloc> m_data;
+ unsigned m_srate,m_nch,m_setup;
+ t_size m_samples;
+public:
+ audio_chunk_impl_t() : m_srate(0), m_nch(0), m_samples(0), m_setup(0) {}
+ audio_chunk_impl_t(const audio_sample * src,unsigned samples,unsigned nch,unsigned srate) : m_srate(0), m_nch(0), m_samples(0)
+ {set_data(src,samples,nch,srate);}
+ audio_chunk_impl_t(const audio_chunk & p_source) : m_srate(0), m_nch(0), m_samples(0), m_setup(0) {copy(p_source);}
+ audio_chunk_impl_t(const t_self & p_source) : m_srate(0), m_nch(0), m_samples(0), m_setup(0) {copy(p_source);}
+
+ virtual audio_sample * get_data() {return m_data.get_ptr();}
+ virtual const audio_sample * get_data() const {return m_data.get_ptr();}
+ virtual t_size get_data_size() const {return m_data.get_size();}
+ virtual void set_data_size(t_size new_size) {m_data.set_size(new_size);}
+
+ virtual unsigned get_srate() const {return m_srate;}
+ virtual void set_srate(unsigned val) {m_srate=val;}
+ virtual unsigned get_channels() const {return m_nch;}
+ virtual unsigned get_channel_config() const {return m_setup;}
+ virtual void set_channels(unsigned val,unsigned setup) {m_nch = val;m_setup = setup;}
+ void set_channels(unsigned val) {set_channels(val,g_guess_channel_config(val));}
+
+ virtual t_size get_sample_count() const {return m_samples;}
+ virtual void set_sample_count(t_size val) {m_samples = val;}
+
+ const t_self & operator=(const audio_chunk & p_source) {copy(p_source);return *this;}
+ const t_self & operator=(const t_self & p_source) {copy(p_source);return *this;}
+};
+
+typedef audio_chunk_impl_t<> audio_chunk_impl;
+typedef audio_chunk_impl_t<pfc::alloc_fast_aggressive> audio_chunk_impl_temporary;
+typedef audio_chunk_impl audio_chunk_i;//for compatibility
+
+//! Implements const methods of audio_chunk only, referring to an external buffer. For temporary use only (does not maintain own storage), e.g.: somefunc( audio_chunk_temp_impl(mybuffer,....) );
+class audio_chunk_temp_impl : public audio_chunk {
+public:
+ audio_chunk_temp_impl(const audio_sample * p_data,t_size p_samples,t_uint32 p_sample_rate,t_uint32 p_channels,t_uint32 p_channel_config) :
+ m_data(p_data), m_samples(p_samples), m_sample_rate(p_sample_rate), m_channels(p_channels), m_channel_config(p_channel_config)
+ {
+ PFC_ASSERT(is_valid());
+ }
+
+ audio_sample * get_data() {throw pfc::exception_not_implemented();}
+ const audio_sample * get_data() const {return m_data;}
+ t_size get_data_size() const {return m_samples * m_channels;}
+ void set_data_size(t_size p_new_size) {throw pfc::exception_not_implemented();}
+
+ unsigned get_srate() const {return m_sample_rate;}
+ void set_srate(unsigned val) {throw pfc::exception_not_implemented();}
+ unsigned get_channels() const {return m_channels;}
+ unsigned get_channel_config() const {return m_channel_config;}
+ void set_channels(unsigned p_count,unsigned p_config) {throw pfc::exception_not_implemented();}
+
+ t_size get_sample_count() const {return m_samples;}
+
+ void set_sample_count(t_size val) {throw pfc::exception_not_implemented();}
+
+private:
+ t_size m_samples;
+ t_uint32 m_sample_rate,m_channels,m_channel_config;
+ const audio_sample * m_data;
+};
+
+
+
+//! Duration counter class - accumulates duration using sample values, without any kind of rounding error accumulation.
+class duration_counter {
+public:
+ duration_counter() : m_offset() {
+ }
+ void set(double v) {
+ m_sampleCounts.remove_all();
+ m_offset = v;
+ }
+ void reset() {
+ set(0);
+ }
+
+ void add(double v) {m_offset += v;}
+ void subtract(double v) {m_offset -= v;}
+
+ double query() const {
+ double acc = m_offset;
+ for(t_map::const_iterator walk = m_sampleCounts.first(); walk.is_valid(); ++walk) {
+ acc += audio_math::samples_to_time(walk->m_value, walk->m_key);
+ }
+ return acc;
+ }
+ void add(const audio_chunk & c) {
+ add(c.get_sample_count(), c.get_sample_rate());
+ }
+ void add(t_uint64 sampleCount, t_uint32 sampleRate) {
+ PFC_ASSERT( sampleRate > 0 );
+ if (sampleRate > 0 && sampleCount > 0) {
+ m_sampleCounts.find_or_add(sampleRate) += sampleCount;
+ }
+ }
+ void add(const duration_counter & other) {
+ add(other.m_offset);
+ for(t_map::const_iterator walk = other.m_sampleCounts.first(); walk.is_valid(); ++walk) {
+ add(walk->m_value, walk->m_key);
+ }
+ }
+ void subtract(const duration_counter & other) {
+ subtract(other.m_offset);
+ for(t_map::const_iterator walk = other.m_sampleCounts.first(); walk.is_valid(); ++walk) {
+ subtract(walk->m_value, walk->m_key);
+ }
+ }
+ void subtract(t_uint64 sampleCount, t_uint32 sampleRate) {
+ PFC_ASSERT( sampleRate > 0 );
+ if (sampleRate > 0 && sampleCount > 0) {
+ t_uint64 * val = m_sampleCounts.query_ptr(sampleRate);
+ if (val == NULL) throw pfc::exception_invalid_params();
+ if (*val < sampleCount) throw pfc::exception_invalid_params();
+ else if (*val == sampleCount) {
+ m_sampleCounts.remove(sampleRate);
+ } else {
+ *val -= sampleCount;
+ }
+
+ }
+ }
+ void subtract(const audio_chunk & c) {
+ subtract(c.get_sample_count(), c.get_sample_rate());
+ }
+ template<typename t_source> duration_counter & operator+=(const t_source & source) {add(source); return *this;}
+ template<typename t_source> duration_counter & operator-=(const t_source & source) {subtract(source); return *this;}
+ template<typename t_source> duration_counter & operator=(const t_source & source) {reset(); add(source); return *this;}
+private:
+ double m_offset;
+ typedef pfc::map_t<t_uint32, t_uint64> t_map;
+ t_map m_sampleCounts;
+};
+
+class audio_chunk_partial_ref : public audio_chunk_temp_impl {
+public:
+ audio_chunk_partial_ref(const audio_chunk & chunk, t_size base, t_size count) : audio_chunk_temp_impl(chunk.get_data() + base * chunk.get_channels(), count, chunk.get_sample_rate(), chunk.get_channels(), chunk.get_channel_config()) {}
+};
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/audio_chunk_channel_config.cpp b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/audio_chunk_channel_config.cpp new file mode 100644 index 0000000000..8dba073819 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/audio_chunk_channel_config.cpp @@ -0,0 +1,144 @@ +#include "foobar2000.h"
+
+#ifdef _WIN32
+#include <ks.h>
+#include <ksmedia.h>
+
+#if 0
+#define SPEAKER_FRONT_LEFT 0x1
+#define SPEAKER_FRONT_RIGHT 0x2
+#define SPEAKER_FRONT_CENTER 0x4
+#define SPEAKER_LOW_FREQUENCY 0x8
+#define SPEAKER_BACK_LEFT 0x10
+#define SPEAKER_BACK_RIGHT 0x20
+#define SPEAKER_FRONT_LEFT_OF_CENTER 0x40
+#define SPEAKER_FRONT_RIGHT_OF_CENTER 0x80
+#define SPEAKER_BACK_CENTER 0x100
+#define SPEAKER_SIDE_LEFT 0x200
+#define SPEAKER_SIDE_RIGHT 0x400
+#define SPEAKER_TOP_CENTER 0x800
+#define SPEAKER_TOP_FRONT_LEFT 0x1000
+#define SPEAKER_TOP_FRONT_CENTER 0x2000
+#define SPEAKER_TOP_FRONT_RIGHT 0x4000
+#define SPEAKER_TOP_BACK_LEFT 0x8000
+#define SPEAKER_TOP_BACK_CENTER 0x10000
+#define SPEAKER_TOP_BACK_RIGHT 0x20000
+#endif
+
+static struct {DWORD m_wfx; unsigned m_native; } const g_translation_table[] =
+{
+ {SPEAKER_FRONT_LEFT, audio_chunk::channel_front_left},
+ {SPEAKER_FRONT_RIGHT, audio_chunk::channel_front_right},
+ {SPEAKER_FRONT_CENTER, audio_chunk::channel_front_center},
+ {SPEAKER_LOW_FREQUENCY, audio_chunk::channel_lfe},
+ {SPEAKER_BACK_LEFT, audio_chunk::channel_back_left},
+ {SPEAKER_BACK_RIGHT, audio_chunk::channel_back_right},
+ {SPEAKER_FRONT_LEFT_OF_CENTER, audio_chunk::channel_front_center_left},
+ {SPEAKER_FRONT_RIGHT_OF_CENTER, audio_chunk::channel_front_center_right},
+ {SPEAKER_BACK_CENTER, audio_chunk::channel_back_center},
+ {SPEAKER_SIDE_LEFT, audio_chunk::channel_side_left},
+ {SPEAKER_SIDE_RIGHT, audio_chunk::channel_side_right},
+ {SPEAKER_TOP_CENTER, audio_chunk::channel_top_center},
+ {SPEAKER_TOP_FRONT_LEFT, audio_chunk::channel_top_front_left},
+ {SPEAKER_TOP_FRONT_CENTER, audio_chunk::channel_top_front_center},
+ {SPEAKER_TOP_FRONT_RIGHT, audio_chunk::channel_top_front_right},
+ {SPEAKER_TOP_BACK_LEFT, audio_chunk::channel_top_back_left},
+ {SPEAKER_TOP_BACK_CENTER, audio_chunk::channel_top_back_center},
+ {SPEAKER_TOP_BACK_RIGHT, audio_chunk::channel_top_back_right},
+};
+
+
+DWORD audio_chunk::g_channel_config_to_wfx(unsigned p_config)
+{
+ DWORD ret = 0;
+ unsigned n;
+ for(n=0;n<PFC_TABSIZE(g_translation_table);n++)
+ {
+ if (p_config & g_translation_table[n].m_native) ret |= g_translation_table[n].m_wfx;
+ }
+ return ret;
+}
+
+unsigned audio_chunk::g_channel_config_from_wfx(DWORD p_wfx)
+{
+ unsigned ret = 0;
+ unsigned n;
+ for(n=0;n<PFC_TABSIZE(g_translation_table);n++)
+ {
+ if (p_wfx & g_translation_table[n].m_wfx) ret |= g_translation_table[n].m_native;
+ }
+ return ret;
+}
+
+#endif
+
+
+static const unsigned g_audio_channel_config_table[] =
+{
+ 0,
+ audio_chunk::channel_config_mono,
+ audio_chunk::channel_config_stereo,
+ audio_chunk::channel_front_left | audio_chunk::channel_front_right | audio_chunk::channel_lfe,
+ audio_chunk::channel_front_left | audio_chunk::channel_front_right | audio_chunk::channel_back_left | audio_chunk::channel_back_right,
+ audio_chunk::channel_front_left | audio_chunk::channel_front_right | audio_chunk::channel_back_left | audio_chunk::channel_back_right | audio_chunk::channel_lfe,
+ audio_chunk::channel_config_5point1,
+ audio_chunk::channel_front_left | audio_chunk::channel_front_right | audio_chunk::channel_back_left | audio_chunk::channel_back_right | audio_chunk::channel_lfe | audio_chunk::channel_front_center_right | audio_chunk::channel_front_center_left,
+ audio_chunk::channel_front_left | audio_chunk::channel_front_right | audio_chunk::channel_back_left | audio_chunk::channel_back_right | audio_chunk::channel_front_center | audio_chunk::channel_lfe | audio_chunk::channel_front_center_right | audio_chunk::channel_front_center_left,
+};
+
+static const unsigned g_audio_channel_config_table_xiph[] =
+{
+ 0,
+ audio_chunk::channel_config_mono,
+ audio_chunk::channel_config_stereo,
+ audio_chunk::channel_front_left | audio_chunk::channel_front_right | audio_chunk::channel_front_center,
+ audio_chunk::channel_front_left | audio_chunk::channel_front_right | audio_chunk::channel_back_left | audio_chunk::channel_back_right,
+ audio_chunk::channel_front_left | audio_chunk::channel_front_right | audio_chunk::channel_back_left | audio_chunk::channel_back_right | audio_chunk::channel_front_center,
+ audio_chunk::channel_config_5point1,
+};
+
+unsigned audio_chunk::g_guess_channel_config(unsigned count)
+{
+ if (count >= PFC_TABSIZE(g_audio_channel_config_table)) return 0;
+ return g_audio_channel_config_table[count];
+}
+unsigned audio_chunk::g_guess_channel_config_xiph(unsigned count) {
+ if (count == 0 || count >= PFC_TABSIZE(g_audio_channel_config_table_xiph)) throw exception_io_data();
+ return g_audio_channel_config_table_xiph[count];
+}
+
+unsigned audio_chunk::g_channel_index_from_flag(unsigned p_config,unsigned p_flag) {
+ unsigned index = 0;
+ for(unsigned walk = 0; walk < 32; walk++) {
+ unsigned query = 1 << walk;
+ if (p_flag & query) return index;
+ if (p_config & query) index++;
+ }
+ return ~0;
+}
+
+unsigned audio_chunk::g_extract_channel_flag(unsigned p_config,unsigned p_index)
+{
+ unsigned toskip = p_index;
+ unsigned flag = 1;
+ while(flag)
+ {
+ if (p_config & flag)
+ {
+ if (toskip == 0) break;
+ toskip--;
+ }
+ flag <<= 1;
+ }
+ return flag;
+}
+
+unsigned audio_chunk::g_count_channels(unsigned p_config)
+{
+ unsigned ret = 0;
+ while(p_config) {
+ ret += (p_config & 1);
+ p_config >>= 1;
+ }
+ return ret;
+}
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/audio_postprocessor.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/audio_postprocessor.h new file mode 100644 index 0000000000..4153d2865c --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/audio_postprocessor.h @@ -0,0 +1,25 @@ +//! This class handles conversion of audio data (audio_chunk) to various linear PCM types, with optional dithering.
+
+class NOVTABLE audio_postprocessor : public service_base
+{
+public:
+ //! Processes one chunk of audio data.
+ //! @param p_chunk Chunk of audio data to process.
+ //! @param p_output Receives output linear signed PCM data.
+ //! @param p_out_bps Desired bit depth of output.
+ //! @param p_out_bps_physical Desired physical word width of output. Must be either 8, 16, 24 or 32, greater or equal to p_out_bps. This is typically set to same value as p_out_bps.
+ //! @param p_dither Indicates whether dithering should be used. Note that dithering is CPU-heavy.
+ //! @param p_prescale Value to scale all audio samples by when converting. Set to 1.0 to do nothing.
+
+ virtual void run(const audio_chunk & p_chunk,
+ mem_block_container & p_output,
+ t_uint32 p_out_bps,
+ t_uint32 p_out_bps_physical,
+ bool p_dither,
+ audio_sample p_prescale
+ ) = 0;
+
+
+
+ FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(audio_postprocessor);
+};
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/autoplaylist.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/autoplaylist.h new file mode 100644 index 0000000000..058b49a90c --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/autoplaylist.h @@ -0,0 +1,106 @@ +/*
+ Autoplaylist APIs
+ These APIs were introduced in foobar2000 0.9.5, to reduce amount of code required to create your own autoplaylists. Creation of autoplaylists is was also possible before through playlist lock APIs.
+ In most cases, you'll want to turn regular playlists into autoplaylists using the following code:
+ static_api_ptr_t<autoplaylist_manager>()->add_client_simple(querypattern, sortpattern, playlistindex, forceSort ? autoplaylist_flag_sort : 0);
+ If you require more advanced functionality, such as using your own code to filter which part of user's Media Library should be placed in specific autoplaylist, you must implement autoplaylist_client (to let autoplaylist manager invoke your handlers when needed) / autoplaylist_client_factory (to re-instantiate your autoplaylist_client after a foobar2000 restart cycle).
+*/
+
+enum {
+ //! When set, core will keep the autoplaylist sorted and prevent user from reordering it.
+ autoplaylist_flag_sort = 1 << 0,
+};
+//! Main class controlling autoplaylist behaviors. Implemented by autoplaylist client in scenarios where simple query/sort strings are not enough (core provides a standard implementation for simple queries).
+class NOVTABLE autoplaylist_client : public service_base {
+public:
+ virtual GUID get_guid() = 0;
+ //! Called only inside a metadb lock for performance reasons.
+ virtual void filter(metadb_handle_list_cref data, bool * out) = 0;
+ //! Return true when you have filled p_orderbuffer with a permutation to apply to p_items, false when you don't support sorting (core's own sort scheme will be applied).
+ virtual bool sort(metadb_handle_list_cref p_items,t_size * p_orderbuffer) = 0;
+ //! Retrieves your configuration data to be used later when re-instantiating your autoplaylist_client after a restart.
+ virtual void get_configuration(stream_writer * p_stream,abort_callback & p_abort) = 0;
+
+ virtual void show_ui(t_size p_source_playlist) = 0;
+
+ //! Helper.
+ template<typename t_array> void get_configuration(t_array & p_out) {
+ PFC_STATIC_ASSERT( sizeof(p_out[0]) == 1 );
+ typedef pfc::array_t<t_uint8,pfc::alloc_fast_aggressive> t_temp; t_temp temp;
+ get_configuration(&stream_writer_buffer_append_ref_t<t_temp>(temp),abort_callback_dummy());
+ p_out = temp;
+ }
+
+
+ FB2K_MAKE_SERVICE_INTERFACE(autoplaylist_client,service_base)
+};
+
+typedef service_ptr_t<autoplaylist_client> autoplaylist_client_ptr;
+
+//! Supported from 0.9.5.3 up.
+class NOVTABLE autoplaylist_client_v2 : public autoplaylist_client {
+public:
+ //! Sets a completion_notify object that the autoplaylist_client implementation should call when its filtering behaviors have changed so the whole playlist needs to be rebuilt. \n
+ //! completion_notify::on_completion() status parameter meaning: \n
+ //! 0.9.5.3 : ignored. \n
+ //! 0.9.5.4 and newer: set to 1 to indicate that your configuration has changed as well (for an example as a result of user edits) to get a get_configuration() call as well as cause the playlist to be rebuilt; set to zero otherwise - when the configuration hasn't changed but the playlist needs to be rebuilt as a result of some other event.
+ virtual void set_full_refresh_notify(completion_notify::ptr notify) = 0;
+
+ //! Returns whether the show_ui() method is available / does anything useful with out implementation (not everyone implements show_ui).
+ virtual bool show_ui_available() = 0;
+
+ //! Returns a human-readable autoplaylist implementer's label to display in playlist's context menu / description / etc.
+ virtual void get_display_name(pfc::string_base & out) = 0;
+
+ FB2K_MAKE_SERVICE_INTERFACE(autoplaylist_client_v2, autoplaylist_client);
+};
+
+//! Class needed to re-instantiate autoplaylist_client after a restart. Not directly needed to set up an autoplaylist_client, but without it, your autoplaylist will be lost after a restart.
+class NOVTABLE autoplaylist_client_factory : public service_base {
+public:
+ //! Must return same GUID as your autoplaylist_client::get_guid()
+ virtual GUID get_guid() = 0;
+ //! Instantiates your autoplaylist_client with specified configuration.
+ virtual autoplaylist_client_ptr instantiate(stream_reader * p_stream,t_size p_sizehint,abort_callback & p_abort) = 0;
+
+ FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(autoplaylist_client_factory)
+};
+
+PFC_DECLARE_EXCEPTION(exception_autoplaylist,pfc::exception,"Autoplaylist error")
+
+PFC_DECLARE_EXCEPTION(exception_autoplaylist_already_owned,exception_autoplaylist,"This playlist is already an autoplaylist")
+PFC_DECLARE_EXCEPTION(exception_autoplaylist_not_owned,exception_autoplaylist,"This playlist is not an autoplaylist")
+PFC_DECLARE_EXCEPTION(exception_autoplaylist_lock_failure,exception_autoplaylist,"Playlist could not be locked")
+
+
+//! Primary class for managing autoplaylists. Implemented by core, do not reimplement; instantiate using static_api_ptr_t<autoplaylist_manager>.
+class NOVTABLE autoplaylist_manager : public service_base {
+public:
+ //! Throws exception_autoplaylist or one of its subclasses on failure.
+ //! @param p_flags See autoplaylist_flag_* constants.
+ virtual void add_client(autoplaylist_client_ptr p_client,t_size p_playlist,t_uint32 p_flags) = 0;
+ virtual bool is_client_present(t_size p_playlist) = 0;
+ //! Throws exception_autoplaylist or one of its subclasses on failure (eg. not an autoplaylist).
+ virtual autoplaylist_client_ptr query_client(t_size p_playlist) = 0;
+ virtual void remove_client(t_size p_playlist) = 0;
+ //! Helper; sets up an autoplaylist using standard autoplaylist_client implementation based on simple query/sort strings. When using this, you don't need to maintain own autoplaylist_client/autoplaylist_client_factory implementations, and autoplaylists that you create will not be lost when your DLL is removed, as opposed to using add_client() directly.
+ //! Throws exception_autoplaylist or one of its subclasses on failure.
+ //! @param p_flags See autoplaylist_flag_* constants.
+ virtual void add_client_simple(const char * p_query,const char * p_sort,t_size p_playlist,t_uint32 p_flags) = 0;
+
+ FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(autoplaylist_manager)
+};
+
+//! \since 0.9.5.4
+//! Extended version of autoplaylist_manager, available from 0.9.5.4 up, with methods allowing modification of autoplaylist flags.
+class NOVTABLE autoplaylist_manager_v2 : public autoplaylist_manager {
+ FB2K_MAKE_SERVICE_INTERFACE(autoplaylist_manager_v2, autoplaylist_manager)
+public:
+ virtual t_uint32 get_client_flags(t_size playlist) = 0;
+ virtual void set_client_flags(t_size playlist, t_uint32 newFlags) = 0;
+
+ //! For use with autoplaylist client configuration dialogs. It's recommended not to call this from anything else.
+ virtual t_uint32 get_client_flags(autoplaylist_client::ptr client) = 0;
+ //! For use with autoplaylist client configuration dialogs. It's recommended not to call this from anything else.
+ virtual void set_client_flags(autoplaylist_client::ptr client, t_uint32 newFlags) = 0;
+};
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/cfg_var.cpp b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/cfg_var.cpp new file mode 100644 index 0000000000..ad00db236f --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/cfg_var.cpp @@ -0,0 +1,57 @@ +#include "foobar2000.h"
+
+cfg_var_reader * cfg_var_reader::g_list = NULL;
+cfg_var_writer * cfg_var_writer::g_list = NULL;
+
+void cfg_var_reader::config_read_file(stream_reader * p_stream,abort_callback & p_abort)
+{
+ pfc::map_t<GUID,cfg_var_reader*> vars;
+ for(cfg_var_reader * walk = g_list; walk != NULL; walk = walk->m_next) {
+ vars.set(walk->m_guid,walk);
+ }
+ for (;;) {
+
+ GUID guid;
+ t_uint32 size;
+
+ if (p_stream->read(&guid,sizeof(guid),p_abort) != sizeof(guid)) break;
+ guid = pfc::byteswap_if_be_t(guid);
+ p_stream->read_lendian_t(size,p_abort);
+
+ cfg_var_reader * var;
+ if (vars.query(guid,var)) {
+ stream_reader_limited_ref wrapper(p_stream,size);
+ try {
+ var->set_data_raw(&wrapper,size,p_abort);
+ } catch(exception_io_data) {}
+ wrapper.flush_remaining(p_abort);
+ } else {
+ p_stream->skip_object(size,p_abort);
+ }
+ }
+}
+
+void cfg_var_writer::config_write_file(stream_writer * p_stream,abort_callback & p_abort) {
+ cfg_var_writer * ptr;
+ pfc::array_t<t_uint8,pfc::alloc_fast_aggressive> temp;
+ for(ptr = g_list; ptr; ptr = ptr->m_next) {
+ temp.set_size(0);
+ ptr->get_data_raw(&stream_writer_buffer_append_ref_t<pfc::array_t<t_uint8,pfc::alloc_fast_aggressive> >(temp),p_abort);
+ p_stream->write_lendian_t(ptr->m_guid,p_abort);
+ p_stream->write_lendian_t(pfc::downcast_guarded<t_uint32>(temp.get_size()),p_abort);
+ if (temp.get_size() > 0) {
+ p_stream->write_object(temp.get_ptr(),temp.get_size(),p_abort);
+ }
+ }
+}
+
+
+void cfg_string::get_data_raw(stream_writer * p_stream,abort_callback & p_abort) {
+ p_stream->write_object(get_ptr(),length(),p_abort);
+}
+
+void cfg_string::set_data_raw(stream_reader * p_stream,t_size p_sizehint,abort_callback & p_abort) {
+ pfc::string8_fastalloc temp;
+ p_stream->read_string_raw(temp,p_abort);
+ set_string(temp);
+}
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/cfg_var.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/cfg_var.h new file mode 100644 index 0000000000..7e31b19e93 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/cfg_var.h @@ -0,0 +1,289 @@ +#ifndef _FOOBAR2000_SDK_CFG_VAR_H_
+#define _FOOBAR2000_SDK_CFG_VAR_H_
+
+#define CFG_VAR_ASSERT_SAFEINIT PFC_ASSERT(!core_api::are_services_available());/*imperfect check for nonstatic instantiation*/
+
+
+//! Reader part of cfg_var object. In most cases, you should use cfg_var instead of using cfg_var_reader directly.
+class NOVTABLE cfg_var_reader {
+public:
+ //! @param p_guid GUID of the variable, used to identify variable implementations owning specific configuration file entries when reading the configuration file back. You must generate a new GUID every time you declare a new cfg_var.
+ cfg_var_reader(const GUID & guid) : m_guid(guid) { CFG_VAR_ASSERT_SAFEINIT; m_next = g_list; g_list = this; }
+ ~cfg_var_reader() { CFG_VAR_ASSERT_SAFEINIT; }
+
+ //! Sets state of the variable. Called only from main thread, when reading configuration file.
+ //! @param p_stream Stream containing new state of the variable.
+ //! @param p_sizehint Number of bytes contained in the stream; reading past p_sizehint bytes will fail (EOF).
+ virtual void set_data_raw(stream_reader * p_stream,t_size p_sizehint,abort_callback & p_abort) = 0;
+
+ //! For internal use only, do not call.
+ static void config_read_file(stream_reader * p_stream,abort_callback & p_abort);
+
+ const GUID m_guid;
+private:
+ static cfg_var_reader * g_list;
+ cfg_var_reader * m_next;
+
+ PFC_CLASS_NOT_COPYABLE_EX(cfg_var_reader)
+};
+
+//! Writer part of cfg_var object. In most cases, you should use cfg_var instead of using cfg_var_writer directly.
+class NOVTABLE cfg_var_writer {
+public:
+ //! @param p_guid GUID of the variable, used to identify variable implementations owning specific configuration file entries when reading the configuration file back. You must generate a new GUID every time you declare a new cfg_var.
+ cfg_var_writer(const GUID & guid) : m_guid(guid) { CFG_VAR_ASSERT_SAFEINIT; m_next = g_list; g_list = this;}
+ ~cfg_var_writer() { CFG_VAR_ASSERT_SAFEINIT; }
+
+ //! Retrieves state of the variable. Called only from main thread, when writing configuration file.
+ //! @param p_stream Stream receiving state of the variable.
+ virtual void get_data_raw(stream_writer * p_stream,abort_callback & p_abort) = 0;
+
+ //! For internal use only, do not call.
+ static void config_write_file(stream_writer * p_stream,abort_callback & p_abort);
+
+ const GUID m_guid;
+private:
+ static cfg_var_writer * g_list;
+ cfg_var_writer * m_next;
+
+ PFC_CLASS_NOT_COPYABLE_EX(cfg_var_writer)
+};
+
+//! Base class for configuration variable classes; provides self-registration mechaisms and methods to set/retrieve configuration data; those methods are automatically called for all registered instances by backend when configuration file is being read or written.\n
+//! Note that cfg_var class and its derivatives may be only instantiated statically (as static objects or members of other static objects), NEVER dynamically (operator new, local variables, members of objects instantiated as such).
+class NOVTABLE cfg_var : public cfg_var_reader, public cfg_var_writer {
+protected:
+ //! @param p_guid GUID of the variable, used to identify variable implementations owning specific configuration file entries when reading the configuration file back. You must generate a new GUID every time you declare a new cfg_var.
+ cfg_var(const GUID & p_guid) : cfg_var_reader(p_guid), cfg_var_writer(p_guid) {}
+public:
+ GUID get_guid() const {return cfg_var_reader::m_guid;}
+};
+
+//! Generic integer config variable class. Template parameter can be used to specify integer type to use.\n
+//! Note that cfg_var class and its derivatives may be only instantiated statically (as static objects or members of other static objects), NEVER dynamically (operator new, local variables, members of objects instantiated as such).
+template<typename t_inttype>
+class cfg_int_t : public cfg_var {
+private:
+ t_inttype m_val;
+protected:
+ void get_data_raw(stream_writer * p_stream,abort_callback & p_abort) {p_stream->write_lendian_t(m_val,p_abort);}
+ void set_data_raw(stream_reader * p_stream,t_size p_sizehint,abort_callback & p_abort) {
+ t_inttype temp;
+ p_stream->read_lendian_t(temp,p_abort);//alter member data only on success, this will throw an exception when something isn't right
+ m_val = temp;
+ }
+
+public:
+ //! @param p_guid GUID of the variable, used to identify variable implementations owning specific configuration file entries when reading the configuration file back. You must generate a new GUID every time you declare a new cfg_var.
+ //! @param p_default Default value of the variable.
+ explicit inline cfg_int_t(const GUID & p_guid,t_inttype p_default) : cfg_var(p_guid), m_val(p_default) {}
+
+ inline const cfg_int_t<t_inttype> & operator=(const cfg_int_t<t_inttype> & p_val) {m_val=p_val.m_val;return *this;}
+ inline t_inttype operator=(t_inttype p_val) {m_val=p_val;return m_val;}
+
+ inline operator t_inttype() const {return m_val;}
+
+ inline t_inttype get_value() const {return m_val;}
+};
+
+typedef cfg_int_t<t_int32> cfg_int;
+typedef cfg_int_t<t_uint32> cfg_uint;
+//! Since relevant byteswapping functions also understand GUIDs, this can be abused to declare a cfg_guid.
+typedef cfg_int_t<GUID> cfg_guid;
+typedef cfg_int_t<bool> cfg_bool;
+
+//! String config variable. Stored in the stream with int32 header containing size in bytes, followed by non-null-terminated UTF-8 data.\n
+//! Note that cfg_var class and its derivatives may be only instantiated statically (as static objects or members of other static objects), NEVER dynamically (operator new, local variables, members of objects instantiated as such).
+class cfg_string : public cfg_var, public pfc::string8 {
+protected:
+ void get_data_raw(stream_writer * p_stream,abort_callback & p_abort);
+ void set_data_raw(stream_reader * p_stream,t_size p_sizehint,abort_callback & p_abort);
+
+public:
+ //! @param p_guid GUID of the variable, used to identify variable implementations owning specific configuration file entries when reading the configuration file back. You must generate a new GUID every time you declare a new cfg_var.
+ //! @param p_defaultval Default/initial value of the variable.
+ explicit inline cfg_string(const GUID & p_guid,const char * p_defaultval) : cfg_var(p_guid), pfc::string8(p_defaultval) {}
+
+ inline const cfg_string& operator=(const cfg_string & p_val) {set_string(p_val);return *this;}
+ inline const cfg_string& operator=(const char* p_val) {set_string(p_val);return *this;}
+
+ inline operator const char * () const {return get_ptr();}
+};
+
+
+class cfg_string_mt : public cfg_var {
+protected:
+ void get_data_raw(stream_writer * p_stream,abort_callback & p_abort) {
+ insync(m_sync);
+ p_stream->write_object(m_val.get_ptr(),m_val.length(),p_abort);
+ }
+ void set_data_raw(stream_reader * p_stream,t_size p_sizehint,abort_callback & p_abort) {
+ pfc::string8_fastalloc temp;
+ p_stream->read_string_raw(temp,p_abort);
+ set(temp);
+ }
+public:
+ cfg_string_mt(const GUID & id, const char * defVal) : cfg_var(id), m_val(defVal) {}
+ void get(pfc::string_base & out) const {
+ insync(m_sync);
+ out = m_val;
+ }
+ void set(const char * val, t_size valLen = ~0) {
+ insync(m_sync);
+ m_val.set_string(val, valLen);
+ }
+private:
+ mutable critical_section m_sync;
+ pfc::string8 m_val;
+};
+
+//! Struct config variable template. Warning: not endian safe, should be used only for nonportable code.\n
+//! Note that cfg_var class and its derivatives may be only instantiated statically (as static objects or members of other static objects), NEVER dynamically (operator new, local variables, members of objects instantiated as such).
+template<typename t_struct>
+class cfg_struct_t : public cfg_var {
+private:
+ t_struct m_val;
+protected:
+
+ void get_data_raw(stream_writer * p_stream,abort_callback & p_abort) {p_stream->write_object(&m_val,sizeof(m_val),p_abort);}
+ void set_data_raw(stream_reader * p_stream,t_size p_sizehint,abort_callback & p_abort) {
+ t_struct temp;
+ p_stream->read_object(&temp,sizeof(temp),p_abort);
+ m_val = temp;
+ }
+public:
+ //! @param p_guid GUID of the variable, used to identify variable implementations owning specific configuration file entries when reading the configuration file back. You must generate a new GUID every time you declare a new cfg_var.
+ inline cfg_struct_t(const GUID & p_guid,const t_struct & p_val) : cfg_var(p_guid), m_val(p_val) {}
+ //! @param p_guid GUID of the variable, used to identify variable implementations owning specific configuration file entries when reading the configuration file back. You must generate a new GUID every time you declare a new cfg_var.
+ inline cfg_struct_t(const GUID & p_guid,int filler) : cfg_var(p_guid) {memset(&m_val,filler,sizeof(t_struct));}
+
+ inline const cfg_struct_t<t_struct> & operator=(const cfg_struct_t<t_struct> & p_val) {m_val = p_val.get_value();return *this;}
+ inline const cfg_struct_t<t_struct> & operator=(const t_struct & p_val) {m_val = p_val;return *this;}
+
+ inline const t_struct& get_value() const {return m_val;}
+ inline t_struct& get_value() {return m_val;}
+ inline operator t_struct() const {return m_val;}
+};
+
+
+template<typename TObj>
+class cfg_objList : public cfg_var, public pfc::list_t<TObj> {
+public:
+ typedef cfg_objList<TObj> t_self;
+ cfg_objList(const GUID& guid) : cfg_var(guid) {}
+ template<typename TSource, unsigned Count> cfg_objList(const GUID& guid, const TSource (& source)[Count]) : cfg_var(guid) {
+ reset(source);
+ }
+ template<typename TSource, unsigned Count> void reset(const TSource (& source)[Count]) {
+ set_size(Count); for(t_size walk = 0; walk < Count; ++walk) (*this)[walk] = source[walk];
+ }
+ void get_data_raw(stream_writer * p_stream,abort_callback & p_abort) {
+ stream_writer_formatter<> out(*p_stream,p_abort);
+ out << pfc::downcast_guarded<t_uint32>(get_size());
+ for(t_size walk = 0; walk < get_size(); ++walk) out << (*this)[walk];
+ }
+ void set_data_raw(stream_reader * p_stream,t_size p_sizehint,abort_callback & p_abort) {
+ try {
+ stream_reader_formatter<> in(*p_stream,p_abort);
+ t_uint32 count; in >> count;
+ set_count(count);
+ for(t_uint32 walk = 0; walk < count; ++walk) in >> (*this)[walk];
+ } catch(...) {
+ remove_all();
+ throw;
+ }
+ }
+ template<typename t_in> t_self & operator=(t_in const & source) {remove_all(); add_items(source); return *this;}
+ template<typename t_in> t_self & operator+=(t_in const & p_source) {add_item(p_source); return *this;}
+ template<typename t_in> t_self & operator|=(t_in const & p_source) {add_items(p_source); return *this;}
+};
+template<typename TList>
+class cfg_objListEx : public cfg_var, public TList {
+public:
+ typedef cfg_objListEx<TList> t_self;
+ cfg_objListEx(const GUID & guid) : cfg_var(guid) {}
+ void get_data_raw(stream_writer * p_stream, abort_callback & p_abort) {
+ stream_writer_formatter<> out(*p_stream,p_abort);
+ out << pfc::downcast_guarded<t_uint32>(this->get_count());
+ for(typename TList::const_iterator walk = this->first(); walk.is_valid(); ++walk) out << *walk;
+ }
+ void set_data_raw(stream_reader * p_stream,t_size p_sizehint,abort_callback & p_abort) {
+ remove_all();
+ stream_reader_formatter<> in(*p_stream,p_abort);
+ t_uint32 count; in >> count;
+ for(t_uint32 walk = 0; walk < count; ++walk) {
+ typename TList::t_item item; in >> item; this->add_item(item);
+ }
+ }
+ template<typename t_in> t_self & operator=(t_in const & source) {remove_all(); add_items(source); return *this;}
+ template<typename t_in> t_self & operator+=(t_in const & p_source) {add_item(p_source); return *this;}
+ template<typename t_in> t_self & operator|=(t_in const & p_source) {add_items(p_source); return *this;}
+};
+
+template<typename TObj>
+class cfg_obj : public cfg_var, public TObj {
+public:
+ cfg_obj(const GUID& guid) : cfg_var(guid), TObj() {}
+ template<typename TInitData> cfg_obj(const GUID& guid,const TInitData& initData) : cfg_var(guid), TObj(initData) {}
+
+ TObj & val() {return *this;}
+ TObj const & val() const {return *this;}
+
+ void get_data_raw(stream_writer * p_stream,abort_callback & p_abort) {
+ stream_writer_formatter<> out(*p_stream,p_abort);
+ const TObj * ptr = this;
+ out << *ptr;
+ }
+ void set_data_raw(stream_reader * p_stream,t_size p_sizehint,abort_callback & p_abort) {
+ stream_reader_formatter<> in(*p_stream,p_abort);
+ TObj * ptr = this;
+ in >> *ptr;
+ }
+};
+
+template<typename TObj, typename TImport> class cfg_objListImporter : private cfg_var_reader {
+public:
+ typedef cfg_objList<TObj> TMasterVar;
+ cfg_objListImporter(TMasterVar & var, const GUID & guid) : m_var(var), cfg_var_reader(guid) {}
+
+ private:
+ void set_data_raw(stream_reader * p_stream,t_size p_sizehint,abort_callback & p_abort) {
+ TImport temp;
+ try {
+ stream_reader_formatter<> in(*p_stream,p_abort);
+ t_uint32 count; in >> count;
+ m_var.set_count(count);
+ for(t_uint32 walk = 0; walk < count; ++walk) {
+ in >> temp;
+ m_var[walk] = temp;
+ }
+ } catch(...) {
+ m_var.remove_all();
+ throw;
+ }
+ }
+ TMasterVar & m_var;
+};
+template<typename TMap> class cfg_objMap : private cfg_var, public TMap {
+public:
+ cfg_objMap(const GUID & id) : cfg_var(id) {}
+private:
+ void get_data_raw(stream_writer * p_stream,abort_callback & p_abort) {
+ stream_writer_formatter<> out(*p_stream, p_abort);
+ out << pfc::downcast_guarded<t_uint32>(this->get_count());
+ for(typename TMap::const_iterator walk = this->first(); walk.is_valid(); ++walk) {
+ out << walk->m_key << walk->m_value;
+ }
+ }
+ void set_data_raw(stream_reader * p_stream,t_size p_sizehint,abort_callback & p_abort) {
+ remove_all();
+ stream_reader_formatter<> in(*p_stream, p_abort);
+ t_uint32 count; in >> count;
+ for(t_uint32 walk = 0; walk < count; ++walk) {
+ TMap::t_key key; in >> key; PFC_ASSERT( !this->have_item(key) );
+ try { in >> this->find_or_add( key ); } catch(...) { this->remove(key); throw; }
+ }
+ }
+};
+
+#endif
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/chapterizer.cpp b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/chapterizer.cpp new file mode 100644 index 0000000000..2187060c28 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/chapterizer.cpp @@ -0,0 +1,96 @@ +#include "foobar2000.h"
+
+void chapter_list::copy(const chapter_list & p_source)
+{
+ t_size n, count = p_source.get_chapter_count();
+ set_chapter_count(count);
+ for(n=0;n<count;n++) set_info(n,p_source.get_info(n));
+ set_pregap(p_source.get_pregap());
+}
+
+bool chapterizer::g_find(service_ptr_t<chapterizer> & p_out,const char * p_path)
+{
+ service_ptr_t<chapterizer> ptr;
+ service_enum_t<chapterizer> e;
+ while(e.next(ptr)) {
+ if (ptr->is_our_path(p_path)) {
+ p_out = ptr;
+ return true;
+ }
+ }
+ return false;
+}
+
+bool chapterizer::g_is_pregap_capable(const char * p_path) {
+ service_ptr_t<chapterizer> ptr;
+ service_enum_t<chapterizer> e;
+ while(e.next(ptr)) {
+ if (ptr->supports_pregaps() && ptr->is_our_path(p_path)) {
+ return true;
+ }
+ }
+ return false;
+}
+
+cuesheet_format_index_time::cuesheet_format_index_time(double p_time)
+{
+ t_uint64 ticks = audio_math::time_to_samples(p_time,75);
+ t_uint64 seconds = ticks / 75; ticks %= 75;
+ t_uint64 minutes = seconds / 60; seconds %= 60;
+ m_buffer << pfc::format_uint(minutes,2) << ":" << pfc::format_uint(seconds,2) << ":" << pfc::format_uint(ticks,2);
+}
+
+double cuesheet_parse_index_time_e(const char * p_string,t_size p_length)
+{
+ return (double) cuesheet_parse_index_time_ticks_e(p_string,p_length) / 75.0;
+}
+
+unsigned cuesheet_parse_index_time_ticks_e(const char * p_string,t_size p_length)
+{
+ p_length = pfc::strlen_max(p_string,p_length);
+ t_size ptr = 0;
+ t_size splitmarks[2];
+ t_size splitptr = 0;
+ for(ptr=0;ptr<p_length;ptr++)
+ {
+ if (p_string[ptr] == ':')
+ {
+ if (splitptr >= 2) throw std::exception("invalid INDEX time syntax",0);
+ splitmarks[splitptr++] = ptr;
+ }
+ else if (!pfc::char_is_numeric(p_string[ptr])) throw std::exception("invalid INDEX time syntax",0);
+ }
+
+ t_size minutes_base = 0, minutes_length = 0, seconds_base = 0, seconds_length = 0, frames_base = 0, frames_length = 0;
+
+ switch(splitptr)
+ {
+ case 0:
+ frames_base = 0;
+ frames_length = p_length;
+ break;
+ case 1:
+ seconds_base = 0;
+ seconds_length = splitmarks[0];
+ frames_base = splitmarks[0] + 1;
+ frames_length = p_length - frames_base;
+ break;
+ case 2:
+ minutes_base = 0;
+ minutes_length = splitmarks[0];
+ seconds_base = splitmarks[0] + 1;
+ seconds_length = splitmarks[1] - seconds_base;
+ frames_base = splitmarks[1] + 1;
+ frames_length = p_length - frames_base;
+ break;
+ }
+
+ unsigned ret = 0;
+
+ if (frames_length > 0) ret += pfc::atoui_ex(p_string + frames_base,frames_length);
+ if (seconds_length > 0) ret += 75 * pfc::atoui_ex(p_string + seconds_base,seconds_length);
+ if (minutes_length > 0) ret += 60 * 75 * pfc::atoui_ex(p_string + minutes_base,minutes_length);
+
+ return ret;
+}
+
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/chapterizer.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/chapterizer.h new file mode 100644 index 0000000000..dd4578e53f --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/chapterizer.h @@ -0,0 +1,97 @@ +//! Interface for object storing list of chapters.
+class NOVTABLE chapter_list {
+public:
+ //! Returns number of chapters.
+ virtual t_size get_chapter_count() const = 0;
+ //! Queries description of specified chapter.
+ //! @param p_chapter Index of chapter to query, greater or equal zero and less than get_chapter_count() value. If p_chapter value is out of valid range, results are undefined (e.g. crash).
+ //! @returns reference to file_info object describing specified chapter (length part of file_info indicates distance between beginning of this chapter and next chapter mark). Returned reference value for temporary use only, becomes invalid after any non-const operation on the chapter_list object.
+ virtual const file_info & get_info(t_size p_chapter) const = 0;
+
+ //! Sets number of chapters.
+ virtual void set_chapter_count(t_size p_count) = 0;
+ //! Modifies description of specified chapter.
+ //! @param p_chapter_index Index of chapter to modify, greater or equal zero and less than get_chapter_count() value. If p_chapter value is out of valid range, results are undefined (e.g. crash).
+ //! @param p_info New chapter description. Note that length part of file_info is used to calculate chapter marks.
+ virtual void set_info(t_size p_chapter,const file_info & p_info) = 0;
+
+ virtual double get_pregap() const = 0;
+ virtual void set_pregap(double val) = 0;
+
+ //! Copies contents of specified chapter_list object to this object.
+ void copy(const chapter_list & p_source);
+
+ inline const chapter_list & operator=(const chapter_list & p_source) {copy(p_source); return *this;}
+
+protected:
+ chapter_list() {}
+ ~chapter_list() {}
+};
+
+//! Implements chapter_list.
+template<typename file_info_ = file_info_impl>
+class chapter_list_impl_t : public chapter_list {
+public:
+ chapter_list_impl_t() : m_pregap() {}
+ typedef chapter_list_impl_t<file_info_> t_self;
+ chapter_list_impl_t(const chapter_list & p_source) : m_pregap() {copy(p_source);}
+
+ const t_self & operator=(const chapter_list & p_source) {copy(p_source); return *this;}
+
+ t_size get_chapter_count() const {return m_infos.get_size();}
+ const file_info & get_info(t_size p_chapter) const {return m_infos[p_chapter];}
+
+ void set_chapter_count(t_size p_count) {m_infos.set_size(p_count);}
+ void set_info(t_size p_chapter,const file_info & p_info) {m_infos[p_chapter] = p_info;}
+ file_info_ & get_info_(t_size p_chapter) {return m_infos[p_chapter];}
+
+ double get_pregap() const {return m_pregap;}
+ void set_pregap(double val) {PFC_ASSERT(val >= 0); m_pregap = val;}
+private:
+ pfc::array_t<file_info_> m_infos;
+ double m_pregap;
+};
+
+typedef chapter_list_impl_t<> chapter_list_impl;
+
+
+//! This service implements chapter list editing operations for various file formats, e.g. for MP4 chapters or CD images with embedded cuesheets. Used by converter "encode single file with chapters" feature.
+class NOVTABLE chapterizer : public service_base {
+ FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(chapterizer);
+public:
+ //! Tests whether specified path is supported by this implementation.
+ //! @param p_ext Extension of the file being processed.
+ virtual bool is_our_path(const char * p_path) = 0;
+
+ //! Writes new chapter list to specified file.
+ //! @param p_path Path of file to modify.
+ //! @param p_list New chapter list to write.
+ //! @param p_abort abort_callback object signaling user aborting the operation.
+ virtual void set_chapters(const char * p_path,chapter_list const & p_list,abort_callback & p_abort) = 0;
+ //! Retrieves chapter list from specified file.
+ //! @param p_path Path of file to examine.
+ //! @param p_list Object receiving chapter list.
+ //! @param p_abort abort_callback object signaling user aborting the operation.
+ virtual void get_chapters(const char * p_path,chapter_list & p_list,abort_callback & p_abort) = 0;
+
+ virtual bool supports_pregaps() = 0;
+
+ //! Static helper, tries to find chapterizer interface that supports specified file.
+ static bool g_find(service_ptr_t<chapterizer> & p_out,const char * p_path);
+
+ static bool g_is_pregap_capable(const char * p_path);
+};
+
+
+
+unsigned cuesheet_parse_index_time_ticks_e(const char * p_string,t_size p_length);
+double cuesheet_parse_index_time_e(const char * p_string,t_size p_length);
+
+class cuesheet_format_index_time
+{
+public:
+ cuesheet_format_index_time(double p_time);
+ inline operator const char*() const {return m_buffer;}
+private:
+ pfc::string_formatter m_buffer;
+};
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/commandline.cpp b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/commandline.cpp new file mode 100644 index 0000000000..b76fd737ae --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/commandline.cpp @@ -0,0 +1,12 @@ +#include "foobar2000.h"
+
+void commandline_handler_metadb_handle::on_file(const char * url) {
+ metadb_handle_list handles;
+ try {
+ static_api_ptr_t<metadb_io>()->path_to_handles_simple(url, handles);
+ } catch(std::exception const & e) {
+ console::complain("Path evaluation failure", e);
+ return;
+ }
+ for(t_size walk = 0; walk < handles.get_size(); ++walk) on_file(handles[walk]);
+}
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/commandline.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/commandline.h new file mode 100644 index 0000000000..fd827b0e1a --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/commandline.h @@ -0,0 +1,41 @@ +class NOVTABLE commandline_handler : public service_base
+{
+public:
+ enum result
+ {
+ RESULT_NOT_OURS,//not our command
+ RESULT_PROCESSED,//command processed
+ RESULT_PROCESSED_EXPECT_FILES,//command processed, we want to takeover file urls after this command
+ };
+ virtual result on_token(const char * token)=0;
+ virtual void on_file(const char * url) {};//optional
+ virtual void on_files_done() {};//optional
+ virtual bool want_directories() {return false;}
+
+ FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(commandline_handler);
+};
+
+class commandline_handler_metadb_handle : public commandline_handler//helper
+{
+protected:
+ virtual void on_file(const char * url);
+ virtual bool want_directories() {return true;}
+public:
+ virtual result on_token(const char * token)=0;
+ virtual void on_files_done() {};
+
+ virtual void on_file(const metadb_handle_ptr & ptr)=0;
+};
+
+/*
+
+how commandline_handler is used:
+
+ scenario #1:
+ creation => on_token() => deletion
+ scenario #2:
+ creation => on_token() returning RESULT_PROCESSED_EXPECT_FILES => on_file(), on_file().... => on_files_done() => deletion
+*/
+
+template<typename T>
+class commandline_handler_factory_t : public service_factory_t<T> {};
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/completion_notify.cpp b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/completion_notify.cpp new file mode 100644 index 0000000000..0a183a8b05 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/completion_notify.cpp @@ -0,0 +1,25 @@ +#include "foobar2000.h"
+
+namespace {
+ class main_thread_callback_myimpl : public main_thread_callback {
+ public:
+ void callback_run() {
+ m_notify->on_completion(m_code);
+ }
+
+ main_thread_callback_myimpl(completion_notify_ptr p_notify,unsigned p_code) : m_notify(p_notify), m_code(p_code) {}
+ private:
+ completion_notify_ptr m_notify;
+ unsigned m_code;
+ };
+}
+
+void completion_notify::g_signal_completion_async(completion_notify_ptr p_notify,unsigned p_code) {
+ if (p_notify.is_valid()) {
+ static_api_ptr_t<main_thread_callback_manager>()->add_callback(new service_impl_t<main_thread_callback_myimpl>(p_notify,p_code));
+ }
+}
+
+void completion_notify::on_completion_async(unsigned p_code) {
+ static_api_ptr_t<main_thread_callback_manager>()->add_callback(new service_impl_t<main_thread_callback_myimpl>(this,p_code));
+}
\ No newline at end of file diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/completion_notify.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/completion_notify.h new file mode 100644 index 0000000000..4781de62a1 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/completion_notify.h @@ -0,0 +1,99 @@ +//! Generic service for receiving notifications about async operation completion. Used by various other services.
+class completion_notify : public service_base {
+public:
+ //! Called when an async operation has been completed. Note that on_completion is always called from main thread. You can use on_completion_async() helper if you need to signal completion while your context is in another thread.\n
+ //! IMPLEMENTATION WARNING: If process being completed creates a window taking caller's window as parent, you must not destroy the parent window inside on_completion(). If you need to do so, use PostMessage() or main_thread_callback to delay the deletion.
+ //! @param p_code Context-specific status code. Possible values depend on the operation being performed.
+ virtual void on_completion(unsigned p_code) = 0;
+
+ //! Helper. Queues a notification, using main_thread_callback.
+ void on_completion_async(unsigned p_code);
+
+ //! Helper. Checks for null ptr and calls on_completion_async when the ptr is not null.
+ static void g_signal_completion_async(service_ptr_t<completion_notify> p_notify,unsigned p_code);
+
+ FB2K_MAKE_SERVICE_INTERFACE(completion_notify,service_base);
+};
+
+//! Implementation helper.
+class completion_notify_dummy : public completion_notify {
+public:
+ void on_completion(unsigned p_code) {}
+};
+
+//! Implementation helper.
+class completion_notify_orphanable : public completion_notify {
+public:
+ virtual void orphan() = 0;
+};
+
+//! Helper implementation.
+//! IMPLEMENTATION WARNING: If process being completed creates a window taking caller's window as parent, you must not destroy the parent window inside on_task_completion(). If you need to do so, use PostMessage() or main_thread_callback to delay the deletion.
+template<typename t_receiver>
+class completion_notify_impl : public completion_notify_orphanable {
+public:
+ void on_completion(unsigned p_code) {
+ if (m_receiver != NULL) {
+ m_receiver->on_task_completion(m_taskid,p_code);
+ }
+ }
+ void setup(t_receiver * p_receiver, unsigned p_task_id) {m_receiver = p_receiver; m_taskid = p_task_id;}
+ void orphan() {m_receiver = NULL; m_taskid = 0;}
+private:
+ t_receiver * m_receiver;
+ unsigned m_taskid;
+};
+
+template<typename t_receiver>
+service_nnptr_t<completion_notify_orphanable> completion_notify_create(t_receiver * p_receiver,unsigned p_taskid) {
+ service_nnptr_t<completion_notify_impl<t_receiver> > instance = new service_impl_t<completion_notify_impl<t_receiver> >();
+ instance->setup(p_receiver,p_taskid);
+ return instance;
+}
+
+typedef service_ptr_t<completion_notify> completion_notify_ptr;
+typedef service_ptr_t<completion_notify_orphanable> completion_notify_orphanable_ptr;
+typedef service_nnptr_t<completion_notify> completion_notify_nnptr;
+typedef service_nnptr_t<completion_notify_orphanable> completion_notify_orphanable_nnptr;
+
+//! Helper base class for classes that manage nonblocking tasks and get notified back thru completion_notify interface.
+class completion_notify_receiver {
+public:
+ completion_notify::ptr create_or_get_task(unsigned p_id) {
+ completion_notify_orphanable_ptr ptr;
+ if (!m_tasks.query(p_id,ptr)) {
+ ptr = completion_notify_create(this,p_id);
+ m_tasks.set(p_id,ptr);
+ }
+ return ptr;
+ }
+ completion_notify_ptr create_task(unsigned p_id) {
+ completion_notify_orphanable_ptr ptr;
+ if (m_tasks.query(p_id,ptr)) ptr->orphan();
+ ptr = completion_notify_create(this,p_id);
+ m_tasks.set(p_id,ptr);
+ return ptr;
+ }
+ bool have_task(unsigned p_id) const {
+ return m_tasks.have_item(p_id);
+ }
+ void orphan_task(unsigned p_id) {
+ completion_notify_orphanable_ptr ptr;
+ if (m_tasks.query(p_id,ptr)) {
+ ptr->orphan();
+ m_tasks.remove(p_id);
+ }
+ }
+ ~completion_notify_receiver() {
+ orphan_all_tasks();
+ }
+ void orphan_all_tasks() {
+ m_tasks.enumerate(orphanfunc);
+ m_tasks.remove_all();
+ }
+
+ virtual void on_task_completion(unsigned p_id,unsigned p_status) {}
+private:
+ static void orphanfunc(unsigned,completion_notify_orphanable_nnptr p_item) {p_item->orphan();}
+ pfc::map_t<unsigned,completion_notify_orphanable_nnptr> m_tasks;
+};
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/component.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/component.h new file mode 100644 index 0000000000..8a81bb99b7 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/component.h @@ -0,0 +1,55 @@ +#include "foobar2000.h"
+
+// This is a helper class that gets reliably static-instantiated in all components so any special code that must be executed on startup can be shoved into its constructor.
+class foobar2000_component_globals {
+public:
+ foobar2000_component_globals() {
+#ifndef _DEBUG
+ ::OverrideCrtAbort();
+#endif
+ }
+};
+
+class NOVTABLE foobar2000_client
+{
+public:
+ typedef service_factory_base* pservice_factory_base;
+
+ enum {
+ FOOBAR2000_CLIENT_VERSION_COMPATIBLE = 72,
+ FOOBAR2000_CLIENT_VERSION = FOOBAR2000_TARGET_VERSION,
+ };
+ virtual t_uint32 get_version() = 0;
+ virtual pservice_factory_base get_service_list() = 0;
+
+ virtual void get_config(stream_writer * p_stream,abort_callback & p_abort) = 0;
+ virtual void set_config(stream_reader * p_stream,abort_callback & p_abort) = 0;
+ virtual void set_library_path(const char * path,const char * name) = 0;
+ virtual void services_init(bool val) = 0;
+ virtual bool is_debug() = 0;
+protected:
+ foobar2000_client() {}
+ ~foobar2000_client() {}
+};
+
+class NOVTABLE foobar2000_api {
+public:
+ virtual service_class_ref service_enum_find_class(const GUID & p_guid) = 0;
+ virtual bool service_enum_create(service_ptr_t<service_base> & p_out,service_class_ref p_class,t_size p_index) = 0;
+ virtual t_size service_enum_get_count(service_class_ref p_class) = 0;
+ virtual HWND get_main_window()=0;
+ virtual bool assert_main_thread()=0;
+ virtual bool is_main_thread()=0;
+ virtual bool is_shutting_down()=0;
+ virtual const char * get_profile_path()=0;
+ virtual bool is_initializing() = 0;
+
+ //New in 0.9.6
+ virtual bool is_portable_mode_enabled() = 0;
+ virtual bool is_quiet_mode_enabled() = 0;
+protected:
+ foobar2000_api() {}
+ ~foobar2000_api() {}
+};
+
+extern foobar2000_api * g_foobar2000_api;
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/component_client.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/component_client.h new file mode 100644 index 0000000000..46aa848887 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/component_client.h @@ -0,0 +1,6 @@ +#ifndef _COMPONENT_CLIENT_H_
+#define _COMPONENT_CLIENT_H_
+
+
+
+#endif //_COMPONENT_CLIENT_H_
\ No newline at end of file diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/components_menu.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/components_menu.h new file mode 100644 index 0000000000..835237331c --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/components_menu.h @@ -0,0 +1,7 @@ +#ifndef _COMPONENTS_MENU_H_
+#define _COMPONENTS_MENU_H_
+
+#error deprecated, see menu_item.h
+
+
+#endif
\ No newline at end of file diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/componentversion.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/componentversion.h new file mode 100644 index 0000000000..b0ca6fa7b1 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/componentversion.h @@ -0,0 +1,94 @@ +//! Entrypoint interface for declaring component's version information. Instead of implementing this directly, use DECLARE_COMPONENT_VERSION().
+class NOVTABLE componentversion : public service_base {
+public:
+ virtual void get_file_name(pfc::string_base & out)=0;
+ virtual void get_component_name(pfc::string_base & out)=0;
+ virtual void get_component_version(pfc::string_base & out)=0;
+ virtual void get_about_message(pfc::string_base & out)=0;//about message uses "\n" for line separators
+
+ FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(componentversion);
+};
+
+//! Implementation helper. You typically want to use DECLARE_COMPONENT_VERSION() instead.
+class componentversion_impl_simple : public componentversion {
+ const char * name,*version,*about;
+public:
+ //do not derive/override
+ virtual void get_file_name(pfc::string_base & out) {out.set_string(core_api::get_my_file_name());}
+ virtual void get_component_name(pfc::string_base & out) {out.set_string(name?name:"");}
+ virtual void get_component_version(pfc::string_base & out) {out.set_string(version?version:"");}
+ virtual void get_about_message(pfc::string_base & out) {out.set_string(about?about:"");}
+ explicit componentversion_impl_simple(const char * p_name,const char * p_version,const char * p_about) : name(p_name), version(p_version), about(p_about ? p_about : "") {}
+};
+
+//! Implementation helper. You typically want to use DECLARE_COMPONENT_VERSION() instead.
+class componentversion_impl_copy : public componentversion {
+ pfc::string8 name,version,about;
+public:
+ //do not derive/override
+ virtual void get_file_name(pfc::string_base & out) {out.set_string(core_api::get_my_file_name());}
+ virtual void get_component_name(pfc::string_base & out) {out.set_string(name);}
+ virtual void get_component_version(pfc::string_base & out) {out.set_string(version);}
+ virtual void get_about_message(pfc::string_base & out) {out.set_string(about);}
+ explicit componentversion_impl_copy(const char * p_name,const char * p_version,const char * p_about) : name(p_name), version(p_version), about(p_about ? p_about : "") {}
+};
+
+typedef service_factory_single_transparent_t<componentversion_impl_simple> __componentversion_impl_simple_factory;
+typedef service_factory_single_transparent_t<componentversion_impl_copy> __componentversion_impl_copy_factory;
+
+class componentversion_impl_simple_factory : public __componentversion_impl_simple_factory {
+public:
+ componentversion_impl_simple_factory(const char * p_name,const char * p_version,const char * p_about) : __componentversion_impl_simple_factory(p_name,p_version,p_about) {}
+};
+
+class componentversion_impl_copy_factory : public __componentversion_impl_copy_factory {
+public:
+ componentversion_impl_copy_factory(const char * p_name,const char * p_version,const char * p_about) : __componentversion_impl_copy_factory(p_name,p_version,p_about) {}
+};
+
+//! Use this to declare your component's version information. Parameters must ba plain const char * string constants. \n
+//! You should have only one DECLARE_COMPONENT_VERSION() per component DLL. Having more than one will confuse component updater's version matching. \n
+//! Please keep your version numbers formatted as: N[.N[.N....]][ alpha|beta|RC[ N[.N...]] \n
+//! Sample version numbers, in ascending order: 0.9 < 0.10 < 1.0 alpha 1 < 1.0 alpha 2 < 1.0 beta 1 < 1.0 RC < 1.0 RC1 < 1.0 < 1.1 < 1.10 \n
+//! For a working sample of how foobar2000 sorts version numbers, see http://www.foobar2000.org/versionator.php \n
+//! Example: DECLARE_COMPONENT_VERSION("blah","1.3.3.7","")
+#define DECLARE_COMPONENT_VERSION(NAME,VERSION,ABOUT) \
+ namespace {class componentversion_myimpl : public componentversion { public: componentversion_myimpl() {PFC_ASSERT( ABOUT );} \
+ void get_file_name(pfc::string_base & out) {out = core_api::get_my_file_name();} \
+ void get_component_name(pfc::string_base & out) {out = NAME;} \
+ void get_component_version(pfc::string_base & out) {out = VERSION;} \
+ void get_about_message(pfc::string_base & out) {out = ABOUT;} \
+ }; static service_factory_single_t<componentversion_myimpl> g_componentversion_myimpl_factory; }
+ // static componentversion_impl_simple_factory g_componentversion_service(NAME,VERSION,ABOUT);
+
+//! Same as DECLARE_COMPONENT_VERSION(), but parameters can be dynamically generated strings rather than compile-time constants.
+#define DECLARE_COMPONENT_VERSION_COPY(NAME,VERSION,ABOUT) \
+ static componentversion_impl_copy_factory g_componentversion_service(NAME,VERSION,ABOUT);
+
+
+//! \since 1.0
+//! Allows components to cleanly abort app startup in case the installation appears to have become corrupted.
+class component_installation_validator : public service_base {
+public:
+ virtual bool is_installed_correctly() = 0;
+
+ FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(component_installation_validator)
+};
+
+//! Simple implementation of component_installation_validator that makes sure that our component DLL has not been renamed around by idiot users.
+class component_installation_validator_filename : public component_installation_validator {
+public:
+ component_installation_validator_filename(const char * dllName) : m_dllName(dllName) {}
+ bool is_installed_correctly() {
+ const char * path = core_api::get_my_full_path();
+ path += pfc::scan_filename(path);
+ bool retVal = ( strcmp(path, m_dllName) == 0 );
+ PFC_ASSERT( retVal );
+ return retVal;
+ }
+private:
+ const char * const m_dllName;
+};
+
+#define VALIDATE_COMPONENT_FILENAME(FN) \
+ static service_factory_single_t<component_installation_validator_filename> g_component_installation_validator_filename(FN);
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/config_io_callback.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/config_io_callback.h new file mode 100644 index 0000000000..4b83dce314 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/config_io_callback.h @@ -0,0 +1,23 @@ +//! Implementing this interface lets you maintain your own configuration files rather than depending on the cfg_var system. \n
+//! Note that you must not make assumptions about what happens first: config_io_callback::on_read(), initialization of cfg_var values or config_io_callback::on_read() in other components. Order of these things is undefined and will change with each run. \n
+//! Use service_factory_single_t<myclass> to register your implementations. Do not call other people's implementations, core is responsible for doing that when appropriate.
+class NOVTABLE config_io_callback : public service_base {
+public:
+ //! Called on startup. You can read your configuration file from here. \n
+ //! Hint: use core_api::get_profile_path() to retrieve the path of the folder where foobar2000 configuration files are stored.
+ virtual void on_read() = 0;
+ //! Called typically on shutdown but you should expect a call at any point after on_read(). You can write your configuration file from here.
+ //! Hint: use core_api::get_profile_path() to retrieve the path of the folder where foobar2000 configuration files are stored.
+ //! @param reset If set to true, our configuration is being reset, so you should wipe your files rather than rewrite them with current configuration.
+ virtual void on_write(bool reset) = 0;
+
+ FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(config_io_callback);
+};
+
+//! \since 1.0
+class NOVTABLE config_io_callback_v2 : public config_io_callback {
+ FB2K_MAKE_SERVICE_INTERFACE(config_io_callback_v2, config_io_callback)
+public:
+ //! Implement optionally. Called to quickly flush recent configuration changes. If your instance of config_io_callback needs to perform timeconsuming tasks when saving, you should skip implementing this method entirely.
+ virtual void on_quicksave() = 0;
+};
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/config_object.cpp b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/config_object.cpp new file mode 100644 index 0000000000..76ba27d35a --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/config_object.cpp @@ -0,0 +1,206 @@ +#include "foobar2000.h"
+
+void config_object_notify_manager::g_on_changed(const service_ptr_t<config_object> & p_object)
+{
+ if (core_api::assert_main_thread())
+ {
+ service_enum_t<config_object_notify_manager> e;
+ service_ptr_t<config_object_notify_manager> ptr;
+ while(e.next(ptr))
+ ptr->on_changed(p_object);
+ }
+}
+
+bool config_object::g_find(service_ptr_t<config_object> & p_out,const GUID & p_guid)
+{
+ service_ptr_t<config_object> ptr;
+ service_enum_t<config_object> e;
+ while(e.next(ptr))
+ {
+ if (ptr->get_guid() == p_guid)
+ {
+ p_out = ptr;
+ return true;
+ }
+ }
+ return false;
+}
+
+void config_object::g_get_data_string(const GUID & p_guid,pfc::string_base & p_out)
+{
+ service_ptr_t<config_object> ptr;
+ if (!g_find(ptr,p_guid)) throw exception_service_not_found();
+ ptr->get_data_string(p_out);
+}
+
+void config_object::g_set_data_string(const GUID & p_guid,const char * p_data,t_size p_length)
+{
+ service_ptr_t<config_object> ptr;
+ if (!g_find(ptr,p_guid)) throw exception_service_not_found();
+ ptr->set_data_string(p_data,p_length);
+}
+
+void config_object::get_data_int32(t_int32 & p_out)
+{
+ t_int32 temp;
+ get_data_struct_t<t_int32>(temp);
+ byte_order::order_le_to_native_t(temp);
+ p_out = temp;
+}
+
+void config_object::set_data_int32(t_int32 p_val)
+{
+ t_int32 temp = p_val;
+ byte_order::order_native_to_le_t(temp);
+ set_data_struct_t<t_int32>(temp);
+}
+
+bool config_object::get_data_bool_simple(bool p_default) {
+ try {
+ bool ret = p_default;
+ get_data_bool(ret);
+ return ret;
+ } catch(...) {return p_default;}
+}
+
+t_int32 config_object::get_data_int32_simple(t_int32 p_default) {
+ try {
+ t_int32 ret = p_default;
+ get_data_int32(ret);
+ return ret;
+ } catch(...) {return p_default;}
+}
+
+void config_object::g_get_data_int32(const GUID & p_guid,t_int32 & p_out) {
+ service_ptr_t<config_object> ptr;
+ if (!g_find(ptr,p_guid)) throw exception_service_not_found();
+ ptr->get_data_int32(p_out);
+}
+
+void config_object::g_set_data_int32(const GUID & p_guid,t_int32 p_val) {
+ service_ptr_t<config_object> ptr;
+ if (!g_find(ptr,p_guid)) throw exception_service_not_found();
+ ptr->set_data_int32(p_val);
+}
+
+bool config_object::g_get_data_bool_simple(const GUID & p_guid,bool p_default)
+{
+ service_ptr_t<config_object> ptr;
+ if (!g_find(ptr,p_guid)) throw exception_service_not_found();
+ return ptr->get_data_bool_simple(p_default);
+}
+
+t_int32 config_object::g_get_data_int32_simple(const GUID & p_guid,t_int32 p_default)
+{
+ service_ptr_t<config_object> ptr;
+ if (!g_find(ptr,p_guid)) throw exception_service_not_found();
+ return ptr->get_data_int32_simple(p_default);
+}
+
+void config_object::get_data_bool(bool & p_out) {get_data_struct_t<bool>(p_out);}
+void config_object::set_data_bool(bool p_val) {set_data_struct_t<bool>(p_val);}
+
+void config_object::g_get_data_bool(const GUID & p_guid,bool & p_out) {g_get_data_struct_t<bool>(p_guid,p_out);}
+void config_object::g_set_data_bool(const GUID & p_guid,bool p_val) {g_set_data_struct_t<bool>(p_guid,p_val);}
+
+namespace {
+ class stream_writer_string : public stream_writer {
+ public:
+ void write(const void * p_buffer,t_size p_bytes,abort_callback & p_abort) {
+ m_out.add_string((const char*)p_buffer,p_bytes);
+ }
+ stream_writer_string(pfc::string_base & p_out) : m_out(p_out) {m_out.reset();}
+ private:
+ pfc::string_base & m_out;
+ };
+
+ class stream_writer_fixedbuffer : public stream_writer {
+ public:
+ void write(const void * p_buffer,t_size p_bytes,abort_callback & p_abort) {
+ if (p_bytes > 0) {
+ if (p_bytes > m_bytes - m_bytes_read) throw pfc::exception_overflow();
+ memcpy((t_uint8*)m_out,p_buffer,p_bytes);
+ m_bytes_read += p_bytes;
+ }
+ }
+ stream_writer_fixedbuffer(void * p_out,t_size p_bytes,t_size & p_bytes_read) : m_out(p_out), m_bytes(p_bytes), m_bytes_read(p_bytes_read) {m_bytes_read = 0;}
+ private:
+ void * m_out;
+ t_size m_bytes;
+ t_size & m_bytes_read;
+ };
+
+
+
+ class stream_writer_get_length : public stream_writer {
+ public:
+ void write(const void * p_buffer,t_size p_bytes,abort_callback & p_abort) {
+ m_length += p_bytes;
+ }
+ stream_writer_get_length(t_size & p_length) : m_length(p_length) {m_length = 0;}
+ private:
+ t_size & m_length;
+ };
+};
+
+t_size config_object::get_data_raw(void * p_out,t_size p_bytes) {
+ t_size ret = 0;
+ get_data(&stream_writer_fixedbuffer(p_out,p_bytes,ret),abort_callback_dummy());
+ return ret;
+}
+
+t_size config_object::get_data_raw_length() {
+ t_size ret = 0;
+ get_data(&stream_writer_get_length(ret),abort_callback_dummy());
+ return ret;
+}
+
+void config_object::set_data_raw(const void * p_data,t_size p_bytes, bool p_notify) {
+ set_data(&stream_reader_memblock_ref(p_data,p_bytes),abort_callback_dummy(),p_notify);
+}
+
+void config_object::set_data_string(const char * p_data,t_size p_length) {
+ set_data_raw(p_data,pfc::strlen_max(p_data,p_length));
+}
+
+void config_object::get_data_string(pfc::string_base & p_out) {
+ get_data(&stream_writer_string(p_out),abort_callback_dummy());
+}
+
+
+//config_object_impl stuff
+
+
+void config_object_impl::get_data(stream_writer * p_stream,abort_callback & p_abort) const {
+ insync(m_sync);
+ p_stream->write_object(m_data.get_ptr(),m_data.get_size(),p_abort);
+}
+
+void config_object_impl::set_data(stream_reader * p_stream,abort_callback & p_abort,bool p_notify) {
+ core_api::ensure_main_thread();
+
+ {
+ insync(m_sync);
+ m_data.set_size(0);
+ enum {delta = 1024};
+ t_uint8 buffer[delta];
+ for (;;)
+ {
+ t_size delta_done = p_stream->read(buffer,delta,p_abort);
+
+ if (delta_done > 0)
+ {
+ m_data.append_fromptr(buffer,delta_done);
+ }
+
+ if (delta_done != delta) break;
+ }
+ }
+
+ if (p_notify) config_object_notify_manager::g_on_changed(this);
+}
+
+config_object_impl::config_object_impl(const GUID & p_guid,const void * p_data,t_size p_bytes) : cfg_var(p_guid)
+{
+ m_data.set_data_fromptr((const t_uint8*)p_data,p_bytes);
+}
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/config_object.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/config_object.h new file mode 100644 index 0000000000..e460dc5400 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/config_object.h @@ -0,0 +1,85 @@ +#ifndef _CONFIG_OBJECT_H_
+#define _CONFIG_OBJECT_H_
+
+class config_object;
+
+class NOVTABLE config_object_notify_manager : public service_base
+{
+public:
+ virtual void on_changed(const service_ptr_t<config_object> & p_object) = 0;
+ static void g_on_changed(const service_ptr_t<config_object> & p_object);
+
+
+ FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(config_object_notify_manager);
+};
+
+class NOVTABLE config_object : public service_base
+{
+public:
+ //interface
+ virtual GUID get_guid() const = 0;
+ virtual void get_data(stream_writer * p_stream,abort_callback & p_abort) const = 0;
+ virtual void set_data(stream_reader * p_stream,abort_callback & p_abort,bool p_sendnotify = true) = 0;
+
+ //helpers
+ static bool g_find(service_ptr_t<config_object> & p_out,const GUID & p_guid);
+
+ void set_data_raw(const void * p_data,t_size p_bytes,bool p_sendnotify = true);
+ t_size get_data_raw(void * p_out,t_size p_bytes);
+ t_size get_data_raw_length();
+
+ template<class T> void get_data_struct_t(T& p_out);
+ template<class T> void set_data_struct_t(const T& p_in);
+ template<class T> static void g_get_data_struct_t(const GUID & p_guid,T & p_out);
+ template<class T> static void g_set_data_struct_t(const GUID & p_guid,const T & p_in);
+
+ void set_data_string(const char * p_data,t_size p_length);
+ void get_data_string(pfc::string_base & p_out);
+
+ void get_data_bool(bool & p_out);
+ void set_data_bool(bool p_val);
+ void get_data_int32(t_int32 & p_out);
+ void set_data_int32(t_int32 p_val);
+ bool get_data_bool_simple(bool p_default);
+ t_int32 get_data_int32_simple(t_int32 p_default);
+
+ static void g_get_data_string(const GUID & p_guid,pfc::string_base & p_out);
+ static void g_set_data_string(const GUID & p_guid,const char * p_data,t_size p_length = ~0);
+
+ static void g_get_data_bool(const GUID & p_guid,bool & p_out);
+ static void g_set_data_bool(const GUID & p_guid,bool p_val);
+ static void g_get_data_int32(const GUID & p_guid,t_int32 & p_out);
+ static void g_set_data_int32(const GUID & p_guid,t_int32 p_val);
+ static bool g_get_data_bool_simple(const GUID & p_guid,bool p_default);
+ static t_int32 g_get_data_int32_simple(const GUID & p_guid,t_int32 p_default);
+
+
+ FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(config_object);
+};
+
+class standard_config_objects
+{
+public:
+ static const GUID bool_remember_window_positions, bool_ui_always_on_top,bool_playlist_stop_after_current;
+ static const GUID bool_playback_follows_cursor, bool_cursor_follows_playback;
+ static const GUID bool_show_keyboard_shortcuts_in_menus;
+ static const GUID string_gui_last_directory_media,string_gui_last_directory_playlists;
+ static const GUID int32_dynamic_bitrate_display_rate;
+
+
+ inline static bool query_show_keyboard_shortcuts_in_menus() {return config_object::g_get_data_bool_simple(standard_config_objects::bool_show_keyboard_shortcuts_in_menus,true);}
+ inline static bool query_remember_window_positions() {return config_object::g_get_data_bool_simple(standard_config_objects::bool_remember_window_positions,true);}
+
+};
+
+class config_object_notify : public service_base
+{
+public:
+ virtual t_size get_watched_object_count() = 0;
+ virtual GUID get_watched_object(t_size p_index) = 0;
+ virtual void on_watched_object_changed(const service_ptr_t<config_object> & p_object) = 0;
+
+ FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(config_object_notify);
+};
+
+#endif _CONFIG_OBJECT_H_
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/config_object_impl.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/config_object_impl.h new file mode 100644 index 0000000000..13445e0c2e --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/config_object_impl.h @@ -0,0 +1,174 @@ +#ifndef _CONFIG_OBJECT_IMPL_H_
+#define _CONFIG_OBJECT_IMPL_H_
+
+//template function bodies from config_object class
+
+template<class T>
+void config_object::get_data_struct_t(T& p_out) {
+ if (get_data_raw(&p_out,sizeof(T)) != sizeof(T)) throw exception_io_data_truncation();
+}
+
+template<class T>
+void config_object::set_data_struct_t(const T& p_in) {
+ return set_data_raw(&p_in,sizeof(T));
+}
+
+template<class T>
+void config_object::g_get_data_struct_t(const GUID & p_guid,T & p_out) {
+ service_ptr_t<config_object> ptr;
+ if (!g_find(ptr,p_guid)) throw exception_service_not_found();
+ return ptr->get_data_struct_t<T>(p_out);
+}
+
+template<class T>
+void config_object::g_set_data_struct_t(const GUID & p_guid,const T & p_in) {
+ service_ptr_t<config_object> ptr;
+ if (!g_find(ptr,p_guid)) throw exception_service_not_found();
+ return ptr->set_data_struct_t<T>(p_in);
+}
+
+
+class config_object_impl : public config_object, private cfg_var
+{
+public:
+ GUID get_guid() const {return cfg_var::get_guid();}
+ void get_data(stream_writer * p_stream,abort_callback & p_abort) const ;
+ void set_data(stream_reader * p_stream,abort_callback & p_abort,bool p_notify);
+
+ config_object_impl(const GUID & p_guid,const void * p_data,t_size p_bytes);
+private:
+
+ //cfg_var methods
+ void get_data_raw(stream_writer * p_stream,abort_callback & p_abort) {get_data(p_stream,p_abort);}
+ void set_data_raw(stream_reader * p_stream,t_size p_sizehint,abort_callback & p_abort) {set_data(p_stream,p_abort,false);}
+
+ mutable critical_section m_sync;
+ pfc::array_t<t_uint8> m_data;
+};
+
+typedef service_factory_single_transparent_t<config_object_impl> config_object_factory;
+
+template<t_size p_size>
+class config_object_fixed_const_impl_t : public config_object {
+public:
+ config_object_fixed_const_impl_t(const GUID & p_guid, const void * p_data) : m_guid(p_guid) {memcpy(m_data,p_data,p_size);}
+ GUID get_guid() const {return m_guid;}
+
+ void get_data(stream_writer * p_stream, abort_callback & p_abort) const { p_stream->write_object(m_data,p_size,p_abort); }
+ void set_data(stream_reader * p_stream, abort_callback & p_abort, bool p_notify) { PFC_ASSERT(!"Should not get here."); }
+
+private:
+ t_uint8 m_data[p_size];
+ const GUID m_guid;
+};
+
+template<t_size p_size>
+class config_object_fixed_impl_t : public config_object, private cfg_var {
+public:
+ GUID get_guid() const {return cfg_var::get_guid();}
+
+ void get_data(stream_writer * p_stream,abort_callback & p_abort) const {
+ insync(m_sync);
+ p_stream->write_object(m_data,p_size,p_abort);
+ }
+
+ void set_data(stream_reader * p_stream,abort_callback & p_abort,bool p_notify) {
+ core_api::ensure_main_thread();
+
+ {
+ t_uint8 temp[p_size];
+ p_stream->read_object(temp,p_size,p_abort);
+ insync(m_sync);
+ memcpy(m_data,temp,p_size);
+ }
+
+ if (p_notify) config_object_notify_manager::g_on_changed(this);
+ }
+
+ config_object_fixed_impl_t (const GUID & p_guid,const void * p_data)
+ : cfg_var(p_guid)
+ {
+ memcpy(m_data,p_data,p_size);
+ }
+
+private:
+ //cfg_var methods
+ void get_data_raw(stream_writer * p_stream,abort_callback & p_abort) {get_data(p_stream,p_abort);}
+ void set_data_raw(stream_reader * p_stream,t_size p_sizehint,abort_callback & p_abort) {set_data(p_stream,p_abort,false);}
+
+ mutable critical_section m_sync;
+ t_uint8 m_data[p_size];
+
+};
+
+template<t_size p_size, bool isConst> class _config_object_fixed_impl_switch;
+template<t_size p_size> class _config_object_fixed_impl_switch<p_size,false> { public: typedef config_object_fixed_impl_t<p_size> type; };
+template<t_size p_size> class _config_object_fixed_impl_switch<p_size,true> { public: typedef config_object_fixed_const_impl_t<p_size> type; };
+
+template<t_size p_size, bool isConst = false>
+class config_object_fixed_factory_t : public service_factory_single_transparent_t< typename _config_object_fixed_impl_switch<p_size,isConst>::type >
+{
+public:
+ config_object_fixed_factory_t(const GUID & p_guid,const void * p_initval)
+ :
+ service_factory_single_transparent_t< typename _config_object_fixed_impl_switch<p_size,isConst>::type >
+ (p_guid,p_initval)
+ {}
+};
+
+
+class config_object_string_factory : public config_object_factory
+{
+public:
+ config_object_string_factory(const GUID & p_guid,const char * p_string,t_size p_string_length = ~0)
+ : config_object_factory(p_guid,p_string,pfc::strlen_max(p_string,~0)) {}
+
+};
+
+template<bool isConst = false>
+class config_object_bool_factory_t : public config_object_fixed_factory_t<1,isConst> {
+public:
+ config_object_bool_factory_t(const GUID & p_guid,bool p_initval)
+ : config_object_fixed_factory_t<1,isConst>(p_guid,&p_initval) {}
+};
+typedef config_object_bool_factory_t<> config_object_bool_factory;
+
+template<class T,bool isConst = false>
+class config_object_int_factory_t : public config_object_fixed_factory_t<sizeof(T),isConst>
+{
+private:
+ template<class T>
+ struct t_initval
+ {
+ T m_initval;
+ t_initval(T p_initval) : m_initval(p_initval) {byte_order::order_native_to_le_t(m_initval);}
+ T * get_ptr() {return &m_initval;}
+ };
+public:
+ config_object_int_factory_t(const GUID & p_guid,T p_initval)
+ : config_object_fixed_factory_t<sizeof(T)>(p_guid,t_initval<T>(p_initval).get_ptr() )
+ {}
+};
+
+typedef config_object_int_factory_t<t_int32> config_object_int32_factory;
+
+
+
+class config_object_notify_impl_simple : public config_object_notify
+{
+public:
+ t_size get_watched_object_count() {return 1;}
+ GUID get_watched_object(t_size p_index) {return m_guid;}
+ void on_watched_object_changed(const service_ptr_t<config_object> & p_object) {m_func(p_object);}
+
+ typedef void (*t_func)(const service_ptr_t<config_object> &);
+
+ config_object_notify_impl_simple(const GUID & p_guid,t_func p_func) : m_guid(p_guid), m_func(p_func) {}
+private:
+ GUID m_guid;
+ t_func m_func;
+};
+
+typedef service_factory_single_transparent_t<config_object_notify_impl_simple> config_object_notify_simple_factory;
+
+#endif _CONFIG_OBJECT_IMPL_H_
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/console.cpp b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/console.cpp new file mode 100644 index 0000000000..ad1d9b1807 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/console.cpp @@ -0,0 +1,50 @@ +#include "foobar2000.h"
+
+
+void console::info(const char * p_message) {print(p_message);}
+void console::error(const char * p_message) {complain("Error", p_message);}
+void console::warning(const char * p_message) {complain("Warning", p_message);}
+
+void console::info_location(const playable_location & src) {print_location(src);}
+void console::info_location(const metadb_handle_ptr & src) {print_location(src);}
+
+void console::print_location(const metadb_handle_ptr & src)
+{
+ print_location(src->get_location());
+}
+
+void console::print_location(const playable_location & src)
+{
+ formatter() << src;
+}
+
+void console::complain(const char * what, const char * msg) {
+ formatter() << what << ": " << msg;
+}
+void console::complain(const char * what, std::exception const & e) {
+ complain(what, e.what());
+}
+
+void console::print(const char* p_message)
+{
+ if (core_api::are_services_available()) {
+ service_ptr_t<console_receiver> ptr;
+ service_enum_t<console_receiver> e;
+ while(e.next(ptr)) ptr->print(p_message,~0);
+ }
+}
+
+void console::printf(const char* p_format,...)
+{
+ va_list list;
+ va_start(list,p_format);
+ printfv(p_format,list);
+ va_end(list);
+}
+
+void console::printfv(const char* p_format,va_list p_arglist)
+{
+ pfc::string8_fastalloc temp;
+ uPrintfV(temp,p_format,p_arglist);
+ print(temp);
+}
\ No newline at end of file diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/console.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/console.h new file mode 100644 index 0000000000..0b591c6205 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/console.h @@ -0,0 +1,31 @@ +//! Namespace with functions for sending text to console. All functions are fully multi-thread safe, though they must not be called during dll initialization or deinitialization (e.g. static object constructors or destructors) when service system is not available.
+namespace console
+{
+ void info(const char * p_message);
+ void error(const char * p_message);
+ void warning(const char * p_message);
+ void info_location(const playable_location & src);
+ void info_location(const metadb_handle_ptr & src);
+ void print_location(const playable_location & src);
+ void print_location(const metadb_handle_ptr & src);
+
+ void print(const char*);
+ void printf(const char*,...);
+ void printfv(const char*,va_list p_arglist);
+
+ //! Usage: console::formatter() << "blah " << somenumber << " asdf" << somestring;
+ class formatter : public pfc::string_formatter {
+ public:
+ ~formatter() {if (!is_empty()) console::print(get_ptr());}
+ };
+ void complain(const char * what, const char * msg);
+ void complain(const char * what, std::exception const & e);
+};
+
+//! Interface receiving console output. Do not call directly; use console namespace functions instead.
+class NOVTABLE console_receiver : public service_base {
+public:
+ virtual void print(const char * p_message,t_size p_message_length) = 0;
+
+ FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(console_receiver);
+};
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/contextmenu.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/contextmenu.h new file mode 100644 index 0000000000..b8fd951383 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/contextmenu.h @@ -0,0 +1,336 @@ +//! Reserved for future use.
+typedef void * t_glyph;
+
+
+class NOVTABLE contextmenu_item_node {
+public:
+ enum t_flags {
+ FLAG_CHECKED = 1,
+ FLAG_DISABLED = 2,
+ FLAG_GRAYED = 4,
+ FLAG_DISABLED_GRAYED = FLAG_DISABLED|FLAG_GRAYED,
+ FLAG_RADIOCHECKED = 8, //new in 0.9.5.2 - overrides FLAG_CHECKED, set together with FLAG_CHECKED for backwards compatibility.
+ };
+
+ enum t_type {
+ type_group,
+ type_command,
+ type_separator,
+
+ //for compatibility
+ TYPE_POPUP = type_group,TYPE_COMMAND = type_command,TYPE_SEPARATOR = type_separator,
+ };
+
+ virtual bool get_display_data(pfc::string_base & p_out,unsigned & p_displayflags,metadb_handle_list_cref p_data,const GUID & p_caller) = 0;
+ virtual t_type get_type() = 0;
+ virtual void execute(metadb_handle_list_cref p_data,const GUID & p_caller) = 0;
+ virtual t_glyph get_glyph(metadb_handle_list_cref p_data,const GUID & p_caller) {return 0;}//RESERVED
+ virtual t_size get_children_count() = 0;
+ virtual contextmenu_item_node * get_child(t_size p_index) = 0;
+ virtual bool get_description(pfc::string_base & p_out) = 0;
+ virtual GUID get_guid() = 0;
+ virtual bool is_mappable_shortcut() = 0;
+
+protected:
+ contextmenu_item_node() {}
+ ~contextmenu_item_node() {}
+};
+
+class NOVTABLE contextmenu_item_node_root : public contextmenu_item_node
+{
+public:
+ virtual ~contextmenu_item_node_root() {}
+};
+
+class NOVTABLE contextmenu_item_node_leaf : public contextmenu_item_node
+{
+public:
+ t_type get_type() {return TYPE_COMMAND;}
+ t_size get_children_count() {return 0;}
+ contextmenu_item_node * get_child(t_size) {return NULL;}
+};
+
+class NOVTABLE contextmenu_item_node_root_leaf : public contextmenu_item_node_root
+{
+public:
+ t_type get_type() {return TYPE_COMMAND;}
+ t_size get_children_count() {return 0;}
+ contextmenu_item_node * get_child(t_size) {return NULL;}
+};
+
+class NOVTABLE contextmenu_item_node_popup : public contextmenu_item_node
+{
+public:
+ t_type get_type() {return TYPE_POPUP;}
+ void execute(metadb_handle_list_cref data,const GUID & caller) {}
+ bool get_description(pfc::string_base & p_out) {return false;}
+};
+
+class NOVTABLE contextmenu_item_node_root_popup : public contextmenu_item_node_root
+{
+public:
+ t_type get_type() {return TYPE_POPUP;}
+ void execute(metadb_handle_list_cref data,const GUID & caller) {}
+ bool get_description(pfc::string_base & p_out) {return false;}
+};
+
+class contextmenu_item_node_separator : public contextmenu_item_node
+{
+public:
+ t_type get_type() {return TYPE_SEPARATOR;}
+ void execute(metadb_handle_list_cref data,const GUID & caller) {}
+ bool get_description(pfc::string_base & p_out) {return false;}
+ t_size get_children_count() {return 0;}
+ bool get_display_data(pfc::string_base & p_out,unsigned & p_displayflags,metadb_handle_list_cref p_data,const GUID & p_caller)
+ {
+ p_displayflags = 0;
+ p_out = "---";
+ return true;
+ }
+ contextmenu_item_node * get_child(t_size) {return NULL;}
+ GUID get_guid() {return pfc::guid_null;}
+ bool is_mappable_shortcut() {return false;}
+};
+
+/*!
+Service class for declaring context menu commands.\n
+See contextmenu_item_simple for implementation helper without dynamic menu generation features.\n
+All methods are valid from main app thread only.
+*/
+class NOVTABLE contextmenu_item : public service_base {
+public:
+ enum t_enabled_state {
+ FORCE_OFF,
+ DEFAULT_OFF,
+ DEFAULT_ON,
+ };
+
+ //! Retrieves number of menu items provided by this contextmenu_item implementation.
+ virtual unsigned get_num_items() = 0;
+ //! Instantiates a context menu item (including sub-node tree for items that contain dynamically-generated sub-items).
+ virtual contextmenu_item_node_root * instantiate_item(unsigned p_index,metadb_handle_list_cref p_data,const GUID & p_caller) = 0;
+ //! Retrieves GUID of the context menu item.
+ virtual GUID get_item_guid(unsigned p_index) = 0;
+ //! Retrieves human-readable name of the context menu item.
+ virtual void get_item_name(unsigned p_index,pfc::string_base & p_out) = 0;
+ //! Obsolete since v1.0, don't use or override in new components.
+ virtual void get_item_default_path(unsigned p_index,pfc::string_base & p_out) {p_out = "";}
+ //! Retrieves item's description to show in the status bar. Set p_out to the string to be displayed and return true if you provide a description, return false otherwise.
+ virtual bool get_item_description(unsigned p_index,pfc::string_base & p_out) = 0;
+ //! Controls default state of context menu preferences for this item: \n
+ //! Return DEFAULT_ON to show this item in the context menu by default - useful for most cases. \n
+ //! Return DEFAULT_OFF to hide this item in the context menu by default - useful for rarely used utility commands. \n
+ //! Return FORCE_OFF to hide this item by default and prevent the user from making it visible (very rarely used). \n
+ //! Values returned by this method should be constant for this context menu item and not change later. Do not use this to conditionally hide the item - return false from get_display_data() instead.
+ virtual t_enabled_state get_enabled_state(unsigned p_index) = 0;
+ //! Executes the menu item command without going thru the instantiate_item path. For items with dynamically-generated sub-items, p_node is identifies of the sub-item command to execute.
+ virtual void item_execute_simple(unsigned p_index,const GUID & p_node,metadb_handle_list_cref p_data,const GUID & p_caller) = 0;
+
+ bool item_get_display_data_root(pfc::string_base & p_out,unsigned & displayflags,unsigned p_index,metadb_handle_list_cref p_data,const GUID & p_caller);
+ bool item_get_display_data(pfc::string_base & p_out,unsigned & displayflags,unsigned p_index,const GUID & p_node,metadb_handle_list_cref p_data,const GUID & p_caller);
+
+ GUID get_parent_fallback();
+ GUID get_parent_();
+
+ //! Deprecated - use caller_active_playlist_selection instead.
+ static const GUID caller_playlist;
+
+ static const GUID caller_active_playlist_selection, caller_active_playlist, caller_playlist_manager, caller_now_playing, caller_keyboard_shortcut_list, caller_media_library_viewer;
+ static const GUID caller_undefined;
+
+ FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(contextmenu_item);
+};
+
+//! \since 1.0
+class NOVTABLE contextmenu_item_v2 : public contextmenu_item {
+ FB2K_MAKE_SERVICE_INTERFACE(contextmenu_item_v2, contextmenu_item)
+public:
+ virtual double get_sort_priority() {return 0;}
+ virtual GUID get_parent() {return get_parent_fallback();}
+};
+
+//! contextmenu_item implementation helper for implementing non-dynamically-generated context menu items; derive from this instead of from contextmenu_item directly if your menu items are static.
+class NOVTABLE contextmenu_item_simple : public contextmenu_item_v2 {
+private:
+public:
+ //! Same as contextmenu_item_node::t_flags.
+ enum t_flags
+ {
+ FLAG_CHECKED = 1,
+ FLAG_DISABLED = 2,
+ FLAG_GRAYED = 4,
+ FLAG_DISABLED_GRAYED = FLAG_DISABLED|FLAG_GRAYED,
+ FLAG_RADIOCHECKED = 8, //new in 0.9.5.2 - overrides FLAG_CHECKED, set together with FLAG_CHECKED for backwards compatibility.
+ };
+
+
+ // Functions to be overridden by implementers (some are not mandatory).
+ virtual t_enabled_state get_enabled_state(unsigned p_index) {return contextmenu_item::DEFAULT_ON;}
+ virtual unsigned get_num_items() = 0;
+ virtual void get_item_name(unsigned p_index,pfc::string_base & p_out) = 0;
+ virtual void context_command(unsigned p_index,metadb_handle_list_cref p_data,const GUID& p_caller) = 0;
+ virtual bool context_get_display(unsigned p_index,metadb_handle_list_cref p_data,pfc::string_base & p_out,unsigned & p_displayflags,const GUID & p_caller) {
+ PFC_ASSERT(p_index>=0 && p_index<get_num_items());
+ get_item_name(p_index,p_out);
+ return true;
+ }
+ virtual GUID get_item_guid(unsigned p_index) = 0;
+ virtual bool get_item_description(unsigned p_index,pfc::string_base & p_out) = 0;
+
+
+private:
+ class contextmenu_item_node_impl : public contextmenu_item_node_root_leaf {
+ public:
+ contextmenu_item_node_impl(contextmenu_item_simple * p_owner,unsigned p_index) : m_owner(p_owner), m_index(p_index) {}
+ bool get_display_data(pfc::string_base & p_out,unsigned & p_displayflags,metadb_handle_list_cref p_data,const GUID & p_caller) {return m_owner->get_display_data(m_index,p_data,p_out,p_displayflags,p_caller);}
+ void execute(metadb_handle_list_cref p_data,const GUID & p_caller) {m_owner->context_command(m_index,p_data,p_caller);}
+ bool get_description(pfc::string_base & p_out) {return m_owner->get_item_description(m_index,p_out);}
+ GUID get_guid() {return pfc::guid_null;}
+ bool is_mappable_shortcut() {return m_owner->item_is_mappable_shortcut(m_index);}
+ private:
+ service_ptr_t<contextmenu_item_simple> m_owner;
+ unsigned m_index;
+ };
+
+ contextmenu_item_node_root * instantiate_item(unsigned p_index,metadb_handle_list_cref p_data,const GUID & p_caller)
+ {
+ return new contextmenu_item_node_impl(this,p_index);
+ }
+
+
+ void item_execute_simple(unsigned p_index,const GUID & p_node,metadb_handle_list_cref p_data,const GUID & p_caller)
+ {
+ if (p_node == pfc::guid_null)
+ context_command(p_index,p_data,p_caller);
+ }
+
+ virtual bool item_is_mappable_shortcut(unsigned p_index)
+ {
+ return true;
+ }
+
+
+ virtual bool get_display_data(unsigned n,metadb_handle_list_cref data,pfc::string_base & p_out,unsigned & displayflags,const GUID & caller)
+ {
+ bool rv = false;
+ assert(n>=0 && n<get_num_items());
+ if (data.get_count()>0)
+ {
+ rv = context_get_display(n,data,p_out,displayflags,caller);
+ }
+ return rv;
+ }
+
+};
+
+
+//! Helper.
+template<typename T>
+class contextmenu_item_factory_t : public service_factory_single_t<T> {};
+
+
+//! Helper.
+#define DECLARE_CONTEXT_MENU_ITEM(P_CLASSNAME,P_NAME,P_DEFAULTPATH,P_FUNC,P_GUID,P_DESCRIPTION) \
+ namespace { \
+ class P_CLASSNAME : public contextmenu_item_simple { \
+ public: \
+ unsigned get_num_items() {return 1;} \
+ void get_item_name(unsigned p_index,pfc::string_base & p_out) {p_out = P_NAME;} \
+ void get_item_default_path(unsigned p_index,pfc::string_base & p_out) {p_out = P_DEFAULTPATH;} \
+ void context_command(unsigned p_index,metadb_handle_list_cref p_data,const GUID& p_caller) {P_FUNC(p_data);} \
+ GUID get_item_guid(unsigned p_index) {return P_GUID;} \
+ bool get_item_description(unsigned p_index,pfc::string_base & p_out) {if (P_DESCRIPTION[0] == 0) return false;p_out = P_DESCRIPTION; return true;} \
+ }; \
+ static contextmenu_item_factory_t<P_CLASSNAME> g_##P_CLASSNAME##_factory; \
+ }
+
+
+
+
+//! New in 0.9.5.1. Static methods safe to use in prior versions as it will use slow fallback mode when the service isn't present. \n
+//! Functionality provided by menu_item_resolver methods isn't much different from just walking all registered contextmenu_item / mainmenu_commands implementations to find the command we want, but it uses a hint map to locate the service we're looking for without walking all of them which may be significantly faster in certain scenarios.
+class menu_item_resolver : public service_base {
+public:
+ virtual bool resolve_context_command(const GUID & id, service_ptr_t<class contextmenu_item> & out, t_uint32 & out_index) = 0;
+ virtual bool resolve_main_command(const GUID & id, service_ptr_t<class mainmenu_commands> & out, t_uint32 & out_index) = 0;
+
+ static bool g_resolve_context_command(const GUID & id, service_ptr_t<class contextmenu_item> & out, t_uint32 & out_index);
+ static bool g_resolve_main_command(const GUID & id, service_ptr_t<class mainmenu_commands> & out, t_uint32 & out_index);
+
+ FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(menu_item_resolver)
+};
+
+//! \since 1.0
+class NOVTABLE contextmenu_group : public service_base {
+ FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(contextmenu_group);
+public:
+ virtual GUID get_guid() = 0;
+ virtual GUID get_parent() = 0;
+ virtual double get_sort_priority() = 0;
+};
+
+//! \since 1.0
+class NOVTABLE contextmenu_group_popup : public contextmenu_group {
+ FB2K_MAKE_SERVICE_INTERFACE(contextmenu_group_popup, contextmenu_group)
+public:
+ virtual void get_display_string(pfc::string_base & out) = 0;
+ void get_name(pfc::string_base & out) {get_display_string(out);}
+};
+
+class contextmenu_groups {
+public:
+ static const GUID root, utilities, tagging, replaygain, fileoperations, playbackstatistics, properties, convert, legacy;
+};
+
+class contextmenu_group_impl : public contextmenu_group {
+public:
+ contextmenu_group_impl(const GUID & guid, const GUID & parent, double sortPriority = 0) : m_guid(guid), m_parent(parent), m_sortPriority(sortPriority) {}
+ GUID get_guid() {return m_guid;}
+ GUID get_parent() {return m_parent;}
+ double get_sort_priority() {return m_sortPriority;}
+private:
+ const GUID m_guid, m_parent;
+ const double m_sortPriority;
+};
+
+class contextmenu_group_popup_impl : public contextmenu_group_popup {
+public:
+ contextmenu_group_popup_impl(const GUID & guid, const GUID & parent, const char * name, double sortPriority = 0) : m_guid(guid), m_parent(parent), m_sortPriority(sortPriority), m_name(name) {}
+ GUID get_guid() {return m_guid;}
+ GUID get_parent() {return m_parent;}
+ double get_sort_priority() {return m_sortPriority;}
+ void get_display_string(pfc::string_base & out) {out = m_name;}
+private:
+ const GUID m_guid, m_parent;
+ const double m_sortPriority;
+ const char * const m_name;
+};
+
+
+
+namespace contextmenu_priorities {
+ enum {
+ root_queue = -100,
+ root_main = -50,
+ root_tagging,
+ root_fileoperations,
+ root_convert,
+ root_utilities,
+ root_replaygain,
+ root_playbackstatistics,
+ root_legacy = 99,
+ root_properties = 100,
+ };
+};
+
+
+
+class contextmenu_group_factory : public service_factory_single_t<contextmenu_group_impl> {
+public:
+ contextmenu_group_factory(const GUID & guid, const GUID & parent, double sortPriority = 0) : service_factory_single_t<contextmenu_group_impl>(guid, parent, sortPriority) {}
+};
+
+class contextmenu_group_popup_factory : public service_factory_single_t<contextmenu_group_popup_impl> {
+public:
+ contextmenu_group_popup_factory(const GUID & guid, const GUID & parent, const char * name, double sortPriority = 0) : service_factory_single_t<contextmenu_group_popup_impl>(guid, parent, name, sortPriority) {}
+};
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/contextmenu_manager.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/contextmenu_manager.h new file mode 100644 index 0000000000..ad50b29fd8 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/contextmenu_manager.h @@ -0,0 +1,128 @@ +class NOVTABLE keyboard_shortcut_manager : public service_base
+{
+public:
+ static bool g_get(service_ptr_t<keyboard_shortcut_manager> & p_out) {return service_enum_create_t(p_out,0);}
+
+ enum shortcut_type
+ {
+ TYPE_MAIN,
+ TYPE_CONTEXT,
+ TYPE_CONTEXT_PLAYLIST,
+ TYPE_CONTEXT_NOW_PLAYING,
+ };
+
+
+ virtual bool process_keydown(shortcut_type type,const pfc::list_base_const_t<metadb_handle_ptr> & data,unsigned keycode)=0;
+ virtual bool process_keydown_ex(shortcut_type type,const pfc::list_base_const_t<metadb_handle_ptr> & data,unsigned keycode,const GUID & caller)=0;
+ bool on_keydown(shortcut_type type,WPARAM wp);
+ bool on_keydown_context(const pfc::list_base_const_t<metadb_handle_ptr> & data,WPARAM wp,const GUID & caller);
+
+ bool on_keydown_auto(WPARAM wp);
+ bool on_keydown_auto_playlist(WPARAM wp);
+ bool on_keydown_auto_context(const pfc::list_base_const_t<metadb_handle_ptr> & data,WPARAM wp,const GUID & caller);
+
+ bool on_keydown_restricted_auto(WPARAM wp);
+ bool on_keydown_restricted_auto_playlist(WPARAM wp);
+ bool on_keydown_restricted_auto_context(const pfc::list_base_const_t<metadb_handle_ptr> & data,WPARAM wp,const GUID & caller);
+
+ virtual bool get_key_description_for_action(const GUID & p_command,const GUID & p_subcommand, pfc::string_base & out, shortcut_type type, bool is_global)=0;
+
+ static bool is_text_key(t_uint32 vkCode);
+ static bool is_typing_key(t_uint32 vkCode);
+ static bool is_typing_key_combo(t_uint32 vkCode, t_uint32 modifiers);
+ static bool is_typing_modifier(t_uint32 flags);
+ static bool is_typing_message(HWND editbox, const MSG * msg);
+ static bool is_typing_message(const MSG * msg);
+
+ FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(keyboard_shortcut_manager);
+};
+
+
+//! New in 0.9.5.
+class keyboard_shortcut_manager_v2 : public keyboard_shortcut_manager {
+public:
+ //! Deprecates old keyboard_shortcut_manager methods. If the action requires selected items, they're obtained from ui_selection_manager API automatically.
+ virtual bool process_keydown_simple(t_uint32 keycode) = 0;
+
+ //! Helper for use with message filters.
+ bool pretranslate_message(const MSG * msg, HWND thisPopupWnd);
+
+ FB2K_MAKE_SERVICE_INTERFACE(keyboard_shortcut_manager_v2,keyboard_shortcut_manager);
+};
+
+class NOVTABLE contextmenu_node {
+public:
+ virtual contextmenu_item_node::t_type get_type()=0;
+ virtual const char * get_name()=0;
+ virtual t_size get_num_children()=0;//TYPE_POPUP only
+ virtual contextmenu_node * get_child(t_size n)=0;//TYPE_POPUP only
+ virtual unsigned get_display_flags()=0;//TYPE_COMMAND/TYPE_POPUP only, see contextmenu_item::FLAG_*
+ virtual unsigned get_id()=0;//TYPE_COMMAND only, returns zero-based index (helpful for win32 menu command ids)
+ virtual void execute()=0;//TYPE_COMMAND only
+ virtual bool get_description(pfc::string_base & out)=0;//TYPE_COMMAND only
+ virtual bool get_full_name(pfc::string_base & out)=0;//TYPE_COMMAND only
+ virtual void * get_glyph()=0;//RESERVED, do not use
+protected:
+ contextmenu_node() {}
+ ~contextmenu_node() {}
+};
+
+
+
+class NOVTABLE contextmenu_manager : public service_base
+{
+public:
+ enum
+ {
+ flag_show_shortcuts = 1 << 0,
+ flag_show_shortcuts_global = 1 << 1,
+ //! \since 1.0
+ //! To control which commands are shown, you should specify either flag_view_reduced or flag_view_full. If neither is specified, the implementation will decide automatically based on shift key being pressed, for backwards compatibility.
+ flag_view_reduced = 1 << 2,
+ //! \since 1.0
+ //! To control which commands are shown, you should specify either flag_view_reduced or flag_view_full. If neither is specified, the implementation will decide automatically based on shift key being pressed, for backwards compatibility.
+ flag_view_full = 1 << 3,
+
+ //for compatibility
+ FLAG_SHOW_SHORTCUTS = 1,
+ FLAG_SHOW_SHORTCUTS_GLOBAL = 2,
+ };
+
+ virtual void init_context(metadb_handle_list_cref data,unsigned flags) = 0;
+ virtual void init_context_playlist(unsigned flags) = 0;
+ virtual contextmenu_node * get_root() = 0;//releasing contextmenu_manager service releaases nodes; root may be null in case of error or something
+ virtual contextmenu_node * find_by_id(unsigned id)=0;
+ virtual void set_shortcut_preference(const keyboard_shortcut_manager::shortcut_type * data,unsigned count)=0;
+
+
+
+ static void g_create(service_ptr_t<contextmenu_manager> & p_out) {standard_api_create_t(p_out);}
+
+#ifdef WIN32
+ static void win32_build_menu(HMENU menu,contextmenu_node * parent,int base_id,int max_id);//menu item identifiers are base_id<=N<base_id+max_id (if theres too many items, they will be clipped)
+ static void win32_run_menu_context(HWND parent,metadb_handle_list_cref data, const POINT * pt = 0,unsigned flags = 0);
+ static void win32_run_menu_context_playlist(HWND parent,const POINT * pt = 0,unsigned flags = 0);
+ void win32_run_menu_popup(HWND parent,const POINT * pt = 0);
+ void win32_build_menu(HMENU menu,int base_id,int max_id) {win32_build_menu(menu,get_root(),base_id,max_id);}
+
+
+#endif
+
+ virtual void init_context_ex(metadb_handle_list_cref data,unsigned flags,const GUID & caller)=0;
+ virtual bool init_context_now_playing(unsigned flags)=0;//returns false if not playing
+
+ bool execute_by_id(unsigned id);
+
+ bool get_description_by_id(unsigned id,pfc::string_base & out);
+
+
+ FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(contextmenu_manager);
+};
+
+//! \since 1.0
+class NOVTABLE contextmenu_group_manager : public service_base {
+ FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(contextmenu_group_manager)
+public:
+ virtual GUID path_to_group(const char * path) = 0;
+ virtual void group_to_path(const GUID & group, pfc::string_base & path) = 0;
+};
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/core_api.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/core_api.h new file mode 100644 index 0000000000..808f988fe9 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/core_api.h @@ -0,0 +1,38 @@ +#ifndef _FB2K_CORE_API_H_
+#define _FB2K_CORE_API_H_
+
+namespace core_api {
+
+ //! Retrieves HINSTANCE of calling DLL.
+ HINSTANCE get_my_instance();
+ //! Retrieves filename of calling dll, excluding extension, e.g. "foo_asdf"
+ const char * get_my_file_name();
+ //! Retrieves full path of calling dll, e.g. file://c:\blah\foobar2000\foo_asdf.dll
+ const char * get_my_full_path();
+ //! Retrieves main app window. WARNING: this is provided for parent of dialog windows and such only; using it for anything else (such as hooking windowproc to alter app behaviors) is absolutely illegal.
+ HWND get_main_window();
+ //! Tests whether services are available at this time. They are not available only during DLL startup or shutdown (e.g. inside static object constructors or destructors).
+ bool are_services_available();
+ //! Tests whether calling thread is main app thread, and shows diagnostic message in debugger output if it's not.
+ bool assert_main_thread();
+ //! Triggers a bug check if the calling thread is not the main app thread.
+ void ensure_main_thread();
+ //! Returns true if calling thread is main app thread, false otherwise.
+ bool is_main_thread();
+ //! Returns whether the app is currently shutting down.
+ bool is_shutting_down();
+ //! Returns whether the app is currently initializing.
+ bool is_initializing();
+ //! Returns filesystem path to directory with user settings, e.g. file://c:\documents_and_settings\username\blah\foobar2000
+ const char * get_profile_path();
+
+ //! Returns whether foobar2000 has been installed in "portable" mode.
+ bool is_portable_mode_enabled();
+
+ //! Returns whether foobar2000 is currently running in quiet mode. \n
+ //! Quiet mode bypasses all GUI features, disables Media Library and does not save any changes to app configuration. \n
+ //! Your component should not display any forms of user interface when running in quiet mode, as well as avoid saving configuration on its own (no need to worry if you only rely on cfg_vars or config_io_callback, they will simply be ignored on shutdown).
+ bool is_quiet_mode_enabled();
+};
+
+#endif
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/coreversion.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/coreversion.h new file mode 100644 index 0000000000..f786444b44 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/coreversion.h @@ -0,0 +1,36 @@ +class NOVTABLE core_version_info : public service_base {
+public:
+ virtual const char * get_version_string() = 0;
+ static const char * g_get_version_string() {return static_api_ptr_t<core_version_info>()->get_version_string();}
+ FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(core_version_info);
+};
+
+struct t_core_version_data {
+ t_uint32 m_major, m_minor1, m_minor2, m_minor3;
+};
+
+//! New (0.9.4.2)
+class NOVTABLE core_version_info_v2 : public core_version_info {
+public:
+ virtual const char * get_name() = 0;//"foobar2000"
+ virtual const char * get_version_as_text() = 0;//"N.N.N.N"
+ virtual t_core_version_data get_version() = 0;
+
+ //! Determine whether running foobar2000 version is newer or equal to the specified version, eg. test_version(0,9,5,0) for 0.9.5.
+ bool test_version(t_uint32 major, t_uint32 minor1, t_uint32 minor2, t_uint32 minor3) {
+ const t_core_version_data v = get_version();
+ if (v.m_major < major) return false;
+ else if (v.m_major > major) return true;
+ // major version matches
+ else if (v.m_minor1 < minor1) return false;
+ else if (v.m_minor1 > minor1) return true;
+ // minor1 version matches
+ else if (v.m_minor2 < minor2) return false;
+ else if (v.m_minor2 > minor2) return true;
+ // minor2 version matches
+ else if (v.m_minor3 < minor3) return false;
+ else return true;
+ }
+
+ FB2K_MAKE_SERVICE_INTERFACE(core_version_info_v2, core_version_info);
+};
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/dsp.cpp b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/dsp.cpp new file mode 100644 index 0000000000..db4d945508 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/dsp.cpp @@ -0,0 +1,403 @@ +#include "foobar2000.h"
+#include <math.h>
+
+t_size dsp_chunk_list_impl::get_count() const {return m_data.get_count();}
+
+audio_chunk * dsp_chunk_list_impl::get_item(t_size n) const {return n>=0 && n<m_data.get_count() ? &*m_data[n] : 0;}
+
+void dsp_chunk_list_impl::remove_by_idx(t_size idx)
+{
+ if (idx>=0 && idx<m_data.get_count())
+ m_recycled.add_item(m_data.remove_by_idx(idx));
+}
+
+void dsp_chunk_list_impl::remove_mask(const bit_array & mask)
+{
+ t_size n, m = m_data.get_count();
+ for(n=0;n<m;n++)
+ if (mask[m])
+ m_recycled.add_item(m_data[n]);
+ m_data.remove_mask(mask);
+}
+
+audio_chunk * dsp_chunk_list_impl::insert_item(t_size idx,t_size hint_size)
+{
+ t_size max = get_count();
+ if (idx<0) idx=0;
+ else if (idx>max) idx = max;
+ pfc::rcptr_t<audio_chunk> ret;
+ if (m_recycled.get_count()>0)
+ {
+ t_size best;
+ if (hint_size>0)
+ {
+ best = 0;
+ t_size best_found = m_recycled[0]->get_data_size(), n, total = m_recycled.get_count();
+ for(n=1;n<total;n++)
+ {
+ if (best_found==hint_size) break;
+ t_size size = m_recycled[n]->get_data_size();
+ int delta_old = abs((int)best_found - (int)hint_size), delta_new = abs((int)size - (int)hint_size);
+ if (delta_new < delta_old)
+ {
+ best_found = size;
+ best = n;
+ }
+ }
+ }
+ else best = m_recycled.get_count()-1;
+
+ ret = m_recycled.remove_by_idx(best);
+ ret->set_sample_count(0);
+ ret->set_channels(0);
+ ret->set_srate(0);
+ }
+ else ret = pfc::rcnew_t<audio_chunk_impl>();
+ if (idx==max) m_data.add_item(ret);
+ else m_data.insert_item(ret,idx);
+ return &*ret;
+}
+
+void dsp_chunk_list::remove_bad_chunks()
+{
+ bool blah = false;
+ t_size idx;
+ for(idx=0;idx<get_count();)
+ {
+ audio_chunk * chunk = get_item(idx);
+ if (!chunk->is_valid())
+ {
+ chunk->reset();
+ remove_by_idx(idx);
+ blah = true;
+ }
+ else idx++;
+ }
+ if (blah) console::info("one or more bad chunks removed from dsp chunk list");
+}
+
+
+bool dsp_entry::g_instantiate(service_ptr_t<dsp> & p_out,const dsp_preset & p_preset)
+{
+ service_ptr_t<dsp_entry> ptr;
+ if (!g_get_interface(ptr,p_preset.get_owner())) return false;
+ return ptr->instantiate(p_out,p_preset);
+}
+
+bool dsp_entry::g_instantiate_default(service_ptr_t<dsp> & p_out,const GUID & p_guid)
+{
+ service_ptr_t<dsp_entry> ptr;
+ if (!g_get_interface(ptr,p_guid)) return false;
+ dsp_preset_impl preset;
+ if (!ptr->get_default_preset(preset)) return false;
+ return ptr->instantiate(p_out,preset);
+}
+
+bool dsp_entry::g_name_from_guid(pfc::string_base & p_out,const GUID & p_guid)
+{
+ service_ptr_t<dsp_entry> ptr;
+ if (!g_get_interface(ptr,p_guid)) return false;
+ ptr->get_name(p_out);
+ return true;
+}
+
+bool dsp_entry::g_dsp_exists(const GUID & p_guid)
+{
+ service_ptr_t<dsp_entry> blah;
+ return g_get_interface(blah,p_guid);
+}
+
+bool dsp_entry::g_get_default_preset(dsp_preset & p_out,const GUID & p_guid)
+{
+ service_ptr_t<dsp_entry> ptr;
+ if (!g_get_interface(ptr,p_guid)) return false;
+ return ptr->get_default_preset(p_out);
+}
+
+void dsp_chain_config::contents_to_stream(stream_writer * p_stream,abort_callback & p_abort) const {
+ t_size n, count = get_count();
+ p_stream->write_lendian_t(count,p_abort);
+ for(n=0;n<count;n++) {
+ get_item(n).contents_to_stream(p_stream,p_abort);
+ }
+}
+
+void dsp_chain_config::contents_from_stream(stream_reader * p_stream,abort_callback & p_abort) {
+ t_uint32 n,count;
+
+ remove_all();
+
+ p_stream->read_lendian_t(count,p_abort);
+
+ dsp_preset_impl temp;
+
+ for(n=0;n<count;n++) {
+ temp.contents_from_stream(p_stream,p_abort);
+ add_item(temp);
+ }
+}
+
+
+bool cfg_dsp_chain_config::get_data(dsp_chain_config & p_data) const {
+ p_data.copy(m_data);
+ return true;
+}
+
+void cfg_dsp_chain_config::set_data(const dsp_chain_config & p_data) {
+ m_data.copy(p_data);
+}
+
+void cfg_dsp_chain_config::reset() {
+ m_data.remove_all();
+}
+
+void cfg_dsp_chain_config::get_data_raw(stream_writer * p_stream,abort_callback & p_abort) {
+ m_data.contents_to_stream(p_stream,p_abort);
+}
+
+void cfg_dsp_chain_config::set_data_raw(stream_reader * p_stream,t_size,abort_callback & p_abort) {
+ m_data.contents_from_stream(p_stream,p_abort);
+}
+
+void dsp_chain_config::remove_item(t_size p_index)
+{
+ remove_mask(bit_array_one(p_index));
+}
+
+void dsp_chain_config::add_item(const dsp_preset & p_data)
+{
+ insert_item(p_data,get_count());
+}
+
+void dsp_chain_config::remove_all()
+{
+ remove_mask(bit_array_true());
+}
+
+void dsp_chain_config::instantiate(service_list_t<dsp> & p_out)
+{
+ p_out.remove_all();
+ t_size n, m = get_count();
+ for(n=0;n<m;n++)
+ {
+ service_ptr_t<dsp> temp;
+ if (dsp_entry::g_instantiate(temp,get_item(n)))
+ p_out.add_item(temp);
+ }
+}
+
+t_size dsp_chain_config_impl::get_count() const
+{
+ return m_data.get_count();
+}
+
+const dsp_preset & dsp_chain_config_impl::get_item(t_size p_index) const
+{
+ return *m_data[p_index];
+}
+
+void dsp_chain_config_impl::replace_item(const dsp_preset & p_data,t_size p_index)
+{
+ *m_data[p_index] = p_data;
+}
+
+void dsp_chain_config_impl::insert_item(const dsp_preset & p_data,t_size p_index)
+{
+ m_data.insert_item(new dsp_preset_impl(p_data),p_index);
+}
+
+void dsp_chain_config_impl::remove_mask(const bit_array & p_mask)
+{
+ m_data.delete_mask(p_mask);
+}
+
+dsp_chain_config_impl::~dsp_chain_config_impl()
+{
+ m_data.delete_all();
+}
+
+void dsp_preset::contents_to_stream(stream_writer * p_stream,abort_callback & p_abort) const {
+ t_size size = get_data_size();
+ p_stream->write_lendian_t(get_owner(),p_abort);
+ p_stream->write_lendian_t(size,p_abort);
+ if (size > 0) {
+ p_stream->write_object(get_data(),size,p_abort);
+ }
+}
+
+void dsp_preset::contents_from_stream(stream_reader * p_stream,abort_callback & p_abort) {
+ t_uint32 size;
+ GUID guid;
+ p_stream->read_lendian_t(guid,p_abort);
+ set_owner(guid);
+ p_stream->read_lendian_t(size,p_abort);
+ if (size > 1024*1024*32) throw exception_io_data();
+ set_data_from_stream(p_stream,size,p_abort);
+}
+
+void dsp_preset::g_contents_from_stream_skip(stream_reader * p_stream,abort_callback & p_abort) {
+ t_uint32 size;
+ GUID guid;
+ p_stream->read_lendian_t(guid,p_abort);
+ p_stream->read_lendian_t(size,p_abort);
+ if (size > 1024*1024*32) throw exception_io_data();
+ p_stream->skip_object(size,p_abort);
+}
+
+void dsp_preset_impl::set_data_from_stream(stream_reader * p_stream,t_size p_bytes,abort_callback & p_abort) {
+ m_data.set_size(p_bytes);
+ if (p_bytes > 0) p_stream->read_object(m_data.get_ptr(),p_bytes,p_abort);
+}
+
+void dsp_chain_config::copy(const dsp_chain_config & p_source) {
+ remove_all();
+ t_size n, m = p_source.get_count();
+ for(n=0;n<m;n++)
+ add_item(p_source.get_item(n));
+}
+
+bool dsp_entry::g_have_config_popup(const GUID & p_guid)
+{
+ service_ptr_t<dsp_entry> entry;
+ if (!g_get_interface(entry,p_guid)) return false;
+ return entry->have_config_popup();
+}
+
+bool dsp_entry::g_have_config_popup(const dsp_preset & p_preset)
+{
+ return g_have_config_popup(p_preset.get_owner());
+}
+
+bool dsp_entry::g_show_config_popup(dsp_preset & p_preset,HWND p_parent)
+{
+ service_ptr_t<dsp_entry> entry;
+ if (!g_get_interface(entry,p_preset.get_owner())) return false;
+ return entry->show_config_popup(p_preset,p_parent);
+}
+
+void dsp_entry::g_show_config_popup_v2(const dsp_preset & p_preset,HWND p_parent,dsp_preset_edit_callback & p_callback) {
+ service_ptr_t<dsp_entry> entry;
+ if (g_get_interface(entry,p_preset.get_owner())) {
+ service_ptr_t<dsp_entry_v2> entry_v2;
+ if (entry->service_query_t(entry_v2)) {
+ entry_v2->show_config_popup_v2(p_preset,p_parent,p_callback);
+ } else {
+ dsp_preset_impl temp(p_preset);
+ if (entry->show_config_popup(temp,p_parent)) p_callback.on_preset_changed(temp);
+ }
+ }
+}
+
+bool dsp_entry::g_get_interface(service_ptr_t<dsp_entry> & p_out,const GUID & p_guid)
+{
+ service_ptr_t<dsp_entry> ptr;
+ service_enum_t<dsp_entry> e;
+ e.reset();
+ while(e.next(ptr))
+ {
+ if (ptr->get_guid() == p_guid)
+ {
+ p_out = ptr;
+ return true;
+ }
+ }
+ return false;
+}
+
+bool resampler_entry::g_get_interface(service_ptr_t<resampler_entry> & p_out,unsigned p_srate_from,unsigned p_srate_to)
+{
+ service_ptr_t<dsp_entry> ptr_dsp;
+ service_ptr_t<resampler_entry> ptr_resampler;
+ service_enum_t<dsp_entry> e;
+ e.reset();
+ float found_priority = 0;
+ service_ptr_t<resampler_entry> found;
+ while(e.next(ptr_dsp))
+ {
+ if (ptr_dsp->service_query_t(ptr_resampler))
+ {
+ if (p_srate_from == 0 || ptr_resampler->is_conversion_supported(p_srate_from,p_srate_to))
+ {
+ float priority = ptr_resampler->get_priority();
+ if (found.is_empty() || priority > found_priority)
+ {
+ found = ptr_resampler;
+ found_priority = priority;
+ }
+ }
+ }
+ }
+ if (found.is_empty()) return false;
+ p_out = found;
+ return true;
+}
+
+bool resampler_entry::g_create_preset(dsp_preset & p_out,unsigned p_srate_from,unsigned p_srate_to,float p_qualityscale)
+{
+ service_ptr_t<resampler_entry> entry;
+ if (!g_get_interface(entry,p_srate_from,p_srate_to)) return false;
+ return entry->create_preset(p_out,p_srate_to,p_qualityscale);
+}
+
+bool resampler_entry::g_create(service_ptr_t<dsp> & p_out,unsigned p_srate_from,unsigned p_srate_to,float p_qualityscale)
+{
+ service_ptr_t<resampler_entry> entry;
+ if (!g_get_interface(entry,p_srate_from,p_srate_to)) return false;
+ dsp_preset_impl preset;
+ if (!entry->create_preset(preset,p_srate_to,p_qualityscale)) return false;
+ return entry->instantiate(p_out,preset);
+}
+
+
+bool dsp_chain_config::equals(dsp_chain_config const & v1, dsp_chain_config const & v2) {
+ const t_size count = v1.get_count();
+ if (count != v2.get_count()) return false;
+ for(t_size walk = 0; walk < count; ++walk) {
+ if (v1.get_item(walk) != v2.get_item(walk)) return false;
+ }
+ return true;
+}
+void dsp_chain_config::get_name_list(pfc::string_base & p_out) const
+{
+ const t_size count = get_count();
+ bool added = false;
+ for(unsigned n=0;n<count;n++)
+ {
+ service_ptr_t<dsp_entry> ptr;
+ if (dsp_entry::g_get_interface(ptr,get_item(n).get_owner()))
+ {
+ if (added) p_out += ", ";
+ added = true;
+
+ pfc::string8 temp;
+ ptr->get_name(temp);
+ p_out += temp;
+ }
+ }
+}
+
+void dsp::run_abortable(dsp_chunk_list * p_chunk_list,const metadb_handle_ptr & p_cur_file,int p_flags,abort_callback & p_abort) {
+ service_ptr_t<dsp_v2> this_v2;
+ if (this->service_query_t(this_v2)) this_v2->run_v2(p_chunk_list,p_cur_file,p_flags,p_abort);
+ else run(p_chunk_list,p_cur_file,p_flags);
+}
+
+namespace {
+ class dsp_preset_edit_callback_impl : public dsp_preset_edit_callback {
+ public:
+ dsp_preset_edit_callback_impl(dsp_preset & p_data) : m_data(p_data) {}
+ void on_preset_changed(const dsp_preset & p_data) {m_data = p_data;}
+ private:
+ dsp_preset & m_data;
+ };
+};
+
+bool dsp_entry_v2::show_config_popup(dsp_preset & p_data,HWND p_parent) {
+ PFC_ASSERT(p_data.get_owner() == get_guid());
+ dsp_preset_impl temp(p_data);
+ show_config_popup_v2(p_data,p_parent,dsp_preset_edit_callback_impl(temp));
+ PFC_ASSERT(temp.get_owner() == get_guid());
+ if (temp == p_data) return false;
+ p_data = temp;
+ return true;
+}
\ No newline at end of file diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/dsp.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/dsp.h new file mode 100644 index 0000000000..55e75850df --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/dsp.h @@ -0,0 +1,493 @@ +//! Interface to a DSP chunk list. A DSP chunk list object is passed to the DSP chain each time, since DSPs are allowed to remove processed chunks or insert new ones.
+class NOVTABLE dsp_chunk_list {
+public:
+ virtual t_size get_count() const = 0;
+ virtual audio_chunk * get_item(t_size n) const = 0;
+ virtual void remove_by_idx(t_size idx) = 0;
+ virtual void remove_mask(const bit_array & mask) = 0;
+ virtual audio_chunk * insert_item(t_size idx,t_size hint_size=0) = 0;
+
+ audio_chunk * add_item(t_size hint_size=0) {return insert_item(get_count(),hint_size);}
+
+ void remove_all() {remove_mask(bit_array_true());}
+
+ double get_duration() {
+ double rv = 0;
+ t_size n,m = get_count();
+ for(n=0;n<m;n++) rv += get_item(n)->get_duration();
+ return rv;
+ }
+
+ void add_chunk(const audio_chunk * chunk) {
+ audio_chunk * dst = insert_item(get_count(),chunk->get_data_length());
+ if (dst) dst->copy(*chunk);
+ }
+
+ void remove_bad_chunks();
+protected:
+ dsp_chunk_list() {}
+ ~dsp_chunk_list() {}
+};
+
+class dsp_chunk_list_impl : public dsp_chunk_list//implementation
+{
+ pfc::list_t<pfc::rcptr_t<audio_chunk> > m_data, m_recycled;
+public:
+ t_size get_count() const;
+ audio_chunk * get_item(t_size n) const;
+ void remove_by_idx(t_size idx);
+ void remove_mask(const bit_array & mask);
+ audio_chunk * insert_item(t_size idx,t_size hint_size=0);
+};
+
+//! Instance of a DSP.\n
+//! Implementation: Derive from dsp_impl_base instead of deriving from dsp directly.\n
+//! Instantiation: Use dsp_entry static helper methods to instantiate DSPs, or dsp_chain_config / dsp_manager to deal with entire DSP chains.
+class NOVTABLE dsp : public service_base {
+public:
+ enum {
+ //! Flush whatever you need to when tracks change.
+ END_OF_TRACK = 1,
+ //! Flush everything.
+ FLUSH = 2
+ };
+
+ //! @param p_chunk_list List of chunks to process. The implementation may alter the list in any way, inserting chunks of different sample rate / channel configuration etc.
+ //! @param p_cur_file Optional, location of currently decoded file. May be null.
+ //! @param p_flags Flags. Can be null, or a combination of END_OF_TRACK and FLUSH constants.
+ virtual void run(dsp_chunk_list * p_chunk_list,const metadb_handle_ptr & p_cur_file,int p_flags)=0;
+
+ //! Flushes the DSP (reinitializes / drops any buffered data). Called after seeking, etc.
+ virtual void flush() = 0;
+
+ //! Retrieves amount of data buffered by the DSP, for syncing visualisation.
+ //! @returns Amount of buffered audio data, in seconds.
+ virtual double get_latency() = 0;
+ //! Returns true if DSP needs to know exact track change point (eg. for crossfading, removing silence).\n
+ //! Signaling this will force-flush any DSPs placed before this DSP so when it gets END_OF_TRACK, relevant chunks contain last samples of the track.\n
+ //! Signaling this will often break regular gapless playback so don't use it unless you have reasons to.
+ virtual bool need_track_change_mark() = 0;
+
+ void run_abortable(dsp_chunk_list * p_chunk_list,const metadb_handle_ptr & p_cur_file,int p_flags,abort_callback & p_abort);
+
+ FB2K_MAKE_SERVICE_INTERFACE(dsp,service_base);
+};
+
+//! Backwards-compatible extension to dsp interface, allows abortable operation. Introduced in 0.9.2.
+class NOVTABLE dsp_v2 : public dsp {
+public:
+ //! Abortable version of dsp::run(). See dsp::run() for descriptions of parameters.
+ virtual void run_v2(dsp_chunk_list * p_chunk_list,const metadb_handle_ptr & p_cur_file,int p_flags,abort_callback & p_abort) = 0;
+private:
+ void run(dsp_chunk_list * p_chunk_list,const metadb_handle_ptr & p_cur_file,int p_flags) {
+ run_v2(p_chunk_list,p_cur_file,p_flags,abort_callback_dummy());
+ }
+
+ FB2K_MAKE_SERVICE_INTERFACE(dsp_v2,dsp);
+};
+
+//! Helper class for implementing dsps. You should derive from dsp_impl_base instead of from dsp directly.\n
+//! The dsp_impl_base_t template allows you to use a custom interface class as a base class for your implementation, in case you provide extended functionality.\n
+//! Use dsp_factory_t<> template to register your dsp implementation.
+//! The implementation - as required by dsp_factory_t<> template - must also provide following methods:\n
+//! A constructor taking const dsp_preset&, initializing the DSP with specified preset data.\n
+//! static void g_get_name(pfc::string_base &); - retrieving human-readable name of the DSP to display.\n
+//! static bool g_get_default_preset(dsp_preset &); - retrieving default preset for this DSP. Return value is reserved for future use and should always be true.\n
+//! static GUID g_get_guid(); - retrieving GUID of your DSP implementation, to be used to identify it when storing DSP chain configuration.\n
+//! static bool g_have_config_popup(); - retrieving whether your DSP implementation supplies a popup dialog for configuring it.\n
+//! static void g_show_config_popup(const dsp_preset & p_data,HWND p_parent, dsp_preset_edit_callback & p_callback); - displaying your DSP's settings dialog; called only when g_have_config_popup() returns true; call p_callback.on_preset_changed() whenever user has made adjustments to the preset data.\n
+template<class t_baseclass>
+class dsp_impl_base_t : public t_baseclass {
+private:
+ typedef dsp_impl_base_t<t_baseclass> t_self;
+ dsp_chunk_list * m_list;
+ t_size m_chunk_ptr;
+ metadb_handle* m_cur_file;
+ void run_v2(dsp_chunk_list * p_list,const metadb_handle_ptr & p_cur_file,int p_flags,abort_callback & p_abort);
+protected:
+ //! Call only from on_chunk / on_endoftrack (on_endoftrack will give info on track being finished).\n
+ //! May return false when there's no known track and the metadb_handle ptr will be empty/null.
+ bool get_cur_file(metadb_handle_ptr & p_out) {p_out = m_cur_file; return p_out.is_valid();}
+
+ dsp_impl_base_t() : m_list(NULL), m_cur_file(NULL), m_chunk_ptr(0) {}
+
+ //! Inserts a new chunk of audio data. \n
+ //! You can call this only from on_chunk(), on_endofplayback() and on_endoftrack(). You're NOT allowed to call this from flush() which should just drop any queued data.
+ //! @param hint_size Optional, amount of buffer space that you require (in audio_samples). This is just a hint for memory allocation logic and will not cause the framework to allocate the chunk for you.
+ //! @returns A pointer to the newly allocated chunk. Pass the audio data you want to insert to this chunk object. The chunk is owned by the framework, you can't delete it etc.
+ audio_chunk * insert_chunk(t_size p_hint_size = 0) {
+ PFC_ASSERT(m_list != NULL);
+ return m_list->insert_item(m_chunk_ptr++,p_hint_size);
+ }
+
+
+ //! To be overridden by a DSP implementation.\n
+ //! Called on track change. You can use insert_chunk() to dump any data you have to flush. \n
+ //! Note that you must implement need_track_change_mark() to return true if you need this method called.
+ virtual void on_endoftrack(abort_callback & p_abort) = 0;
+ //! To be overridden by a DSP implementation.\n
+ //! Called at the end of played stream, typically at the end of last played track, to allow the DSP to return all data it has buffered-ahead.\n
+ //! Use insert_chunk() to return any data you have buffered.\n
+ //! Note that this call does not imply that the DSP will be destroyed next. \n
+ //! This is also called on track changes if some DSP placed after your DSP requests track change marks.
+ virtual void on_endofplayback(abort_callback & p_abort) = 0;
+ //! To be overridden by a DSP implementation.\n
+ //! Processes a chunk of audio data.\n
+ //! You can call insert_chunk() from inside on_chunk() to insert any audio data before currently processed chunk.\n
+ //! @param p_chunk Current chunk being processed. You can alter it in any way you like.
+ //! @returns True to keep p_chunk (with alterations made inside on_chunk()) in the stream, false to remove it.
+ virtual bool on_chunk(audio_chunk * p_chunk,abort_callback & p_abort) = 0;
+
+public:
+ //! To be overridden by a DSP implementation.\n
+ //! Flushes the DSP (drops any buffered data). The implementation should reset the DSP to the same state it was in before receiving any audio data. \n
+ //! Called after seeking, etc.
+ virtual void flush() = 0;
+ //! To be overridden by a DSP implementation.\n
+ //! Retrieves amount of data buffered by the DSP, for syncing visualisation.
+ //! @returns Amount of buffered audio data, in seconds.
+ virtual double get_latency() = 0;
+ //! To be overridden by a DSP implementation.\n
+ //! Returns true if DSP needs to know exact track change point (eg. for crossfading, removing silence).\n
+ //! Signaling this will force-flush any DSPs placed before this DSP so when it gets on_endoftrack(), relevant chunks contain last samples of the track.\n
+ //! Signaling this may interfere with gapless playback in certain scenarios (forces flush of DSPs placed before you) so don't use it unless you have reasons to.
+ virtual bool need_track_change_mark() = 0;
+private:
+ dsp_impl_base_t(const t_self&) {throw pfc::exception_bug_check_v2();}
+ const t_self & operator=(const t_self &) {throw pfc::exception_bug_check_v2();}
+};
+
+template<class t_baseclass>
+void dsp_impl_base_t<t_baseclass>::run_v2(dsp_chunk_list * p_list,const metadb_handle_ptr & p_cur_file,int p_flags,abort_callback & p_abort) {
+ pfc::vartoggle_t<dsp_chunk_list*> l_list_toggle(m_list,p_list);
+ pfc::vartoggle_t<metadb_handle*> l_cur_file_toggle(m_cur_file,p_cur_file.get_ptr());
+
+ for(m_chunk_ptr = 0;m_chunk_ptr<m_list->get_count();m_chunk_ptr++) {
+ audio_chunk * c = m_list->get_item(m_chunk_ptr);
+ if (c->is_empty() || !on_chunk(c,p_abort))
+ m_list->remove_by_idx(m_chunk_ptr--);
+ }
+
+ if (p_flags & FLUSH) {
+ on_endofplayback(p_abort);
+ } else if (p_flags & END_OF_TRACK) {
+ if (need_track_change_mark()) on_endoftrack(p_abort);
+ }
+}
+
+
+typedef dsp_impl_base_t<dsp_v2> dsp_impl_base;
+
+class NOVTABLE dsp_preset {
+public:
+ virtual GUID get_owner() const = 0;
+ virtual void set_owner(const GUID & p_owner) = 0;
+ virtual const void * get_data() const = 0;
+ virtual t_size get_data_size() const = 0;
+ virtual void set_data(const void * p_data,t_size p_data_size) = 0;
+ virtual void set_data_from_stream(stream_reader * p_stream,t_size p_bytes,abort_callback & p_abort) = 0;
+
+ const dsp_preset & operator=(const dsp_preset & p_source) {copy(p_source); return *this;}
+
+ void copy(const dsp_preset & p_source) {set_owner(p_source.get_owner());set_data(p_source.get_data(),p_source.get_data_size());}
+
+ void contents_to_stream(stream_writer * p_stream,abort_callback & p_abort) const;
+ void contents_from_stream(stream_reader * p_stream,abort_callback & p_abort);
+ static void g_contents_from_stream_skip(stream_reader * p_stream,abort_callback & p_abort);
+
+ bool operator==(const dsp_preset & p_other) const {
+ if (get_owner() != p_other.get_owner()) return false;
+ if (get_data_size() != p_other.get_data_size()) return false;
+ if (memcmp(get_data(),p_other.get_data(),get_data_size()) != 0) return false;
+ return true;
+ }
+ bool operator!=(const dsp_preset & p_other) const {
+ return !(*this == p_other);
+ }
+protected:
+ dsp_preset() {}
+ ~dsp_preset() {}
+};
+
+class dsp_preset_writer : public stream_writer {
+public:
+ void write(const void * p_buffer,t_size p_bytes,abort_callback & p_abort) {
+ p_abort.check();
+ m_data.append_fromptr((const t_uint8 *) p_buffer,p_bytes);
+ }
+ void flush(dsp_preset & p_preset) {
+ p_preset.set_data(m_data.get_ptr(),m_data.get_size());
+ m_data.set_size(0);
+ }
+private:
+ pfc::array_t<t_uint8,pfc::alloc_fast_aggressive> m_data;
+};
+
+class dsp_preset_reader : public stream_reader {
+public:
+ dsp_preset_reader() : m_walk(0) {}
+ dsp_preset_reader(const dsp_preset_reader & p_source) : m_walk(0) {*this = p_source;}
+ void init(const dsp_preset & p_preset) {
+ m_data.set_data_fromptr( (const t_uint8*) p_preset.get_data(), p_preset.get_data_size() );
+ m_walk = 0;
+ }
+ t_size read(void * p_buffer,t_size p_bytes,abort_callback & p_abort) {
+ p_abort.check();
+ t_size todo = pfc::min_t<t_size>(p_bytes,m_data.get_size()-m_walk);
+ memcpy(p_buffer,m_data.get_ptr()+m_walk,todo);
+ m_walk += todo;
+ return todo;
+ }
+ bool is_finished() {return m_walk == m_data.get_size();}
+private:
+ t_size m_walk;
+ pfc::array_t<t_uint8> m_data;
+};
+
+class dsp_preset_impl : public dsp_preset
+{
+public:
+ dsp_preset_impl() {}
+ dsp_preset_impl(const dsp_preset_impl & p_source) {copy(p_source);}
+ dsp_preset_impl(const dsp_preset & p_source) {copy(p_source);}
+
+ const dsp_preset_impl& operator=(const dsp_preset_impl & p_source) {copy(p_source); return *this;}
+ const dsp_preset_impl& operator=(const dsp_preset & p_source) {copy(p_source); return *this;}
+
+ GUID get_owner() const {return m_owner;}
+ void set_owner(const GUID & p_owner) {m_owner = p_owner;}
+ const void * get_data() const {return m_data.get_ptr();}
+ t_size get_data_size() const {return m_data.get_size();}
+ void set_data(const void * p_data,t_size p_data_size) {m_data.set_data_fromptr((const t_uint8*)p_data,p_data_size);}
+ void set_data_from_stream(stream_reader * p_stream,t_size p_bytes,abort_callback & p_abort);
+private:
+ GUID m_owner;
+ pfc::array_t<t_uint8> m_data;
+};
+
+class NOVTABLE dsp_preset_edit_callback {
+public:
+ virtual void on_preset_changed(const dsp_preset &) = 0;
+private:
+ dsp_preset_edit_callback(const dsp_preset_edit_callback&) {throw pfc::exception_not_implemented();}
+ const dsp_preset_edit_callback & operator=(const dsp_preset_edit_callback &) {throw pfc::exception_not_implemented();}
+protected:
+ dsp_preset_edit_callback() {}
+ ~dsp_preset_edit_callback() {}
+};
+
+class NOVTABLE dsp_entry : public service_base {
+public:
+ virtual void get_name(pfc::string_base & p_out) = 0;
+ virtual bool get_default_preset(dsp_preset & p_out) = 0;
+ virtual bool instantiate(service_ptr_t<dsp> & p_out,const dsp_preset & p_preset) = 0;
+ virtual GUID get_guid() = 0;
+ virtual bool have_config_popup() = 0;
+ virtual bool show_config_popup(dsp_preset & p_data,HWND p_parent) = 0;
+
+
+ static bool g_get_interface(service_ptr_t<dsp_entry> & p_out,const GUID & p_guid);
+ static bool g_instantiate(service_ptr_t<dsp> & p_out,const dsp_preset & p_preset);
+ static bool g_instantiate_default(service_ptr_t<dsp> & p_out,const GUID & p_guid);
+ static bool g_name_from_guid(pfc::string_base & p_out,const GUID & p_guid);
+ static bool g_dsp_exists(const GUID & p_guid);
+ static bool g_get_default_preset(dsp_preset & p_out,const GUID & p_guid);
+ static bool g_have_config_popup(const GUID & p_guid);
+ static bool g_have_config_popup(const dsp_preset & p_preset);
+ static bool g_show_config_popup(dsp_preset & p_preset,HWND p_parent);
+
+ static void g_show_config_popup_v2(const dsp_preset & p_preset,HWND p_parent,dsp_preset_edit_callback & p_callback);
+
+ FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(dsp_entry);
+};
+
+class NOVTABLE dsp_entry_v2 : public dsp_entry {
+public:
+ virtual void show_config_popup_v2(const dsp_preset & p_data,HWND p_parent,dsp_preset_edit_callback & p_callback) = 0;
+
+private:
+ bool show_config_popup(dsp_preset & p_data,HWND p_parent);
+
+ FB2K_MAKE_SERVICE_INTERFACE(dsp_entry_v2,dsp_entry);
+};
+
+template<class T,class t_entry = dsp_entry>
+class dsp_entry_impl_nopreset_t : public t_entry {
+public:
+ void get_name(pfc::string_base & p_out) {T::g_get_name(p_out);}
+ bool get_default_preset(dsp_preset & p_out)
+ {
+ p_out.set_owner(T::g_get_guid());
+ p_out.set_data(0,0);
+ return true;
+ }
+ bool instantiate(service_ptr_t<dsp> & p_out,const dsp_preset & p_preset)
+ {
+ if (p_preset.get_owner() == T::g_get_guid() && p_preset.get_data_size() == 0)
+ {
+ p_out = new service_impl_t<T>();
+ return p_out.is_valid();
+ }
+ else return false;
+ }
+ GUID get_guid() {return T::g_get_guid();}
+
+ bool have_config_popup() {return false;}
+ bool show_config_popup(dsp_preset & p_data,HWND p_parent) {return false;}
+};
+
+template<class T, class t_entry = dsp_entry_v2>
+class dsp_entry_impl_t : public t_entry {
+public:
+ void get_name(pfc::string_base & p_out) {T::g_get_name(p_out);}
+ bool get_default_preset(dsp_preset & p_out) {return T::g_get_default_preset(p_out);}
+ bool instantiate(service_ptr_t<dsp> & p_out,const dsp_preset & p_preset) {
+ if (p_preset.get_owner() == T::g_get_guid()) {
+ p_out = new service_impl_t<T>(p_preset);
+ return true;
+ }
+ else return false;
+ }
+ GUID get_guid() {return T::g_get_guid();}
+
+ bool have_config_popup() {return T::g_have_config_popup();}
+ bool show_config_popup(dsp_preset & p_data,HWND p_parent) {return T::g_show_config_popup(p_data,p_parent);}
+ //void show_config_popup_v2(const dsp_preset & p_data,HWND p_parent,dsp_preset_edit_callback & p_callback) {T::g_show_config_popup(p_data,p_parent,p_callback);}
+};
+
+template<class T, class t_entry = dsp_entry_v2>
+class dsp_entry_v2_impl_t : public t_entry {
+public:
+ void get_name(pfc::string_base & p_out) {T::g_get_name(p_out);}
+ bool get_default_preset(dsp_preset & p_out) {return T::g_get_default_preset(p_out);}
+ bool instantiate(service_ptr_t<dsp> & p_out,const dsp_preset & p_preset) {
+ if (p_preset.get_owner() == T::g_get_guid()) {
+ p_out = new service_impl_t<T>(p_preset);
+ return true;
+ }
+ else return false;
+ }
+ GUID get_guid() {return T::g_get_guid();}
+
+ bool have_config_popup() {return T::g_have_config_popup();}
+ //bool show_config_popup(dsp_preset & p_data,HWND p_parent) {return T::g_show_config_popup(p_data,p_parent);}
+ void show_config_popup_v2(const dsp_preset & p_data,HWND p_parent,dsp_preset_edit_callback & p_callback) {T::g_show_config_popup(p_data,p_parent,p_callback);}
+};
+
+
+template<class T>
+class dsp_factory_nopreset_t : public service_factory_single_t<dsp_entry_impl_nopreset_t<T> > {};
+
+template<class T>
+class dsp_factory_t : public service_factory_single_t<dsp_entry_v2_impl_t<T> > {};
+
+class NOVTABLE dsp_chain_config
+{
+public:
+ virtual t_size get_count() const = 0;
+ virtual const dsp_preset & get_item(t_size p_index) const = 0;
+ virtual void replace_item(const dsp_preset & p_data,t_size p_index) = 0;
+ virtual void insert_item(const dsp_preset & p_data,t_size p_index) = 0;
+ virtual void remove_mask(const bit_array & p_mask) = 0;
+
+ void remove_item(t_size p_index);
+ void remove_all();
+ void add_item(const dsp_preset & p_data);
+ void copy(const dsp_chain_config & p_source);
+
+ const dsp_chain_config & operator=(const dsp_chain_config & p_source) {copy(p_source); return *this;}
+
+ void contents_to_stream(stream_writer * p_stream,abort_callback & p_abort) const;
+ void contents_from_stream(stream_reader * p_stream,abort_callback & p_abort);
+
+ void instantiate(service_list_t<dsp> & p_out);
+
+ void get_name_list(pfc::string_base & p_out) const;
+
+ static bool equals(dsp_chain_config const & v1, dsp_chain_config const & v2);
+
+ bool operator==(const dsp_chain_config & other) const {return equals(*this, other);}
+ bool operator!=(const dsp_chain_config & other) const {return !equals(*this, other);}
+};
+
+FB2K_STREAM_READER_OVERLOAD(dsp_chain_config) {
+ value.contents_from_stream(&stream.m_stream, stream.m_abort); return stream;
+}
+
+FB2K_STREAM_WRITER_OVERLOAD(dsp_chain_config) {
+ value.contents_to_stream(&stream.m_stream, stream.m_abort); return stream;
+}
+
+class dsp_chain_config_impl : public dsp_chain_config
+{
+public:
+ dsp_chain_config_impl() {}
+ dsp_chain_config_impl(const dsp_chain_config & p_source) {copy(p_source);}
+ dsp_chain_config_impl(const dsp_chain_config_impl & p_source) {copy(p_source);}
+ t_size get_count() const;
+ const dsp_preset & get_item(t_size p_index) const;
+ void replace_item(const dsp_preset & p_data,t_size p_index);
+ void insert_item(const dsp_preset & p_data,t_size p_index);
+ void remove_mask(const bit_array & p_mask);
+
+ const dsp_chain_config_impl & operator=(const dsp_chain_config & p_source) {copy(p_source); return *this;}
+ const dsp_chain_config_impl & operator=(const dsp_chain_config_impl & p_source) {copy(p_source); return *this;}
+
+ ~dsp_chain_config_impl();
+private:
+ pfc::ptr_list_t<dsp_preset_impl> m_data;
+};
+
+class cfg_dsp_chain_config : public cfg_var {
+protected:
+ void get_data_raw(stream_writer * p_stream,abort_callback & p_abort);
+ void set_data_raw(stream_reader * p_stream,t_size p_sizehint,abort_callback & p_abort);
+public:
+ void reset();
+ inline cfg_dsp_chain_config(const GUID & p_guid) : cfg_var(p_guid) {}
+ t_size get_count() const {return m_data.get_count();}
+ const dsp_preset & get_item(t_size p_index) const {return m_data.get_item(p_index);}
+ bool get_data(dsp_chain_config & p_data) const;
+ void set_data(const dsp_chain_config & p_data);
+private:
+ dsp_chain_config_impl m_data;
+
+};
+
+
+
+
+//! Helper.
+class dsp_preset_parser : public stream_reader_formatter<> {
+public:
+ dsp_preset_parser(const dsp_preset & in) : m_data(in), _m_stream(in.get_data(),in.get_data_size()), stream_reader_formatter(_m_stream,_m_abort) {}
+
+ void reset() {_m_stream.reset();}
+ t_size get_remaining() const {return _m_stream.get_remaining();}
+
+ void assume_empty() const {
+ if (get_remaining() != 0) throw exception_io_data();
+ }
+
+ GUID get_owner() const {return m_data.get_owner();}
+private:
+ const dsp_preset & m_data;
+ abort_callback_dummy _m_abort;
+ stream_reader_memblock_ref _m_stream;
+};
+
+//! Helper.
+class dsp_preset_builder : public stream_writer_formatter<> {
+public:
+ dsp_preset_builder() : stream_writer_formatter(_m_stream,_m_abort) {}
+ void finish(const GUID & id, dsp_preset & out) {
+ out.set_owner(id);
+ out.set_data(_m_stream.m_buffer.get_ptr(), _m_stream.m_buffer.get_size());
+ }
+ void reset() {
+ _m_stream.m_buffer.set_size(0);
+ }
+private:
+ abort_callback_dummy _m_abort;
+ stream_writer_buffer_simple _m_stream;
+};
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/dsp_manager.cpp b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/dsp_manager.cpp new file mode 100644 index 0000000000..56a7e99de1 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/dsp_manager.cpp @@ -0,0 +1,188 @@ +#include "foobar2000.h"
+
+void dsp_manager::close() {
+ m_chain.remove_all();
+ m_config_changed = true;
+}
+
+void dsp_manager::set_config( const dsp_chain_config & p_data )
+{
+ //dsp_chain_config::g_instantiate(m_dsp_list,p_data);
+ m_config.copy(p_data);
+ m_config_changed = true;
+}
+
+void dsp_manager::dsp_run(t_dsp_chain::const_iterator p_iter,dsp_chunk_list * p_list,const metadb_handle_ptr & cur_file,unsigned flags,double & latency,abort_callback & p_abort)
+{
+ p_list->remove_bad_chunks();
+
+ TRACK_CODE("dsp::run",p_iter->m_dsp->run_abortable(p_list,cur_file,flags,p_abort));
+ TRACK_CODE("dsp::get_latency",latency += p_iter->m_dsp->get_latency());
+}
+
+double dsp_manager::run(dsp_chunk_list * p_list,const metadb_handle_ptr & p_cur_file,unsigned p_flags,abort_callback & p_abort) {
+ TRACK_CALL_TEXT("dsp_manager::run");
+
+ try {
+ fpu_control_default l_fpu_control;
+
+ double latency=0;
+ bool done = false;
+
+ t_dsp_chain::const_iterator flush_mark;
+ if ((p_flags & dsp::END_OF_TRACK) && ! (p_flags & dsp::FLUSH)) {
+ for(t_dsp_chain::const_iterator iter = m_chain.first(); iter.is_valid(); ++iter) {
+ if (iter->m_dsp->need_track_change_mark()) flush_mark = iter;
+ }
+ }
+
+ if (m_config_changed)
+ {
+ t_dsp_chain newchain;
+ bool recycle_available = true;
+
+ for(t_size n=0;n<m_config.get_count();n++) {
+ service_ptr_t<dsp> temp;
+
+ const dsp_preset & preset = m_config.get_item(n);
+ if (dsp_entry::g_dsp_exists(preset.get_owner())) {
+ t_dsp_chain::iterator iter = newchain.insert_last();
+ iter->m_preset = m_config.get_item(n);
+ iter->m_recycle_flag = false;
+ }
+ }
+
+
+ //HACK: recycle existing DSPs in a special case when user has apparently only altered settings of one of DSPs.
+ if (newchain.get_count() == m_chain.get_count()) {
+ t_size data_mismatch_count = 0;
+ t_size owner_mismatch_count = 0;
+ t_dsp_chain::iterator iter_src, iter_dst;
+ iter_src = m_chain.first(); iter_dst = newchain.first();
+ while(iter_src.is_valid() && iter_dst.is_valid()) {
+ if (iter_src->m_preset.get_owner() != iter_dst->m_preset.get_owner()) {
+ owner_mismatch_count++;
+ } else if (iter_src->m_preset != iter_dst->m_preset) {
+ data_mismatch_count++;
+ }
+ ++iter_src; ++iter_dst;
+ }
+ recycle_available = (owner_mismatch_count == 0 && data_mismatch_count <= 1);
+ } else {
+ recycle_available = false;
+ }
+
+ if (recycle_available) {
+ t_dsp_chain::iterator iter_src, iter_dst;
+ iter_src = m_chain.first(); iter_dst = newchain.first();
+ while(iter_src.is_valid() && iter_dst.is_valid()) {
+ if (iter_src->m_preset == iter_dst->m_preset) {
+ iter_src->m_recycle_flag = true;
+ iter_dst->m_dsp = iter_src->m_dsp;
+ }
+ ++iter_src; ++iter_dst;
+ }
+ }
+
+ for(t_dsp_chain::iterator iter = newchain.first(); iter.is_valid(); ++iter) {
+ if (iter->m_dsp.is_empty()) {
+ if (!dsp_entry::g_instantiate(iter->m_dsp,iter->m_preset)) throw pfc::exception_bug_check_v2();
+ }
+ }
+
+ if (m_chain.get_count()>0) {
+ bool flushflag = flush_mark.is_valid();
+ for(t_dsp_chain::const_iterator iter = m_chain.first(); iter.is_valid(); ++iter) {
+ unsigned flags2 = p_flags;
+ if (iter == flush_mark) flushflag = false;
+ if (flushflag || !iter->m_recycle_flag) flags2|=dsp::FLUSH;
+ dsp_run(iter,p_list,p_cur_file,flags2,latency,p_abort);
+ }
+ done = true;
+ }
+
+ m_chain = newchain;
+ m_config_changed = false;
+ }
+
+ if (!done)
+ {
+ bool flushflag = flush_mark.is_valid();
+ for(t_dsp_chain::const_iterator iter = m_chain.first(); iter.is_valid(); ++iter) {
+ unsigned flags2 = p_flags;
+ if (iter == flush_mark) flushflag = false;
+ if (flushflag) flags2|=dsp::FLUSH;
+ dsp_run(iter,p_list,p_cur_file,flags2,latency,p_abort);
+ }
+ done = true;
+ }
+
+ p_list->remove_bad_chunks();
+
+ return latency;
+ } catch(...) {
+ p_list->remove_all();
+ throw;
+ }
+}
+
+void dsp_manager::flush()
+{
+ for(t_dsp_chain::const_iterator iter = m_chain.first(); iter.is_valid(); ++iter) {
+ TRACK_CODE("dsp::flush",iter->m_dsp->flush());
+ }
+}
+
+
+bool dsp_manager::is_active() const {return m_config.get_count()>0;}
+
+void dsp_config_manager::core_enable_dsp(const dsp_preset & preset) {
+ dsp_chain_config_impl cfg;
+ get_core_settings(cfg);
+
+ bool found = false;
+ bool changed = false;
+ t_size n,m = cfg.get_count();
+ for(n=0;n<m;n++) {
+ if (cfg.get_item(n).get_owner() == preset.get_owner()) {
+ found = true;
+ if (cfg.get_item(n) != preset) {
+ cfg.replace_item(preset,n);
+ changed = true;
+ }
+ break;
+ }
+ }
+ if (!found) {cfg.insert_item(preset,0); changed = true;}
+
+ if (changed) set_core_settings(cfg);
+}
+void dsp_config_manager::core_disable_dsp(const GUID & id) {
+ dsp_chain_config_impl cfg;
+ get_core_settings(cfg);
+
+ t_size n,m = cfg.get_count();
+ bit_array_bittable mask(m);
+ bool changed = false;
+ for(n=0;n<m;n++) {
+ bool axe = (cfg.get_item(n).get_owner() == id) ? true : false;
+ if (axe) changed = true;
+ mask.set(n,axe);
+ }
+ if (changed) {
+ cfg.remove_mask(mask);
+ set_core_settings(cfg);
+ }
+}
+
+bool dsp_config_manager::core_query_dsp(const GUID & id, dsp_preset & out) {
+ dsp_chain_config_impl cfg;
+ get_core_settings(cfg);
+ for(t_size n=0;n<cfg.get_count();n++) {
+ const dsp_preset & entry = cfg.get_item(n);
+ if (entry.get_owner() == id) {
+ out = entry; return true;
+ }
+ }
+ return false;
+}
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/dsp_manager.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/dsp_manager.h new file mode 100644 index 0000000000..6dbb01db35 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/dsp_manager.h @@ -0,0 +1,81 @@ +//! Helper class for running audio data through a DSP chain.
+class dsp_manager {
+public:
+ dsp_manager() : m_config_changed(false) {}
+
+ //! Alters the DSP chain configuration. Should be called before the first run() to set the configuration but can be also called anytime later between run() calls.
+ void set_config( const dsp_chain_config & p_data );
+ //! Runs DSP on the specified chunk list.
+ //! @returns Current DSP latency in seconds.
+ double run(dsp_chunk_list * p_list,const metadb_handle_ptr & p_cur_file,unsigned p_flags,abort_callback & p_abort);
+ //! Flushes the DSP (e.g. when seeking).
+ void flush();
+
+ //! Equivalent to set_config() with empty configuration.
+ void close();
+
+ //! Returns whether there's at least one active DSP in the configuration.
+ bool is_active() const;
+
+private:
+ struct t_dsp_chain_entry {
+ service_ptr_t<dsp> m_dsp;
+ dsp_preset_impl m_preset;
+ bool m_recycle_flag;
+ };
+ typedef pfc::chain_list_v2_t<t_dsp_chain_entry> t_dsp_chain;
+
+ t_dsp_chain m_chain;
+ dsp_chain_config_impl m_config;
+ bool m_config_changed;
+
+ void dsp_run(t_dsp_chain::const_iterator p_iter,dsp_chunk_list * list,const metadb_handle_ptr & cur_file,unsigned flags,double & latency,abort_callback&);
+
+ dsp_manager(const dsp_manager &) {throw pfc::exception_not_implemented();}
+ const dsp_manager & operator=(const dsp_manager&) {throw pfc::exception_not_implemented();}
+};
+
+//! Core API for accessing core playback DSP settings as well as spawning DSP configuration dialogs. \n
+//! Use static_api_ptr_t<dsp_config_manager>() to instantiate.
+class dsp_config_manager : public service_base {
+ FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(dsp_config_manager);
+public:
+ //! Retrieves current core playback DSP settings.
+ virtual void get_core_settings(dsp_chain_config & p_out) = 0;
+ //! Changes current core playback DSP settings.
+ virtual void set_core_settings(const dsp_chain_config & p_data) = 0;
+
+ //! Runs a modal DSP settings dialog.
+ //! @param p_data DSP chain configuration to edit - contains initial configuration to put in the dialog when called, receives the new configuration on successful edit.
+ //! @returns True when user approved DSP configuration changes (pressed the "OK" button), false when the user cancelled them ("Cancel" button).
+ virtual bool configure_popup(dsp_chain_config & p_data,HWND p_parent,const char * p_title) = 0;
+
+ //! Spawns an embedded DSP settings dialog.
+ //! @param p_initdata Initial DSP chain configuration to put in the dialog.
+ //! @param p_parent Parent window to contain the embedded dialog.
+ //! @param p_id Control ID of the embedded dialog. The parent window will receive a WM_COMMAND with BN_CLICKED and this identifier when user changes settings in the embedded dialog.
+ //! @param p_from_modal Must be set to true when the parent window is a modal dialog, false otherwise.
+ virtual HWND configure_embedded(const dsp_chain_config & p_initdata,HWND p_parent,unsigned p_id,bool p_from_modal) = 0;
+ //! Retrieves current settings from an embedded DSP settings dialog. See also: configure_embedded().
+ virtual void configure_embedded_retrieve(HWND wnd,dsp_chain_config & p_data) = 0;
+ //! Changes current settings in an embedded DSP settings dialog. See also: configure_embedded().
+ virtual void configure_embedded_change(HWND wnd,const dsp_chain_config & p_data) = 0;
+
+
+ //! Helper - enables a DSP in core playback settings.
+ void core_enable_dsp(const dsp_preset & preset);
+ //! Helper - disables a DSP in core playback settings.
+ void core_disable_dsp(const GUID & id);
+ //! Helper - if a DSP with the specified identifier is present in playback settings, retrieves its configuration and returns true, otherwise returns false.
+ bool core_query_dsp(const GUID & id, dsp_preset & out);
+};
+
+//! Callback class for getting notified about core playback DSP settings getting altered. \n
+//! Register your implementations with static service_factory_single_t<myclass> g_myclass_factory;
+class NOVTABLE dsp_config_callback : public service_base {
+ FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(dsp_config_callback);
+public:
+ //! Called when core playback DSP settings change. \n
+ //! Note: you must not try to alter core playback DSP settings inside this callback, or call anything else that possibly alters core playback DSP settings.
+ virtual void on_core_settings_change(const dsp_chain_config & p_newdata) = 0;
+};
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/event_logger.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/event_logger.h new file mode 100644 index 0000000000..20e3f7c588 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/event_logger.h @@ -0,0 +1,19 @@ +class NOVTABLE event_logger : public service_base {
+ FB2K_MAKE_SERVICE_INTERFACE(event_logger, service_base);
+public:
+ enum {
+ severity_status,
+ severity_warning,
+ severity_error
+ };
+ void log_status(const char * line) {log_entry(line, severity_status);}
+ void log_warning(const char * line) {log_entry(line, severity_warning);}
+ void log_error(const char * line) {log_entry(line, severity_error);}
+
+ virtual void log_entry(const char * line, unsigned severity) = 0;
+};
+
+class event_logger_fallback : public event_logger {
+public:
+ void log_entry(const char * line, unsigned) {console::print(line);}
+};
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/exceptions.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/exceptions.h new file mode 100644 index 0000000000..2de28dc6e2 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/exceptions.h @@ -0,0 +1,13 @@ +#if FOOBAR2000_TARGET_VERSION >= 76
+
+//! Base class for exceptions that should show a human readable message when caught in app entrypoint function rather than crash and send a crash report.
+PFC_DECLARE_EXCEPTION(exception_messagebox,pfc::exception,"Internal Error");
+
+//! Base class for exceptions that should result in a quiet app shutdown.
+PFC_DECLARE_EXCEPTION(exception_shutdownrequest,pfc::exception,"Shutdown Request");
+
+
+PFC_DECLARE_EXCEPTION(exception_installdamaged, exception_messagebox, "Internal error - one or more of the installed components have been damaged.");
+PFC_DECLARE_EXCEPTION(exception_out_of_resources, exception_messagebox, "Not enough system resources available.");
+
+#endif
\ No newline at end of file diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/file_info.cpp b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/file_info.cpp new file mode 100644 index 0000000000..3b1b138b09 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/file_info.cpp @@ -0,0 +1,474 @@ +#include "foobar2000.h"
+
+t_size file_info::meta_find_ex(const char * p_name,t_size p_name_length) const
+{
+ t_size n, m = meta_get_count();
+ for(n=0;n<m;n++)
+ {
+ if (pfc::stricmp_ascii_ex(meta_enum_name(n),pfc_infinite,p_name,p_name_length) == 0) return n;
+ }
+ return pfc_infinite;
+}
+
+bool file_info::meta_exists_ex(const char * p_name,t_size p_name_length) const
+{
+ return meta_find_ex(p_name,p_name_length) != pfc_infinite;
+}
+
+void file_info::meta_remove_field_ex(const char * p_name,t_size p_name_length)
+{
+ t_size index = meta_find_ex(p_name,p_name_length);
+ if (index!=pfc_infinite) meta_remove_index(index);
+}
+
+
+void file_info::meta_remove_index(t_size p_index)
+{
+ meta_remove_mask(bit_array_one(p_index));
+}
+
+void file_info::meta_remove_all()
+{
+ meta_remove_mask(bit_array_true());
+}
+
+void file_info::meta_remove_value(t_size p_index,t_size p_value)
+{
+ meta_remove_values(p_index,bit_array_one(p_value));
+}
+
+t_size file_info::meta_get_count_by_name_ex(const char * p_name,t_size p_name_length) const
+{
+ t_size index = meta_find_ex(p_name,p_name_length);
+ if (index == pfc_infinite) return 0;
+ return meta_enum_value_count(index);
+}
+
+t_size file_info::info_find_ex(const char * p_name,t_size p_name_length) const
+{
+ t_size n, m = info_get_count();
+ for(n=0;n<m;n++) {
+ if (pfc::stricmp_ascii_ex(info_enum_name(n),pfc_infinite,p_name,p_name_length) == 0) return n;
+ }
+ return pfc_infinite;
+}
+
+bool file_info::info_exists_ex(const char * p_name,t_size p_name_length) const
+{
+ return info_find_ex(p_name,p_name_length) != pfc_infinite;
+}
+
+void file_info::info_remove_index(t_size p_index)
+{
+ info_remove_mask(bit_array_one(p_index));
+}
+
+void file_info::info_remove_all()
+{
+ info_remove_mask(bit_array_true());
+}
+
+bool file_info::info_remove_ex(const char * p_name,t_size p_name_length)
+{
+ t_size index = info_find_ex(p_name,p_name_length);
+ if (index != pfc_infinite)
+ {
+ info_remove_index(index);
+ return true;
+ }
+ else return false;
+}
+
+void file_info::copy_meta_single(const file_info & p_source,t_size p_index)
+{
+ copy_meta_single_rename(p_source,p_index,p_source.meta_enum_name(p_index));
+}
+
+void file_info::copy_meta_single_nocheck(const file_info & p_source,t_size p_index)
+{
+ const char * name = p_source.meta_enum_name(p_index);
+ t_size n, m = p_source.meta_enum_value_count(p_index);
+ t_size new_index = pfc_infinite;
+ for(n=0;n<m;n++)
+ {
+ const char * value = p_source.meta_enum_value(p_index,n);
+ if (n == 0) new_index = meta_set_nocheck(name,value);
+ else meta_add_value(new_index,value);
+ }
+}
+
+void file_info::copy_meta_single_by_name_ex(const file_info & p_source,const char * p_name,t_size p_name_length)
+{
+ t_size index = p_source.meta_find_ex(p_name,p_name_length);
+ if (index != pfc_infinite) copy_meta_single(p_source,index);
+}
+
+void file_info::copy_info_single_by_name_ex(const file_info & p_source,const char * p_name,t_size p_name_length)
+{
+ t_size index = p_source.info_find_ex(p_name,p_name_length);
+ if (index != pfc_infinite) copy_info_single(p_source,index);
+}
+
+void file_info::copy_meta_single_by_name_nocheck_ex(const file_info & p_source,const char * p_name,t_size p_name_length)
+{
+ t_size index = p_source.meta_find_ex(p_name,p_name_length);
+ if (index != pfc_infinite) copy_meta_single_nocheck(p_source,index);
+}
+
+void file_info::copy_info_single_by_name_nocheck_ex(const file_info & p_source,const char * p_name,t_size p_name_length)
+{
+ t_size index = p_source.info_find_ex(p_name,p_name_length);
+ if (index != pfc_infinite) copy_info_single_nocheck(p_source,index);
+}
+
+void file_info::copy_info_single(const file_info & p_source,t_size p_index)
+{
+ info_set(p_source.info_enum_name(p_index),p_source.info_enum_value(p_index));
+}
+
+void file_info::copy_info_single_nocheck(const file_info & p_source,t_size p_index)
+{
+ info_set_nocheck(p_source.info_enum_name(p_index),p_source.info_enum_value(p_index));
+}
+
+void file_info::copy_meta(const file_info & p_source)
+{
+ if (&p_source != this) {
+ meta_remove_all();
+ t_size n, m = p_source.meta_get_count();
+ for(n=0;n<m;n++)
+ copy_meta_single_nocheck(p_source,n);
+ }
+}
+
+void file_info::copy_info(const file_info & p_source)
+{
+ if (&p_source != this) {
+ info_remove_all();
+ t_size n, m = p_source.info_get_count();
+ for(n=0;n<m;n++)
+ copy_info_single_nocheck(p_source,n);
+ }
+}
+
+void file_info::copy(const file_info & p_source)
+{
+ if (&p_source != this) {
+ copy_meta(p_source);
+ copy_info(p_source);
+ set_length(p_source.get_length());
+ set_replaygain(p_source.get_replaygain());
+ }
+}
+
+
+const char * file_info::meta_get_ex(const char * p_name,t_size p_name_length,t_size p_index) const
+{
+ t_size index = meta_find_ex(p_name,p_name_length);
+ if (index == pfc_infinite) return 0;
+ t_size max = meta_enum_value_count(index);
+ if (p_index >= max) return 0;
+ return meta_enum_value(index,p_index);
+}
+
+const char * file_info::info_get_ex(const char * p_name,t_size p_name_length) const
+{
+ t_size index = info_find_ex(p_name,p_name_length);
+ if (index == pfc_infinite) return 0;
+ return info_enum_value(index);
+}
+
+t_int64 file_info::info_get_int(const char * name) const
+{
+ PFC_ASSERT(pfc::is_valid_utf8(name));
+ const char * val = info_get(name);
+ if (val==0) return 0;
+ return _atoi64(val);
+}
+
+t_int64 file_info::info_get_length_samples() const
+{
+ t_int64 ret = 0;
+ double len = get_length();
+ t_int64 srate = info_get_int("samplerate");
+
+ if (srate>0 && len>0)
+ {
+ ret = audio_math::time_to_samples(len,(unsigned)srate);
+ }
+ return ret;
+}
+
+double file_info::info_get_float(const char * name) const
+{
+ const char * ptr = info_get(name);
+ if (ptr) return pfc::string_to_float(ptr);
+ else return 0;
+}
+
+void file_info::info_set_int(const char * name,t_int64 value)
+{
+ PFC_ASSERT(pfc::is_valid_utf8(name));
+ info_set(name,pfc::format_int(value));
+}
+
+void file_info::info_set_float(const char * name,double value,unsigned precision,bool force_sign,const char * unit)
+{
+ PFC_ASSERT(pfc::is_valid_utf8(name));
+ PFC_ASSERT(unit==0 || strlen(unit) <= 64);
+ char temp[128];
+ pfc::float_to_string(temp,64,value,precision,force_sign);
+ temp[63] = 0;
+ if (unit)
+ {
+ strcat(temp," ");
+ strcat(temp,unit);
+ }
+ info_set(name,temp);
+}
+
+
+void file_info::info_set_replaygain_album_gain(float value)
+{
+ replaygain_info temp = get_replaygain();
+ temp.m_album_gain = value;
+ set_replaygain(temp);
+}
+
+void file_info::info_set_replaygain_album_peak(float value)
+{
+ replaygain_info temp = get_replaygain();
+ temp.m_album_peak = value;
+ set_replaygain(temp);
+}
+
+void file_info::info_set_replaygain_track_gain(float value)
+{
+ replaygain_info temp = get_replaygain();
+ temp.m_track_gain = value;
+ set_replaygain(temp);
+}
+
+void file_info::info_set_replaygain_track_peak(float value)
+{
+ replaygain_info temp = get_replaygain();
+ temp.m_track_peak = value;
+ set_replaygain(temp);
+}
+
+
+static bool is_valid_bps(t_int64 val)
+{
+ return val>0 && val<=256;
+}
+
+unsigned file_info::info_get_decoded_bps() const
+{
+ t_int64 val = info_get_int("decoded_bitspersample");
+ if (is_valid_bps(val)) return (unsigned)val;
+ val = info_get_int("bitspersample");
+ if (is_valid_bps(val)) return (unsigned)val;
+ return 0;
+
+}
+
+void file_info::reset()
+{
+ info_remove_all();
+ meta_remove_all();
+ set_length(0);
+ reset_replaygain();
+}
+
+void file_info::reset_replaygain()
+{
+ replaygain_info temp;
+ temp.reset();
+ set_replaygain(temp);
+}
+
+void file_info::copy_meta_single_rename_ex(const file_info & p_source,t_size p_index,const char * p_new_name,t_size p_new_name_length)
+{
+ t_size n, m = p_source.meta_enum_value_count(p_index);
+ t_size new_index = pfc_infinite;
+ for(n=0;n<m;n++)
+ {
+ const char * value = p_source.meta_enum_value(p_index,n);
+ if (n == 0) new_index = meta_set_ex(p_new_name,p_new_name_length,value,pfc_infinite);
+ else meta_add_value(new_index,value);
+ }
+}
+
+t_size file_info::meta_add_ex(const char * p_name,t_size p_name_length,const char * p_value,t_size p_value_length)
+{
+ t_size index = meta_find_ex(p_name,p_name_length);
+ if (index == pfc_infinite) return meta_set_nocheck_ex(p_name,p_name_length,p_value,p_value_length);
+ else
+ {
+ meta_add_value_ex(index,p_value,p_value_length);
+ return index;
+ }
+}
+
+void file_info::meta_add_value_ex(t_size p_index,const char * p_value,t_size p_value_length)
+{
+ meta_insert_value_ex(p_index,meta_enum_value_count(p_index),p_value,p_value_length);
+}
+
+
+t_size file_info::meta_calc_total_value_count() const
+{
+ t_size n, m = meta_get_count(), ret = 0;
+ for(n=0;n<m;n++) ret += meta_enum_value_count(n);
+ return ret;
+}
+
+bool file_info::info_set_replaygain_ex(const char * p_name,t_size p_name_len,const char * p_value,t_size p_value_len)
+{
+ replaygain_info temp = get_replaygain();
+ if (temp.set_from_meta_ex(p_name,p_name_len,p_value,p_value_len))
+ {
+ set_replaygain(temp);
+ return true;
+ }
+ else return false;
+}
+
+void file_info::info_set_replaygain_auto_ex(const char * p_name,t_size p_name_len,const char * p_value,t_size p_value_len)
+{
+ if (!info_set_replaygain_ex(p_name,p_name_len,p_value,p_value_len))
+ info_set_ex(p_name,p_name_len,p_value,p_value_len);
+}
+
+bool replaygain_info::g_equal(const replaygain_info & item1,const replaygain_info & item2)
+{
+ return item1.m_album_gain == item2.m_album_gain &&
+ item1.m_track_gain == item2.m_track_gain &&
+ item1.m_album_peak == item2.m_album_peak &&
+ item1.m_track_peak == item2.m_track_peak;
+}
+
+bool file_info::are_meta_fields_identical(t_size p_index1,t_size p_index2) const
+{
+ const t_size count = meta_enum_value_count(p_index1);
+ if (count != meta_enum_value_count(p_index2)) return false;
+ t_size n;
+ for(n=0;n<count;n++)
+ {
+ if (strcmp(meta_enum_value(p_index1,n),meta_enum_value(p_index2,n))) return false;
+ }
+ return true;
+}
+
+
+void file_info::meta_format_entry(t_size index, pfc::string_base & out, const char * separator) const {
+ out.reset();
+ t_size val, count = meta_enum_value_count(index);
+ PFC_ASSERT( count > 0);
+ for(val=0;val<count;val++)
+ {
+ if (val > 0) out += separator;
+ out += meta_enum_value(index,val);
+ }
+}
+
+bool file_info::meta_format(const char * p_name,pfc::string_base & p_out, const char * separator) const {
+ p_out.reset();
+ t_size index = meta_find(p_name);
+ if (index == pfc_infinite) return false;
+ meta_format_entry(index, p_out, separator);
+ return true;
+}
+
+void file_info::info_calculate_bitrate(t_filesize p_filesize,double p_length)
+{
+ info_set_bitrate((unsigned)floor((double)p_filesize * 8 / (p_length * 1000) + 0.5));
+}
+
+bool file_info::is_encoding_lossy() const {
+ const char * encoding = info_get("encoding");
+ if (encoding != NULL) {
+ if (pfc::stricmp_ascii(encoding,"lossy") == 0 /*|| pfc::stricmp_ascii(encoding,"hybrid") == 0*/) return true;
+ } else {
+ //the old way
+ //disabled: don't whine if we're not sure what we're dealing with - might be a file with info not-yet-loaded in oddball cases or a mod file
+ //if (info_get("bitspersample") == NULL) return true;
+ }
+ return false;
+}
+
+bool file_info::g_is_meta_equal(const file_info & p_item1,const file_info & p_item2) {
+ const t_size count = p_item1.meta_get_count();
+ if (count != p_item2.meta_get_count()) {
+ //uDebugLog() << "meta count mismatch";
+ return false;
+ }
+ pfc::map_t<const char*,t_size,field_name_comparator> item2_meta_map;
+ for(t_size n=0; n<count; n++) {
+ item2_meta_map.set(p_item2.meta_enum_name(n),n);
+ }
+ for(t_size n1=0; n1<count; n1++) {
+ t_size n2;
+ if (!item2_meta_map.query(p_item1.meta_enum_name(n1),n2)) {
+ //uDebugLog() << "item2 doesn't have " << p_item1.meta_enum_name(n1);
+ return false;
+ }
+ t_size value_count = p_item1.meta_enum_value_count(n1);
+ if (value_count != p_item2.meta_enum_value_count(n2)) {
+ //uDebugLog() << "meta value count mismatch: " << p_item1.meta_enum_name(n1) << " : " << value_count << " vs " << p_item2.meta_enum_value_count(n2);
+ return false;
+ }
+ for(t_size v = 0; v < value_count; v++) {
+ if (strcmp(p_item1.meta_enum_value(n1,v),p_item2.meta_enum_value(n2,v)) != 0) {
+ //uDebugLog() << "meta mismatch: " << p_item1.meta_enum_name(n1) << " : " << p_item1.meta_enum_value(n1,v) << " vs " << p_item2.meta_enum_value(n2,v);
+ return false;
+ }
+ }
+ }
+ return true;
+}
+
+bool file_info::g_is_info_equal(const file_info & p_item1,const file_info & p_item2) {
+ t_size count = p_item1.info_get_count();
+ if (count != p_item2.info_get_count()) {
+ //uDebugLog() << "info count mismatch";
+ return false;
+ }
+ for(t_size n1=0; n1<count; n1++) {
+ t_size n2 = p_item2.info_find(p_item1.info_enum_name(n1));
+ if (n2 == pfc_infinite) {
+ //uDebugLog() << "item2 does not have " << p_item1.info_enum_name(n1);
+ return false;
+ }
+ if (strcmp(p_item1.info_enum_value(n1),p_item2.info_enum_value(n2)) != 0) {
+ //uDebugLog() << "value mismatch: " << p_item1.info_enum_name(n1);
+ return false;
+ }
+ }
+ return true;
+}
+
+static bool is_valid_field_name_char(char p_char) {
+ return p_char >= 32 && p_char < 127 && p_char != '=' && p_char != '%' && p_char != '<' && p_char != '>';
+}
+
+bool file_info::g_is_valid_field_name(const char * p_name,t_size p_length) {
+ t_size walk;
+ for(walk = 0; walk < p_length && p_name[walk] != 0; walk++) {
+ if (!is_valid_field_name_char(p_name[walk])) return false;
+ }
+ return walk > 0;
+}
+
+void file_info::to_console() const {
+ console::formatter() << "File info dump:";
+ if (get_length() > 0) console::formatter() << "Duration: " << pfc::format_time_ex(get_length(), 6);
+ pfc::string_formatter temp;
+ for(t_size metaWalk = 0; metaWalk < meta_get_count(); ++metaWalk) {
+ meta_format_entry(metaWalk, temp);
+ console::formatter() << "Meta: " << meta_enum_name(metaWalk) << " = " << temp;
+ }
+ for(t_size infoWalk = 0; infoWalk < info_get_count(); ++infoWalk) {
+ console::formatter() << "Info: " << info_enum_name(infoWalk) << " = " << info_enum_value(infoWalk);
+ }
+}
\ No newline at end of file diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/file_info.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/file_info.h new file mode 100644 index 0000000000..674ee75850 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/file_info.h @@ -0,0 +1,236 @@ +//! Structure containing ReplayGain scan results from some playable object, also providing various helper methods to manipulate those results.
+struct replaygain_info
+{
+ float m_album_gain,m_track_gain;
+ float m_album_peak,m_track_peak;
+
+ enum {text_buffer_size = 16 };
+ typedef char t_text_buffer[text_buffer_size];
+
+ enum { peak_invalid = -1, gain_invalid = -1000 };
+
+ static bool g_format_gain(float p_value,char p_buffer[text_buffer_size]);
+ static bool g_format_peak(float p_value,char p_buffer[text_buffer_size]);
+
+ inline bool format_album_gain(char p_buffer[text_buffer_size]) const {return g_format_gain(m_album_gain,p_buffer);}
+ inline bool format_track_gain(char p_buffer[text_buffer_size]) const {return g_format_gain(m_track_gain,p_buffer);}
+ inline bool format_album_peak(char p_buffer[text_buffer_size]) const {return g_format_peak(m_album_peak,p_buffer);}
+ inline bool format_track_peak(char p_buffer[text_buffer_size]) const {return g_format_peak(m_track_peak,p_buffer);}
+
+ void set_album_gain_text(const char * p_text,t_size p_text_len = pfc_infinite);
+ void set_track_gain_text(const char * p_text,t_size p_text_len = pfc_infinite);
+ void set_album_peak_text(const char * p_text,t_size p_text_len = pfc_infinite);
+ void set_track_peak_text(const char * p_text,t_size p_text_len = pfc_infinite);
+
+ static bool g_is_meta_replaygain(const char * p_name,t_size p_name_len = pfc_infinite);
+ bool set_from_meta_ex(const char * p_name,t_size p_name_len,const char * p_value,t_size p_value_len);
+ inline bool set_from_meta(const char * p_name,const char * p_value) {return set_from_meta_ex(p_name,pfc_infinite,p_value,pfc_infinite);}
+
+ inline bool is_album_gain_present() const {return m_album_gain != gain_invalid;}
+ inline bool is_track_gain_present() const {return m_track_gain != gain_invalid;}
+ inline bool is_album_peak_present() const {return m_album_peak != peak_invalid;}
+ inline bool is_track_peak_present() const {return m_track_peak != peak_invalid;}
+
+ inline void remove_album_gain() {m_album_gain = gain_invalid;}
+ inline void remove_track_gain() {m_track_gain = gain_invalid;}
+ inline void remove_album_peak() {m_album_peak = peak_invalid;}
+ inline void remove_track_peak() {m_track_peak = peak_invalid;}
+
+ t_size get_value_count();
+
+ static replaygain_info g_merge(replaygain_info r1,replaygain_info r2);
+
+ static bool g_equal(const replaygain_info & item1,const replaygain_info & item2);
+
+ void reset();
+};
+
+inline bool operator==(const replaygain_info & item1,const replaygain_info & item2) {return replaygain_info::g_equal(item1,item2);}
+inline bool operator!=(const replaygain_info & item1,const replaygain_info & item2) {return !replaygain_info::g_equal(item1,item2);}
+
+static const replaygain_info replaygain_info_invalid = {replaygain_info::gain_invalid,replaygain_info::gain_invalid,replaygain_info::peak_invalid,replaygain_info::peak_invalid};
+
+
+//! Main interface class for information about some playable object.
+class NOVTABLE file_info {
+public:
+ //! Retrieves audio duration, in seconds. \n
+ //! Note that the reported duration should not be assumed to be the exact length of the track -\n
+ //! with many popular audio formats, exact duration is impossible to determine without performing a full decode pass;\n
+ //! with other formats, the decoded data may be shorter than reported due to truncation other damage.
+ virtual double get_length() const = 0;
+ //! Sets audio duration, in seconds. \n
+ //! Note that the reported duration should not be assumed to be the exact length of the track -\n
+ //! with many popular audio formats, exact duration is impossible to determine without performing a full decode pass;\n
+ //! with other formats, the decoded data may be shorter than reported due to truncation other damage.
+ virtual void set_length(double p_length) = 0;
+
+ //! Sets ReplayGain information.
+ virtual void set_replaygain(const replaygain_info & p_info) = 0;
+ //! Retrieves ReplayGain information.
+ virtual replaygain_info get_replaygain() const = 0;
+
+ //! Retrieves count of metadata entries.
+ virtual t_size meta_get_count() const = 0;
+ //! Retrieves the name of metadata entry of specified index. Return value is a null-terminated UTF-8 encoded string.
+ virtual const char* meta_enum_name(t_size p_index) const = 0;
+ //! Retrieves count of values in metadata entry of specified index. The value is always equal to or greater than 1.
+ virtual t_size meta_enum_value_count(t_size p_index) const = 0;
+ //! Retrieves specified value from specified metadata entry. Return value is a null-terminated UTF-8 encoded string.
+ virtual const char* meta_enum_value(t_size p_index,t_size p_value_number) const = 0;
+ //! Finds index of metadata entry of specified name. Returns infinite when not found.
+ virtual t_size meta_find_ex(const char * p_name,t_size p_name_length) const;
+ //! Creates a new metadata entry of specified name with specified value. If an entry of same name already exists, it is erased. Return value is the index of newly created metadata entry.
+ virtual t_size meta_set_ex(const char * p_name,t_size p_name_length,const char * p_value,t_size p_value_length) = 0;
+ //! Inserts a new value into specified metadata entry.
+ virtual void meta_insert_value_ex(t_size p_index,t_size p_value_index,const char * p_value,t_size p_value_length) = 0;
+ //! Removes metadata entries according to specified bit mask.
+ virtual void meta_remove_mask(const bit_array & p_mask) = 0;
+ //! Reorders metadata entries according to specified permutation.
+ virtual void meta_reorder(const t_size * p_order) = 0;
+ //! Removes values according to specified bit mask from specified metadata entry. If all values are removed, entire metadata entry is removed as well.
+ virtual void meta_remove_values(t_size p_index,const bit_array & p_mask) = 0;
+ //! Alters specified value in specified metadata entry.
+ virtual void meta_modify_value_ex(t_size p_index,t_size p_value_index,const char * p_value,t_size p_value_length) = 0;
+
+ //! Retrieves number of technical info entries.
+ virtual t_size info_get_count() const = 0;
+ //! Retrieves the name of specified technical info entry. Return value is a null-terminated UTF-8 encoded string.
+ virtual const char* info_enum_name(t_size p_index) const = 0;
+ //! Retrieves the value of specified technical info entry. Return value is a null-terminated UTF-8 encoded string.
+ virtual const char* info_enum_value(t_size p_index) const = 0;
+ //! Creates a new technical info entry with specified name and specified value. If an entry of the same name already exists, it is erased. Return value is the index of newly created entry.
+ virtual t_size info_set_ex(const char * p_name,t_size p_name_length,const char * p_value,t_size p_value_length) = 0;
+ //! Removes technical info entries indicated by specified bit mask.
+ virtual void info_remove_mask(const bit_array & p_mask) = 0;
+ //! Finds technical info entry of specified name. Returns index of found entry on success, infinite on failure.
+ virtual t_size info_find_ex(const char * p_name,t_size p_name_length) const;
+
+ //! Copies entire file_info contents from specified file_info object.
+ virtual void copy(const file_info & p_source);//virtualized for performance reasons, can be faster in two-pass
+ //! Copies metadata from specified file_info object.
+ virtual void copy_meta(const file_info & p_source);//virtualized for performance reasons, can be faster in two-pass
+ //! Copies technical info from specified file_info object.
+ virtual void copy_info(const file_info & p_source);//virtualized for performance reasons, can be faster in two-pass
+
+ bool meta_exists_ex(const char * p_name,t_size p_name_length) const;
+ void meta_remove_field_ex(const char * p_name,t_size p_name_length);
+ void meta_remove_index(t_size p_index);
+ void meta_remove_all();
+ void meta_remove_value(t_size p_index,t_size p_value);
+ const char * meta_get_ex(const char * p_name,t_size p_name_length,t_size p_index) const;
+ t_size meta_get_count_by_name_ex(const char * p_name,t_size p_name_length) const;
+ void meta_add_value_ex(t_size p_index,const char * p_value,t_size p_value_length);
+ t_size meta_add_ex(const char * p_name,t_size p_name_length,const char * p_value,t_size p_value_length);
+ t_size meta_calc_total_value_count() const;
+ bool meta_format(const char * p_name,pfc::string_base & p_out, const char * separator = ", ") const;
+ void meta_format_entry(t_size index, pfc::string_base & p_out, const char * separator = ", ") const;//same as meta_format but takes index instead of meta name.
+
+
+ bool info_exists_ex(const char * p_name,t_size p_name_length) const;
+ void info_remove_index(t_size p_index);
+ void info_remove_all();
+ bool info_remove_ex(const char * p_name,t_size p_name_length);
+ const char * info_get_ex(const char * p_name,t_size p_name_length) const;
+
+ inline t_size meta_find(const char * p_name) const {return meta_find_ex(p_name,pfc_infinite);}
+ inline bool meta_exists(const char * p_name) const {return meta_exists_ex(p_name,pfc_infinite);}
+ inline void meta_remove_field(const char * p_name) {meta_remove_field_ex(p_name,pfc_infinite);}
+ inline t_size meta_set(const char * p_name,const char * p_value) {return meta_set_ex(p_name,pfc_infinite,p_value,pfc_infinite);}
+ inline void meta_insert_value(t_size p_index,t_size p_value_index,const char * p_value) {meta_insert_value_ex(p_index,p_value_index,p_value,pfc_infinite);}
+ inline void meta_add_value(t_size p_index,const char * p_value) {meta_add_value_ex(p_index,p_value,pfc_infinite);}
+ inline const char* meta_get(const char * p_name,t_size p_index) const {return meta_get_ex(p_name,pfc_infinite,p_index);}
+ inline t_size meta_get_count_by_name(const char * p_name) const {return meta_get_count_by_name_ex(p_name,pfc_infinite);}
+ inline t_size meta_add(const char * p_name,const char * p_value) {return meta_add_ex(p_name,pfc_infinite,p_value,pfc_infinite);}
+ inline void meta_modify_value(t_size p_index,t_size p_value_index,const char * p_value) {meta_modify_value_ex(p_index,p_value_index,p_value,pfc_infinite);}
+
+
+
+ inline t_size info_set(const char * p_name,const char * p_value) {return info_set_ex(p_name,pfc_infinite,p_value,pfc_infinite);}
+ inline t_size info_find(const char * p_name) const {return info_find_ex(p_name,pfc_infinite);}
+ inline bool info_exists(const char * p_name) const {return info_exists_ex(p_name,pfc_infinite);}
+ inline bool info_remove(const char * p_name) {return info_remove_ex(p_name,pfc_infinite);}
+ inline const char * info_get(const char * p_name) const {return info_get_ex(p_name,pfc_infinite);}
+
+ bool info_set_replaygain_ex(const char * p_name,t_size p_name_len,const char * p_value,t_size p_value_len);
+ inline bool info_set_replaygain(const char * p_name,const char * p_value) {return info_set_replaygain_ex(p_name,pfc_infinite,p_value,pfc_infinite);}
+ void info_set_replaygain_auto_ex(const char * p_name,t_size p_name_len,const char * p_value,t_size p_value_len);
+ inline void info_set_replaygain_auto(const char * p_name,const char * p_value) {info_set_replaygain_auto_ex(p_name,pfc_infinite,p_value,pfc_infinite);}
+
+
+
+ void copy_meta_single(const file_info & p_source,t_size p_index);
+ void copy_info_single(const file_info & p_source,t_size p_index);
+ void copy_meta_single_by_name_ex(const file_info & p_source,const char * p_name,t_size p_name_length);
+ void copy_info_single_by_name_ex(const file_info & p_source,const char * p_name,t_size p_name_length);
+ inline void copy_meta_single_by_name(const file_info & p_source,const char * p_name) {copy_meta_single_by_name_ex(p_source,p_name,pfc_infinite);}
+ inline void copy_info_single_by_name(const file_info & p_source,const char * p_name) {copy_info_single_by_name_ex(p_source,p_name,pfc_infinite);}
+ void reset();
+ void reset_replaygain();
+ void copy_meta_single_rename_ex(const file_info & p_source,t_size p_index,const char * p_new_name,t_size p_new_name_length);
+ inline void copy_meta_single_rename(const file_info & p_source,t_size p_index,const char * p_new_name) {copy_meta_single_rename_ex(p_source,p_index,p_new_name,pfc_infinite);}
+ void overwrite_info(const file_info & p_source);
+
+ t_int64 info_get_int(const char * name) const;
+ t_int64 info_get_length_samples() const;
+ double info_get_float(const char * name) const;
+ void info_set_int(const char * name,t_int64 value);
+ void info_set_float(const char * name,double value,unsigned precision,bool force_sign = false,const char * unit = 0);
+ void info_set_replaygain_track_gain(float value);
+ void info_set_replaygain_album_gain(float value);
+ void info_set_replaygain_track_peak(float value);
+ void info_set_replaygain_album_peak(float value);
+
+ inline t_int64 info_get_bitrate_vbr() const {return info_get_int("bitrate_dynamic");}
+ inline void info_set_bitrate_vbr(t_int64 val) {info_set_int("bitrate_dynamic",val);}
+ inline t_int64 info_get_bitrate() const {return info_get_int("bitrate");}
+ inline void info_set_bitrate(t_int64 val) {info_set_int("bitrate",val);}
+ bool is_encoding_lossy() const;
+
+ void info_calculate_bitrate(t_filesize p_filesize,double p_length);
+
+ unsigned info_get_decoded_bps() const;//what bps the stream originally was (before converting to audio_sample), 0 if unknown
+
+ void merge(const pfc::list_base_const_t<const file_info*> & p_sources);
+
+ void merge_fallback(const file_info & fallback);
+
+ bool are_meta_fields_identical(t_size p_index1,t_size p_index2) const;
+
+ inline const file_info & operator=(const file_info & p_source) {copy(p_source);return *this;}
+
+ static bool g_is_meta_equal(const file_info & p_item1,const file_info & p_item2);
+ static bool g_is_info_equal(const file_info & p_item1,const file_info & p_item2);
+
+ //! Unsafe - does not check whether the field already exists and will result in duplicates if it does - call only when appropriate checks have been applied externally.
+ t_size __meta_add_unsafe_ex(const char * p_name,t_size p_name_length,const char * p_value,t_size p_value_length) {return meta_set_nocheck_ex(p_name,p_name_length,p_value,p_value_length);}
+ //! Unsafe - does not check whether the field already exists and will result in duplicates if it does - call only when appropriate checks have been applied externally.
+ t_size __meta_add_unsafe(const char * p_name,const char * p_value) {return meta_set_nocheck_ex(p_name,pfc_infinite,p_value,pfc_infinite);}
+
+ //! Unsafe - does not check whether the field already exists and will result in duplicates if it does - call only when appropriate checks have been applied externally.
+ t_size __info_add_unsafe_ex(const char * p_name,t_size p_name_length,const char * p_value,t_size p_value_length) {return info_set_nocheck_ex(p_name,p_name_length,p_value,p_value_length);}
+ //! Unsafe - does not check whether the field already exists and will result in duplicates if it does - call only when appropriate checks have been applied externally.
+ t_size __info_add_unsafe(const char * p_name,const char * p_value) {return info_set_nocheck_ex(p_name,pfc_infinite,p_value,pfc_infinite);}
+
+ void _copy_meta_single_nocheck(const file_info & p_source,t_size p_index) {copy_meta_single_nocheck(p_source, p_index);}
+
+ static bool g_is_valid_field_name(const char * p_name,t_size p_length = pfc_infinite);
+ //typedef pfc::comparator_stricmp_ascii field_name_comparator;
+ typedef pfc::string::comparatorCaseInsensitiveASCII field_name_comparator;
+
+ void to_console() const;
+protected:
+ file_info() {}
+ ~file_info() {}
+ void copy_meta_single_nocheck(const file_info & p_source,t_size p_index);
+ void copy_info_single_nocheck(const file_info & p_source,t_size p_index);
+ void copy_meta_single_by_name_nocheck_ex(const file_info & p_source,const char * p_name,t_size p_name_length);
+ void copy_info_single_by_name_nocheck_ex(const file_info & p_source,const char * p_name,t_size p_name_length);
+ inline void copy_meta_single_by_name_nocheck(const file_info & p_source,const char * p_name) {copy_meta_single_by_name_nocheck_ex(p_source,p_name,pfc_infinite);}
+ inline void copy_info_single_by_name_nocheck(const file_info & p_source,const char * p_name) {copy_info_single_by_name_nocheck_ex(p_source,p_name,pfc_infinite);}
+
+ virtual t_size meta_set_nocheck_ex(const char * p_name,t_size p_name_length,const char * p_value,t_size p_value_length) = 0;
+ virtual t_size info_set_nocheck_ex(const char * p_name,t_size p_name_length,const char * p_value,t_size p_value_length) = 0;
+ inline t_size meta_set_nocheck(const char * p_name,const char * p_value) {return meta_set_nocheck_ex(p_name,pfc_infinite,p_value,pfc_infinite);}
+ inline t_size info_set_nocheck(const char * p_name,const char * p_value) {return info_set_nocheck_ex(p_name,pfc_infinite,p_value,pfc_infinite);}
+};
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/file_info_impl.cpp b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/file_info_impl.cpp new file mode 100644 index 0000000000..9d98d75153 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/file_info_impl.cpp @@ -0,0 +1,243 @@ +#include "foobar2000.h"
+
+
+t_size file_info_impl::meta_get_count() const
+{
+ return m_meta.get_count();
+}
+
+const char* file_info_impl::meta_enum_name(t_size p_index) const
+{
+ return m_meta.get_name(p_index);
+}
+
+t_size file_info_impl::meta_enum_value_count(t_size p_index) const
+{
+ return m_meta.get_value_count(p_index);
+}
+
+const char* file_info_impl::meta_enum_value(t_size p_index,t_size p_value_number) const
+{
+ return m_meta.get_value(p_index,p_value_number);
+}
+
+t_size file_info_impl::meta_set_ex(const char * p_name,t_size p_name_length,const char * p_value,t_size p_value_length)
+{
+ meta_remove_field_ex(p_name,p_name_length);
+ return meta_set_nocheck_ex(p_name,p_name_length,p_value,p_value_length);
+}
+
+t_size file_info_impl::meta_set_nocheck_ex(const char * p_name,t_size p_name_length,const char * p_value,t_size p_value_length)
+{
+ return m_meta.add_entry(p_name,p_name_length,p_value,p_value_length);
+}
+
+void file_info_impl::meta_insert_value_ex(t_size p_index,t_size p_value_index,const char * p_value,t_size p_value_length)
+{
+ m_meta.insert_value(p_index,p_value_index,p_value,p_value_length);
+}
+
+void file_info_impl::meta_remove_mask(const bit_array & p_mask)
+{
+ m_meta.remove_mask(p_mask);
+}
+
+void file_info_impl::meta_reorder(const t_size * p_order)
+{
+ m_meta.reorder(p_order);
+}
+
+void file_info_impl::meta_remove_values(t_size p_index,const bit_array & p_mask)
+{
+ m_meta.remove_values(p_index,p_mask);
+ if (m_meta.get_value_count(p_index) == 0)
+ m_meta.remove_mask(bit_array_one(p_index));
+}
+
+t_size file_info_impl::info_get_count() const
+{
+ return m_info.get_count();
+}
+
+const char* file_info_impl::info_enum_name(t_size p_index) const
+{
+ return m_info.get_name(p_index);
+}
+
+const char* file_info_impl::info_enum_value(t_size p_index) const
+{
+ return m_info.get_value(p_index);
+}
+
+t_size file_info_impl::info_set_ex(const char * p_name,t_size p_name_length,const char * p_value,t_size p_value_length)
+{
+ info_remove_ex(p_name,p_name_length);
+ return info_set_nocheck_ex(p_name,p_name_length,p_value,p_value_length);
+}
+
+t_size file_info_impl::info_set_nocheck_ex(const char * p_name,t_size p_name_length,const char * p_value,t_size p_value_length)
+{
+ return m_info.add_item(p_name,p_name_length,p_value,p_value_length);
+}
+
+void file_info_impl::info_remove_mask(const bit_array & p_mask)
+{
+ m_info.remove_mask(p_mask);
+}
+
+
+file_info_impl::file_info_impl(const file_info & p_source) : m_length(0)
+{
+ copy(p_source);
+}
+
+file_info_impl::file_info_impl(const file_info_impl & p_source) : m_length(0)
+{
+ copy(p_source);
+}
+
+const file_info_impl & file_info_impl::operator=(const file_info_impl & p_source)
+{
+ copy(p_source);
+ return *this;
+}
+
+file_info_impl::file_info_impl() : m_length(0)
+{
+ m_replaygain.reset();
+}
+
+double file_info_impl::get_length() const
+{
+ return m_length;
+}
+
+void file_info_impl::set_length(double p_length)
+{
+ m_length = p_length;
+}
+
+void file_info_impl::meta_modify_value_ex(t_size p_index,t_size p_value_index,const char * p_value,t_size p_value_length)
+{
+ m_meta.modify_value(p_index,p_value_index,p_value,p_value_length);
+}
+
+replaygain_info file_info_impl::get_replaygain() const
+{
+ return m_replaygain;
+}
+
+void file_info_impl::set_replaygain(const replaygain_info & p_info)
+{
+ m_replaygain = p_info;
+}
+
+
+
+
+file_info_impl::~file_info_impl()
+{
+}
+
+t_size file_info_impl_utils::info_storage::add_item(const char * p_name,t_size p_name_length,const char * p_value,t_size p_value_length) {
+ t_size index = m_info.get_size();
+ m_info.set_size(index + 1);
+ m_info[index].init(p_name,p_name_length,p_value,p_value_length);
+ return index;
+}
+
+void file_info_impl_utils::info_storage::remove_mask(const bit_array & p_mask) {
+ pfc::remove_mask_t(m_info,p_mask);
+}
+
+
+
+t_size file_info_impl_utils::meta_storage::add_entry(const char * p_name,t_size p_name_length,const char * p_value,t_size p_value_length)
+{
+ meta_entry temp(p_name,p_name_length,p_value,p_value_length);
+ return pfc::append_swap_t(m_data,temp);
+}
+
+void file_info_impl_utils::meta_storage::insert_value(t_size p_index,t_size p_value_index,const char * p_value,t_size p_value_length)
+{
+ m_data[p_index].insert_value(p_value_index,p_value,p_value_length);
+}
+
+void file_info_impl_utils::meta_storage::modify_value(t_size p_index,t_size p_value_index,const char * p_value,t_size p_value_length)
+{
+ m_data[p_index].modify_value(p_value_index,p_value,p_value_length);
+}
+
+void file_info_impl_utils::meta_storage::remove_values(t_size p_index,const bit_array & p_mask)
+{
+ m_data[p_index].remove_values(p_mask);
+}
+
+void file_info_impl_utils::meta_storage::remove_mask(const bit_array & p_mask)
+{
+ pfc::remove_mask_t(m_data,p_mask);
+}
+
+
+file_info_impl_utils::meta_entry::meta_entry(const char * p_name,t_size p_name_len,const char * p_value,t_size p_value_len)
+{
+ m_name.set_string(p_name,p_name_len);
+ m_values.set_size(1);
+ m_values[0].set_string(p_value,p_value_len);
+}
+
+
+void file_info_impl_utils::meta_entry::remove_values(const bit_array & p_mask)
+{
+ pfc::remove_mask_t(m_values,p_mask);
+}
+
+void file_info_impl_utils::meta_entry::insert_value(t_size p_value_index,const char * p_value,t_size p_value_length)
+{
+ pfc::string_simple temp;
+ temp.set_string(p_value,p_value_length);
+ pfc::insert_t(m_values,temp,p_value_index);
+}
+
+void file_info_impl_utils::meta_entry::modify_value(t_size p_value_index,const char * p_value,t_size p_value_length)
+{
+ m_values[p_value_index].set_string(p_value,p_value_length);
+}
+
+void file_info_impl_utils::meta_storage::reorder(const t_size * p_order)
+{
+ pfc::reorder_t(m_data,p_order,m_data.get_size());
+}
+
+void file_info_impl::copy_meta(const file_info & p_source)
+{
+ m_meta.copy_from(p_source);
+}
+
+void file_info_impl::copy_info(const file_info & p_source)
+{
+ m_info.copy_from(p_source);
+}
+
+void file_info_impl_utils::meta_storage::copy_from(const file_info & p_info)
+{
+ t_size meta_index,meta_count = p_info.meta_get_count();
+ m_data.set_size(meta_count);
+ for(meta_index=0;meta_index<meta_count;meta_index++)
+ {
+ meta_entry & entry = m_data[meta_index];
+ t_size value_index,value_count = p_info.meta_enum_value_count(meta_index);
+ entry.m_name = p_info.meta_enum_name(meta_index);
+ entry.m_values.set_size(value_count);
+ for(value_index=0;value_index<value_count;value_index++)
+ entry.m_values[value_index] = p_info.meta_enum_value(meta_index,value_index);
+ }
+}
+
+void file_info_impl_utils::info_storage::copy_from(const file_info & p_info)
+{
+ t_size n, count;
+ count = p_info.info_get_count();
+ m_info.set_count(count);
+ for(n=0;n<count;n++) m_info[n].init(p_info.info_enum_name(n),~0,p_info.info_enum_value(n),~0);
+}
\ No newline at end of file diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/file_info_impl.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/file_info_impl.h new file mode 100644 index 0000000000..def84132c2 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/file_info_impl.h @@ -0,0 +1,144 @@ +#ifndef _FOOBAR2000_SDK_FILE_INFO_IMPL_H_
+#define _FOOBAR2000_SDK_FILE_INFO_IMPL_H_
+
+namespace file_info_impl_utils {
+
+ struct info_entry {
+ void init(const char * p_name,t_size p_name_len,const char * p_value,t_size p_value_len) {
+ m_name.set_string(p_name,p_name_len);
+ m_value.set_string(p_value,p_value_len);
+ }
+
+ inline const char * get_name() const {return m_name;}
+ inline const char * get_value() const {return m_value;}
+
+ pfc::string_simple m_name,m_value;
+ };
+
+ typedef pfc::array_t<info_entry,pfc::alloc_fast> info_entry_array;
+
+}
+
+namespace pfc {
+ template<> class traits_t<file_info_impl_utils::info_entry> : public traits_t<pfc::string_simple> {};
+};
+
+
+namespace file_info_impl_utils {
+ class info_storage
+ {
+ public:
+ t_size add_item(const char * p_name,t_size p_name_length,const char * p_value,t_size p_value_length);
+ void remove_mask(const bit_array & p_mask);
+ inline t_size get_count() const {return m_info.get_count();}
+ inline const char * get_name(t_size p_index) const {return m_info[p_index].get_name();}
+ inline const char * get_value(t_size p_index) const {return m_info[p_index].get_value();}
+ void copy_from(const file_info & p_info);
+ private:
+ info_entry_array m_info;
+ };
+}
+
+
+namespace file_info_impl_utils {
+ typedef pfc::array_hybrid_t<pfc::string_simple,1,pfc::alloc_fast > meta_value_array;
+ struct meta_entry {
+ meta_entry() {}
+ meta_entry(const char * p_name,t_size p_name_len,const char * p_value,t_size p_value_len);
+
+ void remove_values(const bit_array & p_mask);
+ void insert_value(t_size p_value_index,const char * p_value,t_size p_value_length);
+ void modify_value(t_size p_value_index,const char * p_value,t_size p_value_length);
+
+ inline const char * get_name() const {return m_name;}
+ inline const char * get_value(t_size p_index) const {return m_values[p_index];}
+ inline t_size get_value_count() const {return m_values.get_size();}
+
+
+ pfc::string_simple m_name;
+ meta_value_array m_values;
+ };
+ typedef pfc::array_hybrid_t<meta_entry,10, pfc::alloc_fast> meta_entry_array;
+}
+namespace pfc {
+ template<> class traits_t<file_info_impl_utils::meta_entry> : public pfc::traits_combined<pfc::string_simple,file_info_impl_utils::meta_value_array> {};
+}
+
+
+namespace file_info_impl_utils {
+ class meta_storage
+ {
+ public:
+ t_size add_entry(const char * p_name,t_size p_name_length,const char * p_value,t_size p_value_length);
+ void insert_value(t_size p_index,t_size p_value_index,const char * p_value,t_size p_value_length);
+ void modify_value(t_size p_index,t_size p_value_index,const char * p_value,t_size p_value_length);
+ void remove_values(t_size p_index,const bit_array & p_mask);
+ void remove_mask(const bit_array & p_mask);
+ void copy_from(const file_info & p_info);
+
+ inline void reorder(const t_size * p_order);
+
+ inline t_size get_count() const {return m_data.get_size();}
+
+ inline const char * get_name(t_size p_index) const {PFC_ASSERT(p_index < m_data.get_size()); return m_data[p_index].get_name();}
+ inline const char * get_value(t_size p_index,t_size p_value_index) const {PFC_ASSERT(p_index < m_data.get_size()); return m_data[p_index].get_value(p_value_index);}
+ inline t_size get_value_count(t_size p_index) const {PFC_ASSERT(p_index < m_data.get_size()); return m_data[p_index].get_value_count();}
+
+ private:
+ meta_entry_array m_data;
+ };
+}
+
+//! Implements file_info.
+class file_info_impl : public file_info
+{
+public:
+ file_info_impl(const file_info_impl & p_source);
+ file_info_impl(const file_info & p_source);
+ file_info_impl();
+ ~file_info_impl();
+
+ double get_length() const;
+ void set_length(double p_length);
+
+ void copy_meta(const file_info & p_source);//virtualized for performance reasons, can be faster in two-pass
+ void copy_info(const file_info & p_source);//virtualized for performance reasons, can be faster in two-pass
+
+ t_size meta_get_count() const;
+ const char* meta_enum_name(t_size p_index) const;
+ t_size meta_enum_value_count(t_size p_index) const;
+ const char* meta_enum_value(t_size p_index,t_size p_value_number) const;
+ t_size meta_set_ex(const char * p_name,t_size p_name_length,const char * p_value,t_size p_value_length);
+ void meta_insert_value_ex(t_size p_index,t_size p_value_index,const char * p_value,t_size p_value_length);
+ void meta_remove_mask(const bit_array & p_mask);
+ void meta_reorder(const t_size * p_order);
+ void meta_remove_values(t_size p_index,const bit_array & p_mask);
+ void meta_modify_value_ex(t_size p_index,t_size p_value_index,const char * p_value,t_size p_value_length);
+
+ t_size info_get_count() const;
+ const char* info_enum_name(t_size p_index) const;
+ const char* info_enum_value(t_size p_index) const;
+ t_size info_set_ex(const char * p_name,t_size p_name_length,const char * p_value,t_size p_value_length);
+ void info_remove_mask(const bit_array & p_mask);
+
+ const file_info_impl & operator=(const file_info_impl & p_source);
+
+ replaygain_info get_replaygain() const;
+ void set_replaygain(const replaygain_info & p_info);
+
+protected:
+ t_size meta_set_nocheck_ex(const char * p_name,t_size p_name_length,const char * p_value,t_size p_value_length);
+ t_size info_set_nocheck_ex(const char * p_name,t_size p_name_length,const char * p_value,t_size p_value_length);
+private:
+
+
+ file_info_impl_utils::meta_storage m_meta;
+ file_info_impl_utils::info_storage m_info;
+
+
+ double m_length;
+
+ replaygain_info m_replaygain;
+};
+
+#endif
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/file_info_merge.cpp b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/file_info_merge.cpp new file mode 100644 index 0000000000..0597374328 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/file_info_merge.cpp @@ -0,0 +1,146 @@ +#include "foobar2000.h"
+
+static t_size merge_tags_calc_rating_by_index(const file_info & p_info,t_size p_index) {
+ t_size n,m = p_info.meta_enum_value_count(p_index);
+ t_size ret = 0;
+ for(n=0;n<m;n++)
+ ret += strlen(p_info.meta_enum_value(p_index,n)) + 10;//yes, strlen on utf8 data, plus a slight bump to prefer multivalue over singlevalue w/ separator
+ return ret;
+}
+
+static t_size merge_tags_calc_rating(const file_info & p_info,const char * p_field) {
+ t_size field_index = p_info.meta_find(p_field);
+ t_size ret = 0;
+ if (field_index != ~0) {
+ return merge_tags_calc_rating_by_index(p_info,field_index);
+ } else {
+ return 0;
+ }
+}
+
+static void merge_tags_copy_info(const char * field,const file_info * from,file_info * to)
+{
+ const char * val = from->info_get(field);
+ if (val) to->info_set(field,val);
+}
+
+namespace {
+ struct meta_merge_entry {
+ meta_merge_entry() : m_rating(0) {}
+ t_size m_rating;
+ pfc::array_t<const char *> m_data;
+ };
+
+ class meta_merge_map_enumerator {
+ public:
+ meta_merge_map_enumerator(file_info & p_out) : m_out(p_out) {
+ m_out.meta_remove_all();
+ }
+ void operator() (const char * p_name, const meta_merge_entry & p_entry) {
+ if (p_entry.m_data.get_size() > 0) {
+ t_size index = m_out.__meta_add_unsafe(p_name,p_entry.m_data[0]);
+ for(t_size walk = 1; walk < p_entry.m_data.get_size(); ++walk) {
+ m_out.meta_add_value(index,p_entry.m_data[walk]);
+ }
+ }
+ }
+ private:
+ file_info & m_out;
+ };
+}
+
+static void merge_meta(file_info & p_out,const pfc::list_base_const_t<const file_info*> & p_in) {
+ pfc::map_t<const char *,meta_merge_entry,pfc::comparator_stricmp_ascii> map;
+ for(t_size in_walk = 0; in_walk < p_in.get_count(); in_walk++) {
+ const file_info & in = * p_in[in_walk];
+ for(t_size meta_walk = 0, meta_count = in.meta_get_count(); meta_walk < meta_count; meta_walk++ ) {
+ meta_merge_entry & entry = map.find_or_add(in.meta_enum_name(meta_walk));
+ t_size rating = merge_tags_calc_rating_by_index(in,meta_walk);
+ if (rating > entry.m_rating) {
+ entry.m_rating = rating;
+ const t_size value_count = in.meta_enum_value_count(meta_walk);
+ entry.m_data.set_size(value_count);
+ for(t_size value_walk = 0; value_walk < value_count; value_walk++ ) {
+ entry.m_data[value_walk] = in.meta_enum_value(meta_walk,value_walk);
+ }
+ }
+ }
+ }
+
+ map.enumerate(meta_merge_map_enumerator(p_out));
+}
+
+void file_info::merge(const pfc::list_base_const_t<const file_info*> & p_in)
+{
+ t_size in_count = p_in.get_count();
+ if (in_count == 0)
+ {
+ meta_remove_all();
+ return;
+ }
+ else if (in_count == 1)
+ {
+ const file_info * info = p_in[0];
+
+ copy_meta(*info);
+
+ set_replaygain(replaygain_info::g_merge(get_replaygain(),info->get_replaygain()));
+
+ overwrite_info(*info);
+
+ //copy_info_single_by_name(*info,"tagtype");
+
+ return;
+ }
+
+ merge_meta(*this,p_in);
+
+ {
+ pfc::string8_fastalloc tagtype;
+ replaygain_info rg = get_replaygain();
+ t_size in_ptr;
+ for(in_ptr = 0; in_ptr < in_count; in_ptr++ )
+ {
+ const file_info * info = p_in[in_ptr];
+ rg = replaygain_info::g_merge(rg, info->get_replaygain());
+ t_size field_ptr, field_max = info->info_get_count();
+ for(field_ptr = 0; field_ptr < field_max; field_ptr++ )
+ {
+ const char * field_name = info->info_enum_name(field_ptr), * field_value = info->info_enum_value(field_ptr);
+ if (*field_value)
+ {
+ if (!stricmp_utf8(field_name,"tagtype"))
+ {
+ if (!tagtype.is_empty()) tagtype += "|";
+ tagtype += field_value;
+ }
+ }
+ }
+ }
+ if (!tagtype.is_empty()) info_set("tagtype",tagtype);
+ set_replaygain(rg);
+ }
+}
+
+void file_info::overwrite_info(const file_info & p_source) {
+ t_size count = p_source.info_get_count();
+ for(t_size n=0;n<count;n++) {
+ info_set(p_source.info_enum_name(n),p_source.info_enum_value(n));
+ }
+}
+
+
+void file_info::merge_fallback(const file_info & source) {
+ set_replaygain( replaygain_info::g_merge(get_replaygain(), source.get_replaygain() ) );
+ if (get_length() <= 0) set_length(source.get_length());
+ t_size count = source.info_get_count();
+ for(t_size infoWalk = 0; infoWalk < count; ++infoWalk) {
+ const char * name = source.info_enum_name(infoWalk);
+ if (!info_exists(name)) __info_add_unsafe(name, source.info_enum_value(infoWalk));
+ }
+ count = source.meta_get_count();
+ for(t_size metaWalk = 0; metaWalk < count; ++metaWalk) {
+ const char * name = source.meta_enum_name(metaWalk);
+ if (!meta_exists(name)) _copy_meta_single_nocheck(source, metaWalk);
+ }
+}
\ No newline at end of file diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/file_operation_callback.cpp b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/file_operation_callback.cpp new file mode 100644 index 0000000000..e812a1de48 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/file_operation_callback.cpp @@ -0,0 +1,129 @@ +#include "foobar2000.h"
+
+
+static void g_on_files_deleted_sorted(const pfc::list_base_const_t<const char *> & p_items)
+{
+ //static_api_ptr_t<library_manager>()->on_files_deleted_sorted(p_items);
+ static_api_ptr_t<playlist_manager>()->on_files_deleted_sorted(p_items);
+
+ FB2K_FOR_EACH_SERVICE(file_operation_callback, on_files_deleted_sorted(p_items));
+}
+
+static void g_on_files_moved_sorted(const pfc::list_base_const_t<const char *> & p_from,const pfc::list_base_const_t<const char *> & p_to)
+{
+ static_api_ptr_t<playlist_manager>()->on_files_moved_sorted(p_from,p_to);
+ static_api_ptr_t<playlist_manager>()->on_files_deleted_sorted(p_from);
+
+ FB2K_FOR_EACH_SERVICE(file_operation_callback, on_files_moved_sorted(p_from,p_to));
+}
+
+static void g_on_files_copied_sorted(const pfc::list_base_const_t<const char *> & p_from,const pfc::list_base_const_t<const char *> & p_to)
+{
+ FB2K_FOR_EACH_SERVICE(file_operation_callback, on_files_copied_sorted(p_from,p_to));
+}
+
+void file_operation_callback::g_on_files_deleted(const pfc::list_base_const_t<const char *> & p_items)
+{
+ core_api::ensure_main_thread();
+ t_size count = p_items.get_count();
+ if (count > 0)
+ {
+ if (count == 1) g_on_files_deleted_sorted(p_items);
+ else
+ {
+ pfc::array_t<t_size> order; order.set_size(count);
+ order_helper::g_fill(order);
+ p_items.sort_get_permutation_t(metadb::path_compare,order.get_ptr());
+ g_on_files_deleted_sorted(pfc::list_permutation_t<const char*>(p_items,order.get_ptr(),count));
+ }
+ }
+}
+
+void file_operation_callback::g_on_files_moved(const pfc::list_base_const_t<const char *> & p_from,const pfc::list_base_const_t<const char *> & p_to)
+{
+ core_api::ensure_main_thread();
+ pfc::dynamic_assert(p_from.get_count() == p_to.get_count());
+ t_size count = p_from.get_count();
+ if (count > 0)
+ {
+ if (count == 1) g_on_files_moved_sorted(p_from,p_to);
+ else
+ {
+ pfc::array_t<t_size> order; order.set_size(count);
+ order_helper::g_fill(order);
+ p_from.sort_get_permutation_t(metadb::path_compare,order.get_ptr());
+ g_on_files_moved_sorted(pfc::list_permutation_t<const char*>(p_from,order.get_ptr(),count),pfc::list_permutation_t<const char*>(p_to,order.get_ptr(),count));
+ }
+ }
+}
+
+void file_operation_callback::g_on_files_copied(const pfc::list_base_const_t<const char *> & p_from,const pfc::list_base_const_t<const char *> & p_to)
+{
+ if (core_api::assert_main_thread())
+ {
+ assert(p_from.get_count() == p_to.get_count());
+ t_size count = p_from.get_count();
+ if (count > 0)
+ {
+ if (count == 1) g_on_files_copied_sorted(p_from,p_to);
+ else
+ {
+ pfc::array_t<t_size> order; order.set_size(count);
+ order_helper::g_fill(order);
+ p_from.sort_get_permutation_t(metadb::path_compare,order.get_ptr());
+ g_on_files_copied_sorted(pfc::list_permutation_t<const char*>(p_from,order.get_ptr(),count),pfc::list_permutation_t<const char*>(p_to,order.get_ptr(),count));
+ }
+ }
+ }
+}
+bool file_operation_callback::g_search_sorted_list(const pfc::list_base_const_t<const char*> & p_list,const char * p_string,t_size & p_index) {
+ return pfc::binarySearch<metadb::path_comparator>::run(p_list,0,p_list.get_count(),p_string,p_index);
+}
+
+bool file_operation_callback::g_update_list_on_moved_ex(metadb_handle_list_ref p_list,t_pathlist p_from,t_pathlist p_to, metadb_handle_list_ref itemsAdded, metadb_handle_list_ref itemsRemoved) {
+ static_api_ptr_t<metadb> api;
+ bool changed = false;
+ itemsAdded.remove_all(); itemsRemoved.remove_all();
+ for(t_size walk = 0; walk < p_list.get_count(); ++walk) {
+ metadb_handle_ptr item = p_list[walk];
+ t_size index;
+ if (g_search_sorted_list(p_from,item->get_path(),index)) {
+ metadb_handle_ptr newItem;
+ api->handle_create_replace_path_canonical(newItem,item,p_to[index]);
+ p_list.replace_item(walk,newItem);
+ changed = true;
+ itemsAdded.add_item(newItem); itemsRemoved.add_item(item);
+ }
+ }
+ return changed;
+}
+bool file_operation_callback::g_update_list_on_moved(metadb_handle_list_ref p_list,const pfc::list_base_const_t<const char *> & p_from,const pfc::list_base_const_t<const char *> & p_to) {
+ static_api_ptr_t<metadb> api;
+ bool changed = false;
+ for(t_size walk = 0; walk < p_list.get_count(); ++walk) {
+ metadb_handle_ptr item = p_list[walk];
+ t_size index;
+ if (g_search_sorted_list(p_from,item->get_path(),index)) {
+ metadb_handle_ptr newItem;
+ api->handle_create_replace_path_canonical(newItem,item,p_to[index]);
+ p_list.replace_item(walk,newItem);
+ changed = true;
+ }
+ }
+ return changed;
+}
+
+
+bool file_operation_callback::g_mark_dead_entries(metadb_handle_list_cref items, bit_array_var & mask, t_pathlist deadPaths) {
+ bool found = false;
+ const t_size total = items.get_count();
+ for(t_size walk = 0; walk < total; ++walk) {
+ t_size index;
+ if (g_search_sorted_list(deadPaths,items[walk]->get_path(),index)) {
+ mask.set(walk,true); found = true;
+ } else {
+ mask.set(walk,false);
+ }
+ }
+ return found;
+}
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/file_operation_callback.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/file_operation_callback.h new file mode 100644 index 0000000000..7118e50500 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/file_operation_callback.h @@ -0,0 +1,66 @@ +#ifndef _FILE_OPERATION_CALLBACK_H_
+#define _FILE_OPERATION_CALLBACK_H_
+
+//! Interface to notify component system about files being deleted or moved. Operates in app's main thread only.
+
+class NOVTABLE file_operation_callback : public service_base {
+public:
+ typedef const pfc::list_base_const_t<const char *> & t_pathlist;
+ //! p_items is a metadb::path_compare sorted list of files that have been deleted.
+ virtual void on_files_deleted_sorted(t_pathlist p_items) = 0;
+ //! p_from is a metadb::path_compare sorted list of files that have been moved, p_to is a list of corresponding target locations.
+ virtual void on_files_moved_sorted(t_pathlist p_from,t_pathlist p_to) = 0;
+ //! p_from is a metadb::path_compare sorted list of files that have been copied, p_to is a list of corresponding target locations.
+ virtual void on_files_copied_sorted(t_pathlist p_from,t_pathlist p_to) = 0;
+
+ static void g_on_files_deleted(const pfc::list_base_const_t<const char *> & p_items);
+ static void g_on_files_moved(const pfc::list_base_const_t<const char *> & p_from,const pfc::list_base_const_t<const char *> & p_to);
+ static void g_on_files_copied(const pfc::list_base_const_t<const char *> & p_from,const pfc::list_base_const_t<const char *> & p_to);
+
+ static bool g_search_sorted_list(const pfc::list_base_const_t<const char*> & p_list,const char * p_string,t_size & p_index);
+ static bool g_update_list_on_moved(metadb_handle_list_ref p_list,t_pathlist p_from,t_pathlist p_to);
+
+ static bool g_update_list_on_moved_ex(metadb_handle_list_ref p_list,t_pathlist p_from,t_pathlist p_to, metadb_handle_list_ref itemsAdded, metadb_handle_list_ref itemsRemoved);
+
+ static bool g_mark_dead_entries(metadb_handle_list_cref items, bit_array_var & mask, t_pathlist deadPaths);
+
+
+ FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(file_operation_callback);
+};
+
+
+
+//! New in 0.9.5.
+class NOVTABLE file_operation_callback_dynamic {
+public:
+ //! p_items is a metadb::path_compare sorted list of files that have been deleted.
+ virtual void on_files_deleted_sorted(const pfc::list_base_const_t<const char *> & p_items) = 0;
+ //! p_from is a metadb::path_compare sorted list of files that have been moved, p_to is a list of corresponding target locations.
+ virtual void on_files_moved_sorted(const pfc::list_base_const_t<const char *> & p_from,const pfc::list_base_const_t<const char *> & p_to) = 0;
+ //! p_from is a metadb::path_compare sorted list of files that have been copied, p_to is a list of corresponding target locations.
+ virtual void on_files_copied_sorted(const pfc::list_base_const_t<const char *> & p_from,const pfc::list_base_const_t<const char *> & p_to) = 0;
+};
+
+//! New in 0.9.5.
+class NOVTABLE file_operation_callback_dynamic_manager : public service_base {
+public:
+ virtual void register_callback(file_operation_callback_dynamic * p_callback) = 0;
+ virtual void unregister_callback(file_operation_callback_dynamic * p_callback) = 0;
+
+ FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(file_operation_callback_dynamic_manager);
+};
+
+//! New in 0.9.5.
+class file_operation_callback_dynamic_impl_base : public file_operation_callback_dynamic {
+public:
+ file_operation_callback_dynamic_impl_base() {static_api_ptr_t<file_operation_callback_dynamic_manager>()->register_callback(this);}
+ ~file_operation_callback_dynamic_impl_base() {static_api_ptr_t<file_operation_callback_dynamic_manager>()->unregister_callback(this);}
+
+ void on_files_deleted_sorted(const pfc::list_base_const_t<const char *> & p_items) {}
+ void on_files_moved_sorted(const pfc::list_base_const_t<const char *> & p_from,const pfc::list_base_const_t<const char *> & p_to) {}
+ void on_files_copied_sorted(const pfc::list_base_const_t<const char *> & p_from,const pfc::list_base_const_t<const char *> & p_to) {}
+
+ PFC_CLASS_NOT_COPYABLE_EX(file_operation_callback_dynamic_impl_base);
+};
+
+#endif //_FILE_OPERATION_CALLBACK_H_
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/filesystem.cpp b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/filesystem.cpp new file mode 100644 index 0000000000..a3c0405e9e --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/filesystem.cpp @@ -0,0 +1,895 @@ +#include "foobar2000.h"
+
+static const char unpack_prefix[] = "unpack://";
+static const unsigned unpack_prefix_len = 9;
+
+void unpacker::g_open(service_ptr_t<file> & p_out,const service_ptr_t<file> & p,abort_callback & p_abort)
+{
+ service_enum_t<unpacker> e;
+ service_ptr_t<unpacker> ptr;
+ if (e.first(ptr)) do {
+ p->reopen(p_abort);
+ try {
+ ptr->open(p_out,p,p_abort);
+ return;
+ } catch(exception_io_data const &) {}
+ } while(e.next(ptr));
+ throw exception_io_data();
+}
+
+void file::seek_ex(t_sfilesize p_position, file::t_seek_mode p_mode, abort_callback &p_abort) {
+ switch(p_mode) {
+ case seek_from_beginning:
+ seek(p_position,p_abort);
+ break;
+ case seek_from_current:
+ seek(p_position + get_position(p_abort),p_abort);
+ break;
+ case seek_from_eof:
+ seek(p_position + get_size_ex(p_abort),p_abort);
+ break;
+ default:
+ throw exception_io_data();
+ }
+}
+
+t_filesize file::g_transfer(stream_reader * p_src,stream_writer * p_dst,t_filesize p_bytes,abort_callback & p_abort) {
+ enum {BUFSIZE = 1024*1024*8};
+ pfc::array_t<t_uint8> temp;
+ temp.set_size((t_size)pfc::min_t<t_filesize>(BUFSIZE,p_bytes));
+ void* ptr = temp.get_ptr();
+ t_filesize done = 0;
+ while(done<p_bytes) {
+ p_abort.check_e();
+ t_size delta = (t_size)pfc::min_t<t_filesize>(BUFSIZE,p_bytes-done);
+ delta = p_src->read(ptr,delta,p_abort);
+ if (delta<=0) break;
+ p_dst->write(ptr,delta,p_abort);
+ done += delta;
+ }
+ return done;
+}
+
+void file::g_transfer_object(stream_reader * p_src,stream_writer * p_dst,t_filesize p_bytes,abort_callback & p_abort) {
+ if (g_transfer(p_src,p_dst,p_bytes,p_abort) != p_bytes)
+ throw exception_io_data_truncation();
+}
+
+
+void filesystem::g_get_canonical_path(const char * path,pfc::string_base & out)
+{
+ TRACK_CALL_TEXT("filesystem::g_get_canonical_path");
+
+ service_enum_t<filesystem> e;
+ service_ptr_t<filesystem> ptr;
+ if (e.first(ptr)) do {
+ if (ptr->get_canonical_path(path,out)) return;
+ } while(e.next(ptr));
+ //no one wants to process this, let's copy over
+ out = path;
+}
+
+void filesystem::g_get_display_path(const char * path,pfc::string_base & out)
+{
+ TRACK_CALL_TEXT("filesystem::g_get_display_path");
+ service_ptr_t<filesystem> ptr;
+ if (!g_get_interface(ptr,path))
+ {
+ //no one wants to process this, let's copy over
+ out = path;
+ }
+ else
+ {
+ if (!ptr->get_display_path(path,out))
+ out = path;
+ }
+}
+
+filesystem::ptr filesystem::g_get_interface(const char * path) {
+ filesystem::ptr rv;
+ if (!g_get_interface(rv, path)) throw exception_io_no_handler_for_path();
+ return rv;
+
+}
+bool filesystem::g_get_interface(service_ptr_t<filesystem> & p_out,const char * path)
+{
+ service_enum_t<filesystem> e;
+ service_ptr_t<filesystem> ptr;
+ if (e.first(ptr)) do {
+ if (ptr->is_our_path(path))
+ {
+ p_out = ptr;
+ return true;
+ }
+ } while(e.next(ptr));
+ return false;
+}
+
+
+void filesystem::g_open(service_ptr_t<file> & p_out,const char * path,t_open_mode mode,abort_callback & p_abort)
+{
+ TRACK_CALL_TEXT("filesystem::g_open");
+ g_get_interface(path)->open(p_out,path,mode,p_abort);
+}
+
+
+void filesystem::g_open_timeout(service_ptr_t<file> & p_out,const char * p_path,t_open_mode p_mode,double p_timeout,abort_callback & p_abort) {
+ FB2K_RETRY_ON_SHARING_VIOLATION( g_open(p_out, p_path, p_mode, p_abort), p_abort, p_timeout);
+}
+
+bool filesystem::g_exists(const char * p_path,abort_callback & p_abort)
+{
+ t_filestats stats;
+ bool dummy;
+ try {
+ g_get_stats(p_path,stats,dummy,p_abort);
+ } catch(exception_io_not_found) {return false;}
+ return true;
+}
+
+bool filesystem::g_exists_writeable(const char * p_path,abort_callback & p_abort)
+{
+ t_filestats stats;
+ bool writeable;
+ try {
+ g_get_stats(p_path,stats,writeable,p_abort);
+ } catch(exception_io_not_found) {return false;}
+ return writeable;
+}
+
+void filesystem::g_remove(const char * p_path,abort_callback & p_abort) {
+ g_get_interface(p_path)->remove(p_path,p_abort);
+}
+
+void filesystem::g_remove_timeout(const char * p_path,double p_timeout,abort_callback & p_abort) {
+ FB2K_RETRY_ON_SHARING_VIOLATION( g_remove(p_path, p_abort), p_abort, p_timeout );
+}
+
+void filesystem::g_move_timeout(const char * p_src,const char * p_dst,double p_timeout,abort_callback & p_abort) {
+ FB2K_RETRY_ON_SHARING_VIOLATION( g_move(p_src, p_dst, p_abort), p_abort, p_timeout );
+}
+
+void filesystem::g_copy_timeout(const char * p_src,const char * p_dst,double p_timeout,abort_callback & p_abort) {
+ FB2K_RETRY_ON_SHARING_VIOLATION( g_copy(p_src, p_dst, p_abort), p_abort, p_timeout );
+}
+
+void filesystem::g_create_directory(const char * p_path,abort_callback & p_abort)
+{
+ g_get_interface(p_path)->create_directory(p_path,p_abort);
+}
+
+void filesystem::g_move(const char * src,const char * dst,abort_callback & p_abort) {
+ service_enum_t<filesystem> e;
+ service_ptr_t<filesystem> ptr;
+ if (e.first(ptr)) do {
+ if (ptr->is_our_path(src) && ptr->is_our_path(dst)) {
+ ptr->move(src,dst,p_abort);
+ return;
+ }
+ } while(e.next(ptr));
+ throw exception_io_no_handler_for_path();
+}
+
+void filesystem::g_list_directory(const char * p_path,directory_callback & p_out,abort_callback & p_abort)
+{
+ TRACK_CALL_TEXT("filesystem::g_list_directory");
+ g_get_interface(p_path)->list_directory(p_path,p_out,p_abort);
+}
+
+
+static void path_pack_string(pfc::string_base & out,const char * src)
+{
+ out.add_char('|');
+ out << strlen(src);
+ out.add_char('|');
+ out << src;
+ out.add_char('|');
+}
+
+static int path_unpack_string(pfc::string_base & out,const char * src)
+{
+ int ptr=0;
+ if (src[ptr++]!='|') return -1;
+ int len = atoi(src+ptr);
+ if (len<=0) return -1;
+ while(src[ptr]!=0 && src[ptr]!='|') ptr++;
+ if (src[ptr]!='|') return -1;
+ ptr++;
+ int start = ptr;
+ while(ptr-start<len)
+ {
+ if (src[ptr]==0) return -1;
+ ptr++;
+ }
+ if (src[ptr]!='|') return -1;
+ out.set_string(&src[start],len);
+ ptr++;
+ return ptr;
+}
+
+
+void filesystem::g_open_precache(service_ptr_t<file> & p_out,const char * p_path,abort_callback & p_abort) {
+ service_ptr_t<filesystem> fs = g_get_interface(p_path);
+ if (fs->is_remote(p_path)) throw exception_io_object_is_remote();
+ fs->open(p_out,p_path,open_mode_read,p_abort);
+}
+
+bool filesystem::g_is_remote(const char * p_path) {
+ return g_get_interface(p_path)->is_remote(p_path);
+}
+
+bool filesystem::g_is_recognized_and_remote(const char * p_path) {
+ service_ptr_t<filesystem> fs;
+ if (g_get_interface(fs,p_path)) return fs->is_remote(p_path);
+ else return false;
+}
+
+bool filesystem::g_is_remote_or_unrecognized(const char * p_path) {
+ service_ptr_t<filesystem> fs;
+ if (g_get_interface(fs,p_path)) return fs->is_remote(p_path);
+ else return true;
+}
+
+bool filesystem::g_relative_path_create(const char * file_path,const char * playlist_path,pfc::string_base & out)
+{
+
+ bool rv = false;
+ service_ptr_t<filesystem> fs;
+
+ if (g_get_interface(fs,file_path))
+ rv = fs->relative_path_create(file_path,playlist_path,out);
+
+ return rv;
+}
+
+bool filesystem::g_relative_path_parse(const char * relative_path,const char * playlist_path,pfc::string_base & out)
+{
+ service_enum_t<filesystem> e;
+ service_ptr_t<filesystem> ptr;
+ if (e.first(ptr)) do {
+ if (ptr->relative_path_parse(relative_path,playlist_path,out)) return true;
+ } while(e.next(ptr));
+ return false;
+}
+
+
+
+bool archive_impl::get_canonical_path(const char * path,pfc::string_base & out)
+{
+ if (is_our_path(path))
+ {
+ pfc::string8 archive,file,archive_canonical;
+ if (g_parse_unpack_path(path,archive,file))
+ {
+ g_get_canonical_path(archive,archive_canonical);
+ make_unpack_path(out,archive_canonical,file);
+
+ return true;
+ }
+ else return false;
+ }
+ else return false;
+}
+
+bool archive_impl::is_our_path(const char * path)
+{
+ if (!g_is_unpack_path(path)) return false;
+ const char * type = get_archive_type();
+ path += 9;
+ while(*type)
+ {
+ if (*type!=*path) return false;
+ type++;
+ path++;
+ }
+ if (*path!='|') return false;
+ return true;
+}
+
+bool archive_impl::get_display_path(const char * path,pfc::string_base & out)
+{
+ pfc::string8 archive,file;
+ if (g_parse_unpack_path(path,archive,file))
+ {
+ g_get_display_path(archive,out);
+ out.add_string("|");
+ out.add_string(file);
+ return true;
+ }
+ else return false;
+}
+
+void archive_impl::open(service_ptr_t<file> & p_out,const char * path,t_open_mode mode, abort_callback & p_abort)
+{
+ if (mode != open_mode_read) throw exception_io_denied();
+ pfc::string8 archive,file;
+ if (!g_parse_unpack_path(path,archive,file)) throw exception_io_not_found();
+ open_archive(p_out,archive,file,p_abort);
+}
+
+
+void archive_impl::remove(const char * path,abort_callback & p_abort) {
+ throw exception_io_denied();
+}
+
+void archive_impl::move(const char * src,const char * dst,abort_callback & p_abort) {
+ throw exception_io_denied();
+}
+
+bool archive_impl::is_remote(const char * src) {
+ pfc::string8 archive,file;
+ if (g_parse_unpack_path(src,archive,file)) return g_is_remote(archive);
+ else throw exception_io_not_found();
+}
+
+bool archive_impl::relative_path_create(const char * file_path,const char * playlist_path,pfc::string_base & out) {
+ pfc::string8 archive,file;
+ if (g_parse_unpack_path(file_path,archive,file))
+ {
+ pfc::string8 archive_rel;
+ if (g_relative_path_create(archive,playlist_path,archive_rel))
+ {
+ pfc::string8 out_path;
+ make_unpack_path(out_path,archive_rel,file);
+ out.set_string(out_path);
+ return true;
+ }
+ }
+ return false;
+}
+
+bool archive_impl::relative_path_parse(const char * relative_path,const char * playlist_path,pfc::string_base & out)
+{
+ if (!is_our_path(relative_path)) return false;
+ pfc::string8 archive_rel,file;
+ if (g_parse_unpack_path(relative_path,archive_rel,file))
+ {
+ pfc::string8 archive;
+ if (g_relative_path_parse(archive_rel,playlist_path,archive))
+ {
+ pfc::string8 out_path;
+ make_unpack_path(out_path,archive,file);
+ out.set_string(out_path);
+ return true;
+ }
+ }
+ return false;
+}
+
+bool archive_impl::g_parse_unpack_path_ex(const char * path,pfc::string_base & archive,pfc::string_base & file, pfc::string_base & type) {
+ PFC_ASSERT( g_is_unpack_path(path) );
+ const char * base = path + unpack_prefix_len; // strstr(path, "//");
+ const char * split = strchr(path,'|');
+ if (base == NULL || split == NULL || base > split) return false;
+ // base += 2;
+ type.set_string( base, split - base );
+ int delta = path_unpack_string(archive,split);
+ if (delta<0) return false;
+ split += delta;
+ file = split;
+ return true;
+}
+bool archive_impl::g_parse_unpack_path(const char * path,pfc::string_base & archive,pfc::string_base & file) {
+ PFC_ASSERT( g_is_unpack_path(path) );
+ path = strchr(path,'|');
+ if (!path) return false;
+ int delta = path_unpack_string(archive,path);
+ if (delta<0) return false;
+ path += delta;
+ file = path;
+ return true;
+}
+
+bool archive_impl::g_is_unpack_path(const char * path) {
+ return strncmp(path,unpack_prefix,unpack_prefix_len) == 0;
+}
+
+void archive_impl::g_make_unpack_path(pfc::string_base & path,const char * archive,const char * file,const char * name)
+{
+ path = unpack_prefix;
+ path += name;
+ path_pack_string(path,archive);
+ path += file;
+}
+
+void archive_impl::make_unpack_path(pfc::string_base & path,const char * archive,const char * file) {g_make_unpack_path(path,archive,file,get_archive_type());}
+
+
+FILE * filesystem::streamio_open(const char * path,const char * flags)
+{
+ FILE * ret = 0;
+ pfc::string8 temp;
+ g_get_canonical_path(path,temp);
+ if (!strncmp(temp,"file://",7))
+ {
+ ret = _wfopen(pfc::stringcvt::string_wide_from_utf8(path+7),pfc::stringcvt::string_wide_from_utf8(flags));
+ }
+ return ret;
+}
+
+
+namespace {
+
+ class directory_callback_isempty : public directory_callback
+ {
+ bool m_isempty;
+ public:
+ directory_callback_isempty() : m_isempty(true) {}
+ bool on_entry(filesystem * owner,abort_callback & p_abort,const char * url,bool is_subdirectory,const t_filestats & p_stats)
+ {
+ m_isempty = false;
+ return false;
+ }
+ bool isempty() {return m_isempty;}
+ };
+
+ class directory_callback_dummy : public directory_callback
+ {
+ public:
+ bool on_entry(filesystem * owner,abort_callback & p_abort,const char * url,bool is_subdirectory,const t_filestats & p_stats) {return false;}
+ };
+
+}
+
+bool filesystem::g_is_empty_directory(const char * path,abort_callback & p_abort)
+{
+ directory_callback_isempty callback;
+ try {
+ g_list_directory(path,callback,p_abort);
+ } catch(exception_io const &) {return false;}
+ return callback.isempty();
+}
+
+bool filesystem::g_is_valid_directory(const char * path,abort_callback & p_abort) {
+ try {
+ g_list_directory(path,directory_callback_dummy(),p_abort);
+ return true;
+ } catch(exception_io const &) {return false;}
+}
+
+bool directory_callback_impl::on_entry(filesystem * owner,abort_callback & p_abort,const char * url,bool is_subdirectory,const t_filestats & p_stats) {
+ p_abort.check_e();
+ if (is_subdirectory) {
+ if (m_recur) {
+ try {
+ owner->list_directory(url,*this,p_abort);
+ } catch(exception_io const &) {}
+ }
+ } else {
+ m_data.add_item(pfc::rcnew_t<t_entry>(url,p_stats));
+ }
+ return true;
+}
+
+namespace {
+ class directory_callback_impl_copy : public directory_callback
+ {
+ public:
+ directory_callback_impl_copy(const char * p_target)
+ {
+ m_target = p_target;
+ m_target.fix_dir_separator('\\');
+ }
+
+ bool on_entry(filesystem * owner,abort_callback & p_abort,const char * url,bool is_subdirectory,const t_filestats & p_stats) {
+ const char * fn = url + pfc::scan_filename(url);
+ t_size truncat = m_target.length();
+ m_target += fn;
+ if (is_subdirectory) {
+ try {
+ filesystem::g_create_directory(m_target,p_abort);
+ } catch(exception_io_already_exists) {}
+ m_target += "\\";
+ owner->list_directory(url,*this,p_abort);
+ } else {
+ filesystem::g_copy(url,m_target,p_abort);
+ }
+ m_target.truncate(truncat);
+ return true;
+ }
+ private:
+ pfc::string8_fastalloc m_target;
+ };
+}
+
+void filesystem::g_copy_directory(const char * src,const char * dst,abort_callback & p_abort) {
+ //UNTESTED
+ filesystem::g_list_directory(src,directory_callback_impl_copy(dst),p_abort);
+}
+
+void filesystem::g_copy(const char * src,const char * dst,abort_callback & p_abort) {
+ service_ptr_t<file> r_src,r_dst;
+ t_filesize size;
+
+ g_open(r_src,src,open_mode_read,p_abort);
+ size = r_src->get_size_ex(p_abort);
+ g_open(r_dst,dst,open_mode_write_new,p_abort);
+
+ if (size > 0) {
+ try {
+ file::g_transfer_object(r_src,r_dst,size,p_abort);
+ } catch(...) {
+ r_dst.release();
+ try {g_remove(dst,abort_callback_dummy());} catch(...) {}
+ throw;
+ }
+ }
+}
+
+void stream_reader::read_object(void * p_buffer,t_size p_bytes,abort_callback & p_abort) {
+ if (read(p_buffer,p_bytes,p_abort) != p_bytes) throw exception_io_data_truncation();
+}
+
+t_filestats file::get_stats(abort_callback & p_abort)
+{
+ t_filestats temp;
+ temp.m_size = get_size(p_abort);
+ temp.m_timestamp = get_timestamp(p_abort);
+ return temp;
+}
+
+t_filesize stream_reader::skip(t_filesize p_bytes,abort_callback & p_abort)
+{
+ t_uint8 temp[256];
+ t_filesize todo = p_bytes, done = 0;
+ while(todo > 0) {
+ t_size delta,deltadone;
+ delta = sizeof(temp);
+ if (delta > todo) delta = (t_size) todo;
+ deltadone = read(temp,delta,p_abort);
+ done += deltadone;
+ todo -= deltadone;
+ if (deltadone < delta) break;
+ }
+ return done;
+}
+
+void stream_reader::skip_object(t_filesize p_bytes,abort_callback & p_abort) {
+ if (skip(p_bytes,p_abort) != p_bytes) throw exception_io_data_truncation();
+}
+
+void filesystem::g_open_write_new(service_ptr_t<file> & p_out,const char * p_path,abort_callback & p_abort) {
+ g_open(p_out,p_path,open_mode_write_new,p_abort);
+}
+void file::g_transfer_file(const service_ptr_t<file> & p_from,const service_ptr_t<file> & p_to,abort_callback & p_abort) {
+ t_filesize length = p_from->get_size_ex(p_abort);
+ p_from->seek(0,p_abort);
+ p_to->seek(0,p_abort);
+ p_to->set_eof(p_abort);
+ if (length > 0) {
+ g_transfer_object(p_from,p_to,length,p_abort);
+ }
+}
+
+void filesystem::g_open_temp(service_ptr_t<file> & p_out,abort_callback & p_abort) {
+ g_open(p_out,"tempfile://",open_mode_write_new,p_abort);
+}
+
+void filesystem::g_open_tempmem(service_ptr_t<file> & p_out,abort_callback & p_abort) {
+ g_open(p_out,"tempmem://",open_mode_write_new,p_abort);
+}
+
+void archive_impl::list_directory(const char * p_path,directory_callback & p_out,abort_callback & p_abort) {
+ throw exception_io_not_found();
+}
+
+void archive_impl::create_directory(const char * path,abort_callback &) {
+ throw exception_io_denied();
+}
+
+void filesystem::g_get_stats(const char * p_path,t_filestats & p_stats,bool & p_is_writeable,abort_callback & p_abort) {
+ TRACK_CALL_TEXT("filesystem::g_get_stats");
+ return g_get_interface(p_path)->get_stats(p_path,p_stats,p_is_writeable,p_abort);
+}
+
+void archive_impl::get_stats(const char * p_path,t_filestats & p_stats,bool & p_is_writeable,abort_callback & p_abort) {
+ pfc::string8 archive,file;
+ if (g_parse_unpack_path(p_path,archive,file)) {
+ if (g_is_remote(archive)) throw exception_io_object_is_remote();
+ p_is_writeable = false;
+ p_stats = get_stats_in_archive(archive,file,p_abort);
+ }
+ else throw exception_io_not_found();
+}
+
+
+bool file::is_eof(abort_callback & p_abort) {
+ t_filesize position,size;
+ position = get_position(p_abort);
+ size = get_size(p_abort);
+ if (size == filesize_invalid) return false;
+ return position >= size;
+}
+
+
+t_filetimestamp foobar2000_io::filetimestamp_from_system_timer()
+{
+ t_filetimestamp ret;
+ GetSystemTimeAsFileTime((FILETIME*)&ret);
+ return ret;
+}
+
+void stream_reader::read_string_ex(pfc::string_base & p_out,t_size p_bytes,abort_callback & p_abort) {
+ const t_size expBase = 64*1024;
+ if (p_bytes > expBase) {
+ pfc::array_t<char> temp;
+ t_size allocWalk = expBase;
+ t_size done = 0;
+ for (;;) {
+ const t_size target = pfc::min_t(allocWalk, p_bytes);
+ temp.set_size(target);
+ read_object(temp.get_ptr() + done, target - done, p_abort);
+ if (target == p_bytes) break;
+ done = target;
+ allocWalk <<= 1;
+ }
+ p_out.set_string(temp.get_ptr(), p_bytes);
+ } else {
+ pfc::string_buffer buf(p_out, p_bytes);
+ read_object(buf.get_ptr(),p_bytes,p_abort);
+ }
+}
+void stream_reader::read_string(pfc::string_base & p_out,abort_callback & p_abort)
+{
+ t_uint32 length;
+ read_lendian_t(length,p_abort);
+ read_string_ex(p_out,length,p_abort);
+}
+
+void stream_reader::read_string_raw(pfc::string_base & p_out,abort_callback & p_abort) {
+ enum {delta = 256};
+ char buffer[delta];
+ p_out.reset();
+ for (;;) {
+ t_size delta_done;
+ delta_done = read(buffer,delta,p_abort);
+ p_out.add_string(buffer,delta_done);
+ if (delta_done < delta) break;
+ }
+}
+void stream_writer::write_string(const char * p_string,t_size p_len,abort_callback & p_abort) {
+ t_uint32 len = pfc::downcast_guarded<t_uint32>(pfc::strlen_max(p_string,p_len));
+ write_lendian_t(len,p_abort);
+ write_object(p_string,len,p_abort);
+}
+
+void stream_writer::write_string(const char * p_string,abort_callback & p_abort) {
+ write_string(p_string,~0,p_abort);
+}
+
+void stream_writer::write_string_raw(const char * p_string,abort_callback & p_abort) {
+ write_object(p_string,strlen(p_string),p_abort);
+}
+
+void file::truncate(t_uint64 p_position,abort_callback & p_abort) {
+ if (p_position < get_size(p_abort)) resize(p_position,p_abort);
+}
+
+
+#ifdef _WIN32
+namespace {
+ //rare/weird win32 errors that didn't make it to the main API
+ PFC_DECLARE_EXCEPTION(exception_io_device_not_ready, exception_io,"Device not ready");
+ PFC_DECLARE_EXCEPTION(exception_io_invalid_drive, exception_io_not_found,"Drive not found");
+ PFC_DECLARE_EXCEPTION(exception_io_win32, exception_io,"Generic win32 I/O error");
+ PFC_DECLARE_EXCEPTION(exception_io_buffer_overflow, exception_io,"The file name is too long");
+ PFC_DECLARE_EXCEPTION(exception_io_invalid_path_syntax, exception_io,"Invalid path syntax");
+
+ class exception_io_win32_ex : public exception_io_win32 {
+ public:
+ exception_io_win32_ex(DWORD p_code) : m_msg(pfc::string_formatter() << "I/O error (win32 #" << (t_uint32)p_code << ")") {}
+ exception_io_win32_ex(const exception_io_win32_ex & p_other) {*this = p_other;}
+ const char * what() const throw() {return m_msg;}
+ private:
+ pfc::string8 m_msg;
+ };
+}
+PFC_NORETURN void foobar2000_io::exception_io_from_win32(DWORD p_code) {
+ //pfc::string_fixed_t<32> debugMsg; debugMsg << "Win32 I/O error #" << (t_uint32)p_code;
+ //TRACK_CALL_TEXT(debugMsg);
+ switch(p_code) {
+ case ERROR_ALREADY_EXISTS:
+ case ERROR_FILE_EXISTS:
+ throw exception_io_already_exists();
+ case ERROR_NETWORK_ACCESS_DENIED:
+ case ERROR_ACCESS_DENIED:
+ throw exception_io_denied();
+ case ERROR_WRITE_PROTECT:
+ throw exception_io_write_protected();
+ case ERROR_BUSY:
+ case ERROR_PATH_BUSY:
+ case ERROR_SHARING_VIOLATION:
+ case ERROR_LOCK_VIOLATION:
+ throw exception_io_sharing_violation();
+ case ERROR_HANDLE_DISK_FULL:
+ case ERROR_DISK_FULL:
+ throw exception_io_device_full();
+ case ERROR_FILE_NOT_FOUND:
+ case ERROR_PATH_NOT_FOUND:
+ throw exception_io_not_found();
+ case ERROR_BROKEN_PIPE:
+ case ERROR_NO_DATA:
+ throw exception_io_no_data();
+ case ERROR_NETWORK_UNREACHABLE:
+ case ERROR_NETNAME_DELETED:
+ throw exception_io_network_not_reachable();
+ case ERROR_NOT_READY:
+ throw exception_io_device_not_ready();
+ case ERROR_INVALID_DRIVE:
+ throw exception_io_invalid_drive();
+ case ERROR_CRC:
+ case ERROR_FILE_CORRUPT:
+ case ERROR_DISK_CORRUPT:
+ throw exception_io_file_corrupted();
+ case ERROR_BUFFER_OVERFLOW:
+ throw exception_io_buffer_overflow();
+ case ERROR_DISK_CHANGE:
+ throw exception_io_disk_change();
+ case ERROR_DIR_NOT_EMPTY:
+ throw exception_io_directory_not_empty();
+ case ERROR_INVALID_NAME:
+ throw exception_io_invalid_path_syntax();
+ default:
+ throw exception_io_win32_ex(p_code);
+ }
+}
+#endif
+
+t_filesize file::get_size_ex(abort_callback & p_abort) {
+ t_filesize temp = get_size(p_abort);
+ if (temp == filesize_invalid) throw exception_io_no_length();
+ return temp;
+}
+
+void file::ensure_local() {
+ if (is_remote()) throw exception_io_object_is_remote();
+}
+
+void file::ensure_seekable() {
+ if (!can_seek()) throw exception_io_object_not_seekable();
+}
+
+bool filesystem::g_is_recognized_path(const char * p_path) {
+ return g_get_interface(service_ptr_t<filesystem>(),p_path);
+}
+
+t_filesize file::get_remaining(abort_callback & p_abort) {
+ t_filesize length = get_size_ex(p_abort);
+ t_filesize position = get_position(p_abort);
+ pfc::dynamic_assert(position <= length);
+ return length - position;
+}
+
+
+t_filesize file::g_transfer(service_ptr_t<file> p_src,service_ptr_t<file> p_dst,t_filesize p_bytes,abort_callback & p_abort) {
+ return g_transfer(pfc::implicit_cast<stream_reader*>(p_src.get_ptr()),pfc::implicit_cast<stream_writer*>(p_dst.get_ptr()),p_bytes,p_abort);
+}
+
+void file::g_transfer_object(service_ptr_t<file> p_src,service_ptr_t<file> p_dst,t_filesize p_bytes,abort_callback & p_abort) {
+ if (p_bytes > 1024) /* don't bother on small objects */
+ {
+ t_filesize oldsize = p_dst->get_size(p_abort);
+ if (oldsize != filesize_invalid) {
+ t_filesize newpos = p_dst->get_position(p_abort) + p_bytes;
+ if (newpos > oldsize) p_dst->resize(newpos ,p_abort);
+ }
+ }
+ g_transfer_object(pfc::implicit_cast<stream_reader*>(p_src.get_ptr()),pfc::implicit_cast<stream_writer*>(p_dst.get_ptr()),p_bytes,p_abort);
+}
+
+
+void foobar2000_io::generate_temp_location_for_file(pfc::string_base & p_out, const char * p_origpath,const char * p_extension,const char * p_magic) {
+ hasher_md5_result hash;
+ {
+ static_api_ptr_t<hasher_md5> hasher;
+ hasher_md5_state state;
+ hasher->initialize(state);
+ hasher->process(state,p_origpath,strlen(p_origpath));
+ hasher->process(state,p_extension,strlen(p_extension));
+ hasher->process(state,p_magic,strlen(p_magic));
+ hash = hasher->get_result(state);
+ }
+
+ p_out = p_origpath;
+ p_out.truncate(p_out.scan_filename());
+ p_out += "temp-";
+ p_out += pfc::format_hexdump(hash.m_data,sizeof(hash.m_data),"");
+ p_out += ".";
+ p_out += p_extension;
+}
+
+
+t_filesize file::skip(t_filesize p_bytes,abort_callback & p_abort) {
+ if (p_bytes > 1024 && can_seek()) {
+ const t_filesize size = get_size(p_abort);
+ if (size != filesize_invalid) {
+ const t_filesize position = get_position(p_abort);
+ const t_filesize toskip = pfc::min_t( p_bytes, size - position );
+ seek(position + toskip,p_abort);
+ return toskip;
+ }
+ }
+ return stream_reader::skip(p_bytes,p_abort);
+}
+
+bool foobar2000_io::_extract_native_path_ptr(const char * & p_fspath) {
+ static const char header[] = "file://"; static const t_size headerLen = 7;
+ if (strncmp(p_fspath,header,headerLen) != 0) return false;
+ p_fspath += headerLen;
+ return true;
+}
+bool foobar2000_io::extract_native_path(const char * p_fspath,pfc::string_base & p_native) {
+ if (!_extract_native_path_ptr(p_fspath)) return false;
+ p_native = p_fspath;
+ return true;
+}
+
+bool foobar2000_io::extract_native_path_ex(const char * p_fspath, pfc::string_base & p_native) {
+ if (!_extract_native_path_ptr(p_fspath)) return false;
+ if (p_fspath[0] != '\\' || p_fspath[1] != '\\') {
+ p_native = "\\\\?\\";
+ p_native += p_fspath;
+ } else {
+ p_native = p_fspath;
+ }
+ return true;
+}
+
+pfc::string stream_reader::read_string(abort_callback & p_abort) {
+ t_uint32 len;
+ read_lendian_t(len,p_abort);
+ return read_string_ex(len,p_abort);
+}
+pfc::string stream_reader::read_string_ex(t_size p_len,abort_callback & p_abort) {
+ pfc::rcptr_t<pfc::string8> temp; temp.new_t();
+ read_object(temp->lock_buffer(p_len),p_len,p_abort);
+ temp->unlock_buffer();
+ return pfc::string::t_data(temp);
+}
+
+
+void filesystem::remove_directory_content(const char * path, abort_callback & abort) {
+ class myCallback : public directory_callback {
+ public:
+ bool on_entry(filesystem * p_owner,abort_callback & p_abort,const char * p_url,bool p_is_subdirectory,const t_filestats & p_stats) {
+ if (p_is_subdirectory) p_owner->list_directory(p_url, *this, p_abort);
+ try {
+ p_owner->remove(p_url, p_abort);
+ } catch(exception_io_not_found) {}
+ return true;
+ }
+ };
+ myCallback cb;
+ list_directory(path, cb, abort);
+}
+void filesystem::remove_object_recur(const char * path, abort_callback & abort) {
+ try {
+ remove_directory_content(path, abort);
+ } catch(exception_io_not_found) {}
+ remove(path, abort);
+}
+
+void filesystem::g_remove_object_recur(const char * path, abort_callback & abort) {
+ g_get_interface(path)->remove_object_recur(path, abort);
+}
+
+void foobar2000_io::purgeOldFiles(const char * directory, t_filetimestamp period, abort_callback & abort) {
+
+ class myCallback : public directory_callback {
+ public:
+ myCallback(t_filetimestamp period) : m_base(filetimestamp_from_system_timer() - period) {}
+ bool on_entry(filesystem * p_owner,abort_callback & p_abort,const char * p_url,bool p_is_subdirectory,const t_filestats & p_stats) {
+ if (!p_is_subdirectory && p_stats.m_timestamp < m_base) {
+ try {
+ filesystem::g_remove_timeout(p_url, 1, p_abort);
+ } catch(exception_io_not_found) {}
+ }
+ return true;
+ }
+ private:
+ const t_filetimestamp m_base;
+ };
+
+ myCallback cb(period);
+ filesystem::g_list_directory(directory, cb, abort);
+}
\ No newline at end of file diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/filesystem.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/filesystem.h new file mode 100644 index 0000000000..e87eb13acf --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/filesystem.h @@ -0,0 +1,641 @@ +class file_info;
+
+//! Contains various I/O related structures and interfaces.
+
+namespace foobar2000_io
+{
+ //! Type used for file size related variables.
+ typedef t_uint64 t_filesize;
+ //! Type used for file size related variables when signed value is needed.
+ typedef t_int64 t_sfilesize;
+ //! Type used for file timestamp related variables. 64-bit value representing the number of 100-nanosecond intervals since January 1, 1601; 0 for invalid/unknown time.
+ typedef t_uint64 t_filetimestamp;
+ //! Invalid/unknown file timestamp constant. Also see: t_filetimestamp.
+ const t_filetimestamp filetimestamp_invalid = 0;
+ //! Invalid/unknown file size constant. Also see: t_filesize.
+ static const t_filesize filesize_invalid = (t_filesize)(~0);
+
+ static const t_filetimestamp filetimestamp_1second_increment = 10000000;
+
+ //! Generic I/O error. Root class for I/O failure exception. See relevant default message for description of each derived exception class.
+ PFC_DECLARE_EXCEPTION(exception_io, pfc::exception,"I/O error");
+ //! Object not found.
+ PFC_DECLARE_EXCEPTION(exception_io_not_found, exception_io,"Object not found");
+ //! Access denied.
+ PFC_DECLARE_EXCEPTION(exception_io_denied, exception_io,"Access denied");
+ //! Unsupported format or corrupted file (unexpected data encountered).
+ PFC_DECLARE_EXCEPTION(exception_io_data, exception_io,"Unsupported format or corrupted file");
+ //! Unsupported format or corrupted file (truncation encountered).
+ PFC_DECLARE_EXCEPTION(exception_io_data_truncation, exception_io_data,"Unsupported format or corrupted file");
+ //! Unsupported format (a subclass of "unsupported format or corrupted file" exception).
+ PFC_DECLARE_EXCEPTION(exception_io_unsupported_format, exception_io_data,"Unsupported file format");
+ //! Object is remote, while specific operation is supported only for local objects.
+ PFC_DECLARE_EXCEPTION(exception_io_object_is_remote, exception_io,"This operation is not supported on remote objects");
+ //! Sharing violation.
+ PFC_DECLARE_EXCEPTION(exception_io_sharing_violation, exception_io,"Sharing violation");
+ //! Device full.
+ PFC_DECLARE_EXCEPTION(exception_io_device_full, exception_io,"Device full");
+ //! Attempt to seek outside valid range.
+ PFC_DECLARE_EXCEPTION(exception_io_seek_out_of_range, exception_io,"Seek offset out of range");
+ //! This operation requires a seekable object.
+ PFC_DECLARE_EXCEPTION(exception_io_object_not_seekable, exception_io,"Object is not seekable");
+ //! This operation requires an object with known length.
+ PFC_DECLARE_EXCEPTION(exception_io_no_length, exception_io,"Length of object is unknown");
+ //! Invalid path.
+ PFC_DECLARE_EXCEPTION(exception_io_no_handler_for_path, exception_io,"Invalid path");
+ //! Object already exists.
+ PFC_DECLARE_EXCEPTION(exception_io_already_exists, exception_io,"Object already exists");
+ //! Pipe error.
+ PFC_DECLARE_EXCEPTION(exception_io_no_data, exception_io,"The process receiving or sending data has terminated");
+ //! Network not reachable.
+ PFC_DECLARE_EXCEPTION(exception_io_network_not_reachable,exception_io,"Network not reachable");
+ //! Media is write protected.
+ PFC_DECLARE_EXCEPTION(exception_io_write_protected, exception_io_denied,"The media is write protected");
+ //! File is corrupted. This indicates filesystem call failure, not actual invalid data being read by the app.
+ PFC_DECLARE_EXCEPTION(exception_io_file_corrupted, exception_io,"The file is corrupted");
+ //! The disc required for requested operation is not available.
+ PFC_DECLARE_EXCEPTION(exception_io_disk_change, exception_io,"Disc not available");
+ //! The directory is not empty.
+ PFC_DECLARE_EXCEPTION(exception_io_directory_not_empty, exception_io,"Directory not empty");
+
+ //! Stores file stats (size and timestamp).
+ struct t_filestats {
+ //! Size of the file.
+ t_filesize m_size;
+ //! Time of last file modification.
+ t_filetimestamp m_timestamp;
+
+ inline bool operator==(const t_filestats & param) const {return m_size == param.m_size && m_timestamp == param.m_timestamp;}
+ inline bool operator!=(const t_filestats & param) const {return m_size != param.m_size || m_timestamp != param.m_timestamp;}
+ };
+
+ //! Invalid/unknown file stats constant. See: t_filestats.
+ static const t_filestats filestats_invalid = {filesize_invalid,filetimestamp_invalid};
+
+#ifdef _WIN32
+ PFC_NORETURN void exception_io_from_win32(DWORD p_code);
+#define WIN32_IO_OP(X) {SetLastError(NO_ERROR); if (!(X)) exception_io_from_win32(GetLastError());}
+#endif
+
+ //! Generic interface to read data from a nonseekable stream. Also see: stream_writer, file. \n
+ //! Error handling: all methods may throw exception_io or one of derivatives on failure; exception_aborted when abort_callback is signaled.
+ class NOVTABLE stream_reader {
+ public:
+ //! Attempts to reads specified number of bytes from the stream.
+ //! @param p_buffer Receives data being read. Must have at least p_bytes bytes of space allocated.
+ //! @param p_bytes Number of bytes to read.
+ //! @param p_abort abort_callback object signaling user aborting the operation.
+ //! @returns Number of bytes actually read. May be less than requested when EOF was reached.
+ virtual t_size read(void * p_buffer,t_size p_bytes,abort_callback & p_abort) = 0;
+ //! Reads specified number of bytes from the stream. If requested amount of bytes can't be read (e.g. EOF), throws exception_io_data_truncation.
+ //! @param p_buffer Receives data being read. Must have at least p_bytes bytes of space allocated.
+ //! @param p_bytes Number of bytes to read.
+ //! @param p_abort abort_callback object signaling user aborting the operation.
+ virtual void read_object(void * p_buffer,t_size p_bytes,abort_callback & p_abort);
+ //! Attempts to skip specified number of bytes in the stream.
+ //! @param p_bytes Number of bytes to skip.
+ //! @param p_abort abort_callback object signaling user aborting the operation.
+ //! @returns Number of bytes actually skipped, May be less than requested when EOF was reached.
+ virtual t_filesize skip(t_filesize p_bytes,abort_callback & p_abort);
+ //! Skips specified number of bytes in the stream. If requested amount of bytes can't be skipped (e.g. EOF), throws exception_io_data_truncation.
+ //! @param p_bytes Number of bytes to skip.
+ //! @param p_abort abort_callback object signaling user aborting the operation.
+ virtual void skip_object(t_filesize p_bytes,abort_callback & p_abort);
+
+ //! Helper template built around read_object. Reads single raw object from the stream.
+ //! @param p_object Receives object read from the stream on success.
+ //! @param p_abort abort_callback object signaling user aborting the operation.
+ template<typename T> inline void read_object_t(T& p_object,abort_callback & p_abort) {pfc::assert_raw_type<T>(); read_object(&p_object,sizeof(p_object),p_abort);}
+ //! Helper template built around read_object. Reads single raw object from the stream; corrects byte order assuming stream uses little endian order.
+ //! @param p_object Receives object read from the stream on success.
+ //! @param p_abort abort_callback object signaling user aborting the operation.
+ template<typename T> inline void read_lendian_t(T& p_object,abort_callback & p_abort) {read_object_t(p_object,p_abort); byte_order::order_le_to_native_t(p_object);}
+ //! Helper template built around read_object. Reads single raw object from the stream; corrects byte order assuming stream uses big endian order.
+ //! @param p_object Receives object read from the stream on success.
+ //! @param p_abort abort_callback object signaling user aborting the operation.
+ template<typename T> inline void read_bendian_t(T& p_object,abort_callback & p_abort) {read_object_t(p_object,p_abort); byte_order::order_be_to_native_t(p_object);}
+
+ //! Helper function; reads a string (with a 32-bit header indicating length in bytes followed by UTF-8 encoded data without a null terminator).
+ void read_string(pfc::string_base & p_out,abort_callback & p_abort);
+ //! Helper function; alternate way of storing strings; assumes string takes space up to end of stream.
+ void read_string_raw(pfc::string_base & p_out,abort_callback & p_abort);
+ //! Helper function; reads a string (with a 32-bit header indicating length in bytes followed by UTF-8 encoded data without a null terminator).
+ pfc::string read_string(abort_callback & p_abort);
+
+ //! Helper function; reads a string of specified length from the stream.
+ void read_string_ex(pfc::string_base & p_out,t_size p_bytes,abort_callback & p_abort);
+ //! Helper function; reads a string of specified length from the stream.
+ pfc::string read_string_ex(t_size p_len,abort_callback & p_abort);
+ protected:
+ stream_reader() {}
+ ~stream_reader() {}
+ };
+
+
+ //! Generic interface to write data to a nonseekable stream. Also see: stream_reader, file. \n
+ //! Error handling: all methods may throw exception_io or one of derivatives on failure; exception_aborted when abort_callback is signaled.
+ class NOVTABLE stream_writer {
+ public:
+ //! Writes specified number of bytes from specified buffer to the stream.
+ //! @param p_buffer Buffer with data to write. Must contain at least p_bytes bytes.
+ //! @param p_bytes Number of bytes to write.
+ //! @param p_abort abort_callback object signaling user aborting the operation.
+ virtual void write(const void * p_buffer,t_size p_bytes,abort_callback & p_abort) = 0;
+
+ //! Helper. Same as write(), provided for consistency.
+ inline void write_object(const void * p_buffer,t_size p_bytes,abort_callback & p_abort) {write(p_buffer,p_bytes,p_abort);}
+
+ //! Helper template. Writes single raw object to the stream.
+ //! @param p_object Object to write.
+ //! @param p_abort abort_callback object signaling user aborting the operation.
+ template<typename T> inline void write_object_t(const T & p_object, abort_callback & p_abort) {pfc::assert_raw_type<T>(); write_object(&p_object,sizeof(p_object),p_abort);}
+ //! Helper template. Writes single raw object to the stream; corrects byte order assuming stream uses little endian order.
+ //! @param p_object Object to write.
+ //! @param p_abort abort_callback object signaling user aborting the operation.
+ template<typename T> inline void write_lendian_t(const T & p_object, abort_callback & p_abort) {T temp = p_object; byte_order::order_native_to_le_t(temp); write_object_t(temp,p_abort);}
+ //! Helper template. Writes single raw object to the stream; corrects byte order assuming stream uses big endian order.
+ //! @param p_object Object to write.
+ //! @param p_abort abort_callback object signaling user aborting the operation.
+ template<typename T> inline void write_bendian_t(const T & p_object, abort_callback & p_abort) {T temp = p_object; byte_order::order_native_to_be_t(temp); write_object_t(temp,p_abort);}
+
+ //! Helper function; writes string (with 32-bit header indicating length in bytes followed by UTF-8 encoded data without null terminator).
+ void write_string(const char * p_string,abort_callback & p_abort);
+ void write_string(const char * p_string,t_size p_len,abort_callback & p_abort);
+
+ template<typename T>
+ void write_string(const T& val,abort_callback & p_abort) {write_string(pfc::stringToPtr(val),p_abort);}
+
+ //! Helper function; writes raw string to the stream, with no length info or null terminators.
+ void write_string_raw(const char * p_string,abort_callback & p_abort);
+ protected:
+ stream_writer() {}
+ ~stream_writer() {}
+ };
+
+ //! A class providing abstraction for an open file object, with reading/writing/seeking methods. See also: stream_reader, stream_writer (which it inherits read/write methods from). \n
+ //! Error handling: all methods may throw exception_io or one of derivatives on failure; exception_aborted when abort_callback is signaled.
+ class NOVTABLE file : public service_base, public stream_reader, public stream_writer {
+ public:
+
+ //! Seeking mode constants. Note: these are purposedly defined to same values as standard C SEEK_* constants
+ enum t_seek_mode {
+ //! Seek relative to beginning of file (same as seeking to absolute offset).
+ seek_from_beginning = 0,
+ //! Seek relative to current position.
+ seek_from_current = 1,
+ //! Seek relative to end of file.
+ seek_from_eof = 2,
+ };
+
+ //! Retrieves size of the file.
+ //! @param p_abort abort_callback object signaling user aborting the operation.
+ //! @returns File size on success; filesize_invalid if unknown (nonseekable stream etc).
+ virtual t_filesize get_size(abort_callback & p_abort) = 0;
+
+
+ //! Retrieves read/write cursor position in the file. In case of non-seekable stream, this should return number of bytes read so far since open/reopen call.
+ //! @param p_abort abort_callback object signaling user aborting the operation.
+ //! @returns Read/write cursor position
+ virtual t_filesize get_position(abort_callback & p_abort) = 0;
+
+ //! Resizes file to the specified size in bytes.
+ //! @param p_abort abort_callback object signaling user aborting the operation.
+ virtual void resize(t_filesize p_size,abort_callback & p_abort) = 0;
+
+ //! Sets read/write cursor position to the specified offset.
+ //! @param p_position position to seek to.
+ //! @param p_abort abort_callback object signaling user aborting the operation.
+ virtual void seek(t_filesize p_position,abort_callback & p_abort) = 0;
+
+
+ //! Sets read/write cursor position to the specified offset; extended form allowing seeking relative to current position or to end of file.
+ //! @param p_position Position to seek to; interpretation of this value depends on p_mode parameter.
+ //! @param p_mode Seeking mode; see t_seek_mode enum values for further description.
+ //! @param p_abort abort_callback object signaling user aborting the operation.
+ virtual void seek_ex(t_sfilesize p_position,t_seek_mode p_mode,abort_callback & p_abort);
+
+ //! Returns whether the file is seekable or not. If can_seek() returns false, all seek() or seek_ex() calls will fail; reopen() is still usable on nonseekable streams.
+ virtual bool can_seek() = 0;
+
+ //! Retrieves mime type of the file.
+ //! @param p_out Receives content type string on success.
+ virtual bool get_content_type(pfc::string_base & p_out) = 0;
+
+ //! Hint, returns whether the file is already fully buffered into memory.
+ virtual bool is_in_memory() {return false;}
+
+ //! Optional, called by owner thread before sleeping.
+ //! @param p_abort abort_callback object signaling user aborting the operation.
+ virtual void on_idle(abort_callback & p_abort) {}
+
+ //! Retrieves last modification time of the file.
+ //! @param p_abort abort_callback object signaling user aborting the operation.
+ //! @returns Last modification time o fthe file; filetimestamp_invalid if N/A.
+ virtual t_filetimestamp get_timestamp(abort_callback & p_abort) {return filetimestamp_invalid;}
+
+ //! Resets non-seekable stream, or seeks to zero on seekable file.
+ //! @param p_abort abort_callback object signaling user aborting the operation.
+ virtual void reopen(abort_callback & p_abort) = 0;
+
+ //! Indicates whether the file is a remote resource and non-sequential access may be slowed down by lag. This is typically returns to true on non-seekable sources but may also return true on seekable sources indicating that seeking is supported but will be relatively slow.
+ virtual bool is_remote() = 0;
+
+ //! Retrieves file stats structure. Usese get_size() and get_timestamp().
+ t_filestats get_stats(abort_callback & p_abort);
+
+ //! Returns whether read/write cursor position is at the end of file.
+ bool is_eof(abort_callback & p_abort);
+
+ //! Truncates file to specified size (while preserving read/write cursor position if possible); uses set_eof().
+ void truncate(t_filesize p_position,abort_callback & p_abort);
+
+ //! Truncates the file at current read/write cursor position.
+ void set_eof(abort_callback & p_abort) {resize(get_position(p_abort),p_abort);}
+
+
+ //! Helper; retrieves size of the file. If size is not available (get_size() returns filesize_invalid), throws exception_io_no_length.
+ t_filesize get_size_ex(abort_callback & p_abort);
+
+ //! Helper; retrieves amount of bytes between read/write cursor position and end of file. Fails when length can't be determined.
+ t_filesize get_remaining(abort_callback & p_abort);
+
+ //! Helper; throws exception_io_object_not_seekable if file is not seekable.
+ void ensure_seekable();
+
+ //! Helper; throws exception_io_object_is_remote if the file is remote.
+ void ensure_local();
+
+ //! Helper; transfers specified number of bytes between streams.
+ //! @returns number of bytes actually transferred. May be less than requested if e.g. EOF is reached.
+ static t_filesize g_transfer(stream_reader * src,stream_writer * dst,t_filesize bytes,abort_callback & p_abort);
+ //! Helper; transfers specified number of bytes between streams. Throws exception if requested number of bytes could not be read (EOF).
+ static void g_transfer_object(stream_reader * src,stream_writer * dst,t_filesize bytes,abort_callback & p_abort);
+ //! Helper; transfers entire file content from one file to another, erasing previous content.
+ static void g_transfer_file(const service_ptr_t<file> & p_from,const service_ptr_t<file> & p_to,abort_callback & p_abort);
+
+ //! Helper; improved performance over g_transfer on streams (avoids disk fragmentation when transferring large blocks).
+ static t_filesize g_transfer(service_ptr_t<file> p_src,service_ptr_t<file> p_dst,t_filesize p_bytes,abort_callback & p_abort);
+ //! Helper; improved performance over g_transfer_file on streams (avoids disk fragmentation when transferring large blocks).
+ static void g_transfer_object(service_ptr_t<file> p_src,service_ptr_t<file> p_dst,t_filesize p_bytes,abort_callback & p_abort);
+
+
+ t_filesize skip(t_filesize p_bytes,abort_callback & p_abort);
+
+ FB2K_MAKE_SERVICE_INTERFACE(file,service_base);
+ };
+
+ typedef service_ptr_t<file> file_ptr;
+
+ //! Special hack for shoutcast metadata nonsense handling. Documentme.
+ class file_dynamicinfo : public file {
+ public:
+ //! Retrieves "static" info that doesn't change in the middle of stream, such as station names etc. Returns true on success; false when static info is not available.
+ virtual bool get_static_info(class file_info & p_out) = 0;
+ //! Returns whether dynamic info is available on this stream or not.
+ virtual bool is_dynamic_info_enabled()=0;
+ //! Retrieves dynamic stream info (e.g. online stream track titles). Returns true on success, false when info has not changed since last call.
+ virtual bool get_dynamic_info(class file_info & p_out) = 0;
+
+ FB2K_MAKE_SERVICE_INTERFACE(file_dynamicinfo,file);
+ };
+
+ //! Implementation helper - contains dummy implementations of methods that modify the file
+ template<typename t_base> class file_readonly_t : public t_base {
+ public:
+ void resize(t_filesize p_size,abort_callback & p_abort) {throw exception_io_denied();}
+ void write(const void * p_buffer,t_size p_bytes,abort_callback & p_abort) {throw exception_io_denied();}
+ };
+ typedef file_readonly_t<file> file_readonly;
+
+ class file_streamstub : public file_readonly {
+ public:
+ t_size read(void * p_buffer,t_size p_bytes,abort_callback & p_abort) {return 0;}
+ t_filesize get_size(abort_callback & p_abort) {return filesize_invalid;}
+ t_filesize get_position(abort_callback & p_abort) {return 0;}
+ bool get_content_type(pfc::string_base & p_out) {return false;}
+ bool is_remote() {return true;}
+ void reopen(abort_callback&) {}
+ void seek(t_filesize p_position,abort_callback & p_abort) {throw exception_io_object_not_seekable();}
+ bool can_seek() {return false;}
+ };
+
+ class filesystem;
+
+ class NOVTABLE directory_callback {
+ public:
+ //! @returns true to continue enumeration, false to abort.
+ virtual bool on_entry(filesystem * p_owner,abort_callback & p_abort,const char * p_url,bool p_is_subdirectory,const t_filestats & p_stats)=0;
+ };
+
+
+ //! Entrypoint service for all filesystem operations.\n
+ //! Implementation: standard implementations for local filesystem etc are provided by core.\n
+ //! Instantiation: use static helper functions rather than calling filesystem interface methods directly, e.g. filesystem::g_open() to open a file.
+ class NOVTABLE filesystem : public service_base {
+ FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(filesystem);
+ public:
+ //! Enumeration specifying how to open a file. See: filesystem::open(), filesystem::g_open().
+ enum t_open_mode {
+ //! Opens an existing file for reading; if the file does not exist, the operation will fail.
+ open_mode_read,
+ //! Opens an existing file for writing; if the file does not exist, the operation will fail.
+ open_mode_write_existing,
+ //! Opens a new file for writing; if the file exists, its contents will be wiped.
+ open_mode_write_new,
+ };
+
+ virtual bool get_canonical_path(const char * p_path,pfc::string_base & p_out)=0;
+ virtual bool is_our_path(const char * p_path)=0;
+ virtual bool get_display_path(const char * p_path,pfc::string_base & p_out)=0;
+
+ virtual void open(service_ptr_t<file> & p_out,const char * p_path, t_open_mode p_mode,abort_callback & p_abort)=0;
+ virtual void remove(const char * p_path,abort_callback & p_abort)=0;
+ virtual void move(const char * p_src,const char * p_dst,abort_callback & p_abort)=0;
+ //! Queries whether a file at specified path belonging to this filesystem is a remove object or not.
+ virtual bool is_remote(const char * p_src) = 0;
+
+ //! Retrieves stats of a file at specified path.
+ virtual void get_stats(const char * p_path,t_filestats & p_stats,bool & p_is_writeable,abort_callback & p_abort) = 0;
+
+ virtual bool relative_path_create(const char * file_path,const char * playlist_path,pfc::string_base & out) {return false;}
+ virtual bool relative_path_parse(const char * relative_path,const char * playlist_path,pfc::string_base & out) {return false;}
+
+ //! Creates a directory.
+ virtual void create_directory(const char * p_path,abort_callback & p_abort) = 0;
+
+ virtual void list_directory(const char * p_path,directory_callback & p_out,abort_callback & p_abort)=0;
+
+ //! Hint; returns whether this filesystem supports mime types. \n
+ //! When this returns false, all file::get_content_type() calls on files opened thru this filesystem implementation will return false; otherwise, file::get_content_type() calls may return true depending on the file.
+ virtual bool supports_content_types() = 0;
+
+ static void g_get_canonical_path(const char * path,pfc::string_base & out);
+ static void g_get_display_path(const char * path,pfc::string_base & out);
+
+ static bool g_get_interface(service_ptr_t<filesystem> & p_out,const char * path);//path is AFTER get_canonical_path
+ static filesystem::ptr g_get_interface(const char * path);// throws exception_io_no_handler_for_path on failure
+ static bool g_is_remote(const char * p_path);//path is AFTER get_canonical_path
+ static bool g_is_recognized_and_remote(const char * p_path);//path is AFTER get_canonical_path
+ static bool g_is_remote_safe(const char * p_path) {return g_is_recognized_and_remote(p_path);}
+ static bool g_is_remote_or_unrecognized(const char * p_path);
+ static bool g_is_recognized_path(const char * p_path);
+
+ //! Opens file at specified path, with specified access privileges.
+ static void g_open(service_ptr_t<file> & p_out,const char * p_path,t_open_mode p_mode,abort_callback & p_abort);
+ //! Attempts to open file at specified path; if the operation fails with sharing violation error, keeps retrying (with short sleep period between retries) for specified amount of time.
+ static void g_open_timeout(service_ptr_t<file> & p_out,const char * p_path,t_open_mode p_mode,double p_timeout,abort_callback & p_abort);
+ static void g_open_write_new(service_ptr_t<file> & p_out,const char * p_path,abort_callback & p_abort);
+ static void g_open_read(service_ptr_t<file> & p_out,const char * path,abort_callback & p_abort) {return g_open(p_out,path,open_mode_read,p_abort);}
+ static void g_open_precache(service_ptr_t<file> & p_out,const char * path,abort_callback & p_abort);//open only for precaching data (eg. will fail on http etc)
+ static bool g_exists(const char * p_path,abort_callback & p_abort);
+ static bool g_exists_writeable(const char * p_path,abort_callback & p_abort);
+ //! Removes file at specified path.
+ static void g_remove(const char * p_path,abort_callback & p_abort);
+ //! Attempts to remove file at specified path; if the operation fails with a sharing violation error, keeps retrying (with short sleep period between retries) for specified amount of time.
+ static void g_remove_timeout(const char * p_path,double p_timeout,abort_callback & p_abort);
+ //! Moves file from one path to another.
+ static void g_move(const char * p_src,const char * p_dst,abort_callback & p_abort);
+ //! Attempts to move file from one path to another; if the operation fails with a sharing violation error, keeps retrying (with short sleep period between retries) for specified amount of time.
+ static void g_move_timeout(const char * p_src,const char * p_dst,double p_timeout,abort_callback & p_abort);
+
+ static void g_copy(const char * p_src,const char * p_dst,abort_callback & p_abort);//needs canonical path
+ static void g_copy_timeout(const char * p_src,const char * p_dst,double p_timeout,abort_callback & p_abort);//needs canonical path
+ static void g_copy_directory(const char * p_src,const char * p_dst,abort_callback & p_abort);//needs canonical path
+ static void g_get_stats(const char * p_path,t_filestats & p_stats,bool & p_is_writeable,abort_callback & p_abort);
+ static bool g_relative_path_create(const char * p_file_path,const char * p_playlist_path,pfc::string_base & out);
+ static bool g_relative_path_parse(const char * p_relative_path,const char * p_playlist_path,pfc::string_base & out);
+
+ static void g_create_directory(const char * p_path,abort_callback & p_abort);
+
+ //! If for some bloody reason you ever need stream io compatibility, use this, INSTEAD of calling fopen() on the path string you've got; will only work with file:// (and not with http://, unpack:// or whatever)
+ static FILE * streamio_open(const char * p_path,const char * p_flags);
+
+ static void g_open_temp(service_ptr_t<file> & p_out,abort_callback & p_abort);
+ static void g_open_tempmem(service_ptr_t<file> & p_out,abort_callback & p_abort);
+
+ static void g_list_directory(const char * p_path,directory_callback & p_out,abort_callback & p_abort);// path must be canonical
+
+ static bool g_is_valid_directory(const char * path,abort_callback & p_abort);
+ static bool g_is_empty_directory(const char * path,abort_callback & p_abort);
+
+ void remove_object_recur(const char * path, abort_callback & abort);
+ void remove_directory_content(const char * path, abort_callback & abort);
+ static void g_remove_object_recur(const char * path, abort_callback & abort);
+ };
+
+ class directory_callback_impl : public directory_callback
+ {
+ struct t_entry
+ {
+ pfc::string_simple m_path;
+ t_filestats m_stats;
+ t_entry(const char * p_path, const t_filestats & p_stats) : m_path(p_path), m_stats(p_stats) {}
+ };
+
+
+ pfc::list_t<pfc::rcptr_t<t_entry> > m_data;
+ bool m_recur;
+
+ static int sortfunc(const pfc::rcptr_t<const t_entry> & p1, const pfc::rcptr_t<const t_entry> & p2) {return stricmp_utf8(p1->m_path,p2->m_path);}
+ public:
+ bool on_entry(filesystem * owner,abort_callback & p_abort,const char * url,bool is_subdirectory,const t_filestats & p_stats);
+
+ directory_callback_impl(bool p_recur) : m_recur(p_recur) {}
+ t_size get_count() {return m_data.get_count();}
+ const char * operator[](t_size n) const {return m_data[n]->m_path;}
+ const char * get_item(t_size n) const {return m_data[n]->m_path;}
+ const t_filestats & get_item_stats(t_size n) const {return m_data[n]->m_stats;}
+ void sort() {m_data.sort_t(sortfunc);}
+ };
+
+ class archive;
+
+ class NOVTABLE archive_callback : public abort_callback {
+ public:
+ virtual bool on_entry(archive * owner,const char * url,const t_filestats & p_stats,const service_ptr_t<file> & p_reader) = 0;
+ };
+
+ //! Interface for archive reader services. When implementing, derive from archive_impl rather than from deriving from archive directly.
+ class NOVTABLE archive : public filesystem {
+ public:
+ virtual void archive_list(const char * p_path,const service_ptr_t<file> & p_reader,archive_callback & p_callback,bool p_want_readers) = 0;
+
+ FB2K_MAKE_SERVICE_INTERFACE(archive,filesystem);
+ };
+
+ //! Root class for archive implementations. Derive from this instead of from archive directly.
+ class NOVTABLE archive_impl : public archive {
+ private:
+ //do not override these
+ bool get_canonical_path(const char * path,pfc::string_base & out);
+ bool is_our_path(const char * path);
+ bool get_display_path(const char * path,pfc::string_base & out);
+ void remove(const char * path,abort_callback & p_abort);
+ void move(const char * src,const char * dst,abort_callback & p_abort);
+ bool is_remote(const char * src);
+ bool relative_path_create(const char * file_path,const char * playlist_path,pfc::string_base & out);
+ bool relative_path_parse(const char * relative_path,const char * playlist_path,pfc::string_base & out);
+ void open(service_ptr_t<file> & p_out,const char * path, t_open_mode mode,abort_callback & p_abort);
+ void create_directory(const char * path,abort_callback &);
+ void list_directory(const char * p_path,directory_callback & p_out,abort_callback & p_abort);
+ void get_stats(const char * p_path,t_filestats & p_stats,bool & p_is_writeable,abort_callback & p_abort);
+ protected:
+ //override these
+ virtual const char * get_archive_type()=0;//eg. "zip", must be lowercase
+ virtual t_filestats get_stats_in_archive(const char * p_archive,const char * p_file,abort_callback & p_abort) = 0;
+ virtual void open_archive(service_ptr_t<file> & p_out,const char * archive,const char * file, abort_callback & p_abort)=0;//opens for reading
+ public:
+ //override these
+ virtual void archive_list(const char * path,const service_ptr_t<file> & p_reader,archive_callback & p_out,bool p_want_readers)=0;
+
+
+ static bool g_is_unpack_path(const char * path);
+ static bool g_parse_unpack_path(const char * path,pfc::string_base & archive,pfc::string_base & file);
+ static bool g_parse_unpack_path_ex(const char * path,pfc::string_base & archive,pfc::string_base & file, pfc::string_base & type);
+ static void g_make_unpack_path(pfc::string_base & path,const char * archive,const char * file,const char * type);
+ void make_unpack_path(pfc::string_base & path,const char * archive,const char * file);
+
+
+ };
+
+ template<typename T>
+ class archive_factory_t : public service_factory_single_t<T> {};
+
+
+ t_filetimestamp filetimestamp_from_system_timer();
+
+#ifdef _WIN32
+ inline t_filetimestamp import_filetimestamp(FILETIME ft) {
+ return *reinterpret_cast<t_filetimestamp*>(&ft);
+ }
+#endif
+
+ void generate_temp_location_for_file(pfc::string_base & p_out, const char * p_origpath,const char * p_extension,const char * p_magic);
+
+
+ static file_ptr fileOpen(const char * p_path,filesystem::t_open_mode p_mode,abort_callback & p_abort,double p_timeout) {
+ file_ptr temp; filesystem::g_open_timeout(temp,p_path,p_mode,p_timeout,p_abort); PFC_ASSERT(temp.is_valid()); return temp;
+ }
+
+ static file_ptr fileOpenReadExisting(const char * p_path,abort_callback & p_abort,double p_timeout = 0) {
+ return fileOpen(p_path,filesystem::open_mode_read,p_abort,p_timeout);
+ }
+ static file_ptr fileOpenWriteExisting(const char * p_path,abort_callback & p_abort,double p_timeout = 0) {
+ return fileOpen(p_path,filesystem::open_mode_write_existing,p_abort,p_timeout);
+ }
+ static file_ptr fileOpenWriteNew(const char * p_path,abort_callback & p_abort,double p_timeout = 0) {
+ return fileOpen(p_path,filesystem::open_mode_write_new,p_abort,p_timeout);
+ }
+
+ template<typename t_list>
+ class directory_callback_retrieveList : public directory_callback {
+ public:
+ directory_callback_retrieveList(t_list & p_list,bool p_getFiles,bool p_getSubDirectories) : m_list(p_list), m_getFiles(p_getFiles), m_getSubDirectories(p_getSubDirectories) {}
+ bool on_entry(filesystem * p_owner,abort_callback & p_abort,const char * p_url,bool p_is_subdirectory,const t_filestats & p_stats) {
+ p_abort.check();
+ if (p_is_subdirectory ? m_getSubDirectories : m_getFiles) {
+ m_list.add_item(p_url);
+ }
+ return true;
+ }
+ private:
+ const bool m_getSubDirectories;
+ const bool m_getFiles;
+ t_list & m_list;
+ };
+ template<typename t_list>
+ class directory_callback_retrieveListEx : public directory_callback {
+ public:
+ directory_callback_retrieveListEx(t_list & p_files, t_list & p_directories) : m_files(p_files), m_directories(p_directories) {}
+ bool on_entry(filesystem * p_owner,abort_callback & p_abort,const char * p_url,bool p_is_subdirectory,const t_filestats & p_stats) {
+ p_abort.check();
+ if (p_is_subdirectory) m_directories += p_url;
+ else m_files += p_url;
+ return true;
+ }
+ private:
+ t_list & m_files;
+ t_list & m_directories;
+ };
+ template<typename t_list> class directory_callback_retrieveListRecur : public directory_callback {
+ public:
+ directory_callback_retrieveListRecur(t_list & p_list) : m_list(p_list) {}
+ bool on_entry(filesystem * owner,abort_callback & p_abort,const char * path, bool isSubdir, const t_filestats&) {
+ if (isSubdir) {
+ try { owner->list_directory(path,*this,p_abort); } catch(exception_io) {}
+ } else {
+ m_list.add_item(path);
+ }
+ return true;
+ }
+ private:
+ t_list & m_list;
+ };
+
+ template<typename t_list>
+ static void listFiles(const char * p_path,t_list & p_out,abort_callback & p_abort) {
+ directory_callback_retrieveList<t_list> callback(p_out,true,false);
+ filesystem::g_list_directory(p_path,callback,p_abort);
+ }
+ template<typename t_list>
+ static void listDirectories(const char * p_path,t_list & p_out,abort_callback & p_abort) {
+ directory_callback_retrieveList<t_list> callback(p_out,false,true);
+ filesystem::g_list_directory(p_path,callback,p_abort);
+ }
+ template<typename t_list>
+ static void listFilesAndDirectories(const char * p_path,t_list & p_files,t_list & p_directories,abort_callback & p_abort) {
+ directory_callback_retrieveListEx<t_list> callback(p_files,p_directories);
+ filesystem::g_list_directory(p_path,callback,p_abort);
+ }
+ template<typename t_list>
+ static void listFilesRecur(const char * p_path,t_list & p_out,abort_callback & p_abort) {
+ directory_callback_retrieveListRecur<t_list> callback(p_out);
+ filesystem::g_list_directory(p_path,callback,p_abort);
+ }
+
+ bool extract_native_path(const char * p_fspath,pfc::string_base & p_native);
+ bool _extract_native_path_ptr(const char * & p_fspath);
+ bool extract_native_path_ex(const char * p_fspath, pfc::string_base & p_native);//prepends \\?\ where needed
+
+ template<typename T>
+ pfc::string getPathDisplay(const T& source) {
+ pfc::string_formatter temp;
+ filesystem::g_get_display_path(pfc::stringToPtr(source),temp);
+ return temp.toString();
+ }
+ template<typename T>
+ pfc::string getPathCanonical(const T& source) {
+ pfc::string_formatter temp;
+ filesystem::g_get_canonical_path(pfc::stringToPtr(source),temp);
+ return temp.toString();
+ }
+
+
+ static bool matchContentType(const char * fullString, const char * ourType) {
+ t_size lim = pfc::string_find_first(fullString, ';');
+ if (lim != ~0) {
+ while(lim > 0 && fullString[lim-1] == ' ') --lim;
+ }
+ return pfc::stricmp_ascii_ex(fullString,lim, ourType, ~0) == 0;
+ }
+ static bool matchProtocol(const char * fullString, const char * protocolName) {
+ const t_size len = strlen(protocolName);
+ if (pfc::stricmp_ascii_ex(fullString, len, protocolName, len) != 0) return false;
+ return fullString[len] == ':' && fullString[len+1] == '/' && fullString[len+2] == '/';
+ }
+ static void substituteProtocol(pfc::string_base & out, const char * fullString, const char * protocolName) {
+ const char * base = strstr(fullString, "://");
+ if (base) {
+ out = protocolName; out << base;
+ } else {
+ PFC_ASSERT(!"Should not get here");
+ out = fullString;
+ }
+ }
+
+ void purgeOldFiles(const char * directory, t_filetimestamp period, abort_callback & abort);
+}
+
+using namespace foobar2000_io;
+
+#include "filesystem_helper.h"
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/filesystem_helper.cpp b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/filesystem_helper.cpp new file mode 100644 index 0000000000..e8feb4e2cf --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/filesystem_helper.cpp @@ -0,0 +1,106 @@ +#include "foobar2000.h"
+
+void stream_writer_chunk::write(const void * p_buffer,t_size p_bytes,abort_callback & p_abort) {
+ t_size remaining = p_bytes, written = 0;
+ while(remaining > 0) {
+ t_size delta = sizeof(m_buffer) - m_buffer_state;
+ if (delta > remaining) delta = remaining;
+ memcpy(m_buffer,(const t_uint8*)p_buffer + written,delta);
+ written += delta;
+ remaining -= delta;
+
+ if (m_buffer_state == sizeof(m_buffer)) {
+ m_writer->write_lendian_t((t_uint8)m_buffer_state,p_abort);
+ m_writer->write_object(m_buffer,m_buffer_state,p_abort);
+ m_buffer_state = 0;
+ }
+ }
+}
+
+void stream_writer_chunk::flush(abort_callback & p_abort)
+{
+ m_writer->write_lendian_t((t_uint8)m_buffer_state,p_abort);
+ if (m_buffer_state > 0) {
+ m_writer->write_object(m_buffer,m_buffer_state,p_abort);
+ m_buffer_state = 0;
+ }
+}
+
+/*
+ stream_writer * m_writer;
+ unsigned m_buffer_state;
+ unsigned char m_buffer[255];
+*/
+
+t_size stream_reader_chunk::read(void * p_buffer,t_size p_bytes,abort_callback & p_abort)
+{
+ t_size todo = p_bytes, done = 0;
+ while(todo > 0) {
+ if (m_buffer_size == m_buffer_state) {
+ if (m_eof) break;
+ t_uint8 temp;
+ m_reader->read_lendian_t(temp,p_abort);
+ m_buffer_size = temp;
+ if (temp != sizeof(m_buffer)) m_eof = true;
+ m_buffer_state = 0;
+ if (m_buffer_size>0) {
+ m_reader->read_object(m_buffer,m_buffer_size,p_abort);
+ }
+ }
+
+
+ t_size delta = m_buffer_size - m_buffer_state;
+ if (delta > todo) delta = todo;
+ if (delta > 0) {
+ memcpy((unsigned char*)p_buffer + done,m_buffer + m_buffer_state,delta);
+ todo -= delta;
+ done += delta;
+ m_buffer_state += delta;
+ }
+ }
+ return done;
+}
+
+void stream_reader_chunk::flush(abort_callback & p_abort) {
+ while(!m_eof) {
+ p_abort.check_e();
+ t_uint8 temp;
+ m_reader->read_lendian_t(temp,p_abort);
+ m_buffer_size = temp;
+ if (temp != sizeof(m_buffer)) m_eof = true;
+ m_buffer_state = 0;
+ if (m_buffer_size>0) {
+ m_reader->skip_object(m_buffer_size,p_abort);
+ }
+ }
+}
+
+/*
+ stream_reader * m_reader;
+ unsigned m_buffer_state, m_buffer_size;
+ bool m_eof;
+ unsigned char m_buffer[255];
+*/
+
+void stream_reader_chunk::g_skip(stream_reader * p_stream,abort_callback & p_abort) {
+ stream_reader_chunk(p_stream).flush(p_abort);
+}
+
+t_size reader_membuffer_base::read(void * p_buffer,t_size p_bytes,abort_callback & p_abort) {
+ p_abort.check_e();
+ t_size max = get_buffer_size();
+ if (max < m_offset) throw pfc::exception_bug_check_v2();
+ max -= m_offset;
+ t_size delta = p_bytes;
+ if (delta > max) delta = max;
+ memcpy(p_buffer,(char*)get_buffer() + m_offset,delta);
+ m_offset += delta;
+ return delta;
+}
+
+void reader_membuffer_base::seek(t_filesize position,abort_callback & p_abort) {
+ p_abort.check_e();
+ t_filesize max = get_buffer_size();
+ if (position == filesize_invalid || position > max) throw exception_io_seek_out_of_range();
+ m_offset = (t_size)position;
+}
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/filesystem_helper.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/filesystem_helper.h new file mode 100644 index 0000000000..5c537e67b7 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/filesystem_helper.h @@ -0,0 +1,666 @@ +//helper
+class file_path_canonical {
+public:
+ file_path_canonical(const char * src) {filesystem::g_get_canonical_path(src,m_data);}
+ operator const char * () const {return m_data.get_ptr();}
+ const char * get_ptr() const {return m_data.get_ptr();}
+ t_size get_length() const {return m_data.get_length();}
+private:
+ pfc::string8 m_data;
+};
+
+class file_path_display {
+public:
+ file_path_display(const char * src) {filesystem::g_get_display_path(src,m_data);}
+ operator const char * () const {return m_data.get_ptr();}
+ const char * get_ptr() const {return m_data.get_ptr();}
+ t_size get_length() const {return m_data.get_length();}
+private:
+ pfc::string8 m_data;
+};
+
+
+class NOVTABLE reader_membuffer_base : public file_readonly {
+public:
+ reader_membuffer_base() : m_offset(0) {}
+
+ t_size read(void * p_buffer,t_size p_bytes,abort_callback & p_abort);
+
+ void write(const void * p_buffer,t_size p_bytes,abort_callback & p_abort) {throw exception_io_denied();}
+
+ t_filesize get_size(abort_callback & p_abort) {return get_buffer_size();}
+ t_filesize get_position(abort_callback & p_abort) {return m_offset;}
+ void seek(t_filesize position,abort_callback & p_abort);
+ void reopen(abort_callback & p_abort) {seek(0,p_abort);}
+
+ bool can_seek() {return true;}
+ bool is_in_memory() {return true;}
+
+protected:
+ virtual const void * get_buffer() = 0;
+ virtual t_size get_buffer_size() = 0;
+ virtual t_filetimestamp get_timestamp(abort_callback & p_abort) = 0;
+ virtual bool get_content_type(pfc::string_base &) {return false;}
+ inline void seek_internal(t_size p_offset) {if (p_offset > get_buffer_size()) throw exception_io_seek_out_of_range(); m_offset = p_offset;}
+private:
+ t_size m_offset;
+};
+
+class reader_membuffer_simple : public reader_membuffer_base {
+public:
+ reader_membuffer_simple(const void * ptr, t_size size, t_filetimestamp ts = filetimestamp_invalid, bool is_remote = false) {
+ m_data.set_size_discard(size);
+ memcpy(m_data.get_ptr(), ptr, size);
+ }
+ const void * get_buffer() {return m_data.get_ptr();}
+ t_size get_buffer_size() {return m_data.get_size();}
+ t_filetimestamp get_timestamp(abort_callback & p_abort) {return m_ts;}
+ bool is_remote() {return m_isRemote;}
+private:
+ pfc::array_staticsize_t<t_uint8> m_data;
+ t_filetimestamp m_ts;
+ bool m_isRemote;
+};
+
+class reader_membuffer_mirror : public reader_membuffer_base
+{
+public:
+ t_filetimestamp get_timestamp(abort_callback & p_abort) {return m_timestamp;}
+ bool is_remote() {return m_remote;}
+
+ //! Returns false when the object could not be mirrored (too big) or did not need mirroring.
+ static bool g_create(service_ptr_t<file> & p_out,const service_ptr_t<file> & p_src,abort_callback & p_abort) {
+ service_ptr_t<reader_membuffer_mirror> ptr = new service_impl_t<reader_membuffer_mirror>();
+ if (!ptr->init(p_src,p_abort)) return false;
+ p_out = ptr.get_ptr();
+ return true;
+ }
+ bool get_content_type(pfc::string_base & out) {
+ if (m_contentType.is_empty()) return false;
+ out = m_contentType; return true;
+ }
+private:
+ const void * get_buffer() {return m_buffer.get_ptr();}
+ t_size get_buffer_size() {return m_buffer.get_size();}
+
+ bool init(const service_ptr_t<file> & p_src,abort_callback & p_abort) {
+ if (p_src->is_in_memory()) return false;//already buffered
+ if (!p_src->get_content_type(m_contentType)) m_contentType.reset();
+ m_remote = p_src->is_remote();
+
+ t_size size = pfc::downcast_guarded<t_size>(p_src->get_size(p_abort));
+
+ m_buffer.set_size(size);
+
+ p_src->reopen(p_abort);
+
+ p_src->read_object(m_buffer.get_ptr(),size,p_abort);
+
+ m_timestamp = p_src->get_timestamp(p_abort);
+
+ return true;
+ }
+
+
+ t_filetimestamp m_timestamp;
+ pfc::array_t<char> m_buffer;
+ bool m_remote;
+ pfc::string8 m_contentType;
+
+};
+
+class reader_limited : public file_readonly {
+ service_ptr_t<file> r;
+ t_filesize begin;
+ t_filesize end;
+
+public:
+ static file::ptr g_create(file::ptr base, t_filesize offset, t_filesize size, abort_callback & abort) {
+ service_ptr_t<reader_limited> r = new service_impl_t<reader_limited>();
+ if (offset + size < offset) throw pfc::exception_overflow();
+ r->init(base, offset, offset + size, abort);
+ return r;
+ }
+ reader_limited() {begin=0;end=0;}
+ reader_limited(const service_ptr_t<file> & p_r,t_filesize p_begin,t_filesize p_end,abort_callback & p_abort) {
+ r = p_r;
+ begin = p_begin;
+ end = p_end;
+ r->seek(begin,p_abort);
+ }
+
+ void init(const service_ptr_t<file> & p_r,t_filesize p_begin,t_filesize p_end,abort_callback & p_abort) {
+ r = p_r;
+ begin = p_begin;
+ end = p_end;
+ r->seek(begin,p_abort);
+ }
+
+ t_filetimestamp get_timestamp(abort_callback & p_abort) {return r->get_timestamp(p_abort);}
+
+ t_size read(void *p_buffer, t_size p_bytes,abort_callback & p_abort) {
+ t_filesize pos;
+ pos = r->get_position(p_abort);
+ if (p_bytes > end - pos) p_bytes = (t_size)(end - pos);
+ return r->read(p_buffer,p_bytes,p_abort);
+ }
+
+ t_filesize get_size(abort_callback & p_abort) {return end-begin;}
+
+ t_filesize get_position(abort_callback & p_abort) {
+ return r->get_position(p_abort) - begin;
+ }
+
+ void seek(t_filesize position,abort_callback & p_abort) {
+ r->seek(position+begin,p_abort);
+ }
+ bool can_seek() {return r->can_seek();}
+ bool is_remote() {return r->is_remote();}
+
+ bool get_content_type(pfc::string_base &) {return false;}
+
+ void reopen(abort_callback & p_abort) {seek(0,p_abort);}
+};
+
+class stream_reader_memblock_ref : public stream_reader
+{
+public:
+ template<typename t_array> stream_reader_memblock_ref(const t_array & p_array) : m_data(p_array.get_ptr()), m_data_size(p_array.get_size()), m_pointer(0) {
+ pfc::assert_byte_type<typename t_array::t_item>();
+ }
+ stream_reader_memblock_ref(const void * p_data,t_size p_data_size) : m_data((const unsigned char*)p_data), m_data_size(p_data_size), m_pointer(0) {}
+ stream_reader_memblock_ref() : m_data(NULL), m_data_size(0), m_pointer(0) {}
+
+ template<typename t_array> void set_data(const t_array & data) {
+ pfc::assert_byte_type<typename t_array::t_item>();
+ set_data(data.get_ptr(), data.get_size());
+ }
+
+ void set_data(const void * data, t_size dataSize) {
+ m_pointer = 0;
+ m_data = reinterpret_cast<const unsigned char*>(data);
+ m_data_size = dataSize;
+ }
+
+ t_size read(void * p_buffer,t_size p_bytes,abort_callback & p_abort) {
+ t_size delta = pfc::min_t(p_bytes, get_remaining());
+ memcpy(p_buffer,m_data+m_pointer,delta);
+ m_pointer += delta;
+ return delta;
+ }
+ void read_object(void * p_buffer,t_size p_bytes,abort_callback & p_abort) {
+ if (p_bytes > get_remaining()) throw exception_io_data_truncation();
+ memcpy(p_buffer,m_data+m_pointer,p_bytes);
+ m_pointer += p_bytes;
+ }
+ t_filesize skip(t_filesize p_bytes,abort_callback & p_abort) {
+ t_size remaining = get_remaining();
+ if (p_bytes >= remaining) {
+ m_pointer = m_data_size; return remaining;
+ } else {
+ m_pointer += (t_size)p_bytes; return p_bytes;
+ }
+ }
+ void skip_object(t_filesize p_bytes,abort_callback & p_abort) {
+ if (p_bytes > get_remaining()) {
+ throw exception_io_data_truncation();
+ } else {
+ m_pointer += (t_size)p_bytes;
+ }
+ }
+ void seek_(t_size offset) {
+ PFC_ASSERT( offset <= m_data_size );
+ m_pointer = offset;
+ }
+ const void * get_ptr_() const {return m_data + m_pointer;}
+ t_size get_remaining() const {return m_data_size - m_pointer;}
+ void reset() {m_pointer = 0;}
+private:
+ const unsigned char * m_data;
+ t_size m_data_size,m_pointer;
+};
+
+class stream_writer_buffer_simple : public stream_writer {
+public:
+ void write(const void * p_buffer,t_size p_bytes,abort_callback & p_abort) {
+ p_abort.check();
+ t_size base = m_buffer.get_size();
+ if (base + p_bytes < base) throw std::bad_alloc();
+ m_buffer.set_size(base + p_bytes);
+ memcpy( (t_uint8*) m_buffer.get_ptr() + base, p_buffer, p_bytes );
+ }
+
+ typedef pfc::array_t<t_uint8,pfc::alloc_fast> t_buffer;
+
+ pfc::array_t<t_uint8,pfc::alloc_fast> m_buffer;
+};
+
+template<class t_storage>
+class stream_writer_buffer_append_ref_t : public stream_writer
+{
+public:
+ stream_writer_buffer_append_ref_t(t_storage & p_output) : m_output(p_output) {}
+ void write(const void * p_buffer,t_size p_bytes,abort_callback & p_abort) {
+ PFC_STATIC_ASSERT( sizeof(m_output[0]) == 1 );
+ p_abort.check();
+ t_size base = m_output.get_size();
+ if (base + p_bytes < base) throw std::bad_alloc();
+ m_output.set_size(base + p_bytes);
+ memcpy( (t_uint8*) m_output.get_ptr() + base, p_buffer, p_bytes );
+ }
+private:
+ t_storage & m_output;
+};
+
+class stream_reader_limited_ref : public stream_reader {
+public:
+ stream_reader_limited_ref(stream_reader * p_reader,t_filesize p_limit) : m_reader(p_reader), m_remaining(p_limit) {}
+
+ t_size read(void * p_buffer,t_size p_bytes,abort_callback & p_abort) {
+ if (p_bytes > m_remaining) p_bytes = (t_size)m_remaining;
+
+ t_size done = m_reader->read(p_buffer,p_bytes,p_abort);
+ m_remaining -= done;
+ return done;
+ }
+
+ inline t_filesize get_remaining() const {return m_remaining;}
+
+ t_filesize skip(t_filesize p_bytes,abort_callback & p_abort) {
+ if (p_bytes > m_remaining) p_bytes = m_remaining;
+ t_filesize done = m_reader->skip(p_bytes,p_abort);
+ m_remaining -= done;
+ return done;
+ }
+
+ void flush_remaining(abort_callback & p_abort) {
+ if (m_remaining > 0) skip_object(m_remaining,p_abort);
+ }
+
+private:
+ stream_reader * m_reader;
+ t_filesize m_remaining;
+};
+
+class stream_writer_chunk_dwordheader : public stream_writer
+{
+public:
+ stream_writer_chunk_dwordheader(const service_ptr_t<file> & p_writer) : m_writer(p_writer) {}
+
+ void initialize(abort_callback & p_abort) {
+ m_headerposition = m_writer->get_position(p_abort);
+ m_written = 0;
+ m_writer->write_lendian_t((t_uint32)0,p_abort);
+ }
+
+ void finalize(abort_callback & p_abort) {
+ t_filesize end_offset;
+ end_offset = m_writer->get_position(p_abort);
+ m_writer->seek(m_headerposition,p_abort);
+ m_writer->write_lendian_t(pfc::downcast_guarded<t_uint32>(m_written),p_abort);
+ m_writer->seek(end_offset,p_abort);
+ }
+
+ void write(const void * p_buffer,t_size p_bytes,abort_callback & p_abort) {
+ m_writer->write(p_buffer,p_bytes,p_abort);
+ m_written += p_bytes;
+ }
+
+private:
+ service_ptr_t<file> m_writer;
+ t_filesize m_headerposition;
+ t_filesize m_written;
+};
+
+class stream_writer_chunk : public stream_writer
+{
+public:
+ stream_writer_chunk(stream_writer * p_writer) : m_writer(p_writer), m_buffer_state(0) {}
+
+ void write(const void * p_buffer,t_size p_bytes,abort_callback & p_abort);
+
+ void flush(abort_callback & p_abort);//must be called after writing before object is destroyed
+
+private:
+ stream_writer * m_writer;
+ unsigned m_buffer_state;
+ unsigned char m_buffer[255];
+};
+
+class stream_reader_chunk : public stream_reader
+{
+public:
+ stream_reader_chunk(stream_reader * p_reader) : m_reader(p_reader), m_buffer_state(0), m_buffer_size(0), m_eof(false) {}
+
+ t_size read(void * p_buffer,t_size p_bytes,abort_callback & p_abort);
+
+ void flush(abort_callback & p_abort);//must be called after reading before object is destroyed
+
+ static void g_skip(stream_reader * p_stream,abort_callback & p_abort);
+
+private:
+ stream_reader * m_reader;
+ t_size m_buffer_state, m_buffer_size;
+ bool m_eof;
+ unsigned char m_buffer[255];
+};
+
+class stream_reader_dummy : public stream_reader { t_size read(void * p_buffer,t_size p_bytes,abort_callback & p_abort) {return 0;} };
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+template<bool isBigEndian = false> class stream_reader_formatter {
+public:
+ stream_reader_formatter(stream_reader & p_stream,abort_callback & p_abort) : m_stream(p_stream), m_abort(p_abort) {}
+
+ template<typename t_int> void read_int(t_int & p_out) {
+ if (isBigEndian) m_stream.read_bendian_t(p_out,m_abort);
+ else m_stream.read_lendian_t(p_out,m_abort);
+ }
+
+ void read_raw(void * p_buffer,t_size p_bytes) {
+ m_stream.read_object(p_buffer,p_bytes,m_abort);
+ }
+
+ void skip(t_size p_bytes) {m_stream.skip_object(p_bytes,m_abort);}
+
+ template<typename TArray> void read_raw(TArray& data) {
+ pfc::assert_byte_type<typename TArray::t_item>();
+ read_raw(data.get_ptr(),data.get_size());
+ }
+ template<typename TArray> void read_byte_block(TArray & data) {
+ pfc::assert_byte_type<typename TArray::t_item>();
+ t_uint32 size; read_int(size); data.set_size(size);
+ read_raw(data);
+ }
+ template<typename TArray> void read_array(TArray & data) {
+ t_uint32 size; *this >> size; data.set_size(size);
+ for(t_uint32 walk = 0; walk < size; ++walk) *this >> data[walk];
+ }
+
+ stream_reader & m_stream;
+ abort_callback & m_abort;
+};
+
+template<bool isBigEndian = false> class stream_writer_formatter {
+public:
+ stream_writer_formatter(stream_writer & p_stream,abort_callback & p_abort) : m_stream(p_stream), m_abort(p_abort) {}
+
+ template<typename t_int> void write_int(t_int p_int) {
+ if (isBigEndian) m_stream.write_bendian_t(p_int,m_abort);
+ else m_stream.write_lendian_t(p_int,m_abort);
+ }
+
+ void write_raw(const void * p_buffer,t_size p_bytes) {
+ m_stream.write_object(p_buffer,p_bytes,m_abort);
+ }
+ template<typename TArray> void write_raw(const TArray& data) {
+ pfc::assert_byte_type<typename TArray::t_item>();
+ write_raw(data.get_ptr(),data.get_size());
+ }
+
+ template<typename TArray> void write_byte_block(const TArray& data) {
+ pfc::assert_byte_type<typename TArray::t_item>();
+ write_int( pfc::downcast_guarded<t_uint32>(data.get_size()) );
+ write_raw( data );
+ }
+ template<typename TArray> void write_array(const TArray& data) {
+ const t_uint32 size = pfc::downcast_guarded<t_uint32>(data.get_size());
+ *this << size;
+ for(t_uint32 walk = 0; walk < size; ++walk) *this << data[walk];
+ }
+
+ void write_string(const char * str) {
+ const t_size len = strlen(str);
+ *this << pfc::downcast_guarded<t_uint32>(len);
+ write_raw(str, len);
+ }
+ void write_string(const char * str, t_size len_) {
+ const t_size len = pfc::strlen_max(str, len_);
+ *this << pfc::downcast_guarded<t_uint32>(len);
+ write_raw(str, len);
+ }
+
+ stream_writer & m_stream;
+ abort_callback & m_abort;
+};
+
+#define __DECLARE_UINT_OVERLOADS(TYPE) \
+ template<bool isBigEndian> inline stream_reader_formatter<isBigEndian> & operator>>(stream_reader_formatter<isBigEndian> & p_stream,TYPE & p_int) {p_stream.read_int(p_int); return p_stream;} \
+ template<bool isBigEndian> inline stream_writer_formatter<isBigEndian> & operator<<(stream_writer_formatter<isBigEndian> & p_stream,TYPE p_int) {p_stream.write_int(p_int); return p_stream;}
+
+__DECLARE_UINT_OVERLOADS(t_uint8);
+__DECLARE_UINT_OVERLOADS(t_uint16);
+__DECLARE_UINT_OVERLOADS(t_uint32);
+__DECLARE_UINT_OVERLOADS(t_uint64);
+
+#ifdef _MSC_VER
+//SPECIAL FIX
+__DECLARE_UINT_OVERLOADS(unsigned long);
+#endif
+
+#undef __DECLARE_UINT_OVERLOADS
+
+#define __DECLARE_INT_OVERLOADS(TYPE) \
+ template<bool isBigEndian> inline stream_reader_formatter<isBigEndian> & operator>>(stream_reader_formatter<isBigEndian> & p_stream,TYPE & p_int) {typename pfc::sized_int_t<sizeof(TYPE)>::t_unsigned temp;p_stream.read_int(temp); p_int = (TYPE) temp; return p_stream;} \
+ template<bool isBigEndian> inline stream_writer_formatter<isBigEndian> & operator<<(stream_writer_formatter<isBigEndian> & p_stream,TYPE p_int) {p_stream.write_int((typename pfc::sized_int_t<sizeof(TYPE)>::t_unsigned)p_int); return p_stream;}
+
+__DECLARE_INT_OVERLOADS(t_int8);
+__DECLARE_INT_OVERLOADS(t_int16);
+__DECLARE_INT_OVERLOADS(t_int32);
+__DECLARE_INT_OVERLOADS(t_int64);
+
+#ifdef _MSC_VER
+//SPECIAL FIX
+__DECLARE_INT_OVERLOADS(long);
+#endif
+
+#undef __DECLARE_INT_OVERLOADS
+
+template<typename TVal> class __IsTypeByte {
+public:
+ enum {value = pfc::is_same_type<TVal,t_int8>::value || pfc::is_same_type<TVal,t_uint8>::value};
+};
+
+template<bool isBigEndian,typename TVal,size_t Count> stream_reader_formatter<isBigEndian> & operator>>(stream_reader_formatter<isBigEndian> & p_stream,TVal (& p_array)[Count]) {
+ if (__IsTypeByte<TVal>::value) {
+ p_stream.read_raw(p_array,Count);
+ } else {
+ for(t_size walk = 0; walk < Count; ++walk) p_stream >> p_array[walk];
+ }
+ return p_stream;
+}
+
+template<bool isBigEndian,typename TVal,size_t Count> stream_writer_formatter<isBigEndian> & operator<<(stream_writer_formatter<isBigEndian> & p_stream,TVal const (& p_array)[Count]) {
+ if (__IsTypeByte<TVal>::value) {
+ p_stream.write_raw(p_array,Count);
+ } else {
+ for(t_size walk = 0; walk < Count; ++walk) p_stream << p_array[walk];
+ }
+ return p_stream;
+}
+
+#define FB2K_STREAM_READER_OVERLOAD(type) \
+ template<bool isBigEndian> stream_reader_formatter<isBigEndian> & operator>>(stream_reader_formatter<isBigEndian> & stream,type & value)
+
+#define FB2K_STREAM_WRITER_OVERLOAD(type) \
+ template<bool isBigEndian> stream_writer_formatter<isBigEndian> & operator<<(stream_writer_formatter<isBigEndian> & stream,const type & value)
+
+FB2K_STREAM_READER_OVERLOAD(GUID) {
+ return stream >> value.Data1 >> value.Data2 >> value.Data3 >> value.Data4;
+}
+
+FB2K_STREAM_WRITER_OVERLOAD(GUID) {
+ return stream << value.Data1 << value.Data2 << value.Data3 << value.Data4;
+}
+
+FB2K_STREAM_READER_OVERLOAD(pfc::string) {
+ t_uint32 len; stream >> len;
+ value = stream.m_stream.read_string_ex(len,stream.m_abort);
+ return stream;
+}
+
+FB2K_STREAM_WRITER_OVERLOAD(pfc::string) {
+ stream << pfc::downcast_guarded<t_uint32>(value.length());
+ stream.write_raw(value.ptr(),value.length());
+ return stream;
+}
+
+FB2K_STREAM_READER_OVERLOAD(pfc::string_base) {
+ stream.m_stream.read_string(value, stream.m_abort);
+ return stream;
+}
+FB2K_STREAM_WRITER_OVERLOAD(pfc::string_base) {
+ const char * val = value.get_ptr();
+ const t_size len = strlen(val);
+ stream << pfc::downcast_guarded<t_uint32>(len);
+ stream.write_raw(val,len);
+ return stream;
+}
+
+
+FB2K_STREAM_WRITER_OVERLOAD(float) {
+ union {
+ float f; t_uint32 i;
+ } u; u.f = value;
+ return stream << u.i;
+}
+
+FB2K_STREAM_READER_OVERLOAD(float) {
+ union { float f; t_uint32 i;} u;
+ stream >> u.i; value = u.f;
+ return stream;
+}
+
+FB2K_STREAM_WRITER_OVERLOAD(double) {
+ union {
+ double f; t_uint64 i;
+ } u; u.f = value;
+ return stream << u.i;
+}
+
+FB2K_STREAM_READER_OVERLOAD(double) {
+ union { double f; t_uint64 i;} u;
+ stream >> u.i; value = u.f;
+ return stream;
+}
+
+FB2K_STREAM_WRITER_OVERLOAD(bool) {
+ t_uint8 temp = value ? 1 : 0;
+ return stream << temp;
+}
+FB2K_STREAM_READER_OVERLOAD(bool) {
+ t_uint8 temp; stream >> temp; value = temp != 0;
+ return stream;
+}
+
+template<bool BE = false>
+class stream_writer_formatter_simple : public stream_writer_formatter<BE> {
+public:
+ stream_writer_formatter_simple() : stream_writer_formatter(_m_stream,_m_abort), m_buffer(_m_stream.m_buffer) {}
+
+ typedef stream_writer_buffer_simple::t_buffer t_buffer;
+ t_buffer & m_buffer;
+private:
+ stream_writer_buffer_simple _m_stream;
+ abort_callback_dummy _m_abort;
+};
+
+template<bool BE = false>
+class stream_reader_formatter_simple_ref : public stream_reader_formatter<BE> {
+public:
+ stream_reader_formatter_simple_ref(const void * source, t_size sourceSize) : stream_reader_formatter(_m_stream,_m_abort), _m_stream(source,sourceSize) {}
+ template<typename TSource> stream_reader_formatter_simple_ref(const TSource& source) : stream_reader_formatter(_m_stream,_m_abort), _m_stream(source) {}
+ stream_reader_formatter_simple_ref() : stream_reader_formatter(_m_stream,_m_abort) {}
+
+ void set_data(const void * source, t_size sourceSize) {_m_stream.set_data(source,sourceSize);}
+ template<typename TSource> void set_data(const TSource & source) {_m_stream.set_data(source);}
+
+ void reset() {_m_stream.reset();}
+ t_size get_remaining() {return _m_stream.get_remaining();}
+
+ const void * get_ptr_() const {return _m_stream.get_ptr_();}
+private:
+ stream_reader_memblock_ref _m_stream;
+ abort_callback_dummy _m_abort;
+};
+
+template<bool BE = false>
+class stream_reader_formatter_simple : public stream_reader_formatter_simple_ref<BE> {
+public:
+ stream_reader_formatter_simple() {}
+ stream_reader_formatter_simple(const void * source, t_size sourceSize) {set_data(source,sourceSize);}
+ template<typename TSource> stream_reader_formatter_simple(const TSource & source) {set_data(source);}
+
+ void set_data(const void * source, t_size sourceSize) {
+ m_content.set_data_fromptr(reinterpret_cast<const t_uint8*>(source), sourceSize);
+ onContentChange();
+ }
+ template<typename TSource> void set_data(const TSource & source) {
+ m_content = source;
+ onContentChange();
+ }
+private:
+ void onContentChange() {
+ stream_reader_formatter_simple_ref<BE>::set_data(m_content);
+ }
+ pfc::array_t<t_uint8> m_content;
+};
+
+
+
+
+
+
+template<bool isBigEndian> class _stream_reader_formatter_translator {
+public:
+ _stream_reader_formatter_translator(stream_reader_formatter<isBigEndian> & stream) : m_stream(stream) {}
+ typedef _stream_reader_formatter_translator<isBigEndian> t_self;
+ template<typename t_what> t_self & operator||(t_what & out) {m_stream >> out; return *this;}
+private:
+ stream_reader_formatter<isBigEndian> & m_stream;
+};
+template<bool isBigEndian> class _stream_writer_formatter_translator {
+public:
+ _stream_writer_formatter_translator(stream_writer_formatter<isBigEndian> & stream) : m_stream(stream) {}
+ typedef _stream_writer_formatter_translator<isBigEndian> t_self;
+ template<typename t_what> t_self & operator||(const t_what & in) {m_stream << in; return *this;}
+private:
+ stream_writer_formatter<isBigEndian> & m_stream;
+};
+
+#define FB2K_STREAM_RECORD_OVERLOAD(type, code) \
+ FB2K_STREAM_READER_OVERLOAD(type) { \
+ _stream_reader_formatter_translator<isBigEndian> streamEx(stream); \
+ streamEx || code; \
+ return stream; \
+ } \
+ FB2K_STREAM_WRITER_OVERLOAD(type) { \
+ _stream_writer_formatter_translator<isBigEndian> streamEx(stream); \
+ streamEx || code; \
+ return stream; \
+ }
+
+
+
+
+#define FB2K_RETRY_ON_SHARING_VIOLATION(OP, ABORT, TIMEOUT) \
+ { \
+ pfc::lores_timer timer; timer.start(); \
+ for (;;) try { {OP;} break; } catch(exception_io_sharing_violation) { if (timer.query() > TIMEOUT) throw; ABORT.sleep(0.01); } \
+ }
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/foobar2000.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/foobar2000.h new file mode 100644 index 0000000000..09e27977b8 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/foobar2000.h @@ -0,0 +1,105 @@ +// This is the master foobar2000 SDK header file; it includes headers for all functionality exposed through the SDK project. #include this in your source code, never reference any of the other headers directly.
+
+#ifndef _FOOBAR2000_H_
+#define _FOOBAR2000_H_
+
+#ifndef UNICODE
+#error Only UNICODE environment supported.
+#endif
+
+// #define FOOBAR2000_TARGET_VERSION 75 // 0.9.6
+#define FOOBAR2000_TARGET_VERSION 76 // 1.0
+
+#include "../../pfc/pfc.h"
+
+#include "../shared/shared.h"
+
+#ifndef NOTHROW
+#ifdef _MSC_VER
+#define NOTHROW __declspec(nothrow)
+#else
+#define NOTHROW
+#endif
+#endif
+
+#define FB2KAPI /*NOTHROW*/
+
+typedef const char * pcchar;
+
+#include "core_api.h"
+#include "service.h"
+
+#include "completion_notify.h"
+#include "abort_callback.h"
+#include "componentversion.h"
+#include "preferences_page.h"
+#include "coreversion.h"
+#include "filesystem.h"
+#include "audio_chunk.h"
+#include "cfg_var.h"
+#include "mem_block_container.h"
+#include "audio_postprocessor.h"
+#include "playable_location.h"
+#include "file_info.h"
+#include "file_info_impl.h"
+#include "hasher_md5.h"
+#include "metadb_handle.h"
+#include "metadb.h"
+#include "console.h"
+#include "dsp.h"
+#include "dsp_manager.h"
+#include "initquit.h"
+#include "event_logger.h"
+#include "input.h"
+#include "input_impl.h"
+#include "menu.h"
+#include "contextmenu.h"
+#include "contextmenu_manager.h"
+#include "menu_helpers.h"
+#include "modeless_dialog.h"
+#include "playback_control.h"
+#include "play_callback.h"
+#include "playlist.h"
+#include "playlist_loader.h"
+#include "replaygain.h"
+#include "resampler.h"
+#include "tag_processor.h"
+#include "titleformat.h"
+#include "ui.h"
+#include "unpack.h"
+#include "vis.h"
+#include "packet_decoder.h"
+#include "commandline.h"
+#include "genrand.h"
+#include "file_operation_callback.h"
+#include "library_manager.h"
+#include "config_io_callback.h"
+#include "popup_message.h"
+#include "app_close_blocker.h"
+#include "config_object.h"
+#include "config_object_impl.h"
+#include "threaded_process.h"
+#include "message_loop.h"
+#include "input_file_type.h"
+#include "chapterizer.h"
+#include "link_resolver.h"
+#include "main_thread_callback.h"
+#include "advconfig.h"
+#include "info_lookup_handler.h"
+#include "track_property.h"
+
+#include "album_art.h"
+#include "icon_remap.h"
+#include "ui_element.h"
+#include "ole_interaction.h"
+#include "search_tools.h"
+#include "autoplaylist.h"
+#include "replaygain_scanner.h"
+#include "ui_edit_context.h"
+
+#include "system_time_keeper.h"
+#include "playback_stream_capture.h"
+#include "http_client.h"
+#include "exceptions.h"
+
+#endif //_FOOBAR2000_H_
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/foobar2000_12.vcxproj.filters b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/foobar2000_12.vcxproj.filters new file mode 100644 index 0000000000..0c1d438ba9 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/foobar2000_12.vcxproj.filters @@ -0,0 +1,395 @@ +<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{11712814-7256-45e1-a33b-02666d462471}</UniqueIdentifier>
+ <Extensions>*.h</Extensions>
+ </Filter>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{24bc61a9-ecc2-4020-85c6-2a2976241224}</UniqueIdentifier>
+ <Extensions>*.cpp</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="abort_callback.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="advconfig.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="album_art.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="app_close_blocker.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="audio_chunk.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="audio_postprocessor.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="autoplaylist.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="cfg_var.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="chapterizer.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="commandline.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="completion_notify.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="component.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="componentversion.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="config_io_callback.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="config_object.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="config_object_impl.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="console.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="contextmenu.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="contextmenu_manager.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="core_api.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="coreversion.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="dsp.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="dsp_manager.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="event_logger.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="exceptions.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="file_info.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="file_info_impl.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="file_operation_callback.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="filesystem.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="filesystem_helper.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="foobar2000.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="genrand.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="hasher_md5.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="http_client.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="icon_remap.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="info_lookup_handler.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="initquit.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="input.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="input_file_type.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="input_impl.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="library_manager.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="link_resolver.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="main_thread_callback.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="mem_block_container.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="menu.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="menu_helpers.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="message_loop.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="metadb.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="metadb_handle.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="modeless_dialog.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="ole_interaction.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="packet_decoder.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="play_callback.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="playable_location.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="playback_control.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="playback_stream_capture.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="playlist.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="playlist_loader.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="popup_message.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="preferences_page.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="replaygain.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="replaygain_scanner.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="resampler.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="search_tools.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="service.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="service_impl.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="system_time_keeper.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="tag_processor.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="threaded_process.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="titleformat.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="track_property.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="ui.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="ui_edit_context.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="ui_element.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="unpack.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="vis.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="abort_callback.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="advconfig.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="album_art.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="app_close_blocker.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="audio_chunk.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="audio_chunk_channel_config.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="cfg_var.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="chapterizer.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="commandline.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="completion_notify.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="config_object.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="console.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="dsp.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="dsp_manager.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="file_info.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="file_info_impl.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="file_info_merge.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="file_operation_callback.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="filesystem.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="filesystem_helper.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="guids.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="hasher_md5.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="input.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="input_file_type.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="link_resolver.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="mainmenu.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="mem_block_container.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="menu_helpers.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="menu_item.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="menu_manager.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="metadb.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="metadb_handle.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="metadb_handle_list.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="packet_decoder.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="playable_location.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="playback_control.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="playlist.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="playlist_loader.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="popup_message.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="preferences_page.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="replaygain.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="replaygain_info.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="service.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="stdafx.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="tag_processor.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="tag_processor_id3v2.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="threaded_process.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="titleformat.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="ui.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="ui_element.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ </ItemGroup>
+</Project>
\ No newline at end of file diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/foobar2000_SDK_10.vcxproj b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/foobar2000_SDK_10.vcxproj new file mode 100644 index 0000000000..4d4e508130 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/foobar2000_SDK_10.vcxproj @@ -0,0 +1,341 @@ +<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{E8091321-D79D-4575-86EF-064EA1A4A20D}</ProjectGuid>
+ <RootNamespace>foobar2000_SDK</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <UseOfMfc>false</UseOfMfc>
+ <CharacterSet>Unicode</CharacterSet>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <UseOfMfc>false</UseOfMfc>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup>
+ <_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\Obj\$(ProjectName)\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\Obj\$(ProjectName)\</IntDir>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\Obj\$(ProjectName)\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\Obj\$(ProjectName)\</IntDir>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>_DEBUG;_WINDOWS;_WIN32_WINNT=0x501;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <PrecompiledHeader>Use</PrecompiledHeader>
+ <PrecompiledHeaderFile>foobar2000.h</PrecompiledHeaderFile>
+ <WarningLevel>Level3</WarningLevel>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <Culture>0x0409</Culture>
+ </ResourceCompile>
+ <Lib>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ </Lib>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <Optimization>MinSpace</Optimization>
+ <PreprocessorDefinitions>NDEBUG;_WINDOWS;_WIN32_WINNT=0x501;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <StringPooling>true</StringPooling>
+ <BufferSecurityCheck>false</BufferSecurityCheck>
+ <FloatingPointModel>Fast</FloatingPointModel>
+ <RuntimeTypeInfo>false</RuntimeTypeInfo>
+ <PrecompiledHeader>Use</PrecompiledHeader>
+ <PrecompiledHeaderFile>foobar2000.h</PrecompiledHeaderFile>
+ <WarningLevel>Level3</WarningLevel>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <Culture>0x0409</Culture>
+ </ResourceCompile>
+ <Lib>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ </Lib>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClInclude Include="abort_callback.h" />
+ <ClInclude Include="advconfig.h" />
+ <ClInclude Include="album_art.h" />
+ <ClInclude Include="app_close_blocker.h" />
+ <ClInclude Include="audio_chunk.h" />
+ <ClInclude Include="audio_postprocessor.h" />
+ <ClInclude Include="autoplaylist.h" />
+ <ClInclude Include="cfg_var.h" />
+ <ClInclude Include="chapterizer.h" />
+ <ClInclude Include="commandline.h" />
+ <ClInclude Include="completion_notify.h" />
+ <ClInclude Include="component.h" />
+ <ClInclude Include="componentversion.h" />
+ <ClInclude Include="config_io_callback.h" />
+ <ClInclude Include="config_object.h" />
+ <ClInclude Include="config_object_impl.h" />
+ <ClInclude Include="console.h" />
+ <ClInclude Include="contextmenu.h" />
+ <ClInclude Include="contextmenu_manager.h" />
+ <ClInclude Include="core_api.h" />
+ <ClInclude Include="coreversion.h" />
+ <ClInclude Include="dsp.h" />
+ <ClInclude Include="dsp_manager.h" />
+ <ClInclude Include="event_logger.h" />
+ <ClInclude Include="exceptions.h" />
+ <ClInclude Include="file_info.h" />
+ <ClInclude Include="file_info_impl.h" />
+ <ClInclude Include="file_operation_callback.h" />
+ <ClInclude Include="filesystem.h" />
+ <ClInclude Include="filesystem_helper.h" />
+ <ClInclude Include="foobar2000.h" />
+ <ClInclude Include="genrand.h" />
+ <ClInclude Include="hasher_md5.h" />
+ <ClInclude Include="http_client.h" />
+ <ClInclude Include="icon_remap.h" />
+ <ClInclude Include="info_lookup_handler.h" />
+ <ClInclude Include="initquit.h" />
+ <ClInclude Include="input.h" />
+ <ClInclude Include="input_file_type.h" />
+ <ClInclude Include="input_impl.h" />
+ <ClInclude Include="library_manager.h" />
+ <ClInclude Include="link_resolver.h" />
+ <ClInclude Include="main_thread_callback.h" />
+ <ClInclude Include="mem_block_container.h" />
+ <ClInclude Include="menu.h" />
+ <ClInclude Include="menu_helpers.h" />
+ <ClInclude Include="message_loop.h" />
+ <ClInclude Include="metadb.h" />
+ <ClInclude Include="metadb_handle.h" />
+ <ClInclude Include="modeless_dialog.h" />
+ <ClInclude Include="ole_interaction.h" />
+ <ClInclude Include="packet_decoder.h" />
+ <ClInclude Include="play_callback.h" />
+ <ClInclude Include="playable_location.h" />
+ <ClInclude Include="playback_control.h" />
+ <ClInclude Include="playback_stream_capture.h" />
+ <ClInclude Include="playlist.h" />
+ <ClInclude Include="playlist_loader.h" />
+ <ClInclude Include="popup_message.h" />
+ <ClInclude Include="preferences_page.h" />
+ <ClInclude Include="replaygain.h" />
+ <ClInclude Include="replaygain_scanner.h" />
+ <ClInclude Include="resampler.h" />
+ <ClInclude Include="search_tools.h" />
+ <ClInclude Include="service.h" />
+ <ClInclude Include="service_impl.h" />
+ <ClInclude Include="system_time_keeper.h" />
+ <ClInclude Include="tag_processor.h" />
+ <ClInclude Include="threaded_process.h" />
+ <ClInclude Include="titleformat.h" />
+ <ClInclude Include="track_property.h" />
+ <ClInclude Include="ui.h" />
+ <ClInclude Include="ui_edit_context.h" />
+ <ClInclude Include="ui_element.h" />
+ <ClInclude Include="unpack.h" />
+ <ClInclude Include="vis.h" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="abort_callback.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="advconfig.cpp" />
+ <ClCompile Include="album_art.cpp" />
+ <ClCompile Include="app_close_blocker.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="audio_chunk.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="audio_chunk_channel_config.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="cfg_var.cpp" />
+ <ClCompile Include="chapterizer.cpp" />
+ <ClCompile Include="commandline.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="completion_notify.cpp" />
+ <ClCompile Include="config_object.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="console.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="dsp.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="dsp_manager.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="file_info.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="file_info_impl.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="file_info_merge.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="file_operation_callback.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="filesystem.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="filesystem_helper.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="guids.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="hasher_md5.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="input.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="input_file_type.cpp" />
+ <ClCompile Include="link_resolver.cpp" />
+ <ClCompile Include="mainmenu.cpp" />
+ <ClCompile Include="mem_block_container.cpp" />
+ <ClCompile Include="menu_helpers.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="menu_item.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="menu_manager.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="metadb.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="metadb_handle.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="metadb_handle_list.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="packet_decoder.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="playable_location.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="playback_control.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="playlist.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="playlist_loader.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="popup_message.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="preferences_page.cpp" />
+ <ClCompile Include="replaygain.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="replaygain_info.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="service.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="stdafx.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
+ </ClCompile>
+ <ClCompile Include="tag_processor.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="tag_processor_id3v2.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="threaded_process.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="titleformat.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="ui.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="ui_element.cpp" />
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
\ No newline at end of file diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/foobar2000_SDK_10.vcxproj.filters b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/foobar2000_SDK_10.vcxproj.filters new file mode 100644 index 0000000000..0c1d438ba9 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/foobar2000_SDK_10.vcxproj.filters @@ -0,0 +1,395 @@ +<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{11712814-7256-45e1-a33b-02666d462471}</UniqueIdentifier>
+ <Extensions>*.h</Extensions>
+ </Filter>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{24bc61a9-ecc2-4020-85c6-2a2976241224}</UniqueIdentifier>
+ <Extensions>*.cpp</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="abort_callback.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="advconfig.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="album_art.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="app_close_blocker.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="audio_chunk.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="audio_postprocessor.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="autoplaylist.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="cfg_var.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="chapterizer.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="commandline.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="completion_notify.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="component.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="componentversion.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="config_io_callback.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="config_object.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="config_object_impl.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="console.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="contextmenu.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="contextmenu_manager.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="core_api.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="coreversion.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="dsp.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="dsp_manager.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="event_logger.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="exceptions.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="file_info.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="file_info_impl.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="file_operation_callback.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="filesystem.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="filesystem_helper.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="foobar2000.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="genrand.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="hasher_md5.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="http_client.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="icon_remap.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="info_lookup_handler.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="initquit.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="input.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="input_file_type.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="input_impl.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="library_manager.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="link_resolver.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="main_thread_callback.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="mem_block_container.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="menu.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="menu_helpers.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="message_loop.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="metadb.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="metadb_handle.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="modeless_dialog.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="ole_interaction.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="packet_decoder.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="play_callback.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="playable_location.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="playback_control.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="playback_stream_capture.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="playlist.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="playlist_loader.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="popup_message.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="preferences_page.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="replaygain.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="replaygain_scanner.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="resampler.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="search_tools.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="service.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="service_impl.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="system_time_keeper.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="tag_processor.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="threaded_process.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="titleformat.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="track_property.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="ui.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="ui_edit_context.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="ui_element.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="unpack.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="vis.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="abort_callback.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="advconfig.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="album_art.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="app_close_blocker.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="audio_chunk.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="audio_chunk_channel_config.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="cfg_var.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="chapterizer.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="commandline.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="completion_notify.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="config_object.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="console.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="dsp.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="dsp_manager.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="file_info.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="file_info_impl.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="file_info_merge.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="file_operation_callback.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="filesystem.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="filesystem_helper.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="guids.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="hasher_md5.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="input.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="input_file_type.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="link_resolver.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="mainmenu.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="mem_block_container.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="menu_helpers.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="menu_item.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="menu_manager.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="metadb.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="metadb_handle.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="metadb_handle_list.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="packet_decoder.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="playable_location.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="playback_control.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="playlist.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="playlist_loader.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="popup_message.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="preferences_page.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="replaygain.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="replaygain_info.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="service.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="stdafx.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="tag_processor.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="tag_processor_id3v2.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="threaded_process.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="titleformat.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="ui.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="ui_element.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ </ItemGroup>
+</Project>
\ No newline at end of file diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/foobar2000_SDK_12.vcxproj b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/foobar2000_SDK_12.vcxproj new file mode 100644 index 0000000000..b0525c2697 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/foobar2000_SDK_12.vcxproj @@ -0,0 +1,341 @@ +<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{E8091321-D79D-4575-86EF-064EA1A4A20D}</ProjectGuid>
+ <RootNamespace>foobar2000_SDK</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <UseOfMfc>false</UseOfMfc>
+ <CharacterSet>Unicode</CharacterSet>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <UseOfMfc>false</UseOfMfc>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup>
+ <_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\Obj\$(ProjectName)\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\Obj\$(ProjectName)\</IntDir>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\Obj\$(ProjectName)\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\Obj\$(ProjectName)\</IntDir>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>_DEBUG;_WINDOWS;_WIN32_WINNT=0x501;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <PrecompiledHeader>Use</PrecompiledHeader>
+ <PrecompiledHeaderFile>foobar2000.h</PrecompiledHeaderFile>
+ <WarningLevel>Level3</WarningLevel>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <Culture>0x0409</Culture>
+ </ResourceCompile>
+ <Lib>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ </Lib>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <Optimization>MinSpace</Optimization>
+ <PreprocessorDefinitions>NDEBUG;_WINDOWS;_WIN32_WINNT=0x501;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <StringPooling>true</StringPooling>
+ <BufferSecurityCheck>false</BufferSecurityCheck>
+ <FloatingPointModel>Fast</FloatingPointModel>
+ <RuntimeTypeInfo>false</RuntimeTypeInfo>
+ <PrecompiledHeader>Use</PrecompiledHeader>
+ <PrecompiledHeaderFile>foobar2000.h</PrecompiledHeaderFile>
+ <WarningLevel>Level3</WarningLevel>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <Culture>0x0409</Culture>
+ </ResourceCompile>
+ <Lib>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ </Lib>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClInclude Include="abort_callback.h" />
+ <ClInclude Include="advconfig.h" />
+ <ClInclude Include="album_art.h" />
+ <ClInclude Include="app_close_blocker.h" />
+ <ClInclude Include="audio_chunk.h" />
+ <ClInclude Include="audio_postprocessor.h" />
+ <ClInclude Include="autoplaylist.h" />
+ <ClInclude Include="cfg_var.h" />
+ <ClInclude Include="chapterizer.h" />
+ <ClInclude Include="commandline.h" />
+ <ClInclude Include="completion_notify.h" />
+ <ClInclude Include="component.h" />
+ <ClInclude Include="componentversion.h" />
+ <ClInclude Include="config_io_callback.h" />
+ <ClInclude Include="config_object.h" />
+ <ClInclude Include="config_object_impl.h" />
+ <ClInclude Include="console.h" />
+ <ClInclude Include="contextmenu.h" />
+ <ClInclude Include="contextmenu_manager.h" />
+ <ClInclude Include="core_api.h" />
+ <ClInclude Include="coreversion.h" />
+ <ClInclude Include="dsp.h" />
+ <ClInclude Include="dsp_manager.h" />
+ <ClInclude Include="event_logger.h" />
+ <ClInclude Include="exceptions.h" />
+ <ClInclude Include="file_info.h" />
+ <ClInclude Include="file_info_impl.h" />
+ <ClInclude Include="file_operation_callback.h" />
+ <ClInclude Include="filesystem.h" />
+ <ClInclude Include="filesystem_helper.h" />
+ <ClInclude Include="foobar2000.h" />
+ <ClInclude Include="genrand.h" />
+ <ClInclude Include="hasher_md5.h" />
+ <ClInclude Include="http_client.h" />
+ <ClInclude Include="icon_remap.h" />
+ <ClInclude Include="info_lookup_handler.h" />
+ <ClInclude Include="initquit.h" />
+ <ClInclude Include="input.h" />
+ <ClInclude Include="input_file_type.h" />
+ <ClInclude Include="input_impl.h" />
+ <ClInclude Include="library_manager.h" />
+ <ClInclude Include="link_resolver.h" />
+ <ClInclude Include="main_thread_callback.h" />
+ <ClInclude Include="mem_block_container.h" />
+ <ClInclude Include="menu.h" />
+ <ClInclude Include="menu_helpers.h" />
+ <ClInclude Include="message_loop.h" />
+ <ClInclude Include="metadb.h" />
+ <ClInclude Include="metadb_handle.h" />
+ <ClInclude Include="modeless_dialog.h" />
+ <ClInclude Include="ole_interaction.h" />
+ <ClInclude Include="packet_decoder.h" />
+ <ClInclude Include="play_callback.h" />
+ <ClInclude Include="playable_location.h" />
+ <ClInclude Include="playback_control.h" />
+ <ClInclude Include="playback_stream_capture.h" />
+ <ClInclude Include="playlist.h" />
+ <ClInclude Include="playlist_loader.h" />
+ <ClInclude Include="popup_message.h" />
+ <ClInclude Include="preferences_page.h" />
+ <ClInclude Include="replaygain.h" />
+ <ClInclude Include="replaygain_scanner.h" />
+ <ClInclude Include="resampler.h" />
+ <ClInclude Include="search_tools.h" />
+ <ClInclude Include="service.h" />
+ <ClInclude Include="service_impl.h" />
+ <ClInclude Include="system_time_keeper.h" />
+ <ClInclude Include="tag_processor.h" />
+ <ClInclude Include="threaded_process.h" />
+ <ClInclude Include="titleformat.h" />
+ <ClInclude Include="track_property.h" />
+ <ClInclude Include="ui.h" />
+ <ClInclude Include="ui_edit_context.h" />
+ <ClInclude Include="ui_element.h" />
+ <ClInclude Include="unpack.h" />
+ <ClInclude Include="vis.h" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="abort_callback.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="advconfig.cpp" />
+ <ClCompile Include="album_art.cpp" />
+ <ClCompile Include="app_close_blocker.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="audio_chunk.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="audio_chunk_channel_config.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="cfg_var.cpp" />
+ <ClCompile Include="chapterizer.cpp" />
+ <ClCompile Include="commandline.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="completion_notify.cpp" />
+ <ClCompile Include="config_object.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="console.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="dsp.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="dsp_manager.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="file_info.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="file_info_impl.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="file_info_merge.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="file_operation_callback.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="filesystem.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="filesystem_helper.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="guids.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="hasher_md5.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="input.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="input_file_type.cpp" />
+ <ClCompile Include="link_resolver.cpp" />
+ <ClCompile Include="mainmenu.cpp" />
+ <ClCompile Include="mem_block_container.cpp" />
+ <ClCompile Include="menu_helpers.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="menu_item.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="menu_manager.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="metadb.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="metadb_handle.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="metadb_handle_list.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="packet_decoder.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="playable_location.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="playback_control.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="playlist.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="playlist_loader.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="popup_message.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="preferences_page.cpp" />
+ <ClCompile Include="replaygain.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="replaygain_info.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="service.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="stdafx.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
+ </ClCompile>
+ <ClCompile Include="tag_processor.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="tag_processor_id3v2.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="threaded_process.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="titleformat.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="ui.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="ui_element.cpp" />
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
\ No newline at end of file diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/foobar2000_SDK_12.vcxproj.filters b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/foobar2000_SDK_12.vcxproj.filters new file mode 100644 index 0000000000..0c1d438ba9 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/foobar2000_SDK_12.vcxproj.filters @@ -0,0 +1,395 @@ +<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{11712814-7256-45e1-a33b-02666d462471}</UniqueIdentifier>
+ <Extensions>*.h</Extensions>
+ </Filter>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{24bc61a9-ecc2-4020-85c6-2a2976241224}</UniqueIdentifier>
+ <Extensions>*.cpp</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="abort_callback.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="advconfig.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="album_art.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="app_close_blocker.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="audio_chunk.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="audio_postprocessor.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="autoplaylist.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="cfg_var.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="chapterizer.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="commandline.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="completion_notify.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="component.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="componentversion.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="config_io_callback.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="config_object.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="config_object_impl.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="console.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="contextmenu.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="contextmenu_manager.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="core_api.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="coreversion.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="dsp.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="dsp_manager.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="event_logger.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="exceptions.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="file_info.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="file_info_impl.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="file_operation_callback.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="filesystem.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="filesystem_helper.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="foobar2000.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="genrand.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="hasher_md5.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="http_client.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="icon_remap.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="info_lookup_handler.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="initquit.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="input.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="input_file_type.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="input_impl.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="library_manager.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="link_resolver.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="main_thread_callback.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="mem_block_container.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="menu.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="menu_helpers.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="message_loop.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="metadb.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="metadb_handle.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="modeless_dialog.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="ole_interaction.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="packet_decoder.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="play_callback.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="playable_location.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="playback_control.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="playback_stream_capture.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="playlist.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="playlist_loader.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="popup_message.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="preferences_page.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="replaygain.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="replaygain_scanner.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="resampler.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="search_tools.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="service.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="service_impl.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="system_time_keeper.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="tag_processor.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="threaded_process.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="titleformat.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="track_property.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="ui.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="ui_edit_context.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="ui_element.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="unpack.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="vis.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="abort_callback.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="advconfig.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="album_art.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="app_close_blocker.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="audio_chunk.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="audio_chunk_channel_config.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="cfg_var.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="chapterizer.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="commandline.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="completion_notify.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="config_object.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="console.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="dsp.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="dsp_manager.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="file_info.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="file_info_impl.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="file_info_merge.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="file_operation_callback.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="filesystem.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="filesystem_helper.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="guids.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="hasher_md5.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="input.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="input_file_type.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="link_resolver.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="mainmenu.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="mem_block_container.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="menu_helpers.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="menu_item.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="menu_manager.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="metadb.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="metadb_handle.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="metadb_handle_list.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="packet_decoder.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="playable_location.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="playback_control.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="playlist.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="playlist_loader.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="popup_message.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="preferences_page.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="replaygain.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="replaygain_info.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="service.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="stdafx.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="tag_processor.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="tag_processor_id3v2.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="threaded_process.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="titleformat.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="ui.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="ui_element.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ </ItemGroup>
+</Project>
\ No newline at end of file diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/genrand.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/genrand.h new file mode 100644 index 0000000000..04b35c17c1 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/genrand.h @@ -0,0 +1,19 @@ +//! PRNG service. Implemented by the core, do not reimplement. Use g_create() helper function to instantiate.
+class NOVTABLE genrand_service : public service_base
+{
+public:
+ //! Seeds the PRNG with specified value.
+ virtual void seed(unsigned val) = 0;
+ //! Returns random value N, where 0 <= N < range.
+ virtual unsigned genrand(unsigned range)=0;
+
+ static service_ptr_t<genrand_service> g_create() {return standard_api_create_t<genrand_service>();}
+
+ void generate_random_order(t_size * out, t_size count) {
+ t_size n;
+ for(n=0;n<count;n++) out[n]=n;
+ for(n=0;n<count;n++) pfc::swap_t(out[n],out[genrand(count)]);
+ }
+
+ FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(genrand_service);
+};
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/guids.cpp b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/guids.cpp new file mode 100644 index 0000000000..53bcd55c57 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/guids.cpp @@ -0,0 +1,1174 @@ +#include "foobar2000.h"
+
+// {4B897EC8-A2F9-478d-A95E-1A2110A40078}
+FOOGUIDDECL const GUID hasher_md5::class_guid =
+{ 0x4b897ec8, 0xa2f9, 0x478d, { 0xa9, 0x5e, 0x1a, 0x21, 0x10, 0xa4, 0x0, 0x78 } };
+
+// {74497D81-6158-48ba-9657-386A5520D0FF}
+FOOGUIDDECL const GUID config_io_callback::class_guid =
+{ 0x74497d81, 0x6158, 0x48ba, { 0x96, 0x57, 0x38, 0x6a, 0x55, 0x20, 0xd0, 0xff } };
+
+// {10BB3EBD-DDF7-4975-A3CC-23084829453E}
+FOOGUIDDECL const GUID componentversion::class_guid =
+{ 0x10bb3ebd, 0xddf7, 0x4975, { 0xa3, 0xcc, 0x23, 0x8, 0x48, 0x29, 0x45, 0x3e } };
+
+// {7255E8D0-3FCF-4781-B93B-D06CB88DFAFA}
+FOOGUIDDECL const GUID preferences_page::class_guid =
+{ 0x7255e8d0, 0x3fcf, 0x4781, { 0xb9, 0x3b, 0xd0, 0x6c, 0xb8, 0x8d, 0xfa, 0xfa } };
+
+// {8146A883-F146-401b-BAF6-4FB2E306F2EB}
+FOOGUIDDECL const GUID preferences_branch::class_guid =
+{ 0x8146a883, 0xf146, 0x401b, { 0xba, 0xf6, 0x4f, 0xb2, 0xe3, 0x6, 0xf2, 0xeb } };
+
+// {90DF5270-65BB-4dba-BAF5-86BE9E59DC20}
+FOOGUIDDECL const GUID console_receiver::class_guid =
+{ 0x90df5270, 0x65bb, 0x4dba, { 0xba, 0xf5, 0x86, 0xbe, 0x9e, 0x59, 0xdc, 0x20 } };
+
+// {0C36A649-9EA0-4f48-B229-0CB2AA9AB6F4}
+FOOGUIDDECL const GUID core_version_info::class_guid =
+{ 0xc36a649, 0x9ea0, 0x4f48, { 0xb2, 0x29, 0xc, 0xb2, 0xaa, 0x9a, 0xb6, 0xf4 } };
+
+// {61C4E6E4-C31E-4c89-A759-BF0949DFC528}
+FOOGUIDDECL const GUID audio_postprocessor::class_guid =
+{ 0x61c4e6e4, 0xc31e, 0x4c89, { 0xa7, 0x59, 0xbf, 0x9, 0x49, 0xdf, 0xc5, 0x28 } };
+
+// {EE65D408-70D6-40f6-940D-D9F537F1BEF1}
+FOOGUIDDECL const GUID dsp_config_manager::class_guid =
+{ 0xee65d408, 0x70d6, 0x40f6, { 0x94, 0xd, 0xd9, 0xf5, 0x37, 0xf1, 0xbe, 0xf1 } };
+
+// {F8F03D26-C2DA-47ed-8748-1DBACBCEA508}
+FOOGUIDDECL const GUID dsp_config_callback::class_guid =
+{ 0xf8f03d26, 0xc2da, 0x47ed, { 0x87, 0x48, 0x1d, 0xba, 0xcb, 0xce, 0xa5, 0x8 } };
+
+// {0D048731-8AA8-4704-8AD6-189E24D48C88}
+FOOGUIDDECL const GUID dsp_entry::class_guid =
+{ 0xd048731, 0x8aa8, 0x4704, { 0x8a, 0xd6, 0x18, 0x9e, 0x24, 0xd4, 0x8c, 0x88 } };
+
+// {2A42AFEA-940B-455b-AEFF-CFDACAF52AFF}
+FOOGUIDDECL const GUID dsp::class_guid =
+{ 0x2a42afea, 0x940b, 0x455b, { 0xae, 0xff, 0xcf, 0xda, 0xca, 0xf5, 0x2a, 0xff } };
+
+// {113773C4-B387-4b48-8BDF-AB58BC6CE538}
+FOOGUIDDECL const GUID initquit::class_guid =
+{ 0x113773c4, 0xb387, 0x4b48, { 0x8b, 0xdf, 0xab, 0x58, 0xbc, 0x6c, 0xe5, 0x38 } };
+
+FOOGUIDDECL const GUID metadb_display_field_provider::class_guid = { 0x5923fa2a, 0x504b, 0x4022, { 0xb2, 0x86, 0x0, 0x22, 0x75, 0x38, 0x45, 0x5e } };
+
+// {609D48C8-C6A6-4784-8BBD-FDD32BF0740E}
+FOOGUIDDECL const GUID metadb::class_guid =
+{ 0x609d48c8, 0xc6a6, 0x4784, { 0x8b, 0xbd, 0xfd, 0xd3, 0x2b, 0xf0, 0x74, 0xe } };
+
+// {D5286BB4-FDED-47ef-A623-4C3FF056DEC1}
+FOOGUIDDECL const GUID metadb_io_callback::class_guid =
+{ 0xd5286bb4, 0xfded, 0x47ef, { 0xa6, 0x23, 0x4c, 0x3f, 0xf0, 0x56, 0xde, 0xc1 } };
+
+// {1C0802F7-CF24-49ef-B914-8B9866F19779}
+FOOGUIDDECL const GUID contextmenu_item::class_guid =
+{ 0x1c0802f7, 0xcf24, 0x49ef, { 0xb9, 0x14, 0x8b, 0x98, 0x66, 0xf1, 0x97, 0x79 } };
+
+// {98B00B13-8C0E-49ff-B17C-5E537D3AE4B7}
+FOOGUIDDECL const GUID visualisation_manager::class_guid =
+{ 0x98b00b13, 0x8c0e, 0x49ff, { 0xb1, 0x7c, 0x5e, 0x53, 0x7d, 0x3a, 0xe4, 0xb7 } };
+
+// {4A4B1DD8-82FF-4071-A6E2-BD043F4C251C}
+FOOGUIDDECL const GUID visualisation_stream::class_guid =
+{ 0x4a4b1dd8, 0x82ff, 0x4071, { 0xa6, 0xe2, 0xbd, 0x4, 0x3f, 0x4c, 0x25, 0x1c } };
+
+// {015A6C0E-1571-49bd-A367-30B4BD889C34}
+FOOGUIDDECL const GUID packet_decoder::class_guid =
+{ 0x15a6c0e, 0x1571, 0x49bd, { 0xa3, 0x67, 0x30, 0xb4, 0xbd, 0x88, 0x9c, 0x34 } };
+
+// {D815032D-AFEB-46c6-8AA3-6FD530A4CE67}
+FOOGUIDDECL const GUID packet_decoder_streamparse::class_guid =
+{ 0xd815032d, 0xafeb, 0x46c6, { 0x8a, 0xa3, 0x6f, 0xd5, 0x30, 0xa4, 0xce, 0x67 } };
+
+// {53006A71-C03C-4c38-822F-9A34A5655095}
+FOOGUIDDECL const GUID packet_decoder_entry::class_guid =
+{ 0x53006a71, 0xc03c, 0x4c38, { 0x82, 0x2f, 0x9a, 0x34, 0xa5, 0x65, 0x50, 0x95 } };
+
+// {D3BD5F53-A6D6-4346-991F-CF14DFAD2B3A}
+FOOGUIDDECL const GUID contextmenu_manager::class_guid =
+{ 0xd3bd5f53, 0xa6d6, 0x4346, { 0x99, 0x1f, 0xcf, 0x14, 0xdf, 0xad, 0x2b, 0x3a } };
+
+// {640E006E-2934-4d6c-8327-4FA9F341ECF2}
+FOOGUIDDECL const GUID input_file_type::class_guid =
+{ 0x640e006e, 0x2934, 0x4d6c, { 0x83, 0x27, 0x4f, 0xa9, 0xf3, 0x41, 0xec, 0xf2 } };
+
+// {8835B30A-36A6-49bc-B96D-D0609B0EF2BA}
+FOOGUIDDECL const GUID input_file_type_v2::class_guid =
+{ 0x8835b30a, 0x36a6, 0x49bc, { 0xb9, 0x6d, 0xd0, 0x60, 0x9b, 0xe, 0xf2, 0xba } };
+
+// {2DC57FF7-476D-42f5-A05A-60499896134A}
+FOOGUIDDECL const GUID ui_control::class_guid =
+{ 0x2dc57ff7, 0x476d, 0x42f5, { 0xa0, 0x5a, 0x60, 0x49, 0x98, 0x96, 0x13, 0x4a } };
+
+// {392B88DE-50FC-43b0-9F03-2D79B071CAF6}
+FOOGUIDDECL const GUID ui_status_text_override::class_guid =
+{ 0x392b88de, 0x50fc, 0x43b0, { 0x9f, 0x3, 0x2d, 0x79, 0xb0, 0x71, 0xca, 0xf6 } };
+
+// {52BD7A17-540C-4a97-B812-72BC84EC4FF5}
+FOOGUIDDECL const GUID ui_drop_item_callback::class_guid =
+{ 0x52bd7a17, 0x540c, 0x4a97, { 0xb8, 0x12, 0x72, 0xbc, 0x84, 0xec, 0x4f, 0xf5 } };
+
+// {550B3A19-42A4-4c0f-91F2-90550189CBFF}
+FOOGUIDDECL const GUID commandline_handler::class_guid =
+{ 0x550b3a19, 0x42a4, 0x4c0f, { 0x91, 0xf2, 0x90, 0x55, 0x1, 0x89, 0xcb, 0xff } };
+
+// {C71B99BD-12C5-48fe-A9C0-469F6FEA88BF}
+FOOGUIDDECL const GUID modeless_dialog_manager::class_guid =
+{ 0xc71b99bd, 0x12c5, 0x48fe, { 0xa9, 0xc0, 0x46, 0x9f, 0x6f, 0xea, 0x88, 0xbf } };
+
+// {78BCBFA1-DFB9-487f-AB16-CD82BF90CCF7}
+FOOGUIDDECL const GUID play_callback_manager::class_guid =
+{ 0x78bcbfa1, 0xdfb9, 0x487f, { 0xab, 0x16, 0xcd, 0x82, 0xbf, 0x90, 0xcc, 0xf7 } };
+
+// {8E4EED7A-C6B8-49c7-99FE-97E04AAA63A8}
+FOOGUIDDECL const GUID play_callback_static::class_guid =
+{ 0x8e4eed7a, 0xc6b8, 0x49c7, { 0x99, 0xfe, 0x97, 0xe0, 0x4a, 0xaa, 0x63, 0xa8 } };
+
+// {BF803668-2977-4c71-B9AB-5C77C338C970}
+FOOGUIDDECL const GUID playback_control::class_guid =
+{ 0xbf803668, 0x2977, 0x4c71, { 0xb9, 0xab, 0x5c, 0x77, 0xc3, 0x38, 0xc9, 0x70 } };
+
+// {242D9341-211A-4637-A69F-F6684B52F9D6}
+FOOGUIDDECL const GUID playlist_callback_static::class_guid =
+{ 0x242d9341, 0x211a, 0x4637, { 0xa6, 0x9f, 0xf6, 0x68, 0x4b, 0x52, 0xf9, 0xd6 } };
+
+// {95E9F11B-4C99-4d0a-AB9F-367196B10925}
+FOOGUIDDECL const GUID playlist_callback_single_static::class_guid =
+{ 0x95e9f11b, 0x4c99, 0x4d0a, { 0xab, 0x9f, 0x36, 0x71, 0x96, 0xb1, 0x9, 0x25 } };
+
+// {88D7EDB1-A850-42a4-BBAB-49E955F4B81F}
+FOOGUIDDECL const GUID playlist_lock::class_guid =
+{ 0x88d7edb1, 0xa850, 0x42a4, { 0xbb, 0xab, 0x49, 0xe9, 0x55, 0xf4, 0xb8, 0x1f } };
+
+// {2FBCE1E5-902E-49e0-B9CF-CE0FBA765348}
+FOOGUIDDECL const GUID filesystem::class_guid =
+{ 0x2fbce1e5, 0x902e, 0x49e0, { 0xb9, 0xcf, 0xce, 0xf, 0xba, 0x76, 0x53, 0x48 } };
+
+// {9098AF12-61A3-4caa-8AA9-BB95C2EF8346}
+FOOGUIDDECL const GUID unpacker::class_guid =
+{ 0x9098af12, 0x61a3, 0x4caa, { 0x8a, 0xa9, 0xbb, 0x95, 0xc2, 0xef, 0x83, 0x46 } };
+
+// {EC707440-FA3E-4d12-9876-FC369F04D4A4}
+FOOGUIDDECL const GUID archive::class_guid =
+{ 0xec707440, 0xfa3e, 0x4d12, { 0x98, 0x76, 0xfc, 0x36, 0x9f, 0x4, 0xd4, 0xa4 } };
+
+// {B2F9FC40-3E55-4b23-A2C9-22BAAD8795B1}
+FOOGUIDDECL const GUID file::class_guid =
+{ 0xb2f9fc40, 0x3e55, 0x4b23, { 0xa2, 0xc9, 0x22, 0xba, 0xad, 0x87, 0x95, 0xb1 } };
+
+// {6374340F-82D4-4471-A24B-A754B1398285}
+FOOGUIDDECL const GUID file_dynamicinfo::class_guid =
+{ 0x6374340f, 0x82d4, 0x4471, { 0xa2, 0x4b, 0xa7, 0x54, 0xb1, 0x39, 0x82, 0x85 } };
+
+// {A00CB77D-ED72-4031-806B-4E45AF995241}
+FOOGUIDDECL const GUID replaygain_manager::class_guid =
+{ 0xa00cb77d, 0xed72, 0x4031, { 0x80, 0x6b, 0x4e, 0x45, 0xaf, 0x99, 0x52, 0x41 } };
+
+// {3FEED4FC-A400-4a30-8E73-F0ECD114D7E8}
+FOOGUIDDECL const GUID resampler_entry::class_guid =
+{ 0x3feed4fc, 0xa400, 0x4a30, { 0x8e, 0x73, 0xf0, 0xec, 0xd1, 0x14, 0xd7, 0xe8 } };
+
+// {3F7674AB-044C-4796-8801-6C443C244D88}
+FOOGUIDDECL const GUID titleformat_compiler::class_guid =
+{ 0x3f7674ab, 0x44c, 0x4796, { 0x88, 0x1, 0x6c, 0x44, 0x3c, 0x24, 0x4d, 0x88 } };
+
+// {1ADD4DC4-B278-4a0c-A105-2629F4B312F4}
+FOOGUIDDECL const GUID user_interface::class_guid =
+{ 0x1add4dc4, 0xb278, 0x4a0c, { 0xa1, 0x5, 0x26, 0x29, 0xf4, 0xb3, 0x12, 0xf4 } };
+
+// {994C0D0E-319E-45f3-92FC-518616E73ADC}
+FOOGUIDDECL const GUID contextmenu_item::caller_now_playing =
+{ 0x994c0d0e, 0x319e, 0x45f3, { 0x92, 0xfc, 0x51, 0x86, 0x16, 0xe7, 0x3a, 0xdc } };
+
+// {47502BA1-816D-4a3e-ADE5-A7A9860A67DB}
+FOOGUIDDECL const GUID contextmenu_item::caller_active_playlist_selection =
+{ 0x47502ba1, 0x816d, 0x4a3e, { 0xad, 0xe5, 0xa7, 0xa9, 0x86, 0xa, 0x67, 0xdb } };
+
+// Deprecated.
+FOOGUIDDECL const GUID contextmenu_item::caller_playlist = caller_active_playlist_selection;
+
+// {B3CC1030-EF26-45cf-A84A-7FC169BC9FFB}
+FOOGUIDDECL const GUID contextmenu_item::caller_active_playlist =
+{ 0xb3cc1030, 0xef26, 0x45cf, { 0xa8, 0x4a, 0x7f, 0xc1, 0x69, 0xbc, 0x9f, 0xfb } };
+
+// {5FDCD5E8-6EB2-4454-9EDA-527522893BED}
+FOOGUIDDECL const GUID contextmenu_item::caller_playlist_manager =
+{ 0x5fdcd5e8, 0x6eb2, 0x4454, { 0x9e, 0xda, 0x52, 0x75, 0x22, 0x89, 0x3b, 0xed } };
+
+// {00000000-0000-0000-0000-000000000000}
+FOOGUIDDECL const GUID contextmenu_item::caller_undefined =
+{ 0x00000000, 0x0000, 0x0000, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } };
+
+// {FABEE3E9-8901-4df4-A2D7-B9898D86C39B}
+FOOGUIDDECL const GUID contextmenu_item::caller_keyboard_shortcut_list =
+{ 0xfabee3e9, 0x8901, 0x4df4, { 0xa2, 0xd7, 0xb9, 0x89, 0x8d, 0x86, 0xc3, 0x9b } };
+
+// {FDA07C56-05D0-4b84-9FBD-A8BE556D474D}
+FOOGUIDDECL const GUID contextmenu_item::caller_media_library_viewer =
+{ 0xfda07c56, 0x5d0, 0x4b84, { 0x9f, 0xbd, 0xa8, 0xbe, 0x55, 0x6d, 0x47, 0x4d } };
+
+// {95DE5842-30F5-4f72-B40C-191663782F80}
+FOOGUIDDECL const GUID keyboard_shortcut_manager::class_guid =
+{ 0x95de5842, 0x30f5, 0x4f72, { 0xb4, 0xc, 0x19, 0x16, 0x63, 0x78, 0x2f, 0x80 } };
+
+// {CD19C870-DA6A-4b8a-A118-732A8102D07D}
+FOOGUIDDECL const GUID keyboard_shortcut_manager_v2::class_guid =
+{ 0xcd19c870, 0xda6a, 0x4b8a, { 0xa1, 0x18, 0x73, 0x2a, 0x81, 0x2, 0xd0, 0x7d } };
+
+// {30F95BEB-FDF4-4a75-B597-60CAF93B39C4}
+FOOGUIDDECL const GUID packet_decoder::owner_MP4 =
+{ 0x30f95beb, 0xfdf4, 0x4a75, { 0xb5, 0x97, 0x60, 0xca, 0xf9, 0x3b, 0x39, 0xc4 } };
+
+// {8F450CB3-A083-4b83-8D85-ADCE5EA6D57F}
+FOOGUIDDECL const GUID packet_decoder::owner_MP4_ALAC =
+{ 0x8f450cb3, 0xa083, 0x4b83, { 0x8d, 0x85, 0xad, 0xce, 0x5e, 0xa6, 0xd5, 0x7f } };
+
+// {40017871-50A9-48b6-BF60-BD181A227F9B}
+FOOGUIDDECL const GUID packet_decoder::owner_MP4_AMR =
+{ 0x40017871, 0x50a9, 0x48b6, { 0xbf, 0x60, 0xbd, 0x18, 0x1a, 0x22, 0x7f, 0x9b } };
+
+// {2E729EA0-6BEB-4392-BF24-75C69B60166D}
+FOOGUIDDECL const GUID packet_decoder::owner_MP4_AMR_WB =
+{ 0x2e729ea0, 0x6beb, 0x4392, { 0xbf, 0x24, 0x75, 0xc6, 0x9b, 0x60, 0x16, 0x6d } };
+
+// {AF5B7CB0-A08E-404a-A3C0-5C5EA1A8A05C}
+FOOGUIDDECL const GUID packet_decoder::owner_ADTS =
+{ 0xaf5b7cb0, 0xa08e, 0x404a, { 0xa3, 0xc0, 0x5c, 0x5e, 0xa1, 0xa8, 0xa0, 0x5c } };
+
+// {F72D2EAE-835C-4dfb-97C6-624343EFAFB0}
+FOOGUIDDECL const GUID packet_decoder::owner_ADIF =
+{ 0xf72d2eae, 0x835c, 0x4dfb, { 0x97, 0xc6, 0x62, 0x43, 0x43, 0xef, 0xaf, 0xb0 } };
+
+// {5C2DE804-EAEE-4b8e-8C14-9207A2549BBE}
+FOOGUIDDECL const GUID packet_decoder::owner_matroska =
+{ 0x5c2de804, 0xeaee, 0x4b8e, { 0x8c, 0x14, 0x92, 0x7, 0xa2, 0x54, 0x9b, 0xbe } };
+
+// {7B741A69-1AC7-440d-A01D-88536DD4DE1C}
+FOOGUIDDECL const GUID packet_decoder::owner_MP3 =
+{ 0x7b741a69, 0x1ac7, 0x440d, { 0xa0, 0x1d, 0x88, 0x53, 0x6d, 0xd4, 0xde, 0x1c } };
+
+// {17B300A0-3110-4400-A434-C18FBEEABA81}
+FOOGUIDDECL const GUID packet_decoder::owner_MP2 =
+{ 0x17b300a0, 0x3110, 0x4400, { 0xa4, 0x34, 0xc1, 0x8f, 0xbe, 0xea, 0xba, 0x81 } };
+
+// {1C068E5E-DD65-4639-BF85-78B297C8FFAC}
+FOOGUIDDECL const GUID packet_decoder::owner_MP1 =
+{ 0x1c068e5e, 0xdd65, 0x4639, { 0xbf, 0x85, 0x78, 0xb2, 0x97, 0xc8, 0xff, 0xac } };
+
+// {BC73F9FC-0107-480e-BF0E-BE58AF7AF328}
+FOOGUIDDECL const GUID packet_decoder::property_samplerate =
+{ 0xbc73f9fc, 0x107, 0x480e, { 0xbf, 0xe, 0xbe, 0x58, 0xaf, 0x7a, 0xf3, 0x28 } };
+
+// {E5D19AAD-931B-48ac-AA6E-95E2C23BEC37}
+FOOGUIDDECL const GUID packet_decoder::property_bitspersample =
+{ 0xe5d19aad, 0x931b, 0x48ac, { 0xaa, 0x6e, 0x95, 0xe2, 0xc2, 0x3b, 0xec, 0x37 } };
+
+// {1AFA1145-E774-4c26-91D6-3F5DD61E260E}
+FOOGUIDDECL const GUID packet_decoder::property_channels =
+{ 0x1afa1145, 0xe774, 0x4c26, { 0x91, 0xd6, 0x3f, 0x5d, 0xd6, 0x1e, 0x26, 0xe } };
+
+// {29C556DA-065A-4d24-8A11-0F9DBC05A817}
+FOOGUIDDECL const GUID packet_decoder::property_byteorder =
+{ 0x29c556da, 0x65a, 0x4d24, { 0x8a, 0x11, 0xf, 0x9d, 0xbc, 0x5, 0xa8, 0x17 } };
+
+// {0759C32F-E78E-4479-B0C0-B653DFA014D8}
+FOOGUIDDECL const GUID packet_decoder::property_signed =
+{ 0x759c32f, 0xe78e, 0x4479, { 0xb0, 0xc0, 0xb6, 0x53, 0xdf, 0xa0, 0x14, 0xd8 } };
+
+// {BB31669E-0C30-4c5f-AAF0-20CD49D46058}
+FOOGUIDDECL const GUID packet_decoder::property_channelmask =
+{ 0xbb31669e, 0xc30, 0x4c5f, { 0xaa, 0xf0, 0x20, 0xcd, 0x49, 0xd4, 0x60, 0x58 } };
+
+// {6F441057-1D18-4a58-9AC4-8F409CDA7DFD}
+FOOGUIDDECL const GUID standard_commands::guid_context_file_properties =
+{ 0x6f441057, 0x1d18, 0x4a58, { 0x9a, 0xc4, 0x8f, 0x40, 0x9c, 0xda, 0x7d, 0xfd } };
+
+// {EFC1E9C8-EEEF-427a-8F42-E5781605846D}
+FOOGUIDDECL const GUID standard_commands::guid_context_file_open_directory =
+{ 0xefc1e9c8, 0xeeef, 0x427a, { 0x8f, 0x42, 0xe5, 0x78, 0x16, 0x5, 0x84, 0x6d } };
+
+// {FFE18008-BCA2-4b29-AB88-8816B492C434}
+FOOGUIDDECL const GUID standard_commands::guid_context_copy_names =
+{ 0xffe18008, 0xbca2, 0x4b29, { 0xab, 0x88, 0x88, 0x16, 0xb4, 0x92, 0xc4, 0x34 } };
+
+// {44B8F02B-5408-4361-8240-18DEC881B95E}
+FOOGUIDDECL const GUID standard_commands::guid_context_send_to_playlist =
+{ 0x44b8f02b, 0x5408, 0x4361, { 0x82, 0x40, 0x18, 0xde, 0xc8, 0x81, 0xb9, 0x5e } };
+
+// {8C3BA2CB-BC4D-4752-8282-C6F9AED75A78}
+FOOGUIDDECL const GUID standard_commands::guid_context_reload_info =
+{ 0x8c3ba2cb, 0xbc4d, 0x4752, { 0x82, 0x82, 0xc6, 0xf9, 0xae, 0xd7, 0x5a, 0x78 } };
+
+// {BD045EA4-E5E9-4206-8FF9-12AD9F5DCDE1}
+FOOGUIDDECL const GUID standard_commands::guid_context_reload_info_if_changed =
+{ 0xbd045ea4, 0xe5e9, 0x4206, { 0x8f, 0xf9, 0x12, 0xad, 0x9f, 0x5d, 0xcd, 0xe1 } };
+
+// {684D9FBB-4383-44a2-9789-7EE1376209C6}
+FOOGUIDDECL const GUID standard_commands::guid_context_rewrite_info =
+{ 0x684d9fbb, 0x4383, 0x44a2, { 0x97, 0x89, 0x7e, 0xe1, 0x37, 0x62, 0x9, 0xc6 } };
+
+// {860179B7-962F-4340-ACAD-0DDAF060A6B8}
+FOOGUIDDECL const GUID standard_commands::guid_context_remove_tags =
+{ 0x860179b7, 0x962f, 0x4340, { 0xac, 0xad, 0xd, 0xda, 0xf0, 0x60, 0xa6, 0xb8 } };
+
+// {A7E7ECB7-1943-4907-83B3-60E92353C7FA}
+FOOGUIDDECL const GUID standard_commands::guid_context_convert_run =
+{ 0xa7e7ecb7, 0x1943, 0x4907, { 0x83, 0xb3, 0x60, 0xe9, 0x23, 0x53, 0xc7, 0xfa } };
+
+// {BED4FB6E-C4F2-40dd-B528-1DE1450DDFE9}
+FOOGUIDDECL const GUID standard_commands::guid_context_convert_run_withcue =
+{ 0xbed4fb6e, 0xc4f2, 0x40dd, { 0xb5, 0x28, 0x1d, 0xe1, 0x45, 0xd, 0xdf, 0xe9 } };
+
+// {A58AE6EA-A34F-4879-B25C-F31F2CBC4DA9}
+FOOGUIDDECL const GUID standard_commands::guid_context_convert_run_singlefile =
+{ 0xa58ae6ea, 0xa34f, 0x4879, { 0xb2, 0x5c, 0xf3, 0x1f, 0x2c, 0xbc, 0x4d, 0xa9 } };
+
+// {A8EFA42D-76CB-42bc-8803-70516567B13D}
+FOOGUIDDECL const GUID standard_commands::guid_context_write_cd =
+{ 0xa8efa42d, 0x76cb, 0x42bc, { 0x88, 0x3, 0x70, 0x51, 0x65, 0x67, 0xb1, 0x3d } };
+
+// {487DAED1-02FB-4336-A813-5E90317AB041}
+FOOGUIDDECL const GUID standard_commands::guid_context_rg_scan_track =
+{ 0x487daed1, 0x2fb, 0x4336, { 0xa8, 0x13, 0x5e, 0x90, 0x31, 0x7a, 0xb0, 0x41 } };
+
+// {3850F34C-F619-4296-B8A0-26C617B1D16C}
+FOOGUIDDECL const GUID standard_commands::guid_context_rg_scan_album =
+{ 0x3850f34c, 0xf619, 0x4296, { 0xb8, 0xa0, 0x26, 0xc6, 0x17, 0xb1, 0xd1, 0x6c } };
+
+// {6A2DBA02-260C-436f-8F41-0190A4298266}
+FOOGUIDDECL const GUID standard_commands::guid_context_rg_scan_album_multi =
+{ 0x6a2dba02, 0x260c, 0x436f, { 0x8f, 0x41, 0x1, 0x90, 0xa4, 0x29, 0x82, 0x66 } };
+
+// {54C82A92-5824-4381-8D1B-79FBB1E2ABB8}
+FOOGUIDDECL const GUID standard_commands::guid_context_rg_remove =
+{ 0x54c82a92, 0x5824, 0x4381, { 0x8d, 0x1b, 0x79, 0xfb, 0xb1, 0xe2, 0xab, 0xb8 } };
+
+// {69EAA594-13D9-4237-9BD7-11A39FDD1454}
+FOOGUIDDECL const GUID standard_commands::guid_context_save_playlist =
+{ 0x69eaa594, 0x13d9, 0x4237, { 0x9b, 0xd7, 0x11, 0xa3, 0x9f, 0xdd, 0x14, 0x54 } };
+
+// {2BEB6836-C657-40ef-BB6E-D5B222AB89CE}
+FOOGUIDDECL const GUID standard_commands::guid_context_masstag_edit =
+{ 0x2beb6836, 0xc657, 0x40ef, { 0xbb, 0x6e, 0xd5, 0xb2, 0x22, 0xab, 0x89, 0xce } };
+
+// {A579FF07-5D0B-48ed-A071-B6FCE4385AA9}
+FOOGUIDDECL const GUID standard_commands::guid_context_masstag_rename =
+{ 0xa579ff07, 0x5d0b, 0x48ed, { 0xa0, 0x71, 0xb6, 0xfc, 0xe4, 0x38, 0x5a, 0xa9 } };
+
+// {77CFBCD0-98DC-4015-B327-D7142C664806}
+FOOGUIDDECL const GUID standard_commands::guid_main_always_on_top =
+{ 0x77cfbcd0, 0x98dc, 0x4015, { 0xb3, 0x27, 0xd7, 0x14, 0x2c, 0x66, 0x48, 0x6 } };
+
+// {11213A01-9F36-4e69-A1BB-7A72F418DE3A}
+FOOGUIDDECL const GUID standard_commands::guid_main_preferences =
+{ 0x11213a01, 0x9f36, 0x4e69, { 0xa1, 0xbb, 0x7a, 0x72, 0xf4, 0x18, 0xde, 0x3a } };
+
+// {EDA23441-5D38-4499-A22C-FE0CE0A987D9}
+FOOGUIDDECL const GUID standard_commands::guid_main_about =
+{ 0xeda23441, 0x5d38, 0x4499, { 0xa2, 0x2c, 0xfe, 0xc, 0xe0, 0xa9, 0x87, 0xd9 } };
+
+// {6D38C73A-15D8-472c-8E68-6F946B82ECB4}
+FOOGUIDDECL const GUID standard_commands::guid_main_exit =
+{ 0x6d38c73a, 0x15d8, 0x472c, { 0x8e, 0x68, 0x6f, 0x94, 0x6b, 0x82, 0xec, 0xb4 } };
+
+// {EF9B60FE-CB03-4c40-A8FD-3F1821020B37}
+FOOGUIDDECL const GUID standard_commands::guid_main_restart =
+{ 0xef9b60fe, 0xcb03, 0x4c40, { 0xa8, 0xfd, 0x3f, 0x18, 0x21, 0x2, 0xb, 0x37 } };
+
+// {90500F09-F16F-415e-A047-AC5045C95FFE}
+FOOGUIDDECL const GUID standard_commands::guid_main_activate =
+{ 0x90500f09, 0xf16f, 0x415e, { 0xa0, 0x47, 0xac, 0x50, 0x45, 0xc9, 0x5f, 0xfe } };
+
+// {13C17E8D-0D6F-41a4-B24A-59371043E925}
+FOOGUIDDECL const GUID standard_commands::guid_main_hide =
+{ 0x13c17e8d, 0xd6f, 0x41a4, { 0xb2, 0x4a, 0x59, 0x37, 0x10, 0x43, 0xe9, 0x25 } };
+
+// {D9473FB2-BF11-4be0-972F-0E43F166A118}
+FOOGUIDDECL const GUID standard_commands::guid_main_activate_or_hide =
+{ 0xd9473fb2, 0xbf11, 0x4be0, { 0x97, 0x2f, 0xe, 0x43, 0xf1, 0x66, 0xa1, 0x18 } };
+
+// {91E349DA-8800-42e5-BC8C-F3A92577AE84}
+FOOGUIDDECL const GUID standard_commands::guid_main_titleformat_help =
+{ 0x91e349da, 0x8800, 0x42e5, { 0xbc, 0x8c, 0xf3, 0xa9, 0x25, 0x77, 0xae, 0x84 } };
+
+// {FBCFE01C-6C57-4e6a-A9F1-62334640DC91}
+FOOGUIDDECL const GUID standard_commands::guid_main_playback_follows_cursor=
+{ 0xfbcfe01c, 0x6c57, 0x4e6a, { 0xa9, 0xf1, 0x62, 0x33, 0x46, 0x40, 0xdc, 0x91 } };
+
+// {0E1C730A-1EA9-41cc-9C30-25700ABDD9FA}
+FOOGUIDDECL const GUID standard_commands::guid_main_cursor_follows_playback=
+{ 0xe1c730a, 0x1ea9, 0x41cc, { 0x9c, 0x30, 0x25, 0x70, 0xa, 0xbd, 0xd9, 0xfa } };
+
+// {E58895A0-A2F0-45b6-8799-1440E4DB7284}
+FOOGUIDDECL const GUID standard_commands::guid_main_next =
+{ 0xe58895a0, 0xa2f0, 0x45b6, { 0x87, 0x99, 0x14, 0x40, 0xe4, 0xdb, 0x72, 0x84 } };
+
+// {059C4566-4708-4ebf-8139-6A8EA5A9DFC8}
+FOOGUIDDECL const GUID standard_commands::guid_main_previous =
+{ 0x59c4566, 0x4708, 0x4ebf, { 0x81, 0x39, 0x6a, 0x8e, 0xa5, 0xa9, 0xdf, 0xc8 } };
+
+// {18B1278A-F1BB-4b48-BC3D-6EC9EF80AD19}
+FOOGUIDDECL const GUID standard_commands::guid_main_next_or_random =
+{ 0x18b1278a, 0xf1bb, 0x4b48, { 0xbc, 0x3d, 0x6e, 0xc9, 0xef, 0x80, 0xad, 0x19 } };
+
+// {42BDA765-30A8-40fa-BFA4-6A4E2F2B2CE9}
+FOOGUIDDECL const GUID standard_commands::guid_main_random =
+{ 0x42bda765, 0x30a8, 0x40fa, { 0xbf, 0xa4, 0x6a, 0x4e, 0x2f, 0x2b, 0x2c, 0xe9 } };
+
+// {FCEF5262-7FA5-452e-A527-C14E0CB582DE}
+FOOGUIDDECL const GUID standard_commands::guid_main_pause =
+{ 0xfcef5262, 0x7fa5, 0x452e, { 0xa5, 0x27, 0xc1, 0x4e, 0xc, 0xb5, 0x82, 0xde } };
+
+// {D3F83B15-D4AF-4586-8BD0-4EA415E31FE1}
+FOOGUIDDECL const GUID standard_commands::guid_main_play =
+{ 0xd3f83b15, 0xd4af, 0x4586, { 0x8b, 0xd0, 0x4e, 0xa4, 0x15, 0xe3, 0x1f, 0xe1 } };
+
+// {8DEBC44E-EDA2-48d4-8696-31FC29D1F383}
+FOOGUIDDECL const GUID standard_commands::guid_main_play_or_pause =
+{ 0x8debc44e, 0xeda2, 0x48d4, { 0x86, 0x96, 0x31, 0xfc, 0x29, 0xd1, 0xf3, 0x83 } };
+
+// {2DF17F25-80B9-4a43-B21D-620458FDDE1E}
+FOOGUIDDECL const GUID standard_commands::guid_main_rg_set_album =
+{ 0x2df17f25, 0x80b9, 0x4a43, { 0xb2, 0x1d, 0x62, 0x4, 0x58, 0xfd, 0xde, 0x1e } };
+
+// {C26F1955-5753-4836-887F-84A563DD6DD9}
+FOOGUIDDECL const GUID standard_commands::guid_main_rg_set_track =
+{ 0xc26f1955, 0x5753, 0x4836, { 0x88, 0x7f, 0x84, 0xa5, 0x63, 0xdd, 0x6d, 0xd9 } };
+
+// {8D2D808E-6AA2-455b-A2F1-CDB019328140}
+FOOGUIDDECL const GUID standard_commands::guid_main_rg_disable =
+{ 0x8d2d808e, 0x6aa2, 0x455b, { 0xa2, 0xf1, 0xcd, 0xb0, 0x19, 0x32, 0x81, 0x40 } };
+
+// {C3378028-165F-4374-966C-2FA2E0FCD3A8}
+FOOGUIDDECL const GUID standard_commands::guid_main_stop =
+{ 0xc3378028, 0x165f, 0x4374, { 0x96, 0x6c, 0x2f, 0xa2, 0xe0, 0xfc, 0xd3, 0xa8 } };
+
+// {EE057982-22F9-4862-A986-859E463316FB}
+FOOGUIDDECL const GUID standard_commands::guid_main_stop_after_current =
+{ 0xee057982, 0x22f9, 0x4862, { 0xa9, 0x86, 0x85, 0x9e, 0x46, 0x33, 0x16, 0xfb } };
+
+// {11DC6526-73C4-44f0-91B1-DE5C2D26B0C7}
+FOOGUIDDECL const GUID standard_commands::guid_main_volume_down =
+{ 0x11dc6526, 0x73c4, 0x44f0, { 0x91, 0xb1, 0xde, 0x5c, 0x2d, 0x26, 0xb0, 0xc7 } };
+
+// {A313E630-A04A-4ae8-B5B4-0A944AC964FF}
+FOOGUIDDECL const GUID standard_commands::guid_main_volume_up =
+{ 0xa313e630, 0xa04a, 0x4ae8, { 0xb5, 0xb4, 0xa, 0x94, 0x4a, 0xc9, 0x64, 0xff } };
+
+// {4A36285B-B4AF-46ed-A1AA-6333057F485B}
+FOOGUIDDECL const GUID standard_commands::guid_main_volume_mute =
+{ 0x4a36285b, 0xb4af, 0x46ed, { 0xa1, 0xaa, 0x63, 0x33, 0x5, 0x7f, 0x48, 0x5b } };
+
+// {2DC43C22-CA09-4ef9-A61E-7A0C1DAAE21E}
+FOOGUIDDECL const GUID standard_commands::guid_main_add_directory =
+{ 0x2dc43c22, 0xca09, 0x4ef9, { 0xa6, 0x1e, 0x7a, 0xc, 0x1d, 0xaa, 0xe2, 0x1e } };
+
+// {FC89C278-4475-4853-96C9-F7F05E8CC837}
+FOOGUIDDECL const GUID standard_commands::guid_main_add_files =
+{ 0xfc89c278, 0x4475, 0x4853, { 0x96, 0xc9, 0xf7, 0xf0, 0x5e, 0x8c, 0xc8, 0x37 } };
+
+// {9CA39D38-AC9B-4cca-B0CE-C0F62D188114}
+FOOGUIDDECL const GUID standard_commands::guid_main_add_location =
+{ 0x9ca39d38, 0xac9b, 0x4cca, { 0xb0, 0xce, 0xc0, 0xf6, 0x2d, 0x18, 0x81, 0x14 } };
+
+// {73D6E69D-0DC9-4d5c-A7EE-FF4BE3896B08}
+FOOGUIDDECL const GUID standard_commands::guid_main_add_playlist =
+{ 0x73d6e69d, 0xdc9, 0x4d5c, { 0xa7, 0xee, 0xff, 0x4b, 0xe3, 0x89, 0x6b, 0x8 } };
+
+// {55559142-7AEA-4c20-9B72-1D48E970A274}
+FOOGUIDDECL const GUID standard_commands::guid_main_clear_playlist =
+{ 0x55559142, 0x7aea, 0x4c20, { 0x9b, 0x72, 0x1d, 0x48, 0xe9, 0x70, 0xa2, 0x74 } };
+
+// {BF72488F-36AC-46b3-A36D-193E60C79BC5}
+FOOGUIDDECL const GUID standard_commands::guid_main_create_playlist =
+{ 0xbf72488f, 0x36ac, 0x46b3, { 0xa3, 0x6d, 0x19, 0x3e, 0x60, 0xc7, 0x9b, 0xc5 } };
+
+// {59E99BEE-42A3-4526-B06D-56C0C49F0BC1}
+FOOGUIDDECL const GUID standard_commands::guid_main_highlight_playing =
+{ 0x59e99bee, 0x42a3, 0x4526, { 0xb0, 0x6d, 0x56, 0xc0, 0xc4, 0x9f, 0xb, 0xc1 } };
+
+// {D94393D4-9DBB-4e5c-BE8C-BE9CA80E214D}
+FOOGUIDDECL const GUID standard_commands::guid_main_load_playlist =
+{ 0xd94393d4, 0x9dbb, 0x4e5c, { 0xbe, 0x8c, 0xbe, 0x9c, 0xa8, 0xe, 0x21, 0x4d } };
+
+// {EE1308C5-EBD2-48f1-959D-2627069C2E0F}
+FOOGUIDDECL const GUID standard_commands::guid_main_next_playlist =
+{ 0xee1308c5, 0xebd2, 0x48f1, { 0x95, 0x9d, 0x26, 0x27, 0x6, 0x9c, 0x2e, 0xf } };
+
+// {486ECDA3-7BA2-49e9-BB44-4DB9DF9320C7}
+FOOGUIDDECL const GUID standard_commands::guid_main_previous_playlist =
+{ 0x486ecda3, 0x7ba2, 0x49e9, { 0xbb, 0x44, 0x4d, 0xb9, 0xdf, 0x93, 0x20, 0xc7 } };
+
+// {69C778AA-B836-40a0-89CD-7A2E50C102CB}
+FOOGUIDDECL const GUID standard_commands::guid_main_open =
+{ 0x69c778aa, 0xb836, 0x40a0, { 0x89, 0xcd, 0x7a, 0x2e, 0x50, 0xc1, 0x2, 0xcb } };
+
+// {EB7FB5A4-5904-4d2c-B66C-D882A3B15277}
+FOOGUIDDECL const GUID standard_commands::guid_main_remove_playlist =
+{ 0xeb7fb5a4, 0x5904, 0x4d2c, { 0xb6, 0x6c, 0xd8, 0x82, 0xa3, 0xb1, 0x52, 0x77 } };
+
+// {C297BADB-8098-45a9-A5E8-B53A0D780CE3}
+FOOGUIDDECL const GUID standard_commands::guid_main_remove_dead_entries =
+{ 0xc297badb, 0x8098, 0x45a9, { 0xa5, 0xe8, 0xb5, 0x3a, 0xd, 0x78, 0xc, 0xe3 } };
+
+// {D08C2921-7750-4979-98F9-3A513A31FF96}
+FOOGUIDDECL const GUID standard_commands::guid_main_remove_duplicates =
+{ 0xd08c2921, 0x7750, 0x4979, { 0x98, 0xf9, 0x3a, 0x51, 0x3a, 0x31, 0xff, 0x96 } };
+
+// {D3A25E47-BA98-4e6b-95AD-A7502919EB75}
+FOOGUIDDECL const GUID standard_commands::guid_main_rename_playlist =
+{ 0xd3a25e47, 0xba98, 0x4e6b, { 0x95, 0xad, 0xa7, 0x50, 0x29, 0x19, 0xeb, 0x75 } };
+
+// {0FDCFC65-9B39-445a-AA88-4D245F217480}
+FOOGUIDDECL const GUID standard_commands::guid_main_save_all_playlists =
+{ 0xfdcfc65, 0x9b39, 0x445a, { 0xaa, 0x88, 0x4d, 0x24, 0x5f, 0x21, 0x74, 0x80 } };
+
+// {370B720B-4CF7-465b-908C-2D2ADD027900}
+FOOGUIDDECL const GUID standard_commands::guid_main_save_playlist =
+{ 0x370b720b, 0x4cf7, 0x465b, { 0x90, 0x8c, 0x2d, 0x2a, 0xdd, 0x2, 0x79, 0x0 } };
+
+// {A6CFC2A8-56B3-4d12-88E7-0237961AC47E}
+FOOGUIDDECL const GUID standard_commands::guid_main_playlist_search =
+{ 0xa6cfc2a8, 0x56b3, 0x4d12, { 0x88, 0xe7, 0x2, 0x37, 0x96, 0x1a, 0xc4, 0x7e } };
+
+// {383D4E8D-7E30-4fb8-B5DD-8C975D89E58E}
+FOOGUIDDECL const GUID standard_commands::guid_main_playlist_sel_crop =
+{ 0x383d4e8d, 0x7e30, 0x4fb8, { 0xb5, 0xdd, 0x8c, 0x97, 0x5d, 0x89, 0xe5, 0x8e } };
+
+// {E0EEA319-E282-4e6c-8B82-4DFD42A1D4ED}
+FOOGUIDDECL const GUID standard_commands::guid_main_playlist_sel_remove =
+{ 0xe0eea319, 0xe282, 0x4e6c, { 0x8b, 0x82, 0x4d, 0xfd, 0x42, 0xa1, 0xd4, 0xed } };
+
+// {F0845920-7F6D-40ac-B2EB-3D00C2C8260B}
+FOOGUIDDECL const GUID standard_commands::guid_main_playlist_sel_invert =
+{ 0xf0845920, 0x7f6d, 0x40ac, { 0xb2, 0xeb, 0x3d, 0x0, 0xc2, 0xc8, 0x26, 0xb } };
+
+// {29910B33-79E9-40da-992B-5A4AA4281F78}
+FOOGUIDDECL const GUID standard_commands::guid_main_playlist_undo =
+{ 0x29910b33, 0x79e9, 0x40da, { 0x99, 0x2b, 0x5a, 0x4a, 0xa4, 0x28, 0x1f, 0x78 } };
+
+// {7A9D9450-A8BF-4a88-B44F-DCD83A49DD7A}
+FOOGUIDDECL const GUID standard_commands::guid_main_playlist_redo =
+{ 0x7a9d9450, 0xa8bf, 0x4a88, { 0xb4, 0x4f, 0xdc, 0xd8, 0x3a, 0x49, 0xdd, 0x7a } };
+
+// {02D89A8A-5F7D-41c3-A215-6731D8621036}
+FOOGUIDDECL const GUID standard_commands::guid_main_show_console =
+{ 0x2d89a8a, 0x5f7d, 0x41c3, { 0xa2, 0x15, 0x67, 0x31, 0xd8, 0x62, 0x10, 0x36 } };
+
+// {E6970E91-33BE-4288-AC01-4B02F07B5D38}
+FOOGUIDDECL const GUID standard_commands::guid_main_play_cd =
+{ 0xe6970e91, 0x33be, 0x4288, { 0xac, 0x1, 0x4b, 0x2, 0xf0, 0x7b, 0x5d, 0x38 } };
+
+// {1073AB1D-38ED-4957-8B06-38BC878C1F40}
+FOOGUIDDECL const GUID standard_commands::guid_main_restart_resetconfig =
+{ 0x1073ab1d, 0x38ed, 0x4957, { 0x8b, 0x6, 0x38, 0xbc, 0x87, 0x8c, 0x1f, 0x40 } };
+
+// {FDC8A1C2-93EF-4415-8C20-60B6517F0B5F}
+FOOGUIDDECL const GUID standard_commands::guid_main_record =
+{ 0xfdc8a1c2, 0x93ef, 0x4415, { 0x8c, 0x20, 0x60, 0xb6, 0x51, 0x7f, 0xb, 0x5f } };
+
+// {45EB37D2-3CD9-4f0a-9B20-8EAE649D7A9F}
+FOOGUIDDECL const GUID standard_commands::guid_main_playlist_moveback =
+{ 0x45eb37d2, 0x3cd9, 0x4f0a, { 0x9b, 0x20, 0x8e, 0xae, 0x64, 0x9d, 0x7a, 0x9f } };
+
+// {02298938-596A-41f7-A398-19766A06E6EB}
+FOOGUIDDECL const GUID standard_commands::guid_main_playlist_moveforward =
+{ 0x2298938, 0x596a, 0x41f7, { 0xa3, 0x98, 0x19, 0x76, 0x6a, 0x6, 0xe6, 0xeb } };
+
+// {E910ACC6-A81A-4a20-9F62-19015BCD1013}
+FOOGUIDDECL const GUID standard_commands::guid_main_saveconfig =
+{ 0xe910acc6, 0xa81a, 0x4a20, { 0x9f, 0x62, 0x19, 0x1, 0x5b, 0xcd, 0x10, 0x13 } };
+
+// {03445FCC-71D9-4e01-AE02-A557D30B4CD7}
+FOOGUIDDECL const GUID standard_commands::guid_main_playlist_select_all =
+{ 0x3445fcc, 0x71d9, 0x4e01, { 0xae, 0x2, 0xa5, 0x57, 0xd3, 0xb, 0x4c, 0xd7 } };
+
+// {919FA72B-1DF9-49ee-A8F1-D8BA1DEAA7E9}
+FOOGUIDDECL const GUID standard_commands::guid_main_show_now_playing =
+{ 0x919fa72b, 0x1df9, 0x49ee, { 0xa8, 0xf1, 0xd8, 0xba, 0x1d, 0xea, 0xa7, 0xe9 } };
+
+// {D8D51855-D79D-49b8-97A8-065785FA2426}
+FOOGUIDDECL const GUID playlist_manager::class_guid=
+{ 0xd8d51855, 0xd79d, 0x49b8, { 0x97, 0xa8, 0x6, 0x57, 0x85, 0xfa, 0x24, 0x26 } };
+
+// {C303A0F1-8E88-4539-87E5-9E455B7D548C}
+FOOGUIDDECL const GUID genrand_service::class_guid=
+{ 0xc303a0f1, 0x8e88, 0x4539, { 0x87, 0xe5, 0x9e, 0x45, 0x5b, 0x7d, 0x54, 0x8c } };
+
+// {EB8FA333-F365-46ad-8621-345671567BAA}
+FOOGUIDDECL const GUID playlist_incoming_item_filter::class_guid=
+{ 0xeb8fa333, 0xf365, 0x46ad, { 0x86, 0x21, 0x34, 0x56, 0x71, 0x56, 0x7b, 0xaa } };
+
+// {FEBD85B5-C12D-45b5-B55D-0D3F432B0C6B}
+FOOGUIDDECL const GUID library_manager::class_guid=
+{ 0xfebd85b5, 0xc12d, 0x45b5, { 0xb5, 0x5d, 0xd, 0x3f, 0x43, 0x2b, 0xc, 0x6b } };
+
+// {9A08B50F-E8C6-40c0-88C3-7530CF2C3115}
+FOOGUIDDECL const GUID library_callback::class_guid=
+{ 0x9a08b50f, 0xe8c6, 0x40c0, { 0x88, 0xc3, 0x75, 0x30, 0xcf, 0x2c, 0x31, 0x15 } };
+
+// {D5CAC75A-3023-4dce-8B0D-B502BD056A7C}
+FOOGUIDDECL const GUID popup_message::class_guid=
+{ 0xd5cac75a, 0x3023, 0x4dce, { 0x8b, 0xd, 0xb5, 0x2, 0xbd, 0x5, 0x6a, 0x7c } };
+
+// {13F9CB11-0EAE-4417-AF0C-8894DEB65E8B}
+FOOGUIDDECL const GUID app_close_blocker::class_guid=
+{ 0x13f9cb11, 0xeae, 0x4417, { 0xaf, 0xc, 0x88, 0x94, 0xde, 0xb6, 0x5e, 0x8b } };
+
+// {5570A2D2-8F9E-48a7-AFAC-DAC00A3C1636}
+FOOGUIDDECL const GUID file_operation_callback::class_guid=
+{ 0x5570a2d2, 0x8f9e, 0x48a7, { 0xaf, 0xac, 0xda, 0xc0, 0xa, 0x3c, 0x16, 0x36 } };
+
+// {340099D1-7BEC-4ac6-92A4-77FF01507891}
+FOOGUIDDECL const GUID config_object::class_guid=
+{ 0x340099d1, 0x7bec, 0x4ac6, { 0x92, 0xa4, 0x77, 0xff, 0x1, 0x50, 0x78, 0x91 } };
+
+// {1BA04122-DE9A-4a90-9FC3-A6A7EC8F9626}
+FOOGUIDDECL const GUID config_object_notify_manager::class_guid=
+{ 0x1ba04122, 0xde9a, 0x4a90, { 0x9f, 0xc3, 0xa6, 0xa7, 0xec, 0x8f, 0x96, 0x26 } };
+
+// {AD5138E6-CF8F-4482-89B2-B2EAAEDF3B4C}
+FOOGUIDDECL const GUID standard_config_objects::bool_show_keyboard_shortcuts_in_menus=
+{ 0xad5138e6, 0xcf8f, 0x4482, { 0x89, 0xb2, 0xb2, 0xea, 0xae, 0xdf, 0x3b, 0x4c } };
+
+// {E91F618C-5741-470f-A178-21272C3ECA90}
+FOOGUIDDECL const GUID standard_config_objects::bool_remember_window_positions=
+{ 0xe91f618c, 0x5741, 0x470f, { 0xa1, 0x78, 0x21, 0x27, 0x2c, 0x3e, 0xca, 0x90 } };
+
+// {5497FAA9-690C-4fb4-8BC0-678CEBCBBDC4}
+FOOGUIDDECL const GUID standard_config_objects::bool_playback_follows_cursor=
+{ 0x5497faa9, 0x690c, 0x4fb4, { 0x8b, 0xc0, 0x67, 0x8c, 0xeb, 0xcb, 0xbd, 0xc4 } };
+
+// {58D3E2D6-DD6D-48dd-98EB-4EABF0ACFEB8}
+FOOGUIDDECL const GUID standard_config_objects::bool_cursor_follows_playback=
+{ 0x58d3e2d6, 0xdd6d, 0x48dd, { 0x98, 0xeb, 0x4e, 0xab, 0xf0, 0xac, 0xfe, 0xb8 } };
+
+// {2DF7194D-86FC-4312-98DA-E820DA3E710D}
+FOOGUIDDECL const GUID standard_config_objects::bool_ui_always_on_top=
+{ 0x2df7194d, 0x86fc, 0x4312, { 0x98, 0xda, 0xe8, 0x20, 0xda, 0x3e, 0x71, 0xd } };
+
+// {B572C86F-4206-40a0-8476-C7B27E74DB2D}
+FOOGUIDDECL const GUID standard_config_objects::bool_playlist_stop_after_current=
+{ 0xb572c86f, 0x4206, 0x40a0, { 0x84, 0x76, 0xc7, 0xb2, 0x7e, 0x74, 0xdb, 0x2d } };
+
+// {FFDFDA96-699C-4617-A977-22DC2F039B00}
+FOOGUIDDECL const GUID standard_config_objects::string_gui_last_directory_media=
+{ 0xffdfda96, 0x699c, 0x4617, { 0xa9, 0x77, 0x22, 0xdc, 0x2f, 0x3, 0x9b, 0x0 } };
+
+// {915D3B21-81CB-4b96-9762-1C90FBF371DF}
+FOOGUIDDECL const GUID standard_config_objects::string_gui_last_directory_playlists=
+{ 0x915d3b21, 0x81cb, 0x4b96, { 0x97, 0x62, 0x1c, 0x90, 0xfb, 0xf3, 0x71, 0xdf } };
+
+// {338B6871-EB1F-4384-BF83-6BFACE5B66BC}
+FOOGUIDDECL const GUID standard_config_objects::int32_dynamic_bitrate_display_rate=
+{ 0x338b6871, 0xeb1f, 0x4384, { 0xbf, 0x83, 0x6b, 0xfa, 0xce, 0x5b, 0x66, 0xbc } };
+
+// {3E35D949-DCDB-44e1-8013-9D1633C09756}
+FOOGUIDDECL const GUID config_object_notify::class_guid=
+{ 0x3e35d949, 0xdcdb, 0x44e1, { 0x80, 0x13, 0x9d, 0x16, 0x33, 0xc0, 0x97, 0x56 } };
+
+// {4AC9408E-4D9C-4135-ACB5-2CAB35376FC9}
+FOOGUIDDECL const GUID titleformat_object::class_guid=
+{ 0x4ac9408e, 0x4d9c, 0x4135, { 0xac, 0xb5, 0x2c, 0xab, 0x35, 0x37, 0x6f, 0xc9 } };
+
+// {25B0D20D-9BA3-4a7b-8D0E-89FAF75F916F}
+FOOGUIDDECL const GUID tag_processor_id3v2::class_guid=
+{ 0x25b0d20d, 0x9ba3, 0x4a7b, { 0x8d, 0xe, 0x89, 0xfa, 0xf7, 0x5f, 0x91, 0x6f } };
+
+// {AD537D40-499D-4c29-81D4-C0FA496DD58C}
+FOOGUIDDECL const GUID tag_processor_trailing::class_guid=
+{ 0xad537d40, 0x499d, 0x4c29, { 0x81, 0xd4, 0xc0, 0xfa, 0x49, 0x6d, 0xd5, 0x8c } };
+
+// {160885C6-3AA3-4f60-8718-1240615E6414}
+FOOGUIDDECL const GUID metadb_handle::class_guid=
+{ 0x160885c6, 0x3aa3, 0x4f60, { 0x87, 0x18, 0x12, 0x40, 0x61, 0x5e, 0x64, 0x14 } };
+
+// {9DBC262F-4795-4292-824B-23A655011A3E}
+FOOGUIDDECL const GUID threaded_process::class_guid=
+{ 0x9dbc262f, 0x4795, 0x4292, { 0x82, 0x4b, 0x23, 0xa6, 0x55, 0x1, 0x1a, 0x3e } };
+
+// {7B69141B-4271-4070-8998-10CD39249C12}
+FOOGUIDDECL const GUID threaded_process_callback::class_guid=
+{ 0x7b69141b, 0x4271, 0x4070, { 0x89, 0x98, 0x10, 0xcd, 0x39, 0x24, 0x9c, 0x12 } };
+
+
+// {64D18B80-5E97-40e4-A30C-A4640C60BCE5}
+FOOGUIDDECL const GUID metadb_io::class_guid=
+{ 0x64d18b80, 0x5e97, 0x40e4, { 0xa3, 0xc, 0xa4, 0x64, 0xc, 0x60, 0xbc, 0xe5 } };
+
+FOOGUIDDECL const GUID preferences_page::guid_tagging = { 0x563107c3, 0xfc7d, 0x4022, { 0xa8, 0x72, 0xa8, 0x2a, 0x2b, 0x3f, 0xd5, 0x25 } };
+
+// {B9218D23-F73D-4b61-A1D9-BFD420CDAC77}
+FOOGUIDDECL const GUID preferences_page::guid_root=
+{ 0xb9218d23, 0xf73d, 0x4b61, { 0xa1, 0xd9, 0xbf, 0xd4, 0x20, 0xcd, 0xac, 0x77 } };
+
+// {2F0E2232-A5FD-43e4-B6AB-3839B8D1A707}
+FOOGUIDDECL const GUID preferences_page::guid_hidden=
+{ 0x2f0e2232, 0xa5fd, 0x43e4, { 0xb6, 0xab, 0x38, 0x39, 0xb8, 0xd1, 0xa7, 0x7 } };
+
+// {627C0767-0793-44f8-8087-BE4934311282}
+FOOGUIDDECL const GUID preferences_page::guid_tools=
+{ 0x627c0767, 0x793, 0x44f8, { 0x80, 0x87, 0xbe, 0x49, 0x34, 0x31, 0x12, 0x82 } };
+
+// {6AAA67B6-732F-4967-899A-18C5F8C70017}
+FOOGUIDDECL const GUID preferences_page::guid_display=
+{ 0x6aaa67b6, 0x732f, 0x4967, { 0x89, 0x9a, 0x18, 0xc5, 0xf8, 0xc7, 0x0, 0x17 } };
+
+// {67508677-CFCC-4a1c-921C-49B39CC5B986}
+FOOGUIDDECL const GUID preferences_page::guid_playback=
+{ 0x67508677, 0xcfcc, 0x4a1c, { 0x92, 0x1c, 0x49, 0xb3, 0x9c, 0xc5, 0xb9, 0x86 } };
+
+// {494326C8-88FF-4265-B2B2-E6470BEE13B3}
+FOOGUIDDECL const GUID preferences_page::guid_visualisations=
+{ 0x494326c8, 0x88ff, 0x4265, { 0xb2, 0xb2, 0xe6, 0x47, 0xb, 0xee, 0x13, 0xb3 } };
+
+// {FC01B529-4BD7-47cd-BAF7-2FB632F0DBB6}
+FOOGUIDDECL const GUID preferences_page::guid_input=
+{ 0xfc01b529, 0x4bd7, 0x47cd, { 0xba, 0xf7, 0x2f, 0xb6, 0x32, 0xf0, 0xdb, 0xb6 } };
+
+// {2E8E9647-4174-41b2-9EC4-910BE128082E}
+FOOGUIDDECL const GUID preferences_page::guid_core=
+{ 0x2e8e9647, 0x4174, 0x41b2, { 0x9e, 0xc4, 0x91, 0xb, 0xe1, 0x28, 0x8, 0x2e } };
+
+// {7D0334E5-ADD7-4ff5-9DB8-A618B4824028}
+FOOGUIDDECL const GUID preferences_page::guid_tag_writing=
+{ 0x7d0334e5, 0xadd7, 0x4ff5, { 0x9d, 0xb8, 0xa6, 0x18, 0xb4, 0x82, 0x40, 0x28 } };
+
+// {2D269FA9-6F78-4cec-9F1F-0A176EFCE77A}
+FOOGUIDDECL const GUID preferences_page::guid_media_library=
+{ 0x2d269fa9, 0x6f78, 0x4cec, { 0x9f, 0x1f, 0xa, 0x17, 0x6e, 0xfc, 0xe7, 0x7a } };
+
+// {B8C5CEEA-A5F4-4278-AA2D-798E4403001F}
+FOOGUIDDECL const GUID library_viewer::class_guid=
+{ 0xb8c5ceea, 0xa5f4, 0x4278, { 0xaa, 0x2d, 0x79, 0x8e, 0x44, 0x3, 0x0, 0x1f } };
+
+// {5CD49B5D-D604-4c07-A8FA-FFD8512AFD2B}
+FOOGUIDDECL const GUID message_loop::class_guid=
+{ 0x5cd49b5d, 0xd604, 0x4c07, { 0xa8, 0xfa, 0xff, 0xd8, 0x51, 0x2a, 0xfd, 0x2b } };
+
+// {3F489088-6179-434e-A9DB-3A14A1B081AC}
+FOOGUIDDECL const GUID chapterizer::class_guid=
+{ 0x3f489088, 0x6179, 0x434e, { 0xa9, 0xdb, 0x3a, 0x14, 0xa1, 0xb0, 0x81, 0xac } };
+
+// {7EB442CD-FAD7-4a26-AD7E-16F6FC89207B}
+FOOGUIDDECL const GUID input_decoder::class_guid =
+{ 0x7eb442cd, 0xfad7, 0x4a26, { 0xad, 0x7e, 0x16, 0xf6, 0xfc, 0x89, 0x20, 0x7b } };
+
+// {8E9BB1D4-A52B-4df6-A929-1AAE4075388A}
+FOOGUIDDECL const GUID input_info_reader::class_guid =
+{ 0x8e9bb1d4, 0xa52b, 0x4df6, { 0xa9, 0x29, 0x1a, 0xae, 0x40, 0x75, 0x38, 0x8a } };
+
+// {FE40FF66-64C9-4234-B639-028DC8060CF7}
+FOOGUIDDECL const GUID input_info_writer::class_guid =
+{ 0xfe40ff66, 0x64c9, 0x4234, { 0xb6, 0x39, 0x2, 0x8d, 0xc8, 0x6, 0xc, 0xf7 } };
+
+// {436547FC-C4EF-4322-B59E-E696A25FAB2C}
+FOOGUIDDECL const GUID input_entry::class_guid =
+{ 0x436547fc, 0xc4ef, 0x4322, { 0xb5, 0x9e, 0xe6, 0x96, 0xa2, 0x5f, 0xab, 0x2c } };
+
+// {3296219B-EBA5-4c32-A193-C9BB174801DA}
+FOOGUIDDECL const GUID link_resolver::class_guid =
+{ 0x3296219b, 0xeba5, 0x4c32, { 0xa1, 0x93, 0xc9, 0xbb, 0x17, 0x48, 0x1, 0xda } };
+
+// {A49E087E-D064-4b2e-A08D-11264F691FFE}
+FOOGUIDDECL const GUID playback_queue_callback::class_guid =
+{ 0xa49e087e, 0xd064, 0x4b2e, { 0xa0, 0x8d, 0x11, 0x26, 0x4f, 0x69, 0x1f, 0xfe } };
+
+// {1131D64B-04CB-43ee-95EB-24D18B753248}
+FOOGUIDDECL const GUID main_thread_callback_manager::class_guid =
+{ 0x1131d64b, 0x4cb, 0x43ee, { 0x95, 0xeb, 0x24, 0xd1, 0x8b, 0x75, 0x32, 0x48 } };
+
+// {87D2C583-7AFB-4e58-B21E-FBD3E6E8F5E7}
+FOOGUIDDECL const GUID main_thread_callback::class_guid =
+{ 0x87d2c583, 0x7afb, 0x4e58, { 0xb2, 0x1e, 0xfb, 0xd3, 0xe6, 0xe8, 0xf5, 0xe7 } };
+
+
+
+// {21656AB9-0255-4f8c-8FB9-1A7748BCE93A}
+FOOGUIDDECL const GUID mainmenu_group::class_guid =
+{ 0x21656ab9, 0x255, 0x4f8c, { 0x8f, 0xb9, 0x1a, 0x77, 0x48, 0xbc, 0xe9, 0x3a } };
+
+// {2E673A2E-A4EE-419c-94C8-9C838660414C}
+FOOGUIDDECL const GUID mainmenu_group_popup::class_guid =
+{ 0x2e673a2e, 0xa4ee, 0x419c, { 0x94, 0xc8, 0x9c, 0x83, 0x86, 0x60, 0x41, 0x4c } };
+
+// {35077B8C-6E70-47ba-B9DD-D51500E12F2E}
+FOOGUIDDECL const GUID mainmenu_commands::class_guid =
+{ 0x35077b8c, 0x6e70, 0x47ba, { 0xb9, 0xdd, 0xd5, 0x15, 0x0, 0xe1, 0x2f, 0x2e } };
+
+// {350B3EA8-6B3E-4346-B6D2-799E98EFC920}
+FOOGUIDDECL const GUID mainmenu_manager::class_guid =
+{ 0x350b3ea8, 0x6b3e, 0x4346, { 0xb6, 0xd2, 0x79, 0x9e, 0x98, 0xef, 0xc9, 0x20 } };
+
+
+// {8F487F1F-419F-47a7-8ECF-EC44AF4449A3}
+FOOGUIDDECL const GUID mainmenu_groups::file =
+{ 0x8f487f1f, 0x419f, 0x47a7, { 0x8e, 0xcf, 0xec, 0x44, 0xaf, 0x44, 0x49, 0xa3 } };
+
+// {F8BE5604-165F-4bb9-B6A9-15E55E0E0D3A}
+FOOGUIDDECL const GUID mainmenu_groups::view =
+{ 0xf8be5604, 0x165f, 0x4bb9, { 0xb6, 0xa9, 0x15, 0xe5, 0x5e, 0xe, 0xd, 0x3a } };
+
+// {8CDA6B10-0613-4cfd-8730-3B9CBF4C6A39}
+FOOGUIDDECL const GUID mainmenu_groups::edit =
+{ 0x8cda6b10, 0x613, 0x4cfd, { 0x87, 0x30, 0x3b, 0x9c, 0xbf, 0x4c, 0x6a, 0x39 } };
+
+// {D8A4FC46-5E3D-47aa-97B7-947988228246}
+FOOGUIDDECL const GUID mainmenu_groups::edit_part1 =
+{ 0xd8a4fc46, 0x5e3d, 0x47aa, { 0x97, 0xb7, 0x94, 0x79, 0x88, 0x22, 0x82, 0x46 } };
+
+// {007682CE-2A99-4b70-8F63-DE765D1C5555}
+FOOGUIDDECL const GUID mainmenu_groups::edit_part2 =
+{ 0x7682ce, 0x2a99, 0x4b70, { 0x8f, 0x63, 0xde, 0x76, 0x5d, 0x1c, 0x55, 0x55 } };
+
+// {1F572090-D620-4940-85EC-0EFE499FAC03}
+FOOGUIDDECL const GUID mainmenu_groups::edit_part3 =
+{ 0x1f572090, 0xd620, 0x4940, { 0x85, 0xec, 0xe, 0xfe, 0x49, 0x9f, 0xac, 0x3 } };
+
+// {65FA047A-1599-4b9c-B53D-C3FEB716339D}
+FOOGUIDDECL const GUID mainmenu_groups::edit_part2_selection =
+{ 0x65fa047a, 0x1599, 0x4b9c, { 0xb5, 0x3d, 0xc3, 0xfe, 0xb7, 0x16, 0x33, 0x9d } };
+
+// {5B8AEF2C-6E1A-420d-B488-3E3A00E39E28}
+FOOGUIDDECL const GUID mainmenu_groups::edit_part2_sort =
+{ 0x5b8aef2c, 0x6e1a, 0x420d, { 0xb4, 0x88, 0x3e, 0x3a, 0x0, 0xe3, 0x9e, 0x28 } };
+
+// {EE9D6F72-7BC7-4a60-8C28-B96DED252BD3}
+FOOGUIDDECL const GUID mainmenu_groups::edit_part2_selection_sort =
+{ 0xee9d6f72, 0x7bc7, 0x4a60, { 0x8c, 0x28, 0xb9, 0x6d, 0xed, 0x25, 0x2b, 0xd3 } };
+
+// {53FA5B8A-FCBC-4296-B968-45BAE6888845}
+FOOGUIDDECL const GUID mainmenu_groups::playback =
+{ 0x53fa5b8a, 0xfcbc, 0x4296, { 0xb9, 0x68, 0x45, 0xba, 0xe6, 0x88, 0x88, 0x45 } };
+
+// {15D22753-9D30-4929-AA14-5124016F7E68}
+FOOGUIDDECL const GUID mainmenu_groups::library =
+{ 0x15d22753, 0x9d30, 0x4929, { 0xaa, 0x14, 0x51, 0x24, 0x1, 0x6f, 0x7e, 0x68 } };
+
+// {25DC3DB7-996A-4f48-AF53-712032EFA04F}
+FOOGUIDDECL const GUID mainmenu_groups::help =
+{ 0x25dc3db7, 0x996a, 0x4f48, { 0xaf, 0x53, 0x71, 0x20, 0x32, 0xef, 0xa0, 0x4f } };
+
+// {8EED252D-0A0F-4fc9-9D81-8CF7209A8BF2}
+FOOGUIDDECL const GUID mainmenu_groups::file_open =
+{ 0x8eed252d, 0xa0f, 0x4fc9, { 0x9d, 0x81, 0x8c, 0xf7, 0x20, 0x9a, 0x8b, 0xf2 } };
+
+// {9E650B8E-C3F3-4495-AF15-6B656060C3B9}
+FOOGUIDDECL const GUID mainmenu_groups::file_add =
+{ 0x9e650b8e, 0xc3f3, 0x4495, { 0xaf, 0x15, 0x6b, 0x65, 0x60, 0x60, 0xc3, 0xb9 } };
+
+// {9995FAE6-B1C4-457f-A747-5BD120930210}
+FOOGUIDDECL const GUID mainmenu_groups::file_playlist =
+{ 0x9995fae6, 0xb1c4, 0x457f, { 0xa7, 0x47, 0x5b, 0xd1, 0x20, 0x93, 0x2, 0x10 } };
+
+// {8A324F18-6173-42ec-A640-5E296AD446B3}
+FOOGUIDDECL const GUID mainmenu_groups::file_etc =
+{ 0x8a324f18, 0x6173, 0x42ec, { 0xa6, 0x40, 0x5e, 0x29, 0x6a, 0xd4, 0x46, 0xb3 } };
+
+// {12F5E247-5A81-4734-8119-8F9BC114FE74}
+FOOGUIDDECL const GUID mainmenu_groups::playback_controls =
+{ 0x12f5e247, 0x5a81, 0x4734, { 0x81, 0x19, 0x8f, 0x9b, 0xc1, 0x14, 0xfe, 0x74 } };
+
+// {1169B3EB-81B5-4199-8929-7D3EAFD4809F}
+FOOGUIDDECL const GUID mainmenu_groups::playback_etc =
+{ 0x1169b3eb, 0x81b5, 0x4199, { 0x89, 0x29, 0x7d, 0x3e, 0xaf, 0xd4, 0x80, 0x9f } };
+
+// {29272FEC-21C7-4b00-A9A7-01A8CE675EBF}
+FOOGUIDDECL const GUID mainmenu_groups::view_visualisations =
+{ 0x29272fec, 0x21c7, 0x4b00, { 0xa9, 0xa7, 0x1, 0xa8, 0xce, 0x67, 0x5e, 0xbf } };
+
+// {2DA055D4-0257-40b2-8281-7967866B485C}
+FOOGUIDDECL const GUID mainmenu_groups::file_etc_preferences =
+{ 0x2da055d4, 0x257, 0x40b2, { 0x82, 0x81, 0x79, 0x67, 0x86, 0x6b, 0x48, 0x5c } };
+
+// {517BFAE8-A148-4cb2-8CCE-1AD2179FB910}
+FOOGUIDDECL const GUID mainmenu_groups::file_etc_exit =
+{ 0x517bfae8, 0xa148, 0x4cb2, { 0x8c, 0xce, 0x1a, 0xd2, 0x17, 0x9f, 0xb9, 0x10 } };
+
+// {61190F78-3B3A-4fda-A431-2CF7DA1C96CE}
+FOOGUIDDECL const GUID mainmenu_groups::view_alwaysontop =
+{ 0x61190f78, 0x3b3a, 0x4fda, { 0xa4, 0x31, 0x2c, 0xf7, 0xda, 0x1c, 0x96, 0xce } };
+
+// {E55F8D65-AE51-47bf-99F9-BB113421CB19}
+FOOGUIDDECL const GUID mainmenu_groups::help_about =
+{ 0xe55f8d65, 0xae51, 0x47bf, { 0x99, 0xf9, 0xbb, 0x11, 0x34, 0x21, 0xcb, 0x19 } };
+
+// {696DF823-B7AE-4b73-95C8-C1E9A9410726}
+FOOGUIDDECL const GUID mainmenu_groups::library_refresh=
+{ 0x696df823, 0xb7ae, 0x4b73, { 0x95, 0xc8, 0xc1, 0xe9, 0xa9, 0x41, 0x7, 0x26 } };
+
+// {004BF6ED-2F88-464f-BDC1-278F6E610C2F}
+FOOGUIDDECL const GUID standard_commands::guid_seek_ahead_1s =
+{ 0x4bf6ed, 0x2f88, 0x464f, { 0xbd, 0xc1, 0x27, 0x8f, 0x6e, 0x61, 0xc, 0x2f } };
+
+// {5B56D124-2ECA-4b0f-9895-2A533B31D29E}
+FOOGUIDDECL const GUID standard_commands::guid_seek_ahead_5s =
+{ 0x5b56d124, 0x2eca, 0x4b0f, { 0x98, 0x95, 0x2a, 0x53, 0x3b, 0x31, 0xd2, 0x9e } };
+
+// {B582E3CA-D86D-4568-8380-68BC9C93ED0E}
+FOOGUIDDECL const GUID standard_commands::guid_seek_ahead_10s =
+{ 0xb582e3ca, 0xd86d, 0x4568, { 0x83, 0x80, 0x68, 0xbc, 0x9c, 0x93, 0xed, 0xe } };
+
+// {DE6B96B7-3074-4da9-A260-988E31CEE0F9}
+FOOGUIDDECL const GUID standard_commands::guid_seek_ahead_30s =
+{ 0xde6b96b7, 0x3074, 0x4da9, { 0xa2, 0x60, 0x98, 0x8e, 0x31, 0xce, 0xe0, 0xf9 } };
+
+// {FEED4AD7-13D2-4846-8833-D91B5F8B4E94}
+FOOGUIDDECL const GUID standard_commands::guid_seek_ahead_1min =
+{ 0xfeed4ad7, 0x13d2, 0x4846, { 0x88, 0x33, 0xd9, 0x1b, 0x5f, 0x8b, 0x4e, 0x94 } };
+
+// {ECCF4904-03CF-429a-9D99-7A87FA62FD10}
+FOOGUIDDECL const GUID standard_commands::guid_seek_ahead_2min =
+{ 0xeccf4904, 0x3cf, 0x429a, { 0x9d, 0x99, 0x7a, 0x87, 0xfa, 0x62, 0xfd, 0x10 } };
+
+// {5F0F0AF7-F519-41e6-A8DB-04DF1390E69D}
+FOOGUIDDECL const GUID standard_commands::guid_seek_ahead_5min =
+{ 0x5f0f0af7, 0xf519, 0x41e6, { 0xa8, 0xdb, 0x4, 0xdf, 0x13, 0x90, 0xe6, 0x9d } };
+
+// {9ABA4292-1B8F-42ac-93AC-34B2A74C6320}
+FOOGUIDDECL const GUID standard_commands::guid_seek_ahead_10min =
+{ 0x9aba4292, 0x1b8f, 0x42ac, { 0x93, 0xac, 0x34, 0xb2, 0xa7, 0x4c, 0x63, 0x20 } };
+
+// {2F89AB1C-5646-4997-8E3F-92BEE0322A41}
+FOOGUIDDECL const GUID standard_commands::guid_seek_back_1s =
+{ 0x2f89ab1c, 0x5646, 0x4997, { 0x8e, 0x3f, 0x92, 0xbe, 0xe0, 0x32, 0x2a, 0x41 } };
+
+// {0CE84538-2E21-4482-BFE1-BCEC471467CC}
+FOOGUIDDECL const GUID standard_commands::guid_seek_back_5s =
+{ 0xce84538, 0x2e21, 0x4482, { 0xbf, 0xe1, 0xbc, 0xec, 0x47, 0x14, 0x67, 0xcc } };
+
+// {9F504218-AF5D-41a8-BCE3-26313FAE65EE}
+FOOGUIDDECL const GUID standard_commands::guid_seek_back_10s =
+{ 0x9f504218, 0xaf5d, 0x41a8, { 0xbc, 0xe3, 0x26, 0x31, 0x3f, 0xae, 0x65, 0xee } };
+
+// {98239B89-F66E-4160-B650-D9B068C59E63}
+FOOGUIDDECL const GUID standard_commands::guid_seek_back_30s =
+{ 0x98239b89, 0xf66e, 0x4160, { 0xb6, 0x50, 0xd9, 0xb0, 0x68, 0xc5, 0x9e, 0x63 } };
+
+// {6633226B-9AA9-4810-AFDA-185A281D9FE2}
+FOOGUIDDECL const GUID standard_commands::guid_seek_back_1min =
+{ 0x6633226b, 0x9aa9, 0x4810, { 0xaf, 0xda, 0x18, 0x5a, 0x28, 0x1d, 0x9f, 0xe2 } };
+
+// {E2F8B8BB-C539-44f3-A300-13185DE52227}
+FOOGUIDDECL const GUID standard_commands::guid_seek_back_2min =
+{ 0xe2f8b8bb, 0xc539, 0x44f3, { 0xa3, 0x0, 0x13, 0x18, 0x5d, 0xe5, 0x22, 0x27 } };
+
+// {7B41A130-01D2-4a1b-9CAD-6314633C61C4}
+FOOGUIDDECL const GUID standard_commands::guid_seek_back_5min =
+{ 0x7b41a130, 0x1d2, 0x4a1b, { 0x9c, 0xad, 0x63, 0x14, 0x63, 0x3c, 0x61, 0xc4 } };
+
+// {0B012852-BAF9-4f6b-B947-FAB89AE76B79}
+FOOGUIDDECL const GUID standard_commands::guid_seek_back_10min =
+{ 0xb012852, 0xbaf9, 0x4f6b, { 0xb9, 0x47, 0xfa, 0xb8, 0x9a, 0xe7, 0x6b, 0x79 } };
+
+// {97215C5E-7228-4237-B52C-A2B5504EF726}
+FOOGUIDDECL const GUID playback_statistics_collector::class_guid =
+{ 0x97215c5e, 0x7228, 0x4237, { 0xb5, 0x2c, 0xa2, 0xb5, 0x50, 0x4e, 0xf7, 0x26 } };
+
+// {9FB1DA49-AF6F-4fd2-9C73-48A8A109003B}
+FOOGUIDDECL const GUID dsp_v2::class_guid =
+{ 0x9fb1da49, 0xaf6f, 0x4fd2, { 0x9c, 0x73, 0x48, 0xa8, 0xa1, 0x9, 0x0, 0x3b } };
+
+// {9EC5D45E-10F5-46a7-9546-F3ACEC68B149}
+FOOGUIDDECL const GUID dsp_entry_v2::class_guid =
+{ 0x9ec5d45e, 0x10f5, 0x46a7, { 0x95, 0x46, 0xf3, 0xac, 0xec, 0x68, 0xb1, 0x49 } };
+
+
+FOOGUIDDECL const GUID advconfig_entry::guid_root = { 0x34949f34, 0xe655, 0x4f09, { 0xba, 0x50, 0xfa, 0xeb, 0x4d, 0x9b, 0x77, 0x69 } };
+FOOGUIDDECL const GUID advconfig_entry::class_guid = { 0x7e84602e, 0xdc49, 0x4047, { 0xaa, 0xee, 0x63, 0x71, 0x8b, 0xbc, 0x5a, 0x1f } };
+FOOGUIDDECL const GUID advconfig_branch::class_guid = { 0x6a60b472, 0x91ac, 0x4681, { 0x9d, 0xc2, 0x76, 0xc9, 0x94, 0x0, 0x5b, 0x63 } };
+FOOGUIDDECL const GUID advconfig_entry_checkbox::class_guid = { 0x5243aba4, 0x2a3d, 0x4627, { 0x88, 0xef, 0xce, 0xe3, 0x76, 0x1c, 0x7, 0x9c } };
+FOOGUIDDECL const GUID advconfig_entry::guid_branch_tagging = { 0xe8fe273f, 0xdd00, 0x476e, { 0xa7, 0x90, 0xe5, 0x9d, 0xf6, 0xb8, 0xf8, 0xd4 } };
+FOOGUIDDECL const GUID advconfig_entry::guid_branch_decoding = { 0x904c272b, 0x2317, 0x4c3c, { 0xb2, 0xff, 0xc5, 0xa0, 0x12, 0x5e, 0x2c, 0xc2 } };
+FOOGUIDDECL const GUID advconfig_entry_string::class_guid = { 0x185d582d, 0xfbd8, 0x4db3, { 0xbe, 0x23, 0x47, 0xaa, 0xc6, 0x75, 0xfc, 0x11 } };
+FOOGUIDDECL const GUID advconfig_entry::guid_branch_tools = { 0x35365484, 0xcc58, 0x4926, { 0x97, 0xe1, 0x5e, 0x63, 0xf3, 0xab, 0xb9, 0xe2 } };
+FOOGUIDDECL const GUID advconfig_entry::guid_branch_playback = { 0xc48d430d, 0x112, 0x4922, { 0x97, 0x23, 0x28, 0x38, 0xc7, 0xd9, 0x7d, 0xd7 } };
+FOOGUIDDECL const GUID advconfig_entry::guid_branch_display = { 0x6c4bc1c8, 0xbaf4, 0x40c3, { 0x9d, 0xb1, 0x9, 0x50, 0x7f, 0xc, 0xc, 0xb9 } };
+
+
+
+FOOGUIDDECL const GUID playback_control_v2::class_guid = { 0x1eb67bda, 0x1345, 0x49ae, { 0x8e, 0x89, 0x50, 0x5, 0xd9, 0x1, 0x62, 0x89 } };
+
+FOOGUIDDECL const GUID preferences_page_v2::class_guid = { 0xce4ebc9e, 0xab20, 0x46f9, { 0x92, 0x5f, 0x88, 0x3b, 0x8, 0x4f, 0x5, 0x69 } };
+FOOGUIDDECL const GUID preferences_branch_v2::class_guid = { 0x167ebeb9, 0x8334, 0x4b21, { 0xaf, 0x58, 0xa7, 0x40, 0xa5, 0xd5, 0xb6, 0x66 } };
+
+
+
+FOOGUIDDECL const GUID advconfig_entry_enum::class_guid = { 0xb1451540, 0x98ec, 0x4d36, { 0x9f, 0x19, 0xe3, 0x10, 0xfb, 0xa7, 0xab, 0x5a } };
+
+FOOGUIDDECL const GUID info_lookup_handler::class_guid = { 0x4fcfdab7, 0x55b5, 0x47d6, { 0xb1, 0x9d, 0xa4, 0xdc, 0x9f, 0xd7, 0x69, 0x4c } };
+
+FOOGUIDDECL const GUID completion_notify::class_guid = { 0xdf26d586, 0xf7ec, 0x40c3, { 0x9f, 0xe8, 0x2e, 0xa0, 0x72, 0x5d, 0x76, 0xc0 } };
+
+FOOGUIDDECL const GUID metadb_io_v2::class_guid = { 0x265c4ece, 0xffb2, 0x4299, { 0x91, 0xb5, 0x6c, 0xa6, 0x60, 0x3d, 0xa1, 0x53 } };
+
+FOOGUIDDECL const GUID file_info_filter::class_guid = { 0x45d0b800, 0xde83, 0x4a77, { 0xad, 0x34, 0x3f, 0x84, 0x2d, 0x40, 0xe7, 0x95 } };
+
+FOOGUIDDECL const GUID metadb_hint_list::class_guid = { 0x719dc072, 0x8d4d, 0x4aa6, { 0xa6, 0xf3, 0x90, 0x73, 0x7, 0xe5, 0xbc, 0xee } };
+
+FOOGUIDDECL const GUID playlist_incoming_item_filter_v2::class_guid = { 0xf335802b, 0xa522, 0x434d, { 0xbe, 0x89, 0xe8, 0x6d, 0x59, 0x56, 0x16, 0x48 } };
+
+FOOGUIDDECL const GUID process_locations_notify::class_guid = { 0x7d7eddac, 0xf93e, 0x4707, { 0x96, 0x9b, 0xcf, 0x44, 0xa9, 0xe1, 0xfb, 0x78 } };
+
+FOOGUIDDECL const GUID library_manager_v2::class_guid = { 0x900eae79, 0x68d0, 0x4900, { 0xa4, 0xd8, 0x18, 0x20, 0x5, 0xae, 0x33, 0x7e } };
+
+FOOGUIDDECL const GUID packet_decoder::owner_Ogg = { 0x8fa27457, 0xa021, 0x43b9, { 0xad, 0x20, 0xa7, 0x96, 0xdb, 0x94, 0x7c, 0xd1 } };
+
+FOOGUIDDECL const GUID packet_decoder::property_ogg_header = { 0xbeb22c78, 0xeb49, 0x4f9e, { 0x9e, 0x37, 0x57, 0xd8, 0x87, 0x40, 0xfb, 0x4c } };
+
+FOOGUIDDECL const GUID packet_decoder::property_ogg_query_sample_rate = { 0x6226bf73, 0x1c37, 0x4aa1, { 0xae, 0xb1, 0x18, 0x8b, 0x4a, 0xf3, 0xae, 0xf7 } };
+
+FOOGUIDDECL const GUID packet_decoder::property_ogg_packet = { 0xade740be, 0x8e2e, 0x4d0b, { 0xa4, 0x0, 0x3f, 0x6e, 0x8a, 0xf7, 0x71, 0xe4 } };
+
+FOOGUIDDECL const GUID track_property_provider::class_guid = { 0xefcdd365, 0x81fc, 0x4c82, { 0x96, 0x1c, 0xa2, 0xb5, 0x76, 0x1a, 0xf8, 0xb7 } };
+
+FOOGUIDDECL const GUID track_property_provider_v2::class_guid = { 0x78e86595, 0xcffd, 0x4d10, { 0x85, 0x66, 0xbc, 0xf6, 0x6c, 0x89, 0x11, 0x16 } };
+
+
+FOOGUIDDECL const GUID library_manager_v3::class_guid = { 0x33dc0f1f, 0x16f0, 0x4e27, { 0xa7, 0x3, 0x63, 0x57, 0x72, 0x35, 0xb0, 0x1c } };
+
+FOOGUIDDECL const GUID metadb_io_v3::class_guid = { 0x10e80560, 0xb1ef, 0x4e5e, { 0xb4, 0xc, 0x5d, 0xfc, 0x2e, 0x9a, 0xf1, 0x11 } };
+
+FOOGUIDDECL const GUID search_filter::class_guid = { 0x4134bb34, 0xed5, 0x49f3, { 0x9c, 0xef, 0x43, 0xe3, 0xa4, 0xa3, 0xa8, 0xae } };
+
+FOOGUIDDECL const GUID search_filter_manager::class_guid = { 0xad0baa03, 0xebd4, 0x4a72, { 0xa0, 0xa7, 0x98, 0x3, 0xa9, 0xe1, 0xe4, 0xf4 } };
+
+FOOGUIDDECL const GUID playlist_manager_v2::class_guid = { 0x7fe9052a, 0x8ec2, 0x4054, { 0xa8, 0xcf, 0x77, 0xef, 0xb5, 0x2f, 0xe4, 0x8 } };
+
+FOOGUIDDECL const GUID playlist_manager_v3::class_guid = { 0x3b6575c8, 0x21a, 0x4474, { 0xbb, 0x60, 0x6c, 0xfc, 0xfe, 0x33, 0xc3, 0x4f } };
+
+FOOGUIDDECL const GUID titleformat_common_methods::class_guid = { 0x432fe059, 0xf087, 0x4785, { 0xa5, 0x18, 0xcb, 0xc1, 0x8b, 0x84, 0x9a, 0xc1 } };
+
+FOOGUIDDECL const GUID core_version_info_v2::class_guid = { 0x273704d7, 0x99ba, 0x4b58, { 0xa0, 0x60, 0x82, 0xab, 0x1, 0xb4, 0x92, 0x25 } };
+
+FOOGUIDDECL const GUID visualisation_stream_v2::class_guid = { 0xeb5b35b5, 0x267b, 0x443c, { 0xbe, 0x37, 0xc, 0x25, 0x73, 0x81, 0xa8, 0x6a } };
+
+FOOGUIDDECL const GUID visualisation_stream_v3::class_guid = { 0xe1fd8e8b, 0x68f1, 0x4cea, { 0xa0, 0xe6, 0x61, 0x91, 0x1d, 0x14, 0x65, 0x42 } };
+
+FOOGUIDDECL const GUID album_art_data::class_guid = { 0x9ddce05c, 0xaa3f, 0x4565, { 0xb3, 0x3a, 0xbd, 0x6a, 0xdc, 0xdd, 0x90, 0x37 } };
+FOOGUIDDECL const GUID album_art_manager::class_guid = { 0xab90fd55, 0xb6f, 0x47b2, { 0x8c, 0xd7, 0x61, 0x1d, 0x58, 0x6c, 0x4c, 0x45 } };
+FOOGUIDDECL const GUID album_art_manager_instance::class_guid = { 0x3c7b403b, 0xff99, 0x4d86, { 0x84, 0x4a, 0xd3, 0xea, 0xbb, 0xd6, 0x1f, 0x66 } };
+FOOGUIDDECL const GUID album_art_extractor::class_guid = { 0xe19ca3d3, 0x6267, 0x4271, { 0xb7, 0x89, 0x6a, 0x3f, 0x87, 0xfb, 0x3e, 0xbf } };
+FOOGUIDDECL const GUID album_art_extractor_instance::class_guid = { 0xf673700e, 0x3b6e, 0x4f70, { 0xa1, 0x6, 0xab, 0x74, 0x5c, 0x20, 0x20, 0x60 } };
+FOOGUIDDECL const GUID album_art_editor::class_guid = { 0x36b34487, 0xd7b9, 0x4533, { 0xa7, 0x3f, 0x39, 0x6e, 0x2d, 0x9f, 0x41, 0x5e } };
+FOOGUIDDECL const GUID album_art_editor_instance::class_guid = { 0x642a2ae1, 0x2259, 0x48f5, { 0xab, 0xdc, 0x63, 0xed, 0x4e, 0xb5, 0x90, 0x76 } };
+
+
+FOOGUIDDECL const GUID icon_remapping::class_guid = { 0x7c6aea96, 0x4a19, 0x471b, { 0x92, 0x5a, 0xa7, 0xc8, 0xb2, 0x8a, 0x59, 0xe7 } };
+
+FOOGUIDDECL const GUID file_operation_callback_dynamic_manager::class_guid = { 0x1cb3a4dc, 0x7d79, 0x45cf, { 0x82, 0x2e, 0xf8, 0x67, 0x7b, 0x8d, 0xde, 0x37 } };
+
+FOOGUIDDECL const GUID ui_selection_holder::class_guid = { 0x2ec9b7a, 0x93a5, 0x434d, { 0x85, 0x46, 0xed, 0x1d, 0xbb, 0x24, 0x35, 0xd0 } };
+FOOGUIDDECL const GUID ui_selection_manager::class_guid = { 0xd8ee46c7, 0x27ad, 0x4881, { 0xb1, 0x33, 0x14, 0x96, 0xc0, 0xe7, 0xee, 0x67 } };
+FOOGUIDDECL const GUID ui_selection_manager_v2::class_guid = { 0x2740b6c1, 0x449d, 0x40cc, { 0x8a, 0x79, 0x38, 0xc, 0x77, 0xe8, 0xdf, 0xc2 } };
+
+
+FOOGUIDDECL const GUID ole_interaction::class_guid = { 0xfbee40c9, 0xef36, 0x410b, { 0x9d, 0x52, 0x7e, 0x56, 0x39, 0x59, 0xf3, 0xd1 } };
+
+FOOGUIDDECL const GUID tag_processor_album_art_utils::class_guid = { 0x58768713, 0xc13c, 0x4406, { 0x97, 0x98, 0x21, 0x47, 0xcb, 0x97, 0x33, 0x2a } };
+
+FOOGUIDDECL const GUID playlist_incoming_item_filter_v3::class_guid = { 0xd3332054, 0xbccd, 0x45cb, { 0xbc, 0x2, 0x0, 0xa1, 0x3a, 0x80, 0x25, 0x9f } };
+
+FOOGUIDDECL const GUID menu_item_resolver::class_guid = { 0xac70ecdc, 0xe1d, 0x4db2, { 0x9c, 0xd0, 0xc9, 0xb8, 0xa9, 0xcd, 0x28, 0xfa } };
+
+FOOGUIDDECL const GUID app_close_blocking_task_manager::class_guid = { 0x213f1454, 0x8a62, 0x44b6, { 0xb0, 0xcb, 0xc1, 0xe1, 0x5d, 0xa7, 0x3b, 0xc8 } };
+
+FOOGUIDDECL const GUID message_loop_v2::class_guid = { 0x5d438080, 0xb269, 0x406d, { 0x94, 0xaf, 0xef, 0xd9, 0x29, 0x9f, 0x32, 0x5c } };
+
+
+FOOGUIDDECL const GUID autoplaylist_client::class_guid = { 0x7c90bda0, 0xf93d, 0x4a73, { 0x98, 0x51, 0xa0, 0x33, 0x6, 0x7, 0xcb, 0x28 } };
+
+FOOGUIDDECL const GUID autoplaylist_client_factory::class_guid = { 0x764200cb, 0xe283, 0x4efd, { 0x88, 0xa5, 0x80, 0x38, 0xdd, 0xee, 0x77, 0xdb } };
+
+FOOGUIDDECL const GUID autoplaylist_manager::class_guid = { 0x1571d0d, 0xc1e1, 0x44bf, { 0xb5, 0x29, 0x7a, 0xe, 0x4e, 0x89, 0x15, 0xbc } };
+
+
+FOOGUIDDECL const GUID replaygain_result::class_guid = { 0xe7f43102, 0xbc6e, 0x400b, { 0xbb, 0x81, 0x2d, 0x9b, 0xe4, 0x30, 0x3e, 0xcc } };
+FOOGUIDDECL const GUID replaygain_scanner::class_guid = { 0x2a40fcf9, 0xf1f7, 0x41da, { 0xad, 0x76, 0x29, 0xf7, 0x51, 0xed, 0xd3, 0x8a } };
+FOOGUIDDECL const GUID replaygain_scanner_entry::class_guid = { 0x278380f3, 0x6fc0, 0x4176, { 0x8a, 0x98, 0x1f, 0x66, 0x3a, 0x94, 0x79, 0xc5 } };
+
+
+FOOGUIDDECL const GUID search_filter_manager_v2::class_guid = { 0xac62a380, 0x7771, 0x4dc9, { 0x8a, 0x26, 0x41, 0x41, 0x39, 0xb4, 0x3e, 0xe2 } };
+FOOGUIDDECL const GUID search_filter_v2::class_guid = { 0xb7ca3c8, 0xaf23, 0x4a52, { 0x82, 0x66, 0xfe, 0x5, 0x4c, 0x49, 0xeb, 0x23 } };
+
+
+FOOGUIDDECL const GUID autoplaylist_client_v2::class_guid = { 0xfaa716f7, 0xebb1, 0x473c, { 0xbc, 0xf1, 0xb0, 0x1b, 0x8c, 0x9f, 0x1b, 0x95 } };
+
+FOOGUIDDECL const GUID library_search_ui::class_guid = { 0xe5eb14fa, 0xbb08, 0x4564, { 0xaf, 0xfa, 0x6f, 0x27, 0x3f, 0x37, 0xbd, 0x3d } };
+
+FOOGUIDDECL const GUID search_filter_v3::class_guid = { 0xdd6bc035, 0x7e33, 0x425a, { 0x89, 0x32, 0x6, 0xb5, 0xea, 0xb0, 0x39, 0xbc } };
+
+FOOGUIDDECL const GUID input_decoder_v2::class_guid = { 0x2c5489eb, 0xd3c1, 0x4ad4, { 0xbe, 0xa3, 0xcf, 0x40, 0x8e, 0x16, 0x1b, 0x9b } };
+
+FOOGUIDDECL const GUID event_logger::class_guid = { 0x5d336782, 0x69d6, 0x4225, { 0x9e, 0xa8, 0xcc, 0x29, 0x35, 0x7, 0xf9, 0xfe } };
+
+FOOGUIDDECL const GUID playlist_manager_v4::class_guid = { 0xcea7b49e, 0xacf2, 0x4ea2, { 0x99, 0x86, 0x95, 0xa, 0x56, 0xa2, 0xc0, 0xef } };
+
+FOOGUIDDECL const GUID ole_interaction_v2::class_guid = { 0x55738cab, 0x311d, 0x4dbe, { 0xa0, 0xbc, 0x51, 0xc1, 0xba, 0x27, 0xfe, 0x95 } };
+
+FOOGUIDDECL const GUID autoplaylist_manager_v2::class_guid = { 0x67882220, 0xeea5, 0x4dbc, { 0x9a, 0xa3, 0x63, 0xde, 0x8c, 0xdd, 0x40, 0x82 } };
+
+FOOGUIDDECL const GUID library_file_move_scope::class_guid = { 0x345fae5, 0x8093, 0x45f6, { 0x94, 0x2e, 0xd6, 0xe, 0xbf, 0x7, 0xe9, 0x52 } };
+
+FOOGUIDDECL const GUID library_file_move_manager::class_guid = { 0xc4cd4818, 0xe3f8, 0x4061, { 0x99, 0xf1, 0x18, 0x66, 0x4e, 0x6c, 0x28, 0x57 } };
+
+FOOGUIDDECL const GUID library_file_move_notify::class_guid = { 0xd8ae7613, 0x7577, 0x4192, { 0x8f, 0xa4, 0x2d, 0x8f, 0x7e, 0xc6, 0x6, 0x38 } };
+
+FOOGUIDDECL const GUID library_meta_autocomplete::class_guid = { 0x4b976e34, 0xf05a, 0x4da4, { 0xad, 0x65, 0x71, 0x9c, 0xdf, 0xd, 0xed, 0xae } };
+
+FOOGUIDDECL const GUID input_protocol_type::class_guid = { 0x6a03c4ee, 0xf87b, 0x49d7, { 0x81, 0xdb, 0x66, 0xb, 0xe8, 0xc1, 0x0, 0x7e } };
+
+FOOGUIDDECL const GUID input_decoder_v3::class_guid = { 0x953c71ed, 0xd3a2, 0x43f4, { 0xa3, 0x3a, 0x55, 0x94, 0xd6, 0x73, 0x96, 0xe5 } };
+
+FOOGUIDDECL const GUID metadb_hint_list_v2::class_guid = { 0x983a971a, 0x596b, 0x478f, { 0x9c, 0x38, 0x36, 0xb0, 0x2b, 0xd6, 0x39, 0xd9 } };
+
+#if FOOBAR2000_TARGET_VERSION >= 76
+FOOGUIDDECL const GUID playlist_loader::class_guid = { 0x7103cae9, 0x91c, 0x4d80, { 0xbc, 0x1d, 0x28, 0x4a, 0xc1, 0x3f, 0x1e, 0x8c } };
+FOOGUIDDECL const GUID playlist_loader_callback::class_guid = { 0x924470a0, 0x1478, 0x4141, { 0xa7, 0x5a, 0xc5, 0x2f, 0x1f, 0xfa, 0xef, 0xea } };
+#endif
+
+FOOGUIDDECL const GUID album_art_manager_v2::class_guid = { 0xb420664f, 0x4033, 0x465e, { 0x81, 0xb1, 0xce, 0x42, 0x43, 0x89, 0x1f, 0x59 } };
+FOOGUIDDECL const GUID album_art_extractor_instance_v2::class_guid = { 0x951bbeb1, 0xa94a, 0x4d9a, { 0xa2, 0x85, 0xd6, 0x1e, 0xe4, 0x66, 0xe8, 0xcc } };
+FOOGUIDDECL const GUID album_art_path_list::class_guid = { 0xbb26233f, 0x1051, 0x4b01, { 0x9f, 0xd8, 0xf0, 0xe4, 0x20, 0x7, 0xd7, 0xe6 } };
+FOOGUIDDECL const GUID album_art_fallback::class_guid = { 0x45481581, 0x40b3, 0x4930, { 0xab, 0x6d, 0x4e, 0x6e, 0x56, 0x58, 0x6c, 0x82 } };
+
+
+FOOGUIDDECL const GUID preferences_page_callback::class_guid = { 0x3d26e08e, 0x861c, 0x4599, { 0x9c, 0x89, 0xaa, 0xa7, 0x19, 0xaf, 0x50, 0x70 } };
+FOOGUIDDECL const GUID preferences_page_instance::class_guid = { 0x6893a996, 0xa816, 0x49fe, { 0x82, 0xce, 0xc, 0xb8, 0x4, 0xa4, 0xcf, 0xec } };
+FOOGUIDDECL const GUID preferences_page_v3::class_guid = { 0xd6d0f741, 0x9f17, 0x4df8, { 0x9d, 0x5c, 0x87, 0xf2, 0x8b, 0x1f, 0xe, 0x64 } };
+
+FOOGUIDDECL const GUID advconfig_entry_string_v2::class_guid = { 0x2ec9b1fa, 0xe1e4, 0x42f0, { 0x87, 0x97, 0x4a, 0x63, 0x16, 0x94, 0x86, 0xbc } };
+FOOGUIDDECL const GUID advconfig_entry_checkbox_v2::class_guid = { 0xe29b37d0, 0xa957, 0x4a85, { 0x82, 0x40, 0x1e, 0x96, 0xc7, 0x29, 0xb6, 0x69 } };
+
+FOOGUIDDECL const GUID config_io_callback_v2::class_guid = { 0xfe784bf0, 0x9504, 0x4e35, { 0x85, 0xe4, 0x72, 0x53, 0x82, 0x62, 0xa1, 0x99 } };
+
+FOOGUIDDECL const GUID contextmenu_item_v2::class_guid = { 0x4bd830ca, 0xe3e6, 0x404e, { 0x95, 0x44, 0xc9, 0xb7, 0xd1, 0x5a, 0x3f, 0x49 } };
+FOOGUIDDECL const GUID contextmenu_group_manager::class_guid = { 0x92ba0c5, 0x5572, 0x48cd, { 0xa4, 0xca, 0x7b, 0x73, 0xde, 0xb, 0x2a, 0xec } };
+FOOGUIDDECL const GUID contextmenu_group::class_guid = { 0x9dcfc219, 0x779, 0x4669, { 0x98, 0xc1, 0x83, 0x6d, 0xf6, 0x7, 0xc5, 0xd4 } };
+FOOGUIDDECL const GUID contextmenu_group_popup::class_guid = { 0x97636ad5, 0x5b2d, 0x4ad6, { 0x9f, 0x79, 0xc9, 0x64, 0x63, 0x88, 0xc8, 0x29 } };
+
+FOOGUIDDECL const GUID contextmenu_groups::root = { 0xe6e7dc71, 0x114b, 0x4848, { 0x92, 0x8c, 0x2a, 0xdc, 0x3f, 0x86, 0xbe, 0xb4 } };
+FOOGUIDDECL const GUID contextmenu_groups::tagging = { 0xc24b5125, 0xad58, 0x4dfd, { 0x99, 0x76, 0xff, 0xbe, 0xba, 0xad, 0xc9, 0x79 } };
+FOOGUIDDECL const GUID contextmenu_groups::utilities = { 0xfb0a55d6, 0xe693, 0x4c4a, { 0x8c, 0x62, 0xf2, 0x4e, 0xa0, 0xce, 0xf8, 0xb7 } };
+FOOGUIDDECL const GUID contextmenu_groups::replaygain = { 0x9640f207, 0x9c98, 0x47b5, { 0x85, 0x7, 0x6c, 0x9c, 0x14, 0x3e, 0x64, 0x15 } };
+FOOGUIDDECL const GUID contextmenu_groups::fileoperations = { 0x62a0e2a4, 0x251d, 0x4315, { 0x88, 0x9b, 0x1, 0x8f, 0x30, 0x8c, 0x7, 0x7a } };
+FOOGUIDDECL const GUID contextmenu_groups::convert = { 0x70429638, 0x502b, 0x466d, { 0xbf, 0x24, 0x46, 0xd, 0xae, 0x23, 0x10, 0x91 } };
+FOOGUIDDECL const GUID contextmenu_groups::playbackstatistics = { 0x12ad3123, 0xd934, 0x4241, { 0xa7, 0x1, 0x92, 0x7e, 0x87, 0x7, 0xd1, 0xdc } };
+FOOGUIDDECL const GUID contextmenu_groups::properties = { 0xb38cb9f, 0xa92d, 0x4fa4, { 0xb4, 0x58, 0x70, 0xd2, 0xfd, 0x39, 0x25, 0xba } };
+FOOGUIDDECL const GUID contextmenu_groups::legacy = { 0xbebb1711, 0x20e, 0x46ed, { 0xa7, 0xf8, 0xa3, 0x26, 0x27, 0x18, 0x4a, 0x88 } };
+
+FOOGUIDDECL const GUID mainmenu_commands_v2::class_guid = { 0xe682e810, 0x41f3, 0x434d, { 0xb0, 0xc7, 0xd4, 0x96, 0x90, 0xe6, 0x5f, 0x87 } };
+FOOGUIDDECL const GUID mainmenu_node::class_guid = { 0xabba6512, 0x377d, 0x414f, { 0x81, 0x3e, 0x68, 0x6, 0xc2, 0x2d, 0x4d, 0xb1 } };
+
+FOOGUIDDECL const GUID system_time_keeper::class_guid = { 0xdc5d4938, 0x7927, 0x48ba, { 0xbf, 0x84, 0xda, 0x2f, 0xb1, 0xb, 0x36, 0xf2 } };
+
+FOOGUIDDECL const GUID component_installation_validator::class_guid = { 0x639283e, 0x3004, 0x4e5c, { 0xb1, 0xb3, 0x6d, 0xff, 0x8, 0xa7, 0x92, 0x84 } };
+
+FOOGUIDDECL const GUID playback_stream_capture::class_guid = { 0x9423439e, 0x8cd5, 0x45d7, { 0xaa, 0x6d, 0x4b, 0x98, 0xc, 0x22, 0x93, 0x3e } };
+
+FOOGUIDDECL const GUID http_request::class_guid = { 0x48580056, 0x2c5f, 0x45a8, { 0xb8, 0x6e, 0x5, 0x83, 0x55, 0x3e, 0xaa, 0x4f } };
+FOOGUIDDECL const GUID http_request_post::class_guid = { 0xe254b804, 0xeac5, 0x4be0, { 0x99, 0x4d, 0x53, 0x1c, 0x17, 0xea, 0xfd, 0x37 } };
+FOOGUIDDECL const GUID http_client::class_guid = { 0x3b5ffe0c, 0xd75a, 0x491e, { 0xbb, 0x6f, 0x10, 0x3f, 0x73, 0x1e, 0x81, 0x84 } };
+FOOGUIDDECL const GUID http_reply::class_guid = { 0x7f02bf78, 0x5c98, 0x4d6d, { 0x83, 0x6b, 0xb7, 0x77, 0xa4, 0xa3, 0x3e, 0xe5 } };
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/hasher_md5.cpp b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/hasher_md5.cpp new file mode 100644 index 0000000000..0d693dd89e --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/hasher_md5.cpp @@ -0,0 +1,35 @@ +#include "foobar2000.h"
+
+GUID hasher_md5::guid_from_result(const hasher_md5_result & param)
+{
+ assert(sizeof(GUID) == sizeof(hasher_md5_result));
+ GUID temp = * reinterpret_cast<const GUID*>(¶m);
+ byte_order::order_le_to_native_t(temp);
+ return temp;
+}
+
+hasher_md5_result hasher_md5::process_single(const void * p_buffer,t_size p_bytes)
+{
+ hasher_md5_state state;
+ initialize(state);
+ process(state,p_buffer,p_bytes);
+ return get_result(state);
+}
+
+GUID hasher_md5::process_single_guid(const void * p_buffer,t_size p_bytes)
+{
+ return guid_from_result(process_single(p_buffer,p_bytes));
+}
+
+t_uint64 hasher_md5_result::xorHalve() const {
+#if PFC_BYTE_ORDER_IS_BIG_ENDIAN
+ t_uint64 ret = 0;
+ for(int walk = 0; walk < 8; ++walk) {
+ ret |= (t_uint64)((t_uint8)m_data[walk] ^ (t_uint8)m_data[walk+8]) << (walk * 8);
+ }
+ return ret;
+#else
+ const t_uint64 * v = reinterpret_cast<const t_uint64*>(&m_data);
+ return v[0] ^ v[1];
+#endif
+}
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/hasher_md5.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/hasher_md5.h new file mode 100644 index 0000000000..de6d5edba3 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/hasher_md5.h @@ -0,0 +1,80 @@ +struct hasher_md5_state {
+ char m_data[128];
+};
+
+struct hasher_md5_result {
+ char m_data[16];
+
+ t_uint64 xorHalve() const;
+};
+
+inline bool operator==(const hasher_md5_result & p_item1,const hasher_md5_result & p_item2) {return memcmp(&p_item1,&p_item2,sizeof(hasher_md5_result)) == 0;}
+inline bool operator!=(const hasher_md5_result & p_item1,const hasher_md5_result & p_item2) {return memcmp(&p_item1,&p_item2,sizeof(hasher_md5_result)) != 0;}
+
+namespace pfc {
+ template<> class traits_t<hasher_md5_state> : public traits_rawobject {};
+ template<> class traits_t<hasher_md5_result> : public traits_rawobject {};
+
+ template<> inline int compare_t(const hasher_md5_result & p_item1, const hasher_md5_result & p_item2) {
+ return memcmp(&p_item1, &p_item2, sizeof(hasher_md5_result));
+ }
+
+}
+
+class NOVTABLE hasher_md5 : public service_base
+{
+public:
+
+ virtual void initialize(hasher_md5_state & p_state) = 0;
+ virtual void process(hasher_md5_state & p_state,const void * p_buffer,t_size p_bytes) = 0;
+ virtual hasher_md5_result get_result(const hasher_md5_state & p_state) = 0;
+
+
+ static GUID guid_from_result(const hasher_md5_result & param);
+
+ hasher_md5_result process_single(const void * p_buffer,t_size p_bytes);
+ GUID process_single_guid(const void * p_buffer,t_size p_bytes);
+ GUID get_result_guid(const hasher_md5_state & p_state) {return guid_from_result(get_result(p_state));}
+
+
+ //! Helper
+ void process_string(hasher_md5_state & p_state,const char * p_string,t_size p_length = ~0) {return process(p_state,p_string,pfc::strlen_max(p_string,p_length));}
+
+ FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(hasher_md5);
+};
+
+
+class stream_writer_hasher_md5 : public stream_writer {
+public:
+ stream_writer_hasher_md5() {
+ m_hasher->initialize(m_state);
+ }
+ void write(const void * p_buffer,t_size p_bytes,abort_callback & p_abort) {
+ p_abort.check();
+ m_hasher->process(m_state,p_buffer,p_bytes);
+ }
+ hasher_md5_result result() const {
+ return m_hasher->get_result(m_state);
+ }
+ GUID resultGuid() const {
+ return hasher_md5::guid_from_result(result());
+ }
+private:
+ hasher_md5_state m_state;
+ static_api_ptr_t<hasher_md5> m_hasher;
+};
+template<bool isBigEndian = false>
+class stream_formatter_hasher_md5 : public stream_writer_formatter<isBigEndian> {
+public:
+ stream_formatter_hasher_md5() : stream_writer_formatter<isBigEndian>(_m_stream,_m_abort) {}
+
+ hasher_md5_result result() const {
+ return _m_stream.result();
+ }
+ GUID resultGuid() const {
+ return hasher_md5::guid_from_result(result());
+ }
+private:
+ abort_callback_dummy _m_abort;
+ stream_writer_hasher_md5 _m_stream;
+};
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/http_client.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/http_client.h new file mode 100644 index 0000000000..e37b770008 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/http_client.h @@ -0,0 +1,44 @@ +//! Implemented by file object returned by http_request::run methods. Allows you to retrieve various additional information returned by the server. \n
+//! Warning: reply status may change when seeking on the file object since seek operations often require a new HTTP request to be fired.
+class NOVTABLE http_reply : public service_base {
+ FB2K_MAKE_SERVICE_INTERFACE(http_reply, service_base)
+public:
+ //! Retrieves the status line, eg. "200 OK".
+ virtual void get_status(pfc::string_base & out) = 0;
+ //! Retrieves a HTTP header value, eg. "content-type". Note that get_http_header("content-type", out) is equivalent to get_content_type(out). If there are multiple matching header entries, value of the first one will be returned.
+ virtual bool get_http_header(const char * name, pfc::string_base & out) = 0;
+ //! Retrieves a HTTP header value, eg. "content-type". If there are multiple matching header entries, this will return all their values, delimited by \r\n.
+ virtual bool get_http_header_multi(const char * name, pfc::string_base & out) = 0;
+};
+
+class NOVTABLE http_request : public service_base {
+ FB2K_MAKE_SERVICE_INTERFACE(http_request, service_base)
+public:
+ //! Adds a HTTP request header line.
+ //! @param line Request to be added, without trailing \r\n.
+ virtual void add_header(const char * line) = 0;
+ //! Runs the request on the specified URL. Throws an exception on failure (connection error, invalid response from the server, reply code other than 2XX), returns a file::ptr interface to the stream on success.
+ virtual file::ptr run(const char * url, abort_callback & abort) = 0;
+ //! Runs the request on the specified URL. Throws an exception on failure but returns normally if the HTTP server returned a valid response other than 2XX, so the caller can still parse the received data stream if the server has returned an error.
+ virtual file::ptr run_ex(const char * url, abort_callback & abort) = 0;
+};
+
+class NOVTABLE http_request_post : public http_request {
+ FB2K_MAKE_SERVICE_INTERFACE(http_request_post, http_request);
+public:
+ //! Adds a HTTP POST field.
+ //! @param name Field name.
+ //! @param fileName File name to be included in the POST request; leave empty ("") not to send a file name.
+ //! @param contentType Content type of the entry; leave empty ("") not to send content type.
+ virtual void add_post_data(const char * name, const void * data, t_size dataSize, const char * fileName, const char * contentType) = 0;
+
+ void add_post_data(const char * name, const char * value) { add_post_data(name, value, strlen(value), "", ""); }
+};
+
+class NOVTABLE http_client : public service_base {
+ FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(http_client)
+public:
+ //! Creates a HTTP request object.
+ //! @param type Request type. Currently supported: "GET" and "POST". Throws pfc::exception_not_implemented for unsupported values.
+ virtual http_request::ptr create_request(const char * type) = 0;
+};
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/icon_remap.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/icon_remap.h new file mode 100644 index 0000000000..0df7f77b57 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/icon_remap.h @@ -0,0 +1,26 @@ +//! New in 0.9.5; allows your file format to use another icon than <extension>.ico when registering the file type with Windows shell. \n
+//! Implementation: use icon_remapping_impl, or simply: static service_factory_single_t<icon_remapping_impl> myicon("ext","iconname.ico");
+class icon_remapping : public service_base {
+public:
+ //! @param p_extension File type extension being queried.
+ //! @param p_iconname Receives the icon name to use, including the .ico extension.
+ //! @returns True when p_iconname has been set, false if we don't recognize the specified extension.
+ virtual bool query(const char * p_extension,pfc::string_base & p_iconname) = 0;
+
+ FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(icon_remapping);
+};
+
+//! Standard implementation of icon_remapping.
+class icon_remapping_impl : public icon_remapping {
+public:
+ icon_remapping_impl(const char * p_extension,const char * p_iconname) : m_extension(p_extension), m_iconname(p_iconname) {}
+ bool query(const char * p_extension,pfc::string_base & p_iconname) {
+ if (stricmp_utf8(p_extension,m_extension) == 0) {
+ p_iconname = m_iconname; return true;
+ } else {
+ return false;
+ }
+ }
+private:
+ pfc::string8 m_extension,m_iconname;
+};
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/info_lookup_handler.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/info_lookup_handler.h new file mode 100644 index 0000000000..fc68591cfb --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/info_lookup_handler.h @@ -0,0 +1,24 @@ +//! Service used to access various external (online) track info lookup services, such as freedb, to update file tags with info retrieved from those services.
+class NOVTABLE info_lookup_handler : public service_base {
+public:
+ enum {
+ flag_album_lookup = 1 << 0,
+ flag_track_lookup = 1 << 1,
+ };
+
+ //! Retrieves human-readable name of the lookup handler to display in user interface.
+ virtual void get_name(pfc::string_base & p_out) = 0;
+
+ //! Returns one or more of flag_track_lookup, and flag_album_lookup.
+ virtual t_uint32 get_flags() = 0;
+
+ virtual HICON get_icon(int p_width, int p_height) = 0;
+
+ //! Performs a lookup. Creates a modeless dialog and returns immediately.
+ //! @param p_items Items to look up.
+ //! @param p_notify Callback to notify caller when the operation has completed. Call on_completion with status code 0 to signal failure/abort, or with code 1 to signal success / new infos in metadb.
+ //! @param p_parent Parent window for the lookup dialog. Caller will typically disable the window while lookup is in progress and enable it back when completion is signaled.
+ virtual void lookup(const pfc::list_base_const_t<metadb_handle_ptr> & p_items,completion_notify_ptr p_notify,HWND p_parent) = 0;
+
+ FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(info_lookup_handler);
+};
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/initquit.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/initquit.h new file mode 100644 index 0000000000..42b99750c2 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/initquit.h @@ -0,0 +1,17 @@ +//! Basic callback startup/shutdown callback, on_init is called after the main window has been created, on_quit is called before the main window is destroyed. \n
+//! To register: static initquit_factory_t<myclass> myclass_factory; \n
+//! Note that you should be careful with calling other components during on_init/on_quit or \n
+//! initializing services that are possibly used by other components by on_init/on_quit - \n
+//! initialization order of components is undefined.
+//! If some other service that you publish is not properly functional before you receive an on_init() call, \n
+//! someone else might call this service before >your< on_init is invoked.
+class NOVTABLE initquit : public service_base {
+public:
+ virtual void on_init() {}
+ virtual void on_quit() {}
+
+ FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(initquit);
+};
+
+template<typename T>
+class initquit_factory_t : public service_factory_single_t<T> {};
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/input.cpp b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/input.cpp new file mode 100644 index 0000000000..3af8caaa65 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/input.cpp @@ -0,0 +1,248 @@ +#include "foobar2000.h"
+
+
+bool input_entry::g_find_service_by_path(service_ptr_t<input_entry> & p_out,const char * p_path)
+{
+ service_ptr_t<input_entry> ptr;
+ service_enum_t<input_entry> e;
+ pfc::string_extension ext(p_path);
+ while(e.next(ptr))
+ {
+ if (ptr->is_our_path(p_path,ext))
+ {
+ p_out = ptr;
+ return true;
+ }
+ }
+ return false;
+}
+
+bool input_entry::g_find_service_by_content_type(service_ptr_t<input_entry> & p_out,const char * p_content_type)
+{
+ service_ptr_t<input_entry> ptr;
+ service_enum_t<input_entry> e;
+ while(e.next(ptr))
+ {
+ if (ptr->is_our_content_type(p_content_type))
+ {
+ p_out = ptr;
+ return true;
+ }
+ }
+ return false;
+}
+
+
+
+static void prepare_for_open(service_ptr_t<input_entry> & p_service,service_ptr_t<file> & p_file,const char * p_path,filesystem::t_open_mode p_open_mode,abort_callback & p_abort,bool p_from_redirect)
+{
+ if (p_file.is_empty())
+ {
+ service_ptr_t<filesystem> fs;
+ if (filesystem::g_get_interface(fs,p_path)) {
+ if (fs->supports_content_types()) {
+ fs->open(p_file,p_path,p_open_mode,p_abort);
+ }
+ }
+ }
+
+ if (p_file.is_valid())
+ {
+ pfc::string8 content_type;
+ if (p_file->get_content_type(content_type))
+ {
+ if (input_entry::g_find_service_by_content_type(p_service,content_type))
+ return;
+ }
+ }
+
+ if (input_entry::g_find_service_by_path(p_service,p_path))
+ {
+ if (p_from_redirect && p_service->is_redirect()) throw exception_io_unsupported_format();
+ return;
+ }
+
+ throw exception_io_unsupported_format();
+}
+
+namespace {
+
+ bool g_find_inputs_by_content_type(pfc::list_base_t<service_ptr_t<input_entry> > & p_out,const char * p_content_type,bool p_from_redirect) {
+ service_enum_t<input_entry> e;
+ service_ptr_t<input_entry> ptr;
+ bool ret = false;
+ while(e.next(ptr)) {
+ if (!(p_from_redirect && ptr->is_redirect())) {
+ if (ptr->is_our_content_type(p_content_type)) {p_out.add_item(ptr); ret = true;}
+ }
+ }
+ return ret;
+ }
+
+ bool g_find_inputs_by_path(pfc::list_base_t<service_ptr_t<input_entry> > & p_out,const char * p_path,bool p_from_redirect) {
+ service_enum_t<input_entry> e;
+ service_ptr_t<input_entry> ptr;
+ pfc::string_extension extension(p_path);
+ bool ret = false;
+ while(e.next(ptr)) {
+ if (!(p_from_redirect && ptr->is_redirect())) {
+ if (ptr->is_our_path(p_path,extension)) {p_out.add_item(ptr); ret = true;}
+ }
+ }
+ return ret;
+ }
+
+ template<typename t_service> void g_open_from_list(service_ptr_t<t_service> & p_instance,pfc::list_base_const_t<service_ptr_t<input_entry> > const & p_list,service_ptr_t<file> const & p_filehint,const char * p_path,abort_callback & p_abort) {
+ const t_size count = p_list.get_count();
+ if (count == 1) {
+ p_list[0]->open(p_instance,p_filehint,p_path,p_abort);
+ } else {
+ bool got_bad_data = false, got_bad_data_multi = false;
+ bool done = false;
+ pfc::string8 bad_data_message;
+ for(t_size n=0;n<count && !done;n++) {
+ try {
+ p_list[n]->open(p_instance,p_filehint,p_path,p_abort);
+ done = true;
+ } catch(exception_io_unsupported_format) {
+ //do nothing, skip over
+ } catch(exception_io_data const & e) {
+ if (!got_bad_data) bad_data_message = e.what();
+ else got_bad_data_multi = true;
+ got_bad_data = true;
+ }
+ }
+ if (!done) {
+ if (got_bad_data_multi) throw exception_io_data();
+ else if (got_bad_data) throw exception_io_data(bad_data_message);
+ else throw exception_io_unsupported_format();
+ }
+ }
+ }
+
+ template<typename t_service> bool needs_write_access() {return false;}
+ template<> bool needs_write_access<input_info_writer>() {return true;}
+
+ template<typename t_service> void g_open_t(service_ptr_t<t_service> & p_instance,service_ptr_t<file> const & p_filehint,const char * p_path,abort_callback & p_abort,bool p_from_redirect) {
+ service_ptr_t<file> l_file = p_filehint;
+ if (l_file.is_empty()) {
+ service_ptr_t<filesystem> fs;
+ if (filesystem::g_get_interface(fs,p_path)) {
+ if (fs->supports_content_types()) {
+ fs->open(l_file,p_path,needs_write_access<t_service>() ? filesystem::open_mode_write_existing : filesystem::open_mode_read,p_abort);
+ }
+ }
+ }
+
+ if (l_file.is_valid()) {
+ pfc::string8 content_type;
+ if (l_file->get_content_type(content_type)) {
+ pfc::list_hybrid_t<service_ptr_t<input_entry>,4> list;
+ if (g_find_inputs_by_content_type(list,content_type,p_from_redirect)) {
+ g_open_from_list(p_instance,list,l_file,p_path,p_abort);
+ return;
+ }
+ }
+ }
+
+ {
+ pfc::list_hybrid_t<service_ptr_t<input_entry>,4> list;
+ if (g_find_inputs_by_path(list,p_path,p_from_redirect)) {
+ g_open_from_list(p_instance,list,l_file,p_path,p_abort);
+ return;
+ }
+ }
+
+ throw exception_io_unsupported_format();
+ }
+};
+
+void input_entry::g_open_for_decoding(service_ptr_t<input_decoder> & p_instance,service_ptr_t<file> p_filehint,const char * p_path,abort_callback & p_abort,bool p_from_redirect) {
+ TRACK_CALL_TEXT("input_entry::g_open_for_decoding");
+#if 1
+ g_open_t(p_instance,p_filehint,p_path,p_abort,p_from_redirect);
+#else
+ service_ptr_t<file> filehint = p_filehint;
+ service_ptr_t<input_entry> entry;
+
+ prepare_for_open(entry,filehint,p_path,filesystem::open_mode_read,p_abort,p_from_redirect);
+
+ entry->open_for_decoding(p_instance,filehint,p_path,p_abort);
+#endif
+
+}
+
+void input_entry::g_open_for_info_read(service_ptr_t<input_info_reader> & p_instance,service_ptr_t<file> p_filehint,const char * p_path,abort_callback & p_abort,bool p_from_redirect) {
+ TRACK_CALL_TEXT("input_entry::g_open_for_info_read");
+#if 1
+ g_open_t(p_instance,p_filehint,p_path,p_abort,p_from_redirect);
+#else
+ service_ptr_t<file> filehint = p_filehint;
+ service_ptr_t<input_entry> entry;
+
+ prepare_for_open(entry,filehint,p_path,filesystem::open_mode_read,p_abort,p_from_redirect);
+
+ entry->open_for_info_read(p_instance,filehint,p_path,p_abort);
+#endif
+}
+
+void input_entry::g_open_for_info_write(service_ptr_t<input_info_writer> & p_instance,service_ptr_t<file> p_filehint,const char * p_path,abort_callback & p_abort,bool p_from_redirect) {
+ TRACK_CALL_TEXT("input_entry::g_open_for_info_write");
+#if 1
+ g_open_t(p_instance,p_filehint,p_path,p_abort,p_from_redirect);
+#else
+ service_ptr_t<file> filehint = p_filehint;
+ service_ptr_t<input_entry> entry;
+
+ prepare_for_open(entry,filehint,p_path,filesystem::open_mode_write_existing,p_abort,p_from_redirect);
+
+ entry->open_for_info_write(p_instance,filehint,p_path,p_abort);
+#endif
+}
+
+void input_entry::g_open_for_info_write_timeout(service_ptr_t<input_info_writer> & p_instance,service_ptr_t<file> p_filehint,const char * p_path,abort_callback & p_abort,double p_timeout,bool p_from_redirect) {
+ pfc::lores_timer timer;
+ timer.start();
+ for (;;) {
+ try {
+ g_open_for_info_write(p_instance,p_filehint,p_path,p_abort,p_from_redirect);
+ break;
+ } catch(exception_io_sharing_violation) {
+ if (timer.query() > p_timeout) throw;
+ p_abort.sleep(0.01);
+ }
+ }
+}
+
+bool input_entry::g_is_supported_path(const char * p_path)
+{
+ service_ptr_t<input_entry> ptr;
+ service_enum_t<input_entry> e;
+ pfc::string_extension ext(p_path);
+ while(e.next(ptr))
+ {
+ if (ptr->is_our_path(p_path,ext)) return true;
+ }
+ return false;
+}
+
+
+
+void input_open_file_helper(service_ptr_t<file> & p_file,const char * p_path,t_input_open_reason p_reason,abort_callback & p_abort)
+{
+ if (p_file.is_empty()) {
+ switch(p_reason) {
+ default:
+ uBugCheck();
+ case input_open_info_read:
+ case input_open_decode:
+ filesystem::g_open(p_file,p_path,filesystem::open_mode_read,p_abort);
+ break;
+ case input_open_info_write:
+ filesystem::g_open(p_file,p_path,filesystem::open_mode_write_existing,p_abort);
+ break;
+ }
+ } else {
+ p_file->reopen(p_abort);
+ }
+}
\ No newline at end of file diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/input.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/input.h new file mode 100644 index 0000000000..641b11e2ae --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/input.h @@ -0,0 +1,200 @@ +PFC_DECLARE_EXCEPTION(exception_tagging_unsupported, exception_io_data, "Tagging of this file format is not supported")
+
+enum {
+ input_flag_no_seeking = 1 << 0,
+ input_flag_no_looping = 1 << 1,
+ input_flag_playback = 1 << 2,
+ input_flag_testing_integrity = 1 << 3,
+ input_flag_allow_inaccurate_seeking = 1 << 4,
+
+ input_flag_simpledecode = input_flag_no_seeking|input_flag_no_looping,
+};
+
+//! Class providing interface for retrieval of information (metadata, duration, replaygain, other tech infos) from files. Also see: file_info. \n
+//! Instantiating: see input_entry.\n
+//! Implementing: see input_impl.
+
+class NOVTABLE input_info_reader : public service_base
+{
+public:
+ //! Retrieves count of subsongs in the file. 1 for non-multisubsong-enabled inputs.
+ //! Note: multi-subsong handling is disabled for remote files (see: filesystem::is_remote) for performance reasons. Remote files are always assumed to be single-subsong, with null index.
+ virtual t_uint32 get_subsong_count() = 0;
+
+ //! Retrieves identifier of specified subsong; this identifier is meant to be used in playable_location as well as a parameter for input_info_reader::get_info().
+ //! @param p_index Index of subsong to query. Must be >=0 and < get_subsong_count().
+ virtual t_uint32 get_subsong(t_uint32 p_index) = 0;
+
+ //! Retrieves information about specified subsong.
+ //! @param p_subsong Identifier of the subsong to query. See: input_info_reader::get_subsong(), playable_location.
+ //! @param p_info file_info object to fill. Must be empty on entry.
+ //! @param p_abort abort_callback object signaling user aborting the operation.
+ virtual void get_info(t_uint32 p_subsong,file_info & p_info,abort_callback & p_abort) = 0;
+
+ //! Retrieves file stats. Equivalent to calling get_stats() on file object.
+ virtual t_filestats get_file_stats(abort_callback & p_abort) = 0;
+
+ FB2K_MAKE_SERVICE_INTERFACE(input_info_reader,service_base);
+};
+
+//! Class providing interface for retrieval of PCM audio data from files.\n
+//! Instantiating: see input_entry.\n
+//! Implementing: see input_impl.
+
+class NOVTABLE input_decoder : public input_info_reader
+{
+public:
+ //! Prepares to decode specified subsong; resets playback position to the beginning of specified subsong. This must be called first, before any other input_decoder methods (other than those inherited from input_info_reader). \n
+ //! It is legal to set initialize() more than once, with same or different subsong, to play either the same subsong again or another subsong from same file without full reopen.\n
+ //! Warning: this interface inherits from input_info_reader, it is legal to call any input_info_reader methods even during decoding! Call order is not defined, other than initialize() requirement before calling other input_decoder methods.\n
+ //! @param p_subsong Subsong to decode. Should always be 0 for non-multi-subsong-enabled inputs.
+ //! @param p_flags Specifies additional hints for decoding process. It can be null, or a combination of one or more following constants: \n
+ //! input_flag_no_seeking - Indicates that seek() will never be called. Can be used to avoid building potentially expensive seektables when only sequential reading is needed.\n
+ //! input_flag_no_looping - Certain input implementations can be configured to utilize looping info from file formats they process and keep playing single file forever, or keep repeating it specified number of times. This flag indicates that such features should be disabled, for e.g. ReplayGain scan or conversion.\n
+ //! input_flag_playback - Indicates that decoding process will be used for realtime playback rather than conversion. This can be used to reconfigure features that are relevant only for conversion and take a lot of resources, such as very slow secure CDDA reading. \n
+ //! input_flag_testing_integrity - Indicates that we're testing integrity of the file. Any recoverable problems where decoding would normally continue should cause decoder to fail with exception_io_data.
+ //! @param p_abort abort_callback object signaling user aborting the operation.
+ virtual void initialize(t_uint32 p_subsong,unsigned p_flags,abort_callback & p_abort) = 0;
+
+ //! Reads/decodes one chunk of audio data. Use false return value to signal end of file (no more data to return). Before calling run(), decoding must be initialized by initialize() call.
+ //! @param p_chunk audio_chunk object receiving decoded data. Contents are valid only the method returns true.
+ //! @param p_abort abort_callback object signaling user aborting the operation.
+ //! @returns true on success (new data decoded), false on EOF.
+ virtual bool run(audio_chunk & p_chunk,abort_callback & p_abort) = 0;
+
+ //! Seeks to specified time offset. Before seeking or other decoding calls, decoding must be initialized with initialize() call.
+ //! @param p_seconds Time to seek to, in seconds. If p_seconds exceeds length of the object being decoded, succeed, and then return false from next run() call.
+ //! @param p_abort abort_callback object signaling user aborting the operation.
+ virtual void seek(double p_seconds,abort_callback & p_abort) = 0;
+
+ //! Queries whether resource being read/decoded is seekable. If p_value is set to false, all seek() calls will fail. Before calling can_seek() or other decoding calls, decoding must be initialized with initialize() call.
+ virtual bool can_seek() = 0;
+
+ //! This function is used to signal dynamic VBR bitrate, etc. Called after each run() (or not called at all if caller doesn't care about dynamic info).
+ //! @param p_out Initially contains currently displayed info (either last get_dynamic_info result or current cached info), use this object to return changed info.
+ //! @param p_timestamp_delta Indicates when returned info should be displayed (in seconds, relative to first sample of last decoded chunk), initially set to 0.
+ //! @returns false to keep old info, or true to indicate that changes have been made to p_info and those should be displayed.
+ virtual bool get_dynamic_info(file_info & p_out, double & p_timestamp_delta) = 0;
+
+ //! This function is used to signal dynamic live stream song titles etc. Called after each run() (or not called at all if caller doesn't care about dynamic info). The difference between this and get_dynamic_info() is frequency and relevance of dynamic info changes - get_dynamic_info_track() returns new info only on track change in the stream, returning new titles etc.
+ //! @param p_out Initially contains currently displayed info (either last get_dynamic_info_track result or current cached info), use this object to return changed info.
+ //! @param p_timestamp_delta Indicates when returned info should be displayed (in seconds, relative to first sample of last decoded chunk), initially set to 0.
+ //! @returns false to keep old info, or true to indicate that changes have been made to p_info and those should be displayed.
+ virtual bool get_dynamic_info_track(file_info & p_out, double & p_timestamp_delta) = 0;
+
+ //! Called from playback thread before sleeping.
+ //! @param p_abort abort_callback object signaling user aborting the operation.
+ virtual void on_idle(abort_callback & p_abort) = 0;
+
+
+ FB2K_MAKE_SERVICE_INTERFACE(input_decoder,input_info_reader);
+};
+
+
+class NOVTABLE input_decoder_v2 : public input_decoder {
+ FB2K_MAKE_SERVICE_INTERFACE(input_decoder_v2, input_decoder)
+public:
+
+ //! OPTIONAL, throws pfc::exception_not_implemented() when not supported by this implementation.
+ //! Special version of run(). Returns an audio_chunk object as well as a raw data block containing original PCM stream. This is mainly used for MD5 checks on lossless formats. \n
+ //! If you set a "MD5" tech info entry in get_info(), you should make sure that run_raw() returns data stream that can be used to verify it. \n
+ //! Returned raw data should be possible to cut into individual samples; size in bytes should be divisible by audio_chunk's sample count for splitting in case partial output is needed (with cuesheets etc).
+ virtual bool run_raw(audio_chunk & out, mem_block_container & outRaw, abort_callback & abort) = 0;
+
+ //! OPTIONAL, the call is ignored if this implementation doesn't support status logging. \n
+ //! Mainly used to generate logs when ripping CDs etc.
+ virtual void set_logger(event_logger::ptr ptr) = 0;
+};
+
+class NOVTABLE input_decoder_v3 : public input_decoder_v2 {
+ FB2K_MAKE_SERVICE_INTERFACE(input_decoder_v3, input_decoder_v2);
+public:
+ //! OPTIONAL, in case your input cares about paused/unpaused state, handle this to do any necessary additional processing. Valid only after initialize() with input_flag_playback.
+ virtual void set_pause(bool paused) = 0;
+ //! OPTIONAL, should return false in most cases; return true to force playback buffer flush on unpause. Valid only after initialize() with input_flag_playback.
+ virtual bool flush_on_pause() = 0;
+};
+
+//! Class providing interface for writing metadata and replaygain info to files. Also see: file_info. \n
+//! Instantiating: see input_entry.\n
+//! Implementing: see input_impl.
+
+class NOVTABLE input_info_writer : public input_info_reader
+{
+public:
+ //! Tells the service to update file tags with new info for specified subsong.
+ //! @param p_subsong Subsong to update. Should be always 0 for non-multisubsong-enabled inputs.
+ //! @param p_info New info to write. Sometimes not all contents of p_info can be written. Caller will typically read info back after successful write, so e.g. tech infos that change with retag are properly maintained.
+ //! @param p_abort abort_callback object signaling user aborting the operation. WARNING: abort_callback object is provided for consistency; if writing tags actually gets aborted, user will be likely left with corrupted file. Anything calling this should make sure that aborting is either impossible, or gives appropriate warning to the user first.
+ virtual void set_info(t_uint32 p_subsong,const file_info & p_info,abort_callback & p_abort) = 0;
+
+ //! Commits pending updates. In case of multisubsong inputs, set_info should queue the update and perform actual file access in commit(). Otherwise, actual writing can be done in set_info() and then Commit() can just do nothing and always succeed.
+ //! @param p_abort abort_callback object signaling user aborting the operation. WARNING: abort_callback object is provided for consistency; if writing tags actually gets aborted, user will be likely left with corrupted file. Anything calling this should make sure that aborting is either impossible, or gives appropriate warning to the user first.
+ virtual void commit(abort_callback & p_abort) = 0;
+
+ FB2K_MAKE_SERVICE_INTERFACE(input_info_writer,input_info_reader);
+};
+
+class NOVTABLE input_entry : public service_base
+{
+public:
+ //! Determines whether specified content type can be handled by this input.
+ //! @param p_type Content type string to test.
+ virtual bool is_our_content_type(const char * p_type)=0;
+
+ //! Determines whether specified file type can be handled by this input. This must not use any kind of file access; the result should be only based on file path / extension.
+ //! @param p_full_path Full URL of file being tested.
+ //! @param p_extension Extension of file being tested, provided by caller for performance reasons.
+ virtual bool is_our_path(const char * p_full_path,const char * p_extension)=0;
+
+ //! Opens specified resource for decoding.
+ //! @param p_instance Receives new input_decoder instance if successful.
+ //! @param p_filehint Optional; passes file object to use for the operation; if set to null, the service will handle opening file by itself. Note that not all inputs operate on physical files that can be reached through filesystem API, some of them require this parameter to be set to null (tone and silence generators for an example).
+ //! @param p_path URL of resource being opened.
+ //! @param p_abort abort_callback object signaling user aborting the operation.
+ virtual void open_for_decoding(service_ptr_t<input_decoder> & p_instance,service_ptr_t<file> p_filehint,const char * p_path,abort_callback & p_abort) = 0;
+
+ //! Opens specified file for reading info.
+ //! @param p_instance Receives new input_info_reader instance if successful.
+ //! @param p_filehint Optional; passes file object to use for the operation; if set to null, the service will handle opening file by itself. Note that not all inputs operate on physical files that can be reached through filesystem API, some of them require this parameter to be set to null (tone and silence generators for an example).
+ //! @param p_path URL of resource being opened.
+ //! @param p_abort abort_callback object signaling user aborting the operation.
+ virtual void open_for_info_read(service_ptr_t<input_info_reader> & p_instance,service_ptr_t<file> p_filehint,const char * p_path,abort_callback & p_abort) = 0;
+
+ //! Opens specified file for writing info.
+ //! @param p_instance Receives new input_info_writer instance if successful.
+ //! @param p_filehint Optional; passes file object to use for the operation; if set to null, the service will handle opening file by itself. Note that not all inputs operate on physical files that can be reached through filesystem API, some of them require this parameter to be set to null (tone and silence generators for an example).
+ //! @param p_path URL of resource being opened.
+ //! @param p_abort abort_callback object signaling user aborting the operation.
+ virtual void open_for_info_write(service_ptr_t<input_info_writer> & p_instance,service_ptr_t<file> p_filehint,const char * p_path,abort_callback & p_abort) = 0;
+
+ //! Reserved for future use. Do nothing and return until specifications are finalized.
+ virtual void get_extended_data(service_ptr_t<file> p_filehint,const playable_location & p_location,const GUID & p_guid,mem_block_container & p_out,abort_callback & p_abort) = 0;
+
+ enum {
+ //! Indicates that this service implements some kind of redirector that opens another input for decoding, used to avoid circular call possibility.
+ flag_redirect = 1,
+ //! Indicates that multi-CPU optimizations should not be used.
+ flag_parallel_reads_slow = 2,
+ };
+ //! See flag_* enums.
+ virtual unsigned get_flags() = 0;
+
+ inline bool is_redirect() {return (get_flags() & flag_redirect) != 0;}
+ inline bool are_parallel_reads_slow() {return (get_flags() & flag_parallel_reads_slow) != 0;}
+
+ static bool g_find_service_by_path(service_ptr_t<input_entry> & p_out,const char * p_path);
+ static bool g_find_service_by_content_type(service_ptr_t<input_entry> & p_out,const char * p_content_type);
+ static void g_open_for_decoding(service_ptr_t<input_decoder> & p_instance,service_ptr_t<file> p_filehint,const char * p_path,abort_callback & p_abort,bool p_from_redirect = false);
+ static void g_open_for_info_read(service_ptr_t<input_info_reader> & p_instance,service_ptr_t<file> p_filehint,const char * p_path,abort_callback & p_abort,bool p_from_redirect = false);
+ static void g_open_for_info_write(service_ptr_t<input_info_writer> & p_instance,service_ptr_t<file> p_filehint,const char * p_path,abort_callback & p_abort,bool p_from_redirect = false);
+ static void g_open_for_info_write_timeout(service_ptr_t<input_info_writer> & p_instance,service_ptr_t<file> p_filehint,const char * p_path,abort_callback & p_abort,double p_timeout,bool p_from_redirect = false);
+ static bool g_is_supported_path(const char * p_path);
+
+
+ void open(service_ptr_t<input_decoder> & p_instance,service_ptr_t<file> const & p_filehint,const char * p_path,abort_callback & p_abort) {open_for_decoding(p_instance,p_filehint,p_path,p_abort);}
+ void open(service_ptr_t<input_info_reader> & p_instance,service_ptr_t<file> const & p_filehint,const char * p_path,abort_callback & p_abort) {open_for_info_read(p_instance,p_filehint,p_path,p_abort);}
+ void open(service_ptr_t<input_info_writer> & p_instance,service_ptr_t<file> const & p_filehint,const char * p_path,abort_callback & p_abort) {open_for_info_write(p_instance,p_filehint,p_path,p_abort);}
+
+ FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(input_entry);
+};
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/input_file_type.cpp b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/input_file_type.cpp new file mode 100644 index 0000000000..b174b5c76b --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/input_file_type.cpp @@ -0,0 +1,113 @@ +#include "foobar2000.h"
+
+#if FOOBAR2000_TARGET_VERSION >= 76
+
+typedef pfc::avltree_t<pfc::string8,pfc::io::path::comparator> t_fnList;
+
+static void formatMaskList(pfc::string_base & out, t_fnList const & in) {
+ pfc::const_iterator<pfc::string8> walk = in.first();
+ if (walk.is_valid()) {
+ out << *walk; ++walk;
+ while(walk.is_valid()) {
+ out << ";" << *walk; ++walk;
+ }
+ }
+}
+static void formatMaskList(pfc::string_base & out, t_fnList const & in, const char * label) {
+ if (in.get_count() > 0) {
+ out << label << "|";
+ formatMaskList(out,in);
+ out << "|";
+ }
+}
+
+void input_file_type::make_filetype_support_fingerprint(pfc::string_base & str) {
+ pfc::string_formatter out;
+ pfc::avltree_t<pfc::string8, pfc::string::comparatorCaseInsensitive> names;
+
+ {
+ componentversion::ptr ptr; service_enum_t<componentversion> e;
+ pfc::string_formatter name;
+ while(e.next(ptr)) {
+ name = "";
+ ptr->get_component_name(name);
+ if (strstr(name, "decoder") != NULL || strstr(name, "Decoder") != NULL) names += name;
+ }
+ }
+
+
+ make_extension_support_fingerprint(out);
+ for(pfc::const_iterator<pfc::string8> walk = names.first(); walk.is_valid(); ++walk) {
+ if (!out.is_empty()) str << "|";
+ out << *walk;
+ }
+ str = out;
+}
+void input_file_type::make_extension_support_fingerprint(pfc::string_base & str) {
+ pfc::avltree_t<pfc::string8, pfc::string::comparatorCaseInsensitive> masks;
+ {
+ service_enum_t<input_file_type> e;
+ service_ptr_t<input_file_type> ptr;
+ pfc::string_formatter mask;
+ while(e.next(ptr)) {
+ const unsigned count = ptr->get_count();
+ for(unsigned n=0;n<count;n++) {
+ mask.reset();
+ if (ptr->get_mask(n,mask)) {
+ if (strchr(mask,'|') == NULL) masks += mask;
+ }
+ }
+ }
+ }
+ pfc::string_formatter out;
+ for(pfc::const_iterator<pfc::string8> walk = masks.first(); walk.is_valid(); ++walk) {
+ if (!out.is_empty()) out << "|";
+ out << *walk;
+ }
+ str = out;
+}
+void input_file_type::build_openfile_mask(pfc::string_base & out, bool b_include_playlists)
+{
+ t_fnList extensionsAll, extensionsPl;;
+
+ if (b_include_playlists) {
+ service_enum_t<playlist_loader> e; service_ptr_t<playlist_loader> ptr;
+ while(e.next(ptr)) {
+ if (ptr->is_associatable()) {
+ pfc::string_formatter temp; temp << "*." << ptr->get_extension();
+ extensionsPl += temp;
+ extensionsAll += temp;
+ }
+ }
+ }
+
+ typedef pfc::map_t<pfc::string8,t_fnList,pfc::string::comparatorCaseInsensitive> t_masks;
+ t_masks masks;
+ {
+ service_enum_t<input_file_type> e;
+ service_ptr_t<input_file_type> ptr;
+ pfc::string_formatter name, mask;
+ while(e.next(ptr)) {
+ const unsigned count = ptr->get_count();
+ for(unsigned n=0;n<count;n++) {
+ name.reset();
+ mask.reset();
+ if (ptr->get_name(n,name) && ptr->get_mask(n,mask)) {
+ if (!strchr(name,'|') && !strchr(mask,'|')) {
+ masks.find_or_add(name) += mask;
+ extensionsAll += mask;
+ }
+ }
+ }
+ }
+ }
+ pfc::string_formatter outBuf;
+ outBuf << "All files|*.*|";
+ formatMaskList(outBuf, extensionsAll, "All supported types");
+ formatMaskList(outBuf, extensionsPl, "Playlists");
+ for(t_masks::const_iterator walk = masks.first(); walk.is_valid(); ++walk) {
+ formatMaskList(outBuf,walk->m_value,walk->m_key);
+ }
+ out = outBuf;
+}
+#endif
\ No newline at end of file diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/input_file_type.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/input_file_type.h new file mode 100644 index 0000000000..b499c7f02a --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/input_file_type.h @@ -0,0 +1,109 @@ +//! Entrypoint interface for registering media file types that can be opened through "open file" dialogs or associated with foobar2000 application in Windows shell. \n
+//! Instead of implementing this directly, use DECLARE_FILE_TYPE() / DECLARE_FILE_TYPE_EX() macros.
+class input_file_type : public service_base {
+public:
+ virtual unsigned get_count()=0;
+ virtual bool get_name(unsigned idx,pfc::string_base & out)=0;//eg. "MPEG files"
+ virtual bool get_mask(unsigned idx,pfc::string_base & out)=0;//eg. "*.MP3;*.MP2"; separate with semicolons
+ virtual bool is_associatable(unsigned idx) = 0;
+
+#if FOOBAR2000_TARGET_VERSION >= 76
+ static void build_openfile_mask(pfc::string_base & out,bool b_include_playlists=true);
+ static void make_extension_support_fingerprint(pfc::string_base & str);
+ static void make_filetype_support_fingerprint(pfc::string_base & str);
+#endif
+
+ FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(input_file_type);
+};
+
+//! Extended interface for registering media file types that can be associated with foobar2000 application in Windows shell. \n
+//! Instead of implementing this directly, use DECLARE_FILE_TYPE() / DECLARE_FILE_TYPE_EX() macros.
+class input_file_type_v2 : public input_file_type {
+public:
+ virtual void get_format_name(unsigned idx, pfc::string_base & out, bool isPlural) = 0;
+ virtual void get_extensions(unsigned idx, pfc::string_base & out) = 0;
+
+ //Deprecated input_file_type method implementations:
+ bool get_name(unsigned idx, pfc::string_base & out) {get_format_name(idx, out, true); return true;}
+ bool get_mask(unsigned idx, pfc::string_base & out) {
+ pfc::string_formatter temp; get_extensions(idx,temp);
+ pfc::chain_list_v2_t<pfc::string> exts; pfc::splitStringSimple_toList(exts,";",temp);
+ if (exts.get_count() == 0) return false;//should not happen
+ temp.reset();
+ for(pfc::const_iterator<pfc::string> walk = exts.first(); walk.is_valid(); ++walk) {
+ if (!temp.is_empty()) temp << ";";
+ temp << "*." << walk->get_ptr();
+ }
+ out = temp;
+ return true;
+ }
+
+ FB2K_MAKE_SERVICE_INTERFACE(input_file_type_v2,input_file_type)
+};
+
+
+//! Implementation helper.
+class input_file_type_impl : public service_impl_single_t<input_file_type>
+{
+ const char * name, * mask;
+ bool m_associatable;
+public:
+ input_file_type_impl(const char * p_name, const char * p_mask,bool p_associatable) : name(p_name), mask(p_mask), m_associatable(p_associatable) {}
+ unsigned get_count() {return 1;}
+ bool get_name(unsigned idx,pfc::string_base & out) {if (idx==0) {out = name; return true;} else return false;}
+ bool get_mask(unsigned idx,pfc::string_base & out) {if (idx==0) {out = mask; return true;} else return false;}
+ bool is_associatable(unsigned idx) {return m_associatable;}
+};
+
+
+//! Helper macro for registering our media file types.
+//! Usage: DECLARE_FILE_TYPE("Blah files","*.blah;*.bleh");
+#define DECLARE_FILE_TYPE(NAME,MASK) \
+ namespace { static input_file_type_impl g_filetype_instance(NAME,MASK,true); \
+ static service_factory_single_ref_t<input_file_type_impl> g_filetype_service(g_filetype_instance); }
+
+
+
+
+//! Implementation helper.
+//! Usage: static input_file_type_factory mytype("blah type","*.bla;*.meh",true);
+class input_file_type_factory : private service_factory_single_transparent_t<input_file_type_impl>
+{
+public:
+ input_file_type_factory(const char * p_name,const char * p_mask,bool p_associatable)
+ : service_factory_single_transparent_t<input_file_type_impl>(p_name,p_mask,p_associatable) {}
+};
+
+
+
+class input_file_type_v2_impl : public input_file_type_v2 {
+public:
+ input_file_type_v2_impl(const char * extensions,const char * name, const char * namePlural) : m_extensions(extensions), m_name(name), m_namePlural(namePlural) {}
+ unsigned get_count() {return 1;}
+ bool is_associatable(unsigned idx) {return true;}
+ void get_format_name(unsigned idx, pfc::string_base & out, bool isPlural) {
+ out = isPlural ? m_namePlural : m_name;
+ }
+ void get_extensions(unsigned idx, pfc::string_base & out) {
+ out = m_extensions;
+ }
+
+private:
+ const pfc::string8 m_name, m_namePlural, m_extensions;
+};
+
+//! Helper macro for registering our media file types, extended version providing separate singular/plural type names.
+//! Usage: DECLARE_FILE_TYPE_EX("mp1;mp2;mp3","MPEG file","MPEG files")
+#define DECLARE_FILE_TYPE_EX(extensions, name, namePlural) \
+ namespace { static service_factory_single_t<input_file_type_v2_impl> g_myfiletype(extensions, name, namePlural); }
+
+
+//! Service for registering protocol types that can be associated with foobar2000.
+class input_protocol_type : public service_base {
+ FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(input_protocol_type)
+public:
+ //! Returns the name of the protocol, such as "ftp" or "http".
+ virtual void get_protocol_name(pfc::string_base & out) = 0;
+ //! Returns a human-readable description of the protocol.
+ virtual void get_description(pfc::string_base & out) = 0;
+};
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/input_impl.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/input_impl.h new file mode 100644 index 0000000000..0ee65b4726 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/input_impl.h @@ -0,0 +1,329 @@ +enum t_input_open_reason {
+ input_open_info_read,
+ input_open_decode,
+ input_open_info_write
+};
+
+//! Helper function for input implementation use; ensures that file is open with relevant access mode. This is typically called from input_impl::open() and such.
+//! @param p_file File object pointer to process. If passed pointer is non-null, the function does nothing and always succeeds; otherwise it attempts to open the file using filesystem API methods.
+//! @param p_path Path to the file.
+//! @param p_reason Type of input operation requested. See: input_impl::open() parameters.
+//! @param p_abort abort_callback object signaling user aborting the operation.
+void input_open_file_helper(service_ptr_t<file> & p_file,const char * p_path,t_input_open_reason p_reason,abort_callback & p_abort);
+
+
+//! This is a class that just declares prototypes of functions that each input needs to implement. See input_decoder / input_info_reader / input_info_writer interfaces for full descriptions of member functions. Since input implementation class is instantiated using a template, you don't need to derive from input_impl as virtual functions are not used on implementation class level. Use input_factory_t template to register input class based on input_impl.
+class input_impl
+{
+public:
+ //! Opens specified file for info read / decoding / info write. This is called only once, immediately after object creation, before any other methods, and no other methods are called if open() fails.
+ //! @param p_filehint Optional; passes file object to use for the operation; if set to null, the implementation should handle opening file by itself. Note that not all inputs operate on physical files that can be reached through filesystem API, some of them require this parameter to be set to null (tone and silence generators for an example). Typically, an input implementation that requires file access calls input_open_file_helper() function to ensure that file is open with relevant access mode (read or read/write).
+ //! @param p_path URL of resource being opened.
+ //! @param p_reason Type of operation requested. Possible values are: \n
+ //! - input_open_info_read - info retrieval methods are valid; \n
+ //! - input_open_decode - info retrieval and decoding methods are valid; \n
+ //! - input_open_info_write - info retrieval and retagging methods are valid; \n
+ //! Note that info retrieval methods are valid in all cases, and they may be called at any point of decoding/retagging process. Results of info retrieval methods (other than get_subsong_count() / get_subsong()) between retag_set_info() and retag_commit() are undefined however; those should not be called during that period.
+ //! @param p_abort abort_callback object signaling user aborting the operation.
+ void open(service_ptr_t<file> p_filehint,const char * p_path,t_input_open_reason p_reason,abort_callback & p_abort);
+
+ //! See: input_info_reader::get_subsong_count(). Valid after open() with any reason.
+ unsigned get_subsong_count();
+ //! See: input_info_reader::get_subsong(). Valid after open() with any reason.
+ t_uint32 get_subsong(unsigned p_index);
+ //! See: input_info_reader::get_info(). Valid after open() with any reason.
+ void get_info(t_uint32 p_subsong,file_info & p_info,abort_callback & p_abort);
+ //! See: input_info_reader::get_file_stats(). Valid after open() with any reason.
+ t_filestats get_file_stats(abort_callback & p_abort);
+
+ //! See: input_decoder::initialize(). Valid after open() with input_open_decode reason.
+ void decode_initialize(t_uint32 p_subsong,unsigned p_flags,abort_callback & p_abort);
+ //! See: input_decoder::run(). Valid after decode_initialize().
+ bool decode_run(audio_chunk & p_chunk,abort_callback & p_abort);
+ //! See: input_decoder::seek(). Valid after decode_initialize().
+ void decode_seek(double p_seconds,abort_callback & p_abort);
+ //! See: input_decoder::can_seek(). Valid after decode_initialize().
+ bool decode_can_seek();
+ //! See: input_decoder::get_dynamic_info(). Valid after decode_initialize().
+ bool decode_get_dynamic_info(file_info & p_out, double & p_timestamp_delta);
+ //! See: input_decoder::get_dynamic_info_track(). Valid after decode_initialize().
+ bool decode_get_dynamic_info_track(file_info & p_out, double & p_timestamp_delta);
+ //! See: input_decoder::on_idle(). Valid after decode_initialize().
+ void decode_on_idle(abort_callback & p_abort);
+
+ //! See: input_info_writer::set_info(). Valid after open() with input_open_info_write reason.
+ void retag_set_info(t_uint32 p_subsong,const file_info & p_info,abort_callback & p_abort);
+ //! See: input_info_writer::commit(). Valid after open() with input_open_info_write reason.
+ void retag_commit(abort_callback & p_abort);
+
+ //! See: input_entry::is_our_content_type().
+ static bool g_is_our_content_type(const char * p_content_type);
+ //! See: input_entry::is_our_path().
+ static bool g_is_our_path(const char * p_path,const char * p_extension);
+
+protected:
+ input_impl() {}
+ ~input_impl() {}
+};
+
+//! This is a class that just declares prototypes of functions that each non-multitrack-enabled input needs to implement. See input_decoder / input_info_reader / input_info_writer interfaces for full descriptions of member functions. Since input implementation class is instantiated using a template, you don't need to derive from input_singletrack_impl as virtual functions are not used on implementation class level. Use input_singletrack_factory_t template to register input class based on input_singletrack_impl.
+class input_singletrack_impl
+{
+public:
+ //! Opens specified file for info read / decoding / info write. This is called only once, immediately after object creation, before any other methods, and no other methods are called if open() fails.
+ //! @param p_filehint Optional; passes file object to use for the operation; if set to null, the implementation should handle opening file by itself. Note that not all inputs operate on physical files that can be reached through filesystem API, some of them require this parameter to be set to null (tone and silence generators for an example). Typically, an input implementation that requires file access calls input_open_file_helper() function to ensure that file is open with relevant access mode (read or read/write).
+ //! @param p_path URL of resource being opened.
+ //! @param p_reason Type of operation requested. Possible values are: \n
+ //! - input_open_info_read - info retrieval methods are valid; \n
+ //! - input_open_decode - info retrieval and decoding methods are valid; \n
+ //! - input_open_info_write - info retrieval and retagging methods are valid; \n
+ //! Note that info retrieval methods are valid in all cases, and they may be called at any point of decoding/retagging process. Results of info retrieval methods (other than get_subsong_count() / get_subsong()) between retag_set_info() and retag_commit() are undefined however; those should not be called during that period.
+ //! @param p_abort abort_callback object signaling user aborting the operation.
+ void open(service_ptr_t<file> p_filehint,const char * p_path,t_input_open_reason p_reason,abort_callback & p_abort);
+
+ //! See: input_info_reader::get_info(). Valid after open() with any reason. \n
+ //! Implementation warning: this is typically also called immediately after tag update and should return newly written content then.
+ void get_info(file_info & p_info,abort_callback & p_abort);
+ //! See: input_info_reader::get_file_stats(). Valid after open() with any reason. \n
+ //! Implementation warning: this is typically also called immediately after tag update and should return new values then.
+ t_filestats get_file_stats(abort_callback & p_abort);
+
+ //! See: input_decoder::initialize(). Valid after open() with input_open_decode reason.
+ void decode_initialize(unsigned p_flags,abort_callback & p_abort);
+ //! See: input_decoder::run(). Valid after decode_initialize().
+ bool decode_run(audio_chunk & p_chunk,abort_callback & p_abort);
+ //! See: input_decoder::seek(). Valid after decode_initialize().
+ void decode_seek(double p_seconds,abort_callback & p_abort);
+ //! See: input_decoder::can_seek(). Valid after decode_initialize().
+ bool decode_can_seek();
+ //! See: input_decoder::get_dynamic_info(). Valid after decode_initialize().
+ bool decode_get_dynamic_info(file_info & p_out, double & p_timestamp_delta);
+ //! See: input_decoder::get_dynamic_info_track(). Valid after decode_initialize().
+ bool decode_get_dynamic_info_track(file_info & p_out, double & p_timestamp_delta);
+ //! See: input_decoder::on_idle(). Valid after decode_initialize().
+ void decode_on_idle(abort_callback & p_abort);
+
+ //! See: input_info_writer::set_info(). Note that input_info_writer::commit() call isn't forwarded because it's useless in case of non-multitrack-enabled inputs. Valid after open() with input_open_info_write reason.
+ void retag(const file_info & p_info,abort_callback & p_abort);
+
+ //! See: input_entry::is_our_content_type().
+ static bool g_is_our_content_type(const char * p_content_type);
+ //! See: input_entry::is_our_path().
+ static bool g_is_our_path(const char * p_path,const char * p_extension);
+
+protected:
+ input_singletrack_impl() {}
+ ~input_singletrack_impl() {}
+};
+
+
+//! Used internally by standard input_entry implementation; do not use directly. Translates input_decoder / input_info_reader / input_info_writer calls to input_impl calls.
+template<typename I, typename t_base>
+class input_impl_interface_wrapper_t : public t_base
+{
+public:
+ void open(service_ptr_t<file> p_filehint,const char * p_path,t_input_open_reason p_reason,abort_callback & p_abort) {
+ m_instance.open(p_filehint,p_path,p_reason,p_abort);
+ }
+
+ // input_info_reader methods
+
+ t_uint32 get_subsong_count() {
+ return m_instance.get_subsong_count();
+ }
+
+ t_uint32 get_subsong(t_uint32 p_index) {
+ return m_instance.get_subsong(p_index);
+ }
+
+
+ void get_info(t_uint32 p_subsong,file_info & p_info,abort_callback & p_abort) {
+ m_instance.get_info(p_subsong,p_info,p_abort);
+ }
+
+ t_filestats get_file_stats(abort_callback & p_abort) {
+ return m_instance.get_file_stats(p_abort);
+ }
+
+ // input_decoder methods
+
+ void initialize(t_uint32 p_subsong,unsigned p_flags,abort_callback & p_abort) {
+ m_instance.decode_initialize(p_subsong,p_flags,p_abort);
+ }
+
+ bool run(audio_chunk & p_chunk,abort_callback & p_abort) {
+ return m_instance.decode_run(p_chunk,p_abort);
+ }
+
+ bool run_raw(audio_chunk & p_chunk, mem_block_container & p_raw, abort_callback & p_abort) {
+ return m_instance.decode_run_raw(p_chunk, p_raw, p_abort);
+ }
+
+ void seek(double p_seconds,abort_callback & p_abort) {
+ m_instance.decode_seek(p_seconds,p_abort);
+ }
+
+ bool can_seek() {
+ return m_instance.decode_can_seek();
+ }
+
+ bool get_dynamic_info(file_info & p_out, double & p_timestamp_delta) {
+ return m_instance.decode_get_dynamic_info(p_out,p_timestamp_delta);
+ }
+
+ bool get_dynamic_info_track(file_info & p_out, double & p_timestamp_delta) {
+ return m_instance.decode_get_dynamic_info_track(p_out,p_timestamp_delta);
+ }
+
+ void on_idle(abort_callback & p_abort) {
+ m_instance.decode_on_idle(p_abort);
+ }
+
+ void set_logger(event_logger::ptr ptr) {
+ m_instance.set_logger(ptr);
+ }
+
+ void set_pause(bool paused) {
+ m_instance.set_pause(paused);
+ }
+ bool flush_on_pause() {
+ return m_instance.flush_on_pause();
+ }
+
+
+ // input_info_writer methods
+
+ void set_info(t_uint32 p_subsong,const file_info & p_info,abort_callback & p_abort) {
+ m_instance.retag_set_info(p_subsong,p_info,p_abort);
+ }
+
+ void commit(abort_callback & p_abort) {
+ m_instance.retag_commit(p_abort);
+ }
+
+private:
+ I m_instance;
+};
+
+//! Helper used by input_singletrack_factory_t, do not use directly. Translates input_impl calls to input_singletrack_impl calls.
+template<typename I>
+class input_wrapper_singletrack_t
+{
+public:
+ input_wrapper_singletrack_t() {}
+
+ void open(service_ptr_t<file> p_filehint,const char * p_path,t_input_open_reason p_reason,abort_callback & p_abort) {
+ m_instance.open(p_filehint,p_path,p_reason,p_abort);
+ }
+
+ void get_info(t_uint32 p_subsong,file_info & p_info,abort_callback & p_abort) {
+ if (p_subsong != 0) throw exception_io_data();
+ m_instance.get_info(p_info,p_abort);
+ }
+
+ t_uint32 get_subsong_count() {
+ return 1;
+ }
+
+ t_uint32 get_subsong(t_uint32 p_index) {
+ assert(p_index == 0);
+ return 0;
+ }
+
+ t_filestats get_file_stats(abort_callback & p_abort) {
+ return m_instance.get_file_stats(p_abort);
+ }
+
+ void decode_initialize(t_uint32 p_subsong,unsigned p_flags,abort_callback & p_abort) {
+ if (p_subsong != 0) throw exception_io_data();
+ m_instance.decode_initialize(p_flags,p_abort);
+ }
+
+ bool decode_run(audio_chunk & p_chunk,abort_callback & p_abort) {return m_instance.decode_run(p_chunk,p_abort);}
+ void decode_seek(double p_seconds,abort_callback & p_abort) {m_instance.decode_seek(p_seconds,p_abort);}
+ bool decode_can_seek() {return m_instance.decode_can_seek();}
+ bool decode_get_dynamic_info(file_info & p_out, double & p_timestamp_delta) {return m_instance.decode_get_dynamic_info(p_out,p_timestamp_delta);}
+ bool decode_get_dynamic_info_track(file_info & p_out, double & p_timestamp_delta) {return m_instance.decode_get_dynamic_info_track(p_out,p_timestamp_delta);}
+ void decode_on_idle(abort_callback & p_abort) {m_instance.decode_on_idle(p_abort);}
+
+ void retag_set_info(t_uint32 p_subsong,const file_info & p_info,abort_callback & p_abort) {
+ if (p_subsong != 0) throw exception_io_data();
+ m_instance.retag(p_info,p_abort);
+ }
+
+ bool decode_run_raw(audio_chunk & p_chunk, mem_block_container & p_raw, abort_callback & p_abort) {
+ return m_instance.decode_run_raw(p_chunk, p_raw, p_abort);
+ }
+
+ void set_logger(event_logger::ptr ptr) {m_instance.set_logger(ptr);}
+
+ void set_pause(bool paused) {
+ m_instance.set_pause(paused);
+ }
+ bool flush_on_pause() {
+ return m_instance.flush_on_pause();
+ }
+
+ void retag_commit(abort_callback & p_abort) {}
+
+ static bool g_is_our_content_type(const char * p_content_type) {return I::g_is_our_content_type(p_content_type);}
+ static bool g_is_our_path(const char * p_path,const char * p_extension) {return I::g_is_our_path(p_path,p_extension);}
+
+
+private:
+ I m_instance;
+};
+
+//! Helper; standard input_entry implementation. Do not instantiate this directly, use input_factory_t or one of other input_*_factory_t helpers instead.
+template<typename I,unsigned t_flags, typename t_decoder = input_decoder, typename t_inforeader = input_info_reader, typename t_infowriter = input_info_writer>
+class input_entry_impl_t : public input_entry
+{
+private:
+
+ template<typename T, typename out>
+ void instantiate_t(service_ptr_t<out> & p_instance,service_ptr_t<file> p_filehint,const char * p_path,t_input_open_reason p_reason,abort_callback & p_abort)
+ {
+ service_ptr_t< service_impl_t<input_impl_interface_wrapper_t<I,T> > > temp;
+ temp = new service_impl_t<input_impl_interface_wrapper_t<I,T> >();
+ temp->open(p_filehint,p_path,p_reason,p_abort);
+ p_instance = temp.get_ptr();
+ }
+public:
+ bool is_our_content_type(const char * p_type) {return I::g_is_our_content_type(p_type);}
+ bool is_our_path(const char * p_full_path,const char * p_extension) {return I::g_is_our_path(p_full_path,p_extension);}
+
+ void open_for_decoding(service_ptr_t<input_decoder> & p_instance,service_ptr_t<file> p_filehint,const char * p_path,abort_callback & p_abort) {
+ instantiate_t<t_decoder>(p_instance,p_filehint,p_path,input_open_decode,p_abort);
+ }
+
+ void open_for_info_read(service_ptr_t<input_info_reader> & p_instance,service_ptr_t<file> p_filehint,const char * p_path,abort_callback & p_abort) {
+ instantiate_t<t_inforeader>(p_instance,p_filehint,p_path,input_open_info_read,p_abort);
+ }
+
+ void open_for_info_write(service_ptr_t<input_info_writer> & p_instance,service_ptr_t<file> p_filehint,const char * p_path,abort_callback & p_abort) {
+ instantiate_t<t_infowriter>(p_instance,p_filehint,p_path,input_open_info_write,p_abort);
+ }
+
+ void get_extended_data(service_ptr_t<file> p_filehint,const playable_location & p_location,const GUID & p_guid,mem_block_container & p_out,abort_callback & p_abort) {
+ p_out.reset();
+ }
+
+ unsigned get_flags() {return t_flags;}
+};
+
+
+//! Stardard input factory. For reference of functions that must be supported by registered class, see input_impl.\n Usage: static input_factory_t<myinputclass> g_myinputclass_factory;\n Note that input classes can't be registered through service_factory_t template directly.
+template<typename T>
+class input_factory_t : public service_factory_single_t<input_entry_impl_t<T,0> > {};
+
+//! Non-multitrack-enabled input factory (helper) - hides multitrack management functions from input implementation; use this for inputs that handle file types where each physical file can contain only one user-visible playable track. For reference of functions that must be supported by registered class, see input_singletrack_impl.\n Usage: static input_singletrack_factory_t<myinputclass> g_myinputclass_factory;\n Note that input classes can't be registered through service_factory_t template directly.template<class T>
+template<typename T>
+class input_singletrack_factory_t : public service_factory_single_t<input_entry_impl_t<input_wrapper_singletrack_t<T>,0> > {};
+
+//! Extended version of input_factory_t, with non-default flags and supported interfaces. See: input_factory_t, input_entry::get_flags().
+template<typename T,unsigned t_flags = 0, typename t_decoder = input_decoder, typename t_inforeader = input_info_reader, typename t_infowriter = input_info_writer>
+class input_factory_ex_t : public service_factory_single_t<input_entry_impl_t<T,t_flags, t_decoder, t_inforeader, t_infowriter> > {};
+
+//! Extended version of input_singletrack_factory_t, with non-default flags and supported interfaces. See: input_singletrack_factory_t, input_entry::get_flags().
+template<typename T,unsigned t_flags = 0, typename t_decoder = input_decoder, typename t_inforeader = input_info_reader, typename t_infowriter = input_info_writer>
+class input_singletrack_factory_ex_t : public service_factory_single_t<input_entry_impl_t<input_wrapper_singletrack_t<T>,t_flags, t_decoder, t_inforeader, t_infowriter> > {};
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/library_manager.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/library_manager.h new file mode 100644 index 0000000000..609c272b8d --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/library_manager.h @@ -0,0 +1,192 @@ +/*!
+This service implements methods allowing you to interact with the Media Library.\n
+All methods are valid from main thread only, unless noted otherwise.\n
+Usage: Use static_api_ptr_t<library_manager> to instantiate.
+*/
+
+class NOVTABLE library_manager : public service_base {
+public:
+ //! Interface for use with library_manager::enum_items().
+ class NOVTABLE enum_callback {
+ public:
+ //! Return true to continue enumeration, false to abort.
+ virtual bool on_item(const metadb_handle_ptr & p_item) = 0;
+ };
+
+ //! Returns whether the specified item is in the Media Library or not.
+ virtual bool is_item_in_library(const metadb_handle_ptr & p_item) = 0;
+ //! Returns whether current user settings allow the specified item to be added to the Media Library or not.
+ virtual bool is_item_addable(const metadb_handle_ptr & p_item) = 0;
+ //! Returns whether current user settings allow the specified item path to be added to the Media Library or not.
+ virtual bool is_path_addable(const char * p_path) = 0;
+ //! Retrieves path of the specified item relative to the Media Library folder it is in. Returns true on success, false when the item is not in the Media Library.
+ //! SPECIAL WARNING: to allow multi-CPU optimizations to parse relative track paths, this API works in threads other than the main app thread. Main thread MUST be blocked while working in such scenarios, it's NOT safe to call from worker threads while the Media Library content/configuration might be getting altered.
+ virtual bool get_relative_path(const metadb_handle_ptr & p_item,pfc::string_base & p_out) = 0;
+ //! Calls callback method for every item in the Media Library. Note that order of items in Media Library is undefined.
+ virtual void enum_items(enum_callback & p_callback) = 0;
+ //! Deprecated, does nothing.
+ __declspec(deprecated) virtual void add_items(const pfc::list_base_const_t<metadb_handle_ptr> & p_data) = 0;
+ //! Deprecated, does nothing.
+ __declspec(deprecated) virtual void remove_items(const pfc::list_base_const_t<metadb_handle_ptr> & p_data) = 0;
+ //! Deprecated, does nothing.
+ __declspec(deprecated) virtual void add_items_async(const pfc::list_base_const_t<metadb_handle_ptr> & p_data) = 0;
+
+ //! Deprecated, does nothing.
+ __declspec(deprecated) virtual void on_files_deleted_sorted(const pfc::list_base_const_t<const char *> & p_data) = 0;
+
+ //! Retrieves the entire Media Library content.
+ virtual void get_all_items(pfc::list_base_t<metadb_handle_ptr> & p_out) = 0;
+
+ //! Returns whether Media Library functionality is enabled or not (to be exact: whether there's at least one Media Library folder present in settings), for e.g. notifying the user to change settings when trying to use a Media Library viewer without having configured the Media Library first.
+ virtual bool is_library_enabled() = 0;
+ //! Pops up the Media Library preferences page.
+ virtual void show_preferences() = 0;
+
+ //! Deprecated, does nothing.
+ __declspec(deprecated) virtual void rescan() = 0;
+
+ //! Deprecated, does nothing.
+ __declspec(deprecated) virtual void check_dead_entries(const pfc::list_base_t<metadb_handle_ptr> & p_list) = 0;
+
+ FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(library_manager);
+};
+
+//! \since 0.9.3
+class NOVTABLE library_manager_v2 : public library_manager {
+public:
+ //! Deprecated, always returns false.
+ __declspec(deprecated) virtual bool is_rescan_running() = 0;
+
+ //! Deprecated, does nothing and instantly signals completion.
+ __declspec(deprecated) virtual void rescan_async(HWND p_parent,completion_notify_ptr p_notify) = 0;
+
+ //! Deprecated, does nothing and instantly signals completion.
+ __declspec(deprecated) virtual void check_dead_entries_async(const pfc::list_base_const_t<metadb_handle_ptr> & p_list,HWND p_parent,completion_notify_ptr p_notify) = 0;
+
+ FB2K_MAKE_SERVICE_INTERFACE(library_manager_v2,library_manager);
+};
+
+
+class NOVTABLE library_callback_dynamic {
+public:
+ //! Called when new items are added to the Media Library.
+ virtual void on_items_added(const pfc::list_base_const_t<metadb_handle_ptr> & p_data) = 0;
+ //! Called when some items have been removed from the Media Library.
+ virtual void on_items_removed(const pfc::list_base_const_t<metadb_handle_ptr> & p_data) = 0;
+ //! Called when some items in the Media Library have been modified.
+ virtual void on_items_modified(const pfc::list_base_const_t<metadb_handle_ptr> & p_data) = 0;
+};
+
+//! \since 0.9.5
+class NOVTABLE library_manager_v3 : public library_manager_v2 {
+public:
+ //! Retrieves directory path and subdirectory/filename formatting scheme for newly encoded/copied/moved tracks.
+ //! @returns True on success, false when the feature has not been configured.
+ virtual bool get_new_file_pattern_tracks(pfc::string_base & p_directory,pfc::string_base & p_format) = 0;
+ //! Retrieves directory path and subdirectory/filename formatting scheme for newly encoded/copied/moved full album images.
+ //! @returns True on success, false when the feature has not been configured.
+ virtual bool get_new_file_pattern_images(pfc::string_base & p_directory,pfc::string_base & p_format) = 0;
+
+ virtual void register_callback(library_callback_dynamic * p_callback) = 0;
+ virtual void unregister_callback(library_callback_dynamic * p_callback) = 0;
+
+ FB2K_MAKE_SERVICE_INTERFACE(library_manager_v3,library_manager_v2);
+};
+
+class library_callback_dynamic_impl_base : public library_callback_dynamic {
+public:
+ library_callback_dynamic_impl_base() {static_api_ptr_t<library_manager_v3>()->register_callback(this);}
+ ~library_callback_dynamic_impl_base() {static_api_ptr_t<library_manager_v3>()->unregister_callback(this);}
+
+ //stub implementations - avoid pure virtual function call issues
+ void on_items_added(metadb_handle_list_cref p_data) {}
+ void on_items_removed(metadb_handle_list_cref p_data) {}
+ void on_items_modified(metadb_handle_list_cref p_data) {}
+
+ PFC_CLASS_NOT_COPYABLE_EX(library_callback_dynamic_impl_base);
+};
+
+//! Callback service receiving notifications about Media Library content changes. Methods called only from main thread.\n
+//! Use library_callback_factory_t template to register.
+class NOVTABLE library_callback : public service_base {
+public:
+ //! Called when new items are added to the Media Library.
+ virtual void on_items_added(const pfc::list_base_const_t<metadb_handle_ptr> & p_data) = 0;
+ //! Called when some items have been removed from the Media Library.
+ virtual void on_items_removed(const pfc::list_base_const_t<metadb_handle_ptr> & p_data) = 0;
+ //! Called when some items in the Media Library have been modified.
+ virtual void on_items_modified(const pfc::list_base_const_t<metadb_handle_ptr> & p_data) = 0;
+
+ FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(library_callback);
+};
+
+template<typename T>
+class library_callback_factory_t : public service_factory_single_t<T> {};
+
+//! Implement this service to appear on "library viewers" list in Media Library preferences page.\n
+//! Use library_viewer_factory_t to register.
+class NOVTABLE library_viewer : public service_base {
+public:
+ //! Retrieves GUID of your preferences page (pfc::guid_null if you don't have one).
+ virtual GUID get_preferences_page() = 0;
+ //! Queries whether "activate" action is supported (relevant button will be disabled if it's not).
+ virtual bool have_activate() = 0;
+ //! Activates your Media Library viewer component (e.g. shows its window).
+ virtual void activate() = 0;
+ //! Retrieves GUID of your library_viewer implementation, for internal identification. Note that this not the same as preferences page GUID.
+ virtual GUID get_guid() = 0;
+ //! Retrieves name of your Media Library viewer, a null-terminated UTF-8 encoded string.
+ virtual const char * get_name() = 0;
+
+ FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(library_viewer);
+};
+
+template<typename T>
+class library_viewer_factory_t : public service_factory_single_t<T> {};
+
+
+
+
+//! \since 0.9.5.4
+//! Allows you to spawn a popup Media Library Search window with any query string that you specify. \n
+//! Usage: static_api_ptr_t<library_search_ui>()->show("querygoeshere");
+class NOVTABLE library_search_ui : public service_base {
+public:
+ virtual void show(const char * query) = 0;
+
+ FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(library_search_ui)
+};
+
+//! \since 0.9.6
+class NOVTABLE library_file_move_scope : public service_base {
+ FB2K_MAKE_SERVICE_INTERFACE(library_file_move_scope, service_base)
+public:
+};
+
+//! \since 0.9.6
+class NOVTABLE library_file_move_manager : public service_base {
+ FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(library_file_move_manager)
+public:
+ virtual library_file_move_scope::ptr acquire_scope() = 0;
+ virtual bool is_move_in_progress() = 0;
+};
+
+//! \since 0.9.6
+class NOVTABLE library_file_move_notify_ {
+public:
+ virtual void on_state_change(bool isMoving) = 0;
+};
+
+//! \since 0.9.6
+class NOVTABLE library_file_move_notify : public service_base, public library_file_move_notify_ {
+ FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(library_file_move_notify)
+public:
+};
+
+
+//! \since 0.9.6.1
+class NOVTABLE library_meta_autocomplete : public service_base {
+ FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(library_meta_autocomplete)
+public:
+ virtual bool get_value_list(const char * metaName, pfc::com_ptr_t<IUnknown> & out) = 0;
+};
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/link_resolver.cpp b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/link_resolver.cpp new file mode 100644 index 0000000000..26c6c3ed41 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/link_resolver.cpp @@ -0,0 +1,17 @@ +#include "foobar2000.h"
+
+bool link_resolver::g_find(service_ptr_t<link_resolver> & p_out,const char * p_path)
+{
+ service_enum_t<link_resolver> e;
+ service_ptr_t<link_resolver> ptr;
+ pfc::string_extension ext(p_path);
+ while(e.next(ptr))
+ {
+ if (ptr->is_our_path(p_path,ext))
+ {
+ p_out = ptr;
+ return true;
+ }
+ }
+ return false;
+}
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/link_resolver.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/link_resolver.h new file mode 100644 index 0000000000..8f09a1e02e --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/link_resolver.h @@ -0,0 +1,33 @@ +#ifndef _foobar2000_sdk_link_resolver_h_
+#define _foobar2000_sdk_link_resolver_h_
+
+//! Interface for resolving different sorts of link files.
+//! Utilized by mechanisms that convert filesystem path into list of playable locations.
+//! For security reasons, link may only point to playable object path, not to a playlist or another link.
+
+class NOVTABLE link_resolver : public service_base
+{
+public:
+
+ //! Tests whether specified file is supported by this link_resolver service.
+ //! @param p_path Path of file being queried.
+ //! @param p_extension Extension of file being queried. This is provided for performance reasons, path already includes it.
+ virtual bool is_our_path(const char * p_path,const char * p_extension) = 0;
+
+ //! Resolves a link file. Before this is called, path must be accepted by is_our_path().
+ //! @param p_filehint Optional file interface to use. If null/empty, implementation should open file by itself.
+ //! @param p_path Path of link file to resolve.
+ //! @param p_out Receives path the link is pointing to.
+ //! @param p_abort abort_callback object signaling user aborting the operation.
+ virtual void resolve(service_ptr_t<file> p_filehint,const char * p_path,pfc::string_base & p_out,abort_callback & p_abort) = 0;
+
+ //! Helper function; finds link_resolver interface that supports specified link file.
+ //! @param p_out Receives link_resolver interface on success.
+ //! @param p_path Path of file to query.
+ //! @returns True on success, false on failure (no interface that supports specified path could be found).
+ static bool g_find(service_ptr_t<link_resolver> & p_out,const char * p_path);
+
+ FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(link_resolver);
+};
+
+#endif //_foobar2000_sdk_link_resolver_h_
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/main_thread_callback.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/main_thread_callback.h new file mode 100644 index 0000000000..d5c6d89ac2 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/main_thread_callback.h @@ -0,0 +1,20 @@ +//! Callback object class for main_thread_callback_manager service.
+class NOVTABLE main_thread_callback : public service_base {
+public:
+ //! Gets called from main app thread. See main_thread_callback_manager description for more info.
+ virtual void callback_run() = 0;
+
+ FB2K_MAKE_SERVICE_INTERFACE(main_thread_callback,service_base);
+};
+
+/*!
+Allows you to queue a callback object to be called from main app thread. This is commonly used to trigger main-thread-only API calls from worker threads.\n
+This can be also used from main app thread, to avoid race conditions when trying to use APIs that dispatch global callbacks from inside some other global callback, or using message loops / modal dialogs inside global callbacks.
+*/
+class NOVTABLE main_thread_callback_manager : public service_base {
+public:
+ //! Queues a callback object. This can be called from any thread, implementation ensures multithread safety. Implementation will call p_callback->callback_run() once later. To get it called repeatedly, you would need to add your callback again.
+ virtual void add_callback(service_ptr_t<main_thread_callback> p_callback) = 0;
+
+ FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(main_thread_callback_manager);
+};
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/mainmenu.cpp b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/mainmenu.cpp new file mode 100644 index 0000000000..c959cb84d4 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/mainmenu.cpp @@ -0,0 +1,57 @@ +#include "foobar2000.h"
+
+bool mainmenu_commands::g_execute_dynamic(const GUID & p_guid, const GUID & p_subGuid,service_ptr_t<service_base> p_callback) {
+ mainmenu_commands::ptr ptr; t_uint32 index;
+ if (!menu_item_resolver::g_resolve_main_command(p_guid, ptr, index)) return false;
+ mainmenu_commands_v2::ptr v2;
+ if (!ptr->service_query_t(v2)) return false;
+ if (!v2->is_command_dynamic(index)) return false;
+ return v2->dynamic_execute(index, p_subGuid, p_callback);
+}
+bool mainmenu_commands::g_execute(const GUID & p_guid,service_ptr_t<service_base> p_callback) {
+ mainmenu_commands::ptr ptr; t_uint32 index;
+ if (!menu_item_resolver::g_resolve_main_command(p_guid, ptr, index)) return false;
+ ptr->execute(index, p_callback);
+ return true;
+}
+
+bool mainmenu_commands::g_find_by_name(const char * p_name,GUID & p_guid) {
+ service_enum_t<mainmenu_commands> e;
+ service_ptr_t<mainmenu_commands> ptr;
+ pfc::string8_fastalloc temp;
+ while(e.next(ptr)) {
+ const t_uint32 count = ptr->get_command_count();
+ for(t_uint32 n=0;n<count;n++) {
+ ptr->get_name(n,temp);
+ if (stricmp_utf8(temp,p_name) == 0) {
+ p_guid = ptr->get_command(n);
+ return true;
+ }
+ }
+ }
+ return false;
+
+}
+
+
+static bool dynamic_execute_recur(mainmenu_node::ptr node, const GUID & subID, service_ptr_t<service_base> callback) {
+ switch(node->get_type()) {
+ case mainmenu_node::type_command:
+ if (subID == node->get_guid()) {
+ node->execute(callback); return true;
+ }
+ break;
+ case mainmenu_node::type_group:
+ {
+ const t_size total = node->get_children_count();
+ for(t_size walk = 0; walk < total; ++walk) {
+ if (dynamic_execute_recur(node->get_child(walk), subID, callback)) return true;
+ }
+ }
+ break;
+ }
+ return false;
+}
+bool mainmenu_commands_v2::dynamic_execute(t_uint32 index, const GUID & subID, service_ptr_t<service_base> callback) {
+ return dynamic_execute_recur(dynamic_instantiate(index), subID, callback);
+}
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/mem_block_container.cpp b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/mem_block_container.cpp new file mode 100644 index 0000000000..a1961b94a3 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/mem_block_container.cpp @@ -0,0 +1,12 @@ +#include "foobar2000.h"
+
+void mem_block_container::from_stream(stream_reader * p_stream,t_size p_bytes,abort_callback & p_abort) {
+ if (p_bytes == 0) {set_size(0);}
+ set_size(p_bytes);
+ p_stream->read_object(get_ptr(),p_bytes,p_abort);
+}
+
+void mem_block_container::set(const void * p_buffer,t_size p_size) {
+ set_size(p_size);
+ memcpy(get_ptr(),p_buffer,p_size);
+}
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/mem_block_container.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/mem_block_container.h new file mode 100644 index 0000000000..de2f5370f6 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/mem_block_container.h @@ -0,0 +1,68 @@ +//! Generic interface for a memory block; used by various other interfaces to return memory blocks while allowing caller to allocate.
+class NOVTABLE mem_block_container {
+public:
+ virtual const void * get_ptr() const = 0;
+ virtual void * get_ptr() = 0;
+ virtual t_size get_size() const = 0;
+ virtual void set_size(t_size p_size) = 0;
+
+ void from_stream(stream_reader * p_stream,t_size p_bytes,abort_callback & p_abort);
+
+ void set(const void * p_buffer,t_size p_size);
+ void set(const mem_block_container & source) {copy(source);}
+ template<typename t_source> void set(const t_source & source) {
+ PFC_STATIC_ASSERT( sizeof(source[0]) == 1 );
+ set(source.get_ptr(), source.get_size());
+ }
+
+ inline void copy(const mem_block_container & p_source) {set(p_source.get_ptr(),p_source.get_size());}
+ inline void reset() {set_size(0);}
+
+ const mem_block_container & operator=(const mem_block_container & p_source) {copy(p_source);return *this;}
+
+protected:
+ mem_block_container() {}
+ ~mem_block_container() {}
+};
+
+//! mem_block_container implementation.
+template<template<typename> class t_alloc = pfc::alloc_standard>
+class mem_block_container_impl_t : public mem_block_container {
+public:
+ const void * get_ptr() const {return m_data.get_ptr();}
+ void * get_ptr() {return m_data.get_ptr();}
+ t_size get_size() const {return m_data.get_size();}
+ void set_size(t_size p_size) {
+ m_data.set_size(p_size);
+ }
+private:
+ pfc::array_t<t_uint8,t_alloc> m_data;
+};
+
+typedef mem_block_container_impl_t<> mem_block_container_impl;
+
+class mem_block_container_temp_impl : public mem_block_container {
+public:
+ mem_block_container_temp_impl(void * p_buffer,t_size p_size) : m_buffer(p_buffer), m_buffer_size(p_size), m_size(0) {}
+ const void * get_ptr() const {return m_buffer;}
+ void * get_ptr() {return m_buffer;}
+ t_size get_size() const {return m_size;}
+ void set_size(t_size p_size) {if (p_size > m_buffer_size) throw pfc::exception_overflow(); m_size = p_size;}
+private:
+ t_size m_size,m_buffer_size;
+ void * m_buffer;
+};
+
+template<typename t_ref>
+class mem_block_container_ref_impl : public mem_block_container {
+public:
+ mem_block_container_ref_impl(t_ref & ref) : m_ref(ref) {
+ PFC_STATIC_ASSERT( sizeof(ref[0]) == 1 );
+ }
+ const void * get_ptr() const {return m_ref.get_ptr();}
+ void * get_ptr() {return m_ref.get_ptr();}
+ t_size get_size() const {return m_ref.get_size();}
+ void set_size(t_size p_size) {m_ref.set_size(p_size);}
+private:
+ t_ref & m_ref;
+};
\ No newline at end of file diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/menu.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/menu.h new file mode 100644 index 0000000000..cb72921e64 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/menu.h @@ -0,0 +1,214 @@ +class NOVTABLE mainmenu_group : public service_base {
+public:
+ virtual GUID get_guid() = 0;
+ virtual GUID get_parent() = 0;
+ virtual t_uint32 get_sort_priority() = 0;
+
+ FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(mainmenu_group);
+};
+
+class NOVTABLE mainmenu_group_popup : public mainmenu_group {
+public:
+ virtual void get_display_string(pfc::string_base & p_out) = 0;
+ void get_name(pfc::string_base & out) {get_display_string(out);}
+
+ FB2K_MAKE_SERVICE_INTERFACE(mainmenu_group_popup,mainmenu_group);
+};
+
+class NOVTABLE mainmenu_commands : public service_base {
+public:
+ enum {
+ flag_disabled = 1<<0,
+ flag_checked = 1<<1,
+ flag_radiochecked = 1<<2,
+ //! \since 1.0
+ //! Replaces the old return-false-from-get_display() behavior - use this to make your command hidden by default but accessible when holding shift.
+ flag_defaulthidden = 1<<3,
+ sort_priority_base = 0x10000,
+ sort_priority_dontcare = 0x80000000,
+ sort_priority_last = ~0,
+ };
+
+ //! Retrieves number of implemented commands. Index parameter of other methods must be in 0....command_count-1 range.
+ virtual t_uint32 get_command_count() = 0;
+ //! Retrieves GUID of specified command.
+ virtual GUID get_command(t_uint32 p_index) = 0;
+ //! Retrieves name of item, for list of commands to assign keyboard shortcuts to etc.
+ virtual void get_name(t_uint32 p_index,pfc::string_base & p_out) = 0;
+ //! Retrieves item's description for statusbar etc.
+ virtual bool get_description(t_uint32 p_index,pfc::string_base & p_out) = 0;
+ //! Retrieves GUID of owning menu group.
+ virtual GUID get_parent() = 0;
+ //! Retrieves sorting priority of the command; the lower the number, the upper in the menu your commands will appear. Third party components should use sorting_priority_base and up (values below are reserved for internal use). In case of equal priority, order is undefined.
+ virtual t_uint32 get_sort_priority() {return sort_priority_dontcare;}
+ //! Retrieves display string and display flags to use when menu is about to be displayed. If returns false, menu item won't be displayed. You can create keyboard-shortcut-only commands by always returning false from get_display().
+ virtual bool get_display(t_uint32 p_index,pfc::string_base & p_text,t_uint32 & p_flags) {p_flags = 0;get_name(p_index,p_text);return true;}
+ //! Executes the command. p_callback parameter is reserved for future use and should be ignored / set to null pointer.
+ virtual void execute(t_uint32 p_index,service_ptr_t<service_base> p_callback) = 0;
+
+ static bool g_execute(const GUID & p_guid,service_ptr_t<service_base> p_callback = NULL);
+ static bool g_execute_dynamic(const GUID & p_guid, const GUID & p_subGuid,service_ptr_t<service_base> p_callback = NULL);
+ static bool g_find_by_name(const char * p_name,GUID & p_guid);
+
+ FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(mainmenu_commands);
+};
+
+class NOVTABLE mainmenu_manager : public service_base {
+public:
+ enum {
+ flag_show_shortcuts = 1 << 0,
+ flag_show_shortcuts_global = 1 << 1,
+ //! \since 1.0
+ //! To control which commands are shown, you should specify either flag_view_reduced or flag_view_full. If neither is specified, the implementation will decide automatically based on shift key being pressed, for backwards compatibility.
+ flag_view_reduced = 1 << 2,
+ //! \since 1.0
+ //! To control which commands are shown, you should specify either flag_view_reduced or flag_view_full. If neither is specified, the implementation will decide automatically based on shift key being pressed, for backwards compatibility.
+ flag_view_full = 1 << 3,
+ };
+
+ virtual void instantiate(const GUID & p_root) = 0;
+
+#ifdef _WIN32
+ virtual void generate_menu_win32(HMENU p_menu,t_uint32 p_id_base,t_uint32 p_id_count,t_uint32 p_flags) = 0;
+#else
+#error portme
+#endif
+ //@param p_id Identifier of command to execute, relative to p_id_base of generate_menu_*()
+ //@returns true if command was executed successfully, false if not (e.g. command with given identifier not found).
+ virtual bool execute_command(t_uint32 p_id,service_ptr_t<service_base> p_callback = service_ptr_t<service_base>()) = 0;
+
+ virtual bool get_description(t_uint32 p_id,pfc::string_base & p_out) = 0;
+
+ FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(mainmenu_manager);
+};
+
+class mainmenu_groups {
+public:
+ static const GUID file,view,edit,playback,library,help;
+ static const GUID file_open,file_add,file_playlist,file_etc;
+ static const GUID playback_controls,playback_etc;
+ static const GUID view_visualisations, view_alwaysontop;
+ static const GUID edit_part1,edit_part2,edit_part3;
+ static const GUID edit_part2_selection,edit_part2_sort,edit_part2_selection_sort;
+ static const GUID file_etc_preferences, file_etc_exit;
+ static const GUID help_about;
+ static const GUID library_refresh;
+
+ enum {priority_edit_part1,priority_edit_part2,priority_edit_part3};
+ enum {priority_edit_part2_commands,priority_edit_part2_selection,priority_edit_part2_sort};
+ enum {priority_edit_part2_selection_commands,priority_edit_part2_selection_sort};
+ enum {priority_file_open,priority_file_add,priority_file_playlist,priority_file_etc = mainmenu_commands::sort_priority_last};
+};
+
+
+class mainmenu_group_impl : public mainmenu_group {
+public:
+ mainmenu_group_impl(const GUID & p_guid,const GUID & p_parent,t_uint32 p_priority) : m_guid(p_guid), m_parent(p_parent), m_priority(p_priority) {}
+ GUID get_guid() {return m_guid;}
+ GUID get_parent() {return m_parent;}
+ t_uint32 get_sort_priority() {return m_priority;}
+private:
+ GUID m_guid,m_parent; t_uint32 m_priority;
+};
+
+class mainmenu_group_popup_impl : public mainmenu_group_popup {
+public:
+ mainmenu_group_popup_impl(const GUID & p_guid,const GUID & p_parent,t_uint32 p_priority,const char * p_name) : m_guid(p_guid), m_parent(p_parent), m_priority(p_priority), m_name(p_name) {}
+ GUID get_guid() {return m_guid;}
+ GUID get_parent() {return m_parent;}
+ t_uint32 get_sort_priority() {return m_priority;}
+ void get_display_string(pfc::string_base & p_out) {p_out = m_name;}
+private:
+ GUID m_guid,m_parent; t_uint32 m_priority; pfc::string8 m_name;
+};
+
+typedef service_factory_single_t<mainmenu_group_impl> __mainmenu_group_factory;
+typedef service_factory_single_t<mainmenu_group_popup_impl> __mainmenu_group_popup_factory;
+
+class mainmenu_group_factory : public __mainmenu_group_factory {
+public:
+ mainmenu_group_factory(const GUID & p_guid,const GUID & p_parent,t_uint32 p_priority) : __mainmenu_group_factory(p_guid,p_parent,p_priority) {}
+};
+
+class mainmenu_group_popup_factory : public __mainmenu_group_popup_factory {
+public:
+ mainmenu_group_popup_factory(const GUID & p_guid,const GUID & p_parent,t_uint32 p_priority,const char * p_name) : __mainmenu_group_popup_factory(p_guid,p_parent,p_priority,p_name) {}
+};
+
+template<typename T>
+class mainmenu_commands_factory_t : public service_factory_single_t<T> {};
+
+
+
+
+
+
+// \since 1.0
+class NOVTABLE mainmenu_node : public service_base {
+ FB2K_MAKE_SERVICE_INTERFACE(mainmenu_node, service_base)
+public:
+ enum { //same as contextmenu_item_node::t_type
+ type_group,type_command,type_separator
+ };
+
+ virtual t_uint32 get_type() = 0;
+ virtual void get_display(pfc::string_base & text, t_uint32 & flags) = 0;
+ //! Valid only if type is type_group.
+ virtual t_size get_children_count() = 0;
+ //! Valid only if type is type_group.
+ virtual ptr get_child(t_size index) = 0;
+ //! Valid only if type is type_command.
+ virtual void execute(service_ptr_t<service_base> callback) = 0;
+ //! Valid only if type is type_command.
+ virtual GUID get_guid() = 0;
+ //! Valid only if type is type_command.
+ virtual bool get_description(pfc::string_base & out) {return false;}
+
+};
+
+class mainmenu_node_separator : public mainmenu_node {
+public:
+ t_uint32 get_type() {return type_separator;}
+ void get_display(pfc::string_base & text, t_uint32 & flags) {text = ""; flags = 0;}
+ t_size get_children_count() {return 0;}
+ ptr get_child(t_size index) {throw pfc::exception_invalid_params();}
+ void execute(service_ptr_t<service_base>) {}
+ GUID get_guid() {return pfc::guid_null;}
+};
+
+class mainmenu_node_command : public mainmenu_node {
+public:
+ t_uint32 get_type() {return type_command;}
+ t_size get_children_count() {return 0;}
+ ptr get_child(t_size index) {throw pfc::exception_invalid_params();}
+/*
+ void get_display(pfc::string_base & text, t_uint32 & flags);
+ void execute(service_ptr_t<service_base> callback);
+ GUID get_guid();
+ bool get_description(pfc::string_base & out) {return false;}
+*/
+};
+
+class mainmenu_node_group : public mainmenu_node {
+public:
+ t_uint32 get_type() {return type_group;}
+ void execute(service_ptr_t<service_base> callback) {}
+ GUID get_guid() {return pfc::guid_null;}
+/*
+ void get_display(pfc::string_base & text, t_uint32 & flags);
+ t_size get_children_count();
+ ptr get_child(t_size index);
+*/
+};
+
+
+// \since 1.0
+class NOVTABLE mainmenu_commands_v2 : public mainmenu_commands {
+ FB2K_MAKE_SERVICE_INTERFACE(mainmenu_commands_v2, mainmenu_commands)
+public:
+ virtual bool is_command_dynamic(t_uint32 index) = 0;
+ //! Valid only when is_command_dynamic() returns true. Behavior undefined otherwise.
+ virtual mainmenu_node::ptr dynamic_instantiate(t_uint32 index) = 0;
+ //! Default fallback implementation provided.
+ virtual bool dynamic_execute(t_uint32 index, const GUID & subID, service_ptr_t<service_base> callback);
+};
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/menu_helpers.cpp b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/menu_helpers.cpp new file mode 100644 index 0000000000..5a3c14b26e --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/menu_helpers.cpp @@ -0,0 +1,297 @@ +#include "foobar2000.h"
+
+
+bool menu_helpers::context_get_description(const GUID& p_guid,pfc::string_base & out) {
+ service_ptr_t<contextmenu_item> ptr; t_uint32 index;
+ if (!menu_item_resolver::g_resolve_context_command(p_guid, ptr, index)) return false;
+ bool rv = ptr->get_item_description(index, out);
+ if (!rv) out.reset();
+ return rv;
+}
+
+static bool run_context_command_internal(const GUID & p_command,const GUID & p_subcommand,const pfc::list_base_const_t<metadb_handle_ptr> & data,const GUID & caller) {
+ if (data.get_count() == 0) return false;
+ service_ptr_t<contextmenu_item> ptr; t_uint32 index;
+ if (!menu_item_resolver::g_resolve_context_command(p_command, ptr, index)) return false;
+
+ {
+ TRACK_CALL_TEXT("menu_helpers::run_command(), by GUID");
+ ptr->item_execute_simple(index, p_subcommand, data, caller);
+ }
+
+ return true;
+}
+
+bool menu_helpers::run_command_context(const GUID & p_command,const GUID & p_subcommand,const pfc::list_base_const_t<metadb_handle_ptr> & data)
+{
+ return run_context_command_internal(p_command,p_subcommand,data,contextmenu_item::caller_undefined);
+}
+
+bool menu_helpers::run_command_context_ex(const GUID & p_command,const GUID & p_subcommand,const pfc::list_base_const_t<metadb_handle_ptr> & data,const GUID & caller)
+{
+ return run_context_command_internal(p_command,p_subcommand,data,caller);
+}
+
+bool menu_helpers::test_command_context(const GUID & p_guid)
+{
+ service_ptr_t<contextmenu_item> ptr; t_uint32 index;
+ return menu_item_resolver::g_resolve_context_command(p_guid, ptr, index);
+}
+
+static bool g_is_checked(const GUID & p_command,const GUID & p_subcommand,const pfc::list_base_const_t<metadb_handle_ptr> & data,const GUID & caller)
+{
+ service_ptr_t<contextmenu_item> ptr; t_uint32 index;
+ if (!menu_item_resolver::g_resolve_context_command(p_command, ptr, index)) return false;
+
+ unsigned displayflags = 0;
+ pfc::string_formatter dummystring;
+ if (!ptr->item_get_display_data(dummystring,displayflags,index,p_subcommand,data,caller)) return false;
+ return (displayflags & contextmenu_item_node::FLAG_CHECKED) != 0;
+
+}
+
+bool menu_helpers::is_command_checked_context(const GUID & p_command,const GUID & p_subcommand,const pfc::list_base_const_t<metadb_handle_ptr> & data)
+{
+ return g_is_checked(p_command,p_subcommand,data,contextmenu_item::caller_undefined);
+}
+
+bool menu_helpers::is_command_checked_context_playlist(const GUID & p_command,const GUID & p_subcommand)
+{
+ metadb_handle_list temp;
+ static_api_ptr_t<playlist_manager> api;
+ api->activeplaylist_get_selected_items(temp);
+ return g_is_checked(p_command,p_subcommand,temp,contextmenu_item::caller_playlist);
+}
+
+
+
+
+
+
+
+bool menu_helpers::run_command_context_playlist(const GUID & p_command,const GUID & p_subcommand)
+{
+ metadb_handle_list temp;
+ static_api_ptr_t<playlist_manager> api;
+ api->activeplaylist_get_selected_items(temp);
+ return run_command_context_ex(p_command,p_subcommand,temp,contextmenu_item::caller_playlist);
+}
+
+bool menu_helpers::run_command_context_now_playing(const GUID & p_command,const GUID & p_subcommand)
+{
+ metadb_handle_ptr item;
+ if (!static_api_ptr_t<playback_control>()->get_now_playing(item)) return false;//not playing
+ return run_command_context_ex(p_command,p_subcommand,pfc::list_single_ref_t<metadb_handle_ptr>(item),contextmenu_item::caller_now_playing);
+}
+
+
+bool menu_helpers::guid_from_name(const char * p_name,unsigned p_name_len,GUID & p_out)
+{
+ service_enum_t<contextmenu_item> e;
+ service_ptr_t<contextmenu_item> ptr;
+ pfc::string8_fastalloc nametemp;
+ while(e.next(ptr))
+ {
+ unsigned n, m = ptr->get_num_items();
+ for(n=0;n<m;n++)
+ {
+ ptr->get_item_name(n,nametemp);
+ if (!strcmp_ex(nametemp,~0,p_name,p_name_len))
+ {
+ p_out = ptr->get_item_guid(n);
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
+bool menu_helpers::name_from_guid(const GUID & p_guid,pfc::string_base & p_out) {
+ service_ptr_t<contextmenu_item> ptr; t_uint32 index;
+ if (!menu_item_resolver::g_resolve_context_command(p_guid, ptr, index)) return false;
+ ptr->get_item_name(index, p_out);
+ return true;
+}
+
+
+static unsigned calc_total_action_count()
+{
+ service_enum_t<contextmenu_item> e;
+ service_ptr_t<contextmenu_item> ptr;
+ unsigned ret = 0;
+ while(e.next(ptr))
+ ret += ptr->get_num_items();
+ return ret;
+}
+
+
+const char * menu_helpers::guid_to_name_table::search(const GUID & p_guid)
+{
+ if (!m_inited)
+ {
+ m_data.set_size(calc_total_action_count());
+ t_size dataptr = 0;
+ pfc::string8_fastalloc nametemp;
+
+ service_enum_t<contextmenu_item> e;
+ service_ptr_t<contextmenu_item> ptr;
+ while(e.next(ptr))
+ {
+ unsigned n, m = ptr->get_num_items();
+ for(n=0;n<m;n++)
+ {
+ assert(dataptr < m_data.get_size());
+
+ ptr->get_item_name(n,nametemp);
+ m_data[dataptr].m_name = _strdup(nametemp);
+ m_data[dataptr].m_guid = ptr->get_item_guid(n);
+ dataptr++;
+ }
+ }
+ assert(dataptr == m_data.get_size());
+
+ pfc::sort_t(m_data,entry_compare,m_data.get_size());
+ m_inited = true;
+ }
+ t_size index;
+ if (pfc::bsearch_t(m_data.get_size(),m_data,entry_compare_search,p_guid,index))
+ return m_data[index].m_name;
+ else
+ return 0;
+}
+
+int menu_helpers::guid_to_name_table::entry_compare_search(const entry & entry1,const GUID & entry2)
+{
+ return pfc::guid_compare(entry1.m_guid,entry2);
+}
+
+int menu_helpers::guid_to_name_table::entry_compare(const entry & entry1,const entry & entry2)
+{
+ return pfc::guid_compare(entry1.m_guid,entry2.m_guid);
+}
+
+menu_helpers::guid_to_name_table::guid_to_name_table()
+{
+ m_inited = false;
+}
+
+menu_helpers::guid_to_name_table::~guid_to_name_table()
+{
+ t_size n, m = m_data.get_size();
+ for(n=0;n<m;n++) free(m_data[n].m_name);
+
+}
+
+
+int menu_helpers::name_to_guid_table::entry_compare_search(const entry & entry1,const search_entry & entry2)
+{
+ return stricmp_utf8_ex(entry1.m_name,~0,entry2.m_name,entry2.m_name_len);
+}
+
+int menu_helpers::name_to_guid_table::entry_compare(const entry & entry1,const entry & entry2)
+{
+ return stricmp_utf8(entry1.m_name,entry2.m_name);
+}
+
+bool menu_helpers::name_to_guid_table::search(const char * p_name,unsigned p_name_len,GUID & p_out)
+{
+ if (!m_inited)
+ {
+ m_data.set_size(calc_total_action_count());
+ t_size dataptr = 0;
+ pfc::string8_fastalloc nametemp;
+
+ service_enum_t<contextmenu_item> e;
+ service_ptr_t<contextmenu_item> ptr;
+ while(e.next(ptr))
+ {
+ unsigned n, m = ptr->get_num_items();
+ for(n=0;n<m;n++)
+ {
+ assert(dataptr < m_data.get_size());
+
+ ptr->get_item_name(n,nametemp);
+ m_data[dataptr].m_name = _strdup(nametemp);
+ m_data[dataptr].m_guid = ptr->get_item_guid(n);
+ dataptr++;
+ }
+ }
+ assert(dataptr == m_data.get_size());
+
+ pfc::sort_t(m_data,entry_compare,m_data.get_size());
+ m_inited = true;
+ }
+ t_size index;
+ search_entry temp = {p_name,p_name_len};
+ if (pfc::bsearch_t(m_data.get_size(),m_data,entry_compare_search,temp,index))
+ {
+ p_out = m_data[index].m_guid;
+ return true;
+ }
+ else
+ return false;
+}
+
+menu_helpers::name_to_guid_table::name_to_guid_table()
+{
+ m_inited = false;
+}
+
+menu_helpers::name_to_guid_table::~name_to_guid_table()
+{
+ t_size n, m = m_data.get_size();
+ for(n=0;n<m;n++) free(m_data[n].m_name);
+
+}
+
+bool menu_helpers::find_command_by_name(const char * p_name,service_ptr_t<contextmenu_item> & p_item,unsigned & p_index)
+{
+ pfc::string8_fastalloc path,name;
+ service_enum_t<contextmenu_item> e;
+ service_ptr_t<contextmenu_item> ptr;
+ if (e.first(ptr)) do {
+// if (ptr->get_type()==type)
+ {
+ unsigned action,num_actions = ptr->get_num_items();
+ for(action=0;action<num_actions;action++)
+ {
+ ptr->get_item_default_path(action,path); ptr->get_item_name(action,name);
+ if (!path.is_empty()) path += "/";
+ path += name;
+ if (!stricmp_utf8(p_name,path))
+ {
+ p_item = ptr;
+ p_index = action;
+ return true;
+ }
+ }
+ }
+ } while(e.next(ptr));
+ return false;
+
+}
+
+bool menu_helpers::find_command_by_name(const char * p_name,GUID & p_command)
+{
+ service_ptr_t<contextmenu_item> item;
+ unsigned index;
+ bool ret = find_command_by_name(p_name,item,index);
+ if (ret) p_command = item->get_item_guid(index);
+ return ret;
+}
+
+
+bool standard_commands::run_main(const GUID & p_guid) {
+ t_uint32 index;
+ mainmenu_commands::ptr ptr;
+ if (!menu_item_resolver::g_resolve_main_command(p_guid, ptr, index)) return false;
+ ptr->execute(index,service_ptr_t<service_base>());
+ return true;
+}
+
+bool menu_item_resolver::g_resolve_context_command(const GUID & id, contextmenu_item::ptr & out, t_uint32 & out_index) {
+ return static_api_ptr_t<menu_item_resolver>()->resolve_context_command(id, out, out_index);
+}
+bool menu_item_resolver::g_resolve_main_command(const GUID & id, mainmenu_commands::ptr & out, t_uint32 & out_index) {
+ return static_api_ptr_t<menu_item_resolver>()->resolve_main_command(id, out, out_index);
+}
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/menu_helpers.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/menu_helpers.h new file mode 100644 index 0000000000..6233245283 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/menu_helpers.h @@ -0,0 +1,182 @@ +namespace menu_helpers {
+#ifdef _WIN32
+ void win32_auto_mnemonics(HMENU menu);
+#endif
+
+ bool run_command_context(const GUID & p_command,const GUID & p_subcommand,const pfc::list_base_const_t<metadb_handle_ptr> & data);
+ bool run_command_context_ex(const GUID & p_command,const GUID & p_subcommand,const pfc::list_base_const_t<metadb_handle_ptr> & data,const GUID & caller);
+ bool run_command_context_playlist(const GUID & p_command,const GUID & p_subcommand);
+ bool run_command_context_now_playing(const GUID & p_command,const GUID & p_subcommand);
+
+ bool test_command_context(const GUID & p_guid);
+
+ bool is_command_checked_context(const GUID & p_command,const GUID & p_subcommand,const pfc::list_base_const_t<metadb_handle_ptr> & data);
+ bool is_command_checked_context_playlist(const GUID & p_command,const GUID & p_subcommand);
+
+ bool find_command_by_name(const char * p_name,service_ptr_t<contextmenu_item> & p_item,unsigned & p_index);
+ bool find_command_by_name(const char * p_name,GUID & p_command);
+
+ bool context_get_description(const GUID& p_guid,pfc::string_base & out);
+
+ bool guid_from_name(const char * p_name,unsigned p_name_len,GUID & p_out);
+ bool name_from_guid(const GUID & p_guid,pfc::string_base & p_out);
+
+ class guid_to_name_table
+ {
+ public:
+ guid_to_name_table();
+ ~guid_to_name_table();
+ const char * search(const GUID & p_guid);
+ private:
+ struct entry {
+ char* m_name;
+ GUID m_guid;
+ };
+ pfc::array_t<entry> m_data;
+ bool m_inited;
+
+ static int entry_compare_search(const entry & entry1,const GUID & entry2);
+ static int entry_compare(const entry & entry1,const entry & entry2);
+ };
+
+ class name_to_guid_table
+ {
+ public:
+ name_to_guid_table();
+ ~name_to_guid_table();
+ bool search(const char * p_name,unsigned p_name_len,GUID & p_out);
+ private:
+ struct entry {
+ char* m_name;
+ GUID m_guid;
+ };
+ pfc::array_t<entry> m_data;
+ bool m_inited;
+ struct search_entry {
+ const char * m_name; unsigned m_name_len;
+ };
+
+ static int entry_compare_search(const entry & entry1,const search_entry & entry2);
+ static int entry_compare(const entry & entry1,const entry & entry2);
+ };
+
+};
+
+
+
+class standard_commands
+{
+public:
+ static const GUID
+ guid_context_file_properties, guid_context_file_open_directory, guid_context_copy_names,
+ guid_context_send_to_playlist, guid_context_reload_info, guid_context_reload_info_if_changed,
+ guid_context_rewrite_info, guid_context_remove_tags,
+ guid_context_convert_run, guid_context_convert_run_singlefile,guid_context_convert_run_withcue,
+ guid_context_write_cd,
+ guid_context_rg_scan_track, guid_context_rg_scan_album, guid_context_rg_scan_album_multi,
+ guid_context_rg_remove, guid_context_save_playlist, guid_context_masstag_edit,
+ guid_context_masstag_rename,
+ guid_main_always_on_top, guid_main_preferences, guid_main_about,
+ guid_main_exit, guid_main_restart, guid_main_activate,
+ guid_main_hide, guid_main_activate_or_hide, guid_main_titleformat_help,
+ guid_main_next, guid_main_previous,
+ guid_main_next_or_random, guid_main_random, guid_main_pause,
+ guid_main_play, guid_main_play_or_pause, guid_main_rg_set_album,
+ guid_main_rg_set_track, guid_main_rg_disable, guid_main_stop,
+ guid_main_stop_after_current, guid_main_volume_down, guid_main_volume_up,
+ guid_main_volume_mute, guid_main_add_directory, guid_main_add_files,
+ guid_main_add_location, guid_main_add_playlist, guid_main_clear_playlist,
+ guid_main_create_playlist, guid_main_highlight_playing, guid_main_load_playlist,
+ guid_main_next_playlist, guid_main_previous_playlist, guid_main_open,
+ guid_main_remove_playlist, guid_main_remove_dead_entries, guid_main_remove_duplicates,
+ guid_main_rename_playlist, guid_main_save_all_playlists, guid_main_save_playlist,
+ guid_main_playlist_search, guid_main_playlist_sel_crop, guid_main_playlist_sel_remove,
+ guid_main_playlist_sel_invert, guid_main_playlist_undo, guid_main_show_console,
+ guid_main_play_cd, guid_main_restart_resetconfig, guid_main_record,
+ guid_main_playlist_moveback, guid_main_playlist_moveforward, guid_main_playlist_redo,
+ guid_main_playback_follows_cursor, guid_main_cursor_follows_playback, guid_main_saveconfig,
+ guid_main_playlist_select_all, guid_main_show_now_playing,
+
+ guid_seek_ahead_1s, guid_seek_ahead_5s, guid_seek_ahead_10s, guid_seek_ahead_30s,
+ guid_seek_ahead_1min, guid_seek_ahead_2min, guid_seek_ahead_5min, guid_seek_ahead_10min,
+
+ guid_seek_back_1s, guid_seek_back_5s, guid_seek_back_10s, guid_seek_back_30s,
+ guid_seek_back_1min, guid_seek_back_2min, guid_seek_back_5min, guid_seek_back_10min
+ ;
+
+ static bool run_main(const GUID & guid);
+ static inline bool run_context(const GUID & guid,const pfc::list_base_const_t<metadb_handle_ptr> &data) {return menu_helpers::run_command_context(guid,pfc::guid_null,data);}
+ static inline bool run_context(const GUID & guid,const pfc::list_base_const_t<metadb_handle_ptr> &data,const GUID& caller) {return menu_helpers::run_command_context_ex(guid,pfc::guid_null,data,caller);}
+
+ static inline bool context_file_properties(const pfc::list_base_const_t<metadb_handle_ptr> &data,const GUID& caller = contextmenu_item::caller_undefined) {return run_context(guid_context_file_properties,data,caller);}
+ static inline bool context_file_open_directory(const pfc::list_base_const_t<metadb_handle_ptr> &data,const GUID& caller = contextmenu_item::caller_undefined) {return run_context(guid_context_file_open_directory,data,caller);}
+ static inline bool context_copy_names(const pfc::list_base_const_t<metadb_handle_ptr> &data,const GUID& caller = contextmenu_item::caller_undefined) {return run_context(guid_context_copy_names,data,caller);}
+ static inline bool context_send_to_playlist(const pfc::list_base_const_t<metadb_handle_ptr> &data,const GUID& caller = contextmenu_item::caller_undefined) {return run_context(guid_context_send_to_playlist,data,caller);}
+ static inline bool context_reload_info(const pfc::list_base_const_t<metadb_handle_ptr> &data,const GUID& caller = contextmenu_item::caller_undefined) {return run_context(guid_context_reload_info,data,caller);}
+ static inline bool context_reload_info_if_changed(const pfc::list_base_const_t<metadb_handle_ptr> &data,const GUID& caller = contextmenu_item::caller_undefined) {return run_context(guid_context_reload_info_if_changed,data,caller);}
+ static inline bool context_rewrite_info(const pfc::list_base_const_t<metadb_handle_ptr> &data,const GUID& caller = contextmenu_item::caller_undefined) {return run_context(guid_context_rewrite_info,data,caller);}
+ static inline bool context_remove_tags(const pfc::list_base_const_t<metadb_handle_ptr> &data,const GUID& caller = contextmenu_item::caller_undefined) {return run_context(guid_context_remove_tags,data,caller);}
+ static inline bool context_convert_run(const pfc::list_base_const_t<metadb_handle_ptr> &data,const GUID& caller = contextmenu_item::caller_undefined) {return run_context(guid_context_convert_run,data,caller);}
+ static inline bool context_convert_run_singlefile(const pfc::list_base_const_t<metadb_handle_ptr> &data,const GUID& caller = contextmenu_item::caller_undefined) {return run_context(guid_context_convert_run_singlefile,data,caller);}
+ static inline bool context_write_cd(const pfc::list_base_const_t<metadb_handle_ptr> &data,const GUID& caller = contextmenu_item::caller_undefined) {return run_context(guid_context_write_cd,data,caller);}
+ static inline bool context_rg_scan_track(const pfc::list_base_const_t<metadb_handle_ptr> &data,const GUID& caller = contextmenu_item::caller_undefined) {return run_context(guid_context_rg_scan_track,data,caller);}
+ static inline bool context_rg_scan_album(const pfc::list_base_const_t<metadb_handle_ptr> &data,const GUID& caller = contextmenu_item::caller_undefined) {return run_context(guid_context_rg_scan_album,data,caller);}
+ static inline bool context_rg_scan_album_multi(const pfc::list_base_const_t<metadb_handle_ptr> &data,const GUID& caller = contextmenu_item::caller_undefined) {return run_context(guid_context_rg_scan_album_multi,data,caller);}
+ static inline bool context_rg_remove(const pfc::list_base_const_t<metadb_handle_ptr> &data,const GUID& caller = contextmenu_item::caller_undefined) {return run_context(guid_context_rg_remove,data,caller);}
+ static inline bool context_save_playlist(const pfc::list_base_const_t<metadb_handle_ptr> &data,const GUID& caller = contextmenu_item::caller_undefined) {return run_context(guid_context_save_playlist,data,caller);}
+ static inline bool context_masstag_edit(const pfc::list_base_const_t<metadb_handle_ptr> &data,const GUID& caller = contextmenu_item::caller_undefined) {return run_context(guid_context_masstag_edit,data,caller);}
+ static inline bool context_masstag_rename(const pfc::list_base_const_t<metadb_handle_ptr> &data,const GUID& caller = contextmenu_item::caller_undefined) {return run_context(guid_context_masstag_rename,data,caller);}
+ static inline bool main_always_on_top() {return run_main(guid_main_always_on_top);}
+ static inline bool main_preferences() {return run_main(guid_main_preferences);}
+ static inline bool main_about() {return run_main(guid_main_about);}
+ static inline bool main_exit() {return run_main(guid_main_exit);}
+ static inline bool main_restart() {return run_main(guid_main_restart);}
+ static inline bool main_activate() {return run_main(guid_main_activate);}
+ static inline bool main_hide() {return run_main(guid_main_hide);}
+ static inline bool main_activate_or_hide() {return run_main(guid_main_activate_or_hide);}
+ static inline bool main_titleformat_help() {return run_main(guid_main_titleformat_help);}
+ static inline bool main_playback_follows_cursor() {return run_main(guid_main_playback_follows_cursor);}
+ static inline bool main_next() {return run_main(guid_main_next);}
+ static inline bool main_previous() {return run_main(guid_main_previous);}
+ static inline bool main_next_or_random() {return run_main(guid_main_next_or_random);}
+ static inline bool main_random() {return run_main(guid_main_random);}
+ static inline bool main_pause() {return run_main(guid_main_pause);}
+ static inline bool main_play() {return run_main(guid_main_play);}
+ static inline bool main_play_or_pause() {return run_main(guid_main_play_or_pause);}
+ static inline bool main_rg_set_album() {return run_main(guid_main_rg_set_album);}
+ static inline bool main_rg_set_track() {return run_main(guid_main_rg_set_track);}
+ static inline bool main_rg_disable() {return run_main(guid_main_rg_disable);}
+ static inline bool main_stop() {return run_main(guid_main_stop);}
+ static inline bool main_stop_after_current() {return run_main(guid_main_stop_after_current);}
+ static inline bool main_volume_down() {return run_main(guid_main_volume_down);}
+ static inline bool main_volume_up() {return run_main(guid_main_volume_up);}
+ static inline bool main_volume_mute() {return run_main(guid_main_volume_mute);}
+ static inline bool main_add_directory() {return run_main(guid_main_add_directory);}
+ static inline bool main_add_files() {return run_main(guid_main_add_files);}
+ static inline bool main_add_location() {return run_main(guid_main_add_location);}
+ static inline bool main_add_playlist() {return run_main(guid_main_add_playlist);}
+ static inline bool main_clear_playlist() {return run_main(guid_main_clear_playlist);}
+ static inline bool main_create_playlist() {return run_main(guid_main_create_playlist);}
+ static inline bool main_highlight_playing() {return run_main(guid_main_highlight_playing);}
+ static inline bool main_load_playlist() {return run_main(guid_main_load_playlist);}
+ static inline bool main_next_playlist() {return run_main(guid_main_next_playlist);}
+ static inline bool main_previous_playlist() {return run_main(guid_main_previous_playlist);}
+ static inline bool main_open() {return run_main(guid_main_open);}
+ static inline bool main_remove_playlist() {return run_main(guid_main_remove_playlist);}
+ static inline bool main_remove_dead_entries() {return run_main(guid_main_remove_dead_entries);}
+ static inline bool main_remove_duplicates() {return run_main(guid_main_remove_duplicates);}
+ static inline bool main_rename_playlist() {return run_main(guid_main_rename_playlist);}
+ static inline bool main_save_all_playlists() {return run_main(guid_main_save_all_playlists);}
+ static inline bool main_save_playlist() {return run_main(guid_main_save_playlist);}
+ static inline bool main_playlist_search() {return run_main(guid_main_playlist_search);}
+ static inline bool main_playlist_sel_crop() {return run_main(guid_main_playlist_sel_crop);}
+ static inline bool main_playlist_sel_remove() {return run_main(guid_main_playlist_sel_remove);}
+ static inline bool main_playlist_sel_invert() {return run_main(guid_main_playlist_sel_invert);}
+ static inline bool main_playlist_undo() {return run_main(guid_main_playlist_undo);}
+ static inline bool main_show_console() {return run_main(guid_main_show_console);}
+ static inline bool main_play_cd() {return run_main(guid_main_play_cd);}
+ static inline bool main_restart_resetconfig() {return run_main(guid_main_restart_resetconfig);}
+ static inline bool main_playlist_moveback() {return run_main(guid_main_playlist_moveback);}
+ static inline bool main_playlist_moveforward() {return run_main(guid_main_playlist_moveforward);}
+ static inline bool main_saveconfig() {return run_main(guid_main_saveconfig);}
+};
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/menu_item.cpp b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/menu_item.cpp new file mode 100644 index 0000000000..053170b70d --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/menu_item.cpp @@ -0,0 +1,61 @@ +#include "foobar2000.h"
+
+
+
+bool contextmenu_item::item_get_display_data_root(pfc::string_base & p_out,unsigned & p_displayflags,unsigned p_index,const pfc::list_base_const_t<metadb_handle_ptr> & p_data,const GUID & p_caller)
+{
+ bool status = false;
+ pfc::ptrholder_t<contextmenu_item_node_root> root ( instantiate_item(p_index,p_data,p_caller) );
+ if (root.is_valid()) status = root->get_display_data(p_out,p_displayflags,p_data,p_caller);
+ return status;
+}
+
+
+static contextmenu_item_node * g_find_node(const GUID & p_guid,contextmenu_item_node * p_parent)
+{
+ if (p_parent->get_guid() == p_guid) return p_parent;
+ else if (p_parent->get_type() == contextmenu_item_node::TYPE_POPUP)
+ {
+ t_size n, m = p_parent->get_children_count();
+ for(n=0;n<m;n++)
+ {
+ contextmenu_item_node * temp = g_find_node(p_guid,p_parent->get_child(n));
+ if (temp) return temp;
+ }
+ return 0;
+ }
+ else return 0;
+}
+
+bool contextmenu_item::item_get_display_data(pfc::string_base & p_out,unsigned & p_displayflags,unsigned p_index,const GUID & p_node,const pfc::list_base_const_t<metadb_handle_ptr> & p_data,const GUID & p_caller)
+{
+ bool status = false;
+ pfc::ptrholder_t<contextmenu_item_node_root> root ( instantiate_item(p_index,p_data,p_caller) );
+ if (root.is_valid())
+ {
+ contextmenu_item_node * node = g_find_node(p_node,root.get_ptr());
+ if (node) status = node->get_display_data(p_out,p_displayflags,p_data,p_caller);
+ }
+ return status;
+}
+
+
+GUID contextmenu_item::get_parent_fallback() {
+ unsigned total = get_num_items();
+ if (total < 1) return pfc::guid_null; // hide the item
+ pfc::string_formatter path, base; this->get_item_default_path(0, base);
+ for(unsigned walk = 1; walk < total; ++walk) {
+ this->get_item_default_path(walk, path);
+ if (strcmp(path, base) != 0) return contextmenu_groups::legacy;
+ }
+ return static_api_ptr_t<contextmenu_group_manager>()->path_to_group(base);
+}
+
+GUID contextmenu_item::get_parent_() {
+ contextmenu_item_v2::ptr v2;
+ if (service_query_t(v2)) {
+ return v2->get_parent();
+ } else {
+ return get_parent_fallback();
+ }
+}
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/menu_manager.cpp b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/menu_manager.cpp new file mode 100644 index 0000000000..69393b5a86 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/menu_manager.cpp @@ -0,0 +1,410 @@ +#include "foobar2000.h"
+
+#ifdef WIN32
+
+static void fix_ampersand(const char * src,pfc::string_base & out)
+{
+ out.reset();
+ unsigned ptr = 0;
+ while(src[ptr])
+ {
+ if (src[ptr]=='&')
+ {
+ out.add_string("&&");
+ ptr++;
+ while(src[ptr]=='&')
+ {
+ out.add_string("&&");
+ ptr++;
+ }
+ }
+ else out.add_byte(src[ptr++]);
+ }
+}
+
+static unsigned flags_to_win32(unsigned flags)
+{
+ unsigned ret = 0;
+ if (flags & contextmenu_item_node::FLAG_RADIOCHECKED) {/* dealt with elsewhere */}
+ else if (flags & contextmenu_item_node::FLAG_CHECKED) ret |= MF_CHECKED;
+ if (flags & contextmenu_item_node::FLAG_DISABLED) ret |= MF_DISABLED;
+ if (flags & contextmenu_item_node::FLAG_GRAYED) ret |= MF_GRAYED;
+ return ret;
+}
+
+void contextmenu_manager::win32_build_menu(HMENU menu,contextmenu_node * parent,int base_id,int max_id)//menu item identifiers are base_id<=N<base_id+max_id (if theres too many items, they will be clipped)
+{
+ if (parent!=0 && parent->get_type()==contextmenu_item_node::TYPE_POPUP)
+ {
+ pfc::string8_fastalloc temp;
+ t_size child_idx,child_num = parent->get_num_children();
+ for(child_idx=0;child_idx<child_num;child_idx++)
+ {
+ contextmenu_node * child = parent->get_child(child_idx);
+ if (child)
+ {
+ const char * name = child->get_name();
+ if (strchr(name,'&')) {fix_ampersand(name,temp);name=temp;}
+ contextmenu_item_node::t_type type = child->get_type();
+ if (type==contextmenu_item_node::TYPE_POPUP)
+ {
+ HMENU new_menu = CreatePopupMenu();
+ uAppendMenu(menu,MF_STRING|MF_POPUP | flags_to_win32(child->get_display_flags()),(UINT_PTR)new_menu,name);
+ win32_build_menu(new_menu,child,base_id,max_id);
+ }
+ else if (type==contextmenu_item_node::TYPE_SEPARATOR)
+ {
+ uAppendMenu(menu,MF_SEPARATOR,0,0);
+ }
+ else if (type==contextmenu_item_node::TYPE_COMMAND)
+ {
+ int id = child->get_id();
+ if (id>=0 && (max_id<0 || id<max_id))
+ {
+ const unsigned flags = child->get_display_flags();
+ const UINT ID = base_id+id;
+ uAppendMenu(menu,MF_STRING | flags_to_win32(flags),ID,name);
+ if (flags & contextmenu_item_node::FLAG_RADIOCHECKED) CheckMenuRadioItem(menu,ID,ID,ID,MF_BYCOMMAND);
+ }
+ }
+ }
+ }
+ }
+}
+
+#endif
+
+bool contextmenu_manager::get_description_by_id(unsigned id,pfc::string_base & out) {
+ contextmenu_node * ptr = find_by_id(id);
+ if (ptr == NULL) return false;
+ return ptr->get_description(out);
+}
+bool contextmenu_manager::execute_by_id(unsigned id) {
+ contextmenu_node * ptr = find_by_id(id);
+ if (ptr == NULL) return false;
+ ptr->execute();
+ return true;
+}
+
+#ifdef WIN32
+
+void contextmenu_manager::win32_run_menu_popup(HWND parent,const POINT * pt)
+{
+ enum {ID_CUSTOM_BASE = 1};
+
+ int cmd;
+
+ {
+ POINT p;
+ if (pt) p = *pt;
+ else GetCursorPos(&p);
+
+ HMENU hmenu = CreatePopupMenu();
+ try {
+
+ win32_build_menu(hmenu,ID_CUSTOM_BASE,-1);
+ menu_helpers::win32_auto_mnemonics(hmenu);
+
+ cmd = TrackPopupMenu(hmenu,TPM_RIGHTBUTTON|TPM_NONOTIFY|TPM_RETURNCMD,p.x,p.y,0,parent,0);
+ } catch(...) {DestroyMenu(hmenu); throw;}
+
+ DestroyMenu(hmenu);
+ }
+
+ if (cmd>0)
+ {
+ if (cmd>=ID_CUSTOM_BASE)
+ {
+ execute_by_id(cmd - ID_CUSTOM_BASE);
+ }
+ }
+}
+
+void contextmenu_manager::win32_run_menu_context(HWND parent,const pfc::list_base_const_t<metadb_handle_ptr> & data,const POINT * pt,unsigned flags)
+{
+ service_ptr_t<contextmenu_manager> manager;
+ contextmenu_manager::g_create(manager);
+ manager->init_context(data,flags);
+ manager->win32_run_menu_popup(parent,pt);
+}
+
+void contextmenu_manager::win32_run_menu_context_playlist(HWND parent,const POINT * pt,unsigned flags)
+{
+ service_ptr_t<contextmenu_manager> manager;
+ contextmenu_manager::g_create(manager);
+ manager->init_context_playlist(flags);
+ manager->win32_run_menu_popup(parent,pt);
+}
+
+
+namespace {
+ class mnemonic_manager
+ {
+ pfc::string8_fastalloc used;
+ bool is_used(unsigned c)
+ {
+ char temp[8];
+ temp[pfc::utf8_encode_char(uCharLower(c),temp)]=0;
+ return !!strstr(used,temp);
+ }
+
+ static bool is_alphanumeric(char c)
+ {
+ return (c>='a' && c<='z') || (c>='A' && c<='Z') || (c>='0' && c<='9');
+ }
+
+
+
+
+ void insert(const char * src,unsigned idx,pfc::string_base & out)
+ {
+ out.reset();
+ out.add_string(src,idx);
+ out.add_string("&");
+ out.add_string(src+idx);
+ used.add_char(uCharLower(src[idx]));
+ }
+ public:
+ bool check_string(const char * src)
+ {//check for existing mnemonics
+ const char * ptr = src;
+ while(ptr = strchr(ptr,'&'))
+ {
+ if (ptr[1]=='&') ptr+=2;
+ else
+ {
+ unsigned c = 0;
+ if (pfc::utf8_decode_char(ptr+1,c)>0)
+ {
+ if (!is_used(c)) used.add_char(uCharLower(c));
+ }
+ return true;
+ }
+ }
+ return false;
+ }
+ bool process_string(const char * src,pfc::string_base & out)//returns if changed
+ {
+ if (check_string(src)) {out=src;return false;}
+ unsigned idx=0;
+ while(src[idx]==' ') idx++;
+ while(src[idx])
+ {
+ if (is_alphanumeric(src[idx]) && !is_used(src[idx]))
+ {
+ insert(src,idx,out);
+ return true;
+ }
+
+ while(src[idx] && src[idx]!=' ' && src[idx]!='\t') idx++;
+ if (src[idx]=='\t') break;
+ while(src[idx]==' ') idx++;
+ }
+
+ //no success picking first letter of one of words
+ idx=0;
+ while(src[idx])
+ {
+ if (src[idx]=='\t') break;
+ if (is_alphanumeric(src[idx]) && !is_used(src[idx]))
+ {
+ insert(src,idx,out);
+ return true;
+ }
+ idx++;
+ }
+
+ //giving up
+ out = src;
+ return false;
+ }
+ };
+}
+
+void menu_helpers::win32_auto_mnemonics(HMENU menu)
+{
+ mnemonic_manager mgr;
+ unsigned n, m = GetMenuItemCount(menu);
+ pfc::string8_fastalloc temp,temp2;
+ for(n=0;n<m;n++)//first pass, check existing mnemonics
+ {
+ unsigned type = uGetMenuItemType(menu,n);
+ if (type==MFT_STRING)
+ {
+ uGetMenuString(menu,n,temp,MF_BYPOSITION);
+ mgr.check_string(temp);
+ }
+ }
+
+ for(n=0;n<m;n++)
+ {
+ HMENU submenu = GetSubMenu(menu,n);
+ if (submenu) win32_auto_mnemonics(submenu);
+
+ {
+ unsigned type = uGetMenuItemType(menu,n);
+ if (type==MFT_STRING)
+ {
+ unsigned state = submenu ? 0 : GetMenuState(menu,n,MF_BYPOSITION);
+ unsigned id = GetMenuItemID(menu,n);
+ uGetMenuString(menu,n,temp,MF_BYPOSITION);
+ if (mgr.process_string(temp,temp2))
+ {
+ uModifyMenu(menu,n,MF_BYPOSITION|MF_STRING|state,id,temp2);
+ }
+ }
+ }
+ }
+}
+
+#endif
+
+static bool test_key(unsigned k)
+{
+ return (GetKeyState(k) & 0x8000) ? true : false;
+}
+
+#define F_SHIFT (HOTKEYF_SHIFT<<8)
+#define F_CTRL (HOTKEYF_CONTROL<<8)
+#define F_ALT (HOTKEYF_ALT<<8)
+#define F_WIN (HOTKEYF_EXT<<8)
+
+static t_uint32 get_key_code(WPARAM wp) {
+ t_uint32 code = (t_uint32)(wp & 0xFF);
+ if (test_key(VK_CONTROL)) code|=F_CTRL;
+ if (test_key(VK_SHIFT)) code|=F_SHIFT;
+ if (test_key(VK_MENU)) code|=F_ALT;
+ if (test_key(VK_LWIN) || test_key(VK_RWIN)) code|=F_WIN;
+ return code;
+}
+
+static t_uint32 get_key_code(WPARAM wp, t_uint32 mods) {
+ t_uint32 code = (t_uint32)(wp & 0xFF);
+ if (mods & MOD_CONTROL) code|=F_CTRL;
+ if (mods & MOD_SHIFT) code|=F_SHIFT;
+ if (mods & MOD_ALT) code|=F_ALT;
+ if (mods & MOD_WIN) code|=F_WIN;
+ return code;
+}
+
+bool keyboard_shortcut_manager::on_keydown(shortcut_type type,WPARAM wp)
+{
+ if (type==TYPE_CONTEXT) return false;
+ metadb_handle_list dummy;
+ return process_keydown(type,dummy,get_key_code(wp));
+}
+
+bool keyboard_shortcut_manager::on_keydown_context(const pfc::list_base_const_t<metadb_handle_ptr> & data,WPARAM wp,const GUID & caller)
+{
+ if (data.get_count()==0) return false;
+ return process_keydown_ex(TYPE_CONTEXT,data,get_key_code(wp),caller);
+}
+
+bool keyboard_shortcut_manager::on_keydown_auto(WPARAM wp)
+{
+ if (on_keydown(TYPE_MAIN,wp)) return true;
+ if (on_keydown(TYPE_CONTEXT_PLAYLIST,wp)) return true;
+ if (on_keydown(TYPE_CONTEXT_NOW_PLAYING,wp)) return true;
+ return false;
+}
+
+bool keyboard_shortcut_manager::on_keydown_auto_playlist(WPARAM wp)
+{
+ metadb_handle_list data;
+ static_api_ptr_t<playlist_manager> api;
+ api->activeplaylist_get_selected_items(data);
+ return on_keydown_auto_context(data,wp,contextmenu_item::caller_playlist);
+}
+
+bool keyboard_shortcut_manager::on_keydown_auto_context(const pfc::list_base_const_t<metadb_handle_ptr> & data,WPARAM wp,const GUID & caller)
+{
+ if (on_keydown_context(data,wp,caller)) return true;
+ else return on_keydown_auto(wp);
+}
+
+static bool should_relay_key_restricted(UINT p_key) {
+ switch(p_key) {
+ case VK_LEFT:
+ case VK_RIGHT:
+ case VK_UP:
+ case VK_DOWN:
+ return false;
+ default:
+ return (p_key >= VK_F1 && p_key <= VK_F24) || IsKeyPressed(VK_CONTROL) || IsKeyPressed(VK_LWIN) || IsKeyPressed(VK_RWIN);
+ }
+}
+
+bool keyboard_shortcut_manager::on_keydown_restricted_auto(WPARAM wp) {
+ if (!should_relay_key_restricted(wp)) return false;
+ return on_keydown_auto(wp);
+}
+bool keyboard_shortcut_manager::on_keydown_restricted_auto_playlist(WPARAM wp) {
+ if (!should_relay_key_restricted(wp)) return false;
+ return on_keydown_auto_playlist(wp);
+}
+bool keyboard_shortcut_manager::on_keydown_restricted_auto_context(const pfc::list_base_const_t<metadb_handle_ptr> & data,WPARAM wp,const GUID & caller) {
+ if (!should_relay_key_restricted(wp)) return false;
+ return on_keydown_auto_context(data,wp,caller);
+}
+
+static bool filterTypableWindowMessage(const MSG * msg, t_uint32 modifiers) {
+ if (keyboard_shortcut_manager::is_typing_key_combo((t_uint32)msg->wParam, modifiers)) {
+ try {
+ if (static_api_ptr_t<ui_element_typable_window_manager>()->is_registered(msg->hwnd)) return false;
+ } catch(exception_service_not_found) {}
+ }
+ return true;
+}
+
+bool keyboard_shortcut_manager_v2::pretranslate_message(const MSG * msg, HWND thisPopupWnd) {
+ switch(msg->message) {
+ case WM_KEYDOWN:
+ case WM_SYSKEYDOWN:
+ if (thisPopupWnd != NULL && FindOwningPopup(msg->hwnd) == thisPopupWnd) {
+ const t_uint32 modifiers = GetHotkeyModifierFlags();
+ if (filterTypableWindowMessage(msg, modifiers)) {
+ if (process_keydown_simple(get_key_code(msg->wParam,modifiers))) return true;
+ }
+ }
+ return false;
+ default:
+ return false;
+ }
+}
+
+bool keyboard_shortcut_manager::is_text_key(t_uint32 vkCode) {
+ return vkCode == VK_SPACE
+ || (vkCode >= '0' && vkCode < 0x40)
+ || (vkCode > 0x40 && vkCode < VK_LWIN)
+ || (vkCode >= VK_NUMPAD0 && vkCode <= VK_DIVIDE)
+ || (vkCode >= VK_OEM_1 && vkCode <= VK_OEM_3)
+ || (vkCode >= VK_OEM_4 && vkCode <= VK_OEM_8)
+ ;
+}
+
+bool keyboard_shortcut_manager::is_typing_key(t_uint32 vkCode) {
+ return is_text_key(vkCode)
+ || vkCode == VK_BACK
+ || vkCode == VK_RETURN
+ || vkCode == VK_INSERT
+ || (vkCode > VK_SPACE && vkCode < '0');
+}
+
+bool keyboard_shortcut_manager::is_typing_key_combo(t_uint32 vkCode, t_uint32 modifiers) {
+ if (!is_typing_modifier(modifiers)) return false;
+ return is_typing_key(vkCode);
+}
+
+bool keyboard_shortcut_manager::is_typing_modifier(t_uint32 flags) {
+ flags &= ~MOD_SHIFT;
+ return flags == 0 || flags == (MOD_ALT | MOD_CONTROL);
+}
+
+bool keyboard_shortcut_manager::is_typing_message(HWND editbox, const MSG * msg) {
+ if (msg->hwnd != editbox) return false;
+ return is_typing_message(msg);
+}
+bool keyboard_shortcut_manager::is_typing_message(const MSG * msg) {
+ if (msg->message != WM_KEYDOWN && msg->message != WM_SYSKEYDOWN) return false;
+ return is_typing_key_combo(msg->wParam, GetHotkeyModifierFlags());
+}
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/message_loop.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/message_loop.h new file mode 100644 index 0000000000..19cacaf600 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/message_loop.h @@ -0,0 +1,80 @@ +class NOVTABLE message_filter
+{
+public:
+ virtual bool pretranslate_message(MSG * p_msg) = 0;
+};
+
+class NOVTABLE idle_handler {
+public:
+ virtual bool on_idle() = 0;
+};
+
+class NOVTABLE message_loop : public service_base
+{
+public:
+ virtual void add_message_filter(message_filter * ptr) = 0;
+ virtual void remove_message_filter(message_filter * ptr) = 0;
+
+ virtual void add_idle_handler(idle_handler * ptr) = 0;
+ virtual void remove_idle_handler(idle_handler * ptr) = 0;
+
+ FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(message_loop);
+};
+
+class NOVTABLE message_loop_v2 : public message_loop {
+public:
+ virtual void add_message_filter_ex(message_filter * ptr, t_uint32 lowest, t_uint32 highest) = 0;
+
+ FB2K_MAKE_SERVICE_INTERFACE(message_loop_v2, message_loop);
+};
+
+class message_filter_impl_base : public message_filter {
+public:
+ message_filter_impl_base() {static_api_ptr_t<message_loop>()->add_message_filter(this);}
+ message_filter_impl_base(t_uint32 lowest, t_uint32 highest) {
+ static_api_ptr_t<message_loop> api;
+ message_loop_v2::ptr apiV2;
+ if (api->service_query_t(apiV2)) {
+ apiV2->add_message_filter_ex(this, lowest, highest);
+ } else {
+ api->add_message_filter(this);
+ }
+ }
+ ~message_filter_impl_base() {static_api_ptr_t<message_loop>()->remove_message_filter(this);}
+ bool pretranslate_message(MSG * p_msg) {return false;}
+
+ PFC_CLASS_NOT_COPYABLE(message_filter_impl_base,message_filter_impl_base);
+};
+
+class message_filter_impl_accel : public message_filter_impl_base {
+protected:
+ bool pretranslate_message(MSG * p_msg) {
+ if (m_wnd != NULL) {
+ if (GetActiveWindow() == m_wnd) {
+ if (TranslateAccelerator(m_wnd,m_accel.get(),p_msg) != 0) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+public:
+ message_filter_impl_accel(HINSTANCE p_instance,const TCHAR * p_accel) : m_wnd(NULL) {
+ m_accel.load(p_instance,p_accel);
+ }
+ void set_wnd(HWND p_wnd) {m_wnd = p_wnd;}
+private:
+ HWND m_wnd;
+ win32_accelerator m_accel;
+
+ PFC_CLASS_NOT_COPYABLE(message_filter_impl_accel,message_filter_impl_accel);
+};
+
+class idle_handler_impl_base : public idle_handler {
+public:
+ idle_handler_impl_base() {static_api_ptr_t<message_loop>()->add_idle_handler(this);}
+ ~idle_handler_impl_base() {static_api_ptr_t<message_loop>()->remove_idle_handler(this);}
+ bool on_idle() {return true;}
+
+ PFC_CLASS_NOT_COPYABLE_EX(idle_handler_impl_base)
+};
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/metadb.cpp b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/metadb.cpp new file mode 100644 index 0000000000..98d7c5bb46 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/metadb.cpp @@ -0,0 +1,76 @@ +#include "foobar2000.h"
+
+
+void metadb::handle_create_replace_path_canonical(metadb_handle_ptr & p_out,const metadb_handle_ptr & p_source,const char * p_new_path) {
+ handle_create(p_out,make_playable_location(p_new_path,p_source->get_subsong_index()));
+}
+
+void metadb::handle_create_replace_path(metadb_handle_ptr & p_out,const metadb_handle_ptr & p_source,const char * p_new_path) {
+ pfc::string8 path;
+ filesystem::g_get_canonical_path(p_new_path,path);
+ handle_create_replace_path_canonical(p_out,p_source,path);
+}
+
+void metadb::handle_replace_path_canonical(metadb_handle_ptr & p_out,const char * p_new_path) {
+ metadb_handle_ptr temp;
+ handle_create_replace_path_canonical(temp,p_out,p_new_path);
+ p_out = temp;
+}
+
+
+metadb_io::t_load_info_state metadb_io::load_info(metadb_handle_ptr p_item,t_load_info_type p_type,HWND p_parent_window,bool p_show_errors) {
+ return load_info_multi(pfc::list_single_ref_t<metadb_handle_ptr>(p_item),p_type,p_parent_window,p_show_errors);
+}
+
+metadb_io::t_update_info_state metadb_io::update_info(metadb_handle_ptr p_item,file_info & p_info,HWND p_parent_window,bool p_show_errors)
+{
+ file_info * blah = &p_info;
+ return update_info_multi(pfc::list_single_ref_t<metadb_handle_ptr>(p_item),pfc::list_single_ref_t<file_info*>(blah),p_parent_window,p_show_errors);
+}
+
+
+void metadb_io::hint_async(metadb_handle_ptr p_item,const file_info & p_info,const t_filestats & p_stats,bool p_fresh)
+{
+ const file_info * blargh = &p_info;
+ hint_multi_async(pfc::list_single_ref_t<metadb_handle_ptr>(p_item),pfc::list_single_ref_t<const file_info *>(blargh),pfc::list_single_ref_t<t_filestats>(p_stats),bit_array_val(p_fresh));
+}
+
+
+bool metadb::g_get_random_handle(metadb_handle_ptr & p_out) {
+ if (static_api_ptr_t<playback_control>()->get_now_playing(p_out)) return true;
+
+ {
+ static_api_ptr_t<playlist_manager> api;
+
+ t_size playlist_count = api->get_playlist_count();
+ t_size active_playlist = api->get_active_playlist();
+ if (active_playlist != ~0) {
+ if (api->playlist_get_focus_item_handle(p_out,active_playlist)) return true;
+ }
+
+ for(t_size n = 0; n < playlist_count; n++) {
+ if (api->playlist_get_focus_item_handle(p_out,n)) return true;
+ }
+
+ if (active_playlist != ~0) {
+ t_size item_count = api->playlist_get_item_count(active_playlist);
+ if (item_count > 0) {
+ if (api->playlist_get_item_handle(p_out,active_playlist,0)) return true;
+ }
+ }
+
+ for(t_size n = 0; n < playlist_count; n++) {
+ t_size item_count = api->playlist_get_item_count(n);
+ if (item_count > 0) {
+ if (api->playlist_get_item_handle(p_out,n,0)) return true;
+ }
+ }
+ }
+
+ return false;
+}
+
+
+void metadb_io_v2::update_info_async_simple(const pfc::list_base_const_t<metadb_handle_ptr> & p_list,const pfc::list_base_const_t<const file_info*> & p_new_info, HWND p_parent_window,t_uint32 p_op_flags,completion_notify_ptr p_notify) {
+ update_info_async(p_list,new service_impl_t<file_info_filter_impl>(p_list,p_new_info),p_parent_window,p_op_flags,p_notify);
+}
\ No newline at end of file diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/metadb.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/metadb.h new file mode 100644 index 0000000000..2af3b78f5d --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/metadb.h @@ -0,0 +1,319 @@ +//! API for tag read/write operations. Legal to call from main thread only, except for hint_multi_async() / hint_async() / hint_reader().\n
+//! Implemented only by core, do not reimplement.\n
+//! Use static_api_ptr_t template to access metadb_io methods.\n
+//! WARNING: Methods that perform file access (tag reads/writes) run a modal message loop. They SHOULD NOT be called from global callbacks and such.
+class NOVTABLE metadb_io : public service_base
+{
+public:
+ enum t_load_info_type {
+ load_info_default,
+ load_info_force,
+ load_info_check_if_changed
+ };
+
+ enum t_update_info_state {
+ update_info_success,
+ update_info_aborted,
+ update_info_errors,
+ };
+
+ enum t_load_info_state {
+ load_info_success,
+ load_info_aborted,
+ load_info_errors,
+ };
+
+ //! No longer used - returns false always.
+ __declspec(deprecated) virtual bool is_busy() = 0;
+ //! No longer used - returns false always.
+ __declspec(deprecated) virtual bool is_updating_disabled() = 0;
+ //! No longer used - returns false always.
+ __declspec(deprecated) virtual bool is_file_updating_blocked() = 0;
+ //! No longer used.
+ __declspec(deprecated) virtual void highlight_running_process() = 0;
+ //! Loads tags from multiple items. Use the async version in metadb_io_v2 instead if possible.
+ __declspec(deprecated) virtual t_load_info_state load_info_multi(metadb_handle_list_cref p_list,t_load_info_type p_type,HWND p_parent_window,bool p_show_errors) = 0;
+ //! Updates tags on multiple items. Use the async version in metadb_io_v2 instead if possible.
+ __declspec(deprecated) virtual t_update_info_state update_info_multi(metadb_handle_list_cref p_list,const pfc::list_base_const_t<file_info*> & p_new_info,HWND p_parent_window,bool p_show_errors) = 0;
+ //! Rewrites tags on multiple items. Use the async version in metadb_io_v2 instead if possible.
+ __declspec(deprecated) virtual t_update_info_state rewrite_info_multi(metadb_handle_list_cref p_list,HWND p_parent_window,bool p_show_errors) = 0;
+ //! Removes tags from multiple items. Use the async version in metadb_io_v2 instead if possible.
+ __declspec(deprecated) virtual t_update_info_state remove_info_multi(metadb_handle_list_cref p_list,HWND p_parent_window,bool p_show_errors) = 0;
+
+ virtual void hint_multi(metadb_handle_list_cref p_list,const pfc::list_base_const_t<const file_info*> & p_infos,const pfc::list_base_const_t<t_filestats> & p_stats,const bit_array & p_fresh_mask) = 0;
+
+ virtual void hint_multi_async(metadb_handle_list_cref p_list,const pfc::list_base_const_t<const file_info*> & p_infos,const pfc::list_base_const_t<t_filestats> & p_stats,const bit_array & p_fresh_mask) = 0;
+
+ virtual void hint_reader(service_ptr_t<class input_info_reader> p_reader,const char * p_path,abort_callback & p_abort) = 0;
+
+ //! For internal use only.
+ virtual void path_to_handles_simple(const char * p_path, metadb_handle_list_ref p_out) = 0;
+
+ //! Dispatches metadb_io_callback calls with specified items. To be used with metadb_display_field_provider when your component needs specified items refreshed.
+ virtual void dispatch_refresh(metadb_handle_list_cref p_list) = 0;
+
+ void dispatch_refresh(metadb_handle_ptr const & handle) {dispatch_refresh(pfc::list_single_ref_t<metadb_handle_ptr>(handle));}
+
+ void hint_async(metadb_handle_ptr p_item,const file_info & p_info,const t_filestats & p_stats,bool p_fresh);
+
+ __declspec(deprecated) t_load_info_state load_info(metadb_handle_ptr p_item,t_load_info_type p_type,HWND p_parent_window,bool p_show_errors);
+ __declspec(deprecated) t_update_info_state update_info(metadb_handle_ptr p_item,file_info & p_info,HWND p_parent_window,bool p_show_errors);
+
+ FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(metadb_io);
+};
+
+//! Implementing this class gives you direct control over which part of file_info gets altered during a tag update uperation. To be used with metadb_io_v2::update_info_async().
+class NOVTABLE file_info_filter : public service_base {
+public:
+ //! Alters specified file_info entry; called as a part of tag update process. Specified file_info has been read from a file, and will be written back.\n
+ //! WARNING: This will be typically called from another thread than main app thread (precisely, from thread created by tag updater). You should copy all relevant data to members of your file_info_filter instance in constructor and reference only member data in apply_filter() implementation.
+ //! @returns True when you have altered file_info and changes need to be written back to the file; false if no changes have been made.
+ virtual bool apply_filter(metadb_handle_ptr p_location,t_filestats p_stats,file_info & p_info) = 0;
+
+ FB2K_MAKE_SERVICE_INTERFACE(file_info_filter,service_base);
+};
+
+//! Advanced interface for passing infos read from files to metadb backend. Use metadb_io_v2::create_hint_list() to instantiate.
+class NOVTABLE metadb_hint_list : public service_base {
+public:
+ //! Adds a hint to the list.
+ //! @param p_location Location of the item the hint applies to.
+ //! @param p_info file_info object describing the item.
+ //! @param p_stats Information about the file containing item the hint applies to.
+ //! @param p_freshflag Set to true if the info has been directly read from the file, false if it comes from another source such as a playlist file.
+ virtual void add_hint(metadb_handle_ptr const & p_location,const file_info & p_info,const t_filestats & p_stats,bool p_freshflag) = 0;
+ //! Reads info from specified info reader instance and adds hints. May throw an exception in case info read has failed.
+ virtual void add_hint_reader(const char * p_path,service_ptr_t<input_info_reader> const & p_reader,abort_callback & p_abort) = 0;
+ //! Call this when you're done working with this metadb_hint_list instance, to apply hints and dispatch callbacks. If you don't call this, all added hints will be ignored.
+ virtual void on_done() = 0;
+
+ FB2K_MAKE_SERVICE_INTERFACE(metadb_hint_list,service_base);
+};
+//! \since 1.0
+class NOVTABLE metadb_hint_list_v2 : public metadb_hint_list {
+public:
+ virtual void add_hint_browse(metadb_handle_ptr const & p_location,const file_info & p_info, t_filetimestamp browseTS) = 0;
+
+ FB2K_MAKE_SERVICE_INTERFACE(metadb_hint_list_v2, metadb_hint_list);
+};
+
+//! New in 0.9.3. Extends metadb_io functionality with nonblocking versions of tag read/write functions, and some other utility features.
+class NOVTABLE metadb_io_v2 : public metadb_io {
+public:
+ enum {
+ //! By default, when some part of requested operation could not be performed for reasons other than user abort, a popup dialog with description of the problem is spawned.\n
+ //! Set this flag to disable error notification.
+ op_flag_no_errors = 1 << 0,
+ //! Set this flag to make the progress dialog not steal focus on creation.
+ op_flag_background = 1 << 1,
+ //! Set this flag to delay the progress dialog becoming visible, so it does not appear at all during short operations. Also implies op_flag_background effect.
+ op_flag_delay_ui = 1 << 2,
+ };
+
+ //! Preloads information from the specified tracks.
+ //! @param p_list List of items to process.
+ //! @param p_op_flags Can be null, or one or more of op_flag_* enum values combined, altering behaviors of the operation.
+ //! @param p_notify Called when the task is completed. Status code is one of t_load_info_state values. Can be null if caller doesn't care.
+ virtual void load_info_async(metadb_handle_list_cref p_list,t_load_info_type p_type,HWND p_parent_window,t_uint32 p_op_flags,completion_notify_ptr p_notify) = 0;
+ //! Updates tags of the specified tracks.
+ //! @param p_list List of items to process.
+ //! @param p_op_flags Can be null, or one or more of op_flag_* enum values combined, altering behaviors of the operation.
+ //! @param p_notify Called when the task is completed. Status code is one of t_update_info values. Can be null if caller doesn't care.
+ //! @param p_filter Callback handling actual file_info alterations. Typically used to replace entire meta part of file_info, or to alter something else such as ReplayGain while leaving meta intact.
+ virtual void update_info_async(metadb_handle_list_cref p_list,service_ptr_t<file_info_filter> p_filter,HWND p_parent_window,t_uint32 p_op_flags,completion_notify_ptr p_notify) = 0;
+ //! Rewrites tags of the specified tracks; similar to update_info_async() but using last known/cached file_info values rather than values passed by caller.
+ //! @param p_list List of items to process.
+ //! @param p_op_flags Can be null, or one or more of op_flag_* enum values combined, altering behaviors of the operation.
+ //! @param p_notify Called when the task is completed. Status code is one of t_update_info values. Can be null if caller doesn't care.
+ virtual void rewrite_info_async(metadb_handle_list_cref p_list,HWND p_parent_window,t_uint32 p_op_flags,completion_notify_ptr p_notify) = 0;
+ //! Strips all tags / metadata fields from the specified tracks.
+ //! @param p_list List of items to process.
+ //! @param p_op_flags Can be null, or one or more of op_flag_* enum values combined, altering behaviors of the operation.
+ //! @param p_notify Called when the task is completed. Status code is one of t_update_info values. Can be null if caller doesn't care.
+ virtual void remove_info_async(metadb_handle_list_cref p_list,HWND p_parent_window,t_uint32 p_op_flags,completion_notify_ptr p_notify) = 0;
+
+ //! Creates a metadb_hint_list object.
+ virtual metadb_hint_list::ptr create_hint_list() = 0;
+
+ //! Updates tags of the specified tracks. Helper; uses update_info_async internally.
+ //! @param p_list List of items to process.
+ //! @param p_op_flags Can be null, or one or more of op_flag_* enum values combined, altering behaviors of the operation.
+ //! @param p_notify Called when the task is completed. Status code is one of t_update_info values. Can be null if caller doesn't care.
+ //! @param p_new_info New infos to write to specified items.
+ void update_info_async_simple(metadb_handle_list_cref p_list,const pfc::list_base_const_t<const file_info*> & p_new_info, HWND p_parent_window,t_uint32 p_op_flags,completion_notify_ptr p_notify);
+
+ FB2K_MAKE_SERVICE_INTERFACE(metadb_io_v2,metadb_io);
+};
+
+
+//! Dynamically-registered version of metadb_io_callback. See metadb_io_callback for documentation, register instances using metadb_io_v3::register_callback(). It's recommended that you use the metadb_io_callback_dynamic_impl_base helper class to manage registration/unregistration.
+class NOVTABLE metadb_io_callback_dynamic {
+public:
+ virtual void on_changed_sorted(metadb_handle_list_cref p_items_sorted, bool p_fromhook) = 0;
+};
+
+//! New (0.9.5)
+class NOVTABLE metadb_io_v3 : public metadb_io_v2 {
+public:
+ virtual void register_callback(metadb_io_callback_dynamic * p_callback) = 0;
+ virtual void unregister_callback(metadb_io_callback_dynamic * p_callback) = 0;
+
+ FB2K_MAKE_SERVICE_INTERFACE(metadb_io_v3,metadb_io_v2);
+};
+
+//! metadb_io_callback_dynamic implementation helper.
+class metadb_io_callback_dynamic_impl_base : public metadb_io_callback_dynamic {
+public:
+ void on_changed_sorted(metadb_handle_list_cref p_items_sorted, bool p_fromhook) {}
+
+ metadb_io_callback_dynamic_impl_base() {static_api_ptr_t<metadb_io_v3>()->register_callback(this);}
+ ~metadb_io_callback_dynamic_impl_base() {static_api_ptr_t<metadb_io_v3>()->unregister_callback(this);}
+
+ PFC_CLASS_NOT_COPYABLE_EX(metadb_io_callback_dynamic_impl_base)
+};
+//! Callback service receiving notifications about metadb contents changes.
+class NOVTABLE metadb_io_callback : public service_base {
+public:
+ //! Called when metadb contents change. (Or, one of display hook component requests display update).
+ //! @param p_items_sorted List of items that have been updated. The list is always sorted by pointer value, to allow fast bsearch to test whether specific item has changed.
+ //! @param p_fromhook Set to true when actual file contents haven't changed but one of metadb_display_field_provider implementations requested an update so output of metadb_handle::format_title() etc has changed.
+ virtual void on_changed_sorted(metadb_handle_list_cref p_items_sorted, bool p_fromhook) = 0;
+
+ FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(metadb_io_callback);
+};
+
+//! Entrypoint service for metadb_handle related operations.\n
+//! Implemented only by core, do not reimplement.\n
+//! Use static_api_ptr_t template to access it, e.g. static_api_ptr_t<metadb>()->handle_create(myhandle,mylocation);
+class NOVTABLE metadb : public service_base
+{
+public:
+ //! Locks metadb to prevent other threads from modifying it while you're working with some of its contents. Some functions (metadb_handle::get_info_locked(), metadb_handle::get_info_async_locked()) can be called only from inside metadb lock section.
+ virtual void database_lock()=0;
+ //! Unlocks metadb after database_lock(). Some functions (metadb_handle::get_info_locked(), metadb_handle::get_info_async_locked()) can be called only from inside metadb lock section.
+ virtual void database_unlock()=0;
+
+ //! Returns a metadb_handle object referencing the specified location. If one doesn't exist yet a new one is created. There can be only one metadb_handle object referencing specific location. \n
+ //! This function should never fail unless there's something critically wrong (can't allocate memory for the new object, etc). \n
+ //! Speed: O(log(n)) to total number of metadb_handles present. It's recommended to pass metadb_handles around whenever possible rather than pass playable_locations then retrieve metadb_handles on demand when needed.
+ //! @param p_out Receives the metadb_handle pointer.
+ //! @param p_location Location to create a metadb_handle for.
+ virtual void handle_create(metadb_handle_ptr & p_out,const playable_location & p_location)=0;
+
+ void handle_create_replace_path_canonical(metadb_handle_ptr & p_out,const metadb_handle_ptr & p_source,const char * p_new_path);
+ void handle_replace_path_canonical(metadb_handle_ptr & p_out,const char * p_new_path);
+ void handle_create_replace_path(metadb_handle_ptr & p_out,const metadb_handle_ptr & p_source,const char * p_new_path);
+
+ //! Helper function; attempts to retrieve a handle to any known playable location to be used for e.g. titleformatting script preview.\n
+ //! @returns True on success; false on failure (no known playable locations).
+ static bool g_get_random_handle(metadb_handle_ptr & p_out);
+
+ enum {case_sensitive = true};
+ typedef pfc::comparator_strcmp path_comparator;
+
+ inline static int path_compare_ex(const char * p1,t_size len1,const char * p2,t_size len2) {return case_sensitive ? pfc::strcmp_ex(p1,len1,p2,len2) : stricmp_utf8_ex(p1,len1,p2,len2);}
+ inline static int path_compare(const char * p1,const char * p2) {return case_sensitive ? strcmp(p1,p2) : stricmp_utf8(p1,p2);}
+ inline static int path_compare_metadb_handle(const metadb_handle_ptr & p1,const metadb_handle_ptr & p2) {return path_compare(p1->get_path(),p2->get_path());}
+
+ FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(metadb);
+};
+
+//! Metadb lock sync helper. For use around metadb_handle "locked" methods.
+class in_metadb_sync {
+public:
+ in_metadb_sync() {
+ m_api->database_lock();
+ }
+ ~in_metadb_sync() {
+ m_api->database_unlock();
+ }
+private:
+ static_api_ptr_t<metadb> m_api;
+};
+
+//! Metadb lock sync helper. For use around metadb_handle "locked" methods.
+class in_metadb_sync_fromptr {
+public:
+ in_metadb_sync_fromptr(const service_ptr_t<metadb> & p_api) : m_api(p_api) {m_api->database_lock();}
+ ~in_metadb_sync_fromptr() {m_api->database_unlock();}
+private:
+ service_ptr_t<metadb> m_api;
+};
+
+//! Metadb lock sync helper. For use around metadb_handle "locked" methods.
+class in_metadb_sync_fromhandle {
+public:
+ in_metadb_sync_fromhandle(const service_ptr_t<metadb_handle> & p_api) : m_api(p_api) {m_api->metadb_lock();}
+ ~in_metadb_sync_fromhandle() {m_api->metadb_unlock();}
+private:
+ service_ptr_t<metadb_handle> m_api;
+};
+
+class titleformat_text_out;
+class titleformat_hook_function_params;
+
+
+/*!
+ Implementing this service lets you provide your own title-formatting fields that are parsed globally with each call to metadb_handle::format_title methods. \n
+ Note that this API is meant to allow you to add your own component-specific fields - not to overlay your data over standard fields or over fields provided by other components. Any attempts to interfere with standard fields will have severe ill effects. \n
+ This should be implemented only where absolutely necessary, for safety and performance reasons. Any expensive operations inside the process_field() method may severely damage performance of affected title-formatting calls. \n
+ You must NEVER make any other foobar2000 API calls from inside process_field, other than possibly querying information from the passed metadb_handle pointer; you should read your own implementation-specific private data and return as soon as possible. You must not make any assumptions about calling context (threading etc). \n
+ It is guaranteed that process_field() is called only inside a metadb lock scope so you can safely call "locked" metadb_handle methods on the metadb_handle pointer you get. You must not lock metadb by yourself inside process_field() - while it is always called from inside a metadb lock scope, it may be called from another thread than the one maintaining the lock because of multi-CPU optimizations active. \n
+ If there are multiple metadb_display_field_provider services registered providing fields of the same name, the behavior is undefined. You must pick unique names for provided fields to ensure safe coexistence with other people's components. \n
+ IMPORTANT: Any components implementing metadb_display_field_provider MUST call metadb_io::dispatch_refresh() with affected metadb_handles whenever info that they present changes. Otherwise, anything rendering title-formatting strings that reference your data will not update properly, resulting in unreliable/broken output, repaint glitches, etc. \n
+ Do not expect a process_field() call each time somebody uses title formatting, calling code might perform its own caching of strings that you return, getting new ones only after metadb_io::dispatch_refresh() with relevant items. \n
+ If you can't reliably notify other components about changes of content of fields that you provide (such as when your fields provide some kind of global information and not information specific to item identified by passed metadb_handle), you should not be providing those fields in first place. You must not change returned values of your fields without dispatching appropriate notifications. \n
+ Use static service_factory_single_t<myclass> to register your metadb_display_field_provider implementations. Do not call other people's metadb_display_field_provider services directly, they're meant to be called by backend only. \n
+ List of fields that you provide is expected to be fixed at run-time. The backend will enumerate your fields only once and refer to them by indexes later. \n
+*/
+
+class NOVTABLE metadb_display_field_provider : public service_base {
+public:
+ //! Returns number of fields provided by this metadb_display_field_provider implementation.
+ virtual t_uint32 get_field_count() = 0;
+ //! Returns name of specified field provided by this metadb_display_field_provider implementation. Names are not case sensitive. It's strongly recommended that you keep your field names plain English / ASCII only.
+ virtual void get_field_name(t_uint32 index, pfc::string_base & out) = 0;
+ //! Evaluates the specified field.
+ //! @param index Index of field being processed : 0 <= index < get_field_count().
+ //! @param handle Handle to item being processed. You can safely call "locked" methods on this handle to retrieve track information and such.
+ //! @param out Interface receiving your text output.
+ //! @returns Return true to indicate that the field is present so if it's enclosed in square brackets, contents of those brackets should not be skipped, false otherwise.
+ virtual bool process_field(t_uint32 index, metadb_handle * handle, titleformat_text_out * out) = 0;
+
+ FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(metadb_display_field_provider);
+};
+
+
+
+
+
+//! Helper implementation of file_info_filter_impl.
+class file_info_filter_impl : public file_info_filter {
+public:
+ file_info_filter_impl(const pfc::list_base_const_t<metadb_handle_ptr> & p_list,const pfc::list_base_const_t<const file_info*> & p_new_info) {
+ pfc::dynamic_assert(p_list.get_count() == p_new_info.get_count());
+ pfc::array_t<t_size> order;
+ order.set_size(p_list.get_count());
+ order_helper::g_fill(order.get_ptr(),order.get_size());
+ p_list.sort_get_permutation_t(pfc::compare_t<metadb_handle_ptr,metadb_handle_ptr>,order.get_ptr());
+ m_handles.set_count(order.get_size());
+ m_infos.set_size(order.get_size());
+ for(t_size n = 0; n < order.get_size(); n++) {
+ m_handles[n] = p_list[order[n]];
+ m_infos[n] = *p_new_info[order[n]];
+ }
+ }
+
+ bool apply_filter(metadb_handle_ptr p_location,t_filestats p_stats,file_info & p_info) {
+ t_size index;
+ if (m_handles.bsearch_t(pfc::compare_t<metadb_handle_ptr,metadb_handle_ptr>,p_location,index)) {
+ p_info = m_infos[index];
+ return true;
+ } else {
+ return false;
+ }
+ }
+private:
+ metadb_handle_list m_handles;
+ pfc::array_t<file_info_impl> m_infos;
+};
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/metadb_handle.cpp b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/metadb_handle.cpp new file mode 100644 index 0000000000..71fd8ae05a --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/metadb_handle.cpp @@ -0,0 +1,48 @@ +#include "foobar2000.h"
+
+
+double metadb_handle::get_length()
+{
+ double rv = 0;
+ in_metadb_sync_fromhandle l_sync(this);
+ const file_info * info;
+ if (get_info_locked(info))
+ rv = info->get_length();
+ return rv;
+}
+
+t_filetimestamp metadb_handle::get_filetimestamp()
+{
+ return get_filestats().m_timestamp;
+}
+
+t_filesize metadb_handle::get_filesize()
+{
+ return get_filestats().m_size;
+}
+
+bool metadb_handle::format_title_legacy(titleformat_hook * p_hook,pfc::string_base & p_out,const char * p_spec,titleformat_text_filter * p_filter)
+{
+ service_ptr_t<titleformat_object> script;
+ if (static_api_ptr_t<titleformat_compiler>()->compile(script,p_spec)) {
+ return format_title(p_hook,p_out,script,p_filter);
+ } else {
+ p_out.reset();
+ return false;
+ }
+}
+
+
+
+bool metadb_handle::g_should_reload(const t_filestats & p_old_stats,const t_filestats & p_new_stats,bool p_fresh)
+{
+ if (p_new_stats.m_timestamp == filetimestamp_invalid) return p_fresh;
+ else if (p_fresh) return p_old_stats!= p_new_stats;
+ else return p_old_stats.m_timestamp < p_new_stats.m_timestamp;
+}
+
+bool metadb_handle::should_reload(const t_filestats & p_new_stats, bool p_fresh) const
+{
+ if (!is_info_loaded_async()) return true;
+ else return g_should_reload(get_filestats(),p_new_stats,p_fresh);
+}
\ No newline at end of file diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/metadb_handle.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/metadb_handle.h new file mode 100644 index 0000000000..eb5ac54d73 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/metadb_handle.h @@ -0,0 +1,219 @@ +class titleformat_hook;
+class titleformat_text_filter;
+
+//! A metadb_handle object represents interface to reference-counted file_info cache entry for the specified location.\n
+//! To obtain a metadb_handle to specific location, use metadb::handle_create(). To obtain a list of metadb_handle objects corresponding to specific path (directory, playlist, multitrack file, etc), use relevant playlist_incoming_item_filter methods (recommended), or call playlist_loader methods directly.\n
+//! A metadb_handle is also the most efficient way of passing playable object locations around because it provides fast access to both location and infos, and is reference counted so duplicating it is as fast as possible.\n
+//! To retrieve a path of a file from a metadb_handle, use metadb_handle::get_path() function. Note that metadb_handle is NOT just file path, some formats support multiple subsongs per physical file, which are signaled using subsong indexes.
+
+class NOVTABLE metadb_handle : public service_base
+{
+public:
+ //! Retrieves location represented by this metadb_handle object. Returned reference is valid until calling context releases metadb_handle that returned it (metadb_handle_ptr is deallocated etc).
+ virtual const playable_location & get_location() const = 0;//never fails, returned pointer valid till the object is released
+
+
+ //! Renders information about item referenced by this metadb_handle object.
+ //! @param p_hook Optional callback object overriding fields and functions; set to NULL if not used.
+ //! @param p_out String receiving the output on success.
+ //! @param p_script Titleformat script to use. Use titleformat_compiler service to create one.
+ //! @param p_filter Optional callback object allowing input to be filtered according to context (i.e. removal of linebreak characters present in tags when rendering playlist lines). Set to NULL when not used.
+ //! @returns true on success, false when dummy file_info instance was used because actual info is was not (yet) known.
+ virtual bool format_title(titleformat_hook * p_hook,pfc::string_base & p_out,const service_ptr_t<class titleformat_object> & p_script,titleformat_text_filter * p_filter) = 0;
+
+ //! Locks metadb to prevent other threads from modifying it while you're working with some of its contents. Some functions (metadb_handle::get_info_locked(), metadb_handle::get_info_async_locked()) can be called only from inside metadb lock section.
+ //! Same as metadb::database_lock().
+ virtual void metadb_lock() = 0;
+ //! Unlocks metadb after metadb_lock(). Some functions (metadb_handle::get_info_locked(), metadb_handle::get_info_async_locked()) can be called only from inside metadb lock section.
+ //! Same as metadb::database_unlock().
+ virtual void metadb_unlock() = 0;
+
+ //! Returns last seen file stats, filestats_invalid if unknown.
+ virtual t_filestats get_filestats() const = 0;
+
+ //! Queries whether cached info about item referenced by this metadb_handle object is already available. Note that this function causes the metadb to be temporarily locked; you can not use it in context that where locking is forbidden.\n
+ //! Note that state of cached info changes only inside main thread, so you can safely assume that it doesn't change while some block of your code inside main thread is being executed.
+ virtual bool is_info_loaded() const = 0;
+ //! Queries cached info about item referenced by this metadb_handle object. Returns true on success, false when info is not yet known. Note that this function causes the metadb to be temporarily locked; you can not use it in context that where locking is forbidden. \n
+ //! Note that state of cached info changes only inside main thread, so you can safely assume that it doesn't change while some block of your code inside main thread is being executed.
+ virtual bool get_info(file_info & p_info) const = 0;
+ //! Queries cached info about item referenced by this metadb_handle object. Returns true on success, false when info is not yet known. This is more efficient than get_info() since no data is copied.\n
+ //! You must lock the metadb before calling this function, and unlock it after you are done working with the returned pointer, to ensure multithread safety.\n
+ //! Note that state of cached info changes only inside main thread, so you can safely assume that it doesn't change while some block of your code inside main thread is being executed.
+ //! @param p_info On success, receives a pointer to metadb's file_info object. The pointer is for temporary use only, and becomes invalid when metadb is unlocked.
+ virtual bool get_info_locked(const file_info * & p_info) const = 0;
+
+ //! Queries whether cached info about item referenced by this metadb_handle object is already available.\n
+ //! This is intended for use in special cases when you need to immediately retrieve info sent by metadb_io hint from another thread; state of returned data can be altered by any thread, as opposed to non-async methods.
+ virtual bool is_info_loaded_async() const = 0;
+ //! Queries cached info about item referenced by this metadb_handle object. Returns true on success, false when info is not yet known. Note that this function causes the metadb to be temporarily locked; you can not use it in context that where locking is forbidden.\n
+ //! This is intended for use in special cases when you need to immediately retrieve info sent by metadb_io hint from another thread; state of returned data can be altered by any thread, as opposed to non-async methods.
+ virtual bool get_info_async(file_info & p_info) const = 0;
+ //! Queries cached info about item referenced by this metadb_handle object. Returns true on success, false when info is not yet known. This is more efficient than get_info() since no data is copied.\n
+ //! You must lock the metadb before calling this function, and unlock it after you are done working with the returned pointer, to ensure multithread safety.\n
+ //! This is intended for use in special cases when you need to immediately retrieve info sent by metadb_io hint from another thread; state of returned data can be altered by any thread, as opposed to non-async methods.
+ //! @param p_info On success, receives a pointer to metadb's file_info object. The pointer is for temporary use only, and becomes invalid when metadb is unlocked.
+ virtual bool get_info_async_locked(const file_info * & p_info) const = 0;
+
+
+ //! Renders information about item referenced by this metadb_handle object, using external file_info data.
+ virtual void format_title_from_external_info(const file_info & p_info,titleformat_hook * p_hook,pfc::string_base & p_out,const service_ptr_t<class titleformat_object> & p_script,titleformat_text_filter * p_filter) = 0;
+
+
+ //! New in 0.9.5.
+ virtual bool format_title_nonlocking(titleformat_hook * p_hook,pfc::string_base & p_out,const service_ptr_t<class titleformat_object> & p_script,titleformat_text_filter * p_filter) = 0;
+
+ //! New in 0.9.5.
+ virtual void format_title_from_external_info_nonlocking(const file_info & p_info,titleformat_hook * p_hook,pfc::string_base & p_out,const service_ptr_t<class titleformat_object> & p_script,titleformat_text_filter * p_filter) = 0;
+
+#if FOOBAR2000_TARGET_VERSION >= 76
+ //! New in 1.0
+ virtual bool get_browse_info(file_info & info, t_filetimestamp & ts) const = 0;
+
+ //! New in 1.0
+ virtual bool get_browse_info_locked(const file_info * & p_info, t_filetimestamp & ts) const = 0;
+#endif
+
+ static bool g_should_reload(const t_filestats & p_old_stats,const t_filestats & p_new_stats,bool p_fresh);
+ bool should_reload(const t_filestats & p_new_stats,bool p_fresh) const;
+
+
+ //! Helper provided for backwards compatibility; takes formatting script as text string and calls relevant titleformat_compiler methods; returns false when the script could not be compiled.\n
+ //! See format_title() for descriptions of parameters.\n
+ //! Bottleneck warning: you should consider using precompiled titleformat script object and calling regular format_title() instead when processing large numbers of items.
+ bool format_title_legacy(titleformat_hook * p_hook,pfc::string_base & out,const char * p_spec,titleformat_text_filter * p_filter);
+
+ //! Retrieves path of item described by this metadb_handle instance. Returned string is valid until calling context releases metadb_handle that returned it (metadb_handle_ptr is deallocated etc).
+ inline const char * get_path() const {return get_location().get_path();}
+ //! Retrieves subsong index of item described by this metadb_handle instance (used for multiple playable tracks within single physical file).
+ inline t_uint32 get_subsong_index() const {return get_location().get_subsong_index();}
+
+ double get_length();//helper
+
+ t_filetimestamp get_filetimestamp();
+ t_filesize get_filesize();
+
+ FB2K_MAKE_SERVICE_INTERFACE(metadb_handle,service_base);
+};
+
+typedef service_ptr_t<metadb_handle> metadb_handle_ptr;
+
+typedef pfc::list_base_t<metadb_handle_ptr> & metadb_handle_list_ref;
+typedef pfc::list_base_const_t<metadb_handle_ptr> const & metadb_handle_list_cref;
+
+namespace metadb_handle_list_helper {
+ void sort_by_format(metadb_handle_list_ref p_list,const char * spec,titleformat_hook * p_hook);
+ void sort_by_format_get_order(metadb_handle_list_cref p_list,t_size* order,const char * spec,titleformat_hook * p_hook);
+ void sort_by_format(metadb_handle_list_ref p_list,const service_ptr_t<titleformat_object> & p_script,titleformat_hook * p_hook, int direction = 1);
+ void sort_by_format_get_order(metadb_handle_list_cref p_list,t_size* order,const service_ptr_t<titleformat_object> & p_script,titleformat_hook * p_hook,int p_direction = 1);
+
+ void sort_by_relative_path(metadb_handle_list_ref p_list);
+ void sort_by_relative_path_get_order(metadb_handle_list_cref p_list,t_size* order);
+
+ void remove_duplicates(pfc::list_base_t<metadb_handle_ptr> & p_list);
+ void sort_by_pointer_remove_duplicates(pfc::list_base_t<metadb_handle_ptr> & p_list);
+ void sort_by_path_quick(pfc::list_base_t<metadb_handle_ptr> & p_list);
+
+ void sort_by_pointer(pfc::list_base_t<metadb_handle_ptr> & p_list);
+ t_size bsearch_by_pointer(const pfc::list_base_const_t<metadb_handle_ptr> & p_list,const metadb_handle_ptr & val);
+
+ double calc_total_duration(const pfc::list_base_const_t<metadb_handle_ptr> & p_list);
+
+ void sort_by_path(pfc::list_base_t<metadb_handle_ptr> & p_list);
+
+ t_filesize calc_total_size(metadb_handle_list_cref list, bool skipUnknown = false);
+ t_filesize calc_total_size_ex(metadb_handle_list_cref list, bool & foundUnknown);
+
+ bool extract_single_path(metadb_handle_list_cref list, const char * &path);
+};
+
+template<template<typename> class t_alloc = pfc::alloc_fast >
+class metadb_handle_list_t : public service_list_t<metadb_handle,t_alloc> {
+private:
+ typedef metadb_handle_list_t<t_alloc> t_self;
+ typedef list_base_const_t<metadb_handle_ptr> t_interface;
+public:
+ inline void sort_by_format(const char * spec,titleformat_hook * p_hook) {
+ return metadb_handle_list_helper::sort_by_format(*this, spec, p_hook);
+ }
+ inline void sort_by_format_get_order(t_size* order,const char * spec,titleformat_hook * p_hook) const {
+ metadb_handle_list_helper::sort_by_format_get_order(*this, order, spec, p_hook);
+ }
+
+ inline void sort_by_format(const service_ptr_t<titleformat_object> & p_script,titleformat_hook * p_hook, int direction = 1) {
+ metadb_handle_list_helper::sort_by_format(*this, p_script, p_hook, direction);
+ }
+ inline void sort_by_format_get_order(t_size* order,const service_ptr_t<titleformat_object> & p_script,titleformat_hook * p_hook) const {
+ metadb_handle_list_helper::sort_by_format_get_order(*this, order, p_script, p_hook);
+ }
+
+ inline void sort_by_relative_path() {
+ metadb_handle_list_helper::sort_by_relative_path(*this);
+ }
+ inline void sort_by_relative_path_get_order(t_size* order) const {
+ metadb_handle_list_helper::sort_by_relative_path_get_order(*this,order);
+ }
+
+ inline void remove_duplicates() {metadb_handle_list_helper::remove_duplicates(*this);}
+ inline void sort_by_pointer_remove_duplicates() {metadb_handle_list_helper::sort_by_pointer_remove_duplicates(*this);}
+ inline void sort_by_path_quick() {metadb_handle_list_helper::sort_by_path_quick(*this);}
+
+ inline void sort_by_pointer() {metadb_handle_list_helper::sort_by_pointer(*this);}
+ inline t_size bsearch_by_pointer(const metadb_handle_ptr & val) const {return metadb_handle_list_helper::bsearch_by_pointer(*this,val);}
+
+ inline double calc_total_duration() const {return metadb_handle_list_helper::calc_total_duration(*this);}
+
+ inline void sort_by_path() {metadb_handle_list_helper::sort_by_path(*this);}
+
+ const t_self & operator=(const t_self & p_source) {remove_all(); add_items(p_source);return *this;}
+ const t_self & operator=(const t_interface & p_source) {remove_all(); add_items(p_source);return *this;}
+ metadb_handle_list_t(const t_self & p_source) {add_items(p_source);}
+ metadb_handle_list_t(const t_interface & p_source) {add_items(p_source);}
+ metadb_handle_list_t() {}
+
+ t_self & operator+=(const t_interface & source) {add_items(source); return *this;}
+ t_self & operator+=(const metadb_handle_ptr & source) {add_item(source); return *this;}
+
+ bool extract_single_path(const char * &path) const {return metadb_handle_list_helper::extract_single_path(*this, path);}
+};
+
+typedef metadb_handle_list_t<> metadb_handle_list;
+
+namespace metadb_handle_list_helper {
+ void sorted_by_pointer_extract_difference(metadb_handle_list const & p_list_1,metadb_handle_list const & p_list_2,metadb_handle_list & p_list_1_specific,metadb_handle_list & p_list_2_specific);
+};
+
+class metadb_handle_lock
+{
+ metadb_handle_ptr m_ptr;
+public:
+ inline metadb_handle_lock(const metadb_handle_ptr & param)
+ {
+ m_ptr = param;
+ m_ptr->metadb_lock();
+ }
+ inline ~metadb_handle_lock() {m_ptr->metadb_unlock();}
+};
+
+inline pfc::string_base & operator<<(pfc::string_base & p_fmt,const metadb_handle_ptr & p_location) {
+ if (p_location.is_valid())
+ return p_fmt << p_location->get_location();
+ else
+ return p_fmt << "[invalid location]";
+}
+
+
+class string_format_title {
+public:
+ string_format_title(metadb_handle_ptr p_item,const char * p_script) {
+ p_item->format_title_legacy(NULL,m_data,p_script,NULL);
+ }
+ string_format_title(metadb_handle_ptr p_item,service_ptr_t<class titleformat_object> p_script) {
+ p_item->format_title(NULL,m_data,p_script,NULL);
+ }
+
+ const char * get_ptr() const {return m_data.get_ptr();}
+ operator const char * () const {return m_data.get_ptr();}
+private:
+ pfc::string8_fastalloc m_data;
+};
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/metadb_handle_list.cpp b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/metadb_handle_list.cpp new file mode 100644 index 0000000000..eb68fff666 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/metadb_handle_list.cpp @@ -0,0 +1,397 @@ +#include "foobar2000.h"
+#include <shlwapi.h>
+
+namespace {
+
+ wchar_t * makeSortString(const char * in) {
+ wchar_t * out = new wchar_t[pfc::stringcvt::estimate_utf8_to_wide(in) + 1];
+ out[0] = ' ';//StrCmpLogicalW bug workaround.
+ pfc::stringcvt::convert_utf8_to_wide_unchecked(out + 1, in);
+ return out;
+ }
+
+ struct custom_sort_data {
+ wchar_t * text;
+ t_size index;
+ };
+}
+
+template<int direction>
+static int custom_sort_compare(const custom_sort_data & elem1, const custom_sort_data & elem2 ) {
+ int ret = direction * StrCmpLogicalW(elem1.text,elem2.text);
+ if (ret == 0) ret = pfc::sgn_t((t_ssize)elem1.index - (t_ssize)elem2.index);
+ return ret;
+}
+
+
+template<int direction>
+static int _cdecl _custom_sort_compare(const void * v1, const void * v2) {
+ return custom_sort_compare<direction>(*reinterpret_cast<const custom_sort_data*>(v1),*reinterpret_cast<const custom_sort_data*>(v2));
+}
+void metadb_handle_list_helper::sort_by_format(metadb_handle_list_ref p_list,const char * spec,titleformat_hook * p_hook)
+{
+ service_ptr_t<titleformat_object> script;
+ if (static_api_ptr_t<titleformat_compiler>()->compile(script,spec))
+ sort_by_format(p_list,script,p_hook);
+}
+
+void metadb_handle_list_helper::sort_by_format_get_order(metadb_handle_list_cref p_list,t_size* order,const char * spec,titleformat_hook * p_hook)
+{
+ service_ptr_t<titleformat_object> script;
+ if (static_api_ptr_t<titleformat_compiler>()->compile(script,spec))
+ sort_by_format_get_order(p_list,order,script,p_hook);
+}
+
+void metadb_handle_list_helper::sort_by_format(metadb_handle_list_ref p_list,const service_ptr_t<titleformat_object> & p_script,titleformat_hook * p_hook, int direction)
+{
+ const t_size count = p_list.get_count();
+ pfc::array_t<t_size> order; order.set_size(count);
+ sort_by_format_get_order(p_list,order.get_ptr(),p_script,p_hook,direction);
+ p_list.reorder(order.get_ptr());
+}
+
+namespace {
+
+ class tfhook_sort : public titleformat_hook {
+ public:
+ tfhook_sort() {
+ m_API->seed((unsigned)__rdtsc());
+ }
+ bool process_field(titleformat_text_out * p_out,const char * p_name,t_size p_name_length,bool & p_found_flag) {
+ return false;
+ }
+ bool process_function(titleformat_text_out * p_out,const char * p_name,t_size p_name_length,titleformat_hook_function_params * p_params,bool & p_found_flag) {
+ if (stricmp_utf8_ex(p_name, p_name_length, "rand", ~0) == 0) {
+ t_size param_count = p_params->get_param_count();
+ t_uint32 val;
+ if (param_count == 1) {
+ t_uint32 mod = (t_uint32)p_params->get_param_uint(0);
+ if (mod > 0) {
+ val = m_API->genrand(mod);
+ } else {
+ val = 0;
+ }
+ } else {
+ val = m_API->genrand(0xFFFFFFFF);
+ }
+ p_out->write_int(titleformat_inputtypes::unknown, val);
+ p_found_flag = true;
+ return true;
+ } else {
+ return false;
+ }
+ }
+ private:
+ static_api_ptr_t<genrand_service> m_API;
+ };
+
+ class tfthread : public pfc::thread {
+ public:
+ tfthread(pfc::counter * walk, metadb_handle_list_cref items,custom_sort_data * out,titleformat_object::ptr script,titleformat_hook * hook) : m_walk(walk), m_items(items), m_out(out), m_script(script), m_hook(hook) {}
+ ~tfthread() {waitTillDone();}
+
+
+
+ void threadProc() {
+ TRACK_CALL_TEXT("metadb_handle sort helper thread");
+
+ tfhook_sort myHook;
+ titleformat_hook_impl_splitter hookSplitter(&myHook, m_hook);
+ titleformat_hook * const hookPtr = m_hook ? pfc::implicit_cast<titleformat_hook*>(&hookSplitter) : &myHook;
+
+ pfc::string8_fastalloc temp; temp.prealloc(512);
+ const t_size total = m_items.get_size();
+ for (;;) {
+ const t_size index = (*m_walk)++;
+ if (index >= total) break;
+ m_out[index].index = index;
+ m_items[index]->format_title_nonlocking(hookPtr,temp,m_script,0);
+ m_out[index].text = makeSortString(temp);
+ }
+ }
+ private:
+ pfc::counter * const m_walk;
+ metadb_handle_list_cref m_items;
+ custom_sort_data * const m_out;
+ titleformat_object::ptr const m_script;
+ titleformat_hook * const m_hook;
+ };
+}
+
+void metadb_handle_list_helper::sort_by_format_get_order(metadb_handle_list_cref p_list,t_size* order,const service_ptr_t<titleformat_object> & p_script,titleformat_hook * p_hook,int p_direction)
+{
+// pfc::hires_timer timer; timer.start();
+
+ const t_size count = p_list.get_count();
+ pfc::array_t<custom_sort_data> data; data.set_size(count);
+
+ {
+ in_metadb_sync sync;
+ pfc::counter counter(0);
+ pfc::array_t<pfc::rcptr_t<tfthread> > threads; threads.set_size(pfc::getOptimalWorkerThreadCountEx(p_list.get_count() / 128));
+ PFC_ASSERT( threads.get_size() > 0 );
+ for(t_size walk = 0; walk < threads.get_size(); ++walk) {
+ threads[walk].new_t(&counter,p_list,data.get_ptr(),p_script,p_hook);
+ }
+ for(t_size walk = 1; walk < threads.get_size(); ++walk) threads[walk]->start();
+ threads[0]->threadProc();
+ for(t_size walk = 1; walk < threads.get_size(); ++walk) threads[walk]->waitTillDone();
+ }
+// console::formatter() << "metadb_handle sort: prepared in " << pfc::format_time_ex(timer.query(),6);
+
+ pfc::sort_t(data, p_direction > 0 ? custom_sort_compare<1> : custom_sort_compare<-1>,count);
+ //qsort(data.get_ptr(),count,sizeof(custom_sort_data),p_direction > 0 ? _custom_sort_compare<1> : _custom_sort_compare<-1>);
+
+
+// console::formatter() << "metadb_handle sort: sorted in " << pfc::format_time_ex(timer.query(),6);
+
+ for(t_size n=0;n<count;n++)
+ {
+ order[n]=data[n].index;
+ delete[] data[n].text;
+ }
+
+// console::formatter() << "metadb_handle sort: finished in " << pfc::format_time_ex(timer.query(),6);
+}
+
+void metadb_handle_list_helper::sort_by_relative_path(metadb_handle_list_ref p_list)
+{
+ const t_size count = p_list.get_count();
+ pfc::array_t<t_size> order; order.set_size(count);
+ sort_by_relative_path_get_order(p_list,order.get_ptr());
+ p_list.reorder(order.get_ptr());
+}
+
+void metadb_handle_list_helper::sort_by_relative_path_get_order(metadb_handle_list_cref p_list,t_size* order)
+{
+ const t_size count = p_list.get_count();
+ t_size n;
+ pfc::array_t<custom_sort_data> data;
+ data.set_size(count);
+ static_api_ptr_t<library_manager> api;
+
+ pfc::string8_fastalloc temp;
+ temp.prealloc(512);
+ for(n=0;n<count;n++)
+ {
+ metadb_handle_ptr item;
+ p_list.get_item_ex(item,n);
+ if (!api->get_relative_path(item,temp)) temp = "";
+ data[n].index = n;
+ data[n].text = makeSortString(temp);
+ //data[n].subsong = item->get_subsong_index();
+ }
+
+ pfc::sort_t(data,custom_sort_compare<1>,count);
+ //qsort(data.get_ptr(),count,sizeof(custom_sort_data),(int (__cdecl *)(const void *elem1, const void *elem2 ))custom_sort_compare);
+
+ for(n=0;n<count;n++)
+ {
+ order[n]=data[n].index;
+ delete[] data[n].text;
+ }
+}
+
+void metadb_handle_list_helper::remove_duplicates(metadb_handle_list_ref p_list)
+{
+ t_size count = p_list.get_count();
+ if (count>0)
+ {
+ bit_array_bittable mask(count);
+ pfc::array_t<t_size> order; order.set_size(count);
+ order_helper::g_fill(order);
+
+ p_list.sort_get_permutation_t(pfc::compare_t<metadb_handle_ptr,metadb_handle_ptr>,order.get_ptr());
+
+ t_size n;
+ bool found = false;
+ for(n=0;n<count-1;n++)
+ {
+ if (p_list.get_item(order[n])==p_list.get_item(order[n+1]))
+ {
+ found = true;
+ mask.set(order[n+1],true);
+ }
+ }
+
+ if (found) p_list.remove_mask(mask);
+ }
+}
+
+void metadb_handle_list_helper::sort_by_pointer_remove_duplicates(metadb_handle_list_ref p_list)
+{
+ t_size count = p_list.get_count();
+ if (count>0)
+ {
+ sort_by_pointer(p_list);
+ bool b_found = false;
+ t_size n;
+ for(n=0;n<count-1;n++)
+ {
+ if (p_list.get_item(n)==p_list.get_item(n+1))
+ {
+ b_found = true;
+ break;
+ }
+ }
+
+ if (b_found)
+ {
+ bit_array_bittable mask(count);
+ t_size n;
+ for(n=0;n<count-1;n++)
+ {
+ if (p_list.get_item(n)==p_list.get_item(n+1))
+ mask.set(n+1,true);
+ }
+ p_list.remove_mask(mask);
+ }
+ }
+}
+
+void metadb_handle_list_helper::sort_by_path_quick(metadb_handle_list_ref p_list)
+{
+ p_list.sort_t(metadb::path_compare_metadb_handle);
+}
+
+
+void metadb_handle_list_helper::sort_by_pointer(metadb_handle_list_ref p_list)
+{
+ //it seems MSVC71 /GL does something highly retarded here
+ //p_list.sort_t(pfc::compare_t<metadb_handle_ptr,metadb_handle_ptr>);
+ p_list.sort();
+}
+
+t_size metadb_handle_list_helper::bsearch_by_pointer(metadb_handle_list_cref p_list,const metadb_handle_ptr & val)
+{
+ t_size blah;
+ if (p_list.bsearch_t(pfc::compare_t<metadb_handle_ptr,metadb_handle_ptr>,val,blah)) return blah;
+ else return ~0;
+}
+
+
+void metadb_handle_list_helper::sorted_by_pointer_extract_difference(metadb_handle_list const & p_list_1,metadb_handle_list const & p_list_2,metadb_handle_list & p_list_1_specific,metadb_handle_list & p_list_2_specific)
+{
+ t_size found_1, found_2;
+ const t_size count_1 = p_list_1.get_count(), count_2 = p_list_2.get_count();
+ t_size ptr_1, ptr_2;
+
+ found_1 = found_2 = 0;
+ ptr_1 = ptr_2 = 0;
+ while(ptr_1 < count_1 || ptr_2 < count_2)
+ {
+ while(ptr_1 < count_1 && (ptr_2 == count_2 || p_list_1[ptr_1] < p_list_2[ptr_2]))
+ {
+ found_1++;
+ t_size ptr_1_new = ptr_1 + 1;
+ while(ptr_1_new < count_1 && p_list_1[ptr_1_new] == p_list_1[ptr_1]) ptr_1_new++;
+ ptr_1 = ptr_1_new;
+ }
+ while(ptr_2 < count_2 && (ptr_1 == count_1 || p_list_2[ptr_2] < p_list_1[ptr_1]))
+ {
+ found_2++;
+ t_size ptr_2_new = ptr_2 + 1;
+ while(ptr_2_new < count_2 && p_list_2[ptr_2_new] == p_list_2[ptr_2]) ptr_2_new++;
+ ptr_2 = ptr_2_new;
+ }
+ while(ptr_1 < count_1 && ptr_2 < count_2 && p_list_1[ptr_1] == p_list_2[ptr_2]) {ptr_1++; ptr_2++;}
+ }
+
+
+
+ p_list_1_specific.set_count(found_1);
+ p_list_2_specific.set_count(found_2);
+ if (found_1 > 0 || found_2 > 0)
+ {
+ found_1 = found_2 = 0;
+ ptr_1 = ptr_2 = 0;
+
+ while(ptr_1 < count_1 || ptr_2 < count_2)
+ {
+ while(ptr_1 < count_1 && (ptr_2 == count_2 || p_list_1[ptr_1] < p_list_2[ptr_2]))
+ {
+ p_list_1_specific[found_1++] = p_list_1[ptr_1];
+ t_size ptr_1_new = ptr_1 + 1;
+ while(ptr_1_new < count_1 && p_list_1[ptr_1_new] == p_list_1[ptr_1]) ptr_1_new++;
+ ptr_1 = ptr_1_new;
+ }
+ while(ptr_2 < count_2 && (ptr_1 == count_1 || p_list_2[ptr_2] < p_list_1[ptr_1]))
+ {
+ p_list_2_specific[found_2++] = p_list_2[ptr_2];
+ t_size ptr_2_new = ptr_2 + 1;
+ while(ptr_2_new < count_2 && p_list_2[ptr_2_new] == p_list_2[ptr_2]) ptr_2_new++;
+ ptr_2 = ptr_2_new;
+ }
+ while(ptr_1 < count_1 && ptr_2 < count_2 && p_list_1[ptr_1] == p_list_2[ptr_2]) {ptr_1++; ptr_2++;}
+ }
+
+ }
+}
+
+double metadb_handle_list_helper::calc_total_duration(metadb_handle_list_cref p_list)
+{
+ double ret = 0;
+ t_size n, m = p_list.get_count();
+ for(n=0;n<m;n++)
+ {
+ double temp = p_list.get_item(n)->get_length();
+ if (temp > 0) ret += temp;
+ }
+ return ret;
+}
+
+void metadb_handle_list_helper::sort_by_path(metadb_handle_list_ref p_list)
+{
+ sort_by_format(p_list,"%path_sort%",NULL);
+}
+
+
+t_filesize metadb_handle_list_helper::calc_total_size(metadb_handle_list_cref p_list, bool skipUnknown) {
+ metadb_handle_list list(p_list);
+ list.sort_t(metadb::path_compare_metadb_handle);
+
+ t_filesize ret = 0;
+ t_size n, m = list.get_count();
+ for(n=0;n<m;n++) {
+ if (n==0 || metadb::path_compare(list[n-1]->get_path(),list[n]->get_path())) {
+ t_filesize t = list[n]->get_filesize();
+ if (t == filesize_invalid) {
+ if (!skipUnknown) return filesize_invalid;
+ } else {
+ ret += t;
+ }
+ }
+ }
+ return ret;
+}
+
+t_filesize metadb_handle_list_helper::calc_total_size_ex(metadb_handle_list_cref p_list, bool & foundUnknown) {
+ foundUnknown = false;
+ metadb_handle_list list(p_list);
+ list.sort_t(metadb::path_compare_metadb_handle);
+
+ t_filesize ret = 0;
+ t_size n, m = list.get_count();
+ for(n=0;n<m;n++) {
+ if (n==0 || metadb::path_compare(list[n-1]->get_path(),list[n]->get_path())) {
+ t_filesize t = list[n]->get_filesize();
+ if (t == filesize_invalid) {
+ foundUnknown = true;
+ } else {
+ ret += t;
+ }
+ }
+ }
+ return ret;
+}
+
+bool metadb_handle_list_helper::extract_single_path(metadb_handle_list_cref list, const char * &pathOut) {
+ const t_size total = list.get_count();
+ if (total == 0) return false;
+ const char * path = list[0]->get_path();
+ for(t_size walk = 1; walk < total; ++walk) {
+ if (metadb::path_compare(path, list[walk]->get_path()) != 0) return false;
+ }
+ pathOut = path;
+ return true;
+}
\ No newline at end of file diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/modeless_dialog.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/modeless_dialog.h new file mode 100644 index 0000000000..cc7d10d1f2 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/modeless_dialog.h @@ -0,0 +1,17 @@ +//! Service for plugging your nonmodal dialog windows into main app loop to receive IsDialogMessage()-translated messages.\n
+//! Note that all methods are valid from main app thread only.\n
+//! Usage: static_api_ptr_t<modeless_dialog_manager> or modeless_dialog_manager::g_add / modeless_dialog_manager::g_remove.
+class NOVTABLE modeless_dialog_manager : public service_base {
+ FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(modeless_dialog_manager);
+public:
+ //! Adds specified window to global list of windows to receive IsDialogMessage().
+ virtual void add(HWND p_wnd) = 0;
+ //! Removes specified window from global list of windows to receive IsDialogMessage().
+ virtual void remove(HWND p_wnd) = 0;
+
+ //! Static helper; see add().
+ static void g_add(HWND p_wnd) {static_api_ptr_t<modeless_dialog_manager>()->add(p_wnd);}
+ //! Static helper; see remove().
+ static void g_remove(HWND p_wnd) {static_api_ptr_t<modeless_dialog_manager>()->remove(p_wnd);}
+
+};
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/ole_interaction.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/ole_interaction.h new file mode 100644 index 0000000000..5159194bd0 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/ole_interaction.h @@ -0,0 +1,149 @@ +class NOVTABLE playlist_dataobject_desc {
+public:
+ virtual t_size get_entry_count() const = 0;
+ virtual void get_entry_name(t_size which, pfc::string_base & out) const = 0;
+ virtual void get_entry_content(t_size which, metadb_handle_list_ref out) const = 0;
+
+ virtual void set_entry_count(t_size count) = 0;
+ virtual void set_entry_name(t_size which, const char * name) = 0;
+ virtual void set_entry_content(t_size which, metadb_handle_list_cref content) = 0;
+
+ void copy(playlist_dataobject_desc const & source) {
+ const t_size count = source.get_entry_count(); set_entry_count(count);
+ metadb_handle_list content; pfc::string8 name;
+ for(t_size walk = 0; walk < count; ++walk) {
+ source.get_entry_name(walk,name); source.get_entry_content(walk,content);
+ set_entry_name(walk,name); set_entry_content(walk,content);
+ }
+ }
+protected:
+ ~playlist_dataobject_desc() {}
+private:
+ const playlist_dataobject_desc & operator=(const playlist_dataobject_desc &) {return *this;}
+};
+
+class NOVTABLE playlist_dataobject_desc_v2 : public playlist_dataobject_desc {
+public:
+ virtual void get_side_data(t_size which, mem_block_container & out) const = 0;
+ virtual void set_side_data(t_size which, const void * data, t_size size) = 0;
+
+ void copy(playlist_dataobject_desc_v2 const & source) {
+ const t_size count = source.get_entry_count(); set_entry_count(count);
+ metadb_handle_list content; pfc::string8 name;
+ mem_block_container_impl_t<pfc::alloc_fast_aggressive> sideData;
+ for(t_size walk = 0; walk < count; ++walk) {
+ source.get_entry_name(walk,name); source.get_entry_content(walk,content); source.get_side_data(walk, sideData);
+ set_entry_name(walk,name); set_entry_content(walk,content); set_side_data(walk, sideData.get_ptr(), sideData.get_size());
+ }
+ }
+
+ void set_from_playlist_manager(bit_array const & mask) {
+ static_api_ptr_t<playlist_manager_v4> api;
+ const t_size pltotal = api->get_playlist_count();
+ const t_size total = mask.calc_count(true,0,pltotal);
+ set_entry_count(total);
+ t_size done = 0;
+ pfc::string8 name; metadb_handle_list content;
+ abort_callback_dummy abort;
+ for(t_size walk = 0; walk < pltotal; ++walk) if (mask[walk]) {
+ pfc::dynamic_assert( done < total );
+ api->playlist_get_name(walk,name); api->playlist_get_all_items(walk,content);
+ set_entry_name(done,name); set_entry_content(done,content);
+ stream_writer_buffer_simple sideData; api->playlist_get_sideinfo(walk, &sideData, abort);
+ set_side_data(done,sideData.m_buffer.get_ptr(), sideData.m_buffer.get_size());
+ ++done;
+ }
+ pfc::dynamic_assert( done == total );
+ }
+
+ const playlist_dataobject_desc_v2 & operator=(const playlist_dataobject_desc_v2& source) {copy(source); return *this;}
+protected:
+ ~playlist_dataobject_desc_v2() {}
+};
+
+class playlist_dataobject_desc_impl : public playlist_dataobject_desc_v2 {
+public:
+ playlist_dataobject_desc_impl() {}
+ playlist_dataobject_desc_impl(const playlist_dataobject_desc_v2 & source) {copy(source);}
+
+ t_size get_entry_count() const {return m_entries.get_size();}
+ void get_entry_name(t_size which, pfc::string_base & out) const {
+ if (which < m_entries.get_size()) out = m_entries[which].m_name;
+ else throw pfc::exception_invalid_params();
+ }
+ void get_entry_content(t_size which, metadb_handle_list_ref out) const {
+ if (which < m_entries.get_size()) out = m_entries[which].m_content;
+ else throw pfc::exception_invalid_params();
+ }
+ void set_entry_count(t_size count) {
+ m_entries.set_size(count);
+ }
+ void set_entry_name(t_size which, const char * name) {
+ if (which < m_entries.get_size()) m_entries[which].m_name = name;
+ else throw pfc::exception_invalid_params();
+ }
+ void set_entry_content(t_size which, metadb_handle_list_cref content) {
+ if (which < m_entries.get_size()) m_entries[which].m_content = content;
+ else throw pfc::exception_invalid_params();
+ }
+ void get_side_data(t_size which, mem_block_container & out) const {
+ if (which < m_entries.get_size()) out.set(m_entries[which].m_sideData);
+ else throw pfc::exception_invalid_params();
+ }
+ void set_side_data(t_size which, const void * data, t_size size) {
+ if (which < m_entries.get_size()) m_entries[which].m_sideData.set_data_fromptr(reinterpret_cast<const t_uint8*>(data), size);
+ else throw pfc::exception_invalid_params();
+ }
+private:
+ struct entry { metadb_handle_list m_content; pfc::string8 m_name; pfc::array_t<t_uint8> m_sideData; };
+ pfc::array_t<entry> m_entries;
+};
+
+//! \since 0.9.5
+//! Provides various methods for interaction between foobar2000 and OLE IDataObjects, Windows Clipboard, drag&drop and such.
+//! To instantiate, use static_api_ptr_t<ole_interaction>.
+class NOVTABLE ole_interaction : public service_base {
+ FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(ole_interaction)
+public:
+ enum {
+ KClipboardFormatSimpleLocations,
+ KClipboardFormatFPL,
+ KClipboardFormatMultiFPL,
+ KClipboardFormatTotal
+ };
+ //! Retrieves clipboard format ID for one of foobar2000's internal data formats.
+ //! @param which One of KClipboardFormat* constants.
+ virtual t_uint32 get_clipboard_format(t_uint32 which) = 0;
+
+ //! Creates an IDataObject from a group of tracks.
+ virtual pfc::com_ptr_t<IDataObject> create_dataobject(metadb_handle_list_cref source) = 0;
+
+ //! Creates an IDataObject from one or more playlists, including playlist name info for re-creating those playlists later.
+ virtual pfc::com_ptr_t<IDataObject> create_dataobject(const playlist_dataobject_desc & source) = 0;
+
+ //! Attempts to parse an IDataObject as playlists.
+ virtual HRESULT parse_dataobject_playlists(pfc::com_ptr_t<IDataObject> obj, playlist_dataobject_desc & out) = 0;
+
+ //! For internal use only. Will succeed only if the metadb_handle list can be generated immediately, without performing potentially timeconsuming tasks such as parsing media files (for an example when the specified IDataObject contains data in one of our internal formats).
+ virtual HRESULT parse_dataobject_immediate(pfc::com_ptr_t<IDataObject> obj, metadb_handle_list_ref out) = 0;
+
+ //! Attempts to parse an IDataObject into a dropped_files_data object (list of metadb_handles if immediately available, list of file paths otherwise).
+ virtual HRESULT parse_dataobject(pfc::com_ptr_t<IDataObject> obj, dropped_files_data & out) = 0;
+
+ //! Checks whether the specified IDataObject appears to be parsable by our parse_dataobject methods.
+ virtual HRESULT check_dataobject(pfc::com_ptr_t<IDataObject> obj, DWORD & dropEffect, bool & isNative) = 0;
+
+ //! Checks whether the specified IDataObject appears to be parsable as playlists (parse_dataobject_playlists method).
+ virtual HRESULT check_dataobject_playlists(pfc::com_ptr_t<IDataObject> obj) = 0;
+};
+
+//! \since 0.9.5.4
+class NOVTABLE ole_interaction_v2 : public ole_interaction {
+ FB2K_MAKE_SERVICE_INTERFACE(ole_interaction_v2, ole_interaction)
+public:
+ //! Creates an IDataObject from one or more playlists, including playlist name info for re-creating those playlists later.
+ virtual pfc::com_ptr_t<IDataObject> create_dataobject(const playlist_dataobject_desc_v2 & source) = 0;
+
+ //! Attempts to parse an IDataObject as playlists.
+ virtual HRESULT parse_dataobject_playlists(pfc::com_ptr_t<IDataObject> obj, playlist_dataobject_desc_v2 & out) = 0;
+};
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/packet_decoder.cpp b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/packet_decoder.cpp new file mode 100644 index 0000000000..abef1bc4d7 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/packet_decoder.cpp @@ -0,0 +1,14 @@ +#include "foobar2000.h"
+
+void packet_decoder::g_open(service_ptr_t<packet_decoder> & p_out,bool p_decode,const GUID & p_owner,t_size p_param1,const void * p_param2,t_size p_param2size,abort_callback & p_abort)
+{
+ service_enum_t<packet_decoder_entry> e;
+ service_ptr_t<packet_decoder_entry> ptr;
+ while(e.next(ptr)) {
+ if (ptr->is_our_setup(p_owner,p_param1,p_param2,p_param2size)) {
+ ptr->open(p_out,p_decode,p_owner,p_param1,p_param2,p_param2size,p_abort);
+ return;
+ }
+ }
+ throw exception_io_data();
+}
\ No newline at end of file diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/packet_decoder.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/packet_decoder.h new file mode 100644 index 0000000000..55f6a69682 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/packet_decoder.h @@ -0,0 +1,113 @@ +//! Provides interface to decode various audio data types to PCM. Use packet_decoder_factory_t template to register.
+
+class NOVTABLE packet_decoder : public service_base {
+protected:
+ //! Prototype of function that must be implemented by packet_decoder implementation but is not accessible through packet_decoder interface itself.
+ //! Determines whether specific packet_decoder implementation supports specified decoder setup data.
+ static bool g_is_our_setup(const GUID & p_owner,t_size p_param1,const void * p_param2,t_size p_param2size) {return false;}
+
+ //! Prototype of function that must be implemented by packet_decoder implementation but is not accessible through packet_decoder interface itself.
+ //! Initializes packet decoder instance with specified decoder setup data. This is called only once, before any other methods.
+ //! @param p_decode If set to true, decode() and reset_after_seek() calls can be expected later. If set to false, those methods will not be called on this packet_decoder instance - for an example when caller is only retrieving information about the file rather than preparing to decode it.
+ void open(const GUID & p_owner,bool p_decode,t_size p_param1,const void * p_param2,t_size p_param2size,abort_callback & p_abort) {throw exception_io_data();}
+public:
+
+
+ //! Forwards additional information about stream being decoded. \n
+ //! Calling: this must be called immediately after packet_decoder object is created, before any other methods are called.\n
+ //! Implementation: this is called after open() (which is called by implementation framework immediately after creation), and before any other methods are called.
+ virtual t_size set_stream_property(const GUID & p_type,t_size p_param1,const void * p_param2,t_size p_param2size) = 0;
+
+
+ //! Retrieves additional user-readable tech infos that decoder can provide.
+ //! @param p_info Interface receiving information about the stream being decoded. Note that it already contains partial info about the file; existing info should not be erased, decoder-provided info should be merged with it.
+ virtual void get_info(file_info & p_info) = 0;
+
+ //! Returns many frames back to start decoding when seeking.
+ virtual unsigned get_max_frame_dependency()=0;
+ //! Returns much time back to start decoding when seeking (for containers where going back by specified number of frames is not trivial).
+ virtual double get_max_frame_dependency_time()=0;
+
+ //! Flushes decoder after seeking.
+ virtual void reset_after_seek()=0;
+
+ //! Decodes a block of audio data.\n
+ //! It may return empty chunk even when successful (caused by encoder+decoder delay for an example), caller must check for it and handle it appropriately.
+ virtual void decode(const void * p_buffer,t_size p_bytes,audio_chunk & p_chunk,abort_callback & p_abort)=0;
+
+ //! Returns whether this packet decoder supports analyze_first_frame() function.
+ virtual bool analyze_first_frame_supported() = 0;
+ //! Optional. Some codecs need to analyze first frame of the stream to return additional info about the stream, such as encoding setup. This can be only called immediately after instantiation (and set_stream_property() if present), before any actual decoding or get_info(). Caller can determine whether this method is supported or not by calling analyze_first_frame_supported(), to avoid reading first frame when decoder won't utiilize the extra info for an example. If particular decoder can't utilize first frame info in any way (and analyze_first_frame_supported() returns false), this function should do nothing and succeed.
+ virtual void analyze_first_frame(const void * p_buffer,t_size p_bytes,abort_callback & p_abort) = 0;
+
+ //! Static helper, creates a packet_decoder instance and initializes it with specific decoder setup data.
+ static void g_open(service_ptr_t<packet_decoder> & p_out,bool p_decode,const GUID & p_owner,t_size p_param1,const void * p_param2,t_size p_param2size,abort_callback & p_abort);
+
+ static const GUID owner_MP4,owner_matroska,owner_MP3,owner_MP2,owner_MP1,owner_MP4_ALAC,owner_ADTS,owner_ADIF, owner_Ogg, owner_MP4_AMR, owner_MP4_AMR_WB;
+
+ struct matroska_setup
+ {
+ const char * codec_id;
+ unsigned sample_rate,sample_rate_output;
+ unsigned channels;
+ unsigned codec_private_size;
+ const void * codec_private;
+ };
+ //owner_MP4: param1 - codec ID (MP4 audio type), param2 - MP4 codec initialization data
+ //owner_MP3: raw MP3/MP2 file, parameters ignored
+ //owner_matroska: param2 = matroska_setup struct, param2size size must be equal to sizeof(matroska_setup)
+
+
+ //these are used to initialize PCM decoder
+ static const GUID property_samplerate,property_bitspersample,property_channels,property_byteorder,property_signed,property_channelmask;
+ //property_samplerate : param1 == sample rate in hz
+ //property_bitspersample : param1 == bits per sample
+ //property_channels : param1 == channel count
+ //property_byteorder : if (param1) little_endian; else big_endian;
+ //property_signed : if (param1) signed; else unsigned;
+
+
+ //property_ogg_header : p_param1 = unused, p_param2 = ogg_packet structure, retval: 0 when more headers are wanted, 1 when done parsing headers
+ //property_ogg_query_sample_rate : returns sample rate, no parameters
+ //property_ogg_packet : p_param1 = unused, p_param2 = ogg_packet strucute
+ static const GUID property_ogg_header, property_ogg_query_sample_rate, property_ogg_packet;
+
+ FB2K_MAKE_SERVICE_INTERFACE(packet_decoder,service_base);
+};
+
+class NOVTABLE packet_decoder_streamparse : public packet_decoder
+{
+public:
+ virtual void decode_ex(const void * p_buffer,t_size p_bytes,t_size & p_bytes_processed,audio_chunk & p_chunk,abort_callback & p_abort) = 0;
+ virtual void analyze_first_frame_ex(const void * p_buffer,t_size p_bytes,t_size & p_bytes_processed,abort_callback & p_abort) = 0;
+
+ FB2K_MAKE_SERVICE_INTERFACE(packet_decoder_streamparse,packet_decoder);
+};
+
+class NOVTABLE packet_decoder_entry : public service_base
+{
+public:
+ virtual bool is_our_setup(const GUID & p_owner,t_size p_param1,const void * p_param2,t_size p_param2size) = 0;
+ virtual void open(service_ptr_t<packet_decoder> & p_out,bool p_decode,const GUID & p_owner,t_size p_param1,const void * p_param2,t_size p_param2size,abort_callback & p_abort) = 0;
+
+ FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(packet_decoder_entry);
+};
+
+
+template<class T>
+class packet_decoder_entry_impl_t : public packet_decoder_entry
+{
+public:
+ bool is_our_setup(const GUID & p_owner,t_size p_param1,const void * p_param2,t_size p_param2size) {
+ return T::g_is_our_setup(p_owner,p_param1,p_param2,p_param2size);
+ }
+ void open(service_ptr_t<packet_decoder> & p_out,bool p_decode,const GUID & p_owner,t_size p_param1,const void * p_param2,t_size p_param2size,abort_callback & p_abort) {
+ assert(is_our_setup(p_owner,p_param1,p_param2,p_param2size));
+ service_ptr_t<T> instance = new service_impl_t<T>();
+ instance->open(p_owner,p_decode,p_param1,p_param2,p_param2size,p_abort);
+ p_out = instance.get_ptr();
+ }
+};
+
+template<typename T>
+class packet_decoder_factory_t : public service_factory_single_t<packet_decoder_entry_impl_t<T> > {};
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/play_callback.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/play_callback.h new file mode 100644 index 0000000000..2fc48019af --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/play_callback.h @@ -0,0 +1,149 @@ +/*!
+Class receiving notifications about playback events. Note that all methods are called only from app's main thread.
+Use play_callback_manager to register your dynamically created instances. Statically registered version is available too - see play_callback_static.
+*/
+class NOVTABLE play_callback {
+public:
+ //! Playback process is being initialized. on_playback_new_track() should be called soon after this when first file is successfully opened for decoding.
+ virtual void FB2KAPI on_playback_starting(play_control::t_track_command p_command,bool p_paused) = 0;
+ //! Playback advanced to new track.
+ virtual void FB2KAPI on_playback_new_track(metadb_handle_ptr p_track) = 0;
+ //! Playback stopped.
+ virtual void FB2KAPI on_playback_stop(play_control::t_stop_reason p_reason) = 0;
+ //! User has seeked to specific time.
+ virtual void FB2KAPI on_playback_seek(double p_time) = 0;
+ //! Called on pause/unpause.
+ virtual void FB2KAPI on_playback_pause(bool p_state) = 0;
+ //! Called when currently played file gets edited.
+ virtual void FB2KAPI on_playback_edited(metadb_handle_ptr p_track) = 0;
+ //! Dynamic info (VBR bitrate etc) change.
+ virtual void FB2KAPI on_playback_dynamic_info(const file_info & p_info) = 0;
+ //! Per-track dynamic info (stream track titles etc) change. Happens less often than on_playback_dynamic_info().
+ virtual void FB2KAPI on_playback_dynamic_info_track(const file_info & p_info) = 0;
+ //! Called every second, for time display
+ virtual void FB2KAPI on_playback_time(double p_time) = 0;
+ //! User changed volume settings. Possibly called when not playing.
+ //! @param p_new_val new volume level in dB; 0 for full volume.
+ virtual void FB2KAPI on_volume_change(float p_new_val) = 0;
+
+ enum {
+ flag_on_playback_starting = 1 << 0,
+ flag_on_playback_new_track = 1 << 1,
+ flag_on_playback_stop = 1 << 2,
+ flag_on_playback_seek = 1 << 3,
+ flag_on_playback_pause = 1 << 4,
+ flag_on_playback_edited = 1 << 5,
+ flag_on_playback_dynamic_info = 1 << 6,
+ flag_on_playback_dynamic_info_track = 1 << 7,
+ flag_on_playback_time = 1 << 8,
+ flag_on_volume_change = 1 << 9,
+
+ flag_on_playback_all = flag_on_playback_starting | flag_on_playback_new_track |
+ flag_on_playback_stop | flag_on_playback_seek |
+ flag_on_playback_pause | flag_on_playback_edited |
+ flag_on_playback_dynamic_info | flag_on_playback_dynamic_info_track | flag_on_playback_time,
+ };
+protected:
+ play_callback() {}
+ ~play_callback() {}
+};
+
+//! Standard API (always present); manages registrations of dynamic play_callbacks.
+//! Usage: use static_api_ptr_t<play_callback_manager>.
+//! Do not reimplement.
+class NOVTABLE play_callback_manager : public service_base
+{
+public:
+ //! Registers a play_callback object.
+ //! @param p_callback Interface to register.
+ //! @param p_flags Indicates which notifications are requested.
+ //! @param p_forward_status_on_register Set to true to have the callback immediately receive current playback status as notifications if playback is active (eg. to receive info about playback process that started before our callback was registered).
+ virtual void FB2KAPI register_callback(play_callback * p_callback,unsigned p_flags,bool p_forward_status_on_register) = 0;
+ //! Unregisters a play_callback object.
+ //! @p_callback Previously registered interface to unregister.
+ virtual void FB2KAPI unregister_callback(play_callback * p_callback) = 0;
+
+ FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(play_callback_manager);
+};
+
+//! Implementation helper.
+class play_callback_impl_base : public play_callback {
+public:
+ play_callback_impl_base(unsigned p_flags = ~0) {
+ static_api_ptr_t<play_callback_manager>()->register_callback(this,p_flags,false);
+ }
+ ~play_callback_impl_base() {
+ static_api_ptr_t<play_callback_manager>()->unregister_callback(this);
+ }
+ void play_callback_reregister(unsigned flags, bool refresh = false) {
+ static_api_ptr_t<play_callback_manager> api;
+ api->unregister_callback(this);
+ api->register_callback(this,flags,refresh);
+ }
+ void on_playback_starting(play_control::t_track_command p_command,bool p_paused) {}
+ void on_playback_new_track(metadb_handle_ptr p_track) {}
+ void on_playback_stop(play_control::t_stop_reason p_reason) {}
+ void on_playback_seek(double p_time) {}
+ void on_playback_pause(bool p_state) {}
+ void on_playback_edited(metadb_handle_ptr p_track) {}
+ void on_playback_dynamic_info(const file_info & p_info) {}
+ void on_playback_dynamic_info_track(const file_info & p_info) {}
+ void on_playback_time(double p_time) {}
+ void on_volume_change(float p_new_val) {}
+
+ PFC_CLASS_NOT_COPYABLE_EX(play_callback_impl_base)
+};
+
+//! Static (autoregistered) version of play_callback. Use play_callback_static_factory_t to register.
+class play_callback_static : public service_base, public play_callback {
+public:
+ //! Controls which methods your callback wants called; returned value should not change in run time, you should expect it to be queried only once (on startup). See play_callback::flag_* constants.
+ virtual unsigned get_flags() = 0;
+
+ FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(play_callback_static);
+};
+
+template<typename T>
+class play_callback_static_factory_t : public service_factory_single_t<T> {};
+
+
+//! Gets notified about tracks being played. Notification occurs when at least 60s of the track has been played, or the track has reached its end after at least 1/3 of it has been played through.
+//! Use playback_statistics_collector_factory_t to register.
+class NOVTABLE playback_statistics_collector : public service_base {
+public:
+ virtual void on_item_played(metadb_handle_ptr p_item) = 0;
+
+ FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(playback_statistics_collector);
+};
+
+template<typename T>
+class playback_statistics_collector_factory_t : public service_factory_single_t<T> {};
+
+
+
+
+//! Helper providing a simplified interface for receiving playback events, in case your code does not care about the kind of playback event that has occurred; useful typically for GUI/rendering code that just refreshes some control whenever a playback state change occurs.
+class playback_event_notify : private play_callback_impl_base {
+public:
+ playback_event_notify(playback_control::t_display_level level = playback_control::display_level_all) : play_callback_impl_base(GrabCBFlags(level)) {}
+
+ static t_uint32 GrabCBFlags(playback_control::t_display_level level) {
+ t_uint32 flags = flag_on_playback_starting | flag_on_playback_new_track | flag_on_playback_stop | flag_on_playback_pause | flag_on_playback_edited | flag_on_volume_change;
+ if (level >= playback_control::display_level_titles) flags |= flag_on_playback_dynamic_info_track;
+ if (level >= playback_control::display_level_all) flags |= flag_on_playback_seek | flag_on_playback_dynamic_info | flag_on_playback_time;
+ return flags;
+ }
+protected:
+ virtual void on_playback_event() {}
+private:
+ void on_playback_starting(play_control::t_track_command p_command,bool p_paused) {on_playback_event();}
+ void on_playback_new_track(metadb_handle_ptr p_track) {on_playback_event();}
+ void on_playback_stop(play_control::t_stop_reason p_reason) {on_playback_event();}
+ void on_playback_seek(double p_time) {on_playback_event();}
+ void on_playback_pause(bool p_state) {on_playback_event();}
+ void on_playback_edited(metadb_handle_ptr p_track) {on_playback_event();}
+ void on_playback_dynamic_info(const file_info & p_info) {on_playback_event();}
+ void on_playback_dynamic_info_track(const file_info & p_info) {on_playback_event();}
+ void on_playback_time(double p_time) {on_playback_event();}
+ void on_volume_change(float p_new_val) {on_playback_event();}
+};
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/playable_location.cpp b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/playable_location.cpp new file mode 100644 index 0000000000..5ad6e0c0ed --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/playable_location.cpp @@ -0,0 +1,23 @@ +#include "foobar2000.h"
+
+int playable_location::g_compare(const playable_location & p_item1,const playable_location & p_item2) {
+ int ret = metadb::path_compare(p_item1.get_path(),p_item2.get_path());
+ if (ret != 0) return ret;
+ return pfc::compare_t(p_item1.get_subsong(),p_item2.get_subsong());
+}
+
+pfc::string_base & operator<<(pfc::string_base & p_fmt,const playable_location & p_location)
+{
+ p_fmt << "\"" << file_path_display(p_location.get_path()) << "\"";
+ t_uint32 index = p_location.get_subsong_index();
+ if (index != 0) p_fmt << " / index: " << p_location.get_subsong_index();
+ return p_fmt;
+}
+
+
+bool playable_location::operator==(const playable_location & p_other) const {
+ return metadb::path_compare(get_path(),p_other.get_path()) == 0 && get_subsong() == p_other.get_subsong();
+}
+bool playable_location::operator!=(const playable_location & p_other) const {
+ return !(*this == p_other);
+}
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/playable_location.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/playable_location.h new file mode 100644 index 0000000000..0f1d1829b4 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/playable_location.h @@ -0,0 +1,90 @@ +#ifndef _FOOBAR2000_PLAYABLE_LOCATION_H_
+#define _FOOBAR2000_PLAYABLE_LOCATION_H_
+
+//playable_location stores location of a playable resource, currently implemented as file path and integer for indicating multiple playable "subsongs" per file
+//also see: file_info.h
+//for getting more info about resource referenced by a playable_location, see metadb.h
+
+//char* strings are all UTF-8
+
+class NOVTABLE playable_location//interface (for passing around between DLLs)
+{
+public:
+ virtual const char * get_path() const =0;
+ virtual void set_path(const char*)=0;
+ virtual t_uint32 get_subsong() const =0;
+ virtual void set_subsong(t_uint32)=0;
+
+ void copy(const playable_location & p_other) {
+ set_path(p_other.get_path());
+ set_subsong(p_other.get_subsong());
+ }
+
+ static int g_compare(const playable_location & p_item1,const playable_location & p_item2);
+
+ const playable_location & operator=(const playable_location & src) {copy(src);return *this;}
+
+ bool operator==(const playable_location & p_other) const;
+ bool operator!=(const playable_location & p_other) const;
+
+ inline bool is_empty() {return get_path()[0]==0 && get_subsong()==0;}
+ inline void reset() {set_path("");set_subsong(0);}
+ inline t_uint32 get_subsong_index() const {return get_subsong();}
+ inline void set_subsong_index(t_uint32 v) {set_subsong(v);}
+
+ class comparator {
+ public:
+ static int compare(const playable_location & v1, const playable_location & v2) {return g_compare(v1,v2);}
+ };
+
+protected:
+ playable_location() {}
+ ~playable_location() {}
+};
+
+typedef playable_location * pplayable_location;
+typedef playable_location const * pcplayable_location;
+typedef playable_location & rplayable_location;
+typedef playable_location const & rcplayable_location;
+
+class playable_location_impl : public playable_location//implementation
+{
+public:
+ const char * get_path() const {return m_path;}
+ void set_path(const char* p_path) {m_path=p_path;}
+ t_uint32 get_subsong() const {return m_subsong;}
+ void set_subsong(t_uint32 p_subsong) {m_subsong=p_subsong;}
+
+ const playable_location_impl & operator=(const playable_location & src) {copy(src);return *this;}
+ const playable_location_impl & operator=(const playable_location_impl & src) {copy(src);return *this;}
+
+ playable_location_impl() : m_subsong(0) {}
+ playable_location_impl(const char * p_path,t_uint32 p_subsong) : m_path(p_path), m_subsong(p_subsong) {}
+ playable_location_impl(const playable_location & src) {copy(src);}
+ playable_location_impl(const playable_location_impl & src) {copy(src);}
+
+private:
+ pfc::string_simple m_path;
+ t_uint32 m_subsong;
+};
+
+// usage: something( make_playable_location("file://c:\blah.ogg",0) );
+// only for use as a parameter to a function taking const playable_location &
+class make_playable_location : public playable_location
+{
+ const char * path;
+ t_uint32 num;
+
+ void set_path(const char*) {throw pfc::exception_not_implemented();}
+ void set_subsong(t_uint32) {throw pfc::exception_not_implemented();}
+
+public:
+ const char * get_path() const {return path;}
+ t_uint32 get_subsong() const {return num;}
+
+ make_playable_location(const char * p_path,t_uint32 p_num) : path(p_path), num(p_num) {}
+};
+
+pfc::string_base & operator<<(pfc::string_base & p_fmt,const playable_location & p_location);
+
+#endif //_FOOBAR2000_PLAYABLE_LOCATION_H_
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/playback_control.cpp b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/playback_control.cpp new file mode 100644 index 0000000000..bf9c47be70 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/playback_control.cpp @@ -0,0 +1,13 @@ +#include "foobar2000.h"
+
+
+double playback_control::playback_get_length()
+{
+ double rv = 0;
+ metadb_handle_ptr ptr;
+ if (get_now_playing(ptr))
+ {
+ rv = ptr->get_length();
+ }
+ return rv;
+}
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/playback_control.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/playback_control.h new file mode 100644 index 0000000000..b247bf4d5e --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/playback_control.h @@ -0,0 +1,143 @@ +//! Provides control for various playback-related operations.
+//! All methods provided by this interface work from main app thread only. Calling from another thread will do nothing or trigger an exception. If you need to trigger one of playback_control methods from another thread, see main_thread_callback.
+//! Do not call playback_control methods from inside any kind of global callback (e.g. playlist callback), otherwise race conditions may occur.
+//! Use static_api_ptr_t to instantiate. See static_api_ptr_t documentation for more info.
+class NOVTABLE playback_control : public service_base
+{
+public:
+
+ enum t_stop_reason {
+ stop_reason_user = 0,
+ stop_reason_eof,
+ stop_reason_starting_another,
+ stop_reason_shutting_down,
+ };
+
+
+ enum t_track_command {
+ track_command_default = 0,
+ track_command_play,
+ //! Plays the next track from the current playlist according to the current playback order.
+ track_command_next,
+ //! Plays the previous track from the current playlist according to the current playback order.
+ track_command_prev,
+ //! For internal use only, do not use.
+ track_command_settrack,
+ //! Plays a random track from the current playlist.
+ track_command_rand,
+
+ //! For internal use only, do not use.
+ track_command_resume,
+ };
+
+ //! Retrieves now playing item handle.
+ //! @returns true on success, false on failure (not playing).
+ virtual bool get_now_playing(metadb_handle_ptr & p_out) = 0;
+ //! Starts playback. If playback is already active, existing process is stopped first.
+ //! @param p_command Specifies what track to start playback from. See t_track_Command enum for more info.
+ //! @param p_paused Specifies whether playback should be started as paused.
+ virtual void start(t_track_command p_command = track_command_play,bool p_paused = false) = 0;
+ //! Stops playback.
+ virtual void stop() = 0;
+ //! Returns whether playback is active.
+ virtual bool is_playing() = 0;
+ //! Returns whether playback is active and in paused state.
+ virtual bool is_paused() = 0;
+ //! Toggles pause state if playback is active.
+ //! @param p_state set to true when pausing or to false when unpausing.
+ virtual void pause(bool p_state) = 0;
+
+ //! Retrieves stop-after-current-track option state.
+ virtual bool get_stop_after_current() = 0;
+ //! Alters stop-after-current-track option state.
+ virtual void set_stop_after_current(bool p_state) = 0;
+
+ //! Alters playback volume level.
+ //! @param p_value volume in dB; 0 for full volume.
+ virtual void set_volume(float p_value) = 0;
+ //! Retrieves playback volume level.
+ //! @returns current playback volume level, in dB; 0 for full volume.
+ virtual float get_volume() = 0;
+ //! Alters playback volume level one step up.
+ virtual void volume_up() = 0;
+ //! Alters playback volume level one step down.
+ virtual void volume_down() = 0;
+ //! Toggles playback mute state.
+ virtual void volume_mute_toggle() = 0;
+ //! Seeks in currenly played track to specified time.
+ //! @param p_time target time in seconds.
+ virtual void playback_seek(double p_time) = 0;
+ //! Seeks in currently played track by specified time forward or back.
+ //! @param p_delta time in seconds to seek by; can be positive to seek forward or negative to seek back.
+ virtual void playback_seek_delta(double p_delta) = 0;
+ //! Returns whether currently played track is seekable. If it's not, playback_seek/playback_seek_delta calls will be ignored.
+ virtual bool playback_can_seek() = 0;
+ //! Returns current playback position within currently played track, in seconds.
+ virtual double playback_get_position() = 0;
+
+ //! Type used to indicate level of dynamic playback-related info displayed. Safe to use with <> opereators, e.g. level above N always includes information rendered by level N.
+ enum t_display_level {
+ //! No playback-related info
+ display_level_none,
+ //! Static info and is_playing/is_paused stats
+ display_level_basic,
+ //! display_level_basic + dynamic track titles on e.g. live streams
+ display_level_titles,
+ //! display_level_titles + timing + VBR bitrate display etc
+ display_level_all,
+ };
+
+ //! Renders information about currently playing item.
+ //! @param p_hook Optional callback object overriding fields and functions; set to NULL if not used.
+ //! @param p_out String receiving the output on success.
+ //! @param p_script Titleformat script to use. Use titleformat_compiler service to create one.
+ //! @param p_filter Optional callback object allowing input to be filtered according to context (i.e. removal of linebreak characters present in tags when rendering playlist lines). Set to NULL when not used.
+ //! @param p_level Indicates level of dynamic playback-related info displayed. See t_display_level enum for more details.
+ //! @returns true on success, false when no item is currently being played.
+ virtual bool playback_format_title(titleformat_hook * p_hook,pfc::string_base & p_out,const service_ptr_t<class titleformat_object> & p_script,titleformat_text_filter * p_filter,t_display_level p_level) = 0;
+
+
+
+ //! Helper; renders info about any item, including currently playing item info if the item is currently played.
+ bool playback_format_title_ex(metadb_handle_ptr p_item,titleformat_hook * p_hook,pfc::string_base & p_out,const service_ptr_t<class titleformat_object> & p_script,titleformat_text_filter * p_filter,t_display_level p_level) {
+ if (p_item.is_empty()) return playback_format_title(p_hook,p_out,p_script,p_filter,p_level);
+ metadb_handle_ptr temp;
+ if (get_now_playing(temp)) {
+ if (temp == p_item) {
+ return playback_format_title(p_hook,p_out,p_script,p_filter,p_level);
+ }
+ }
+ p_item->format_title(p_hook,p_out,p_script,p_filter);
+ return true;
+ }
+
+ //! Helper; retrieves length of currently playing item.
+ double playback_get_length();
+
+ //! Toggles stop-after-current state.
+ void toggle_stop_after_current() {set_stop_after_current(!get_stop_after_current());}
+ //! Toggles pause state.
+ void toggle_pause() {pause(!is_paused());}
+
+ //! Starts playback if playback is inactive, otherwise toggles pause.
+ void play_or_pause() {if (is_playing()) toggle_pause(); else start();}
+
+ //deprecated
+ inline void play_start(t_track_command p_command = track_command_play,bool p_paused = false) {start(p_command,p_paused);}
+ //deprecated
+ inline void play_stop() {stop();}
+
+ static const int volume_mute = -100;
+
+ FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(playback_control);
+};
+
+class playback_control_v2 : public playback_control {
+public:
+ virtual float get_volume_step() = 0;
+
+ FB2K_MAKE_SERVICE_INTERFACE(playback_control_v2,playback_control);
+};
+
+//for compatibility with old code
+typedef playback_control play_control;
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/playback_stream_capture.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/playback_stream_capture.h new file mode 100644 index 0000000000..64d28f4e4a --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/playback_stream_capture.h @@ -0,0 +1,23 @@ +//! \since 1.0
+class NOVTABLE playback_stream_capture_callback {
+public:
+ //! Delivers a real-time chunk of audio data. \n
+ //! Audio is roughly synchronized with what can currently be heard. This API is provided for utility purposes such as streaming; if you want to implement a visualisation, use the visualisation_manager API instead. \n
+ //! Called only from the main thread.
+ virtual void on_chunk(const audio_chunk &) = 0;
+protected:
+ playback_stream_capture_callback() {}
+ ~playback_stream_capture_callback() {}
+};
+
+//! \since 1.0
+class NOVTABLE playback_stream_capture : public service_base {
+public:
+ //! Possible to call only from the main thread.
+ virtual void add_callback(playback_stream_capture_callback * ) = 0;
+ //! Possible to call only from the main thread.
+ virtual void remove_callback(playback_stream_capture_callback * ) = 0;
+
+
+ FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(playback_stream_capture)
+};
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/playlist.cpp b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/playlist.cpp new file mode 100644 index 0000000000..516aa436a1 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/playlist.cpp @@ -0,0 +1,861 @@ +#include "foobar2000.h"
+
+namespace {
+ class enum_items_callback_retrieve_item : public playlist_manager::enum_items_callback
+ {
+ metadb_handle_ptr m_item;
+ public:
+ enum_items_callback_retrieve_item() : m_item(0) {}
+ bool on_item(t_size p_index,const metadb_handle_ptr & p_location,bool b_selected)
+ {
+ assert(m_item.is_empty());
+ m_item = p_location;
+ return false;
+ }
+ inline const metadb_handle_ptr & get_item() {return m_item;}
+ };
+
+ class enum_items_callback_retrieve_selection : public playlist_manager::enum_items_callback
+ {
+ bool m_state;
+ public:
+ enum_items_callback_retrieve_selection() : m_state(false) {}
+ bool on_item(t_size p_index,const metadb_handle_ptr & p_location,bool b_selected)
+ {
+ m_state = b_selected;
+ return false;
+ }
+ inline bool get_state() {return m_state;}
+ };
+
+ class enum_items_callback_retrieve_selection_mask : public playlist_manager::enum_items_callback
+ {
+ bit_array_var & m_out;
+ public:
+ enum_items_callback_retrieve_selection_mask(bit_array_var & p_out) : m_out(p_out) {}
+ bool on_item(t_size p_index,const metadb_handle_ptr & p_location,bool b_selected)
+ {
+ m_out.set(p_index,b_selected);
+ return true;
+ }
+ };
+
+ class enum_items_callback_retrieve_all_items : public playlist_manager::enum_items_callback
+ {
+ pfc::list_base_t<metadb_handle_ptr> & m_out;
+ public:
+ enum_items_callback_retrieve_all_items(pfc::list_base_t<metadb_handle_ptr> & p_out) : m_out(p_out) {m_out.remove_all();}
+ bool on_item(t_size p_index,const metadb_handle_ptr & p_location,bool b_selected)
+ {
+ m_out.add_item(p_location);
+ return true;
+ }
+ };
+
+ class enum_items_callback_retrieve_selected_items : public playlist_manager::enum_items_callback
+ {
+ pfc::list_base_t<metadb_handle_ptr> & m_out;
+ public:
+ enum_items_callback_retrieve_selected_items(pfc::list_base_t<metadb_handle_ptr> & p_out) : m_out(p_out) {m_out.remove_all();}
+ bool on_item(t_size p_index,const metadb_handle_ptr & p_location,bool b_selected)
+ {
+ if (b_selected) m_out.add_item(p_location);
+ return true;
+ }
+ };
+
+ class enum_items_callback_count_selection : public playlist_manager::enum_items_callback
+ {
+ t_size m_counter,m_max;
+ public:
+ enum_items_callback_count_selection(t_size p_max) : m_max(p_max), m_counter(0) {}
+ bool on_item(t_size p_index,const metadb_handle_ptr & p_location,bool b_selected)
+ {
+ if (b_selected)
+ {
+ if (++m_counter >= m_max) return false;
+ }
+ return true;
+ }
+
+ inline t_size get_count() {return m_counter;}
+ };
+
+}
+
+void playlist_manager::playlist_get_all_items(t_size p_playlist,pfc::list_base_t<metadb_handle_ptr> & out)
+{
+ playlist_get_items(p_playlist,out,bit_array_true());
+}
+
+void playlist_manager::playlist_get_selected_items(t_size p_playlist,pfc::list_base_t<metadb_handle_ptr> & out)
+{
+ playlist_enum_items(p_playlist,enum_items_callback_retrieve_selected_items(out),bit_array_true());
+}
+
+void playlist_manager::playlist_get_selection_mask(t_size p_playlist,bit_array_var & out)
+{
+ playlist_enum_items(p_playlist,enum_items_callback_retrieve_selection_mask(out),bit_array_true());
+}
+
+bool playlist_manager::playlist_is_item_selected(t_size p_playlist,t_size p_item)
+{
+ enum_items_callback_retrieve_selection callback;
+ playlist_enum_items(p_playlist,callback,bit_array_one(p_item));
+ return callback.get_state();
+}
+
+metadb_handle_ptr playlist_manager::playlist_get_item_handle(t_size playlist, t_size item) {
+ metadb_handle_ptr temp;
+ if (!playlist_get_item_handle(temp, playlist, item)) throw pfc::exception_invalid_params();
+ PFC_ASSERT( temp.is_valid() );
+ return temp;
+
+}
+bool playlist_manager::playlist_get_item_handle(metadb_handle_ptr & p_out,t_size p_playlist,t_size p_item)
+{
+ enum_items_callback_retrieve_item callback;
+ playlist_enum_items(p_playlist,callback,bit_array_one(p_item));
+ p_out = callback.get_item();
+ return p_out.is_valid();
+}
+
+void playlist_manager::g_make_selection_move_permutation(t_size * p_output,t_size p_count,const bit_array & p_selection,int p_delta) {
+ pfc::create_move_items_permutation(p_output,p_count,p_selection,p_delta);
+}
+
+bool playlist_manager::playlist_move_selection(t_size p_playlist,int p_delta) {
+ if (p_delta==0) return true;
+
+ t_size count = playlist_get_item_count(p_playlist);
+
+ pfc::array_t<t_size> order; order.set_size(count);
+ pfc::array_t<bool> selection; selection.set_size(count);
+
+ playlist_get_selection_mask(p_playlist,bit_array_var_table(selection.get_ptr(),selection.get_size()));
+ g_make_selection_move_permutation(order.get_ptr(),count,bit_array_table(selection.get_ptr(),selection.get_size()),p_delta);
+ return playlist_reorder_items(p_playlist,order.get_ptr(),count);
+}
+
+//retrieving status
+t_size playlist_manager::activeplaylist_get_item_count()
+{
+ t_size playlist = get_active_playlist();
+ if (playlist == pfc_infinite) return 0;
+ else return playlist_get_item_count(playlist);
+}
+
+void playlist_manager::activeplaylist_enum_items(enum_items_callback & p_callback,const bit_array & p_mask)
+{
+ t_size playlist = get_active_playlist();
+ if (playlist != pfc_infinite) playlist_enum_items(playlist,p_callback,p_mask);
+}
+
+t_size playlist_manager::activeplaylist_get_focus_item()
+{
+ t_size playlist = get_active_playlist();
+ if (playlist == pfc_infinite) return pfc_infinite;
+ else return playlist_get_focus_item(playlist);
+}
+
+bool playlist_manager::activeplaylist_get_name(pfc::string_base & p_out)
+{
+ t_size playlist = get_active_playlist();
+ if (playlist == pfc_infinite) return false;
+ else return playlist_get_name(playlist,p_out);
+}
+
+//modifying playlist
+bool playlist_manager::activeplaylist_reorder_items(const t_size * order,t_size count)
+{
+ t_size playlist = get_active_playlist();
+ if (playlist != pfc_infinite) return playlist_reorder_items(playlist,order,count);
+ else return false;
+}
+
+void playlist_manager::activeplaylist_set_selection(const bit_array & affected,const bit_array & status)
+{
+ t_size playlist = get_active_playlist();
+ if (playlist != pfc_infinite) playlist_set_selection(playlist,affected,status);
+}
+
+bool playlist_manager::activeplaylist_remove_items(const bit_array & mask)
+{
+ t_size playlist = get_active_playlist();
+ if (playlist != pfc_infinite) return playlist_remove_items(playlist,mask);
+ else return false;
+}
+
+bool playlist_manager::activeplaylist_replace_item(t_size p_item,const metadb_handle_ptr & p_new_item)
+{
+ t_size playlist = get_active_playlist();
+ if (playlist != pfc_infinite) return playlist_replace_item(playlist,p_item,p_new_item);
+ else return false;
+}
+
+void playlist_manager::activeplaylist_set_focus_item(t_size p_item)
+{
+ t_size playlist = get_active_playlist();
+ if (playlist != pfc_infinite) playlist_set_focus_item(playlist,p_item);
+}
+
+t_size playlist_manager::activeplaylist_insert_items(t_size p_base,const pfc::list_base_const_t<metadb_handle_ptr> & data,const bit_array & p_selection)
+{
+ t_size playlist = get_active_playlist();
+ if (playlist != pfc_infinite) return playlist_insert_items(playlist,p_base,data,p_selection);
+ else return pfc_infinite;
+}
+
+void playlist_manager::activeplaylist_ensure_visible(t_size p_item)
+{
+ t_size playlist = get_active_playlist();
+ if (playlist != pfc_infinite) playlist_ensure_visible(playlist,p_item);
+}
+
+bool playlist_manager::activeplaylist_rename(const char * p_name,t_size p_name_len)
+{
+ t_size playlist = get_active_playlist();
+ if (playlist != pfc_infinite) return playlist_rename(playlist,p_name,p_name_len);
+ else return false;
+}
+
+bool playlist_manager::activeplaylist_is_item_selected(t_size p_item)
+{
+ t_size playlist = get_active_playlist();
+ if (playlist != pfc_infinite) return playlist_is_item_selected(playlist,p_item);
+ else return false;
+}
+
+metadb_handle_ptr playlist_manager::activeplaylist_get_item_handle(t_size p_item) {
+ metadb_handle_ptr temp;
+ if (!activeplaylist_get_item_handle(temp, p_item)) throw pfc::exception_invalid_params();
+ PFC_ASSERT( temp.is_valid() );
+ return temp;
+}
+bool playlist_manager::activeplaylist_get_item_handle(metadb_handle_ptr & p_out,t_size p_item)
+{
+ t_size playlist = get_active_playlist();
+ if (playlist != pfc_infinite) return playlist_get_item_handle(p_out,playlist,p_item);
+ else return false;
+}
+
+void playlist_manager::activeplaylist_move_selection(int p_delta)
+{
+ t_size playlist = get_active_playlist();
+ if (playlist != pfc_infinite) playlist_move_selection(playlist,p_delta);
+}
+
+void playlist_manager::activeplaylist_get_selection_mask(bit_array_var & out)
+{
+ t_size playlist = get_active_playlist();
+ if (playlist != pfc_infinite) playlist_get_selection_mask(playlist,out);
+}
+
+void playlist_manager::activeplaylist_get_all_items(pfc::list_base_t<metadb_handle_ptr> & out)
+{
+ t_size playlist = get_active_playlist();
+ if (playlist != pfc_infinite) playlist_get_all_items(playlist,out);
+}
+
+void playlist_manager::activeplaylist_get_selected_items(pfc::list_base_t<metadb_handle_ptr> & out)
+{
+ t_size playlist = get_active_playlist();
+ if (playlist != pfc_infinite) playlist_get_selected_items(playlist,out);
+}
+
+bool playlist_manager::remove_playlist(t_size idx)
+{
+ return remove_playlists(bit_array_one(idx));
+}
+
+bool playlist_incoming_item_filter::process_location(const char * url,pfc::list_base_t<metadb_handle_ptr> & out,bool filter,const char * p_mask,const char * p_exclude,HWND p_parentwnd)
+{
+ return process_locations(pfc::list_single_ref_t<const char*>(url),out,filter,p_mask,p_exclude,p_parentwnd);
+}
+
+void playlist_manager::playlist_clear(t_size p_playlist)
+{
+ playlist_remove_items(p_playlist,bit_array_true());
+}
+
+void playlist_manager::activeplaylist_clear()
+{
+ t_size playlist = get_active_playlist();
+ if (playlist != pfc_infinite) playlist_clear(playlist);
+}
+
+bool playlist_manager::playlist_update_content(t_size playlist, metadb_handle_list_cref content, bool bUndoBackup) {
+ metadb_handle_list old;
+ playlist_get_all_items(playlist, old);
+ if (old.get_size() == 0) {
+ if (content.get_size() == 0) return false;
+ if (bUndoBackup) playlist_undo_backup(playlist);
+ playlist_add_items(playlist, content, bit_array_false());
+ return true;
+ }
+ pfc::avltree_t<metadb_handle::nnptr> itemsOld, itemsNew;
+
+ for(t_size walk = 0; walk < old.get_size(); ++walk) itemsOld += old[walk];
+ for(t_size walk = 0; walk < content.get_size(); ++walk) itemsNew += content[walk];
+ bit_array_bittable removeMask(old.get_size());
+ bit_array_bittable filterMask(content.get_size());
+ bool gotNew = false, filterNew = false, gotRemove = false;
+ for(t_size walk = 0; walk < content.get_size(); ++walk) {
+ const bool state = !itemsOld.have_item(content[walk]);
+ if (state) gotNew = true;
+ else filterNew = true;
+ filterMask.set(walk, state);
+ }
+ for(t_size walk = 0; walk < old.get_size(); ++walk) {
+ const bool state = !itemsNew.have_item(old[walk]);
+ if (state) gotRemove = true;
+ removeMask.set(walk, state);
+ }
+ if (!gotNew && !gotRemove) return false;
+ if (bUndoBackup) playlist_undo_backup(playlist);
+ if (gotRemove) {
+ playlist_remove_items(playlist, removeMask);
+ }
+ if (gotNew) {
+ if (filterNew) {
+ metadb_handle_list temp(content);
+ temp.filter_mask(filterMask);
+ playlist_add_items(playlist, temp, bit_array_false());
+ } else {
+ playlist_add_items(playlist, content, bit_array_false());
+ }
+ }
+ return true;
+}
+bool playlist_manager::playlist_add_items(t_size playlist,const pfc::list_base_const_t<metadb_handle_ptr> & data,const bit_array & p_selection)
+{
+ return playlist_insert_items(playlist,pfc_infinite,data,p_selection) != pfc_infinite;
+}
+
+bool playlist_manager::activeplaylist_add_items(const pfc::list_base_const_t<metadb_handle_ptr> & data,const bit_array & p_selection)
+{
+ t_size playlist = get_active_playlist();
+ if (playlist != pfc_infinite) return playlist_add_items(playlist,data,p_selection);
+ else return false;
+}
+
+bool playlist_manager::playlist_insert_items_filter(t_size p_playlist,t_size p_base,const pfc::list_base_const_t<metadb_handle_ptr> & p_data,bool p_select)
+{
+ metadb_handle_list temp;
+ static_api_ptr_t<playlist_incoming_item_filter> api;
+ if (!api->filter_items(p_data,temp))
+ return false;
+ return playlist_insert_items(p_playlist,p_base,temp,bit_array_val(p_select)) != pfc_infinite;
+}
+
+bool playlist_manager::activeplaylist_insert_items_filter(t_size p_base,const pfc::list_base_const_t<metadb_handle_ptr> & p_data,bool p_select)
+{
+ t_size playlist = get_active_playlist();
+ if (playlist != pfc_infinite) return playlist_insert_items_filter(playlist,p_base,p_data,p_select);
+ else return false;
+}
+
+bool playlist_manager::playlist_insert_locations(t_size p_playlist,t_size p_base,const pfc::list_base_const_t<const char*> & p_urls,bool p_select,HWND p_parentwnd)
+{
+ metadb_handle_list temp;
+ static_api_ptr_t<playlist_incoming_item_filter> api;
+ if (!api->process_locations(p_urls,temp,true,0,0,p_parentwnd)) return false;
+ return playlist_insert_items(p_playlist,p_base,temp,bit_array_val(p_select)) != pfc_infinite;
+}
+
+bool playlist_manager::activeplaylist_insert_locations(t_size p_base,const pfc::list_base_const_t<const char*> & p_urls,bool p_select,HWND p_parentwnd)
+{
+ t_size playlist = get_active_playlist();
+ if (playlist != pfc_infinite) return playlist_insert_locations(playlist,p_base,p_urls,p_select,p_parentwnd);
+ else return false;
+}
+
+bool playlist_manager::playlist_add_items_filter(t_size p_playlist,const pfc::list_base_const_t<metadb_handle_ptr> & p_data,bool p_select)
+{
+ return playlist_insert_items_filter(p_playlist,pfc_infinite,p_data,p_select);
+}
+
+bool playlist_manager::activeplaylist_add_items_filter(const pfc::list_base_const_t<metadb_handle_ptr> & p_data,bool p_select)
+{
+ return activeplaylist_insert_items_filter(pfc_infinite,p_data,p_select);
+}
+
+bool playlist_manager::playlist_add_locations(t_size p_playlist,const pfc::list_base_const_t<const char*> & p_urls,bool p_select,HWND p_parentwnd)
+{
+ return playlist_insert_locations(p_playlist,pfc_infinite,p_urls,p_select,p_parentwnd);
+}
+bool playlist_manager::activeplaylist_add_locations(const pfc::list_base_const_t<const char*> & p_urls,bool p_select,HWND p_parentwnd)
+{
+ return activeplaylist_insert_locations(pfc_infinite,p_urls,p_select,p_parentwnd);
+}
+
+void playlist_manager::reset_playing_playlist()
+{
+ set_playing_playlist(get_active_playlist());
+}
+
+void playlist_manager::playlist_clear_selection(t_size p_playlist)
+{
+ playlist_set_selection(p_playlist,bit_array_true(),bit_array_false());
+}
+
+void playlist_manager::activeplaylist_clear_selection()
+{
+ t_size playlist = get_active_playlist();
+ if (playlist != pfc_infinite) playlist_clear_selection(playlist);
+}
+
+void playlist_manager::activeplaylist_undo_backup()
+{
+ t_size playlist = get_active_playlist();
+ if (playlist != pfc_infinite) playlist_undo_backup(playlist);
+}
+
+bool playlist_manager::activeplaylist_undo_restore()
+{
+ t_size playlist = get_active_playlist();
+ if (playlist != pfc_infinite) return playlist_undo_restore(playlist);
+ else return false;
+}
+
+bool playlist_manager::activeplaylist_redo_restore()
+{
+ t_size playlist = get_active_playlist();
+ if (playlist != pfc_infinite) return playlist_redo_restore(playlist);
+ else return false;
+}
+
+void playlist_manager::playlist_remove_selection(t_size p_playlist,bool p_crop)
+{
+ bit_array_bittable table(playlist_get_item_count(p_playlist));
+ playlist_get_selection_mask(p_playlist,table);
+ if (p_crop) playlist_remove_items(p_playlist,bit_array_not(table));
+ else playlist_remove_items(p_playlist,table);
+}
+
+void playlist_manager::activeplaylist_remove_selection(bool p_crop)
+{
+ t_size playlist = get_active_playlist();
+ if (playlist != pfc_infinite) playlist_remove_selection(playlist,p_crop);
+}
+
+void playlist_manager::activeplaylist_item_format_title(t_size p_item,titleformat_hook * p_hook,pfc::string_base & out,const service_ptr_t<titleformat_object> & p_script,titleformat_text_filter * p_filter,play_control::t_display_level p_playback_info_level)
+{
+ t_size playlist = get_active_playlist();
+ if (playlist == pfc_infinite) out = "NJET";
+ else playlist_item_format_title(playlist,p_item,p_hook,out,p_script,p_filter,p_playback_info_level);
+}
+
+void playlist_manager::playlist_set_selection_single(t_size p_playlist,t_size p_item,bool p_state)
+{
+ playlist_set_selection(p_playlist,bit_array_one(p_item),bit_array_val(p_state));
+}
+
+void playlist_manager::activeplaylist_set_selection_single(t_size p_item,bool p_state)
+{
+ t_size playlist = get_active_playlist();
+ if (playlist != pfc_infinite) playlist_set_selection_single(playlist,p_item,p_state);
+}
+
+t_size playlist_manager::playlist_get_selection_count(t_size p_playlist,t_size p_max)
+{
+ enum_items_callback_count_selection callback(p_max);
+ playlist_enum_items(p_playlist,callback,bit_array_true());
+ return callback.get_count();
+}
+
+t_size playlist_manager::activeplaylist_get_selection_count(t_size p_max)
+{
+ t_size playlist = get_active_playlist();
+ if (playlist != pfc_infinite) return playlist_get_selection_count(playlist,p_max);
+ else return 0;
+}
+
+bool playlist_manager::playlist_get_focus_item_handle(metadb_handle_ptr & p_out,t_size p_playlist)
+{
+ t_size index = playlist_get_focus_item(p_playlist);
+ if (index == pfc_infinite) return false;
+ return playlist_get_item_handle(p_out,p_playlist,index);
+}
+
+bool playlist_manager::activeplaylist_get_focus_item_handle(metadb_handle_ptr & p_out)
+{
+ t_size playlist = get_active_playlist();
+ if (playlist != pfc_infinite) return playlist_get_focus_item_handle(p_out,playlist);
+ else return false;
+}
+
+t_size playlist_manager::find_playlist(const char * p_name,t_size p_name_length)
+{
+ t_size n, m = get_playlist_count();
+ pfc::string_formatter temp;
+ for(n=0;n<m;n++) {
+ if (!playlist_get_name(n,temp)) break;
+ if (stricmp_utf8_ex(temp,temp.length(),p_name,p_name_length) == 0) return n;
+ }
+ return pfc_infinite;
+}
+
+t_size playlist_manager::find_or_create_playlist_unlocked(const char * p_name, t_size p_name_length) {
+ t_size n, m = get_playlist_count();
+ pfc::string_formatter temp;
+ for(n=0;n<m;n++) {
+ if (!playlist_lock_is_present(n) && playlist_get_name(n,temp)) {
+ if (stricmp_utf8_ex(temp,~0,p_name,p_name_length) == 0) return n;
+ }
+ }
+ return create_playlist(p_name,p_name_length,pfc_infinite);
+}
+t_size playlist_manager::find_or_create_playlist(const char * p_name,t_size p_name_length)
+{
+ t_size index = find_playlist(p_name,p_name_length);
+ if (index != pfc_infinite) return index;
+ return create_playlist(p_name,p_name_length,pfc_infinite);
+}
+
+t_size playlist_manager::create_playlist_autoname(t_size p_index) {
+ static const char new_playlist_text[] = "New Playlist";
+ if (find_playlist(new_playlist_text,pfc_infinite) == pfc_infinite) return create_playlist(new_playlist_text,pfc_infinite,p_index);
+ for(t_size walk = 2; ; walk++) {
+ pfc::string_fixed_t<64> namebuffer;
+ namebuffer << new_playlist_text << " (" << walk << ")";
+ if (find_playlist(namebuffer,pfc_infinite) == pfc_infinite) return create_playlist(namebuffer,pfc_infinite,p_index);
+ }
+}
+
+bool playlist_manager::activeplaylist_sort_by_format(const char * spec,bool p_sel_only)
+{
+ t_size playlist = get_active_playlist();
+ if (playlist != pfc_infinite) return playlist_sort_by_format(playlist,spec,p_sel_only);
+ else return false;
+}
+
+bool playlist_manager::highlight_playing_item()
+{
+ t_size playlist,item;
+ if (!get_playing_item_location(&playlist,&item)) return false;
+ set_active_playlist(playlist);
+ playlist_set_focus_item(playlist,item);
+ playlist_set_selection(playlist,bit_array_true(),bit_array_one(item));
+ playlist_ensure_visible(playlist,item);
+ return true;
+}
+
+void playlist_manager::playlist_get_items(t_size p_playlist,pfc::list_base_t<metadb_handle_ptr> & out,const bit_array & p_mask)
+{
+ playlist_enum_items(p_playlist,enum_items_callback_retrieve_all_items(out),p_mask);
+}
+
+void playlist_manager::activeplaylist_get_items(pfc::list_base_t<metadb_handle_ptr> & out,const bit_array & p_mask)
+{
+ t_size playlist = get_active_playlist();
+ if (playlist != pfc_infinite) playlist_get_items(playlist,out,p_mask);
+ else out.remove_all();
+}
+
+void playlist_manager::active_playlist_fix()
+{
+ t_size playlist = get_active_playlist();
+ if (playlist == pfc_infinite)
+ {
+ t_size max = get_playlist_count();
+ if (max == 0)
+ {
+ create_playlist_autoname();
+ }
+ set_active_playlist(0);
+ }
+}
+
+namespace {
+ class enum_items_callback_remove_list : public playlist_manager::enum_items_callback
+ {
+ const metadb_handle_list & m_data;
+ bit_array_var & m_table;
+ t_size m_found;
+ public:
+ enum_items_callback_remove_list(const metadb_handle_list & p_data,bit_array_var & p_table) : m_data(p_data), m_table(p_table), m_found(0) {}
+ bool on_item(t_size p_index,const metadb_handle_ptr & p_location,bool b_selected)
+ {
+ bool found = m_data.bsearch_by_pointer(p_location) != pfc_infinite;
+ m_table.set(p_index,found);
+ if (found) m_found++;
+ return true;
+ }
+
+ inline t_size get_found() const {return m_found;}
+ };
+}
+
+void playlist_manager::remove_items_from_all_playlists(const pfc::list_base_const_t<metadb_handle_ptr> & p_data)
+{
+ t_size playlist_num, playlist_max = get_playlist_count();
+ if (playlist_max != pfc_infinite)
+ {
+ metadb_handle_list temp;
+ temp.add_items(p_data);
+ temp.sort_by_pointer();
+ for(playlist_num = 0; playlist_num < playlist_max; playlist_num++ )
+ {
+ t_size playlist_item_count = playlist_get_item_count(playlist_num);
+ if (playlist_item_count == pfc_infinite) break;
+ bit_array_bittable table(playlist_item_count);
+ enum_items_callback_remove_list callback(temp,table);
+ playlist_enum_items(playlist_num,callback,bit_array_true());
+ if (callback.get_found()>0)
+ playlist_remove_items(playlist_num,table);
+ }
+ }
+}
+
+bool playlist_manager::get_all_items(pfc::list_base_t<metadb_handle_ptr> & out)
+{
+ t_size n, m = get_playlist_count();
+ if (m == pfc_infinite) return false;
+ enum_items_callback_retrieve_all_items callback(out);
+ for(n=0;n<m;n++)
+ {
+ playlist_enum_items(n,callback,bit_array_true());
+ }
+ return true;
+}
+
+t_uint32 playlist_manager::activeplaylist_lock_get_filter_mask()
+{
+ t_size playlist = get_active_playlist();
+ if (playlist == pfc_infinite) return ~0;
+ else return playlist_lock_get_filter_mask(playlist);
+}
+
+bool playlist_manager::activeplaylist_is_undo_available()
+{
+ t_size playlist = get_active_playlist();
+ if (playlist == pfc_infinite) return false;
+ else return playlist_is_undo_available(playlist);
+}
+
+bool playlist_manager::activeplaylist_is_redo_available()
+{
+ t_size playlist = get_active_playlist();
+ if (playlist == pfc_infinite) return false;
+ else return playlist_is_redo_available(playlist);
+}
+
+bool playlist_manager::remove_playlist_switch(t_size idx)
+{
+ bool need_switch = get_active_playlist() == idx;
+ if (remove_playlist(idx))
+ {
+ if (need_switch)
+ {
+ t_size total = get_playlist_count();
+ if (total > 0)
+ {
+ if (idx >= total) idx = total-1;
+ set_active_playlist(idx);
+ }
+ }
+ return true;
+ }
+ else return false;
+}
+
+
+
+bool t_playback_queue_item::operator==(const t_playback_queue_item & p_item) const
+{
+ return m_handle == p_item.m_handle && m_playlist == p_item.m_playlist && m_item == p_item.m_item;
+}
+
+bool t_playback_queue_item::operator!=(const t_playback_queue_item & p_item) const
+{
+ return m_handle != p_item.m_handle || m_playlist != p_item.m_playlist || m_item != p_item.m_item;
+}
+
+
+
+bool playlist_manager::activeplaylist_execute_default_action(t_size p_item) {
+ t_size idx = get_active_playlist();
+ if (idx == pfc_infinite) return false;
+ else return playlist_execute_default_action(idx,p_item);
+}
+
+namespace {
+ class completion_notify_dfd : public completion_notify {
+ public:
+ completion_notify_dfd(const pfc::list_base_const_t<metadb_handle_ptr> & p_data,service_ptr_t<process_locations_notify> p_notify) : m_data(p_data), m_notify(p_notify) {}
+ void on_completion(unsigned p_code) {
+ switch(p_code) {
+ case metadb_io::load_info_aborted:
+ m_notify->on_aborted();
+ break;
+ default:
+ m_notify->on_completion(m_data);
+ break;
+ }
+ }
+ private:
+ metadb_handle_list m_data;
+ service_ptr_t<process_locations_notify> m_notify;
+ };
+};
+
+void dropped_files_data_impl::to_handles_async_ex(t_uint32 p_op_flags,HWND p_parentwnd,service_ptr_t<process_locations_notify> p_notify) {
+ if (m_is_paths) {
+ static_api_ptr_t<playlist_incoming_item_filter_v2>()->process_locations_async(
+ m_paths,
+ p_op_flags,
+ NULL,
+ NULL,
+ p_parentwnd,
+ p_notify);
+ } else {
+ t_uint32 flags = 0;
+ if (p_op_flags & playlist_incoming_item_filter_v2::op_flag_background) flags |= metadb_io_v2::op_flag_background;
+ if (p_op_flags & playlist_incoming_item_filter_v2::op_flag_delay_ui) flags |= metadb_io_v2::op_flag_delay_ui;
+ static_api_ptr_t<metadb_io_v2>()->load_info_async(m_handles,metadb_io::load_info_default,p_parentwnd,flags,new service_impl_t<completion_notify_dfd>(m_handles,p_notify));
+ }
+}
+void dropped_files_data_impl::to_handles_async(bool p_filter,HWND p_parentwnd,service_ptr_t<process_locations_notify> p_notify) {
+ to_handles_async_ex(p_filter ? 0 : playlist_incoming_item_filter_v2::op_flag_no_filter,p_parentwnd,p_notify);
+}
+
+bool dropped_files_data_impl::to_handles(pfc::list_base_t<metadb_handle_ptr> & p_out,bool p_filter,HWND p_parentwnd) {
+ if (m_is_paths) {
+ return static_api_ptr_t<playlist_incoming_item_filter>()->process_locations(m_paths,p_out,p_filter,NULL,NULL,p_parentwnd);
+ } else {
+ if (static_api_ptr_t<metadb_io>()->load_info_multi(m_handles,metadb_io::load_info_default,p_parentwnd,true) == metadb_io::load_info_aborted) return false;
+ p_out = m_handles;
+ return true;
+ }
+}
+
+void playlist_manager::playlist_activate_delta(int p_delta) {
+ const t_size total = get_playlist_count();
+ if (total > 0) {
+ t_size active = get_active_playlist();
+
+ //clip p_delta to -(total-1)...(total-1) range
+ if (p_delta < 0) {
+ p_delta = - ( (-p_delta) % (t_ssize)total );
+ } else {
+ p_delta = p_delta % total;
+ }
+ if (p_delta != 0) {
+ if (active == pfc_infinite) {
+ //special case when no playlist is active
+ if (p_delta > 0) {
+ active = (t_size)(p_delta - 1);
+ } else {
+ active = (total + p_delta);//p_delta is negative
+ }
+ } else {
+ active = (t_size) (active + total + p_delta) % total;
+ }
+ set_active_playlist(active % total);
+ }
+ }
+}
+namespace {
+ class enum_items_callback_get_selected_count : public playlist_manager::enum_items_callback {
+ public:
+ enum_items_callback_get_selected_count() : m_found() {}
+ t_size get_count() const {return m_found;}
+ bool on_item(t_size p_index,const metadb_handle_ptr & p_location,bool b_selected) {
+ if (b_selected) m_found++;
+ return true;
+ }
+ private:
+ t_size m_found;
+ };
+}
+t_size playlist_manager::playlist_get_selected_count(t_size p_playlist,bit_array const & p_mask) {
+ enum_items_callback_get_selected_count callback;
+ playlist_enum_items(p_playlist,callback,p_mask);
+ return callback.get_count();
+}
+
+namespace {
+ class enum_items_callback_find_item : public playlist_manager::enum_items_callback {
+ public:
+ enum_items_callback_find_item(metadb_handle_ptr p_lookingFor) : m_result(pfc_infinite), m_lookingFor(p_lookingFor) {}
+ t_size result() const {return m_result;}
+ bool on_item(t_size p_index,const metadb_handle_ptr & p_location,bool b_selected) {
+ if (p_location == m_lookingFor) {
+ m_result = p_index;
+ return false;
+ } else {
+ return true;
+ }
+ }
+ private:
+ metadb_handle_ptr m_lookingFor;
+ t_size m_result;
+ };
+ class enum_items_callback_find_item_selected : public playlist_manager::enum_items_callback {
+ public:
+ enum_items_callback_find_item_selected(metadb_handle_ptr p_lookingFor) : m_result(pfc_infinite), m_lookingFor(p_lookingFor) {}
+ t_size result() const {return m_result;}
+ bool on_item(t_size p_index,const metadb_handle_ptr & p_location,bool b_selected) {
+ if (b_selected && p_location == m_lookingFor) {
+ m_result = p_index;
+ return false;
+ } else {
+ return true;
+ }
+ }
+ private:
+ metadb_handle_ptr m_lookingFor;
+ t_size m_result;
+ };
+}
+
+bool playlist_manager::playlist_find_item(t_size p_playlist,metadb_handle_ptr p_item,t_size & p_result) {
+ enum_items_callback_find_item callback(p_item);
+ playlist_enum_items(p_playlist,callback,bit_array_true());
+ t_size result = callback.result();
+ if (result == pfc_infinite) return false;
+ p_result = result;
+ return true;
+}
+bool playlist_manager::playlist_find_item_selected(t_size p_playlist,metadb_handle_ptr p_item,t_size & p_result) {
+ enum_items_callback_find_item_selected callback(p_item);
+ playlist_enum_items(p_playlist,callback,bit_array_true());
+ t_size result = callback.result();
+ if (result == pfc_infinite) return false;
+ p_result = result;
+ return true;
+}
+t_size playlist_manager::playlist_set_focus_by_handle(t_size p_playlist,metadb_handle_ptr p_item) {
+ t_size index;
+ if (!playlist_find_item(p_playlist,p_item,index)) index = pfc_infinite;
+ playlist_set_focus_item(p_playlist,index);
+ return index;
+}
+bool playlist_manager::activeplaylist_find_item(metadb_handle_ptr p_item,t_size & p_result) {
+ t_size playlist = get_active_playlist();
+ if (playlist == pfc_infinite) return false;
+ return playlist_find_item(playlist,p_item,p_result);
+}
+t_size playlist_manager::activeplaylist_set_focus_by_handle(metadb_handle_ptr p_item) {
+ t_size playlist = get_active_playlist();
+ if (playlist == pfc_infinite) return pfc_infinite;
+ return playlist_set_focus_by_handle(playlist,p_item);
+}
+
+pfc::com_ptr_t<interface IDataObject> playlist_incoming_item_filter::create_dataobject_ex(metadb_handle_list_cref data) {
+ pfc::com_ptr_t<interface IDataObject> temp; temp.attach( create_dataobject(data) ); PFC_ASSERT( temp.is_valid() ); return temp;
+}
+
+void playlist_manager_v3::recycler_restore_by_id(t_uint32 id) {
+ t_size which = recycler_find_by_id(id);
+ if (which != ~0) recycler_restore(which);
+}
+
+t_size playlist_manager_v3::recycler_find_by_id(t_uint32 id) {
+ const t_size total = recycler_get_count();
+ for(t_size walk = 0; walk < total; ++walk) {
+ if (id == recycler_get_id(walk)) return walk;
+ }
+ return ~0;
+}
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/playlist.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/playlist.h new file mode 100644 index 0000000000..0fef24da9e --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/playlist.h @@ -0,0 +1,873 @@ +//! This interface allows filtering of playlist modification operations.\n
+//! Implemented by components "locking" playlists; use playlist_manager::playlist_lock_install() etc to takeover specific playlist with your instance of playlist_lock.
+class NOVTABLE playlist_lock : public service_base {
+public:
+ enum {
+ filter_add = 1 << 0,
+ filter_remove = 1 << 1,
+ filter_reorder = 1 << 2,
+ filter_replace = 1 << 3,
+ filter_rename = 1 << 4,
+ filter_remove_playlist = 1 << 5,
+ filter_default_action = 1 << 6,
+ };
+
+ //! Queries whether specified item insertiion operation is allowed in the locked playlist.
+ //! @param p_base Index from which the items are being inserted.
+ //! @param p_data Items being inserted.
+ //! @param p_selection Caller-requested selection state of items being inserted.
+ //! @returns True to allow the operation, false to block it.
+ virtual bool query_items_add(t_size p_base, const pfc::list_base_const_t<metadb_handle_ptr> & p_data,const bit_array & p_selection) = 0;
+ //! Queries whether specified item reorder operation is allowed in the locked playlist.
+ //! @param p_order Pointer to array containing permutation defining requested reorder operation.
+ //! @param p_count Number of items in array pointed to by p_order. This should always be equal to number of items on the locked playlist.
+ //! @returns True to allow the operation, false to block it.
+ virtual bool query_items_reorder(const t_size * p_order,t_size p_count) = 0;
+ //! Queries whether specified item removal operation is allowed in the locked playlist.
+ //! @param p_mask Specifies which items from locked playlist are being removed.
+ //! @param p_force If set to true, the call is made only for notification purpose and items are getting removed regardless (after e.g. they have been physically removed).
+ //! @returns True to allow the operation, false to block it. Note that return value is ignored if p_force is set to true.
+ virtual bool query_items_remove(const bit_array & p_mask,bool p_force) = 0;
+ //! Queries whether specified item replacement operation is allowed in the locked playlist.
+ //! @param p_index Index of the item being replaced.
+ //! @param p_old Old value of the item being replaced.
+ //! @param p_new New value of the item being replaced.
+ //! @returns True to allow the operation, false to block it.
+ virtual bool query_item_replace(t_size p_index,const metadb_handle_ptr & p_old,const metadb_handle_ptr & p_new)=0;
+ //! Queries whether renaming the locked playlist is allowed.
+ //! @param p_new_name Requested new name of the playlist; a UTF-8 encoded string.
+ //! @param p_new_name_len Length limit of the name string, in bytes (actual string may be shorter if null terminator is encountered before). Set this to infinite to use plain null-terminated strings.
+ //! @returns True to allow the operation, false to block it.
+ virtual bool query_playlist_rename(const char * p_new_name,t_size p_new_name_len) = 0;
+ //! Queries whether removal of the locked playlist is allowed. Note that the lock will be released when the playlist is removed.
+ //! @returns True to allow the operation, false to block it.
+ virtual bool query_playlist_remove() = 0;
+ //! Executes "default action" (doubleclick etc) for specified playlist item. When the playlist is not locked, default action starts playback of the item.
+ //! @returns True if custom default action was executed, false to fall-through to default one for non-locked playlists (start playback).
+ virtual bool execute_default_action(t_size p_item) = 0;
+ //! Notifies lock about changed index of the playlist, in result of user reordering playlists or removing other playlists.
+ virtual void on_playlist_index_change(t_size p_new_index) = 0;
+ //! Notifies lock about the locked playlist getting removed.
+ virtual void on_playlist_remove() = 0;
+ //! Retrieves human-readable name of playlist lock to display.
+ virtual void get_lock_name(pfc::string_base & p_out) = 0;
+ //! Requests user interface of component controlling the playlist lock to be shown.
+ virtual void show_ui() = 0;
+ //! Queries which actions the lock filters. The return value must not change while the lock is registered with playlist_manager. The return value is a combination of one or more filter_* constants.
+ virtual t_uint32 get_filter_mask() = 0;
+
+ FB2K_MAKE_SERVICE_INTERFACE(playlist_lock,service_base);
+};
+
+struct t_playback_queue_item {
+ metadb_handle_ptr m_handle;
+ t_size m_playlist,m_item;
+
+ bool operator==(const t_playback_queue_item & p_item) const;
+ bool operator!=(const t_playback_queue_item & p_item) const;
+};
+
+
+//! This service provides methods for all sorts of playlist interaction.\n
+//! All playlist_manager methods are valid only from main app thread.\n
+//! Usage: static_api_ptr_t<playlist_manager>.
+class NOVTABLE playlist_manager : public service_base
+{
+public:
+
+ //! Callback interface for playlist enumeration methods.
+ class NOVTABLE enum_items_callback {
+ public:
+ //! @returns True to continue enumeration, false to abort.
+ virtual bool on_item(t_size p_index,const metadb_handle_ptr & p_location,bool b_selected) = 0;//return false to stop
+ };
+
+ //! Retrieves number of playlists.
+ virtual t_size get_playlist_count() = 0;
+ //! Retrieves index of active playlist; infinite if no playlist is active.
+ virtual t_size get_active_playlist() = 0;
+ //! Sets active playlist (infinite to set no active playlist).
+ virtual void set_active_playlist(t_size p_index) = 0;
+ //! Retrieves playlist from which items to be played are taken from.
+ virtual t_size get_playing_playlist() = 0;
+ //! Sets playlist from which items to be played are taken from.
+ virtual void set_playing_playlist(t_size p_index) = 0;
+ //! Removes playlists according to specified mask. See also: bit_array.
+ virtual bool remove_playlists(const bit_array & p_mask) = 0;
+ //! Creates a new playlist.
+ //! @param p_name Name of playlist to create; a UTF-8 encoded string.
+ //! @param p_name_length Length limit of playlist name string, in bytes (actual string may be shorter if null terminator is encountered before). Set this to infinite to use plain null-terminated strings.
+ //! @param p_index Index at which to insert new playlist; set to infinite to put it at the end of playlist list.
+ //! @returns Actual index of newly inserted playlist, infinite on failure (call from invalid context).
+ virtual t_size create_playlist(const char * p_name,t_size p_name_length,t_size p_index) = 0;
+ //! Reorders the playlist list according to specified permutation.
+ //! @returns True on success, false on failure (call from invalid context).
+ virtual bool reorder(const t_size * p_order,t_size p_count) = 0;
+
+
+ //! Retrieves number of items on specified playlist.
+ virtual t_size playlist_get_item_count(t_size p_playlist) = 0;
+ //! Enumerates contents of specified playlist.
+ virtual void playlist_enum_items(t_size p_playlist,enum_items_callback & p_callback,const bit_array & p_mask) = 0;
+ //! Retrieves index of focus item on specified playlist; returns infinite when no item has focus.
+ virtual t_size playlist_get_focus_item(t_size p_playlist) = 0;
+ //! Retrieves name of specified playlist. Should never fail unless the parameters are invalid.
+ virtual bool playlist_get_name(t_size p_playlist,pfc::string_base & p_out) = 0;
+
+ //! Reorders items in specified playlist according to specified permutation.
+ virtual bool playlist_reorder_items(t_size p_playlist,const t_size * p_order,t_size p_count) = 0;
+ //! Selects/deselects items on specified playlist.
+ //! @param p_playlist Index of playlist to alter.
+ //! @param p_affected Mask of items to alter.
+ //! @param p_status Mask of selected/deselected state to apply to items specified by p_affected.
+ virtual void playlist_set_selection(t_size p_playlist,const bit_array & p_affected,const bit_array & p_status) = 0;
+ //! Removes specified items from specified playlist. Returns true on success or false on failure (playlist locked).
+ virtual bool playlist_remove_items(t_size p_playlist,const bit_array & mask)=0;
+ //! Replaces specified item on specified playlist. Returns true on success or false on failure (playlist locked).
+ virtual bool playlist_replace_item(t_size p_playlist,t_size p_item,const metadb_handle_ptr & p_new_item) = 0;
+ //! Sets index of focus item on specified playlist; use infinite to set no focus item.
+ virtual void playlist_set_focus_item(t_size p_playlist,t_size p_item) = 0;
+ //! Inserts new items into specified playlist, at specified position.
+ virtual t_size playlist_insert_items(t_size p_playlist,t_size p_base,const pfc::list_base_const_t<metadb_handle_ptr> & data,const bit_array & p_selection) = 0;
+ //! Tells playlist renderers to make sure that specified item is visible.
+ virtual void playlist_ensure_visible(t_size p_playlist,t_size p_item) = 0;
+ //! Renames specified playlist.
+ //! @param p_name New name of playlist; a UTF-8 encoded string.
+ //! @param p_name_length Length limit of playlist name string, in bytes (actual string may be shorter if null terminator is encountered before). Set this to infinite to use plain null-terminated strings.
+ //! @returns True on success, false on failure (playlist locked).
+ virtual bool playlist_rename(t_size p_index,const char * p_name,t_size p_name_length) = 0;
+
+
+ //! Creates an undo restore point for specified playlist.
+ virtual void playlist_undo_backup(t_size p_playlist) = 0;
+ //! Reverts specified playlist to last undo restore point and generates a redo restore point.
+ //! @returns True on success, false on failure (playlist locked or no restore point available).
+ virtual bool playlist_undo_restore(t_size p_playlist) = 0;
+ //! Reverts specified playlist to next redo restore point and generates an undo restore point.
+ //! @returns True on success, false on failure (playlist locked or no restore point available).
+ virtual bool playlist_redo_restore(t_size p_playlist) = 0;
+ //! Returns whether an undo restore point is available for specified playlist.
+ virtual bool playlist_is_undo_available(t_size p_playlist) = 0;
+ //! Returns whether a redo restore point is available for specified playlist.
+ virtual bool playlist_is_redo_available(t_size p_playlist) = 0;
+
+ //! Renders information about specified playlist item, using specified titleformatting script parameters.
+ //! @param p_playlist Index of playlist containing item being processed.
+ //! @param p_item Index of item being processed in the playlist containing it.
+ //! @param p_hook Titleformatting script hook to use; see titleformat_hook documentation for more info. Set to NULL when hook functionality is not needed.
+ //! @param p_out String object receiving results.
+ //! @param p_script Compiled titleformatting script to use; see titleformat_object cocumentation for more info.
+ //! @param p_filter Text filter to use; see titleformat_text_filter documentation for more info. Set to NULL when text filter functionality is not needed.
+ //! @param p_playback_info_level Level of playback related information requested. See playback_control::t_display_level documentation for more info.
+ virtual void playlist_item_format_title(t_size p_playlist,t_size p_item,titleformat_hook * p_hook,pfc::string_base & p_out,const service_ptr_t<titleformat_object> & p_script,titleformat_text_filter * p_filter,playback_control::t_display_level p_playback_info_level)=0;
+
+
+ //! Retrieves playlist position of currently playing item.
+ //! @param p_playlist Receives index of playlist containing currently playing item on success.
+ //! @param p_index Receives index of currently playing item in the playlist that contains it on success.
+ //! @returns True on success, false on failure (not playing or currently played item has been removed from the playlist it was on when starting).
+ virtual bool get_playing_item_location(t_size * p_playlist,t_size * p_index) = 0;
+
+ //! Sorts specified playlist - entire playlist or selection only - by specified title formatting pattern, or randomizes the order.
+ //! @param p_playlist Index of playlist to alter.
+ //! @param p_pattern Title formatting pattern to sort by (an UTF-8 encoded null-termindated string). Set to NULL to randomize the order of items.
+ //! @param p_sel_only Set to false to sort/randomize whole playlist, or to true to sort/randomize only selection on the playlist.
+ //! @returns True on success, false on failure (playlist locked etc).
+ virtual bool playlist_sort_by_format(t_size p_playlist,const char * p_pattern,bool p_sel_only) = 0;
+
+ //! For internal use only; p_items must be sorted by metadb::path_compare; use file_operation_callback static methods instead of calling this directly.
+ virtual void on_files_deleted_sorted(const pfc::list_base_const_t<const char *> & p_items) = 0;
+ //! For internal use only; p_from must be sorted by metadb::path_compare; use file_operation_callback static methods instead of calling this directly.
+ virtual void on_files_moved_sorted(const pfc::list_base_const_t<const char *> & p_from,const pfc::list_base_const_t<const char *> & p_to) = 0;
+
+ virtual bool playlist_lock_install(t_size p_playlist,const service_ptr_t<playlist_lock> & p_lock) = 0;//returns false when invalid playlist or already locked
+ virtual bool playlist_lock_uninstall(t_size p_playlist,const service_ptr_t<playlist_lock> & p_lock) = 0;
+ virtual bool playlist_lock_is_present(t_size p_playlist) = 0;
+ virtual bool playlist_lock_query_name(t_size p_playlist,pfc::string_base & p_out) = 0;
+ virtual bool playlist_lock_show_ui(t_size p_playlist) = 0;
+ virtual t_uint32 playlist_lock_get_filter_mask(t_size p_playlist) = 0;
+
+
+ //! Retrieves number of available playback order modes.
+ virtual t_size playback_order_get_count() = 0;
+ //! Retrieves name of specified playback order move.
+ //! @param p_index Index of playback order mode to query, from 0 to playback_order_get_count() return value - 1.
+ //! @returns Null-terminated UTF-8 encoded string containing name of the playback order mode. Returned pointer points to statically allocated string and can be safely stored without having to free it later.
+ virtual const char * playback_order_get_name(t_size p_index) = 0;
+ //! Retrieves GUID of specified playback order mode. Used for managing playback modes without relying on names.
+ //! @param p_index Index of playback order mode to query, from 0 to playback_order_get_count() return value - 1.
+ virtual GUID playback_order_get_guid(t_size p_index) = 0;
+ //! Retrieves index of active playback order mode.
+ virtual t_size playback_order_get_active() = 0;
+ //! Sets index of active playback order mode.
+ virtual void playback_order_set_active(t_size p_index) = 0;
+
+ virtual void queue_remove_mask(bit_array const & p_mask) = 0;
+ virtual void queue_add_item_playlist(t_size p_playlist,t_size p_item) = 0;
+ virtual void queue_add_item(metadb_handle_ptr p_item) = 0;
+ virtual t_size queue_get_count() = 0;
+ virtual void queue_get_contents(pfc::list_base_t<t_playback_queue_item> & p_out) = 0;
+ //! Returns index (0-based) on success, infinite on failure (item not in queue).
+ virtual t_size queue_find_index(t_playback_queue_item const & p_item) = 0;
+
+ //! Registers a playlist callback; registered object receives notifications about any modifications of any of loaded playlists.
+ //! @param p_callback Callback interface to register.
+ //! @param p_flags Flags indicating which callback methods are requested. See playlist_callback::flag_* constants for more info. The main purpose of flags parameter is working set optimization by not calling methods that do nothing.
+ virtual void register_callback(class playlist_callback * p_callback,unsigned p_flags) = 0;
+ //! Registers a playlist callback; registered object receives notifications about any modifications of active playlist.
+ //! @param p_callback Callback interface to register.
+ //! @param p_flags Flags indicating which callback methods are requested. See playlist_callback_single::flag_* constants for more info. The main purpose of flags parameter is working set optimization by not calling methods that do nothing.
+ virtual void register_callback(class playlist_callback_single * p_callback,unsigned p_flags) = 0;
+ //! Unregisters a playlist callback (playlist_callback version).
+ virtual void unregister_callback(class playlist_callback * p_callback) = 0;
+ //! Unregisters a playlist callback (playlist_callback_single version).
+ virtual void unregister_callback(class playlist_callback_single * p_callback) = 0;
+ //! Modifies flags indicating which calback methods are requested (playlist_callback version).
+ virtual void modify_callback(class playlist_callback * p_callback,unsigned p_flags) = 0;
+ //! Modifies flags indicating which calback methods are requested (playlist_callback_single version).
+ virtual void modify_callback(class playlist_callback_single * p_callback,unsigned p_flags) = 0;
+
+ //! Executes default doubleclick/enter action for specified item on specified playlist (starts playing the item unless overridden by a lock to do something else).
+ virtual bool playlist_execute_default_action(t_size p_playlist,t_size p_item) = 0;
+
+
+ //! Helper; removes all items from the playback queue.
+ void queue_flush() {queue_remove_mask(bit_array_true());}
+ //! Helper; returns whether there are items in the playback queue.
+ bool queue_is_active() {return queue_get_count() > 0;}
+
+ //! Helper; highlights currently playing item; returns true on success or false on failure (not playing or currently played item has been removed from playlist since playback started).
+ bool highlight_playing_item();
+ //! Helper; removes single playlist of specified index.
+ bool remove_playlist(t_size p_playlist);
+ //! Helper; removes single playlist of specified index, and switches to another playlist when possible.
+ bool remove_playlist_switch(t_size p_playlist);
+
+ //! Helper; returns whether specified item on specified playlist is selected or not.
+ bool playlist_is_item_selected(t_size p_playlist,t_size p_item);
+ //! Helper; retrieves metadb_handle of the specified playlist item. Returns true on success, false on failure (invalid parameters).
+ bool playlist_get_item_handle(metadb_handle_ptr & p_out,t_size p_playlist,t_size p_item);
+ //! Helper; retrieves metadb_handle of the specified playlist item; throws pfc::exception_invalid_params() on failure.
+ metadb_handle_ptr playlist_get_item_handle(t_size playlist, t_size item);
+
+ //! Moves selected items up/down in the playlist by specified offset.
+ //! @param p_playlist Index of playlist to alter.
+ //! @param p_delta Offset to move items by. Set it to a negative valuye to move up, or to a positive value to move down.
+ //! @returns True on success, false on failure (e.g. playlist locked).
+ bool playlist_move_selection(t_size p_playlist,int p_delta);
+ //! Retrieves selection map of specific playlist, using bit_array_var interface.
+ void playlist_get_selection_mask(t_size p_playlist,bit_array_var & out);
+ void playlist_get_items(t_size p_playlist,pfc::list_base_t<metadb_handle_ptr> & out,const bit_array & p_mask);
+ void playlist_get_all_items(t_size p_playlist,pfc::list_base_t<metadb_handle_ptr> & out);
+ void playlist_get_selected_items(t_size p_playlist,pfc::list_base_t<metadb_handle_ptr> & out);
+
+ //! Clears contents of specified playlist (removes all items from it).
+ void playlist_clear(t_size p_playlist);
+ bool playlist_add_items(t_size playlist,const pfc::list_base_const_t<metadb_handle_ptr> & data,const bit_array & p_selection);
+ void playlist_clear_selection(t_size p_playlist);
+ void playlist_remove_selection(t_size p_playlist,bool p_crop = false);
+
+
+ //! Changes contents of the specified playlist to the specified items, trying to reuse existing playlist content as much as possible (preserving selection/focus/etc). Order of items in playlist not guaranteed to be the same as in the specified item list.
+ //! @returns true if the playlist has been altered, false if there was nothing to update.
+ bool playlist_update_content(t_size playlist, metadb_handle_list_cref content, bool bUndoBackup);
+
+ //retrieving status
+ t_size activeplaylist_get_item_count();
+ void activeplaylist_enum_items(enum_items_callback & p_callback,const bit_array & p_mask);
+ t_size activeplaylist_get_focus_item();//focus may be infinite if no item is focused
+ bool activeplaylist_get_name(pfc::string_base & p_out);
+
+ //modifying playlist
+ bool activeplaylist_reorder_items(const t_size * order,t_size count);
+ void activeplaylist_set_selection(const bit_array & affected,const bit_array & status);
+ bool activeplaylist_remove_items(const bit_array & mask);
+ bool activeplaylist_replace_item(t_size p_item,const metadb_handle_ptr & p_new_item);
+ void activeplaylist_set_focus_item(t_size p_item);
+ t_size activeplaylist_insert_items(t_size p_base,const pfc::list_base_const_t<metadb_handle_ptr> & data,const bit_array & p_selection);
+ void activeplaylist_ensure_visible(t_size p_item);
+ bool activeplaylist_rename(const char * p_name,t_size p_name_len);
+
+ void activeplaylist_undo_backup();
+ bool activeplaylist_undo_restore();
+ bool activeplaylist_redo_restore();
+
+ bool activeplaylist_is_item_selected(t_size p_item);
+ bool activeplaylist_get_item_handle(metadb_handle_ptr & item,t_size p_item);
+ metadb_handle_ptr activeplaylist_get_item_handle(t_size p_item);
+ void activeplaylist_move_selection(int p_delta);
+ void activeplaylist_get_selection_mask(bit_array_var & out);
+ void activeplaylist_get_items(pfc::list_base_t<metadb_handle_ptr> & out,const bit_array & p_mask);
+ void activeplaylist_get_all_items(pfc::list_base_t<metadb_handle_ptr> & out);
+ void activeplaylist_get_selected_items(pfc::list_base_t<metadb_handle_ptr> & out);
+ void activeplaylist_clear();
+
+ bool activeplaylist_add_items(const pfc::list_base_const_t<metadb_handle_ptr> & data,const bit_array & p_selection);
+
+ bool playlist_insert_items_filter(t_size p_playlist,t_size p_base,const pfc::list_base_const_t<metadb_handle_ptr> & p_data,bool p_select);
+ bool activeplaylist_insert_items_filter(t_size p_base,const pfc::list_base_const_t<metadb_handle_ptr> & p_data,bool p_select);
+
+ //! \deprecated (since 0.9.3) Use playlist_incoming_item_filter_v2::process_locations_async whenever possible
+ bool playlist_insert_locations(t_size p_playlist,t_size p_base,const pfc::list_base_const_t<const char*> & p_urls,bool p_select,HWND p_parentwnd);
+ //! \deprecated (since 0.9.3) Use playlist_incoming_item_filter_v2::process_locations_async whenever possible
+ bool activeplaylist_insert_locations(t_size p_base,const pfc::list_base_const_t<const char*> & p_urls,bool p_select,HWND p_parentwnd);
+
+ bool playlist_add_items_filter(t_size p_playlist,const pfc::list_base_const_t<metadb_handle_ptr> & p_data,bool p_select);
+ bool activeplaylist_add_items_filter(const pfc::list_base_const_t<metadb_handle_ptr> & p_data,bool p_select);
+
+ bool playlist_add_locations(t_size p_playlist,const pfc::list_base_const_t<const char*> & p_urls,bool p_select,HWND p_parentwnd);
+ bool activeplaylist_add_locations(const pfc::list_base_const_t<const char*> & p_urls,bool p_select,HWND p_parentwnd);
+
+ void reset_playing_playlist();
+
+ void activeplaylist_clear_selection();
+ void activeplaylist_remove_selection(bool p_crop = false);
+
+ void activeplaylist_item_format_title(t_size p_item,titleformat_hook * p_hook,pfc::string_base & out,const service_ptr_t<titleformat_object> & p_script,titleformat_text_filter * p_filter,play_control::t_display_level p_playback_info_level);
+
+ void playlist_set_selection_single(t_size p_playlist,t_size p_item,bool p_state);
+ void activeplaylist_set_selection_single(t_size p_item,bool p_state);
+
+ t_size playlist_get_selection_count(t_size p_playlist,t_size p_max);
+ t_size activeplaylist_get_selection_count(t_size p_max);
+
+ bool playlist_get_focus_item_handle(metadb_handle_ptr & p_item,t_size p_playlist);
+ bool activeplaylist_get_focus_item_handle(metadb_handle_ptr & item);
+
+ t_size find_playlist(const char * p_name,t_size p_name_length = ~0);
+ t_size find_or_create_playlist(const char * p_name,t_size p_name_length = ~0);
+ t_size find_or_create_playlist_unlocked(const char * p_name,t_size p_name_length = ~0);
+
+ t_size create_playlist_autoname(t_size p_index = ~0);
+
+ bool activeplaylist_sort_by_format(const char * spec,bool p_sel_only);
+
+ t_uint32 activeplaylist_lock_get_filter_mask();
+ bool activeplaylist_is_undo_available();
+ bool activeplaylist_is_redo_available();
+
+ bool activeplaylist_execute_default_action(t_size p_item);
+
+ void remove_items_from_all_playlists(const pfc::list_base_const_t<metadb_handle_ptr> & p_data);
+
+ void active_playlist_fix();
+
+ bool get_all_items(pfc::list_base_t<metadb_handle_ptr> & out);
+
+ void playlist_activate_delta(int p_delta);
+ void playlist_activate_next() {playlist_activate_delta(1);}
+ void playlist_activate_previous() {playlist_activate_delta(-1);}
+
+
+ t_size playlist_get_selected_count(t_size p_playlist,bit_array const & p_mask);
+ t_size activeplaylist_get_selected_count(bit_array const & p_mask) {return playlist_get_selected_count(get_active_playlist(),p_mask);}
+
+ bool playlist_find_item(t_size p_playlist,metadb_handle_ptr p_item,t_size & p_result);//inefficient, walks entire playlist
+ bool playlist_find_item_selected(t_size p_playlist,metadb_handle_ptr p_item,t_size & p_result);//inefficient, walks entire playlist
+ t_size playlist_set_focus_by_handle(t_size p_playlist,metadb_handle_ptr p_item);
+ bool activeplaylist_find_item(metadb_handle_ptr p_item,t_size & p_result);//inefficient, walks entire playlist
+ t_size activeplaylist_set_focus_by_handle(metadb_handle_ptr p_item);
+
+ static void g_make_selection_move_permutation(t_size * p_output,t_size p_count,const bit_array & p_selection,int p_delta);
+
+ FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(playlist_manager);
+};
+
+//! Extension of the playlist_manager service that manages playlist properties.
+//! Playlist properties come in two flavors: persistent and runtime.
+//! Persistent properties are blocks of binary that that will be preserved when the application is exited and restarted.
+//! Runtime properties are service pointers that will be lost when the application exits.
+//! \since 0.9.5
+class NOVTABLE playlist_manager_v2 : public playlist_manager {
+public:
+ //! Write a persistent playlist property.
+ //! \param p_playlist Index of the playlist
+ //! \param p_property GUID that identifies the property
+ //! \param p_stream stream that contains the data that will be associated with the property
+ //! \param p_abort abort_callback that will be used when reading from p_stream
+ virtual void playlist_set_property(t_size p_playlist,const GUID & p_property,stream_reader * p_stream,t_size p_size_hint,abort_callback & p_abort) = 0;
+ //! Read a persistent playlist property.
+ //! \param p_playlist Index of the playlist
+ //! \param p_property GUID that identifies the property
+ //! \param p_stream stream that will receive the stored data
+ //! \param p_abort abort_callback that will be used when writing to p_stream
+ //! \return true if the property exists, false otherwise
+ virtual bool playlist_get_property(t_size p_playlist,const GUID & p_property,stream_writer * p_stream,abort_callback & p_abort) = 0;
+ //! Test existence of a persistent playlist property.
+ //! \param p_playlist Index of the playlist
+ //! \param p_property GUID that identifies the property
+ //! \return true if the property exists, false otherwise
+ virtual bool playlist_have_property(t_size p_playlist,const GUID & p_property) = 0;
+ //! Remove a persistent playlist property.
+ //! \param p_playlist Index of the playlist
+ //! \param p_property GUID that identifies the property
+ //! \return true if the property existed, false otherwise
+ virtual bool playlist_remove_property(t_size p_playlist,const GUID & p_property) = 0;
+
+ //! Write a runtime playlist property.
+ //! \param p_playlist Index of the playlist
+ //! \param p_property GUID that identifies the property
+ //! \param p_data service pointer that will be associated with the property
+ virtual void playlist_set_runtime_property(t_size p_playlist,const GUID & p_property,service_ptr_t<service_base> p_data) = 0;
+ //! Read a runtime playlist property.
+ //! \param p_playlist Index of the playlist
+ //! \param p_property GUID that identifies the property
+ //! \param p_data base service pointer reference that will receive the stored servive pointer
+ //! \return true if the property exists, false otherwise
+ virtual bool playlist_get_runtime_property(t_size p_playlist,const GUID & p_property,service_ptr_t<service_base> & p_data) = 0;
+ //! Test existence of a runtime playlist property.
+ //! \param p_playlist Index of the playlist
+ //! \param p_property GUID that identifies the property
+ //! \return true if the property exists, false otherwise
+ virtual bool playlist_have_runtime_property(t_size p_playlist,const GUID & p_property) = 0;
+ //! Remove a runtime playlist property.
+ //! \param p_playlist Index of the playlist
+ //! \param p_property GUID that identifies the property
+ //! \return true if the property existed, false otherwise
+ virtual bool playlist_remove_runtime_property(t_size p_playlist,const GUID & p_property) = 0;
+
+ //! Write a persistent playlist property.
+ //! \param p_playlist Index of the playlist
+ //! \param p_property GUID that identifies the property
+ //! \param p_data array that contains the data that will be associated with the property
+ template<typename t_array> void playlist_set_property(t_size p_playlist,const GUID & p_property,const t_array & p_data) {
+ PFC_STATIC_ASSERT( sizeof(p_data[0]) == 1 );
+ playlist_set_property(p_playlist,p_property,&stream_reader_memblock_ref(p_data),p_data.get_size(),abort_callback_dummy());
+ }
+ //! Read a persistent playlist property.
+ //! \param p_playlist Index of the playlist
+ //! \param p_property GUID that identifies the property
+ //! \param p_data array that will receive the stored data
+ //! \return true if the property exists, false otherwise
+ template<typename t_array> bool playlist_get_property(t_size p_playlist,const GUID & p_property,t_array & p_data) {
+ PFC_STATIC_ASSERT( sizeof(p_data[0]) == 1 );
+ typedef pfc::array_t<t_uint8,pfc::alloc_fast_aggressive> t_temp;
+ t_temp temp;
+ if (!playlist_get_property(p_playlist,p_property,&stream_writer_buffer_append_ref_t<t_temp>(temp),abort_callback_dummy())) return false;
+ p_data = temp;
+ return true;
+ }
+ //! Read a runtime playlist property.
+ //! \param p_playlist Index of the playlist
+ //! \param p_property GUID that identifies the property
+ //! \param p_data specific service pointer reference that will receive the stored servive pointer
+ //! \return true if the property exists and can be converted to the type of p_data, false otherwise
+ template<typename _t_interface> bool playlist_get_runtime_property(t_size p_playlist,const GUID & p_property,service_ptr_t<_t_interface> & p_data) {
+ service_ptr_t<service_base> ptr;
+ if (!playlist_get_runtime_property(p_playlist,p_property,ptr)) return false;
+ return ptr->service_query_t(p_data);
+ }
+
+ //! Write a persistent playlist property.
+ //! \param p_playlist Index of the playlist
+ //! \param p_property GUID that identifies the property
+ //! \param p_value integer that will be associated with the property
+ template<typename _t_int>
+ void playlist_set_property_int(t_size p_playlist,const GUID & p_property,_t_int p_value) {
+ pfc::array_t<t_uint8> temp; temp.set_size(sizeof(_t_int));
+ pfc::encode_little_endian(temp.get_ptr(),p_value);
+ playlist_set_property(p_playlist,p_property,temp);
+ }
+ //! Read a persistent playlist property.
+ //! \param p_playlist Index of the playlist
+ //! \param p_property GUID that identifies the property
+ //! \param p_value integer reference that will receive the stored data
+ //! \return true if the property exists and if the data is compatible with p_value, false otherwise
+ template<typename _t_int>
+ bool playlist_get_property_int(t_size p_playlist,const GUID & p_property,_t_int & p_value) {
+ pfc::array_t<t_uint8> temp;
+ if (!playlist_get_property(p_playlist,p_property,temp)) return false;
+ if (temp.get_size() != sizeof(_t_int)) return false;
+ pfc::decode_little_endian(p_value,temp.get_ptr());
+ return true;
+ }
+
+ FB2K_MAKE_SERVICE_INTERFACE(playlist_manager_v2,playlist_manager)
+};
+
+//! \since 0.9.5
+class NOVTABLE playlist_manager_v3 : public playlist_manager_v2 {
+ FB2K_MAKE_SERVICE_INTERFACE(playlist_manager_v3,playlist_manager_v2)
+public:
+ virtual t_size recycler_get_count() = 0;
+ virtual void recycler_get_content(t_size which, metadb_handle_list_ref out) = 0;
+ virtual void recycler_get_name(t_size which, pfc::string_base & out) = 0;
+ virtual t_uint32 recycler_get_id(t_size which) = 0;
+ virtual void recycler_purge(const bit_array & mask) = 0;
+ virtual void recycler_restore(t_size which) = 0;
+
+ void recycler_restore_by_id(t_uint32 id);
+ t_size recycler_find_by_id(t_uint32 id);
+};
+
+//! \since 0.9.5.4
+class NOVTABLE playlist_manager_v4 : public playlist_manager_v3 {
+ FB2K_MAKE_SERVICE_INTERFACE(playlist_manager_v4, playlist_manager_v3)
+public:
+ virtual void playlist_get_sideinfo(t_size which, stream_writer * stream, abort_callback & abort) = 0;
+ virtual t_size create_playlist_ex(const char * p_name,t_size p_name_length,t_size p_index, metadb_handle_list_cref content, stream_reader * sideInfo, abort_callback & abort) = 0;
+};
+
+class NOVTABLE playlist_callback
+{
+public:
+ virtual void on_items_added(t_size p_playlist,t_size p_start, const pfc::list_base_const_t<metadb_handle_ptr> & p_data,const bit_array & p_selection)=0;//inside any of these methods, you can call playlist APIs to get exact info about what happened (but only methods that read playlist state, not those that modify it)
+ virtual void on_items_reordered(t_size p_playlist,const t_size * p_order,t_size p_count)=0;//changes selection too; doesnt actually change set of items that are selected or item having focus, just changes their order
+ virtual void on_items_removing(t_size p_playlist,const bit_array & p_mask,t_size p_old_count,t_size p_new_count)=0;//called before actually removing them
+ virtual void on_items_removed(t_size p_playlist,const bit_array & p_mask,t_size p_old_count,t_size p_new_count)=0;
+ virtual void on_items_selection_change(t_size p_playlist,const bit_array & p_affected,const bit_array & p_state) = 0;
+ virtual void on_item_focus_change(t_size p_playlist,t_size p_from,t_size p_to)=0;//focus may be -1 when no item has focus; reminder: focus may also change on other callbacks
+
+ virtual void on_items_modified(t_size p_playlist,const bit_array & p_mask)=0;
+ virtual void on_items_modified_fromplayback(t_size p_playlist,const bit_array & p_mask,play_control::t_display_level p_level)=0;
+
+ struct t_on_items_replaced_entry
+ {
+ t_size m_index;
+ metadb_handle_ptr m_old,m_new;
+ };
+
+ virtual void on_items_replaced(t_size p_playlist,const bit_array & p_mask,const pfc::list_base_const_t<t_on_items_replaced_entry> & p_data)=0;
+
+ virtual void on_item_ensure_visible(t_size p_playlist,t_size p_idx)=0;
+
+ virtual void on_playlist_activate(t_size p_old,t_size p_new) = 0;
+ virtual void on_playlist_created(t_size p_index,const char * p_name,t_size p_name_len) = 0;
+ virtual void on_playlists_reorder(const t_size * p_order,t_size p_count) = 0;
+ virtual void on_playlists_removing(const bit_array & p_mask,t_size p_old_count,t_size p_new_count) = 0;
+ virtual void on_playlists_removed(const bit_array & p_mask,t_size p_old_count,t_size p_new_count) = 0;
+ virtual void on_playlist_renamed(t_size p_index,const char * p_new_name,t_size p_new_name_len) = 0;
+
+ virtual void on_default_format_changed() = 0;
+ virtual void on_playback_order_changed(t_size p_new_index) = 0;
+ virtual void on_playlist_locked(t_size p_playlist,bool p_locked) = 0;
+
+ enum {
+ flag_on_items_added = 1 << 0,
+ flag_on_items_reordered = 1 << 1,
+ flag_on_items_removing = 1 << 2,
+ flag_on_items_removed = 1 << 3,
+ flag_on_items_selection_change = 1 << 4,
+ flag_on_item_focus_change = 1 << 5,
+ flag_on_items_modified = 1 << 6,
+ flag_on_items_modified_fromplayback = 1 << 7,
+ flag_on_items_replaced = 1 << 8,
+ flag_on_item_ensure_visible = 1 << 9,
+ flag_on_playlist_activate = 1 << 10,
+ flag_on_playlist_created = 1 << 11,
+ flag_on_playlists_reorder = 1 << 12,
+ flag_on_playlists_removing = 1 << 13,
+ flag_on_playlists_removed = 1 << 14,
+ flag_on_playlist_renamed = 1 << 15,
+ flag_on_default_format_changed = 1 << 16,
+ flag_on_playback_order_changed = 1 << 17,
+ flag_on_playlist_locked = 1 << 18,
+
+ flag_all = ~0,
+ flag_item_ops = flag_on_items_added | flag_on_items_reordered | flag_on_items_removing | flag_on_items_removed | flag_on_items_selection_change | flag_on_item_focus_change | flag_on_items_modified | flag_on_items_modified_fromplayback | flag_on_items_replaced | flag_on_item_ensure_visible,
+ flag_playlist_ops = flag_on_playlist_activate | flag_on_playlist_created | flag_on_playlists_reorder | flag_on_playlists_removing | flag_on_playlists_removed | flag_on_playlist_renamed | flag_on_playlist_locked,
+ };
+protected:
+ playlist_callback() {}
+ ~playlist_callback() {}
+};
+
+class NOVTABLE playlist_callback_static : public service_base, public playlist_callback
+{
+public:
+ virtual unsigned get_flags() = 0;
+
+ FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(playlist_callback_static);
+};
+
+class NOVTABLE playlist_callback_single
+{
+public:
+ virtual void on_items_added(t_size p_base, const pfc::list_base_const_t<metadb_handle_ptr> & p_data,const bit_array & p_selection)=0;//inside any of these methods, you can call playlist APIs to get exact info about what happened (but only methods that read playlist state, not those that modify it)
+ virtual void on_items_reordered(const t_size * p_order,t_size p_count)=0;//changes selection too; doesnt actually change set of items that are selected or item having focus, just changes their order
+ virtual void on_items_removing(const bit_array & p_mask,t_size p_old_count,t_size p_new_count)=0;//called before actually removing them
+ virtual void on_items_removed(const bit_array & p_mask,t_size p_old_count,t_size p_new_count)=0;
+ virtual void on_items_selection_change(const bit_array & p_affected,const bit_array & p_state) = 0;
+ virtual void on_item_focus_change(t_size p_from,t_size p_to)=0;//focus may be -1 when no item has focus; reminder: focus may also change on other callbacks
+ virtual void on_items_modified(const bit_array & p_mask)=0;
+ virtual void on_items_modified_fromplayback(const bit_array & p_mask,play_control::t_display_level p_level)=0;
+ virtual void on_items_replaced(const bit_array & p_mask,const pfc::list_base_const_t<playlist_callback::t_on_items_replaced_entry> & p_data)=0;
+ virtual void on_item_ensure_visible(t_size p_idx)=0;
+
+ virtual void on_playlist_switch() = 0;
+ virtual void on_playlist_renamed(const char * p_new_name,t_size p_new_name_len) = 0;
+ virtual void on_playlist_locked(bool p_locked) = 0;
+
+ virtual void on_default_format_changed() = 0;
+ virtual void on_playback_order_changed(t_size p_new_index) = 0;
+
+ enum {
+ flag_on_items_added = 1 << 0,
+ flag_on_items_reordered = 1 << 1,
+ flag_on_items_removing = 1 << 2,
+ flag_on_items_removed = 1 << 3,
+ flag_on_items_selection_change = 1 << 4,
+ flag_on_item_focus_change = 1 << 5,
+ flag_on_items_modified = 1 << 6,
+ flag_on_items_modified_fromplayback = 1 << 7,
+ flag_on_items_replaced = 1 << 8,
+ flag_on_item_ensure_visible = 1 << 9,
+ flag_on_playlist_switch = 1 << 10,
+ flag_on_playlist_renamed = 1 << 11,
+ flag_on_playlist_locked = 1 << 12,
+ flag_on_default_format_changed = 1 << 13,
+ flag_on_playback_order_changed = 1 << 14,
+ flag_all = ~0,
+ };
+protected:
+ playlist_callback_single() {}
+ ~playlist_callback_single() {}
+};
+
+//! playlist_callback implementation helper - registers itself on creation / unregisters on destruction. Must not be instantiated statically!
+class playlist_callback_impl_base : public playlist_callback {
+public:
+ playlist_callback_impl_base(t_uint32 p_flags = 0) {
+ static_api_ptr_t<playlist_manager>()->register_callback(this,p_flags);
+ }
+ ~playlist_callback_impl_base() {
+ static_api_ptr_t<playlist_manager>()->unregister_callback(this);
+ }
+ void set_callback_flags(t_uint32 p_flags) {
+ static_api_ptr_t<playlist_manager>()->modify_callback(this,p_flags);
+ }
+ //dummy implementations - avoid possible pure virtual function calls!
+ void on_items_added(t_size p_playlist,t_size p_start, const pfc::list_base_const_t<metadb_handle_ptr> & p_data,const bit_array & p_selection) {}
+ void on_items_reordered(t_size p_playlist,const t_size * p_order,t_size p_count) {}
+ void on_items_removing(t_size p_playlist,const bit_array & p_mask,t_size p_old_count,t_size p_new_count) {}
+ void on_items_removed(t_size p_playlist,const bit_array & p_mask,t_size p_old_count,t_size p_new_count) {}
+ void on_items_selection_change(t_size p_playlist,const bit_array & p_affected,const bit_array & p_state) {}
+ void on_item_focus_change(t_size p_playlist,t_size p_from,t_size p_to) {}
+
+ void on_items_modified(t_size p_playlist,const bit_array & p_mask) {}
+ void on_items_modified_fromplayback(t_size p_playlist,const bit_array & p_mask,play_control::t_display_level p_level) {}
+
+ void on_items_replaced(t_size p_playlist,const bit_array & p_mask,const pfc::list_base_const_t<t_on_items_replaced_entry> & p_data) {}
+
+ void on_item_ensure_visible(t_size p_playlist,t_size p_idx) {}
+
+ void on_playlist_activate(t_size p_old,t_size p_new) {}
+ void on_playlist_created(t_size p_index,const char * p_name,t_size p_name_len) {}
+ void on_playlists_reorder(const t_size * p_order,t_size p_count) {}
+ void on_playlists_removing(const bit_array & p_mask,t_size p_old_count,t_size p_new_count) {}
+ void on_playlists_removed(const bit_array & p_mask,t_size p_old_count,t_size p_new_count) {}
+ void on_playlist_renamed(t_size p_index,const char * p_new_name,t_size p_new_name_len) {}
+
+ void on_default_format_changed() {}
+ void on_playback_order_changed(t_size p_new_index) {}
+ void on_playlist_locked(t_size p_playlist,bool p_locked) {}
+};
+
+//! playlist_callback_single implementation helper - registers itself on creation / unregisters on destruction. Must not be instantiated statically!
+class playlist_callback_single_impl_base : public playlist_callback_single {
+protected:
+ playlist_callback_single_impl_base(t_uint32 p_flags = 0) {
+ static_api_ptr_t<playlist_manager>()->register_callback(this,p_flags);
+ }
+ void set_callback_flags(t_uint32 p_flags) {
+ static_api_ptr_t<playlist_manager>()->modify_callback(this,p_flags);
+ }
+ ~playlist_callback_single_impl_base() {
+ static_api_ptr_t<playlist_manager>()->unregister_callback(this);
+ }
+
+ //dummy implementations - avoid possible pure virtual function calls!
+ void on_items_added(t_size p_base, const pfc::list_base_const_t<metadb_handle_ptr> & p_data,const bit_array & p_selection) {}
+ void on_items_reordered(const t_size * p_order,t_size p_count) {}
+ void on_items_removing(const bit_array & p_mask,t_size p_old_count,t_size p_new_count) {}
+ void on_items_removed(const bit_array & p_mask,t_size p_old_count,t_size p_new_count) {}
+ void on_items_selection_change(const bit_array & p_affected,const bit_array & p_state) {}
+ void on_item_focus_change(t_size p_from,t_size p_to) {}
+ void on_items_modified(const bit_array & p_mask) {}
+ void on_items_modified_fromplayback(const bit_array & p_mask,play_control::t_display_level p_level) {}
+ void on_items_replaced(const bit_array & p_mask,const pfc::list_base_const_t<playlist_callback::t_on_items_replaced_entry> & p_data) {}
+ void on_item_ensure_visible(t_size p_idx) {}
+
+ void on_playlist_switch() {}
+ void on_playlist_renamed(const char * p_new_name,t_size p_new_name_len) {}
+ void on_playlist_locked(bool p_locked) {}
+
+ void on_default_format_changed() {}
+ void on_playback_order_changed(t_size p_new_index) {}
+
+ PFC_CLASS_NOT_COPYABLE(playlist_callback_single_impl_base,playlist_callback_single_impl_base);
+};
+
+class playlist_callback_single_static : public service_base, public playlist_callback_single
+{
+public:
+ virtual unsigned get_flags() = 0;
+
+ FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(playlist_callback_single_static);
+};
+
+
+//! Class used for async processing of IDataObject. Content of IDataObject can be dumped into dropped_files_data without any time-consuming operations - won't block calling app when used inside drag&drop handler - and actual time-consuming processing (listing directories and reading infos) can be done later.\n
+//! \deprecated In 0.9.3 and up, instead of going thru dropped_files_data, you can use playlist_incoming_item_filter_v2::process_dropped_files_async().
+class NOVTABLE dropped_files_data {
+public:
+ virtual void set_paths(pfc::string_list_const const & p_paths) = 0;
+ virtual void set_handles(const pfc::list_base_const_t<metadb_handle_ptr> & p_handles) = 0;
+protected:
+ dropped_files_data() {}
+ ~dropped_files_data() {}
+};
+
+
+class NOVTABLE playlist_incoming_item_filter : public service_base {
+public:
+ //! Pre-sorts incoming items according to user-configured settings, removes duplicates. \n
+ //! @param in Items to process.
+ //! @param out Receives processed item list. \n
+ //! NOTE: because of an implementation bug in pre-0.9.5, the output list should be emptied before calling filter_items(), otherwise the results will be inconsistent/unpredictable.
+ //! @returns True when there's one or more item in the output list, false when the output list is empty.
+ virtual bool filter_items(metadb_handle_list_cref in,metadb_handle_list_ref out) = 0;
+
+ //! Converts one or more paths to a list of metadb_handles; displays a progress dialog.\n
+ //! Note that this function creates modal dialog and does not return until the operation has completed.
+ //! @returns True on success, false on user abort.
+ //! \deprecated Use playlist_incoming_item_filter_v2::process_locations_async() when possible.
+ virtual bool process_locations(const pfc::list_base_const_t<const char*> & p_urls,pfc::list_base_t<metadb_handle_ptr> & p_out,bool p_filter,const char * p_restrict_mask_override, const char * p_exclude_mask_override,HWND p_parentwnd) = 0;
+
+ //! Converts an IDataObject to a list of metadb_handles.
+ //! Using this function is strongly disrecommended as it implies blocking the drag&drop source app (as well as our app).\n
+ //! @returns True on success, false on user abort or unknown data format.
+ //! \deprecated Use playlist_incoming_item_filter_v2::process_dropped_files_async() when possible.
+ virtual bool process_dropped_files(interface IDataObject * pDataObject,pfc::list_base_t<metadb_handle_ptr> & p_out,bool p_filter,HWND p_parentwnd) = 0;
+
+ //! Checks whether IDataObject contains one of known data formats that can be translated to a list of metadb_handles.
+ virtual bool process_dropped_files_check(interface IDataObject * pDataObject) = 0;
+
+ //! Checks whether IDataObject contains our own private data format (drag&drop within the app etc).
+ virtual bool process_dropped_files_check_if_native(interface IDataObject * pDataObject) = 0;
+
+ //! Creates an IDataObject from specified metadb_handle list. The caller is responsible for releasing the returned object. It is recommended that you use create_dataobject_ex() to get an autopointer that ensures proper deletion.
+ virtual interface IDataObject * create_dataobject(const pfc::list_base_const_t<metadb_handle_ptr> & p_data) = 0;
+
+ //! Checks whether IDataObject contains one of known data formats that can be translated to a list of metadb_handles.\n
+ //! This function also returns drop effects to use (see: IDropTarget::DragEnter(), IDropTarget::DragOver() ). In certain cases, drag effects are necessary for drag&drop to work at all (such as dragging links from IE).\n
+ virtual bool process_dropped_files_check_ex(interface IDataObject * pDataObject, DWORD * p_effect) = 0;
+
+ //! Dumps IDataObject content to specified dropped_files_data object, without any time-consuming processing.\n
+ //! Using this function instead of process_dropped_files() and processing dropped_files_data outside drop handler allows you to avoid blocking drop source app when processing large directories etc.\n
+ //! Note: since 0.9.3, it is recommended to use playlist_incoming_item_filter_v2::process_dropped_files_async() instead.
+ //! @returns True on success, false when IDataObject does not contain any of known data formats.
+ virtual bool process_dropped_files_delayed(dropped_files_data & p_out,interface IDataObject * pDataObject) = 0;
+
+ //! Helper - calls process_locations() with a single URL. See process_locations() for more info.
+ bool process_location(const char * url,pfc::list_base_t<metadb_handle_ptr> & out,bool filter,const char * p_mask,const char * p_exclude,HWND p_parentwnd);
+ //! Helper - returns a pfc::com_ptr_t<> rather than a raw pointer.
+ pfc::com_ptr_t<interface IDataObject> create_dataobject_ex(metadb_handle_list_cref data);
+
+ FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(playlist_incoming_item_filter);
+};
+
+//! For use with playlist_incoming_item_filter_v2::process_locations_async().
+//! \since 0.9.3
+class NOVTABLE process_locations_notify : public service_base {
+public:
+ virtual void on_completion(const pfc::list_base_const_t<metadb_handle_ptr> & p_items) = 0;
+ virtual void on_aborted() = 0;
+
+ FB2K_MAKE_SERVICE_INTERFACE(process_locations_notify,service_base);
+};
+
+typedef service_ptr_t<process_locations_notify> process_locations_notify_ptr;
+
+//! \since 0.9.3
+class NOVTABLE playlist_incoming_item_filter_v2 : public playlist_incoming_item_filter {
+public:
+ enum {
+ //! Set this to disable presorting (according to user settings) and duplicate removal in output list. Should be unset in most cases.
+ op_flag_no_filter = 1 << 0,
+ //! Set this flag to make the progress dialog not steal focus on creation.
+ op_flag_background = 1 << 1,
+ //! Set this flag to delay the progress dialog becoming visible, so it does not appear at all during short operations. Also implies op_flag_background effect.
+ op_flag_delay_ui = 1 << 2,
+ };
+
+ //! Converts one or more paths to a list of metadb_handles. The function returns immediately; specified callback object receives results when the operation has completed.
+ //! @param p_urls List of paths to process.
+ //! @param p_op_flags Can be null, or one or more of op_flag_* enum values combined, altering behaviors of the operation.
+ //! @param p_restrict_mask_override Override of "restrict incoming items to" setting. Pass NULL to use the value from preferences.
+ //! @param p_exclude_mask_override Override of "exclude file types" setting. Pass NULL to use value from preferences.
+ //! @param p_parentwnd Parent window for spawned progress dialogs.
+ //! @param p_notify Callback receiving notifications about success/abort of the operation as well as output item list.
+ virtual void process_locations_async(const pfc::list_base_const_t<const char*> & p_urls,t_uint32 p_op_flags,const char * p_restrict_mask_override, const char * p_exclude_mask_override,HWND p_parentwnd,process_locations_notify_ptr p_notify) = 0;
+
+ //! Converts an IDataObject to a list of metadb_handles. The function returns immediately; specified callback object receives results when the operation has completed.
+ //! @param p_dataobject IDataObject to process.
+ //! @param p_op_flags Can be null, or one or more of op_flag_* enum values combined, altering behaviors of the operation.
+ //! @param p_parentwnd Parent window for spawned progress dialogs.
+ //! @param p_notify Callback receiving notifications about success/abort of the operation as well as output item list.
+ virtual void process_dropped_files_async(interface IDataObject * p_dataobject,t_uint32 p_op_flags,HWND p_parentwnd,process_locations_notify_ptr p_notify) = 0;
+
+ FB2K_MAKE_SERVICE_INTERFACE(playlist_incoming_item_filter_v2,playlist_incoming_item_filter);
+};
+
+//! \since 0.9.5
+class playlist_incoming_item_filter_v3 : public playlist_incoming_item_filter_v2 {
+public:
+ virtual bool auto_playlist_name(metadb_handle_list_cref data,pfc::string_base & out) = 0;
+
+ FB2K_MAKE_SERVICE_INTERFACE(playlist_incoming_item_filter_v3,playlist_incoming_item_filter_v2)
+};
+
+//! Implementation of dropped_files_data.
+class dropped_files_data_impl : public dropped_files_data {
+public:
+ dropped_files_data_impl() : m_is_paths(false) {}
+ void set_paths(pfc::string_list_const const & p_paths) {
+ m_is_paths = true;
+ m_paths = p_paths;
+ }
+ void set_handles(const pfc::list_base_const_t<metadb_handle_ptr> & p_handles) {
+ m_is_paths = false;
+ m_handles = p_handles;
+ }
+
+ void to_handles_async(bool p_filter,HWND p_parentwnd,service_ptr_t<process_locations_notify> p_notify);
+ //! @param p_op_flags Can be null, or one or more of playlist_incoming_item_filter_v2::op_flag_* enum values combined, altering behaviors of the operation.
+ void to_handles_async_ex(t_uint32 p_op_flags,HWND p_parentwnd,service_ptr_t<process_locations_notify> p_notify);
+ bool to_handles(pfc::list_base_t<metadb_handle_ptr> & p_out,bool p_filter,HWND p_parentwnd);
+private:
+ pfc::string_list_impl m_paths;
+ metadb_handle_list m_handles;
+ bool m_is_paths;
+};
+
+
+class NOVTABLE playback_queue_callback : public service_base
+{
+public:
+ enum t_change_origin {
+ changed_user_added,
+ changed_user_removed,
+ changed_playback_advance,
+ };
+ virtual void on_changed(t_change_origin p_origin) = 0;
+
+ FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(playback_queue_callback);
+};
+
+
+class playlist_lock_change_notify : private playlist_callback_single_impl_base {
+public:
+ playlist_lock_change_notify() : playlist_callback_single_impl_base(flag_on_playlist_switch|flag_on_playlist_locked) {}
+protected:
+ virtual void on_lock_state_change() {}
+ bool is_playlist_command_available(t_uint32 what) const {
+ static_api_ptr_t<playlist_manager> api;
+ const t_size active = api->get_active_playlist();
+ if (active == ~0) return false;
+ return (api->playlist_lock_get_filter_mask(active) & what) == 0;
+ }
+private:
+ void on_playlist_switch() {on_lock_state_change();}
+ void on_playlist_locked(bool p_locked) {on_lock_state_change();}
+};
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/playlist_loader.cpp b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/playlist_loader.cpp new file mode 100644 index 0000000000..b04a6f2165 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/playlist_loader.cpp @@ -0,0 +1,273 @@ +#include "foobar2000.h"
+
+#if FOOBAR2000_TARGET_VERSION >= 76
+static void process_path_internal(const char * p_path,const service_ptr_t<file> & p_reader,playlist_loader_callback::ptr callback, abort_callback & abort,playlist_loader_callback::t_entry_type type,const t_filestats & p_stats);
+
+namespace {
+ class archive_callback_impl : public archive_callback {
+ public:
+ archive_callback_impl(playlist_loader_callback::ptr p_callback, abort_callback & p_abort) : m_callback(p_callback), m_abort(p_abort) {}
+ bool on_entry(archive * owner,const char * p_path,const t_filestats & p_stats,const service_ptr_t<file> & p_reader)
+ {
+ process_path_internal(p_path,p_reader,m_callback,m_abort,playlist_loader_callback::entry_directory_enumerated,p_stats);
+ return !m_abort.is_aborting();
+ }
+ bool is_aborting() const {return m_abort.is_aborting();}
+ abort_callback_event get_abort_event() const {return m_abort.get_abort_event();}
+ private:
+ const playlist_loader_callback::ptr m_callback;
+ abort_callback & m_abort;
+ };
+}
+
+void playlist_loader::g_load_playlist_filehint(file::ptr fileHint,const char * p_path,playlist_loader_callback::ptr p_callback, abort_callback & p_abort) {
+ TRACK_CALL_TEXT("playlist_loader::g_load_playlist_filehint");
+ pfc::string8 filepath;
+
+ filesystem::g_get_canonical_path(p_path,filepath);
+
+ pfc::string_extension extension(filepath);
+
+ service_ptr_t<file> l_file = fileHint;
+
+ if (l_file.is_empty()) {
+ filesystem::ptr fs;
+ if (filesystem::g_get_interface(fs,filepath)) {
+ if (fs->supports_content_types()) {
+ fs->open(l_file,filepath,filesystem::open_mode_read,p_abort);
+ }
+ }
+ }
+
+ {
+ service_enum_t<playlist_loader> e;
+
+ if (l_file.is_valid()) {
+ pfc::string8 content_type;
+ if (l_file->get_content_type(content_type)) {
+ service_ptr_t<playlist_loader> l;
+ e.reset(); while(e.next(l)) {
+ if (l->is_our_content_type(content_type)) {
+ try {
+ TRACK_CODE("playlist_loader::open",l->open(filepath,l_file,p_callback, p_abort));
+ return;
+ } catch(exception_io_unsupported_format) {
+ l_file->reopen(p_abort);
+ }
+ }
+ }
+ }
+ }
+
+ if (extension.length()>0) {
+ playlist_loader::ptr l;
+ e.reset(); while(e.next(l)) {
+ if (stricmp_utf8(l->get_extension(),extension) == 0) {
+ if (l_file.is_empty()) filesystem::g_open_read(l_file,filepath,p_abort);
+ try {
+ TRACK_CODE("playlist_loader::open",l->open(filepath,l_file,p_callback,p_abort));
+ return;
+ } catch(exception_io_unsupported_format) {
+ l_file->reopen(p_abort);
+ }
+ }
+ }
+ }
+ }
+
+ throw exception_io_unsupported_format();
+}
+void playlist_loader::g_load_playlist(const char * p_path,playlist_loader_callback::ptr callback, abort_callback & abort) {
+ g_load_playlist_filehint(NULL,p_path,callback,abort);
+}
+
+static void index_tracks_helper(const char * p_path,const service_ptr_t<file> & p_reader,const t_filestats & p_stats,playlist_loader_callback::t_entry_type p_type,playlist_loader_callback::ptr p_callback, abort_callback & p_abort,bool & p_got_input)
+{
+ TRACK_CALL_TEXT("index_tracks_helper");
+ if (p_reader.is_empty() && filesystem::g_is_remote_safe(p_path))
+ {
+ TRACK_CALL_TEXT("remote");
+ metadb_handle_ptr handle;
+ p_callback->handle_create(handle,make_playable_location(p_path,0));
+ p_got_input = true;
+ p_callback->on_entry(handle,p_type,p_stats,true);
+ } else {
+ TRACK_CALL_TEXT("hintable");
+ service_ptr_t<input_info_reader> instance;
+ input_entry::g_open_for_info_read(instance,p_reader,p_path,p_abort);
+
+ t_filestats stats = instance->get_file_stats(p_abort);
+
+ t_uint32 subsong,subsong_count = instance->get_subsong_count();
+ for(subsong=0;subsong<subsong_count;subsong++)
+ {
+ TRACK_CALL_TEXT("subsong-loop");
+ p_abort.check();
+ metadb_handle_ptr handle;
+ t_uint32 index = instance->get_subsong(subsong);
+ p_callback->handle_create(handle,make_playable_location(p_path,index));
+
+ p_got_input = true;
+ if (p_callback->want_info(handle,p_type,stats,true))
+ {
+ file_info_impl info;
+ TRACK_CODE("get_info",instance->get_info(index,info,p_abort));
+ p_callback->on_entry_info(handle,p_type,stats,info,true);
+ }
+ else
+ {
+ p_callback->on_entry(handle,p_type,stats,true);
+ }
+ }
+ }
+}
+
+
+static void track_indexer__g_get_tracks_wrap(const char * p_path,const service_ptr_t<file> & p_reader,const t_filestats & p_stats,playlist_loader_callback::t_entry_type p_type,playlist_loader_callback::ptr p_callback, abort_callback & p_abort) {
+ bool got_input = false;
+ bool fail = false;
+ try {
+ index_tracks_helper(p_path,p_reader,p_stats,p_type,p_callback,p_abort, got_input);
+ } catch(exception_aborted) {
+ throw;
+ } catch(exception_io_unsupported_format) {
+ fail = true;
+ } catch(std::exception const & e) {
+ fail = true;
+ console::formatter() << "could not enumerate tracks (" << e << ") on:\n" << file_path_display(p_path);
+ }
+ if (fail) {
+ if (!got_input && !p_abort.is_aborting()) {
+ if (p_type == playlist_loader_callback::entry_user_requested)
+ {
+ metadb_handle_ptr handle;
+ p_callback->handle_create(handle,make_playable_location(p_path,0));
+ p_callback->on_entry(handle,p_type,p_stats,true);
+ }
+ }
+ }
+}
+
+
+static void process_path_internal(const char * p_path,const service_ptr_t<file> & p_reader,playlist_loader_callback::ptr callback, abort_callback & abort,playlist_loader_callback::t_entry_type type,const t_filestats & p_stats)
+{
+ //p_path must be canonical
+
+ abort.check();
+
+ callback->on_progress(p_path);
+
+
+ {
+ if (p_reader.is_empty()) {
+ directory_callback_impl directory_results(true);
+ try {
+ filesystem::g_list_directory(p_path,directory_results,abort);
+ for(t_size n=0;n<directory_results.get_count();n++) {
+ process_path_internal(directory_results.get_item(n),0,callback,abort,playlist_loader_callback::entry_directory_enumerated,directory_results.get_item_stats(n));
+ }
+ return;
+ } catch(exception_aborted) {throw;}
+ catch(...) {
+ //do nothing, fall thru
+ //fixme - catch only filesystem exceptions?
+ }
+ }
+
+ bool found = false;
+
+
+ {
+ archive_callback_impl archive_results(callback, abort);
+ service_enum_t<filesystem> e;
+ service_ptr_t<filesystem> f;
+ while(e.next(f)) {
+ abort.check();
+ service_ptr_t<archive> arch;
+ if (f->service_query_t(arch)) {
+ if (p_reader.is_valid()) p_reader->reopen(abort);
+
+ try {
+ TRACK_CODE("archive::archive_list",arch->archive_list(p_path,p_reader,archive_results,true));
+ return;
+ } catch(exception_aborted) {throw;}
+ catch(...) {}
+ }
+ }
+ }
+ }
+
+
+
+ {
+ service_ptr_t<link_resolver> ptr;
+ if (link_resolver::g_find(ptr,p_path))
+ {
+ if (p_reader.is_valid()) p_reader->reopen(abort);
+
+ pfc::string8 temp;
+ try {
+ TRACK_CODE("link_resolver::resolve",ptr->resolve(p_reader,p_path,temp,abort));
+
+ track_indexer__g_get_tracks_wrap(temp,0,filestats_invalid,playlist_loader_callback::entry_from_playlist,callback, abort);
+ return;//success
+ } catch(exception_aborted) {throw;}
+ catch(...) {}
+ }
+ }
+
+ if (callback->is_path_wanted(p_path,type)) {
+ track_indexer__g_get_tracks_wrap(p_path,p_reader,p_stats,type,callback, abort);
+ }
+}
+
+void playlist_loader::g_process_path(const char * p_filename,playlist_loader_callback::ptr callback, abort_callback & abort,playlist_loader_callback::t_entry_type type)
+{
+ TRACK_CALL_TEXT("playlist_loader::g_process_path");
+
+ file_path_canonical filename(p_filename);
+
+ process_path_internal(filename,0,callback,abort, type,filestats_invalid);
+}
+
+void playlist_loader::g_save_playlist(const char * p_filename,const pfc::list_base_const_t<metadb_handle_ptr> & data,abort_callback & p_abort)
+{
+ TRACK_CALL_TEXT("playlist_loader::g_save_playlist");
+ pfc::string8 filename;
+ filesystem::g_get_canonical_path(p_filename,filename);
+ try {
+ service_ptr_t<file> r;
+ filesystem::g_open(r,filename,filesystem::open_mode_write_new,p_abort);
+
+ pfc::string_extension ext(filename);
+
+ service_enum_t<playlist_loader> e;
+ service_ptr_t<playlist_loader> l;
+ if (e.first(l)) do {
+ if (l->can_write() && !stricmp_utf8(ext,l->get_extension())) {
+ try {
+ TRACK_CODE("playlist_loader::write",l->write(filename,r,data,p_abort));
+ return;
+ } catch(exception_io_data) {}
+ }
+ } while(e.next(l));
+ throw exception_io_data();
+ } catch(...) {
+ try {filesystem::g_remove(filename,p_abort);} catch(...) {}
+ throw;
+ }
+}
+
+
+bool playlist_loader::g_process_path_ex(const char * filename,playlist_loader_callback::ptr callback, abort_callback & abort,playlist_loader_callback::t_entry_type type)
+{
+ try {
+ g_load_playlist(filename,callback, abort);
+ return true;
+ } catch(exception_io_unsupported_format) {//not a playlist format
+ g_process_path(filename,callback,abort,type);
+ return false;
+ }
+}
+
+#endif
\ No newline at end of file diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/playlist_loader.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/playlist_loader.h new file mode 100644 index 0000000000..5041baab2c --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/playlist_loader.h @@ -0,0 +1,117 @@ +#if FOOBAR2000_TARGET_VERSION >= 76
+//! Callback interface receiving item locations from playlist loader. \n
+//! Typically, you call one of standard services such as playlist_incoming_item_filter instead of implementing this interface and calling playlist_loader methods directly.
+class NOVTABLE playlist_loader_callback : public service_base {
+ FB2K_MAKE_SERVICE_INTERFACE(playlist_loader_callback, service_base)
+public:
+ //! Enumeration type representing origin of item passed to playlist_loader_callback.
+ enum t_entry_type {
+ //! User-requested (such as directly dropped to window or picked in openfiledialog).
+ entry_user_requested,
+ //! From directory content enumeration.
+ entry_directory_enumerated,
+ //! Referenced by playlist file.
+ entry_from_playlist,
+ };
+ //! Indicates specified path being processed; provided for updating GUI. Note that optimally GUI should not be updated every time this is called because that could introduce a bottleneck.
+ virtual void on_progress(const char * p_path) = 0;
+
+ //! Receives an item from one of playlist_loader functions.
+ //! @param p_item Item location, in form of metadb_handle pointer.
+ //! @param p_type Origin of this item - see t_entry_type for more info.
+ //! @param p_stats File stats of this item; set to filestats_invalid if not available.
+ //! @param p_fresh Fresh flag; indicates whether stats are directly from filesystem (true) or as stored earlier in a playlist file (false).
+ virtual void on_entry(const metadb_handle_ptr & p_item,t_entry_type p_type,const t_filestats & p_stats,bool p_fresh) = 0;
+ //! Queries whether file_info for specified item is requested. In typical scenario, if want_info() returns false, on_entry() will be called with same parameters; otherwise caller will attempt to read info from the item and call on_entry_info() with same parameters and file_info read from the item.
+ //! @param p_item Item location, in form of metadb_handle pointer.
+ //! @param p_type Origin of this item - see t_entry_type for more info.
+ //! @param p_stats File stats of this item; set to filestats_invalid if not available.
+ //! @param p_fresh Fresh flag; indicates whether stats are directly from filesystem (true) or as stored earlier in a playlist file (false).
+ virtual bool want_info(const metadb_handle_ptr & p_item,t_entry_type p_type,const t_filestats & p_stats,bool p_fresh) = 0;
+ //! Receives an item from one of playlist_loader functions; including file_info data. Except for file_info to be typically used as hint for metadb backend, behavior of this method is same as on_entry().
+ //! @param p_item Item location, in form of metadb_handle pointer.
+ //! @param p_type Origin of this item - see t_entry_type for more info.
+ //! @param p_stats File stats of this item; set to filestats_invalid if not available.
+ //! @param p_info Information about the item, read from the file directly (if p_fresh is set to true) or from e.g. playlist file (if p_fresh is set to false).
+ //! @param p_fresh Fresh flag; indicates whether stats are directly from filesystem (true) or as stored earlier in a playlist file (false).
+ virtual void on_entry_info(const metadb_handle_ptr & p_item,t_entry_type p_type,const t_filestats & p_stats,const file_info & p_info,bool p_fresh) = 0;
+
+ //! Same as metadb::handle_create(); provided here to avoid repeated metadb instantiation bottleneck since calling code will need this function often.
+ virtual void handle_create(metadb_handle_ptr & p_out,const playable_location & p_location) = 0;
+
+ //! Returns whether further on_entry() calls for this file are wanted. Typically always returns true, can be used to optimize cases when directories are searched for files matching specific pattern only so unwanted files aren't parsed unnecessarily.
+ //! @param path Canonical path to the media file being processed.
+ virtual bool is_path_wanted(const char * path, t_entry_type type) = 0;
+
+ virtual bool want_browse_info(const metadb_handle_ptr & p_item,t_entry_type p_type,t_filetimestamp ts) = 0;
+ virtual void on_browse_info(const metadb_handle_ptr & p_item,t_entry_type p_type,const file_info & info, t_filetimestamp ts) = 0;
+};
+
+
+
+//! Service handling playlist file operations. There are multiple implementations handling different playlist formats; you can add new implementations to allow new custom playlist file formats to be read or written.\n
+//! Also provides static helper functions for turning a filesystem path into a list of playable item locations. \n
+//! Note that you should typically call playlist_incoming_item_filter methods instead of calling playlist_loader methods directly to get a list of playable items from a specified path; this way you get a core-implemented threading and abortable dialog displaying progress.\n
+//! To register your own implementation, use playlist_loader_factory_t template.\n
+//! To call existing implementations, use static helper methods of playlist_loader class.
+class NOVTABLE playlist_loader : public service_base {
+public:
+ //! Parses specified playlist file into list of playable locations. Throws exception_io or derivatives on failure, exception_aborted on abort. If specified file is not a recognized playlist file, exception_io_unsupported_format is thrown.
+ //! @param p_path Path of playlist file to parse. Used for relative path handling purposes (p_file parameter is used for actual file access).
+ //! @param p_file File interface to use for reading. Read/write pointer must be set to beginning by caller before calling.
+ //! @param p_callback Callback object receiving enumerated playable item locations.
+ virtual void open(const char * p_path, const service_ptr_t<file> & p_file,playlist_loader_callback::ptr p_callback, abort_callback & p_abort) = 0;
+ //! Writes a playlist file containing specific item list to specified file. Will fail (pfc::exception_not_implemented) if specified playlist_loader is read-only (can_write() returns false).
+ //! @param p_path Path of playlist file to write. Used for relative path handling purposes (p_file parameter is used for actual file access).
+ //! @param p_file File interface to use for writing. Caller should ensure that the file is empty (0 bytes long) before calling.
+ //! @param p_data List of items to save to playlist file.
+ //! @param p_abort abort_callback object signaling user aborting the operation. Note that aborting a save playlist operation will most likely leave user with corrupted/incomplete file.
+ virtual void write(const char * p_path, const service_ptr_t<file> & p_file,metadb_handle_list_cref p_data,abort_callback & p_abort) = 0;
+ //! Returns extension of file format handled by this playlist_loader implementation (a UTF-8 encoded null-terminated string).
+ virtual const char * get_extension() = 0;
+ //! Returns whether this playlist_loader implementation supports writing. If can_write() returns false, all write() calls will fail.
+ virtual bool can_write() = 0;
+ //! Returns whether specified content type is one of playlist types supported by this playlist_loader implementation or not.
+ //! @param p_content_type Content type to query, a UTF-8 encoded null-terminated string.
+ virtual bool is_our_content_type(const char* p_content_type) = 0;
+ //! Returns whether playlist format extension supported by this implementation should be listed on file types associations page.
+ virtual bool is_associatable() = 0;
+
+ //! Attempts to load a playlist file from specified filesystem path. Throws exception_io or derivatives on failure, exception_aborted on abort. If specified file is not a recognized playlist file, exception_io_unsupported_format is thrown. \n
+ //! Equivalent to g_load_playlist_filehint(NULL,p_path,p_callback).
+ //! @param p_path Filesystem path to load playlist from, a UTF-8 encoded null-terminated string.
+ //! @param p_callback Callback object receiving enumerated playable item locations as well as signaling user aborting the operation.
+ static void g_load_playlist(const char * p_path,playlist_loader_callback::ptr p_callback, abort_callback & p_abort);
+
+ //! Attempts to load a playlist file from specified filesystem path. Throws exception_io or derivatives on failure, exception_aborted on abort. If specified file is not a recognized playlist file, exception_io_unsupported_format is thrown.
+ //! @param p_path Filesystem path to load playlist from, a UTF-8 encoded null-terminated string.
+ //! @param p_callback Callback object receiving enumerated playable item locations as well as signaling user aborting the operation.
+ //! @param fileHint File object to read from, can be NULL if not available.
+ static void g_load_playlist_filehint(file::ptr fileHint,const char * p_path,playlist_loader_callback::ptr p_callback, abort_callback & p_abort);
+
+ //! Saves specified list of locations into a playlist file. Throws exception_io or derivatives on failure, exception_aborted on abort.
+ //! @param p_path Filesystem path to save playlist to, a UTF-8 encoded null-terminated string.
+ //! @param p_data List of items to save to playlist file.
+ //! @param p_abort abort_callback object signaling user aborting the operation. Note that aborting a save playlist operation will most likely leave user with corrupted/incomplete file.
+ static void g_save_playlist(const char * p_path,metadb_handle_list_cref p_data,abort_callback & p_abort);
+
+ //! Processes specified path to generate list of playable items. Includes recursive directory/archive enumeration. \n
+ //! Does not touch playlist files encountered - use g_process_path_ex() if specified path is possibly a playlist file; playlist files found inside directories or archives are ignored regardless.\n
+ //! Warning: caller must handle exceptions which will occur in case of I/O failure.
+ //! @param p_path Filesystem path to process; a UTF-8 encoded null-terminated string.
+ //! @param p_callback Callback object receiving enumerated playable item locations as well as signaling user aborting the operation.
+ //! @param p_type Origin of p_path string. Reserved for internal use in recursive calls, should be left at default value; it controls various internal behaviors.
+ static void g_process_path(const char * p_path,playlist_loader_callback::ptr p_callback, abort_callback & p_abort,playlist_loader_callback::t_entry_type p_type = playlist_loader_callback::entry_user_requested);
+
+ //! Calls attempts to process specified path as a playlist; if that fails (i.e. not a playlist), calls g_process_path with same parameters. See g_process_path for parameter descriptions. \n
+ //! Warning: caller must handle exceptions which will occur in case of I/O failure or playlist parsing failure.
+ //! @returns True if specified path was processed as a playlist file, false otherwise (relevant in some scenarios where output is sorted after loading, playlist file contents should not be sorted).
+ static bool g_process_path_ex(const char * p_path,playlist_loader_callback::ptr p_callback, abort_callback & p_abort,playlist_loader_callback::t_entry_type p_type = playlist_loader_callback::entry_user_requested);
+
+ FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(playlist_loader);
+};
+
+template<typename t_myclass>
+class playlist_loader_factory_t : public service_factory_single_t<t_myclass> {};
+
+#endif
\ No newline at end of file diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/popup_message.cpp b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/popup_message.cpp new file mode 100644 index 0000000000..7c62cb9866 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/popup_message.cpp @@ -0,0 +1,6 @@ +#include "foobar2000.h"
+
+void popup_message::g_show_ex(const char * p_msg,unsigned p_msg_length,const char * p_title,unsigned p_title_length,t_icon p_icon)
+{
+ static_api_ptr_t<popup_message>()->show_ex(p_msg,p_msg_length,p_title,p_title_length,p_icon);
+}
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/popup_message.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/popup_message.h new file mode 100644 index 0000000000..a08a5095c9 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/popup_message.h @@ -0,0 +1,42 @@ +
+//! This interface allows you to show generic nonmodal noninteractive dialog with a text message. This should be used instead of MessageBox where possible.\n
+//! Usage: use popup_message::g_show / popup_message::g_show_ex static helpers, or static_api_ptr_t<popup_message>.\n
+//! Note that all strings are UTF-8.
+
+class NOVTABLE popup_message : public service_base {
+public:
+ enum t_icon {icon_information, icon_error, icon_query};
+ //! Activates the popup dialog; returns immediately (the dialog remains visible).
+ //! @param p_msg Message to show (UTF-8 encoded string).
+ //! @param p_msg_length Length limit of message string to show, in bytes (actual string may be shorter if null terminator is encountered before). Set this to infinite to use plain null-terminated strings.
+ //! @param p_title Title of dialog to show (UTF-8 encoded string).
+ //! @param p_title_length Length limit of the title string, in bytes (actual string may be shorter if null terminator is encountered before). Set this to infinite to use plain null-terminated strings.
+ //! @param p_icon Icon of the dialog - can be set to icon_information, icon_error or icon_query.
+ virtual void show_ex(const char * p_msg,unsigned p_msg_length,const char * p_title,unsigned p_title_length,t_icon p_icon = icon_information) = 0;
+
+ //! Activates the popup dialog; returns immediately (the dialog remains visible); helper function built around show_ex(), takes null terminated strings with no length limit parameters.
+ //! @param p_msg Message to show (UTF-8 encoded string).
+ //! @param p_title Title of dialog to show (UTF-8 encoded string).
+ //! @param p_icon Icon of the dialog - can be set to icon_information, icon_error or icon_query.
+ inline void show(const char * p_msg,const char * p_title,t_icon p_icon = icon_information) {show_ex(p_msg,~0,p_title,~0,p_icon);}
+
+ //! Static helper function instantiating the service and activating the message dialog. See show_ex() for description of parameters.
+ static void g_show_ex(const char * p_msg,unsigned p_msg_length,const char * p_title,unsigned p_title_length,t_icon p_icon = icon_information);
+ //! Static helper function instantiating the service and activating the message dialog. See show() for description of parameters.
+ static inline void g_show(const char * p_msg,const char * p_title,t_icon p_icon = icon_information) {g_show_ex(p_msg,~0,p_title,~0,p_icon);}
+
+ static void g_complain(const char * what) {
+ g_show(what, "Information", icon_error);
+ }
+
+ static void g_complain(const char * p_whatFailed, const std::exception & p_exception) {
+ g_complain(p_whatFailed,p_exception.what());
+ }
+ static void g_complain(const char * p_whatFailed, const char * msg) {
+ g_complain(pfc::string_formatter() << p_whatFailed << ": " << msg);
+ }
+
+ FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(popup_message);
+};
+
+#define EXCEPTION_TO_POPUP_MESSAGE(CODE,LABEL) try { CODE; } catch(std::exception const & e) {popup_message::g_complain(LABEL,e);}
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/preferences_page.cpp b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/preferences_page.cpp new file mode 100644 index 0000000000..037d6a8199 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/preferences_page.cpp @@ -0,0 +1,10 @@ +#include "foobar2000.h"
+
+void preferences_page::get_help_url_helper(pfc::string_base & out, const char * category, const GUID & id, const char * name) {
+ out.reset();
+ out << "http://help.foobar2000.org/" << core_version_info::g_get_version_string() << "/" << category << "/" << pfc::print_guid(id) << "/" << name;
+}
+bool preferences_page::get_help_url(pfc::string_base & p_out) {
+ get_help_url_helper(p_out,"preferences",get_guid(), get_name());
+ return true;
+}
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/preferences_page.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/preferences_page.h new file mode 100644 index 0000000000..1cbe8ceae9 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/preferences_page.h @@ -0,0 +1,136 @@ +//! Implementing this service will generate a page in preferences dialog. Use preferences_page_factory_t template to register. \n
+//! In 1.0 and newer you should always derive from preferences_page_v3 rather than from preferences_page directly.
+class NOVTABLE preferences_page : public service_base {
+public:
+ //! Creates preferences page dialog window. It is safe to assume that two dialog instances will never coexist. Caller is responsible for embedding it into preferences dialog itself.
+ virtual HWND create(HWND p_parent) = 0;
+ //! Retrieves name of the prefernces page to be displayed in preferences tree (static string).
+ virtual const char * get_name() = 0;
+ //! Retrieves GUID of the page.
+ virtual GUID get_guid() = 0;
+ //! Retrieves GUID of parent page/branch of this page. See preferences_page::guid_* constants for list of standard parent GUIDs. Can also be a GUID of another page or a branch (see: preferences_branch).
+ virtual GUID get_parent_guid() = 0;
+ //! Obsolete.
+ virtual bool reset_query() = 0;
+ //! Obsolete.
+ virtual void reset() = 0;
+ //! Retrieves help URL. Without overriding it, it will redirect to foobar2000 wiki.
+ virtual bool get_help_url(pfc::string_base & p_out);
+
+ static void get_help_url_helper(pfc::string_base & out, const char * category, const GUID & id, const char * name);
+
+ static const GUID guid_root, guid_hidden, guid_tools,guid_core,guid_display,guid_playback,guid_visualisations,guid_input,guid_tag_writing,guid_media_library, guid_tagging;
+
+ FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(preferences_page);
+};
+
+class NOVTABLE preferences_page_v2 : public preferences_page {
+public:
+ //! Allows custom sorting order of preferences pages. Return lower value for higher priority (lower resulting index in the list). When sorting priority of two items matches, alphabetic sorting is used. Return 0 to use default alphabetic sorting without overriding priority.
+ virtual double get_sort_priority() {return 0;}
+
+ FB2K_MAKE_SERVICE_INTERFACE(preferences_page_v2,preferences_page);
+};
+
+template<class T>
+class preferences_page_factory_t : public service_factory_single_t<T> {};
+
+//! Creates a preferences branch - an empty page that only serves as a parent for other pages and is hidden when no child pages exist. Instead of implementing this, simply use preferences_branch_factory class to declare a preferences branch with specified parameters.
+class NOVTABLE preferences_branch : public service_base {
+public:
+ //! Retrieves name of the preferences branch.
+ virtual const char * get_name() = 0;
+ //! Retrieves GUID of the preferences branch. Use this GUID as parent GUID for pages/branches nested in this branch.
+ virtual GUID get_guid() = 0;
+ //! Retrieves GUID of parent page/branch of this branch. See preferences_page::guid_* constants for list of standard parent GUIDs. Can also be a GUID of another branch or a page.
+ virtual GUID get_parent_guid() = 0;
+
+
+ FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(preferences_branch);
+};
+
+class preferences_branch_v2 : public preferences_branch {
+public:
+ //! Allows custom sorting order of preferences pages. Return lower value for higher priority (lower resulting index in the list). When sorting priority of two items matches, alphabetic sorting is used. Return 0 to use default alphabetic sorting without overriding priority.
+ virtual double get_sort_priority() {return 0;}
+
+ FB2K_MAKE_SERVICE_INTERFACE(preferences_branch_v2,preferences_branch);
+};
+
+class preferences_branch_impl : public preferences_branch_v2 {
+public:
+ preferences_branch_impl(const GUID & p_guid,const GUID & p_parent,const char * p_name,double p_sort_priority = 0) : m_guid(p_guid), m_parent(p_parent), m_name(p_name), m_sort_priority(p_sort_priority) {}
+ const char * get_name() {return m_name;}
+ GUID get_guid() {return m_guid;}
+ GUID get_parent_guid() {return m_parent;}
+ double get_sort_priority() {return m_sort_priority;}
+private:
+ const GUID m_guid,m_parent;
+ const pfc::string8 m_name;
+ const double m_sort_priority;
+};
+
+typedef service_factory_single_t<preferences_branch_impl> _preferences_branch_factory;
+
+//! Instantiating this class declares a preferences branch with specified parameters.\n
+//! Usage: static preferences_branch_factory g_mybranch(mybranchguid,parentbranchguid,"name of my preferences branch goes here");
+class preferences_branch_factory : public _preferences_branch_factory {
+public:
+ preferences_branch_factory(const GUID & p_guid,const GUID & p_parent,const char * p_name,double p_sort_priority = 0) : _preferences_branch_factory(p_guid,p_parent,p_name,p_sort_priority) {}
+};
+
+
+
+
+class preferences_state {
+public:
+ enum {
+ changed = 1,
+ needs_restart = 2,
+ needs_restart_playback = 4,
+ resettable = 8,
+
+ //! \since 1.1
+ //! Indicates that the dialog is currently busy and cannot be applied or cancelled. Do not use without a good reason! \n
+ //! This flag was introduced in 1.1. It will not be respected in earlier foobar2000 versions. It is recommended not to use this flag unless you are absolutely sure that you need it and take appropriate precautions. \n
+ //! Note that this has no power to entirely prevent your preferences page from being destroyed/cancelled as a result of app shutdown if the user dismisses the warnings, but you won't be getting an "apply" call while this is set.
+ busy = 16,
+ };
+};
+
+class preferences_page_callback : public service_base {
+ FB2K_MAKE_SERVICE_INTERFACE(preferences_page_callback, service_base)
+public:
+ virtual void on_state_changed() = 0;
+};
+
+//! \since 1.0
+//! Implements a preferences page instance. \n
+//! Instantiated through preferences_page_v3::instantiate(). \n
+//! Note that the window will be destroyed by the caller before the last reference to the preferences_page_instance is released. \n
+//! WARNING: misguided use of modal dialogs - or ANY windows APIs that might spawn such dialogs - may result in conditions when the owner dialog (along with your page) is destroyed somewhere inside your message handler, also releasing references to your object. \n
+//! It is recommended to use window_service_impl_t<> from ATLHelpers to instantiate preferences_page_instances, or preferences_page_impl<> framework for your preferences_page code to cleanly workaround such cases.
+class preferences_page_instance : public service_base {
+ FB2K_MAKE_SERVICE_INTERFACE(preferences_page_instance, service_base)
+public:
+ //! @returns a combination of preferences_state constants.
+ virtual t_uint32 get_state() = 0;
+ //! @returns the window handle.
+ virtual HWND get_wnd() = 0;
+ //! Applies preferences changes.
+ virtual void apply() = 0;
+ //! Resets this page's content to the default values. Does not apply any changes - lets user preview the changes before hitting "apply".
+ virtual void reset() = 0;
+};
+
+//! \since 1.0
+//! Implements a preferences page.
+class preferences_page_v3 : public preferences_page_v2 {
+ FB2K_MAKE_SERVICE_INTERFACE(preferences_page_v3, preferences_page_v2)
+public:
+ virtual preferences_page_instance::ptr instantiate(HWND parent, preferences_page_callback::ptr callback) = 0;
+private:
+ HWND create(HWND p_parent) {throw pfc::exception_not_implemented();} //stub
+ bool reset_query() {return false;} //stub - the new apply-friendly reset should be used instead.
+ void reset() {} //stub
+};
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/replaygain.cpp b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/replaygain.cpp new file mode 100644 index 0000000000..caa22e6234 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/replaygain.cpp @@ -0,0 +1,223 @@ +#include "foobar2000.h"
+
+void t_replaygain_config::reset()
+{
+ m_source_mode = source_mode_none;
+ m_processing_mode = processing_mode_none;
+ m_preamp_without_rg = 0;
+ m_preamp_with_rg = 0;
+}
+
+audio_sample t_replaygain_config::query_scale(const file_info & p_info) const
+{
+ const audio_sample peak_margin = 1.0;//used to be 0.999 but it must not trigger on lossless
+
+ audio_sample peak = peak_margin;
+ audio_sample gain = 0;
+
+ bool have_rg_gain = false, have_rg_peak = false;
+
+ if (m_source_mode == source_mode_track || m_source_mode == source_mode_album)
+ {
+ replaygain_info info = p_info.get_replaygain();
+ float gain_select = replaygain_info::gain_invalid, peak_select = replaygain_info::peak_invalid;
+ if (m_source_mode == source_mode_track)
+ {
+ if (info.is_track_gain_present()) {gain = info.m_track_gain; have_rg_gain = true; }
+ else if (info.is_album_gain_present()) {gain = info.m_album_gain; have_rg_gain = true; }
+ if (info.is_track_peak_present()) {peak = info.m_track_peak; have_rg_peak = true; }
+ else if (info.is_album_peak_present()) {peak = info.m_album_peak; have_rg_peak = true; }
+ }
+ else
+ {
+ if (info.is_album_gain_present()) {gain = info.m_album_gain; have_rg_gain = true; }
+ else if (info.is_track_gain_present()) {gain = info.m_track_gain; have_rg_gain = true; }
+ if (info.is_album_peak_present()) {peak = info.m_album_peak; have_rg_peak = true; }
+ else if (info.is_track_peak_present()) {peak = info.m_track_peak; have_rg_peak = true; }
+ }
+ }
+
+ gain += have_rg_gain ? m_preamp_with_rg : m_preamp_without_rg;
+
+ audio_sample scale = 1.0;
+
+ if (m_processing_mode == processing_mode_gain || m_processing_mode == processing_mode_gain_and_peak)
+ {
+ scale *= audio_math::gain_to_scale(gain);
+ }
+
+ if (m_processing_mode == processing_mode_peak || m_processing_mode == processing_mode_gain_and_peak)
+ {
+ if (scale * peak > peak_margin)
+ scale = (audio_sample)(peak_margin / peak);
+ }
+
+ return scale;
+}
+
+audio_sample t_replaygain_config::query_scale(const metadb_handle_ptr & p_object) const
+{
+ audio_sample rv = 1.0;
+ p_object->metadb_lock();
+ const file_info * info;
+ if (p_object->get_info_async_locked(info))
+ rv = query_scale(*info);
+ p_object->metadb_unlock();
+ return rv;
+}
+
+audio_sample replaygain_manager::core_settings_query_scale(const file_info & p_info)
+{
+ t_replaygain_config temp;
+ get_core_settings(temp);
+ return temp.query_scale(p_info);
+}
+
+audio_sample replaygain_manager::core_settings_query_scale(const metadb_handle_ptr & info)
+{
+ t_replaygain_config temp;
+ get_core_settings(temp);
+ return temp.query_scale(info);
+}
+
+//enum t_source_mode {source_mode_none,source_mode_track,source_mode_album};
+//enum t_processing_mode {processing_mode_none,processing_mode_gain,processing_mode_gain_and_peak,processing_mode_peak};
+namespace {
+class format_dbdelta
+{
+public:
+ format_dbdelta(double p_val);
+ operator const char*() const {return m_buffer;}
+private:
+ pfc::string_fixed_t<128> m_buffer;
+};
+static const char * querysign(int val) {
+ return val<0 ? "-" : val>0 ? "+" : "\xc2\xb1";
+}
+
+format_dbdelta::format_dbdelta(double p_val) {
+ int val = (int)(p_val * 10);
+ m_buffer << querysign(val) << (abs(val)/10) << "." << (abs(val)%10) << "dB";
+}
+}
+void t_replaygain_config::format_name(pfc::string_base & p_out) const
+{
+ switch(m_processing_mode)
+ {
+ case processing_mode_none:
+ p_out = "None.";
+ break;
+ case processing_mode_gain:
+ switch(m_source_mode)
+ {
+ case source_mode_none:
+ if (m_preamp_without_rg == 0) p_out = "None.";
+ else p_out = pfc::string_formatter() << "Preamp : " << format_dbdelta(m_preamp_without_rg);
+ break;
+ case source_mode_track:
+ {
+ pfc::string_formatter fmt;
+ fmt << "Apply track gain";
+ if (m_preamp_without_rg != 0 || m_preamp_with_rg != 0) fmt << ", with preamp";
+ fmt << ".";
+ p_out = fmt;
+ }
+ break;
+ case source_mode_album:
+ {
+ pfc::string_formatter fmt;
+ fmt << "Apply album gain";
+ if (m_preamp_without_rg != 0 || m_preamp_with_rg != 0) fmt << ", with preamp";
+ fmt << ".";
+ p_out = fmt;
+ }
+ break;
+ };
+ break;
+ case processing_mode_gain_and_peak:
+ switch(m_source_mode)
+ {
+ case source_mode_none:
+ if (m_preamp_without_rg >= 0) p_out = "None.";
+ else p_out = pfc::string_formatter() << "Preamp : " << format_dbdelta(m_preamp_without_rg);
+ break;
+ case source_mode_track:
+ {
+ pfc::string_formatter fmt;
+ fmt << "Apply track gain";
+ if (m_preamp_without_rg != 0 || m_preamp_with_rg != 0) fmt << ", with preamp";
+ fmt << ", prevent clipping according to track peak.";
+ p_out = fmt;
+ }
+ break;
+ case source_mode_album:
+ {
+ pfc::string_formatter fmt;
+ fmt << "Apply album gain";
+ if (m_preamp_without_rg != 0 || m_preamp_with_rg != 0) fmt << ", with preamp";
+ fmt << ", prevent clipping according to album peak.";
+ p_out = fmt;
+ }
+ break;
+ };
+ break;
+ case processing_mode_peak:
+ switch(m_source_mode)
+ {
+ case source_mode_none:
+ p_out = "None.";
+ break;
+ case source_mode_track:
+ p_out = "Prevent clipping according to track peak.";
+ break;
+ case source_mode_album:
+ p_out = "Prevent clipping according to album peak.";
+ break;
+ };
+ break;
+ }
+}
+
+bool t_replaygain_config::is_active() const
+{
+ switch(m_processing_mode)
+ {
+ case processing_mode_none:
+ return false;
+ case processing_mode_gain:
+ switch(m_source_mode)
+ {
+ case source_mode_none:
+ return m_preamp_without_rg != 0;
+ case source_mode_track:
+ return true;
+ case source_mode_album:
+ return true;
+ };
+ return false;
+ case processing_mode_gain_and_peak:
+ switch(m_source_mode)
+ {
+ case source_mode_none:
+ return m_preamp_without_rg < 0;
+ case source_mode_track:
+ return true;
+ case source_mode_album:
+ return true;
+ };
+ return false;
+ case processing_mode_peak:
+ switch(m_source_mode)
+ {
+ case source_mode_none:
+ return false;
+ case source_mode_track:
+ return true;
+ case source_mode_album:
+ return true;
+ };
+ return false;
+ default:
+ return false;
+ }
+}
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/replaygain.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/replaygain.h new file mode 100644 index 0000000000..f3bfa43f3b --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/replaygain.h @@ -0,0 +1,66 @@ +//! Structure storing ReplayGain configuration: album/track source data modes, gain/peak processing modes and preamp values.
+struct t_replaygain_config
+{
+ enum /*t_source_mode*/ {source_mode_none,source_mode_track,source_mode_album};
+ enum /*t_processing_mode*/ {processing_mode_none,processing_mode_gain,processing_mode_gain_and_peak,processing_mode_peak};
+ typedef t_uint32 t_source_mode; typedef t_uint32 t_processing_mode;
+
+ t_replaygain_config() {reset();}
+ t_replaygain_config(t_source_mode p_source_mode,t_processing_mode p_processing_mode,float p_preamp_without_rg, float p_preamp_with_rg)
+ : m_source_mode(p_source_mode), m_processing_mode(p_processing_mode), m_preamp_without_rg(p_preamp_without_rg), m_preamp_with_rg(p_preamp_with_rg) {}
+
+
+ t_source_mode m_source_mode;
+ t_processing_mode m_processing_mode;
+ float m_preamp_without_rg, m_preamp_with_rg;//preamp values in dB
+
+ void reset();
+ audio_sample query_scale(const file_info & info) const;
+ audio_sample query_scale(const metadb_handle_ptr & info) const;
+
+ void format_name(pfc::string_base & p_out) const;
+ bool is_active() const;
+
+ static bool equals(const t_replaygain_config & v1, const t_replaygain_config & v2) {
+ return v1.m_source_mode == v2.m_source_mode && v1.m_processing_mode == v2.m_processing_mode && v1.m_preamp_without_rg == v2.m_preamp_without_rg && v1.m_preamp_with_rg == v2.m_preamp_with_rg;
+ }
+ bool operator==(const t_replaygain_config & other) const {return equals(*this, other);}
+ bool operator!=(const t_replaygain_config & other) const {return !equals(*this, other);}
+};
+
+FB2K_STREAM_READER_OVERLOAD(t_replaygain_config) {
+ return stream >> value.m_source_mode >> value.m_processing_mode >> value.m_preamp_with_rg >> value.m_preamp_without_rg;
+}
+FB2K_STREAM_WRITER_OVERLOAD(t_replaygain_config) {
+ return stream << value.m_source_mode << value.m_processing_mode << value.m_preamp_with_rg << value.m_preamp_without_rg;
+}
+
+//! Core service providing methods to retrieve/alter playback ReplayGain settings, as well as use ReplayGain configuration dialog.
+class NOVTABLE replaygain_manager : public service_base {
+public:
+ //! Retrieves playback ReplayGain settings.
+ virtual void get_core_settings(t_replaygain_config & p_out) = 0;
+
+ //! Creates embedded version of ReplayGain settings dialog. Note that embedded dialog sends WM_COMMAND with id/BN_CLICKED to parent window when user makes changes to settings.
+ virtual HWND configure_embedded(const t_replaygain_config & p_initdata,HWND p_parent,unsigned p_id,bool p_from_modal) = 0;
+ //! Retrieves settings from embedded version of ReplayGain settings dialog.
+ virtual void configure_embedded_retrieve(HWND wnd,t_replaygain_config & p_data) = 0;
+
+ //! Shows popup/modal version of ReplayGain settings dialog. Returns true when user changed the settings, false when user cancelled the operation. Title parameter can be null to use default one.
+ virtual bool configure_popup(t_replaygain_config & p_data,HWND p_parent,const char * p_title) = 0;
+
+ //! Alters playback ReplayGain settings.
+ virtual void set_core_settings(const t_replaygain_config & p_config) = 0;
+
+ //! New in 1.0
+ virtual void configure_embedded_set(HWND wnd, t_replaygain_config const & p_data) = 0;
+ //! New in 1.0
+ virtual void get_core_defaults(t_replaygain_config & out) = 0;
+
+ //! Helper; queries scale value for specified item according to core playback settings.
+ audio_sample core_settings_query_scale(const file_info & p_info);
+ //! Helper; queries scale value for specified item according to core playback settings.
+ audio_sample core_settings_query_scale(const metadb_handle_ptr & info);
+
+ FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(replaygain_manager);
+};
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/replaygain_info.cpp b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/replaygain_info.cpp new file mode 100644 index 0000000000..b63874bce8 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/replaygain_info.cpp @@ -0,0 +1,136 @@ +#include "foobar2000.h"
+
+bool replaygain_info::g_format_gain(float p_value,char p_buffer[text_buffer_size])
+{
+ fpu_control_roundnearest bah;
+ if (p_value == gain_invalid)
+ {
+ p_buffer[0] = 0;
+ return false;
+ }
+ else
+ {
+ pfc::float_to_string(p_buffer,text_buffer_size - 4,p_value,2,true);
+ strcat(p_buffer," dB");
+ return true;
+ }
+}
+
+bool replaygain_info::g_format_peak(float p_value,char p_buffer[text_buffer_size])
+{
+ fpu_control_roundnearest bah;
+ if (p_value == peak_invalid)
+ {
+ p_buffer[0] = 0;
+ return false;
+ }
+ else
+ {
+ pfc::float_to_string(p_buffer,text_buffer_size,p_value,6,false);
+ return true;
+ }
+}
+
+void replaygain_info::reset()
+{
+ m_album_gain = gain_invalid;
+ m_track_gain = gain_invalid;
+ m_album_peak = peak_invalid;
+ m_track_peak = peak_invalid;
+}
+
+static const char meta_album_gain[] = "replaygain_album_gain", meta_album_peak[] = "replaygain_album_peak", meta_track_gain[] = "replaygain_track_gain", meta_track_peak[] = "replaygain_track_peak";
+
+bool replaygain_info::g_is_meta_replaygain(const char * p_name,t_size p_name_len)
+{
+ return
+ stricmp_utf8_ex(p_name,p_name_len,meta_album_gain,~0) == 0 ||
+ stricmp_utf8_ex(p_name,p_name_len,meta_album_peak,~0) == 0 ||
+ stricmp_utf8_ex(p_name,p_name_len,meta_track_gain,~0) == 0 ||
+ stricmp_utf8_ex(p_name,p_name_len,meta_track_peak,~0) == 0;
+}
+
+bool replaygain_info::set_from_meta_ex(const char * p_name,t_size p_name_len,const char * p_value,t_size p_value_len)
+{
+ fpu_control_roundnearest bah;
+ if (stricmp_utf8_ex(p_name,p_name_len,meta_album_gain,~0) == 0)
+ {
+ m_album_gain = (float)pfc::string_to_float(p_value,p_value_len);
+ return true;
+ }
+ else if (stricmp_utf8_ex(p_name,p_name_len,meta_album_peak,~0) == 0)
+ {
+ m_album_peak = (float)pfc::string_to_float(p_value,p_value_len);
+ if (m_album_peak < 0) m_album_peak = 0;
+ return true;
+ }
+ else if (stricmp_utf8_ex(p_name,p_name_len,meta_track_gain,~0) == 0)
+ {
+ m_track_gain = (float)pfc::string_to_float(p_value,p_value_len);
+ return true;
+ }
+ else if (stricmp_utf8_ex(p_name,p_name_len,meta_track_peak,~0) == 0)
+ {
+ m_track_peak = (float)pfc::string_to_float(p_value,p_value_len);
+ if (m_track_peak < 0) m_track_peak = 0;
+ return true;
+ }
+ else return false;
+}
+
+
+t_size replaygain_info::get_value_count()
+{
+ t_size ret = 0;
+ if (is_album_gain_present()) ret++;
+ if (is_album_peak_present()) ret++;
+ if (is_track_gain_present()) ret++;
+ if (is_track_peak_present()) ret++;
+ return ret;
+}
+
+void replaygain_info::set_album_gain_text(const char * p_text,t_size p_text_len)
+{
+ fpu_control_roundnearest bah;
+ if (p_text != 0 && p_text_len > 0 && *p_text != 0)
+ m_album_gain = (float)pfc::string_to_float(p_text,p_text_len);
+ else
+ remove_album_gain();
+}
+
+void replaygain_info::set_track_gain_text(const char * p_text,t_size p_text_len)
+{
+ fpu_control_roundnearest bah;
+ if (p_text != 0 && p_text_len > 0 && *p_text != 0)
+ m_track_gain = (float)pfc::string_to_float(p_text,p_text_len);
+ else
+ remove_track_gain();
+}
+
+void replaygain_info::set_album_peak_text(const char * p_text,t_size p_text_len)
+{
+ fpu_control_roundnearest bah;
+ if (p_text != 0 && p_text_len > 0 && *p_text != 0)
+ m_album_peak = (float)pfc::string_to_float(p_text,p_text_len);
+ else
+ remove_album_peak();
+}
+
+void replaygain_info::set_track_peak_text(const char * p_text,t_size p_text_len)
+{
+ fpu_control_roundnearest bah;
+ if (p_text != 0 && p_text_len > 0 && *p_text != 0)
+ m_track_peak = (float)pfc::string_to_float(p_text,p_text_len);
+ else
+ remove_track_peak();
+}
+
+replaygain_info replaygain_info::g_merge(replaygain_info r1,replaygain_info r2)
+{
+ replaygain_info ret = r1;
+ if (!ret.is_album_gain_present()) ret.m_album_gain = r2.m_album_gain;
+ if (!ret.is_album_peak_present()) ret.m_album_peak = r2.m_album_peak;
+ if (!ret.is_track_gain_present()) ret.m_track_gain = r2.m_track_gain;
+ if (!ret.is_track_peak_present()) ret.m_track_peak = r2.m_track_peak;
+ return ret;
+}
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/replaygain_scanner.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/replaygain_scanner.h new file mode 100644 index 0000000000..0224d8a9f8 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/replaygain_scanner.h @@ -0,0 +1,37 @@ +//! Container of ReplayGain scan results from one or more tracks.
+class replaygain_result : public service_base {
+ FB2K_MAKE_SERVICE_INTERFACE(replaygain_result, service_base);
+public:
+ //! Retrieves the gain value, in dB.
+ virtual float get_gain() = 0;
+ //! Retrieves the peak value, normalized to 0..1 range (audio_sample value).
+ virtual float get_peak() = 0;
+ //! Merges ReplayGain scan results from different tracks. Merge results from all tracks in an album to get album gain/peak values. \n
+ //! This function returns a newly created replaygain_result object. Existing replaygain_result objects remain unaltered.
+ virtual replaygain_result::ptr merge(replaygain_result::ptr other) = 0;
+};
+
+//! Instance of a ReplayGain scanner. \n
+//! Use static_api_ptr_t<replaygain_scanner_entry>()->instantiate() to create a replaygain_scanner object; see replaygain_scanner_entry for more info. \n
+//! Typical use: call process_chunk() with each chunk read from your track, call finalize() to obtain results for this track and reset replaygain_scanner's state for scanning another track; to obtain album gain/peak values, merge results (replaygain_result::merge) from all tracks. \n
+class replaygain_scanner : public service_base {
+ FB2K_MAKE_SERVICE_INTERFACE(replaygain_scanner, service_base);
+public:
+ //! Processes a PCM chunk. \n
+ //! May throw exception_io_data if the chunk contains something that can't be processed properly.
+ virtual void process_chunk(const audio_chunk & chunk) = 0;
+ //! Finalizes the scanning process; resets scanner's internal state and returns results for the track we've just scanned. \n
+ //! After calling finalize(), scanner's state becomes the same as after instantiation; you can continue with processing another track without creating a new scanner object.
+ virtual replaygain_result::ptr finalize() = 0;
+};
+
+
+//! Entrypoint class for instantiating replaygain_scanner objects. Use static_api_ptr_t<replaygain_scanner_entry>()->instantiate() to create replaygain_scanner instances. \n
+//! This service is OPTIONAL; it's available from foobar2000 0.9.5.3 up but only if the ReplayGain Scanner component is installed. \n
+//! It is recommended that you use replaygain_scanner like this: try { myInstance = static_api_ptr_t<replaygain_scanner_entry>()->instantiate(); } catch(exception_service_not_found) { /* too old foobar2000 version or no foo_rgscan installed - complain/fail/etc */ }
+class replaygain_scanner_entry : public service_base {
+ FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(replaygain_scanner_entry);
+public:
+ //! Instantiates a replaygain_scanner object.
+ virtual replaygain_scanner::ptr instantiate() = 0;
+};
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/resampler.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/resampler.h new file mode 100644 index 0000000000..de46269605 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/resampler.h @@ -0,0 +1,25 @@ +class NOVTABLE resampler_entry : public dsp_entry
+{
+public:
+ virtual bool is_conversion_supported(unsigned p_srate_from,unsigned p_srate_to) = 0;
+ virtual bool create_preset(dsp_preset & p_out,unsigned p_target_srate,float p_qualityscale) = 0;//p_qualityscale is 0...1
+ virtual float get_priority() = 0;//value is 0...1, where high-quality (SSRC etc) has 1
+
+ static bool g_get_interface(service_ptr_t<resampler_entry> & p_out,unsigned p_srate_from,unsigned p_srate_to);
+ static bool g_create(service_ptr_t<dsp> & p_out,unsigned p_srate_from,unsigned p_srate_to,float p_qualityscale);
+ static bool g_create_preset(dsp_preset & p_out,unsigned p_srate_from,unsigned p_srate_to,float p_qualityscale);
+
+ FB2K_MAKE_SERVICE_INTERFACE(resampler_entry,dsp_entry);
+};
+
+template<typename T>
+class resampler_entry_impl_t : public dsp_entry_impl_t<T,resampler_entry>
+{
+public:
+ bool is_conversion_supported(unsigned p_srate_from,unsigned p_srate_to) {return T::g_is_conversion_supported(p_srate_from,p_srate_to);}
+ bool create_preset(dsp_preset & p_out,unsigned p_target_srate,float p_qualityscale) {return T::g_create_preset(p_out,p_target_srate,p_qualityscale);}
+ float get_priority() {return T::g_get_priority();}
+};
+
+template<typename T>
+class resampler_factory_t : public service_factory_single_t<resampler_entry_impl_t<T> > {};
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/search_tools.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/search_tools.h new file mode 100644 index 0000000000..91c4fadbf1 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/search_tools.h @@ -0,0 +1,68 @@ +//! Instance of a search filter object. New in 0.9.5. \n
+//! This object contains a preprocessed search query; used to perform filtering similar to Media Library Search or Album List's "filter" box. \n
+//! Use search_filter_manager API to instantiate search_filter objects.
+class search_filter : public service_base {
+public:
+ //! For backwards compatibility with older (0.9.5 alpha) revisions of this API. Do not call.
+ virtual bool test_locked(const metadb_handle_ptr & p_item,const file_info * p_info) = 0;
+
+ //! Use this to run this filter on a group of items.
+ //! @param data Items to test.
+ //! @param out Pointer to a buffer (size at least equal to number of items in the source list) receiving the results.
+ virtual void test_multi(metadb_handle_list_cref data, bool * out) = 0;
+
+ FB2K_MAKE_SERVICE_INTERFACE(search_filter,service_base);
+};
+
+//! New in 0.9.5.3. You can obtain a search_filter_v2 pointer by using service_query() on a search_filter pointer, or from search_filter_manager_v2::create_ex().
+class search_filter_v2 : public search_filter {
+public:
+ virtual bool get_sort_pattern(titleformat_object::ptr & out, int & direction) = 0;
+
+ //! Abortable version of test_multi(). If the abort_callback object becomes signaled while the operation is being performed, contents of the output buffer are undefined and the operation will fail with exception_aborted.
+ virtual void test_multi_ex(metadb_handle_list_cref data, bool * out, abort_callback & abort) = 0;
+
+ FB2K_MAKE_SERVICE_INTERFACE(search_filter_v2, search_filter)
+};
+
+//! New in 0.9.5.4. You can obtain a search_filter_v2 pointer by using service_query() on a search_filter/search_filter_v2 pointer.
+class search_filter_v3 : public search_filter_v2 {
+public:
+ //! Returns whether the sort pattern returned by get_sort_pattern() was set by the user explicitly using "SORT BY" syntax or whether it was determined implicitly from some other part of the query. It's recommended to use this to determine whether to create a force-sorted autoplaylist or not.
+ virtual bool is_sort_explicit() = 0;
+
+ FB2K_MAKE_SERVICE_INTERFACE(search_filter_v3, search_filter_v2)
+};
+
+//! Entrypoint class to instantiate search_filter objects. New in 0.9.5.
+class search_filter_manager : public service_base {
+public:
+ //! Creates a search_filter object. Throws an exception on failure (such as an error in the query). It's recommended that you relay the exception message to the user if this function fails.
+ virtual search_filter::ptr create(const char * p_query) = 0;
+
+ //! Retrieves the search expression manual string. See also: show_manual().
+ virtual void get_manual(pfc::string_base & p_out) = 0;
+
+ void show_manual() {
+ pfc::string8 temp;
+ get_manual(temp);
+ popup_message::g_show(temp,"Search Expression Reference");
+ }
+ FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(search_filter_manager);
+};
+
+//! New in 0.9.5.3.
+class search_filter_manager_v2 : public search_filter_manager {
+public:
+ enum {
+ KFlagAllowSort = 1 << 0,
+ };
+ //! Creates a search_filter object. Throws an exception on failure (such as an error in the query). It's recommended that you relay the exception message to the user if this function fails.
+ //! @param changeNotify A completion_notify callback object that will get called each time the query's behavior changes as a result of some external event (such as system time change). The caller must refresh query results each time this callback is triggered. The status parameter of it's on_completion() parameter is unused and always set to zero.
+ virtual search_filter_v2::ptr create_ex(const char * query, completion_notify::ptr changeNotify, t_uint32 flags) = 0;
+
+ //! Opens the search query syntax reference document, typically an external HTML in user's default web browser.
+ virtual void show_manual() = 0;
+
+ FB2K_MAKE_SERVICE_INTERFACE(search_filter_manager_v2, search_filter_manager);
+};
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/service.cpp b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/service.cpp new file mode 100644 index 0000000000..a26f4d5742 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/service.cpp @@ -0,0 +1,59 @@ +#include "foobar2000.h"
+#include "component.h"
+
+foobar2000_api * g_foobar2000_api = NULL;
+
+service_class_ref service_factory_base::enum_find_class(const GUID & p_guid)
+{
+ PFC_ASSERT(core_api::are_services_available() && g_foobar2000_api);
+ return g_foobar2000_api->service_enum_find_class(p_guid);
+}
+
+bool service_factory_base::enum_create(service_ptr_t<service_base> & p_out,service_class_ref p_class,t_size p_index)
+{
+ PFC_ASSERT(core_api::are_services_available() && g_foobar2000_api);
+ return g_foobar2000_api->service_enum_create(p_out,p_class,p_index);
+}
+
+t_size service_factory_base::enum_get_count(service_class_ref p_class)
+{
+ PFC_ASSERT(core_api::are_services_available() && g_foobar2000_api);
+ return g_foobar2000_api->service_enum_get_count(p_class);
+}
+
+service_factory_base * service_factory_base::__internal__list = NULL;
+
+
+
+
+
+namespace {
+ class main_thread_callback_release_object : public main_thread_callback {
+ public:
+ main_thread_callback_release_object(service_ptr obj) : m_object(obj) {}
+ void callback_run() {
+ try { m_object.release(); } catch(...) {}
+ }
+ private:
+ service_ptr m_object;
+ };
+}
+namespace service_impl_helper {
+ void release_object_delayed(service_ptr obj) {
+ static_api_ptr_t<main_thread_callback_manager>()->add_callback(new service_impl_t<main_thread_callback_release_object>(obj));
+ }
+};
+
+
+void _standard_api_create_internal(service_ptr & out, const GUID & classID) {
+ service_class_ref c = service_factory_base::enum_find_class(classID);
+ switch(service_factory_base::enum_get_count(c)) {
+ case 0:
+ throw exception_service_not_found();
+ case 1:
+ PFC_ASSERT_SUCCESS( service_factory_base::enum_create(out, c, 0) );
+ break;
+ default:
+ throw exception_service_duplicated();
+ }
+}
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/service.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/service.h new file mode 100644 index 0000000000..4d04f3f934 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/service.h @@ -0,0 +1,719 @@ +#ifndef _foobar2000_sdk_service_h_included_
+#define _foobar2000_sdk_service_h_included_
+
+typedef const void* service_class_ref;
+
+PFC_DECLARE_EXCEPTION(exception_service_not_found,pfc::exception,"Service not found");
+PFC_DECLARE_EXCEPTION(exception_service_extension_not_found,pfc::exception,"Service extension not found");
+PFC_DECLARE_EXCEPTION(exception_service_duplicated,pfc::exception,"Service duplicated");
+
+#ifdef _MSC_VER
+#define FOOGUIDDECL __declspec(selectany)
+#else
+#define FOOGUIDDECL
+#endif
+
+
+#define DECLARE_GUID(NAME,A,S,D,F,G,H,J,K,L,Z,X) FOOGUIDDECL const GUID NAME = {A,S,D,{F,G,H,J,K,L,Z,X}};
+#define DECLARE_CLASS_GUID(NAME,A,S,D,F,G,H,J,K,L,Z,X) FOOGUIDDECL const GUID NAME::class_guid = {A,S,D,{F,G,H,J,K,L,Z,X}};
+
+//! Special hack to ensure errors when someone tries to ->service_add_ref()/->service_release() on a service_ptr_t
+template<typename T> class service_obscure_refcounting : public T {
+private:
+ int service_add_ref() throw();
+ int service_release() throw();
+};
+
+//! Converts a service interface pointer to a pointer that obscures service counter functionality.
+template<typename T> static inline service_obscure_refcounting<T>* service_obscure_refcounting_cast(T * p_source) throw() {return static_cast<service_obscure_refcounting<T>*>(p_source);}
+
+//Must be templated instead of taking service_base* because of multiple inheritance issues.
+template<typename T> static void service_release_safe(T * p_ptr) throw() {
+ if (p_ptr != NULL) PFC_ASSERT_NO_EXCEPTION( p_ptr->service_release() );
+}
+
+//Must be templated instead of taking service_base* because of multiple inheritance issues.
+template<typename T> static void service_add_ref_safe(T * p_ptr) throw() {
+ if (p_ptr != NULL) PFC_ASSERT_NO_EXCEPTION( p_ptr->service_add_ref() );
+}
+
+class service_base;
+
+template<typename T>
+class service_ptr_base_t {
+public:
+ inline T* get_ptr() const throw() {return m_ptr;}
+protected:
+ T * m_ptr;
+};
+
+// forward declaration
+template<typename T> class service_nnptr_t;
+
+//! Autopointer class to be used with all services. Manages reference counter calls behind-the-scenes.
+template<typename T>
+class service_ptr_t : public service_ptr_base_t<T> {
+private:
+ typedef service_ptr_t<T> t_self;
+
+ template<typename t_source> void _init(t_source * in) {
+ m_ptr = in;
+ if (m_ptr) m_ptr->service_add_ref();
+ }
+public:
+ service_ptr_t() throw() {m_ptr = NULL;}
+ service_ptr_t(T * p_ptr) throw() {_init(p_ptr);}
+ service_ptr_t(const t_self & p_source) throw() {_init(p_source.get_ptr());}
+ template<typename t_source> service_ptr_t(t_source * p_ptr) throw() {_init(p_ptr);}
+ template<typename t_source> service_ptr_t(const service_ptr_base_t<t_source> & p_source) throw() {_init(p_source.get_ptr());}
+
+ template<typename t_source> service_ptr_t(const service_nnptr_t<t_source> & p_source) throw() { m_ptr = p_source.get_ptr(); m_ptr->service_add_ref(); }
+
+ ~service_ptr_t() throw() {service_release_safe(m_ptr);}
+
+ template<typename t_source>
+ void copy(t_source * p_ptr) throw() {
+ service_add_ref_safe(p_ptr);
+ service_release_safe(m_ptr);
+ m_ptr = pfc::safe_ptr_cast<T>(p_ptr);
+ }
+
+ template<typename t_source>
+ void copy(const service_ptr_base_t<t_source> & p_source) throw() {copy(p_source.get_ptr());}
+
+
+ inline const t_self & operator=(const t_self & p_source) throw() {copy(p_source); return *this;}
+ inline const t_self & operator=(T * p_ptr) throw() {copy(p_ptr); return *this;}
+
+ template<typename t_source> inline t_self & operator=(const service_ptr_base_t<t_source> & p_source) throw() {copy(p_source); return *this;}
+ template<typename t_source> inline t_self & operator=(t_source * p_ptr) throw() {copy(p_ptr); return *this;}
+
+ template<typename t_source> inline t_self & operator=(const service_nnptr_t<t_source> & p_ptr) throw() {
+ service_release_safe(m_ptr);
+ t_source * ptr = p_ptr.get_ptr();
+ ptr->service_add_ref();
+ m_ptr = ptr;
+ return *this;
+ }
+
+ inline void release() throw() {
+ service_release_safe(m_ptr);
+ m_ptr = NULL;
+ }
+
+
+ inline service_obscure_refcounting<T>* operator->() const throw() {PFC_ASSERT(m_ptr != NULL);return service_obscure_refcounting_cast(m_ptr);}
+
+ inline T* get_ptr() const throw() {return m_ptr;}
+
+ inline bool is_valid() const throw() {return m_ptr != NULL;}
+ inline bool is_empty() const throw() {return m_ptr == NULL;}
+
+ inline bool operator==(const t_self & p_item) const throw() {return m_ptr == p_item.get_ptr();}
+ inline bool operator!=(const t_self & p_item) const throw() {return m_ptr != p_item.get_ptr();}
+ inline bool operator>(const t_self & p_item) const throw() {return m_ptr > p_item.get_ptr();}
+ inline bool operator<(const t_self & p_item) const throw() {return m_ptr < p_item.get_ptr();}
+
+ template<typename t_other>
+ inline t_self & operator<<(service_ptr_t<t_other> & p_source) throw() {attach(p_source.detach());return *this;}
+ template<typename t_other>
+ inline t_self & operator>>(service_ptr_t<t_other> & p_dest) throw() {p_dest.attach(detach());return *this;}
+
+
+ inline T* _duplicate_ptr() const throw() {//should not be used ! temporary !
+ service_add_ref_safe(m_ptr);
+ return m_ptr;
+ }
+
+ inline T* detach() throw() {
+ return pfc::replace_null_t(m_ptr);
+ }
+
+ template<typename t_source>
+ inline void attach(t_source * p_ptr) throw() {
+ service_release_safe(m_ptr);
+ m_ptr = pfc::safe_ptr_cast<T>(p_ptr);
+ }
+
+ T & operator*() const throw() {return *m_ptr;}
+
+ service_ptr_t<service_base> & _as_base_ptr() {
+ PFC_ASSERT( _as_base_ptr_check() );
+ return *reinterpret_cast<service_ptr_t<service_base>*>(this);
+ }
+ static bool _as_base_ptr_check() {
+ return static_cast<service_base*>((T*)NULL) == reinterpret_cast<service_base*>((T*)NULL);
+ }
+};
+
+//! Autopointer class to be used with all services. Manages reference counter calls behind-the-scenes. \n
+//! This assumes that the pointers are valid all the time (can't point to null). Mainly intended to be used for scenarios where null pointers are not valid and relevant code should crash ASAP if somebody passes invalid pointers around. \n
+//! You want to use service_ptr_t<> rather than service_nnptr_t<> most of the time.
+template<typename T>
+class service_nnptr_t : public service_ptr_base_t<T> {
+private:
+ typedef service_nnptr_t<T> t_self;
+
+ template<typename t_source> void _init(t_source * in) {
+ m_ptr = in;
+ m_ptr->service_add_ref();
+ }
+ service_nnptr_t() throw() {pfc::crash();}
+public:
+ service_nnptr_t(T * p_ptr) throw() {_init(p_ptr);}
+ service_nnptr_t(const t_self & p_source) throw() {_init(p_source.get_ptr());}
+ template<typename t_source> service_nnptr_t(t_source * p_ptr) throw() {_init(p_ptr);}
+ template<typename t_source> service_nnptr_t(const service_ptr_base_t<t_source> & p_source) throw() {_init(p_source.get_ptr());}
+
+ ~service_nnptr_t() throw() {m_ptr->service_release();}
+
+ template<typename t_source>
+ void copy(t_source * p_ptr) throw() {
+ p_ptr->service_add_ref();
+ m_ptr->service_release();
+ m_ptr = pfc::safe_ptr_cast<T>(p_ptr);
+ }
+
+ template<typename t_source>
+ void copy(const service_ptr_base_t<t_source> & p_source) throw() {copy(p_source.get_ptr());}
+
+
+ inline const t_self & operator=(const t_self & p_source) throw() {copy(p_source); return *this;}
+ inline const t_self & operator=(T * p_ptr) throw() {copy(p_ptr); return *this;}
+
+ template<typename t_source> inline t_self & operator=(const service_ptr_base_t<t_source> & p_source) throw() {copy(p_source); return *this;}
+ template<typename t_source> inline t_self & operator=(t_source * p_ptr) throw() {copy(p_ptr); return *this;}
+
+
+ inline service_obscure_refcounting<T>* operator->() const throw() {PFC_ASSERT(m_ptr != NULL);return service_obscure_refcounting_cast(m_ptr);}
+
+ inline T* get_ptr() const throw() {return m_ptr;}
+
+ inline bool is_valid() const throw() {return true;}
+ inline bool is_empty() const throw() {return false;}
+
+ inline bool operator==(const t_self & p_item) const throw() {return m_ptr == p_item.get_ptr();}
+ inline bool operator!=(const t_self & p_item) const throw() {return m_ptr != p_item.get_ptr();}
+ inline bool operator>(const t_self & p_item) const throw() {return m_ptr > p_item.get_ptr();}
+ inline bool operator<(const t_self & p_item) const throw() {return m_ptr < p_item.get_ptr();}
+
+ inline T* _duplicate_ptr() const throw() {//should not be used ! temporary !
+ service_add_ref_safe(m_ptr);
+ return m_ptr;
+ }
+
+ T & operator*() const throw() {return *m_ptr;}
+
+ service_ptr_t<service_base> & _as_base_ptr() {
+ PFC_ASSERT( _as_base_ptr_check() );
+ return *reinterpret_cast<service_ptr_t<service_base>*>(this);
+ }
+ static bool _as_base_ptr_check() {
+ return static_cast<service_base*>((T*)NULL) == reinterpret_cast<service_base*>((T*)NULL);
+ }
+};
+
+namespace pfc {
+ class traits_service_ptr : public traits_default {
+ public:
+ enum { realloc_safe = true, constructor_may_fail = false};
+ };
+
+ template<typename T> class traits_t<service_ptr_t<T> > : public traits_service_ptr {};
+ template<typename T> class traits_t<service_nnptr_t<T> > : public traits_service_ptr {};
+}
+
+
+template<typename T, template<typename> class t_alloc = pfc::alloc_fast>
+class service_list_t : public pfc::list_t<service_ptr_t<T>, t_alloc >
+{
+};
+
+//! Helper macro for use when defining a service class. Generates standard features of a service, without ability to register using service_factory / enumerate using service_enum_t. \n
+//! This is used for declaring services that are meant to be instantiated by means other than service_enum_t (or non-entrypoint services), or extensions of services (including extension of entrypoint services). \n
+//! Sample non-entrypoint declaration: class myclass : public service_base {...; FB2K_MAKE_SERVICE_INTERFACE(myclass, service_base); }; \n
+//! Sample extension declaration: class myclass : public myotherclass {...; FB2K_MAKE_SERVICE_INTERFACE(myclass, myotherclass); }; \n
+//! This macro is intended for use ONLY WITH INTERFACE CLASSES, not with implementation classes.
+#define FB2K_MAKE_SERVICE_INTERFACE(THISCLASS,PARENTCLASS) \
+ public: \
+ typedef THISCLASS t_interface; \
+ typedef PARENTCLASS t_interface_parent; \
+ \
+ static const GUID class_guid; \
+ \
+ virtual bool service_query(service_ptr_t<service_base> & p_out,const GUID & p_guid) { \
+ if (p_guid == class_guid) {p_out = this; return true;} \
+ else return PARENTCLASS::service_query(p_out,p_guid); \
+ } \
+ typedef service_ptr_t<t_interface> ptr; \
+ typedef service_nnptr_t<t_interface> nnptr; \
+ protected: \
+ THISCLASS() {} \
+ ~THISCLASS() {} \
+ private: \
+ const THISCLASS & operator=(const THISCLASS &) {throw pfc::exception_not_implemented();} \
+ THISCLASS(const THISCLASS &) {throw pfc::exception_not_implemented();} \
+ private: \
+ void __private__service_declaration_selftest() { \
+ pfc::assert_same_type<PARENTCLASS,PARENTCLASS::t_interface>(); /*parentclass must be an interface*/ \
+ __validate_service_class_helper<THISCLASS>(); /*service_base must be reachable by walking t_interface_parent*/ \
+ pfc::implicit_cast<service_base*>(this); /*this class must derive from service_base, directly or indirectly, and be implictly castable to it*/ \
+ }
+
+//! Helper macro for use when defining an entrypoint service class. Generates standard features of a service, including ability to register using service_factory and enumerate using service_enum. \n
+//! Sample declaration: class myclass : public service_base {...; FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(myclass); }; \n
+//! Note that entrypoint service classes must directly derive from service_base, and not from another service class.
+//! This macro is intended for use ONLY WITH INTERFACE CLASSES, not with implementation classes.
+#define FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(THISCLASS) \
+ public: \
+ typedef THISCLASS t_interface_entrypoint; \
+ FB2K_MAKE_SERVICE_INTERFACE(THISCLASS,service_base)
+
+
+#define FB2K_DECLARE_SERVICE_BEGIN(THISCLASS,BASECLASS) \
+ class NOVTABLE THISCLASS : public BASECLASS { \
+ FB2K_MAKE_SERVICE_INTERFACE(THISCLASS,BASECLASS); \
+ public:
+
+#define FB2K_DECLARE_SERVICE_END() \
+ };
+
+#define FB2K_DECLARE_SERVICE_ENTRYPOINT_BEGIN(THISCLASS) \
+ class NOVTABLE THISCLASS : public service_base { \
+ FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(THISCLASS) \
+ public:
+
+
+//! Base class for all service classes.\n
+//! Provides interfaces for reference counter and querying for different interfaces supported by the object.\n
+class NOVTABLE service_base
+{
+public:
+ //! Decrements reference count; deletes the object if reference count reaches zero. This is normally not called directly but managed by service_ptr_t<> template.
+ //! @returns New reference count. For debug purposes only, in certain conditions return values may be unreliable.
+ virtual int service_release() throw() = 0;
+ //! Increments reference count. This is normally not called directly but managed by service_ptr_t<> template.
+ //! @returns New reference count. For debug purposes only, in certain conditions return values may be unreliable.
+ virtual int service_add_ref() throw() = 0;
+ //! Queries whether the object supports specific interface and retrieves a pointer to that interface. This is normally not called directly but managed by service_query_t<> function template.
+ //! Typical implementation checks the parameter against GUIDs of interfaces supported by this object, if the GUID is one of supported interfaces, p_out is set to service_base pointer that can be static_cast<>'ed to queried interface and the method returns true; otherwise the method returns false.
+ virtual bool service_query(service_ptr_t<service_base> & p_out,const GUID & p_guid) {return false;}
+
+ //! Queries whether the object supports specific interface and retrieves a pointer to that interface.
+ //! @param p_out Receives pointer to queried interface on success.
+ //! returns true on success, false on failure (interface not supported by the object).
+ template<class T>
+ bool service_query_t(service_ptr_t<T> & p_out)
+ {
+ pfc::assert_same_type<T,T::t_interface>();
+ return service_query( *reinterpret_cast<service_ptr_t<service_base>*>(&p_out),T::class_guid);
+ }
+
+ typedef service_base t_interface;
+
+protected:
+ service_base() {}
+ ~service_base() {}
+private:
+ service_base(const service_base&) {throw pfc::exception_not_implemented();}
+ const service_base & operator=(const service_base&) {throw pfc::exception_not_implemented();}
+};
+
+typedef service_ptr_t<service_base> service_ptr;
+typedef service_nnptr_t<service_base> service_nnptr;
+
+template<typename T>
+static void __validate_service_class_helper() {
+ __validate_service_class_helper<T::t_interface_parent>();
+}
+
+template<>
+static void __validate_service_class_helper<service_base>() {}
+
+
+#include "service_impl.h"
+
+class NOVTABLE service_factory_base {
+protected:
+ inline service_factory_base(const GUID & p_guid, service_factory_base * & factoryList) : m_guid(p_guid) {PFC_ASSERT(!core_api::are_services_available());__internal__next=factoryList;factoryList=this;}
+ inline ~service_factory_base() {PFC_ASSERT(!core_api::are_services_available());}
+public:
+ inline const GUID & get_class_guid() const {return m_guid;}
+
+ static service_class_ref enum_find_class(const GUID & p_guid);
+ static bool enum_create(service_ptr_t<service_base> & p_out,service_class_ref p_class,t_size p_index);
+ static t_size enum_get_count(service_class_ref p_class);
+
+ inline static bool is_service_present(const GUID & g) {return enum_get_count(enum_find_class(g))>0;}
+
+ //! Throws std::bad_alloc or another exception on failure.
+ virtual void instance_create(service_ptr_t<service_base> & p_out) = 0;
+
+ //! FOR INTERNAL USE ONLY
+ static service_factory_base *__internal__list;
+ //! FOR INTERNAL USE ONLY
+ service_factory_base * __internal__next;
+private:
+ const GUID & m_guid;
+};
+
+template<typename B>
+class service_factory_traits {
+public:
+ static service_factory_base * & factory_list() {return service_factory_base::__internal__list;}
+};
+
+template<typename B>
+class service_factory_base_t : public service_factory_base {
+public:
+ service_factory_base_t() : service_factory_base(B::class_guid, service_factory_traits<B>::factory_list()) {
+ pfc::assert_same_type<B,B::t_interface_entrypoint>();
+ }
+};
+
+template<typename T> static void _validate_service_ptr(service_ptr_t<T> const & ptr) {
+ PFC_ASSERT( ptr.is_valid() );
+ service_ptr_t<T> test;
+ PFC_ASSERT( ptr->service_query_t(test) );
+}
+
+#ifdef _DEBUG
+#define FB2K_ASSERT_VALID_SERVICE_PTR(ptr) _validate_service_ptr(ptr)
+#else
+#define FB2K_ASSERT_VALID_SERVICE_PTR(ptr)
+#endif
+
+template<class T> static bool service_enum_create_t(service_ptr_t<T> & p_out,t_size p_index) {
+ pfc::assert_same_type<T,T::t_interface_entrypoint>();
+ service_ptr_t<service_base> ptr;
+ if (service_factory_base::enum_create(ptr,service_factory_base::enum_find_class(T::class_guid),p_index)) {
+ p_out = static_cast<T*>(ptr.get_ptr());
+ return true;
+ } else {
+ p_out.release();
+ return false;
+ }
+}
+
+template<typename T> static service_class_ref _service_find_class() {
+ pfc::assert_same_type<T,T::t_interface_entrypoint>();
+ return service_factory_base::enum_find_class(T::class_guid);
+}
+
+template<typename what>
+static bool _service_instantiate_helper(service_ptr_t<what> & out, service_class_ref servClass, t_size index) {
+ /*if (out._as_base_ptr_check()) {
+ const bool state = service_factory_base::enum_create(out._as_base_ptr(), servClass, index);
+ if (state) { FB2K_ASSERT_VALID_SERVICE_PTR(out); }
+ return state;
+ } else */{
+ service_ptr temp;
+ const bool state = service_factory_base::enum_create(temp, servClass, index);
+ if (state) {
+ out.attach( static_cast<what*>( temp.detach() ) );
+ FB2K_ASSERT_VALID_SERVICE_PTR( out );
+ }
+ return state;
+ }
+}
+
+template<typename T> class service_class_helper_t {
+public:
+ service_class_helper_t() : m_class(service_factory_base::enum_find_class(T::class_guid)) {
+ pfc::assert_same_type<T,T::t_interface_entrypoint>();
+ }
+ t_size get_count() const {
+ return service_factory_base::enum_get_count(m_class);
+ }
+
+ bool create(service_ptr_t<T> & p_out,t_size p_index) const {
+ return _service_instantiate_helper(p_out, m_class, p_index);
+ }
+
+ service_ptr_t<T> create(t_size p_index) const {
+ service_ptr_t<T> temp;
+ if (!create(temp,p_index)) throw pfc::exception_bug_check_v2();
+ return temp;
+ }
+ service_class_ref get_class() const {return m_class;}
+private:
+ service_class_ref m_class;
+};
+
+void _standard_api_create_internal(service_ptr & out, const GUID & classID);
+
+template<typename T> static void standard_api_create_t(service_ptr_t<T> & p_out) {
+ if (pfc::is_same_type<T,T::t_interface_entrypoint>::value) {
+ _standard_api_create_internal(p_out._as_base_ptr(), T::class_guid);
+ FB2K_ASSERT_VALID_SERVICE_PTR(p_out);
+ } else {
+ service_ptr_t<T::t_interface_entrypoint> temp;
+ standard_api_create_t(temp);
+ if (!temp->service_query_t(p_out)) throw exception_service_extension_not_found();
+ }
+}
+
+template<typename T> static void standard_api_create_t(T* & p_out) {
+ p_out = NULL;
+ standard_api_create_t( *reinterpret_cast< service_ptr_t<T> * >( & p_out ) );
+}
+
+template<typename T> static service_ptr_t<T> standard_api_create_t() {
+ service_ptr_t<T> temp;
+ standard_api_create_t(temp);
+ return temp;
+}
+
+template<typename T>
+static bool static_api_test_t() {
+ typedef T::t_interface_entrypoint EP;
+ service_class_helper_t<EP> helper;
+ if (helper.get_count() != 1) return false;
+ if (!pfc::is_same_type<T,EP>::value) {
+ service_ptr_t<T> t;
+ if (!helper.create(0)->service_query_t(t)) return false;
+ }
+ return true;
+}
+
+#define FB2K_API_AVAILABLE(API) static_api_test_t<API>()
+
+//! Helper template used to easily access core services. \n
+//! Usage: static_api_ptr_t<myclass> api; api->dosomething();
+//! Can be used at any point of code, WITH EXCEPTION of static objects that are initialized during the DLL loading process before the service system is initialized; such as static static_api_ptr_t objects or having static_api_ptr_t instances as members of statically created objects.
+//! Throws exception_service_not_found if service could not be reached (which can be ignored for core APIs that are always present unless there is some kind of bug in the code).
+template<typename t_interface>
+class static_api_ptr_t {
+private:
+ typedef static_api_ptr_t<t_interface> t_self;
+public:
+ static_api_ptr_t() {
+ standard_api_create_t(m_ptr);
+ }
+ service_obscure_refcounting<t_interface>* operator->() const {return service_obscure_refcounting_cast(m_ptr);}
+ t_interface * get_ptr() const {return m_ptr;}
+ ~static_api_ptr_t() {m_ptr->service_release();}
+
+ static_api_ptr_t(const t_self & in) {
+ m_ptr = in.m_ptr; m_ptr->service_add_ref();
+ }
+ const t_self & operator=(const t_self & in) {return *this;} //obsolete, each instance should carry the same pointer
+private:
+ t_interface * m_ptr;
+};
+
+//! Helper; simulates array with instance of each available implementation of given service class.
+template<typename T> class service_instance_array_t {
+public:
+ typedef service_ptr_t<T> t_ptr;
+ service_instance_array_t() {
+ service_class_helper_t<T> helper;
+ const t_size count = helper.get_count();
+ m_data.set_size(count);
+ for(t_size n=0;n<count;n++) m_data[n] = helper.create(n);
+ }
+
+ t_size get_size() const {return m_data.get_size();}
+ const t_ptr & operator[](t_size p_index) const {return m_data[p_index];}
+
+ //nonconst version to allow sorting/bsearching; do not abuse
+ t_ptr & operator[](t_size p_index) {return m_data[p_index];}
+private:
+ pfc::array_t<t_ptr> m_data;
+};
+
+template<typename t_interface>
+class service_enum_t {
+public:
+ service_enum_t() : m_index(0) {
+ pfc::assert_same_type<t_interface,typename t_interface::t_interface_entrypoint>();
+ }
+ void reset() {m_index = 0;}
+
+ template<typename t_query>
+ bool first(service_ptr_t<t_query> & p_out) {
+ reset();
+ return next(p_out);
+ }
+
+ template<typename t_query>
+ bool next(service_ptr_t<t_query> & p_out) {
+ pfc::assert_same_type<typename t_query::t_interface_entrypoint,t_interface>();
+ if (pfc::is_same_type<t_query,t_interface>::value) {
+ return __next(reinterpret_cast<service_ptr_t<t_interface>&>(p_out));
+ } else {
+ service_ptr_t<t_interface> temp;
+ while(__next(temp)) {
+ if (temp->service_query_t(p_out)) return true;
+ }
+ return false;
+ }
+ }
+
+private:
+ bool __next(service_ptr_t<t_interface> & p_out) {
+ return m_helper.create(p_out,m_index++);
+ }
+ unsigned m_index;
+ service_class_helper_t<t_interface> m_helper;
+};
+
+template<typename T>
+class service_factory_t : public service_factory_base_t<typename T::t_interface_entrypoint> {
+public:
+ void instance_create(service_ptr_t<service_base> & p_out) {
+ p_out = pfc::implicit_cast<service_base*>(pfc::implicit_cast<typename T::t_interface_entrypoint*>(pfc::implicit_cast<T*>( new service_impl_t<T> )));
+ }
+};
+
+template<typename T>
+class service_factory_single_t : public service_factory_base_t<typename T::t_interface_entrypoint> {
+ service_impl_single_t<T> g_instance;
+public:
+ TEMPLATE_CONSTRUCTOR_FORWARD_FLOOD(service_factory_single_t,g_instance)
+
+ void instance_create(service_ptr_t<service_base> & p_out) {
+ p_out = pfc::implicit_cast<service_base*>(pfc::implicit_cast<typename T::t_interface_entrypoint*>(pfc::implicit_cast<T*>(&g_instance)));
+ }
+
+ inline T& get_static_instance() {return g_instance;}
+ inline const T& get_static_instance() const {return g_instance;}
+};
+
+template<typename T>
+class service_factory_single_ref_t : public service_factory_base_t<typename T::t_interface_entrypoint>
+{
+private:
+ T & instance;
+public:
+ service_factory_single_ref_t(T& param) : instance(param) {}
+
+ void instance_create(service_ptr_t<service_base> & p_out) {
+ p_out = pfc::implicit_cast<service_base*>(pfc::implicit_cast<typename T::t_interface_entrypoint*>(pfc::implicit_cast<T*>(&instance)));
+ }
+
+ inline T& get_static_instance() {return instance;}
+};
+
+
+template<typename T>
+class service_factory_single_transparent_t : public service_factory_base_t<typename T::t_interface_entrypoint>, public service_impl_single_t<T>
+{
+public:
+ TEMPLATE_CONSTRUCTOR_FORWARD_FLOOD(service_factory_single_transparent_t,service_impl_single_t<T>)
+
+ void instance_create(service_ptr_t<service_base> & p_out) {
+ p_out = pfc::implicit_cast<service_base*>(pfc::implicit_cast<typename T::t_interface_entrypoint*>(pfc::implicit_cast<T*>(this)));
+ }
+
+ inline T& get_static_instance() {return *(T*)this;}
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+template<typename what>
+static bool service_by_guid_fallback(service_ptr_t<what> & out, const GUID & id) {
+ service_enum_t<what> e;
+ service_ptr_t<what> ptr;
+ while(e.next(ptr)) {
+ if (ptr->get_guid() == id) {out = ptr; return true;}
+ }
+ return false;
+}
+
+template<typename what>
+class service_by_guid_data {
+public:
+ service_by_guid_data() : m_servClass(), m_inited() {}
+
+ bool ready() const {return m_inited;}
+
+ void initialize() {
+ if (m_inited) return;
+ pfc::assert_same_type< what, typename what::t_interface_entrypoint >();
+ m_servClass = service_factory_base::enum_find_class(what::class_guid);
+ const t_size servCount = service_factory_base::enum_get_count(m_servClass);
+ for(t_size walk = 0; walk < servCount; ++walk) {
+ service_ptr_t<what> temp;
+ if (_service_instantiate_helper(temp, m_servClass, walk)) {
+ m_order.set(temp->get_guid(), walk);
+ }
+ }
+ m_inited = true;
+ }
+
+ bool create(service_ptr_t<what> & out, const GUID & id) const {
+ PFC_ASSERT(m_inited);
+ t_size index;
+ if (!m_order.query(id,index)) return false;
+ return _service_instantiate_helper(out, m_servClass, index);
+ }
+ service_ptr_t<what> create(const GUID & id) const {
+ service_ptr_t<what> temp; if (!crete(temp,id)) throw exception_service_not_found(); return temp;
+ }
+
+private:
+ volatile bool m_inited;
+ pfc::map_t<GUID,t_size> m_order;
+ service_class_ref m_servClass;
+};
+
+template<typename what>
+class _service_by_guid_data_container {
+public:
+ static service_by_guid_data<what> data;
+};
+template<typename what> service_by_guid_data<what> _service_by_guid_data_container<what>::data;
+
+
+template<typename what>
+static void service_by_guid_init() {
+ service_by_guid_data<what> & data = _service_by_guid_data_container<what>::data;
+ data.initialize();
+}
+template<typename what>
+static bool service_by_guid(service_ptr_t<what> & out, const GUID & id) {
+ pfc::assert_same_type< what, typename what::t_interface_entrypoint >();
+ service_by_guid_data<what> & data = _service_by_guid_data_container<what>::data;
+ if (data.ready()) {
+ //fall-thru
+ } else if (core_api::is_main_thread()) {
+ data.initialize();
+ } else {
+#ifdef _DEBUG
+ uDebugLog() << "Warning: service_by_guid() used in non-main thread without initialization, using fallback";
+#endif
+ return service_by_guid_fallback(out,id);
+ }
+ return data.create(out,id);
+}
+template<typename what>
+static service_ptr_t<what> service_by_guid(const GUID & id) {
+ service_ptr_t<what> temp;
+ if (!service_by_guid(temp,id)) throw exception_service_not_found();
+ return temp;
+}
+
+#define FB2K_FOR_EACH_SERVICE(type, call) {service_enum_t<typename type::t_interface_entrypoint> e; service_ptr_t<type> ptr; while(e.next(ptr)) {ptr->call;} }
+
+
+
+class comparator_service_guid {
+public:
+ template<typename what> static int compare(const what & v1, const what & v2) { return pfc::compare_t(v1->get_guid(), v2->get_guid()); }
+};
+
+
+#endif //_foobar2000_sdk_service_h_included_
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/service_impl.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/service_impl.h new file mode 100644 index 0000000000..1c31536bb9 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/service_impl.h @@ -0,0 +1,37 @@ +//! Template implementing reference-counting features of service_base. Intended for dynamic instantiation: "new service_impl_t<someclass>(param1,param2);"; should not be instantiated otherwise (no local/static/member objects) because it does a "delete this;" when reference count reaches zero.\n
+//! Note that some constructor parameters such as NULL will need explicit typecasts to ensure correctly guessed types for constructor function template (null string needs to be (const char*)NULL rather than just NULL, etc).
+template<typename T>
+class service_impl_t : public T
+{
+public:
+ int FB2KAPI service_release() throw() {
+ int ret = --m_counter;
+ if (ret == 0) {
+ PFC_ASSERT_NO_EXCEPTION( delete this );
+ }
+ return ret;
+ }
+ int FB2KAPI service_add_ref() throw() {return ++m_counter;}
+
+ TEMPLATE_CONSTRUCTOR_FORWARD_FLOOD(service_impl_t,T)
+private:
+ pfc::refcounter m_counter;
+};
+
+//! Template implementing dummy version of reference-counting features of service_base. Intended for static/local/member instantiation: "static service_impl_single_t<someclass> myvar(params);". Because reference counting features are disabled (dummy reference counter), code instantiating it is responsible for deleting it as well as ensuring that no references are active when the object gets deleted.\n
+//! Note that some constructor parameters such as NULL will need explicit typecasts to ensure correctly guessed types for constructor function template (null string needs to be (const char*)NULL rather than just NULL, etc).
+template<typename T>
+class service_impl_single_t : public T
+{
+public:
+ int FB2KAPI service_release() throw() {return 1;}
+ int FB2KAPI service_add_ref() throw() {return 1;}
+
+ TEMPLATE_CONSTRUCTOR_FORWARD_FLOOD(service_impl_single_t,T)
+};
+
+
+namespace service_impl_helper {
+ void release_object_delayed(service_ptr obj);
+};
+
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/shortcut_actions.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/shortcut_actions.h new file mode 100644 index 0000000000..cfc068aec6 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/shortcut_actions.h @@ -0,0 +1 @@ +#error DEPRECATED
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/stdafx.cpp b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/stdafx.cpp new file mode 100644 index 0000000000..ea4f0bdf13 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/stdafx.cpp @@ -0,0 +1,2 @@ +//cpp used to generate precompiled header
+#include "foobar2000.h"
\ No newline at end of file diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/system_time_keeper.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/system_time_keeper.h new file mode 100644 index 0000000000..452049bbaf --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/system_time_keeper.h @@ -0,0 +1,47 @@ +namespace system_time_periods {
+ static const t_filetimestamp second = filetimestamp_1second_increment;
+ static const t_filetimestamp minute = second * 60;
+ static const t_filetimestamp hour = minute * 60;
+ static const t_filetimestamp day = hour * 24;
+ static const t_filetimestamp week = day * 7;
+};
+class system_time_callback {
+public:
+ virtual void on_time_changed(t_filetimestamp newVal) = 0;
+};
+//! \since 0.9.6
+class system_time_keeper : public service_base {
+public:
+ //! The callback object receives an on_changed() call with the current time inside the register_callback() call.
+ virtual void register_callback(system_time_callback * callback, t_filetimestamp resolution) = 0;
+
+ virtual void unregister_callback(system_time_callback * callback) = 0;
+
+ FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(system_time_keeper)
+};
+
+class system_time_callback_impl : public system_time_callback {
+public:
+ system_time_callback_impl() : m_registered() {}
+ ~system_time_callback_impl() {stop_timer();}
+
+ void stop_timer() {
+ if (m_registered) {
+ static_api_ptr_t<system_time_keeper>()->unregister_callback(this);
+ m_registered = false;
+ }
+ }
+ //! You get a on_changed() call inside the initialize_timer() call.
+ void initialize_timer(t_filetimestamp period) {
+ stop_timer();
+ static_api_ptr_t<system_time_keeper>()->register_callback(this, period);
+ m_registered = true;
+ }
+
+ void on_time_changed(t_filetimestamp newVal) {}
+
+ PFC_CLASS_NOT_COPYABLE_EX(system_time_callback_impl)
+private:
+ bool m_registered;
+};
+
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/tag_processor.cpp b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/tag_processor.cpp new file mode 100644 index 0000000000..6b6361a942 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/tag_processor.cpp @@ -0,0 +1,170 @@ +#include "foobar2000.h"
+
+void tag_processor_trailing::write_id3v1(const service_ptr_t<file> & p_file,const file_info & p_info,abort_callback & p_abort)
+{
+ write(p_file,p_info,flag_id3v1,p_abort);
+}
+
+void tag_processor_trailing::write_apev2(const service_ptr_t<file> & p_file,const file_info & p_info,abort_callback & p_abort)
+{
+ write(p_file,p_info,flag_apev2,p_abort);
+}
+
+void tag_processor_trailing::write_apev2_id3v1(const service_ptr_t<file> & p_file,const file_info & p_info,abort_callback & p_abort)
+{
+ write(p_file,p_info,flag_id3v1|flag_apev2,p_abort);
+}
+
+
+
+
+enum {
+ g_flag_id3v1 = 1<<0,
+ g_flag_id3v2 = 1<<1,
+ g_flag_apev2 = 1<<2
+};
+
+static void tagtype_list_append(pfc::string_base & p_out,const char * p_name)
+{
+ if (!p_out.is_empty()) p_out += "|";
+ p_out += p_name;
+}
+
+static void g_write_tags_ex(tag_write_callback & p_callback,unsigned p_flags,const service_ptr_t<file> & p_file,const file_info * p_info,abort_callback & p_abort) {
+ PFC_ASSERT( p_flags == 0 || p_info != 0 );
+
+
+ if (p_flags & (g_flag_id3v1 | g_flag_apev2)) {
+ switch(p_flags & (g_flag_id3v1 | g_flag_apev2)) {
+ case g_flag_id3v1 | g_flag_apev2:
+ static_api_ptr_t<tag_processor_trailing>()->write_apev2_id3v1(p_file,*p_info,p_abort);
+ break;
+ case g_flag_id3v1:
+ static_api_ptr_t<tag_processor_trailing>()->write_id3v1(p_file,*p_info,p_abort);
+ break;
+ case g_flag_apev2:
+ static_api_ptr_t<tag_processor_trailing>()->write_apev2(p_file,*p_info,p_abort);
+ break;
+ default:
+ throw exception_io_data();
+ }
+ } else {
+ static_api_ptr_t<tag_processor_trailing>()->remove(p_file,p_abort);
+ }
+
+ if (p_flags & g_flag_id3v2)
+ {
+ static_api_ptr_t<tag_processor_id3v2>()->write_ex(p_callback,p_file,*p_info,p_abort);
+ }
+ else
+ {
+ t_uint64 dummy;
+ tag_processor_id3v2::g_remove_ex(p_callback,p_file,dummy,p_abort);
+ }
+}
+
+static void g_write_tags(unsigned p_flags,const service_ptr_t<file> & p_file,const file_info * p_info,abort_callback & p_abort) {
+ g_write_tags_ex(tag_write_callback_dummy(),p_flags,p_file,p_info,p_abort);
+}
+
+
+void tag_processor::write_multi(const service_ptr_t<file> & p_file,const file_info & p_info,abort_callback & p_abort,bool p_write_id3v1,bool p_write_id3v2,bool p_write_apev2) {
+ unsigned flags = 0;
+ if (p_write_id3v1) flags |= g_flag_id3v1;
+ if (p_write_id3v2) flags |= g_flag_id3v2;
+ if (p_write_apev2) flags |= g_flag_apev2;
+ g_write_tags(flags,p_file,&p_info,p_abort);
+}
+
+void tag_processor::write_multi_ex(tag_write_callback & p_callback,const service_ptr_t<file> & p_file,const file_info & p_info,abort_callback & p_abort,bool p_write_id3v1,bool p_write_id3v2,bool p_write_apev2) {
+ unsigned flags = 0;
+ if (p_write_id3v1) flags |= g_flag_id3v1;
+ if (p_write_id3v2) flags |= g_flag_id3v2;
+ if (p_write_apev2) flags |= g_flag_apev2;
+ g_write_tags_ex(p_callback,flags,p_file,&p_info,p_abort);
+}
+
+void tag_processor::write_id3v1(const service_ptr_t<file> & p_file,const file_info & p_info,abort_callback & p_abort) {
+ g_write_tags(g_flag_id3v1,p_file,&p_info,p_abort);
+}
+
+void tag_processor::write_apev2(const service_ptr_t<file> & p_file,const file_info & p_info,abort_callback & p_abort) {
+ g_write_tags(g_flag_apev2,p_file,&p_info,p_abort);
+}
+
+void tag_processor::write_apev2_id3v1(const service_ptr_t<file> & p_file,const file_info & p_info,abort_callback & p_abort) {
+ g_write_tags(g_flag_apev2|g_flag_id3v1,p_file,&p_info,p_abort);
+}
+
+void tag_processor::write_id3v2(const service_ptr_t<file> & p_file,const file_info & p_info,abort_callback & p_abort) {
+ g_write_tags(g_flag_id3v2,p_file,&p_info,p_abort);
+}
+
+void tag_processor::write_id3v2_id3v1(const service_ptr_t<file> & p_file,const file_info & p_info,abort_callback & p_abort) {
+ g_write_tags(g_flag_id3v2|g_flag_id3v1,p_file,&p_info,p_abort);
+}
+
+void tag_processor::remove_trailing(const service_ptr_t<file> & p_file,abort_callback & p_abort) {
+ return static_api_ptr_t<tag_processor_trailing>()->remove(p_file,p_abort);
+}
+
+bool tag_processor::remove_id3v2(const service_ptr_t<file> & p_file,abort_callback & p_abort) {
+ t_uint64 dummy = 0;
+ tag_processor_id3v2::g_remove(p_file,dummy,p_abort);
+ return dummy > 0;
+}
+
+void tag_processor::remove_id3v2_trailing(const service_ptr_t<file> & p_file,abort_callback & p_abort) {
+ remove_id3v2(p_file,p_abort);
+ remove_trailing(p_file,p_abort);
+}
+
+void tag_processor::read_trailing(const service_ptr_t<file> & p_file,file_info & p_info,abort_callback & p_abort) {
+ static_api_ptr_t<tag_processor_trailing>()->read(p_file,p_info,p_abort);
+}
+
+void tag_processor::read_trailing_ex(const service_ptr_t<file> & p_file,file_info & p_info,t_uint64 & p_tagoffset,abort_callback & p_abort) {
+ static_api_ptr_t<tag_processor_trailing>()->read_ex(p_file,p_info,p_tagoffset,p_abort);
+}
+
+void tag_processor::read_id3v2(const service_ptr_t<file> & p_file,file_info & p_info,abort_callback & p_abort) {
+ static_api_ptr_t<tag_processor_id3v2>()->read(p_file,p_info,p_abort);
+}
+
+void tag_processor::read_id3v2_trailing(const service_ptr_t<file> & p_file,file_info & p_info,abort_callback & p_abort)
+{
+ file_info_impl temp_infos[2];
+ bool have_id3v2 = true, have_trailing = true;
+ try {
+ read_id3v2(p_file,temp_infos[0],p_abort);
+ } catch(exception_io_data) {
+ have_id3v2 = false;
+ }
+ try {
+ read_trailing(p_file,temp_infos[1],p_abort);
+ } catch(exception_io_data) {
+ have_trailing = false;
+ }
+
+ if (!have_id3v2 && !have_trailing) throw exception_tag_not_found();
+ else {
+ pfc::ptr_list_t<const file_info> blargh;
+ if (have_id3v2) blargh.add_item(&temp_infos[0]);
+ if (have_trailing) blargh.add_item(&temp_infos[1]);
+ p_info.merge(blargh);
+ }
+}
+
+void tag_processor::skip_id3v2(const service_ptr_t<file> & p_file,t_uint64 & p_size_skipped,abort_callback & p_abort) {
+ tag_processor_id3v2::g_skip(p_file,p_size_skipped,p_abort);
+}
+
+bool tag_processor::is_id3v1_sufficient(const file_info & p_info)
+{
+ return static_api_ptr_t<tag_processor_trailing>()->is_id3v1_sufficient(p_info);
+}
+
+void tag_processor::truncate_to_id3v1(file_info & p_info)
+{
+ static_api_ptr_t<tag_processor_trailing>()->truncate_to_id3v1(p_info);
+}
\ No newline at end of file diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/tag_processor.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/tag_processor.h new file mode 100644 index 0000000000..92cd5060dc --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/tag_processor.h @@ -0,0 +1,101 @@ +PFC_DECLARE_EXCEPTION(exception_tag_not_found,exception_io_data,"Tag not found");
+
+//! Callback interface for write-tags-to-temp-file-and-swap scheme, used for ID3v2 tag updates and such where entire file needs to be rewritten.
+//! As a speed optimization, file content can be copied to a temporary file in the same directory as the file being updated, and then source file can be swapped for the newly created file with updated tags.
+//! This also gives better security against data loss on crash compared to rewriting the file in place and using memory or generic temporary file APIs to store content being rewritten.
+class NOVTABLE tag_write_callback {
+public:
+ //! Called only once per operation (or not called at all when operation being performed can be done in-place).
+ //! Requests a temporary file to be created in the same directory
+ virtual bool open_temp_file(service_ptr_t<file> & p_out,abort_callback & p_abort) = 0;
+protected:
+ tag_write_callback() {}
+ ~tag_write_callback() {}
+private:
+ tag_write_callback(const tag_write_callback &) {throw pfc::exception_not_implemented();}
+ const tag_write_callback & operator=(const tag_write_callback &) {throw pfc::exception_not_implemented();}
+};
+
+class tag_write_callback_dummy : public tag_write_callback {
+public:
+ bool open_temp_file(service_ptr_t<file> & p_out,abort_callback & p_abort) {return false;}
+};
+
+//! For internal use - call tag_processor namespace methods instead.
+class NOVTABLE tag_processor_id3v2 : public service_base
+{
+public:
+ virtual void read(const service_ptr_t<file> & p_file,file_info & p_info,abort_callback & p_abort) = 0;
+ virtual void write(const service_ptr_t<file> & p_file,const file_info & p_info,abort_callback & p_abort) = 0;
+ virtual void write_ex(tag_write_callback & p_callback,const service_ptr_t<file> & p_file,const file_info & p_info,abort_callback & p_abort) = 0;
+
+ static bool g_get(service_ptr_t<tag_processor_id3v2> & p_out);
+ static void g_skip(const service_ptr_t<file> & p_file,t_filesize & p_size_skipped,abort_callback & p_abort);
+ static void g_skip_at(const service_ptr_t<file> & p_file,t_filesize p_base, t_filesize & p_size_skipped,abort_callback & p_abort);
+ static t_size g_multiskip(const service_ptr_t<file> & p_file,t_filesize & p_size_skipped,abort_callback & p_abort);
+ static void g_remove(const service_ptr_t<file> & p_file,t_filesize & p_size_removed,abort_callback & p_abort);
+ static void g_remove_ex(tag_write_callback & p_callback,const service_ptr_t<file> & p_file,t_filesize & p_size_removed,abort_callback & p_abort);
+
+ FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(tag_processor_id3v2);
+};
+
+//! For internal use - call tag_processor namespace methods instead.
+class NOVTABLE tag_processor_trailing : public service_base
+{
+public:
+ enum {
+ flag_apev2 = 1,
+ flag_id3v1 = 2,
+ };
+
+ virtual void read(const service_ptr_t<file> & p_file,file_info & p_info,abort_callback & p_abort) = 0;
+ virtual void write(const service_ptr_t<file> & p_file,const file_info & p_info,unsigned p_flags,abort_callback & p_abort) = 0;
+ virtual void remove(const service_ptr_t<file> & p_file,abort_callback & p_abort) = 0;
+ virtual bool is_id3v1_sufficient(const file_info & p_info) = 0;
+ virtual void truncate_to_id3v1(file_info & p_info) = 0;
+ virtual void read_ex(const service_ptr_t<file> & p_file,file_info & p_info,t_filesize & p_tagoffset,abort_callback & p_abort) = 0;
+
+ void write_id3v1(const service_ptr_t<file> & p_file,const file_info & p_info,abort_callback & p_abort);
+ void write_apev2(const service_ptr_t<file> & p_file,const file_info & p_info,abort_callback & p_abort);
+ void write_apev2_id3v1(const service_ptr_t<file> & p_file,const file_info & p_info,abort_callback & p_abort);
+
+
+ FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(tag_processor_trailing);
+};
+
+namespace tag_processor {
+ //! Strips all recognized tags from the file and writes an ID3v1 tag with specified info.
+ void write_id3v1(const service_ptr_t<file> & p_file,const file_info & p_info,abort_callback & p_abort);
+ //! Strips all recognized tags from the file and writes an APEv2 tag with specified info.
+ void write_apev2(const service_ptr_t<file> & p_file,const file_info & p_info,abort_callback & p_abort);
+ //! Strips all recognized tags from the file and writes ID3v1+APEv2 tags with specified info.
+ void write_apev2_id3v1(const service_ptr_t<file> & p_file,const file_info & p_info,abort_callback & p_abort);
+ //! Strips all recognized tags from the file and writes an ID3v2 tag with specified info.
+ void write_id3v2(const service_ptr_t<file> & p_file,const file_info & p_info,abort_callback & p_abort);
+ //! Strips all recognized tags from the file and writes ID3v1+ID3v2 tags with specified info.
+ void write_id3v2_id3v1(const service_ptr_t<file> & p_file,const file_info & p_info,abort_callback & p_abort);
+ //! Strips all recognized tags from the file and writes new tags with specified info according to parameters.
+ void write_multi(const service_ptr_t<file> & p_file,const file_info & p_info,abort_callback & p_abort,bool p_write_id3v1,bool p_write_id3v2,bool p_write_apev2);
+ //! Strips all recognized tags from the file and writes new tags with specified info according to parameters. Extended to allow write-tags-to-temp-file-and-swap scheme.
+ void write_multi_ex(tag_write_callback & p_callback,const service_ptr_t<file> & p_file,const file_info & p_info,abort_callback & p_abort,bool p_write_id3v1,bool p_write_id3v2,bool p_write_apev2);
+ //! Removes trailing tags from the file.
+ void remove_trailing(const service_ptr_t<file> & p_file,abort_callback & p_abort);
+ //! Removes ID3v2 tags from the file. Returns true when a tag was removed, false when the file was not altered.
+ bool remove_id3v2(const service_ptr_t<file> & p_file,abort_callback & p_abort);
+ //! Removes ID3v2 and trailing tags from specified file (not to be confused with trailing ID3v2 which are not yet supported).
+ void remove_id3v2_trailing(const service_ptr_t<file> & p_file,abort_callback & p_abort);
+ //! Reads trailing tags from the file.
+ void read_trailing(const service_ptr_t<file> & p_file,file_info & p_info,abort_callback & p_abort);
+ //! Reads trailing tags from the file. Extended version, returns offset at which parsed tags start.
+ void read_trailing_ex(const service_ptr_t<file> & p_file,file_info & p_info,t_filesize & p_tagoffset,abort_callback & p_abort);
+ //! Reads ID3v2 tags from specified file.
+ void read_id3v2(const service_ptr_t<file> & p_file,file_info & p_info,abort_callback & p_abort);
+ //! Reads ID3v2 and trailing tags from specified file (not to be confused with trailing ID3v2 which are not yet supported).
+ void read_id3v2_trailing(const service_ptr_t<file> & p_file,file_info & p_info,abort_callback & p_abort);
+
+ void skip_id3v2(const service_ptr_t<file> & p_file,t_filesize & p_size_skipped,abort_callback & p_abort);
+
+ bool is_id3v1_sufficient(const file_info & p_info);
+ void truncate_to_id3v1(file_info & p_info);
+
+};
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/tag_processor_id3v2.cpp b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/tag_processor_id3v2.cpp new file mode 100644 index 0000000000..384bb812b1 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/tag_processor_id3v2.cpp @@ -0,0 +1,105 @@ +#include "foobar2000.h"
+
+bool tag_processor_id3v2::g_get(service_ptr_t<tag_processor_id3v2> & p_out)
+{
+ return service_enum_t<tag_processor_id3v2>().first(p_out);
+}
+
+void tag_processor_id3v2::g_remove(const service_ptr_t<file> & p_file,t_uint64 & p_size_removed,abort_callback & p_abort) {
+ g_remove_ex(tag_write_callback_dummy(),p_file,p_size_removed,p_abort);
+}
+
+void tag_processor_id3v2::g_remove_ex(tag_write_callback & p_callback,const service_ptr_t<file> & p_file,t_uint64 & p_size_removed,abort_callback & p_abort)
+{
+ p_file->ensure_seekable();
+
+ t_filesize len;
+
+ len = p_file->get_size(p_abort);
+
+ if (len == filesize_invalid) throw exception_io_no_length();
+
+ p_file->seek(0,p_abort);
+
+ t_uint64 offset;
+ g_multiskip(p_file,offset,p_abort);
+
+ if (offset>0 && offset<len)
+ {
+ len-=offset;
+ service_ptr_t<file> temp;
+ if (p_callback.open_temp_file(temp,p_abort)) {
+ file::g_transfer_object(p_file,temp,len,p_abort);
+ } else {
+ if (len > 16*1024*1024) filesystem::g_open_temp(temp,p_abort);
+ else filesystem::g_open_tempmem(temp,p_abort);
+ file::g_transfer_object(p_file,temp,len,p_abort);
+ p_file->seek(0,p_abort);
+ p_file->set_eof(p_abort);
+ temp->seek(0,p_abort);
+ file::g_transfer_object(temp,p_file,len,p_abort);
+ }
+ }
+ p_size_removed = offset;
+}
+
+t_size tag_processor_id3v2::g_multiskip(const service_ptr_t<file> & p_file,t_filesize & p_size_skipped,abort_callback & p_abort) {
+ t_filesize offset = 0;
+ t_size count = 0;
+ for (;;) {
+ t_filesize delta;
+ g_skip_at(p_file, offset, delta, p_abort);
+ if (delta == 0) break;
+ offset += delta;
+ ++count;
+ }
+ p_size_skipped = offset;
+ return count;
+}
+void tag_processor_id3v2::g_skip(const service_ptr_t<file> & p_file,t_uint64 & p_size_skipped,abort_callback & p_abort) {
+ g_skip_at(p_file, 0, p_size_skipped, p_abort);
+}
+
+void tag_processor_id3v2::g_skip_at(const service_ptr_t<file> & p_file,t_filesize p_base, t_filesize & p_size_skipped,abort_callback & p_abort) {
+
+ unsigned char tmp[10];
+
+ p_file->seek ( p_base, p_abort );
+
+ if (p_file->read( tmp, sizeof(tmp), p_abort) != sizeof(tmp)) {
+ p_file->seek ( p_base, p_abort );
+ p_size_skipped = 0;
+ return;
+ }
+
+ if (
+ 0 != memcmp ( tmp, "ID3", 3) ||
+ ( tmp[5] & 0x0F ) != 0 ||
+ ((tmp[6] | tmp[7] | tmp[8] | tmp[9]) & 0x80) != 0
+ ) {
+ p_file->seek ( p_base, p_abort );
+ p_size_skipped = 0;
+ return;
+ }
+
+ int FooterPresent = tmp[5] & 0x10;
+
+ t_uint32 ret;
+ ret = tmp[6] << 21;
+ ret += tmp[7] << 14;
+ ret += tmp[8] << 7;
+ ret += tmp[9] ;
+ ret += 10;
+ if ( FooterPresent ) ret += 10;
+
+ try {
+ p_file->seek ( p_base + ret, p_abort );
+ } catch(exception_io_seek_out_of_range) {
+ p_file->seek( p_base, p_abort );
+ p_size_skipped = 0;
+ return;
+ }
+
+ p_size_skipped = ret;
+
+}
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/threaded_process.cpp b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/threaded_process.cpp new file mode 100644 index 0000000000..567bd304f6 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/threaded_process.cpp @@ -0,0 +1,36 @@ +#include "foobar2000.h"
+
+void threaded_process_status::set_progress(t_size p_state,t_size p_max)
+{
+ set_progress( progress_min + MulDiv_Size(p_state,progress_max-progress_min,p_max) );
+}
+
+void threaded_process_status::set_progress_secondary(t_size p_state,t_size p_max)
+{
+ set_progress_secondary( progress_min + MulDiv_Size(p_state,progress_max-progress_min,p_max) );
+}
+
+void threaded_process_status::set_progress_float(double p_state)
+{
+ if (p_state < 0.0) set_progress(progress_min);
+ else if (p_state < 1.0) set_progress( progress_min + (t_size)(p_state * (progress_max - progress_min)));
+ else set_progress(progress_max);
+}
+
+void threaded_process_status::set_progress_secondary_float(double p_state)
+{
+ if (p_state < 0.0) set_progress_secondary(progress_min);
+ else if (p_state < 1.0) set_progress_secondary( progress_min + (t_size)(p_state * (progress_max - progress_min)));
+ else set_progress_secondary(progress_max);
+}
+
+
+bool threaded_process::g_run_modal(service_ptr_t<threaded_process_callback> p_callback,unsigned p_flags,HWND p_parent,const char * p_title,t_size p_title_len)
+{
+ return static_api_ptr_t<threaded_process>()->run_modal(p_callback,p_flags,p_parent,p_title,p_title_len);
+}
+
+bool threaded_process::g_run_modeless(service_ptr_t<threaded_process_callback> p_callback,unsigned p_flags,HWND p_parent,const char * p_title,t_size p_title_len)
+{
+ return static_api_ptr_t<threaded_process>()->run_modeless(p_callback,p_flags,p_parent,p_title,p_title_len);
+}
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/threaded_process.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/threaded_process.h new file mode 100644 index 0000000000..f63b85dcab --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/threaded_process.h @@ -0,0 +1,105 @@ +//! Callback class passed to your threaded_process client code; allows you to give various visual feedback to the user.
+class NOVTABLE threaded_process_status {
+public:
+ enum {progress_min = 0, progress_max = 5000};
+
+ //! Sets the primary progress bar state; scale from progress_min to progress_max.
+ virtual void set_progress(t_size p_state) = 0;
+ //! Sets the secondary progress bar state; scale from progress_min to progress_max.
+ virtual void set_progress_secondary(t_size p_state) = 0;
+ //! Sets the currently progressed item label. When working with files, you should use set_file_path() instead.
+ virtual void set_item(const char * p_item,t_size p_item_len = ~0) = 0;
+ //! Sets the currently progressed item label; treats the label as a file path.
+ virtual void set_item_path(const char * p_item,t_size p_item_len = ~0) = 0;
+ //! Sets the title of the dialog. You normally don't need this function unless you want to override the title you set when initializing the threaded_process.
+ virtual void set_title(const char * p_title,t_size p_title_len = ~0) = 0;
+ //! Should not be used.
+ virtual void force_update() = 0;
+ //! Returns whether the process is paused.
+ virtual bool is_paused() = 0;
+
+ //! Checks if process is paused and sleeps if needed; returns false when process should be aborted, true on success. \n
+ //! You should use poll_pause() instead of calling this directly.
+ virtual bool process_pause() = 0;
+
+ //! Automatically sleeps if the process is paused.
+ void poll_pause() {if (!process_pause()) throw exception_aborted();}
+
+ //! Helper; sets primary progress with a custom scale.
+ void set_progress(t_size p_state,t_size p_max);
+ //! Helper; sets secondary progress with a custom scale.
+ void set_progress_secondary(t_size p_state,t_size p_max);
+ //! Helper; sets primary progress with a float 0..1 scale.
+ void set_progress_float(double p_state);
+ //! Helper; sets secondary progress with a float 0..1 scale.
+ void set_progress_secondary_float(double p_state);
+protected:
+ threaded_process_status() {}
+ ~threaded_process_status() {}
+};
+
+//! Callback class for the threaded_process API. You must implement this to create your own threaded_process client.
+class NOVTABLE threaded_process_callback : public service_base {
+public:
+ //! Called from the main thread before spawning the worker thread. \n
+ //! Note that you should not access the window handle passed to on_init() in the worker thread later on.
+ virtual void on_init(HWND p_wnd) {}
+ //! Called from the worker thread. Do all the hard work here.
+ virtual void run(threaded_process_status & p_status,abort_callback & p_abort) = 0;
+ //! Called after the worker thread has finished executing.
+ virtual void on_done(HWND p_wnd,bool p_was_aborted) {}
+
+ FB2K_MAKE_SERVICE_INTERFACE(threaded_process_callback,service_base);
+};
+
+
+//! The threaded_process API allows you to easily put timeconsuming tasks in worker threads, with progress dialog giving nice feedback to the user. \n
+//! Thanks to this API you can perform such tasks with no user interface related programming at all.
+class NOVTABLE threaded_process : public service_base {
+public:
+ enum {
+ //! Shows the "abort" button.
+ flag_show_abort = 1,
+ //! Obsolete, do not use.
+ flag_show_minimize = 1 << 1,
+ //! Shows a progress bar.
+ flag_show_progress = 1 << 2,
+ //! Shows dual progress bars; implies flag_show_progress.
+ flag_show_progress_dual = 1 << 3,
+ //! Shows the item being currently processed.
+ flag_show_item = 1 << 4,
+ //! Shows the "pause" button.
+ flag_show_pause = 1 << 5,
+ //! Obsolete, do not use.
+ flag_high_priority = 1 << 6,
+ //! Make the dialog hidden by default and show it only if the operation could not be completed after 500ms. Implies flag_no_focus. Relevant only to modeless dialogs.
+ flag_show_delayed = 1 << 7,
+ //! Do not focus the dialog by default.
+ flag_no_focus = 1 << 8,
+ };
+
+ //! Runs a synchronous threaded_process operation - the function does not return until the operation has completed, though the app UI is not frozen and the operation is abortable. \n
+ //! This API is obsolete and should not be used. Please use run_modeless() instead if possible.
+ //! @param p_callback Interface to your threaded_process client.
+ //! @param p_flags Flags describing requested dialog functionality. See threaded_process::flag_* constants.
+ //! @param p_parent Parent window for the progress dialog - typically core_api::get_main_window().
+ //! @param p_title Initial title of the dialog.
+ //! @returns True if the operation has completed normally, false if the user has aborted the operation. In case of a catastrophic failure such as dialog creation failure, exceptions will be thrown.
+ virtual bool run_modal(service_ptr_t<threaded_process_callback> p_callback,unsigned p_flags,HWND p_parent,const char * p_title,t_size p_title_len = ~0) = 0;
+ //! Runs an asynchronous threaded_process operation.
+ //! @param p_callback Interface to your threaded_process client.
+ //! @param p_flags Flags describing requested dialog functionality. See threaded_process::flag_* constants.
+ //! @param p_parent Parent window for the progress dialog - typically core_api::get_main_window().
+ //! @param p_title Initial title of the dialog.
+ //! @returns True, always; the return value should be ignored. In case of a catastrophic failure such as dialog creation failure, exceptions will be thrown.
+ virtual bool run_modeless(service_ptr_t<threaded_process_callback> p_callback,unsigned p_flags,HWND p_parent,const char * p_title,t_size p_title_len = ~0) = 0;
+
+
+ //! Helper invoking run_modal().
+ static bool g_run_modal(service_ptr_t<threaded_process_callback> p_callback,unsigned p_flags,HWND p_parent,const char * p_title,t_size p_title_len = ~0);
+ //! Helper invoking run_modeless().
+ static bool g_run_modeless(service_ptr_t<threaded_process_callback> p_callback,unsigned p_flags,HWND p_parent,const char * p_title,t_size p_title_len = ~0);
+
+
+ FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(threaded_process);
+};
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/titleformat.cpp b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/titleformat.cpp new file mode 100644 index 0000000000..251e15a1b2 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/titleformat.cpp @@ -0,0 +1,190 @@ +#include "foobar2000.h"
+
+
+#define tf_profiler(x) // profiler(x)
+
+void titleformat_compiler::remove_color_marks(const char * src,pfc::string_base & out)//helper
+{
+ out.reset();
+ while(*src)
+ {
+ if (*src==3)
+ {
+ src++;
+ while(*src && *src!=3) src++;
+ if (*src==3) src++;
+ }
+ else out.add_byte(*src++);
+ }
+}
+
+static bool test_for_bad_char(const char * source,t_size source_char_len,const char * reserved)
+{
+ return pfc::strstr_ex(reserved,(t_size)(-1),source,source_char_len) != (t_size)(-1);
+}
+
+void titleformat_compiler::remove_forbidden_chars(titleformat_text_out * p_out,const GUID & p_inputtype,const char * p_source,t_size p_source_len,const char * p_reserved_chars)
+{
+ if (p_reserved_chars == 0 || *p_reserved_chars == 0)
+ {
+ p_out->write(p_inputtype,p_source,p_source_len);
+ }
+ else
+ {
+ p_source_len = pfc::strlen_max(p_source,p_source_len);
+ t_size index = 0;
+ t_size good_byte_count = 0;
+ while(index < p_source_len)
+ {
+ t_size delta = pfc::utf8_char_len(p_source + index,p_source_len - index);
+ if (delta == 0) break;
+ if (test_for_bad_char(p_source+index,delta,p_reserved_chars))
+ {
+ if (good_byte_count > 0) {p_out->write(p_inputtype,p_source+index-good_byte_count,good_byte_count);good_byte_count=0;}
+ p_out->write(p_inputtype,"_",1);
+ }
+ else
+ {
+ good_byte_count += delta;
+ }
+ index += delta;
+ }
+ if (good_byte_count > 0) {p_out->write(p_inputtype,p_source+index-good_byte_count,good_byte_count);good_byte_count=0;}
+ }
+}
+
+void titleformat_compiler::remove_forbidden_chars_string_append(pfc::string_receiver & p_out,const char * p_source,t_size p_source_len,const char * p_reserved_chars)
+{
+ remove_forbidden_chars(&titleformat_text_out_impl_string(p_out),pfc::guid_null,p_source,p_source_len,p_reserved_chars);
+}
+
+void titleformat_compiler::remove_forbidden_chars_string(pfc::string_base & p_out,const char * p_source,t_size p_source_len,const char * p_reserved_chars)
+{
+ p_out.reset();
+ remove_forbidden_chars_string_append(p_out,p_source,p_source_len,p_reserved_chars);
+}
+
+bool titleformat_hook_impl_file_info::process_field(titleformat_text_out * p_out,const char * p_name,t_size p_name_length,bool & p_found_flag) {
+ return m_api->process_field(*m_info,m_location,p_out,p_name,p_name_length,p_found_flag);
+}
+bool titleformat_hook_impl_file_info::process_function(titleformat_text_out * p_out,const char * p_name,t_size p_name_length,titleformat_hook_function_params * p_params,bool & p_found_flag) {
+ return m_api->process_function(*m_info,m_location,p_out,p_name,p_name_length,p_params,p_found_flag);
+}
+
+void titleformat_object::run_hook(const playable_location & p_location,const file_info * p_source,titleformat_hook * p_hook,pfc::string_base & p_out,titleformat_text_filter * p_filter)
+{
+ if (p_hook)
+ {
+ run(
+ &titleformat_hook_impl_splitter(
+ p_hook,
+ &titleformat_hook_impl_file_info(p_location,p_source)
+ ),
+ p_out,p_filter);
+ }
+ else
+ {
+ run(
+ &titleformat_hook_impl_file_info(p_location,p_source),
+ p_out,p_filter);
+ }
+}
+
+void titleformat_object::run_simple(const playable_location & p_location,const file_info * p_source,pfc::string_base & p_out)
+{
+ run(&titleformat_hook_impl_file_info(p_location,p_source),p_out,NULL);
+}
+
+t_size titleformat_hook_function_params::get_param_uint(t_size index)
+{
+ const char * str;
+ t_size str_len;
+ get_param(index,str,str_len);
+ return pfc::atoui_ex(str,str_len);
+}
+
+
+void titleformat_text_out_impl_filter_chars::write(const GUID & p_inputtype,const char * p_data,t_size p_data_length)
+{
+ titleformat_compiler::remove_forbidden_chars(m_chain,p_inputtype,p_data,p_data_length,m_restricted_chars);
+}
+
+bool titleformat_hook_impl_splitter::process_field(titleformat_text_out * p_out,const char * p_name,t_size p_name_length,bool & p_found_flag)
+{
+ p_found_flag = false;
+ if (m_hook1 && m_hook1->process_field(p_out,p_name,p_name_length,p_found_flag)) return true;
+ p_found_flag = false;
+ if (m_hook2 && m_hook2->process_field(p_out,p_name,p_name_length,p_found_flag)) return true;
+ p_found_flag = false;
+ return false;
+}
+
+bool titleformat_hook_impl_splitter::process_function(titleformat_text_out * p_out,const char * p_name,t_size p_name_length,titleformat_hook_function_params * p_params,bool & p_found_flag)
+{
+ p_found_flag = false;
+ if (m_hook1 && m_hook1->process_function(p_out,p_name,p_name_length,p_params,p_found_flag)) return true;
+ p_found_flag = false;
+ if (m_hook2 && m_hook2->process_function(p_out,p_name,p_name_length,p_params,p_found_flag)) return true;
+ p_found_flag = false;
+ return false;
+}
+
+void titleformat_text_out::write_int_padded(const GUID & p_inputtype,t_int64 val,t_int64 maxval)
+{
+ unsigned width = 0;
+ while(maxval > 0) {maxval/=10;width++;}
+ write(p_inputtype,pfc::format_int(val,width));
+}
+
+void titleformat_text_out::write_int(const GUID & p_inputtype,t_int64 val)
+{
+ write(p_inputtype,pfc::format_int(val));
+}
+void titleformat_text_filter_impl_reserved_chars::write(const GUID & p_inputtype,pfc::string_receiver & p_out,const char * p_data,t_size p_data_length)
+{
+ if (p_inputtype == titleformat_inputtypes::meta) titleformat_compiler::remove_forbidden_chars_string_append(p_out,p_data,p_data_length,m_reserved_chars);
+ else p_out.add_string(p_data,p_data_length);
+}
+
+void titleformat_compiler::run(titleformat_hook * p_source,pfc::string_base & p_out,const char * p_spec)
+{
+ service_ptr_t<titleformat_object> ptr;
+ if (!compile(ptr,p_spec)) p_out = "[COMPILATION ERROR]";
+ else ptr->run(p_source,p_out,NULL);
+}
+
+void titleformat_compiler::compile_safe(service_ptr_t<titleformat_object> & p_out,const char * p_spec)
+{
+ if (!compile(p_out,p_spec)) {
+ if (!compile(p_out,"%filename%"))
+ throw pfc::exception_bug_check_v2();
+ }
+}
+
+
+namespace titleformat_inputtypes {
+ const GUID meta = { 0xcd839c8e, 0x5c66, 0x4ae1, { 0x8d, 0xad, 0x71, 0x1f, 0x86, 0x0, 0xa, 0xe3 } };
+ const GUID unknown = { 0x673aa1cd, 0xa7a8, 0x40c8, { 0xbf, 0x9b, 0x34, 0x37, 0x99, 0x29, 0x16, 0x3b } };
+};
+
+void titleformat_text_filter_impl_filename_chars::write(const GUID & p_inputType,pfc::string_receiver & p_out,const char * p_data,t_size p_dataLength) {
+ if (p_inputType == titleformat_inputtypes::meta) {
+ //slightly inefficient...
+ p_out.add_string( pfc::io::path::replaceIllegalNameChars(pfc::string(p_data,p_dataLength)).ptr());
+ } else p_out.add_string(p_data,p_dataLength);
+}
+
+void titleformat_compiler::compile_safe_ex(titleformat_object::ptr & p_out,const char * p_spec,const char * p_fallback) {
+ if (!compile(p_out,p_spec)) compile_force(p_out,p_fallback);
+}
+
+
+void titleformat_text_filter_nontext_chars::write(const GUID & p_inputtype,pfc::string_receiver & p_out,const char * p_data,t_size p_data_length) {
+ for(t_size walk = 0;;) {
+ t_size base = walk;
+ while(walk < p_data_length && !isReserved(p_data[walk]) && p_data[walk] != 0) walk++;
+ p_out.add_string(p_data+base,walk-base);
+ if (walk >= p_data_length || p_data[walk] == 0) break;
+ p_out.add_byte('_'); walk++;
+ }
+}
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/titleformat.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/titleformat.h new file mode 100644 index 0000000000..570f41e84d --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/titleformat.h @@ -0,0 +1,227 @@ +namespace titleformat_inputtypes {
+ extern const GUID meta, unknown;
+};
+
+class NOVTABLE titleformat_text_out {
+public:
+ virtual void write(const GUID & p_inputtype,const char * p_data,t_size p_data_length = ~0) = 0;
+ void write_int(const GUID & p_inputtype,t_int64 val);
+ void write_int_padded(const GUID & p_inputtype,t_int64 val,t_int64 maxval);
+protected:
+ titleformat_text_out() {}
+ ~titleformat_text_out() {}
+};
+
+
+class NOVTABLE titleformat_text_filter {
+public:
+ virtual void write(const GUID & p_inputtype,pfc::string_receiver & p_out,const char * p_data,t_size p_data_length) = 0;
+protected:
+ titleformat_text_filter() {}
+ ~titleformat_text_filter() {}
+};
+
+class NOVTABLE titleformat_hook_function_params
+{
+public:
+ virtual t_size get_param_count() = 0;
+ virtual void get_param(t_size index,const char * & p_string,t_size & p_string_len) = 0;//warning: not a null-terminated string
+
+ //helper
+ t_size get_param_uint(t_size index);
+};
+
+class NOVTABLE titleformat_hook
+{
+public:
+ virtual bool process_field(titleformat_text_out * p_out,const char * p_name,t_size p_name_length,bool & p_found_flag) = 0;
+ virtual bool process_function(titleformat_text_out * p_out,const char * p_name,t_size p_name_length,titleformat_hook_function_params * p_params,bool & p_found_flag) = 0;
+};
+//! Represents precompiled executable title-formatting script. Use titleformat_compiler to instantiate; do not reimplement.
+class NOVTABLE titleformat_object : public service_base
+{
+public:
+ virtual void run(titleformat_hook * p_source,pfc::string_base & p_out,titleformat_text_filter * p_filter)=0;
+
+ void run_hook(const playable_location & p_location,const file_info * p_source,titleformat_hook * p_hook,pfc::string_base & p_out,titleformat_text_filter * p_filter);
+ void run_simple(const playable_location & p_location,const file_info * p_source,pfc::string_base & p_out);
+
+ FB2K_MAKE_SERVICE_INTERFACE(titleformat_object,service_base);
+};
+
+//! Standard service for instantiating titleformat_object. Implemented by the core; do not reimplement.
+//! To instantiate, use static_api_ptr_t<titleformat_compiler>.
+class NOVTABLE titleformat_compiler : public service_base
+{
+public:
+ //! Returns false in case of a compilation error.
+ virtual bool compile(titleformat_object::ptr & p_out,const char * p_spec) = 0;
+ //! Helper;
+ void run(titleformat_hook * p_source,pfc::string_base & p_out,const char * p_spec);
+ //! Should never fail, falls back to %filename% in case of failure.
+ void compile_safe(titleformat_object::ptr & p_out,const char * p_spec);
+
+ //! Falls back to p_fallback in case of failure.
+ void compile_safe_ex(titleformat_object::ptr & p_out,const char * p_spec,const char * p_fallback = "<ERROR>");
+
+ //! Throws a bug check exception when script can't be compiled. For use with hardcoded scripts only.
+ void compile_force(titleformat_object::ptr & p_out,const char * p_spec) {if (!compile(p_out,p_spec)) throw pfc::exception_bug_check_v2();}
+
+
+ static void remove_color_marks(const char * src,pfc::string_base & out);//helper
+ static void remove_forbidden_chars(titleformat_text_out * p_out,const GUID & p_inputtype,const char * p_source,t_size p_source_len,const char * p_forbidden_chars);
+ static void remove_forbidden_chars_string_append(pfc::string_receiver & p_out,const char * p_source,t_size p_source_len,const char * p_forbidden_chars);
+ static void remove_forbidden_chars_string(pfc::string_base & p_out,const char * p_source,t_size p_source_len,const char * p_forbidden_chars);
+
+ FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(titleformat_compiler);
+};
+
+
+class titleformat_object_wrapper {
+public:
+ titleformat_object_wrapper(const char * p_script) {
+ static_api_ptr_t<titleformat_compiler>()->compile_force(m_script,p_script);
+ }
+
+ operator const service_ptr_t<titleformat_object> &() const {return m_script;}
+
+private:
+ service_ptr_t<titleformat_object> m_script;
+};
+
+
+//helpers
+
+
+class titleformat_text_out_impl_filter_chars : public titleformat_text_out
+{
+public:
+ inline titleformat_text_out_impl_filter_chars(titleformat_text_out * p_chain,const char * p_restricted_chars)
+ : m_chain(p_chain), m_restricted_chars(p_restricted_chars) {}
+ void write(const GUID & p_inputtype,const char * p_data,t_size p_data_length);
+private:
+ titleformat_text_out * m_chain;
+ const char * m_restricted_chars;
+};
+
+class titleformat_text_out_impl_string : public titleformat_text_out {
+public:
+ titleformat_text_out_impl_string(pfc::string_receiver & p_string) : m_string(p_string) {}
+ void write(const GUID & p_inputtype,const char * p_data,t_size p_data_length) {m_string.add_string(p_data,p_data_length);}
+private:
+ pfc::string_receiver & m_string;
+};
+
+class titleformat_common_methods : public service_base {
+public:
+ virtual bool process_field(const file_info & p_info,const playable_location & p_location,titleformat_text_out * p_out,const char * p_name,t_size p_name_length,bool & p_found_flag) = 0;
+ virtual bool process_function(const file_info & p_info,const playable_location & p_location,titleformat_text_out * p_out,const char * p_name,t_size p_name_length,titleformat_hook_function_params * p_params,bool & p_found_flag) = 0;
+ virtual bool remap_meta(const file_info & p_info,t_size & p_index, const char * p_name, t_size p_name_length) = 0;
+
+ FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(titleformat_common_methods);
+};
+
+class titleformat_hook_impl_file_info : public titleformat_hook
+{
+public:
+ titleformat_hook_impl_file_info(const playable_location & p_location,const file_info * p_info) : m_location(p_location), m_info(p_info) {}//caller must ensure that referenced file_info object is alive as long as the titleformat_hook_impl_file_info instance
+ bool process_field(titleformat_text_out * p_out,const char * p_name,t_size p_name_length,bool & p_found_flag);
+ bool process_function(titleformat_text_out * p_out,const char * p_name,t_size p_name_length,titleformat_hook_function_params * p_params,bool & p_found_flag);
+protected:
+ bool remap_meta(t_size & p_index, const char * p_name, t_size p_name_length) {return m_api->remap_meta(*m_info,p_index,p_name,p_name_length);}
+ const file_info * m_info;
+private:
+ const playable_location & m_location;
+ static_api_ptr_t<titleformat_common_methods> m_api;
+};
+
+class titleformat_hook_impl_splitter : public titleformat_hook {
+public:
+ inline titleformat_hook_impl_splitter(titleformat_hook * p_hook1,titleformat_hook * p_hook2) : m_hook1(p_hook1), m_hook2(p_hook2) {}
+ bool process_field(titleformat_text_out * p_out,const char * p_name,t_size p_name_length,bool & p_found_flag);
+ bool process_function(titleformat_text_out * p_out,const char * p_name,t_size p_name_length,titleformat_hook_function_params * p_params,bool & p_found_flag);
+private:
+ titleformat_hook * m_hook1, * m_hook2;
+};
+
+class titleformat_text_filter_impl_reserved_chars : public titleformat_text_filter {
+public:
+ titleformat_text_filter_impl_reserved_chars(const char * p_reserved_chars) : m_reserved_chars(p_reserved_chars) {}
+ virtual void write(const GUID & p_inputtype,pfc::string_receiver & p_out,const char * p_data,t_size p_data_length);
+private:
+ const char * m_reserved_chars;
+};
+
+class titleformat_text_filter_impl_filename_chars : public titleformat_text_filter {
+public:
+ void write(const GUID & p_inputType,pfc::string_receiver & p_out,const char * p_data,t_size p_dataLength);
+};
+
+class titleformat_text_filter_nontext_chars : public titleformat_text_filter {
+public:
+ inline static bool isReserved(char c) { return c >= 0 && c < 0x20; }
+ void write(const GUID & p_inputtype,pfc::string_receiver & p_out,const char * p_data,t_size p_data_length);
+};
+
+
+
+
+
+
+
+class titleformat_hook_impl_list : public titleformat_hook {
+public:
+ titleformat_hook_impl_list(t_size p_index /* zero-based! */,t_size p_total) : m_index(p_index), m_total(p_total) {}
+
+ bool process_field(titleformat_text_out * p_out,const char * p_name,t_size p_name_length,bool & p_found_flag) {
+ if (
+ stricmp_utf8_ex(p_name,p_name_length,"list_index",~0) == 0
+ ) {
+ p_out->write_int_padded(titleformat_inputtypes::unknown,m_index+1, m_total);
+ p_found_flag = true; return true;
+ } else if (
+ stricmp_utf8_ex(p_name,p_name_length,"list_total",~0) == 0
+ ) {
+ p_out->write_int(titleformat_inputtypes::unknown,m_total);
+ p_found_flag = true; return true;
+ } else {
+ p_found_flag = false; return false;
+ }
+ }
+
+ bool process_function(titleformat_text_out * p_out,const char * p_name,t_size p_name_length,titleformat_hook_function_params * p_params,bool & p_found_flag) {return false;}
+
+private:
+ t_size m_index, m_total;
+};
+
+class string_formatter_tf : public pfc::string_base {
+public:
+ string_formatter_tf(titleformat_text_out * out, const GUID & inputType = titleformat_inputtypes::meta) : m_out(out), m_inputType(inputType) {}
+
+ const char * get_ptr() const {
+ throw pfc::exception_not_implemented();
+ }
+ void add_string(const char * p_string,t_size p_length) {
+ m_out->write(m_inputType,p_string,p_length);
+ }
+ void set_string(const char * p_string,t_size p_length) {
+ throw pfc::exception_not_implemented();
+ }
+ void truncate(t_size len) {
+ throw pfc::exception_not_implemented();
+ }
+ t_size get_length() const {
+ throw pfc::exception_not_implemented();
+ }
+ char * lock_buffer(t_size p_requested_length) {
+ throw pfc::exception_not_implemented();
+ }
+ void unlock_buffer() {
+ throw pfc::exception_not_implemented();
+ }
+
+private:
+ titleformat_text_out * const m_out;
+ const GUID m_inputType;
+};
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/track_property.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/track_property.h new file mode 100644 index 0000000000..3f8aa605df --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/track_property.h @@ -0,0 +1,45 @@ +//! Callback interface for track_property_provider::enumerate_properties().
+class NOVTABLE track_property_callback {
+public:
+ //! Sets a property list entry to display. Called by track_property_provider::enumerate_properties() implementation.
+ //! @param p_group Name of group to put the entry in, case-sensitive. Note that non-standard groups are sorted alphabetically.
+ //! @param p_sortpriority Sort priority of the property inside its group (smaller value means earlier in the list), pass 0 if you don't care (alphabetic order by name used when more than one item has same priority).
+ //! @param p_name Name of the property.
+ //! @param p_value Value of the property.
+ virtual void set_property(const char * p_group,double p_sortpriority,const char * p_name,const char * p_value) = 0;
+protected:
+ track_property_callback const & operator=(track_property_callback const &) {return *this;}
+ ~track_property_callback() {}
+};
+
+class NOVTABLE track_property_callback_v2 : public track_property_callback {
+public:
+ virtual bool is_group_wanted(const char * p_group) = 0;
+protected:
+ ~track_property_callback_v2() {}
+};
+
+//! Service for adding custom entries in "Properties" tab of the properties dialog.
+class NOVTABLE track_property_provider : public service_base {
+public:
+ //! Enumerates properties of specified track list.
+ //! @param p_tracks List of tracks to enumerate properties on.
+ //! @param p_out Callback interface receiving enumerated properties.
+ virtual void enumerate_properties(metadb_handle_list_cref p_tracks, track_property_callback & p_out) = 0;
+ //! Returns whether specified tech info filed is processed by our service and should not be displayed among unknown fields.
+ //! @param p_name Name of tech info field being queried.
+ //! @returns True if the field is among fields processed by this track_property_provider implementation and should not be displayed among unknown fields, false otherwise.
+ virtual bool is_our_tech_info(const char * p_name) = 0;
+
+ FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(track_property_provider);
+};
+
+class NOVTABLE track_property_provider_v2 : public track_property_provider {
+public:
+ virtual void enumerate_properties_v2(metadb_handle_list_cref p_tracks, track_property_callback_v2 & p_out) = 0;
+
+ FB2K_MAKE_SERVICE_INTERFACE(track_property_provider_v2,track_property_provider)
+};
+
+template<typename T>
+class track_property_provider_factory_t : public service_factory_single_t<T> {};
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/ui.cpp b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/ui.cpp new file mode 100644 index 0000000000..7417e65e5f --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/ui.cpp @@ -0,0 +1,35 @@ +#include "foobar2000.h"
+
+bool ui_drop_item_callback::g_on_drop(interface IDataObject * pDataObject)
+{
+ service_enum_t<ui_drop_item_callback> e;
+ service_ptr_t<ui_drop_item_callback> ptr;
+ if (e.first(ptr)) do {
+ if (ptr->on_drop(pDataObject)) return true;
+ } while(e.next(ptr));
+ return false;
+}
+
+bool ui_drop_item_callback::g_is_accepted_type(interface IDataObject * pDataObject, DWORD * p_effect)
+{
+ service_enum_t<ui_drop_item_callback> e;
+ service_ptr_t<ui_drop_item_callback> ptr;
+ if (e.first(ptr)) do {
+ if (ptr->is_accepted_type(pDataObject,p_effect)) return true;
+ } while(e.next(ptr));
+ return false;
+}
+
+bool user_interface::g_find(service_ptr_t<user_interface> & p_out,const GUID & p_guid)
+{
+ service_enum_t<user_interface> e;
+ service_ptr_t<user_interface> ptr;
+ if (e.first(ptr)) do {
+ if (ptr->get_guid() == p_guid)
+ {
+ p_out = ptr;
+ return true;
+ }
+ } while(e.next(ptr));
+ return false;
+}
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/ui.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/ui.h new file mode 100644 index 0000000000..7618db731c --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/ui.h @@ -0,0 +1,228 @@ +#ifndef _WINDOWS
+#error PORTME
+#endif
+
+//! Entrypoint service for user interface modules. Implement when registering an UI module. Do not call existing implementations; only core enumerates / dispatches calls. To control UI behaviors from other components, use ui_control API. \n
+//! Use user_interface_factory_t<> to register, e.g static user_interface_factory_t<myclass> g_myclass_factory;
+class NOVTABLE user_interface : public service_base {
+public:
+ //!HookProc usage: \n
+ //! in your windowproc, call HookProc first, and if it returns true, return LRESULT value it passed to you
+ typedef BOOL (WINAPI * HookProc_t)(HWND wnd,UINT msg,WPARAM wp,LPARAM lp,LRESULT * ret);
+
+ //! Retrieves name (UTF-8 null-terminated string) of the UI module.
+ virtual const char * get_name()=0;
+ //! Initializes the UI module - creates the main app window, etc. Failure should be signaled by appropriate exception (std::exception or a derivative).
+ virtual HWND init(HookProc_t hook)=0;
+ //! Deinitializes the UI module - destroys the main app window, etc.
+ virtual void shutdown()=0;
+ //! Activates main app window.
+ virtual void activate()=0;
+ //! Minimizes/hides main app window.
+ virtual void hide()=0;
+ //! Returns whether main window is visible / not minimized. Used for activate/hide command.
+ virtual bool is_visible() = 0;
+ //! Retrieves GUID of your implementation, to be stored in configuration file etc.
+ virtual GUID get_guid() = 0;
+
+ //! Overrides statusbar text with specified string. The parameter is a null terminated UTF-8 string. The override is valid until another override_statusbar_text() call or revert_statusbar_text() call.
+ virtual void override_statusbar_text(const char * p_text) = 0;
+ //! Disables statusbar text override.
+ virtual void revert_statusbar_text() = 0;
+
+ //! Shows now-playing item somehow (e.g. system notification area popup).
+ virtual void show_now_playing() = 0;
+
+ static bool g_find(service_ptr_t<user_interface> & p_out,const GUID & p_guid);
+
+ FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(user_interface);
+};
+
+template<typename T>
+class user_interface_factory : public service_factory_single_t<T> {};
+
+//! Interface class allowing you to override UI statusbar text. There may be multiple callers trying to override statusbar text; backend decides which one succeeds so you will not always get what you want. Statusbar text override is automatically cancelled when the object is released.\n
+//! Use ui_control::override_status_text_create() to instantiate.
+//! Implemented by core. Do not reimplement.
+class NOVTABLE ui_status_text_override : public service_base
+{
+public:
+ //! Sets statusbar text to specified UTF-8 null-terminated string.
+ virtual void override_text(const char * p_message) = 0;
+ //! Cancels statusbar text override.
+ virtual void revert_text() = 0;
+
+ FB2K_MAKE_SERVICE_INTERFACE(ui_status_text_override,service_base);
+};
+
+//! Serivce providing various UI-related commands. Implemented by core; do not reimplement.
+//! Instantiation: use static_api_ptr_t<ui_control>.
+class NOVTABLE ui_control : public service_base {
+public:
+ //! Returns whether primary UI is visible/unminimized.
+ virtual bool is_visible()=0;
+ //! Activates/unminimizes main UI.
+ virtual void activate()=0;
+ //! Hides/minimizese main UI.
+ virtual void hide()=0;
+ //! Retrieves main GUI icon, to use as window icon etc. Returned handle does not need to be freed.
+ virtual HICON get_main_icon()=0;
+ //! Loads main GUI icon, version with specified width/height. Returned handle needs to be freed with DestroyIcon when you are done using it.
+ virtual HICON load_main_icon(unsigned width,unsigned height) = 0;
+
+ //! Activates preferences dialog and navigates to specified page. See also: preference_page API.
+ virtual void show_preferences(const GUID & p_page) = 0;
+
+ //! Instantiates ui_status_text_override service, that can be used to display status messages.
+ //! @param p_out receives new ui_status_text_override instance.
+ //! @returns true on success, false on failure (out of memory / no GUI loaded / etc)
+ virtual bool override_status_text_create(service_ptr_t<ui_status_text_override> & p_out) = 0;
+
+ FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(ui_control);
+};
+
+//! Service called from the UI when some object is dropped into the UI. Usable for modifying drag&drop behaviors such as adding custom handlers for object types other than supported media files.\n
+//! Implement where needed; use ui_drop_item_callback_factory_t<> template to register, e.g. static ui_drop_item_callback_factory_t<myclass> g_myclass_factory.
+class NOVTABLE ui_drop_item_callback : public service_base {
+public:
+ //! Called when an object was dropped; returns true if the object was processed and false if not.
+ virtual bool on_drop(interface IDataObject * pDataObject) = 0;
+ //! Tests whether specified object type is supported by this ui_drop_item_callback implementation. Returns true and sets p_effect when it's supported; returns false otherwise. \n
+ //! See IDropTarget::DragEnter() documentation for more information about p_effect values.
+ virtual bool is_accepted_type(interface IDataObject * pDataObject, DWORD * p_effect)=0;
+
+ //! Static helper, calls all existing implementations appropriately. See on_drop().
+ static bool g_on_drop(interface IDataObject * pDataObject);
+ //! Static helper, calls all existing implementations appropriately. See is_accepted_type().
+ static bool g_is_accepted_type(interface IDataObject * pDataObject, DWORD * p_effect);
+
+ FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(ui_drop_item_callback);
+};
+
+template<class T>
+class ui_drop_item_callback_factory_t : public service_factory_single_t<T> {};
+
+
+class ui_selection_callback;
+
+//! Write interface and reference counter for the shared selection.
+//! The ui_selection_manager stores the selected items as a list.
+//! The ui_selection_holder service allows components to modify this list.
+//! It also serves as a reference count: the ui_selection_manager clears the stored
+//! selection when no component holds a reference to a ui_selection_holder.
+//!
+//! When a window that uses the shared selection gets the focus, it should acquire
+//! a ui_selection_holder from the ui_selection_manager. If it contains selectable items,
+//! it should use the appropriate method to store its selected items as the shared selection.
+//! If it just wants to preserve the selection - for example so it can display it - it should
+//! merely store the acquired ui_selection_holder.
+//!
+//! When the window loses the focus, it should release its ui_selection_holder.
+//! It should not use a set method to clear the selection
+class NOVTABLE ui_selection_holder : public service_base {
+public:
+ //! Sets selected items.
+ virtual void set_selection(metadb_handle_list_cref data) = 0;
+ //! Sets selected items to playlist selection and enables tracking.
+ //! When the playlist selection changes, the stored selection is automatically updated.
+ //! Tracking ends when a set method is called on any ui_selection_holder or when
+ //! the last reference to this ui_selection_holder is released.
+ virtual void set_playlist_selection_tracking() = 0;
+ //! Sets selected items to the contents of the active playlist and enables tracking.
+ //! When the active playlist or its contents changes, the stored selection is automatically updated.
+ //! Tracking ends when a set method is called on any ui_selection_holder or when
+ //! the last reference to this ui_selection_holder is released.
+ virtual void set_playlist_tracking() = 0;
+
+ //! Sets selected items and type of selection holder.
+ //! @param type Specifies type of selection. Values same as contextmenu_item caller IDs.
+ virtual void set_selection_ex(metadb_handle_list_cref data, const GUID & type) = 0;
+
+ FB2K_MAKE_SERVICE_INTERFACE(ui_selection_holder,service_base);
+};
+
+class NOVTABLE ui_selection_manager : public service_base {
+public:
+ //! Retrieves the current selection.
+ virtual void get_selection(metadb_handle_list_ref p_selection) = 0;
+ //! Registers a callback. It is recommended to use ui_selection_callback_impl_base class instead of calling this directly.
+ virtual void register_callback(ui_selection_callback * p_callback) = 0;
+ //! Unregisters a callback. It is recommended to use ui_selection_callback_impl_base class instead of calling this directly.
+ virtual void unregister_callback(ui_selection_callback * p_callback) = 0;
+
+ virtual ui_selection_holder::ptr acquire() = 0;
+
+ //! Retrieves type of the active selection holder. Values same as contextmenu_item caller IDs.
+ virtual GUID get_selection_type() = 0;
+
+ FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(ui_selection_manager);
+};
+
+//! \since 1.0
+class NOVTABLE ui_selection_manager_v2 : public ui_selection_manager {
+ FB2K_MAKE_SERVICE_INTERFACE(ui_selection_manager_v2, ui_selection_manager)
+public:
+ enum { flag_no_now_playing = 1 };
+ virtual void get_selection(metadb_handle_list_ref out, t_uint32 flags) = 0;
+ virtual GUID get_selection_type(t_uint32 flags) = 0;
+ virtual void register_callback(ui_selection_callback * callback, t_uint32 flags) = 0;
+};
+
+class ui_selection_callback {
+public:
+ virtual void on_selection_changed(metadb_handle_list_cref p_selection) = 0;
+protected:
+ ui_selection_callback() {}
+ ~ui_selection_callback() {}
+};
+
+//! ui_selection_callback implementation helper with autoregistration - do not instantiate statically
+class ui_selection_callback_impl_base : public ui_selection_callback {
+protected:
+ ui_selection_callback_impl_base(bool activate = true) : m_active() {ui_selection_callback_activate(activate);}
+ ~ui_selection_callback_impl_base() {ui_selection_callback_activate(false);}
+
+ void ui_selection_callback_activate(bool state = true) {
+ if (state != m_active) {
+ m_active = state;
+ static_api_ptr_t<ui_selection_manager> api;
+ if (state) api->register_callback(this);
+ else api->unregister_callback(this);
+ }
+ }
+
+ //avoid pure virtual function calls in rare cases - provide a dummy implementation
+ void on_selection_changed(metadb_handle_list_cref p_selection) {}
+
+ PFC_CLASS_NOT_COPYABLE_EX(ui_selection_callback_impl_base);
+private:
+ bool m_active;
+};
+
+//! \since 1.0
+//! ui_selection_callback implementation helper with autoregistration - do not instantiate statically
+template<unsigned flags>
+class ui_selection_callback_impl_base_ex : public ui_selection_callback {
+protected:
+ enum {
+ ui_selection_flags = flags
+ };
+ ui_selection_callback_impl_base_ex(bool activate = true) : m_active() {ui_selection_callback_activate(activate);}
+ ~ui_selection_callback_impl_base_ex() {ui_selection_callback_activate(false);}
+
+ void ui_selection_callback_activate(bool state = true) {
+ if (state != m_active) {
+ m_active = state;
+ static_api_ptr_t<ui_selection_manager_v2> api;
+ if (state) api->register_callback(this, flags);
+ else api->unregister_callback(this);
+ }
+ }
+
+ //avoid pure virtual function calls in rare cases - provide a dummy implementation
+ void on_selection_changed(metadb_handle_list_cref p_selection) {}
+
+ PFC_CLASS_NOT_COPYABLE(ui_selection_callback_impl_base_ex, ui_selection_callback_impl_base_ex<flags>);
+private:
+ bool m_active;
+};
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/ui_edit_context.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/ui_edit_context.h new file mode 100644 index 0000000000..41747fcb49 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/ui_edit_context.h @@ -0,0 +1,132 @@ +
+class NOVTABLE ui_edit_context : public service_base {
+ FB2K_MAKE_SERVICE_INTERFACE(ui_edit_context, service_base)
+public:
+ //! Called by core only.
+ virtual void initialize() = 0;
+ //! Called by core only. \n
+ //! WARNING: you may get other methods called after shutdown() in case someone using ui_edit_context_manager has kept a reference to your service - for an example during an async operation. You should behave sanely in such case - either execute the operation if still possible or fail cleanly.
+ virtual void shutdown() = 0;
+
+ enum {
+ flag_removable = 1,
+ flag_reorderable = 2,
+ flag_undoable = 4,
+ flag_redoable = 8,
+ flag_linearlist = 16,
+ flag_searchable = 32,
+ flag_insertable = 64,
+ };
+
+ virtual t_uint32 get_flags() = 0;
+
+ bool can_remove() {return (get_flags() & flag_removable) != 0;}
+ bool test_flags(t_uint32 flags) {return (get_flags() & flags) == flags;}
+ bool can_remove_mask() {return test_flags(flag_removable | flag_linearlist);}
+ bool can_reorder() {return test_flags(flag_reorderable);}
+ bool can_search() {return test_flags(flag_searchable);}
+
+ virtual void select_all() {update_selection(bit_array_true(), bit_array_true());}
+ virtual void select_none() {update_selection(bit_array_true(), bit_array_false());}
+ virtual void get_selected_items(metadb_handle_list_ref out) {bit_array_bittable mask(get_item_count()); get_selection_mask(mask); get_items(out, mask);}
+ virtual void remove_selection() {bit_array_bittable mask(get_item_count()); get_selection_mask(mask); remove_items(mask);}
+ virtual void crop_selection() {bit_array_bittable mask(get_item_count()); get_selection_mask(mask); remove_items(bit_array_not(mask));}
+ virtual void clear() {remove_items(bit_array_true());}
+ virtual void get_all_items(metadb_handle_list_ref out) {get_items(out, bit_array_true());}
+ virtual GUID get_selection_type() = 0;
+
+ // available if flag_linearlist is set
+ virtual void get_selection_mask(pfc::bit_array_var & out) {
+ const t_size count = get_item_count(); for(t_size walk = 0; walk < count; ++walk) out.set(walk, is_item_selected(walk));
+ }
+ virtual void update_selection(const pfc::bit_array & mask, const pfc::bit_array & newVals) = 0;
+ virtual t_size get_item_count(t_size max = ~0) = 0;
+ virtual metadb_handle_ptr get_item(t_size index) = 0;
+ virtual void get_items(metadb_handle_list_ref out, pfc::bit_array const & mask) = 0;
+ virtual bool is_item_selected(t_size item) = 0;
+ virtual void remove_items(pfc::bit_array const & mask) = 0;
+ virtual void reorder_items(const t_size * order, t_size count) = 0;
+ virtual t_size get_selection_count(t_size max = ~0) {
+ t_size count = 0;
+ const t_size total = get_item_count();
+ for(t_size walk = 0; walk < total && count < max; ++walk) if (is_item_selected(walk)) ++count;
+ return count;
+ }
+
+ virtual void search() = 0;
+
+ virtual void undo_backup() = 0;
+ virtual void undo_restore() = 0;
+ virtual void redo_restore() = 0;
+
+ virtual void insert_items(t_size at, metadb_handle_list_cref items, pfc::bit_array const & selection) = 0;
+
+ virtual t_size query_insert_mark() = 0;
+
+ void sort_by_format(const char * spec, bool onlySelection) {
+ const t_size count = get_item_count();
+ pfc::array_t<t_size> order; order.set_size(count);
+ pfc::array_t<t_size> sel_map;
+ if (onlySelection) {
+ sel_map.set_size(count);
+ t_size sel_count = 0;
+ for(t_size n=0;n<count;n++) if (is_item_selected(n)) sel_map[sel_count++]=n;
+ sel_map.set_size(sel_count);
+ }
+
+ {
+ metadb_handle_list temp;
+ pfc::array_t<t_size> order_temp;
+ if (onlySelection) {
+ get_selected_items(temp);
+ order_temp.set_size(count);
+ } else {
+ get_all_items(temp);
+ }
+
+
+ if (spec != NULL) {
+ temp.sort_by_format_get_order(onlySelection ? order_temp.get_ptr() : order.get_ptr(),spec,0);
+ } else {
+ static_api_ptr_t<genrand_service> api; api->seed((unsigned)__rdtsc());
+ api->generate_random_order(onlySelection ? order_temp.get_ptr() : order.get_ptr(),temp.get_count());
+ }
+
+ if (onlySelection) {
+ t_size n,ptr;
+ for(n=0,ptr=0;n<count;n++) {
+ if (!is_item_selected(n)) {
+ order[n] = n;
+ } else {
+ t_size v = order_temp[ptr++];
+ order[n] = sel_map[v];
+ }
+ }
+ }
+ }
+
+ reorder_items(order.get_ptr(), count);
+ }
+
+};
+
+class ui_edit_context_playlist : public ui_edit_context {
+ FB2K_MAKE_SERVICE_INTERFACE(ui_edit_context_playlist, ui_edit_context)
+public:
+ virtual t_size get_playlist_number() = 0;
+};
+
+class NOVTABLE ui_edit_context_manager : public service_base {
+ FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(ui_edit_context_manager)
+public:
+ virtual t_uint32 set_context(ui_edit_context::ptr context) = 0;
+ virtual void unset_context(t_uint32 id) = 0;
+ virtual ui_edit_context::ptr get_context() = 0;
+ virtual ui_edit_context::ptr create_playlist_context(t_size playlist_number) = 0;
+ virtual void disable_autofallback() = 0;
+ virtual t_uint32 set_context_active_playlist() = 0;
+};
+
+FOOGUIDDECL const GUID ui_edit_context::class_guid = { 0xf9ba651b, 0x52dd, 0x466f, { 0xaa, 0x77, 0xa9, 0x7a, 0x74, 0x98, 0x80, 0x7e } };
+FOOGUIDDECL const GUID ui_edit_context_manager::class_guid = { 0x3807f161, 0xaa17, 0x47df, { 0x80, 0xf1, 0xe, 0xfc, 0xd2, 0x19, 0xb7, 0xa1 } };
+FOOGUIDDECL const GUID ui_edit_context_playlist::class_guid = { 0x6dec364d, 0x29f2, 0x47c8, { 0xaf, 0x93, 0xbd, 0x35, 0x56, 0x3f, 0xa2, 0x25 } };
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/ui_element.cpp b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/ui_element.cpp new file mode 100644 index 0000000000..6ef8afbdce --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/ui_element.cpp @@ -0,0 +1,124 @@ +#include "foobar2000.h"
+
+
+namespace {
+ class ui_element_config_impl : public ui_element_config {
+ public:
+ ui_element_config_impl(const GUID & guid) : m_guid(guid) {}
+ ui_element_config_impl(const GUID & guid, const void * buffer, t_size size) : m_guid(guid) {
+ m_content.set_data_fromptr(reinterpret_cast<const t_uint8*>(buffer),size);
+ }
+
+ void * get_data_var() {return m_content.get_ptr();}
+ void set_data_size(t_size size) {m_content.set_size(size);}
+
+ GUID get_guid() const {return m_guid;}
+ const void * get_data() const {return m_content.get_ptr();}
+ t_size get_data_size() const {return m_content.get_size();}
+ private:
+ const GUID m_guid;
+ pfc::array_t<t_uint8> m_content;
+ };
+
+}
+
+service_ptr_t<ui_element_config> ui_element_config::g_create(const GUID& id, const void * data, t_size size) {
+ return new service_impl_t<ui_element_config_impl>(id,data,size);
+}
+
+service_ptr_t<ui_element_config> ui_element_config::g_create(const GUID & id, stream_reader * in, t_size bytes, abort_callback & abort) {
+ service_ptr_t<ui_element_config_impl> data = new service_impl_t<ui_element_config_impl>(id);
+ data->set_data_size(bytes);
+ in->read_object(data->get_data_var(),bytes,abort);
+ return data;
+}
+
+service_ptr_t<ui_element_config> ui_element_config::g_create(stream_reader * in, t_size bytes, abort_callback & abort) {
+ if (bytes < sizeof(GUID)) throw exception_io_data_truncation();
+ GUID id; stream_reader_formatter<>(*in,abort) >> id;
+ return g_create(id,in,bytes - sizeof(GUID),abort);
+}
+
+ui_element_config::ptr ui_element_config_parser::subelement(t_size size) {
+ return ui_element_config::g_create(&m_stream, size, m_abort);
+}
+ui_element_config::ptr ui_element_config_parser::subelement(const GUID & id, t_size dataSize) {
+ return ui_element_config::g_create(id, &m_stream, dataSize, m_abort);
+}
+
+service_ptr_t<ui_element_config> ui_element_config::g_create(const void * data, t_size size) {
+ stream_reader_memblock_ref stream(data,size);
+ return g_create(&stream,size,abort_callback_dummy());
+}
+
+bool ui_element_subclass_description(const GUID & id, pfc::string_base & p_out) {
+ if (id == ui_element_subclass_playlist_renderers) {
+ p_out = "Playlist Renderers"; return true;
+ } else if (id == ui_element_subclass_media_library_viewers) {
+ p_out = "Media Library Viewers"; return true;
+ } else if (id == ui_element_subclass_selection_information) {
+ p_out = "Selection Information"; return true;
+ } else if (id == ui_element_subclass_playback_visualisation) {
+ p_out = "Playback Visualization"; return true;
+ } else if (id == ui_element_subclass_playback_information) {
+ p_out = "Playback Information"; return true;
+ } else if (id == ui_element_subclass_utility) {
+ p_out = "Utility"; return true;
+ } else if (id == ui_element_subclass_containers) {
+ p_out = "Containers"; return true;
+ } else {
+ return false;
+ }
+}
+
+bool ui_element::get_element_group(pfc::string_base & p_out) {
+ return ui_element_subclass_description(get_subclass(),p_out);
+}
+
+t_ui_color ui_element_instance_callback::query_std_color(const GUID & p_what) {
+#ifdef _WIN32
+ t_ui_color ret;
+ if (query_color(p_what,ret)) return ret;
+ int idx = ui_color_to_sys_color_index(p_what);
+ if (idx < 0) return 0;//should not be triggerable
+ return GetSysColor(idx);
+#else
+#error portme
+#endif
+}
+
+bool ui_element::g_find(service_ptr_t<ui_element> & out, const GUID & id) {
+ return service_by_guid(out, id);
+}
+
+bool ui_element::g_get_name(pfc::string_base & p_out,const GUID & p_guid) {
+ ui_element::ptr ptr; if (!g_find(ptr,p_guid)) return false;
+ ptr->get_name(p_out); return true;
+}
+
+bool ui_element_instance_callback::is_elem_visible_(service_ptr_t<class ui_element_instance> elem) {
+ ui_element_instance_callback_v2::ptr v2;
+ if (!this->service_query_t(v2)) {
+ PFC_ASSERT(!"Should not get here - somebody implemented ui_element_instance_callback but not ui_element_instance_callback_v2.");
+ return true;
+ }
+ return v2->is_elem_visible(elem);
+}
+
+bool ui_element_instance_callback::set_elem_label(ui_element_instance * source, const char * label) {
+ return notify_(source, ui_element_host_notify_set_elem_label, 0, label, strlen(label)) != 0;
+}
+
+t_uint32 ui_element_instance_callback::get_dialog_texture(ui_element_instance * source) {
+ return (t_uint32) notify_(source, ui_element_host_notify_get_dialog_texture, 0, NULL, 0);
+}
+
+bool ui_element_instance_callback::is_border_needed(ui_element_instance * source) {
+ return notify_(source, ui_element_host_notify_is_border_needed, 0, NULL, 0) != 0;
+}
+
+t_size ui_element_instance_callback::notify_(ui_element_instance * source, const GUID & what, t_size param1, const void * param2, t_size param2size) {
+ ui_element_instance_callback_v3::ptr v3;
+ if (!this->service_query_t(v3)) { PFC_ASSERT(!"Outdated UI Element host implementation"); return 0; }
+ return v3->notify(source, what, param1, param2, param2size);
+}
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/ui_element.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/ui_element.h new file mode 100644 index 0000000000..6d749d1803 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/ui_element.h @@ -0,0 +1,634 @@ +//! Configuration of a UI element.
+class NOVTABLE ui_element_config : public service_base {
+public:
+ //! Returns GUID of the UI element this configuration data belongs to.
+ virtual GUID get_guid() const = 0;
+ //! Returns raw configuration data pointer.
+ virtual const void * get_data() const = 0;
+ //! Returns raw configuration data size, in bytes.
+ virtual t_size get_data_size() const = 0;
+
+
+ //! Helper.
+ static service_ptr_t<ui_element_config> g_create(const GUID& id, const void * data, t_size size);
+
+ template<typename t_source> static service_ptr_t<ui_element_config> g_create(const GUID& id, t_source const & data) {
+ pfc::assert_byte_type<typename t_source::t_item>();
+ return g_create(id, data.get_ptr(), data.get_size());
+ }
+
+ static service_ptr_t<ui_element_config> g_create_empty(const GUID & id = pfc::guid_null) {return g_create(id,NULL,0);}
+
+ static service_ptr_t<ui_element_config> g_create(const GUID & id, stream_reader * in, t_size bytes, abort_callback & abort);
+ static service_ptr_t<ui_element_config> g_create(stream_reader * in, t_size bytes, abort_callback & abort);
+ static service_ptr_t<ui_element_config> g_create(const void * data, t_size size);
+ service_ptr_t<ui_element_config> clone() const {
+ return g_create(get_guid(), get_data(), get_data_size());
+ }
+
+ FB2K_MAKE_SERVICE_INTERFACE(ui_element_config,service_base);
+};
+
+//! Helper.
+class ui_element_config_parser : public stream_reader_formatter<> {
+public:
+ ui_element_config_parser(ui_element_config::ptr in) : m_data(in), _m_stream(in->get_data(),in->get_data_size()), stream_reader_formatter(_m_stream,_m_abort) {}
+
+ void reset() {_m_stream.reset();}
+ t_size get_remaining() const {return _m_stream.get_remaining();}
+
+ ui_element_config::ptr subelement(t_size size);
+ ui_element_config::ptr subelement(const GUID & id, t_size dataSize);
+private:
+ const ui_element_config::ptr m_data;
+ abort_callback_dummy _m_abort;
+ stream_reader_memblock_ref _m_stream;
+};
+
+//! Helper.
+class ui_element_config_builder : public stream_writer_formatter<> {
+public:
+ ui_element_config_builder() : stream_writer_formatter(_m_stream,_m_abort) {}
+ ui_element_config::ptr finish(const GUID & id) {
+ return ui_element_config::g_create(id,_m_stream.m_buffer);
+ }
+ void reset() {
+ _m_stream.m_buffer.set_size(0);
+ }
+private:
+ abort_callback_dummy _m_abort;
+ stream_writer_buffer_simple _m_stream;
+};
+
+
+FB2K_STREAM_WRITER_OVERLOAD(ui_element_config::ptr) {
+ stream << value->get_guid();
+ t_size size = value->get_data_size();
+ stream << pfc::downcast_guarded<t_uint32>(size);
+ stream.write_raw(value->get_data(),size);
+ return stream;
+}
+FB2K_STREAM_READER_OVERLOAD(ui_element_config::ptr) {
+ GUID guid;
+ t_uint32 size;
+ stream >> guid >> size;
+ value = ui_element_config::g_create(guid,&stream.m_stream,size,stream.m_abort);
+ return stream;
+}
+
+
+
+
+typedef COLORREF t_ui_color;
+typedef HFONT t_ui_font;
+typedef HICON t_ui_icon;
+
+static const GUID ui_color_text = { 0x5dd38be7, 0xff8a, 0x416f, { 0x88, 0x2d, 0xa4, 0x8e, 0x31, 0x87, 0x85, 0xb2 } };
+static const GUID ui_color_background = { 0x16fc40c1, 0x1cba, 0x4385, { 0x93, 0x3b, 0xe9, 0x32, 0x7f, 0x6e, 0x35, 0x1f } };
+static const GUID ui_color_highlight = { 0xd2f98042, 0x3e6a, 0x423a, { 0xb8, 0x66, 0x65, 0x1, 0xfe, 0xa9, 0x75, 0x93 } };
+static const GUID ui_color_selection = { 0xebe1a36b, 0x7e0a, 0x469a, { 0x8e, 0xc5, 0xcf, 0x3, 0x12, 0x90, 0x40, 0xb5 } };
+
+static const GUID ui_font_default = { 0x9ef02cef, 0xe58a, 0x4f99, { 0x9f, 0xe3, 0x85, 0x39, 0xb, 0xed, 0xc5, 0xe0 } };
+static const GUID ui_font_tabs = { 0x65ffd7ac, 0x71ce, 0x495c, { 0xa5, 0x99, 0x48, 0x5b, 0xbf, 0x7a, 0x4, 0x7b } };
+static const GUID ui_font_lists = { 0xa86198b3, 0xb5d8, 0x40cf, { 0xac, 0x19, 0xf9, 0xda, 0xc, 0xb5, 0xd4, 0x24 } };
+static const GUID ui_font_playlists = { 0xd85b7b7e, 0xbf83, 0x41ed, { 0x88, 0xce, 0x1, 0x99, 0x31, 0x94, 0x3e, 0x2f } };
+static const GUID ui_font_statusbar = { 0xc7fd555b, 0xbd15, 0x4f74, { 0x93, 0xe, 0xba, 0x55, 0x52, 0x9d, 0xd9, 0x71 } };
+static const GUID ui_font_console = { 0xb08c619d, 0xd3d1, 0x4089, { 0x93, 0xb2, 0xd5, 0xb, 0x87, 0x2d, 0x1a, 0x25 } };
+
+
+
+
+//! @returns -1 when the GUID is unknown / unmappable, index that can be passed over to GetSysColor() otherwise.
+static int ui_color_to_sys_color_index(const GUID & p_guid) {
+ if (p_guid == ui_color_text) {
+ return COLOR_WINDOWTEXT;
+ } else if (p_guid == ui_color_background) {
+ return COLOR_WINDOW;
+ } else if (p_guid == ui_color_highlight) {
+ return COLOR_HOTLIGHT;
+ } else if (p_guid == ui_color_selection) {
+ return COLOR_HIGHLIGHT;
+ } else {
+ return -1;
+ }
+}
+
+
+struct ui_element_min_max_info {
+ ui_element_min_max_info() : m_min_width(0), m_max_width(~0), m_min_height(0), m_max_height(~0) {}
+ t_uint32 m_min_width, m_max_width, m_min_height, m_max_height;
+
+ const ui_element_min_max_info & operator|=(const ui_element_min_max_info & p_other) {
+ m_min_width = pfc::max_t(m_min_width,p_other.m_min_width);
+ m_min_height = pfc::max_t(m_min_height,p_other.m_min_height);
+ m_max_width = pfc::min_t(m_max_width,p_other.m_max_width);
+ m_max_height = pfc::min_t(m_max_height,p_other.m_max_height);
+ return *this;
+ }
+ ui_element_min_max_info operator|(const ui_element_min_max_info & p_other) const {
+ ui_element_min_max_info ret(*this);
+ ret |= p_other;
+ return ret;
+ }
+
+};
+
+//! Callback class passed by a UI element host to a UI element instance, allowing each UI element instance to communicate with its host. \n
+//! Each ui_element_instance_callback implementation must also implement ui_element_instance_callback_v2.
+class NOVTABLE ui_element_instance_callback : public service_base {
+ FB2K_MAKE_SERVICE_INTERFACE(ui_element_instance_callback,service_base);
+public:
+ virtual void on_min_max_info_change() = 0;
+ //! Deprecated, does nothing.
+ virtual void on_alt_pressed(bool p_state) = 0;
+ //! Returns true on success, false when the color is undefined and defaults such as global windows settings should be used.
+ virtual bool query_color(const GUID & p_what,t_ui_color & p_out) = 0;
+ //! Tells the host that specified element wants to activate itself as a result of some kind of external user command (eg. menu command). Host should ensure that requesting child element's window is visible.\n
+ //! @returns True when relevant child element window has been properly made visible and requesting code should proceed to SetFocus their window etc, false when denied.
+ virtual bool request_activation(service_ptr_t<class ui_element_instance> p_item) = 0;
+
+ //! Queries whether "edit mode" is enabled. Most of UI element editing functionality should be locked when it's not.
+ virtual bool is_edit_mode_enabled() = 0;
+
+ //! Tells the host that the user has requested the element to be replaced with another one.
+ //! Note: this is generally used only when "edit mode" is enabled, but legal to call when it's not (eg. dummy element calls it regardless of settings when clicked).
+ virtual void request_replace(service_ptr_t<class ui_element_instance> p_item) = 0;
+
+ //! Deprecated - use query_font_ex. Equivalent to query_font_ex(ui_font_default).
+ t_ui_font query_font() {return query_font_ex(ui_font_default);}
+
+ //! Retrieves an user-configurable font to use for specified kind of display. See ui_font_* constant for possible parameters.
+ virtual t_ui_font query_font_ex(const GUID & p_what) = 0;
+
+ //! Helper - a wrapper around query_color(), if the color is not user-overridden, returns relevant system color.
+ t_ui_color query_std_color(const GUID & p_what);
+
+ bool is_elem_visible_(service_ptr_t<class ui_element_instance> elem);
+
+ t_size notify_(ui_element_instance * source, const GUID & what, t_size param1, const void * param2, t_size param2size);
+ bool set_elem_label(ui_element_instance * source, const char * label);
+ t_uint32 get_dialog_texture(ui_element_instance * source);
+ bool is_border_needed(ui_element_instance * source);
+};
+
+
+class NOVTABLE ui_element_instance_callback_v2 : public ui_element_instance_callback {
+ FB2K_MAKE_SERVICE_INTERFACE(ui_element_instance_callback_v2, ui_element_instance_callback);
+public:
+ virtual bool is_elem_visible(service_ptr_t<class ui_element_instance> elem) = 0;
+};
+
+class NOVTABLE ui_element_instance_callback_v3 : public ui_element_instance_callback_v2 {
+ FB2K_MAKE_SERVICE_INTERFACE(ui_element_instance_callback_v3, ui_element_instance_callback_v2)
+public:
+ //! Returns zero when the notification was not handled, return value depends on the notification otherwise.
+ virtual t_size notify(ui_element_instance * source, const GUID & what, t_size param1, const void * param2, t_size param2size) = 0;
+};
+
+typedef service_ptr_t<ui_element_instance_callback> ui_element_instance_callback_ptr;
+
+//! ui_element_instance_callback implementation helper.
+template<typename t_receiver> class ui_element_instance_callback_impl : public ui_element_instance_callback_v3 {
+public:
+ ui_element_instance_callback_impl(t_receiver * p_receiver) : m_receiver(p_receiver) {}
+ void on_min_max_info_change() {
+ if (m_receiver != NULL) m_receiver->on_min_max_info_change();
+ }
+ void on_alt_pressed(bool p_state) {}
+
+ bool query_color(const GUID & p_what,t_ui_color & p_out) {
+ if (m_receiver != NULL) return m_receiver->query_color(p_what,p_out);
+ else return false;
+ }
+
+ bool request_activation(service_ptr_t<class ui_element_instance> p_item) {
+ if (m_receiver) return m_receiver->request_activation(p_item);
+ else return false;
+ }
+
+ bool is_edit_mode_enabled() {
+ if (m_receiver) return m_receiver->is_edit_mode_enabled();
+ else return false;
+ }
+ void request_replace(service_ptr_t<class ui_element_instance> p_item) {
+ if (m_receiver) m_receiver->request_replace(p_item);
+ }
+
+ t_ui_font query_font_ex(const GUID & p_what) {
+ if (m_receiver) return m_receiver->query_font_ex(p_what);
+ else return NULL;
+ }
+
+ void orphan() {m_receiver = NULL;}
+
+ bool is_elem_visible(service_ptr_t<class ui_element_instance> elem) {
+ if (m_receiver) return m_receiver->is_elem_visible(elem);
+ else return false;
+ }
+ t_size notify(ui_element_instance * source, const GUID & what, t_size param1, const void * param2, t_size param2size) {
+ if (m_receiver) return m_receiver->host_notify(source, what, param1, param2, param2size);
+ else return 0;
+ }
+private:
+ t_receiver * m_receiver;
+};
+
+//! ui_element_instance_callback implementation helper.
+class ui_element_instance_callback_receiver {
+public:
+ virtual void on_min_max_info_change() {}
+ virtual bool query_color(const GUID & p_what,t_ui_color & p_out) {return false;}
+ virtual bool request_activation(service_ptr_t<class ui_element_instance> p_item) {return false;}
+ virtual bool is_edit_mode_enabled() {return false;}
+ virtual void request_replace(service_ptr_t<class ui_element_instance> p_item) {}
+ virtual t_ui_font query_font_ex(const GUID&) {return NULL;}
+ virtual bool is_elem_visible(service_ptr_t<ui_element_instance> elem) {return true;}
+ virtual t_size host_notify(ui_element_instance * source, const GUID & what, t_size param1, const void * param2, t_size param2size) {return 0;}
+ ui_element_instance_callback_ptr ui_element_instance_callback_get_ptr() {
+ if (m_callback.is_empty()) m_callback = new service_impl_t<t_callback>(this);
+ return m_callback;
+ }
+ void ui_element_instance_callback_release() {
+ if (m_callback.is_valid()) {
+ m_callback->orphan();
+ m_callback.release();
+ }
+ }
+protected:
+ ~ui_element_instance_callback_receiver() {
+ ui_element_instance_callback_release();
+ }
+ ui_element_instance_callback_receiver() {}
+
+private:
+ typedef ui_element_instance_callback_receiver t_self;
+ typedef ui_element_instance_callback_impl<t_self> t_callback;
+ service_ptr_t<t_callback> m_callback;
+};
+
+//! Instance of a UI element.
+class NOVTABLE ui_element_instance : public service_base {
+public:
+ //! Returns ui_element_instance's window handle.\n
+ //! UI Element's window must be created when the ui_element_instance object is created. The window may or may not be destroyed by caller before the ui_element_instance itself is destroyed. If caller doesn't destroy the window before ui_element_instance destruction, ui_element_instance destructor should do it.
+ virtual HWND get_wnd() = 0;
+
+ //! Alters element's current configuration. Specified ui_element_config's GUID must be the same as this element's GUID.
+ virtual void set_configuration(ui_element_config::ptr data) = 0;
+ //! Retrieves element's current configuration. Returned object's GUID must be set to your element's GUID so your element can be re-instantiated with stored settings.
+ virtual ui_element_config::ptr get_configuration() = 0;
+
+ //! Returns GUID of the element. The return value must be the same as your ui_element::get_guid().
+ virtual GUID get_guid() = 0;
+ //! Returns subclass GUID of the element. The return value must be the same as your ui_element::get_guid().
+ virtual GUID get_subclass() = 0;
+
+ //! Returns element's focus priority.
+ virtual double get_focus_priority() {return 0;}
+ //! Elements that host other elements should pass the call to the child with the highest priority. Override for container elements.
+ virtual void set_default_focus() {set_default_focus_fallback();}
+
+ //! Overridden by containers only.
+ virtual bool get_focus_priority_subclass(double & p_out,const GUID & p_subclass) {
+ if (p_subclass == get_subclass()) {p_out = get_focus_priority(); return true;}
+ else {return false;}
+ }
+ //! Overridden by containers only.
+ virtual bool set_default_focus_subclass(const GUID & p_subclass) {
+ if (p_subclass == get_subclass()) {set_default_focus(); return true;}
+ else {return false;}
+ }
+
+ //! Retrieves element's minimum/maximum window size. Default implementation will fall back to WM_GETMINMAXINFO.
+ virtual ui_element_min_max_info get_min_max_info() {
+ ui_element_min_max_info ret;
+ MINMAXINFO temp = {};
+ temp.ptMaxTrackSize.x = 1024*1024;//arbitrary huge number
+ temp.ptMaxTrackSize.y = 1024*1024;
+ SendMessage(get_wnd(),WM_GETMINMAXINFO,0,(LPARAM)&temp);
+ if (temp.ptMinTrackSize.x >= 0) ret.m_min_width = temp.ptMinTrackSize.x;
+ if (temp.ptMaxTrackSize.x > 0) ret.m_max_width = temp.ptMaxTrackSize.x;
+ if (temp.ptMinTrackSize.y >= 0) ret.m_min_height = temp.ptMinTrackSize.y;
+ if (temp.ptMaxTrackSize.y > 0) ret.m_max_height = temp.ptMaxTrackSize.y;
+ return ret;
+ }
+
+ //! Used by host to notify the element about various events. See ui_element_notify_* GUIDs for possible p_what parameter; meaning of other parameters depends on p_what value. Container classes should dispatch all notifications to their children.
+ virtual void notify(const GUID & p_what, t_size p_param1, const void * p_param2, t_size p_param2size) {}
+
+ //! @param p_point Context menu point in screen coordinates. Always within out window's rect.
+ //! @return True to request edit_mode_context_menu_build() call to add our own items to the menu, false if we can't supply a context menu for this point.
+ virtual bool edit_mode_context_menu_test(const POINT & p_point,bool p_fromkeyboard) {return false;}
+ virtual void edit_mode_context_menu_build(const POINT & p_point,bool p_fromkeyboard,HMENU p_menu,unsigned p_id_base) {}
+ virtual void edit_mode_context_menu_command(const POINT & p_point,bool p_fromkeyboard,unsigned p_id,unsigned p_id_base) {}
+ //! @param p_point Receives the point to spawn context menu over when user has pressed the context menu key; in screen coordinates.
+ virtual bool edit_mode_context_menu_get_focus_point(POINT & p_point) {return false;}
+
+ virtual bool edit_mode_context_menu_get_description(unsigned p_id,unsigned p_id_base,pfc::string_base & p_out) {return false;}
+
+
+ //! Helper.
+ void set_default_focus_fallback() {
+ const HWND thisWnd = this->get_wnd();
+ if (thisWnd != NULL) ::SetFocus(thisWnd);
+ }
+
+ FB2K_MAKE_SERVICE_INTERFACE(ui_element_instance,service_base);
+};
+
+typedef service_ptr_t<ui_element_instance> ui_element_instance_ptr;
+
+
+//! Interface to enumerate and possibly alter children of a container element. Obtained from ui_element::enumerate_children().
+class NOVTABLE ui_element_children_enumerator : public service_base {
+public:
+ //! Retrieves the container's children count.
+ virtual t_size get_count() = 0;
+ //! Retrieves the configuration of the child at specified index, 0 <= index < get_count().
+ virtual ui_element_config::ptr get_item(t_size p_index) = 0;
+
+ //! Returns whether children count can be altered. For certain containers, children count is fixed and this method returns false.
+ virtual bool can_set_count() = 0;
+ //! Alters container's children count (behavior is undefined when can_set_count() returns false). Newly allocated children get default empty element configuration.
+ virtual void set_count(t_size count) = 0;
+ //! Alters the selected item.
+ virtual void set_item(t_size p_index,ui_element_config::ptr cfg) = 0;
+ //! Creates a new ui_element_config for this container, with our changes (set_count(), set_item()) applied.
+ virtual ui_element_config::ptr commit() = 0;
+
+ FB2K_MAKE_SERVICE_INTERFACE(ui_element_children_enumerator,service_base);
+};
+
+
+typedef service_ptr_t<ui_element_children_enumerator> ui_element_children_enumerator_ptr;
+
+
+//! Entrypoint interface for each UI element implementation.
+class NOVTABLE ui_element : public service_base {
+public:
+ //! Retrieves GUID of the element.
+ virtual GUID get_guid() = 0;
+
+ //! Retrieves subclass GUID of the element. Typically one of ui_element_subclass_* values, but you can create your own custom subclasses. Subclass GUIDs are used for various purposes such as focusing an UI element that provides specific functionality.
+ virtual GUID get_subclass() = 0;
+
+ //! Retrieves a simple human-readable name of the element.
+ virtual void get_name(pfc::string_base & p_out) = 0;
+
+ //! Instantiates the element using specified settings.
+ virtual ui_element_instance_ptr instantiate(HWND p_parent,ui_element_config::ptr cfg,ui_element_instance_callback_ptr p_callback) = 0;
+
+ //! Retrieves default configuration of the element.
+ virtual ui_element_config::ptr get_default_configuration() = 0;
+
+ //! Implemented by container elements only. Returns NULL for non-container elements. \n
+ //! Allows caller to parse and edit child element structure of container elements.
+ virtual ui_element_children_enumerator_ptr enumerate_children(ui_element_config::ptr cfg) = 0;
+
+
+ //! In certain cases, an UI element can import settings of another UI element (eg. vertical<=>horizontal splitter, tabs<=>splitters) when user directly replaces one of such elements with another. Overriding this function allows special handling of such cases. \n
+ //! Implementation hint: when implementing a multi-child container, you probably want to takeover child elements replacing another container element; use enumerate_children() on the element the configuration belongs to to grab those.
+ //! @returns A new ui_element_config on success, a null pointer when the input data could not be parsed / is in an unknown format.
+ virtual ui_element_config::ptr import(ui_element_config::ptr cfg) {return NULL;}
+
+ //! Override this to return false when your element is for internal use only and should not be user-addable.
+ virtual bool is_user_addable() {return true;}
+
+ //! Returns an icon to show in available UI element lists, etc. Returns NULL when there is no icon to display.
+ virtual t_ui_icon get_icon() {return NULL;}
+
+ //! Retrieves a human-readable description of the element.
+ virtual bool get_description(pfc::string_base & p_out) {return false;}
+
+ //! Retrieves a human-readable description of the element's function to use for grouping in the element list. The default implementation relies on get_subclass() return value.
+ virtual bool get_element_group(pfc::string_base & p_out);
+
+ static bool g_find(service_ptr_t<ui_element> & out, const GUID & id);
+ static bool g_get_name(pfc::string_base & p_out,const GUID & p_guid);
+
+ FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(ui_element);
+};
+
+//! Extended interface for a UI element implementation.
+class NOVTABLE ui_element_v2 : public ui_element {
+public:
+ enum {
+ //! Indicates that bump() method is supported.
+ KFlagSupportsBump = 1 << 0,
+ //! Tells UI backend to auto-generate a menu command activating your element - bumping an existing instance if possible, spawning a popup otherwise.
+ //! Currently menu commands are generated for ui_element_subclass_playback_visualisation, ui_element_subclass_media_library_viewers and ui_element_subclass_utility subclasses, in relevant menus.
+ KFlagHavePopupCommand = 1 << 1,
+ //! Tells backend that your element supports fullscreen mode (typically set only for visualisations).
+ KFlagHaveFullscreen = 1 << 2,
+
+ KFlagPopupCommandHidden = 1 << 3,
+
+ KFlagsVisualisation = KFlagHavePopupCommand | KFlagHaveFullscreen,
+ };
+ virtual t_uint32 get_flags() = 0;
+ //! Called only when get_flags() return value has KFlagSupportsBump bit set.
+ //! Returns true when an existing instance of this element has been "bumped" - brought to user's attention in some way, false when there's no instance to bump or none of existing instances could be bumped for whatever reason.
+ virtual bool bump() = 0;
+
+ //! Override to use another GUID for our menu command. Relevant only when KFlagHavePopupCommand is set.
+ virtual GUID get_menu_command_id() {return get_guid();}
+
+ //! Override to use another description for our menu command. Relevant only when KFlagHavePopupCommand is set.
+ virtual bool get_menu_command_description(pfc::string_base & out) {
+ pfc::string8 name; get_name(name);
+ out = pfc::string_formatter() << "Activates " << name << " window.";
+ return true;
+ }
+
+ //! Override to use another name for our menu command. Relevant only when KFlagHavePopupCommand is set.
+ virtual void get_menu_command_name(pfc::string_base & out) {get_name(out);}
+ //! Relevant only when KFlagHavePopupCommand is set.
+ //! @param defSize Default window size @ 96DPI. If screen DPI is different, it will be rescaled appropriately.
+ //! @param title Window title to use.
+ //! @returns True when implemented, false when not - caller will automatically determine default size and window title then.
+ virtual bool get_popup_specs(SIZE & defSize, pfc::string_base & title) {return false;}
+
+
+ FB2K_MAKE_SERVICE_INTERFACE(ui_element_v2, ui_element)
+};
+
+class NOVTABLE ui_element_popup_host_callback : public service_base {
+public:
+ virtual void on_resize(t_uint32 width, t_uint32 height) = 0;
+ virtual void on_close() = 0;
+ virtual void on_destroy() = 0;
+
+ FB2K_MAKE_SERVICE_INTERFACE(ui_element_popup_host_callback,service_base);
+};
+
+class NOVTABLE ui_element_popup_host : public service_base {
+ FB2K_MAKE_SERVICE_INTERFACE(ui_element_popup_host,service_base);
+public:
+ virtual ui_element_instance::ptr get_root_elem() = 0;
+ virtual HWND get_wnd() = 0;
+ virtual ui_element_config::ptr get_config() = 0;
+ virtual void set_config(ui_element_config::ptr cfg) = 0;
+ //! Sets edit mode on/off. Default: off.
+ virtual void set_edit_mode(bool state) = 0;
+};
+
+class NOVTABLE ui_element_popup_host_v2 : public ui_element_popup_host {
+ FB2K_MAKE_SERVICE_INTERFACE(ui_element_popup_host_v2, ui_element_popup_host);
+public:
+ virtual void set_window_title(const char * title) = 0;
+ virtual void allow_element_specified_title(bool allow) = 0;
+};
+
+//! For use with static_api_ptr_t<>
+class NOVTABLE ui_element_common_methods : public service_base {
+public:
+ virtual void copy(ui_element_config::ptr cfg) = 0;
+ virtual void cut(ui_element_instance_ptr & p_instance,HWND p_parent,ui_element_instance_callback_ptr p_callback) = 0;
+ virtual bool paste(ui_element_instance_ptr & p_instance,HWND p_parent,ui_element_instance_callback_ptr p_callback) = 0;
+ virtual bool is_paste_available() = 0;
+ virtual bool paste(ui_element_config::ptr & out) = 0;
+
+ virtual bool parse_dataobject_check(pfc::com_ptr_t<IDataObject> in, DWORD & dropEffect) = 0;
+ virtual bool parse_dataobject(pfc::com_ptr_t<IDataObject> in,ui_element_config::ptr & out, DWORD & dropEffect) = 0;
+
+ virtual pfc::com_ptr_t<IDataObject> create_dataobject(ui_element_config::ptr in) = 0;
+
+ virtual HWND spawn_scratchbox(HWND parent,ui_element_config::ptr cfg) = 0;
+
+ virtual ui_element_popup_host::ptr spawn_host(HWND parent, ui_element_config::ptr cfg, ui_element_popup_host_callback::ptr callback, ui_element::ptr elem = NULL, DWORD style = WS_POPUPWINDOW|WS_CAPTION|WS_THICKFRAME, DWORD styleEx = WS_EX_CONTROLPARENT) = 0;
+
+ void copy(ui_element_instance_ptr p_instance) {copy(p_instance->get_configuration());}
+
+ FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(ui_element_common_methods);
+};
+
+//! For use with static_api_ptr_t<>
+class NOVTABLE ui_element_common_methods_v2 : public ui_element_common_methods {
+public:
+ virtual void spawn_host_simple(HWND parent, ui_element::ptr elem, bool fullScreenMode) = 0;
+
+ void spawn_host_simple(HWND parent, const GUID & elem, bool fullScreenMode) {
+ spawn_host_simple(parent, service_by_guid<ui_element>(elem), fullScreenMode);
+ }
+
+ virtual void toggle_fullscreen(ui_element::ptr elem, HWND parent) = 0;
+
+ void toggle_fullscreen(const GUID & elem, HWND parent) {
+ toggle_fullscreen(service_by_guid<ui_element>(elem), parent);
+ }
+
+ FB2K_MAKE_SERVICE_INTERFACE(ui_element_common_methods_v2, ui_element_common_methods);
+};
+
+class NOVTABLE ui_element_typable_window_manager : public service_base {
+public:
+ virtual void add(HWND wnd) = 0;
+ virtual void remove(HWND wnd) = 0;
+ virtual bool is_registered(HWND wnd) = 0;
+
+ FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(ui_element_typable_window_manager)
+};
+
+FOOGUIDDECL const GUID ui_element_instance::class_guid = { 0xb55d4525, 0xddc8, 0x40d7, { 0xb9, 0x19, 0x6d, 0x7c, 0x48, 0x38, 0xf2, 0xdb } };
+FOOGUIDDECL const GUID ui_element::class_guid = { 0xb52c703, 0x1586, 0x42f7, { 0xa8, 0x4c, 0x70, 0x54, 0xcd, 0xc8, 0x22, 0x55 } };
+FOOGUIDDECL const GUID ui_element_v2::class_guid = { 0x2e1fe21e, 0x8e0f, 0x43be, { 0x9f, 0xdb, 0xd5, 0xdd, 0xf4, 0xc9, 0xba, 0xba } };
+FOOGUIDDECL const GUID ui_element_instance_callback::class_guid = { 0xcd3647c6, 0x12d9, 0x4122, { 0xa5, 0x28, 0x4a, 0xba, 0x34, 0x90, 0x89, 0x5c } };
+FOOGUIDDECL const GUID ui_element_instance_callback_v2::class_guid = { 0x5b11faa3, 0x48ee, 0x41a1, { 0xb7, 0xf9, 0x16, 0x7a, 0xba, 0x6c, 0x60, 0x41 } };
+FOOGUIDDECL const GUID ui_element_children_enumerator::class_guid = { 0x6c7a3a46, 0xdc54, 0x4499, { 0x98, 0x66, 0xae, 0x3, 0x55, 0xe, 0xf3, 0x1c } };
+FOOGUIDDECL const GUID ui_element_common_methods::class_guid = { 0xedee8cd9, 0x3072, 0x410e, { 0xb2, 0x66, 0x37, 0x5d, 0x9f, 0x6f, 0xb0, 0x36 } };
+FOOGUIDDECL const GUID ui_element_common_methods_v2::class_guid = { 0x2dc90e34, 0x38fc, 0x4ad1, { 0x92, 0x80, 0xff, 0x1f, 0xac, 0x14, 0x52, 0xd0 } };
+FOOGUIDDECL const GUID ui_element_popup_host::class_guid = { 0xfcc381e9, 0xe527, 0x4887, { 0xae, 0x63, 0x27, 0xc0, 0x3f, 0x4, 0xd, 0x1 } };
+FOOGUIDDECL const GUID ui_element_popup_host_callback::class_guid = { 0x2993a043, 0x2e70, 0x4d8f, { 0x81, 0xb, 0x41, 0x3, 0x37, 0x73, 0x97, 0xcd } };
+FOOGUIDDECL const GUID ui_element_config::class_guid = { 0xd34bba46, 0x1bad, 0x4547, { 0xba, 0xb4, 0x17, 0xe2, 0x44, 0xd5, 0xeb, 0x94 } };
+FOOGUIDDECL const GUID ui_element_typable_window_manager::class_guid = { 0xbaa99ee2, 0xf770, 0x4981, { 0x9e, 0x50, 0xf3, 0x4c, 0x5c, 0x6d, 0x98, 0x81 } };
+FOOGUIDDECL const GUID ui_element_instance_callback_v3::class_guid = { 0x6d15c0c6, 0x90b6, 0x4c7e, { 0xbf, 0x39, 0xe9, 0x39, 0xf2, 0xdf, 0x9b, 0x91 } };
+FOOGUIDDECL const GUID ui_element_popup_host_v2::class_guid = { 0x8caac11e, 0x52b6, 0x47f7, { 0x97, 0xc9, 0x2c, 0x87, 0xdb, 0xdb, 0x2e, 0x5b } };
+
+
+//! Dispatched through ui_element_instance::notify() when host changes color settings. Other parameters are not used and should be set to zero.
+static const GUID ui_element_notify_colors_changed = { 0xeedda994, 0xe3d2, 0x441a, { 0xbe, 0x47, 0xa1, 0x63, 0x5b, 0x71, 0xab, 0x60 } };
+static const GUID ui_element_notify_font_changed = { 0x7a6964a8, 0xc797, 0x4737, { 0x90, 0x55, 0x7d, 0x84, 0xe7, 0x3d, 0x63, 0x6e } };
+static const GUID ui_element_notify_edit_mode_changed = { 0xf72f00af, 0xec76, 0x4251, { 0xb2, 0x67, 0x89, 0x4c, 0x52, 0x5f, 0x18, 0xc6 } };
+
+//! Sent when a portion of the GUI is shown/hidden. First parameter is a bool flag indicating whether your UI Element is now visible.
+static const GUID ui_element_notify_visibility_changed = { 0x313c22b9, 0x287a, 0x4804, { 0x8e, 0x6c, 0xff, 0xef, 0x4, 0x10, 0xcd, 0xea } };
+
+//! Sent to retrieve areas occupied by elements to show overlay labels. Param1 is ignored, param2 is a pointer to ui_element_notify_get_element_labels_callback, param2size is ignored.
+static const GUID ui_element_notify_get_element_labels = { 0x4850a2cb, 0x6cfc, 0x4d74, { 0x9a, 0x6d, 0xc, 0x7b, 0x29, 0x16, 0x5e, 0x69 } };
+
+
+//! Set to ui_element_instance_callback_v3 to set our element's label. Param1 is ignored, param2 is a pointer to a UTF-8 string containing the new label. Return value is 1 if the label is user-visible, 0 if the host does not support displaying overridden labels.
+static const GUID ui_element_host_notify_set_elem_label = { 0x24598cb7, 0x9c5c, 0x488e, { 0xba, 0xff, 0xd, 0x2f, 0x11, 0x93, 0xe4, 0xf2 } };
+static const GUID ui_element_host_notify_get_dialog_texture = { 0xbb98eb99, 0x7b07, 0x42f3, { 0x8c, 0xd1, 0x12, 0xa2, 0xc2, 0x23, 0xb5, 0xbc } };
+static const GUID ui_element_host_notify_is_border_needed = { 0x2974f554, 0x2f31, 0x49c5, { 0xab, 0x4, 0x76, 0x4a, 0xf7, 0x94, 0x7c, 0x4f } };
+
+
+
+class ui_element_notify_get_element_labels_callback {
+public:
+ virtual void set_area_label(const RECT & rc, const char * name) = 0;
+ virtual void set_visible_element(ui_element_instance::ptr item) = 0;
+protected:
+ ui_element_notify_get_element_labels_callback() {}
+ ~ui_element_notify_get_element_labels_callback() {}
+
+ PFC_CLASS_NOT_COPYABLE_EX(ui_element_notify_get_element_labels_callback);
+};
+
+
+static const GUID ui_element_subclass_playlist_renderers = { 0x3c4c68a0, 0xfc5, 0x400a, { 0xa3, 0x4a, 0x2e, 0x3a, 0xae, 0x6e, 0x90, 0x76 } };
+static const GUID ui_element_subclass_media_library_viewers = { 0x58455355, 0x289d, 0x459c, { 0x8f, 0x8a, 0xe1, 0x49, 0x6, 0xfc, 0x14, 0x56 } };
+static const GUID ui_element_subclass_containers = { 0x72dc5954, 0x1f26, 0x41be, { 0xae, 0xf2, 0x92, 0x9d, 0x25, 0xb5, 0x8d, 0xcf } };
+static const GUID ui_element_subclass_selection_information = { 0x68084e43, 0x7359, 0x46a5, { 0xb6, 0x84, 0x3c, 0xd7, 0x57, 0xf6, 0xde, 0xfd } };
+static const GUID ui_element_subclass_playback_visualisation = { 0x1f3c62f2, 0x8bb5, 0x4700, { 0x9e, 0x82, 0x8c, 0x48, 0x22, 0xf0, 0x18, 0x35 } };
+static const GUID ui_element_subclass_playback_information = { 0x84859f2d, 0xbb9c, 0x4e70, { 0x9d, 0x4, 0x14, 0x71, 0xb5, 0x63, 0x1f, 0x7f } };
+static const GUID ui_element_subclass_utility = { 0xffa4f4fc, 0xc169, 0x4766, { 0x9c, 0x94, 0xfa, 0xef, 0xae, 0xb2, 0x7e, 0xf } };
+
+bool ui_element_subclass_description(const GUID & id, pfc::string_base & out);
+
+
+#define ReplaceUIElementCommand "Replace UI Element..."
+#define ReplaceUIElementDescription "Replaces this UI Element with another one."
+
+#define CopyUIElementCommand "Copy UI Element"
+#define CopyUIElementDescription "Copies this UI Element to Windows Clipboard."
+
+#define PasteUIElementCommand "Paste UI Element"
+#define PasteUIElementDescription "Replaces this UI Element with Windows Clipboard content."
+
+#define CutUIElementCommand "Cut UI Element"
+#define CutUIElementDescription "Copies this UI Element to Windows Clipboard and replaces it with an empty UI Element."
+
+#define AddNewUIElementCommand "Add New UI Element..."
+#define AddNewUIElementDescription "Replaces the selected empty space with a new UI Element."
+
+
+
+
+template<typename TImpl, typename TInterface = ui_element> class ui_element_impl : public TInterface {
+public:
+ GUID get_guid() { return TImpl::g_get_guid();}
+ GUID get_subclass() { return TImpl::g_get_subclass();}
+ void get_name(pfc::string_base & out) { TImpl::g_get_name(out); }
+ ui_element_instance::ptr instantiate(HWND parent,ui_element_config::ptr cfg,ui_element_instance_callback::ptr callback) {
+ PFC_ASSERT( cfg->get_guid() == get_guid() );
+ service_nnptr_t<ui_element_instance_impl_helper> item = new window_service_impl_t<ui_element_instance_impl_helper>(cfg,callback);
+ item->initialize_window(parent);
+ return item;
+ }
+ ui_element_config::ptr get_default_configuration() { return TImpl::g_get_default_configuration(); }
+ ui_element_children_enumerator_ptr enumerate_children(ui_element_config::ptr cfg) {return NULL;}
+ bool get_description(pfc::string_base & out) {out = TImpl::g_get_description(); return true;}
+private:
+ class ui_element_instance_impl_helper : public TImpl {
+ public:
+ ui_element_instance_impl_helper(ui_element_config::ptr cfg, ui_element_instance_callback::ptr callback) : TImpl(cfg,callback) {}
+
+ GUID get_guid() {return TImpl::g_get_guid();}
+ GUID get_subclass() {return TImpl::g_get_subclass();}
+ HWND get_wnd() {return *this;}
+ };
+public:
+ typedef ui_element_instance_impl_helper TInstance;
+ static TInstance const & instanceGlobals() {return *reinterpret_cast<const TInstance*>(NULL);}
+};
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/unpack.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/unpack.h new file mode 100644 index 0000000000..7e2be58cb8 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/unpack.h @@ -0,0 +1,22 @@ +//! Service providing "unpacker" functionality - processes "packed" file (such as a zip file containing a single media file inside) to allow its contents to be accessed transparently.\n
+//! To access existing unpacker implementations, use unpacker::g_open helper function.\n
+//! To register your own implementation, use unpacker_factory_t template.
+class NOVTABLE unpacker : public service_base {
+public:
+ //! Attempts to open specified file for unpacking, creates interface to virtual file with uncompressed data on success. When examined file doesn't appear to be one of formats supported by this unpacker implementation, throws exception_io_data.
+ //! @param p_out Receives interface to virtual file with uncompressed data on success.
+ //! @param p_source Source file to process.
+ //! @param p_abort abort_callback object signaling user aborting the operation.
+ virtual void open(service_ptr_t<file> & p_out,const service_ptr_t<file> & p_source,abort_callback & p_abort) = 0;
+
+ //! Static helper querying existing unpacker implementations until one that successfully opens specified file is found. Attempts to open specified file for unpacking, creates interface to virtual file with uncompressed data on success. When examined file doesn't appear to be one of formats supported by registered unpacker implementations, throws exception_io_data.
+ //! @param p_out Receives interface to virtual file with uncompressed data on success.
+ //! @param p_source Source file to process.
+ //! @param p_abort abort_callback object signaling user aborting the operation.
+ static void g_open(service_ptr_t<file> & p_out,const service_ptr_t<file> & p_source,abort_callback & p_abort);
+
+ FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(unpacker);
+};
+
+template<typename t_myclass>
+class unpacker_factory_t : public service_factory_single_t<t_myclass> {};
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/vis.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/vis.h new file mode 100644 index 0000000000..8033113861 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/SDK/vis.h @@ -0,0 +1,78 @@ +//! This class provides abstraction for retrieving visualisation data. Instances of visualisation_stream being created/released serve as an indication for visualisation backend to process currently played audio data or shut down when there are no visualisation clients active.\n
+//! Use visualisation_manager::create_stream to instantiate.
+class NOVTABLE visualisation_stream : public service_base {
+public:
+ //! Retrieves absolute playback time since last playback start or seek. You typically pass value retrieved by this function - optionally with offset added - to other visualisation_stream methods.
+ virtual bool get_absolute_time(double & p_value) = 0;
+
+ //! Retrieves an audio chunk starting at specified offset (see get_absolute_time()), of specified length.
+ //! @returns False when requested timestamp is out of available range, true on success.
+ virtual bool get_chunk_absolute(audio_chunk & p_chunk,double p_offset,double p_requested_length) = 0;
+ //! Retrieves spectrum for audio data at specified offset (see get_absolute_time()), with specified FFT size.
+ //! @param p_chunk Receives spectrum data. audio_chunk type is used for consistency (since required functionality is identical to provided by audio_chunk), the data is *not* PCM. Returned sample count is equal to half of FFT size; channels and sample rate are as in audio stream the spectrum was generated from.
+ //! @param p_offset Timestamp of spectrum to retrieve. See get_absolute_time().
+ //! @param p_fft_size FFT size to use for spectrum generation. Must be a power of 2.
+ //! @returns False when requested timestamp is out of available range, true on success.
+ virtual bool get_spectrum_absolute(audio_chunk & p_chunk,double p_offset,unsigned p_fft_size) = 0;
+
+ //! Generates fake audio chunk to display when get_chunk_absolute() fails - e.g. shortly after visualisation_stream creation data for currently played audio might not be available yet.
+ //! Throws std::exception derivatives on failure.
+ virtual void make_fake_chunk_absolute(audio_chunk & p_chunk,double p_offset,double p_requested_length) = 0;
+ //! Generates fake spectrum to display when get_spectrum_absolute() fails - e.g. shortly after visualisation_stream creation data for currently played audio might not be available yet.
+ //! Throws std::exception derivatives on failure.
+ virtual void make_fake_spectrum_absolute(audio_chunk & p_chunk,double p_offset,unsigned p_fft_size) = 0;
+
+ FB2K_MAKE_SERVICE_INTERFACE(visualisation_stream,service_base);
+};
+
+//! New in 0.9.5.
+class NOVTABLE visualisation_stream_v2 : public visualisation_stream {
+public:
+ virtual void request_backlog(double p_time) = 0;
+ virtual void set_channel_mode(t_uint32 p_mode) = 0;
+
+ enum {
+ channel_mode_default = 0,
+ channel_mode_mono,
+ channel_mode_frontonly,
+ channel_mode_backonly,
+ };
+
+ FB2K_MAKE_SERVICE_INTERFACE(visualisation_stream_v2,visualisation_stream);
+};
+
+//! New in 0.9.5.2.
+class NOVTABLE visualisation_stream_v3 : public visualisation_stream_v2 {
+public:
+ virtual void chunk_to_spectrum(audio_chunk const & chunk, audio_chunk & spectrum, double centerOffset) = 0;
+
+ FB2K_MAKE_SERVICE_INTERFACE(visualisation_stream_v3,visualisation_stream_v2);
+};
+
+//! Entrypoint service for visualisation processing; use this to create visualisation_stream objects that can be used to retrieve properties of currently played audio. \n
+//! Implemented by core; do not reimplement.\n
+//! Use static_api_ptr_t to access it, e.g. static_api_ptr_t<visualisation_manager>()->create_stream(mystream,0);
+class NOVTABLE visualisation_manager : public service_base {
+public:
+ //! Creates a visualisation_stream object. See visualisation_stream for more info.
+ //! @param p_out Receives newly created visualisation_stream instance.
+ //! @param p_flags Combination of one or more KStreamFlag* values. Currently only KStreamFlagNewFFT is defined.
+ //! It's recommended that you set p_flags to KStreamFlagNewFFT to get the new FFT behavior (better quality and result normalization), the old behavior for null flags is preserved for compatibility with old components that rely on it.
+ virtual void create_stream(service_ptr_t<visualisation_stream> & p_out,unsigned p_flags) = 0;
+
+ enum {
+ //! New FFT behavior for spectrum-generating methods, available in 0.9.5.2 and newer: output normalized to 0..1, Gauss window used instead of rectangluar (better quality / less aliasing).
+ //! It's recommended to always set this flag. The old behavior is preserved for backwards compatibility.
+ KStreamFlagNewFFT = 1 << 0,
+ };
+
+
+ //! Wrapper around non-template create_stream(); retrieves one of newer visualisation_stream_* interfaces rather than base visualisation_stream interface. Throws exception_service_extension_not_found() when running too old foobar2000 version for the requested interface.
+ template<typename t_streamptr>
+ void create_stream(t_streamptr & out, unsigned flags) {
+ visualisation_stream::ptr temp; create_stream(temp, flags);
+ if (!temp->service_query_t(out)) throw exception_service_extension_not_found();
+ }
+
+ FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(visualisation_manager);
+};
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/foobar2000_component_client/component_client.cpp b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/foobar2000_component_client/component_client.cpp new file mode 100644 index 0000000000..0d688bb282 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/foobar2000_component_client/component_client.cpp @@ -0,0 +1,123 @@ +#include "../SDK/foobar2000.h"
+#include "../SDK/component.h"
+
+static HINSTANCE g_hIns;
+
+static pfc::string_simple g_name,g_full_path;
+
+static bool g_services_available = false, g_initialized = false;
+
+
+
+namespace core_api
+{
+
+ HINSTANCE get_my_instance()
+ {
+ return g_hIns;
+ }
+
+ HWND get_main_window()
+ {
+ PFC_ASSERT( g_foobar2000_api != NULL );
+ return g_foobar2000_api->get_main_window();
+ }
+ const char* get_my_file_name()
+ {
+ return g_name;
+ }
+
+ const char* get_my_full_path()
+ {
+ return g_full_path;
+ }
+
+ bool are_services_available()
+ {
+ return g_services_available;
+ }
+ bool assert_main_thread()
+ {
+ return (g_services_available && g_foobar2000_api) ? g_foobar2000_api->assert_main_thread() : true;
+ }
+
+ void ensure_main_thread() {
+ if (!is_main_thread()) uBugCheck();
+ }
+
+ bool is_main_thread()
+ {
+ return (g_services_available && g_foobar2000_api) ? g_foobar2000_api->is_main_thread() : true;
+ }
+ const char* get_profile_path()
+ {
+ PFC_ASSERT( g_foobar2000_api != NULL );
+ return g_foobar2000_api->get_profile_path();
+ }
+
+ bool is_shutting_down()
+ {
+ return (g_services_available && g_foobar2000_api) ? g_foobar2000_api->is_shutting_down() : g_initialized;
+ }
+ bool is_initializing()
+ {
+ return (g_services_available && g_foobar2000_api) ? g_foobar2000_api->is_initializing() : !g_initialized;
+ }
+ bool is_portable_mode_enabled() {
+ PFC_ASSERT( g_foobar2000_api != NULL );
+ return g_foobar2000_api->is_portable_mode_enabled();
+ }
+
+ bool is_quiet_mode_enabled() {
+ PFC_ASSERT( g_foobar2000_api != NULL );
+ return g_foobar2000_api->is_quiet_mode_enabled();
+ }
+}
+
+namespace {
+ class foobar2000_client_impl : public foobar2000_client, private foobar2000_component_globals
+ {
+ public:
+ t_uint32 get_version() {return FOOBAR2000_CLIENT_VERSION;}
+ pservice_factory_base get_service_list() {return service_factory_base::__internal__list;}
+
+ void get_config(stream_writer * p_stream,abort_callback & p_abort) {
+ cfg_var::config_write_file(p_stream,p_abort);
+ }
+
+ void set_config(stream_reader * p_stream,abort_callback & p_abort) {
+ cfg_var::config_read_file(p_stream,p_abort);
+ }
+
+ void set_library_path(const char * path,const char * name) {
+ g_full_path = path;
+ g_name = name;
+ }
+
+ void services_init(bool val) {
+ if (val) g_initialized = true;
+ g_services_available = val;
+ }
+
+ bool is_debug() {
+#ifdef _DEBUG
+ return true;
+#else
+ return false;
+#endif
+ }
+ };
+}
+
+static foobar2000_client_impl g_client;
+
+extern "C"
+{
+ __declspec(dllexport) foobar2000_client * _cdecl foobar2000_get_interface(foobar2000_api * p_api,HINSTANCE hIns)
+ {
+ g_hIns = hIns;
+ g_foobar2000_api = p_api;
+
+ return &g_client;
+ }
+}
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/foobar2000_component_client/foobar2000_component_client_10.vcxproj b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/foobar2000_component_client/foobar2000_component_client_10.vcxproj new file mode 100644 index 0000000000..215b3bd623 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/foobar2000_component_client/foobar2000_component_client_10.vcxproj @@ -0,0 +1,97 @@ +<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{71AD2674-065B-48F5-B8B0-E1F9D3892081}</ProjectGuid>
+ <RootNamespace>foobar2000_component_client</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <UseOfMfc>false</UseOfMfc>
+ <CharacterSet>Unicode</CharacterSet>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <UseOfMfc>false</UseOfMfc>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup>
+ <_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\Obj\$(ProjectName)\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\Obj\$(ProjectName)\</IntDir>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\Obj\$(ProjectName)\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\Obj\$(ProjectName)\</IntDir>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <Culture>0x0409</Culture>
+ </ResourceCompile>
+ <Lib>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ </Lib>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <Optimization>MinSpace</Optimization>
+ <PreprocessorDefinitions>NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <StringPooling>true</StringPooling>
+ <BufferSecurityCheck>false</BufferSecurityCheck>
+ <FloatingPointModel>Fast</FloatingPointModel>
+ <RuntimeTypeInfo>false</RuntimeTypeInfo>
+ <WarningLevel>Level3</WarningLevel>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <Culture>0x0409</Culture>
+ </ResourceCompile>
+ <Lib>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ </Lib>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClCompile Include="component_client.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
+ </ClCompile>
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
\ No newline at end of file diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/foobar2000_component_client/foobar2000_component_client_12.vcxproj b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/foobar2000_component_client/foobar2000_component_client_12.vcxproj new file mode 100644 index 0000000000..ac813e6308 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/foobar2000_component_client/foobar2000_component_client_12.vcxproj @@ -0,0 +1,97 @@ +<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{71AD2674-065B-48F5-B8B0-E1F9D3892081}</ProjectGuid>
+ <RootNamespace>foobar2000_component_client</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <UseOfMfc>false</UseOfMfc>
+ <CharacterSet>Unicode</CharacterSet>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <UseOfMfc>false</UseOfMfc>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup>
+ <_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\Obj\$(ProjectName)\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\Obj\$(ProjectName)\</IntDir>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\Obj\$(ProjectName)\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\Obj\$(ProjectName)\</IntDir>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <Culture>0x0409</Culture>
+ </ResourceCompile>
+ <Lib>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ </Lib>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <Optimization>MinSpace</Optimization>
+ <PreprocessorDefinitions>NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <StringPooling>true</StringPooling>
+ <BufferSecurityCheck>false</BufferSecurityCheck>
+ <FloatingPointModel>Fast</FloatingPointModel>
+ <RuntimeTypeInfo>false</RuntimeTypeInfo>
+ <WarningLevel>Level3</WarningLevel>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <Culture>0x0409</Culture>
+ </ResourceCompile>
+ <Lib>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ </Lib>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClCompile Include="component_client.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
+ </ClCompile>
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
\ No newline at end of file diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/foobar2000_component_client/foobar2000_component_client_14.vcxproj b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/foobar2000_component_client/foobar2000_component_client_14.vcxproj new file mode 100644 index 0000000000..7209e180d2 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/foobar2000_component_client/foobar2000_component_client_14.vcxproj @@ -0,0 +1,97 @@ +<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{71AD2674-065B-48F5-B8B0-E1F9D3892081}</ProjectGuid>
+ <RootNamespace>foobar2000_component_client</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <UseOfMfc>false</UseOfMfc>
+ <CharacterSet>Unicode</CharacterSet>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <UseOfMfc>false</UseOfMfc>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup>
+ <_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\Obj\$(ProjectName)\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\Obj\$(ProjectName)\</IntDir>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\Obj\$(ProjectName)\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\Obj\$(ProjectName)\</IntDir>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <Culture>0x0409</Culture>
+ </ResourceCompile>
+ <Lib>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ </Lib>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <Optimization>MinSpace</Optimization>
+ <PreprocessorDefinitions>NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <StringPooling>true</StringPooling>
+ <BufferSecurityCheck>false</BufferSecurityCheck>
+ <FloatingPointModel>Fast</FloatingPointModel>
+ <RuntimeTypeInfo>false</RuntimeTypeInfo>
+ <WarningLevel>Level3</WarningLevel>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <Culture>0x0409</Culture>
+ </ResourceCompile>
+ <Lib>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ </Lib>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClCompile Include="component_client.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
+ </ClCompile>
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
\ No newline at end of file diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/COM_utils.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/COM_utils.h new file mode 100644 index 0000000000..72fb8fcccc --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/COM_utils.h @@ -0,0 +1,9 @@ +#define FB2K_COM_CATCH catch(exception_com const & e) {return e.get_code();} catch(std::bad_alloc) {return E_OUTOFMEMORY;} catch(pfc::exception_invalid_params) {return E_INVALIDARG;} catch(...) {return E_UNEXPECTED;}
+
+#define COM_QI_BEGIN() HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid,void ** ppvObject) { if (ppvObject == NULL) return E_INVALIDARG;
+#define COM_QI_ENTRY(IWhat) { if (iid == IID_##IWhat) {IWhat * temp = this; temp->AddRef(); * ppvObject = temp; return S_OK;} }
+#define COM_QI_END() * ppvObject = NULL; return E_NOINTERFACE; }
+
+#define COM_QI_CHAIN(Parent) { HRESULT status = Parent::QueryInterface(iid, ppvObject); if (SUCCEEDED(status)) return status; }
+
+#define COM_QI_SIMPLE(IWhat) COM_QI_BEGIN() COM_QI_ENTRY(IUnknown) COM_QI_ENTRY(IWhat) COM_QI_END()
\ No newline at end of file diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/CallForwarder.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/CallForwarder.h new file mode 100644 index 0000000000..53608d6c16 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/CallForwarder.h @@ -0,0 +1,32 @@ +namespace CF {
+ template<typename TWhat> class CallForwarder {
+ public:
+ CallForwarder(TWhat * ptr) { m_ptr.new_t(ptr); }
+
+ void Orphan() {*m_ptr = NULL;}
+ bool IsValid() const { return *m_ptr != NULL; }
+ bool IsEmpty() const { return !IsValid(); }
+
+ TWhat * operator->() const {
+ PFC_ASSERT( IsValid() );
+ return *m_ptr;
+ }
+
+ TWhat & operator*() const {
+ PFC_ASSERT( IsValid() );
+ return **m_ptr;
+ }
+
+ private:
+ pfc::rcptr_t<TWhat*> m_ptr;
+ };
+
+ template<typename TWhat> class CallForwarderMaster : public CallForwarder<TWhat> {
+ public:
+ CallForwarderMaster(TWhat * ptr) : CallForwarder<TWhat>(ptr) {}
+ ~CallForwarderMaster() { Orphan(); }
+
+ PFC_CLASS_NOT_COPYABLE(CallForwarderMaster, CallForwarderMaster<TWhat>);
+ };
+
+}
\ No newline at end of file diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/IDataObjectUtils.cpp b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/IDataObjectUtils.cpp new file mode 100644 index 0000000000..65c36e542d --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/IDataObjectUtils.cpp @@ -0,0 +1,186 @@ +#include "stdafx.h"
+
+
+HRESULT IDataObjectUtils::DataBlockToSTGMEDIUM(const void * blockPtr, t_size blockSize, STGMEDIUM * medium, DWORD tymed, bool bHere) throw() {
+ try {
+ if (bHere) {
+ switch(tymed) {
+ case TYMED_ISTREAM:
+ {
+ if (medium->pstm == NULL) return E_INVALIDARG;
+ ULONG written = 0;
+ HRESULT state;
+ state = medium->pstm->Write(blockPtr, pfc::downcast_guarded<ULONG>(blockSize),&written);
+ if (FAILED(state)) return state;
+ if (written != blockSize) return STG_E_MEDIUMFULL;
+ return S_OK;
+ }
+ default:
+ return DV_E_TYMED;
+ }
+ } else {
+ if (tymed & TYMED_HGLOBAL) {
+ HGLOBAL hMem = HGlobalFromMemblock(blockPtr, blockSize);
+ if (hMem == NULL) return E_OUTOFMEMORY;
+ medium->tymed = TYMED_HGLOBAL;
+ medium->hGlobal = hMem;
+ medium->pUnkForRelease = NULL;
+ return S_OK;
+ }
+ if (tymed & TYMED_ISTREAM) {
+ HRESULT state;
+ HGLOBAL hMem = HGlobalFromMemblock(blockPtr, blockSize);
+ if (hMem == NULL) return E_OUTOFMEMORY;
+ medium->tymed = TYMED_ISTREAM;
+ pfc::com_ptr_t<IStream> stream;
+ if (FAILED( state = CreateStreamOnHGlobal(hMem,TRUE,stream.receive_ptr()) ) ) {
+ GlobalFree(hMem);
+ return state;
+ }
+ {
+ LARGE_INTEGER wtf = {};
+ if (FAILED( state = stream->Seek(wtf,STREAM_SEEK_END,NULL) ) ) {
+ return state;
+ }
+ }
+ medium->pstm = stream.detach();
+ medium->pUnkForRelease = NULL;
+ return S_OK;
+ }
+ return DV_E_TYMED;
+ }
+ } catch(pfc::exception_not_implemented) {
+ return E_NOTIMPL;
+ } catch(std::bad_alloc) {
+ return E_OUTOFMEMORY;
+ } catch(...) {
+ return E_UNEXPECTED;
+ }
+}
+
+
+HGLOBAL IDataObjectUtils::HGlobalFromMemblock(const void * ptr,t_size size) {
+ HGLOBAL handle = GlobalAlloc(GMEM_MOVEABLE,size);
+ if (handle != NULL) {
+ void * destptr = GlobalLock(handle);
+ if (destptr == NULL) {
+ GlobalFree(handle);
+ handle = NULL;
+ } else {
+ memcpy(destptr,ptr,size);
+ GlobalUnlock(handle);
+ }
+ }
+ return handle;
+}
+
+HRESULT IDataObjectUtils::ExtractDataObjectContent(pfc::com_ptr_t<IDataObject> obj, UINT format, DWORD aspect, LONG index, pfc::array_t<t_uint8> & out) {
+ FORMATETC fmt = {};
+ fmt.cfFormat = format; fmt.dwAspect = aspect; fmt.lindex = index;
+ fmt.tymed = TYMED_HGLOBAL | TYMED_ISTREAM;
+
+ STGMEDIUM med = {};
+ HRESULT state;
+ if (FAILED( state = obj->GetData(&fmt,&med) ) ) return state;
+ ReleaseStgMediumScope relScope(&med);
+ return STGMEDIUMToDataBlock(med, out);
+}
+
+HRESULT IDataObjectUtils::STGMEDIUMToDataBlock(const STGMEDIUM & med, pfc::array_t<t_uint8> & out) {
+ switch(med.tymed) {
+ case TYMED_HGLOBAL:
+ {
+ CGlobalLockScope lock(med.hGlobal);
+ out.set_data_fromptr( (const t_uint8*) lock.GetPtr(), lock.GetSize() );
+ }
+ return S_OK;
+ case TYMED_ISTREAM:
+ {
+ HRESULT state;
+ IStream * stream = med.pstm;
+ LARGE_INTEGER offset = {};
+ STATSTG stats = {};
+ if (FAILED( state = stream->Stat(&stats,STATFLAG_NONAME ) ) ) return state;
+ t_size toRead = pfc::downcast_guarded<t_size>(stats.cbSize.QuadPart);
+ out.set_size(toRead);
+ if (FAILED( state = stream->Seek(offset,STREAM_SEEK_SET,NULL) ) ) return state;
+ ULONG cbRead = 0;
+ if (FAILED( state = stream->Read(out.get_ptr(), pfc::downcast_guarded<ULONG>(toRead), &cbRead) ) ) return state;
+ if (cbRead != toRead) return E_UNEXPECTED;
+ }
+ return S_OK;
+ default:
+ return DV_E_TYMED;
+ }
+}
+
+HRESULT IDataObjectUtils::ExtractDataObjectContent(pfc::com_ptr_t<IDataObject> obj, UINT format, pfc::array_t<t_uint8> & out) {
+ return ExtractDataObjectContent(obj, format, DVASPECT_CONTENT, -1, out);
+}
+
+HRESULT IDataObjectUtils::ExtractDataObjectContentTest(pfc::com_ptr_t<IDataObject> obj, UINT format, DWORD aspect, LONG index) {
+ FORMATETC fmt = {};
+ fmt.cfFormat = format; fmt.dwAspect = aspect; fmt.lindex = index;
+ for(t_uint32 walk = 0; walk < 32; ++walk) {
+ const DWORD tymed = 1 << walk;
+ if ((ExtractDataObjectContent_SupportedTymeds & tymed) != 0) {
+ fmt.tymed = tymed;
+ HRESULT state = obj->QueryGetData(&fmt);
+ if (SUCCEEDED(state)) {
+ if (state == S_OK) return S_OK;
+ } else {
+ if (state != DV_E_TYMED) return state;
+ }
+ }
+ }
+ return E_FAIL;
+}
+
+HRESULT IDataObjectUtils::ExtractDataObjectContentTest(pfc::com_ptr_t<IDataObject> obj, UINT format) {
+ return ExtractDataObjectContentTest(obj,format,DVASPECT_CONTENT,-1);
+}
+
+HRESULT IDataObjectUtils::ExtractDataObjectString(pfc::com_ptr_t<IDataObject> obj, pfc::string_base & out) {
+ pfc::array_t<t_uint8> data;
+ HRESULT state;
+ state = ExtractDataObjectContent(obj,CF_UNICODETEXT,data);
+ if (SUCCEEDED(state)) {
+ out = pfc::stringcvt::string_utf8_from_os_ex( (const wchar_t*) data.get_ptr(), data.get_size() / sizeof(wchar_t) );
+ return S_OK;
+ }
+ state = ExtractDataObjectContent(obj,CF_TEXT,data);
+ if (SUCCEEDED(state)) {
+ out = pfc::stringcvt::string_utf8_from_os_ex( (const char*) data.get_ptr(), data.get_size() / sizeof(char) );
+ return S_OK;
+ }
+ return E_FAIL;
+}
+
+HRESULT IDataObjectUtils::SetDataObjectContent(pfc::com_ptr_t<IDataObject> obj, UINT format, DWORD aspect, LONG index, const void * data, t_size dataSize) {
+ STGMEDIUM med = {};
+ FORMATETC fmt = {};
+ fmt.cfFormat = format; fmt.dwAspect = aspect; fmt.lindex = index; fmt.tymed = TYMED_HGLOBAL;
+ HRESULT state;
+ if (FAILED(state = DataBlockToSTGMEDIUM(data,dataSize,&med,TYMED_HGLOBAL,false))) return state;
+ return obj->SetData(&fmt,&med,TRUE);
+}
+
+HRESULT IDataObjectUtils::SetDataObjectString(pfc::com_ptr_t<IDataObject> obj, const char * str) {
+ pfc::stringcvt::string_wide_from_utf8 s(str);
+ return SetDataObjectContent(obj,CF_UNICODETEXT,DVASPECT_CONTENT,-1,s.get_ptr(), (s.length()+1) * sizeof(s[0]));
+}
+
+HRESULT IDataObjectUtils::ExtractDataObjectDWORD(pfc::com_ptr_t<IDataObject> obj, UINT format, DWORD & val) {
+ HRESULT state;
+ pfc::array_t<t_uint8> buffer;
+ if (FAILED( state = ExtractDataObjectContent(obj, format, DVASPECT_CONTENT, -1, buffer) ) ) return state;
+ if (buffer.get_size() < sizeof(val)) return E_UNEXPECTED;
+ val = *(DWORD*) buffer.get_ptr();
+ return S_OK;
+}
+HRESULT IDataObjectUtils::SetDataObjectDWORD(pfc::com_ptr_t<IDataObject> obj, UINT format, DWORD val) {
+ return SetDataObjectContent(obj,format,DVASPECT_CONTENT,-1,&val,sizeof(val));
+}
+HRESULT IDataObjectUtils::PasteSucceeded(pfc::com_ptr_t<IDataObject> obj, DWORD effect) {
+ return SetDataObjectDWORD(obj, RegisterClipboardFormat(CFSTR_PASTESUCCEEDED), effect);
+}
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/IDataObjectUtils.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/IDataObjectUtils.h new file mode 100644 index 0000000000..5eca9a3997 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/IDataObjectUtils.h @@ -0,0 +1,180 @@ +#include <shlobj.h>
+
+namespace IDataObjectUtils {
+
+ class ReleaseStgMediumScope {
+ public:
+ ReleaseStgMediumScope(STGMEDIUM * medium) : m_medium(medium) {}
+ ~ReleaseStgMediumScope() {if (m_medium != NULL) ReleaseStgMedium(m_medium);}
+ private:
+ STGMEDIUM * m_medium;
+
+ PFC_CLASS_NOT_COPYABLE_EX(ReleaseStgMediumScope)
+ };
+
+ static const DWORD DataBlockToSTGMEDIUM_SupportedTymeds = TYMED_ISTREAM | TYMED_HGLOBAL;
+ static const DWORD ExtractDataObjectContent_SupportedTymeds = TYMED_ISTREAM | TYMED_HGLOBAL;
+
+ HRESULT DataBlockToSTGMEDIUM(const void * blockPtr, t_size blockSize, STGMEDIUM * medium, DWORD tymed, bool bHere) throw();
+
+ HGLOBAL HGlobalFromMemblock(const void * ptr,t_size size);
+
+ HRESULT ExtractDataObjectContent(pfc::com_ptr_t<IDataObject> obj, UINT format, DWORD aspect, LONG index, pfc::array_t<t_uint8> & out);
+ HRESULT ExtractDataObjectContent(pfc::com_ptr_t<IDataObject> obj, UINT format, pfc::array_t<t_uint8> & out);
+
+ HRESULT ExtractDataObjectContentTest(pfc::com_ptr_t<IDataObject> obj, UINT format, DWORD aspect, LONG index);
+ HRESULT ExtractDataObjectContentTest(pfc::com_ptr_t<IDataObject> obj, UINT format);
+
+ HRESULT ExtractDataObjectString(pfc::com_ptr_t<IDataObject> obj, pfc::string_base & out);
+ HRESULT SetDataObjectString(pfc::com_ptr_t<IDataObject> obj, const char * str);
+
+ HRESULT SetDataObjectContent(pfc::com_ptr_t<IDataObject> obj, UINT format, DWORD aspect, LONG index, const void * data, t_size dataSize);
+
+ HRESULT STGMEDIUMToDataBlock(const STGMEDIUM & med, pfc::array_t<t_uint8> & out);
+
+ HRESULT ExtractDataObjectDWORD(pfc::com_ptr_t<IDataObject> obj, UINT format, DWORD & val);
+ HRESULT SetDataObjectDWORD(pfc::com_ptr_t<IDataObject> obj, UINT format, DWORD val);
+
+ HRESULT PasteSucceeded(pfc::com_ptr_t<IDataObject> obj, DWORD effect);
+
+ class comparator_FORMATETC {
+ public:
+ static int compare(const FORMATETC & v1, const FORMATETC & v2) {
+ int val;
+ val = pfc::compare_t(v1.cfFormat,v2.cfFormat); if (val != 0) return val;
+ val = pfc::compare_t(v1.dwAspect,v2.dwAspect); if (val != 0) return val;
+ val = pfc::compare_t(v1.lindex, v2.lindex ); if (val != 0) return val;
+ return 0;
+ }
+ };
+
+ class CDataObjectBase : public IDataObject {
+ public:
+ COM_QI_SIMPLE(IDataObject)
+
+ HRESULT STDMETHODCALLTYPE GetData(FORMATETC * formatetc, STGMEDIUM * medium) {
+ return GetData_internal(formatetc,medium,false);
+ }
+
+ HRESULT STDMETHODCALLTYPE GetDataHere(FORMATETC * formatetc, STGMEDIUM * medium) {
+ return GetData_internal(formatetc,medium,true);
+ }
+
+ HRESULT STDMETHODCALLTYPE QueryGetData(FORMATETC * formatetc) {
+ if (formatetc == NULL) return E_INVALIDARG;
+
+ if ((DataBlockToSTGMEDIUM_SupportedTymeds & formatetc->tymed) == 0) return DV_E_TYMED;
+
+ try {
+ return RenderDataTest(formatetc->cfFormat,formatetc->dwAspect,formatetc->lindex);
+ } FB2K_COM_CATCH;
+ }
+
+
+ HRESULT STDMETHODCALLTYPE GetCanonicalFormatEtc(FORMATETC * in, FORMATETC * out) {
+ //check this again
+ if (in == NULL || out == NULL)
+ return E_INVALIDARG;
+ *out = *in;
+ return DATA_S_SAMEFORMATETC;
+ }
+
+ HRESULT STDMETHODCALLTYPE EnumFormatEtc(DWORD dwDirection,IEnumFORMATETC ** ppenumFormatetc) {
+ if (dwDirection == DATADIR_GET) {
+ if (ppenumFormatetc == NULL) return E_INVALIDARG;
+ return CreateIEnumFORMATETC(ppenumFormatetc);
+ } else if (dwDirection == DATADIR_SET) {
+ return E_NOTIMPL;
+ } else {
+ return E_INVALIDARG;
+ }
+ }
+
+ HRESULT STDMETHODCALLTYPE SetData(FORMATETC * pFormatetc, STGMEDIUM * pmedium, BOOL fRelease) {
+ try {
+ ReleaseStgMediumScope relScope(fRelease ? pmedium : NULL);
+ if (pFormatetc == NULL || pmedium == NULL) return E_INVALIDARG;
+
+ /*TCHAR buf[256];
+ if (GetClipboardFormatName(pFormatetc->cfFormat,buf,PFC_TABSIZE(buf)) > 0) {
+ buf[PFC_TABSIZE(buf)-1] = 0;
+ OutputDebugString(TEXT("SetData: ")); OutputDebugString(buf); OutputDebugString(TEXT("\n"));
+ } else {
+ OutputDebugString(TEXT("SetData: unknown clipboard format.\n"));
+ }*/
+
+ pfc::array_t<t_uint8> temp;
+ HRESULT state = STGMEDIUMToDataBlock(*pmedium,temp);
+ if (FAILED(state)) return state;
+ m_entries.set(*pFormatetc,temp);
+ return S_OK;
+ } FB2K_COM_CATCH;
+ }
+ HRESULT STDMETHODCALLTYPE DAdvise(FORMATETC * pFormatetc, DWORD advf, IAdviseSink * pAdvSink, DWORD * pdwConnection) {return OLE_E_ADVISENOTSUPPORTED;}
+ HRESULT STDMETHODCALLTYPE DUnadvise(DWORD dwConnection) {return OLE_E_ADVISENOTSUPPORTED;}
+ HRESULT STDMETHODCALLTYPE EnumDAdvise(IEnumSTATDATA ** ppenumAdvise) {return OLE_E_ADVISENOTSUPPORTED;}
+ protected:
+ virtual HRESULT RenderData(UINT format,DWORD aspect,LONG dataIndex,stream_writer_formatter<> & out) const {
+ FORMATETC fmt = {};
+ fmt.cfFormat = format; fmt.dwAspect = aspect; fmt.lindex = dataIndex;
+ const pfc::array_t<t_uint8> * entry = m_entries.query_ptr(fmt);
+ if (entry != NULL) {
+ out.write_raw(entry->get_ptr(), entry->get_size());
+ return S_OK;
+ }
+ return DV_E_FORMATETC;
+ }
+ virtual HRESULT RenderDataTest(UINT format,DWORD aspect, LONG dataIndex) const {
+ FORMATETC fmt = {};
+ fmt.cfFormat = format; fmt.dwAspect = aspect; fmt.lindex = dataIndex;
+ if (m_entries.have_item(fmt)) return S_OK;
+ return DV_E_FORMATETC;
+ }
+ typedef pfc::list_base_t<FORMATETC> TFormatList;
+
+ static void AddFormat(TFormatList & out,UINT code) {
+ FORMATETC fmt = {};
+ fmt.dwAspect = DVASPECT_CONTENT;
+ fmt.lindex = -1;
+ fmt.cfFormat = code;
+ for(t_size medWalk = 0; medWalk < 32; ++medWalk) {
+ const DWORD med = 1 << medWalk;
+ if ((DataBlockToSTGMEDIUM_SupportedTymeds & med) != 0) {
+ fmt.tymed = med;
+ out.add_item(fmt);
+ }
+ }
+ }
+
+ virtual void EnumFormats(TFormatList & out) const {
+ pfc::avltree_t<UINT> formats;
+ for(t_entries::const_iterator walk = m_entries.first(); walk.is_valid(); ++walk) {
+ formats.add_item( walk->m_key.cfFormat );
+ }
+ for(pfc::const_iterator<UINT> walk = formats.first(); walk.is_valid(); ++walk) {
+ AddFormat(out, *walk);
+ }
+ }
+ HRESULT CreateIEnumFORMATETC(IEnumFORMATETC ** outptr) const throw() {
+ try {
+ pfc::list_t<FORMATETC> out;
+ EnumFormats(out);
+ return SHCreateStdEnumFmtEtc((UINT)out.get_count(), out.get_ptr(), outptr);
+ } FB2K_COM_CATCH;
+ }
+ private:
+ HRESULT GetData_internal(FORMATETC * formatetc, STGMEDIUM * medium,bool bHere) {
+ if (formatetc == NULL || medium == NULL) return E_INVALIDARG;
+
+ try {
+ stream_writer_formatter_simple<> out;
+ HRESULT hr = RenderData(formatetc->cfFormat,formatetc->dwAspect,formatetc->lindex,out);
+ if (FAILED(hr)) return hr;
+ return DataBlockToSTGMEDIUM(out.m_buffer.get_ptr(),out.m_buffer.get_size(),medium,formatetc->tymed,bHere);
+ } FB2K_COM_CATCH;
+ }
+
+ typedef pfc::map_t<FORMATETC, pfc::array_t<t_uint8>, comparator_FORMATETC> t_entries;
+ t_entries m_entries;
+ };
+}
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/ProfileCache.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/ProfileCache.h new file mode 100644 index 0000000000..05497ce011 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/ProfileCache.h @@ -0,0 +1,44 @@ +namespace ProfileCache {
+ static file::ptr FetchFile(const char * context, const char * name, const char * webURL, t_filetimestamp acceptableAge, abort_callback & abort) {
+ const double timeoutVal = 5;
+
+ pfc::string_formatter path ( core_api::get_profile_path() );
+ path.fix_dir_separator('\\');
+ path << context;
+ try {
+ filesystem::g_create_directory(path, abort);
+ } catch(exception_io_already_exists) {}
+ path << "\\" << name;
+
+ bool fetch = false;
+ file::ptr fLocal;
+
+ try {
+ filesystem::g_open_timeout(fLocal, path, filesystem::open_mode_write_existing, timeoutVal, abort);
+ fetch = fLocal->get_timestamp(abort) < filetimestamp_from_system_timer() - acceptableAge;
+ } catch(exception_io_not_found) {
+ filesystem::g_open_timeout(fLocal, path, filesystem::open_mode_write_new, timeoutVal, abort);
+ fetch = true;
+ }
+ if (fetch) {
+ fLocal->resize(0, abort);
+ file::ptr fRemote;
+ try {
+ filesystem::g_open(fRemote, webURL, filesystem::open_mode_read, abort);
+ } catch(exception_io_not_found) {
+ fLocal.release();
+ try { filesystem::g_remove_timeout(path, timeoutVal, abort); } catch(...) {}
+ throw;
+ }
+ pfc::array_t<t_uint8> buffer; buffer.set_size(64*1024);
+ for (;;) {
+ t_size delta = buffer.get_size();
+ delta = fRemote->read(buffer.get_ptr(), delta, abort);
+ fLocal->write(buffer.get_ptr(), delta, abort);
+ if (delta < buffer.get_size()) break;
+ }
+ fLocal->seek(0, abort);
+ }
+ return fLocal;
+ }
+};
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/StdAfx.cpp b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/StdAfx.cpp new file mode 100644 index 0000000000..9dc5b543a9 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/StdAfx.cpp @@ -0,0 +1,6 @@ +// stdafx.cpp : source file that includes just the standard includes
+// foobar2000_sdk_helpers.pch will be the pre-compiled header
+// stdafx.obj will contain the pre-compiled type information
+
+#include "stdafx.h"
+
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/StdAfx.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/StdAfx.h new file mode 100644 index 0000000000..50a4e7bf8b --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/StdAfx.h @@ -0,0 +1,22 @@ +// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently, but
+// are changed infrequently
+//
+
+#if !defined(AFX_STDAFX_H__6356EC2B_6DD1_4BE8_935C_87ECBA8697E4__INCLUDED_)
+#define AFX_STDAFX_H__6356EC2B_6DD1_4BE8_935C_87ECBA8697E4__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+
+#include "../SDK/foobar2000.h"
+#include "helpers.h"
+
+// TODO: reference additional headers your program requires here
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_STDAFX_H__6356EC2B_6DD1_4BE8_935C_87ECBA8697E4__INCLUDED_)
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/ThreadUtils.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/ThreadUtils.h new file mode 100644 index 0000000000..bc20bd2298 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/ThreadUtils.h @@ -0,0 +1,262 @@ +namespace ThreadUtils {
+ static bool WaitAbortable(HANDLE ev, abort_callback & abort, DWORD timeout = INFINITE) {
+ const HANDLE handles[2] = {ev, abort.get_abort_event()};
+ SetLastError(0);
+ const DWORD status = WaitForMultipleObjects(2, handles, FALSE, timeout);
+ switch(status) {
+ case WAIT_TIMEOUT:
+ PFC_ASSERT( timeout != INFINITE );
+ return false;
+ case WAIT_OBJECT_0:
+ return true;
+ case WAIT_OBJECT_0 + 1:
+ throw exception_aborted();
+ case WAIT_FAILED:
+ WIN32_OP_FAIL();
+ default:
+ uBugCheck();
+ }
+ }
+
+ static void ProcessPendingMessages() {
+ MSG msg = {};
+ while(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
+ DispatchMessage(&msg);
+ }
+ }
+
+
+ static void WaitAbortable_MsgLoop(HANDLE ev, abort_callback & abort) {
+ const HANDLE handles[2] = {ev, abort.get_abort_event()};
+ for (;;) {
+ SetLastError(0);
+ const DWORD status = MsgWaitForMultipleObjects(2, handles, FALSE, INFINITE, QS_ALLEVENTS);
+ switch(status) {
+ case WAIT_TIMEOUT:
+ PFC_ASSERT(!"How did we get here?");
+ uBugCheck();
+ case WAIT_OBJECT_0:
+ return;
+ case WAIT_OBJECT_0 + 1:
+ throw exception_aborted();
+ case WAIT_OBJECT_0 + 2:
+ ProcessPendingMessages();
+ break;
+ case WAIT_FAILED:
+ WIN32_OP_FAIL();
+ default:
+ uBugCheck();
+ }
+ }
+ }
+
+ static t_size MultiWaitAbortable_MsgLoop(const HANDLE * ev, t_size evCount, abort_callback & abort) {
+ pfc::array_t<HANDLE> handles; handles.set_size(evCount + 1);
+ handles[0] = abort.get_abort_event();
+ pfc::memcpy_t(handles.get_ptr() + 1, ev, evCount);
+ for (;;) {
+ SetLastError(0);
+ const DWORD status = MsgWaitForMultipleObjects(handles.get_count(), handles.get_ptr(), FALSE, INFINITE, QS_ALLEVENTS);
+ switch(status) {
+ case WAIT_TIMEOUT:
+ PFC_ASSERT(!"How did we get here?");
+ uBugCheck();
+ case WAIT_OBJECT_0:
+ throw exception_aborted();
+ case WAIT_FAILED:
+ WIN32_OP_FAIL();
+ default:
+ {
+ t_size index = (t_size)(status - (WAIT_OBJECT_0 + 1));
+ if (index == evCount) {
+ ProcessPendingMessages();
+ } else if (index < evCount) {
+ return index;
+ } else {
+ uBugCheck();
+ }
+ }
+ }
+ }
+ }
+
+ static void SleepAbortable_MsgLoop(abort_callback & abort, DWORD timeout /*must not be INFINITE*/) {
+ PFC_ASSERT( timeout != INFINITE );
+ const DWORD entry = GetTickCount();
+ const HANDLE handles[1] = {abort.get_abort_event()};
+ for (;;) {
+ const DWORD done = GetTickCount() - entry;
+ if (done >= timeout) return;
+ SetLastError(0);
+ const DWORD status = MsgWaitForMultipleObjects(1, handles, FALSE, timeout - done, QS_ALLEVENTS);
+ switch(status) {
+ case WAIT_TIMEOUT:
+ return;
+ case WAIT_OBJECT_0:
+ throw exception_aborted();
+ case WAIT_OBJECT_0 + 1:
+ ProcessPendingMessages();
+ default:
+ throw exception_win32(GetLastError());
+ }
+ }
+ }
+
+ static bool WaitAbortable_MsgLoop(HANDLE ev, abort_callback & abort, DWORD timeout /*must not be INFINITE*/) {
+ PFC_ASSERT( timeout != INFINITE );
+ const DWORD entry = GetTickCount();
+ const HANDLE handles[2] = {ev, abort.get_abort_event()};
+ for (;;) {
+ const DWORD done = GetTickCount() - entry;
+ if (done >= timeout) return false;
+ SetLastError(0);
+ const DWORD status = MsgWaitForMultipleObjects(2, handles, FALSE, timeout - done, QS_ALLEVENTS);
+ switch(status) {
+ case WAIT_TIMEOUT:
+ return false;
+ case WAIT_OBJECT_0:
+ return true;
+ case WAIT_OBJECT_0 + 1:
+ throw exception_aborted();
+ case WAIT_OBJECT_0 + 2:
+ ProcessPendingMessages();
+ break;
+ case WAIT_FAILED:
+ WIN32_OP_FAIL();
+ default:
+ uBugCheck();
+ }
+ }
+ }
+
+ template<typename TWhat>
+ class CObjectQueue {
+ public:
+ CObjectQueue() { m_event.create(true,false); }
+
+ template<typename TSource> void Add(const TSource & source) {
+ insync(m_sync);
+ m_content.add_item(source);
+ if (m_content.get_count() == 1) m_event.set_state(true);
+ }
+ template<typename TDestination> void Get(TDestination & out, abort_callback & abort) {
+ WaitAbortable(m_event.get(), abort);
+ _Get(out);
+ }
+
+ template<typename TDestination> void Get_MsgLoop(TDestination & out, abort_callback & abort) {
+ WaitAbortable_MsgLoop(m_event.get(), abort);
+ _Get(out);
+ }
+
+ private:
+ template<typename TDestination> void _Get(TDestination & out) {
+ insync(m_sync);
+ pfc::const_iterator<TWhat> iter = m_content.first();
+ pfc::dynamic_assert( iter.is_valid() );
+ out = *iter;
+ m_content.remove(iter);
+ if (m_content.get_count() == 0) m_event.set_state(false);
+ }
+ win32_event m_event;
+ critical_section m_sync;
+ pfc::chain_list_v2_t<TWhat> m_content;
+ };
+
+
+ template<typename TBase, bool processMsgs = false>
+ class CSingleThreadWrapper : protected pfc::thread {
+ private:
+ enum status {
+ success,
+ fail,
+ fail_io,
+ fail_io_data,
+ fail_abort,
+ };
+ protected:
+ class command {
+ protected:
+ command() : m_status(success), m_abort(), m_completionEvent() {}
+ virtual void executeImpl(TBase &) {}
+ virtual ~command() {}
+ public:
+ void execute(TBase & obj) {
+ try {
+ executeImpl(obj);
+ m_status = success;
+ } catch(exception_aborted const & e) {
+ m_status = fail_abort; m_statusMsg = e.what();
+ } catch(exception_io_data const & e) {
+ m_status = fail_io_data; m_statusMsg = e.what();
+ } catch(exception_io const & e) {
+ m_status = fail_io; m_statusMsg = e.what();
+ } catch(std::exception const & e) {
+ m_status = fail; m_statusMsg = e.what();
+ }
+ SetEvent(m_completionEvent);
+ }
+ void rethrow() const {
+ switch(m_status) {
+ case fail:
+ throw pfc::exception(m_statusMsg);
+ case fail_io:
+ throw exception_io(m_statusMsg);
+ case fail_io_data:
+ throw exception_io_data(m_statusMsg);
+ case fail_abort:
+ throw exception_aborted();
+ case success:
+ break;
+ default:
+ uBugCheck();
+ }
+ }
+ status m_status;
+ pfc::string8 m_statusMsg;
+ HANDLE m_completionEvent;
+ abort_callback * m_abort;
+ };
+
+ typedef pfc::rcptr_t<command> command_ptr;
+
+ CSingleThreadWrapper() {
+ m_completionEvent.create(true,false);
+ start();
+ }
+
+ ~CSingleThreadWrapper() {
+ m_threadAbort.abort();
+ waitTillDone();
+ }
+
+ void invokeCommand(command_ptr cmd, abort_callback & abort) {
+ abort.check();
+ m_completionEvent.set_state(false);
+ pfc::vartoggle_t<abort_callback*> abortToggle(cmd->m_abort, &abort);
+ pfc::vartoggle_t<HANDLE> eventToggle(cmd->m_completionEvent, m_completionEvent.get() );
+ m_commands.Add(cmd);
+ m_completionEvent.wait_for(-1);
+ //WaitAbortable(m_completionEvent.get(), abort);
+ cmd->rethrow();
+ }
+
+ private:
+ void threadProc() {
+ TRACK_CALL_TEXT("CSingleThreadWrapper entry");
+ try {
+ TBase instance;
+ for (;;) {
+ command_ptr cmd;
+ if (processMsgs) m_commands.Get_MsgLoop(cmd, m_threadAbort);
+ else m_commands.Get(cmd, m_threadAbort);
+ cmd->execute(instance);
+ }
+ } catch(...) {}
+ if (processMsgs) ProcessPendingMessages();
+ }
+ win32_event m_completionEvent;
+ CObjectQueue<command_ptr> m_commands;
+ abort_callback_impl m_threadAbort;
+ };
+}
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/VisUtils.cpp b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/VisUtils.cpp new file mode 100644 index 0000000000..069244d466 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/VisUtils.cpp @@ -0,0 +1,36 @@ +#include "stdafx.h"
+
+namespace VisUtils {
+ void PrepareFFTChunk(audio_chunk const & source, audio_chunk & out, double centerOffset) {
+ const t_size channels = source.get_channel_count();
+ const t_uint32 sampleRate = source.get_sample_rate();
+ pfc::dynamic_assert( sampleRate > 0 );
+ out.set_channels(channels, source.get_channel_config());
+ out.set_sample_rate(sampleRate);
+ const t_size inSize = source.get_sample_count();
+ const t_size fftSize = MatchFFTSize(inSize);
+ out.set_sample_count(fftSize);
+ out.set_data_size(fftSize * channels);
+ if (fftSize >= inSize) { //rare case with *REALLY* small input
+ pfc::memcpy_t( out.get_data(), source.get_data(), inSize * channels );
+ pfc::memset_null_t( out.get_data() + inSize * channels, (fftSize - inSize) * channels );
+ } else { //inSize > fftSize, we're using a subset of source chunk for the job, pick a subset around centerOffset.
+ const double baseOffset = pfc::max_t<double>(0, centerOffset - 0.5 * (double)fftSize / (double)sampleRate);
+ const t_size baseSample = pfc::min_t<t_size>( (t_size) audio_math::time_to_samples(baseOffset, sampleRate), inSize - fftSize);
+ pfc::memcpy_t( out.get_data(), source.get_data() + baseSample * channels, fftSize * channels);
+ }
+ }
+
+ bool IsValidFFTSize(t_size p_size) {
+ return p_size >= 2 && (p_size & (p_size - 1)) == 0;
+ }
+
+ t_size MatchFFTSize(t_size samples) {
+ if (samples <= 2) return 2;
+ t_size mask = 1;
+ while(!IsValidFFTSize(samples)) {
+ samples &= ~mask; mask <<= 1;
+ }
+ return samples;
+ }
+};
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/VisUtils.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/VisUtils.h new file mode 100644 index 0000000000..973fb3fcb8 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/VisUtils.h @@ -0,0 +1,8 @@ +namespace VisUtils {
+ //! Turns an arbitrary audio_chunk into a valid chunk to run FFT on, with proper sample count etc.
+ //! @param centerOffset Time offset (in seconds) inside the source chunk to center the output on, in case the FFT window is smaller than input data.
+ void PrepareFFTChunk(audio_chunk const & source, audio_chunk & out, double centerOffset);
+
+ bool IsValidFFTSize(t_size size);
+ t_size MatchFFTSize(t_size samples);
+};
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/album_art_helpers.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/album_art_helpers.h new file mode 100644 index 0000000000..e1e6693359 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/album_art_helpers.h @@ -0,0 +1,109 @@ +//! Helper class to load album art from a separate thread (without lagging GUI). In most scenarios you will want to use CAlbumArtLoader instead of deriving from CAlbumArtLoaderBase, unless you want to additionally process the images as they are loaded.
+//! All methods meant to be called from the main thread.
+//! IMPORTANT: derived classes must call Abort() in their own destructor rather than relying on CAlbumArtLoaderBase destructor, since the thread calls virtual functions!
+class CAlbumArtLoaderBase : private CSimpleThread {
+public:
+ CAlbumArtLoaderBase() : m_api(static_api_ptr_t<album_art_manager>()->instantiate()) {}
+ ~CAlbumArtLoaderBase() {Abort();}
+
+ //! Requests the loader to process specific album art type. See album_art_ids namespace for defined types.
+ void AddType(const GUID & p_what) {
+ if (!HaveType(p_what)) {
+ Abort();
+ m_requestIds.add_item(p_what);
+ m_api->close();
+ }
+ }
+ bool HaveType(const GUID & p_what) const {
+ return m_requestIds.have_item(p_what);
+ }
+
+ void ResetTypes() {
+ Abort();
+ m_requestIds.remove_all();
+ m_api->close();
+ }
+
+ void Abort() {
+ AbortThread();
+ m_notify.release();
+ }
+
+ //! Completion notify code is 1 when content has changed, 0 when content is the same as before the request (like, advanced to another track with the same album art data).
+ void Request(const char * p_path,completion_notify_ptr p_notify = NULL) {
+ Abort();
+ m_requestPath = p_path;
+ m_notify = p_notify;
+ StartThread();
+ }
+
+ bool IsReady() const {return !IsWorking();}
+ bool IsWorking() const {return IsThreadActive();}
+
+protected:
+ virtual void OnContent(const GUID & p_what,album_art_data_ptr p_data,abort_callback & p_abort) {}
+ virtual void OnContentReset() {}
+
+private:
+ unsigned ThreadProc(abort_callback & p_abort) {
+ try {
+ return ProcessRequest(p_abort);
+ } catch(exception_aborted) {
+ return 0;
+ } catch(std::exception const & e) {
+ console::complain("Album Art loading failure", e);
+ return 0;
+ }
+ }
+
+ unsigned ProcessRequest(abort_callback & p_abort) {
+ if (m_api->open(m_requestPath,p_abort)) {
+ OnContentReset();
+ for(pfc::chain_list_v2_t<GUID>::const_iterator walk = m_requestIds.first(); walk.is_valid(); ++walk) {
+ album_art_data_ptr data;
+ try {
+ data = m_api->query(*walk,p_abort);
+ } catch(exception_io const & e) {
+ console::complain("Requested Album Art entry could not be retrieved", e);
+ continue;
+ }
+ pfc::dynamic_assert( data.is_valid() );
+ OnContent(*walk,data,p_abort);
+ }
+ return 1;
+ } else {
+ return 0;
+ }
+ }
+ void ThreadDone(unsigned p_code) {
+ //release our notify ptr before triggering callbacks, they might fire another query from inside that
+ completion_notify_ptr temp; temp << m_notify;
+ if (temp.is_valid()) temp->on_completion(p_code);
+ }
+
+ pfc::string8 m_requestPath;
+ pfc::chain_list_v2_t<GUID> m_requestIds;
+
+ completion_notify_ptr m_notify;
+
+ const album_art_manager_instance_ptr m_api;
+
+ PFC_CLASS_NOT_COPYABLE_EX(CAlbumArtLoaderBase);
+};
+
+class CAlbumArtLoader : public CAlbumArtLoaderBase {
+public:
+ ~CAlbumArtLoader() {Abort();}
+ bool Query(const GUID & p_what, album_art_data_ptr & p_data) const {
+ pfc::dynamic_assert( IsReady() );
+ return m_content.query(p_what,p_data);
+ }
+protected:
+ void OnContentReset() {
+ m_content.remove_all();
+ }
+ void OnContent(const GUID & p_what,album_art_data_ptr p_data,abort_callback & p_abort) {
+ m_content.set(p_what,p_data);
+ }
+ pfc::map_t<GUID,album_art_data_ptr> m_content;
+};
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/bitreader_helper.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/bitreader_helper.h new file mode 100644 index 0000000000..4af87efd05 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/bitreader_helper.h @@ -0,0 +1,122 @@ +namespace bitreader_helper {
+
+ inline static size_t extract_bit(const t_uint8 * p_stream,size_t p_offset) {
+ return (p_stream[p_offset>>3] >> (7-(p_offset&7)))&1;
+ }
+
+ static size_t extract_int(const t_uint8 * p_stream,size_t p_base,size_t p_width) {
+ size_t ret = 0;
+ size_t offset = p_base;
+ for(size_t bit=0;bit<p_width;bit++) {
+ ret <<= 1;
+ ret |= extract_bit(p_stream,offset++);
+ }
+ return ret;
+ }
+
+class bitreader
+{
+public:
+ inline bitreader(const t_uint8 * p_ptr,t_size p_base)
+ : m_ptr(p_ptr), m_bitptr(p_base)
+ {
+ }
+
+ inline void skip(t_size p_bits)
+ {
+ m_bitptr += p_bits;
+ }
+
+ template<typename t_ret>
+ t_ret read_t(t_size p_bits) {
+ t_ret ret = 0;
+ for(t_size bit=0;bit<p_bits;bit++)
+ {
+ ret <<= 1;
+ ret |= (m_ptr[m_bitptr>>3] >> (7-(m_bitptr&7)))&1;
+ m_bitptr++;
+ }
+ return ret;
+ }
+
+ t_size read(t_size p_bits) {return read_t<t_size>(p_bits);}
+
+ inline t_size get_bitptr() const {return m_bitptr;}
+
+ inline bool read_bit() {
+ bool state = ( (m_ptr[m_bitptr>>3] >> (7-(m_bitptr&7)))&1 ) != 0;
+ m_bitptr++;
+ return state;
+ }
+
+private:
+
+ const t_uint8 * m_ptr;
+ t_size m_bitptr;
+};
+
+class bitreader_fromfile
+{
+public:
+ inline bitreader_fromfile(service_ptr_t<file> const& p_file) : m_file(p_file), m_buffer_ptr(0) {}
+
+ t_size read(t_size p_bits,abort_callback & p_abort) {
+ t_size ret = 0;
+ for(t_size bit=0;bit<p_bits;bit++) {
+ if (m_buffer_ptr == 0)
+ m_file->read_object(&m_buffer,1,p_abort);
+
+ ret <<= 1;
+ ret |= (m_buffer >> (7-m_buffer_ptr))&1;
+ m_buffer_ptr = (m_buffer_ptr+1) & 7;
+ }
+ return ret;
+ }
+
+ void skip(t_size p_bits,abort_callback & p_abort) {
+ for(t_size bit=0;bit<p_bits;bit++) {
+ if (m_buffer_ptr == 0) m_file->read_object(&m_buffer,1,p_abort);
+ m_buffer_ptr = (m_buffer_ptr+1) & 7;
+ }
+ }
+
+ inline void byte_align() {m_buffer_ptr = 0;}
+
+private:
+ service_ptr_t<file> m_file;
+ t_size m_buffer_ptr;
+ t_uint8 m_buffer;
+};
+
+class bitreader_limited
+{
+public:
+ inline bitreader_limited(const t_uint8 * p_ptr,t_size p_base,t_size p_remaining) : m_reader(p_ptr,p_base), m_remaining(p_remaining) {}
+
+ inline t_size get_bitptr() const {return m_reader.get_bitptr();}
+
+ inline t_size get_remaining() const {return m_remaining;}
+
+ inline void skip(t_size p_bits) {
+ if (p_bits > m_remaining) throw exception_io_data_truncation();
+ m_remaining -= p_bits;
+ m_reader.skip(p_bits);
+ }
+
+ t_size read(t_size p_bits)
+ {
+ if (p_bits > m_remaining) throw exception_io_data_truncation();
+ m_remaining -= p_bits;
+ return m_reader.read(p_bits);
+ }
+
+private:
+ bitreader m_reader;
+ t_size m_remaining;
+};
+
+inline static t_size extract_bits(const t_uint8 * p_buffer,t_size p_base,t_size p_count) {
+ return bitreader(p_buffer,p_base).read(p_count);
+}
+
+}
\ No newline at end of file diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/cfg_guidlist.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/cfg_guidlist.h new file mode 100644 index 0000000000..dfdbae14e9 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/cfg_guidlist.h @@ -0,0 +1,29 @@ +class cfg_guidlist : public cfg_var, public pfc::list_t<GUID>
+{
+public:
+ void get_data_raw(stream_writer * p_stream,abort_callback & p_abort) {
+ t_uint32 n, m = pfc::downcast_guarded<t_uint32>(get_count());
+ p_stream->write_lendian_t(m,p_abort);
+ for(n=0;n<m;n++) p_stream->write_lendian_t(get_item(n),p_abort);
+ }
+ void set_data_raw(stream_reader * p_stream,t_size p_sizehint,abort_callback & p_abort) {
+ t_uint32 n,count;
+ p_stream->read_lendian_t(count,p_abort);
+ m_buffer.set_size(count);
+ for(n=0;n<count;n++) {
+ try {
+ p_stream->read_lendian_t(m_buffer[n],p_abort);
+ } catch(...) {m_buffer.set_size(0); throw;}
+ }
+ }
+
+ void sort() {sort_t(pfc::guid_compare);}
+
+ bool have_item_bsearch(const GUID & p_item) {
+ t_size dummy;
+ return bsearch_t(pfc::guid_compare,p_item,dummy);
+ }
+
+public:
+ cfg_guidlist(const GUID & p_guid) : cfg_var(p_guid) {}
+};
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/clipboard.cpp b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/clipboard.cpp new file mode 100644 index 0000000000..928ce1e0a8 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/clipboard.cpp @@ -0,0 +1,37 @@ +#include "stdafx.h"
+
+#ifdef UNICODE
+#define CF_TCHAR CF_UNICODETEXT
+#else
+#define CF_TCHAR CF_TEXT
+#endif
+
+namespace ClipboardHelper {
+ void SetRaw(UINT format,const void * data, t_size size) {
+ HANDLE buffer = GlobalAlloc(GMEM_DDESHARE,size);
+ if (buffer == NULL) throw std::bad_alloc();
+ try {
+ CGlobalLockScope lock(buffer);
+ PFC_ASSERT(lock.GetSize() == size);
+ memcpy(lock.GetPtr(),data,size);
+ } catch(...) {
+ GlobalFree(buffer); throw;
+ }
+
+ WIN32_OP(SetClipboardData(format,buffer) != NULL);
+ }
+ void SetString(const char * in) {
+ pfc::stringcvt::string_os_from_utf8 temp(in);
+ SetRaw(CF_TCHAR,temp.get_ptr(),(temp.length() + 1) * sizeof(TCHAR));
+ }
+
+ bool GetString(pfc::string_base & out) {
+ pfc::array_t<t_uint8> temp;
+ if (!GetRaw(CF_TCHAR,temp)) return false;
+ out = pfc::stringcvt::string_utf8_from_os(reinterpret_cast<const TCHAR*>(temp.get_ptr()),temp.get_size() / sizeof(TCHAR));
+ return true;
+ }
+ bool IsTextAvailable() {
+ return IsClipboardFormatAvailable(CF_TCHAR) == TRUE;
+ }
+}
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/clipboard.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/clipboard.h new file mode 100644 index 0000000000..f456ab1c94 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/clipboard.h @@ -0,0 +1,40 @@ +namespace ClipboardHelper {
+
+ class OpenScope {
+ public:
+ OpenScope() : m_open(false) {}
+ ~OpenScope() {Close();}
+ void Open(HWND p_owner) {
+ Close();
+ WIN32_OP(OpenClipboard(p_owner));
+ m_open = true;
+ }
+ void Close() {
+ if (m_open) {
+ m_open = false;
+ CloseClipboard();
+ }
+ }
+ private:
+ bool m_open;
+
+ PFC_CLASS_NOT_COPYABLE_EX(OpenScope)
+ };
+
+ void SetRaw(UINT format,const void * buffer, t_size size);
+ void SetString(const char * in);
+
+ bool GetString(pfc::string_base & out);
+
+ template<typename TArray>
+ bool GetRaw(UINT format,TArray & out) {
+ pfc::assert_byte_type<typename TArray::t_item>();
+ HANDLE data = GetClipboardData(format);
+ if (data == NULL) return false;
+ CGlobalLockScope lock(data);
+ out.set_size( lock.GetSize() );
+ memcpy(out.get_ptr(), lock.GetPtr(), lock.GetSize() );
+ return true;
+ }
+ bool IsTextAvailable();
+};
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/create_directory_helper.cpp b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/create_directory_helper.cpp new file mode 100644 index 0000000000..03cb01d66f --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/create_directory_helper.cpp @@ -0,0 +1,165 @@ +#include "stdafx.h"
+
+namespace create_directory_helper
+{
+ static void create_path_internal(const char * p_path,t_size p_base,abort_callback & p_abort) {
+ pfc::string8_fastalloc temp;
+ for(t_size walk = p_base; p_path[walk]; walk++) {
+ if (p_path[walk] == '\\') {
+ temp.set_string(p_path,walk);
+ try {filesystem::g_create_directory(temp.get_ptr(),p_abort);} catch(exception_io_already_exists) {}
+ }
+ }
+ }
+
+ static bool is_valid_netpath_char(char p_char) {
+ return pfc::char_is_ascii_alphanumeric(p_char) || p_char == '_' || p_char == '-' || p_char == '.';
+ }
+
+ static bool test_localpath(const char * p_path) {
+ if (pfc::strcmp_partial(p_path,"file://") == 0) p_path += strlen("file://");
+ return pfc::char_is_ascii_alpha(p_path[0]) &&
+ p_path[1] == ':' &&
+ p_path[2] == '\\';
+ }
+ static bool test_netpath(const char * p_path) {
+ if (pfc::strcmp_partial(p_path,"file://") == 0) p_path += strlen("file://");
+ if (*p_path != '\\') return false;
+ p_path++;
+ if (*p_path != '\\') return false;
+ p_path++;
+ if (!is_valid_netpath_char(*p_path)) return false;
+ p_path++;
+ while(is_valid_netpath_char(*p_path)) p_path++;
+ if (*p_path != '\\') return false;
+ return true;
+ }
+
+ void create_path(const char * p_path,abort_callback & p_abort) {
+ if (test_localpath(p_path)) {
+ t_size walk = 0;
+ if (pfc::strcmp_partial(p_path,"file://") == 0) walk += strlen("file://");
+ create_path_internal(p_path,walk + 3,p_abort);
+ } else if (test_netpath(p_path)) {
+ t_size walk = 0;
+ if (pfc::strcmp_partial(p_path,"file://") == 0) walk += strlen("file://");
+ while(p_path[walk] == '\\') walk++;
+ while(p_path[walk] != 0 && p_path[walk] != '\\') walk++;
+ while(p_path[walk] == '\\') walk++;
+ while(p_path[walk] != 0 && p_path[walk] != '\\') walk++;
+ while(p_path[walk] == '\\') walk++;
+ create_path_internal(p_path,walk,p_abort);
+ } else {
+ throw exception_io("Could not create directory structure; unknown path format");
+ }
+ }
+
+ static bool is_bad_dirchar(char c)
+ {
+ return c==' ' || c=='.';
+ }
+
+ void make_path(const char * parent,const char * filename,const char * extension,bool allow_new_dirs,pfc::string8 & out,bool really_create_dirs,abort_callback & p_abort)
+ {
+ out.reset();
+ if (parent && *parent)
+ {
+ out = parent;
+ out.fix_dir_separator('\\');
+ }
+ bool last_char_is_dir_sep = true;
+ while(*filename)
+ {
+#ifdef WIN32
+ if (allow_new_dirs && is_bad_dirchar(*filename))
+ {
+ const char * ptr = filename+1;
+ while(is_bad_dirchar(*ptr)) ptr++;
+ if (*ptr!='\\' && *ptr!='/') out.add_string(filename,ptr-filename);
+ filename = ptr;
+ if (*filename==0) break;
+ }
+#endif
+ if (pfc::is_path_bad_char(*filename))
+ {
+ if (allow_new_dirs && (*filename=='\\' || *filename=='/'))
+ {
+ if (!last_char_is_dir_sep)
+ {
+ if (really_create_dirs) try{filesystem::g_create_directory(out,p_abort);}catch(exception_io_already_exists){}
+ out.add_char('\\');
+ last_char_is_dir_sep = true;
+ }
+ }
+ else
+ out.add_char('_');
+ }
+ else
+ {
+ out.add_byte(*filename);
+ last_char_is_dir_sep = false;
+ }
+ filename++;
+ }
+ if (out.length()>0 && out[out.length()-1]=='\\')
+ {
+ out.add_string("noname");
+ }
+ if (extension && *extension)
+ {
+ out.add_char('.');
+ out.add_string(extension);
+ }
+ }
+}
+
+pfc::string create_directory_helper::sanitize_formatted_path(pfc::stringp formatted, bool allowWC) {
+ pfc::string out;
+ t_size curSegBase = 0;
+ for(t_size walk = 0; ; ++walk) {
+ const char c = formatted[walk];
+ if (c == 0 || pfc::io::path::isSeparator(c)) {
+ if (curSegBase < walk) {
+ pfc::string seg( formatted + curSegBase, walk - curSegBase );
+ out = pfc::io::path::combine(out, pfc::io::path::validateFileName(seg, allowWC));
+ }
+ if (c == 0) break;
+ curSegBase = walk + 1;
+ }
+ }
+ return out;
+};
+
+void create_directory_helper::format_filename_ex(const metadb_handle_ptr & handle,titleformat_hook * p_hook,titleformat_object::ptr spec,const char * suffix, pfc::string_base & out) {
+ pfc::string_formatter formatted;
+ handle->format_title(p_hook,formatted,spec,&titleformat_text_filter_myimpl());
+ formatted << suffix;
+ out = sanitize_formatted_path(formatted).ptr();
+}
+void create_directory_helper::format_filename(const metadb_handle_ptr & handle,titleformat_hook * p_hook,titleformat_object::ptr spec,pfc::string_base & out) {
+ format_filename_ex(handle, p_hook, spec, "", out);
+}
+void create_directory_helper::format_filename(const metadb_handle_ptr & handle,titleformat_hook * p_hook,const char * spec,pfc::string_base & out)
+{
+ service_ptr_t<titleformat_object> script;
+ if (static_api_ptr_t<titleformat_compiler>()->compile(script,spec)) {
+ format_filename(handle, p_hook, script, out);
+ } else {
+ out.reset();
+ }
+}
+
+void create_directory_helper::titleformat_text_filter_myimpl::write(const GUID & p_inputType,pfc::string_receiver & p_out,const char * p_data,t_size p_dataLength) {
+ if (p_inputType == titleformat_inputtypes::meta) {
+ pfc::string_formatter temp;
+ for(t_size walk = 0; walk < p_dataLength; ++walk) {
+ char c = p_data[walk];
+ if (c == 0) break;
+ if (pfc::io::path::isSeparator(c)) {
+ c = '-';
+ }
+ temp.add_byte(c);
+ }
+ p_out.add_string(temp);
+ } else p_out.add_string(p_data,p_dataLength);
+}
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/create_directory_helper.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/create_directory_helper.h new file mode 100644 index 0000000000..ba58111911 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/create_directory_helper.h @@ -0,0 +1,20 @@ +#ifndef _CREATE_DIRECTORY_HELPER_H_
+#define _CREATE_DIRECTORY_HELPER_H_
+
+namespace create_directory_helper {
+ void create_path(const char * p_path,abort_callback & p_abort);
+ void make_path(const char * parent,const char * filename,const char * extension,bool allow_new_dirs,pfc::string8 & out,bool b_really_create_dirs,abort_callback & p_dir_create_abort);
+ void format_filename(const metadb_handle_ptr & handle,titleformat_hook * p_hook,const char * spec,pfc::string_base & out);
+ void format_filename(const metadb_handle_ptr & handle,titleformat_hook * p_hook,titleformat_object::ptr spec,pfc::string_base & out);
+ void format_filename_ex(const metadb_handle_ptr & handle,titleformat_hook * p_hook,titleformat_object::ptr spec,const char * suffix, pfc::string_base & out);
+
+ pfc::string sanitize_formatted_path(pfc::stringp str, bool allowWC = false);
+
+ class titleformat_text_filter_myimpl : public titleformat_text_filter {
+ public:
+ void write(const GUID & p_inputType,pfc::string_receiver & p_out,const char * p_data,t_size p_dataLength);
+ };
+
+};
+
+#endif//_CREATE_DIRECTORY_HELPER_H_
\ No newline at end of file diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/cue_creator.cpp b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/cue_creator.cpp new file mode 100644 index 0000000000..8752c12472 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/cue_creator.cpp @@ -0,0 +1,177 @@ +#include "stdafx.h"
+
+
+namespace {
+
+ class format_meta
+ {
+ public:
+ format_meta(const file_info & p_source,const char * p_name,bool p_allow_space = true)
+ {
+ p_source.meta_format(p_name,m_buffer);
+ m_buffer.replace_byte('\"','\'');
+ uReplaceString(m_buffer,pfc::string8(m_buffer),pfc_infinite,"\x0d\x0a",2,"\\",1,false);
+ if (!p_allow_space) m_buffer.replace_byte(' ','_');
+ m_buffer.replace_nontext_chars();
+ }
+ inline operator const char*() const {return m_buffer;}
+ private:
+ pfc::string8_fastalloc m_buffer;
+ };
+}
+
+static bool is_meta_same_everywhere(const cue_creator::t_entry_list & p_list,const char * p_meta)
+{
+ pfc::string8_fastalloc reference,temp;
+
+ cue_creator::t_entry_list::const_iterator iter;
+ iter = p_list.first();
+ if (!iter.is_valid()) return false;
+ if (!iter->m_infos.meta_format(p_meta,reference)) return false;
+ for (;iter.is_valid();++iter)
+ {
+ if (!iter->m_infos.meta_format(p_meta,temp)) return false;
+ if (strcmp(temp,reference)!=0) return false;
+ }
+ return true;
+}
+
+static const char g_eol[] = "\r\n";
+
+
+namespace cue_creator
+{
+ void create(pfc::string_formatter & p_out,const t_entry_list & p_data)
+ {
+ if (p_data.get_count() == 0) return;
+ bool album_artist_global = is_meta_same_everywhere(p_data,"album artist"),
+ artist_global = is_meta_same_everywhere(p_data,"artist"),
+ album_global = is_meta_same_everywhere(p_data,"album"),
+ genre_global = is_meta_same_everywhere(p_data,"genre"),
+ date_global = is_meta_same_everywhere(p_data,"date"),
+ discid_global = is_meta_same_everywhere(p_data,"discid"),
+ comment_global = is_meta_same_everywhere(p_data,"comment"),
+ catalog_global = is_meta_same_everywhere(p_data,"catalog"),
+ songwriter_global = is_meta_same_everywhere(p_data,"songwriter");
+
+ if (genre_global) {
+ p_out << "REM GENRE " << format_meta(p_data.first()->m_infos,"genre") << g_eol;
+ }
+ if (date_global) {
+ p_out << "REM DATE " << format_meta(p_data.first()->m_infos,"date") << g_eol;
+ }
+ if (discid_global) {
+ p_out << "REM DISCID " << format_meta(p_data.first()->m_infos,"discid") << g_eol;
+ }
+ if (comment_global) {
+ p_out << "REM COMMENT " << format_meta(p_data.first()->m_infos,"comment") << g_eol;
+ }
+ if (catalog_global) {
+ p_out << "CATALOG " << format_meta(p_data.first()->m_infos,"catalog") << g_eol;
+ }
+ if (songwriter_global) {
+ p_out << "SONGWRITER \"" << format_meta(p_data.first()->m_infos,"songwriter") << "\"" << g_eol;
+ }
+
+ if (album_artist_global)
+ {
+ p_out << "PERFORMER \"" << format_meta(p_data.first()->m_infos,"album artist") << "\"" << g_eol;
+ artist_global = false;
+ }
+ else if (artist_global)
+ {
+ p_out << "PERFORMER \"" << format_meta(p_data.first()->m_infos,"artist") << "\"" << g_eol;
+ }
+ if (album_global)
+ {
+ p_out << "TITLE \"" << format_meta(p_data.first()->m_infos,"album") << "\"" << g_eol;
+ }
+
+ {
+ replaygain_info::t_text_buffer rgbuffer;
+ replaygain_info rg = p_data.first()->m_infos.get_replaygain();
+ if (rg.format_album_gain(rgbuffer))
+ p_out << "REM REPLAYGAIN_ALBUM_GAIN " << rgbuffer << g_eol;
+ if (rg.format_album_peak(rgbuffer))
+ p_out << "REM REPLAYGAIN_ALBUM_PEAK " << rgbuffer << g_eol;
+ }
+
+ pfc::string8 last_file;
+
+ for(t_entry_list::const_iterator iter = p_data.first();iter.is_valid();++iter)
+ {
+ if (strcmp(last_file,iter->m_file) != 0)
+ {
+ p_out << "FILE \"" << iter->m_file << "\" WAVE" << g_eol;
+ last_file = iter->m_file;
+ }
+
+ p_out << " TRACK " << pfc::format_int(iter->m_track_number,2) << " AUDIO" << g_eol;
+
+ if (iter->m_infos.meta_find("title") != pfc_infinite)
+ p_out << " TITLE \"" << format_meta(iter->m_infos,"title") << "\"" << g_eol;
+
+ if (!artist_global && iter->m_infos.meta_find("artist") != pfc_infinite)
+ p_out << " PERFORMER \"" << format_meta(iter->m_infos,"artist") << "\"" << g_eol;
+
+ if (!songwriter_global && iter->m_infos.meta_find("songwriter") != pfc_infinite) {
+ p_out << " SONGWRITER \"" << format_meta(iter->m_infos,"songwriter") << "\"" << g_eol;
+ }
+
+ if (iter->m_infos.meta_find("isrc") != pfc_infinite) {
+ p_out << " ISRC " << format_meta(iter->m_infos,"isrc") << g_eol;
+ }
+
+ if (!date_global && iter->m_infos.meta_find("date") != pfc_infinite) {
+ p_out << " REM DATE " << format_meta(iter->m_infos,"date") << g_eol;
+ }
+
+
+
+ {
+ replaygain_info::t_text_buffer rgbuffer;
+ replaygain_info rg = iter->m_infos.get_replaygain();
+ if (rg.format_track_gain(rgbuffer))
+ p_out << " REM REPLAYGAIN_TRACK_GAIN " << rgbuffer << g_eol;
+ if (rg.format_track_peak(rgbuffer))
+ p_out << " REM REPLAYGAIN_TRACK_PEAK " << rgbuffer << g_eol;
+ }
+
+ if (!iter->m_flags.is_empty()) {
+ p_out << " FLAGS " << iter->m_flags << g_eol;
+ }
+
+ if (iter->m_index_list.m_positions[0] < iter->m_index_list.m_positions[1])
+ {
+ if (iter->m_index_list.m_positions[0] < 0)
+ p_out << " PREGAP " << cuesheet_format_index_time(iter->m_index_list.m_positions[1] - iter->m_index_list.m_positions[0]) << g_eol;
+ else
+ p_out << " INDEX 00 " << cuesheet_format_index_time(iter->m_index_list.m_positions[0]) << g_eol;
+ }
+
+ p_out << " INDEX 01 " << cuesheet_format_index_time(iter->m_index_list.m_positions[1]) << g_eol;
+
+ for(unsigned n=2;n<t_cuesheet_index_list::count && iter->m_index_list.m_positions[n] > 0;n++)
+ {
+ p_out << " INDEX " << pfc::format_uint(n,2) << " " << cuesheet_format_index_time(iter->m_index_list.m_positions[n]) << g_eol;
+ }
+
+ // p_out << " INDEX 01 " << cuesheet_format_index_time(iter->m_offset) << g_eol;
+ }
+ }
+
+
+ void t_entry::set_simple_index(double p_time)
+ {
+ m_index_list.reset();
+ m_index_list.m_positions[0] = m_index_list.m_positions[1] = p_time;
+ }
+ void t_entry::set_index01(double index0, double index1) {
+ PFC_ASSERT( index0 <= index1 );
+ m_index_list.reset();
+ m_index_list.m_positions[0] = index0;
+ m_index_list.m_positions[1] = index1;
+ }
+
+}
+
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/cue_creator.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/cue_creator.h new file mode 100644 index 0000000000..235a5306c9 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/cue_creator.h @@ -0,0 +1,18 @@ +namespace cue_creator
+{
+ struct t_entry
+ {
+ file_info_impl m_infos;
+ pfc::string8 m_file,m_flags;
+ unsigned m_track_number;
+
+ t_cuesheet_index_list m_index_list;
+
+ void set_simple_index(double p_time);
+ void set_index01(double index0, double index1);
+ };
+
+ typedef pfc::chain_list_v2_t<t_entry> t_entry_list;
+
+ void create(pfc::string_formatter & p_out,const t_entry_list & p_list);
+};
\ No newline at end of file diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/cue_parser.cpp b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/cue_parser.cpp new file mode 100644 index 0000000000..2630bbff83 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/cue_parser.cpp @@ -0,0 +1,764 @@ +#include "stdafx.h"
+
+namespace {
+ PFC_DECLARE_EXCEPTION(exception_cue,pfc::exception,"Invalid cuesheet");
+}
+
+static bool is_numeric(char c) {return c>='0' && c<='9';}
+
+
+static bool is_spacing(char c)
+{
+ return c == ' ' || c == '\t';
+}
+
+static bool is_linebreak(char c)
+{
+ return c == '\n' || c == '\r';
+}
+
+static void validate_file_type(const char * p_type,t_size p_type_length) {
+ if (
+ //standard types
+ stricmp_utf8_ex(p_type,p_type_length,"WAVE",pfc_infinite) != 0 &&
+ stricmp_utf8_ex(p_type,p_type_length,"MP3",pfc_infinite) != 0 &&
+ stricmp_utf8_ex(p_type,p_type_length,"AIFF",pfc_infinite) != 0 &&
+ //common user-entered types
+ stricmp_utf8_ex(p_type,p_type_length,"APE",pfc_infinite) != 0 &&
+ stricmp_utf8_ex(p_type,p_type_length,"FLAC",pfc_infinite) != 0 &&
+ stricmp_utf8_ex(p_type,p_type_length,"WV",pfc_infinite) != 0 &&
+ stricmp_utf8_ex(p_type,p_type_length,"WAVPACK",pfc_infinite) != 0
+ )
+ throw exception_cue(pfc::string_formatter() << "expected WAVE, MP3 or AIFF, got : \"" << pfc::string_part(p_type,p_type_length) << "\"");
+}
+
+namespace {
+
+ class NOVTABLE cue_parser_callback
+ {
+ public:
+ virtual void on_file(const char * p_file,t_size p_file_length,const char * p_type,t_size p_type_length) = 0;
+ virtual void on_track(unsigned p_index,const char * p_type,t_size p_type_length) = 0;
+ virtual void on_pregap(unsigned p_value) = 0;
+ virtual void on_index(unsigned p_index,unsigned p_value) = 0;
+ virtual void on_title(const char * p_title,t_size p_title_length) = 0;
+ virtual void on_performer(const char * p_performer,t_size p_performer_length) = 0;
+ virtual void on_songwriter(const char * p_songwriter,t_size p_songwriter_length) = 0;
+ virtual void on_isrc(const char * p_isrc,t_size p_isrc_length) = 0;
+ virtual void on_catalog(const char * p_catalog,t_size p_catalog_length) = 0;
+ virtual void on_comment(const char * p_comment,t_size p_comment_length) = 0;
+ virtual void on_flags(const char * p_flags,t_size p_flags_length) = 0;
+ };
+
+ class NOVTABLE cue_parser_callback_meta : public cue_parser_callback
+ {
+ public:
+ virtual void on_file(const char * p_file,t_size p_file_length,const char * p_type,t_size p_type_length) = 0;
+ virtual void on_track(unsigned p_index,const char * p_type,t_size p_type_length) = 0;
+ virtual void on_pregap(unsigned p_value) = 0;
+ virtual void on_index(unsigned p_index,unsigned p_value) = 0;
+ virtual void on_meta(const char * p_name,t_size p_name_length,const char * p_value,t_size p_value_length) = 0;
+ protected:
+ static bool is_known_meta(const char * p_name,t_size p_length)
+ {
+ static const char * metas[] = {"genre","date","discid","comment","replaygain_track_gain","replaygain_track_peak","replaygain_album_gain","replaygain_album_peak"};
+ for(t_size n=0;n<PFC_TABSIZE(metas);n++) {
+ if (!stricmp_utf8_ex(p_name,p_length,metas[n],pfc_infinite)) return true;
+ }
+ return false;
+ }
+
+ void on_comment(const char * p_comment,t_size p_comment_length)
+ {
+ unsigned ptr = 0;
+ while(ptr < p_comment_length && !is_spacing(p_comment[ptr])) ptr++;
+ if (is_known_meta(p_comment, ptr))
+ {
+ unsigned name_length = ptr;
+ while(ptr < p_comment_length && is_spacing(p_comment[ptr])) ptr++;
+ if (ptr < p_comment_length)
+ {
+ if (p_comment[ptr] == '\"')
+ {
+ ptr++;
+ unsigned value_base = ptr;
+ while(ptr < p_comment_length && p_comment[ptr] != '\"') ptr++;
+ if (ptr == p_comment_length) throw exception_cue("invalid REM syntax",0);
+ if (ptr > value_base) on_meta(p_comment,name_length,p_comment + value_base,ptr - value_base);
+ }
+ else
+ {
+ unsigned value_base = ptr;
+ while(ptr < p_comment_length /*&& !is_spacing(p_comment[ptr])*/) ptr++;
+ if (ptr > value_base) on_meta(p_comment,name_length,p_comment + value_base,ptr - value_base);
+ }
+ }
+ }
+ }
+ void on_title(const char * p_title,t_size p_title_length)
+ {
+ on_meta("title",pfc_infinite,p_title,p_title_length);
+ }
+ void on_songwriter(const char * p_songwriter,t_size p_songwriter_length) {
+ on_meta("songwriter",pfc_infinite,p_songwriter,p_songwriter_length);
+ }
+ void on_performer(const char * p_performer,t_size p_performer_length)
+ {
+ on_meta("artist",pfc_infinite,p_performer,p_performer_length);
+ }
+
+ void on_isrc(const char * p_isrc,t_size p_isrc_length)
+ {
+ on_meta("isrc",pfc_infinite,p_isrc,p_isrc_length);
+ }
+ void on_catalog(const char * p_catalog,t_size p_catalog_length)
+ {
+ on_meta("catalog",pfc_infinite,p_catalog,p_catalog_length);
+ }
+ void on_flags(const char * p_flags,t_size p_flags_length) {}
+ };
+
+
+ class cue_parser_callback_retrievelist : public cue_parser_callback
+ {
+ public:
+ cue_parser_callback_retrievelist(cue_parser::t_cue_entry_list & p_out) : m_out(p_out), m_track(0), m_pregap(0), m_index0_set(false), m_index1_set(false)
+ {
+ }
+
+ void on_file(const char * p_file,t_size p_file_length,const char * p_type,t_size p_type_length)
+ {
+ validate_file_type(p_type,p_type_length);
+ m_file.set_string(p_file,p_file_length);
+ }
+
+ void on_track(unsigned p_index,const char * p_type,t_size p_type_length)
+ {
+ if (stricmp_utf8_ex(p_type,p_type_length,"audio",pfc_infinite)) throw exception_cue("only tracks of type AUDIO supported",0);
+ //if (p_index != m_track + 1) throw exception_cue("cuesheet tracks out of order");
+ if (m_track != 0) finalize_track();
+ if (m_file.is_empty()) throw exception_cue("declaring a track with no file set",0);
+ m_trackfile = m_file;
+ m_track = p_index;
+ }
+
+ void on_pregap(unsigned p_value) {m_pregap = (double) p_value / 75.0;}
+
+ void on_index(unsigned p_index,unsigned p_value)
+ {
+ if (p_index < t_cuesheet_index_list::count)
+ {
+ switch(p_index)
+ {
+ case 0: m_index0_set = true; break;
+ case 1: m_index1_set = true; break;
+ }
+ m_index_list.m_positions[p_index] = (double) p_value / 75.0;
+ }
+ }
+
+ void on_title(const char * p_title,t_size p_title_length) {}
+ void on_performer(const char * p_performer,t_size p_performer_length) {}
+ void on_songwriter(const char * p_songwriter,t_size p_songwriter_length) {}
+ void on_isrc(const char * p_isrc,t_size p_isrc_length) {}
+ void on_catalog(const char * p_catalog,t_size p_catalog_length) {}
+ void on_comment(const char * p_comment,t_size p_comment_length) {}
+ void on_flags(const char * p_flags,t_size p_flags_length) {}
+
+ void finalize()
+ {
+ if (m_track != 0)
+ {
+ finalize_track();
+ m_track = 0;
+ }
+ }
+
+ private:
+ void finalize_track()
+ {
+ if (!m_index1_set) throw exception_cue("INDEX 01 not set",0);
+ if (!m_index0_set) m_index_list.m_positions[0] = m_index_list.m_positions[1] - m_pregap;
+ if (!m_index_list.is_valid()) throw exception_cue("invalid index list");
+
+ cue_parser::t_cue_entry_list::iterator iter;
+ iter = m_out.insert_last();
+ if (m_trackfile.is_empty()) throw exception_cue("track has no file assigned",0);
+ iter->m_file = m_trackfile;
+ iter->m_track_number = m_track;
+ iter->m_indexes = m_index_list;
+
+ m_index_list.reset();
+ m_index0_set = false;
+ m_index1_set = false;
+ m_pregap = 0;
+ }
+
+ bool m_index0_set,m_index1_set;
+ t_cuesheet_index_list m_index_list;
+ double m_pregap;
+ unsigned m_track;
+ pfc::string8 m_file,m_trackfile;
+ cue_parser::t_cue_entry_list & m_out;
+ };
+
+ class cue_parser_callback_retrieveinfo : public cue_parser_callback_meta
+ {
+ public:
+ cue_parser_callback_retrieveinfo(file_info & p_out,unsigned p_wanted_track) : m_out(p_out), m_wanted_track(p_wanted_track), m_track(0), m_is_va(false), m_index0_set(false), m_index1_set(false), m_pregap(0), m_totaltracks(0) {}
+
+ void on_file(const char * p_file,t_size p_file_length,const char * p_type,t_size p_type_length) {}
+
+ void on_track(unsigned p_index,const char * p_type,t_size p_type_length)
+ {
+ if (p_index == 0) throw exception_cue("invalid TRACK index",0);
+ if (p_index == m_wanted_track)
+ {
+ if (stricmp_utf8_ex(p_type,p_type_length,"audio",pfc_infinite)) throw exception_cue("only tracks of type AUDIO supported",0);
+ }
+ m_track = p_index;
+ m_totaltracks++;
+ }
+
+ void on_pregap(unsigned p_value) {if (m_track == m_wanted_track) m_pregap = (double) p_value / 75.0;}
+
+ void on_index(unsigned p_index,unsigned p_value)
+ {
+ if (m_track == m_wanted_track && p_index < t_cuesheet_index_list::count)
+ {
+ switch(p_index)
+ {
+ case 0: m_index0_set = true; break;
+ case 1: m_index1_set = true; break;
+ }
+ m_indexes.m_positions[p_index] = (double) p_value / 75.0;
+ }
+ }
+
+
+ void on_meta(const char * p_name,t_size p_name_length,const char * p_value,t_size p_value_length)
+ {
+ t_meta_list::iterator iter;
+ if (m_track == 0) //globals
+ {
+ //convert global title to album
+ if (!stricmp_utf8_ex(p_name,p_name_length,"title",pfc_infinite))
+ {
+ p_name = "album";
+ p_name_length = 5;
+ }
+ else if (!stricmp_utf8_ex(p_name,p_name_length,"artist",pfc_infinite))
+ {
+ m_album_artist.set_string(p_value,p_value_length);
+ }
+
+ iter = m_globals.insert_last();
+ }
+ else
+ {
+ if (!m_is_va)
+ {
+ if (!stricmp_utf8_ex(p_name,p_name_length,"artist",pfc_infinite))
+ {
+ if (!m_album_artist.is_empty())
+ {
+ if (stricmp_utf8_ex(p_value,p_value_length,m_album_artist,m_album_artist.length())) m_is_va = true;
+ }
+ }
+ }
+
+ if (m_track == m_wanted_track) //locals
+ {
+ iter = m_locals.insert_last();
+ }
+ }
+ if (iter.is_valid())
+ {
+ iter->m_name.set_string(p_name,p_name_length);
+ iter->m_value.set_string(p_value,p_value_length);
+ }
+ }
+
+ void finalize()
+ {
+ if (!m_index1_set) throw exception_cue("INDEX 01 not set",0);
+ if (!m_index0_set) m_indexes.m_positions[0] = m_indexes.m_positions[1] - m_pregap;
+ m_indexes.to_infos(m_out);
+
+ replaygain_info rg;
+ rg.reset();
+ t_meta_list::const_iterator iter;
+
+ if (m_is_va)
+ {
+ //clean up VA mess
+
+ t_meta_list::const_iterator iter_global,iter_local;
+
+ iter_global = find_first_field(m_globals,"artist");
+ iter_local = find_first_field(m_locals,"artist");
+ if (iter_global.is_valid())
+ {
+ m_out.meta_set("album artist",iter_global->m_value);
+ if (iter_local.is_valid()) m_out.meta_set("artist",iter_local->m_value);
+ else m_out.meta_set("artist",iter_global->m_value);
+ }
+ else
+ {
+ if (iter_local.is_valid()) m_out.meta_set("artist",iter_local->m_value);
+ }
+
+
+ wipe_field(m_globals,"artist");
+ wipe_field(m_locals,"artist");
+
+ }
+
+ for(iter=m_globals.first();iter.is_valid();iter++)
+ {
+ if (!rg.set_from_meta(iter->m_name,iter->m_value))
+ m_out.meta_set(iter->m_name,iter->m_value);
+ }
+ for(iter=m_locals.first();iter.is_valid();iter++)
+ {
+ if (!rg.set_from_meta(iter->m_name,iter->m_value))
+ m_out.meta_set(iter->m_name,iter->m_value);
+ }
+ m_out.meta_set("tracknumber",pfc::string_formatter() << m_wanted_track);
+ m_out.meta_set("totaltracks", pfc::string_formatter() << m_totaltracks);
+ m_out.set_replaygain(rg);
+
+ }
+ private:
+ struct t_meta_entry {
+ pfc::string8 m_name,m_value;
+ };
+ typedef pfc::chain_list_v2_t<t_meta_entry> t_meta_list;
+
+ static t_meta_list::const_iterator find_first_field(t_meta_list const & p_list,const char * p_field)
+ {
+ t_meta_list::const_iterator iter;
+ for(iter=p_list.first();iter.is_valid();++iter)
+ {
+ if (!stricmp_utf8(p_field,iter->m_name)) return iter;
+ }
+ return t_meta_list::const_iterator();//null iterator
+ }
+
+ static void wipe_field(t_meta_list & p_list,const char * p_field)
+ {
+ t_meta_list::iterator iter;
+ for(iter=p_list.first();iter.is_valid();)
+ {
+ if (!stricmp_utf8(p_field,iter->m_name))
+ {
+ t_meta_list::iterator temp = iter;
+ ++temp;
+ p_list.remove_single(iter);
+ iter = temp;
+ }
+ else
+ {
+ ++iter;
+ }
+ }
+ }
+
+ t_meta_list m_globals,m_locals;
+ file_info & m_out;
+ unsigned m_wanted_track, m_track,m_totaltracks;
+ pfc::string8 m_album_artist;
+ bool m_is_va;
+ t_cuesheet_index_list m_indexes;
+ bool m_index0_set,m_index1_set;
+ double m_pregap;
+ };
+
+};
+
+
+static void g_parse_cue_line(const char * p_line,t_size p_line_length,cue_parser_callback & p_callback)
+{
+ t_size ptr = 0;
+ while(ptr < p_line_length && !is_spacing(p_line[ptr])) ptr++;
+ if (!stricmp_utf8_ex(p_line,ptr,"file",pfc_infinite))
+ {
+ while(ptr < p_line_length && is_spacing(p_line[ptr])) ptr++;
+ t_size file_base,file_length, type_base,type_length;
+
+ if (p_line[ptr] == '\"')
+ {
+ ptr++;
+ file_base = ptr;
+ while(ptr < p_line_length && p_line[ptr] != '\"') ptr++;
+ if (ptr == p_line_length) throw exception_cue("invalid FILE syntax",0);
+ file_length = ptr - file_base;
+ ptr++;
+ while(ptr < p_line_length && is_spacing(p_line[ptr])) ptr++;
+ }
+ else
+ {
+ file_base = ptr;
+ while(ptr < p_line_length && !is_spacing(p_line[ptr])) ptr++;
+ file_length = ptr - file_base;
+ while(ptr < p_line_length && is_spacing(p_line[ptr])) ptr++;
+ }
+
+ type_base = ptr;
+ while(ptr < p_line_length && !is_spacing(p_line[ptr])) ptr++;
+ type_length = ptr - type_base;
+ while(ptr < p_line_length && is_spacing(p_line[ptr])) ptr++;
+
+ if (ptr != p_line_length || file_length == 0 || type_length == 0) throw exception_cue("invalid FILE syntax",0);
+
+ p_callback.on_file(p_line + file_base, file_length, p_line + type_base, type_length);
+ }
+ else if (!stricmp_utf8_ex(p_line,ptr,"track",pfc_infinite))
+ {
+ while(ptr < p_line_length && is_spacing(p_line[ptr])) ptr++;
+
+ t_size track_base = ptr, track_length;
+ while(ptr < p_line_length && !is_spacing(p_line[ptr]))
+ {
+ if (!is_numeric(p_line[ptr])) throw exception_cue("invalid TRACK syntax",0);
+ ptr++;
+ }
+ track_length = ptr - track_base;
+ while(ptr < p_line_length && is_spacing(p_line[ptr])) ptr++;
+
+ t_size type_base = ptr, type_length;
+ while(ptr < p_line_length && !is_spacing(p_line[ptr])) ptr++;
+ type_length = ptr - type_base;
+
+ while(ptr < p_line_length && is_spacing(p_line[ptr])) ptr++;
+ if (ptr != p_line_length || type_length == 0) throw exception_cue("invalid TRACK syntax",0);
+ unsigned track = pfc::atoui_ex(p_line+track_base,track_length);
+ if (track < 1 || track > 99) throw exception_cue("invalid track number",0);
+
+ p_callback.on_track(track,p_line + type_base, type_length);
+ }
+ else if (!stricmp_utf8_ex(p_line,ptr,"index",pfc_infinite))
+ {
+ while(ptr < p_line_length && is_spacing(p_line[ptr])) ptr++;
+
+ t_size index_base,index_length, time_base,time_length;
+ index_base = ptr;
+ while(ptr < p_line_length && !is_spacing(p_line[ptr]))
+ {
+ if (!is_numeric(p_line[ptr])) throw exception_cue("invalid INDEX syntax",0);
+ ptr++;
+ }
+ index_length = ptr - index_base;
+
+ while(ptr < p_line_length && is_spacing(p_line[ptr])) ptr++;
+ time_base = ptr;
+ while(ptr < p_line_length && !is_spacing(p_line[ptr]))
+ {
+ if (!is_numeric(p_line[ptr]) && p_line[ptr] != ':')
+ throw exception_cue("invalid INDEX syntax",0);
+ ptr++;
+ }
+ time_length = ptr - time_base;
+
+ while(ptr < p_line_length && is_spacing(p_line[ptr])) ptr++;
+
+ if (ptr != p_line_length || index_length == 0 || time_length == 0)
+ throw exception_cue("invalid INDEX syntax",0);
+
+ unsigned index = pfc::atoui_ex(p_line+index_base,index_length);
+ if (index > 99) throw exception_cue("invalid INDEX syntax",0);
+ unsigned time = cuesheet_parse_index_time_ticks_e(p_line + time_base,time_length);
+
+ p_callback.on_index(index,time);
+ }
+ else if (!stricmp_utf8_ex(p_line,ptr,"pregap",pfc_infinite))
+ {
+ while(ptr < p_line_length && is_spacing(p_line[ptr])) ptr++;
+
+ t_size time_base, time_length;
+ time_base = ptr;
+ while(ptr < p_line_length && !is_spacing(p_line[ptr]))
+ {
+ if (!is_numeric(p_line[ptr]) && p_line[ptr] != ':')
+ throw exception_cue("invalid PREGAP syntax",0);
+ ptr++;
+ }
+ time_length = ptr - time_base;
+
+ while(ptr < p_line_length && is_spacing(p_line[ptr])) ptr++;
+
+ if (ptr != p_line_length || time_length == 0)
+ throw exception_cue("invalid PREGAP syntax",0);
+
+ unsigned time = cuesheet_parse_index_time_ticks_e(p_line + time_base,time_length);
+
+ p_callback.on_pregap(time);
+ }
+ else if (!stricmp_utf8_ex(p_line,ptr,"title",pfc_infinite))
+ {
+ while(ptr < p_line_length && is_spacing(p_line[ptr])) ptr++;
+ if (ptr == p_line_length) throw exception_cue("invalid TITLE syntax",0);
+ if (p_line[ptr] == '\"')
+ {
+ ptr++;
+ t_size base = ptr;
+ while(ptr < p_line_length && p_line[ptr] != '\"') ptr++;
+ if (ptr == p_line_length) throw exception_cue("invalid TITLE syntax",0);
+ t_size length = ptr-base;
+ ptr++;
+ while(ptr < p_line_length && is_spacing(p_line[ptr])) ptr++;
+ if (ptr != p_line_length) throw exception_cue("invalid TITLE syntax",0);
+ p_callback.on_title(p_line+base,length);
+ }
+ else
+ {
+ p_callback.on_title(p_line+ptr,p_line_length-ptr);
+ }
+ }
+ else if (!stricmp_utf8_ex(p_line,ptr,"performer",pfc_infinite))
+ {
+ while(ptr < p_line_length && is_spacing(p_line[ptr])) ptr++;
+ if (ptr == p_line_length) throw exception_cue("invalid PERFORMER syntax",0);
+ if (p_line[ptr] == '\"')
+ {
+ ptr++;
+ t_size base = ptr;
+ while(ptr < p_line_length && p_line[ptr] != '\"') ptr++;
+ if (ptr == p_line_length) throw exception_cue("invalid PERFORMER syntax",0);
+ t_size length = ptr-base;
+ ptr++;
+ while(ptr < p_line_length && is_spacing(p_line[ptr])) ptr++;
+ if (ptr != p_line_length) throw exception_cue("invalid PERFORMER syntax",0);
+ p_callback.on_performer(p_line+base,length);
+ }
+ else
+ {
+ p_callback.on_performer(p_line+ptr,p_line_length-ptr);
+ }
+ }
+ else if (!stricmp_utf8_ex(p_line,ptr,"songwriter",pfc_infinite))
+ {
+ while(ptr < p_line_length && is_spacing(p_line[ptr])) ptr++;
+ if (ptr == p_line_length) throw exception_cue("invalid SONGWRITER syntax",0);
+ if (p_line[ptr] == '\"')
+ {
+ ptr++;
+ t_size base = ptr;
+ while(ptr < p_line_length && p_line[ptr] != '\"') ptr++;
+ if (ptr == p_line_length) throw exception_cue("invalid SONGWRITER syntax",0);
+ t_size length = ptr-base;
+ ptr++;
+ while(ptr < p_line_length && is_spacing(p_line[ptr])) ptr++;
+ if (ptr != p_line_length) throw exception_cue("invalid SONGWRITER syntax",0);
+ p_callback.on_songwriter(p_line+base,length);
+ }
+ else
+ {
+ p_callback.on_songwriter(p_line+ptr,p_line_length-ptr);
+ }
+ }
+ else if (!stricmp_utf8_ex(p_line,ptr,"isrc",pfc_infinite))
+ {
+ while(ptr < p_line_length && is_spacing(p_line[ptr])) ptr++;
+ t_size length = p_line_length - ptr;
+ if (length == 0) throw exception_cue("invalid ISRC syntax",0);
+ p_callback.on_isrc(p_line+ptr,length);
+ }
+ else if (!stricmp_utf8_ex(p_line,ptr,"catalog",pfc_infinite))
+ {
+ while(ptr < p_line_length && is_spacing(p_line[ptr])) ptr++;
+ t_size length = p_line_length - ptr;
+ if (length == 0) throw exception_cue("invalid CATALOG syntax",0);
+ p_callback.on_catalog(p_line+ptr,length);
+ }
+ else if (!stricmp_utf8_ex(p_line,ptr,"flags",pfc_infinite))
+ {
+ while(ptr < p_line_length && is_spacing(p_line[ptr])) ptr++;
+ if (ptr < p_line_length)
+ p_callback.on_flags(p_line + ptr, p_line_length - ptr);
+ }
+ else if (!stricmp_utf8_ex(p_line,ptr,"rem",pfc_infinite))
+ {
+ while(ptr < p_line_length && is_spacing(p_line[ptr])) ptr++;
+ if (ptr < p_line_length)
+ p_callback.on_comment(p_line + ptr, p_line_length - ptr);
+ }
+ else if (!stricmp_utf8_ex(p_line,ptr,"postgap",pfc_infinite)) {
+ throw exception_cue("POSTGAP is not supported",0);
+ } else if (!stricmp_utf8_ex(p_line,ptr,"cdtextfile",pfc_infinite)) {
+ //do nothing
+ }
+ else throw exception_cue("unknown cuesheet item",0);
+}
+
+static void g_parse_cue(const char * p_cuesheet,cue_parser_callback & p_callback)
+{
+ const char * parseptr = p_cuesheet;
+ t_size lineidx = 1;
+ while(*parseptr)
+ {
+ while(is_spacing(*parseptr)) *parseptr++;
+ if (*parseptr)
+ {
+ t_size length = 0;
+ while(parseptr[length] && !is_linebreak(parseptr[length])) length++;
+ if (length > 0) {
+ try {
+ g_parse_cue_line(parseptr,length,p_callback);
+ } catch(exception_cue const & e) {//rethrow with line info
+ throw exception_cue(pfc::string_formatter() << e.what() << " (line " << lineidx << ")");
+ }
+ }
+ parseptr += length;
+ while(is_linebreak(*parseptr)) {
+ if (*parseptr == '\n') lineidx++;
+ parseptr++;
+ }
+ }
+ }
+}
+
+void cue_parser::parse(const char *p_cuesheet,t_cue_entry_list & p_out) {
+ try {
+ cue_parser_callback_retrievelist callback(p_out);
+ g_parse_cue(p_cuesheet,callback);
+ callback.finalize();
+ } catch(exception_cue const & e) {
+ throw exception_bad_cuesheet(pfc::string_formatter() << "Error parsing cuesheet: " << e.what());
+ }
+}
+void cue_parser::parse_info(const char * p_cuesheet,file_info & p_info,unsigned p_index) {
+ try {
+ cue_parser_callback_retrieveinfo callback(p_info,p_index);
+ g_parse_cue(p_cuesheet,callback);
+ callback.finalize();
+ } catch(exception_cue const & e) {
+ throw exception_bad_cuesheet(pfc::string_formatter() << "Error parsing cuesheet: " << e.what());
+ }
+}
+
+namespace {
+
+ class cue_parser_callback_retrievecount : public cue_parser_callback
+ {
+ public:
+ cue_parser_callback_retrievecount() : m_count(0) {}
+ unsigned get_count() const {return m_count;}
+ void on_file(const char * p_file,t_size p_file_length,const char * p_type,t_size p_type_length) {}
+ void on_track(unsigned p_index,const char * p_type,t_size p_type_length) {m_count++;}
+ void on_pregap(unsigned p_value) {}
+ void on_index(unsigned p_index,unsigned p_value) {}
+ void on_title(const char * p_title,t_size p_title_length) {}
+ void on_performer(const char * p_performer,t_size p_performer_length) {}
+ void on_isrc(const char * p_isrc,t_size p_isrc_length) {}
+ void on_catalog(const char * p_catalog,t_size p_catalog_length) {}
+ void on_comment(const char * p_comment,t_size p_comment_length) {}
+ void on_flags(const char * p_flags,t_size p_flags_length) {}
+ private:
+ unsigned m_count;
+ };
+
+ class cue_parser_callback_retrievecreatorentries : public cue_parser_callback
+ {
+ public:
+ cue_parser_callback_retrievecreatorentries(cue_creator::t_entry_list & p_out) : m_out(p_out), m_track(0), m_pregap(0), m_index0_set(false), m_index1_set(false) {}
+
+ void on_file(const char * p_file,t_size p_file_length,const char * p_type,t_size p_type_length) {
+ validate_file_type(p_type,p_type_length);
+ m_file.set_string(p_file,p_file_length);
+ }
+
+ void on_track(unsigned p_index,const char * p_type,t_size p_type_length)
+ {
+ if (stricmp_utf8_ex(p_type,p_type_length,"audio",pfc_infinite)) throw exception_cue("only tracks of type AUDIO supported",0);
+ //if (p_index != m_track + 1) throw exception_cue("cuesheet tracks out of order",0);
+ if (m_track != 0) finalize_track();
+ if (m_file.is_empty()) throw exception_cue("declaring a track with no file set",0);
+ m_trackfile = m_file;
+ m_track = p_index;
+ }
+
+ void on_pregap(unsigned p_value)
+ {
+ m_pregap = (double) p_value / 75.0;
+ }
+
+ void on_index(unsigned p_index,unsigned p_value)
+ {
+ if (p_index < t_cuesheet_index_list::count)
+ {
+ switch(p_index)
+ {
+ case 0: m_index0_set = true; break;
+ case 1: m_index1_set = true; break;
+ }
+ m_indexes.m_positions[p_index] = (double) p_value / 75.0;
+ }
+ }
+ void on_title(const char * p_title,t_size p_title_length) {}
+ void on_performer(const char * p_performer,t_size p_performer_length) {}
+ void on_songwriter(const char * p_performer,t_size p_performer_length) {}
+ void on_isrc(const char * p_isrc,t_size p_isrc_length) {}
+ void on_catalog(const char * p_catalog,t_size p_catalog_length) {}
+ void on_comment(const char * p_comment,t_size p_comment_length) {}
+ void finalize()
+ {
+ if (m_track != 0)
+ {
+ finalize_track();
+ m_track = 0;
+ }
+ }
+ void on_flags(const char * p_flags,t_size p_flags_length) {
+ m_flags.set_string(p_flags,p_flags_length);
+ }
+ private:
+ void finalize_track()
+ {
+ if (m_track < 1 || m_track > 99) throw exception_cue("track number out of range",0);
+ if (!m_index1_set) throw exception_cue("INDEX 01 not set",0);
+ if (!m_index0_set) m_indexes.m_positions[0] = m_indexes.m_positions[1] - m_pregap;
+ if (!m_indexes.is_valid()) throw exception_cue("invalid index list");
+
+ cue_creator::t_entry_list::iterator iter;
+ iter = m_out.insert_last();
+ iter->m_track_number = m_track;
+ iter->m_file = m_trackfile;
+ iter->m_index_list = m_indexes;
+ iter->m_flags = m_flags;
+ m_pregap = 0;
+ m_indexes.reset();
+ m_index0_set = m_index1_set = false;
+ m_flags.reset();
+ }
+
+ bool m_index0_set,m_index1_set;
+ double m_pregap;
+ unsigned m_track;
+ cue_creator::t_entry_list & m_out;
+ pfc::string8 m_file,m_trackfile,m_flags;
+ t_cuesheet_index_list m_indexes;
+ };
+}
+
+void cue_parser::parse_full(const char * p_cuesheet,cue_creator::t_entry_list & p_out) {
+ try {
+ {
+ cue_parser_callback_retrievecreatorentries callback(p_out);
+ g_parse_cue(p_cuesheet,callback);
+ callback.finalize();
+ }
+
+ {
+ cue_creator::t_entry_list::iterator iter;
+ for(iter=p_out.first();iter.is_valid();++iter)
+ {
+ cue_parser_callback_retrieveinfo callback(iter->m_infos,iter->m_track_number);
+ g_parse_cue(p_cuesheet,callback);
+ callback.finalize();
+ }
+ }
+ } catch(exception_cue const & e) {
+ throw exception_bad_cuesheet(pfc::string_formatter() << "Error parsing cuesheet: " << e.what());
+ }
+}
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/cue_parser.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/cue_parser.h new file mode 100644 index 0000000000..9b254ad9cc --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/cue_parser.h @@ -0,0 +1,444 @@ +//HINT: for info on how to generate an embedded cuesheet enabled input, see the end of this header.
+
+//to be moved somewhere else later
+namespace file_info_record_helper {
+
+ class __file_info_record__info__enumerator {
+ public:
+ __file_info_record__info__enumerator(file_info & p_out) : m_out(p_out) {}
+ void operator() (const char * p_name,const char * p_value) {m_out.__info_add_unsafe(p_name,p_value);}
+ private:
+ file_info & m_out;
+ };
+
+ class __file_info_record__meta__enumerator {
+ public:
+ __file_info_record__meta__enumerator(file_info & p_out) : m_out(p_out) {}
+ template<typename t_value> void operator() (const char * p_name,const t_value & p_value) {
+ t_size index = ~0;
+ for(typename t_value::const_iterator iter = p_value.first(); iter.is_valid(); ++iter) {
+ if (index == ~0) index = m_out.__meta_add_unsafe(p_name,*iter);
+ else m_out.meta_add_value(index,*iter);
+ }
+ }
+ private:
+ file_info & m_out;
+ };
+
+ class file_info_record {
+ public:
+ typedef pfc::chain_list_v2_t<pfc::string8> t_meta_value;
+ typedef pfc::map_t<pfc::string8,t_meta_value,file_info::field_name_comparator> t_meta_map;
+ typedef pfc::map_t<pfc::string8,pfc::string8,file_info::field_name_comparator> t_info_map;
+
+ file_info_record() : m_replaygain(replaygain_info_invalid), m_length(0) {}
+
+ replaygain_info get_replaygain() const {return m_replaygain;}
+ void set_replaygain(const replaygain_info & p_replaygain) {m_replaygain = p_replaygain;}
+ double get_length() const {return m_length;}
+ void set_length(double p_length) {m_length = p_length;}
+
+ void reset() {
+ m_meta.remove_all(); m_info.remove_all();
+ m_length = 0;
+ m_replaygain = replaygain_info_invalid;
+ }
+
+ void from_info_overwrite_info(const file_info & p_info) {
+ for(t_size infowalk = 0, infocount = p_info.info_get_count(); infowalk < infocount; ++infowalk) {
+ m_info.set(p_info.info_enum_name(infowalk),p_info.info_enum_value(infowalk));
+ }
+ }
+ void from_info_overwrite_meta(const file_info & p_info) {
+ for(t_size metawalk = 0, metacount = p_info.meta_get_count(); metawalk < metacount; ++metawalk) {
+ const t_size valuecount = p_info.meta_enum_value_count(metawalk);
+ if (valuecount > 0) {
+ t_meta_value & entry = m_meta.find_or_add(p_info.meta_enum_name(metawalk));
+ entry.remove_all();
+ for(t_size valuewalk = 0; valuewalk < valuecount; ++valuewalk) {
+ entry.add_item(p_info.meta_enum_value(metawalk,valuewalk));
+ }
+ }
+ }
+ }
+
+ void from_info_overwrite_rg(const file_info & p_info) {
+ m_replaygain = replaygain_info::g_merge(m_replaygain,p_info.get_replaygain());
+ }
+
+ template<typename t_source>
+ void overwrite_meta(const t_source & p_meta) {
+ m_meta.overwrite(p_meta);
+ }
+ template<typename t_source>
+ void overwrite_info(const t_source & p_info) {
+ m_info.overwrite(p_info);
+ }
+
+ void merge_overwrite(const file_info & p_info) {
+ from_info_overwrite_info(p_info);
+ from_info_overwrite_meta(p_info);
+ from_info_overwrite_rg(p_info);
+ }
+
+ void transfer_meta_entry(const char * p_name,const file_info & p_info,t_size p_index) {
+ const t_size count = p_info.meta_enum_value_count(p_index);
+ if (count == 0) {
+ m_meta.remove(p_name);
+ } else {
+ t_meta_value & val = m_meta.find_or_add(p_name);
+ val.remove_all();
+ for(t_size walk = 0; walk < count; ++walk) {
+ val.add_item(p_info.meta_enum_value(p_index,walk));
+ }
+ }
+ }
+
+ void meta_set(const char * p_name,const char * p_value) {
+ m_meta.find_or_add(p_name).set_single(p_value);
+ }
+
+ const t_meta_value * meta_query_ptr(const char * p_name) const {
+ return m_meta.query_ptr(p_name);
+ }
+
+
+ void from_info_set_meta(const file_info & p_info) {
+ m_meta.remove_all();
+ from_info_overwrite_meta(p_info);
+ }
+
+ void from_info(const file_info & p_info) {
+ reset();
+ m_length = p_info.get_length();
+ m_replaygain = p_info.get_replaygain();
+ from_info_overwrite_meta(p_info);
+ from_info_overwrite_info(p_info);
+ }
+ void to_info(file_info & p_info) const {
+ p_info.reset();
+ p_info.set_length(m_length);
+ p_info.set_replaygain(m_replaygain);
+ m_info.enumerate(__file_info_record__info__enumerator(p_info));
+ m_meta.enumerate(__file_info_record__meta__enumerator(p_info));
+ }
+
+ template<typename t_callback> void enumerate_meta(t_callback & p_callback) const {m_meta.enumerate(p_callback);}
+ template<typename t_callback> void enumerate_meta(t_callback & p_callback) {m_meta.enumerate(p_callback);}
+
+ //private:
+ t_meta_map m_meta;
+ t_info_map m_info;
+ replaygain_info m_replaygain;
+ double m_length;
+ };
+
+}//namespace file_info_record_helper
+
+
+namespace cue_parser
+{
+ struct cue_entry {
+ pfc::string8 m_file;
+ unsigned m_track_number;
+ t_cuesheet_index_list m_indexes;
+ };
+
+ typedef pfc::chain_list_v2_t<cue_entry> t_cue_entry_list;
+
+
+ PFC_DECLARE_EXCEPTION(exception_bad_cuesheet,exception_io_data,"Invalid cuesheet");
+
+ //! Throws exception_bad_cuesheet on failure.
+ void parse(const char *p_cuesheet,t_cue_entry_list & p_out);
+ //! Throws exception_bad_cuesheet on failure.
+ void parse_info(const char *p_cuesheet,file_info & p_info,unsigned p_index);
+ //! Throws exception_bad_cuesheet on failure.
+ void parse_full(const char * p_cuesheet,cue_creator::t_entry_list & p_out);
+
+
+
+ struct track_record {
+ file_info_record_helper::file_info_record m_info;
+ pfc::string8 m_file,m_flags;
+ t_cuesheet_index_list m_index_list;
+ };
+
+ typedef pfc::map_t<unsigned,track_record> track_record_list;
+
+ class embeddedcue_metadata_manager {
+ public:
+ void get_tag(file_info & p_info) const;
+ void set_tag(file_info const & p_info);
+
+ void get_track_info(unsigned p_track,file_info & p_info) const;
+ void set_track_info(unsigned p_track,file_info const & p_info);
+ void query_track_offsets(unsigned p_track,double & p_begin,double & p_length) const;
+ bool have_cuesheet() const;
+ unsigned remap_trackno(unsigned p_index) const;
+ t_size get_cue_track_count() const;
+ private:
+ track_record_list m_content;
+ };
+
+
+
+
+
+
+ class _decoder_wrapper {
+ public:
+ virtual bool run(audio_chunk & p_chunk,abort_callback & p_abort) = 0;
+ virtual void seek(double p_seconds,abort_callback & p_abort) = 0;
+ virtual bool get_dynamic_info(file_info & p_out, double & p_timestamp_delta) = 0;
+ virtual bool get_dynamic_info_track(file_info & p_out, double & p_timestamp_delta) = 0;
+ virtual void on_idle(abort_callback & p_abort) = 0;
+ virtual bool run_raw(audio_chunk & p_chunk, mem_block_container & p_raw, abort_callback & p_abort) = 0;
+ virtual void set_logger(event_logger::ptr ptr) = 0;
+ virtual ~_decoder_wrapper() {}
+ };
+
+ template<typename t_input>
+ class _decoder_wrapper_simple : public _decoder_wrapper {
+ public:
+ void initialize(service_ptr_t<file> p_filehint,const char * p_path,unsigned p_flags,abort_callback & p_abort) {
+ m_input.open(p_filehint,p_path,input_open_decode,p_abort);
+ m_input.decode_initialize(p_flags,p_abort);
+ }
+ bool run(audio_chunk & p_chunk,abort_callback & p_abort) {return m_input.decode_run(p_chunk,p_abort);}
+ void seek(double p_seconds,abort_callback & p_abort) {m_input.decode_seek(p_seconds,p_abort);}
+ bool get_dynamic_info(file_info & p_out, double & p_timestamp_delta) {return m_input.decode_get_dynamic_info(p_out,p_timestamp_delta);}
+ bool get_dynamic_info_track(file_info & p_out, double & p_timestamp_delta) {return m_input.decode_get_dynamic_info_track(p_out,p_timestamp_delta);}
+ void on_idle(abort_callback & p_abort) {m_input.decode_on_idle(p_abort);}
+ bool run_raw(audio_chunk & p_chunk, mem_block_container & p_raw, abort_callback & p_abort) {return m_input.decode_run_raw(p_chunk, p_raw, p_abort);}
+ void set_logger(event_logger::ptr ptr) {m_input.set_logger(ptr);}
+ private:
+ t_input m_input;
+ };
+
+ class _decoder_wrapper_cue : public _decoder_wrapper {
+ public:
+ void open(service_ptr_t<file> p_filehint,const playable_location & p_location,unsigned p_flags,abort_callback & p_abort,double p_start,double p_length) {
+ m_input.open(p_filehint,p_location,p_flags,p_abort,p_start,p_length);
+ }
+ bool run(audio_chunk & p_chunk,abort_callback & p_abort) {return m_input.run(p_chunk,p_abort);}
+ void seek(double p_seconds,abort_callback & p_abort) {m_input.seek(p_seconds,p_abort);}
+ bool get_dynamic_info(file_info & p_out, double & p_timestamp_delta) {return m_input.get_dynamic_info(p_out,p_timestamp_delta);}
+ bool get_dynamic_info_track(file_info & p_out, double & p_timestamp_delta) {return m_input.get_dynamic_info_track(p_out,p_timestamp_delta);}
+ void on_idle(abort_callback & p_abort) {m_input.on_idle(p_abort);}
+ bool run_raw(audio_chunk & p_chunk, mem_block_container & p_raw, abort_callback & p_abort) {return m_input.run_raw(p_chunk, p_raw, p_abort);}
+ void set_logger(event_logger::ptr ptr) {m_input.set_logger(ptr);}
+ private:
+ input_helper_cue m_input;
+ };
+
+ template<typename t_base>
+ class input_wrapper_cue_t {
+ public:
+ input_wrapper_cue_t() {}
+ ~input_wrapper_cue_t() {}
+
+ void open(service_ptr_t<file> p_filehint,const char * p_path,t_input_open_reason p_reason,abort_callback & p_abort) {
+ m_path = p_path;
+
+ m_file = p_filehint;
+ input_open_file_helper(m_file,p_path,p_reason,p_abort);
+
+ {
+ file_info_impl info;
+ t_base instance;
+ instance.open(m_file,p_path,p_reason,p_abort);
+ instance.get_info(info,p_abort);
+ m_meta.set_tag(info);
+ }
+ }
+
+ t_uint32 get_subsong_count() {
+ return m_meta.have_cuesheet() ? m_meta.get_cue_track_count() : 1;
+ }
+
+ t_uint32 get_subsong(t_uint32 p_index) {
+ return m_meta.have_cuesheet() ? m_meta.remap_trackno(p_index) : 0;
+ }
+
+ void get_info(t_uint32 p_subsong,file_info & p_info,abort_callback & p_abort) {
+ if (p_subsong == 0) {
+ m_meta.get_tag(p_info);
+ } else {
+ m_meta.get_track_info(p_subsong,p_info);
+ }
+ }
+
+ t_filestats get_file_stats(abort_callback & p_abort) {return m_file->get_stats(p_abort);}
+
+ void decode_initialize(t_uint32 p_subsong,unsigned p_flags,abort_callback & p_abort) {
+ m_decoder.release();
+ if (p_subsong == 0) {
+ pfc::rcptr_t<_decoder_wrapper_simple<t_base> > temp;
+ temp.new_t();
+ m_file->reopen(p_abort);
+ temp->initialize(m_file,m_path,p_flags,p_abort);
+ m_decoder = temp;
+ } else {
+ double start,length;
+ m_meta.query_track_offsets(p_subsong,start,length);
+
+ pfc::rcptr_t<_decoder_wrapper_cue> temp;
+ temp.new_t();
+ m_file->reopen(p_abort);
+ temp->open(m_file,make_playable_location(m_path,0),p_flags & ~input_flag_no_seeking,p_abort,start,length);
+ m_decoder = temp;
+ }
+ if (m_logger.is_valid()) m_decoder->set_logger(m_logger);
+ }
+
+ bool decode_run(audio_chunk & p_chunk,abort_callback & p_abort) {
+ return m_decoder->run(p_chunk,p_abort);
+ }
+
+ void decode_seek(double p_seconds,abort_callback & p_abort) {
+ m_decoder->seek(p_seconds,p_abort);
+ }
+
+ bool decode_can_seek() {return true;}
+
+ bool decode_run_raw(audio_chunk & p_chunk, mem_block_container & p_raw, abort_callback & p_abort) {
+ return m_decoder->run_raw(p_chunk, p_raw, p_abort);
+ }
+ void set_logger(event_logger::ptr ptr) {
+ m_logger = ptr;
+ if (m_decoder.is_valid()) m_decoder->set_logger(ptr);
+ }
+
+ bool decode_get_dynamic_info(file_info & p_out, double & p_timestamp_delta) {
+ return m_decoder->get_dynamic_info(p_out,p_timestamp_delta);
+ }
+
+ bool decode_get_dynamic_info_track(file_info & p_out, double & p_timestamp_delta) {
+ return m_decoder->get_dynamic_info_track(p_out,p_timestamp_delta);
+ }
+
+ void decode_on_idle(abort_callback & p_abort) {
+ m_decoder->on_idle(p_abort);
+ }
+
+ void retag_set_info(t_uint32 p_subsong,const file_info & p_info,abort_callback & p_abort) {
+ pfc::dynamic_assert(m_decoder.is_empty());
+ if (p_subsong == 0) {
+ m_meta.set_tag(p_info);
+ } else {
+ m_meta.set_track_info(p_subsong,p_info);
+ }
+ }
+
+ void retag_commit(abort_callback & p_abort) {
+ pfc::dynamic_assert(m_decoder.is_empty());
+
+ file_info_impl info;
+ m_meta.get_tag(info);
+
+ {
+ t_base instance;
+ m_file->reopen(p_abort);
+ instance.open(m_file,m_path,input_open_info_write,p_abort);
+ instance.retag(pfc::implicit_cast<const file_info&>(info),p_abort);
+ info.reset();
+ instance.get_info(info,p_abort);
+ m_meta.set_tag(info);
+ }
+ }
+
+ inline static bool g_is_our_content_type(const char * p_content_type) {return t_base::g_is_our_content_type(p_content_type);}
+ inline static bool g_is_our_path(const char * p_path,const char * p_extension) {return t_base::g_is_our_path(p_path,p_extension);}
+
+ private:
+ pfc::rcptr_t<_decoder_wrapper> m_decoder;
+
+ file_info_impl m_info;
+ pfc::string8 m_path;
+ service_ptr_t<file> m_file;
+
+ embeddedcue_metadata_manager m_meta;
+ event_logger::ptr m_logger;
+ };
+
+ template<typename I>
+ class chapterizer_impl_t : public chapterizer
+ {
+ public:
+ bool is_our_path(const char * p_path) {
+ return I::g_is_our_path(p_path, pfc::string_extension(p_path));
+ }
+
+ void set_chapters(const char * p_path,chapter_list const & p_list,abort_callback & p_abort) {
+ input_wrapper_cue_t<I> instance;
+ instance.open(0,p_path,input_open_info_write,p_abort);
+
+ //stamp the cuesheet first
+ {
+ file_info_impl info;
+ instance.get_info(0,info,p_abort);
+
+ pfc::string_formatter cuesheet;
+
+ {
+ cue_creator::t_entry_list entries;
+ t_size n, m = p_list.get_chapter_count();
+ const double pregap = p_list.get_pregap();
+ double offset_acc = pregap;
+ for(n=0;n<m;n++)
+ {
+ cue_creator::t_entry_list::iterator entry;
+ entry = entries.insert_last();
+ entry->m_infos = p_list.get_info(n);
+ entry->m_file = "CDImage.wav";
+ entry->m_track_number = (unsigned)(n+1);
+ entry->m_index_list.from_infos(entry->m_infos,offset_acc);
+ if (n == 0) entry->m_index_list.m_positions[0] = 0;
+ offset_acc += entry->m_infos.get_length();
+ }
+ cue_creator::create(cuesheet,entries);
+ }
+
+ info.meta_set("cuesheet",cuesheet);
+
+ instance.retag_set_info(0,info,p_abort);
+ }
+ //stamp per-chapter infos
+ for(t_size walk = 0, total = p_list.get_chapter_count(); walk < total; ++walk) {
+ instance.retag_set_info(walk + 1, p_list.get_info(walk),p_abort);
+ }
+
+ instance.retag_commit(p_abort);
+ }
+
+ void get_chapters(const char * p_path,chapter_list & p_list,abort_callback & p_abort) {
+
+ input_wrapper_cue_t<I> instance;
+ instance.open(0,p_path,input_open_info_read,p_abort);
+ const t_uint32 total = instance.get_subsong_count();
+
+ p_list.set_chapter_count(total);
+ for(t_uint32 walk = 0; walk < total; ++walk) {
+ file_info_impl info;
+ instance.get_info(instance.get_subsong(walk),info,p_abort);
+ p_list.set_info(walk,info);
+ }
+ }
+
+ bool supports_pregaps() {
+ return true;
+ }
+ };
+
+};
+
+//! Wrapper template for generating embedded cuesheet enabled inputs.
+//! t_input_impl is a singletrack input implementation (see input_singletrack_impl for method declarations).
+//! To declare an embedded cuesheet enabled input, change your input declaration from input_singletrack_factory_t<myinput> to input_cuesheet_factory_t<myinput>.
+template<typename t_input_impl, unsigned t_flags = 0>
+class input_cuesheet_factory_t {
+public:
+ input_factory_ex_t<cue_parser::input_wrapper_cue_t<t_input_impl>,t_flags,input_decoder_v2> m_input_factory;
+ service_factory_single_t<cue_parser::chapterizer_impl_t<t_input_impl> > m_chapterizer_factory;
+};
\ No newline at end of file diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/cue_parser_embedding.cpp b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/cue_parser_embedding.cpp new file mode 100644 index 0000000000..0a263460b7 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/cue_parser_embedding.cpp @@ -0,0 +1,358 @@ +#include "stdafx.h"
+
+using namespace cue_parser;
+using namespace file_info_record_helper;
+static void build_cue_meta_name(const char * p_name,unsigned p_tracknumber,pfc::string_base & p_out) {
+ p_out.reset();
+ p_out << "cue_track" << pfc::format_uint(p_tracknumber % 100,2) << "_" << p_name;
+}
+
+static bool is_reserved_meta_entry(const char * p_name) {
+ return file_info::field_name_comparator::compare(p_name,"cuesheet") == 0;
+}
+
+static bool is_global_meta_entry(const char * p_name) {
+ static const char header[] = "cue_track";
+ return pfc::stricmp_ascii_ex(p_name,strlen(header),header,~0) != 0;
+}
+static bool is_allowed_field(const char * p_name) {
+ return !is_reserved_meta_entry(p_name) && is_global_meta_entry(p_name);
+}
+namespace {
+ class __get_tag_cue_track_list_builder {
+ public:
+ __get_tag_cue_track_list_builder(cue_creator::t_entry_list & p_entries) : m_entries(p_entries) {}
+ void operator() (unsigned p_trackno,const track_record & p_record) {
+ if (p_trackno > 0) {
+ cue_creator::t_entry_list::iterator iter = m_entries.insert_last();
+ iter->m_file = p_record.m_file;
+ iter->m_flags = p_record.m_flags;
+ iter->m_index_list = p_record.m_index_list;
+ iter->m_track_number = p_trackno;
+ p_record.m_info.to_info(iter->m_infos);
+ }
+ }
+ private:
+ cue_creator::t_entry_list & m_entries;
+ };
+
+ typedef pfc::avltree_t<pfc::string8,file_info::field_name_comparator> field_name_list;
+
+ class __get_tag__enum_fields_enumerator {
+ public:
+ __get_tag__enum_fields_enumerator(field_name_list & p_out) : m_out(p_out) {}
+ void operator() (unsigned p_trackno,const track_record & p_record) {
+ if (p_trackno > 0) p_record.m_info.enumerate_meta(*this);
+ }
+ template<typename t_value> void operator() (const char * p_name,const t_value & p_value) {
+ m_out.add(p_name);
+ }
+ private:
+ field_name_list & m_out;
+ };
+
+
+ class __get_tag__is_field_global_check {
+ private:
+ typedef file_info_record::t_meta_value t_value;
+ public:
+ __get_tag__is_field_global_check(const char * p_field) : m_field(p_field), m_value(NULL), m_state(true) {}
+
+ void operator() (unsigned p_trackno,const track_record & p_record) {
+ if (p_trackno > 0 && m_state) {
+ const t_value * val = p_record.m_info.meta_query_ptr(m_field);
+ if (val == NULL) {m_state = false; return;}
+ if (m_value == NULL) {
+ m_value = val;
+ } else {
+ if (pfc::comparator_list<pfc::comparator_strcmp>::compare(*m_value,*val) != 0) {
+ m_state = false; return;
+ }
+ }
+ }
+ }
+ void finalize(file_info_record::t_meta_map & p_globals) {
+ if (m_state && m_value != NULL) {
+ p_globals.set(m_field,*m_value);
+ }
+ }
+ private:
+ const char * const m_field;
+ const t_value * m_value;
+ bool m_state;
+ };
+
+ class __get_tag__filter_globals {
+ public:
+ __get_tag__filter_globals(track_record_list const & p_tracks,file_info_record::t_meta_map & p_globals) : m_tracks(p_tracks), m_globals(p_globals) {}
+
+ void operator() (const char * p_field) {
+ if (is_allowed_field(p_field)) {
+ __get_tag__is_field_global_check wrapper(p_field);
+ m_tracks.enumerate(wrapper);
+ wrapper.finalize(m_globals);
+ }
+ }
+ private:
+ const track_record_list & m_tracks;
+ file_info_record::t_meta_map & m_globals;
+ };
+
+ class __get_tag__local_field_filter {
+ public:
+ __get_tag__local_field_filter(const file_info_record::t_meta_map & p_globals,file_info_record::t_meta_map & p_output) : m_globals(p_globals), m_output(p_output), m_currenttrack(0) {}
+ void operator() (unsigned p_trackno,const track_record & p_track) {
+ if (p_trackno > 0) {
+ m_currenttrack = p_trackno;
+ p_track.m_info.enumerate_meta(*this);
+ }
+ }
+ void operator() (const char * p_name,const file_info_record::t_meta_value & p_value) {
+ PFC_ASSERT(m_currenttrack > 0);
+ if (!m_globals.have_item(p_name)) {
+ build_cue_meta_name(p_name,m_currenttrack,m_buffer);
+ m_output.set(m_buffer,p_value);
+ }
+ }
+ private:
+ unsigned m_currenttrack;
+ pfc::string8_fastalloc m_buffer;
+ const file_info_record::t_meta_map & m_globals;
+ file_info_record::t_meta_map & m_output;
+ };
+};
+
+static void strip_redundant_track_meta(unsigned p_tracknumber,const file_info & p_cueinfo,file_info_record::t_meta_map & p_meta,const char * p_metaname) {
+ t_size metaindex = p_cueinfo.meta_find(p_metaname);
+ if (metaindex == ~0) return;
+ pfc::string_formatter namelocal;
+ build_cue_meta_name(p_metaname,p_tracknumber,namelocal);
+ {
+ const file_info_record::t_meta_value * val = p_meta.query_ptr(namelocal);
+ if (val == NULL) return;
+ file_info_record::t_meta_value::const_iterator iter = val->first();
+ for(t_size valwalk = 0, valcount = p_cueinfo.meta_enum_value_count(metaindex); valwalk < valcount; ++valwalk) {
+ if (iter.is_empty()) return;
+ if (strcmp(*iter,p_cueinfo.meta_enum_value(metaindex,valwalk)) != 0) return;
+ ++iter;
+ }
+ if (!iter.is_empty()) return;
+ }
+ //success
+ p_meta.remove(namelocal);
+}
+
+void embeddedcue_metadata_manager::get_tag(file_info & p_info) const {
+ if (!have_cuesheet()) {
+ m_content.query_ptr((unsigned)0)->m_info.to_info(p_info);
+ p_info.meta_remove_field("cuesheet");
+ } else {
+ cue_creator::t_entry_list entries;
+ m_content.enumerate(__get_tag_cue_track_list_builder(entries));
+ pfc::string_formatter cuesheet;
+ cue_creator::create(cuesheet,entries);
+ entries.remove_all();
+ //parse it back to see what info got stored in the cuesheet and what needs to be stored outside cuesheet in the tags
+ cue_parser::parse_full(cuesheet,entries);
+ file_info_record output;
+
+
+
+
+ {
+ file_info_record::t_meta_map globals;
+ //1. find global infos and forward them
+ {
+ field_name_list fields;
+ m_content.enumerate(__get_tag__enum_fields_enumerator(fields));
+ fields.enumerate(__get_tag__filter_globals(m_content,globals));
+ }
+
+ output.overwrite_meta(globals);
+
+ //2. find local infos
+ m_content.enumerate(__get_tag__local_field_filter(globals,output.m_meta));
+ }
+
+
+ //strip redundant titles and tracknumbers that the cuesheet already contains
+ for(cue_creator::t_entry_list::const_iterator iter = entries.first(); iter.is_valid(); ++iter) {
+ strip_redundant_track_meta(iter->m_track_number,iter->m_infos,output.m_meta,"tracknumber");
+ strip_redundant_track_meta(iter->m_track_number,iter->m_infos,output.m_meta,"title");
+ }
+
+
+ //add tech infos etc
+
+ {
+ const track_record * rec = m_content.query_ptr((unsigned)0);
+ if (rec != NULL) {
+ output.set_length(rec->m_info.get_length());
+ output.set_replaygain(rec->m_info.get_replaygain());
+ output.overwrite_info(rec->m_info.m_info);
+ }
+ }
+ output.meta_set("cuesheet",cuesheet);
+ output.to_info(p_info);
+ }
+}
+
+static bool resolve_cue_meta_name(const char * p_name,pfc::string_base & p_outname,unsigned & p_tracknumber) {
+ //"cue_trackNN_fieldname"
+ static const char header[] = "cue_track";
+ if (pfc::stricmp_ascii_ex(p_name,strlen(header),header,~0) != 0) return false;
+ p_name += strlen(header);
+ if (!pfc::char_is_numeric(p_name[0]) || !pfc::char_is_numeric(p_name[1]) || p_name[2] != '_') return false;
+ unsigned tracknumber = pfc::atoui_ex(p_name,2);
+ if (tracknumber == 0) return false;
+ p_name += 3;
+ p_tracknumber = tracknumber;
+ p_outname = p_name;
+ return true;
+}
+
+
+namespace {
+ class __set_tag_global_field_relay {
+ public:
+ __set_tag_global_field_relay(const file_info & p_info,t_size p_index) : m_info(p_info), m_index(p_index) {}
+ void operator() (unsigned p_trackno,track_record & p_record) {
+ if (p_trackno > 0) {
+ p_record.m_info.transfer_meta_entry(m_info.meta_enum_name(m_index),m_info,m_index);
+ }
+ }
+ private:
+ const file_info & m_info;
+ const t_size m_index;
+ };
+}
+
+void embeddedcue_metadata_manager::set_tag(file_info const & p_info) {
+ m_content.remove_all();
+
+ {
+ track_record & track0 = m_content.find_or_add((unsigned)0);
+ track0.m_info.from_info(p_info);
+ track0.m_info.m_info.set("cue_embedded","no");
+ }
+
+
+
+ const char * cuesheet = p_info.meta_get("cuesheet",0);
+ if (cuesheet == NULL) {
+ return;
+ }
+
+ //processing order
+ //1. cuesheet content
+ //2. overwrite with global metadata from the tag
+ //3. overwrite with local metadata from the tag
+
+ {
+ cue_creator::t_entry_list entries;
+ try {
+ cue_parser::parse_full(cuesheet,entries);
+ } catch(exception_io_data const & e) {
+ console::complain("Attempting to embed an invalid cuesheet", e.what());
+ return;
+ }
+
+ for(cue_creator::t_entry_list::const_iterator iter = entries.first(); iter.is_valid(); ) {
+ cue_creator::t_entry_list::const_iterator next = iter;
+ ++next;
+ track_record & entry = m_content.find_or_add(iter->m_track_number);
+ entry.m_file = iter->m_file;
+ entry.m_flags = iter->m_flags;
+ entry.m_index_list = iter->m_index_list;
+ entry.m_info.from_info(iter->m_infos);
+ entry.m_info.from_info_overwrite_info(p_info);
+ entry.m_info.m_info.set("cue_embedded","yes");
+ double begin = entry.m_index_list.start(), end = next.is_valid() ? next->m_index_list.start() : p_info.get_length();
+ if (end <= begin) throw exception_io_data();
+ entry.m_info.set_length(end - begin);
+ iter = next;
+ }
+ }
+
+ for(t_size metawalk = 0, metacount = p_info.meta_get_count(); metawalk < metacount; ++metawalk) {
+ const char * name = p_info.meta_enum_name(metawalk);
+ const t_size valuecount = p_info.meta_enum_value_count(metawalk);
+ if (valuecount > 0 && !is_reserved_meta_entry(name) && is_global_meta_entry(name)) {
+ __set_tag_global_field_relay relay(p_info,metawalk);
+ m_content.enumerate(relay);
+ }
+ }
+
+ {
+ pfc::string8_fastalloc namebuffer;
+ for(t_size metawalk = 0, metacount = p_info.meta_get_count(); metawalk < metacount; ++metawalk) {
+ const char * name = p_info.meta_enum_name(metawalk);
+ const t_size valuecount = p_info.meta_enum_value_count(metawalk);
+ unsigned trackno;
+ if (valuecount > 0 && !is_reserved_meta_entry(name) && resolve_cue_meta_name(name,namebuffer,trackno)) {
+ track_record * rec = m_content.query_ptr(trackno);
+ if (rec != NULL) {
+ rec->m_info.transfer_meta_entry(namebuffer,p_info,metawalk);
+ }
+ }
+ }
+ }
+}
+
+void embeddedcue_metadata_manager::get_track_info(unsigned p_track,file_info & p_info) const {
+ const track_record * rec = m_content.query_ptr(p_track);
+ if (rec == NULL) throw exception_io_data();
+ rec->m_info.to_info(p_info);
+}
+
+void embeddedcue_metadata_manager::set_track_info(unsigned p_track,file_info const & p_info) {
+ track_record * rec = m_content.query_ptr(p_track);
+ if (rec == NULL) throw exception_io_data();
+ rec->m_info.from_info_set_meta(p_info);
+ rec->m_info.set_replaygain(p_info.get_replaygain());
+}
+
+void embeddedcue_metadata_manager::query_track_offsets(unsigned p_track,double & p_begin,double & p_length) const {
+ const track_record * rec = m_content.query_ptr(p_track);
+ if (rec == NULL) throw exception_io_data();
+ p_begin = rec->m_index_list.start();
+ p_length = rec->m_info.get_length();
+}
+
+bool embeddedcue_metadata_manager::have_cuesheet() const {
+ return m_content.get_count() > 1;
+}
+
+namespace {
+ class __remap_trackno_enumerator {
+ public:
+ __remap_trackno_enumerator(unsigned p_index) : m_countdown(p_index), m_result(0) {}
+ template<typename t_blah> void operator() (unsigned p_trackno,const t_blah&) {
+ if (p_trackno > 0 && m_result == 0) {
+ if (m_countdown == 0) {
+ m_result = p_trackno;
+ } else {
+ --m_countdown;
+ }
+ }
+ }
+ unsigned result() const {return m_result;}
+ private:
+ unsigned m_countdown;
+ unsigned m_result;
+ };
+};
+
+unsigned embeddedcue_metadata_manager::remap_trackno(unsigned p_index) const {
+ if (have_cuesheet()) {
+ __remap_trackno_enumerator wrapper(p_index);
+ m_content.enumerate(wrapper);
+ return wrapper.result();
+ } else {
+ return 0;
+ }
+}
+
+t_size embeddedcue_metadata_manager::get_cue_track_count() const {
+ return m_content.get_count() - 1;
+}
\ No newline at end of file diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/cuesheet_index_list.cpp b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/cuesheet_index_list.cpp new file mode 100644 index 0000000000..dfabf18fa4 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/cuesheet_index_list.cpp @@ -0,0 +1,73 @@ +#include "stdafx.h"
+
+bool t_cuesheet_index_list::is_valid() const {
+ if (m_positions[1] < m_positions[0]) return false;
+ for(t_size n = 2; n < count && m_positions[n] > 0; n++) {
+ if (m_positions[n] < m_positions[n-1]) return false;
+ }
+ return true;
+}
+
+void t_cuesheet_index_list::to_infos(file_info & p_out) const
+{
+ double base = m_positions[1];
+
+ if (base > 0) {
+ p_out.info_set("referenced_offset",cuesheet_format_index_time(base));
+ }
+
+ if (m_positions[0] < base)
+ p_out.info_set("pregap",cuesheet_format_index_time(base - m_positions[0]));
+ else
+ p_out.info_remove("pregap");
+
+ p_out.info_remove("index 00");
+ p_out.info_remove("index 01");
+
+ for(unsigned n=2;n<count;n++)
+ {
+ char namebuffer[16];
+ sprintf_s(namebuffer,"index %02u",n);
+ double position = m_positions[n] - base;
+ if (position > 0)
+ p_out.info_set(namebuffer,cuesheet_format_index_time(position));
+ else
+ p_out.info_remove(namebuffer);
+ }
+}
+
+static bool parse_value(const char * p_name,double & p_out)
+{
+ if (p_name == NULL) return false;
+ try {
+ p_out = cuesheet_parse_index_time_e(p_name,strlen(p_name));
+ } catch(std::exception const &) {return false;}
+ return true;
+}
+
+bool t_cuesheet_index_list::from_infos(file_info const & p_in,double p_base)
+{
+ double pregap;
+ bool found = false;
+ if (!parse_value(p_in.info_get("pregap"),pregap)) pregap = 0;
+ else found = true;
+ m_positions[0] = p_base - pregap;
+ m_positions[1] = p_base;
+ for(unsigned n=2;n<count;n++)
+ {
+ char namebuffer[16];
+ sprintf_s(namebuffer,"index %02u",n);
+ double temp;
+ if (parse_value(p_in.info_get(namebuffer),temp)) {
+ m_positions[n] = temp + p_base; found = true;
+ } else {
+ m_positions[n] = 0;
+ }
+ }
+ return found;
+}
+
+bool t_cuesheet_index_list::is_empty() const {
+ for(unsigned n=0;n<count;n++) if (m_positions[n] != m_positions[1]) return false;
+ return true;
+}
\ No newline at end of file diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/cuesheet_index_list.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/cuesheet_index_list.h new file mode 100644 index 0000000000..099ce80915 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/cuesheet_index_list.h @@ -0,0 +1,19 @@ +struct t_cuesheet_index_list
+{
+ enum {count = 100};
+ t_cuesheet_index_list() {reset();}
+ void reset() {for(unsigned n=0;n<count;n++) m_positions[n]=0;}
+
+ void to_infos(file_info & p_out) const;
+
+ //returns false when there was nothing relevant in infos
+ bool from_infos(file_info const & p_in,double p_base);
+
+ double m_positions[count];
+
+ inline double start() const {return m_positions[1];}
+ bool is_empty() const;
+
+ bool is_valid() const;
+};
+
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/dialog_resize_helper.cpp b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/dialog_resize_helper.cpp new file mode 100644 index 0000000000..5e7fa9a856 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/dialog_resize_helper.cpp @@ -0,0 +1,160 @@ +#include "stdafx.h"
+#include "dialog_resize_helper.h"
+
+BOOL GetChildWindowRect(HWND wnd,UINT id,RECT* child)
+{
+ RECT temp;
+ HWND wndChild = GetDlgItem(wnd, id);
+ if (wndChild == NULL) return FALSE;
+ if (!GetWindowRect(wndChild,&temp)) return FALSE;
+ if (!MapWindowPoints(0,wnd,(POINT*)&temp,2)) return FALSE;
+ *child = temp;
+ return TRUE;
+}
+
+void dialog_resize_helper::set_parent(HWND wnd)
+{
+ reset();
+ parent = wnd;
+ GetClientRect(parent,&orig_client);
+}
+
+void dialog_resize_helper::reset()
+{
+ parent = 0;
+ sizegrip = 0;
+}
+
+void dialog_resize_helper::on_wm_size()
+{
+ if (parent)
+ {
+ unsigned count = m_table.get_size();
+ if (sizegrip != 0) count++;
+ HDWP hWinPosInfo = BeginDeferWindowPos(count);
+ for(unsigned n=0;n<m_table.get_size();n++)
+ {
+ param & e = m_table[n];
+ const RECT & orig_rect = rects[n];
+ RECT cur_client;
+ GetClientRect(parent,&cur_client);
+ HWND wnd = GetDlgItem(parent,e.id);
+ if (wnd != NULL) {
+ unsigned dest_x = orig_rect.left, dest_y = orig_rect.top,
+ dest_cx = orig_rect.right - orig_rect.left, dest_cy = orig_rect.bottom - orig_rect.top;
+
+ int delta_x = cur_client.right - orig_client.right,
+ delta_y = cur_client.bottom - orig_client.bottom;
+
+ if (e.flags & X_MOVE)
+ dest_x += delta_x;
+ else if (e.flags & X_SIZE)
+ dest_cx += delta_x;
+
+ if (e.flags & Y_MOVE)
+ dest_y += delta_y;
+ else if (e.flags & Y_SIZE)
+ dest_cy += delta_y;
+
+ DeferWindowPos(hWinPosInfo, wnd,0,dest_x,dest_y,dest_cx,dest_cy,SWP_NOZORDER);
+ }
+ }
+ if (sizegrip != 0)
+ {
+ RECT rc, rc_grip;
+ GetClientRect(parent, &rc);
+ GetWindowRect(sizegrip, &rc_grip);
+ DeferWindowPos(hWinPosInfo, sizegrip, NULL, rc.right - (rc_grip.right - rc_grip.left), rc.bottom - (rc_grip.bottom - rc_grip.top), 0, 0, SWP_NOZORDER | SWP_NOSIZE);
+ }
+ EndDeferWindowPos(hWinPosInfo);
+ //RedrawWindow(parent,0,0,RDW_INVALIDATE);
+ }
+}
+
+bool dialog_resize_helper::process_message(HWND wnd,UINT msg,WPARAM wp,LPARAM lp) {
+ LRESULT result = 0;
+ if (!ProcessWindowMessage(wnd,msg,wp,lp,result)) return false;
+ SetWindowLongPtr(wnd,DWLP_MSGRESULT,result);
+ return true;
+}
+
+BOOL dialog_resize_helper::ProcessWindowMessage(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT& lResult) {
+ switch(uMsg) {
+ case WM_SIZE:
+ on_wm_size();
+ return FALSE;
+ case WM_GETMINMAXINFO:
+ {
+ RECT r;
+ LPMINMAXINFO info = (LPMINMAXINFO) lParam;
+ DWORD dwStyle = GetWindowLongPtr(hWnd, GWL_STYLE);
+ DWORD dwExStyle = GetWindowLongPtr(hWnd, GWL_EXSTYLE);
+ if (max_x && max_y)
+ {
+ r.left = 0; r.right = max_x;
+ r.top = 0; r.bottom = max_y;
+ MapDialogRect(hWnd,&r);
+ AdjustWindowRectEx(&r, dwStyle, FALSE, dwExStyle);
+ info->ptMaxTrackSize.x = r.right - r.left;
+ info->ptMaxTrackSize.y = r.bottom - r.top;
+ }
+ if (min_x && min_y)
+ {
+ r.left = 0; r.right = min_x;
+ r.top = 0; r.bottom = min_y;
+ MapDialogRect(hWnd,&r);
+ AdjustWindowRectEx(&r, dwStyle, FALSE, dwExStyle);
+ info->ptMinTrackSize.x = r.right - r.left;
+ info->ptMinTrackSize.y = r.bottom - r.top;
+ }
+ }
+ lResult = 0;
+ return TRUE;
+ case WM_INITDIALOG:
+ set_parent(hWnd);
+ {
+ t_size n;
+ for(n=0;n<m_table.get_size();n++) {
+ GetChildWindowRect(parent,m_table[n].id,&rects[n]);
+ }
+ }
+ return FALSE;
+ case WM_DESTROY:
+ reset();
+ return FALSE;
+ default:
+ return FALSE;
+ }
+}
+
+void dialog_resize_helper::add_sizegrip()
+{
+ if (parent != 0 && sizegrip == 0)
+ {
+ sizegrip = CreateWindowEx(0, WC_SCROLLBAR, _T(""), WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | SBS_SIZEGRIP | SBS_SIZEBOXBOTTOMRIGHTALIGN,
+ 0, 0, CW_USEDEFAULT, CW_USEDEFAULT,
+ parent, (HMENU)0, NULL, NULL);
+ if (sizegrip != 0)
+ {
+ RECT rc, rc_grip;
+ GetClientRect(parent, &rc);
+ GetWindowRect(sizegrip, &rc_grip);
+ SetWindowPos(sizegrip, NULL, rc.right - (rc_grip.right - rc_grip.left), rc.bottom - (rc_grip.bottom - rc_grip.top), 0, 0, SWP_NOZORDER | SWP_NOSIZE);
+ }
+ }
+}
+
+
+dialog_resize_helper::dialog_resize_helper(const param * src,unsigned count,unsigned p_min_x,unsigned p_min_y,unsigned p_max_x,unsigned p_max_y)
+ : min_x(p_min_x), min_y(p_min_y), max_x(p_max_x), max_y(p_max_y), parent(0), sizegrip(0)
+{
+ m_table.set_size(count);
+ unsigned n;
+ for(n=0;n<count;n++)
+ m_table[n] = src[n];
+ rects.set_size(count);
+}
+
+dialog_resize_helper::~dialog_resize_helper()
+{
+}
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/dialog_resize_helper.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/dialog_resize_helper.h new file mode 100644 index 0000000000..346ca769af --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/dialog_resize_helper.h @@ -0,0 +1,48 @@ +#ifndef _DIALOG_RESIZE_HELPER_H_
+#define _DIALOG_RESIZE_HELPER_H_
+
+BOOL GetChildWindowRect(HWND wnd,UINT id,RECT* child);
+
+class dialog_resize_helper
+{
+ pfc::array_t<RECT> rects;
+ RECT orig_client;
+ HWND parent;
+ HWND sizegrip;
+ unsigned min_x,min_y,max_x,max_y;
+
+public:
+ struct param {
+ unsigned short id;
+ unsigned short flags;
+ };
+private:
+ pfc::array_t<param> m_table;
+
+ void set_parent(HWND wnd);
+ void reset();
+ void on_wm_size();
+public:
+ inline void set_min_size(unsigned x,unsigned y) {min_x = x; min_y = y;}
+ inline void set_max_size(unsigned x,unsigned y) {max_x = x; max_y = y;}
+ void add_sizegrip();
+
+ enum {
+ X_MOVE = 1, X_SIZE = 2, Y_MOVE = 4, Y_SIZE = 8,
+ XY_MOVE = X_MOVE|Y_MOVE, XY_SIZE = X_SIZE|Y_SIZE,
+ X_MOVE_Y_SIZE = X_MOVE|Y_SIZE, X_SIZE_Y_MOVE = X_SIZE|Y_MOVE,
+ };
+ //the old way
+ bool process_message(HWND wnd,UINT msg,WPARAM wp,LPARAM lp);
+
+ //ATL-compatible
+ BOOL ProcessWindowMessage(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT& lResult);
+
+ dialog_resize_helper(const param * src,unsigned count,unsigned p_min_x,unsigned p_min_y,unsigned p_max_x,unsigned p_max_y);
+
+ ~dialog_resize_helper();
+
+ PFC_CLASS_NOT_COPYABLE_EX(dialog_resize_helper);
+};
+
+#endif
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/dropdown_helper.cpp b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/dropdown_helper.cpp new file mode 100644 index 0000000000..7434470709 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/dropdown_helper.cpp @@ -0,0 +1,160 @@ +#include "stdafx.h"
+#include "dropdown_helper.h"
+
+
+void _cfg_dropdown_history_base::build_list(pfc::ptr_list_t<char> & out)
+{
+ pfc::string8 temp; get_state(temp);
+ const char * src = temp;
+ while(*src)
+ {
+ int ptr = 0;
+ while(src[ptr] && src[ptr]!=separator) ptr++;
+ if (ptr>0)
+ {
+ out.add_item(pfc::strdup_n(src,ptr));
+ src += ptr;
+ }
+ while(*src==separator) src++;
+ }
+}
+
+void _cfg_dropdown_history_base::parse_list(const pfc::ptr_list_t<char> & src)
+{
+ t_size n;
+ pfc::string8_fastalloc temp;
+ for(n=0;n<src.get_count();n++)
+ {
+ temp.add_string(src[n]);
+ temp.add_char(separator);
+ }
+ set_state(temp);
+}
+
+static void g_setup_dropdown_fromlist(HWND wnd,const pfc::ptr_list_t<char> & list)
+{
+ t_size n, m = list.get_count();
+ uSendMessage(wnd,CB_RESETCONTENT,0,0);
+ for(n=0;n<m;n++) {
+ uSendMessageText(wnd,CB_ADDSTRING,0,list[n]);
+ }
+}
+
+void _cfg_dropdown_history_base::setup_dropdown(HWND wnd)
+{
+ pfc::ptr_list_t<char> list;
+ build_list(list);
+ g_setup_dropdown_fromlist(wnd,list);
+ list.free_all();
+}
+
+bool _cfg_dropdown_history_base::add_item(const char * item)
+{
+ if (!item || !*item) return false;
+ pfc::string8 meh;
+ if (strchr(item,separator))
+ {
+ uReplaceChar(meh,item,-1,separator,'|',false);
+ item = meh;
+ }
+ pfc::ptr_list_t<char> list;
+ build_list(list);
+ unsigned n;
+ bool found = false;
+ for(n=0;n<list.get_count();n++)
+ {
+ if (!strcmp(list[n],item))
+ {
+ char* temp = list.remove_by_idx(n);
+ list.insert_item(temp,0);
+ found = true;
+ }
+ }
+
+ if (!found)
+ {
+ while(list.get_count() > m_max) list.delete_by_idx(list.get_count()-1);
+ list.insert_item(_strdup(item),0);
+ }
+ parse_list(list);
+ list.free_all();
+ return found;
+}
+
+bool _cfg_dropdown_history_base::add_item(const char *item, HWND combobox) {
+ const bool state = add_item(item);
+ if (state) uSendMessageText(combobox, CB_ADDSTRING, 0, item);
+ return state;
+}
+
+bool _cfg_dropdown_history_base::is_empty()
+{
+ pfc::string8 temp; get_state(temp);
+ const char * src = temp;
+ while(*src)
+ {
+ if (*src!=separator) return false;
+ src++;
+ }
+ return true;
+}
+
+bool _cfg_dropdown_history_base::on_context(HWND wnd,LPARAM coords) {
+ try {
+ int coords_x = (short)LOWORD(coords), coords_y = (short)HIWORD(coords);
+ if (coords_x == -1 && coords_y == -1)
+ {
+ RECT asdf;
+ GetWindowRect(wnd,&asdf);
+ coords_x = (asdf.left + asdf.right) / 2;
+ coords_y = (asdf.top + asdf.bottom) / 2;
+ }
+ enum {ID_ERASE_ALL = 1, ID_ERASE_ONE };
+ HMENU menu = CreatePopupMenu();
+ uAppendMenu(menu,MF_STRING,ID_ERASE_ALL,"Wipe history");
+ {
+ pfc::string8 tempvalue;
+ uGetWindowText(wnd,tempvalue);
+ if (!tempvalue.is_empty())
+ uAppendMenu(menu,MF_STRING,ID_ERASE_ONE,"Remove this history item");
+ }
+ int cmd = TrackPopupMenu(menu,TPM_RIGHTBUTTON|TPM_NONOTIFY|TPM_RETURNCMD,coords_x,coords_y,0,wnd,0);
+ DestroyMenu(menu);
+ switch(cmd)
+ {
+ case ID_ERASE_ALL:
+ {
+ set_state("");
+ pfc::string8 value;//preserve old value while wiping dropdown list
+ uGetWindowText(wnd,value);
+ uSendMessage(wnd,CB_RESETCONTENT,0,0);
+ uSetWindowText(wnd,value);
+ return true;
+ }
+ case ID_ERASE_ONE:
+ {
+ pfc::string8 value;
+ uGetWindowText(wnd,value);
+
+ pfc::ptr_list_t<char> list;
+ build_list(list);
+ bool found = false;
+ for(t_size n=0;n<list.get_size();n++)
+ {
+ if (!strcmp(value,list[n]))
+ {
+ free(list[n]);
+ list.remove_by_idx(n);
+ found = true;
+ break;
+ }
+ }
+ if (found) parse_list(list);
+ g_setup_dropdown_fromlist(wnd,list);
+ list.free_all();
+ return found;
+ }
+ }
+ } catch(...) {}
+ return false;
+}
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/dropdown_helper.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/dropdown_helper.h new file mode 100644 index 0000000000..910d17b136 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/dropdown_helper.h @@ -0,0 +1,54 @@ +#ifndef _DROPDOWN_HELPER_H_
+#define _DROPDOWN_HELPER_H_
+
+class _cfg_dropdown_history_base
+{
+ const unsigned m_max;
+ void build_list(pfc::ptr_list_t<char> & out);
+ void parse_list(const pfc::ptr_list_t<char> & src);
+public:
+ enum {separator = '\n'};
+ virtual void set_state(const char * val) = 0;
+ virtual void get_state(pfc::string_base & out) const = 0;
+ _cfg_dropdown_history_base(unsigned p_max) : m_max(p_max) {}
+ void on_init(HWND ctrl, const char * initVal) {
+ add_item(initVal); setup_dropdown(ctrl); uSetWindowText(ctrl, initVal);
+ }
+ void setup_dropdown(HWND wnd);
+ void setup_dropdown(HWND wnd,UINT id) {setup_dropdown(GetDlgItem(wnd,id));}
+ bool add_item(const char * item); //returns true when the content has changed, false when not (the item was already on the list)
+ bool add_item(const char * item, HWND combobox); //immediately adds the item to the combobox
+ bool is_empty();
+ bool on_context(HWND wnd,LPARAM coords); //returns true when the content has changed
+};
+
+class cfg_dropdown_history : public _cfg_dropdown_history_base {
+public:
+ cfg_dropdown_history(const GUID & p_guid,unsigned p_max = 10,const char * init_vals = "") : _cfg_dropdown_history_base(p_max), m_state(p_guid, init_vals) {}
+ void set_state(const char * val) {m_state = val;}
+ void get_state(pfc::string_base & out) const {out = m_state;}
+private:
+ cfg_string m_state;
+};
+
+class cfg_dropdown_history_mt : public _cfg_dropdown_history_base {
+public:
+ cfg_dropdown_history_mt(const GUID & p_guid,unsigned p_max = 10,const char * init_vals = "") : _cfg_dropdown_history_base(p_max), m_state(p_guid, init_vals) {}
+ void set_state(const char * val) {m_state.set(val);}
+ void get_state(pfc::string_base & out) const {m_state.get(out);}
+private:
+ cfg_string_mt m_state;
+};
+
+// ATL-compatible message map entry macro for installing dropdown list context menus.
+#define DROPDOWN_HISTORY_HANDLER(ctrlID,var) \
+ if(uMsg == WM_CONTEXTMENU) { \
+ const HWND source = (HWND) wParam; \
+ if (source != NULL && source == CWindow(hWnd).GetDlgItem(ctrlID)) { \
+ var.on_context(source,lParam); \
+ lResult = 0; \
+ return TRUE; \
+ } \
+ }
+
+#endif //_DROPDOWN_HELPER_H_
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/dynamic_bitrate_helper.cpp b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/dynamic_bitrate_helper.cpp new file mode 100644 index 0000000000..2be9380be4 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/dynamic_bitrate_helper.cpp @@ -0,0 +1,74 @@ +#include "stdafx.h"
+
+static unsigned g_query_settings()
+{
+ t_int32 temp;
+ try {
+ config_object::g_get_data_int32(standard_config_objects::int32_dynamic_bitrate_display_rate,temp);
+ } catch(std::exception const &) {return 9;}
+ if (temp < 0) return 0;
+ return (unsigned) temp;
+}
+
+dynamic_bitrate_helper::dynamic_bitrate_helper()
+{
+ reset();
+}
+
+void dynamic_bitrate_helper::init()
+{
+ if (!m_inited)
+ {
+ m_inited = true;
+ unsigned temp = g_query_settings();
+ if (temp > 0) {m_enabled = true; m_update_interval = 1.0 / (double) temp; }
+ else {m_enabled = false; m_update_interval = 0; }
+ m_last_duration = 0;
+ m_update_bits = 0;
+ m_update_time = 0;
+
+ }
+}
+
+void dynamic_bitrate_helper::on_frame(double p_duration,t_size p_bits)
+{
+ init();
+ m_last_duration = p_duration;
+ m_update_time += p_duration;
+ m_update_bits += p_bits;
+}
+
+bool dynamic_bitrate_helper::on_update(file_info & p_out, double & p_timestamp_delta)
+{
+ init();
+
+ bool ret = false;
+ if (m_enabled)
+ {
+ if (m_update_time > m_update_interval)
+ {
+ int val = (int) ( ((double)m_update_bits / m_update_time + 500.0) / 1000.0 );
+ if (val != p_out.info_get_bitrate_vbr())
+ {
+ p_timestamp_delta = - (m_update_time - m_last_duration); //relative to last frame beginning;
+ p_out.info_set_bitrate_vbr(val);
+ ret = true;
+ }
+ m_update_bits = 0;
+ m_update_time = 0;
+ }
+ }
+ else
+ {
+ m_update_bits = 0;
+ m_update_time = 0;
+ }
+
+ return ret;
+
+}
+
+void dynamic_bitrate_helper::reset()
+{
+ m_inited = false;
+}
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/dynamic_bitrate_helper.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/dynamic_bitrate_helper.h new file mode 100644 index 0000000000..6480c679e1 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/dynamic_bitrate_helper.h @@ -0,0 +1,15 @@ +class dynamic_bitrate_helper
+{
+public:
+ dynamic_bitrate_helper();
+ void on_frame(double p_duration,t_size p_bits);
+ bool on_update(file_info & p_out, double & p_timestamp_delta);
+ void reset();
+private:
+ void init();
+ double m_last_duration;
+ t_size m_update_bits;
+ double m_update_time;
+ double m_update_interval;
+ bool m_inited, m_enabled;
+};
\ No newline at end of file diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/file_cached.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/file_cached.h new file mode 100644 index 0000000000..dc6206e6b1 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/file_cached.h @@ -0,0 +1,119 @@ +class file_cached : public file {
+public:
+ static file::ptr g_create(service_ptr_t<file> p_base,abort_callback & p_abort, t_size blockSize) {
+ service_ptr_t<file_cached> temp = new service_impl_t<file_cached>(blockSize);
+ temp->initialize(p_base,p_abort);
+ return temp;
+ }
+ static void g_create(service_ptr_t<file> & p_out,service_ptr_t<file> p_base,abort_callback & p_abort, t_size blockSize) {
+ p_out = g_create(p_base, p_abort, blockSize);
+ }
+protected:
+ file_cached(t_size blocksize) {
+ m_buffer.set_size(blocksize);
+ }
+ void initialize(service_ptr_t<file> p_base,abort_callback & p_abort) {
+ m_base = p_base;
+ m_position = 0;
+ m_can_seek = m_base->can_seek();
+ if (m_can_seek) {
+ m_position_base = m_base->get_position(p_abort);
+ } else {
+ m_position_base = 0;
+ }
+
+ m_size = m_base->get_size(p_abort);
+
+ flush_buffer();
+ }
+public:
+
+ t_size read(void * p_buffer,t_size p_bytes,abort_callback & p_abort) {
+ t_uint8 * outptr = (t_uint8*)p_buffer;
+ t_size done = 0;
+ while(done < p_bytes && m_position < m_size) {
+ p_abort.check();
+
+ if (m_position >= m_buffer_position && m_position < m_buffer_position + m_buffer_status) {
+ t_size delta = pfc::min_t<t_size>((t_size)(m_buffer_position + m_buffer_status - m_position),p_bytes - done);
+ t_size bufptr = (t_size)(m_position - m_buffer_position);
+ memcpy(outptr+done,m_buffer.get_ptr()+bufptr,delta);
+ done += delta;
+ m_position += delta;
+ if (m_buffer_status != m_buffer.get_size() && done < p_bytes) break;//EOF before m_size is hit
+ } else {
+ m_buffer_position = m_position - m_position % m_buffer.get_size();
+ adjust_position(m_buffer_position,p_abort);
+
+ m_buffer_status = m_base->read(m_buffer.get_ptr(),m_buffer.get_size(),p_abort);
+ m_position_base += m_buffer_status;
+
+ if (m_buffer_status <= (t_size)(m_position - m_buffer_position)) break;
+ }
+ }
+
+ return done;
+ }
+
+ void write(const void * p_buffer,t_size p_bytes,abort_callback & p_abort) {
+ p_abort.check();
+ adjust_position(m_position,p_abort);
+ m_base->write(p_buffer,p_bytes,p_abort);
+ m_position_base = m_position = m_position + p_bytes;
+ if (m_size < m_position) m_size = m_position;
+ flush_buffer();
+ }
+
+ t_filesize get_size(abort_callback & p_abort) {
+ p_abort.check();
+ return m_size;
+ }
+ t_filesize get_position(abort_callback & p_abort) {
+ p_abort.check();
+ return m_position;
+ }
+ void set_eof(abort_callback & p_abort) {
+ p_abort.check();
+ adjust_position(m_position,p_abort);
+ m_base->set_eof(p_abort);
+ flush_buffer();
+ }
+ void seek(t_filesize p_position,abort_callback & p_abort) {
+ p_abort.check();
+ if (!m_can_seek) throw exception_io_object_not_seekable();
+ if (p_position > m_size) throw exception_io_seek_out_of_range();
+ m_position = p_position;
+ }
+ void reopen(abort_callback & p_abort) {seek(0,p_abort);}
+ bool can_seek() {return m_can_seek;}
+ bool get_content_type(pfc::string_base & out) {return m_base->get_content_type(out);}
+ void on_idle(abort_callback & p_abort) {p_abort.check();m_base->on_idle(p_abort);}
+ t_filetimestamp get_timestamp(abort_callback & p_abort) {p_abort.check(); return m_base->get_timestamp(p_abort);}
+ bool is_remote() {return m_base->is_remote();}
+ void resize(t_filesize p_size,abort_callback & p_abort) {
+ flush_buffer();
+ m_base->resize(p_size,p_abort);
+ m_size = p_size;
+ if (m_position > m_size) m_position = m_size;
+ if (m_position_base > m_size) m_position_base = m_size;
+ }
+private:
+ void adjust_position(t_filesize p_target,abort_callback & p_abort) {
+ if (p_target != m_position_base) {
+ m_base->seek(p_target,p_abort);
+ m_position_base = p_target;
+ }
+ }
+
+ void flush_buffer() {
+ m_buffer_status = 0;
+ m_buffer_position = 0;
+ }
+
+ service_ptr_t<file> m_base;
+ t_filesize m_position,m_position_base,m_size;
+ bool m_can_seek;
+ t_filesize m_buffer_position;
+ t_size m_buffer_status;
+ pfc::array_t<t_uint8> m_buffer;
+};
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/file_info_const_impl.cpp b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/file_info_const_impl.cpp new file mode 100644 index 0000000000..5e20ea177e --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/file_info_const_impl.cpp @@ -0,0 +1,269 @@ +#include "stdafx.h"
+
+// presorted - do not change without a proper strcmp resort
+static const char * const standard_fieldnames[] = {
+ "ALBUM","ALBUM ARTIST","ARTIST","Album","Album Artist","Artist","COMMENT","Comment","DATE","DISCNUMBER","Date",
+ "Discnumber","GENRE","Genre","TITLE","TOTALTRACKS","TRACKNUMBER","Title","TotalTracks","Totaltracks","TrackNumber",
+ "Tracknumber","album","album artist","artist","comment","date","discnumber","genre","title","totaltracks","tracknumber",
+};
+
+// presorted - do not change without a proper strcmp resort
+static const char * const standard_infonames[] = {
+ "bitrate","bitspersample","channels","codec","codec_profile","encoding","samplerate","tagtype","tool",
+};
+
+static const char * optimize_fieldname(const char * p_string) {
+ t_size index;
+ if (!pfc::binarySearch<pfc::comparator_strcmp>::run(standard_fieldnames,0,PFC_TABSIZE(standard_fieldnames),p_string,index)) return NULL;
+ return standard_fieldnames[index];
+}
+
+static const char * optimize_infoname(const char * p_string) {
+ t_size index;
+ if (!pfc::binarySearch<pfc::comparator_strcmp>::run(standard_infonames,0,PFC_TABSIZE(standard_infonames),p_string,index)) return NULL;
+ return standard_infonames[index];
+}
+
+/*
+order of things
+
+ meta entries
+ meta value map
+ info entries
+ string buffer
+
+*/
+
+inline static char* stringbuffer_append(char * & buffer,const char * value)
+{
+ char * ret = buffer;
+ while(*value) *(buffer++) = *(value++);
+ *(buffer++) = 0;
+ return ret;
+}
+
+#ifdef __file_info_const_impl_have_hintmap__
+
+namespace {
+ class sort_callback_hintmap_impl : public pfc::sort_callback
+ {
+ public:
+ sort_callback_hintmap_impl(const file_info_const_impl::meta_entry * p_meta,file_info_const_impl::t_index * p_hintmap)
+ : m_meta(p_meta), m_hintmap(p_hintmap)
+ {
+ }
+
+ int compare(t_size p_index1, t_size p_index2) const
+ {
+// profiler(sort_callback_hintmap_impl_compare);
+ return pfc::stricmp_ascii(m_meta[m_hintmap[p_index1]].m_name,m_meta[m_hintmap[p_index2]].m_name);
+ }
+
+ void swap(t_size p_index1, t_size p_index2)
+ {
+ pfc::swap_t<file_info_const_impl::t_index>(m_hintmap[p_index1],m_hintmap[p_index2]);
+ }
+ private:
+ const file_info_const_impl::meta_entry * m_meta;
+ file_info_const_impl::t_index * m_hintmap;
+ };
+
+ class bsearch_callback_hintmap_impl// : public pfc::bsearch_callback
+ {
+ public:
+ bsearch_callback_hintmap_impl(
+ const file_info_const_impl::meta_entry * p_meta,
+ const file_info_const_impl::t_index * p_hintmap,
+ const char * p_name,
+ t_size p_name_length)
+ : m_meta(p_meta), m_hintmap(p_hintmap), m_name(p_name), m_name_length(p_name_length)
+ {
+ }
+
+ inline int test(t_size p_index) const
+ {
+ return pfc::stricmp_ascii_ex(m_meta[m_hintmap[p_index]].m_name,~0,m_name,m_name_length);
+ }
+
+ private:
+ const file_info_const_impl::meta_entry * m_meta;
+ const file_info_const_impl::t_index * m_hintmap;
+ const char * m_name;
+ t_size m_name_length;
+ };
+}
+
+#endif//__file_info_const_impl_have_hintmap__
+
+void file_info_const_impl::copy(const file_info & p_source)
+{
+// profiler(file_info_const_impl__copy);
+ t_size meta_size = 0;
+ t_size info_size = 0;
+ t_size valuemap_size = 0;
+ t_size stringbuffer_size = 0;
+#ifdef __file_info_const_impl_have_hintmap__
+ t_size hintmap_size = 0;
+#endif
+
+ {
+// profiler(file_info_const_impl__copy__pass1);
+ t_size index;
+ m_meta_count = pfc::downcast_guarded<t_index>(p_source.meta_get_count());
+ meta_size = m_meta_count * sizeof(meta_entry);
+#ifdef __file_info_const_impl_have_hintmap__
+ hintmap_size = (m_meta_count > hintmap_cutoff) ? m_meta_count * sizeof(t_index) : 0;
+#endif//__file_info_const_impl_have_hintmap__
+ for(index = 0; index < m_meta_count; index++ )
+ {
+ {
+ const char * name = p_source.meta_enum_name(index);
+ if (optimize_fieldname(name) == 0)
+ stringbuffer_size += strlen(name) + 1;
+ }
+
+ t_size val; const t_size val_max = p_source.meta_enum_value_count(index);
+
+ if (val_max == 1)
+ {
+ stringbuffer_size += strlen(p_source.meta_enum_value(index,0)) + 1;
+ }
+ else
+ {
+ valuemap_size += val_max * sizeof(char*);
+
+ for(val = 0; val < val_max; val++ )
+ {
+ stringbuffer_size += strlen(p_source.meta_enum_value(index,val)) + 1;
+ }
+ }
+ }
+
+ m_info_count = pfc::downcast_guarded<t_index>(p_source.info_get_count());
+ info_size = m_info_count * sizeof(info_entry);
+ for(index = 0; index < m_info_count; index++ )
+ {
+ const char * name = p_source.info_enum_name(index);
+ if (optimize_infoname(name) == NULL) stringbuffer_size += strlen(name) + 1;
+ stringbuffer_size += strlen(p_source.info_enum_value(index)) + 1;
+ }
+ }
+
+
+ {
+// profiler(file_info_const_impl__copy__alloc);
+ m_buffer.set_size(
+#ifdef __file_info_const_impl_have_hintmap__
+ hintmap_size +
+#endif
+ meta_size + info_size + valuemap_size + stringbuffer_size);
+ }
+
+ char * walk = m_buffer.get_ptr();
+
+#ifdef __file_info_const_impl_have_hintmap__
+ t_index* hintmap = (hintmap_size > 0) ? (t_index*) walk : NULL;
+ walk += hintmap_size;
+#endif
+ meta_entry * meta = (meta_entry*) walk;
+ walk += meta_size;
+ char ** valuemap = (char**) walk;
+ walk += valuemap_size;
+ info_entry * info = (info_entry*) walk;
+ walk += info_size;
+ char * stringbuffer = walk;
+
+ m_meta = meta;
+ m_info = info;
+#ifdef __file_info_const_impl_have_hintmap__
+ m_hintmap = hintmap;
+#endif
+
+ {
+// profiler(file_info_const_impl__copy__pass2);
+ t_size index;
+ for ( index = 0; index < m_meta_count; index ++ )
+ {
+ t_size val; const t_size val_max = p_source.meta_enum_value_count(index);
+
+ {
+ const char * name = p_source.meta_enum_name(index);
+ const char * name_opt = optimize_fieldname(name);
+ if (name_opt == NULL)
+ meta[index].m_name = stringbuffer_append(stringbuffer, name );
+ else
+ meta[index].m_name = name_opt;
+ }
+
+ meta[index].m_valuecount = val_max;
+
+ if (val_max == 1)
+ {
+ meta[index].m_valuemap = reinterpret_cast<const char * const *>(stringbuffer_append(stringbuffer, p_source.meta_enum_value(index,0) ));
+ }
+ else
+ {
+ meta[index].m_valuemap = valuemap;
+ for ( val = 0; val < val_max ; val ++ )
+ *(valuemap ++ ) = stringbuffer_append(stringbuffer, p_source.meta_enum_value(index,val) );
+ }
+ }
+
+ for ( index = 0; index < m_info_count; index ++ )
+ {
+ const char * name = p_source.info_enum_name(index);
+ const char * name_opt = optimize_infoname(name);
+ if (name_opt == NULL)
+ info[index].m_name = stringbuffer_append(stringbuffer, name );
+ else
+ info[index].m_name = name_opt;
+ info[index].m_value = stringbuffer_append(stringbuffer, p_source.info_enum_value(index) );
+ }
+ }
+
+ m_length = p_source.get_length();
+ m_replaygain = p_source.get_replaygain();
+#ifdef __file_info_const_impl_have_hintmap__
+ if (hintmap != NULL) {
+// profiler(file_info_const_impl__copy__hintmap);
+ for(t_size n=0;n<m_meta_count;n++) hintmap[n]=n;
+ pfc::sort(sort_callback_hintmap_impl(meta,hintmap),m_meta_count);
+ }
+#endif//__file_info_const_impl_have_hintmap__
+}
+
+
+void file_info_const_impl::reset()
+{
+ m_meta_count = m_info_count = 0; m_length = 0; m_replaygain.reset();
+}
+
+t_size file_info_const_impl::meta_find_ex(const char * p_name,t_size p_name_length) const
+{
+#ifdef __file_info_const_impl_have_hintmap__
+ if (m_hintmap != NULL) {
+ t_size result = ~0;
+ if (!pfc::bsearch_inline_t(m_meta_count,bsearch_callback_hintmap_impl(m_meta,m_hintmap,p_name,p_name_length),result)) return ~0;
+ else return m_hintmap[result];
+ } else {
+ return file_info::meta_find_ex(p_name,p_name_length);
+ }
+#else
+ return file_info::meta_find_ex(p_name,p_name_length);
+#endif
+}
+
+
+t_size file_info_const_impl::meta_enum_value_count(t_size p_index) const
+{
+ return m_meta[p_index].m_valuecount;
+}
+
+const char* file_info_const_impl::meta_enum_value(t_size p_index,t_size p_value_number) const
+{
+ const meta_entry & entry = m_meta[p_index];
+ if (entry.m_valuecount == 1)
+ return reinterpret_cast<const char*>(entry.m_valuemap);
+ else
+ return entry.m_valuemap[p_value_number];
+}
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/file_info_const_impl.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/file_info_const_impl.h new file mode 100644 index 0000000000..59ddf35494 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/file_info_const_impl.h @@ -0,0 +1,78 @@ +#define __file_info_const_impl_have_hintmap__
+
+//! Special implementation of file_info that implements only const and copy methods. The difference between this and regular file_info_impl is amount of resources used and speed of the copy operation.
+class file_info_const_impl : public file_info
+{
+public:
+ file_info_const_impl(const file_info & p_source) {copy(p_source);}
+ file_info_const_impl(const file_info_const_impl & p_source) {copy(p_source);}
+ file_info_const_impl() {m_meta_count = m_info_count = 0; m_length = 0; m_replaygain.reset();}
+
+ double get_length() const {return m_length;}
+
+ t_size meta_get_count() const {return m_meta_count;}
+ const char* meta_enum_name(t_size p_index) const {return m_meta[p_index].m_name;}
+ t_size meta_enum_value_count(t_size p_index) const;
+ const char* meta_enum_value(t_size p_index,t_size p_value_number) const;
+ t_size meta_find_ex(const char * p_name,t_size p_name_length) const;
+
+ t_size info_get_count() const {return m_info_count;}
+ const char* info_enum_name(t_size p_index) const {return m_info[p_index].m_name;}
+ const char* info_enum_value(t_size p_index) const {return m_info[p_index].m_value;}
+
+
+ const file_info_const_impl & operator=(const file_info & p_source) {copy(p_source); return *this;}
+ const file_info_const_impl & operator=(const file_info_const_impl & p_source) {copy(p_source); return *this;}
+ void copy(const file_info & p_source);
+ void reset();
+
+ replaygain_info get_replaygain() const {return m_replaygain;}
+
+private:
+ void set_length(double p_length) {uBugCheck();}
+
+ t_size meta_set_ex(const char * p_name,t_size p_name_length,const char * p_value,t_size p_value_length) {uBugCheck();}
+ void meta_insert_value_ex(t_size p_index,t_size p_value_index,const char * p_value,t_size p_value_length) {uBugCheck();}
+ void meta_remove_mask(const bit_array & p_mask) {uBugCheck();}
+ void meta_reorder(const t_size * p_order) {uBugCheck();}
+ void meta_remove_values(t_size p_index,const bit_array & p_mask) {uBugCheck();}
+ void meta_modify_value_ex(t_size p_index,t_size p_value_index,const char * p_value,t_size p_value_length) {uBugCheck();}
+
+ t_size info_set_ex(const char * p_name,t_size p_name_length,const char * p_value,t_size p_value_length) {uBugCheck();}
+ void info_remove_mask(const bit_array & p_mask) {uBugCheck();}
+
+ void set_replaygain(const replaygain_info & p_info) {uBugCheck();}
+
+ t_size meta_set_nocheck_ex(const char * p_name,t_size p_name_length,const char * p_value,t_size p_value_length) {uBugCheck();}
+ t_size info_set_nocheck_ex(const char * p_name,t_size p_name_length,const char * p_value,t_size p_value_length) {uBugCheck();}
+public:
+ struct meta_entry {
+ const char * m_name;
+ t_size m_valuecount;
+ const char * const * m_valuemap;
+ };
+
+ struct info_entry {
+ const char * m_name;
+ const char * m_value;
+ };
+
+#ifdef __file_info_const_impl_have_hintmap__
+ typedef t_uint32 t_index;
+ enum {hintmap_cutoff = 20};
+#endif//__file_info_const_impl_have_hintmap__
+private:
+ pfc::array_t<char> m_buffer;
+ t_index m_meta_count;
+ t_index m_info_count;
+
+ const meta_entry * m_meta;
+ const info_entry * m_info;
+
+#ifdef __file_info_const_impl_have_hintmap__
+ const t_index * m_hintmap;
+#endif
+
+ double m_length;
+ replaygain_info m_replaygain;
+};
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/file_list_helper.cpp b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/file_list_helper.cpp new file mode 100644 index 0000000000..4053e73a0d --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/file_list_helper.cpp @@ -0,0 +1,70 @@ +#include "stdafx.h"
+
+static void file_list_remove_duplicates(pfc::ptr_list_t<char> & out)
+{
+ t_size n, m = out.get_count();
+ out.sort_t(metadb::path_compare);
+ bit_array_bittable mask(m);
+ t_size duplicates = 0;
+ for(n=1;n<m;n++) {
+ if (!metadb::path_compare(out[n-1],out[n])) {duplicates++;mask.set(n,true);}
+ }
+ if (duplicates>0) {
+ out.free_mask(mask);
+ }
+}
+
+
+namespace file_list_helper
+{
+ t_size file_list_from_metadb_handle_list::g_get_count(metadb_handle_list_cref data, t_size max) {
+ pfc::avltree_t<const char*, metadb::path_comparator> content;
+ const t_size inCount = data.get_size();
+ for(t_size walk = 0; walk < inCount && content.get_count() < max; ++walk) {
+ content += data[walk]->get_path();
+ }
+ return content.get_count();
+ }
+ void file_list_from_metadb_handle_list::__add(const char * p_what) {
+ char * temp = _strdup(p_what);
+ if (temp == NULL) throw std::bad_alloc();
+ try {m_data.add_item(temp); } catch(...) {free(temp); throw;}
+ }
+
+ void file_list_from_metadb_handle_list::init_from_list(const list_base_const_t<metadb_handle_ptr> & p_list)
+ {
+ m_data.free_all();
+
+ t_size n, m = p_list.get_count();
+ for(n=0;n<m;n++) {
+ __add( p_list.get_item(n)->get_path() );
+ }
+ file_list_remove_duplicates(m_data);
+ }
+
+ void file_list_from_metadb_handle_list::init_from_list_display(const list_base_const_t<metadb_handle_ptr> & p_list)
+ {
+ m_data.free_all();
+
+ pfc::string8_fastalloc temp;
+
+ t_size n, m = p_list.get_count();
+ for(n=0;n<m;n++)
+ {
+ filesystem::g_get_display_path(p_list.get_item(n)->get_path(),temp);
+ __add(temp);
+ }
+ file_list_remove_duplicates(m_data);
+
+
+ }
+
+ t_size file_list_from_metadb_handle_list::get_count() const {return m_data.get_count();}
+ void file_list_from_metadb_handle_list::get_item_ex(const char * & p_out,t_size n) const {p_out = m_data.get_item(n);}
+
+ file_list_from_metadb_handle_list::~file_list_from_metadb_handle_list()
+ {
+ m_data.free_all();
+ }
+
+}
\ No newline at end of file diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/file_list_helper.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/file_list_helper.h new file mode 100644 index 0000000000..3cf03831c5 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/file_list_helper.h @@ -0,0 +1,30 @@ +#ifndef _foobar2000_helpers_file_list_helper_
+#define _foobar2000_helpers_file_list_helper_
+
+
+namespace file_list_helper
+{
+ //list guaranteed to be sorted by metadb::path_compare
+ class file_list_from_metadb_handle_list : public pfc::list_base_const_t<const char*> {
+ public:
+
+ static t_size g_get_count(const list_base_const_t<metadb_handle_ptr> & p_list, t_size max = ~0);
+
+ void init_from_list(const list_base_const_t<metadb_handle_ptr> & p_list);
+ void init_from_list_display(const list_base_const_t<metadb_handle_ptr> & p_list);
+
+ t_size get_count() const;
+ void get_item_ex(const char * & p_out,t_size n) const;
+
+ ~file_list_from_metadb_handle_list();
+
+ private:
+ void __add(const char * p_what);
+ pfc::ptr_list_t<char> m_data;
+ };
+
+
+};
+
+
+#endif //_foobar2000_helpers_file_list_helper_
\ No newline at end of file diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/file_move_helper.cpp b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/file_move_helper.cpp new file mode 100644 index 0000000000..4c2336b67c --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/file_move_helper.cpp @@ -0,0 +1,38 @@ +#include "stdafx.h"
+
+bool file_move_helper::g_on_deleted(const pfc::list_base_const_t<const char *> & p_files)
+{
+ file_operation_callback::g_on_files_deleted(p_files);
+ return true;
+}
+
+t_size file_move_helper::g_filter_dead_files_sorted_make_mask(pfc::list_base_t<metadb_handle_ptr> & p_data,const pfc::list_base_const_t<const char*> & p_dead,bit_array_var & p_mask)
+{
+ t_size n, m = p_data.get_count();
+ t_size found = 0;
+ for(n=0;n<m;n++)
+ {
+ t_size dummy;
+ bool dead = p_dead.bsearch_t(metadb::path_compare,p_data.get_item(n)->get_path(),dummy);
+ if (dead) found++;
+ p_mask.set(n,dead);
+ }
+ return found;
+}
+
+t_size file_move_helper::g_filter_dead_files_sorted(pfc::list_base_t<metadb_handle_ptr> & p_data,const pfc::list_base_const_t<const char*> & p_dead)
+{
+ bit_array_bittable mask(p_data.get_count());
+ t_size found = g_filter_dead_files_sorted_make_mask(p_data,p_dead,mask);
+ if (found > 0) p_data.remove_mask(mask);
+ return found;
+}
+
+t_size file_move_helper::g_filter_dead_files(pfc::list_base_t<metadb_handle_ptr> & p_data,const pfc::list_base_const_t<const char*> & p_dead)
+{
+ pfc::ptr_list_t<const char> temp;
+ temp.add_items(p_dead);
+ temp.sort_t(metadb::path_compare);
+ return g_filter_dead_files_sorted(p_data,temp);
+}
+
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/file_move_helper.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/file_move_helper.h new file mode 100644 index 0000000000..e52d0a628e --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/file_move_helper.h @@ -0,0 +1,8 @@ +class file_move_helper {
+public:
+ static bool g_on_deleted(const pfc::list_base_const_t<const char *> & p_files);
+
+ static t_size g_filter_dead_files_sorted_make_mask(pfc::list_base_t<metadb_handle_ptr> & p_data,const pfc::list_base_const_t<const char*> & p_dead,bit_array_var & p_mask);
+ static t_size g_filter_dead_files_sorted(pfc::list_base_t<metadb_handle_ptr> & p_data,const pfc::list_base_const_t<const char*> & p_dead);
+ static t_size g_filter_dead_files(pfc::list_base_t<metadb_handle_ptr> & p_data,const pfc::list_base_const_t<const char*> & p_dead);
+};
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/file_win32_wrapper.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/file_win32_wrapper.h new file mode 100644 index 0000000000..b8061a3485 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/file_win32_wrapper.h @@ -0,0 +1,183 @@ +namespace file_win32_helpers {
+ static t_filesize get_size(HANDLE p_handle) {
+ union {
+ t_uint64 val64;
+ t_uint32 val32[2];
+ } u;
+
+ u.val64 = 0;
+ SetLastError(NO_ERROR);
+ u.val32[0] = GetFileSize(p_handle,reinterpret_cast<DWORD*>(&u.val32[1]));
+ if (GetLastError()!=NO_ERROR) exception_io_from_win32(GetLastError());
+ return u.val64;
+ }
+ static void seek(HANDLE p_handle,t_sfilesize p_position,file::t_seek_mode p_mode) {
+ union {
+ t_int64 temp64;
+ struct {
+ DWORD temp_lo;
+ LONG temp_hi;
+ };
+ };
+
+ temp64 = p_position;
+ SetLastError(ERROR_SUCCESS);
+ temp_lo = SetFilePointer(p_handle,temp_lo,&temp_hi,(DWORD)p_mode);
+ if (GetLastError() != ERROR_SUCCESS) exception_io_from_win32(GetLastError());
+ }
+}
+
+template<bool p_seekable,bool p_writeable>
+class file_win32_wrapper_t : public file {
+public:
+ file_win32_wrapper_t(HANDLE p_handle) : m_handle(p_handle), m_position(0)
+ {
+ }
+
+ static service_ptr_t<file> g_CreateFile(const char * p_path,DWORD p_access,DWORD p_sharemode,LPSECURITY_ATTRIBUTES p_security_attributes,DWORD p_createmode,DWORD p_flags,HANDLE p_template) {
+ SetLastError(NO_ERROR);
+ HANDLE handle = uCreateFile(p_path,p_access,p_sharemode,p_security_attributes,p_createmode,p_flags,p_template);
+ if (handle == INVALID_HANDLE_VALUE) exception_io_from_win32(GetLastError());
+ try {
+ return g_create_from_handle(handle);
+ } catch(...) {CloseHandle(handle); throw;}
+ }
+
+ static service_ptr_t<file> g_create_from_handle(HANDLE p_handle) {
+ return new service_impl_t<file_win32_wrapper_t<p_seekable,p_writeable> >(p_handle);
+ }
+
+
+ void reopen(abort_callback & p_abort) {seek(0,p_abort);}
+
+ void write(const void * p_buffer,t_size p_bytes,abort_callback & p_abort) {
+ if (!p_writeable) throw exception_io_denied();
+
+ PFC_STATIC_ASSERT(sizeof(t_size) >= sizeof(DWORD));
+
+ t_size bytes_written_total = 0;
+
+ if (sizeof(t_size) == sizeof(DWORD)) {
+ p_abort.check_e();
+ DWORD bytes_written = 0;
+ SetLastError(ERROR_SUCCESS);
+ if (!WriteFile(m_handle,p_buffer,(DWORD)p_bytes,&bytes_written,0)) exception_io_from_win32(GetLastError());
+ if (bytes_written != p_bytes) throw exception_io("Write failure");
+ bytes_written_total = bytes_written;
+ m_position += bytes_written;
+ } else {
+ while(bytes_written_total < p_bytes) {
+ p_abort.check_e();
+ DWORD bytes_written = 0;
+ DWORD delta = (DWORD) pfc::min_t<t_size>(p_bytes - bytes_written_total, 0x80000000);
+ SetLastError(ERROR_SUCCESS);
+ if (!WriteFile(m_handle,(const t_uint8*)p_buffer + bytes_written_total,delta,&bytes_written,0)) exception_io_from_win32(GetLastError());
+ if (bytes_written != delta) throw exception_io("Write failure");
+ bytes_written_total += bytes_written;
+ m_position += bytes_written;
+ }
+ }
+ }
+
+ t_size read(void * p_buffer,t_size p_bytes,abort_callback & p_abort) {
+ PFC_STATIC_ASSERT(sizeof(t_size) >= sizeof(DWORD));
+
+ t_size bytes_read_total = 0;
+ if (sizeof(t_size) == sizeof(DWORD)) {
+ p_abort.check_e();
+ DWORD bytes_read = 0;
+ SetLastError(ERROR_SUCCESS);
+ if (!ReadFile(m_handle,p_buffer,pfc::downcast_guarded<DWORD>(p_bytes),&bytes_read,0)) exception_io_from_win32(GetLastError());
+ bytes_read_total = bytes_read;
+ m_position += bytes_read;
+ } else {
+ while(bytes_read_total < p_bytes) {
+ p_abort.check_e();
+ DWORD bytes_read = 0;
+ DWORD delta = (DWORD) pfc::min_t<t_size>(p_bytes - bytes_read_total, 0x80000000);
+ SetLastError(ERROR_SUCCESS);
+ if (!ReadFile(m_handle,(t_uint8*)p_buffer + bytes_read_total,delta,&bytes_read,0)) exception_io_from_win32(GetLastError());
+ bytes_read_total += bytes_read;
+ m_position += bytes_read;
+ if (bytes_read != delta) break;
+ }
+ }
+ return bytes_read_total;
+ }
+
+
+ t_filesize get_size(abort_callback & p_abort) {
+ p_abort.check_e();
+ return file_win32_helpers::get_size(m_handle);
+ }
+
+ t_filesize get_position(abort_callback & p_abort) {
+ p_abort.check_e();
+ return m_position;
+ }
+
+ void resize(t_filesize p_size,abort_callback & p_abort) {
+ if (!p_writeable) throw exception_io_denied();
+ p_abort.check_e();
+ if (m_position != p_size) {
+ file_win32_helpers::seek(m_handle,p_size,file::seek_from_beginning);
+ }
+ SetLastError(ERROR_SUCCESS);
+ if (!SetEndOfFile(m_handle)) {
+ DWORD code = GetLastError();
+ if (m_position != p_size) try {file_win32_helpers::seek(m_handle,m_position,file::seek_from_beginning);} catch(...) {}
+ exception_io_from_win32(code);
+ }
+ if (m_position > p_size) m_position = p_size;
+ if (m_position != p_size) file_win32_helpers::seek(m_handle,m_position,file::seek_from_beginning);
+ }
+
+#if 0
+ void set_eof(abort_callback & p_abort) {
+ if (!p_writeable) throw exception_io_denied();
+ p_abort.check_e();
+
+ SetLastError(ERROR_SUCCESS);
+ if (!SetEndOfFile(m_handle)) exception_io_from_win32(GetLastError());
+ }
+#endif
+
+ void seek(t_filesize p_position,abort_callback & p_abort) {
+ if (!p_seekable) throw exception_io_object_not_seekable();
+ p_abort.check_e();
+ if (p_position > file_win32_helpers::get_size(m_handle)) throw exception_io_seek_out_of_range();
+ file_win32_helpers::seek(m_handle,p_position,file::seek_from_beginning);
+ m_position = p_position;
+ //return seek_ex((t_sfilesize)p_position,file::seek_from_beginning,p_abort);
+ }
+#if 0
+ void seek_ex(t_sfilesize p_position,file::t_seek_mode p_mode,abort_callback & p_abort) {
+ if (!p_seekable) throw exception_io_object_not_seekable();
+ p_abort.check_e();
+
+ file_win32_helpers::seek(m_handle,p_position,p_mode);
+
+ m_position = (t_filesize) temp64;
+ }
+#endif
+
+ bool can_seek() {return p_seekable;}
+ bool get_content_type(pfc::string_base & out) {return false;}
+ bool is_in_memory() {return false;}
+ void on_idle(abort_callback & p_abort) {p_abort.check_e();}
+
+ t_filetimestamp get_timestamp(abort_callback & p_abort) {
+ p_abort.check_e();
+ FlushFileBuffers(m_handle);
+ SetLastError(ERROR_SUCCESS);
+ t_filetimestamp temp;
+ if (!GetFileTime(m_handle,0,0,(FILETIME*)&temp)) exception_io_from_win32(GetLastError());
+ return temp;
+ }
+
+ bool is_remote() {return false;}
+ ~file_win32_wrapper_t() {CloseHandle(m_handle);}
+private:
+ HANDLE m_handle;
+ t_filesize m_position;
+};
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/file_wrapper_simple.cpp b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/file_wrapper_simple.cpp new file mode 100644 index 0000000000..79b61b197a --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/file_wrapper_simple.cpp @@ -0,0 +1,75 @@ +#include "stdafx.h"
+
+t_size file_wrapper_simple::read(void * p_buffer,t_size p_bytes) {
+ if (m_has_failed) return 0;
+ try {
+ return m_file->read(p_buffer,p_bytes,m_abort);
+ } catch(std::exception const &) {
+ m_has_failed = true;
+ return 0;
+ }
+}
+
+t_size file_wrapper_simple::write(const void * p_buffer,t_size p_bytes) {
+ if (m_has_failed) return 0;
+ try {
+ m_file->write(p_buffer,p_bytes,m_abort);
+ return p_bytes;
+ } catch(std::exception const &) {
+ m_has_failed = true;
+ return 0;
+ }
+}
+
+bool file_wrapper_simple::seek(t_filesize p_offset) {
+ if (m_has_failed) return false;
+ try {
+ m_file->seek(p_offset,m_abort);
+ return true;
+ } catch(std::exception const &) {
+ m_has_failed = true;
+ return false;
+ }
+}
+
+t_filesize file_wrapper_simple::get_position() {
+ if (m_has_failed) return filesize_invalid;
+ try {
+ return m_file->get_position(m_abort);
+ } catch(std::exception const &) {
+ m_has_failed = true;
+ return filesize_invalid;
+ }
+}
+
+bool file_wrapper_simple::truncate() {
+ if (m_has_failed) return false;
+ try {
+ m_file->set_eof(m_abort);
+ return true;
+ } catch(std::exception) {
+ m_has_failed = true;
+ return true;
+ }
+}
+
+
+t_filesize file_wrapper_simple::get_size() {
+ if (m_has_failed) return filesize_invalid;
+ try {
+ return m_file->get_size(m_abort);
+ } catch(std::exception const &) {
+ m_has_failed = true;
+ return filesize_invalid;
+ }
+}
+
+bool file_wrapper_simple::can_seek() {
+ if (m_has_failed) return false;
+ try {
+ return m_file->can_seek();
+ } catch(std::exception const &) {
+ m_has_failed = true;
+ return false;
+ }
+}
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/file_wrapper_simple.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/file_wrapper_simple.h new file mode 100644 index 0000000000..6819d0ddf7 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/file_wrapper_simple.h @@ -0,0 +1,21 @@ +class file_wrapper_simple
+{
+public:
+ explicit file_wrapper_simple(const service_ptr_t<file> & p_file,abort_callback & p_abort) : m_file(p_file), m_abort(p_abort), m_has_failed(false) {}
+
+ inline bool has_failed() const {return m_has_failed;}
+ inline void reset_status() {m_has_failed = false;}
+
+
+ t_size read(void * p_buffer,t_size p_bytes);
+ t_size write(const void * p_buffer,t_size p_bytes);
+ bool seek(t_filesize p_offset);
+ t_filesize get_position();
+ t_filesize get_size();
+ bool can_seek();
+ bool truncate();
+private:
+ service_ptr_t<file> m_file;
+ abort_callback & m_abort;
+ bool m_has_failed;
+};
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/filetimetools.cpp b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/filetimetools.cpp new file mode 100644 index 0000000000..a5a9068b06 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/filetimetools.cpp @@ -0,0 +1,93 @@ +#include "stdafx.h"
+
+
+#ifndef _WIN32
+#error PORTME
+#endif
+
+static bool is_spacing(char c) {return c == ' ' || c==10 || c==13 || c == '\t';}
+
+static bool is_spacing(const char * str, t_size len) {
+ for(t_size walk = 0; walk < len; ++walk) if (!is_spacing(str[walk])) return false;
+ return true;
+}
+
+typedef exception_io_data exception_time_error;
+
+static unsigned ParseDateElem(const char * ptr, t_size len) {
+ unsigned ret = 0;
+ for(t_size walk = 0; walk < len; ++walk) {
+ const char c = ptr[walk];
+ if (c < '0' || c > '9') throw exception_time_error();
+ ret = ret * 10 + (unsigned)(c - '0');
+ }
+ return ret;
+}
+
+t_filetimestamp foobar2000_io::filetimestamp_from_string(const char * date) {
+ // Accepted format
+ // YYYY-MM-DD HH:MM:SS
+ try {
+ t_size remaining = strlen(date);
+ SYSTEMTIME st = {};
+ st.wDay = 1; st.wMonth = 1;
+ for (;;) {
+#define ADVANCE(n) { PFC_ASSERT( remaining >= n); date += n; remaining -= n; }
+#define ADVANCE_TEST(n) { if (remaining < n) throw exception_time_error(); }
+#define PARSE(var, digits) { ADVANCE_TEST(digits); var = (WORD) ParseDateElem(date, digits); ADVANCE(digits) ; }
+#define TEST_END( durationIncrement )
+#define SKIP(c) { ADVANCE_TEST(1); if (date[0] != c) throw exception_time_error(); ADVANCE(1); }
+#define SKIP_SPACING() {while(remaining > 0 && is_spacing(*date)) ADVANCE(1);}
+ SKIP_SPACING();
+ PARSE( st.wYear, 4 ); if (st.wYear < 1601) throw exception_time_error();
+ TEST_END(wYear); SKIP('-');
+ PARSE( st.wMonth, 2 ); if (st.wMonth < 1 || st.wMonth > 12) throw exception_time_error();
+ TEST_END(wMonth); SKIP('-');
+ PARSE( st.wDay, 2); if (st.wDay < 1 || st.wDay > 31) throw exception_time_error();
+ TEST_END(wDay); SKIP(' ');
+ PARSE( st.wHour, 2); if (st.wHour >= 24) throw exception_time_error();
+ TEST_END(wHour); SKIP(':');
+ PARSE( st.wMinute, 2); if (st.wMinute >= 60) throw exception_time_error();
+ TEST_END(wMinute); SKIP(':');
+ PARSE( st.wSecond, 2); if (st.wSecond >= 60) throw exception_time_error();
+ SKIP_SPACING();
+ TEST_END( wSecond );
+#undef ADVANCE
+#undef ADVANCE_TEST
+#undef PARSE
+#undef TEST_END
+#undef SKIP
+#undef SKIP_SPACING
+ if (remaining > 0) throw exception_time_error();
+ break;
+ }
+ t_filetimestamp base, out;
+ if (!SystemTimeToFileTime(&st, (FILETIME*) &base)) throw exception_time_error();
+ if (!LocalFileTimeToFileTime((const FILETIME*)&base, (FILETIME*)&out)) throw exception_time_error();
+ return out;
+ } catch(exception_time_error) {
+ return filetimestamp_invalid;
+ }
+}
+
+
+
+format_filetimestamp::format_filetimestamp(t_filetimestamp p_timestamp) {
+ SYSTEMTIME st; FILETIME ft;
+ if (FileTimeToLocalFileTime((FILETIME*)&p_timestamp,&ft)) {
+ if (FileTimeToSystemTime(&ft,&st)) {
+ m_buffer
+ << pfc::format_uint(st.wYear,4) << "-" << pfc::format_uint(st.wMonth,2) << "-" << pfc::format_uint(st.wDay,2) << " "
+ << pfc::format_uint(st.wHour,2) << ":" << pfc::format_uint(st.wMinute,2) << ":" << pfc::format_uint(st.wSecond,2);
+ } else m_buffer << "<invalid timestamp>";
+ } else m_buffer << "<invalid timestamp>";
+}
+
+format_filetimestamp_utc::format_filetimestamp_utc(t_filetimestamp p_timestamp) {
+ SYSTEMTIME st;
+ if (FileTimeToSystemTime((const FILETIME*)&p_timestamp,&st)) {
+ m_buffer
+ << pfc::format_uint(st.wYear,4) << "-" << pfc::format_uint(st.wMonth,2) << "-" << pfc::format_uint(st.wDay,2) << " "
+ << pfc::format_uint(st.wHour,2) << ":" << pfc::format_uint(st.wMinute,2) << ":" << pfc::format_uint(st.wSecond,2);
+ } else m_buffer << "<invalid timestamp>";
+}
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/filetimetools.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/filetimetools.h new file mode 100644 index 0000000000..25867dbeac --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/filetimetools.h @@ -0,0 +1,23 @@ +namespace foobar2000_io {
+ t_filetimestamp filetimestamp_from_string(const char * date);
+
+ //! Warning: this formats according to system timezone settings, created strings should be used for display only, never for storage.
+ class format_filetimestamp {
+ public:
+ format_filetimestamp(t_filetimestamp p_timestamp);
+ operator const char*() const {return m_buffer;}
+ const char * get_ptr() const {return m_buffer;}
+ private:
+ pfc::string_fixed_t<32> m_buffer;
+ };
+
+ class format_filetimestamp_utc {
+ public:
+ format_filetimestamp_utc(t_filetimestamp p_timestamp);
+ operator const char*() const {return m_buffer;}
+ const char * get_ptr() const {return m_buffer;}
+ private:
+ pfc::string_fixed_t<32> m_buffer;
+ };
+
+}
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/foobar2000_12.vcxproj.filters b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/foobar2000_12.vcxproj.filters new file mode 100644 index 0000000000..25e20aa581 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/foobar2000_12.vcxproj.filters @@ -0,0 +1,224 @@ +<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{4f22ab27-58fc-4da2-95dc-4db23e50e87f}</UniqueIdentifier>
+ <Extensions>cpp;c;cxx;rc;def;r;odl;idl;hpj;bat</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{fe1c86a9-301a-461d-a3cd-b576f4f1fdf3}</UniqueIdentifier>
+ <Extensions>h;hpp;hxx;hm;inl</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="clipboard.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="create_directory_helper.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="cue_creator.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="cue_parser.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="cue_parser_embedding.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="cuesheet_index_list.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="dialog_resize_helper.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="dropdown_helper.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="dynamic_bitrate_helper.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="file_info_const_impl.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="file_list_helper.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="file_move_helper.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="file_wrapper_simple.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="filetimetools.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="IDataObjectUtils.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="input_helpers.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="listview_helper.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="metadb_io_hintlist.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="mp3_utils.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="seekabilizer.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="StdAfx.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="stream_buffer_helper.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="text_file_loader.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="VisUtils.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="wildcard.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="win32_dialog.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="win32_misc.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="window_placement_helper.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="album_art_helpers.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="bitreader_helper.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="CallForwarder.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="cfg_guidlist.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="clipboard.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="COM_utils.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="create_directory_helper.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="cue_creator.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="cue_parser.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="cuesheet_index_list.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="dialog_resize_helper.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="dropdown_helper.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="dynamic_bitrate_helper.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="file_cached.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="file_info_const_impl.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="file_list_helper.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="file_move_helper.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="file_win32_wrapper.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="file_wrapper_simple.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="filetimetools.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="helpers.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="icon_remapping_wildcard.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="IDataObjectUtils.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="input_helpers.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="listview_helper.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="meta_table_builder.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="metadb_io_hintlist.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="mp3_utils.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="playlist_position_reference_tracker.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="ProfileCache.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="seekabilizer.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="StdAfx.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="stream_buffer_helper.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="string_filter.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="text_file_loader.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="ThreadUtils.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="VisUtils.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="wildcard.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="win32_dialog.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="win32_misc.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="window_placement_helper.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ </ItemGroup>
+</Project>
\ No newline at end of file diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/foobar2000_14.vcxproj.filters b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/foobar2000_14.vcxproj.filters new file mode 100644 index 0000000000..25e20aa581 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/foobar2000_14.vcxproj.filters @@ -0,0 +1,224 @@ +<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{4f22ab27-58fc-4da2-95dc-4db23e50e87f}</UniqueIdentifier>
+ <Extensions>cpp;c;cxx;rc;def;r;odl;idl;hpj;bat</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{fe1c86a9-301a-461d-a3cd-b576f4f1fdf3}</UniqueIdentifier>
+ <Extensions>h;hpp;hxx;hm;inl</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="clipboard.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="create_directory_helper.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="cue_creator.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="cue_parser.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="cue_parser_embedding.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="cuesheet_index_list.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="dialog_resize_helper.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="dropdown_helper.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="dynamic_bitrate_helper.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="file_info_const_impl.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="file_list_helper.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="file_move_helper.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="file_wrapper_simple.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="filetimetools.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="IDataObjectUtils.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="input_helpers.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="listview_helper.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="metadb_io_hintlist.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="mp3_utils.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="seekabilizer.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="StdAfx.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="stream_buffer_helper.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="text_file_loader.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="VisUtils.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="wildcard.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="win32_dialog.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="win32_misc.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="window_placement_helper.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="album_art_helpers.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="bitreader_helper.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="CallForwarder.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="cfg_guidlist.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="clipboard.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="COM_utils.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="create_directory_helper.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="cue_creator.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="cue_parser.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="cuesheet_index_list.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="dialog_resize_helper.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="dropdown_helper.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="dynamic_bitrate_helper.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="file_cached.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="file_info_const_impl.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="file_list_helper.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="file_move_helper.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="file_win32_wrapper.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="file_wrapper_simple.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="filetimetools.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="helpers.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="icon_remapping_wildcard.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="IDataObjectUtils.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="input_helpers.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="listview_helper.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="meta_table_builder.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="metadb_io_hintlist.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="mp3_utils.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="playlist_position_reference_tracker.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="ProfileCache.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="seekabilizer.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="StdAfx.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="stream_buffer_helper.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="string_filter.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="text_file_loader.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="ThreadUtils.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="VisUtils.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="wildcard.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="win32_dialog.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="win32_misc.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="window_placement_helper.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ </ItemGroup>
+</Project>
\ No newline at end of file diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/foobar2000_SDK_14.vcxproj b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/foobar2000_SDK_14.vcxproj new file mode 100644 index 0000000000..3490b8b312 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/foobar2000_SDK_14.vcxproj @@ -0,0 +1,341 @@ +<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{E8091321-D79D-4575-86EF-064EA1A4A20D}</ProjectGuid>
+ <RootNamespace>foobar2000_SDK</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <UseOfMfc>false</UseOfMfc>
+ <CharacterSet>Unicode</CharacterSet>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <UseOfMfc>false</UseOfMfc>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup>
+ <_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\Obj\$(ProjectName)\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\Obj\$(ProjectName)\</IntDir>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\Obj\$(ProjectName)\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\Obj\$(ProjectName)\</IntDir>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>_DEBUG;_WINDOWS;_WIN32_WINNT=0x501;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <PrecompiledHeader>Use</PrecompiledHeader>
+ <PrecompiledHeaderFile>foobar2000.h</PrecompiledHeaderFile>
+ <WarningLevel>Level3</WarningLevel>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <Culture>0x0409</Culture>
+ </ResourceCompile>
+ <Lib>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ </Lib>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <Optimization>MinSpace</Optimization>
+ <PreprocessorDefinitions>NDEBUG;_WINDOWS;_WIN32_WINNT=0x501;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <StringPooling>true</StringPooling>
+ <BufferSecurityCheck>false</BufferSecurityCheck>
+ <FloatingPointModel>Fast</FloatingPointModel>
+ <RuntimeTypeInfo>false</RuntimeTypeInfo>
+ <PrecompiledHeader>Use</PrecompiledHeader>
+ <PrecompiledHeaderFile>foobar2000.h</PrecompiledHeaderFile>
+ <WarningLevel>Level3</WarningLevel>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <Culture>0x0409</Culture>
+ </ResourceCompile>
+ <Lib>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ </Lib>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClInclude Include="abort_callback.h" />
+ <ClInclude Include="advconfig.h" />
+ <ClInclude Include="album_art.h" />
+ <ClInclude Include="app_close_blocker.h" />
+ <ClInclude Include="audio_chunk.h" />
+ <ClInclude Include="audio_postprocessor.h" />
+ <ClInclude Include="autoplaylist.h" />
+ <ClInclude Include="cfg_var.h" />
+ <ClInclude Include="chapterizer.h" />
+ <ClInclude Include="commandline.h" />
+ <ClInclude Include="completion_notify.h" />
+ <ClInclude Include="component.h" />
+ <ClInclude Include="componentversion.h" />
+ <ClInclude Include="config_io_callback.h" />
+ <ClInclude Include="config_object.h" />
+ <ClInclude Include="config_object_impl.h" />
+ <ClInclude Include="console.h" />
+ <ClInclude Include="contextmenu.h" />
+ <ClInclude Include="contextmenu_manager.h" />
+ <ClInclude Include="core_api.h" />
+ <ClInclude Include="coreversion.h" />
+ <ClInclude Include="dsp.h" />
+ <ClInclude Include="dsp_manager.h" />
+ <ClInclude Include="event_logger.h" />
+ <ClInclude Include="exceptions.h" />
+ <ClInclude Include="file_info.h" />
+ <ClInclude Include="file_info_impl.h" />
+ <ClInclude Include="file_operation_callback.h" />
+ <ClInclude Include="filesystem.h" />
+ <ClInclude Include="filesystem_helper.h" />
+ <ClInclude Include="foobar2000.h" />
+ <ClInclude Include="genrand.h" />
+ <ClInclude Include="hasher_md5.h" />
+ <ClInclude Include="http_client.h" />
+ <ClInclude Include="icon_remap.h" />
+ <ClInclude Include="info_lookup_handler.h" />
+ <ClInclude Include="initquit.h" />
+ <ClInclude Include="input.h" />
+ <ClInclude Include="input_file_type.h" />
+ <ClInclude Include="input_impl.h" />
+ <ClInclude Include="library_manager.h" />
+ <ClInclude Include="link_resolver.h" />
+ <ClInclude Include="main_thread_callback.h" />
+ <ClInclude Include="mem_block_container.h" />
+ <ClInclude Include="menu.h" />
+ <ClInclude Include="menu_helpers.h" />
+ <ClInclude Include="message_loop.h" />
+ <ClInclude Include="metadb.h" />
+ <ClInclude Include="metadb_handle.h" />
+ <ClInclude Include="modeless_dialog.h" />
+ <ClInclude Include="ole_interaction.h" />
+ <ClInclude Include="packet_decoder.h" />
+ <ClInclude Include="play_callback.h" />
+ <ClInclude Include="playable_location.h" />
+ <ClInclude Include="playback_control.h" />
+ <ClInclude Include="playback_stream_capture.h" />
+ <ClInclude Include="playlist.h" />
+ <ClInclude Include="playlist_loader.h" />
+ <ClInclude Include="popup_message.h" />
+ <ClInclude Include="preferences_page.h" />
+ <ClInclude Include="replaygain.h" />
+ <ClInclude Include="replaygain_scanner.h" />
+ <ClInclude Include="resampler.h" />
+ <ClInclude Include="search_tools.h" />
+ <ClInclude Include="service.h" />
+ <ClInclude Include="service_impl.h" />
+ <ClInclude Include="system_time_keeper.h" />
+ <ClInclude Include="tag_processor.h" />
+ <ClInclude Include="threaded_process.h" />
+ <ClInclude Include="titleformat.h" />
+ <ClInclude Include="track_property.h" />
+ <ClInclude Include="ui.h" />
+ <ClInclude Include="ui_edit_context.h" />
+ <ClInclude Include="ui_element.h" />
+ <ClInclude Include="unpack.h" />
+ <ClInclude Include="vis.h" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="abort_callback.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="advconfig.cpp" />
+ <ClCompile Include="album_art.cpp" />
+ <ClCompile Include="app_close_blocker.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="audio_chunk.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="audio_chunk_channel_config.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="cfg_var.cpp" />
+ <ClCompile Include="chapterizer.cpp" />
+ <ClCompile Include="commandline.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="completion_notify.cpp" />
+ <ClCompile Include="config_object.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="console.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="dsp.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="dsp_manager.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="file_info.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="file_info_impl.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="file_info_merge.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="file_operation_callback.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="filesystem.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="filesystem_helper.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="guids.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="hasher_md5.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="input.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="input_file_type.cpp" />
+ <ClCompile Include="link_resolver.cpp" />
+ <ClCompile Include="mainmenu.cpp" />
+ <ClCompile Include="mem_block_container.cpp" />
+ <ClCompile Include="menu_helpers.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="menu_item.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="menu_manager.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="metadb.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="metadb_handle.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="metadb_handle_list.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="packet_decoder.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="playable_location.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="playback_control.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="playlist.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="playlist_loader.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="popup_message.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="preferences_page.cpp" />
+ <ClCompile Include="replaygain.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="replaygain_info.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="service.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="stdafx.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
+ </ClCompile>
+ <ClCompile Include="tag_processor.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="tag_processor_id3v2.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="threaded_process.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="titleformat.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="ui.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="ui_element.cpp" />
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
\ No newline at end of file diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/foobar2000_SDK_14.vcxproj.filters b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/foobar2000_SDK_14.vcxproj.filters new file mode 100644 index 0000000000..0c1d438ba9 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/foobar2000_SDK_14.vcxproj.filters @@ -0,0 +1,395 @@ +<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{11712814-7256-45e1-a33b-02666d462471}</UniqueIdentifier>
+ <Extensions>*.h</Extensions>
+ </Filter>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{24bc61a9-ecc2-4020-85c6-2a2976241224}</UniqueIdentifier>
+ <Extensions>*.cpp</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="abort_callback.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="advconfig.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="album_art.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="app_close_blocker.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="audio_chunk.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="audio_postprocessor.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="autoplaylist.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="cfg_var.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="chapterizer.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="commandline.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="completion_notify.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="component.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="componentversion.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="config_io_callback.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="config_object.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="config_object_impl.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="console.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="contextmenu.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="contextmenu_manager.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="core_api.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="coreversion.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="dsp.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="dsp_manager.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="event_logger.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="exceptions.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="file_info.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="file_info_impl.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="file_operation_callback.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="filesystem.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="filesystem_helper.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="foobar2000.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="genrand.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="hasher_md5.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="http_client.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="icon_remap.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="info_lookup_handler.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="initquit.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="input.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="input_file_type.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="input_impl.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="library_manager.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="link_resolver.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="main_thread_callback.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="mem_block_container.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="menu.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="menu_helpers.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="message_loop.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="metadb.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="metadb_handle.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="modeless_dialog.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="ole_interaction.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="packet_decoder.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="play_callback.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="playable_location.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="playback_control.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="playback_stream_capture.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="playlist.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="playlist_loader.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="popup_message.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="preferences_page.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="replaygain.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="replaygain_scanner.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="resampler.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="search_tools.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="service.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="service_impl.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="system_time_keeper.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="tag_processor.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="threaded_process.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="titleformat.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="track_property.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="ui.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="ui_edit_context.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="ui_element.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="unpack.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="vis.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="abort_callback.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="advconfig.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="album_art.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="app_close_blocker.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="audio_chunk.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="audio_chunk_channel_config.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="cfg_var.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="chapterizer.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="commandline.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="completion_notify.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="config_object.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="console.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="dsp.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="dsp_manager.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="file_info.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="file_info_impl.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="file_info_merge.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="file_operation_callback.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="filesystem.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="filesystem_helper.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="guids.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="hasher_md5.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="input.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="input_file_type.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="link_resolver.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="mainmenu.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="mem_block_container.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="menu_helpers.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="menu_item.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="menu_manager.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="metadb.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="metadb_handle.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="metadb_handle_list.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="packet_decoder.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="playable_location.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="playback_control.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="playlist.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="playlist_loader.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="popup_message.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="preferences_page.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="replaygain.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="replaygain_info.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="service.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="stdafx.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="tag_processor.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="tag_processor_id3v2.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="threaded_process.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="titleformat.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="ui.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="ui_element.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ </ItemGroup>
+</Project>
\ No newline at end of file diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/foobar2000_sdk_helpers_10.vcxproj b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/foobar2000_sdk_helpers_10.vcxproj new file mode 100644 index 0000000000..d5dbbfea13 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/foobar2000_sdk_helpers_10.vcxproj @@ -0,0 +1,212 @@ +<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{EE47764E-A202-4F85-A767-ABDAB4AFF35F}</ProjectGuid>
+ <RootNamespace>foobar2000_sdk_helpers</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <UseOfMfc>false</UseOfMfc>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <UseOfMfc>false</UseOfMfc>
+ <CharacterSet>Unicode</CharacterSet>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup>
+ <_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\Obj\$(ProjectName)\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\Obj\$(ProjectName)\</IntDir>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\Obj\$(ProjectName)\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\Obj\$(ProjectName)\</IntDir>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <Optimization>MinSpace</Optimization>
+ <PreprocessorDefinitions>NDEBUG;_WINDOWS;_WIN32_WINNT=0x501;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <StringPooling>true</StringPooling>
+ <BufferSecurityCheck>false</BufferSecurityCheck>
+ <FloatingPointModel>Fast</FloatingPointModel>
+ <RuntimeTypeInfo>false</RuntimeTypeInfo>
+ <PrecompiledHeader>Use</PrecompiledHeader>
+ <PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
+ <WarningLevel>Level3</WarningLevel>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <Culture>0x0409</Culture>
+ </ResourceCompile>
+ <Lib>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ </Lib>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>_DEBUG;_WINDOWS;_WIN32_WINNT=0x501;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <PrecompiledHeader>Use</PrecompiledHeader>
+ <PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
+ <WarningLevel>Level3</WarningLevel>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <Culture>0x0409</Culture>
+ </ResourceCompile>
+ <Lib>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ </Lib>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClCompile Include="clipboard.cpp" />
+ <ClCompile Include="create_directory_helper.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="cue_creator.cpp" />
+ <ClCompile Include="cue_parser.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="cue_parser_embedding.cpp" />
+ <ClCompile Include="cuesheet_index_list.cpp" />
+ <ClCompile Include="dialog_resize_helper.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="dropdown_helper.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="dynamic_bitrate_helper.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="file_info_const_impl.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="file_list_helper.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="file_move_helper.cpp" />
+ <ClCompile Include="file_wrapper_simple.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="filetimetools.cpp" />
+ <ClCompile Include="IDataObjectUtils.cpp" />
+ <ClCompile Include="input_helpers.cpp" />
+ <ClCompile Include="listview_helper.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="metadb_io_hintlist.cpp" />
+ <ClCompile Include="mp3_utils.cpp" />
+ <ClCompile Include="seekabilizer.cpp" />
+ <ClCompile Include="StdAfx.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
+ </ClCompile>
+ <ClCompile Include="stream_buffer_helper.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="text_file_loader.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="VisUtils.cpp" />
+ <ClCompile Include="wildcard.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="win32_dialog.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="win32_misc.cpp" />
+ <ClCompile Include="window_placement_helper.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="album_art_helpers.h" />
+ <ClInclude Include="bitreader_helper.h" />
+ <ClInclude Include="CallForwarder.h" />
+ <ClInclude Include="cfg_guidlist.h" />
+ <ClInclude Include="clipboard.h" />
+ <ClInclude Include="COM_utils.h" />
+ <ClInclude Include="create_directory_helper.h" />
+ <ClInclude Include="cue_creator.h" />
+ <ClInclude Include="cue_parser.h" />
+ <ClInclude Include="cuesheet_index_list.h" />
+ <ClInclude Include="dialog_resize_helper.h" />
+ <ClInclude Include="dropdown_helper.h" />
+ <ClInclude Include="dynamic_bitrate_helper.h" />
+ <ClInclude Include="file_cached.h" />
+ <ClInclude Include="file_info_const_impl.h" />
+ <ClInclude Include="file_list_helper.h" />
+ <ClInclude Include="file_move_helper.h" />
+ <ClInclude Include="file_win32_wrapper.h" />
+ <ClInclude Include="file_wrapper_simple.h" />
+ <ClInclude Include="filetimetools.h" />
+ <ClInclude Include="helpers.h" />
+ <ClInclude Include="icon_remapping_wildcard.h" />
+ <ClInclude Include="IDataObjectUtils.h" />
+ <ClInclude Include="input_helpers.h" />
+ <ClInclude Include="listview_helper.h" />
+ <ClInclude Include="meta_table_builder.h" />
+ <ClInclude Include="metadb_io_hintlist.h" />
+ <ClInclude Include="mp3_utils.h" />
+ <ClInclude Include="playlist_position_reference_tracker.h" />
+ <ClInclude Include="ProfileCache.h" />
+ <ClInclude Include="seekabilizer.h" />
+ <ClInclude Include="StdAfx.h" />
+ <ClInclude Include="stream_buffer_helper.h" />
+ <ClInclude Include="string_filter.h" />
+ <ClInclude Include="text_file_loader.h" />
+ <ClInclude Include="ThreadUtils.h" />
+ <ClInclude Include="VisUtils.h" />
+ <ClInclude Include="wildcard.h" />
+ <ClInclude Include="win32_dialog.h" />
+ <ClInclude Include="win32_misc.h" />
+ <ClInclude Include="window_placement_helper.h" />
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
\ No newline at end of file diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/foobar2000_sdk_helpers_10.vcxproj.filters b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/foobar2000_sdk_helpers_10.vcxproj.filters new file mode 100644 index 0000000000..25e20aa581 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/foobar2000_sdk_helpers_10.vcxproj.filters @@ -0,0 +1,224 @@ +<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{4f22ab27-58fc-4da2-95dc-4db23e50e87f}</UniqueIdentifier>
+ <Extensions>cpp;c;cxx;rc;def;r;odl;idl;hpj;bat</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{fe1c86a9-301a-461d-a3cd-b576f4f1fdf3}</UniqueIdentifier>
+ <Extensions>h;hpp;hxx;hm;inl</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="clipboard.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="create_directory_helper.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="cue_creator.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="cue_parser.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="cue_parser_embedding.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="cuesheet_index_list.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="dialog_resize_helper.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="dropdown_helper.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="dynamic_bitrate_helper.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="file_info_const_impl.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="file_list_helper.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="file_move_helper.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="file_wrapper_simple.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="filetimetools.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="IDataObjectUtils.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="input_helpers.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="listview_helper.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="metadb_io_hintlist.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="mp3_utils.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="seekabilizer.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="StdAfx.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="stream_buffer_helper.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="text_file_loader.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="VisUtils.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="wildcard.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="win32_dialog.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="win32_misc.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="window_placement_helper.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="album_art_helpers.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="bitreader_helper.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="CallForwarder.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="cfg_guidlist.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="clipboard.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="COM_utils.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="create_directory_helper.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="cue_creator.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="cue_parser.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="cuesheet_index_list.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="dialog_resize_helper.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="dropdown_helper.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="dynamic_bitrate_helper.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="file_cached.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="file_info_const_impl.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="file_list_helper.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="file_move_helper.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="file_win32_wrapper.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="file_wrapper_simple.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="filetimetools.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="helpers.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="icon_remapping_wildcard.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="IDataObjectUtils.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="input_helpers.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="listview_helper.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="meta_table_builder.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="metadb_io_hintlist.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="mp3_utils.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="playlist_position_reference_tracker.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="ProfileCache.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="seekabilizer.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="StdAfx.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="stream_buffer_helper.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="string_filter.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="text_file_loader.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="ThreadUtils.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="VisUtils.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="wildcard.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="win32_dialog.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="win32_misc.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="window_placement_helper.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ </ItemGroup>
+</Project>
\ No newline at end of file diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/foobar2000_sdk_helpers_12.vcxproj b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/foobar2000_sdk_helpers_12.vcxproj new file mode 100644 index 0000000000..b82d72d265 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/foobar2000_sdk_helpers_12.vcxproj @@ -0,0 +1,212 @@ +<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{EE47764E-A202-4F85-A767-ABDAB4AFF35F}</ProjectGuid>
+ <RootNamespace>foobar2000_sdk_helpers</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <UseOfMfc>false</UseOfMfc>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <UseOfMfc>false</UseOfMfc>
+ <CharacterSet>Unicode</CharacterSet>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup>
+ <_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\Obj\$(ProjectName)\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\Obj\$(ProjectName)\</IntDir>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\Obj\$(ProjectName)\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\Obj\$(ProjectName)\</IntDir>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <Optimization>MinSpace</Optimization>
+ <PreprocessorDefinitions>NDEBUG;_WINDOWS;_WIN32_WINNT=0x501;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <StringPooling>true</StringPooling>
+ <BufferSecurityCheck>false</BufferSecurityCheck>
+ <FloatingPointModel>Fast</FloatingPointModel>
+ <RuntimeTypeInfo>false</RuntimeTypeInfo>
+ <PrecompiledHeader>Use</PrecompiledHeader>
+ <PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
+ <WarningLevel>Level3</WarningLevel>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <Culture>0x0409</Culture>
+ </ResourceCompile>
+ <Lib>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ </Lib>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>_DEBUG;_WINDOWS;_WIN32_WINNT=0x501;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <PrecompiledHeader>Use</PrecompiledHeader>
+ <PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
+ <WarningLevel>Level3</WarningLevel>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <Culture>0x0409</Culture>
+ </ResourceCompile>
+ <Lib>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ </Lib>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClCompile Include="clipboard.cpp" />
+ <ClCompile Include="create_directory_helper.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="cue_creator.cpp" />
+ <ClCompile Include="cue_parser.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="cue_parser_embedding.cpp" />
+ <ClCompile Include="cuesheet_index_list.cpp" />
+ <ClCompile Include="dialog_resize_helper.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="dropdown_helper.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="dynamic_bitrate_helper.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="file_info_const_impl.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="file_list_helper.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="file_move_helper.cpp" />
+ <ClCompile Include="file_wrapper_simple.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="filetimetools.cpp" />
+ <ClCompile Include="IDataObjectUtils.cpp" />
+ <ClCompile Include="input_helpers.cpp" />
+ <ClCompile Include="listview_helper.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="metadb_io_hintlist.cpp" />
+ <ClCompile Include="mp3_utils.cpp" />
+ <ClCompile Include="seekabilizer.cpp" />
+ <ClCompile Include="StdAfx.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
+ </ClCompile>
+ <ClCompile Include="stream_buffer_helper.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="text_file_loader.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="VisUtils.cpp" />
+ <ClCompile Include="wildcard.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="win32_dialog.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="win32_misc.cpp" />
+ <ClCompile Include="window_placement_helper.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="album_art_helpers.h" />
+ <ClInclude Include="bitreader_helper.h" />
+ <ClInclude Include="CallForwarder.h" />
+ <ClInclude Include="cfg_guidlist.h" />
+ <ClInclude Include="clipboard.h" />
+ <ClInclude Include="COM_utils.h" />
+ <ClInclude Include="create_directory_helper.h" />
+ <ClInclude Include="cue_creator.h" />
+ <ClInclude Include="cue_parser.h" />
+ <ClInclude Include="cuesheet_index_list.h" />
+ <ClInclude Include="dialog_resize_helper.h" />
+ <ClInclude Include="dropdown_helper.h" />
+ <ClInclude Include="dynamic_bitrate_helper.h" />
+ <ClInclude Include="file_cached.h" />
+ <ClInclude Include="file_info_const_impl.h" />
+ <ClInclude Include="file_list_helper.h" />
+ <ClInclude Include="file_move_helper.h" />
+ <ClInclude Include="file_win32_wrapper.h" />
+ <ClInclude Include="file_wrapper_simple.h" />
+ <ClInclude Include="filetimetools.h" />
+ <ClInclude Include="helpers.h" />
+ <ClInclude Include="icon_remapping_wildcard.h" />
+ <ClInclude Include="IDataObjectUtils.h" />
+ <ClInclude Include="input_helpers.h" />
+ <ClInclude Include="listview_helper.h" />
+ <ClInclude Include="meta_table_builder.h" />
+ <ClInclude Include="metadb_io_hintlist.h" />
+ <ClInclude Include="mp3_utils.h" />
+ <ClInclude Include="playlist_position_reference_tracker.h" />
+ <ClInclude Include="ProfileCache.h" />
+ <ClInclude Include="seekabilizer.h" />
+ <ClInclude Include="StdAfx.h" />
+ <ClInclude Include="stream_buffer_helper.h" />
+ <ClInclude Include="string_filter.h" />
+ <ClInclude Include="text_file_loader.h" />
+ <ClInclude Include="ThreadUtils.h" />
+ <ClInclude Include="VisUtils.h" />
+ <ClInclude Include="wildcard.h" />
+ <ClInclude Include="win32_dialog.h" />
+ <ClInclude Include="win32_misc.h" />
+ <ClInclude Include="window_placement_helper.h" />
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
\ No newline at end of file diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/foobar2000_sdk_helpers_12.vcxproj.filters b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/foobar2000_sdk_helpers_12.vcxproj.filters new file mode 100644 index 0000000000..25e20aa581 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/foobar2000_sdk_helpers_12.vcxproj.filters @@ -0,0 +1,224 @@ +<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{4f22ab27-58fc-4da2-95dc-4db23e50e87f}</UniqueIdentifier>
+ <Extensions>cpp;c;cxx;rc;def;r;odl;idl;hpj;bat</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{fe1c86a9-301a-461d-a3cd-b576f4f1fdf3}</UniqueIdentifier>
+ <Extensions>h;hpp;hxx;hm;inl</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="clipboard.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="create_directory_helper.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="cue_creator.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="cue_parser.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="cue_parser_embedding.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="cuesheet_index_list.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="dialog_resize_helper.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="dropdown_helper.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="dynamic_bitrate_helper.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="file_info_const_impl.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="file_list_helper.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="file_move_helper.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="file_wrapper_simple.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="filetimetools.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="IDataObjectUtils.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="input_helpers.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="listview_helper.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="metadb_io_hintlist.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="mp3_utils.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="seekabilizer.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="StdAfx.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="stream_buffer_helper.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="text_file_loader.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="VisUtils.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="wildcard.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="win32_dialog.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="win32_misc.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="window_placement_helper.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="album_art_helpers.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="bitreader_helper.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="CallForwarder.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="cfg_guidlist.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="clipboard.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="COM_utils.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="create_directory_helper.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="cue_creator.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="cue_parser.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="cuesheet_index_list.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="dialog_resize_helper.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="dropdown_helper.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="dynamic_bitrate_helper.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="file_cached.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="file_info_const_impl.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="file_list_helper.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="file_move_helper.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="file_win32_wrapper.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="file_wrapper_simple.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="filetimetools.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="helpers.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="icon_remapping_wildcard.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="IDataObjectUtils.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="input_helpers.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="listview_helper.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="meta_table_builder.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="metadb_io_hintlist.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="mp3_utils.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="playlist_position_reference_tracker.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="ProfileCache.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="seekabilizer.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="StdAfx.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="stream_buffer_helper.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="string_filter.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="text_file_loader.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="ThreadUtils.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="VisUtils.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="wildcard.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="win32_dialog.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="win32_misc.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="window_placement_helper.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ </ItemGroup>
+</Project>
\ No newline at end of file diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/foobar2000_sdk_helpers_14.vcxproj b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/foobar2000_sdk_helpers_14.vcxproj new file mode 100644 index 0000000000..9c3e77e3aa --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/foobar2000_sdk_helpers_14.vcxproj @@ -0,0 +1,212 @@ +<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{EE47764E-A202-4F85-A767-ABDAB4AFF35F}</ProjectGuid>
+ <RootNamespace>foobar2000_sdk_helpers</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <UseOfMfc>false</UseOfMfc>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <UseOfMfc>false</UseOfMfc>
+ <CharacterSet>Unicode</CharacterSet>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup>
+ <_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\Obj\$(ProjectName)\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\Obj\$(ProjectName)\</IntDir>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\Obj\$(ProjectName)\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\Obj\$(ProjectName)\</IntDir>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <Optimization>MinSpace</Optimization>
+ <PreprocessorDefinitions>NDEBUG;_WINDOWS;_WIN32_WINNT=0x501;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <StringPooling>true</StringPooling>
+ <BufferSecurityCheck>false</BufferSecurityCheck>
+ <FloatingPointModel>Fast</FloatingPointModel>
+ <RuntimeTypeInfo>false</RuntimeTypeInfo>
+ <PrecompiledHeader>Use</PrecompiledHeader>
+ <PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
+ <WarningLevel>Level3</WarningLevel>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <Culture>0x0409</Culture>
+ </ResourceCompile>
+ <Lib>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ </Lib>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>_DEBUG;_WINDOWS;_WIN32_WINNT=0x501;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <PrecompiledHeader>Use</PrecompiledHeader>
+ <PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
+ <WarningLevel>Level3</WarningLevel>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <Culture>0x0409</Culture>
+ </ResourceCompile>
+ <Lib>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ </Lib>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClCompile Include="clipboard.cpp" />
+ <ClCompile Include="create_directory_helper.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="cue_creator.cpp" />
+ <ClCompile Include="cue_parser.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="cue_parser_embedding.cpp" />
+ <ClCompile Include="cuesheet_index_list.cpp" />
+ <ClCompile Include="dialog_resize_helper.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="dropdown_helper.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="dynamic_bitrate_helper.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="file_info_const_impl.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="file_list_helper.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="file_move_helper.cpp" />
+ <ClCompile Include="file_wrapper_simple.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="filetimetools.cpp" />
+ <ClCompile Include="IDataObjectUtils.cpp" />
+ <ClCompile Include="input_helpers.cpp" />
+ <ClCompile Include="listview_helper.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="metadb_io_hintlist.cpp" />
+ <ClCompile Include="mp3_utils.cpp" />
+ <ClCompile Include="seekabilizer.cpp" />
+ <ClCompile Include="StdAfx.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
+ </ClCompile>
+ <ClCompile Include="stream_buffer_helper.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="text_file_loader.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="VisUtils.cpp" />
+ <ClCompile Include="wildcard.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="win32_dialog.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ <ClCompile Include="win32_misc.cpp" />
+ <ClCompile Include="window_placement_helper.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="album_art_helpers.h" />
+ <ClInclude Include="bitreader_helper.h" />
+ <ClInclude Include="CallForwarder.h" />
+ <ClInclude Include="cfg_guidlist.h" />
+ <ClInclude Include="clipboard.h" />
+ <ClInclude Include="COM_utils.h" />
+ <ClInclude Include="create_directory_helper.h" />
+ <ClInclude Include="cue_creator.h" />
+ <ClInclude Include="cue_parser.h" />
+ <ClInclude Include="cuesheet_index_list.h" />
+ <ClInclude Include="dialog_resize_helper.h" />
+ <ClInclude Include="dropdown_helper.h" />
+ <ClInclude Include="dynamic_bitrate_helper.h" />
+ <ClInclude Include="file_cached.h" />
+ <ClInclude Include="file_info_const_impl.h" />
+ <ClInclude Include="file_list_helper.h" />
+ <ClInclude Include="file_move_helper.h" />
+ <ClInclude Include="file_win32_wrapper.h" />
+ <ClInclude Include="file_wrapper_simple.h" />
+ <ClInclude Include="filetimetools.h" />
+ <ClInclude Include="helpers.h" />
+ <ClInclude Include="icon_remapping_wildcard.h" />
+ <ClInclude Include="IDataObjectUtils.h" />
+ <ClInclude Include="input_helpers.h" />
+ <ClInclude Include="listview_helper.h" />
+ <ClInclude Include="meta_table_builder.h" />
+ <ClInclude Include="metadb_io_hintlist.h" />
+ <ClInclude Include="mp3_utils.h" />
+ <ClInclude Include="playlist_position_reference_tracker.h" />
+ <ClInclude Include="ProfileCache.h" />
+ <ClInclude Include="seekabilizer.h" />
+ <ClInclude Include="StdAfx.h" />
+ <ClInclude Include="stream_buffer_helper.h" />
+ <ClInclude Include="string_filter.h" />
+ <ClInclude Include="text_file_loader.h" />
+ <ClInclude Include="ThreadUtils.h" />
+ <ClInclude Include="VisUtils.h" />
+ <ClInclude Include="wildcard.h" />
+ <ClInclude Include="win32_dialog.h" />
+ <ClInclude Include="win32_misc.h" />
+ <ClInclude Include="window_placement_helper.h" />
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
\ No newline at end of file diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/foobar2000_sdk_helpers_14.vcxproj.filters b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/foobar2000_sdk_helpers_14.vcxproj.filters new file mode 100644 index 0000000000..25e20aa581 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/foobar2000_sdk_helpers_14.vcxproj.filters @@ -0,0 +1,224 @@ +<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{4f22ab27-58fc-4da2-95dc-4db23e50e87f}</UniqueIdentifier>
+ <Extensions>cpp;c;cxx;rc;def;r;odl;idl;hpj;bat</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{fe1c86a9-301a-461d-a3cd-b576f4f1fdf3}</UniqueIdentifier>
+ <Extensions>h;hpp;hxx;hm;inl</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="clipboard.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="create_directory_helper.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="cue_creator.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="cue_parser.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="cue_parser_embedding.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="cuesheet_index_list.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="dialog_resize_helper.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="dropdown_helper.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="dynamic_bitrate_helper.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="file_info_const_impl.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="file_list_helper.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="file_move_helper.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="file_wrapper_simple.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="filetimetools.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="IDataObjectUtils.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="input_helpers.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="listview_helper.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="metadb_io_hintlist.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="mp3_utils.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="seekabilizer.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="StdAfx.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="stream_buffer_helper.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="text_file_loader.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="VisUtils.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="wildcard.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="win32_dialog.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="win32_misc.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="window_placement_helper.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="album_art_helpers.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="bitreader_helper.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="CallForwarder.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="cfg_guidlist.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="clipboard.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="COM_utils.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="create_directory_helper.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="cue_creator.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="cue_parser.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="cuesheet_index_list.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="dialog_resize_helper.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="dropdown_helper.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="dynamic_bitrate_helper.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="file_cached.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="file_info_const_impl.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="file_list_helper.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="file_move_helper.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="file_win32_wrapper.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="file_wrapper_simple.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="filetimetools.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="helpers.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="icon_remapping_wildcard.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="IDataObjectUtils.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="input_helpers.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="listview_helper.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="meta_table_builder.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="metadb_io_hintlist.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="mp3_utils.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="playlist_position_reference_tracker.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="ProfileCache.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="seekabilizer.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="StdAfx.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="stream_buffer_helper.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="string_filter.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="text_file_loader.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="ThreadUtils.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="VisUtils.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="wildcard.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="win32_dialog.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="win32_misc.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="window_placement_helper.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ </ItemGroup>
+</Project>
\ No newline at end of file diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/helpers.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/helpers.h new file mode 100644 index 0000000000..c8966e88d5 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/helpers.h @@ -0,0 +1,44 @@ +#ifndef _FOOBAR2000_SDK_HELPERS_H_
+#define _FOOBAR2000_SDK_HELPERS_H_
+
+#include "input_helpers.h"
+#include "create_directory_helper.h"
+#include "dialog_resize_helper.h"
+#include "dropdown_helper.h"
+#include "window_placement_helper.h"
+#include "win32_dialog.h"
+#include "wildcard.h"
+#include "cuesheet_index_list.h"
+#include "cue_creator.h"
+#include "cue_parser.h"
+#include "text_file_loader.h"
+#include "file_list_helper.h"
+#include "listview_helper.h"
+#include "stream_buffer_helper.h"
+#include "file_info_const_impl.h"
+#include "file_wrapper_simple.h"
+#include "dynamic_bitrate_helper.h"
+#include "cfg_guidlist.h"
+#include "file_win32_wrapper.h"
+#include "file_move_helper.h"
+#include "file_cached.h"
+#include "seekabilizer.h"
+#include "string_filter.h"
+#include "bitreader_helper.h"
+#include "mp3_utils.h"
+#include "win32_misc.h"
+#include "COM_utils.h"
+#include "metadb_io_hintlist.h"
+#include "meta_table_builder.h"
+#include "icon_remapping_wildcard.h"
+#include "album_art_helpers.h"
+#include "clipboard.h"
+#include "IDataObjectUtils.h"
+#include "CallForwarder.h"
+#include "playlist_position_reference_tracker.h"
+#include "ThreadUtils.h"
+#include "VisUtils.h"
+#include "filetimetools.h"
+#include "ProfileCache.h"
+
+#endif //_FOOBAR2000_SDK_HELPERS_H_
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/icon_remapping_wildcard.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/icon_remapping_wildcard.h new file mode 100644 index 0000000000..c6bb98129d --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/icon_remapping_wildcard.h @@ -0,0 +1,13 @@ +class icon_remapping_wildcard_impl : public icon_remapping {
+public:
+ icon_remapping_wildcard_impl(const char * p_pattern,const char * p_iconname) : m_pattern(p_pattern), m_iconname(p_iconname) {}
+ bool query(const char * p_extension,pfc::string_base & p_iconname) {
+ if (wildcard_helper::test(p_extension,m_pattern,true)) {
+ p_iconname = m_iconname; return true;
+ } else {
+ return false;
+ }
+ }
+private:
+ pfc::string8 m_pattern,m_iconname;
+};
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/input_helpers.cpp b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/input_helpers.cpp new file mode 100644 index 0000000000..40b19696d9 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/input_helpers.cpp @@ -0,0 +1,388 @@ +#include "stdafx.h"
+
+void input_helper::open(service_ptr_t<file> p_filehint,metadb_handle_ptr p_location,unsigned p_flags,abort_callback & p_abort,bool p_from_redirect,bool p_skip_hints)
+{
+ open(p_filehint,p_location->get_location(),p_flags,p_abort,p_from_redirect,p_skip_hints);
+}
+
+static void process_fullbuffer(service_ptr_t<file> & p_file,const char * p_path,t_filesize p_fullbuffer,abort_callback & p_abort) {
+ if (p_fullbuffer > 0) {
+ if (p_file.is_empty()) {
+ service_ptr_t<filesystem> fs;
+ if (filesystem::g_get_interface(fs,p_path)) {
+ fs->open(p_file,p_path,filesystem::open_mode_read,p_abort);
+ }
+ }
+
+ if (p_file.is_valid()) {
+ t_filesize size = p_file->get_size(p_abort);
+ if (size != filesize_invalid && size <= p_fullbuffer) {
+ service_ptr_t<file> l_file_buffered;
+ if (reader_membuffer_mirror::g_create(l_file_buffered,p_file,p_abort)) {
+ p_file = l_file_buffered;
+ }
+ }
+ }
+ }
+}
+
+bool input_helper::need_file_reopen(const char * newPath) const {
+ return m_input.is_empty() || metadb::path_compare(m_path, newPath) != 0;
+}
+
+bool input_helper::open_path(file::ptr p_filehint,const char * path,abort_callback & p_abort,bool p_from_redirect,bool p_skip_hints) {
+ p_abort.check();
+
+ if (!need_file_reopen(path)) return false;
+ m_input.release();
+
+ service_ptr_t<file> l_file = p_filehint;
+ process_fullbuffer(l_file,path,m_fullbuffer,p_abort);
+
+ TRACK_CODE("input_entry::g_open_for_decoding",
+ input_entry::g_open_for_decoding(m_input,l_file,path,p_abort,p_from_redirect)
+ );
+
+
+ if (!p_skip_hints) {
+ try {
+ static_api_ptr_t<metadb_io>()->hint_reader(m_input.get_ptr(),path,p_abort);
+ } catch(exception_io_data) {
+ //Don't fail to decode when this barfs, might be barfing when reading info from another subsong than the one we're trying to decode etc.
+ m_input.release();
+ if (l_file.is_valid()) l_file->reopen(p_abort);
+ TRACK_CODE("input_entry::g_open_for_decoding",
+ input_entry::g_open_for_decoding(m_input,l_file,path,p_abort,p_from_redirect)
+ );
+ }
+ }
+
+ m_path = path;
+ return true;
+}
+
+void input_helper::open_decoding(t_uint32 subsong, t_uint32 flags, abort_callback & p_abort) {
+ TRACK_CODE("input_decoder::initialize",m_input->initialize(subsong,flags,p_abort));
+}
+
+void input_helper::open(service_ptr_t<file> p_filehint,const playable_location & p_location,unsigned p_flags,abort_callback & p_abort,bool p_from_redirect,bool p_skip_hints) {
+ open_path(p_filehint, p_location.get_path(), p_abort, p_from_redirect, p_skip_hints);
+
+ open_decoding(p_location.get_subsong(), p_flags, p_abort);
+}
+
+
+void input_helper::close() {
+ m_input.release();
+}
+
+bool input_helper::is_open() {
+ return m_input.is_valid();
+}
+
+void input_helper::set_pause(bool state) {
+ input_decoder_v3::ptr v3;
+ if (m_input->service_query_t(v3)) v3->set_pause(state);
+}
+bool input_helper::flush_on_pause() {
+ input_decoder_v3::ptr v3;
+ if (m_input->service_query_t(v3)) return v3->flush_on_pause();
+ else return false;
+}
+
+
+void input_helper::set_logger(event_logger::ptr ptr) {
+ input_decoder_v2::ptr v2;
+ if (m_input->service_query_t(v2)) v2->set_logger(ptr);
+}
+
+bool input_helper::run_raw(audio_chunk & p_chunk, mem_block_container & p_raw, abort_callback & p_abort) {
+ input_decoder_v2::ptr v2;
+ if (!m_input->service_query_t(v2)) throw pfc::exception_not_implemented();
+ return v2->run_raw(p_chunk, p_raw, p_abort);
+}
+
+bool input_helper::run(audio_chunk & p_chunk,abort_callback & p_abort) {
+ TRACK_CODE("input_decoder::run",return m_input->run(p_chunk,p_abort));
+}
+
+void input_helper::seek(double seconds,abort_callback & p_abort) {
+ TRACK_CODE("input_decoder::seek",m_input->seek(seconds,p_abort));
+}
+
+bool input_helper::can_seek() {
+ return m_input->can_seek();
+}
+
+void input_helper::set_full_buffer(t_filesize val) {
+ m_fullbuffer = val;
+}
+void input_helper::on_idle(abort_callback & p_abort) {
+ if (m_input.is_valid()) {
+ TRACK_CODE("input_decoder::on_idle",m_input->on_idle(p_abort));
+ }
+}
+
+bool input_helper::get_dynamic_info(file_info & p_out,double & p_timestamp_delta) {
+ TRACK_CODE("input_decoder::get_dynamic_info",return m_input->get_dynamic_info(p_out,p_timestamp_delta));
+}
+
+bool input_helper::get_dynamic_info_track(file_info & p_out,double & p_timestamp_delta) {
+ TRACK_CODE("input_decoder::get_dynamic_info_track",return m_input->get_dynamic_info_track(p_out,p_timestamp_delta));
+}
+
+void input_helper::get_info(t_uint32 p_subsong,file_info & p_info,abort_callback & p_abort) {
+ TRACK_CODE("input_decoder::get_info",m_input->get_info(p_subsong,p_info,p_abort));
+}
+
+const char * input_helper::get_path() const {
+ return m_path;
+}
+
+
+input_helper::input_helper() : m_fullbuffer(0)
+{
+}
+
+
+void input_helper::g_get_info(const playable_location & p_location,file_info & p_info,abort_callback & p_abort,bool p_from_redirect) {
+ service_ptr_t<input_info_reader> instance;
+ input_entry::g_open_for_info_read(instance,0,p_location.get_path(),p_abort,p_from_redirect);
+ instance->get_info(p_location.get_subsong_index(),p_info,p_abort);
+}
+
+void input_helper::g_set_info(const playable_location & p_location,file_info & p_info,abort_callback & p_abort,bool p_from_redirect) {
+ service_ptr_t<input_info_writer> instance;
+ input_entry::g_open_for_info_write(instance,0,p_location.get_path(),p_abort,p_from_redirect);
+ instance->set_info(p_location.get_subsong_index(),p_info,p_abort);
+ instance->commit(p_abort);
+}
+
+
+bool dead_item_filter::run(const pfc::list_base_const_t<metadb_handle_ptr> & p_list,bit_array_var & p_mask) {
+ file_list_helper::file_list_from_metadb_handle_list path_list;
+ path_list.init_from_list(p_list);
+ metadb_handle_list valid_handles;
+ static_api_ptr_t<metadb> l_metadb;
+ for(t_size pathidx=0;pathidx<path_list.get_count();pathidx++)
+ {
+ if (is_aborting()) return false;
+ on_progress(pathidx,path_list.get_count());
+
+ const char * path = path_list[pathidx];
+
+ if (filesystem::g_is_remote_safe(path)) {
+ metadb_handle_ptr temp;
+ l_metadb->handle_create(temp,make_playable_location(path,0));
+ valid_handles.add_item(temp);
+ } else {
+ try {
+ service_ptr_t<input_info_reader> reader;
+
+ input_entry::g_open_for_info_read(reader,0,path,*this);
+ t_uint32 count = reader->get_subsong_count();
+ for(t_uint32 n=0;n<count && !is_aborting();n++) {
+ metadb_handle_ptr ptr;
+ t_uint32 index = reader->get_subsong(n);
+ l_metadb->handle_create(ptr,make_playable_location(path,index));
+ valid_handles.add_item(ptr);
+ }
+ } catch(...) {}
+ }
+ }
+
+ if (is_aborting()) return false;
+
+ valid_handles.sort_by_pointer();
+ for(t_size listidx=0;listidx<p_list.get_count();listidx++) {
+ bool dead = valid_handles.bsearch_by_pointer(p_list[listidx]) == ~0;
+ if (dead) console::formatter() << "Dead item: " << p_list[listidx];
+ p_mask.set(listidx,dead);
+ }
+ return !is_aborting();
+}
+
+namespace {
+
+class dead_item_filter_impl_simple : public dead_item_filter
+{
+public:
+ inline dead_item_filter_impl_simple(abort_callback & p_abort) : m_abort(p_abort) {}
+ bool is_aborting() const {return m_abort.is_aborting();}
+ abort_callback_event get_abort_event() const {return m_abort.get_abort_event();}
+ void on_progress(t_size p_position,t_size p_total) {}
+private:
+ abort_callback & m_abort;
+};
+
+}
+
+bool input_helper::g_mark_dead(const pfc::list_base_const_t<metadb_handle_ptr> & p_list,bit_array_var & p_mask,abort_callback & p_abort)
+{
+ dead_item_filter_impl_simple filter(p_abort);
+ return filter.run(p_list,p_mask);
+}
+
+void input_info_read_helper::open(const char * p_path,abort_callback & p_abort) {
+ if (m_input.is_empty() || metadb::path_compare(m_path,p_path) != 0)
+ {
+ TRACK_CODE("input_entry::g_open_for_info_read",input_entry::g_open_for_info_read(m_input,0,p_path,p_abort));
+
+ m_path = p_path;
+ }
+}
+
+void input_info_read_helper::get_info(const playable_location & p_location,file_info & p_info,t_filestats & p_stats,abort_callback & p_abort) {
+ open(p_location.get_path(),p_abort);
+
+ TRACK_CODE("input_info_reader::get_file_stats",p_stats = m_input->get_file_stats(p_abort));
+
+ TRACK_CODE("input_info_reader::get_info",m_input->get_info(p_location.get_subsong_index(),p_info,p_abort));
+}
+
+void input_info_read_helper::get_info_check(const playable_location & p_location,file_info & p_info,t_filestats & p_stats,bool & p_reloaded,abort_callback & p_abort) {
+ open(p_location.get_path(),p_abort);
+ t_filestats newstats;
+ TRACK_CODE("input_info_reader::get_file_stats",newstats = m_input->get_file_stats(p_abort));
+ if (metadb_handle::g_should_reload(p_stats,newstats,true)) {
+ p_stats = newstats;
+ TRACK_CODE("input_info_reader::get_info",m_input->get_info(p_location.get_subsong_index(),p_info,p_abort));
+ p_reloaded = true;
+ } else {
+ p_reloaded = false;
+ }
+}
+
+
+
+
+
+
+void input_helper_cue::open(service_ptr_t<file> p_filehint,const playable_location & p_location,unsigned p_flags,abort_callback & p_abort,double p_start,double p_length) {
+ p_abort.check();
+
+ m_start = p_start;
+ m_position = 0;
+ m_dynamic_info_trigger = false;
+ m_dynamic_info_track_trigger = false;
+
+ m_input.open(p_filehint,p_location,p_flags,p_abort,true,true);
+
+ if (!m_input.can_seek()) throw exception_io_object_not_seekable();
+
+ if (m_start > 0) {
+ m_input.seek(m_start,p_abort);
+ }
+
+ if (p_length > 0) {
+ m_length = p_length;
+ } else {
+ file_info_impl temp;
+ m_input.get_info(0,temp,p_abort);
+ double ref_length = temp.get_length();
+ if (ref_length <= 0) throw exception_io_data();
+ m_length = ref_length - m_start + p_length /* negative or zero */;
+ if (m_length <= 0) throw exception_io_data();
+ }
+}
+
+void input_helper_cue::close() {m_input.close();}
+bool input_helper_cue::is_open() {return m_input.is_open();}
+
+bool input_helper_cue::_m_input_run(audio_chunk & p_chunk, mem_block_container * p_raw, abort_callback & p_abort) {
+ if (p_raw == NULL) {
+ return m_input.run(p_chunk, p_abort);
+ } else {
+ return m_input.run_raw(p_chunk, *p_raw, p_abort);
+ }
+}
+bool input_helper_cue::_run(audio_chunk & p_chunk, mem_block_container * p_raw, abort_callback & p_abort) {
+ p_abort.check();
+
+ if (m_length > 0) {
+ if (m_position >= m_length) return false;
+
+ if (!_m_input_run(p_chunk, p_raw, p_abort)) return false;
+
+ m_dynamic_info_trigger = true;
+ m_dynamic_info_track_trigger = true;
+
+ t_uint64 max = (t_uint64) audio_math::time_to_samples(m_length - m_position, p_chunk.get_sample_rate());
+ if (max == 0)
+ {//handle rounding accidents, this normally shouldn't trigger
+ m_position = m_length;
+ return false;
+ }
+
+ t_size samples = p_chunk.get_sample_count();
+ if ((t_uint64)samples > max)
+ {
+ p_chunk.set_sample_count((unsigned)max);
+ if (p_raw != NULL) {
+ const t_size rawSize = p_raw->get_size();
+ PFC_ASSERT( rawSize % samples == 0 );
+ p_raw->set_size( (t_size) ( (t_uint64) rawSize * max / samples ) );
+ }
+ m_position = m_length;
+ }
+ else
+ {
+ m_position += p_chunk.get_duration();
+ }
+ return true;
+ }
+ else
+ {
+ if (!_m_input_run(p_chunk, p_raw, p_abort)) return false;
+ m_position += p_chunk.get_duration();
+ return true;
+ }
+}
+bool input_helper_cue::run_raw(audio_chunk & p_chunk, mem_block_container & p_raw, abort_callback & p_abort) {
+ return _run(p_chunk, &p_raw, p_abort);
+}
+
+bool input_helper_cue::run(audio_chunk & p_chunk,abort_callback & p_abort) {
+ return _run(p_chunk, NULL, p_abort);
+}
+
+void input_helper_cue::seek(double p_seconds,abort_callback & p_abort)
+{
+ m_dynamic_info_trigger = false;
+ m_dynamic_info_track_trigger = false;
+ if (m_length <= 0 || p_seconds < m_length) {
+ m_input.seek(p_seconds + m_start,p_abort);
+ m_position = p_seconds;
+ } else {
+ m_position = m_length;
+ }
+}
+
+bool input_helper_cue::can_seek() {return true;}
+void input_helper_cue::set_full_buffer(t_filesize val) {m_input.set_full_buffer(val);}
+
+void input_helper_cue::on_idle(abort_callback & p_abort) {m_input.on_idle(p_abort);}
+
+bool input_helper_cue::get_dynamic_info(file_info & p_out,double & p_timestamp_delta) {
+ if (m_dynamic_info_trigger) {
+ m_dynamic_info_trigger = false;
+ return m_input.get_dynamic_info(p_out,p_timestamp_delta);
+ } else {
+ return false;
+ }
+}
+
+bool input_helper_cue::get_dynamic_info_track(file_info & p_out,double & p_timestamp_delta) {
+ if (m_dynamic_info_track_trigger) {
+ m_dynamic_info_track_trigger = false;
+ return m_input.get_dynamic_info_track(p_out,p_timestamp_delta);
+ } else {
+ return false;
+ }
+}
+
+const char * input_helper_cue::get_path() const {return m_input.get_path();}
+
+void input_helper_cue::get_info(t_uint32 p_subsong,file_info & p_info,abort_callback & p_abort) {m_input.get_info(p_subsong,p_info,p_abort);}
+
+
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/input_helpers.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/input_helpers.h new file mode 100644 index 0000000000..b5835e1de7 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/input_helpers.h @@ -0,0 +1,99 @@ +#ifndef _INPUT_HELPERS_H_
+#define _INPUT_HELPERS_H_
+
+class input_helper {
+public:
+ input_helper();
+ void open(service_ptr_t<file> p_filehint,metadb_handle_ptr p_location,unsigned p_flags,abort_callback & p_abort,bool p_from_redirect = false,bool p_skip_hints = false);
+ void open(service_ptr_t<file> p_filehint,const playable_location & p_location,unsigned p_flags,abort_callback & p_abort,bool p_from_redirect = false,bool p_skip_hints = false);
+
+ //! Multilevel open helpers.
+ //! @returns Diagnostic/helper value: true if the decoder had to be re-opened entirely, false if the instance was reused.
+ bool open_path(file::ptr p_filehint,const char * path,abort_callback & p_abort,bool p_from_redirect,bool p_skip_hints);
+ //! Multilevel open helpers.
+ void open_decoding(t_uint32 subsong, t_uint32 flags, abort_callback & p_abort);
+
+ bool need_file_reopen(const char * newPath) const;
+
+ void close();
+ bool is_open();
+ bool run(audio_chunk & p_chunk,abort_callback & p_abort);
+ bool run_raw(audio_chunk & p_chunk, mem_block_container & p_raw, abort_callback & p_abort);
+ void seek(double seconds,abort_callback & p_abort);
+ bool can_seek();
+ void set_full_buffer(t_filesize val);
+ void on_idle(abort_callback & p_abort);
+ bool get_dynamic_info(file_info & p_out,double & p_timestamp_delta);
+ bool get_dynamic_info_track(file_info & p_out,double & p_timestamp_delta);
+ void set_logger(event_logger::ptr ptr);
+ void set_pause(bool state);
+ bool flush_on_pause();
+
+ //! Retrieves path of currently open file.
+ const char * get_path() const;
+
+ //! Retrieves info about specific subsong of currently open file.
+ void get_info(t_uint32 p_subsong,file_info & p_info,abort_callback & p_abort);
+
+ static void g_get_info(const playable_location & p_location,file_info & p_info,abort_callback & p_abort,bool p_from_redirect = false);
+ static void g_set_info(const playable_location & p_location,file_info & p_info,abort_callback & p_abort,bool p_from_redirect = false);
+
+
+ static bool g_mark_dead(const pfc::list_base_const_t<metadb_handle_ptr> & p_list,bit_array_var & p_mask,abort_callback & p_abort);
+
+private:
+ service_ptr_t<input_decoder> m_input;
+ pfc::string8 m_path;
+ t_filesize m_fullbuffer;
+};
+
+class NOVTABLE dead_item_filter : public abort_callback {
+public:
+ virtual void on_progress(t_size p_position,t_size p_total) = 0;
+
+ bool run(const pfc::list_base_const_t<metadb_handle_ptr> & p_list,bit_array_var & p_mask);
+};
+
+class input_info_read_helper {
+public:
+ input_info_read_helper() {}
+ void get_info(const playable_location & p_location,file_info & p_info,t_filestats & p_stats,abort_callback & p_abort);
+ void get_info_check(const playable_location & p_location,file_info & p_info,t_filestats & p_stats,bool & p_reloaded,abort_callback & p_abort);
+private:
+ void open(const char * p_path,abort_callback & p_abort);
+
+ pfc::string8 m_path;
+ service_ptr_t<input_info_reader> m_input;
+};
+
+
+
+class input_helper_cue {
+public:
+ void open(service_ptr_t<file> p_filehint,const playable_location & p_location,unsigned p_flags,abort_callback & p_abort,double p_start,double p_length);
+
+ void close();
+ bool is_open();
+ bool run(audio_chunk & p_chunk,abort_callback & p_abort);
+ bool run_raw(audio_chunk & p_chunk, mem_block_container & p_raw, abort_callback & p_abort);
+ void seek(double seconds,abort_callback & p_abort);
+ bool can_seek();
+ void set_full_buffer(t_filesize val);
+ void on_idle(abort_callback & p_abort);
+ bool get_dynamic_info(file_info & p_out,double & p_timestamp_delta);
+ bool get_dynamic_info_track(file_info & p_out,double & p_timestamp_delta);
+ void set_logger(event_logger::ptr ptr) {m_input.set_logger(ptr);}
+
+ const char * get_path() const;
+
+ void get_info(t_uint32 p_subsong,file_info & p_info,abort_callback & p_abort);
+
+private:
+ bool _run(audio_chunk & p_chunk, mem_block_container * p_raw, abort_callback & p_abort);
+ bool _m_input_run(audio_chunk & p_chunk, mem_block_container * p_raw, abort_callback & p_abort);
+ input_helper m_input;
+ double m_start,m_length,m_position;
+ bool m_dynamic_info_trigger,m_dynamic_info_track_trigger;
+};
+
+#endif
\ No newline at end of file diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/listview_helper.cpp b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/listview_helper.cpp new file mode 100644 index 0000000000..28eee6ff6f --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/listview_helper.cpp @@ -0,0 +1,169 @@ +#include "stdafx.h"
+
+
+
+namespace listview_helper {
+
+ unsigned insert_item(HWND p_listview,unsigned p_index,const char * p_name,LPARAM p_param)
+ {
+ if (p_index == ~0) p_index = ListView_GetItemCount(p_listview);
+ LVITEM item = {};
+
+ pfc::stringcvt::string_os_from_utf8 os_string_temp(p_name);
+
+ item.mask = LVIF_TEXT | LVIF_PARAM;
+ item.iItem = p_index;
+ item.lParam = p_param;
+ item.pszText = const_cast<TCHAR*>(os_string_temp.get_ptr());
+
+ LRESULT ret = uSendMessage(p_listview,LVM_INSERTITEM,0,(LPARAM)&item);
+ if (ret < 0) return ~0;
+ else return (unsigned) ret;
+ }
+
+
+
+ unsigned insert_column(HWND p_listview,unsigned p_index,const char * p_name,unsigned p_width_dlu)
+ {
+ pfc::stringcvt::string_os_from_utf8 os_string_temp(p_name);
+
+ RECT rect = {0,0,p_width_dlu,0};
+ MapDialogRect(GetParent(p_listview),&rect);
+
+ LVCOLUMN data = {};
+ data.mask = LVCF_TEXT | LVCF_WIDTH | LVCF_FMT;
+ data.fmt = LVCFMT_LEFT;
+ data.cx = rect.right;
+ data.pszText = const_cast<TCHAR*>(os_string_temp.get_ptr());
+
+ LRESULT ret = uSendMessage(p_listview,LVM_INSERTCOLUMN,p_index,(LPARAM)&data);
+ if (ret < 0) return ~0;
+ else return (unsigned) ret;
+ }
+
+ void get_item_text(HWND p_listview,unsigned p_index,unsigned p_column,pfc::string_base & p_out) {
+ enum {buffer_length = 1024*64};
+ pfc::array_t<TCHAR> buffer; buffer.set_size(buffer_length);
+ ListView_GetItemText(p_listview,p_index,p_column,buffer.get_ptr(),buffer_length);
+ p_out = pfc::stringcvt::string_utf8_from_os(buffer.get_ptr(),buffer_length);
+ }
+
+ bool set_item_text(HWND p_listview,unsigned p_index,unsigned p_column,const char * p_name)
+ {
+ LVITEM item = {};
+
+ pfc::stringcvt::string_os_from_utf8 os_string_temp(p_name);
+
+ item.mask = LVIF_TEXT;
+ item.iItem = p_index;
+ item.iSubItem = p_column;
+ item.pszText = const_cast<TCHAR*>(os_string_temp.get_ptr());
+ return uSendMessage(p_listview,LVM_SETITEM,0,(LPARAM)&item) ? true : false;
+ }
+
+ bool is_item_selected(HWND p_listview,unsigned p_index)
+ {
+ LVITEM item = {};
+ item.mask = LVIF_STATE;
+ item.iItem = p_index;
+ item.stateMask = LVIS_SELECTED;
+ if (!uSendMessage(p_listview,LVM_GETITEM,0,(LPARAM)&item)) return false;
+ return (item.state & LVIS_SELECTED) ? true : false;
+ }
+
+ void set_item_selection(HWND p_listview,unsigned p_index,bool p_state)
+ {
+ PFC_ASSERT( ::IsWindow(p_listview) );
+ LVITEM item = {};
+ item.stateMask = LVIS_SELECTED;
+ item.state = p_state ? LVIS_SELECTED : 0;
+ WIN32_OP_D( SendMessage(p_listview,LVM_SETITEMSTATE,(WPARAM)p_index,(LPARAM)&item) );
+ }
+
+ bool select_single_item(HWND p_listview,unsigned p_index)
+ {
+ LRESULT temp = SendMessage(p_listview,LVM_GETITEMCOUNT,0,0);
+ if (temp < 0) return false;
+ ListView_SetSelectionMark(p_listview,p_index);
+ unsigned n; const unsigned m = pfc::downcast_guarded<unsigned>(temp);
+ for(n=0;n<m;n++) {
+ enum {mask = LVIS_FOCUSED | LVIS_SELECTED};
+ ListView_SetItemState(p_listview,n,n == p_index ? mask : 0, mask);
+ }
+ return ensure_visible(p_listview,p_index);
+ }
+
+ bool ensure_visible(HWND p_listview,unsigned p_index)
+ {
+ return uSendMessage(p_listview,LVM_ENSUREVISIBLE,p_index,FALSE) ? true : false;
+ }
+}
+
+
+
+void ListView_GetContextMenuPoint(HWND p_list,LPARAM p_coords,POINT & p_point,int & p_selection) {
+ if ((DWORD)p_coords == (DWORD)(-1)) {
+ int firstsel = ListView_GetFirstSelection(p_list);
+ if (firstsel >= 0) {
+ ListView_EnsureVisible(p_list, firstsel, FALSE);
+ RECT rect;
+ WIN32_OP_D( ListView_GetItemRect(p_list,firstsel,&rect,LVIR_BOUNDS) );
+ p_point.x = (rect.left + rect.right) / 2;
+ p_point.y = (rect.top + rect.bottom) / 2;
+ WIN32_OP_D( ClientToScreen(p_list,&p_point) );
+ } else {
+ RECT rect;
+ WIN32_OP_D(GetClientRect(p_list,&rect));
+ p_point.x = (rect.left + rect.right) / 2;
+ p_point.y = (rect.top + rect.bottom) / 2;
+ WIN32_OP_D(ClientToScreen(p_list,&p_point));
+ }
+ p_selection = firstsel;
+ } else {
+ POINT pt = {(short)LOWORD(p_coords),(short)HIWORD(p_coords)};
+ p_point = pt;
+ POINT client = pt;
+ WIN32_OP_D( ScreenToClient(p_list,&client) );
+ LVHITTESTINFO info = {};
+ info.pt = client;
+ p_selection = ListView_HitTest(p_list,&info);
+ }
+}
+
+#if 0
+static bool ProbeColumn(HWND view, int index) {
+ LVCOLUMN col = {LVCF_ORDER};
+ return !! ListView_GetColumn(view, index, &col);
+}
+int ListView_GetColumnCount(HWND listView) {
+ if (!ProbeColumn(listView, 0)) return 0;
+ int hi = 1;
+ for (;;) {
+ if (!ProbeColumn(listView, hi)) break;
+ hi <<= 1;
+ if (hi <= 0) {
+ PFC_ASSERT(!"Shouldn't get here!");
+ return -1;
+ }
+ }
+ int lo = hi >> 1;
+ //lo is the highest known valid column, hi is the lowest known invalid, let's bsearch thru
+ while(lo + 1 < hi) {
+ PFC_ASSERT( lo < hi );
+ const int mid = lo + (hi - lo) / 2;
+ PFC_ASSERT( lo < mid && mid < hi );
+ if (ProbeColumn(listView, mid)) {
+ lo = mid;
+ } else {
+ hi = mid;
+ }
+ }
+ return hi;
+}
+#else
+int ListView_GetColumnCount(HWND listView) {
+ HWND header = ListView_GetHeader(listView);
+ PFC_ASSERT(header != NULL);
+ return Header_GetItemCount(header);
+}
+#endif
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/listview_helper.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/listview_helper.h new file mode 100644 index 0000000000..9f5831afd9 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/listview_helper.h @@ -0,0 +1,40 @@ +namespace listview_helper
+{
+ unsigned insert_item(HWND p_listview,unsigned p_index,const char * p_name,LPARAM p_param);//returns index of new item on success, infinite on failure
+
+ unsigned insert_column(HWND p_listview,unsigned p_index,const char * p_name,unsigned p_width_dlu);//returns index of new item on success, infinite on failure
+
+ bool set_item_text(HWND p_listview,unsigned p_index,unsigned p_column,const char * p_name);
+
+ bool is_item_selected(HWND p_listview,unsigned p_index);
+
+ void set_item_selection(HWND p_listview,unsigned p_index,bool p_state);
+
+ bool select_single_item(HWND p_listview,unsigned p_index);
+
+ bool ensure_visible(HWND p_listview,unsigned p_index);
+
+ void get_item_text(HWND p_listview,unsigned p_index,unsigned p_column,pfc::string_base & p_out);
+
+};
+
+static int ListView_GetFirstSelection(HWND p_listview) {
+ return ListView_GetNextItem(p_listview,-1,LVNI_SELECTED);
+}
+
+static int ListView_GetSingleSelection(HWND p_listview) {
+ if (ListView_GetSelectedCount(p_listview) != 1) return -1;
+ return ListView_GetFirstSelection(p_listview);
+}
+
+static int ListView_GetFocusItem(HWND p_listview) {
+ return ListView_GetNextItem(p_listview,-1,LVNI_FOCUSED);
+}
+
+static bool ListView_IsItemSelected(HWND p_listview,int p_index) {
+ return ListView_GetItemState(p_listview,p_index,LVIS_SELECTED) != 0;
+}
+
+void ListView_GetContextMenuPoint(HWND p_list,LPARAM p_coords,POINT & p_point,int & p_selection);
+
+int ListView_GetColumnCount(HWND listView);
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/meta_table_builder.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/meta_table_builder.h new file mode 100644 index 0000000000..44ad0bef3f --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/meta_table_builder.h @@ -0,0 +1,109 @@ +class _meta_table_enum_wrapper {
+public:
+ _meta_table_enum_wrapper(file_info & p_info) : m_info(p_info) {}
+ template<typename t_values>
+ void operator() (const char * p_name,const t_values & p_values) {
+ t_size index = ~0;
+ for(t_values::const_iterator iter = p_values.first(); iter.is_valid(); ++iter) {
+ if (index == ~0) index = m_info.__meta_add_unsafe(p_name,*iter);
+ else m_info.meta_add_value(index,*iter);
+ }
+ }
+private:
+ file_info & m_info;
+};
+
+class _meta_table_enum_wrapper_RG {
+public:
+ _meta_table_enum_wrapper_RG(file_info & p_info) : m_info(p_info) {}
+ template<typename t_values>
+ void operator() (const char * p_name,const t_values & p_values) {
+ if (p_values.get_count() > 0) {
+ if (!m_info.info_set_replaygain(p_name, *p_values.first())) {
+ t_size index = ~0;
+ for(t_values::const_iterator iter = p_values.first(); iter.is_valid(); ++iter) {
+ if (index == ~0) index = m_info.__meta_add_unsafe(p_name,*iter);
+ else m_info.meta_add_value(index,*iter);
+ }
+ }
+ }
+ }
+private:
+ file_info & m_info;
+};
+
+//! Purpose: building a file_info metadata table from loose input without search-for-existing-entry bottleneck
+class meta_table_builder {
+public:
+ typedef pfc::chain_list_v2_t<pfc::string8> t_entry;
+ typedef pfc::map_t<pfc::string8,t_entry,file_info::field_name_comparator> t_content;
+
+ t_content & content() {return m_data;}
+ t_content const & content() const {return m_data;}
+
+ void add(const char * p_name,const char * p_value,t_size p_value_len = ~0) {
+ if (file_info::g_is_valid_field_name(p_name)) {
+ _add(p_name).insert_last()->set_string(p_value,p_value_len);
+ }
+ }
+
+ void remove(const char * p_name) {
+ m_data.remove(p_name);
+ }
+ void set(const char * p_name,const char * p_value,t_size p_value_len = ~0) {
+ if (file_info::g_is_valid_field_name(p_name)) {
+ t_entry & entry = _add(p_name);
+ entry.remove_all();
+ entry.insert_last()->set_string(p_value,p_value_len);
+ }
+ }
+ t_entry & add(const char * p_name) {
+ if (!file_info::g_is_valid_field_name(p_name)) throw pfc::exception_bug_check_v2();//we return a reference, nothing smarter to do
+ return _add(p_name);
+ }
+ void finalize(file_info & p_info) const {
+ p_info.meta_remove_all();
+ m_data.enumerate(_meta_table_enum_wrapper(p_info));
+ }
+ void finalize_withRG(file_info & p_info) const {
+ p_info.meta_remove_all(); p_info.set_replaygain(replaygain_info_invalid);
+ m_data.enumerate(_meta_table_enum_wrapper_RG(p_info));
+ }
+
+ void from_info(const file_info & p_info) {
+ m_data.remove_all();
+ from_info_overwrite(p_info);
+ }
+ void from_info_withRG(const file_info & p_info) {
+ m_data.remove_all();
+ from_info_overwrite(p_info);
+ from_RG_overwrite(p_info.get_replaygain());
+ }
+ void from_RG_overwrite(replaygain_info info) {
+ replaygain_info::t_text_buffer buffer;
+ if (info.format_album_gain(buffer)) set("replaygain_album_gain", buffer);
+ if (info.format_track_gain(buffer)) set("replaygain_track_gain", buffer);
+ if (info.format_album_peak(buffer)) set("replaygain_album_peak", buffer);
+ if (info.format_track_peak(buffer)) set("replaygain_track_peak", buffer);
+ }
+ void from_info_overwrite(const file_info & p_info) {
+ for(t_size metawalk = 0, metacount = p_info.meta_get_count(); metawalk < metacount; ++metawalk ) {
+ const t_size valuecount = p_info.meta_enum_value_count(metawalk);
+ if (valuecount > 0) {
+ t_entry & entry = add(p_info.meta_enum_name(metawalk));
+ entry.remove_all();
+ for(t_size valuewalk = 0; valuewalk < valuecount; ++valuewalk) {
+ entry.insert_last(p_info.meta_enum_value(metawalk,valuewalk));
+ }
+ }
+ }
+ }
+ void reset() {m_data.remove_all();}
+private:
+
+ t_entry & _add(const char * p_name) {
+ return m_data.find_or_add(p_name);
+ }
+
+ t_content m_data;
+};
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/metadb_io_hintlist.cpp b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/metadb_io_hintlist.cpp new file mode 100644 index 0000000000..4849f1134a --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/metadb_io_hintlist.cpp @@ -0,0 +1,39 @@ +#include "stdafx.h"
+
+void metadb_io_hintlist::run() {
+ if (m_entries.get_count() > 0) {
+ static_api_ptr_t<metadb_io>()->hint_multi_async(
+ metadb_io_hintlist_wrapper_part1(m_entries),
+ metadb_io_hintlist_wrapper_part2(m_entries),
+ metadb_io_hintlist_wrapper_part3(m_entries),
+ metadb_io_hintlist_wrapper_part4(m_entries)
+ );
+ }
+ m_entries.remove_all();
+}
+
+void metadb_io_hintlist::add(metadb_handle_ptr const & p_handle,const file_info & p_info,t_filestats const & p_stats,bool p_fresh) {
+ t_entry entry;
+ entry.m_handle = p_handle;
+ entry.m_info.new_t(p_info);
+ entry.m_stats = p_stats;
+ entry.m_fresh = p_fresh;
+ m_entries.add_item(entry);
+}
+
+void metadb_io_hintlist::hint_reader(service_ptr_t<input_info_reader> p_reader, const char * p_path,abort_callback & p_abort) {
+ static_api_ptr_t<metadb> api;
+ const t_uint32 subsongcount = p_reader->get_subsong_count();
+ t_filestats stats = p_reader->get_file_stats(p_abort);
+ for(t_uint32 subsong = 0; subsong < subsongcount; subsong++) {
+ t_uint32 subsong_id = p_reader->get_subsong(subsong);
+ metadb_handle_ptr handle;
+ api->handle_create(handle,make_playable_location(p_path,subsong_id));
+ if (handle->should_reload(stats,true)) {
+ file_info_impl temp;
+ p_reader->get_info(subsong_id,temp,p_abort);
+
+ add(handle,temp,stats,true);
+ }
+ }
+}
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/metadb_io_hintlist.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/metadb_io_hintlist.h new file mode 100644 index 0000000000..0549649550 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/metadb_io_hintlist.h @@ -0,0 +1,50 @@ +
+class metadb_io_hintlist {
+public:
+ void hint_reader(service_ptr_t<input_info_reader> p_reader, const char * p_path,abort_callback & p_abort);
+ void add(metadb_handle_ptr const & p_handle,const file_info & p_info,t_filestats const & p_stats,bool p_fresh);
+ void run();
+ t_size get_pending_count() const {return m_entries.get_count();}
+private:
+ struct t_entry {
+ metadb_handle_ptr m_handle;
+ pfc::rcptr_t<file_info_const_impl> m_info;
+ t_filestats m_stats;
+ bool m_fresh;
+ };
+ class metadb_io_hintlist_wrapper_part1 : public pfc::list_base_const_t<metadb_handle_ptr> {
+ public:
+ metadb_io_hintlist_wrapper_part1(const pfc::list_base_const_t<metadb_io_hintlist::t_entry> & p_list) : m_list(p_list) {}
+ t_size get_count() const {return m_list.get_count();}
+ void get_item_ex(metadb_handle_ptr & p_out, t_size n) const {p_out = m_list[n].m_handle;}
+
+ private:
+ const pfc::list_base_const_t<metadb_io_hintlist::t_entry> & m_list;
+ };
+ class metadb_io_hintlist_wrapper_part2 : public pfc::list_base_const_t<const file_info*> {
+ public:
+ metadb_io_hintlist_wrapper_part2(const pfc::list_base_const_t<metadb_io_hintlist::t_entry> & p_list) : m_list(p_list) {}
+ t_size get_count() const {return m_list.get_count();}
+ void get_item_ex(const file_info* & p_out, t_size n) const {p_out = &*m_list[n].m_info;}
+ private:
+ const pfc::list_base_const_t<metadb_io_hintlist::t_entry> & m_list;
+ };
+ class metadb_io_hintlist_wrapper_part3 : public pfc::list_base_const_t<t_filestats> {
+ public:
+ metadb_io_hintlist_wrapper_part3(const pfc::list_base_const_t<metadb_io_hintlist::t_entry> & p_list) : m_list(p_list) {}
+ t_size get_count() const {return m_list.get_count();}
+ void get_item_ex(t_filestats & p_out, t_size n) const {p_out = m_list[n].m_stats;}
+ private:
+ const pfc::list_base_const_t<metadb_io_hintlist::t_entry> & m_list;
+ };
+ class metadb_io_hintlist_wrapper_part4 : public bit_array {
+ public:
+ metadb_io_hintlist_wrapper_part4(const pfc::list_base_const_t<metadb_io_hintlist::t_entry> & p_list) : m_list(p_list) {}
+ bool get(t_size n) const {return m_list[n].m_fresh;}
+ private:
+ const pfc::list_base_const_t<metadb_io_hintlist::t_entry> & m_list;
+ };
+
+ pfc::list_t<t_entry,pfc::alloc_fast> m_entries;
+};
+
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/mp3_utils.cpp b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/mp3_utils.cpp new file mode 100644 index 0000000000..a3ace28e38 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/mp3_utils.cpp @@ -0,0 +1,261 @@ +#include "stdafx.h"
+
+using namespace bitreader_helper;
+
+static unsigned extract_header_bits(const t_uint8 p_header[4],unsigned p_base,unsigned p_bits)
+{
+ assert(p_base+p_bits<=32);
+ return extract_bits(p_header,p_base,p_bits);
+}
+
+namespace {
+
+ class header_parser
+ {
+ public:
+ header_parser(const t_uint8 p_header[4]) : m_bitptr(0)
+ {
+ memcpy(m_header,p_header,4);
+ }
+ unsigned read(unsigned p_bits)
+ {
+ unsigned ret = extract_header_bits(m_header,m_bitptr,p_bits);
+ m_bitptr += p_bits;
+ return ret;
+ }
+ private:
+ t_uint8 m_header[4];
+ unsigned m_bitptr;
+ };
+}
+
+typedef t_uint16 uint16;
+
+static const uint16 bitrate_table_l1v1[16] = { 0, 32, 64, 96,128,160,192,224,256,288,320,352,384,416,448, 0};
+static const uint16 bitrate_table_l2v1[16] = { 0, 32, 48, 56, 64, 80, 96,112,128,160,192,224,256,320,384, 0};
+static const uint16 bitrate_table_l3v1[16] = { 0, 32, 40, 48, 56, 64, 80, 96,112,128,160,192,224,256,320, 0};
+static const uint16 bitrate_table_l1v2[16] = { 0, 32, 48, 56, 64, 80, 96,112,128,144,160,176,192,224,256, 0};
+static const uint16 bitrate_table_l23v2[16] = { 0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96,112,128,144,160, 0};
+static const uint16 sample_rate_table[] = {11025,12000,8000};
+
+unsigned mp3_utils::QueryMPEGFrameSize(const t_uint8 p_header[4])
+{
+ TMPEGFrameInfo info;
+ if (!ParseMPEGFrameHeader(info,p_header)) return 0;
+ return info.m_bytes;
+}
+
+bool mp3_utils::ParseMPEGFrameHeader(TMPEGFrameInfo & p_info,const t_uint8 p_header[4])
+{
+ enum {MPEG_LAYER_1 = 3, MPEG_LAYER_2 = 2, MPEG_LAYER_3 = 1};
+ enum {_MPEG_1 = 3, _MPEG_2 = 2, _MPEG_25 = 0};
+
+ header_parser parser(p_header);
+ if (parser.read(11) != 0x7FF) return false;
+ unsigned mpeg_version = parser.read(2);
+ unsigned layer = parser.read(2);
+ unsigned protection = parser.read(1);
+ unsigned bitrate_index = parser.read(4);
+ unsigned sample_rate_index = parser.read(2);
+ if (sample_rate_index == 11) return false;//reserved
+ unsigned paddingbit = parser.read(1);
+ int paddingdelta = 0;
+ parser.read(1);//private
+ unsigned channel_mode = parser.read(2);
+ parser.read(2);//channel_mode_extension
+ parser.read(1);//copyright
+ parser.read(1);//original
+ parser.read(2);//emphasis
+
+ unsigned bitrate = 0,sample_rate = 0;
+
+ switch(layer)
+ {
+ default:
+ return false;
+ case MPEG_LAYER_3:
+ paddingdelta = paddingbit ? 1 : 0;
+
+ p_info.m_layer = 3;
+ switch(mpeg_version)
+ {
+ case _MPEG_1:
+ p_info.m_duration = 1152;
+ bitrate = bitrate_table_l3v1[bitrate_index];
+ break;
+ case _MPEG_2:
+ case _MPEG_25:
+ p_info.m_duration = 576;
+ bitrate = bitrate_table_l23v2[bitrate_index];
+ break;
+ default:
+ return false;
+ }
+
+ break;
+ case MPEG_LAYER_2:
+ paddingdelta = paddingbit ? 1 : 0;
+ p_info.m_duration = 1152;
+ p_info.m_layer = 2;
+ switch(mpeg_version)
+ {
+ case _MPEG_1:
+ bitrate = bitrate_table_l2v1[bitrate_index];
+ break;
+ case _MPEG_2:
+ case _MPEG_25:
+ bitrate = bitrate_table_l23v2[bitrate_index];
+ break;
+ default:
+ return false;
+ }
+ break;
+ case MPEG_LAYER_1:
+ paddingdelta = paddingbit ? 4 : 0;
+ p_info.m_duration = 384;
+ p_info.m_layer = 1;
+ switch(mpeg_version)
+ {
+ case _MPEG_1:
+ bitrate = bitrate_table_l1v1[bitrate_index];
+ break;
+ case _MPEG_2:
+ case _MPEG_25:
+ bitrate = bitrate_table_l1v2[bitrate_index];
+ break;
+ default:
+ return false;
+ }
+ break;
+ }
+ if (bitrate == 0) return false;
+
+ sample_rate = sample_rate_table[sample_rate_index];
+ if (sample_rate == 0) return false;
+ switch(mpeg_version)
+ {
+ case _MPEG_1:
+ sample_rate *= 4;
+ p_info.m_mpegversion = MPEG_1;
+ break;
+ case _MPEG_2:
+ sample_rate *= 2;
+ p_info.m_mpegversion = MPEG_2;
+ break;
+ case _MPEG_25:
+ p_info.m_mpegversion = MPEG_25;
+ break;
+ }
+
+ switch(channel_mode)
+ {
+ case 0:
+ case 1:
+ case 2:
+ p_info.m_channels = 2;
+ break;
+ case 3:
+ p_info.m_channels = 1;
+ break;
+ }
+
+ p_info.m_channel_mode = channel_mode;
+
+ p_info.m_sample_rate = sample_rate;
+
+
+ p_info.m_bytes = ( bitrate /*kbps*/ * (1000/8) /* kbps-to-bytes*/ * p_info.m_duration /*samples-per-frame*/ ) / sample_rate + paddingdelta;
+
+ if (p_info.m_layer == 1) p_info.m_bytes &= ~3;
+
+ p_info.m_crc = protection == 0;
+
+ return true;
+}
+
+unsigned mp3header::get_samples_per_frame()
+{
+ mp3_utils::TMPEGFrameInfo fr;
+ if (!decode(fr)) return 0;
+ return fr.m_duration;
+}
+
+bool mp3_utils::IsSameStream(TMPEGFrameInfo const & p_frame1,TMPEGFrameInfo const & p_frame2) {
+ return
+ p_frame1.m_channel_mode == p_frame2.m_channel_mode &&
+ p_frame1.m_sample_rate == p_frame2.m_sample_rate &&
+ p_frame1.m_layer == p_frame2.m_layer &&
+ p_frame1.m_mpegversion == p_frame2.m_mpegversion;
+}
+
+
+
+bool mp3_utils::ValidateFrameCRC(const t_uint8 * frameData, t_size frameSize, TMPEGFrameInfo const & info) {
+ if (frameSize < info.m_bytes) return false; //FAIL, incomplete data
+ if (!info.m_crc) return true; //nothing to check, frame appears valid
+ return ExtractFrameCRC(frameData, frameSize, info) == CalculateFrameCRC(frameData, frameSize, info);
+}
+
+static t_uint32 CRC_update(unsigned value, t_uint32 crc)
+{
+ enum { CRC16_POLYNOMIAL = 0x8005 };
+ unsigned i;
+ value <<= 8;
+ for (i = 0; i < 8; i++) {
+ value <<= 1;
+ crc <<= 1;
+ if (((crc ^ value) & 0x10000)) crc ^= CRC16_POLYNOMIAL;
+ }
+ return crc;
+}
+
+
+void mp3_utils::RecalculateFrameCRC(t_uint8 * frameData, t_size frameSize, TMPEGFrameInfo const & info) {
+ PFC_ASSERT( frameSize >= info.m_bytes && info.m_crc );
+
+ const t_uint16 crc = ExtractFrameCRC(frameData, frameSize, info);
+ frameData[4] = (t_uint8)(crc >> 8);
+ frameData[5] = (t_uint8)(crc & 0xFF);
+}
+
+static t_uint16 grabFrameCRC(const t_uint8 * frameData, t_size sideInfoLen) {
+ t_uint32 crc = 0xffff;
+ crc = CRC_update(frameData[2], crc);
+ crc = CRC_update(frameData[3], crc);
+ for (t_size i = 6; i < sideInfoLen; i++) {
+ crc = CRC_update(frameData[i], crc);
+ }
+
+ return (t_uint32) (crc & 0xFFFF);
+}
+
+t_uint16 mp3_utils::ExtractFrameCRC(const t_uint8 * frameData, t_size frameSize, TMPEGFrameInfo const & info) {
+ PFC_ASSERT( frameSize >= info.m_bytes && info.m_crc );
+
+ return ((t_uint16)frameData[4] << 8) | (t_uint16)frameData[5];
+
+}
+t_uint16 mp3_utils::CalculateFrameCRC(const t_uint8 * frameData, t_size frameSize, TMPEGFrameInfo const & info) {
+ PFC_ASSERT( frameSize >= info.m_bytes && info.m_crc );
+
+ t_size sideInfoLen = 0;
+ if (info.m_mpegversion == MPEG_1)
+ sideInfoLen = (info.m_channels == 1) ? 4 + 17 : 4 + 32;
+ else
+ sideInfoLen = (info.m_channels == 1) ? 4 + 9 : 4 + 17;
+
+ //CRC
+ sideInfoLen += 2;
+
+ PFC_ASSERT( sideInfoLen <= frameSize );
+
+ return grabFrameCRC(frameData, sideInfoLen);
+}
+
+
+bool mp3_utils::ValidateFrameCRC(const t_uint8 * frameData, t_size frameSize) {
+ if (frameSize < 4) return false; //FAIL, not a valid frame
+ TMPEGFrameInfo info;
+ if (!ParseMPEGFrameHeader(info, frameData)) return false; //FAIL, not a valid frame
+ return ValidateFrameCRC(frameData, frameSize, info);
+}
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/mp3_utils.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/mp3_utils.h new file mode 100644 index 0000000000..0d058f29da --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/mp3_utils.h @@ -0,0 +1,68 @@ +namespace mp3_utils
+{
+
+ enum {
+ MPG_MD_STEREO=0,
+ MPG_MD_JOINT_STEREO=1,
+ MPG_MD_DUAL_CHANNEL=2,
+ MPG_MD_MONO=3,
+ };
+
+ typedef t_uint8 byte;
+
+ enum {MPEG_1, MPEG_2, MPEG_25};
+
+ struct TMPEGFrameInfo
+ {
+ unsigned m_bytes;
+ unsigned m_sample_rate;
+ unsigned m_layer;
+ unsigned m_mpegversion;
+ unsigned m_channels;
+ unsigned m_duration;
+ unsigned m_channel_mode;
+ bool m_crc;
+ };
+
+
+ bool ParseMPEGFrameHeader(TMPEGFrameInfo & p_info,const t_uint8 p_header[4]);
+ bool ValidateFrameCRC(const t_uint8 * frameData, t_size frameSize);
+ bool ValidateFrameCRC(const t_uint8 * frameData, t_size frameSize, TMPEGFrameInfo const & frameInfo);
+
+ //! Assumes valid frame with CRC (frameInfo.m_crc set, frameInfo.m_bytes <= frameSize).
+ t_uint16 ExtractFrameCRC(const t_uint8 * frameData, t_size frameSize, TMPEGFrameInfo const & frameInfo);
+ //! Assumes valid frame with CRC (frameInfo.m_crc set, frameInfo.m_bytes <= frameSize).
+ t_uint16 CalculateFrameCRC(const t_uint8 * frameData, t_size frameSize, TMPEGFrameInfo const & frameInfo);
+ //! Assumes valid frame with CRC (frameInfo.m_crc set, frameInfo.m_bytes <= frameSize).
+ void RecalculateFrameCRC(t_uint8 * frameData, t_size frameSize, TMPEGFrameInfo const & frameInfo);
+
+ unsigned QueryMPEGFrameSize(const t_uint8 p_header[4]);
+ bool IsSameStream(TMPEGFrameInfo const & p_frame1,TMPEGFrameInfo const & p_frame2);
+};
+
+class mp3header
+{
+ t_uint8 bytes[4];
+public:
+
+ inline void copy(const mp3header & src) {memcpy(bytes,src.bytes,4);}
+ inline void copy_raw(const void * src) {memcpy(bytes,src,4);}
+
+ inline mp3header(const mp3header & src) {copy(src);}
+ inline mp3header() {}
+
+ inline const mp3header & operator=(const mp3header & src) {copy(src); return *this;}
+
+ inline void get_bytes(void * out) {memcpy(out,bytes,4);}
+ inline unsigned get_frame_size() const {return mp3_utils::QueryMPEGFrameSize(bytes);}
+ inline bool decode(mp3_utils::TMPEGFrameInfo & p_out) {return mp3_utils::ParseMPEGFrameHeader(p_out,bytes);}
+
+ unsigned get_samples_per_frame();
+};
+
+static inline mp3header mp3header_from_buffer(const void * p_buffer)
+{
+ mp3header temp;
+ temp.copy_raw(p_buffer);
+ return temp;
+}
\ No newline at end of file diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/playlist_position_reference_tracker.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/playlist_position_reference_tracker.h new file mode 100644 index 0000000000..ef3edb9941 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/playlist_position_reference_tracker.h @@ -0,0 +1,73 @@ +class playlist_position_reference_tracker : public playlist_callback_impl_base {
+public:
+ //! @param p_trackitem Specifies whether we want to track some specific item rather than just an offset in a playlist. When set to true, item index becomes invalidated when the item we're tracking is removed.
+ playlist_position_reference_tracker(bool p_trackitem = true) : playlist_callback_impl_base(~0), m_trackitem(p_trackitem), m_playlist(pfc_infinite), m_item(pfc_infinite) {}
+
+ void on_items_added(t_size p_playlist,t_size p_start, const pfc::list_base_const_t<metadb_handle_ptr> & p_data,const bit_array & p_selection) {
+ if (p_playlist == m_playlist && m_item != pfc_infinite && p_start <= m_item) {
+ m_item += p_data.get_count();
+ }
+ }
+ void on_items_reordered(t_size p_playlist,const t_size * p_order,t_size p_count) {
+ if (p_playlist == m_playlist) {
+ if (m_item < p_count) {
+ m_item = order_helper::g_find_reverse(p_order,m_item);
+ } else {
+ m_item = pfc_infinite;
+ }
+ }
+ }
+
+ void on_items_removed(t_size p_playlist,const bit_array & p_mask,t_size p_old_count,t_size p_new_count) {
+ if (p_playlist == m_playlist) {
+ if (m_item < p_old_count) {
+ const t_size item_before = m_item;
+ for(t_size walk = p_mask.find_first(true,0,p_old_count); walk < p_old_count; walk = p_mask.find_next(true,walk,p_old_count)) {
+ if (walk < item_before) {
+ m_item--;
+ } else if (walk == item_before) {
+ if (m_trackitem) m_item = pfc_infinite;
+ break;
+ } else {
+ break;
+ }
+ }
+ if (m_item >= p_new_count) m_item = pfc_infinite;
+ } else {
+ m_item = pfc_infinite;
+ }
+ }
+ }
+
+ //todo? could be useful in some cases
+ void on_items_replaced(t_size p_playlist,const bit_array & p_mask,const pfc::list_base_const_t<t_on_items_replaced_entry> & p_data) {}
+
+ void on_playlist_created(t_size p_index,const char * p_name,t_size p_name_len) {
+ if (m_playlist != pfc_infinite && p_index <= m_playlist) m_playlist++;
+ }
+ void on_playlists_reorder(const t_size * p_order,t_size p_count) {
+ if (m_playlist < p_count) m_playlist = order_helper::g_find_reverse(p_order,m_playlist);
+ else m_playlist = pfc_infinite;
+ }
+ void on_playlists_removed(const bit_array & p_mask,t_size p_old_count,t_size p_new_count) {
+ if (m_playlist < p_old_count) {
+ const t_size playlist_before = m_playlist;
+ for(t_size walk = p_mask.find_first(true,0,p_old_count); walk < p_old_count; walk = p_mask.find_next(true,walk,p_old_count)) {
+ if (walk < playlist_before) {
+ m_playlist--;
+ } else if (walk == playlist_before) {
+ m_playlist = pfc_infinite;
+ break;
+ } else {
+ break;
+ }
+ }
+ } else {
+ m_playlist = pfc_infinite;
+ }
+ }
+
+ t_size m_playlist, m_item;
+private:
+ const bool m_trackitem;
+};
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/seekabilizer.cpp b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/seekabilizer.cpp new file mode 100644 index 0000000000..5173d39ece --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/seekabilizer.cpp @@ -0,0 +1,218 @@ +#include "stdafx.h"
+
+enum {backread_on_seek = 1024};
+
+void seekabilizer_backbuffer::initialize(t_size p_size)
+{
+ m_depth = m_cursor = 0;
+
+ m_buffer.set_size(p_size);
+}
+
+void seekabilizer_backbuffer::write(const void * p_buffer,t_size p_bytes)
+{
+ if (p_bytes >= m_buffer.get_size())
+ {
+ memcpy(m_buffer.get_ptr(),(const t_uint8*)p_buffer + p_bytes - m_buffer.get_size(),m_buffer.get_size());
+ m_cursor = 0;
+ m_depth = m_buffer.get_size();
+ }
+ else
+ {
+ const t_uint8* sourceptr = (const t_uint8*) p_buffer;
+ t_size remaining = p_bytes;
+ while(remaining > 0)
+ {
+ t_size delta = m_buffer.get_size() - m_cursor;
+ if (delta > remaining) delta = remaining;
+
+ memcpy(m_buffer.get_ptr() + m_cursor,sourceptr,delta);
+
+ sourceptr += delta;
+ remaining -= delta;
+ m_cursor = (m_cursor + delta) % m_buffer.get_size();
+
+ m_depth = pfc::min_t<t_size>(m_buffer.get_size(),m_depth + delta);
+
+ }
+ }
+}
+
+void seekabilizer_backbuffer::read(t_size p_backlogdepth,void * p_buffer,t_size p_bytes) const
+{
+ assert(p_backlogdepth <= m_depth);
+ assert(p_backlogdepth >= p_bytes);
+
+
+ t_uint8* targetptr = (t_uint8*) p_buffer;
+ t_size remaining = p_bytes;
+ t_size cursor = (m_cursor + m_buffer.get_size() - p_backlogdepth) % m_buffer.get_size();
+
+ while(remaining > 0)
+ {
+ t_size delta = m_buffer.get_size() - cursor;
+ if (delta > remaining) delta = remaining;
+
+ memcpy(targetptr,m_buffer.get_ptr() + cursor,delta);
+
+ targetptr += delta;
+ remaining -= delta;
+ cursor = (cursor + delta) % m_buffer.get_size();
+ }
+}
+
+t_size seekabilizer_backbuffer::get_depth() const
+{
+ return m_depth;
+}
+
+t_size seekabilizer_backbuffer::get_max_depth() const
+{
+ return m_buffer.get_size();
+}
+
+void seekabilizer_backbuffer::reset()
+{
+ m_depth = m_cursor = 0;
+}
+
+
+void seekabilizer::initialize(service_ptr_t<file> p_base,t_size p_buffer_size,abort_callback & p_abort) {
+ m_buffer.initialize(p_buffer_size);
+ m_file = p_base;
+ m_position = m_position_base = 0;
+ m_size = m_file->get_size(p_abort);
+}
+
+void seekabilizer::g_seekabilize(service_ptr_t<file> & p_reader,t_size p_buffer_size,abort_callback & p_abort) {
+ if (p_reader.is_valid() && p_reader->is_remote() && p_buffer_size > 0) {
+ service_ptr_t<seekabilizer> instance = new service_impl_t<seekabilizer>();
+ instance->initialize(p_reader,p_buffer_size,p_abort);
+ p_reader = instance.get_ptr();
+ }
+}
+
+t_size seekabilizer::read(void * p_buffer,t_size p_bytes,abort_callback & p_abort) {
+ p_abort.check_e();
+
+ if (m_position > m_position_base + pfc::max_t<t_size>(m_buffer.get_max_depth(),backread_on_seek) && m_file->can_seek()) {
+ t_filesize target = m_position;
+ if (target < backread_on_seek) target = 0;
+ else target -= backread_on_seek;
+ m_file->seek(target,p_abort);
+ m_position_base = target;
+ }
+
+ //seek ahead
+ while(m_position > m_position_base) {
+ enum {tempsize = 1024};
+ t_uint8 temp[tempsize];
+ t_size delta = (t_size) pfc::min_t<t_filesize>(tempsize,m_position - m_position_base);
+ t_size bytes_read = 0;
+ bytes_read = m_file->read(temp,delta,p_abort);
+ m_buffer.write(temp,bytes_read);
+ m_position_base += bytes_read;
+
+ if (bytes_read < delta) {
+ return 0;
+ }
+ }
+
+ t_size done = 0;
+ t_uint8 * targetptr = (t_uint8*) p_buffer;
+
+ //try to read backbuffer
+ if (m_position < m_position_base) {
+ if (m_position_base - m_position > (t_filesize)m_buffer.get_depth()) throw exception_io_seek_out_of_range();
+ t_size backread_depth = (t_size) (m_position_base - m_position);
+ t_size delta = pfc::min_t<t_size>(backread_depth,p_bytes-done);
+ m_buffer.read(backread_depth,targetptr,delta);
+ done += delta;
+ m_position += delta;
+ }
+
+ //regular read
+ if (done < p_bytes)
+ {
+ t_size bytes_read;
+ bytes_read = m_file->read(targetptr+done,p_bytes-done,p_abort);
+
+ m_buffer.write(targetptr+done,bytes_read);
+
+ done += bytes_read;
+ m_position += bytes_read;
+ m_position_base += bytes_read;
+ }
+
+ return done;
+}
+
+t_filesize seekabilizer::get_size(abort_callback & p_abort) {
+ p_abort.check_e();
+ return m_size;
+}
+
+t_filesize seekabilizer::get_position(abort_callback & p_abort) {
+ p_abort.check_e();
+ return m_position;
+}
+
+void seekabilizer::seek(t_filesize p_position,abort_callback & p_abort) {
+ assert(m_position_base >= m_buffer.get_depth());
+ p_abort.check_e();
+
+ if (m_size != filesize_invalid && p_position > m_size) throw exception_io_seek_out_of_range();
+
+ t_filesize lowest = m_position_base - m_buffer.get_depth();
+
+ if (p_position < lowest) {
+ if (m_file->can_seek()) {
+ m_buffer.reset();
+ t_filesize target = p_position;
+ t_size delta = m_buffer.get_max_depth();
+ if (delta > backread_on_seek) delta = backread_on_seek;
+ if (target > delta) target -= delta;
+ else target = 0;
+ m_file->seek(target,p_abort);
+ m_position_base = target;
+ }
+ else {
+ m_buffer.reset();
+ m_file->reopen(p_abort);
+ m_position_base = 0;
+ }
+ }
+
+ m_position = p_position;
+}
+
+bool seekabilizer::can_seek()
+{
+ return true;
+}
+
+bool seekabilizer::get_content_type(pfc::string_base & p_out) {return m_file->get_content_type(p_out);}
+
+bool seekabilizer::is_in_memory() {return false;}
+
+void seekabilizer::on_idle(abort_callback & p_abort) {return m_file->on_idle(p_abort);}
+
+t_filetimestamp seekabilizer::get_timestamp(abort_callback & p_abort) {
+ p_abort.check_e();
+ return m_file->get_timestamp(p_abort);
+}
+
+void seekabilizer::reopen(abort_callback & p_abort) {
+ if (m_position_base - m_buffer.get_depth() == 0) {
+ seek(0,p_abort);
+ } else {
+ m_position = m_position_base = 0;
+ m_buffer.reset();
+ m_file->reopen(p_abort);
+ }
+}
+
+bool seekabilizer::is_remote()
+{
+ return m_file->is_remote();
+}
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/seekabilizer.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/seekabilizer.h new file mode 100644 index 0000000000..454546b148 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/seekabilizer.h @@ -0,0 +1,36 @@ +class seekabilizer_backbuffer
+{
+public:
+ void initialize(t_size p_size);
+ void write(const void * p_buffer,t_size p_bytes);
+ void read(t_size p_backlogdepth,void * p_buffer,t_size p_bytes) const;
+ t_size get_depth() const;
+ void reset();
+ t_size get_max_depth() const;
+private:
+ pfc::array_t<t_uint8> m_buffer;
+ t_size m_depth,m_cursor;
+};
+
+class seekabilizer : public file_readonly {
+public:
+ void initialize(service_ptr_t<file> p_base,t_size p_buffer_size,abort_callback & p_abort);
+
+ static void g_seekabilize(service_ptr_t<file> & p_reader,t_size p_buffer_size,abort_callback & p_abort);
+
+ t_size read(void * p_buffer,t_size p_bytes,abort_callback & p_abort);
+ t_filesize get_size(abort_callback & p_abort);
+ t_filesize get_position(abort_callback & p_abort);
+ void seek(t_filesize p_position,abort_callback & p_abort);
+ bool can_seek();
+ bool get_content_type(pfc::string_base & p_out);
+ bool is_in_memory();
+ void on_idle(abort_callback & p_abort);
+ t_filetimestamp get_timestamp(abort_callback & p_abort);
+ void reopen(abort_callback & p_abort);
+ bool is_remote();
+private:
+ service_ptr_t<file> m_file;
+ seekabilizer_backbuffer m_buffer;
+ t_filesize m_size,m_position,m_position_base;
+};
\ No newline at end of file diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/stream_buffer_helper.cpp b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/stream_buffer_helper.cpp new file mode 100644 index 0000000000..6e6c099a27 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/stream_buffer_helper.cpp @@ -0,0 +1,79 @@ +#include "stdafx.h"
+
+stream_reader_buffered::stream_reader_buffered(stream_reader * p_base,t_size p_buffer) : m_base(p_base)
+{
+ m_buffer.set_size(p_buffer);
+ m_buffer_ptr = 0;
+ m_buffer_max = 0;
+}
+
+t_size stream_reader_buffered::read(void * p_buffer,t_size p_bytes,abort_callback & p_abort) {
+ p_abort.check_e();
+ char * output = (char*) p_buffer;
+ t_size output_ptr = 0;
+
+ while(output_ptr < p_bytes) {
+ {
+ t_size delta = pfc::min_t(p_bytes - output_ptr, m_buffer_max - m_buffer_ptr);
+ if (delta > 0)
+ {
+ memcpy(output + output_ptr, m_buffer.get_ptr() + m_buffer_ptr, delta);
+ output_ptr += delta;
+ m_buffer_ptr += delta;
+ }
+ }
+
+ if (m_buffer_ptr == m_buffer_max)
+ {
+ t_size bytes_read;
+ bytes_read = m_base->read(m_buffer.get_ptr(), m_buffer.get_size(), p_abort);
+ m_buffer_ptr = 0;
+ m_buffer_max = bytes_read;
+
+ if (m_buffer_max == 0) break;
+ }
+ }
+
+ return output_ptr;
+}
+
+stream_writer_buffered::stream_writer_buffered(stream_writer * p_base,t_size p_buffer)
+ : m_base(p_base)
+{
+ m_buffer.set_size(p_buffer);
+ m_buffer_ptr = 0;
+}
+
+void stream_writer_buffered::write(const void * p_buffer,t_size p_bytes,abort_callback & p_abort) {
+ p_abort.check_e();
+ const char * source = (const char*)p_buffer;
+ t_size source_remaining = p_bytes;
+ const t_size buffer_size = m_buffer.get_size();
+ if (source_remaining >= buffer_size)
+ {
+ flush(p_abort);
+ m_base->write_object(source,source_remaining,p_abort);
+ return;
+ }
+
+ if (m_buffer_ptr + source_remaining >= buffer_size)
+ {
+ t_size delta = buffer_size - m_buffer_ptr;
+ memcpy(m_buffer.get_ptr() + m_buffer_ptr, source,delta);
+ source += delta;
+ source_remaining -= delta;
+ m_buffer_ptr += delta;
+ flush(p_abort);
+ }
+
+ memcpy(m_buffer.get_ptr() + m_buffer_ptr, source,source_remaining);
+ m_buffer_ptr += source_remaining;
+}
+
+
+void stream_writer_buffered::flush(abort_callback & p_abort) {
+ if (m_buffer_ptr > 0) {
+ m_base->write_object(m_buffer.get_ptr(),m_buffer_ptr,p_abort);
+ m_buffer_ptr = 0;
+ }
+}
\ No newline at end of file diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/stream_buffer_helper.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/stream_buffer_helper.h new file mode 100644 index 0000000000..b58c382c42 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/stream_buffer_helper.h @@ -0,0 +1,26 @@ +class stream_reader_buffered : public stream_reader
+{
+public:
+ stream_reader_buffered(stream_reader * p_base,t_size p_buffer);
+ t_size read(void * p_buffer,t_size p_bytes,abort_callback & p_abort);
+private:
+ stream_reader * m_base;
+ pfc::array_t<char> m_buffer;
+ t_size m_buffer_ptr, m_buffer_max;
+};
+
+class stream_writer_buffered : public stream_writer
+{
+public:
+ stream_writer_buffered(stream_writer * p_base,t_size p_buffer);
+
+ void write(const void * p_buffer,t_size p_bytes,abort_callback & p_abort);
+
+ void flush(abort_callback & p_abort);
+
+private:
+ stream_writer * m_base;
+ pfc::array_t<char> m_buffer;
+ t_size m_buffer_ptr;
+};
+
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/string_filter.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/string_filter.h new file mode 100644 index 0000000000..e40d69bc31 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/string_filter.h @@ -0,0 +1,24 @@ +class string_filter_noncasesensitive {
+public:
+ string_filter_noncasesensitive(const char * p_string,t_size p_string_len = ~0) {
+ uStringLower(m_pattern,p_string,p_string_len);
+ }
+
+ bool test(const char * p_string,t_size p_string_len = ~0) const {
+ ::uStringLower(m_lowercasebuffer,p_string,p_string_len);
+ t_size walk = 0;
+ while(m_pattern[walk] != 0) {
+ while(m_pattern[walk] == ' ') walk++;
+ t_size delta = 0;
+ while(m_pattern[walk+delta] != 0 && m_pattern[walk+delta] != ' ') delta++;
+ if (delta > 0) {
+ if (pfc::string_find_first_ex(m_lowercasebuffer,~0,m_pattern+walk,delta) == ~0) return false;
+ }
+ walk += delta;
+ }
+ return true;
+ }
+private:
+ mutable pfc::string8_fastalloc m_lowercasebuffer;
+ pfc::string8 m_pattern;
+};
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/text_file_loader.cpp b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/text_file_loader.cpp new file mode 100644 index 0000000000..b88403a352 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/text_file_loader.cpp @@ -0,0 +1,100 @@ +#include "StdAfx.h"
+
+static const unsigned char utf8_header[3] = {0xEF,0xBB,0xBF};
+
+namespace text_file_loader
+{
+ void write(const service_ptr_t<file> & p_file,abort_callback & p_abort,const char * p_string,bool is_utf8)
+ {
+ p_file->seek(0,p_abort);
+ p_file->set_eof(p_abort);
+ if (is_utf8)
+ {
+ p_file->write_object(utf8_header,sizeof(utf8_header),p_abort);
+ p_file->write_object(p_string,strlen(p_string),p_abort);
+ }
+ else
+ {
+ pfc::stringcvt::string_ansi_from_utf8 bah(p_string);
+ p_file->write_object(bah,bah.length(),p_abort);
+ }
+ }
+
+ void read(const service_ptr_t<file> & p_file,abort_callback & p_abort,pfc::string_base & p_out,bool & is_utf8) {
+ p_out.reset();
+ if (p_file->can_seek())
+ {
+ p_file->seek(0,p_abort);
+ }
+
+ pfc::array_t<char> mem;
+ t_filesize size64;
+ size64 = p_file->get_size(p_abort);
+ if (size64 == filesize_invalid)//typically HTTP
+ {
+ pfc::string8 ansitemp;
+ is_utf8 = false;
+ enum {delta = 1024*64, max = 1024*512};
+ char temp[3];
+ t_size done;
+ done = p_file->read(temp,3,p_abort);
+ if (done != 3)
+ {
+ if (done > 0) p_out = pfc::stringcvt::string_utf8_from_ansi(temp,done);
+ return;
+ }
+ if (!memcmp(utf8_header,temp,3)) is_utf8 = true;
+ else ansitemp.add_string(temp,3);
+
+ mem.set_size(delta);
+
+ for (;;)
+ {
+ done = p_file->read(mem.get_ptr(),delta,p_abort);
+ if (done > 0)
+ {
+ if (is_utf8) p_out.add_string(mem.get_ptr(),done);
+ else ansitemp.add_string(mem.get_ptr(),done);
+ }
+ if (done < delta) break;
+ }
+
+ if (!is_utf8)
+ {
+ p_out = pfc::stringcvt::string_utf8_from_ansi(ansitemp);
+ }
+
+ return;
+ }
+ else
+ {
+ if (size64>1024*1024*128) throw exception_io_data();//hard limit
+ t_size size = pfc::downcast_guarded<t_size>(size64);
+ mem.set_size(size+1);
+ char * asdf = mem.get_ptr();
+ p_file->read_object(asdf,size,p_abort);
+ asdf[size]=0;
+ if (size>3 && !memcmp(utf8_header,asdf,3)) {is_utf8 = true; p_out.add_string(asdf+3); }
+ else {
+ is_utf8 = false;
+ p_out = pfc::stringcvt::string_utf8_from_ansi(asdf);
+ }
+ return;
+ }
+ }
+
+ void write(const char * p_path,abort_callback & p_abort,const char * p_string,bool is_utf8)
+ {
+ service_ptr_t<file> f;
+ filesystem::g_open_write_new(f,p_path,p_abort);
+ write(f,p_abort,p_string,is_utf8);
+ }
+
+ void read(const char * p_path,abort_callback & p_abort,pfc::string_base & p_out,bool & is_utf8)
+ {
+ service_ptr_t<file> f;
+ filesystem::g_open_read(f,p_path,p_abort);
+ read(f,p_abort,p_out,is_utf8);
+ }
+
+}
\ No newline at end of file diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/text_file_loader.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/text_file_loader.h new file mode 100644 index 0000000000..fd4b83622c --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/text_file_loader.h @@ -0,0 +1,9 @@ +namespace text_file_loader
+{
+ void write(const service_ptr_t<file> & p_file,abort_callback & p_abort,const char * p_string,bool is_utf8);
+ void read(const service_ptr_t<file> & p_file,abort_callback & p_abort,pfc::string_base & p_out,bool & is_utf8);
+
+ void write(const char * p_path,abort_callback & p_abort,const char * p_string,bool is_utf8);
+ void read(const char * p_path,abort_callback & p_abort,pfc::string_base & p_out,bool & is_utf8);
+
+};
\ No newline at end of file diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/wildcard.cpp b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/wildcard.cpp new file mode 100644 index 0000000000..6021e4e569 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/wildcard.cpp @@ -0,0 +1,50 @@ +#include "stdafx.h"
+
+static bool test_recur(const char * fn,const char * rm,bool b_sep)
+{
+ for (;;)
+ {
+ if ((b_sep && *rm==';') || *rm==0) return *fn==0;
+ else if (*rm=='*')
+ {
+ rm++;
+ do
+ {
+ if (test_recur(fn,rm,b_sep)) return true;
+ } while(pfc::utf8_advance(fn));
+ return false;
+ }
+ else if (*fn==0) return false;
+ else if (*rm!='?' && uCharLower(pfc::utf8_get_char(fn))!=uCharLower(pfc::utf8_get_char(rm))) return false;
+
+ fn = pfc::utf8_char_next(fn); rm = pfc::utf8_char_next(rm);
+ }
+}
+
+bool wildcard_helper::test_path(const char * path,const char * pattern,bool b_sep) {return test(path + pfc::scan_filename(path),pattern,b_sep);}
+
+bool wildcard_helper::test(const char * fn,const char * pattern,bool b_sep)
+{
+ if (!b_sep) return test_recur(fn,pattern,false);
+ const char * rm=pattern;
+ while(*rm)
+ {
+ if (test_recur(fn,rm,true)) return true;
+ while(*rm && *rm!=';') rm++;
+ if (*rm==';')
+ {
+ while(*rm==';') rm++;
+ while(*rm==' ') rm++;
+ }
+ };
+
+ return false;
+}
+
+bool wildcard_helper::has_wildcards(const char * str) {return strchr(str,'*') || strchr(str,'?');}
+
+const char * wildcard_helper::get_wildcard_list() {return "*?";}
+
+bool wildcard_helper::is_wildcard(char c) {
+ return c == '*' || c == '?';
+}
\ No newline at end of file diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/wildcard.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/wildcard.h new file mode 100644 index 0000000000..2445588267 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/wildcard.h @@ -0,0 +1,15 @@ +#ifndef __FOOBAR2000_HELPER_WILDCARD_H__
+#define __FOOBAR2000_HELPER_WILDCARD_H__
+
+namespace wildcard_helper
+{
+ bool test_path(const char * path,const char * pattern,bool b_separate_by_semicolon = false);//will extract filename from path first
+ bool test(const char * str,const char * pattern,bool b_separate_by_semicolon = false);//tests if str matches pattern
+ bool has_wildcards(const char * str);
+ const char * get_wildcard_list();
+ bool is_wildcard(char c);
+};
+
+
+
+#endif //__FOOBAR2000_HELPER_WILDCARD_H__
\ No newline at end of file diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/win32_dialog.cpp b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/win32_dialog.cpp new file mode 100644 index 0000000000..8cda858b83 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/win32_dialog.cpp @@ -0,0 +1,288 @@ +#include "stdafx.h"
+
+
+namespace dialog_helper {
+
+
+ INT_PTR CALLBACK dialog::DlgProc(HWND wnd,UINT msg,WPARAM wp,LPARAM lp)
+ {
+ dialog * p_this;
+ BOOL rv;
+ if (msg==WM_INITDIALOG)
+ {
+ p_this = reinterpret_cast<dialog*>(lp);
+ p_this->wnd = wnd;
+ SetWindowLongPtr(wnd,DWLP_USER,lp);
+
+ if (p_this->m_is_modal) p_this->m_modal_scope.initialize(wnd);
+ }
+ else p_this = reinterpret_cast<dialog*>(GetWindowLongPtr(wnd,DWLP_USER));
+
+ rv = p_this ? p_this->on_message(msg,wp,lp) : FALSE;
+
+ if (msg==WM_DESTROY && p_this)
+ {
+ SetWindowLongPtr(wnd,DWLP_USER,0);
+// p_this->wnd = 0;
+ }
+
+ return rv;
+ }
+
+
+ int dialog::run_modal(unsigned id,HWND parent)
+ {
+ assert(wnd == 0);
+ if (wnd != 0) return -1;
+ m_is_modal = true;
+ return uDialogBox(id,parent,DlgProc,reinterpret_cast<LPARAM>(this));
+ }
+ HWND dialog::run_modeless(unsigned id,HWND parent)
+ {
+ assert(wnd == 0);
+ if (wnd != 0) return 0;
+ m_is_modal = false;
+ return uCreateDialog(id,parent,DlgProc,reinterpret_cast<LPARAM>(this));
+ }
+
+ void dialog::end_dialog(int code)
+ {
+ assert(m_is_modal);
+ if (m_is_modal) uEndDialog(wnd,code);
+ }
+
+
+
+
+
+
+
+
+
+
+ int dialog_modal::run(unsigned p_id,HWND p_parent,HINSTANCE p_instance)
+ {
+ int status;
+
+ // note: uDialogBox() has its own modal scope, we don't want that to trigger
+ // if this is ever changed, move deinit to WM_DESTROY handler in DlgProc
+
+ status = (int)DialogBoxParam(p_instance,MAKEINTRESOURCE(p_id),p_parent,DlgProc,reinterpret_cast<LPARAM>(this));
+
+ m_modal_scope.deinitialize();
+
+ return status;
+ }
+
+ void dialog_modal::end_dialog(int p_code)
+ {
+ EndDialog(m_wnd,p_code);
+ }
+
+
+ INT_PTR CALLBACK dialog_modal::DlgProc(HWND wnd,UINT msg,WPARAM wp,LPARAM lp)
+ {
+ dialog_modal * _this;
+ if (msg==WM_INITDIALOG)
+ {
+ _this = reinterpret_cast<dialog_modal*>(lp);
+ _this->m_wnd = wnd;
+ SetWindowLongPtr(wnd,DWLP_USER,lp);
+
+ _this->m_modal_scope.initialize(wnd);
+ }
+ else _this = reinterpret_cast<dialog_modal*>(GetWindowLongPtr(wnd,DWLP_USER));
+
+ assert(_this == 0 || _this->m_wnd == wnd);
+
+ return _this ? _this->on_message(msg,wp,lp) : FALSE;
+ }
+
+
+ bool dialog_modeless::create(unsigned p_id,HWND p_parent,HINSTANCE p_instance) {
+ assert(!m_is_in_create);
+ if (m_is_in_create) return false;
+ pfc::vartoggle_t<bool> scope(m_is_in_create,true);
+ if (CreateDialogParam(p_instance,MAKEINTRESOURCE(p_id),p_parent,DlgProc,reinterpret_cast<LPARAM>(this)) == 0) return false;
+ return m_wnd != 0;
+ }
+
+ dialog_modeless::~dialog_modeless() {
+ assert(!m_is_in_create);
+ switch(m_destructor_status)
+ {
+ case destructor_none:
+ m_destructor_status = destructor_normal;
+ if (m_wnd != 0)
+ {
+ DestroyWindow(m_wnd);
+ m_wnd = 0;
+ }
+ break;
+ case destructor_fromwindow:
+ if (m_wnd != 0) SetWindowLongPtr(m_wnd,DWLP_USER,0);
+ break;
+ default:
+ //should never trigger
+ pfc::crash();
+ break;
+ }
+ }
+
+ void dialog_modeless::on_window_destruction()
+ {
+ if (m_is_in_create)
+ {
+ m_wnd = 0;
+ }
+ else
+ switch(m_destructor_status)
+ {
+ case destructor_none:
+ m_destructor_status = destructor_fromwindow;
+ delete this;
+ break;
+ case destructor_fromwindow:
+ pfc::crash();
+ break;
+ default:
+ break;
+ }
+ }
+
+ BOOL dialog_modeless::on_message_wrap(UINT msg,WPARAM wp,LPARAM lp)
+ {
+ if (m_destructor_status == destructor_none)
+ return on_message(msg,wp,lp);
+ else
+ return FALSE;
+ }
+
+ INT_PTR CALLBACK dialog_modeless::DlgProc(HWND wnd,UINT msg,WPARAM wp,LPARAM lp)
+ {
+ dialog_modeless * thisptr;
+ BOOL rv;
+ if (msg == WM_INITDIALOG)
+ {
+ thisptr = reinterpret_cast<dialog_modeless*>(lp);
+ thisptr->m_wnd = wnd;
+ SetWindowLongPtr(wnd,DWLP_USER,lp);
+ modeless_dialog_manager::g_add(wnd);
+ }
+ else thisptr = reinterpret_cast<dialog_modeless*>(GetWindowLongPtr(wnd,DWLP_USER));
+
+ rv = thisptr ? thisptr->on_message_wrap(msg,wp,lp) : FALSE;
+
+ if (msg == WM_DESTROY)
+ modeless_dialog_manager::g_remove(wnd);
+
+ if (msg == WM_DESTROY && thisptr != 0)
+ thisptr->on_window_destruction();
+
+ return rv;
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ dialog_modeless_v2::dialog_modeless_v2(unsigned p_id,HWND p_parent,HINSTANCE p_instance,bool p_stealfocus) : m_wnd(0), m_status(status_construction), m_stealfocus(p_stealfocus)
+ {
+ WIN32_OP( CreateDialogParam(p_instance,MAKEINTRESOURCE(p_id),p_parent,DlgProc,reinterpret_cast<LPARAM>(this)) != NULL );
+ m_status = status_lifetime;
+ }
+
+ dialog_modeless_v2::~dialog_modeless_v2()
+ {
+ bool is_window_being_destroyed = (m_status == status_destruction_requested);
+ m_status = status_destruction;
+
+ if (m_wnd != 0)
+ {
+ if (is_window_being_destroyed)
+ detach_window();
+ else
+ DestroyWindow(m_wnd);
+ }
+ }
+
+ INT_PTR CALLBACK dialog_modeless_v2::DlgProc(HWND wnd,UINT msg,WPARAM wp,LPARAM lp)
+ {
+ dialog_modeless_v2 * thisptr;
+ BOOL rv = FALSE;
+ if (msg == WM_INITDIALOG)
+ {
+ thisptr = reinterpret_cast<dialog_modeless_v2*>(lp);
+ assert(thisptr->m_status == status_construction);
+ thisptr->m_wnd = wnd;
+ SetWindowLongPtr(wnd,DWLP_USER,lp);
+ if (GetWindowLongPtr(wnd,GWL_STYLE) & WS_POPUP) {
+ modeless_dialog_manager::g_add(wnd);
+ }
+ }
+ else thisptr = reinterpret_cast<dialog_modeless_v2*>(GetWindowLongPtr(wnd,DWLP_USER));
+
+ if (thisptr != NULL) rv = thisptr->on_message_internal(msg,wp,lp);
+
+ if (msg == WM_DESTROY)
+ {
+ modeless_dialog_manager::g_remove(wnd);
+ }
+
+ return rv;
+ }
+
+
+ void dialog_modeless_v2::detach_window()
+ {
+ if (m_wnd != 0)
+ {
+ SetWindowLongPtr(m_wnd,DWLP_USER,0);
+ m_wnd = 0;
+ }
+ }
+
+
+ BOOL dialog_modeless_v2::on_message_internal(UINT msg,WPARAM wp,LPARAM lp)
+ {
+ if (m_status == status_lifetime || m_status == status_destruction_requested)
+ {
+ if (msg == WM_DESTROY)
+ {
+ assert(m_status == status_lifetime);
+ m_status = status_destruction_requested;
+ delete this;
+ return TRUE;
+ }
+ else
+ return on_message(msg,wp,lp);
+ }
+ else if (m_status == status_construction)
+ {
+ if (msg == WM_INITDIALOG) return m_stealfocus ? TRUE : FALSE;
+ else return FALSE;
+ }
+ else return FALSE;
+ }
+}
+
+HWND uCreateDialog(UINT id,HWND parent,DLGPROC proc,LPARAM param)
+{
+ return CreateDialogParam(core_api::get_my_instance(),MAKEINTRESOURCE(id),parent,proc,param);
+}
+
+int uDialogBox(UINT id,HWND parent,DLGPROC proc,LPARAM param)
+{
+ return (int)DialogBoxParam(core_api::get_my_instance(),MAKEINTRESOURCE(id),parent,proc,param);
+}
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/win32_dialog.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/win32_dialog.h new file mode 100644 index 0000000000..6c409c1e55 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/win32_dialog.h @@ -0,0 +1,121 @@ +#ifndef _FOOBAR2000_HELPERS_WIN32_DIALOG_H_
+#define _FOOBAR2000_HELPERS_WIN32_DIALOG_H_
+
+//DEPRECATED dialog helpers - kept only for compatibility with old code - do not use in new code, use WTL instead.
+
+namespace dialog_helper
+{
+
+ class dialog
+ {
+ protected:
+
+ dialog() : wnd(0), m_is_modal(false) {}
+ ~dialog() { }
+
+ virtual BOOL on_message(UINT msg,WPARAM wp,LPARAM lp)=0;
+
+ void end_dialog(int code);
+
+ public:
+ inline HWND get_wnd() {return wnd;}
+
+ __declspec(deprecated) int run_modal(unsigned id,HWND parent);
+
+ __declspec(deprecated) HWND run_modeless(unsigned id,HWND parent);
+ private:
+ HWND wnd;
+ static INT_PTR CALLBACK DlgProc(HWND wnd,UINT msg,WPARAM wp,LPARAM lp);
+
+ bool m_is_modal;
+
+ modal_dialog_scope m_modal_scope;
+ };
+
+ //! This class is meant to be instantiated on-stack, as a local variable. Using new/delete operators instead or even making this a member of another object works, but does not make much sense because of the way this works (single run() call).
+ class dialog_modal
+ {
+ public:
+ __declspec(deprecated) int run(unsigned p_id,HWND p_parent,HINSTANCE p_instance = core_api::get_my_instance());
+ protected:
+ virtual BOOL on_message(UINT msg,WPARAM wp,LPARAM lp)=0;
+
+ inline dialog_modal() : m_wnd(0) {}
+ void end_dialog(int p_code);
+ inline HWND get_wnd() const {return m_wnd;}
+ private:
+ static INT_PTR CALLBACK DlgProc(HWND wnd,UINT msg,WPARAM wp,LPARAM lp);
+
+ HWND m_wnd;
+ modal_dialog_scope m_modal_scope;
+ };
+
+ //! This class is meant to be used with new/delete operators only. Destroying the window - outside create() / WM_INITDIALOG - will result in object calling delete this. If object is deleted directly using delete operator, WM_DESTROY handler may not be called so it should not be used (use destructor of derived class instead).
+ //! Classes derived from dialog_modeless must not be instantiated in any other way than operator new().
+ /*! Typical usage : \n
+ class mydialog : public dialog_helper::dialog_modeless {...};
+ (...)
+ bool createmydialog()
+ {
+ mydialog * instance = new mydialog;
+ if (instance == 0) return flase;
+ if (!instance->create(...)) {delete instance; return false;}
+ return true;
+ }
+
+ */
+ class dialog_modeless
+ {
+ public:
+ //! Creates the dialog window. This will call on_message with WM_INITDIALOG. To abort creation, you can call DestroyWindow() on our window; it will not delete the object but make create() return false instead. You should not delete the object from inside WM_INITDIALOG handler or anything else possibly called from create().
+ //! @returns true on success, false on failure.
+ __declspec(deprecated) bool create(unsigned p_id,HWND p_parent,HINSTANCE p_instance = core_api::get_my_instance());
+ protected:
+ //! Standard windows message handler (DialogProc-style). Use get_wnd() to retrieve our dialog window handle.
+ virtual BOOL on_message(UINT msg,WPARAM wp,LPARAM lp)=0;
+
+ inline dialog_modeless() : m_wnd(0), m_destructor_status(destructor_none), m_is_in_create(false) {}
+ inline HWND get_wnd() const {return m_wnd;}
+ virtual ~dialog_modeless();
+ private:
+ static INT_PTR CALLBACK DlgProc(HWND wnd,UINT msg,WPARAM wp,LPARAM lp);
+ void on_window_destruction();
+
+ BOOL on_message_wrap(UINT msg,WPARAM wp,LPARAM lp);
+
+ HWND m_wnd;
+ enum {destructor_none,destructor_normal,destructor_fromwindow} m_destructor_status;
+ bool m_is_in_create;
+ };
+
+
+ class dialog_modeless_v2
+ {
+ protected:
+ __declspec(deprecated) explicit dialog_modeless_v2(unsigned p_id,HWND p_parent,HINSTANCE p_instance = core_api::get_my_instance(),bool p_stealfocus = true);
+ virtual ~dialog_modeless_v2();
+ HWND get_wnd() const {return m_wnd;}
+ virtual BOOL on_message(UINT msg,WPARAM wp,LPARAM lp) {return FALSE;}
+
+ static dialog_modeless_v2 * __unsafe__instance_from_window(HWND p_wnd) {return reinterpret_cast<dialog_modeless_v2*>(GetWindowLongPtr(p_wnd,DWLP_USER));}
+ private:
+ static INT_PTR CALLBACK DlgProc(HWND wnd,UINT msg,WPARAM wp,LPARAM lp);
+ void detach_window();
+ BOOL on_message_internal(UINT msg,WPARAM wp,LPARAM lp);
+ enum {status_construction, status_lifetime, status_destruction_requested, status_destruction} m_status;
+ HWND m_wnd;
+ const bool m_stealfocus;
+
+ const dialog_modeless_v2 & operator=(const dialog_modeless_v2 &);
+ dialog_modeless_v2(const dialog_modeless_v2 &);
+ };
+
+};
+
+//! Wrapper (provided mainly for old code), simplifies parameters compared to standard CreateDialog() by using core_api::get_my_instance().
+HWND uCreateDialog(UINT id,HWND parent,DLGPROC proc,LPARAM param = 0);
+//! Wrapper (provided mainly for old code), simplifies parameters compared to standard DialogBox() by using core_api::get_my_instance().
+int uDialogBox(UINT id,HWND parent,DLGPROC proc,LPARAM param = 0);
+
+
+#endif
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/win32_misc.cpp b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/win32_misc.cpp new file mode 100644 index 0000000000..07d5034898 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/win32_misc.cpp @@ -0,0 +1,134 @@ +#include "stdafx.h"
+
+void registerclass_scope_delayed::toggle_on(UINT p_style,WNDPROC p_wndproc,int p_clsextra,int p_wndextra,HICON p_icon,HCURSOR p_cursor,HBRUSH p_background,const TCHAR * p_class_name,const TCHAR * p_menu_name) {
+ toggle_off();
+ WNDCLASS wc = {};
+ wc.style = p_style;
+ wc.lpfnWndProc = p_wndproc;
+ wc.cbClsExtra = p_clsextra;
+ wc.cbWndExtra = p_wndextra;
+ wc.hInstance = core_api::get_my_instance();
+ wc.hIcon = p_icon;
+ wc.hCursor = p_cursor;
+ wc.hbrBackground = p_background;
+ wc.lpszMenuName = p_menu_name;
+ wc.lpszClassName = p_class_name;
+ WIN32_OP( (m_class = RegisterClass(&wc)) != 0);
+}
+
+void registerclass_scope_delayed::toggle_off() {
+ if (m_class != 0) {
+ UnregisterClass((LPCTSTR)m_class,core_api::get_my_instance());
+ m_class = 0;
+ }
+}
+
+
+unsigned QueryScreenDPI() {
+ HDC dc = GetDC(0);
+ unsigned ret = GetDeviceCaps(dc,LOGPIXELSY);
+ ReleaseDC(0,dc);
+ return ret;
+}
+
+
+SIZE QueryScreenDPIEx() {
+ HDC dc = GetDC(0);
+ SIZE ret = { GetDeviceCaps(dc,LOGPIXELSY), GetDeviceCaps(dc,LOGPIXELSY) };
+ ReleaseDC(0,dc);
+ return ret;
+}
+
+
+bool IsMenuNonEmpty(HMENU menu) {
+ unsigned n,m=GetMenuItemCount(menu);
+ for(n=0;n<m;n++) {
+ if (GetSubMenu(menu,n)) return true;
+ if (!(GetMenuState(menu,n,MF_BYPOSITION)&MF_SEPARATOR)) return true;
+ }
+ return false;
+}
+
+PFC_NORETURN PFC_NOINLINE void WIN32_OP_FAIL() {
+ const DWORD code = GetLastError();
+ PFC_ASSERT( code != NO_ERROR );
+ pfc::string_fixed_t<32> debugMsg; debugMsg << "Win32 error #" << (t_uint32)code;
+ TRACK_CODE( debugMsg, throw exception_win32(code) );
+}
+
+#ifdef _DEBUG
+void WIN32_OP_D_FAIL(const wchar_t * _Message, const wchar_t *_File, unsigned _Line) {
+ const DWORD code = GetLastError();
+ pfc::array_t<wchar_t> msgFormatted; msgFormatted.set_size(pfc::strlen_t(_Message) + 64);
+ wsprintfW(msgFormatted.get_ptr(), L"%s (code: %u)", _Message, code);
+ if (IsDebuggerPresent()) {
+ OutputDebugString(TEXT("WIN32_OP_D() failure:\n"));
+ OutputDebugString(msgFormatted.get_ptr());
+ OutputDebugString(TEXT("\n"));
+ pfc::crash();
+ }
+ _wassert(msgFormatted.get_ptr(),_File,_Line);
+}
+#endif
+
+
+void GetOSVersionString(pfc::string_base & out) {
+ out.reset(); GetOSVersionStringAppend(out);
+}
+
+static bool running_under_wine(void) {
+ HMODULE module = GetModuleHandle(_T("ntdll.dll"));
+ if (!module) return false;
+ return GetProcAddress(module, "wine_server_call") != NULL;
+}
+static bool FetchWineInfoAppend(pfc::string_base & out) {
+ typedef const char *(__cdecl *t_wine_get_build_id)(void);
+ typedef void (__cdecl *t_wine_get_host_version)( const char **sysname, const char **release );
+ const HMODULE ntdll = GetModuleHandle(_T("ntdll.dll"));
+ if (ntdll == NULL) return false;
+ t_wine_get_build_id wine_get_build_id;
+ t_wine_get_host_version wine_get_host_version;
+ wine_get_build_id = (t_wine_get_build_id)GetProcAddress(ntdll, "wine_get_build_id");
+ wine_get_host_version = (t_wine_get_host_version)GetProcAddress(ntdll, "wine_get_host_version");
+ if (wine_get_build_id == NULL || wine_get_host_version == NULL) {
+ if (GetProcAddress(ntdll, "wine_server_call") != NULL) {
+ out << "wine (unknown version)";
+ return true;
+ }
+ return false;
+ }
+ const char * sysname = NULL; const char * release = NULL;
+ wine_get_host_version(&sysname, &release);
+ out << wine_get_build_id() << ", on: " << sysname << " / " << release;
+ return true;
+}
+void GetOSVersionStringAppend(pfc::string_base & out) {
+
+ if (FetchWineInfoAppend(out)) return;
+
+ OSVERSIONINFO ver = {}; ver.dwOSVersionInfoSize = sizeof(ver);
+ WIN32_OP( GetVersionEx(&ver) );
+ SYSTEM_INFO info = {};
+ GetNativeSystemInfo(&info);
+
+ out << "Windows " << (int)ver.dwMajorVersion << "." << (int)ver.dwMinorVersion << "." << (int)ver.dwBuildNumber;
+ if (ver.szCSDVersion[0] != 0) out << " " << pfc::stringcvt::string_utf8_from_os(ver.szCSDVersion, PFC_TABSIZE(ver.szCSDVersion));
+
+ switch(info.wProcessorArchitecture) {
+ case PROCESSOR_ARCHITECTURE_AMD64:
+ out << " x64"; break;
+ case PROCESSOR_ARCHITECTURE_IA64:
+ out << " IA64"; break;
+ case PROCESSOR_ARCHITECTURE_INTEL:
+ out << " x86"; break;
+ }
+}
+
+
+void SetDefaultMenuItem(HMENU p_menu,unsigned p_id) {
+ MENUITEMINFO info = {sizeof(info)};
+ info.fMask = MIIM_STATE;
+ GetMenuItemInfo(p_menu,p_id,FALSE,&info);
+ info.fState |= MFS_DEFAULT;
+ SetMenuItemInfo(p_menu,p_id,FALSE,&info);
+}
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/win32_misc.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/win32_misc.h new file mode 100644 index 0000000000..5180953586 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/win32_misc.h @@ -0,0 +1,410 @@ +PFC_NORETURN PFC_NOINLINE void WIN32_OP_FAIL();
+
+#ifdef _DEBUG
+void WIN32_OP_D_FAIL(const wchar_t * _Message, const wchar_t *_File, unsigned _Line);
+#endif
+
+//Throws an exception when (OP) evaluates to false/zero.
+#define WIN32_OP(OP) \
+ { \
+ SetLastError(NO_ERROR); \
+ if (!(OP)) WIN32_OP_FAIL(); \
+ }
+
+//WIN32_OP_D() acts like an assert specialized for win32 operations in debug build, ignores the return value / error codes in release build.
+//Use WIN32_OP_D() instead of WIN32_OP() on operations that are extremely unlikely to fail, so failure condition checks are performed in the debug build only, to avoid bloating release code with pointless error checks.
+#ifdef _DEBUG
+#define WIN32_OP_D(OP) \
+ { \
+ SetLastError(NO_ERROR); \
+ if (!(OP)) WIN32_OP_D_FAIL(PFC_WIDESTRING(#OP), PFC_WIDESTRING(__FILE__), __LINE__); \
+ }
+
+#else
+#define WIN32_OP_D(OP) (void)( (OP), 0);
+#endif
+
+
+class registerclass_scope_delayed {
+public:
+ registerclass_scope_delayed() : m_class(0) {}
+
+ bool is_registered() const {return m_class != 0;}
+ void toggle_on(UINT p_style,WNDPROC p_wndproc,int p_clsextra,int p_wndextra,HICON p_icon,HCURSOR p_cursor,HBRUSH p_background,const TCHAR * p_classname,const TCHAR * p_menuname);
+ void toggle_off();
+ ATOM get_class() const {return m_class;}
+
+ ~registerclass_scope_delayed() {toggle_off();}
+private:
+ registerclass_scope_delayed(const registerclass_scope_delayed &) {throw pfc::exception_not_implemented();}
+ const registerclass_scope_delayed & operator=(const registerclass_scope_delayed &) {throw pfc::exception_not_implemented();}
+
+ ATOM m_class;
+};
+
+
+
+template<typename t_object>
+class syncd_storage {
+private:
+ typedef syncd_storage<t_object> t_self;
+public:
+ syncd_storage() {}
+ template<typename t_source>
+ syncd_storage(const t_source & p_source) : m_object(p_source) {}
+ template<typename t_source>
+ void set(t_source const & p_in) {
+ insync(m_sync);
+ m_object = p_in;
+ }
+ template<typename t_destination>
+ void get(t_destination & p_out) const {
+ insync(m_sync);
+ p_out = m_object;
+ }
+ t_object get() const {
+ insync(m_sync);
+ return m_object;
+ }
+ template<typename t_source>
+ const t_self & operator=(t_source const & p_source) {set(p_source); return *this;}
+private:
+ mutable critical_section m_sync;
+ t_object m_object;
+};
+
+template<typename t_object>
+class syncd_storage_flagged {
+private:
+ typedef syncd_storage_flagged<t_object> t_self;
+public:
+ syncd_storage_flagged() : m_changed_flag(false) {}
+ template<typename t_source>
+ syncd_storage_flagged(const t_source & p_source) : m_changed_flag(false), m_object(p_source) {}
+ void set_changed(bool p_flag = true) {
+ insync(m_sync);
+ m_changed_flag = p_flag;
+ }
+ template<typename t_source>
+ void set(t_source const & p_in) {
+ insync(m_sync);
+ m_object = p_in;
+ m_changed_flag = true;
+ }
+ bool has_changed() const {
+ insync(m_sync);
+ return m_changed_flag;
+ }
+ t_object peek() const {insync(m_sync); return m_object;}
+ template<typename t_destination>
+ bool get_if_changed(t_destination & p_out) {
+ insync(m_sync);
+ if (m_changed_flag) {
+ p_out = m_object;
+ m_changed_flag = false;
+ return true;
+ } else {
+ return false;
+ }
+ }
+ t_object get() {
+ insync(m_sync);
+ m_changed_flag = false;
+ return m_object;
+ }
+ template<typename t_destination>
+ void get(t_destination & p_out) {
+ insync(m_sync);
+ p_out = m_object;
+ m_changed_flag = false;
+ }
+ template<typename t_source>
+ const t_self & operator=(t_source const & p_source) {set(p_source); return *this;}
+private:
+ bool m_changed_flag;
+ mutable critical_section m_sync;
+ t_object m_object;
+};
+
+typedef CGlobalLockScope CGlobalLock;//for compatibility, implementation moved elsewhere
+
+static bool SetClipboardDataBlock(UINT p_format,const void * p_block,t_size p_block_size) {
+ bool success = false;
+ if (OpenClipboard(NULL)) {
+ EmptyClipboard();
+ HANDLE handle = GlobalAlloc(GMEM_MOVEABLE,p_block_size);
+ if (handle == NULL) {
+ CloseClipboard();
+ throw std::bad_alloc();
+ }
+ {CGlobalLock lock(handle);memcpy(lock.GetPtr(),p_block,p_block_size);}
+ if (SetClipboardData(p_format,handle) == NULL) {
+ GlobalFree(handle);//todo?
+ } else {
+ success = true;
+ }
+ CloseClipboard();
+ }
+ return success;
+}
+
+template<typename t_array>
+static bool SetClipboardDataBlock(UINT p_format,const t_array & p_array) {
+ PFC_STATIC_ASSERT( sizeof(p_array[0]) == 1 );
+ return SetClipboardDataBlock(p_format,p_array.get_ptr(),p_array.get_size());
+}
+
+template<typename t_array>
+static bool GetClipboardDataBlock(UINT p_format,t_array & p_array) {
+ PFC_STATIC_ASSERT( sizeof(p_array[0]) == 1 );
+ if (OpenClipboard(NULL)) {
+ HANDLE handle = GetClipboardData(p_format);
+ if (handle == NULL) {
+ CloseClipboard();
+ return false;
+ }
+ {
+ CGlobalLock lock(handle);
+ const t_size size = lock.GetSize();
+ try {
+ p_array.set_size(size);
+ } catch(...) {
+ CloseClipboard();
+ throw;
+ }
+ memcpy(p_array.get_ptr(),lock.GetPtr(),size);
+ }
+ CloseClipboard();
+ return true;
+ } else {
+ return false;
+ }
+}
+
+
+class OleInitializeScope {
+public:
+ OleInitializeScope() {
+ if (FAILED(OleInitialize(NULL))) throw pfc::exception("OleInitialize() failure");
+ }
+ ~OleInitializeScope() {
+ OleUninitialize();
+ }
+
+private:
+ PFC_CLASS_NOT_COPYABLE(OleInitializeScope,OleInitializeScope);
+};
+
+class CoInitializeScope {
+public:
+ CoInitializeScope() {
+ if (FAILED(CoInitialize(NULL))) throw pfc::exception("CoInitialize() failed");
+ }
+ CoInitializeScope(DWORD params) {
+ if (FAILED(CoInitializeEx(NULL, params))) throw pfc::exception("CoInitialize() failed");
+ }
+ ~CoInitializeScope() {
+ CoUninitialize();
+ }
+ PFC_CLASS_NOT_COPYABLE_EX(CoInitializeScope)
+};
+
+
+unsigned QueryScreenDPI();
+
+SIZE QueryScreenDPIEx();
+
+static WORD GetOSVersion() {
+ const DWORD ver = GetVersion();
+ return (WORD)HIBYTE(LOWORD(ver)) | ((WORD)LOBYTE(LOWORD(ver)) << 8);
+}
+
+#if _WIN32_WINNT >= 0x501
+#define WS_EX_COMPOSITED_Safe() WS_EX_COMPOSITED
+#else
+static DWORD WS_EX_COMPOSITED_Safe() {
+ return (GetOSVersion() < 0x501) ? 0 : 0x02000000L;
+}
+#endif
+
+
+static t_size GetOptimalWorkerThreadCount() throw() {
+ DWORD_PTR mask,system;
+ t_size ret = 0;
+ GetProcessAffinityMask(GetCurrentProcess(),&mask,&system);
+ for(t_size n=0;n<sizeof(mask)*8;n++) {
+ if (mask & ((DWORD_PTR)1<<n)) ret++;
+ }
+ if (ret == 0) return 1;
+ return ret;
+}
+
+//! IMPORTANT: all classes derived from CVerySimpleThread must call WaitTillThreadDone() in their destructor, to avoid object destruction during a virtual function call!
+class CVerySimpleThread {
+public:
+ CVerySimpleThread() : m_thread(INVALID_HANDLE_VALUE) {}
+ ~CVerySimpleThread() {WaitTillThreadDone();}
+ void StartThread() {
+ CloseThread();
+ HANDLE thread;
+ WIN32_OP( (thread = CreateThread(NULL,0,g_entry,reinterpret_cast<void*>(this),0,NULL) ) != NULL);
+ m_thread = thread;
+ }
+ bool IsThreadActive() const {
+ return m_thread != INVALID_HANDLE_VALUE;
+ }
+ void WaitTillThreadDone() {
+ CloseThread();
+ }
+protected:
+ virtual void ThreadProc() {}
+private:
+ void CloseThread() {
+ if (IsThreadActive()) {
+ WaitForSingleObject(m_thread,INFINITE);
+ CloseHandle(m_thread); m_thread = INVALID_HANDLE_VALUE;
+ }
+ }
+
+ static DWORD CALLBACK g_entry(void* p_instance) {
+ return reinterpret_cast<CVerySimpleThread*>(p_instance)->entry();
+ }
+ unsigned entry() {
+ try {
+ ThreadProc();
+ } catch(...) {}
+ return 0;
+ }
+ HANDLE m_thread;
+
+ PFC_CLASS_NOT_COPYABLE_EX(CVerySimpleThread)
+};
+
+//! IMPORTANT: all classes derived from CSimpleThread must call AbortThread()/WaitTillThreadDone() in their destructors, to avoid object destruction during a virtual function call!
+class CSimpleThread : private completion_notify_receiver {
+public:
+ CSimpleThread() : m_thread(INVALID_HANDLE_VALUE) {}
+ ~CSimpleThread() {AbortThread();}
+ void StartThread() {
+ AbortThread();
+ m_abort.reset();
+ m_ownNotify = create_task(0);
+ HANDLE thread;
+ WIN32_OP( (thread = CreateThread(NULL,0,g_entry,reinterpret_cast<void*>(this),0,NULL) ) != NULL);
+ m_thread = thread;
+ }
+ void AbortThread() {
+ m_abort.abort();
+ CloseThread();
+ }
+ bool IsThreadActive() const {
+ return m_thread != INVALID_HANDLE_VALUE;
+ }
+ void WaitTillThreadDone() {
+ CloseThread();
+ }
+protected:
+ virtual unsigned ThreadProc(abort_callback & p_abort) {return 0;}
+ //! Called when the thread has completed normally, with p_code equal to ThreadProc retval. Not called when AbortThread() or WaitTillThreadDone() was used to abort the thread / wait for the thread to finish.
+ virtual void ThreadDone(unsigned p_code) {};
+private:
+ void CloseThread() {
+ if (IsThreadActive()) {
+ WaitForSingleObject(m_thread,INFINITE);
+ CloseHandle(m_thread); m_thread = INVALID_HANDLE_VALUE;
+ }
+ orphan_all_tasks();
+ }
+
+ void on_task_completion(unsigned p_id,unsigned p_status) {
+ if (IsThreadActive()) {
+ CloseThread();
+ ThreadDone(p_status);
+ }
+ }
+ static DWORD CALLBACK g_entry(void* p_instance) {
+ return reinterpret_cast<CSimpleThread*>(p_instance)->entry();
+ }
+ unsigned entry() {
+ unsigned code = ~0;
+ try {
+ code = ThreadProc(m_abort);
+ } catch(...) {}
+ if (!m_abort.is_aborting()) m_ownNotify->on_completion_async(code);
+ return code;
+ }
+ abort_callback_impl m_abort;
+ HANDLE m_thread;
+ completion_notify_ptr m_ownNotify;
+
+ PFC_CLASS_NOT_COPYABLE_EX(CSimpleThread);
+};
+
+
+
+class EnableWindowScope {
+public:
+ EnableWindowScope(HWND p_window,BOOL p_state) throw() : m_window(p_window) {
+ m_oldState = IsWindowEnabled(m_window);
+ EnableWindow(m_window,p_state);
+ }
+ ~EnableWindowScope() throw() {
+ EnableWindow(m_window,m_oldState);
+ }
+
+private:
+ BOOL m_oldState;
+ HWND m_window;
+};
+
+bool IsMenuNonEmpty(HMENU menu);
+
+class SetTextColorScope {
+public:
+ SetTextColorScope(HDC dc, COLORREF col) throw() : m_dc(dc) {
+ m_oldCol = SetTextColor(dc,col);
+ }
+ ~SetTextColorScope() throw() {
+ SetTextColor(m_dc,m_oldCol);
+ }
+ PFC_CLASS_NOT_COPYABLE_EX(SetTextColorScope)
+private:
+ HDC m_dc;
+ COLORREF m_oldCol;
+};
+
+class CloseHandleScope {
+public:
+ CloseHandleScope(HANDLE handle) throw() : m_handle(handle) {}
+ ~CloseHandleScope() throw() {CloseHandle(m_handle);}
+ HANDLE Detach() throw() {return pfc::replace_t(m_handle,INVALID_HANDLE_VALUE);}
+ HANDLE Get() const throw() {return m_handle;}
+ void Close() throw() {CloseHandle(Detach());}
+ PFC_CLASS_NOT_COPYABLE_EX(CloseHandleScope)
+private:
+ HANDLE m_handle;
+};
+
+class CModelessDialogEntry {
+public:
+ inline CModelessDialogEntry() : m_wnd() {}
+ inline CModelessDialogEntry(HWND p_wnd) : m_wnd() {Set(p_wnd);}
+ inline ~CModelessDialogEntry() {Set(NULL);}
+
+ void Set(HWND p_new) {
+ static_api_ptr_t<modeless_dialog_manager> api;
+ if (m_wnd) api->remove(m_wnd);
+ m_wnd = p_new;
+ if (m_wnd) api->add(m_wnd);
+ }
+private:
+ PFC_CLASS_NOT_COPYABLE_EX(CModelessDialogEntry);
+ HWND m_wnd;
+};
+
+void GetOSVersionString(pfc::string_base & out);
+void GetOSVersionStringAppend(pfc::string_base & out);
+
+
+
+void SetDefaultMenuItem(HMENU p_menu,unsigned p_id);
\ No newline at end of file diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/window_placement_helper.cpp b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/window_placement_helper.cpp new file mode 100644 index 0000000000..9a616d9e05 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/window_placement_helper.cpp @@ -0,0 +1,206 @@ +#include "stdafx.h"
+
+static bool g_is_enabled()
+{
+ return standard_config_objects::query_remember_window_positions();
+}
+
+static BOOL CALLBACK __MonitorEnumProc(
+ HMONITOR hMonitor, // handle to display monitor
+ HDC hdcMonitor, // handle to monitor DC
+ LPRECT lprcMonitor, // monitor intersection rectangle
+ LPARAM dwData // data
+ ) {
+ RECT * clip = (RECT*)dwData;
+ RECT newclip;
+ if (UnionRect(&newclip,clip,lprcMonitor)) {
+ *clip = newclip;
+ }
+ return TRUE;
+}
+
+static bool test_rect(const RECT * rc) {
+ RECT clip = {};
+ if (EnumDisplayMonitors(NULL,NULL,__MonitorEnumProc,(LPARAM)&clip)) {
+ const LONG sanitycheck = 4;
+ const LONG cwidth = clip.right - clip.left;
+ const LONG cheight = clip.bottom - clip.top;
+
+ const LONG width = rc->right - rc->left;
+ const LONG height = rc->bottom - rc->top;
+
+ if (width > cwidth * sanitycheck || height > cheight * sanitycheck) return false;
+ }
+
+ return MonitorFromRect(rc,MONITOR_DEFAULTTONULL) != NULL;
+}
+
+
+bool cfg_window_placement::read_from_window(HWND window)
+{
+ WINDOWPLACEMENT wp = {};
+ if (g_is_enabled()) {
+ wp.length = sizeof(wp);
+ if (!GetWindowPlacement(window,&wp))
+ memset(&wp,0,sizeof(wp));
+ /*else
+ {
+ if (!IsWindowVisible(window)) wp.showCmd = SW_HIDE;
+ }*/
+ }
+ m_data = wp;
+ return m_data.length == sizeof(m_data);
+}
+
+void cfg_window_placement::on_window_creation_silent(HWND window) {
+ PFC_ASSERT(!m_windows.have_item(window));
+ m_windows.add_item(window);
+}
+bool cfg_window_placement::on_window_creation(HWND window)
+{
+ bool ret = false;
+ PFC_ASSERT(!m_windows.have_item(window));
+ m_windows.add_item(window);
+
+ if (g_is_enabled())
+ {
+ if (m_data.length==sizeof(m_data) && test_rect(&m_data.rcNormalPosition))
+ {
+ if (SetWindowPlacement(window,&m_data))
+ {
+ ret = true;
+ }
+ }
+ }
+
+ return ret;
+}
+
+
+void cfg_window_placement::on_window_destruction(HWND window)
+{
+ if (m_windows.have_item(window))
+ {
+ read_from_window(window);
+ m_windows.remove_item(window);
+ }
+}
+
+void cfg_window_placement::get_data_raw(stream_writer * p_stream,abort_callback & p_abort) {
+ if (g_is_enabled()) {
+ {
+ t_size n, m = m_windows.get_count();
+ for(n=0;n<m;n++) {
+ HWND window = m_windows[n];
+ PFC_ASSERT(IsWindow(window));
+ if (IsWindow(window) && read_from_window(window)) break;
+ }
+ }
+
+ if (m_data.length == sizeof(m_data)) {
+ p_stream->write_object(&m_data,sizeof(m_data),p_abort);
+ }
+ }
+}
+
+void cfg_window_placement::set_data_raw(stream_reader * p_stream,t_size p_sizehint,abort_callback & p_abort) {
+ if (p_sizehint == 0) return;
+ WINDOWPLACEMENT temp;
+ try {
+ p_stream->read_object(&temp,sizeof(temp),p_abort);
+ } catch(exception_io_data) {return;}
+ if (temp.length == sizeof(temp)) m_data = temp;
+}
+
+
+cfg_window_placement::cfg_window_placement(const GUID & p_guid) : cfg_var(p_guid)
+{
+ memset(&m_data,0,sizeof(m_data));
+}
+
+
+cfg_window_size::cfg_window_size(const GUID & p_guid) : cfg_var(p_guid), m_width(~0), m_height(~0) {}
+
+static BOOL SetWindowSize(HWND p_wnd,unsigned p_x,unsigned p_y)
+{
+ if (p_x != ~0 && p_y != ~0)
+ return SetWindowPos(p_wnd,0,0,0,p_x,p_y,SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOZORDER);
+ else
+ return FALSE;
+}
+
+bool cfg_window_size::on_window_creation(HWND p_wnd)
+{
+ bool ret = false;
+ PFC_ASSERT(!m_windows.have_item(p_wnd));
+ m_windows.add_item(p_wnd);
+
+ if (g_is_enabled())
+ {
+ if (SetWindowSize(p_wnd,m_width,m_height)) ret = true;
+ }
+
+ return ret;
+}
+
+void cfg_window_size::on_window_destruction(HWND p_wnd)
+{
+ if (m_windows.have_item(p_wnd))
+ {
+ read_from_window(p_wnd);
+ m_windows.remove_item(p_wnd);
+ }
+}
+
+bool cfg_window_size::read_from_window(HWND p_wnd)
+{
+ if (g_is_enabled())
+ {
+ RECT r;
+ if (GetWindowRect(p_wnd,&r))
+ {
+ m_width = r.right - r.left;
+ m_height = r.bottom - r.top;
+ return true;
+ }
+ else
+ {
+ m_width = m_height = ~0;
+ return false;
+ }
+ }
+ else
+ {
+ m_width = m_height = ~0;
+ return false;
+ }
+}
+
+void cfg_window_size::get_data_raw(stream_writer * p_stream,abort_callback & p_abort) {
+ if (g_is_enabled()) {
+ {
+ t_size n, m = m_windows.get_count();
+ for(n=0;n<m;n++) {
+ HWND window = m_windows[n];
+ PFC_ASSERT(IsWindow(window));
+ if (IsWindow(window) && read_from_window(window)) break;
+ }
+ }
+
+ if (m_width != ~0 && m_height != ~0) {
+ p_stream->write_lendian_t(m_width,p_abort);
+ p_stream->write_lendian_t(m_height,p_abort);
+ }
+ }
+}
+
+void cfg_window_size::set_data_raw(stream_reader * p_stream,t_size p_sizehint,abort_callback & p_abort) {
+ if (p_sizehint == 0) return;
+ t_uint32 width,height;
+ try {
+ p_stream->read_lendian_t(width,p_abort);
+ p_stream->read_lendian_t(height,p_abort);
+ } catch(exception_io_data) {return;}
+
+ m_width = width; m_height = height;
+}
\ No newline at end of file diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/window_placement_helper.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/window_placement_helper.h new file mode 100644 index 0000000000..24cfe20dd5 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/helpers/window_placement_helper.h @@ -0,0 +1,34 @@ +#ifndef _WINDOW_PLACEMENT_HELPER_H_
+#define _WINDOW_PLACEMENT_HELPER_H_
+
+class cfg_window_placement : public cfg_var
+{
+public:
+ bool on_window_creation(HWND window);//returns true if window position has been changed, false if not
+ void on_window_creation_silent(HWND window);
+ void on_window_destruction(HWND window);
+ bool read_from_window(HWND window);
+ void get_data_raw(stream_writer * p_stream,abort_callback & p_abort);
+ void set_data_raw(stream_reader * p_stream,t_size p_sizehint,abort_callback & p_abort);
+ cfg_window_placement(const GUID & p_guid);
+private:
+ pfc::list_hybrid_t<HWND,2> m_windows;
+ WINDOWPLACEMENT m_data;
+};
+
+class cfg_window_size : public cfg_var
+{
+public:
+ bool on_window_creation(HWND window);//returns true if window position has been changed, false if not
+ void on_window_destruction(HWND window);
+ bool read_from_window(HWND window);
+ void get_data_raw(stream_writer * p_stream,abort_callback & p_abort);
+ void set_data_raw(stream_reader * p_stream,t_size p_sizehint,abort_callback & p_abort);
+ cfg_window_size(const GUID & p_guid);
+private:
+ pfc::list_hybrid_t<HWND,2> m_windows;
+ t_uint32 m_width,m_height;
+};
+
+
+#endif //_WINDOW_PLACEMENT_HELPER_H_
\ No newline at end of file diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/sdk-license.txt b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/sdk-license.txt new file mode 100644 index 0000000000..416f8e025b --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/sdk-license.txt @@ -0,0 +1,14 @@ +foobar2000 1.0 SDK
+Copyright (c) 2001-2010, Peter Pawlowski
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
+Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation or other materials provided with the distribution.
+
+Usage restrictions:
+It is illegal to use this SDK as a part of foobar2000 components that operate outside of legally documented programming interfaces (APIs), such as using window procedure hooks to modify user interface behaviors. We believe components doing so to be harmful to our userbase by introducing compatibility issues and dependencies on undocumented behaviors of our code that may change at any time without any notice or an update to the SDK which would reflect the change.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\ No newline at end of file diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/sdk-readme.css b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/sdk-readme.css new file mode 100644 index 0000000000..1020d9b491 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/sdk-readme.css @@ -0,0 +1,1291 @@ +a.interwiki { +padding-left : 16px; +} +a.iw_wp { +} +a.iw_wpde { +} +a.iw_wpmeta { +} +a.iw_doku { +} +a.iw_sb { +} +a.iw_amazon { +} +a.iw_amazon_de { +} +a.iw_amazon_uk { +} +a.iw_phpfn { +} +a.iw_dokubug { +} +a.iw_coral { +} +a.iw_google { +} +a.iw_meatball { +} +a.iw_wiki { +} +a.mediafile { +padding-left : 18px; +padding-bottom : 1px; +} +a.mf_jpg { +} +a.mf_jpeg { +} +a.mf_gif { +} +a.mf_png { +} +a.mf_tgz { +} +a.mf_tar { +} +a.mf_gz { +} +a.mf_zip { +} +a.mf_rar { +} +a.mf_pdf { +} +a.mf_ps { +} +a.mf_doc { +} +a.mf_xls { +} +a.mf_ppt { +} +a.mf_rtf { +} +a.mf_swf { +} +a.mf_rpm { +} +a.mf_deb { +} +a.mf_sxw { +} +a.mf_sxc { +} +a.mf_sxi { +} +a.mf_sxd { +} +a.mf_odc { +} +a.mf_odf { +} +a.mf_odg { +} +a.mf_odi { +} +a.mf_odp { +} +a.mf_ods { +} +a.mf_odt { +} +div.clearer { +clear : both; +line-height : 0; +height : 0; +overflow : hidden; +} +div.no { +display : inline; +margin : 0; +padding : 0; +} +.hidden { +display : none; +} +div.error { +background : #fcc; +color : #000; +border-bottom : 1px solid #faa; +font-size : 90%; +margin : 0; +padding-left : 3em; +overflow : hidden; +} +div.info { +background : #ccf; +color : #000; +border-bottom : 1px solid #aaf; +font-size : 90%; +margin : 0; +padding-left : 3em; +overflow : hidden; +} +div.success { +background : #cfc; +color : #000; +border-bottom : 1px solid #afa; +font-size : 90%; +margin : 0; +padding-left : 3em; +overflow : hidden; +} +div.notify { +background : #ffc; +color : #000; +border-bottom : 1px solid #ffa; +font-size : 90%; +margin : 0; +padding-left : 3em; +overflow : hidden; +} +.medialeft { +float : left; +} +.mediaright { +float : right; +} +.mediacenter { +display : block; +margin-left : auto; +margin-right : auto; +} +.leftalign { +text-align : left; +} +.centeralign { +text-align : center; +} +.rightalign { +text-align : right; +} +em.u { +font-style : normal; +text-decoration : underline; +} +em em.u { +font-style : italic; +} +.code .br0 { +color : #6c6; +} +.code .co1 { +color : #808080; +font-style : italic; +} +.code .co2 { +color : #808080; +font-style : italic; +} +.code .co3 { +color : #808080; +} +.code .coMULTI { +color : #808080; +font-style : italic; +} +.code .es0 { +color : #009; +font-weight : bold; +} +.code .kw1 { +color : #b1b100; +} +.code .kw2 { +color : #000; +font-weight : bold; +} +.code .kw3 { +color : #006; +} +.code .kw4 { +color : #933; +} +.code .kw5 { +color : #00f; +} +.code .me1 { +color : #060; +} +.code .me2 { +color : #060; +} +.code .nu0 { +color : #c6c; +} +.code .re0 { +color : #00f; +} +.code .re1 { +color : #00f; +} +.code .re2 { +color : #00f; +} +.code .re3 { +color : #f33; +font-weight : bold; +} +.code .re4 { +color : #099; +} +.code .st0 { +color : #f00; +} +.code .sy0 { +color : #6c6; +} +#acl__manager label { +text-align : left; +font-weight : normal; +display : inline; +} +#acl__manager table { +margin-left : 10%; +width : 80%; +} +#config__manager div.success, #config__manager div.error, #config__manager div.info { +background-position : 0.5em 0%; +padding : 0.5em; +text-align : center; +} +#config__manager fieldset { +margin : 1em; +width : auto; +margin-bottom : 2em; +background-color : #dee7ec; +color : #000; +padding : 0 1em; +} +#config__manager legend { +font-size : 1.25em; +} +#config__manager table { +margin : 1em 0; +width : 100%; +} +#config__manager fieldset td { +text-align : left; +} +#config__manager fieldset td.value { +width : 30em; +} +#config__manager td input.edit { +width : 30em; +} +#config__manager td textarea.edit { +width : 27.5em; +height : 4em; +} +#config__manager tr .input, #config__manager tr input, #config__manager tr textarea, #config__manager tr select { +background-color : #fff; +color : #000; +} +#config__manager tr.default .input, #config__manager tr.default input, #config__manager tr.default textarea, #config__manager tr.default select, #config__manager .selectiondefault { +background-color : #cdf; +color : #000; +} +#config__manager tr.protected .input, #config__manager tr.protected input, #config__manager tr.protected textarea, #config__manager tr.protected select, #config__manager tr.protected .selection { +background-color : #fcc !important ; +color : #000 !important ; +} +#config__manager td.error { +background-color : red; +color : #000; +} +#config__manager .selection { +width : 14.8em; +float : left; +margin : 0 0.3em 2px 0; +} +#config__manager .selection label { +float : right; +width : 14em; +font-size : 90%; +} +* html #config__manager .selection label { +padding-top : 2px; +} +#config__manager .selection input.checkbox { +padding-left : 0.7em; +} +#config__manager .other { +clear : both; +padding-top : 0.5em; +} +#config__manager .other label { +padding-left : 2px; +font-size : 90%; +} +#plugin__manager h2 { +margin-left : 0; +} +#plugin__manager form { +display : block; +margin : 0; +padding : 0; +} +#plugin__manager legend { +display : none; +} +#plugin__manager fieldset { +width : auto; +} +#plugin__manager .button { +margin : 0; +} +#plugin__manager p, #plugin__manager label { +text-align : left; +} +#plugin__manager .hidden { +display : none; +} +#plugin__manager .new { +background : #dee7ec; +} +#plugin__manager input[disabled] { +color : #ccc; +border-color : #ccc; +} +#plugin__manager .pm_menu, #plugin__manager .pm_info { +margin-left : 0; +text-align : left; +} +#plugin__manager .pm_menu { +float : left; +width : 48%; +} +#plugin__manager .pm_info { +float : right; +width : 50%; +} +#plugin__manager .common fieldset { +margin : 0; +padding : 0 0 1em 0; +text-align : left; +border : none; +} +#plugin__manager .common label { +padding : 0 0 0.5em 0; +} +#plugin__manager .common input.edit { +width : 24em; +margin : 0.5em; +} +#plugin__manager .plugins fieldset { +color : #000; +background : #fff; +text-align : right; +border-top : none; +border-right : none; +border-left : none; +} +#plugin__manager .plugins fieldset.protected { +background : #fdd; +color : #000; +} +#plugin__manager .plugins fieldset.disabled { +background : #e0e0e0; +color : #a8a8a8; +} +#plugin__manager .plugins .legend { +color : #000; +background : inherit; +display : block; +margin : 0; +padding : 0; +font-size : 1em; +line-height : 1.4em; +font-weight : normal; +text-align : left; +float : left; +padding : 0; +clear : none; +} +#plugin__manager .plugins .button { +font-size : 95%; +} +#plugin__manager .plugins fieldset.buttons { +border : none; +} +#plugin__manager .plugins fieldset.buttons .button { +float : left; +} +#plugin__manager .pm_info h3 { +margin-left : 0; +} +#plugin__manager .pm_info dl { +margin : 1em 0; +padding : 0; +} +#plugin__manager .pm_info dt { +width : 6em; +float : left; +clear : left; +margin : 0; +padding : 0; +} +#plugin__manager .pm_info dd { +margin : 0 0 0 7em; +padding : 0; +background : none; +} +#plugin__manager .plugins .enable { +float : left; +width : auto; +margin-right : 0.5em; +} +#user__manager tr.disabled { +color : #6f6f6f; +background : #e4e4e4; +} +#user__manager tr.user_info { +vertical-align : top; +} +#user__manager div.edit_user { +width : 46%; +float : left; +} +#user__manager table { +margin-bottom : 1em; +} +#user__manager input.button[disabled] { +color : #ccc !important ; +border-color : #ccc !important ; +} +div.dokuwiki .header { +padding : 3px 0 0 2px; +} +div.dokuwiki .pagename { +float : left; +font-size : 200%; +font-weight : bolder; +color : #dee7ec; +text-align : left; +vertical-align : middle; +} +div.dokuwiki .pagename a { +color : #436976 !important ; +text-decoration : none !important ; +} +div.dokuwiki .logo { +float : right; +font-size : 220%; +font-weight : bolder; +text-align : right; +vertical-align : middle; +} +div.dokuwiki .logo a { +color : #dee7ec !important ; +text-decoration : none !important ; +font-variant : small-caps; +letter-spacing : 2pt; +} +div.dokuwiki .bar { +border-top : 1px solid #8cacbb; +border-bottom : 1px solid #8cacbb; +background : #dee7ec; +padding : 0.1em 0.15em; +clear : both; +} +div.dokuwiki .bar-left { +float : left; +} +div.dokuwiki .bar-right { +float : right; +text-align : right; +} +div.dokuwiki #bar__bottom { +margin-bottom : 3px; +} +div.dokuwiki div.meta { +clear : both; +margin-top : 1em; +color : #638c9c; +font-size : 70%; +} +div.dokuwiki div.meta div.user { +float : left; +} +div.dokuwiki div.meta div.doc { +text-align : right; +} +* { +padding : 0; +margin : 0; +} +body { +font : 80% "Lucida Grande", Verdana, Lucida, Helvetica, Arial, sans-serif; +background-color : #fff; +color : #000; +} +div.dokuwiki div.page { +margin : 4px 2em 0 1em; +text-align : justify; +} +div.dokuwiki table { +font-size : 100%; +} +div.dokuwiki img { +border : 0; +} +div.dokuwiki p, div.dokuwiki blockquote, div.dokuwiki table, div.dokuwiki pre { +margin : 0 0 1em 0; +} +div.dokuwiki hr { +border : 0; +border-top : 1px solid #8cacbb; +text-align : center; +height : 0; +} +div.dokuwiki div.nothing { +text-align : center; +margin : 2em; +} +div.dokuwiki form { +border : none; +display : inline; +} +div.dokuwiki label.block { +display : block; +text-align : right; +font-weight : bold; +} +div.dokuwiki label.simple { +display : block; +text-align : left; +font-weight : normal; +} +div.dokuwiki label.block input.edit { +width : 50%; +} +div.dokuwiki fieldset { +width : 300px; +text-align : center; +border : 1px solid #8cacbb; +padding : 0.5em; +margin : auto; +} +div.dokuwiki textarea.edit { +font-family : monospace; +font-size : 14px; +color : #000; +background-color : #fff; +border : 1px solid #8cacbb; +padding : 0.3em 0 0 0.3em; +width : 100%; +} +html > body div.dokuwiki textarea.edit { +background : #fff; +} +div.dokuwiki input.edit, div.dokuwiki select.edit { +font-size : 100%; +border : 1px solid #8cacbb; +color : #000; +background-color : #fff; +vertical-align : middle; +margin : 1px; +padding : 0.2em 0.3em; +display : inline; +} +html > body div.dokuwiki input.edit, html > body div.dokuwiki select.edit { +background : #fff; +} +div.dokuwiki select.edit { +padding : 0.1em 0; +} +div.dokuwiki input.missing { +font-size : 100%; +border : 1px solid #8cacbb; +color : #000; +background-color : #fcc; +vertical-align : middle; +margin : 1px; +padding : 0.2em 0.3em; +display : inline; +} +div.dokuwiki textarea.edit[disabled], div.dokuwiki textarea.edit[readonly], div.dokuwiki input.edit[disabled], div.dokuwiki input.edit[readonly], div.dokuwiki select.edit[disabled] { +background-color : #f5f5f5 !important ; +color : #666 !important ; +} +div.dokuwiki div.toolbar, div.dokuwiki div#wiki__editbar { +margin : 2px 0; +text-align : left; +} +div.dokuwiki div#size__ctl { +float : right; +width : 60px; +height : 2.7em; +} +div.dokuwiki #size__ctl img { +cursor : pointer; +} +div.dokuwiki div#wiki__editbar div.editButtons { +float : left; +padding : 0 1em 0.7em 0; +} +div.dokuwiki div#wiki__editbar div.summary { +float : left; +} +div.dokuwiki .nowrap { +white-space : nowrap; +} +div.dokuwiki div#draft__status { +float : right; +color : #638c9c; +} +div.dokuwiki input.button, div.dokuwiki button.button { +border : 1px solid #8cacbb; +color : #000; +background-color : #fff; +vertical-align : middle; +text-decoration : none; +font-size : 100%; +cursor : pointer; +margin : 1px; +padding : 0.125em 0.4em; +} +html > body div.dokuwiki input.button, html > body div.dokuwiki button.button { +background : #fff; +} +* html div.dokuwiki input.button, * html div.dokuwiki button.button { +height : 1.8em; +} +div.dokuwiki div.secedit input.button { +border : 1px solid #8cacbb; +color : #000; +background-color : #fff; +vertical-align : middle; +text-decoration : none; +margin : 0; +padding : 0; +font-size : 10px; +cursor : pointer; +float : right; +display : inline; +} +div.dokuwiki div.pagenav { +margin : 1em 0 0 0; +} +div.dokuwiki div.pagenav-prev { +text-align : right; +float : left; +width : 49%; +} +div.dokuwiki div.pagenav-next { +text-align : left; +float : right; +width : 49%; +} +div.dokuwiki a:link, div.dokuwiki a:visited { +color : #436976; +text-decoration : none; +} +div.dokuwiki a:hover, div.dokuwiki a:active { +color : #000; +text-decoration : underline; +} +div.dokuwiki h1 a, div.dokuwiki h2 a, div.dokuwiki h3 a, div.dokuwiki h4 a, div.dokuwiki h5 a, div.dokuwiki a.nolink { +color : #000 !important ; +text-decoration : none !important ; +} +div.dokuwiki a.urlextern { +background : transparent; +padding : 1px 0 1px 16px; +} +div.dokuwiki a.windows { +background : transparent; +padding : 1px 0 1px 16px; +} +div.dokuwiki a.urlextern:link, div.dokuwiki a.windows:link, div.dokuwiki a.interwiki:link { +color : #436976; +} +div.dokuwiki a.urlextern:visited, div.dokuwiki a.windows:visited, div.dokuwiki a.interwiki:visited { +color : purple; +} +div.dokuwiki a.urlextern:hover, div.dokuwiki a.urlextern:active, div.dokuwiki a.windows:hover, div.dokuwiki a.windows:active, div.dokuwiki a.interwiki:hover, div.dokuwiki a.interwiki:active { +color : #000; +} +div.dokuwiki a.mail { +background : transparent; +padding : 1px 0 1px 16px; +} +div.dokuwiki a.wikilink1 { +color : #090 !important ; +} +div.dokuwiki a.wikilink2 { +color : #f30 !important ; +text-decoration : none !important ; +border-bottom : 1px dashed #f30 !important ; +} +div.dokuwiki div.preview { +background-color : #f5f5f5; +margin : 0 0 0 2em; +padding : 4px; +border : 1px dashed #000; +} +div.dokuwiki div.breadcrumbs { +background-color : #f5f5f5; +color : #666; +font-size : 80%; +padding : 0 0 0 4px; +} +div.dokuwiki span.user { +color : #ccc; +font-size : 90%; +} +div.dokuwiki li.minor { +color : #666; +font-style : italic; +} +div.dokuwiki img.media { +margin : 3px; +} +div.dokuwiki img.medialeft { +border : 0; +float : left; +margin : 0 1.5em 0 0; +} +div.dokuwiki img.mediaright { +border : 0; +float : right; +margin : 0 0 0 1.5em; +} +div.dokuwiki img.mediacenter { +border : 0; +display : block; +margin : 0 auto; +} +div.dokuwiki img.middle { +vertical-align : middle; +} +div.dokuwiki acronym { +cursor : help; +border-bottom : 1px dotted #000; +} +div.dokuwiki h1, div.dokuwiki h2, div.dokuwiki h3, div.dokuwiki h4, div.dokuwiki h5 { +color : #000; +background-color : inherit; +font-size : 100%; +font-weight : normal; +margin : 0 0 1em 0; +padding : 0.5em 0 0 0; +border-bottom : 1px solid #8cacbb; +clear : left; +} +div.dokuwiki h1 { +font-size : 160%; +margin-left : 0; +font-weight : bold; +} +div.dokuwiki h2 { +font-size : 150%; +margin-left : 20px; +} +div.dokuwiki h3 { +font-size : 140%; +margin-left : 40px; +border-bottom : none; +font-weight : bold; +} +div.dokuwiki h4 { +font-size : 120%; +margin-left : 60px; +border-bottom : none; +font-weight : bold; +} +div.dokuwiki h5 { +font-size : 100%; +margin-left : 80px; +border-bottom : none; +font-weight : bold; +} +div.dokuwiki div.level1 { +margin-left : 3px; +} +div.dokuwiki div.level2 { +margin-left : 23px; +} +div.dokuwiki div.level3 { +margin-left : 43px; +} +div.dokuwiki div.level4 { +margin-left : 63px; +} +div.dokuwiki div.level5 { +margin-left : 83px; +} +div.dokuwiki ul { +line-height : 1.5em; +list-style-type : square; +list-style-image : none; +margin : 0 0 0.5em 1.5em; +color : #638c9c; +} +div.dokuwiki ol { +line-height : 1.5em; +list-style-image : none; +margin : 0 0 0.5em 1.5em; +color : #638c9c; +font-weight : bold; +} +div.dokuwiki .li { +color : #000; +font-weight : normal; +} +div.dokuwiki ol { +list-style-type : decimal; +} +div.dokuwiki ol ol { +list-style-type : upper-roman; +} +div.dokuwiki ol ol ol { +list-style-type : lower-alpha; +} +div.dokuwiki ol ol ol ol { +list-style-type : lower-greek; +} +div.dokuwiki li.open { +} +div.dokuwiki li.closed { +} +div.dokuwiki blockquote { +border-left : 2px solid #8cacbb; +padding-left : 3px; +} +div.dokuwiki pre { +font-size : 120%; +padding : 0.5em; +border : 1px dashed #8cacbb; +color : #000; +overflow : auto; +} +div.dokuwiki pre.pre { +background-color : #f7f9fa; +} +div.dokuwiki pre.code { +background-color : #f7f9fa; +} +div.dokuwiki code { +font-size : 120%; +} +div.dokuwiki pre.file { +background-color : #dee7ec; +} +div.dokuwiki table.inline { +background-color : #fff; +border-spacing : 0; +border-collapse : collapse; +} +div.dokuwiki table.inline th { +padding : 3px; +border : 1px solid #8cacbb; +background-color : #dee7ec; +} +div.dokuwiki table.inline td { +padding : 3px; +border : 1px solid #8cacbb; +} +div.dokuwiki div.toc { +margin : 1.2em 0 0 2em; +float : right; +width : 200px; +font-size : 80%; +clear : both; +} +div.dokuwiki div.tocheader { +border : 1px solid #8cacbb; +background-color : #dee7ec; +text-align : left; +font-weight : bold; +padding : 3px; +margin-bottom : 2px; +} +div.dokuwiki span.toc_open, div.dokuwiki span.toc_close { +border : 0.4em solid #dee7ec; +float : right; +display : block; +margin : 0.4em 3px 0 0; +} +div.dokuwiki span.toc_open span, div.dokuwiki span.toc_close span { +display : none; +} +div.dokuwiki span.toc_open { +margin-top : 0.4em; +border-top : 0.4em solid #000; +} +div.dokuwiki span.toc_close { +margin-top : 0; +border-bottom : 0.4em solid #000; +} +div.dokuwiki #toc__inside { +border : 1px solid #8cacbb; +background-color : #fff; +text-align : left; +padding : 0.5em 0 0.7em 0; +} +div.dokuwiki ul.toc { +list-style-type : none; +list-style-image : none; +line-height : 1.2em; +padding-left : 1em; +margin : 0; +} +div.dokuwiki ul.toc li { +background : transparent; +padding-left : 0.4em; +} +div.dokuwiki ul.toc li.clear { +background-image : none; +padding-left : 0.4em; +} +div.dokuwiki a.toc:link, div.dokuwiki a.toc:visited { +color : #436976; +} +div.dokuwiki a.toc:hover, div.dokuwiki a.toc:active { +color : #000; +} +div.dokuwiki table.diff { +background-color : #fff; +width : 100%; +} +div.dokuwiki td.diff-blockheader { +font-weight : bold; +} +div.dokuwiki table.diff th { +border-bottom : 1px solid #8cacbb; +font-size : 120%; +width : 50%; +font-weight : normal; +text-align : left; +} +div.dokuwiki table.diff td { +font-family : monospace; +font-size : 100%; +} +div.dokuwiki td.diff-addedline { +background-color : #dfd; +} +div.dokuwiki td.diff-deletedline { +background-color : #ffb; +} +div.dokuwiki td.diff-context { +background-color : #f5f5f5; +} +div.dokuwiki table.diff td.diff-addedline strong, div.dokuwiki table.diff td.diff-deletedline strong { +color : red; +} +div.dokuwiki div.footnotes { +clear : both; +border-top : 1px solid #8cacbb; +padding-left : 1em; +margin-top : 1em; +} +div.dokuwiki div.fn { +font-size : 90%; +} +div.dokuwiki a.fn_top { +vertical-align : super; +font-size : 80%; +} +div.dokuwiki a.fn_bot { +vertical-align : super; +font-size : 80%; +font-weight : bold; +} +div.insitu-footnote { +font-size : 80%; +line-height : 1.2em; +border : 1px solid #8cacbb; +background-color : #f7f9fa; +text-align : left; +padding : 4px; +max-width : 40%; +} +* html .insitu-footnote pre.code, * html .insitu-footnote pre.file { +padding-bottom : 18px; +} +div.dokuwiki .search_result { +margin-bottom : 6px; +padding : 0 10px 0 30px; +} +div.dokuwiki .search_snippet { +color : #ccc; +font-size : 12px; +margin-left : 20px; +} +div.dokuwiki .search_sep { +color : #000; +} +div.dokuwiki .search_hit { +color : #000; +background-color : #ff9; +} +div.dokuwiki strong.search_hit { +font-weight : normal; +} +div.dokuwiki div.search_quickresult { +margin : 0 0 15px 30px; +padding : 0 10px 10px 0; +border-bottom : 1px dashed #8cacbb; +} +div.dokuwiki div.search_quickresult h3 { +margin : 0 0 1em 0; +font-size : 1em; +font-weight : bold; +} +div.dokuwiki ul.search_quickhits { +margin : 0 0 0.5em 1em; +} +div.dokuwiki ul.search_quickhits li { +margin : 0 1em 0 1em; +float : left; +width : 30%; +} +div.footerinc { +text-align : center; +} +.footerinc a img { +border : 0; +} +div.dokuwiki div.ajax_qsearch { +position : absolute; +right : 237px; +width : 200px; +display : none; +font-size : 80%; +line-height : 1.2em; +border : 1px solid #8cacbb; +background-color : #f7f9fa; +text-align : left; +padding : 4px; +} +button.toolbutton { +background-color : #fff; +padding : 0; +margin : 0 1px 0 0; +border : 1px solid #8cacbb; +cursor : pointer; +} +html > body button.toolbutton { +background : #fff; +} +div.picker { +width : 250px; +border : 1px solid #8cacbb; +background-color : #dee7ec; +} +button.pickerbutton { +padding : 0; +margin : 0 1px 1px 0; +border : 0; +background-color : transparent; +font-size : 80%; +cursor : pointer; +} +div.dokuwiki a.spell_error { +color : #f00; +text-decoration : underline; +} +div.dokuwiki div#spell__suggest { +background-color : #fff; +padding : 2px; +border : 1px solid #000; +font-size : 80%; +display : none; +} +div.dokuwiki div#spell__result { +border : 1px solid #8cacbb; +color : #000; +font-size : 14px; +padding : 3px; +background-color : #f7f9fa; +display : none; +} +div.dokuwiki span.spell_noerr { +color : #093; +} +div.dokuwiki span.spell_wait { +color : #06c; +} +div.dokuwiki div.img_big { +float : left; +margin-right : 0.5em; +} +div.dokuwiki dl.img_tags dt { +font-weight : bold; +background-color : #dee7ec; +} +div.dokuwiki dl.img_tags dd { +background-color : #f5f5f5; +} +div.dokuwiki div.imagemeta { +color : #666; +font-size : 70%; +line-height : 95%; +} +div.dokuwiki div.imagemeta img.thumb { +float : left; +margin-right : 0.1em; +} +#media__manager { +height : 100%; +overflow : hidden; +} +#media__left { +width : 30%; +border-right : 1px solid #8cacbb; +height : 100%; +overflow : auto; +position : absolute; +left : 0; +} +#media__right { +width : 69.7%; +height : 100%; +overflow : auto; +position : absolute; +right : 0; +} +#media__manager h1 { +margin : 0; +padding : 0; +margin-bottom : 0.5em; +} +#media__tree img { +float : left; +padding : 0.5em 0.3em 0 0; +} +#media__tree ul { +list-style-type : none; +list-style-image : none; +} +#media__tree li { +clear : left; +list-style-type : none; +list-style-image : none; +} +* html #media__tree li { +border : 1px solid #fff; +} +#media__opts { +padding-left : 1em; +margin-bottom : 0.5em; +} +#media__opts input { +float : left; +position : absolute; +} +* html #media__opts input { +position : static; +} +#media__opts label { +display : block; +float : left; +margin-left : 30px; +} +* html #media__opts label { +margin-left : 10px; +} +#media__opts br { +clear : left; +} +#media__content img.load { +margin : 1em auto; +} +#media__content #scroll__here { +border : 1px dashed #8cacbb; +} +#media__content .odd { +background-color : #f7f9fa; +padding : 0.4em; +} +#media__content .even { +padding : 0.4em; +} +#media__content a.mediafile { +margin-right : 1.5em; +font-weight : bold; +} +#media__content div.detail { +padding : 0.3em 0 0.3em 2em; +} +#media__content div.detail div.thumb { +float : left; +width : 130px; +text-align : center; +margin-right : 0.4em; +} +#media__content img.btn { +vertical-align : text-bottom; +} +#media__content div.example { +color : #666; +margin-left : 1em; +} +#media__content div.upload { +font-size : 90%; +padding : 0 0.5em 0.5em 0.5em; +} +#media__content form.upload { +display : block; +border-bottom : 1px solid #8cacbb; +padding : 0 0.5em 1em 0.5em; +} +#media__content form.upload fieldset { +padding : 0; +margin : 0; +border : none; +width : auto; +} +#media__content form.upload p { +clear : left; +text-align : left; +padding : 0.25em 0; +margin : 0; +line-height : 1em; +} +#media__content form.upload label { +float : left; +width : 30%; +} +#media__content form.upload label.check { +float : none; +width : auto; +} +#media__content form.upload input.check { +margin-left : 30%; +} +#media__content form.meta { +display : block; +padding : 0 0 1em 0; +} +#media__content form.meta label { +display : block; +width : 25%; +float : left; +font-weight : bold; +margin-left : 1em; +clear : left; +} +#media__content form.meta .edit { +font : 100% "Lucida Grande", Verdana, Lucida, Helvetica, Arial, sans-serif; +float : left; +width : 70%; +padding-right : 0; +padding-left : 0.2em; +margin : 2px; +} +#media__content form.meta textarea.edit { +height : 8em; +} +#media__content form.meta div.metafield { +clear : left; +} +#media__content form.meta div.buttons { +clear : left; +margin-left : 20%; +padding-left : 1em; +}
\ No newline at end of file diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/sdk-readme.html b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/sdk-readme.html new file mode 100644 index 0000000000..4462088efb --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/sdk-readme.html @@ -0,0 +1,366 @@ +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
+ lang="en" dir="ltr">
+<head> + <title>foobar2000 1.0 SDK readme</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <meta name="generator" content="DokuWiki Release 2007-06-26b" /> + <link rel="stylesheet" type="text/css" href="sdk-readme.css" /> +</head> +<body> +<div class="dokuwiki export"> +<div class="toc"> +<div class="tocheader toctoggle" id="toc__header">Table of Contents</div> +<div id="toc__inside"> + +<ul class="toc"> +<li class="level1"><div class="li"><span class="li"><a href="#foobar2000_1.0_sdk_readme" class="toc">foobar2000 1.0 SDK readme</a></span></div> +<ul class="toc"> +<li class="level2"><div class="li"><span class="li"><a href="#compatibility" class="toc">Compatibility</a></span></div></li> +<li class="level2"><div class="li"><span class="li"><a href="#basic_usage" class="toc">Basic usage</a></span></div></li> +<li class="level2"><div class="li"><span class="li"><a href="#structure_of_a_component" class="toc">Structure of a component</a></span></div> +<ul class="toc"> +<li class="level3"><div class="li"><span class="li"><a href="#services" class="toc">Services</a></span></div></li> +<li class="level3"><div class="li"><span class="li"><a href="#entrypoint_services" class="toc">Entrypoint services</a></span></div></li> +<li class="level3"><div class="li"><span class="li"><a href="#service_extensions" class="toc">Service extensions</a></span></div></li> +<li class="level3"><div class="li"><span class="li"><a href="#autopointer_template_use" class="toc">Autopointer template use</a></span></div></li> +<li class="level3"><div class="li"><span class="li"><a href="#exception_use" class="toc">Exception use</a></span></div></li> +<li class="level3"><div class="li"><span class="li"><a href="#storing_configuration" class="toc">Storing configuration</a></span></div></li> +<li class="level3"><div class="li"><span class="li"><a href="#use_of_global_callback_services" class="toc">Use of global callback services</a></span></div></li> +</ul> +</li> +<li class="level2"><div class="li"><span class="li"><a href="#service_class_design_guidelines_advanced" class="toc">Service class design guidelines (advanced)</a></span></div> +<ul class="toc"> +<li class="level3"><div class="li"><span class="li"><a href="#cross-dll_safety" class="toc">Cross-DLL safety</a></span></div></li> +<li class="level3"><div class="li"><span class="li"><a href="#entrypoint_service_efficiency" class="toc">Entrypoint service efficiency</a></span></div></li></ul> +</li></ul> +</li></ul> +</div> +</div> + + + +<h1><a name="foobar2000_1.0_sdk_readme" id="foobar2000_1.0_sdk_readme">foobar2000 1.0 SDK readme</a></h1> +<div class="level1"> + +</div> +<!-- SECTION "foobar2000 1.0 SDK readme" [1-42] --> +<h2><a name="compatibility" id="compatibility">Compatibility</a></h2> +<div class="level2"> + +<p> + Components built with this <acronym title="Software Development Kit">SDK</acronym> are compatible with foobar2000 1.0. They are not compatible with any earlier versions (will fail to load), and not guaranteed to be compatible with any future versions, though upcoming releases will aim to maintain compatibility as far as possible without crippling newly added functionality. +</p> + +</div> +<!-- SECTION "Compatibility" [43-394] --> +<h2><a name="basic_usage" id="basic_usage">Basic usage</a></h2> +<div class="level2"> + +<p> + Each component must link against: +</p> +<ul> +<li class="level1"><div class="li"> foobar2000_<acronym title="Software Development Kit">SDK</acronym> project (contains declarations of services and various service-specific helper code)</div> +</li> +<li class="level1"><div class="li"> foobar2000_component_client project (contains DLL entrypoint)</div> +</li> +<li class="level1"><div class="li"> shared.dll (various helper code, mainly win32 function wrappers taking UTF-8 strings)</div> +</li> +<li class="level1"><div class="li"> PFC (non-<acronym title="Operating System">OS</acronym>-specific helper class library)</div> +</li> +</ul> + +<p> +Optionally, components can use helper libraries with various non-critical code that is commonly reused across various foobar2000 components: +</p> +<ul> +<li class="level1"><div class="li"> foobar2000_<acronym title="Software Development Kit">SDK</acronym>_helpers - a library of various helper code commonly used by foobar2000 components.</div> +</li> +<li class="level1"><div class="li"> foobar2000_ATL_helpers - another library of various helper code commonly used by foobar2000 components; requires WTL. Note that it depends on foobar2000_<acronym title="Software Development Kit">SDK</acronym> and foobar2000_<acronym title="Software Development Kit">SDK</acronym>_helpers projects.</div> +</li> +</ul> + +<p> + Foobar2000_<acronym title="Software Development Kit">SDK</acronym>, foobar2000_component_client and PFC are included in sourcecode form; you can link against them by adding them to your workspace and using dependencies. To link against shared.dll, you must add “shared.lib” to linker input manually. +</p> + +<p> +Component code should include the following header files: +</p> +<ul> +<li class="level1"><div class="li"> foobar2000.h from <acronym title="Software Development Kit">SDK</acronym> - do not include other headers from the <acronym title="Software Development Kit">SDK</acronym> directory directly, they're meant to be referenced by foobar2000.h only; it also includes PFC headers and shared.dll helper declaration headers.</div> +</li> +<li class="level1"><div class="li"> Optionally: helpers.h from helpers directory (foobar2000_<acronym title="Software Development Kit">SDK</acronym>_helpers project) - a library of various helper code commonly used by foobar2000 components.</div> +</li> +<li class="level1"><div class="li"> Optionally: ATLHelpers.h from ATLHelpers directory (foobar2000_ATL_helpers project) - another library of various helper code commonly used by foobar2000 components; requires WTL. Note that ATLHelpers.h already includes <acronym title="Software Development Kit">SDK</acronym>/foobar2000.h and helpers/helpers.h so you can replace your other include lines with a reference to ATLHelpers.h.</div> +</li> +</ul> + +</div> +<!-- SECTION "Basic usage" [395-2222] --> +<h2><a name="structure_of_a_component" id="structure_of_a_component">Structure of a component</a></h2> +<div class="level2"> + +<p> + A component is a DLL that implements one or more entrypoint services and interacts with services provided by other components. +</p> + +</div> +<!-- SECTION "Structure of a component" [2223-2389] --> +<h3><a name="services" id="services">Services</a></h3> +<div class="level3"> + +<p> + A service type is an interface class, deriving directly or indirectly from <code>service_base</code> class. A service type class must not have any data members; it can only provide virtual methods (to be overridden by service implementation), helper non-virtual methods built around virtual methods, static helper methods, and constants / enums. Each service interface class must have a static <code>class_guid</code> member, used for identification when enumerating services or querying for supported functionality. A service type declaration should declare a class with public virtual/helper/static methods, and use <code>FB2K_MAKE_SERVICE_INTERFACE()</code> / <code>FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT()</code> macro to implement standard service behaviors for the class; additionally, <code>class_guid</code> needs to be defined outside class declaration (e.g. <code>const GUID someclass::class_guid = {….};</code> ). Note that most of components will not declare their own service types, they will only implement existing ones declared in the <acronym title="Software Development Kit">SDK</acronym>. +</p> + +<p> +A service implementation is a class derived from relevant service type class, implementing virtual methods declared by service type class. Note that service implementation class does not implement virtual methods declared by service_base; those are implemented by service type declaration framework (<code>service_query</code>) or by instantiation framework (<code>service_add_ref</code> / <code>service_release</code>). Service implementation classes are instantiated using <code>service_factory</code> templates in case of entrypoint services (see below), or using <code>service_impl_t</code> template and operator <code>new</code>: ”<code>myserviceptr = new service_impl_t<myservice_impl>(params);</code>”. +</p> + +<p> +Each service object provides reference counter features and (<code>service_add_ref()</code> and <code>service_release()</code> methods) as well as a method to query for extended functionality (<code>service_query()</code> method). Those methods are implemented by service framework and should be never overridden by service implementations. These methods should also never be called directly - reference counter methods are managed by relevant autopointer templates, <code>service_query_t</code> function template should be used instead of calling <code>service_query</code> directly, to ensure type safety and correct type conversions. +</p> + +</div> +<!-- SECTION "Services" [2390-4655] --> +<h3><a name="entrypoint_services" id="entrypoint_services">Entrypoint services</a></h3> +<div class="level3"> + +<p> + An entrypoint service type is a special case of a service type that can be registered using <code>service_factory</code> templates, and then accessed from any point of service system (excluding DLL startup/shutdown code, such as code inside static object constructors/destructors). An entrypoint service type class must directly derive from <code>service_base</code>. +</p> + +<p> +Registered entrypoint services can be accessed using: +</p> +<ul> +<li class="level1"><div class="li"> For services types with variable number of implementations registered: <code>service_enum_t<T></code> template, <code>service_class_helper_t<T></code> template, etc, e.g. <pre class="code cpp">service_enum_t<someclass> e; service_ptr_t<someclass> ptr; <span class="kw1">while</span><span class="br0">(</span>e.<span class="me1">next</span><span class="br0">(</span>ptr<span class="br0">)</span><span class="br0">)</span> ptr->dosomething<span class="br0">(</span><span class="br0">)</span>;</pre></div> +</li> +<li class="level1"><div class="li"> For services types with single always-present implementation registered - such as core services like <code>playlist_manager</code> - using <code>static_api_ptr_t<T></code> template, e.g.: <pre class="code cpp">static_api_ptr_t<someclass> api; api->dosomething<span class="br0">(</span><span class="br0">)</span>; api->dosomethingelse<span class="br0">(</span><span class="br0">)</span>;</pre></div> +</li> +<li class="level1"><div class="li"> Using per-service-type defined static helper functions, e.g. <code>someclass::g_dosomething()</code> - those use relevant service enumeration methods internally.</div> +</li> +</ul> + +<p> + An entrypoint service type must use <code>FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT()</code> macro to implement standard entrypoint service behaviors, as opposed to all other service types that use <code>FB2K_MAKE_SERVICE_INTERFACE()</code> macro instead. +</p> + +<p> +You can register your own entrypoint service implementations using either <code>service_factory_t</code> or <code>service_factory_single_t</code> template - the difference between the two is that the former instantiates the class on demand, while the latter keeps a single static instance and returns references to it when requested; the latter is faster but usable only for things that have no per-instance member data to maintain. Each <code>service_factory_t</code> / <code>service_factory_single_t</code> instance should be a static variable, such as: ”<code>static service_factory_t<myclass> g_myclass_factory;</code>”. +</p> + +<p> +Certain service types require custom <code>service_factory</code> helper templates to be used instead of standard <code>service_factory_t</code> / <code>service_factory_single_t</code> templates; see documentation of specific service type for exact info about registering. +</p> + +<p> +A typical entrypoint service implementation looks like this: +</p> +<pre class="code cpp"><span class="kw2">class</span> myservice_impl : <span class="kw2">public</span> myservice <span class="br0">{</span> +<span class="kw2">public</span>: + <span class="kw4">void</span> dosomething<span class="br0">(</span><span class="br0">)</span> <span class="br0">{</span>....<span class="br0">}</span>; + <span class="kw4">void</span> dosomethingelse<span class="br0">(</span><span class="kw4">int</span> meh<span class="br0">)</span> <span class="br0">{</span>...<span class="br0">}</span>; +<span class="br0">}</span>; +<span class="kw4">static</span> service_factory_single_t<myservice_impl> g_myservice_impl_factory;</pre> +</div> +<!-- SECTION "Entrypoint services" [4656-7127] --> +<h3><a name="service_extensions" id="service_extensions">Service extensions</a></h3> +<div class="level3"> + +<p> + Additional methods can be added to any service type, by declaring a new service type class deriving from service type class you want to extend. For example: +</p> +<pre class="code cpp"><span class="kw2">class</span> myservice : <span class="kw2">public</span> service_base <span class="br0">{</span> <span class="kw2">public</span>: <span class="kw2">virtual</span> <span class="kw4">void</span> dosomething<span class="br0">(</span><span class="br0">)</span> = <span class="nu0">0</span>; FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT<span class="br0">(</span>myservice<span class="br0">)</span>; <span class="br0">}</span>; +<span class="kw2">class</span> myservice_v2 : <span class="kw2">public</span> myservice <span class="br0">{</span> <span class="kw2">public</span>: <span class="kw2">virtual</span> <span class="kw4">void</span> dosomethingelse<span class="br0">(</span><span class="br0">)</span> = <span class="nu0">0</span>; FB2K_MAKE_SERVICE_INTERFACE<span class="br0">(</span>myservice_v2, myservice<span class="br0">)</span>; <span class="br0">}</span>;</pre> +<p> + In such scenario, to query whether a myservice instance is a <code>myservice_v2</code> and to retrieve <code>myservice_v2</code> pointer, use <code>service_query</code> functionality: +</p> +<pre class="code cpp">service_ptr_t<myservice> ptr; +<span class="br0">(</span>...<span class="br0">)</span> +service_ptr_t<myservice_v2> ptr_ex; +<span class="kw1">if</span> <span class="br0">(</span>ptr->service_query_t<span class="br0">(</span>ptr_ex<span class="br0">)</span><span class="br0">)</span> <span class="br0">{</span> <span class="coMULTI">/* ptr_ex is a valid pointer to myservice_v2 interface of our myservice instance */</span> <span class="br0">(</span>...<span class="br0">)</span> <span class="br0">}</span> +<span class="kw1">else</span> <span class="br0">{</span><span class="coMULTI">/* this myservice implementation does not implement myservice_v2 */</span> <span class="br0">(</span>...<span class="br0">)</span> <span class="br0">}</span></pre> +</div> +<!-- SECTION "Service extensions" [7128-8067] --> +<h3><a name="autopointer_template_use" id="autopointer_template_use">Autopointer template use</a></h3> +<div class="level3"> + +<p> + When performing most kinds of service operations, <code>service_ptr_t<T></code> template should be used rather than working with service pointers directly; it automatically manages reference counter calls, ensuring that the service object is deleted when it is no longer referenced. Additionally, <code>static_api_ptr_t<T></code> can be used to automatically acquire/release a pointer to single-implementation entrypoint service, such as one of standard APIs like <code>playlist_manager</code>. +</p> + +</div> +<!-- SECTION "Autopointer template use" [8068-8572] --> +<h3><a name="exception_use" id="exception_use">Exception use</a></h3> +<div class="level3"> + +<p> + Most of <acronym title="Application Programming Interface">API</acronym> functions use C++ exceptions to signal failure conditions. All used exception classes must derive from <code>std::exception</code> (which <code>pfc::exception</code> is typedef'd to); this design allows various instances of code to use single <code>catch()</code> line to get human-readable description of the problem to display. +</p> + +<p> +Additionally, special subclasses of exceptions are defined for use in specific conditions, such as <code>exception_io</code> for I/O failures. As a result, you must provide an exception handler whenever you invoke any kind of I/O code that may fail, unless in specific case calling context already handles exceptions (e.g. input implementation code - any exceptions should be forwarded to calling context, since exceptions are a part of input <acronym title="Application Programming Interface">API</acronym>). +</p> + +<p> +Implementations of global callback services such as <code>playlist_callback</code>, <code>playback_callback</code> or <code>library_callback</code> must not throw unhandled exceptions; behaviors in case they do are undefined (app termination is to be expected). +</p> + +</div> +<!-- SECTION "Exception use" [8573-9590] --> +<h3><a name="storing_configuration" id="storing_configuration">Storing configuration</a></h3> +<div class="level3"> + +<p> + In order to create your entries in the configuration file, you must instantiate some objects that derive from <code>cfg_var</code> class. Those can be either predefined classes (<code>cfg_int</code>, <code>cfg_string</code>, etc) or your own classes implementing relevant methods. +</p> + +<p> +Each <code>cfg_var</code> instance has a GUID assigned, to identify its configuration file entry. The GUID is passed to its constructor (which implementations must take care of, typically by providing a constructor that takes a GUID and forwards it to <code>cfg_var</code> constructor). +</p> + +<p> +Note that <code>cfg_var</code> objects can only be instantiated statically (either directly as static objects, or as members of other static objects). Additionally, you can create configuration data objects that can be accessed by other components, by implementing <code>config_object</code> service. Some standard configuration variables can be also accessed using <code>config_object</code> interface. +</p> + +</div> +<!-- SECTION "Storing configuration" [9591-10526] --> +<h3><a name="use_of_global_callback_services" id="use_of_global_callback_services">Use of global callback services</a></h3> +<div class="level3"> + +<p> + Multiple service classes presented by the <acronym title="Software Development Kit">SDK</acronym> allow your component to receive notifications about various events: +</p> +<ul> +<li class="level1"><div class="li"> file_operation_callback - tracking file move/copy/delete operations.</div> +</li> +<li class="level1"><div class="li"> library_callback - tracking Media Library content changes.</div> +</li> +<li class="level1"><div class="li"> metadb_io_callback - tracking tag read / write operations altering cached/displayed media information.</div> +</li> +<li class="level1"><div class="li"> play_callback - tracking playback related events.</div> +</li> +<li class="level1"><div class="li"> playback_statistics_collector - collecting information about played tracks.</div> +</li> +<li class="level1"><div class="li"> playlist_callback, playlist_callback_single - tracking playlist changes (the latter tracks only active playlist changes).</div> +</li> +<li class="level1"><div class="li"> playback_queue_callback - tracking playback queue changes.</div> +</li> +<li class="level1"><div class="li"> titleformat_config_callback - tracking changes of title formatting configuration.</div> +</li> +<li class="level1"><div class="li"> ui_drop_item_callback - filtering items dropped into the UI.</div> +</li> +</ul> + +<p> +All of global callbacks operate only within main app thread, allowing easy cooperation with windows <acronym title="Graphical User Interface">GUI</acronym> - for an example, you perform playlist view window repainting directly from your playlist_callback implementation. +</p> + +</div> + +<h4><a name="global_callback_recursion_issues" id="global_callback_recursion_issues">Global callback recursion issues</a></h4> +<div class="level4"> + +<p> +There are restrictions on things that are legal to call from within global callbacks. For an example, you can't modify a playlist from inside a playlist callback, because there are other registered callbacks tracking playlist changes that haven't been notified about the change being currently processed yet. +</p> + +<p> +You must not enter modal message loops from inside global callbacks, as those allow any unrelated code (queued messages, user input, etc.) to be executed, without being aware that a global callback is being processed. Certain global <acronym title="Application Programming Interface">API</acronym> methods such as metadb_io::load_info_multi or threaded_process::run_modal enter modal loops when called. Use main_thread_callback service to avoid this problem and delay execution of problematic code. +</p> + +<p> +You should also avoid firing a cross-thread SendMessage() inside global callbacks as well as performing any operations that dispatch global callbacks when handling a message that was sent through a cross-thread SendMessage(). Doing so may result in rare unwanted recursions - SendMessage() call will block the calling thread and immediately process any incoming cross-thread SendMessage() messages. If you're handling a cross-thread SendMessage() and need to perform such operation, delay it using PostMessage() or main_thread_callback. +</p> + +</div> +<!-- SECTION "Use of global callback services" [10527-12948] --> +<h2><a name="service_class_design_guidelines_advanced" id="service_class_design_guidelines_advanced">Service class design guidelines (advanced)</a></h2> +<div class="level2"> + +<p> + This chapter describes things you should keep on your mind when designing your own service type classes. Since 99% of components will only implement existing service types rather than adding their own cross-DLL-communication protocols, you can probably skip reading this chapter. +</p> + +</div> +<!-- SECTION "Service class design guidelines (advanced)" [12949-13285] --> +<h3><a name="cross-dll_safety" id="cross-dll_safety">Cross-DLL safety</a></h3> +<div class="level3"> + +<p> + It is important that all function parameters used by virtual methods of services are cross-DLL safe (do not depend on compiler-specific or runtime-specific behaviors, so no unexpected behaviors occur when calling code is built with different compiler/runtime than callee). To achieve this, any classes passed around must be either simple objects with no structure that could possibly vary with different compilers/runtimes (i.e. make sure that any memory blocks are freed on the side that allocated them); easiest way to achieve this is to reduce all complex data objects or classes passed around to interfaces with virtual methods, with implementation details hidden from callee. For an example, use <code>pfc::string_base&</code> as parameter to a function that is meant to return variable-length strings. +</p> + +</div> +<!-- SECTION "Cross-DLL safety" [13286-14113] --> +<h3><a name="entrypoint_service_efficiency" id="entrypoint_service_efficiency">Entrypoint service efficiency</a></h3> +<div class="level3"> + +<p> + When designing an entrypoint service interface meant to have multiple different implementations, you should consider making it possible for all its implementations to use <code>service_factory_single_t</code> (i.e. no per-instance member data); by e.g. moving functionality that needs multi-instance operation to a separate service type class that is created on-demand by one of entrypoint service methods. For example: +</p> +<pre class="code cpp"><span class="kw2">class</span> myservice : <span class="kw2">public</span> service_base <span class="br0">{</span> +<span class="kw2">public</span>: + <span class="co1">//this method accesses per-instance member data of the implementation class</span> + <span class="kw2">virtual</span> <span class="kw4">void</span> workerfunction<span class="br0">(</span><span class="kw4">const</span> <span class="kw4">void</span> * p_databuffer,t_size p_buffersize<span class="br0">)</span> = <span class="nu0">0</span>; + <span class="co1">//this method is used to determine which implementation can be used to process specific data stream.</span> + <span class="kw2">virtual</span> <span class="kw4">bool</span> queryfunction<span class="br0">(</span><span class="kw4">const</span> <span class="kw4">char</span> * p_dataformat<span class="br0">)</span> = <span class="nu0">0</span>; + + FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT<span class="br0">(</span>myservice<span class="br0">)</span>; +<span class="br0">}</span>; +<span class="br0">(</span>...<span class="br0">)</span> +service_ptr_t<myservice> findservice<span class="br0">(</span><span class="kw4">const</span> <span class="kw4">char</span> * p_dataformat<span class="br0">)</span> <span class="br0">{</span> + service_enum_t<myservice> e; service_ptr_t<myservice> ptr; + <span class="co1">//BOTTLENECK, this dynamically instantiates the service for each query.</span> + <span class="kw1">while</span><span class="br0">(</span>e.<span class="me1">next</span><span class="br0">(</span>ptr<span class="br0">)</span><span class="br0">)</span> <span class="br0">{</span> + <span class="kw1">if</span> <span class="br0">(</span>ptr->queryfunction<span class="br0">(</span>p_dataformat<span class="br0">)</span><span class="br0">)</span> <span class="kw1">return</span> ptr; + <span class="br0">}</span> + throw exception_io_data<span class="br0">(</span><span class="br0">)</span>; +<span class="br0">}</span></pre> +<p> +.. should be changed to: +</p> +<pre class="code cpp"><span class="co1">//no longer an entrypoint service - use myservice::instantiate to get an instance instead.</span> +<span class="kw2">class</span> myservice_instance : <span class="kw2">public</span> service_base <span class="br0">{</span> +<span class="kw2">public</span>: + <span class="kw2">virtual</span> <span class="kw4">void</span> workerfunction<span class="br0">(</span><span class="kw4">const</span> <span class="kw4">void</span> * p_databuffer,t_size p_buffersize<span class="br0">)</span> = <span class="nu0">0</span>; + FB2K_MAKE_SERVICE_INTERFACE<span class="br0">(</span>myservice_instance,service_base<span class="br0">)</span>; +<span class="br0">}</span>; + +<span class="kw2">class</span> myservice : <span class="kw2">public</span> service_base <span class="br0">{</span> +<span class="kw2">public</span>: + <span class="co1">//this method is used to determine which implementation can be used to process specific data stream.</span> + <span class="kw2">virtual</span> <span class="kw4">bool</span> queryfunction<span class="br0">(</span><span class="kw4">const</span> <span class="kw4">char</span> * p_dataformat<span class="br0">)</span> = <span class="nu0">0</span>; + <span class="kw2">virtual</span> service_ptr_t<myservice_instance> instantiate<span class="br0">(</span><span class="br0">)</span> = <span class="nu0">0</span>; + FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT<span class="br0">(</span>myservice<span class="br0">)</span>; +<span class="br0">}</span>; + +template<typename t_myservice_instance_impl> +<span class="kw2">class</span> myservice_impl_t : <span class="kw2">public</span> myservice <span class="br0">{</span> +<span class="kw2">public</span>: + <span class="co1">//implementation of myservice_instance must provide static bool g_queryformatfunction(const char*);</span> + <span class="kw4">bool</span> queryfunction<span class="br0">(</span><span class="kw4">const</span> <span class="kw4">char</span> * p_dataformat<span class="br0">)</span> <span class="br0">{</span><span class="kw1">return</span> t_myservice_instance_impl::<span class="me2">g_queryfunction</span><span class="br0">(</span>p_dataformat<span class="br0">)</span>;<span class="br0">}</span> + service_ptr_t<myservice_instance> instantiate<span class="br0">(</span><span class="br0">)</span> <span class="br0">{</span><span class="kw1">return</span> <span class="kw3">new</span> service_impl_t<t_myservice_instance_impl><span class="br0">(</span><span class="br0">)</span>;<span class="br0">}</span> +<span class="br0">}</span>; + +template<typename t_myservice_instance_impl> <span class="kw2">class</span> myservice_factory_t : + <span class="kw2">public</span> service_factory_single_t<myservice_impl_t<t_myservice_instance_impl> > <span class="br0">{</span><span class="br0">}</span>; +<span class="co1">//usage: static myservice_factory_t<myclass> g_myclass_factory;</span> + +<span class="br0">(</span>...<span class="br0">)</span> + +service_ptr_t<myservice_instance> findservice<span class="br0">(</span><span class="kw4">const</span> <span class="kw4">char</span> * p_dataformat<span class="br0">)</span> <span class="br0">{</span> + service_enum_t<myservice> e; service_ptr_t<myservice> ptr; + <span class="co1">//no more bottleneck, enumerated service does not perform inefficient operations when requesting an instance.</span> + <span class="kw1">while</span><span class="br0">(</span>e.<span class="me1">next</span><span class="br0">(</span>ptr<span class="br0">)</span><span class="br0">)</span> <span class="br0">{</span> + <span class="co1">//"inefficient" part is used only once, with implementation that actually supports what we request.</span> + <span class="kw1">if</span> <span class="br0">(</span>ptr->queryfunction<span class="br0">(</span>p_dataformat<span class="br0">)</span><span class="br0">)</span> <span class="kw1">return</span> ptr->instantiate<span class="br0">(</span><span class="br0">)</span>; + <span class="br0">}</span> + throw exception_io_data<span class="br0">(</span><span class="br0">)</span>; +<span class="br0">}</span></pre> +</div> +<!-- SECTION "Entrypoint service efficiency" [14114-] --></div> +</body> +</html> diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/shared/audio_math.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/shared/audio_math.h new file mode 100644 index 0000000000..f58c171de5 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/shared/audio_math.h @@ -0,0 +1,78 @@ +#include <math.h>
+
+#ifdef _M_X64
+#include <xmmintrin.h>
+#include <emmintrin.h>
+#endif
+
+
+#define audio_sample_size 32
+
+#if audio_sample_size == 32
+typedef float audio_sample;
+#define audio_sample_asm dword
+#elif audio_sample_size == 64
+typedef double audio_sample;
+#define audio_sample_asm qword
+#else
+#error wrong audio_sample_size
+#endif
+
+#define audio_sample_bytes (audio_sample_size/8)
+
+namespace audio_math
+{
+ //! p_source/p_output can point to same buffer
+ void SHARED_EXPORT scale(const audio_sample * p_source,t_size p_count,audio_sample * p_output,audio_sample p_scale);
+ void SHARED_EXPORT convert_to_int16(const audio_sample * p_source,t_size p_count,t_int16 * p_output,audio_sample p_scale);
+ void SHARED_EXPORT convert_to_int32(const audio_sample * p_source,t_size p_count,t_int32 * p_output,audio_sample p_scale);
+ audio_sample SHARED_EXPORT convert_to_int16_calculate_peak(const audio_sample * p_source,t_size p_count,t_int16 * p_output,audio_sample p_scale);
+ void SHARED_EXPORT convert_from_int16(const t_int16 * p_source,t_size p_count,audio_sample * p_output,audio_sample p_scale);
+ void SHARED_EXPORT convert_from_int32(const t_int32 * p_source,t_size p_count,audio_sample * p_output,audio_sample p_scale);
+ audio_sample SHARED_EXPORT convert_to_int32_calculate_peak(const audio_sample * p_source,t_size p_count,t_int32 * p_output,audio_sample p_scale);
+ audio_sample SHARED_EXPORT calculate_peak(const audio_sample * p_source,t_size p_count);
+ void SHARED_EXPORT remove_denormals(audio_sample * p_buffer,t_size p_count);
+ void SHARED_EXPORT add_offset(audio_sample * p_buffer,audio_sample p_delta,t_size p_count);
+
+
+ inline t_uint64 time_to_samples(double p_time,t_uint32 p_sample_rate) {
+ return (t_uint64)floor((double)p_sample_rate * p_time + 0.5);
+ }
+
+ inline double samples_to_time(t_uint64 p_samples,t_uint32 p_sample_rate) {
+ PFC_ASSERT(p_sample_rate > 0);
+ return (double) p_samples / (double) p_sample_rate;
+ }
+
+
+#ifdef _M_IX86
+ inline static t_int64 rint64(audio_sample val) {
+ t_int64 rv;
+ _asm {
+ fld val;
+ fistp rv;
+ }
+ return rv;
+ }
+ inline static t_int32 rint32(audio_sample val) {
+ t_int32 rv;
+ _asm {
+ fld val;
+ fistp rv;
+ }
+ return rv;
+ }
+#elif defined(_M_X64)
+ inline static t_int64 rint64(audio_sample val) {return (t_int64)floor(val+0.5);}
+ static inline t_int32 rint32(float p_val) {
+ return (t_int32)_mm_cvtss_si32(_mm_load_ss(&p_val));
+ }
+#else
+ inline static t_int64 rint64(audio_sample val) {return (t_int64)floor(val+0.5);}
+ inline static t_int32 rint32(audio_sample val) {return (t_int32)floor(val+0.5);}
+#endif
+
+
+ inline audio_sample gain_to_scale(double p_gain) {return (audio_sample) pow(10.0,p_gain / 20.0);}
+
+}
\ No newline at end of file diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/shared/filedialogs.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/shared/filedialogs.h new file mode 100644 index 0000000000..8d2169a175 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/shared/filedialogs.h @@ -0,0 +1,7 @@ +class uGetOpenFileNameMultiResult_impl : public uGetOpenFileNameMultiResult {
+ pfc::list_t<pfc::string> m_data;
+public:
+ void AddItem(pfc::stringp param) {m_data.add_item(param);}
+ t_size get_count() const {return m_data.get_count();}
+ void get_item_ex(const char * & out,t_size n) const {out = m_data[n].ptr();}
+};
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/shared/shared.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/shared/shared.h new file mode 100644 index 0000000000..4f035b945d --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/shared/shared.h @@ -0,0 +1,861 @@ +#ifndef _SHARED_DLL__SHARED_H_
+#define _SHARED_DLL__SHARED_H_
+
+#include "../../pfc/pfc.h"
+#include <signal.h>
+
+#ifndef WIN32
+#error N/A
+#endif
+
+#ifndef STRICT
+#define STRICT
+#endif
+
+#include <windows.h>
+#include <ddeml.h>
+#include <commctrl.h>
+#include <uxtheme.h>
+#include <tmschema.h>
+
+#ifndef NOTHROW
+#ifdef _MSC_VER
+#define NOTHROW __declspec(nothrow)
+#else
+#define NOTHROW
+#endif
+#endif
+
+#define SHARED_API /*NOTHROW*/ __stdcall
+
+#ifndef SHARED_EXPORTS
+#define SHARED_EXPORT __declspec(dllimport) SHARED_API
+#else
+#define SHARED_EXPORT __declspec(dllexport) SHARED_API
+#endif
+
+extern "C" {
+
+//SHARED_EXPORT BOOL IsUnicode();
+#ifdef UNICODE
+#define IsUnicode() 1
+#else
+#define IsUnicode() 0
+#endif
+
+LRESULT SHARED_EXPORT uSendMessageText(HWND wnd,UINT msg,WPARAM wp,const char * text);
+LRESULT SHARED_EXPORT uSendDlgItemMessageText(HWND wnd,UINT id,UINT msg,WPARAM wp,const char * text);
+BOOL SHARED_EXPORT uGetWindowText(HWND wnd,pfc::string_base & out);
+BOOL SHARED_EXPORT uSetWindowText(HWND wnd,const char * p_text);
+BOOL SHARED_EXPORT uSetWindowTextEx(HWND wnd,const char * p_text,unsigned p_text_length);
+BOOL SHARED_EXPORT uGetDlgItemText(HWND wnd,UINT id,pfc::string_base & out);
+BOOL SHARED_EXPORT uSetDlgItemText(HWND wnd,UINT id,const char * p_text);
+BOOL SHARED_EXPORT uSetDlgItemTextEx(HWND wnd,UINT id,const char * p_text,unsigned p_text_length);
+BOOL SHARED_EXPORT uBrowseForFolder(HWND parent,const char * title,pfc::string_base & out);
+BOOL SHARED_EXPORT uBrowseForFolderWithFile(HWND parent,const char * title,pfc::string_base & out,const char * p_file_to_find);
+int SHARED_EXPORT uMessageBox(HWND wnd,const char * text,const char * caption,UINT type);
+void SHARED_EXPORT uOutputDebugString(const char * msg);
+BOOL SHARED_EXPORT uAppendMenu(HMENU menu,UINT flags,UINT_PTR id,const char * content);
+BOOL SHARED_EXPORT uInsertMenu(HMENU menu,UINT position,UINT flags,UINT_PTR id,const char * content);
+int SHARED_EXPORT uStringCompare(const char * elem1, const char * elem2);
+int SHARED_EXPORT uCharCompare(t_uint32 p_char1,t_uint32 p_char2);
+int SHARED_EXPORT uStringCompare_ConvertNumbers(const char * elem1,const char * elem2);
+HINSTANCE SHARED_EXPORT uLoadLibrary(const char * name);
+HANDLE SHARED_EXPORT uCreateEvent(LPSECURITY_ATTRIBUTES lpEventAttributes,BOOL bManualReset,BOOL bInitialState, const char * lpName);
+HANDLE SHARED_EXPORT GetInfiniteWaitEvent();
+DWORD SHARED_EXPORT uGetModuleFileName(HMODULE hMod,pfc::string_base & out);
+BOOL SHARED_EXPORT uSetClipboardString(const char * ptr);
+BOOL SHARED_EXPORT uGetClipboardString(pfc::string_base & out);
+BOOL SHARED_EXPORT uSetClipboardRawData(UINT format,const void * ptr,t_size size);//does not empty the clipboard
+BOOL SHARED_EXPORT uGetClassName(HWND wnd,pfc::string_base & out);
+t_size SHARED_EXPORT uCharLength(const char * src);
+BOOL SHARED_EXPORT uDragQueryFile(HDROP hDrop,UINT idx,pfc::string_base & out);
+UINT SHARED_EXPORT uDragQueryFileCount(HDROP hDrop);
+BOOL SHARED_EXPORT uGetTextExtentPoint32(HDC dc,const char * text,UINT cb,LPSIZE size);//note, cb is number of bytes, not actual unicode characters in the string (read: plain strlen() will do)
+BOOL SHARED_EXPORT uExtTextOut(HDC dc,int x,int y,UINT flags,const RECT * rect,const char * text,UINT cb,const int * lpdx);
+BOOL SHARED_EXPORT uTextOutColors(HDC dc,const char * src,UINT len,int x,int y,const RECT * clip,BOOL is_selected,DWORD default_color);
+BOOL SHARED_EXPORT uTextOutColorsTabbed(HDC dc,const char * src,UINT src_len,const RECT * item,int border,const RECT * clip,BOOL selected,DWORD default_color,BOOL use_columns);
+UINT SHARED_EXPORT uGetTextHeight(HDC dc);
+UINT SHARED_EXPORT uGetFontHeight(HFONT font);
+BOOL SHARED_EXPORT uChooseColor(DWORD * p_color,HWND parent,DWORD * p_custom_colors);
+HCURSOR SHARED_EXPORT uLoadCursor(HINSTANCE hIns,const char * name);
+HICON SHARED_EXPORT uLoadIcon(HINSTANCE hIns,const char * name);
+HMENU SHARED_EXPORT uLoadMenu(HINSTANCE hIns,const char * name);
+BOOL SHARED_EXPORT uGetEnvironmentVariable(const char * name,pfc::string_base & out);
+HMODULE SHARED_EXPORT uGetModuleHandle(const char * name);
+UINT SHARED_EXPORT uRegisterWindowMessage(const char * name);
+BOOL SHARED_EXPORT uMoveFile(const char * src,const char * dst);
+BOOL SHARED_EXPORT uDeleteFile(const char * fn);
+DWORD SHARED_EXPORT uGetFileAttributes(const char * fn);
+BOOL SHARED_EXPORT uFileExists(const char * fn);
+BOOL SHARED_EXPORT uRemoveDirectory(const char * fn);
+HANDLE SHARED_EXPORT uCreateFile(const char * p_path,DWORD p_access,DWORD p_sharemode,LPSECURITY_ATTRIBUTES p_security_attributes,DWORD p_createmode,DWORD p_flags,HANDLE p_template);
+HANDLE SHARED_EXPORT uCreateFileMapping(HANDLE hFile,LPSECURITY_ATTRIBUTES lpFileMappingAttributes,DWORD flProtect,DWORD dwMaximumSizeHigh,DWORD dwMaximumSizeLow,const char * lpName);
+BOOL SHARED_EXPORT uCreateDirectory(const char * fn,LPSECURITY_ATTRIBUTES blah);
+HANDLE SHARED_EXPORT uCreateMutex(LPSECURITY_ATTRIBUTES blah,BOOL bInitialOwner,const char * name);
+BOOL SHARED_EXPORT uGetLongPathName(const char * name,pfc::string_base & out);//may just fail to work on old windows versions, present on win98/win2k+
+BOOL SHARED_EXPORT uGetFullPathName(const char * name,pfc::string_base & out);
+BOOL SHARED_EXPORT uSearchPath(const char * path, const char * filename, const char * extension, pfc::string_base & p_out);
+BOOL SHARED_EXPORT uFixPathCaps(const char * path,pfc::string_base & p_out);
+//BOOL SHARED_EXPORT uFixPathCapsQuick(const char * path,pfc::string_base & p_out);
+void SHARED_EXPORT uGetCommandLine(pfc::string_base & out);
+BOOL SHARED_EXPORT uGetTempPath(pfc::string_base & out);
+BOOL SHARED_EXPORT uGetTempFileName(const char * path_name,const char * prefix,UINT unique,pfc::string_base & out);
+BOOL SHARED_EXPORT uGetOpenFileName(HWND parent,const char * p_ext_mask,unsigned def_ext_mask,const char * p_def_ext,const char * p_title,const char * p_directory,pfc::string_base & p_filename,BOOL b_save);
+//note: uGetOpenFileName extension mask uses | as separator, not null
+HANDLE SHARED_EXPORT uLoadImage(HINSTANCE hIns,const char * name,UINT type,int x,int y,UINT flags);
+UINT SHARED_EXPORT uRegisterClipboardFormat(const char * name);
+BOOL SHARED_EXPORT uGetClipboardFormatName(UINT format,pfc::string_base & out);
+BOOL SHARED_EXPORT uFormatSystemErrorMessage(pfc::string_base & p_out,DWORD p_code);
+
+HANDLE SHARED_EXPORT uSortStringCreate(const char * src);
+int SHARED_EXPORT uSortStringCompare(HANDLE string1,HANDLE string2);
+int SHARED_EXPORT uSortStringCompareEx(HANDLE string1,HANDLE string2,DWORD flags);//flags - see win32 CompareString
+int SHARED_EXPORT uSortPathCompare(HANDLE string1,HANDLE string2);
+void SHARED_EXPORT uSortStringFree(HANDLE string);
+
+
+int SHARED_EXPORT uCompareString(DWORD flags,const char * str1,unsigned len1,const char * str2,unsigned len2);
+
+class NOVTABLE uGetOpenFileNameMultiResult : public pfc::list_base_const_t<const char*>
+{
+public:
+ inline t_size GetCount() {return get_count();}
+ inline const char * GetFileName(t_size index) {return get_item(index);}
+ virtual ~uGetOpenFileNameMultiResult() {}
+};
+
+typedef uGetOpenFileNameMultiResult * puGetOpenFileNameMultiResult;
+
+puGetOpenFileNameMultiResult SHARED_EXPORT uGetOpenFileNameMulti(HWND parent,const char * p_ext_mask,unsigned def_ext_mask,const char * p_def_ext,const char * p_title,const char * p_directory);
+
+class NOVTABLE uFindFile
+{
+protected:
+ uFindFile() {}
+public:
+ virtual BOOL FindNext()=0;
+ virtual const char * GetFileName()=0;
+ virtual t_uint64 GetFileSize()=0;
+ virtual DWORD GetAttributes()=0;
+ virtual FILETIME GetCreationTime()=0;
+ virtual FILETIME GetLastAccessTime()=0;
+ virtual FILETIME GetLastWriteTime()=0;
+ virtual ~uFindFile() {};
+ inline bool IsDirectory() {return (GetAttributes() & FILE_ATTRIBUTE_DIRECTORY) ? true : false;}
+};
+
+typedef uFindFile * puFindFile;
+
+puFindFile SHARED_EXPORT uFindFirstFile(const char * path);
+
+HINSTANCE SHARED_EXPORT uShellExecute(HWND wnd,const char * oper,const char * file,const char * params,const char * dir,int cmd);
+HWND SHARED_EXPORT uCreateStatusWindow(LONG style,const char * text,HWND parent,UINT id);
+
+BOOL SHARED_EXPORT uShellNotifyIcon(DWORD dwMessage,HWND wnd,UINT id,UINT callbackmsg,HICON icon,const char * tip);
+BOOL SHARED_EXPORT uShellNotifyIconEx(DWORD dwMessage,HWND wnd,UINT id,UINT callbackmsg,HICON icon,const char * tip,const char * balloon_title,const char * balloon_msg);
+
+HWND SHARED_EXPORT uCreateWindowEx(DWORD dwExStyle,const char * lpClassName,const char * lpWindowName,DWORD dwStyle,int x,int y,int nWidth,int nHeight,HWND hWndParent,HMENU hMenu,HINSTANCE hInstance,LPVOID lpParam);
+
+BOOL SHARED_EXPORT uGetSystemDirectory(pfc::string_base & out);
+BOOL SHARED_EXPORT uGetWindowsDirectory(pfc::string_base & out);
+BOOL SHARED_EXPORT uSetCurrentDirectory(const char * path);
+BOOL SHARED_EXPORT uGetCurrentDirectory(pfc::string_base & out);
+BOOL SHARED_EXPORT uExpandEnvironmentStrings(const char * src,pfc::string_base & out);
+BOOL SHARED_EXPORT uGetUserName(pfc::string_base & out);
+BOOL SHARED_EXPORT uGetShortPathName(const char * src,pfc::string_base & out);
+
+HSZ SHARED_EXPORT uDdeCreateStringHandle(DWORD ins,const char * src);
+BOOL SHARED_EXPORT uDdeQueryString(DWORD ins,HSZ hsz,pfc::string_base & out);
+UINT SHARED_EXPORT uDdeInitialize(LPDWORD pidInst,PFNCALLBACK pfnCallback,DWORD afCmd,DWORD ulRes);
+BOOL SHARED_EXPORT uDdeAccessData_Text(HDDEDATA data,pfc::string_base & out);
+
+HIMAGELIST SHARED_EXPORT uImageList_LoadImage(HINSTANCE hi, const char * lpbmp, int cx, int cGrow, COLORREF crMask, UINT uType, UINT uFlags);
+
+#define uDdeFreeStringHandle DdeFreeStringHandle
+#define uDdeCmpStringHandles DdeCmpStringHandles
+#define uDdeKeepStringHandle DdeKeepStringHandle
+#define uDdeUninitialize DdeUninitialize
+#define uDdeNameService DdeNameService
+#define uDdeFreeDataHandle DdeFreeDataHandle
+
+
+typedef TVINSERTSTRUCTA uTVINSERTSTRUCT;
+
+HTREEITEM SHARED_EXPORT uTreeView_InsertItem(HWND wnd,const uTVINSERTSTRUCT * param);
+LPARAM SHARED_EXPORT uTreeView_GetUserData(HWND wnd,HTREEITEM item);
+bool SHARED_EXPORT uTreeView_GetText(HWND wnd,HTREEITEM item,pfc::string_base & out);
+
+#define uSetWindowsHookEx SetWindowsHookEx
+#define uUnhookWindowsHookEx UnhookWindowsHookEx
+#define uCallNextHookEx CallNextHookEx
+
+typedef TCITEMA uTCITEM;
+int SHARED_EXPORT uTabCtrl_InsertItem(HWND wnd,t_size idx,const uTCITEM * item);
+int SHARED_EXPORT uTabCtrl_SetItem(HWND wnd,t_size idx,const uTCITEM * item);
+
+int SHARED_EXPORT uGetKeyNameText(LONG lparam,pfc::string_base & out);
+
+void SHARED_EXPORT uFixAmpersandChars(const char * src,pfc::string_base & out);//for notification area icon
+void SHARED_EXPORT uFixAmpersandChars_v2(const char * src,pfc::string_base & out);//for other controls
+
+//deprecated
+t_size SHARED_EXPORT uPrintCrashInfo(LPEXCEPTION_POINTERS param,const char * extrainfo,char * out);
+enum {uPrintCrashInfo_max_length = 1024};
+
+void SHARED_EXPORT uPrintCrashInfo_Init(const char * name);//called only by the exe on startup
+void SHARED_EXPORT uPrintCrashInfo_SetComponentList(const char * p_info);//called only by the exe on startup
+void SHARED_EXPORT uPrintCrashInfo_AddEnvironmentInfo(const char * p_info);//called only by the exe on startup
+void SHARED_EXPORT uPrintCrashInfo_SetDumpPath(const char * name);//called only by the exe on startup
+
+void SHARED_EXPORT uDumpCrashInfo(LPEXCEPTION_POINTERS param);
+
+
+
+void SHARED_EXPORT uPrintCrashInfo_OnEvent(const char * message, t_size length);
+
+BOOL SHARED_EXPORT uListBox_GetText(HWND listbox,UINT index,pfc::string_base & out);
+
+void SHARED_EXPORT uPrintfV(pfc::string_base & out,const char * fmt,va_list arglist);
+static inline void uPrintf(pfc::string_base & out,const char * fmt,...) {va_list list;va_start(list,fmt);uPrintfV(out,fmt,list);va_end(list);}
+
+
+class NOVTABLE uResource
+{
+public:
+ virtual const void * GetPointer() = 0;
+ virtual unsigned GetSize() = 0;
+ virtual ~uResource() {}
+};
+
+typedef uResource* puResource;
+
+puResource SHARED_EXPORT uLoadResource(HMODULE hMod,const char * name,const char * type,WORD wLang = MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL) );
+puResource SHARED_EXPORT LoadResourceEx(HMODULE hMod,const TCHAR * name,const TCHAR * type,WORD wLang = MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL) );
+HRSRC SHARED_EXPORT uFindResource(HMODULE hMod,const char * name,const char * type,WORD wLang = MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL) );
+
+BOOL SHARED_EXPORT uLoadString(HINSTANCE ins,UINT id,pfc::string_base & out);
+
+UINT SHARED_EXPORT uCharLower(UINT c);
+UINT SHARED_EXPORT uCharUpper(UINT c);
+
+BOOL SHARED_EXPORT uGetMenuString(HMENU menu,UINT id,pfc::string_base & out,UINT flag);
+BOOL SHARED_EXPORT uModifyMenu(HMENU menu,UINT id,UINT flags,UINT newitem,const char * data);
+UINT SHARED_EXPORT uGetMenuItemType(HMENU menu,UINT position);
+
+
+}//extern "C"
+
+inline char * uCharNext(char * src) {return src+uCharLength(src);}
+inline const char * uCharNext(const char * src) {return src+uCharLength(src);}
+
+
+class string_utf8_from_window
+{
+public:
+ string_utf8_from_window(HWND wnd)
+ {
+ uGetWindowText(wnd,m_data);
+ }
+ string_utf8_from_window(HWND wnd,UINT id)
+ {
+ uGetDlgItemText(wnd,id,m_data);
+ }
+ inline operator const char * () const {return m_data.get_ptr();}
+ inline t_size length() const {return m_data.length();}
+ inline bool is_empty() const {return length() == 0;}
+ inline const char * get_ptr() const {return m_data.get_ptr();}
+private:
+ pfc::string8 m_data;
+};
+
+static pfc::string uGetWindowText(HWND wnd) {
+ pfc::string8 temp;
+ if (!uGetWindowText(wnd,temp)) return "";
+ return temp.toString();
+}
+static pfc::string uGetDlgItemText(HWND wnd,UINT id) {
+ pfc::string8 temp;
+ if (!uGetDlgItemText(wnd,id,temp)) return "";
+ return temp.toString();
+}
+
+#define uMAKEINTRESOURCE(x) ((const char*)LOWORD(x))
+
+#ifdef _DEBUG
+class critical_section {
+private:
+ CRITICAL_SECTION sec;
+ int count;
+public:
+ int enter() {EnterCriticalSection(&sec);return ++count;}
+ int leave() {int rv = --count;LeaveCriticalSection(&sec);return rv;}
+ int get_lock_count() {return count;}
+ int get_lock_count_check() {enter();return leave();}
+ inline void assert_locked() {assert(get_lock_count_check()>0);}
+ inline void assert_not_locked() {assert(get_lock_count_check()==0);}
+ critical_section() {InitializeCriticalSection(&sec);count=0;}
+ ~critical_section() {DeleteCriticalSection(&sec);}
+private:
+ critical_section(const critical_section&) {throw pfc::exception_not_implemented();}
+ const critical_section & operator=(const critical_section &) {throw pfc::exception_not_implemented();}
+};
+#else
+class critical_section {
+private:
+ CRITICAL_SECTION sec;
+public:
+ void enter() throw() {EnterCriticalSection(&sec);}
+ void leave() throw() {LeaveCriticalSection(&sec);}
+ critical_section() {InitializeCriticalSection(&sec);}
+ ~critical_section() {DeleteCriticalSection(&sec);}
+private:
+ critical_section(const critical_section&) {throw pfc::exception_not_implemented();}
+ const critical_section & operator=(const critical_section &) {throw pfc::exception_not_implemented();}
+};
+#endif
+class c_insync
+{
+private:
+ critical_section & m_section;
+public:
+ c_insync(critical_section * p_section) throw() : m_section(*p_section) {m_section.enter();}
+ c_insync(critical_section & p_section) throw() : m_section(p_section) {m_section.enter();}
+ ~c_insync() throw() {m_section.leave();}
+};
+
+#define insync(X) c_insync blah____sync(X)
+
+
+class critical_section2 //smarter version, has try_enter()
+{
+private:
+ HANDLE hMutex;
+ int count;
+public:
+ int enter() {return enter_timeout(INFINITE);}
+ int leave() {int rv = --count;ReleaseMutex(hMutex);return rv;}
+ int get_lock_count() {return count;}
+ int get_lock_count_check()
+ {
+ int val = try_enter();
+ if (val>0) val = leave();
+ return val;
+ }
+ int enter_timeout(DWORD t) {return WaitForSingleObject(hMutex,t)==WAIT_OBJECT_0 ? ++count : 0;}
+ int try_enter() {return enter_timeout(0);}
+ int check_count() {enter();return leave();}
+ critical_section2()
+ {
+ hMutex = uCreateMutex(0,0,0);
+ count=0;
+ }
+ ~critical_section2() {CloseHandle(hMutex);}
+
+ inline void assert_locked() {assert(get_lock_count_check()>0);}
+ inline void assert_not_locked() {assert(get_lock_count_check()==0);}
+
+};
+
+class c_insync2
+{
+private:
+ critical_section2 * ptr;
+public:
+ c_insync2(critical_section2 * p) {ptr=p;ptr->enter();}
+ c_insync2(critical_section2 & p) {ptr=&p;ptr->enter();}
+ ~c_insync2() {ptr->leave();}
+};
+
+#define insync2(X) c_insync2 blah____sync2(X)
+
+
+//other
+
+#define uIsDialogMessage IsDialogMessage
+#define uGetMessage GetMessage
+#define uPeekMessage PeekMessage
+#define uDispatchMessage DispatchMessage
+
+#define uCallWindowProc CallWindowProc
+#define uDefWindowProc DefWindowProc
+#define uGetWindowLong GetWindowLongPtr
+#define uSetWindowLong SetWindowLongPtr
+
+#define uEndDialog EndDialog
+#define uDestroyWindow DestroyWindow
+#define uGetDlgItem GetDlgItem
+#define uEnableWindow EnableWindow
+#define uGetDlgItemInt GetDlgItemInt
+#define uSetDlgItemInt SetDlgItemInt
+
+#define uSendMessage SendMessage
+#define uSendDlgItemMessage SendDlgItemMessage
+#define uSendMessageTimeout SendMessageTimeout
+#define uSendNotifyMessage SendNotifyMessage
+#define uSendMessageCallback SendMessageCallback
+#define uPostMessage PostMessage
+#define uPostThreadMessage PostThreadMessage
+
+
+class uStringPrintf
+{
+public:
+ inline explicit uStringPrintf(const char * fmt,...)
+ {
+ va_list list;
+ va_start(list,fmt);
+ uPrintfV(m_data,fmt,list);
+ va_end(list);
+ }
+ inline operator const char * () const {return m_data.get_ptr();}
+ inline t_size length() const {return m_data.length();}
+ inline bool is_empty() const {return length() == 0;}
+ inline const char * get_ptr() const {return m_data.get_ptr();}
+ const char * toString() const {return get_ptr();}
+private:
+ pfc::string8_fastalloc m_data;
+};
+#pragma deprecated(uStringPrintf, uPrintf, uPrintfV)
+
+inline LRESULT uButton_SetCheck(HWND wnd,UINT id,bool state) {return uSendDlgItemMessage(wnd,id,BM_SETCHECK,state ? BST_CHECKED : BST_UNCHECKED,0); }
+inline bool uButton_GetCheck(HWND wnd,UINT id) {return uSendDlgItemMessage(wnd,id,BM_GETCHECK,0,0) == BST_CHECKED;}
+
+class uCallStackTracker
+{
+ t_size param;
+public:
+ explicit SHARED_EXPORT uCallStackTracker(const char * name);
+ SHARED_EXPORT ~uCallStackTracker();
+};
+
+extern "C"
+{
+ LPCSTR SHARED_EXPORT uGetCallStackPath();
+}
+
+namespace pfc {
+ class formatBugCheck : public string_formatter {
+ public:
+ formatBugCheck(const char * msg) {
+ *this << msg;
+ const char * path = uGetCallStackPath();
+ if (*path) {
+ *this << " (at: " << path << ")";
+ }
+ }
+ };
+ class exception_bug_check_v2 : public exception_bug_check {
+ public:
+ exception_bug_check_v2(const char * msg = exception_bug_check::g_what()) : exception_bug_check(formatBugCheck(msg)) {
+ PFC_ASSERT(!"exception_bug_check_v2 triggered");
+ }
+ };
+}
+
+static int uExceptFilterProc_inline(LPEXCEPTION_POINTERS param) {
+ uDumpCrashInfo(param);
+ TerminateProcess(GetCurrentProcess(), 0);
+ return 0;// never reached
+}
+
+#if !defined(FOOBAR2000_TARGET_VERSION) || FOOBAR2000_TARGET_VERSION >= 76
+extern "C" {
+ LONG SHARED_EXPORT uExceptFilterProc(LPEXCEPTION_POINTERS param);
+ PFC_NORETURN void SHARED_EXPORT uBugCheck();
+}
+#else
+#define uExceptFilterProc uExceptFilterProc_inline
+#define uBugCheck() {throw pfc::exception_bug_check_v2(msg);}
+#endif
+
+#define __except_instacrash __except(uExceptFilterProc(GetExceptionInformation()))
+#define fb2k_instacrash_scope(X) __try { X; } __except_instacrash {}
+
+
+#if 1
+#define TRACK_CALL(X) uCallStackTracker TRACKER__##X(#X)
+#define TRACK_CALL_TEXT(X) uCallStackTracker TRACKER__BLAH(X)
+#define TRACK_CODE(description,code) {uCallStackTracker __call_tracker(description); code;}
+#else
+#define TRACK_CALL(X)
+#define TRACK_CALL_TEXT(X)
+#define TRACK_CODE(description,code) {code;}
+#endif
+
+extern "C" {
+int SHARED_EXPORT stricmp_utf8(const char * p1,const char * p2) throw();
+int SHARED_EXPORT stricmp_utf8_ex(const char * p1,t_size len1,const char * p2,t_size len2) throw();
+int SHARED_EXPORT stricmp_utf8_stringtoblock(const char * p1,const char * p2,t_size p2_bytes) throw();
+int SHARED_EXPORT stricmp_utf8_partial(const char * p1,const char * p2,t_size num = ~0) throw();
+int SHARED_EXPORT stricmp_utf8_max(const char * p1,const char * p2,t_size p1_bytes) throw();
+t_size SHARED_EXPORT uReplaceStringAdd(pfc::string_base & out,const char * src,t_size src_len,const char * s1,t_size len1,const char * s2,t_size len2,bool casesens);
+t_size SHARED_EXPORT uReplaceCharAdd(pfc::string_base & out,const char * src,t_size src_len,unsigned c1,unsigned c2,bool casesens);
+//all lengths in uReplaceString functions are optional, set to -1 if parameters is a simple null-terminated string
+void SHARED_EXPORT uAddStringLower(pfc::string_base & out,const char * src,t_size len = ~0);
+void SHARED_EXPORT uAddStringUpper(pfc::string_base & out,const char * src,t_size len = ~0);
+}
+
+class comparator_stricmp_utf8 {
+public:
+ static int compare(const char * p_string1,const char * p_string2) throw() {return stricmp_utf8(p_string1,p_string2);}
+};
+
+inline void uStringLower(pfc::string_base & out,const char * src,t_size len = ~0) {out.reset();uAddStringLower(out,src,len);}
+inline void uStringUpper(pfc::string_base & out,const char * src,t_size len = ~0) {out.reset();uAddStringUpper(out,src,len);}
+
+inline t_size uReplaceString(pfc::string_base & out,const char * src,t_size src_len,const char * s1,t_size len1,const char * s2,t_size len2,bool casesens)
+{
+ out.reset();
+ return uReplaceStringAdd(out,src,src_len,s1,len1,s2,len2,casesens);
+}
+
+inline t_size uReplaceChar(pfc::string_base & out,const char * src,t_size src_len,unsigned c1,unsigned c2,bool casesens)
+{
+ out.reset();
+ return uReplaceCharAdd(out,src,src_len,c1,c2,casesens);
+}
+
+class string_lower
+{
+public:
+ explicit string_lower(const char * ptr,t_size p_count = ~0) {uAddStringLower(m_data,ptr,p_count);}
+ inline operator const char * () const {return m_data.get_ptr();}
+ inline t_size length() const {return m_data.length();}
+ inline bool is_empty() const {return length() == 0;}
+ inline const char * get_ptr() const {return m_data.get_ptr();}
+private:
+ pfc::string8 m_data;
+};
+
+class string_upper
+{
+public:
+ explicit string_upper(const char * ptr,t_size p_count = ~0) {uAddStringUpper(m_data,ptr,p_count);}
+ inline operator const char * () const {return m_data.get_ptr();}
+ inline t_size length() const {return m_data.length();}
+ inline bool is_empty() const {return length() == 0;}
+ inline const char * get_ptr() const {return m_data.get_ptr();}
+private:
+ pfc::string8 m_data;
+};
+
+
+inline BOOL uGetLongPathNameEx(const char * name,pfc::string_base & out)
+{
+ if (uGetLongPathName(name,out)) return TRUE;
+ return uGetFullPathName(name,out);
+}
+
+struct t_font_description
+{
+ enum
+ {
+ m_facename_length = LF_FACESIZE*2,
+ m_height_dpi = 480,
+ };
+
+ t_uint32 m_height;
+ t_uint32 m_weight;
+ t_uint8 m_italic;
+ t_uint8 m_charset;
+ char m_facename[m_facename_length];
+
+ bool operator==(const t_font_description & other) const {return g_equals(*this, other);}
+ bool operator!=(const t_font_description & other) const {return !g_equals(*this, other);}
+
+ static bool g_equals(const t_font_description & v1, const t_font_description & v2) {
+ return v1.m_height == v2.m_height && v1.m_weight == v2.m_weight && v1.m_italic == v2.m_italic && v1.m_charset == v2.m_charset && pfc::strcmp_ex(v1.m_facename, m_facename_length, v2.m_facename, m_facename_length) == 0;
+ }
+
+ HFONT SHARED_EXPORT create() const;
+ bool SHARED_EXPORT popup_dialog(HWND p_parent);
+ void SHARED_EXPORT from_font(HFONT p_font);
+ static t_font_description SHARED_EXPORT g_from_font(HFONT p_font);
+ static t_font_description SHARED_EXPORT g_from_logfont(LOGFONT const & lf);
+ static t_font_description SHARED_EXPORT g_from_system(int id = TMT_MENUFONT);
+
+ template<typename t_stream,typename t_abort> void to_stream(t_stream p_stream,t_abort & p_abort) const;
+ template<typename t_stream,typename t_abort> void from_stream(t_stream p_stream,t_abort & p_abort);
+};
+
+/* relevant types not yet defined here */ template<typename t_stream,typename t_abort> void t_font_description::to_stream(t_stream p_stream,t_abort & p_abort) const {
+ p_stream->write_lendian_t(m_height,p_abort);
+ p_stream->write_lendian_t(m_weight,p_abort);
+ p_stream->write_lendian_t(m_italic,p_abort);
+ p_stream->write_lendian_t(m_charset,p_abort);
+ p_stream->write_string(m_facename,PFC_TABSIZE(m_facename),p_abort);
+}
+
+/* relevant types not yet defined here */ template<typename t_stream,typename t_abort> void t_font_description::from_stream(t_stream p_stream,t_abort & p_abort) {
+ p_stream->read_lendian_t(m_height,p_abort);
+ p_stream->read_lendian_t(m_weight,p_abort);
+ p_stream->read_lendian_t(m_italic,p_abort);
+ p_stream->read_lendian_t(m_charset,p_abort);
+ pfc::string8 temp;
+ p_stream->read_string(temp,p_abort);
+ strncpy_s(m_facename,temp,PFC_TABSIZE(m_facename));
+}
+
+
+struct t_modal_dialog_entry
+{
+ HWND m_wnd_to_poke;
+ bool m_in_use;
+};
+
+extern "C" {
+ void SHARED_EXPORT ModalDialog_Switch(t_modal_dialog_entry & p_entry);
+ void SHARED_EXPORT ModalDialog_PokeExisting();
+ bool SHARED_EXPORT ModalDialog_CanCreateNew();
+
+ HWND SHARED_EXPORT FindOwningPopup(HWND p_wnd);
+ void SHARED_EXPORT PokeWindow(HWND p_wnd);
+};
+
+static bool ModalDialogPrologue() {
+ bool rv = ModalDialog_CanCreateNew();
+ if (!rv) ModalDialog_PokeExisting();
+ return rv;
+}
+
+//! The purpose of modal_dialog_scope is to help to avoid the modal dialog recursion problem. Current toplevel modal dialog handle is stored globally, so when creation of a new modal dialog is blocked, it can be activated to indicate the reason for the task being blocked.
+class modal_dialog_scope {
+public:
+ //! This constructor initializes the modal dialog scope with specified dialog handle.
+ inline modal_dialog_scope(HWND p_wnd) throw() : m_initialized(false) {initialize(p_wnd);}
+ //! This constructor leaves the scope uninitialized (you can call initialize() later with your window handle).
+ inline modal_dialog_scope() throw() : m_initialized(false) {}
+ inline ~modal_dialog_scope() throw() {deinitialize();}
+
+ //! Returns whether creation of a new modal dialog is allowed (false when there's another one active).\n
+ //! NOTE: when calling context is already inside a modal dialog that you own, you should not be checking this before creating a new modal dialog.
+ inline static bool can_create() throw(){return ModalDialog_CanCreateNew();}
+ //! Activates the top-level modal dialog existing, if one exists.
+ inline static void poke_existing() throw() {ModalDialog_PokeExisting();}
+
+ //! Initializes the scope with specified window handle.
+ void initialize(HWND p_wnd) throw()
+ {
+ if (!m_initialized)
+ {
+ m_initialized = true;
+ m_entry.m_in_use = true;
+ m_entry.m_wnd_to_poke = p_wnd;
+ ModalDialog_Switch(m_entry);
+ }
+ }
+
+ void deinitialize() throw()
+ {
+ if (m_initialized)
+ {
+ ModalDialog_Switch(m_entry);
+ m_initialized = false;
+ }
+ }
+
+
+
+private:
+ modal_dialog_scope(const modal_dialog_scope & p_scope) {assert(0);}
+ const modal_dialog_scope & operator=(const modal_dialog_scope &) {assert(0); return *this;}
+
+ t_modal_dialog_entry m_entry;
+
+ bool m_initialized;
+};
+
+class LastErrorRevertScope {
+public:
+ LastErrorRevertScope() : m_val(GetLastError()) {}
+ ~LastErrorRevertScope() {SetLastError(m_val);}
+
+private:
+ const DWORD m_val;
+};
+
+class format_win32_error {
+public:
+ format_win32_error(DWORD p_code) {
+ LastErrorRevertScope revert;
+ if (p_code == 0) m_buffer = "Undefined error";
+ else if (!uFormatSystemErrorMessage(m_buffer,p_code)) m_buffer << "Unknown error code (" << (unsigned)p_code << ")";
+ }
+
+ const char * get_ptr() const {return m_buffer.get_ptr();}
+ operator const char*() const {return m_buffer.get_ptr();}
+private:
+ pfc::string8 m_buffer;
+};
+
+class format_hresult {
+public:
+ format_hresult(HRESULT p_code) {
+ if (!uFormatSystemErrorMessage(m_buffer,(DWORD)p_code)) m_buffer = "Unknown error code";
+ stamp_hex(p_code);
+ }
+ format_hresult(HRESULT p_code, const char * msgOverride) {
+ m_buffer = msgOverride;
+ stamp_hex(p_code);
+ }
+
+ const char * get_ptr() const {return m_buffer.get_ptr();}
+ operator const char*() const {return m_buffer.get_ptr();}
+private:
+ void stamp_hex(HRESULT p_code) {m_buffer << " (0x" << pfc::format_hex((t_uint32)p_code, 8) << ")";}
+ pfc::string_formatter m_buffer;
+};
+
+struct exception_win32 : public std::exception {
+ exception_win32(DWORD p_code) : std::exception(format_win32_error(p_code)), m_code(p_code) {}
+ DWORD get_code() const {return m_code;}
+private:
+ DWORD m_code;
+};
+
+class uDebugLog : public pfc::string_formatter {
+public:
+ ~uDebugLog() {*this << "\n"; uOutputDebugString(get_ptr());}
+};
+
+static void uAddWindowStyle(HWND p_wnd,LONG p_style) {
+ SetWindowLongPtr(p_wnd,GWL_STYLE, GetWindowLongPtr(p_wnd,GWL_STYLE) | p_style);
+}
+
+static void uRemoveWindowStyle(HWND p_wnd,LONG p_style) {
+ SetWindowLongPtr(p_wnd,GWL_STYLE, GetWindowLongPtr(p_wnd,GWL_STYLE) & ~p_style);
+}
+
+static void uAddWindowExStyle(HWND p_wnd,LONG p_style) {
+ SetWindowLongPtr(p_wnd,GWL_EXSTYLE, GetWindowLongPtr(p_wnd,GWL_EXSTYLE) | p_style);
+}
+
+static void uRemoveWindowExStyle(HWND p_wnd,LONG p_style) {
+ SetWindowLongPtr(p_wnd,GWL_EXSTYLE, GetWindowLongPtr(p_wnd,GWL_EXSTYLE) & ~p_style);
+}
+
+static unsigned MapDialogWidth(HWND p_dialog,unsigned p_value) {
+ RECT temp;
+ temp.left = 0; temp.right = p_value; temp.top = temp.bottom = 0;
+ if (!MapDialogRect(p_dialog,&temp)) return 0;
+ return temp.right;
+}
+
+static bool IsKeyPressed(unsigned vk) {
+ return (GetKeyState(vk) & 0x8000) ? true : false;
+}
+
+//! Returns current modifier keys pressed, using win32 MOD_* flags.
+static unsigned GetHotkeyModifierFlags() {
+ unsigned ret = 0;
+ if (IsKeyPressed(VK_CONTROL)) ret |= MOD_CONTROL;
+ if (IsKeyPressed(VK_SHIFT)) ret |= MOD_SHIFT;
+ if (IsKeyPressed(VK_MENU)) ret |= MOD_ALT;
+ if (IsKeyPressed(VK_LWIN) || IsKeyPressed(VK_RWIN)) ret |= MOD_WIN;
+ return ret;
+}
+
+class CClipboardOpenScope {
+public:
+ CClipboardOpenScope() : m_open(false) {}
+ ~CClipboardOpenScope() {Close();}
+ bool Open(HWND p_owner) {
+ Close();
+ if (OpenClipboard(p_owner)) {
+ m_open = true;
+ return true;
+ } else {
+ return false;
+ }
+ }
+ void Close() {
+ if (m_open) {
+ m_open = false;
+ CloseClipboard();
+ }
+ }
+private:
+ bool m_open;
+
+ PFC_CLASS_NOT_COPYABLE_EX(CClipboardOpenScope)
+};
+
+class CGlobalLockScope {
+public:
+ CGlobalLockScope(HGLOBAL p_handle) : m_handle(p_handle), m_ptr(GlobalLock(p_handle)) {
+ if (m_ptr == NULL) throw std::bad_alloc();
+ }
+ ~CGlobalLockScope() {
+ if (m_ptr != NULL) GlobalUnlock(m_handle);
+ }
+ void * GetPtr() const {return m_ptr;}
+ t_size GetSize() const {return GlobalSize(m_handle);}
+private:
+ void * m_ptr;
+ HGLOBAL m_handle;
+
+ PFC_CLASS_NOT_COPYABLE_EX(CGlobalLockScope)
+};
+
+template<typename TItem> class CGlobalLockScopeT {
+public:
+ CGlobalLockScopeT(HGLOBAL handle) : m_scope(handle) {}
+ TItem * GetPtr() const {return reinterpret_cast<TItem*>(m_scope.GetPtr());}
+ t_size GetSize() const {
+ const t_size val = m_scope.GetSize();
+ PFC_ASSERT( val % sizeof(TItem) == 0 );
+ return val / sizeof(TItem);
+ }
+private:
+ CGlobalLockScope m_scope;
+};
+
+
+static bool IsPointInsideControl(const POINT& pt, HWND wnd) {
+ HWND walk = WindowFromPoint(pt);
+ for (;;) {
+ if (walk == NULL) return false;
+ if (walk == wnd) return true;
+ if (GetWindowLongPtr(walk,GWL_STYLE) & WS_POPUP) return false;
+ walk = GetParent(walk);
+ }
+}
+
+static bool IsWindowChildOf(HWND child, HWND parent) {
+ HWND walk = child;
+ while(walk != parent && walk != NULL && (GetWindowLongPtr(walk,GWL_STYLE) & WS_CHILD) != 0) {
+ walk = GetParent(walk);
+ }
+ return walk == parent;
+}
+
+
+#include "audio_math.h"
+#include "win32_misc.h"
+
+template<typename TPtr>
+class CoTaskMemObject {
+public:
+ CoTaskMemObject() : m_ptr() {}
+
+ ~CoTaskMemObject() {CoTaskMemFree(m_ptr);}
+
+ TPtr m_ptr;
+ PFC_CLASS_NOT_COPYABLE(CoTaskMemObject, CoTaskMemObject<TPtr> );
+};
+
+
+
+static void __cdecl _OverrideCrtAbort_handler(int signal) {
+ const ULONG_PTR args[] = {signal};
+ RaiseException(0x6F8E1DC8 /* random GUID */, EXCEPTION_NONCONTINUABLE, _countof(args), args);
+}
+
+static void OverrideCrtAbort() {
+ const int signals[] = {SIGINT, SIGTERM, SIGBREAK, SIGABRT};
+ for(size_t i=0; i<_countof(signals); i++) signal(signals[i], _OverrideCrtAbort_handler);
+ _set_abort_behavior(0, ~0);
+}
+
+#endif //_SHARED_DLL__SHARED_H_
diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/shared/shared.lib b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/shared/shared.lib Binary files differnew file mode 100644 index 0000000000..8e6c50af25 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/shared/shared.lib diff --git a/plugins/ListeningTo/src/players/foo_mlt/foobar2000/shared/win32_misc.h b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/shared/win32_misc.h new file mode 100644 index 0000000000..b3baa477aa --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/foobar2000/shared/win32_misc.h @@ -0,0 +1,253 @@ +class win32_menu {
+public:
+ win32_menu(HMENU p_initval) : m_menu(p_initval) {}
+ win32_menu() : m_menu(NULL) {}
+ ~win32_menu() {release();}
+ void release() {
+ if (m_menu != NULL) {
+ DestroyMenu(m_menu);
+ m_menu = NULL;
+ }
+ }
+ void set(HMENU p_menu) {release(); m_menu = p_menu;}
+ void create_popup() {
+ release();
+ SetLastError(NO_ERROR);
+ m_menu = CreatePopupMenu();
+ if (m_menu == NULL) throw exception_win32(GetLastError());
+ }
+ HMENU get() const {return m_menu;}
+ HMENU detach() {return pfc::replace_t(m_menu,(HMENU)NULL);}
+
+ bool is_valid() const {return m_menu != NULL;}
+private:
+ win32_menu(const win32_menu &) {throw pfc::exception_not_implemented();}
+ const win32_menu & operator=(const win32_menu &) {throw pfc::exception_not_implemented();}
+
+ HMENU m_menu;
+};
+
+class win32_font {
+public:
+ win32_font(HFONT p_initval) : m_font(p_initval) {}
+ win32_font() : m_font(NULL) {}
+ ~win32_font() {release();}
+
+ void release() {
+ HFONT temp = detach();
+ if (temp != NULL) DeleteObject(temp);
+ }
+
+ void set(HFONT p_font) {release(); m_font = p_font;}
+ HFONT get() const {return m_font;}
+ HFONT detach() {return pfc::replace_t(m_font,(HFONT)NULL);}
+
+ void create(const t_font_description & p_desc) {
+ SetLastError(NO_ERROR);
+ HFONT temp = p_desc.create();
+ if (temp == NULL) throw exception_win32(GetLastError());
+ set(temp);
+ }
+
+ bool is_valid() const {return m_font != NULL;}
+
+private:
+ win32_font(const win32_font&) {throw pfc::exception_not_implemented();}
+ const win32_font & operator=(const win32_font &) {throw pfc::exception_not_implemented();}
+
+ HFONT m_font;
+};
+
+class win32_event {
+public:
+ win32_event() : m_handle(NULL) {}
+ ~win32_event() {release();}
+
+ void create(bool p_manualreset,bool p_initialstate) {
+ release();
+ SetLastError(NO_ERROR);
+ m_handle = CreateEvent(NULL,p_manualreset ? TRUE : FALSE, p_initialstate ? TRUE : FALSE,NULL);
+ if (m_handle == NULL) throw exception_win32(GetLastError());
+ }
+
+ void set(HANDLE p_handle) {release(); m_handle = p_handle;}
+ HANDLE get() const {return m_handle;}
+ HANDLE detach() {return pfc::replace_t(m_handle,(HANDLE)NULL);}
+ bool is_valid() const {return m_handle != NULL;}
+
+ void release() {
+ HANDLE temp = detach();
+ if (temp != NULL) CloseHandle(temp);
+ }
+
+
+ //! Returns true when signaled, false on timeout
+ bool wait_for(double p_timeout_seconds) {return g_wait_for(get(),p_timeout_seconds);}
+
+ static DWORD g_calculate_wait_time(double p_seconds) {
+ DWORD time = 0;
+ if (p_seconds> 0) {
+ time = audio_math::rint32((audio_sample)(p_seconds * 1000.0));
+ if (time == 0) time = 1;
+ } else if (p_seconds < 0) {
+ time = INFINITE;
+ }
+ return time;
+ }
+
+ //! Returns true when signaled, false on timeout
+ static bool g_wait_for(HANDLE p_event,double p_timeout_seconds) {
+ SetLastError(NO_ERROR);
+ DWORD status = WaitForSingleObject(p_event,g_calculate_wait_time(p_timeout_seconds));
+ switch(status) {
+ case WAIT_FAILED:
+ throw exception_win32(GetLastError());
+ default:
+ throw pfc::exception_bug_check();
+ case WAIT_OBJECT_0:
+ return true;
+ case WAIT_TIMEOUT:
+ return false;
+ }
+ }
+
+ void set_state(bool p_state) {
+ PFC_ASSERT(m_handle != NULL);
+ if (p_state) SetEvent(m_handle);
+ else ResetEvent(m_handle);
+ }
+
+private:
+ win32_event(const win32_event&) {throw pfc::exception_not_implemented();}
+ const win32_event & operator=(const win32_event &) {throw pfc::exception_not_implemented();}
+
+ HANDLE m_handle;
+};
+
+static void uSleepSeconds(double p_time,bool p_alertable) {
+ SleepEx(win32_event::g_calculate_wait_time(p_time),p_alertable ? TRUE : FALSE);
+}
+
+
+
+
+class win32_icon {
+public:
+ win32_icon(HICON p_initval) : m_icon(p_initval) {}
+ win32_icon() : m_icon(NULL) {}
+ ~win32_icon() {release();}
+
+ void release() {
+ HICON temp = detach();
+ if (temp != NULL) DestroyIcon(temp);
+ }
+
+ void set(HICON p_icon) {release(); m_icon = p_icon;}
+ HICON get() const {return m_icon;}
+ HICON detach() {return pfc::replace_t(m_icon,(HICON)NULL);}
+
+ bool is_valid() const {return m_icon != NULL;}
+
+private:
+ win32_icon(const win32_icon&) {throw pfc::exception_not_implemented();}
+ const win32_icon & operator=(const win32_icon &) {throw pfc::exception_not_implemented();}
+
+ HICON m_icon;
+};
+
+class win32_accelerator {
+public:
+ win32_accelerator() : m_accel(NULL) {}
+ ~win32_accelerator() {release();}
+ HACCEL get() const {return m_accel;}
+
+ void load(HINSTANCE p_inst,const TCHAR * p_id) {
+ release();
+ SetLastError(NO_ERROR);
+ m_accel = LoadAccelerators(p_inst,p_id);
+ if (m_accel == NULL) {
+ throw exception_win32(GetLastError());
+ }
+ }
+
+ void release() {
+ if (m_accel != NULL) {
+ DestroyAcceleratorTable(m_accel);
+ m_accel = NULL;
+ }
+ }
+private:
+ HACCEL m_accel;
+ PFC_CLASS_NOT_COPYABLE(win32_accelerator,win32_accelerator);
+};
+
+
+class SelectObjectScope {
+public:
+ SelectObjectScope(HDC p_dc,HGDIOBJ p_obj) throw() : m_dc(p_dc), m_obj(SelectObject(p_dc,p_obj)) {}
+ ~SelectObjectScope() throw() {SelectObject(m_dc,m_obj);}
+private:
+ PFC_CLASS_NOT_COPYABLE_EX(SelectObjectScope)
+ HDC m_dc;
+ HGDIOBJ m_obj;
+};
+
+class OffsetWindowOrgScope {
+public:
+ OffsetWindowOrgScope(HDC dc, const POINT & pt) throw() : m_dc(dc), m_pt(pt) {
+ OffsetWindowOrgEx(m_dc, m_pt.x, m_pt.y, NULL);
+ }
+ ~OffsetWindowOrgScope() throw() {
+ OffsetWindowOrgEx(m_dc, -m_pt.x, -m_pt.y, NULL);
+ }
+
+private:
+ const HDC m_dc;
+ const POINT m_pt;
+};
+class DCStateScope {
+public:
+ DCStateScope(HDC p_dc) throw() : m_dc(p_dc) {
+ m_state = SaveDC(m_dc);
+ }
+ ~DCStateScope() throw() {
+ RestoreDC(m_dc,m_state);
+ }
+private:
+ const HDC m_dc;
+ int m_state;
+};
+
+
+class exception_com : public std::exception {
+public:
+ exception_com(HRESULT p_code) : std::exception(format_hresult(p_code)), m_code(p_code) {}
+ exception_com(HRESULT p_code, const char * msg) : std::exception(format_hresult(p_code, msg)), m_code(p_code) {}
+ HRESULT get_code() const {return m_code;}
+private:
+ HRESULT m_code;
+};
+
+// Same format as _WIN32_WINNT macro.
+static WORD GetWindowsVersionCode() throw() {
+ const DWORD ver = GetVersion();
+ return (WORD)HIBYTE(LOWORD(ver)) | ((WORD)LOBYTE(LOWORD(ver)) << 8);
+}
+
+//! Simple implementation of a COM reference counter. The initial reference count is zero, so it can be used with pfc::com_ptr_t<> with plain operator=/constructor rather than attach().
+template<typename TBase> class ImplementCOMRefCounter : public TBase {
+public:
+ TEMPLATE_CONSTRUCTOR_FORWARD_FLOOD(ImplementCOMRefCounter,TBase)
+ ULONG STDMETHODCALLTYPE AddRef() {
+ return ++m_refcounter;
+ }
+ ULONG STDMETHODCALLTYPE Release() {
+ long val = --m_refcounter;
+ if (val == 0) delete this;
+ return val;
+ }
+protected:
+ virtual ~ImplementCOMRefCounter() {}
+private:
+ pfc::refcounter m_refcounter;
+};
diff --git a/plugins/ListeningTo/src/players/foo_mlt/pfc/alloc.h b/plugins/ListeningTo/src/players/foo_mlt/pfc/alloc.h new file mode 100644 index 0000000000..deb03b47cd --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/pfc/alloc.h @@ -0,0 +1,422 @@ +namespace pfc {
+
+ static void * raw_malloc(t_size p_size) {
+ return p_size > 0 ? new_ptr_check_t(malloc(p_size)) : NULL;
+ }
+
+ static void raw_free(void * p_block) throw() {free(p_block);}
+
+ static void* raw_realloc(void * p_ptr,t_size p_size) {
+ if (p_size == 0) {raw_free(p_ptr); return NULL;}
+ else if (p_ptr == NULL) return raw_malloc(p_size);
+ else return pfc::new_ptr_check_t(::realloc(p_ptr,p_size));
+ }
+
+ static bool raw_realloc_inplace(void * p_block,t_size p_size) throw() {
+ if (p_block == NULL) return p_size == 0;
+#ifdef _MSC_VER
+ if (p_size == 0) return false;
+ return _expand(p_block,p_size) != NULL;
+#else
+ return false;
+#endif
+ }
+
+ template<typename T>
+ t_size calc_array_width(t_size p_width) {
+ return pfc::mul_safe_t<std::bad_alloc,t_size>(p_width,sizeof(T));
+ }
+
+ template<typename T>
+ T * __raw_malloc_t(t_size p_size) {
+ return reinterpret_cast<T*>(raw_malloc(calc_array_width<T>(p_size)));
+ }
+
+ template<typename T>
+ void __raw_free_t(T * p_block) throw() {
+ raw_free(reinterpret_cast<void*>(p_block));
+ }
+
+ template<typename T>
+ T * __raw_realloc_t(T * p_block,t_size p_size) {
+ return reinterpret_cast<T*>(raw_realloc(p_block,calc_array_width<T>(p_size)));
+ }
+
+ template<typename T>
+ bool __raw_realloc_inplace_t(T * p_block,t_size p_size) {
+ return raw_realloc_inplace(p_block,calc_array_width<T>(p_size));
+ }
+
+
+ template<typename t_exception,typename t_int>
+ inline t_int safe_shift_left_t(t_int p_val,t_size p_shift = 1) {
+ t_int newval = p_val << p_shift;
+ if (newval >> p_shift != p_val) throw t_exception();
+ return newval;
+ }
+
+ template<typename t_item> class alloc_dummy {
+ private: typedef alloc_dummy<t_item> t_self;
+ public:
+ alloc_dummy() {}
+ void set_size(t_size p_size) {throw pfc::exception_not_implemented();}
+ t_size get_size() const {throw pfc::exception_not_implemented();}
+ const t_item & operator[](t_size p_index) const {throw pfc::exception_not_implemented();}
+ t_item & operator[](t_size p_index) {throw pfc::exception_not_implemented();}
+
+ bool is_ptr_owned(const void * p_item) const {return false;}
+
+ //set to true when we prioritize speed over memory usage
+ enum { alloc_prioritizes_speed = false };
+
+ //not mandatory
+ const t_item * get_ptr() const {throw pfc::exception_not_implemented();}
+ t_item * get_ptr() {throw pfc::exception_not_implemented();}
+ void prealloc(t_size) {throw pfc::exception_not_implemented();}
+ void force_reset() {throw pfc::exception_not_implemented();}
+ private:
+ const t_self & operator=(const t_self &) {throw pfc::exception_not_implemented();}
+ alloc_dummy(const t_self&) {throw pfc::exception_not_implemented();}
+ };
+
+ template<typename t_item>
+ bool is_pointer_in_range(const t_item * p_buffer,t_size p_buffer_size,const void * p_pointer) {
+ return p_pointer >= reinterpret_cast<const void*>(p_buffer) && p_pointer < reinterpret_cast<const void*>(p_buffer + p_buffer_size);
+ }
+
+
+ //! Simple inefficient fully portable allocator.
+ template<typename t_item> class alloc_simple {
+ private: typedef alloc_simple<t_item> t_self;
+ public:
+ alloc_simple() : m_data(NULL), m_size(0) {}
+ void set_size(t_size p_size) {
+ if (p_size != m_size) {
+ t_item * l_data = NULL;
+ if (p_size > 0) l_data = new t_item[p_size];
+ try {
+ pfc::memcpy_t(l_data,m_data,pfc::min_t(m_size,p_size));
+ } catch(...) {
+ delete[] l_data;
+ throw;
+ }
+ delete[] m_data;
+ m_data = l_data;
+ m_size = p_size;
+ }
+ }
+ t_size get_size() const {return m_size;}
+ const t_item & operator[](t_size p_index) const {PFC_ASSERT(p_index < m_size); return m_data[p_index];}
+ t_item & operator[](t_size p_index) {PFC_ASSERT(p_index < m_size); return m_data[p_index];}
+ bool is_ptr_owned(const void * p_item) const {return is_pointer_in_range(get_ptr(),get_size(),p_item);}
+
+ enum { alloc_prioritizes_speed = false };
+
+ t_item * get_ptr() {return m_data;}
+ const t_item * get_ptr() const {return m_data;}
+
+ void prealloc(t_size) {}
+ void force_reset() {set_size(0);}
+
+ ~alloc_simple() {delete[] m_data;}
+ private:
+ const t_self & operator=(const t_self &) {throw pfc::exception_not_implemented();}
+ alloc_simple(const t_self&) {throw pfc::exception_not_implemented();}
+
+ t_item * m_data;
+ t_size m_size;
+ };
+
+ template<typename t_item> class __array_fast_helper_t {
+ private:
+ typedef __array_fast_helper_t<t_item> t_self;
+ public:
+ __array_fast_helper_t() : m_buffer(NULL), m_size_total(0), m_size(0) {}
+
+
+ void set_size(t_size p_size,t_size p_size_total) {
+ PFC_ASSERT(p_size <= p_size_total);
+ PFC_ASSERT(m_size <= m_size_total);
+ if (p_size_total > m_size_total) {
+ resize_storage(p_size_total);
+ resize_content(p_size);
+ } else {
+ resize_content(p_size);
+ resize_storage(p_size_total);
+ }
+ }
+
+
+
+ t_size get_size() const {return m_size;}
+ t_size get_size_total() const {return m_size_total;}
+ const t_item & operator[](t_size p_index) const {PFC_ASSERT(p_index < m_size); return m_buffer[p_index];}
+ t_item & operator[](t_size p_index) {PFC_ASSERT(p_index < m_size); return m_buffer[p_index];}
+ ~__array_fast_helper_t() {
+ set_size(0,0);
+ }
+ t_item * get_ptr() {return m_buffer;}
+ const t_item * get_ptr() const {return m_buffer;}
+ bool is_ptr_owned(const void * p_item) const {return is_pointer_in_range(m_buffer,m_size_total,p_item);}
+ private:
+ const t_self & operator=(const t_self &) {throw pfc::exception_not_implemented();}
+ __array_fast_helper_t(const t_self &) {throw pfc::exception_not_implemented();}
+
+
+ void resize_content(t_size p_size) {
+ if (traits_t<t_item>::needs_constructor || traits_t<t_item>::needs_destructor) {
+ if (p_size > m_size) {//expand
+ do {
+ __unsafe__in_place_constructor_t(m_buffer[m_size]);
+ m_size++;
+ } while(m_size < p_size);
+ } else if (p_size < m_size) {
+ __unsafe__in_place_destructor_array_t(m_buffer + p_size, m_size - p_size);
+ m_size = p_size;
+ }
+ } else {
+ m_size = p_size;
+ }
+ }
+
+ void resize_storage(t_size p_size) {
+ PFC_ASSERT( m_size <= m_size_total );
+ PFC_ASSERT( m_size <= p_size );
+ if (m_size_total != p_size) {
+ if (pfc::traits_t<t_item>::realloc_safe) {
+ m_buffer = pfc::__raw_realloc_t(m_buffer,p_size);
+ m_size_total = p_size;
+ } else if (__raw_realloc_inplace_t(m_buffer,p_size)) {
+ //success
+ m_size_total = p_size;
+ } else {
+ t_item * newbuffer = pfc::__raw_malloc_t<t_item>(p_size);
+ try {
+ pfc::__unsafe__in_place_constructor_array_copy_t(newbuffer,m_size,m_buffer);
+ } catch(...) {
+ pfc::__raw_free_t(newbuffer);
+ throw;
+ }
+ pfc::__unsafe__in_place_destructor_array_t(m_buffer,m_size);
+ pfc::__raw_free_t(m_buffer);
+ m_buffer = newbuffer;
+ m_size_total = p_size;
+ }
+ }
+ }
+
+ t_item * m_buffer;
+ t_size m_size,m_size_total;
+ };
+
+ template<typename t_item> class alloc_standard {
+ private: typedef alloc_standard<t_item> t_self;
+ public:
+ alloc_standard() {}
+ void set_size(t_size p_size) {m_content.set_size(p_size,p_size);}
+
+ t_size get_size() const {return m_content.get_size();}
+
+ const t_item & operator[](t_size p_index) const {return m_content[p_index];}
+ t_item & operator[](t_size p_index) {return m_content[p_index];}
+
+ const t_item * get_ptr() const {return m_content.get_ptr();}
+ t_item * get_ptr() {return m_content.get_ptr();}
+
+ bool is_ptr_owned(const void * p_item) const {return m_content.is_ptr_owned(p_item);}
+ void prealloc(t_size p_size) {}
+ void force_reset() {set_size(0);}
+
+ enum { alloc_prioritizes_speed = false };
+ private:
+ alloc_standard(const t_self &) {throw pfc::exception_not_implemented();}
+ const t_self & operator=(const t_self&) {throw pfc::exception_not_implemented();}
+
+ __array_fast_helper_t<t_item> m_content;
+ };
+
+ template<typename t_item> class alloc_fast {
+ private: typedef alloc_fast<t_item> t_self;
+ public:
+ alloc_fast() {}
+
+ void set_size(t_size p_size) {
+ t_size size_base = m_data.get_size_total();
+ if (size_base == 0) size_base = 1;
+ while(size_base < p_size) {
+ size_base = safe_shift_left_t<std::bad_alloc,t_size>(size_base,1);
+ }
+ while(size_base >> 2 > p_size) {
+ size_base >>= 1;
+ }
+ m_data.set_size(p_size,size_base);
+ }
+
+ t_size get_size() const {return m_data.get_size();}
+ const t_item & operator[](t_size p_index) const {return m_data[p_index];}
+ t_item & operator[](t_size p_index) {return m_data[p_index];}
+
+ const t_item * get_ptr() const {return m_data.get_ptr();}
+ t_item * get_ptr() {return m_data.get_ptr();}
+ bool is_ptr_owned(const void * p_item) const {return m_data.is_ptr_owned(p_item);}
+ void prealloc(t_size) {}
+ void force_reset() {m_data.set_size(0,0);}
+
+ enum { alloc_prioritizes_speed = true };
+ private:
+ alloc_fast(const t_self &) {throw pfc::exception_not_implemented();}
+ const t_self & operator=(const t_self&) {throw pfc::exception_not_implemented();}
+ __array_fast_helper_t<t_item> m_data;
+ };
+
+ template<typename t_item> class alloc_fast_aggressive {
+ private: typedef alloc_fast_aggressive<t_item> t_self;
+ public:
+ alloc_fast_aggressive() {}
+
+ void set_size(t_size p_size) {
+ t_size size_base = m_data.get_size_total();
+ if (size_base == 0) size_base = 1;
+ while(size_base < p_size) {
+ size_base = safe_shift_left_t<std::bad_alloc,t_size>(size_base,1);
+ }
+ m_data.set_size(p_size,size_base);
+ }
+
+ void prealloc(t_size p_size) {
+ if (p_size > 0) {
+ t_size size_base = m_data.get_size_total();
+ if (size_base == 0) size_base = 1;
+ while(size_base < p_size) {
+ size_base = safe_shift_left_t<std::bad_alloc,t_size>(size_base,1);
+ }
+ m_data.set_size(m_data.get_size(),size_base);
+ }
+ }
+
+ t_size get_size() const {return m_data.get_size();}
+ const t_item & operator[](t_size p_index) const {;return m_data[p_index];}
+ t_item & operator[](t_size p_index) {return m_data[p_index];}
+
+ const t_item * get_ptr() const {return m_data.get_ptr();}
+ t_item * get_ptr() {return m_data.get_ptr();}
+ bool is_ptr_owned(const void * p_item) const {return m_data.is_ptr_owned(p_item);}
+ void force_reset() {m_data.set_size(0,0);}
+
+ enum { alloc_prioritizes_speed = true };
+ private:
+ alloc_fast_aggressive(const t_self &) {throw pfc::exception_not_implemented();}
+ const t_self & operator=(const t_self&) {throw pfc::exception_not_implemented();}
+ __array_fast_helper_t<t_item> m_data;
+ };
+
+ template<t_size p_width> class alloc_fixed {
+ public:
+ template<typename t_item> class alloc {
+ private: typedef alloc<t_item> t_self;
+ public:
+ alloc() : m_size(0) {}
+
+ void set_size(t_size p_size) {
+ static_assert_t<sizeof(m_array) == sizeof(t_item[p_width])>();
+
+ if (p_size > p_width) throw pfc::exception_overflow();
+ else if (p_size > m_size) {
+ __unsafe__in_place_constructor_array_t(get_ptr()+m_size,p_size-m_size);
+ m_size = p_size;
+ } else if (p_size < m_size) {
+ __unsafe__in_place_destructor_array_t(get_ptr()+p_size,m_size-p_size);
+ m_size = p_size;
+ }
+ }
+
+ ~alloc() {
+ if (pfc::traits_t<t_item>::needs_destructor) set_size(0);
+ }
+
+ t_size get_size() const {return m_size;}
+
+ t_item * get_ptr() {return reinterpret_cast<t_item*>(&m_array);}
+ const t_item * get_ptr() const {return reinterpret_cast<const t_item*>(&m_array);}
+
+ const t_item & operator[](t_size n) const {return get_ptr()[n];}
+ t_item & operator[](t_size n) {return get_ptr()[n];}
+ bool is_ptr_owned(const void * p_item) const {return is_pointer_in_range(get_ptr(),p_width,p_item);}
+ void prealloc(t_size) {}
+ void force_reset() {set_size(0);}
+
+ enum { alloc_prioritizes_speed = false };
+ private:
+ alloc(const t_self&) {throw pfc::exception_not_implemented();}
+ const t_self& operator=(const t_self&) {throw pfc::exception_not_implemented();}
+
+ t_uint8 m_array[sizeof(t_item[p_width])];
+ t_size m_size;
+ };
+ };
+
+ template<t_size p_width, template<typename> class t_alloc = alloc_standard > class alloc_hybrid {
+ public:
+ template<typename t_item> class alloc {
+ private: typedef alloc<t_item> t_self;
+ public:
+ alloc() {}
+
+ void set_size(t_size p_size) {
+ if (p_size > p_width) {
+ m_fixed.set_size(p_width);
+ m_variable.set_size(p_size - p_width);
+ } else {
+ m_fixed.set_size(p_size);
+ m_variable.set_size(0);
+ }
+ }
+
+ t_item & operator[](t_size p_index) {
+ PFC_ASSERT(p_index < get_size());
+ if (p_index < p_width) return m_fixed[p_index];
+ else return m_variable[p_index - p_width];
+ }
+
+ const t_item & operator[](t_size p_index) const {
+ PFC_ASSERT(p_index < get_size());
+ if (p_index < p_width) return m_fixed[p_index];
+ else return m_variable[p_index - p_width];
+ }
+
+ t_size get_size() const {return m_fixed.get_size() + m_variable.get_size();}
+ bool is_ptr_owned(const void * p_item) const {return m_fixed.is_ptr_owned(p_item) || m_variable.is_ptr_owned(p_item);}
+ void prealloc(t_size p_size) {
+ if (p_size > p_width) m_variable.prealloc(p_size - p_width);
+ }
+ void force_reset() {
+ m_fixed.force_reset(); m_variable.force_reset();
+ }
+ enum { alloc_prioritizes_speed = t_alloc<t_item>::alloc_prioritizes_speed };
+ private:
+ alloc(const t_self&) {throw pfc::exception_not_implemented();}
+ const t_self& operator=(const t_self&) {throw pfc::exception_not_implemented();}
+
+ typename alloc_fixed<p_width>::template alloc<t_item> m_fixed;
+ t_alloc<t_item> m_variable;
+ };
+ };
+
+ template<typename t_item> class traits_t<alloc_simple<t_item> > : public traits_default_movable {};
+ template<typename t_item> class traits_t<__array_fast_helper_t<t_item> > : public traits_default_movable {};
+ template<typename t_item> class traits_t<alloc_standard<t_item> > : public pfc::traits_t<__array_fast_helper_t<t_item> > {};
+ template<typename t_item> class traits_t<alloc_fast<t_item> > : public pfc::traits_t<__array_fast_helper_t<t_item> > {};
+ template<typename t_item> class traits_t<alloc_fast_aggressive<t_item> > : public pfc::traits_t<__array_fast_helper_t<t_item> > {};
+
+#if 0//not working (compiler bug?)
+ template<t_size p_width,typename t_item> class traits_t<typename alloc_fixed<p_width>::template alloc<t_item> > : public pfc::traits_t<t_item> {
+ public:
+ enum {
+ needs_constructor = true,
+ };
+ };
+
+ template<t_size p_width,template<typename> class t_alloc,typename t_item>
+ class traits_t<typename alloc_hybrid<p_width,t_alloc>::template alloc<t_item> > : public traits_combined<t_alloc,typename alloc_fixed<p_width>::template alloc<t_item> > {};
+#endif
+};
diff --git a/plugins/ListeningTo/src/players/foo_mlt/pfc/array.h b/plugins/ListeningTo/src/players/foo_mlt/pfc/array.h new file mode 100644 index 0000000000..0ad6be2499 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/pfc/array.h @@ -0,0 +1,288 @@ +#ifndef _PFC_ARRAY_H_
+#define _PFC_ARRAY_H_
+
+namespace pfc {
+
+ template<typename t_item, template<typename> class t_alloc = alloc_standard> class array_t;
+
+
+ //! Special simplififed version of array class that avoids stepping on landmines with classes without public copy operators/constructors.
+ template<typename _t_item>
+ class array_staticsize_t {
+ public: typedef _t_item t_item;
+ private: typedef array_staticsize_t<t_item> t_self;
+ public:
+ array_staticsize_t() : m_size(0), m_array(NULL) {}
+ array_staticsize_t(t_size p_size) : m_array(new t_item[p_size]), m_size(p_size) {}
+ ~array_staticsize_t() {__release();}
+
+ //! Copy constructor nonfunctional when data type is not copyable.
+ array_staticsize_t(const t_self & p_source) : m_size(0), m_array(NULL) {
+ *this = p_source;
+ }
+
+ //! Copy operator nonfunctional when data type is not copyable.
+ const t_self & operator=(const t_self & p_source) {
+ __release();
+
+ //m_array = pfc::malloc_copy_t(p_source.get_size(),p_source.get_ptr());
+ const t_size newsize = p_source.get_size();
+ m_array = new t_item[newsize];
+ m_size = newsize;
+ for(t_size n = 0; n < newsize; n++) m_array[n] = p_source[n];
+ return *this;
+ }
+
+ void set_size_discard(t_size p_size) {
+ __release();
+ if (p_size > 0) {
+ m_array = new t_item[p_size];
+ m_size = p_size;
+ }
+ }
+ //! Warning: buffer pointer must not point to buffer allocated by this array (fixme).
+ template<typename t_source>
+ void set_data_fromptr(const t_source * p_buffer,t_size p_count) {
+ set_size_discard(p_count);
+ pfc::copy_array_loop_t(*this,p_buffer,p_count);
+ }
+
+
+ t_size get_size() const {return m_size;}
+ const t_item * get_ptr() const {return m_array;}
+ t_item * get_ptr() {return m_array;}
+
+ const t_item & operator[](t_size p_index) const {PFC_ASSERT(p_index < get_size());return m_array[p_index];}
+ t_item & operator[](t_size p_index) {PFC_ASSERT(p_index < get_size());return m_array[p_index];}
+
+ template<typename t_source> bool is_owned(const t_source & p_item) {return pfc::is_pointer_in_range(get_ptr(),get_size(),&p_item);}
+
+ template<typename t_out> void enumerate(t_out & out) const { for(t_size walk = 0; walk < m_size; ++walk) out(m_array[walk]); }
+ private:
+ void __release() {
+ m_size = 0;
+ delete[] pfc::replace_null_t(m_array);
+ }
+ t_item * m_array;
+ t_size m_size;
+ };
+
+ template<typename t_to,typename t_from>
+ inline void copy_array_t(t_to & p_to,const t_from & p_from) {
+ const t_size size = array_size_t(p_from);
+ if (p_to.has_owned_items(p_from)) {//avoid landmines with actual array data overlapping, or p_from being same as p_to
+ array_staticsize_t<typename t_to::t_item> temp;
+ temp.set_size_discard(size);
+ pfc::copy_array_loop_t(temp,p_from,size);
+ p_to.set_size(size);
+ pfc::copy_array_loop_t(p_to,temp,size);
+ } else {
+ p_to.set_size(size);
+ pfc::copy_array_loop_t(p_to,p_from,size);
+ }
+ }
+
+ template<typename t_array,typename t_value>
+ inline void fill_array_t(t_array & p_array,const t_value & p_value) {
+ const t_size size = array_size_t(p_array);
+ for(t_size n=0;n<size;n++) p_array[n] = p_value;
+ }
+
+ template<typename _t_item, template<typename> class t_alloc> class array_t {
+ public: typedef _t_item t_item;
+ private: typedef array_t<t_item,t_alloc> t_self;
+ public:
+ array_t() {}
+ array_t(const t_self & p_source) {copy_array_t(*this,p_source);}
+ template<typename t_source> array_t(const t_source & p_source) {copy_array_t(*this,p_source);}
+ const t_self & operator=(const t_self & p_source) {copy_array_t(*this,p_source); return *this;}
+ template<typename t_source> const t_self & operator=(const t_source & p_source) {copy_array_t(*this,p_source); return *this;}
+
+ void set_size(t_size p_size) {m_alloc.set_size(p_size);}
+ void set_size_discard(t_size p_size) {m_alloc.set_size(p_size);}
+ void set_count(t_size p_count) {m_alloc.set_size(p_count);}
+ t_size get_size() const {return m_alloc.get_size();}
+ t_size get_count() const {return m_alloc.get_size();}
+ void force_reset() {m_alloc.force_reset();}
+
+ const t_item & operator[](t_size p_index) const {PFC_ASSERT(p_index < get_size());return m_alloc[p_index];}
+ t_item & operator[](t_size p_index) {PFC_ASSERT(p_index < get_size());return m_alloc[p_index];}
+
+ //! Warning: buffer pointer must not point to buffer allocated by this array (fixme).
+ template<typename t_source>
+ void set_data_fromptr(const t_source * p_buffer,t_size p_count) {
+ set_size(p_count);
+ pfc::copy_array_loop_t(*this,p_buffer,p_count);
+ }
+
+ template<typename t_array>
+ void append(const t_array & p_source) {
+ if (has_owned_items(p_source)) append(array_t<t_item>(p_source));
+ else {
+ const t_size source_size = array_size_t(p_source);
+ const t_size base = get_size();
+ increase_size(source_size);
+ for(t_size n=0;n<source_size;n++) m_alloc[base+n] = p_source[n];
+ }
+ }
+
+ template<typename t_insert>
+ void insert_multi(const t_insert & value, t_size base, t_size count) {
+ const t_size oldSize = get_size();
+ if (base > oldSize) base = oldSize;
+ increase_size(count);
+ pfc::memmove_t(get_ptr() + base + count, get_ptr() + base, oldSize - base);
+ pfc::fill_ptr_t(get_ptr() + base, count, value);
+ }
+ template<typename t_append> void append_multi(const t_append & value, t_size count) {insert_multi(value,~0,count);}
+
+ //! Warning: buffer pointer must not point to buffer allocated by this array (fixme).
+ template<typename t_append>
+ void append_fromptr(const t_append * p_buffer,t_size p_count) {
+ PFC_ASSERT( !is_owned(&p_buffer[0]) );
+ t_size base = get_size();
+ increase_size(p_count);
+ for(t_size n=0;n<p_count;n++) m_alloc[base+n] = p_buffer[n];
+ }
+
+ void increase_size(t_size p_delta) {
+ t_size new_size = get_size() + p_delta;
+ if (new_size < p_delta) throw std::bad_alloc();
+ set_size(new_size);
+ }
+
+ template<typename t_append>
+ void append_single(const t_append & p_item) {
+ if (is_owned(p_item)) append_single(t_append(p_item));
+ else {
+ const t_size base = get_size();
+ increase_size(1);
+ m_alloc[base] = p_item;
+ }
+ }
+
+ template<typename t_filler>
+ void fill(const t_filler & p_filler) {
+ const t_size max = get_size();
+ for(t_size n=0;n<max;n++) m_alloc[n] = p_filler;
+ }
+
+ void fill_null() {
+ const t_size max = get_size();
+ for(t_size n=0;n<max;n++) m_alloc[n] = 0;
+ }
+
+ void grow_size(t_size p_size) {
+ if (p_size > get_size()) set_size(p_size);
+ }
+
+ //not supported by some allocs
+ const t_item * get_ptr() const {return m_alloc.get_ptr();}
+ t_item * get_ptr() {return m_alloc.get_ptr();}
+
+ void prealloc(t_size p_size) {m_alloc.prealloc(p_size);}
+
+ template<typename t_array>
+ bool has_owned_items(const t_array & p_source) {
+ if (array_size_t(p_source) == 0) return false;
+
+ //how the hell would we properly check if any of source items is owned by us, in case source array implements some weird mixing of references of items from different sources?
+ //the most obvious way means evil bottleneck here (whether it matters or not from caller's point of view which does something O(n) already is another question)
+ //at least this will work fine with all standard classes which don't crossreference anyhow and always use own storage
+ //perhaps we'll traitify this someday later
+ return is_owned(p_source[0]);
+ }
+
+ template<typename t_source>
+ bool is_owned(const t_source & p_item) {
+ return m_alloc.is_ptr_owned(&p_item);
+ }
+
+ template<typename t_item>
+ void set_single(const t_item & p_item) {
+ set_size(1);
+ (*this)[0] = p_item;
+ }
+
+ template<typename t_callback> void enumerate(t_callback & p_callback) const { for(t_size n = 0; n < get_size(); n++ ) { p_callback((*this)[n]); } }
+ private:
+ t_alloc<t_item> m_alloc;
+ };
+
+ template<typename t_item,t_size p_width,template<typename> class t_alloc = alloc_standard >
+ class array_hybrid_t : public array_t<t_item, pfc::alloc_hybrid<p_width,t_alloc>::template alloc >
+ {};
+
+
+ template<typename t_item> class traits_t<array_staticsize_t<t_item> > : public traits_default_movable {};
+ template<typename t_item,template<typename> class t_alloc> class traits_t<array_t<t_item,t_alloc> > : public pfc::traits_t<t_alloc<t_item> > {};
+
+
+ template<typename t_comparator = comparator_default>
+ class comparator_array {
+ public:
+ template<typename t_array1, typename t_array2>
+ static int compare(const t_array1 & p_array1, const t_array2 & p_array2) {
+ t_size walk = 0;
+ for (;;) {
+ if (walk >= p_array1.get_size() && walk >= p_array2.get_size()) return 0;
+ else if (walk >= p_array1.get_size()) return -1;
+ else if (walk >= p_array2.get_size()) return 1;
+ else {
+ int state = t_comparator::compare(p_array1[walk],p_array2[walk]);
+ if (state != 0) return state;
+ }
+ ++walk;
+ }
+ }
+ };
+
+ template<typename t_a1, typename t_a2>
+ static bool array_equals(const t_a1 & arr1, const t_a2 & arr2) {
+ const t_size s = array_size_t(arr1);
+ if (s != array_size_t(arr2)) return false;
+ for(t_size walk = 0; walk < s; ++walk) {
+ if (arr1[walk] != arr2[walk]) return false;
+ }
+ return true;
+ }
+
+
+
+ template<typename t_item, template<typename> class t_alloc = alloc_standard> class array_2d_t {
+ public:
+ array_2d_t() : m_d1(), m_d2() {}
+ void set_size(t_size d1, t_size d2) {
+ m_content.set_size(pfc::mul_safe_t<std::bad_alloc>(d1, d2));
+ m_d1 = d1; m_d2 = d2;
+ }
+ t_size get_dim1() const {return m_d1;}
+ t_size get_dim2() const {return m_d2;}
+
+ t_item & at(t_size i1, t_size i2) {
+ return * _transformPtr(m_content.get_ptr(), i1, i2);
+ }
+ const t_item & at(t_size i1, t_size i2) const {
+ return * _transformPtr(m_content.get_ptr(), i1, i2);
+ }
+ template<typename t_filler> void fill(const t_filler & p_filler) {m_content.fill(p_filler);}
+ void fill_null() {m_content.fill_null();}
+
+ t_item * rowPtr(t_size i1) {return _transformPtr(m_content.get_ptr(), i1, 0);}
+ const t_item * rowPtr(t_size i1) const {return _transformPtr(m_content.get_ptr(), i1, 0);}
+
+ const t_item * operator[](t_size i1) const {return rowPtr(i1);}
+ t_item * operator[](t_size i1) {return rowPtr(i1);}
+ private:
+ template<typename t_ptr> t_ptr _transformPtr(t_ptr ptr, t_size i1, t_size i2) const {
+ PFC_ASSERT( i1 < m_d1 ); PFC_ASSERT( i2 < m_d2 );
+ return ptr + i1 * m_d2 + i2;
+ }
+ pfc::array_t<t_item, t_alloc> m_content;
+ t_size m_d1, m_d2;
+ };
+
+}
+
+
+#endif //_PFC_ARRAY_H_
diff --git a/plugins/ListeningTo/src/players/foo_mlt/pfc/avltree.h b/plugins/ListeningTo/src/players/foo_mlt/pfc/avltree.h new file mode 100644 index 0000000000..930e003212 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/pfc/avltree.h @@ -0,0 +1,551 @@ +namespace pfc {
+
+ template<typename t_storage>
+ class _avltree_node : public _list_node<t_storage> {
+ public:
+ typedef _list_node<t_storage> t_node;
+ typedef _avltree_node<t_storage> t_self;
+ template<typename t_param> _avltree_node(t_param const& param) : t_node(param), m_left(), m_right(), m_depth() {}
+
+ typedef refcounted_object_ptr_t<t_self> t_ptr;
+ typedef t_self* t_rawptr;
+
+ t_ptr m_left, m_right;
+ t_rawptr m_parent;
+
+ t_size m_depth;
+
+ void link_left(t_self* ptr) throw() {
+ m_left = ptr;
+ if (ptr != NULL) ptr->m_parent = this;
+ }
+ void link_right(t_self* ptr) throw() {
+ m_right = ptr;
+ if (ptr != NULL) ptr->m_parent = this;
+ }
+
+ void link_child(bool which,t_self* ptr) throw() {
+ (which ? m_right : m_left) = ptr;
+ if (ptr != NULL) ptr->m_parent = this;
+ }
+
+ void unlink() throw() {
+ m_left.release(); m_right.release(); m_parent = NULL; m_depth = 0;
+ }
+
+ inline void add_ref() throw() {this->refcount_add_ref();}
+ inline void release() throw() {this->refcount_release();}
+
+ inline t_rawptr child(bool which) const throw() {return which ? &*m_right : &*m_left;}
+ inline bool which_child(const t_self* ptr) const throw() {return ptr == &*m_right;}
+
+
+
+ t_rawptr step(bool direction) throw() {
+ t_self* walk = this;
+ for (;;) {
+ t_self* t = walk->child(direction);
+ if (t != NULL) return t->peakchild(!direction);
+ for (;;) {
+ t = walk->m_parent;
+ if (t == NULL) return NULL;
+ if (t->which_child(walk) != direction) return t;
+ walk = t;
+ }
+ }
+ }
+ t_rawptr peakchild(bool direction) throw() {
+ t_self* walk = this;
+ for (;;) {
+ t_rawptr next = walk->child(direction);
+ if (next == NULL) return walk;
+ walk = next;
+ }
+ }
+ t_node * prev() throw() {return step(false);}
+ t_node * next() throw() {return step(true);}
+ private:
+ ~_avltree_node() throw() {}
+ };
+
+
+ template<typename t_storage,typename t_comparator = comparator_default>
+ class avltree_t {
+ public:
+ typedef avltree_t<t_storage,t_comparator> t_self;
+ typedef pfc::const_iterator<t_storage> const_iterator;
+ typedef pfc::iterator<t_storage> iterator;
+ typedef t_storage t_item;
+ private:
+ typedef _avltree_node<t_storage> t_node;
+#if 1//MSVC8 bug fix
+ typedef refcounted_object_ptr_t<t_node> t_nodeptr;
+ typedef t_node * t_noderawptr;
+#else
+ typedef typename t_node::t_ptr t_nodeptr;
+ typedef typename t_node::t_rawptr t_noderawptr;
+#endif
+
+
+ template<typename t_item1,typename t_item2>
+ inline static int compare(const t_item1 & p_item1, const t_item2 & p_item2) {
+ return t_comparator::compare(p_item1,p_item2);
+ }
+
+ t_nodeptr m_root;
+
+ static t_size calc_depth(const t_nodeptr & ptr)
+ {
+ return ptr.is_valid() ? 1+ptr->m_depth : 0;
+ }
+
+ static void recalc_depth(t_nodeptr const& ptr) {
+ ptr->m_depth = pfc::max_t(calc_depth(ptr->m_left), calc_depth(ptr->m_right));
+ }
+
+ static void assert_children(t_nodeptr ptr) {
+ PFC_ASSERT(ptr->m_depth == pfc::max_t(calc_depth(ptr->m_left),calc_depth(ptr->m_right)) );
+ }
+
+ static t_ssize test_depth(t_nodeptr const& ptr)
+ {
+ if (ptr==0) return 0;
+ else return calc_depth(ptr->m_right) - calc_depth(ptr->m_left);
+ }
+
+ static t_nodeptr extract_left_leaf(t_nodeptr & p_base) {
+ if (p_base->m_left != NULL) {
+ t_nodeptr ret = extract_left_leaf(p_base->m_left);
+ recalc_depth(p_base);
+ g_rebalance(p_base);
+ return ret;
+ } else {
+ t_nodeptr node = p_base;
+ p_base = node->m_right;
+ if (p_base.is_valid()) p_base->m_parent = node->m_parent;
+ node->m_right.release();
+ node->m_depth = 0;
+ node->m_parent = NULL;
+ return node;
+ }
+ }
+
+ static t_nodeptr extract_right_leaf(t_nodeptr & p_base) {
+ if (p_base->m_right != NULL) {
+ t_nodeptr ret = extract_right_leaf(p_base->m_right);
+ recalc_depth(p_base);
+ g_rebalance(p_base);
+ return ret;
+ } else {
+ t_nodeptr node = p_base;
+ p_base = node->m_left;
+ if (p_base.is_valid()) p_base->m_parent = node->m_parent;
+ node->m_left.release();
+ node->m_depth = 0;
+ node->m_parent = NULL;
+ return node;
+ }
+ }
+
+ static void remove_internal(t_nodeptr & p_node) {
+ t_nodeptr oldval = p_node;
+ if (p_node->m_left.is_empty()) {
+ p_node = p_node->m_right;
+ if (p_node.is_valid()) p_node->m_parent = oldval->m_parent;
+ } else if (p_node->m_right.is_empty()) {
+ p_node = p_node->m_left;
+ if (p_node.is_valid()) p_node->m_parent = oldval->m_parent;
+ } else {
+ t_nodeptr swap = extract_left_leaf(p_node->m_right);
+
+ swap->link_left(&*oldval->m_left);
+ swap->link_right(&*oldval->m_right);
+ swap->m_parent = oldval->m_parent;
+ recalc_depth(swap);
+ p_node = swap;
+ }
+ oldval->unlink();
+ }
+
+ template<typename t_nodewalk,typename t_callback>
+ static void __enum_items_recur(t_nodewalk * p_node,t_callback & p_callback) {
+ if (p_node != NULL) {
+ __enum_items_recur<t_nodewalk>(&*p_node->m_left,p_callback);
+ p_callback (p_node->m_content);
+ __enum_items_recur<t_nodewalk>(&*p_node->m_right,p_callback);
+ }
+ }
+ template<typename t_search>
+ static t_node * g_find_or_add_node(t_nodeptr & p_base,t_node * parent,t_search const & p_search,bool & p_new)
+ {
+ if (p_base.is_empty()) {
+ p_base = new t_node(p_search);
+ p_base->m_parent = parent;
+ p_new = true;
+ return p_base.get_ptr();
+ }
+
+ PFC_ASSERT( p_base->m_parent == parent );
+
+ int result = compare(p_base->m_content,p_search);
+ if (result > 0) {
+ t_node * ret = g_find_or_add_node<t_search>(p_base->m_left,&*p_base,p_search,p_new);
+ if (p_new) {
+ recalc_depth(p_base);
+ g_rebalance(p_base);
+ }
+ return ret;
+ } else if (result < 0) {
+ t_node * ret = g_find_or_add_node<t_search>(p_base->m_right,&*p_base,p_search,p_new);
+ if (p_new) {
+ recalc_depth(p_base);
+ g_rebalance(p_base);
+ }
+ return ret;
+ } else {
+ p_new = false;
+ return p_base.get_ptr();
+ }
+ }
+
+
+
+ template<typename t_search>
+ static t_storage * g_find_or_add(t_nodeptr & p_base,t_node * parent,t_search const & p_search,bool & p_new) {
+ return &g_find_or_add_node(p_base,parent,p_search,p_new)->m_content;
+ }
+
+
+ static void g_rotate_right(t_nodeptr & p_node) {
+ t_nodeptr oldroot = p_node;
+ t_nodeptr newroot = oldroot->m_right;
+ oldroot->link_child(true, &*newroot->m_left);
+ newroot->m_left = oldroot;
+ newroot->m_parent = oldroot->m_parent;
+ oldroot->m_parent = &*newroot;
+ recalc_depth(oldroot);
+ recalc_depth(newroot);
+ p_node = newroot;
+ }
+
+ static void g_rotate_left(t_nodeptr & p_node) {
+ t_nodeptr oldroot = p_node;
+ t_nodeptr newroot = oldroot->m_left;
+ oldroot->link_child(false, &*newroot->m_right);
+ newroot->m_right = oldroot;
+ newroot->m_parent = oldroot->m_parent;
+ oldroot->m_parent = &*newroot;
+ recalc_depth(oldroot);
+ recalc_depth(newroot);
+ p_node = newroot;
+ }
+
+ static void g_rebalance(t_nodeptr & p_node) {
+ t_ssize balance = test_depth(p_node);
+ if (balance > 1) {
+ //right becomes root
+ if (test_depth(p_node->m_right) < 0) {
+ g_rotate_left(p_node->m_right);
+ }
+ g_rotate_right(p_node);
+ } else if (balance < -1) {
+ //left becomes root
+ if (test_depth(p_node->m_left) > 0) {
+ g_rotate_right(p_node->m_left);
+ }
+ g_rotate_left(p_node);
+ }
+ selftest(p_node);
+ }
+
+ template<typename t_search>
+ static bool g_remove(t_nodeptr & p_node,t_search const & p_search) {
+ if (p_node.is_empty()) return false;
+
+ int result = compare(p_node->m_content,p_search);
+ if (result == 0) {
+ remove_internal(p_node);
+ if (p_node != NULL) {
+ recalc_depth(p_node);
+ g_rebalance(p_node);
+ }
+ return true;
+ } else {
+ if (g_remove<t_search>(result > 0 ? p_node->m_left : p_node->m_right,p_search)) {
+ recalc_depth(p_node);
+ g_rebalance(p_node);
+ return true;
+ } else {
+ return false;
+ }
+ }
+ }
+
+ static void selftest(t_nodeptr const& p_node) {
+ #if 0 //def _DEBUG//SLOW!
+ if (p_node != NULL) {
+ selftest(p_node->m_left);
+ selftest(p_node->m_right);
+ assert_children(p_node);
+ t_ssize delta = test_depth(p_node);
+ PFC_ASSERT(delta >= -1 && delta <= 1);
+
+ if (p_node->m_left.is_valid()) {
+ PFC_ASSERT( p_node.get_ptr() == p_node->m_left->m_parent );
+ }
+ if (p_node->m_right.is_valid()) {
+ PFC_ASSERT( p_node.get_ptr() == p_node->m_right->m_parent );
+ }
+
+ if (p_node->m_parent != NULL) {
+ PFC_ASSERT(p_node == p_node->m_parent->m_left || p_node == p_node->m_parent->m_right);
+ }
+ }
+ #endif
+ }
+
+
+ static t_size calc_count(const t_node * p_node) throw() {
+ if (p_node != NULL) {
+ return 1 + calc_count(&*p_node->m_left) + calc_count(&*p_node->m_right);
+ } else {
+ return 0;
+ }
+ }
+
+ template<typename t_param>
+ t_storage * _find_item_ptr(t_param const & p_item) const {
+ t_node* ptr = &*m_root;
+ while(ptr != NULL) {
+ int result = compare(ptr->m_content,p_item);
+ if (result > 0) ptr=&*ptr->m_left;
+ else if (result < 0) ptr=&*ptr->m_right;
+ else return &ptr->m_content;
+ }
+ return NULL;
+ }
+
+ template<typename t_param>
+ t_node * _find_node_ptr(t_param const & p_item) const {
+ t_node* ptr = &*m_root;
+ while(ptr != NULL) {
+ int result = compare(ptr->m_content,p_item);
+ if (result > 0) ptr=&*ptr->m_left;
+ else if (result < 0) ptr=&*ptr->m_right;
+ else return ptr;
+ }
+ return NULL;
+ }
+
+ template<bool inclusive,bool above,typename t_search> t_storage * __find_nearest(const t_search & p_search) const {
+ t_node * ptr = &*m_root;
+ t_storage * found = NULL;
+ while(ptr != NULL) {
+ int result = compare(ptr->m_content,p_search);
+ if (above) result = -result;
+ if (inclusive && result == 0) {
+ //direct hit
+ found = &ptr->m_content;
+ break;
+ } else if (result < 0) {
+ //match
+ found = &ptr->m_content;
+ ptr = ptr->child(!above);
+ } else {
+ //mismatch
+ ptr = ptr->child(above);
+ }
+ }
+ return found;
+ }
+ public:
+ avltree_t() : m_root(NULL) {}
+ ~avltree_t() {reset();}
+ const t_self & operator=(const t_self & p_other) {__copy(p_other);return *this;}
+ avltree_t(const t_self & p_other) : m_root(NULL) {try{__copy(p_other);} catch(...) {remove_all(); throw;}}
+
+ template<typename t_other> const t_self & operator=(const t_other & p_other) {copy_list_enumerated(*this,p_other);return *this;}
+ template<typename t_other> avltree_t(const t_other & p_other) : m_root(NULL) {try{copy_list_enumerated(*this,p_other);}catch(...){remove_all(); throw;}}
+
+
+ template<bool inclusive,bool above,typename t_search> const t_storage * find_nearest_item(const t_search & p_search) const {
+ return __find_nearest<inclusive,above>(p_search);
+ }
+
+ template<bool inclusive,bool above,typename t_search> t_storage * find_nearest_item(const t_search & p_search) {
+ return __find_nearest<inclusive,above>(p_search);
+ }
+
+ template<typename t_param>
+ t_storage & add_item(t_param const & p_item) {
+ bool dummy;
+ return add_item_ex(p_item,dummy);
+ }
+
+ template<typename t_param>
+ t_self & operator+=(const t_param & p_item) {add_item(p_item);return *this;}
+
+ template<typename t_param>
+ t_self & operator-=(const t_param & p_item) {remove_item(p_item);return *this;}
+
+ //! Returns true when the list has been altered, false when the item was already present before.
+ template<typename t_param>
+ bool add_item_check(t_param const & item) {
+ bool isNew = false;
+ g_find_or_add(m_root,NULL,item,isNew);
+ selftest(m_root);
+ return isNew;
+ }
+ template<typename t_param>
+ t_storage & add_item_ex(t_param const & p_item,bool & p_isnew) {
+ t_storage * ret = g_find_or_add(m_root,NULL,p_item,p_isnew);
+ selftest(m_root);
+ return *ret;
+ }
+
+ template<typename t_param>
+ void set_item(const t_param & p_item) {
+ bool isnew;
+ t_storage & found = add_item_ex(p_item,isnew);
+ if (isnew) found = p_item;
+ }
+
+ template<typename t_param>
+ const t_storage * find_item_ptr(t_param const & p_item) const {return _find_item_ptr(p_item);}
+
+ //! Unsafe! Caller must not modify items in a way that changes sort order!
+ template<typename t_param>
+ t_storage * find_item_ptr(t_param const & p_item) { return _find_item_ptr(p_item); }
+
+ template<typename t_param> const_iterator find(t_param const & item) const { return _find_node_ptr(item);}
+
+ //! Unsafe! Caller must not modify items in a way that changes sort order!
+ template<typename t_param> iterator find(t_param const & item) { return _find_node_ptr(item);}
+
+
+ template<typename t_param>
+ bool contains(const t_param & p_item) const {
+ return find_item_ptr(p_item) != NULL;
+ }
+
+ //! Same as contains().
+ template<typename t_param>
+ bool have_item(const t_param & p_item) const {return contains(p_item);}
+
+ void remove_all() throw() {
+ _unlink_recur(m_root);
+ m_root.release();
+ }
+
+ bool remove(const_iterator const& iter) {
+ PFC_ASSERT(iter.is_valid());
+ return remove_item(*iter);//OPTIMIZEME
+ //should never return false unless there's a bug in calling code
+ }
+
+ template<typename t_param>
+ bool remove_item(t_param const & p_item) {
+ bool ret = g_remove<t_param>(m_root,p_item);
+ selftest(m_root);
+ return ret;
+ }
+
+ t_size get_count() const throw() {
+ return calc_count(&*m_root);
+ }
+
+ template<typename t_callback>
+ void enumerate(t_callback & p_callback) const {
+ __enum_items_recur<const t_node>(&*m_root,p_callback);
+ }
+
+ //! Allows callback to modify the tree content.
+ //! Unsafe! Caller must not modify items in a way that changes sort order!
+ template<typename t_callback>
+ void _enumerate_var(t_callback & p_callback) { __enum_items_recur<t_node>(&*m_root,p_callback); }
+
+ template<typename t_param> iterator insert(const t_param & p_item) {
+ bool isNew;
+ t_node * ret = g_find_or_add_node(m_root,NULL,p_item,isNew);
+ selftest(m_root);
+ return ret;
+ }
+
+ //deprecated backwards compatibility method wrappers
+ template<typename t_param> t_storage & add(const t_param & p_item) {return add_item(p_item);}
+ template<typename t_param> t_storage & add_ex(const t_param & p_item,bool & p_isnew) {return add_item_ex(p_item,p_isnew);}
+ template<typename t_param> const t_storage * find_ptr(t_param const & p_item) const {return find_item_ptr(p_item);}
+ template<typename t_param> t_storage * find_ptr(t_param const & p_item) {return find_item_ptr(p_item);}
+ template<typename t_param> bool exists(t_param const & p_item) const {return have_item(p_item);}
+ void reset() {remove_all();}
+
+
+
+
+ const_iterator first() const throw() {return _firstlast(false);}
+ const_iterator last() const throw() {return _firstlast(true);}
+ //! Unsafe! Caller must not modify items in a way that changes sort order!
+ iterator _first_var() { return _firstlast(false); }
+ //! Unsafe! Caller must not modify items in a way that changes sort order!
+ iterator _last_var() { return _firstlast(true); }
+
+ template<typename t_param> bool get_first(t_param & p_item) const throw() {
+ const_iterator iter = first();
+ if (!iter.is_valid()) return false;
+ p_item = *iter;
+ return true;
+ }
+ template<typename t_param> bool get_last(t_param & p_item) const throw() {
+ const_iterator iter = last();
+ if (!iter.is_valid()) return false;
+ p_item = *iter;
+ return true;
+ }
+
+ static bool equals(const t_self & v1, const t_self & v2) {
+ return listEquals(v1,v2);
+ }
+ bool operator==(const t_self & other) const {return equals(*this,other);}
+ bool operator!=(const t_self & other) const {return !equals(*this,other);}
+
+ private:
+ static void _unlink_recur(t_nodeptr & node) {
+ if (node.is_valid()) {
+ _unlink_recur(node->m_left);
+ _unlink_recur(node->m_right);
+ node->unlink();
+ }
+ }
+ t_node* _firstlast(bool which) const throw() {
+ if (m_root.is_empty()) return NULL;
+ for(t_node * walk = &*m_root; ; ) {
+ t_node * next = walk->child(which);
+ if (next == NULL) return walk;
+ PFC_ASSERT( next->m_parent == walk );
+ walk = next;
+ }
+ }
+ static t_nodeptr __copy_recur(t_node * p_source,t_node * parent) {
+ if (p_source == NULL) {
+ return NULL;
+ } else {
+ t_nodeptr newnode = new t_node(p_source->m_content);
+ newnode->m_depth = p_source->m_depth;
+ newnode->m_left = __copy_recur(&*p_source->m_left,&*newnode);
+ newnode->m_right = __copy_recur(&*p_source->m_right,&*newnode);
+ newnode->m_parent = parent;
+ return newnode;
+ }
+ }
+
+ void __copy(const t_self & p_other) {
+ reset();
+ m_root = __copy_recur(&*p_other.m_root,NULL);
+ selftest(m_root);
+ }
+ };
+
+
+ template<typename t_storage,typename t_comparator>
+ class traits_t<avltree_t<t_storage,t_comparator> > : public traits_default_movable {};
+}
diff --git a/plugins/ListeningTo/src/players/foo_mlt/pfc/base64.cpp b/plugins/ListeningTo/src/players/foo_mlt/pfc/base64.cpp new file mode 100644 index 0000000000..c2a7db0f12 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/pfc/base64.cpp @@ -0,0 +1,99 @@ +#include "pfc.h"
+
+namespace bitWriter {
+ static void set_bit(t_uint8 * p_stream,size_t p_offset, bool state) {
+ t_uint8 mask = 1 << (7-(p_offset&7));
+ t_uint8 & byte = p_stream[p_offset>>3];
+ byte = (byte & ~mask) | (state ? mask : 0);
+ }
+ static void set_bits(t_uint8 * stream, t_size offset, t_size word, t_size bits) {
+ for(t_size walk = 0; walk < bits; ++walk) {
+ t_uint8 bit = (t_uint8)((word >> (bits - walk - 1))&1);
+ set_bit(stream, offset+walk, bit != 0);
+ }
+ }
+};
+
+namespace pfc {
+ t_size base64_decode_estimate(const char * text) {
+ t_size textLen = strlen(text);
+ if (textLen % 4 != 0) throw pfc::exception_invalid_params();
+ t_size outLen = (textLen / 4) * 3;
+
+ if (textLen >= 4) {
+ if (text[textLen-1] == '=') {
+ textLen--; outLen--;
+ if (text[textLen-1] == '=') {
+ textLen--; outLen--;
+ }
+ }
+ }
+ return outLen;
+ }
+
+
+
+ void base64_decode(const char * text, void * out) {
+ static const char alphabet[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+ t_uint8 alphabetRev[256];
+ for(t_size walk = 0; walk < PFC_TABSIZE(alphabetRev); ++walk) alphabetRev[walk] = 0xFF;
+ for(t_size walk = 0; walk < PFC_TABSIZE(alphabet); ++walk) alphabetRev[alphabet[walk]] = (t_uint8)walk;
+ const t_size textLen = strlen(text);
+
+ if (textLen % 4 != 0) throw pfc::exception_invalid_params();
+ if (textLen == 0) return;
+
+ t_size outWritePtr = 0;
+
+ {
+ const t_size max = textLen - 4;
+ t_size textWalk = 0;
+ for (; textWalk < max; textWalk ++) {
+ const t_uint8 v = alphabetRev[(t_uint8)text[textWalk]];
+ if (v == 0xFF) throw pfc::exception_invalid_params();
+ bitWriter::set_bits(reinterpret_cast<t_uint8*>(out),outWritePtr,v,6);
+ outWritePtr += 6;
+ }
+
+ t_uint8 temp[3];
+ t_size tempWritePtr = 0;
+ for (; textWalk < textLen; textWalk ++) {
+ const char c = text[textWalk];
+ if (c == '=') break;
+ const t_uint8 v = alphabetRev[(t_uint8)c];
+ if (v == 0xFF) throw pfc::exception_invalid_params();
+ bitWriter::set_bits(temp,tempWritePtr,v,6);
+ tempWritePtr += 6;
+ }
+ for (; textWalk < textLen; textWalk ++) {
+ if (text[textWalk] != '=') throw pfc::exception_invalid_params();
+ }
+ memcpy(reinterpret_cast<t_uint8*>(out) + (outWritePtr/8), temp, tempWritePtr/8);
+ }
+ }
+ void base64_encode(pfc::string_base & out, const void * in, t_size inSize) {
+ out.reset(); base64_encode_append(out, in, inSize);
+ }
+ void base64_encode_append(pfc::string_base & out, const void * in, t_size inSize) {
+ static const char alphabet[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+ int shift = 0;
+ int accum = 0;
+ const t_uint8 * inPtr = reinterpret_cast<const t_uint8*>(in);
+
+ for(t_size walk = 0; walk < inSize; ++walk) {
+ accum <<= 8;
+ shift += 8;
+ accum |= inPtr[walk];
+ while ( shift >= 6 ) {
+ shift -= 6;
+ out << format_char( alphabet[(accum >> shift) & 0x3F] );
+ }
+ }
+ if (shift == 4) {
+ out << format_char( alphabet[(accum & 0xF)<<2] ) << "=";
+ } else if (shift == 2) {
+ out << format_char( alphabet[(accum & 0x3)<<4] ) << "==";
+ }
+ }
+
+}
diff --git a/plugins/ListeningTo/src/players/foo_mlt/pfc/base64.h b/plugins/ListeningTo/src/players/foo_mlt/pfc/base64.h new file mode 100644 index 0000000000..fae66ab98d --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/pfc/base64.h @@ -0,0 +1,12 @@ +namespace pfc {
+ void base64_encode(pfc::string_base & out, const void * in, t_size inSize);
+ void base64_encode_append(pfc::string_base & out, const void * in, t_size inSize);
+ t_size base64_decode_estimate(const char * text);
+ void base64_decode(const char * text, void * out);
+
+ template<typename t_buffer> void base64_decode_array(t_buffer & out, const char * text) {
+ PFC_STATIC_ASSERT( sizeof(out[0]) == 1 );
+ out.set_size_discard( base64_decode_estimate(text) );
+ base64_decode(text, out.get_ptr());
+ }
+}
diff --git a/plugins/ListeningTo/src/players/foo_mlt/pfc/binary_search.h b/plugins/ListeningTo/src/players/foo_mlt/pfc/binary_search.h new file mode 100644 index 0000000000..5b15889fed --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/pfc/binary_search.h @@ -0,0 +1,81 @@ +namespace pfc {
+ class comparator_default;
+
+ template<typename t_comparator = comparator_default>
+ class binarySearch {
+ public:
+
+ template<typename t_container,typename t_param>
+ static bool run(const t_container & p_container,t_size p_base,t_size p_count,const t_param & p_param,t_size & p_result) {
+ t_size max = p_base + p_count;
+ t_size min = p_base;
+ while(min<max) {
+ t_size ptr = min + ( (max-min) >> 1);
+ int state = t_comparator::compare(p_param,p_container[ptr]);
+ if (state > 0) min = ptr + 1;
+ else if (state < 0) max = ptr;
+ else {
+ p_result = ptr;
+ return true;
+ }
+ }
+ p_result = min;
+ return false;
+ }
+
+
+ template<typename t_container,typename t_param>
+ static bool runGroupBegin(const t_container & p_container,t_size p_base,t_size p_count,const t_param & p_param,t_size & p_result) {
+ t_size max = p_base + p_count;
+ t_size min = p_base;
+ bool found = false;
+ while(min<max) {
+ t_size ptr = min + ( (max-min) >> 1);
+ int state = t_comparator::compare(p_param,p_container[ptr]);
+ if (state > 0) min = ptr + 1;
+ else if (state < 0) max = ptr;
+ else {
+ found = true; max = ptr;
+ }
+ }
+ p_result = min;
+ return found;
+ }
+
+ template<typename t_container,typename t_param>
+ static bool runGroupEnd(const t_container & p_container,t_size p_base,t_size p_count,const t_param & p_param,t_size & p_result) {
+ t_size max = p_base + p_count;
+ t_size min = p_base;
+ bool found = false;
+ while(min<max) {
+ t_size ptr = min + ( (max-min) >> 1);
+ int state = t_comparator::compare(p_param,p_container[ptr]);
+ if (state > 0) min = ptr + 1;
+ else if (state < 0) max = ptr;
+ else {
+ found = true; min = ptr + 1;
+ }
+ }
+ p_result = min;
+ return found;
+ }
+
+ template<typename t_container,typename t_param>
+ static bool runGroup(const t_container & p_container,t_size p_base,t_size p_count,const t_param & p_param,t_size & p_result,t_size & p_resultCount) {
+ if (!runGroupBegin(p_container,p_base,p_count,p_param,p_result)) {
+ p_resultCount = 0;
+ return false;
+ }
+ t_size groupEnd;
+ if (!runGroupEnd(p_container,p_result,p_count - p_result,p_param,groupEnd)) {
+ //should not happen..
+ PFC_ASSERT(0);
+ p_resultCount = 0;
+ return false;
+ }
+ PFC_ASSERT(groupEnd > p_result);
+ p_resultCount = groupEnd - p_result;
+ return true;
+ }
+ };
+};
diff --git a/plugins/ListeningTo/src/players/foo_mlt/pfc/bit_array.h b/plugins/ListeningTo/src/players/foo_mlt/pfc/bit_array.h new file mode 100644 index 0000000000..d8e0626642 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/pfc/bit_array.h @@ -0,0 +1,67 @@ +#ifndef _PFC_BIT_ARRAY_H_
+#define _PFC_BIT_ARRAY_H_
+namespace pfc {
+ //! Bit array interface class, constant version (you can only retrieve values). \n
+ //! Range of valid indexes depends on the context. When passing a bit_array as a parameter to some code, valid index range must be signaled independently.
+ class NOVTABLE bit_array {
+ public:
+ virtual bool get(t_size n) const = 0;
+ //! Returns the first occurance of val between start and start+count (excluding start+count), or start+count if not found; count may be negative to search back rather than forward. \n
+ //! Can be overridden by bit_array implementations for improved speed in specific cases.
+ virtual t_size find(bool val,t_size start,t_ssize count) const
+ {
+ t_ssize d, todo, ptr = start;
+ if (count==0) return start;
+ else if (count<0) {d = -1; todo = -count;}
+ else {d = 1; todo = count;}
+ while(todo>0 && get(ptr)!=val) {ptr+=d;todo--;}
+ return ptr;
+ }
+ inline bool operator[](t_size n) const {return get(n);}
+
+ t_size calc_count(bool val,t_size start,t_size count,t_size count_max = ~0) const//counts number of vals for start<=n<start+count
+ {
+ t_size found = 0;
+ t_size max = start+count;
+ t_size ptr;
+ for(ptr=find(val,start,count);found<count_max && ptr<max;ptr=find(val,ptr+1,max-ptr-1)) found++;
+ return found;
+ }
+
+ inline t_size find_first(bool val,t_size start,t_size max) const {return find(val,start,max-start);}
+ inline t_size find_next(bool val,t_size previous,t_size max) const {return find(val,previous+1,max-(previous+1));}
+ protected:
+ bit_array() {}
+ ~bit_array() {}
+ };
+
+ //! Bit array interface class, variable version (you can both set and retrieve values). \n
+ //! As with the constant version, valid index range depends on the context.
+ class NOVTABLE bit_array_var : public bit_array {
+ public:
+ virtual void set(t_size n,bool val)=0;
+ protected:
+ bit_array_var() {}
+ ~bit_array_var() {}
+ };
+}
+
+typedef pfc::bit_array bit_array; //for compatibility
+typedef pfc::bit_array_var bit_array_var; //for compatibility
+
+class bit_array_wrapper_permutation : public bit_array {
+public:
+ bit_array_wrapper_permutation(const t_size * p_permutation, t_size p_size) : m_permutation(p_permutation), m_size(p_size) {}
+ bool get(t_size n) const {
+ if (n < m_size) {
+ return m_permutation[n] != n;
+ } else {
+ return false;
+ }
+ }
+private:
+ const t_size * const m_permutation;
+ const t_size m_size;
+};
+
+#endif
diff --git a/plugins/ListeningTo/src/players/foo_mlt/pfc/bit_array_impl.h b/plugins/ListeningTo/src/players/foo_mlt/pfc/bit_array_impl.h new file mode 100644 index 0000000000..0c2e98afb4 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/pfc/bit_array_impl.h @@ -0,0 +1,234 @@ +#ifndef _PFC_BIT_ARRAY_IMPL_H_
+#define _PFC_BIT_ARRAY_IMPL_H_
+
+template<class T>
+class bit_array_table_t : public bit_array
+{
+ const T * data;
+ t_size count;
+ bool after;
+public:
+ inline bit_array_table_t(const T * p_data,t_size p_count,bool p_after = false)
+ : data(p_data), count(p_count), after(p_after)
+ {
+ }
+
+ bool get(t_size n) const
+ {
+ if (n<count) return !!data[n];
+ else return after;
+ }
+};
+
+template<class T>
+class bit_array_var_table_t : public bit_array_var
+{
+ T * data;
+ t_size count;
+ bool after;
+public:
+ inline bit_array_var_table_t(T * p_data,t_size p_count,bool p_after = false)
+ : data(p_data), count(p_count), after(p_after)
+ {
+ }
+
+ bool get(t_size n) const {
+ if (n<count) return !!data[n];
+ else return after;
+ }
+
+ void set(t_size n,bool val) {
+ if (n<count) data[n] = !!val;
+ }
+};
+
+
+typedef bit_array_table_t<bool> bit_array_table;
+typedef bit_array_var_table_t<bool> bit_array_var_table;
+
+class bit_array_range : public bit_array
+{
+ t_size begin,end;
+ bool state;
+public:
+ bit_array_range(t_size first,t_size count,bool p_state = true) : begin(first), end(first+count), state(p_state) {}
+
+ bool get(t_size n) const
+ {
+ bool rv = n>=begin && n<end;
+ if (!state) rv = !rv;
+ return rv;
+ }
+};
+
+//! Combines two arrays using the AND logical operator. \n
+//! Valid index range is an intersection of valid index ranges of the parameter arrays.
+class bit_array_and : public bit_array
+{
+ const bit_array & a1, & a2;
+public:
+ bit_array_and(const bit_array & p_a1, const bit_array & p_a2) : a1(p_a1), a2(p_a2) {}
+ bool get(t_size n) const {return a1.get(n) && a2.get(n);}
+};
+
+//! Combines two arrays using the OR logical operator. \n
+//! Valid index range is an intersection of valid index ranges of the parameter arrays.
+class bit_array_or : public bit_array
+{
+ const bit_array & a1, & a2;
+public:
+ bit_array_or(const bit_array & p_a1, const bit_array & p_a2) : a1(p_a1), a2(p_a2) {}
+ bool get(t_size n) const {return a1.get(n) || a2.get(n);}
+};
+
+//! Combines two arrays using the XOR logical operator. \n
+//! Valid index range is an intersection of valid index ranges of the parameter arrays.
+class bit_array_xor : public bit_array
+{
+ const bit_array & a1, & a2;
+public:
+ bit_array_xor(const bit_array & p_a1, const bit_array & p_a2) : a1(p_a1), a2(p_a2) {}
+ bool get(t_size n) const
+ {
+ bool v1 = a1.get(n), v2 = a2.get(n);
+ return (v1 && !v2) || (!v1 && v2);
+ }
+};
+
+//! Negation of another array. \n
+//! Valid index range is the same as valid index range of the parameter array.
+class bit_array_not : public bit_array
+{
+ const bit_array & a1;
+public:
+ bit_array_not(const bit_array & p_a1) : a1(p_a1) {}
+ bool get(t_size n) const {return !a1.get(n);}
+ t_size find(bool val,t_size start,t_ssize count) const
+ {return a1.find(!val,start,count);}
+
+};
+
+class bit_array_true : public bit_array
+{
+public:
+ bool get(t_size n) const {return true;}
+ t_size find(bool val,t_size start,t_ssize count) const
+ {return val ? start : start+count;}
+};
+
+class bit_array_false : public bit_array
+{
+public:
+ bool get(t_size n) const {return false;}
+ t_size find(bool val,t_size start,t_ssize count) const
+ {return val ? start+count : start;}
+};
+
+class bit_array_val : public bit_array
+{
+ bool val;
+public:
+ bit_array_val(bool v) : val(v) {}
+ bool get(t_size n) const {return val;}
+ t_size find(bool p_val,t_size start,t_ssize count) const
+ {return val==p_val ? start : start+count;}
+};
+
+class bit_array_one : public bit_array
+{
+ t_size val;
+public:
+ bit_array_one(t_size p_val) : val(p_val) {}
+ virtual bool get(t_size n) const {return n==val;}
+
+ virtual t_size find(bool p_val,t_size start,t_ssize count) const
+ {
+ if (count==0) return start;
+ else if (p_val)
+ {
+ if (count>0)
+ return (val>=start && val<start+count) ? val : start+count;
+ else
+ return (val<=start && val>start+count) ? val : start+count;
+ }
+ else
+ {
+ if (start == val) return count>0 ? start+1 : start-1;
+ else return start;
+ }
+ }
+};
+
+//! Generic variable bit_array implementation. \n
+//! Needs to be initialized with requested array size before use.
+class bit_array_bittable : public bit_array_var
+{
+ pfc::array_t<t_uint8> m_data;
+ t_size m_count;
+public:
+ //helpers
+ template<typename t_array>
+ inline static bool g_get(const t_array & p_array,t_size idx)
+ {
+ return !! (p_array[idx>>3] & (1<<(idx&7)));
+ }
+
+ template<typename t_array>
+ inline static void g_set(t_array & p_array,t_size idx,bool val)
+ {
+ unsigned char & dst = p_array[idx>>3];
+ unsigned char mask = 1<<(idx&7);
+ dst = val ? dst|mask : dst&~mask;
+ }
+
+ inline static t_size g_estimate_size(t_size p_count) {return (p_count+7)>>3;}
+
+ void resize(t_size p_count)
+ {
+ t_size old_bytes = g_estimate_size(m_count);
+ m_count = p_count;
+ t_size bytes = g_estimate_size(m_count);
+ m_data.set_size(bytes);
+ if (bytes > old_bytes) pfc::memset_null_t(m_data.get_ptr()+old_bytes,bytes-old_bytes);
+ }
+
+ bit_array_bittable(t_size p_count) : m_count(0) {resize(p_count);}
+ bit_array_bittable() : m_count() {}
+
+ void set(t_size n,bool val)
+ {
+ if (n<m_count)
+ {
+ g_set(m_data,n,val);
+ }
+ }
+
+ bool get(t_size n) const
+ {
+ bool rv = false;
+ if (n<m_count) {
+ rv = g_get(m_data,n);
+ }
+ return rv;
+ }
+};
+
+
+//! Bit array that takes a permutation and signals indexes reordered by the permutation. \n
+//! Valid index range same as length of the permutation.
+class bit_array_order_changed : public bit_array {
+public:
+ bit_array_order_changed(const t_size * p_order) : m_order(p_order) {}
+ bool get(t_size n) const
+ {
+ return m_order[n] != n;
+ }
+
+private:
+ const t_size * m_order;
+};
+
+#define for_each_bit_array(var,mask,val,start,count) for(var = mask.find(val,start,count);var<start+count;var=mask.find(val,var+1,count-(var+1-start)))
+
+
+#endif //_PFC_BIT_ARRAY_IMPL_H_
diff --git a/plugins/ListeningTo/src/players/foo_mlt/pfc/bit_array_impl_part2.h b/plugins/ListeningTo/src/players/foo_mlt/pfc/bit_array_impl_part2.h new file mode 100644 index 0000000000..fa5212eae6 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/pfc/bit_array_impl_part2.h @@ -0,0 +1,32 @@ +namespace pfc {
+ //! Generic variable bit array implementation. \n
+ //! Not very efficient to handle lots of items set to true but offers fast searches for true values and accepts arbitrary indexes, contrary to bit_array_bittable. Note that searches for false values are relatively inefficient.
+ class bit_array_var_impl : public bit_array_var {
+ public:
+ bool get(t_size n) const {
+ return m_data.have_item(n);
+ }
+ t_size find(bool val,t_size start,t_ssize count) const {
+ if (!val) {
+ return bit_array::find(false, start, count); //optimizeme.
+ } else if (count > 0) {
+ const t_size * v = m_data.find_nearest_item<true, true>(start);
+ if (v == NULL || *v > start+count) return start + count;
+ return *v;
+ } else if (count < 0) {
+ const t_size * v = m_data.find_nearest_item<true, false>(start);
+ if (v == NULL || *v < start+count) return start + count;
+ return *v;
+ } else return start;
+ }
+ void set(t_size n,bool val) {
+ if (val) m_data += n;
+ else m_data -= n;
+ }
+ void set(t_size n) {m_data += n;}
+ void unset(t_size n) {m_data -= n;}
+ t_size get_true_count() const {return m_data.get_count();}
+ private:
+ avltree_t<t_size> m_data;
+ };
+}
diff --git a/plugins/ListeningTo/src/players/foo_mlt/pfc/bsearch.cpp b/plugins/ListeningTo/src/players/foo_mlt/pfc/bsearch.cpp new file mode 100644 index 0000000000..b49f07e511 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/pfc/bsearch.cpp @@ -0,0 +1,19 @@ +#include "pfc.h"
+
+//deprecated
+
+/*
+class NOVTABLE bsearch_callback
+{
+public:
+ virtual int test(t_size p_index) const = 0;
+};
+*/
+
+namespace pfc {
+
+ bool pfc::bsearch(t_size p_count, bsearch_callback const & p_callback,t_size & p_result) {
+ return bsearch_inline_t(p_count,p_callback,p_result);
+ }
+
+}
\ No newline at end of file diff --git a/plugins/ListeningTo/src/players/foo_mlt/pfc/bsearch.h b/plugins/ListeningTo/src/players/foo_mlt/pfc/bsearch.h new file mode 100644 index 0000000000..2c147e4553 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/pfc/bsearch.h @@ -0,0 +1,87 @@ +namespace pfc {
+
+ //deprecated
+
+ class NOVTABLE bsearch_callback
+ {
+ public:
+ virtual int test(t_size n) const = 0;
+ };
+
+ bool bsearch(t_size p_count, bsearch_callback const & p_callback,t_size & p_result);
+
+ template<typename t_container,typename t_compare, typename t_param>
+ class bsearch_callback_impl_simple_t : public bsearch_callback {
+ public:
+ int test(t_size p_index) const {
+ return m_compare(m_container[p_index],m_param);
+ }
+ bsearch_callback_impl_simple_t(const t_container & p_container,t_compare p_compare,const t_param & p_param)
+ : m_container(p_container), m_compare(p_compare), m_param(p_param)
+ {
+ }
+ private:
+ const t_container & m_container;
+ t_compare m_compare;
+ const t_param & m_param;
+ };
+
+ template<typename t_container,typename t_compare, typename t_param,typename t_permutation>
+ class bsearch_callback_impl_permutation_t : public bsearch_callback {
+ public:
+ int test(t_size p_index) const {
+ return m_compare(m_container[m_permutation[p_index]],m_param);
+ }
+ bsearch_callback_impl_permutation_t(const t_container & p_container,t_compare p_compare,const t_param & p_param,const t_permutation & p_permutation)
+ : m_container(p_container), m_compare(p_compare), m_param(p_param), m_permutation(p_permutation)
+ {
+ }
+ private:
+ const t_container & m_container;
+ t_compare m_compare;
+ const t_param & m_param;
+ const t_permutation & m_permutation;
+ };
+
+
+ template<typename t_container,typename t_compare, typename t_param>
+ bool bsearch_t(t_size p_count,const t_container & p_container,t_compare p_compare,const t_param & p_param,t_size & p_index) {
+ return bsearch(
+ p_count,
+ bsearch_callback_impl_simple_t<t_container,t_compare,t_param>(p_container,p_compare,p_param),
+ p_index);
+ }
+
+ template<typename t_container,typename t_compare,typename t_param,typename t_permutation>
+ bool bsearch_permutation_t(t_size p_count,const t_container & p_container,t_compare p_compare,const t_param & p_param,const t_permutation & p_permutation,t_size & p_index) {
+ t_size index;
+ if (bsearch(
+ p_count,
+ bsearch_callback_impl_permutation_t<t_container,t_compare,t_param,t_permutation>(p_container,p_compare,p_param,p_permutation),
+ index))
+ {
+ p_index = p_permutation[index];
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ template<typename t_container,typename t_compare, typename t_param>
+ bool bsearch_range_t(const t_size p_count,const t_container & p_container,t_compare p_compare,const t_param & p_param,t_size & p_range_base,t_size & p_range_count)
+ {
+ t_size probe;
+ if (!bsearch(
+ p_count,
+ bsearch_callback_impl_simple_t<t_container,t_compare,t_param>(p_container,p_compare,p_param),
+ probe)) return false;
+
+ t_size base = probe, count = 1;
+ while(base > 0 && p_compare(p_container[base-1],p_param) == 0) {base--; count++;}
+ while(base + count < p_count && p_compare(p_container[base+count],p_param) == 0) {count++;}
+ p_range_base = base;
+ p_range_count = count;
+ return true;
+ }
+
+}
diff --git a/plugins/ListeningTo/src/players/foo_mlt/pfc/bsearch_inline.h b/plugins/ListeningTo/src/players/foo_mlt/pfc/bsearch_inline.h new file mode 100644 index 0000000000..272a275a69 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/pfc/bsearch_inline.h @@ -0,0 +1,48 @@ +namespace pfc {
+
+ //deprecated
+
+template<typename t_callback>
+inline bool bsearch_inline_t(t_size p_count, const t_callback & p_callback,t_size & p_result)
+{
+ t_size max = p_count;
+ t_size min = 0;
+ t_size ptr;
+ while(min<max)
+ {
+ ptr = min + ( (max-min) >> 1);
+ int result = p_callback.test(ptr);
+ if (result<0) min = ptr + 1;
+ else if (result>0) max = ptr;
+ else
+ {
+ p_result = ptr;
+ return true;
+ }
+ }
+ p_result = min;
+ return false;
+}
+
+template<typename t_buffer,typename t_value>
+inline bool bsearch_simple_inline_t(const t_buffer & p_buffer,t_size p_count,t_value const & p_value,t_size & p_result)
+{
+ t_size max = p_count;
+ t_size min = 0;
+ t_size ptr;
+ while(min<max)
+ {
+ ptr = min + ( (max-min) >> 1);
+ if (p_value > p_buffer[ptr]) min = ptr + 1;
+ else if (p_value < p_buffer[ptr]) max = ptr;
+ else
+ {
+ p_result = ptr;
+ return true;
+ }
+ }
+ p_result = min;
+ return false;
+}
+
+}
diff --git a/plugins/ListeningTo/src/players/foo_mlt/pfc/byte_order_helper.h b/plugins/ListeningTo/src/players/foo_mlt/pfc/byte_order_helper.h new file mode 100644 index 0000000000..4ff14000a7 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/pfc/byte_order_helper.h @@ -0,0 +1,230 @@ +#ifndef _PFC_BYTE_ORDER_HELPER_
+#define _PFC_BYTE_ORDER_HELPER_
+
+namespace pfc {
+ void byteswap_raw(void * p_buffer,t_size p_bytes);
+
+ template<typename T> T byteswap_t(T p_source);
+
+ template<> inline char byteswap_t<char>(char p_source) {return p_source;}
+ template<> inline unsigned char byteswap_t<unsigned char>(unsigned char p_source) {return p_source;}
+
+#ifdef _MSC_VER//does this even help with performance/size?
+ template<> inline wchar_t byteswap_t<wchar_t>(wchar_t p_source) {return _byteswap_ushort(p_source);}
+
+ template<> inline short byteswap_t<short>(short p_source) {return _byteswap_ushort(p_source);}
+ template<> inline unsigned short byteswap_t<unsigned short>(unsigned short p_source) {return _byteswap_ushort(p_source);}
+
+ template<> inline int byteswap_t<int>(int p_source) {return _byteswap_ulong(p_source);}
+ template<> inline unsigned int byteswap_t<unsigned int>(unsigned int p_source) {return _byteswap_ulong(p_source);}
+
+ template<> inline long byteswap_t<long>(long p_source) {return _byteswap_ulong(p_source);}
+ template<> inline unsigned long byteswap_t<unsigned long>(unsigned long p_source) {return _byteswap_ulong(p_source);}
+
+ template<> inline long long byteswap_t<long long>(long long p_source) {return _byteswap_uint64(p_source);}
+ template<> inline unsigned long long byteswap_t<unsigned long long>(unsigned long long p_source) {return _byteswap_uint64(p_source);}
+#else
+ template<> inline t_uint16 byteswap_t<t_uint16>(t_uint16 p_source) {return ((p_source & 0xFF00) >> 8) | ((p_source & 0x00FF) << 8);}
+ template<> inline t_int16 byteswap_t<t_int16>(t_int16 p_source) {return byteswap_t<t_uint16>(p_source);}
+
+ template<> inline t_uint32 byteswap_t<t_uint32>(t_uint32 p_source) {return ((p_source & 0xFF000000) >> 24) | ((p_source & 0x00FF0000) >> 8) | ((p_source & 0x0000FF00) << 8) | ((p_source & 0x000000FF) << 24);}
+ template<> inline t_int32 byteswap_t<t_int32>(t_int32 p_source) {return byteswap_t<t_uint32>(p_source);}
+
+ template<> inline t_uint64 byteswap_t<t_uint64>(t_uint64 p_source) {
+ //optimizeme
+ byteswap_raw(&p_source,sizeof(p_source));
+ return p_source;
+ }
+ template<> inline t_int64 byteswap_t<t_int64>(t_int64 p_source) {return byteswap_t<t_uint64>(p_source);}
+
+ template<> inline wchar_t byteswap_t<wchar_t>(wchar_t p_source) {
+ return byteswap_t<pfc::sized_int_t<sizeof(wchar_t)>::t_unsigned>(p_source);
+ }
+#endif
+
+ template<> inline float byteswap_t<float>(float p_source) {
+ float ret;
+ *(t_uint32*) &ret = byteswap_t(*(const t_uint32*)&p_source );
+ return ret;
+ }
+
+ template<> inline double byteswap_t<double>(double p_source) {
+ double ret;
+ *(t_uint64*) &ret = byteswap_t(*(const t_uint64*)&p_source );
+ return ret;
+ }
+
+ //blargh at GUID byteswap issue
+ template<> inline GUID byteswap_t<GUID>(GUID p_guid) {
+ GUID ret;
+ ret.Data1 = pfc::byteswap_t(p_guid.Data1);
+ ret.Data2 = pfc::byteswap_t(p_guid.Data2);
+ ret.Data3 = pfc::byteswap_t(p_guid.Data3);
+ ret.Data4[0] = p_guid.Data4[0];
+ ret.Data4[1] = p_guid.Data4[1];
+ ret.Data4[2] = p_guid.Data4[2];
+ ret.Data4[3] = p_guid.Data4[3];
+ ret.Data4[4] = p_guid.Data4[4];
+ ret.Data4[5] = p_guid.Data4[5];
+ ret.Data4[6] = p_guid.Data4[6];
+ ret.Data4[7] = p_guid.Data4[7];
+ return ret;
+ }
+
+
+
+};
+
+#ifdef _MSC_VER
+
+#if defined(_M_IX86) || defined(_M_X64)
+#define PFC_BYTE_ORDER_IS_BIG_ENDIAN 0
+#endif
+
+#else//_MSC_VER
+
+#include <endian.h>
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+#define PFC_BYTE_ORDER_IS_BIG_ENDIAN 0
+#else
+#define PFC_BYTE_ORDER_IS_BIG_ENDIAN 1
+#endif
+
+#endif//_MSC_VER
+
+#ifdef PFC_BYTE_ORDER_IS_BIG_ENDIAN
+#define PFC_BYTE_ORDER_IS_LITTLE_ENDIAN (!(PFC_BYTE_ORDER_IS_BIG_ENDIAN))
+#else
+#error please update byte order #defines
+#endif
+
+
+namespace pfc {
+ static const bool byte_order_is_big_endian = !!PFC_BYTE_ORDER_IS_BIG_ENDIAN;
+ static const bool byte_order_is_little_endian = !!PFC_BYTE_ORDER_IS_LITTLE_ENDIAN;
+
+ template<typename T> T byteswap_if_be_t(T p_param) {return byte_order_is_big_endian ? byteswap_t(p_param) : p_param;}
+ template<typename T> T byteswap_if_le_t(T p_param) {return byte_order_is_little_endian ? byteswap_t(p_param) : p_param;}
+}
+
+namespace byte_order {
+
+#if PFC_BYTE_ORDER_IS_BIG_ENDIAN//big endian
+ template<typename T> inline void order_native_to_le_t(T& param) {param = pfc::byteswap_t(param);}
+ template<typename T> inline void order_native_to_be_t(T& param) {}
+ template<typename T> inline void order_le_to_native_t(T& param) {param = pfc::byteswap_t(param);}
+ template<typename T> inline void order_be_to_native_t(T& param) {}
+#else//little endian
+ template<typename T> inline void order_native_to_le_t(T& param) {}
+ template<typename T> inline void order_native_to_be_t(T& param) {param = pfc::byteswap_t(param);}
+ template<typename T> inline void order_le_to_native_t(T& param) {}
+ template<typename T> inline void order_be_to_native_t(T& param) {param = pfc::byteswap_t(param);}
+#endif
+};
+
+
+
+namespace pfc {
+ template<typename TInt,unsigned width,bool IsBigEndian>
+ class __EncodeIntHelper {
+ public:
+ inline static void Run(TInt p_value,t_uint8 * p_out) {
+ *p_out = (t_uint8)(p_value);
+ __EncodeIntHelper<TInt,width-1,IsBigEndian>::Run(p_value >> 8,p_out + (IsBigEndian ? -1 : 1));
+ }
+ };
+
+ template<typename TInt,bool IsBigEndian>
+ class __EncodeIntHelper<TInt,1,IsBigEndian> {
+ public:
+ inline static void Run(TInt p_value,t_uint8* p_out) {
+ *p_out = (t_uint8)(p_value);
+ }
+ };
+ template<typename TInt,bool IsBigEndian>
+ class __EncodeIntHelper<TInt,0,IsBigEndian> {
+ public:
+ inline static void Run(TInt,t_uint8*) {}
+ };
+
+ template<typename TInt>
+ inline void encode_little_endian(t_uint8 * p_buffer,TInt p_value) {
+ __EncodeIntHelper<TInt,sizeof(TInt),false>::Run(p_value,p_buffer);
+ }
+ template<typename TInt>
+ inline void encode_big_endian(t_uint8 * p_buffer,TInt p_value) {
+ __EncodeIntHelper<TInt,sizeof(TInt),true>::Run(p_value,p_buffer + (sizeof(TInt) - 1));
+ }
+
+
+ template<typename TInt,unsigned width,bool IsBigEndian>
+ class __DecodeIntHelper {
+ public:
+ inline static TInt Run(const t_uint8 * p_in) {
+ return (__DecodeIntHelper<TInt,width-1,IsBigEndian>::Run(p_in + (IsBigEndian ? -1 : 1)) << 8) + *p_in;
+ }
+ };
+
+ template<typename TInt,bool IsBigEndian>
+ class __DecodeIntHelper<TInt,1,IsBigEndian> {
+ public:
+ inline static TInt Run(const t_uint8* p_in) {return *p_in;}
+ };
+
+ template<typename TInt,bool IsBigEndian>
+ class __DecodeIntHelper<TInt,0,IsBigEndian> {
+ public:
+ inline static TInt Run(const t_uint8*) {return 0;}
+ };
+
+ template<typename TInt>
+ inline void decode_little_endian(TInt & p_out,const t_uint8 * p_buffer) {
+ p_out = __DecodeIntHelper<TInt,sizeof(TInt),false>::Run(p_buffer);
+ }
+
+ template<typename TInt>
+ inline void decode_big_endian(TInt & p_out,const t_uint8 * p_buffer) {
+ p_out = __DecodeIntHelper<TInt,sizeof(TInt),true>::Run(p_buffer + (sizeof(TInt) - 1));
+ }
+
+ template<typename TInt>
+ inline TInt decode_little_endian(const t_uint8 * p_buffer) {
+ TInt temp;
+ decode_little_endian(temp,p_buffer);
+ return temp;
+ }
+
+ template<typename TInt>
+ inline TInt decode_big_endian(const t_uint8 * p_buffer) {
+ TInt temp;
+ decode_big_endian(temp,p_buffer);
+ return temp;
+ }
+
+ template<bool IsBigEndian,typename TInt>
+ inline void decode_endian(TInt & p_out,const t_uint8 * p_buffer) {
+ if (IsBigEndian) decode_big_endian(p_out,p_buffer);
+ else decode_little_endian(p_out,p_buffer);
+ }
+ template<bool IsBigEndian,typename TInt>
+ inline void encode_endian(t_uint8 * p_buffer,TInt p_in) {
+ if (IsBigEndian) encode_big_endian(p_in,p_value);
+ else encode_little_endian(p_in,p_value);
+ }
+
+
+
+ template<unsigned width>
+ inline static void reverse_bytes(t_uint8 * p_buffer) {
+ pfc::swap_t(p_buffer[0],p_buffer[width-1]);
+ reverse_bytes<width-2>(p_buffer+1);
+ }
+
+ template<> inline static void reverse_bytes<1>(t_uint8 * p_buffer) { }
+ template<> inline static void reverse_bytes<0>(t_uint8 * p_buffer) { }
+
+}
+
+
+
+#endif
diff --git a/plugins/ListeningTo/src/players/foo_mlt/pfc/chain_list_v2.h b/plugins/ListeningTo/src/players/foo_mlt/pfc/chain_list_v2.h new file mode 100644 index 0000000000..a6d6b64f76 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/pfc/chain_list_v2.h @@ -0,0 +1,264 @@ +namespace pfc {
+
+ template<typename t_item>
+ class __chain_list_elem : public _list_node<t_item> {
+ public:
+ typedef _list_node<t_item> t_node;
+ TEMPLATE_CONSTRUCTOR_FORWARD_FLOOD_WITH_INITIALIZER(__chain_list_elem,t_node, {m_prev = m_next = NULL;});
+
+ typedef __chain_list_elem<t_item> t_self;
+
+ t_self * m_prev, * m_next;
+
+ t_node * prev() throw() {return m_prev;}
+ t_node * next() throw() {return m_next;}
+
+ //helper wrappers
+ void add_ref() throw() {this->refcount_add_ref();}
+ void release() throw() {this->refcount_release();}
+ //workaround for cross-list-relinking case - never actually deletes p_elem
+ void __release_temporary() throw() {this->_refcount_release_temporary();}
+ };
+
+ //! Differences between chain_list_v2_t<> and old chain_list_t<>: \n
+ //! Iterators pointing to removed items as well as to items belonging to no longer existing list objects remain valid but they're no longer walkable - as if the referenced item was the only item in the list. The old class invalidated iterators on deletion instead.
+ template<typename _t_item>
+ class chain_list_v2_t {
+ public:
+ typedef _t_item t_item;
+ typedef chain_list_v2_t<t_item> t_self;
+ typedef ::pfc::iterator<t_item> iterator;
+ typedef ::pfc::const_iterator<t_item> const_iterator;
+ typedef __chain_list_elem<t_item> t_elem;
+
+ chain_list_v2_t() : m_first(), m_last(), m_count() {}
+ chain_list_v2_t(const t_self & p_source) : m_first(), m_last(), m_count() {
+ try {
+ *this = p_source;
+ } catch(...) {
+ remove_all();
+ throw;
+ }
+ }
+ const t_self & operator=(const t_self & p_other) {
+ remove_all();
+ for(t_elem * walk = p_other.m_first; walk != NULL; walk = walk->m_next) {
+ add_item(walk->m_content);
+ }
+ return *this;
+ }
+
+ t_size get_count() const {return m_count;}
+
+ iterator first() {return iterator(m_first);}
+ iterator last() {return iterator(m_last);}
+ const_iterator first() const {return const_iterator(m_first);}
+ const_iterator last() const {return const_iterator(m_last);}
+
+ void remove_single(const_iterator const & p_iter) {
+ PFC_ASSERT(p_iter.is_valid());
+ __unlink(_elem(p_iter));
+ }
+
+ void remove(const_iterator const & p_iter) {
+ PFC_ASSERT(p_iter.is_valid());
+ __unlink(_elem(p_iter));
+ }
+
+ void remove_all() throw() {
+ while(m_first != NULL) __unlink(m_first);
+ PFC_ASSERT(m_count == 0);
+ }
+ void remove_range(const_iterator const & p_from,const_iterator const & p_to) {
+ for(t_elem * walk = _elem(p_from);;) {
+ if (walk == NULL) {PFC_ASSERT(!"Should not get here"); break;}//should not happen unless there is a bug in calling code
+ t_elem * next = walk->m_next;
+ __unlink(walk);
+ if (walk == _elem(p_to)) break;
+ walk = next;
+ }
+ }
+
+ template<typename t_callback> void enumerate(t_callback & p_callback) const {__enumerate_chain<const t_elem>(m_first,p_callback);}
+ template<typename t_callback> void enumerate(t_callback & p_callback) {__enumerate_chain<t_elem>(m_first,p_callback);}
+
+ template<typename t_source> bool remove_item(const t_source & p_item) {
+ t_elem * elem;
+ if (__find(elem,p_item)) {
+ __unlink(elem);
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ ~chain_list_v2_t() {remove_all();}
+
+ template<typename t_source>
+ inline void add_item(const t_source & p_source) {
+ __link_last(new t_elem(p_source));
+ }
+ template<typename t_source>
+ inline t_self & operator+=(const t_source & p_source) {
+ add_item(p_source); return *this;
+ }
+ iterator insert_last() {return __link_last(new t_elem);}
+ iterator insert_first() {return __link_first(new t_elem);}
+ iterator insert_after(const_iterator const & p_iter) {return __link_next(_elem(p_iter),new t_elem);}
+ iterator insert_before(const_iterator const & p_iter) {return __link_prev(_elem(p_iter),new t_elem);}
+ template<typename t_source> iterator insert_last(const t_source & p_source) {return __link_last(new t_elem(p_source));}
+ template<typename t_source> iterator insert_first(const t_source & p_source) {return __link_first(new t_elem(p_source));}
+ template<typename t_source> iterator insert_after(const_iterator const & p_iter,const t_source & p_source) {return __link_next(_elem(p_iter),new t_elem(p_source));}
+ template<typename t_source> iterator insert_before(const_iterator const & p_iter,const t_source & p_source) {return __link_prev(_elem(p_iter),new t_elem(p_source));}
+
+ template<typename t_source> const_iterator find_item(const t_source & p_item) const {
+ t_elem * elem;
+ if (!__find(elem,p_item)) return const_iterator();
+ return const_iterator(elem);
+ }
+
+ template<typename t_source> iterator find_item(const t_source & p_item) {
+ t_elem * elem;
+ if (!__find(elem,p_item)) return iterator();
+ return iterator(elem);
+ }
+
+ template<typename t_source> bool have_item(const t_source & p_item) const {
+ t_elem * dummy;
+ return __find(dummy,p_item);
+ }
+ template<typename t_source> void set_single(const t_source & p_item) {
+ remove_all(); add_item(p_item);
+ }
+
+ //! Slow!
+ const_iterator by_index(t_size p_index) const {return __by_index(p_index);}
+ //! Slow!
+ iterator by_index(t_size p_index) {return __by_index(p_index);}
+
+ t_self & operator<<(t_self & p_other) {
+ while(p_other.m_first != NULL) {
+ __link_last( p_other.__unlink_temporary(p_other.m_first) );
+ }
+ return *this;
+ }
+ t_self & operator>>(t_self & p_other) {
+ while(m_last != NULL) {
+ p_other.__link_first(__unlink_temporary(m_last));
+ }
+ return p_other;
+ }
+ //! Links an object that has been unlinked from another list. Unsafe.
+ void _link_last(const_iterator const& iter) {
+ PFC_ASSERT(iter.is_valid());
+ PFC_ASSERT( _elem(iter)->m_prev == NULL && _elem(iter)->m_next == NULL );
+ __link_last(_elem(iter));
+ }
+ //! Links an object that has been unlinked from another list. Unsafe.
+ void _link_first(const_iterator const& iter) {
+ PFC_ASSERT(iter.is_valid());
+ PFC_ASSERT( _elem(iter)->m_prev == NULL && _elem(iter)->m_next == NULL );
+ __link_first(_elem(iter));
+ }
+ private:
+ static t_elem * _elem(const_iterator const & iter) {
+ return static_cast<t_elem*>(iter._node());
+ }
+ t_elem * __by_index(t_size p_index) const {
+ t_elem * walk = m_first;
+ while(p_index > 0 && walk != NULL) {
+ p_index--;
+ walk = walk->m_next;
+ }
+ return walk;
+ }
+ template<typename t_elemwalk,typename t_callback>
+ static void __enumerate_chain(t_elemwalk * p_elem,t_callback & p_callback) {
+ t_elemwalk * walk = p_elem;
+ while(walk != NULL) {
+ p_callback(walk->m_content);
+ walk = walk->m_next;
+ }
+ }
+
+ template<typename t_source> bool __find(t_elem * & p_elem,const t_source & p_item) const {
+ for(t_elem * walk = m_first; walk != NULL; walk = walk->m_next) {
+ if (walk->m_content == p_item) {
+ p_elem = walk; return true;
+ }
+ }
+ return false;
+ }
+
+ void __unlink_helper(t_elem * p_elem) throw() {
+ (p_elem->m_prev == NULL ? m_first : p_elem->m_prev->m_next) = p_elem->m_next;
+ (p_elem->m_next == NULL ? m_last : p_elem->m_next->m_prev) = p_elem->m_prev;
+ p_elem->m_next = p_elem->m_prev = NULL;
+ }
+
+ //workaround for cross-list-relinking case - never actually deletes p_elem
+ t_elem * __unlink_temporary(t_elem * p_elem) throw() {
+ __unlink_helper(p_elem);
+ --m_count; p_elem->__release_temporary();
+ return p_elem;
+ }
+
+ t_elem * __unlink(t_elem * p_elem) throw() {
+ __unlink_helper(p_elem);
+ --m_count; p_elem->release();
+ return p_elem;
+ }
+ void __on_link(t_elem * p_elem) throw() {
+ p_elem->add_ref(); ++m_count;
+ }
+ t_elem * __link_first(t_elem * p_elem) throw() {
+ __on_link(p_elem);
+ p_elem->m_next = m_first;
+ p_elem->m_prev = NULL;
+ (m_first == NULL ? m_last : m_first->m_prev) = p_elem;
+ m_first = p_elem;
+ return p_elem;
+ }
+ t_elem * __link_last(t_elem * p_elem) throw() {
+ __on_link(p_elem);
+ p_elem->m_prev = m_last;
+ p_elem->m_next = NULL;
+ (m_last == NULL ? m_first : m_last->m_next) = p_elem;
+ m_last = p_elem;
+ return p_elem;
+ }
+ t_elem * __link_next(t_elem * p_prev,t_elem * p_elem) throw() {
+ __on_link(p_elem);
+ p_elem->m_prev = p_prev;
+ p_elem->m_next = p_prev->m_next;
+ (p_prev->m_next != NULL ? p_prev->m_next->m_prev : m_last) = p_elem;
+ p_prev->m_next = p_elem;
+ return p_elem;
+ }
+ t_elem * __link_prev(t_elem * p_next,t_elem * p_elem) throw() {
+ __on_link(p_elem);
+ p_elem->m_next = p_next;
+ p_elem->m_prev = p_next->m_prev;
+ (p_next->m_prev != NULL ? p_next->m_prev->m_next : m_first) = p_elem;
+ p_next->m_prev = p_elem;
+ return p_elem;
+ }
+ t_elem * m_first, * m_last;
+ t_size m_count;
+ };
+
+
+ template<typename t_item> class traits_t<chain_list_v2_t<t_item> > : public traits_default_movable {};
+
+ class __chain_list_iterator_traits : public traits_default_movable {
+ public:
+ enum {
+ constructor_may_fail = false
+ };
+ };
+
+ template<typename t_item> class traits_t<const_iterator<t_item> > : public traits_t<refcounted_object_ptr_t<_list_node<t_item> > > {};
+
+ template<typename t_item> class traits_t<iterator<t_item> > : public traits_t<const_iterator<t_item> > {};
+
+}//namespace pfc
diff --git a/plugins/ListeningTo/src/players/foo_mlt/pfc/com_ptr_t.h b/plugins/ListeningTo/src/players/foo_mlt/pfc/com_ptr_t.h new file mode 100644 index 0000000000..3f5d279ade --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/pfc/com_ptr_t.h @@ -0,0 +1,82 @@ +#ifdef _WIN32
+namespace pfc {
+
+ template<typename what> static void _COM_AddRef(what * ptr) {
+ if (ptr != NULL) ptr->AddRef();
+ }
+ template<typename what> static void _COM_Release(what * ptr) {
+ if (ptr != NULL) ptr->Release();
+ }
+
+ template<class T>
+ class com_ptr_t {
+ public:
+ typedef com_ptr_t<T> t_self;
+
+ inline com_ptr_t() throw() : m_ptr() {}
+ template<typename source> inline com_ptr_t(source * p_ptr) throw() : m_ptr(p_ptr) {_COM_AddRef(m_ptr);}
+ inline com_ptr_t(const t_self & p_source) throw() : m_ptr(p_source.m_ptr) {_COM_AddRef(m_ptr);}
+ template<typename source> inline com_ptr_t(const com_ptr_t<source> & p_source) throw() : m_ptr(p_source.get_ptr()) {_COM_AddRef(m_ptr);}
+
+ inline ~com_ptr_t() throw() {_COM_Release(m_ptr);}
+
+ inline void copy(T * p_ptr) throw() {
+ _COM_Release(m_ptr);
+ m_ptr = p_ptr;
+ _COM_AddRef(m_ptr);
+ }
+
+ template<typename source> inline void copy(const com_ptr_t<source> & p_source) throw() {copy(p_source.get_ptr());}
+
+ inline void attach(T * p_ptr) throw() {
+ _COM_Release(m_ptr);
+ m_ptr = p_ptr;
+ }
+
+ inline const t_self & operator=(const t_self & p_source) throw() {copy(p_source); return *this;}
+ inline const t_self & operator=(T* p_source) throw() {copy(p_source); return *this;}
+ template<typename source> inline const t_self & operator=(const com_ptr_t<source> & p_source) throw() {copy(p_source); return *this;}
+ template<typename source> inline const t_self & operator=(source * p_ptr) throw() {copy(p_ptr); return *this;}
+
+ inline void release() throw() {
+ _COM_Release(m_ptr);
+ m_ptr = NULL;
+ }
+
+
+ inline T* operator->() const throw() {assert(m_ptr);return m_ptr;}
+
+ inline T* get_ptr() const throw() {return m_ptr;}
+
+ inline T* duplicate_ptr() const throw() //should not be used ! temporary !
+ {
+ _COM_AddRef(m_ptr);
+ return m_ptr;
+ }
+
+ inline T* detach() throw() {
+ return replace_null_t(m_ptr);
+ }
+
+ inline bool is_valid() const throw() {return m_ptr != 0;}
+ inline bool is_empty() const throw() {return m_ptr == 0;}
+
+ inline bool operator==(const com_ptr_t<T> & p_item) const throw() {return m_ptr == p_item.m_ptr;}
+ inline bool operator!=(const com_ptr_t<T> & p_item) const throw() {return m_ptr != p_item.m_ptr;}
+ inline bool operator>(const com_ptr_t<T> & p_item) const throw() {return m_ptr > p_item.m_ptr;}
+ inline bool operator<(const com_ptr_t<T> & p_item) const throw() {return m_ptr < p_item.m_ptr;}
+
+ inline static void g_swap(com_ptr_t<T> & item1, com_ptr_t<T> & item2) throw() {
+ pfc::swap_t(item1.m_ptr,item2.m_ptr);
+ }
+
+ inline T** receive_ptr() throw() {release();return &m_ptr;}
+
+ inline t_self & operator<<(t_self & p_source) throw() {attach(p_source.detach());return *this;}
+ inline t_self & operator>>(t_self & p_dest) throw() {p_dest.attach(detach());return *this;}
+ private:
+ T* m_ptr;
+ };
+
+}
+#endif
diff --git a/plugins/ListeningTo/src/players/foo_mlt/pfc/guid.cpp b/plugins/ListeningTo/src/players/foo_mlt/pfc/guid.cpp new file mode 100644 index 0000000000..c90a9eac08 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/pfc/guid.cpp @@ -0,0 +1,144 @@ +#include "pfc.h"
+
+namespace pfc {
+/*
+6B29FC40-CA47-1067-B31D-00DD010662DA
+.
+typedef struct _GUID { // size is 16
+ DWORD Data1;
+ WORD Data2;
+ WORD Data3;
+ BYTE Data4[8];
+} GUID;
+
+// {B296CF59-4D51-466f-8E0B-E57D3F91D908}
+static const GUID <<name>> =
+{ 0xb296cf59, 0x4d51, 0x466f, { 0x8e, 0xb, 0xe5, 0x7d, 0x3f, 0x91, 0xd9, 0x8 } };
+
+*/
+
+unsigned GUID_from_text::read_hex(char c)
+{
+ if (c>='0' && c<='9') return (unsigned)c - '0';
+ else if (c>='a' && c<='f') return 0xa + (unsigned)c - 'a';
+ else if (c>='A' && c<='F') return 0xa + (unsigned)c - 'A';
+ else return 0;
+}
+
+unsigned GUID_from_text::read_byte(const char * ptr)
+{
+ return (read_hex(ptr[0])<<4) | read_hex(ptr[1]);
+}
+unsigned GUID_from_text::read_word(const char * ptr)
+{
+ return (read_byte(ptr)<<8) | read_byte(ptr+2);
+}
+
+unsigned GUID_from_text::read_dword(const char * ptr)
+{
+ return (read_word(ptr)<<16) | read_word(ptr+4);
+}
+
+void GUID_from_text::read_bytes(BYTE * out,unsigned num,const char * ptr)
+{
+ for (;num;num--)
+ {
+ *out = read_byte(ptr);
+ out++;ptr+=2;
+ }
+}
+
+
+GUID_from_text::GUID_from_text(const char * text)
+{
+ if (*text=='{') text++;
+ const char * max;
+
+ {
+ const char * t = strchr(text,'}');
+ if (t) max = t;
+ else max = text + strlen(text);
+ }
+
+ (GUID)*this = pfc::guid_null;
+
+
+ do {
+ if (text+8>max) break;
+ Data1 = read_dword(text);
+ text += 8;
+ while(*text=='-') text++;
+ if (text+4>max) break;
+ Data2 = read_word(text);
+ text += 4;
+ while(*text=='-') text++;
+ if (text+4>max) break;
+ Data3 = read_word(text);
+ text += 4;
+ while(*text=='-') text++;
+ if (text+4>max) break;
+ read_bytes(Data4,2,text);
+ text += 4;
+ while(*text=='-') text++;
+ if (text+12>max) break;
+ read_bytes(Data4+2,6,text);
+ } while(false);
+}
+
+
+static inline char print_hex_digit(unsigned val)
+{
+ static const char table[16] = {'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};
+ assert((val & ~0xF) == 0);
+ return table[val];
+}
+
+static void print_hex(unsigned val,char * &out,unsigned bytes)
+{
+ unsigned n;
+ for(n=0;n<bytes;n++)
+ {
+ unsigned char c = (unsigned char)((val >> ((bytes - 1 - n) << 3)) & 0xFF);
+ *(out++) = print_hex_digit( c >> 4 );
+ *(out++) = print_hex_digit( c & 0xF );
+ }
+ *out = 0;
+}
+
+
+print_guid::print_guid(const GUID & p_guid)
+{
+ char * out = m_data;
+ print_hex(p_guid.Data1,out,4);
+ *(out++) = '-';
+ print_hex(p_guid.Data2,out,2);
+ *(out++) = '-';
+ print_hex(p_guid.Data3,out,2);
+ *(out++) = '-';
+ print_hex(p_guid.Data4[0],out,1);
+ print_hex(p_guid.Data4[1],out,1);
+ *(out++) = '-';
+ print_hex(p_guid.Data4[2],out,1);
+ print_hex(p_guid.Data4[3],out,1);
+ print_hex(p_guid.Data4[4],out,1);
+ print_hex(p_guid.Data4[5],out,1);
+ print_hex(p_guid.Data4[6],out,1);
+ print_hex(p_guid.Data4[7],out,1);
+ *out = 0;
+}
+
+
+void print_hex_raw(const void * buffer,unsigned bytes,char * p_out)
+{
+ char * out = p_out;
+ const unsigned char * in = (const unsigned char *) buffer;
+ unsigned n;
+ for(n=0;n<bytes;n++)
+ print_hex(in[n],out,1);
+}
+
+}
+
+
+
+const GUID pfc::guid_null = { 0, 0, 0, { 0, 0, 0, 0, 0, 0, 0, 0 } };
\ No newline at end of file diff --git a/plugins/ListeningTo/src/players/foo_mlt/pfc/guid.h b/plugins/ListeningTo/src/players/foo_mlt/pfc/guid.h new file mode 100644 index 0000000000..9a090955f3 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/pfc/guid.h @@ -0,0 +1,58 @@ +#ifndef _PFC_GUID_H_
+#define _PFC_GUID_H_
+
+namespace pfc {
+
+ class GUID_from_text : public GUID
+ {
+ unsigned read_hex(char c);
+ unsigned read_byte(const char * ptr);
+ unsigned read_word(const char * ptr);
+ unsigned read_dword(const char * ptr);
+ void read_bytes(unsigned char * out,unsigned num,const char * ptr);
+
+ public:
+ GUID_from_text(const char * text);
+ };
+
+ class print_guid
+ {
+ public:
+ print_guid(const GUID & p_guid);
+ inline operator const char * () const {return m_data;}
+ inline const char * get_ptr() {return m_data;}
+ private:
+ char m_data[64];
+ };
+
+ inline int guid_compare(const GUID & g1,const GUID & g2) {return memcmp(&g1,&g2,sizeof(GUID));}
+
+ inline bool guid_equal(const GUID & g1,const GUID & g2) {return (g1 == g2) ? true : false;}
+ template<> inline int compare_t<GUID,GUID>(const GUID & p_item1,const GUID & p_item2) {return guid_compare(p_item1,p_item2);}
+
+ extern const GUID guid_null;
+
+ void print_hex_raw(const void * buffer,unsigned bytes,char * p_out);
+
+ static GUID makeGUID(t_uint32 Data1, t_uint16 Data2, t_uint16 Data3, t_uint8 Data4_1, t_uint8 Data4_2, t_uint8 Data4_3, t_uint8 Data4_4, t_uint8 Data4_5, t_uint8 Data4_6, t_uint8 Data4_7, t_uint8 Data4_8) {
+ GUID guid = { Data1, Data2, Data3, {Data4_1, Data4_2, Data4_3, Data4_4, Data4_5, Data4_6, Data4_7, Data4_8 } };
+ return guid;
+ }
+ static GUID xorGUID(const GUID & v1, const GUID & v2) {
+ GUID temp; memxor(&temp, &v1, &v1, sizeof(GUID)); return temp;
+ }
+
+ class format_guid_cpp : public pfc::string_formatter {
+ public:
+ format_guid_cpp(const GUID & guid) {
+ *this << "{0x" << pfc::format_hex(guid.Data1,8) << ", 0x" << pfc::format_hex(guid.Data2, 4) << ", 0x" << pfc::format_hex(guid.Data3,4) << ", {0x" << pfc::format_hex(guid.Data4[0],2);
+ for(int n = 1; n < 8; ++n) {
+ *this << ", 0x" << pfc::format_hex(guid.Data4[n],2);
+ }
+ *this << "}}";
+ }
+ };
+}
+
+
+#endif
diff --git a/plugins/ListeningTo/src/players/foo_mlt/pfc/instance_tracker.h b/plugins/ListeningTo/src/players/foo_mlt/pfc/instance_tracker.h new file mode 100644 index 0000000000..fb3bb3b996 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/pfc/instance_tracker.h @@ -0,0 +1,49 @@ +namespace pfc {
+ template<typename t_object>
+ class instance_tracker_server_t {
+ public:
+ void add(t_object * p_object) {
+ m_list.add_item(p_object);
+ }
+ void remove(t_object * p_object) {
+ m_list.remove_item(p_object);
+ }
+
+ t_size get_count() const {return m_list.get_count();}
+ t_object * get_item(t_size p_index) {return m_list[p_index];}
+ t_object * operator[](t_size p_index) {return m_list[p_index];}
+
+ private:
+ ptr_list_hybrid_t<t_object,4> m_list;
+ };
+
+
+ template<typename t_object,instance_tracker_server_t<t_object> & p_server>
+ class instance_tracker_client_t {
+ public:
+ instance_tracker_client_t(t_object* p_ptr) : m_ptr(NULL), m_added(false) {initialize(p_ptr);}
+ instance_tracker_client_t() : m_ptr(NULL), m_added(false) {}
+
+ void initialize(t_object * p_ptr) {
+ uninitialize();
+ p_server.add(p_ptr);
+ m_ptr = p_ptr;
+ m_added = true;
+ }
+
+ void uninitialize() {
+ if (m_added) {
+ p_server.remove(m_ptr);
+ m_ptr = NULL;
+ m_added = false;
+ }
+ }
+
+ ~instance_tracker_client_t() {
+ uninitialize();
+ }
+ private:
+ bool m_added;
+ t_object * m_ptr;
+ };
+}
\ No newline at end of file diff --git a/plugins/ListeningTo/src/players/foo_mlt/pfc/int_types.h b/plugins/ListeningTo/src/players/foo_mlt/pfc/int_types.h new file mode 100644 index 0000000000..219f5c4668 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/pfc/int_types.h @@ -0,0 +1,120 @@ +#if !defined(_MSC_VER) && !defined(_EVC_VER)
+#include <stdint.h>
+typedef int64_t t_int64;
+typedef uint64_t t_uint64;
+typedef int32_t t_int32;
+typedef uint32_t t_uint32;
+typedef int16_t t_int16;
+typedef uint16_t t_uint16;
+typedef int8_t t_int8;
+typedef uint8_t t_uint8;
+#else
+typedef __int64 t_int64;
+typedef unsigned __int64 t_uint64;
+typedef __int32 t_int32;
+typedef unsigned __int32 t_uint32;
+typedef __int16 t_int16;
+typedef unsigned __int16 t_uint16;
+typedef __int8 t_int8;
+typedef unsigned __int8 t_uint8;
+#endif
+
+typedef int t_int;
+typedef unsigned int t_uint;
+
+typedef float t_float32;
+typedef double t_float64;
+
+
+
+#if defined(_WIN32) && !defined(_WIN64)
+#define __PFC_WP64 __w64
+#else
+#define __PFC_WP64
+#endif
+
+
+namespace pfc {
+ template<unsigned t_bytes>
+ class sized_int_t;
+
+ template<> class sized_int_t<1> {
+ public:
+ typedef t_uint8 t_unsigned;
+ typedef t_int8 t_signed;
+ };
+
+ template<> class sized_int_t<2> {
+ public:
+ typedef t_uint16 t_unsigned;
+ typedef t_int16 t_signed;
+ };
+
+ template<> class sized_int_t<4> {
+ public:
+ typedef t_uint32 t_unsigned;
+ typedef t_int32 t_signed;
+ };
+
+ template<> class sized_int_t<8> {
+ public:
+ typedef t_uint64 t_unsigned;
+ typedef t_int64 t_signed;
+ };
+}
+
+
+typedef pfc::sized_int_t<sizeof(void*)>::t_unsigned __PFC_WP64 t_size;
+typedef pfc::sized_int_t<sizeof(void*)>::t_signed __PFC_WP64 t_ssize;
+
+
+
+
+#if defined(_WIN32) && !defined(_WIN64)
+inline t_size MulDiv_Size(t_size x,t_size y,t_size z) {return (t_size) ( ((t_uint64)x * (t_uint64)y) / (t_uint64)z );}
+#elif defined(_WIN64)
+inline t_size MulDiv_Size(t_size x,t_size y,t_size z) {return (x*y)/z;}
+#else
+#error portme
+#endif
+
+#define pfc_infinite (~0)
+
+namespace pfc {
+ const t_uint16 infinite16 = (t_uint16)(~0);
+ const t_uint32 infinite32 = (t_uint32)(~0);
+ const t_uint64 infinite64 = (t_uint64)(~0);
+ const t_size infinite_size = (t_size)(~0);
+
+ template<typename T> class int_specs_t;
+
+ template<typename T>
+ class int_specs_signed_t {
+ public:
+ inline static T get_min() {return ((T)1<<(sizeof(T)*8-1));}
+ inline static T get_max() {return ~((T)1<<(sizeof(T)*8-1));}
+ enum {is_signed = true};
+ };
+
+ template<typename T>
+ class int_specs_unsigned_t {
+ public:
+ inline static T get_min() {return (T)0;}
+ inline static T get_max() {return (T)~0;}
+ enum {is_signed = false};
+ };
+
+ template<> class int_specs_t<char> : public int_specs_signed_t<char> {};
+ template<> class int_specs_t<unsigned char> : public int_specs_unsigned_t<unsigned char> {};
+ template<> class int_specs_t<short> : public int_specs_signed_t<short> {};
+ template<> class int_specs_t<unsigned short> : public int_specs_unsigned_t<unsigned short> {};
+ template<> class int_specs_t<int> : public int_specs_signed_t<int> {};
+ template<> class int_specs_t<unsigned int> : public int_specs_unsigned_t<unsigned int> {};
+ template<> class int_specs_t<long> : public int_specs_signed_t<long> {};
+ template<> class int_specs_t<unsigned long> : public int_specs_unsigned_t<unsigned long> {};
+ template<> class int_specs_t<long long> : public int_specs_signed_t<long long> {};
+ template<> class int_specs_t<unsigned long long> : public int_specs_unsigned_t<unsigned long long> {};
+
+ template<> class int_specs_t<wchar_t> : public int_specs_unsigned_t<wchar_t> {};
+
+};
diff --git a/plugins/ListeningTo/src/players/foo_mlt/pfc/iterators.h b/plugins/ListeningTo/src/players/foo_mlt/pfc/iterators.h new file mode 100644 index 0000000000..bc68c65f41 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/pfc/iterators.h @@ -0,0 +1,113 @@ +namespace pfc {
+ //! Base class for list nodes. Implemented by list implementers.
+ template<typename t_item> class _list_node : public refcounted_object_root {
+ public:
+ typedef _list_node<t_item> t_self;
+
+ TEMPLATE_CONSTRUCTOR_FORWARD_FLOOD(_list_node,m_content)
+
+ t_item m_content;
+
+ virtual t_self * prev() throw() {return NULL;}
+ virtual t_self * next() throw() {return NULL;}
+
+ t_self * walk(bool forward) throw() {return forward ? next() : prev();}
+ };
+
+ template<typename t_item> class const_iterator {
+ public:
+ typedef _list_node<t_item> t_node;
+ typedef refcounted_object_ptr_t<t_node> t_nodeptr;
+ typedef const_iterator<t_item> t_self;
+
+ bool is_empty() const throw() {return m_content.is_empty();}
+ bool is_valid() const throw() {return m_content.is_valid();}
+ void invalidate() throw() {m_content = NULL;}
+
+ void walk(bool forward) throw() {m_content = m_content->walk(forward);}
+ void prev() throw() {m_content = m_content->prev();}
+ void next() throw() {m_content = m_content->next();}
+
+ //! For internal use / list implementations only! Do not call!
+ t_node* _node() const throw() {return m_content.get_ptr();}
+
+ const_iterator() {}
+ const_iterator(t_node* source) : m_content(source) {}
+ const_iterator(t_nodeptr const & source) : m_content(source) {}
+
+ const t_item& operator*() const throw() {return m_content->m_content;}
+ const t_item* operator->() const throw() {return &m_content->m_content;}
+
+ const t_self & operator++() throw() {this->next(); return *this;}
+ const t_self & operator--() throw() {this->prev(); return *this;}
+ t_self operator++(int) throw() {t_self old = *this; this->next(); return old;}
+ t_self operator--(int) throw() {t_self old = *this; this->prev(); return old;}
+
+ bool operator==(const t_self & other) const throw() {return this->m_content == other.m_content;}
+ bool operator!=(const t_self & other) const throw() {return this->m_content != other.m_content;}
+ bool operator> (const t_self & other) const throw() {return this->m_content > other.m_content;}
+ bool operator< (const t_self & other) const throw() {return this->m_content < other.m_content;}
+ bool operator>=(const t_self & other) const throw() {return this->m_content >= other.m_content;}
+ bool operator<=(const t_self & other) const throw() {return this->m_content <= other.m_content;}
+ protected:
+ t_nodeptr m_content;
+ };
+ template<typename t_item> class iterator : public const_iterator<t_item> {
+ public:
+ typedef const_iterator<t_item> t_selfConst;
+ typedef iterator<t_item> t_self;
+ typedef _list_node<t_item> t_node;
+ typedef refcounted_object_ptr_t<t_node> t_nodeptr;
+
+ iterator() {}
+ iterator(t_node* source) : t_selfConst(source) {}
+ iterator(t_nodeptr const & source) : t_selfConst(source) {}
+
+ t_item& operator*() const throw() {return this->m_content->m_content;}
+ t_item* operator->() const throw() {return &this->m_content->m_content;}
+
+ const t_self & operator++() throw() {this->next(); return *this;}
+ const t_self & operator--() throw() {this->prev(); return *this;}
+ t_self operator++(int) throw() {t_self old = *this; this->next(); return old;}
+ t_self operator--(int) throw() {t_self old = *this; this->prev(); return old;}
+
+ bool operator==(const t_self & other) const throw() {return this->m_content == other.m_content;}
+ bool operator!=(const t_self & other) const throw() {return this->m_content != other.m_content;}
+ bool operator> (const t_self & other) const throw() {return this->m_content > other.m_content;}
+ bool operator< (const t_self & other) const throw() {return this->m_content < other.m_content;}
+ bool operator>=(const t_self & other) const throw() {return this->m_content >= other.m_content;}
+ bool operator<=(const t_self & other) const throw() {return this->m_content <= other.m_content;}
+ };
+
+ template<typename t_comparator = comparator_default>
+ class comparator_list {
+ public:
+ template<typename t_list1, typename t_list2>
+ static int compare(const t_list1 & p_list1, const t_list2 p_list2) {
+ typename t_list1::const_iterator iter1 = p_list1.first();
+ typename t_list2::const_iterator iter2 = p_list2.first();
+ for (;;) {
+ if (iter1.is_empty() && iter2.is_empty()) return 0;
+ else if (iter1.is_empty()) return -1;
+ else if (iter2.is_empty()) return 1;
+ else {
+ int state = t_comparator::compare(*iter1,*iter2);
+ if (state != 0) return state;
+ }
+ ++iter1; ++iter2;
+ }
+ }
+ };
+
+ template<typename t_list1, typename t_list2>
+ static bool listEquals(const t_list1 & p_list1, const t_list2 & p_list2) {
+ typename t_list1::const_iterator iter1 = p_list1.first();
+ typename t_list2::const_iterator iter2 = p_list2.first();
+ for (;;) {
+ if (iter1.is_empty() && iter2.is_empty()) return true;
+ else if (iter1.is_empty() || iter2.is_empty()) return false;
+ else if (*iter1 != *iter2) return false;
+ ++iter1; ++iter2;
+ }
+ }
+}
diff --git a/plugins/ListeningTo/src/players/foo_mlt/pfc/license.txt b/plugins/ListeningTo/src/players/foo_mlt/pfc/license.txt new file mode 100644 index 0000000000..51ebcad261 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/pfc/license.txt @@ -0,0 +1,10 @@ +Copyright (c) 2001-2010, Peter Pawlowski
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/plugins/ListeningTo/src/players/foo_mlt/pfc/list.h b/plugins/ListeningTo/src/players/foo_mlt/pfc/list.h new file mode 100644 index 0000000000..c503f53d2a --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/pfc/list.h @@ -0,0 +1,629 @@ +#ifndef _PFC_LIST_H_
+#define _PFC_LIST_H_
+
+namespace pfc {
+
+template<typename T>
+class NOVTABLE list_base_const_t {
+private: typedef list_base_const_t<T> t_self;
+public:
+ typedef T t_item;
+ virtual t_size get_count() const = 0;
+ virtual void get_item_ex(T& p_out, t_size n) const = 0;
+
+ inline t_size get_size() const {return get_count();}
+
+ inline T get_item(t_size n) const {T temp; get_item_ex(temp,n); return temp;}
+ inline T operator[](t_size n) const {T temp; get_item_ex(temp,n); return temp;}
+
+ template<typename t_compare>
+ t_size find_duplicates_sorted_t(t_compare p_compare,bit_array_var & p_out) const
+ {
+ return pfc::find_duplicates_sorted_t<list_base_const_t<T> const &,t_compare>(*this,get_count(),p_compare,p_out);
+ }
+
+ template<typename t_compare,typename t_permutation>
+ t_size find_duplicates_sorted_permutation_t(t_compare p_compare,t_permutation const & p_permutation,bit_array_var & p_out)
+ {
+ return pfc::find_duplicates_sorted_permutation_t<list_base_const_t<T> const &,t_compare,t_permutation>(*this,get_count(),p_compare,p_permutation,p_out);
+ }
+
+ template<typename t_search>
+ t_size find_item(const t_search & p_item) const//returns index of first occurance, infinite if not found
+ {
+ t_size n,max = get_count();
+ for(n=0;n<max;n++)
+ if (get_item(n)==p_item) return n;
+ return ~0;
+ }
+
+ template<typename t_search>
+ inline bool have_item(const t_search & p_item) const {return find_item<t_search>(p_item)!=~0;}
+
+
+ template<typename t_compare, typename t_param>
+ bool bsearch_t(t_compare p_compare,t_param const & p_param,t_size &p_index) const {
+ return pfc::bsearch_t(get_count(),*this,p_compare,p_param,p_index);
+ }
+
+ template<typename t_compare,typename t_param,typename t_permutation>
+ bool bsearch_permutation_t(t_compare p_compare,t_param const & p_param,const t_permutation & p_permutation,t_size & p_index) const {
+ return pfc::bsearch_permutation_t(get_count(),*this,p_compare,p_param,p_permutation,p_index);
+ }
+
+ template<typename t_compare,typename t_permutation>
+ void sort_get_permutation_t(t_compare p_compare,t_permutation const & p_permutation) const {
+ pfc::sort_get_permutation_t<list_base_const_t<T>,t_compare,t_permutation>(*this,p_compare,get_count(),p_permutation);
+ }
+
+ template<typename t_compare,typename t_permutation>
+ void sort_stable_get_permutation_t(t_compare p_compare,t_permutation const & p_permutation) const {
+ pfc::sort_stable_get_permutation_t<list_base_const_t<T>,t_compare,t_permutation>(*this,p_compare,get_count(),p_permutation);
+ }
+
+ template<typename t_callback>
+ void enumerate(t_callback & p_callback) const {
+ for(t_size n = 0, m = get_count(); n < m; ++n ) {
+ p_callback( (*this)[n] );
+ }
+ }
+
+ static bool g_equals(const t_self & item1, const t_self & item2) {
+ const t_size count = item1.get_count();
+ if (count != item2.get_count()) return false;
+ for(t_size walk = 0; walk < count; ++walk) if (item1[walk] != item2[walk]) return false;
+ return true;
+ }
+ bool operator==(const t_self & item2) const {return g_equals(*this,item2);}
+ bool operator!=(const t_self & item2) const {return !g_equals(*this,item2);}
+
+protected:
+ list_base_const_t() {}
+ ~list_base_const_t() {}
+private:
+ const t_self & operator=(const t_self &) {throw pfc::exception_not_implemented();}
+};
+
+
+template<typename T>
+class list_single_ref_t : public list_base_const_t<T>
+{
+public:
+ list_single_ref_t(const T & p_item,t_size p_count = 1) : m_item(p_item), m_count(p_count) {}
+ t_size get_count() const {return m_count;}
+ void get_item_ex(T& p_out,t_size n) const {PFC_ASSERT(n<m_count); p_out = m_item;}
+private:
+ const T & m_item;
+ t_size m_count;
+};
+
+template<typename T>
+class list_partial_ref_t : public list_base_const_t<T>
+{
+public:
+ list_partial_ref_t(const list_base_const_t<T> & p_list,t_size p_base,t_size p_count)
+ : m_list(p_list), m_base(p_base), m_count(p_count)
+ {
+ PFC_ASSERT(m_base + m_count <= m_list.get_count());
+ }
+
+private:
+ const list_base_const_t<T> & m_list;
+ t_size m_base,m_count;
+
+ t_size get_count() const {return m_count;}
+ void get_item_ex(T & p_out,t_size n) const {m_list.get_item_ex(p_out,n+m_base);}
+};
+
+template<typename T,typename A>
+class list_const_array_t : public list_base_const_t<T>
+{
+public:
+ inline list_const_array_t(A p_data,t_size p_count) : m_data(p_data), m_count(p_count) {}
+ t_size get_count() const {return m_count;}
+ void get_item_ex(T & p_out,t_size n) const {p_out = m_data[n];}
+private:
+ A m_data;
+ t_size m_count;
+};
+template<typename t_array>
+class list_const_array_ref_t : public list_base_const_t<typename t_array::t_item> {
+public:
+ list_const_array_ref_t(const t_array & data) : m_data(data) {}
+ t_size get_count() const {return m_data.get_size();}
+ void get_item_ex(typename t_array::t_item & out, t_size n) const {out = m_data[n];}
+private:
+ const t_array & m_data;
+};
+
+template<typename to,typename from>
+class list_const_cast_t : public list_base_const_t<to>
+{
+public:
+ list_const_cast_t(const list_base_const_t<from> & p_from) : m_from(p_from) {}
+ t_size get_count() const {return m_from.get_count();}
+ void get_item_ex(to & p_out,t_size n) const
+ {
+ from temp;
+ m_from.get_item_ex(temp,n);
+ p_out = temp;
+ }
+private:
+ const list_base_const_t<from> & m_from;
+};
+
+template<typename T,typename A>
+class ptr_list_const_array_t : public list_base_const_t<T*>
+{
+public:
+ inline ptr_list_const_array_t(A p_data,t_size p_count) : m_data(p_data), m_count(p_count) {}
+ t_size get_count() const {return m_count;}
+ void get_item_ex(T* & p_out,t_size n) const {p_out = &m_data[n];}
+private:
+ A m_data;
+ t_size m_count;
+};
+template<typename T>
+class list_const_ptr_t : public list_base_const_t<T>
+{
+public:
+ inline list_const_ptr_t(const T * p_data,t_size p_count) : m_data(p_data), m_count(p_count) {}
+ t_size get_count() const {return m_count;}
+ void get_item_ex(T & p_out,t_size n) const {p_out = m_data[n];}
+private:
+ const T * m_data;
+ t_size m_count;
+};
+
+template<typename T>
+class NOVTABLE list_base_t : public list_base_const_t<T> {
+private:
+ typedef list_base_t<T> t_self;
+ typedef const list_base_const_t<T> t_self_const;
+public:
+ class NOVTABLE sort_callback
+ {
+ public:
+ virtual int compare(const T& p_item1,const T& p_item2) = 0;
+ };
+
+ virtual void filter_mask(const bit_array & mask) = 0;
+ virtual t_size insert_items(const list_base_const_t<T> & items,t_size base) = 0;
+ virtual void reorder_partial(t_size p_base,const t_size * p_data,t_size p_count) = 0;
+ virtual void sort(sort_callback & p_callback) = 0;
+ virtual void sort_stable(sort_callback & p_callback) = 0;
+ virtual void replace_item(t_size p_index,const T& p_item) = 0;
+ virtual void swap_item_with(t_size p_index,T & p_item) = 0;
+ virtual void swap_items(t_size p_index1,t_size p_index2) = 0;
+
+ inline void reorder(const t_size * p_data) {reorder_partial(0,p_data,this->get_count());}
+
+ inline t_size insert_item(const T & item,t_size base) {return insert_items(list_single_ref_t<T>(item),base);}
+ t_size insert_items_repeat(const T & item,t_size num,t_size base) {return insert_items(list_single_ref_t<T>(item,num),base);}
+ inline t_size add_items_repeat(T item,t_size num) {return insert_items_repeat(item,num,~0);}
+ t_size insert_items_fromptr(const T* source,t_size num,t_size base) {return insert_items(list_const_ptr_t<T>(source,num),base);}
+ inline t_size add_items_fromptr(const T* source,t_size num) {return insert_items_fromptr(source,num,~0);}
+
+ inline t_size add_items(const list_base_const_t<T> & items) {return insert_items(items,~0);}
+ inline t_size add_item(const T& item) {return insert_item(item,~0);}
+
+ inline void remove_mask(const bit_array & mask) {filter_mask(bit_array_not(mask));}
+ inline void remove_all() {filter_mask(bit_array_false());}
+ inline void truncate(t_size val) {if (val < this->get_count()) remove_mask(bit_array_range(val,this->get_count()-val,true));}
+
+ inline T replace_item_ex(t_size p_index,const T & p_item) {T ret = p_item;swap_item_with(p_index,ret);return ret;}
+
+ inline T operator[](t_size n) const {return this->get_item(n);}
+
+ template<typename t_compare>
+ class sort_callback_impl_t : public sort_callback
+ {
+ public:
+ sort_callback_impl_t(t_compare p_compare) : m_compare(p_compare) {}
+ int compare(const T& p_item1,const T& p_item2) {return m_compare(p_item1,p_item2);}
+ private:
+ t_compare m_compare;
+ };
+
+ class sort_callback_auto : public sort_callback
+ {
+ public:
+ int compare(const T& p_item1,const T& p_item2) {return pfc::compare_t(p_item1,p_item2);}
+ };
+
+ void sort() {sort(sort_callback_auto());}
+ template<typename t_compare> void sort_t(t_compare p_compare) {sort(sort_callback_impl_t<t_compare>(p_compare));}
+ template<typename t_compare> void sort_stable_t(t_compare p_compare) {sort_stable(sort_callback_impl_t<t_compare>(p_compare));}
+
+ template<typename t_compare> void sort_remove_duplicates_t(t_compare p_compare)
+ {
+ sort_t<t_compare>(p_compare);
+ bit_array_bittable array(this->get_count());
+ if (this->template find_duplicates_sorted_t<t_compare>(p_compare,array) > 0)
+ remove_mask(array);
+ }
+
+ template<typename t_compare> void sort_stable_remove_duplicates_t(t_compare p_compare)
+ {
+ sort_stable_t<t_compare>(p_compare);
+ bit_array_bittable array(this->get_count());
+ if (this->template find_duplicates_sorted_t<t_compare>(p_compare,array) > 0)
+ remove_mask(array);
+ }
+
+
+ template<typename t_compare> void remove_duplicates_t(t_compare p_compare)
+ {
+ order_helper order(this->get_count());
+ sort_get_permutation_t<t_compare,order_helper&>(p_compare,order);
+ bit_array_bittable array(this->get_count());
+ if (this->template find_duplicates_sorted_permutation_t<t_compare,order_helper const&>(p_compare,order,array) > 0)
+ remove_mask(array);
+ }
+
+ template<typename t_func>
+ void for_each(t_func p_func) {
+ t_size n,max=this->get_count();
+ for(n=0;n<max;n++) p_func(this->get_item(n));
+ }
+
+ template<typename t_func>
+ void for_each(t_func p_func,const bit_array & p_mask) {
+ t_size n,max=this->get_count();
+ for(n=p_mask.find(true,0,max);n<max;n=p_mask.find(true,n+1,max-n-1)) {
+ p_func(this->get_item(n));
+ }
+ }
+
+ template<typename t_releasefunc>
+ void remove_mask_ex(const bit_array & p_mask,t_releasefunc p_func) {
+ this->template for_each<t_releasefunc>(p_func,p_mask);
+ remove_mask(p_mask);
+ }
+
+ template<typename t_releasefunc>
+ void remove_all_ex(t_releasefunc p_func) {
+ this->template for_each<t_releasefunc>(p_func);
+ remove_all();
+ }
+
+ template<typename t_in> t_self & operator=(t_in const & source) {remove_all(); add_items(source); return *this;}
+ template<typename t_in> t_self & operator+=(t_in const & p_source) {add_item(p_source); return *this;}
+ template<typename t_in> t_self & operator|=(t_in const & p_source) {add_items(p_source); return *this;}
+
+protected:
+ list_base_t() {}
+ ~list_base_t() {}
+};
+
+
+template<typename T,typename t_storage>
+class list_impl_t : public list_base_t<T>
+{
+public:
+ list_impl_t() {}
+ list_impl_t(const list_impl_t<T,t_storage> & p_source) { *this = p_source; }
+
+ void prealloc(t_size count) {m_buffer.prealloc(count);}
+
+ void set_count(t_size p_count) {m_buffer.set_size(p_count);}
+ void set_size(t_size p_count) {m_buffer.set_size(p_count);}
+
+ template<typename t_in>
+ t_size _insert_item_t(const t_in & item, t_size idx) {
+ return pfc::insert_t(m_buffer, item, idx);
+ }
+ template<typename t_in>
+ t_size insert_item(const t_in & item, t_size idx) {
+ return _insert_item_t(item, idx);
+ }
+
+ t_size insert_item(const T& item,t_size idx) {
+ return _insert_item_t(item, idx);
+ }
+
+ T remove_by_idx(t_size idx)
+ {
+ T ret = m_buffer[idx];
+ t_size n;
+ t_size max = m_buffer.get_size();
+ for(n=idx+1;n<max;n++) {
+ pfc::move_t(m_buffer[n-1],m_buffer[n]);
+ }
+ m_buffer.set_size(max-1);
+ return ret;
+ }
+
+
+ inline void get_item_ex(T& p_out,t_size n) const
+ {
+ PFC_ASSERT(n>=0);
+ PFC_ASSERT(n<get_size());
+ p_out = m_buffer[n];
+ }
+
+ inline const T& get_item_ref(t_size n) const
+ {
+ PFC_ASSERT(n>=0);
+ PFC_ASSERT(n<get_size());
+ return m_buffer[n];
+ }
+
+ inline T get_item(t_size n) const
+ {
+ PFC_ASSERT(n >= 0);
+ PFC_ASSERT(n < get_size() );
+ return m_buffer[n];
+ };
+
+ inline t_size get_count() const {return m_buffer.get_size();}
+ inline t_size get_size() const {return m_buffer.get_size();}
+
+ inline const T & operator[](t_size n) const
+ {
+ PFC_ASSERT(n>=0);
+ PFC_ASSERT(n<get_size());
+ return m_buffer[n];
+ }
+
+ inline const T* get_ptr() const {return m_buffer.get_ptr();}
+ inline T* get_ptr() {return m_buffer.get_ptr();}
+
+ inline T& operator[](t_size n) {return m_buffer[n];}
+
+ inline void remove_from_idx(t_size idx,t_size num)
+ {
+ remove_mask(bit_array_range(idx,num));
+ }
+
+ t_size _insert_items_v(const list_base_const_t<T> & source,t_size base) { //workaround for inefficient operator[] on virtual-interface-accessed lists
+ t_size count = get_size();
+ if (base>count) base = count;
+ t_size num = source.get_count();
+ m_buffer.set_size(count+num);
+ if (count > base) {
+ for(t_size n=count-1;(int)n>=(int)base;n--) {
+ pfc::move_t(m_buffer[n+num],m_buffer[n]);
+ }
+ }
+
+ for(t_size n=0;n<num;n++) {
+ source.get_item_ex(m_buffer[n+base],n);
+ }
+ return base;
+ }
+ // use _insert_items_v where it's more efficient
+ t_size insert_items(const list_base_const_t<T> & source,t_size base) {return _insert_items_v(source, base);}
+ t_size insert_items(const list_base_t<T> & source,t_size base) {return _insert_items_v(source, base);}
+
+ template<typename t_in>
+ t_size insert_items(const t_in & source,t_size base) {
+ t_size count = get_size();
+ if (base>count) base = count;
+ t_size num = array_size_t(source);
+ m_buffer.set_size(count+num);
+ if (count > base) {
+ for(t_size n=count-1;(int)n>=(int)base;n--) {
+ pfc::move_t(m_buffer[n+num],m_buffer[n]);
+ }
+ }
+
+ for(t_size n=0;n<num;n++) {
+ m_buffer[n+base] = source[n];
+ }
+ return base;
+ }
+
+ template<typename t_in>
+ void add_items(const t_in & in) {insert_items(in, ~0);}
+
+ void get_items_mask(list_impl_t<T,t_storage> & out,const bit_array & mask)
+ {
+ t_size n,count = get_size();
+ for_each_bit_array(n,mask,true,0,count)
+ out.add_item(m_buffer[n]);
+ }
+
+ void filter_mask(const bit_array & mask)
+ {
+ t_size n,count = get_size(), total = 0;
+
+ n = total = mask.find(false,0,count);
+
+ if (n<count) {
+ for(n=mask.find(true,n+1,count-n-1);n<count;n=mask.find(true,n+1,count-n-1))
+ pfc::move_t(m_buffer[total++],m_buffer[n]);
+
+ m_buffer.set_size(total);
+ }
+ }
+
+ void replace_item(t_size idx,const T& item)
+ {
+ PFC_ASSERT(idx>=0);
+ PFC_ASSERT(idx<get_size());
+ m_buffer[idx] = item;
+ }
+
+ void sort()
+ {
+ pfc::sort_callback_impl_auto_wrap_t<t_storage> wrapper(m_buffer);
+ pfc::sort(wrapper,get_size());
+ }
+
+ template<typename t_compare>
+ void sort_t(t_compare p_compare)
+ {
+ pfc::sort_callback_impl_simple_wrap_t<t_storage,t_compare> wrapper(m_buffer,p_compare);
+ pfc::sort(wrapper,get_size());
+ }
+
+ template<typename t_compare>
+ void sort_stable_t(t_compare p_compare)
+ {
+ pfc::sort_callback_impl_simple_wrap_t<t_storage,t_compare> wrapper(m_buffer,p_compare);
+ pfc::sort_stable(wrapper,get_size());
+ }
+ inline void reorder_partial(t_size p_base,const t_size * p_order,t_size p_count)
+ {
+ PFC_ASSERT(p_base+p_count<=get_size());
+ pfc::reorder_partial_t(m_buffer,p_base,p_order,p_count);
+ }
+
+ template<typename t_compare>
+ t_size find_duplicates_sorted_t(t_compare p_compare,bit_array_var & p_out) const
+ {
+ return pfc::find_duplicates_sorted_t<list_impl_t<T,t_storage> const &,t_compare>(*this,get_size(),p_compare,p_out);
+ }
+
+ template<typename t_compare,typename t_permutation>
+ t_size find_duplicates_sorted_permutation_t(t_compare p_compare,t_permutation p_permutation,bit_array_var & p_out)
+ {
+ return pfc::find_duplicates_sorted_permutation_t<list_impl_t<T,t_storage> const &,t_compare,t_permutation>(*this,get_size(),p_compare,p_permutation,p_out);
+ }
+
+
+private:
+ class sort_callback_wrapper
+ {
+ public:
+ explicit inline sort_callback_wrapper(sort_callback & p_callback) : m_callback(p_callback) {}
+ inline int operator()(const T& item1,const T& item2) const {return m_callback.compare(item1,item2);}
+ private:
+ sort_callback & m_callback;
+ };
+public:
+ void sort(sort_callback & p_callback)
+ {
+ sort_t(sort_callback_wrapper(p_callback));
+ }
+
+ void sort_stable(sort_callback & p_callback)
+ {
+ sort_stable_t(sort_callback_wrapper(p_callback));
+ }
+
+ void remove_mask(const bit_array & mask) {filter_mask(bit_array_not(mask));}
+
+ void remove_mask(const bool * mask) {remove_mask(bit_array_table(mask,get_size()));}
+ void filter_mask(const bool * mask) {filter_mask(bit_array_table(mask,get_size()));}
+
+ t_size add_item(const T& item) {
+ return insert_item(item, ~0);
+ }
+
+ template<typename t_in> t_size add_item(const t_in & item) {
+ return insert_item(item, ~0);
+ }
+
+ void remove_all() {remove_mask(bit_array_true());}
+
+ void remove_item(const T& item)
+ {
+ t_size n,max = get_size();
+ bit_array_bittable mask(max);
+ for(n=0;n<max;n++)
+ mask.set(n,get_item(n)==item);
+ remove_mask(mask);
+ }
+
+ void swap_item_with(t_size p_index,T & p_item)
+ {
+ PFC_ASSERT(p_index < get_size());
+ pfc::swap_t(m_buffer[p_index],p_item);
+ }
+
+ void swap_items(t_size p_index1,t_size p_index2)
+ {
+ PFC_ASSERT(p_index1 < get_size());
+ PFC_ASSERT(p_index2 < get_size());
+ pfc::swap_t(m_buffer[p_index1],m_buffer[p_index2]);
+ }
+
+ inline static void g_swap(list_impl_t<T,t_storage> & p_item1,list_impl_t<T,t_storage> & p_item2)
+ {
+ pfc::swap_t(p_item1.m_buffer,p_item2.m_buffer);
+ }
+
+ template<typename t_search>
+ t_size find_item(const t_search & p_item) const//returns index of first occurance, infinite if not found
+ {
+ t_size n,max = get_size();
+ for(n=0;n<max;n++)
+ if (m_buffer[n]==p_item) return n;
+ return ~0;
+ }
+
+ template<typename t_search>
+ inline bool have_item(const t_search & p_item) const {return this->template find_item<t_search>(p_item)!=~0;}
+
+ template<typename t_in> t_self & operator=(t_in const & source) {remove_all(); add_items(source); return *this;}
+ template<typename t_in> t_self & operator+=(t_in const & p_source) {add_item(p_source); return *this;}
+ template<typename t_in> t_self & operator|=(t_in const & p_source) {add_items(p_source); return *this;}
+protected:
+ t_storage m_buffer;
+};
+
+template<typename t_item, template<typename> class t_alloc = pfc::alloc_fast >
+class list_t : public list_impl_t<t_item,pfc::array_t<t_item,t_alloc> > {
+public:
+ template<typename t_in> t_self & operator=(t_in const & source) {remove_all(); add_items(source); return *this;}
+ template<typename t_in> t_self & operator+=(t_in const & p_source) {add_item(p_source); return *this;}
+ template<typename t_in> t_self & operator|=(t_in const & p_source) {add_items(p_source); return *this;}
+};
+
+template<typename t_item, t_size p_fixed_count, template<typename> class t_alloc = pfc::alloc_fast >
+class list_hybrid_t : public list_impl_t<t_item,pfc::array_hybrid_t<t_item,p_fixed_count,t_alloc> > {
+public:
+ template<typename t_in> t_self & operator=(t_in const & source) {remove_all(); add_items(source); return *this;}
+ template<typename t_in> t_self & operator+=(t_in const & p_source) {add_item(p_source); return *this;}
+ template<typename t_in> t_self & operator|=(t_in const & p_source) {add_items(p_source); return *this;}
+};
+
+template<typename T>
+class ptr_list_const_cast_t : public list_base_const_t<const T *>
+{
+public:
+ inline ptr_list_const_cast_t(const list_base_const_t<T*> & p_param) : m_param(p_param) {}
+ t_size get_count() const {return m_param.get_count();}
+ void get_item_ex(const T * & p_out,t_size n) const {T* temp; m_param.get_item_ex(temp,n); p_out = temp;}
+private:
+ const list_base_const_t<T*> & m_param;
+
+};
+
+
+template<typename T,typename P>
+class list_const_permutation_t : public list_base_const_t<T>
+{
+public:
+ inline list_const_permutation_t(const list_base_const_t<T> & p_list,P p_permutation) : m_list(p_list), m_permutation(p_permutation) {}
+ t_size get_count() const {return m_list.get_count();}
+ void get_item_ex(T & p_out,t_size n) const {m_list.get_item_ex(p_out,m_permutation[n]);}
+private:
+ P m_permutation;
+ const list_base_const_t<T> & m_list;
+};
+
+
+template<class T>
+class list_permutation_t : public list_base_const_t<T>
+{
+public:
+ t_size get_count() const {return m_count;}
+ void get_item_ex(T & p_out,t_size n) const {m_base.get_item_ex(p_out,m_order[n]);}
+ list_permutation_t(const list_base_const_t<T> & p_base,const t_size * p_order,t_size p_count)
+ : m_base(p_base), m_order(p_order), m_count(p_count)
+ {
+ PFC_ASSERT(m_base.get_count() >= m_count);
+ }
+private:
+ const list_base_const_t<T> & m_base;
+ const t_size * m_order;
+ t_size m_count;
+};
+
+template<typename item, template<typename> class alloc> class traits_t<list_t<item, alloc> > : public traits_combined<alloc<item>, traits_vtable> {};
+
+}
+#endif //_PFC_LIST_H_
diff --git a/plugins/ListeningTo/src/players/foo_mlt/pfc/map.h b/plugins/ListeningTo/src/players/foo_mlt/pfc/map.h new file mode 100644 index 0000000000..010efc6ec4 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/pfc/map.h @@ -0,0 +1,254 @@ +#ifndef _MAP_T_H_INCLUDED_
+#define _MAP_T_H_INCLUDED_
+
+namespace pfc {
+ PFC_DECLARE_EXCEPTION(exception_map_entry_not_found,exception,"Map entry not found");
+
+ template<typename t_destination> class __map_overwrite_wrapper {
+ public:
+ __map_overwrite_wrapper(t_destination & p_destination) : m_destination(p_destination) {}
+ template<typename t_key,typename t_value> void operator() (const t_key & p_key,const t_value & p_value) {m_destination.set(p_key,p_value);}
+ private:
+ t_destination & m_destination;
+ };
+
+ template<typename t_storage_key, typename t_storage_value, typename t_comparator = comparator_default>
+ class map_t {
+ private:
+ typedef map_t<t_storage_key,t_storage_value,t_comparator> t_self;
+ public:
+ typedef t_storage_key t_key; typedef t_storage_value t_value;
+ template<typename _t_key,typename _t_value>
+ void set(const _t_key & p_key, const _t_value & p_value) {
+ bool isnew;
+ t_storage & storage = m_data.add_ex(t_search_set<_t_key,_t_value>(p_key,p_value), isnew);
+ if (!isnew) storage.m_value = p_value;
+ }
+
+ template<typename _t_key>
+ t_storage_value & find_or_add(_t_key const & p_key) {
+ return m_data.add(t_search_query<_t_key>(p_key)).m_value;
+ }
+
+ template<typename _t_key>
+ t_storage_value & find_or_add_ex(_t_key const & p_key,bool & p_isnew) {
+ return m_data.add_ex(t_search_query<_t_key>(p_key),p_isnew).m_value;
+ }
+
+ template<typename _t_key>
+ bool have_item(const _t_key & p_key) const {
+ return m_data.have_item(t_search_query<_t_key>(p_key));
+ }
+
+ template<typename _t_key,typename _t_value>
+ bool query(const _t_key & p_key,_t_value & p_value) const {
+ const t_storage * storage = m_data.find_ptr(t_search_query<_t_key>(p_key));
+ if (storage == NULL) return false;
+ p_value = storage->m_value;
+ return true;
+ }
+
+ template<typename _t_key>
+ const t_storage_value & operator[] (const _t_key & p_key) const {
+ const t_storage_value * ptr = query_ptr(p_key);
+ if (ptr == NULL) throw exception_map_entry_not_found();
+ return *ptr;
+ }
+
+ template<typename _t_key>
+ t_storage_value & operator[] (const _t_key & p_key) {
+ return find_or_add(p_key);
+ }
+
+ template<typename _t_key>
+ const t_storage_value * query_ptr(const _t_key & p_key) const {
+ const t_storage * storage = m_data.find_ptr(t_search_query<_t_key>(p_key));
+ if (storage == NULL) return NULL;
+ return &storage->m_value;
+ }
+
+ template<typename _t_key>
+ t_storage_value * query_ptr(const _t_key & p_key) {
+ t_storage * storage = m_data.find_ptr(t_search_query<_t_key>(p_key));
+ if (storage == NULL) return NULL;
+ return &storage->m_value;
+ }
+
+ template<typename _t_key>
+ bool query_ptr(const _t_key & p_key, const t_storage_value * & out) const {
+ const t_storage * storage = m_data.find_ptr(t_search_query<_t_key>(p_key));
+ if (storage == NULL) return false;
+ out = &storage->m_value;
+ return true;
+ }
+
+ template<typename _t_key>
+ bool query_ptr(const _t_key & p_key, t_storage_value * & out) {
+ t_storage * storage = m_data.find_ptr(t_search_query<_t_key>(p_key));
+ if (storage == NULL) return false;
+ out = &storage->m_value;
+ return true;
+ }
+
+ template<bool inclusive,bool above,typename _t_key>
+ const t_storage_value * query_nearest_ptr(_t_key & p_key) const {
+ const t_storage * storage = m_data.find_nearest_item<inclusive,above>(t_search_query<_t_key>(p_key));
+ if (storage == NULL) return NULL;
+ p_key = storage->m_key;
+ return &storage->m_value;
+ }
+
+ template<bool inclusive,bool above,typename _t_key>
+ t_storage_value * query_nearest_ptr(_t_key & p_key) {
+ t_storage * storage = m_data.find_nearest_item<inclusive,above>(t_search_query<_t_key>(p_key));
+ if (storage == NULL) return NULL;
+ p_key = storage->m_key;
+ return &storage->m_value;
+ }
+
+ template<bool inclusive,bool above,typename _t_key,typename _t_value>
+ bool query_nearest(_t_key & p_key,_t_value & p_value) const {
+ const t_storage * storage = m_data.find_nearest_item<inclusive,above>(t_search_query<_t_key>(p_key));
+ if (storage == NULL) return false;
+ p_key = storage->m_key;
+ p_value = storage->m_value;
+ return true;
+ }
+
+
+ template<typename _t_key>
+ bool remove(const _t_key & p_key) {
+ return m_data.remove_item(t_search_query<_t_key>(p_key));
+ }
+
+ template<typename t_callback>
+ void enumerate(t_callback & p_callback) const {
+ m_data.enumerate(enumeration_wrapper<t_callback>(p_callback));
+ }
+
+ template<typename t_callback>
+ void enumerate(t_callback & p_callback) {
+ m_data._enumerate_var(enumeration_wrapper_var<t_callback>(p_callback));
+ }
+
+
+ t_size get_count() const throw() {return m_data.get_count();}
+
+ void remove_all() throw() {m_data.remove_all();}
+
+ template<typename t_source>
+ void overwrite(const t_source & p_source) {
+ __map_overwrite_wrapper<t_self> wrapper(*this);
+ p_source.enumerate(wrapper);
+ }
+
+ //backwards compatibility method wrappers
+ template<typename _t_key> bool exists(const _t_key & p_key) const {return have_item(p_key);}
+
+
+ template<typename _t_key> bool get_first(_t_key & p_out) const {
+ return m_data.get_first(t_retrieve_key<_t_key>(p_out));
+ }
+
+ template<typename _t_key> bool get_last(_t_key & p_out) const {
+ return m_data.get_last(t_retrieve_key<_t_key>(p_out));
+ }
+
+ private:
+ template<typename _t_key>
+ struct t_retrieve_key {
+ typedef t_retrieve_key<_t_key> t_self;
+ t_retrieve_key(_t_key & p_key) : m_key(p_key) {}
+ template<typename t_what> const t_self & operator=(const t_what & p_what) {m_key = p_what.m_key; return *this;}
+ _t_key & m_key;
+ };
+ template<typename _t_key>
+ struct t_search_query {
+ t_search_query(const _t_key & p_key) : m_key(p_key) {}
+ _t_key const & m_key;
+ };
+ template<typename _t_key,typename _t_value>
+ struct t_search_set {
+ t_search_set(const _t_key & p_key, const _t_value & p_value) : m_key(p_key), m_value(p_value) {}
+
+ _t_key const & m_key;
+ _t_value const & m_value;
+ };
+
+ struct t_storage {
+ const t_storage_key m_key;
+ t_storage_value m_value;
+
+ template<typename _t_key>
+ t_storage(t_search_query<_t_key> const & p_source) : m_key(p_source.m_key), m_value() {}
+
+ template<typename _t_key,typename _t_value>
+ t_storage(t_search_set<_t_key,_t_value> const & p_source) : m_key(p_source.m_key), m_value(p_source.m_value) {}
+
+ static bool equals(const t_storage & v1, const t_storage & v2) {return v1.m_key == v2.m_key && v1.m_value == v2.m_value;}
+ bool operator==(const t_storage & other) const {return equals(*this,other);}
+ bool operator!=(const t_storage & other) const {return !equals(*this,other);}
+ };
+
+ class comparator_wrapper {
+ public:
+ template<typename t1,typename t2>
+ inline static int compare(const t1 & p_item1,const t2 & p_item2) {
+ return t_comparator::compare(p_item1.m_key,p_item2.m_key);
+ }
+ };
+
+ template<typename t_callback>
+ class enumeration_wrapper {
+ public:
+ enumeration_wrapper(t_callback & p_callback) : m_callback(p_callback) {}
+ void operator()(const t_storage & p_item) {m_callback(p_item.m_key,p_item.m_value);}
+ private:
+ t_callback & m_callback;
+ };
+
+ template<typename t_callback>
+ class enumeration_wrapper_var {
+ public:
+ enumeration_wrapper_var(t_callback & p_callback) : m_callback(p_callback) {}
+ void operator()(t_storage & p_item) {m_callback(implicit_cast<t_storage_key const&>(p_item.m_key),p_item.m_value);}
+ private:
+ t_callback & m_callback;
+ };
+
+ typedef avltree_t<t_storage,comparator_wrapper> t_content;
+
+ t_content m_data;
+ public:
+ typedef traits_t<t_content> traits;
+ typedef typename t_content::const_iterator const_iterator;
+ typedef typename t_content::iterator iterator;
+
+ iterator first() throw() {return m_data._first_var();}
+ iterator last() throw() {return m_data._last_var();}
+ const_iterator first() const throw() {return m_data.first();}
+ const_iterator last() const throw() {return m_data.last();}
+
+ template<typename _t_key> iterator find(const _t_key & key) {return m_data.find(t_search_query<_t_key>(key));}
+ template<typename _t_key> const_iterator find(const _t_key & key) const {return m_data.find(t_search_query<_t_key>(key));}
+
+ static bool equals(const t_self & v1, const t_self & v2) {
+ return t_content::equals(v1.m_data,v2.m_data);
+ }
+ bool operator==(const t_self & other) const {return equals(*this,other);}
+ bool operator!=(const t_self & other) const {return !equals(*this,other);}
+
+ bool remove(iterator const& iter) {
+ PFC_ASSERT(iter.is_valid());
+ return m_data.remove(iter);
+ //should never return false unless there's a bug in calling code
+ }
+ bool remove(const_iterator const& iter) {
+ PFC_ASSERT(iter.is_valid());
+ return m_data.remove(iter);
+ //should never return false unless there's a bug in calling code
+ }
+ };
+}
+
+#endif //_MAP_T_H_INCLUDED_
diff --git a/plugins/ListeningTo/src/players/foo_mlt/pfc/mem_block_mgr.h b/plugins/ListeningTo/src/players/foo_mlt/pfc/mem_block_mgr.h new file mode 100644 index 0000000000..daaead0135 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/pfc/mem_block_mgr.h @@ -0,0 +1,71 @@ +#ifndef _MEM_BLOCK_MGR_H_
+#define _MEM_BLOCK_MGR_H_
+
+#error DEPRECATED
+
+
+template<class T>
+class mem_block_manager
+{
+ struct entry
+ {
+ mem_block_t<T> block;
+ bool used;
+ };
+ ptr_list_t<entry> list;
+public:
+ T * copy(const T* ptr,int size)
+ {
+ int n;
+ int found_size = -1,found_index = -1;
+ for(n=0;n<list.get_count();n++)
+ {
+ if (!list[n]->used)
+ {
+ int block_size = list[n]->block.get_size();
+ if (found_size<0)
+ {
+ found_index=n; found_size = block_size;
+ }
+ else if (found_size<size)
+ {
+ if (block_size>found_size)
+ {
+ found_index=n; found_size = block_size;
+ }
+ }
+ else if (found_size>size)
+ {
+ if (block_size>=size && block_size<found_size)
+ {
+ found_index=n; found_size = block_size;
+ }
+ }
+
+ if (found_size==size) break;
+ }
+ }
+ if (found_index>=0)
+ {
+ list[found_index]->used = true;
+ return list[found_index]->block.copy(ptr,size);
+ }
+ entry * new_entry = new entry;
+ new_entry->used = true;
+ list.add_item(new_entry);
+ return new_entry->block.copy(ptr,size);
+ }
+
+ void mark_as_free()
+ {
+ int n;
+ for(n=0;n<list.get_count();n++)
+ {
+ list[n]->used = false;
+ }
+ }
+
+ ~mem_block_manager() {list.delete_all();}
+};
+
+#endif
\ No newline at end of file diff --git a/plugins/ListeningTo/src/players/foo_mlt/pfc/order_helper.h b/plugins/ListeningTo/src/players/foo_mlt/pfc/order_helper.h new file mode 100644 index 0000000000..869623e3de --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/pfc/order_helper.h @@ -0,0 +1,94 @@ +namespace pfc {
+ PFC_DECLARE_EXCEPTION( exception_invalid_permutation, exception_invalid_params, "Invalid permutation" );
+ t_size permutation_find_reverse(t_size const * order, t_size count, t_size value);
+
+ //! For critical sanity checks. Speed: O(n), allocates memory.
+ bool permutation_is_valid(t_size const * order, t_size count);
+ //! For critical sanity checks. Speed: O(n), allocates memory.
+ void permutation_validate(t_size const * order, t_size count);
+
+ //! Creates a permutation that moves selected items in a list box by the specified delta-offset.
+ void create_move_items_permutation(t_size * p_output,t_size p_count,const class bit_array & p_selection,int p_delta);
+}
+
+class order_helper
+{
+ pfc::array_t<t_size> m_data;
+public:
+ order_helper(t_size p_size) {
+ m_data.set_size(p_size);
+ for(t_size n=0;n<p_size;n++) m_data[n]=n;
+ }
+
+ order_helper(const order_helper & p_order) {*this = p_order;}
+
+ static bool g_is_identity(const t_size * order, t_size count) {
+ for(t_size walk = 0; walk < count; ++walk) {
+ if (order[walk] != walk) return false;
+ }
+ return true;
+ }
+ template<typename t_array> static bool g_is_identity(const t_array & p_array) {
+ const t_size count = pfc::array_size_t(p_array);
+ for(t_size walk = 0; walk < count; ++walk) if (p_array[walk] != walk) return false;
+ return true;
+ }
+
+ template<typename t_int>
+ static void g_fill(t_int * p_order,const t_size p_count) {
+ t_size n; for(n=0;n<p_count;n++) p_order[n] = (t_int)n;
+ }
+
+ template<typename t_array>
+ static void g_fill(t_array & p_array) {
+ t_size n; const t_size max = pfc::array_size_t(p_array);
+ for(n=0;n<max;n++) p_array[n] = n;
+ }
+
+
+ t_size get_item(t_size ptr) const {return m_data[ptr];}
+
+ t_size & operator[](t_size ptr) {return m_data[ptr];}
+ t_size operator[](t_size ptr) const {return m_data[ptr];}
+
+ static void g_swap(t_size * p_data,t_size ptr1,t_size ptr2);
+ inline void swap(t_size ptr1,t_size ptr2) {pfc::swap_t(m_data[ptr1],m_data[ptr2]);}
+
+ const t_size * get_ptr() const {return m_data.get_ptr();}
+
+ //! Insecure - may deadlock or crash on invalid permutation content. In theory faster than walking the permutation, but still O(n).
+ static t_size g_find_reverse(const t_size * order,t_size val);
+ //! Insecure - may deadlock or crash on invalid permutation content. In theory faster than walking the permutation, but still O(n).
+ inline t_size find_reverse(t_size val) {return g_find_reverse(m_data.get_ptr(),val);}
+
+ static void g_reverse(t_size * order,t_size base,t_size count);
+ inline void reverse(t_size base,t_size count) {g_reverse(m_data.get_ptr(),base,count);}
+
+ t_size get_count() const {return m_data.get_size();}
+};
+
+
+namespace pfc {
+ template<typename t_list>
+ static bool guess_reorder_pattern(pfc::array_t<t_size> & out, const t_list & from, const t_list & to) {
+ typedef typename t_list::t_item t_item;
+ const t_size count = from.get_size();
+ if (count != to.get_size()) return false;
+ out.set_size(count);
+ for(t_size walk = 0; walk < count; ++walk) out[walk] = walk;
+ //required output: to[n] = from[out[n]];
+ typedef pfc::chain_list_v2_t<t_size> t_queue;
+ pfc::map_t<t_item, t_queue > content;
+ for(t_size walk = 0; walk < count; ++walk) {
+ content.find_or_add(from[walk]).add_item(walk);
+ }
+ for(t_size walk = 0; walk < count; ++walk) {
+ t_queue * q = content.query_ptr(to[walk]);
+ if (q == NULL) return false;
+ if (q->get_count() == 0) return false;
+ out[walk] = *q->first();
+ q->remove(q->first());
+ }
+ return true;
+ }
+}
diff --git a/plugins/ListeningTo/src/players/foo_mlt/pfc/other.cpp b/plugins/ListeningTo/src/players/foo_mlt/pfc/other.cpp new file mode 100644 index 0000000000..fcb5a07b4c --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/pfc/other.cpp @@ -0,0 +1,137 @@ +#include "pfc.h"
+
+#include <intrin.h>
+
+namespace pfc {
+ bool permutation_is_valid(t_size const * order, t_size count) {
+ bit_array_bittable found(count);
+ for(t_size walk = 0; walk < count; ++walk) {
+ if (order[walk] >= count) return false;
+ if (found[walk]) return false;
+ found.set(walk,true);
+ }
+ return true;
+ }
+ void permutation_validate(t_size const * order, t_size count) {
+ if (!permutation_is_valid(order,count)) throw exception_invalid_permutation();
+ }
+
+ t_size permutation_find_reverse(t_size const * order, t_size count, t_size value) {
+ if (value >= count) return ~0;
+ for(t_size walk = 0; walk < count; ++walk) {
+ if (order[walk] == value) return walk;
+ }
+ return ~0;
+ }
+
+ void create_move_items_permutation(t_size * p_output,t_size p_count,const bit_array & p_selection,int p_delta) {
+ t_size * const order = p_output;
+ const t_size count = p_count;
+
+ pfc::array_t<bool> selection; selection.set_size(p_count);
+
+ for(t_size walk = 0; walk < count; ++walk) {
+ order[walk] = walk;
+ selection[walk] = p_selection[walk];
+ }
+
+ if (p_delta<0)
+ {
+ for (;p_delta<0;p_delta++)
+ {
+ t_size idx;
+ for(idx=1;idx<count;idx++)
+ {
+ if (selection[idx] && !selection[idx-1])
+ {
+ pfc::swap_t(order[idx],order[idx-1]);
+ pfc::swap_t(selection[idx],selection[idx-1]);
+ }
+ }
+ }
+ }
+ else
+ {
+ for (;p_delta>0;p_delta--)
+ {
+ t_size idx;
+ for(idx=count-2;(int)idx>=0;idx--)
+ {
+ if (selection[idx] && !selection[idx+1])
+ {
+ pfc::swap_t(order[idx],order[idx+1]);
+ pfc::swap_t(selection[idx],selection[idx+1]);
+ }
+ }
+ }
+ }
+ }
+}
+
+void order_helper::g_swap(t_size * data,t_size ptr1,t_size ptr2)
+{
+ t_size temp = data[ptr1];
+ data[ptr1] = data[ptr2];
+ data[ptr2] = temp;
+}
+
+
+t_size order_helper::g_find_reverse(const t_size * order,t_size val)
+{
+ t_size prev = val, next = order[val];
+ while(next != val)
+ {
+ prev = next;
+ next = order[next];
+ }
+ return prev;
+}
+
+
+void order_helper::g_reverse(t_size * order,t_size base,t_size count)
+{
+ t_size max = count>>1;
+ t_size n;
+ t_size base2 = base+count-1;
+ for(n=0;n<max;n++)
+ g_swap(order,base+n,base2-n);
+}
+
+
+void pfc::crash() {
+#ifdef _MSC_VER
+ __debugbreak();
+#else
+ *(char*)NULL = 0;
+#endif
+}
+
+
+void pfc::byteswap_raw(void * p_buffer,const t_size p_bytes) {
+ t_uint8 * ptr = (t_uint8*)p_buffer;
+ t_size n;
+ for(n=0;n<p_bytes>>1;n++) swap_t(ptr[n],ptr[p_bytes-n-1]);
+}
+
+#if defined(_DEBUG) && defined(_WIN32)
+void pfc::myassert(const wchar_t * _Message, const wchar_t *_File, unsigned _Line) {
+ if (IsDebuggerPresent()) pfc::crash();
+ _wassert(_Message,_File,_Line);
+}
+#endif
+
+
+t_uint64 pfc::pow_int(t_uint64 base, t_uint64 exp) {
+ t_uint64 mul = base;
+ t_uint64 val = 1;
+ t_uint64 mask = 1;
+ while(exp != 0) {
+ if (exp & mask) {
+ val *= mul;
+ exp ^= mask;
+ }
+ mul = mul * mul;
+ mask <<= 1;
+ }
+ return val;
+}
diff --git a/plugins/ListeningTo/src/players/foo_mlt/pfc/other.h b/plugins/ListeningTo/src/players/foo_mlt/pfc/other.h new file mode 100644 index 0000000000..ace7e266a6 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/pfc/other.h @@ -0,0 +1,207 @@ +#ifndef _PFC_OTHER_H_
+#define _PFC_OTHER_H_
+
+namespace pfc {
+ template<class T>
+ class vartoggle_t {
+ T oldval; T & var;
+ public:
+ vartoggle_t(T & p_var,const T & val) : var(p_var) {
+ oldval = var;
+ var = val;
+ }
+ ~vartoggle_t() {var = oldval;}
+ };
+
+ typedef vartoggle_t<bool> booltoggle;
+};
+
+#ifdef _MSC_VER
+
+class fpu_control
+{
+ unsigned old_val;
+ unsigned mask;
+public:
+ inline fpu_control(unsigned p_mask,unsigned p_val)
+ {
+ mask = p_mask;
+ _controlfp_s(&old_val,p_val,mask);
+ }
+ inline ~fpu_control()
+ {
+ unsigned dummy;
+ _controlfp_s(&dummy,old_val,mask);
+ }
+};
+
+class fpu_control_roundnearest : private fpu_control
+{
+public:
+ fpu_control_roundnearest() : fpu_control(_MCW_RC,_RC_NEAR) {}
+};
+
+class fpu_control_flushdenormal : private fpu_control
+{
+public:
+ fpu_control_flushdenormal() : fpu_control(_MCW_DN,_DN_FLUSH) {}
+};
+
+class fpu_control_default : private fpu_control
+{
+public:
+ fpu_control_default() : fpu_control(_MCW_DN|_MCW_RC,_DN_FLUSH|_RC_NEAR) {}
+};
+
+#ifdef _M_IX86
+class sse_control {
+public:
+ sse_control(unsigned p_mask,unsigned p_val) : m_mask(p_mask) {
+ __control87_2(p_val,p_mask,NULL,&m_oldval);
+ }
+ ~sse_control() {
+ __control87_2(m_oldval,m_mask,NULL,&m_oldval);
+ }
+private:
+ unsigned m_mask,m_oldval;
+};
+class sse_control_flushdenormal : private sse_control {
+public:
+ sse_control_flushdenormal() : sse_control(_MCW_DN,_DN_FLUSH) {}
+};
+#endif
+
+#endif
+
+namespace pfc {
+
+ class releaser_delete {
+ public:
+ template<typename T> static void release(T* p_ptr) {delete p_ptr;}
+ };
+ class releaser_delete_array {
+ public:
+ template<typename T> static void release(T* p_ptr) {delete[] p_ptr;}
+ };
+ class releaser_free {
+ public:
+ static void release(void * p_ptr) {free(p_ptr);}
+ };
+
+ //! Assumes t_freefunc to never throw exceptions.
+ template<typename T,typename t_releaser = releaser_delete >
+ class ptrholder_t {
+ private:
+ typedef ptrholder_t<T,t_releaser> t_self;
+ public:
+ inline ptrholder_t(T* p_ptr) : m_ptr(p_ptr) {}
+ inline ptrholder_t() : m_ptr(NULL) {}
+ inline ~ptrholder_t() {t_releaser::release(m_ptr);}
+ inline bool is_valid() const {return m_ptr != NULL;}
+ inline bool is_empty() const {return m_ptr == NULL;}
+ inline T* operator->() const {return m_ptr;}
+ inline T* get_ptr() const {return m_ptr;}
+ inline void release() {t_releaser::release(replace_null_t(m_ptr));;}
+ inline void attach(T * p_ptr) {release(); m_ptr = p_ptr;}
+ inline const t_self & operator=(T * p_ptr) {set(p_ptr);return *this;}
+ inline T* detach() {return pfc::replace_null_t(m_ptr);}
+ inline T& operator*() const {return *m_ptr;}
+
+ inline t_self & operator<<(t_self & p_source) {attach(p_source.detach());return *this;}
+ inline t_self & operator>>(t_self & p_dest) {p_dest.attach(detach());return *this;}
+
+ //deprecated
+ inline void set(T * p_ptr) {attach(p_ptr);}
+ private:
+ ptrholder_t(const t_self &) {throw pfc::exception_not_implemented();}
+ const t_self & operator=(const t_self & ) {throw pfc::exception_not_implemented();}
+
+ T* m_ptr;
+ };
+
+ //avoid "void&" breakage
+ template<typename t_releaser>
+ class ptrholder_t<void,t_releaser> {
+ private:
+ typedef void T;
+ typedef ptrholder_t<T,t_releaser> t_self;
+ public:
+ inline ptrholder_t(T* p_ptr) : m_ptr(p_ptr) {}
+ inline ptrholder_t() : m_ptr(NULL) {}
+ inline ~ptrholder_t() {t_releaser::release(m_ptr);}
+ inline bool is_valid() const {return m_ptr != NULL;}
+ inline bool is_empty() const {return m_ptr == NULL;}
+ inline T* operator->() const {return m_ptr;}
+ inline T* get_ptr() const {return m_ptr;}
+ inline void release() {t_releaser::release(replace_null_t(m_ptr));;}
+ inline void attach(T * p_ptr) {release(); m_ptr = p_ptr;}
+ inline const t_self & operator=(T * p_ptr) {set(p_ptr);return *this;}
+ inline T* detach() {return pfc::replace_null_t(m_ptr);}
+
+ inline t_self & operator<<(t_self & p_source) {attach(p_source.detach());return *this;}
+ inline t_self & operator>>(t_self & p_dest) {p_dest.attach(detach());return *this;}
+
+ //deprecated
+ inline void set(T * p_ptr) {attach(p_ptr);}
+ private:
+ ptrholder_t(const t_self &) {throw pfc::exception_not_implemented();}
+ const t_self & operator=(const t_self & ) {throw pfc::exception_not_implemented();}
+
+ T* m_ptr;
+ };
+
+ void crash();
+
+ template<typename t_type,t_type p_initval>
+ class int_container_helper {
+ public:
+ int_container_helper() : m_val(p_initval) {}
+ t_type m_val;
+ };
+
+
+
+ //warning: not multi-thread-safe
+ template<typename t_base>
+ class instanceTracker : public t_base {
+ private:
+ typedef instanceTracker<t_base> t_self;
+ public:
+ TEMPLATE_CONSTRUCTOR_FORWARD_FLOOD_WITH_INITIALIZER(instanceTracker,t_base,{g_list += this;});
+
+ instanceTracker(const t_self & p_other) : t_base( (const t_base &)p_other) {g_list += this;}
+ ~instanceTracker() {g_list -= this;}
+
+ typedef pfc::avltree_t<t_self*> t_list;
+ static const t_list & instanceList() {return g_list;}
+ template<typename t_callback> static void forEach(t_callback & p_callback) {instanceList().enumerate(p_callback);}
+ private:
+ static t_list g_list;
+ };
+
+ template<typename t_base>
+ typename instanceTracker<t_base>::t_list instanceTracker<t_base>::g_list;
+
+
+ //warning: not multi-thread-safe
+ template<typename TClass>
+ class instanceTrackerV2 {
+ private:
+ typedef instanceTrackerV2<TClass> t_self;
+ public:
+ instanceTrackerV2(const t_self & p_other) {g_list += static_cast<TClass*>(this);}
+ instanceTrackerV2() {g_list += static_cast<TClass*>(this);}
+ ~instanceTrackerV2() {g_list -= static_cast<TClass*>(this);}
+
+ typedef pfc::avltree_t<TClass*> t_instanceList;
+ static const t_instanceList & instanceList() {return g_list;}
+ template<typename t_callback> static void forEach(t_callback & p_callback) {instanceList().enumerate(p_callback);}
+ private:
+ static t_instanceList g_list;
+ };
+
+ template<typename TClass>
+ typename instanceTrackerV2<TClass>::t_instanceList instanceTrackerV2<TClass>::g_list;
+}
+
+#endif
\ No newline at end of file diff --git a/plugins/ListeningTo/src/players/foo_mlt/pfc/pathUtils.cpp b/plugins/ListeningTo/src/players/foo_mlt/pfc/pathUtils.cpp new file mode 100644 index 0000000000..e936e656fa --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/pfc/pathUtils.cpp @@ -0,0 +1,182 @@ +#include "pfc.h"
+
+namespace pfc { namespace io { namespace path {
+
+static const string g_pathSeparators ("\\/|");
+
+string getFileName(string path) {
+ t_size split = path.lastIndexOfAnyChar(g_pathSeparators);
+ if (split == ~0) return path;
+ else return path.subString(split+1);
+}
+string getFileNameWithoutExtension(string path) {
+ string fn = getFileName(path);
+ t_size split = fn.lastIndexOf('.');
+ if (split == ~0) return fn;
+ else return fn.subString(0,split);
+}
+string getFileExtension(string path) {
+ string fn = getFileName(path);
+ t_size split = fn.lastIndexOf('.');
+ if (split == ~0) return "";
+ else return fn.subString(split);
+}
+string getDirectory(string filePath) {return getParent(filePath);}
+
+string getParent(string filePath) {
+ t_size split = filePath.lastIndexOfAnyChar(g_pathSeparators);
+ if (split == ~0) return "";
+#ifdef _WINDOWS
+ if (split > 0 && getIllegalNameChars().contains(filePath[split-1])) {
+ if (split + 1 < filePath.length()) return filePath.subString(0,split+1);
+ else return "";
+ }
+#endif
+ return filePath.subString(0,split);
+}
+string combine(string basePath,string fileName) {
+ if (basePath.length() > 0) {
+ if (!isSeparator(basePath.lastChar())) {
+ basePath += getDefaultSeparator();
+ }
+ return basePath + fileName;
+ } else {
+ //todo?
+ return fileName;
+ }
+}
+
+bool isSeparator(char c) {
+ return g_pathSeparators.indexOf(c) != ~0;
+}
+string getSeparators() {
+ return g_pathSeparators;
+}
+
+static string replaceIllegalChar(char c) {
+ switch(c) {
+ case '*':
+ return "x";
+ case '\"':
+ return "\'\'";
+ case ':':
+ case '/':
+ case '\\':
+ return "-";
+ default:
+ return "_";
+ }
+}
+string replaceIllegalPathChars(string fn) {
+ string illegal = getIllegalNameChars();
+ string separators = getSeparators();
+ string_formatter output;
+ for(t_size walk = 0; walk < fn.length(); ++walk) {
+ const char c = fn[walk];
+ if (separators.contains(c)) {
+ output.add_byte(getDefaultSeparator());
+ } else if (string::isNonTextChar(c) || illegal.contains(c)) {
+ string replacement = replaceIllegalChar(c);
+ if (replacement.containsAnyChar(illegal)) /*per-OS weirdness security*/ replacement = "_";
+ output << replacement.ptr();
+ } else {
+ output.add_byte(c);
+ }
+ }
+ return output.toString();
+}
+
+string replaceIllegalNameChars(string fn, bool allowWC) {
+ const string illegal = getIllegalNameChars(allowWC);
+ string_formatter output;
+ for(t_size walk = 0; walk < fn.length(); ++walk) {
+ const char c = fn[walk];
+ if (string::isNonTextChar(c) || illegal.contains(c)) {
+ string replacement = replaceIllegalChar(c);
+ if (replacement.containsAnyChar(illegal)) /*per-OS weirdness security*/ replacement = "_";
+ output << replacement.ptr();
+ } else {
+ output.add_byte(c);
+ }
+ }
+ return output.toString();
+}
+
+bool isInsideDirectory(pfc::string directory, pfc::string inside) {
+ //not very efficient
+ string walk = inside;
+ for (;;) {
+ walk = getParent(walk);
+ if (walk == "") return false;
+ if (equals(directory,walk)) return true;
+ }
+}
+bool isDirectoryRoot(string path) {
+ return getParent(path).isEmpty();
+}
+//OS-dependant part starts here
+
+
+char getDefaultSeparator() {
+#ifdef _WINDOWS
+ return '\\';
+#else
+#error PORTME
+#endif
+}
+
+static const string g_illegalNameChars(g_pathSeparators +
+#ifdef _WINDOWS
+ ":<>*?\""
+#else
+#error PORTME
+#endif
+ );
+static const string g_illegalNameChars_noWC(g_pathSeparators +
+#ifdef _WINDOWS
+ ":<>?\""
+#else
+#error PORTME
+#endif
+ );
+string getIllegalNameChars(bool allowWC) {
+ return allowWC ? g_illegalNameChars_noWC : g_illegalNameChars;
+}
+
+static bool isIllegalTrailingChar(char c) {
+ return c == ' ' || c == '.';
+}
+
+string validateFileName(string name, bool allowWC) {
+ for(t_size walk = 0; name[walk];) {
+ if (name[walk] == '?') {
+ t_size end = walk;
+ do { ++end; } while(name[end] == '?');
+ name = name.subString(0, walk) + name.subString(end);
+ } else {
+ ++walk;
+ }
+ }
+#ifdef _WINDOWS
+ name = replaceIllegalNameChars(name, allowWC);
+ if (name.length() > 0) {
+ t_size end = name.length();
+ while(end > 0) {
+ if (!isIllegalTrailingChar(name[end-1])) break;
+ --end;
+ }
+ t_size begin = 0;
+ while(begin < end) {
+ if (!isIllegalTrailingChar(name[begin])) break;
+ ++begin;
+ }
+ if (end < name.length() || begin > 0) name = name.subString(begin,end - begin);
+ }
+ if (name.isEmpty()) name = "_";
+ return name;
+#else
+ return replaceIllegalNameChars(name);
+#endif
+}
+
+}}}
diff --git a/plugins/ListeningTo/src/players/foo_mlt/pfc/pathUtils.h b/plugins/ListeningTo/src/players/foo_mlt/pfc/pathUtils.h new file mode 100644 index 0000000000..c6a886bb2c --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/pfc/pathUtils.h @@ -0,0 +1,29 @@ +namespace pfc {
+ namespace io {
+ namespace path {
+ string getFileName(string path);
+ string getFileNameWithoutExtension(string path);
+ string getFileExtension(string path);
+ string getParent(string filePath);
+ string getDirectory(string filePath);//same as getParent()
+ string combine(string basePath,string fileName);
+ char getDefaultSeparator();
+ string getSeparators();
+ bool isSeparator(char c);
+ string getIllegalNameChars(bool allowWC = false);
+ string replaceIllegalNameChars(string fn, bool allowWC = false);
+ string replaceIllegalPathChars(string fn);
+ bool isInsideDirectory(pfc::string directory, pfc::string inside);
+ bool isDirectoryRoot(string path);
+ string validateFileName(string name, bool allowWC = false);//removes various illegal things from the name, exact effect depends on the OS, includes removal of the invalid characters
+
+ template<typename t1, typename t2> bool equals(const t1 & v1, const t2 & v2) {return comparator::compare(v1,v2) == 0;}
+
+#ifdef _WINDOWS
+ typedef string::comparatorCaseInsensitive comparator;
+#else
+#error PORTME
+#endif
+ }
+ }
+}
diff --git a/plugins/ListeningTo/src/players/foo_mlt/pfc/pfc.h b/plugins/ListeningTo/src/players/foo_mlt/pfc/pfc.h new file mode 100644 index 0000000000..408fcd54d3 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/pfc/pfc.h @@ -0,0 +1,172 @@ +#ifndef ___PFC_H___
+#define ___PFC_H___
+
+#if !defined(_WINDOWS) && (defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64) || defined(_WIN32_WCE))
+#define _WINDOWS
+#endif
+
+
+#define PFC_DLL_EXPORT
+
+#ifdef _WINDOWS
+
+#ifndef STRICT
+#define STRICT
+#endif
+
+#ifndef _SYS_GUID_OPERATOR_EQ_
+#define _NO_SYS_GUID_OPERATOR_EQ_ //fix retarded warning with operator== on GUID returning int
+#endif
+
+#ifndef _WIN32_WINNT
+#define _WIN32_WINNT 0x500
+#endif
+
+#include <windows.h>
+
+#ifndef _SYS_GUID_OPERATOR_EQ_
+__inline bool __InlineIsEqualGUID(REFGUID rguid1, REFGUID rguid2)
+{
+ return (
+ ((unsigned long *) &rguid1)[0] == ((unsigned long *) &rguid2)[0] &&
+ ((unsigned long *) &rguid1)[1] == ((unsigned long *) &rguid2)[1] &&
+ ((unsigned long *) &rguid1)[2] == ((unsigned long *) &rguid2)[2] &&
+ ((unsigned long *) &rguid1)[3] == ((unsigned long *) &rguid2)[3]);
+}
+
+inline bool operator==(REFGUID guidOne, REFGUID guidOther) {return __InlineIsEqualGUID(guidOne,guidOther);}
+inline bool operator!=(REFGUID guidOne, REFGUID guidOther) {return !__InlineIsEqualGUID(guidOne,guidOther);}
+#endif
+
+#include <tchar.h>
+
+#elif defined(__GNUC__) && (defined __unix__ || defined __POSIX__)
+#include <stdint.h>
+#include <memory.h>
+typedef struct {
+ uint32_t Data1;
+ uint16_t Data2;
+ uint16_t Data3;
+ uint8_t Data4[ 8 ];
+ } GUID; //same as win32 GUID
+
+inline bool operator==(const GUID & p_item1,const GUID & p_item2) {
+ return memcmp(&p_item1,&p_item2,sizeof(GUID)) == 0;
+}
+
+inline bool operator!=(const GUID & p_item1,const GUID & p_item2) {
+ return memcmp(&p_item1,&p_item2,sizeof(GUID)) != 0;
+}
+
+#else
+
+#error Only win32 or unix target supported.
+
+#endif
+
+
+
+#define PFC_MEMORY_SPACE_LIMIT ((t_uint64)1<<(sizeof(void*)*8-1))
+
+#define PFC_ALLOCA_LIMIT (4096)
+
+#define INDEX_INVALID ((unsigned)(-1))
+
+
+#include <exception>
+#include <stdexcept>
+#include <new>
+
+#include <malloc.h>
+
+#include <stdio.h>
+
+#include <assert.h>
+
+#include <math.h>
+#include <float.h>
+
+#define _PFC_WIDESTRING(_String) L ## _String
+#define PFC_WIDESTRING(_String) _PFC_WIDESTRING(_String)
+
+#ifndef _DEBUG
+#define PFC_ASSERT(_Expression) ((void)0)
+#define PFC_ASSERT_SUCCESS(_Expression) (void)( (_Expression), 0)
+#define PFC_ASSERT_NO_EXCEPTION(_Expression) { _Expression; }
+#else
+
+#ifdef _WIN32
+namespace pfc { void myassert(const wchar_t * _Message, const wchar_t *_File, unsigned _Line); }
+#define PFC_ASSERT(_Expression) (void)( (!!(_Expression)) || (pfc::myassert(PFC_WIDESTRING(#_Expression), PFC_WIDESTRING(__FILE__), __LINE__), 0) )
+#define PFC_ASSERT_SUCCESS(_Expression) PFC_ASSERT(_Expression)
+#else
+#define PFC_ASSERT(_Expression) assert(_Expression)
+#define PFC_ASSERT_SUCCESS(_Expression) (void)( (_Expression), 0) //FIXME
+#endif
+
+#define PFC_ASSERT_NO_EXCEPTION(_Expression) { try { _Expression; } catch(...) { PFC_ASSERT(!"Should not get here - unexpected exception"); } }
+#endif
+
+#ifdef _MSC_VER
+
+#ifdef _DEBUG
+#define NOVTABLE
+#else
+#define NOVTABLE _declspec(novtable)
+#endif
+
+#ifdef _DEBUG
+#define ASSUME(X) PFC_ASSERT(X)
+#else
+#define ASSUME(X) __assume(X)
+#endif
+
+#define PFC_DEPRECATE(X) __declspec(deprecated(X))
+#define PFC_NORETURN __declspec(noreturn)
+#define PFC_NOINLINE __declspec(noinline)
+#else
+
+#define NOVTABLE
+#define ASSUME(X) PFC_ASSERT(X)
+#define PFC_DEPRECATE(X)
+#define PFC_NORETURN
+#define PFC_NOINLINE
+
+#endif
+
+#include "int_types.h"
+#include "traits.h"
+#include "bit_array.h"
+#include "primitives.h"
+#include "alloc.h"
+#include "array.h"
+#include "bit_array_impl.h"
+#include "binary_search.h"
+#include "bsearch_inline.h"
+#include "bsearch.h"
+#include "sort.h"
+#include "order_helper.h"
+#include "list.h"
+#include "ptr_list.h"
+#include "string.h"
+#include "string_list.h"
+#include "ref_counter.h"
+#include "iterators.h"
+#include "avltree.h"
+#include "map.h"
+#include "bit_array_impl_part2.h"
+#include "profiler.h"
+#include "guid.h"
+#include "byte_order_helper.h"
+#include "other.h"
+#include "chain_list_v2.h"
+#include "rcptr.h"
+#include "com_ptr_t.h"
+#include "string_conv.h"
+#include "stringNew.h"
+#include "pathUtils.h"
+#include "instance_tracker.h"
+#include "threads.h"
+#include "base64.h"
+
+#endif //___PFC_H___
diff --git a/plugins/ListeningTo/src/players/foo_mlt/pfc/pfc_10.vcxproj b/plugins/ListeningTo/src/players/foo_mlt/pfc/pfc_10.vcxproj new file mode 100644 index 0000000000..3069358394 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/pfc/pfc_10.vcxproj @@ -0,0 +1,197 @@ +<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{EBFFFB4E-261D-44D3-B89C-957B31A0BF9C}</ProjectGuid>
+ <RootNamespace>pfc</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <UseOfMfc>false</UseOfMfc>
+ <CharacterSet>Unicode</CharacterSet>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <UseOfMfc>false</UseOfMfc>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup>
+ <_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\Obj\$(ProjectName)\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\Obj\$(ProjectName)\</IntDir>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\Obj\$(ProjectName)\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\Obj\$(ProjectName)\</IntDir>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>_DEBUG;_WINDOWS;PFC_DLL_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <PrecompiledHeader>Use</PrecompiledHeader>
+ <PrecompiledHeaderFile>pfc.h</PrecompiledHeaderFile>
+ <WarningLevel>Level3</WarningLevel>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <Culture>0x0409</Culture>
+ </ResourceCompile>
+ <Lib>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ </Lib>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <Optimization>MaxSpeed</Optimization>
+ <PreprocessorDefinitions>NDEBUG;_WINDOWS;PFC_DLL_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <StringPooling>true</StringPooling>
+ <BufferSecurityCheck>false</BufferSecurityCheck>
+ <FloatingPointModel>Fast</FloatingPointModel>
+ <RuntimeTypeInfo>false</RuntimeTypeInfo>
+ <PrecompiledHeader>Use</PrecompiledHeader>
+ <PrecompiledHeaderFile>pfc.h</PrecompiledHeaderFile>
+ <WarningLevel>Level3</WarningLevel>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <Culture>0x0409</Culture>
+ </ResourceCompile>
+ <Lib>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ </Lib>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClInclude Include="alloc.h" />
+ <ClInclude Include="array.h" />
+ <ClInclude Include="avltree.h" />
+ <ClInclude Include="base64.h" />
+ <ClInclude Include="binary_search.h" />
+ <ClInclude Include="bit_array.h" />
+ <ClInclude Include="bit_array_impl.h" />
+ <ClInclude Include="bit_array_impl_part2.h" />
+ <ClInclude Include="bsearch.h" />
+ <ClInclude Include="bsearch_inline.h" />
+ <ClInclude Include="byte_order_helper.h" />
+ <ClInclude Include="chain_list_v2.h" />
+ <ClInclude Include="com_ptr_t.h" />
+ <ClInclude Include="guid.h" />
+ <ClInclude Include="instance_tracker.h" />
+ <ClInclude Include="int_types.h" />
+ <ClInclude Include="iterators.h" />
+ <ClInclude Include="list.h" />
+ <ClInclude Include="map.h" />
+ <ClInclude Include="order_helper.h" />
+ <ClInclude Include="other.h" />
+ <ClInclude Include="pathUtils.h" />
+ <ClInclude Include="pfc.h" />
+ <ClInclude Include="primitives.h" />
+ <ClInclude Include="profiler.h" />
+ <ClInclude Include="ptr_list.h" />
+ <ClInclude Include="rcptr.h" />
+ <ClInclude Include="ref_counter.h" />
+ <ClInclude Include="sort.h" />
+ <ClInclude Include="string.h" />
+ <ClInclude Include="string8_impl.h" />
+ <ClInclude Include="string_conv.h" />
+ <ClInclude Include="string_list.h" />
+ <ClInclude Include="stringNew.h" />
+ <ClInclude Include="threads.h" />
+ <ClInclude Include="traits.h" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="base64.cpp" />
+ <ClCompile Include="bsearch.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ClCompile>
+ <ClCompile Include="guid.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ClCompile>
+ <ClCompile Include="other.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ClCompile>
+ <ClCompile Include="pathUtils.cpp" />
+ <ClCompile Include="printf.cpp" />
+ <ClCompile Include="profiler.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ClCompile>
+ <ClCompile Include="selftest.cpp" />
+ <ClCompile Include="sort.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ClCompile>
+ <ClCompile Include="stdafx.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
+ </ClCompile>
+ <ClCompile Include="string.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ClCompile>
+ <ClCompile Include="string_conv.cpp" />
+ <ClCompile Include="stringNew.cpp" />
+ <ClCompile Include="threads.cpp" />
+ <ClCompile Include="utf8.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ClCompile>
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
\ No newline at end of file diff --git a/plugins/ListeningTo/src/players/foo_mlt/pfc/pfc_12.vcxproj b/plugins/ListeningTo/src/players/foo_mlt/pfc/pfc_12.vcxproj new file mode 100644 index 0000000000..8bd85a71a2 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/pfc/pfc_12.vcxproj @@ -0,0 +1,197 @@ +<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{EBFFFB4E-261D-44D3-B89C-957B31A0BF9C}</ProjectGuid>
+ <RootNamespace>pfc</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <UseOfMfc>false</UseOfMfc>
+ <CharacterSet>Unicode</CharacterSet>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <UseOfMfc>false</UseOfMfc>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup>
+ <_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\Obj\$(ProjectName)\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\Obj\$(ProjectName)\</IntDir>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\Obj\$(ProjectName)\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\Obj\$(ProjectName)\</IntDir>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>_DEBUG;_WINDOWS;PFC_DLL_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <PrecompiledHeader>Use</PrecompiledHeader>
+ <PrecompiledHeaderFile>pfc.h</PrecompiledHeaderFile>
+ <WarningLevel>Level3</WarningLevel>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <Culture>0x0409</Culture>
+ </ResourceCompile>
+ <Lib>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ </Lib>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <Optimization>MaxSpeed</Optimization>
+ <PreprocessorDefinitions>NDEBUG;_WINDOWS;PFC_DLL_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <StringPooling>true</StringPooling>
+ <BufferSecurityCheck>false</BufferSecurityCheck>
+ <FloatingPointModel>Fast</FloatingPointModel>
+ <RuntimeTypeInfo>false</RuntimeTypeInfo>
+ <PrecompiledHeader>Use</PrecompiledHeader>
+ <PrecompiledHeaderFile>pfc.h</PrecompiledHeaderFile>
+ <WarningLevel>Level3</WarningLevel>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <Culture>0x0409</Culture>
+ </ResourceCompile>
+ <Lib>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ </Lib>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClInclude Include="alloc.h" />
+ <ClInclude Include="array.h" />
+ <ClInclude Include="avltree.h" />
+ <ClInclude Include="base64.h" />
+ <ClInclude Include="binary_search.h" />
+ <ClInclude Include="bit_array.h" />
+ <ClInclude Include="bit_array_impl.h" />
+ <ClInclude Include="bit_array_impl_part2.h" />
+ <ClInclude Include="bsearch.h" />
+ <ClInclude Include="bsearch_inline.h" />
+ <ClInclude Include="byte_order_helper.h" />
+ <ClInclude Include="chain_list_v2.h" />
+ <ClInclude Include="com_ptr_t.h" />
+ <ClInclude Include="guid.h" />
+ <ClInclude Include="instance_tracker.h" />
+ <ClInclude Include="int_types.h" />
+ <ClInclude Include="iterators.h" />
+ <ClInclude Include="list.h" />
+ <ClInclude Include="map.h" />
+ <ClInclude Include="order_helper.h" />
+ <ClInclude Include="other.h" />
+ <ClInclude Include="pathUtils.h" />
+ <ClInclude Include="pfc.h" />
+ <ClInclude Include="primitives.h" />
+ <ClInclude Include="profiler.h" />
+ <ClInclude Include="ptr_list.h" />
+ <ClInclude Include="rcptr.h" />
+ <ClInclude Include="ref_counter.h" />
+ <ClInclude Include="sort.h" />
+ <ClInclude Include="string.h" />
+ <ClInclude Include="string8_impl.h" />
+ <ClInclude Include="string_conv.h" />
+ <ClInclude Include="string_list.h" />
+ <ClInclude Include="stringNew.h" />
+ <ClInclude Include="threads.h" />
+ <ClInclude Include="traits.h" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="base64.cpp" />
+ <ClCompile Include="bsearch.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ClCompile>
+ <ClCompile Include="guid.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ClCompile>
+ <ClCompile Include="other.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ClCompile>
+ <ClCompile Include="pathUtils.cpp" />
+ <ClCompile Include="printf.cpp" />
+ <ClCompile Include="profiler.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ClCompile>
+ <ClCompile Include="selftest.cpp" />
+ <ClCompile Include="sort.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ClCompile>
+ <ClCompile Include="stdafx.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
+ </ClCompile>
+ <ClCompile Include="string.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ClCompile>
+ <ClCompile Include="string_conv.cpp" />
+ <ClCompile Include="stringNew.cpp" />
+ <ClCompile Include="threads.cpp" />
+ <ClCompile Include="utf8.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ClCompile>
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
\ No newline at end of file diff --git a/plugins/ListeningTo/src/players/foo_mlt/pfc/pfc_14.vcxproj b/plugins/ListeningTo/src/players/foo_mlt/pfc/pfc_14.vcxproj new file mode 100644 index 0000000000..df2311c9db --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/pfc/pfc_14.vcxproj @@ -0,0 +1,197 @@ +<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{EBFFFB4E-261D-44D3-B89C-957B31A0BF9C}</ProjectGuid>
+ <RootNamespace>pfc</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <UseOfMfc>false</UseOfMfc>
+ <CharacterSet>Unicode</CharacterSet>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <UseOfMfc>false</UseOfMfc>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup>
+ <_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\Obj\$(ProjectName)\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\Obj\$(ProjectName)\</IntDir>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\Obj\$(ProjectName)\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\Obj\$(ProjectName)\</IntDir>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>_DEBUG;_WINDOWS;PFC_DLL_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <PrecompiledHeader>Use</PrecompiledHeader>
+ <PrecompiledHeaderFile>pfc.h</PrecompiledHeaderFile>
+ <WarningLevel>Level3</WarningLevel>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <Culture>0x0409</Culture>
+ </ResourceCompile>
+ <Lib>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ </Lib>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <Optimization>MaxSpeed</Optimization>
+ <PreprocessorDefinitions>NDEBUG;_WINDOWS;PFC_DLL_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <StringPooling>true</StringPooling>
+ <BufferSecurityCheck>false</BufferSecurityCheck>
+ <FloatingPointModel>Fast</FloatingPointModel>
+ <RuntimeTypeInfo>false</RuntimeTypeInfo>
+ <PrecompiledHeader>Use</PrecompiledHeader>
+ <PrecompiledHeaderFile>pfc.h</PrecompiledHeaderFile>
+ <WarningLevel>Level3</WarningLevel>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <Culture>0x0409</Culture>
+ </ResourceCompile>
+ <Lib>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ </Lib>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClInclude Include="alloc.h" />
+ <ClInclude Include="array.h" />
+ <ClInclude Include="avltree.h" />
+ <ClInclude Include="base64.h" />
+ <ClInclude Include="binary_search.h" />
+ <ClInclude Include="bit_array.h" />
+ <ClInclude Include="bit_array_impl.h" />
+ <ClInclude Include="bit_array_impl_part2.h" />
+ <ClInclude Include="bsearch.h" />
+ <ClInclude Include="bsearch_inline.h" />
+ <ClInclude Include="byte_order_helper.h" />
+ <ClInclude Include="chain_list_v2.h" />
+ <ClInclude Include="com_ptr_t.h" />
+ <ClInclude Include="guid.h" />
+ <ClInclude Include="instance_tracker.h" />
+ <ClInclude Include="int_types.h" />
+ <ClInclude Include="iterators.h" />
+ <ClInclude Include="list.h" />
+ <ClInclude Include="map.h" />
+ <ClInclude Include="order_helper.h" />
+ <ClInclude Include="other.h" />
+ <ClInclude Include="pathUtils.h" />
+ <ClInclude Include="pfc.h" />
+ <ClInclude Include="primitives.h" />
+ <ClInclude Include="profiler.h" />
+ <ClInclude Include="ptr_list.h" />
+ <ClInclude Include="rcptr.h" />
+ <ClInclude Include="ref_counter.h" />
+ <ClInclude Include="sort.h" />
+ <ClInclude Include="string.h" />
+ <ClInclude Include="string8_impl.h" />
+ <ClInclude Include="string_conv.h" />
+ <ClInclude Include="string_list.h" />
+ <ClInclude Include="stringNew.h" />
+ <ClInclude Include="threads.h" />
+ <ClInclude Include="traits.h" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="base64.cpp" />
+ <ClCompile Include="bsearch.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ClCompile>
+ <ClCompile Include="guid.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ClCompile>
+ <ClCompile Include="other.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ClCompile>
+ <ClCompile Include="pathUtils.cpp" />
+ <ClCompile Include="printf.cpp" />
+ <ClCompile Include="profiler.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ClCompile>
+ <ClCompile Include="selftest.cpp" />
+ <ClCompile Include="sort.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ClCompile>
+ <ClCompile Include="stdafx.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
+ </ClCompile>
+ <ClCompile Include="string.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ClCompile>
+ <ClCompile Include="string_conv.cpp" />
+ <ClCompile Include="stringNew.cpp" />
+ <ClCompile Include="threads.cpp" />
+ <ClCompile Include="utf8.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ClCompile>
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
\ No newline at end of file diff --git a/plugins/ListeningTo/src/players/foo_mlt/pfc/primitives.h b/plugins/ListeningTo/src/players/foo_mlt/pfc/primitives.h new file mode 100644 index 0000000000..77444e8b67 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/pfc/primitives.h @@ -0,0 +1,801 @@ +#define tabsize(x) ((size_t)(sizeof(x)/sizeof(*x)))
+#define PFC_TABSIZE(x) ((size_t)(sizeof(x)/sizeof(*x)))
+
+#define TEMPLATE_CONSTRUCTOR_FORWARD_FLOOD_WITH_INITIALIZER(THISCLASS,MEMBER,INITIALIZER) \
+ THISCLASS() : MEMBER() INITIALIZER \
+ template<typename t_param1> THISCLASS(const t_param1 & p_param1) : MEMBER(p_param1) INITIALIZER \
+ template<typename t_param1,typename t_param2> THISCLASS(const t_param1 & p_param1,const t_param2 & p_param2) : MEMBER(p_param1,p_param2) INITIALIZER \
+ template<typename t_param1,typename t_param2,typename t_param3> THISCLASS(const t_param1 & p_param1,const t_param2 & p_param2,const t_param3 & p_param3) : MEMBER(p_param1,p_param2,p_param3) INITIALIZER \
+ template<typename t_param1,typename t_param2,typename t_param3,typename t_param4> THISCLASS(const t_param1 & p_param1,const t_param2 & p_param2,const t_param3 & p_param3,const t_param4 & p_param4) : MEMBER(p_param1,p_param2,p_param3,p_param4) INITIALIZER \
+ template<typename t_param1,typename t_param2,typename t_param3,typename t_param4,typename t_param5> THISCLASS(const t_param1 & p_param1,const t_param2 & p_param2,const t_param3 & p_param3,const t_param4 & p_param4,const t_param5 & p_param5) : MEMBER(p_param1,p_param2,p_param3,p_param4,p_param5) INITIALIZER \
+ template<typename t_param1,typename t_param2,typename t_param3,typename t_param4,typename t_param5,typename t_param6> THISCLASS(const t_param1 & p_param1,const t_param2 & p_param2,const t_param3 & p_param3,const t_param4 & p_param4,const t_param5 & p_param5,const t_param6 & p_param6) : MEMBER(p_param1,p_param2,p_param3,p_param4,p_param5,p_param6) INITIALIZER \
+ template<typename t_param1,typename t_param2,typename t_param3,typename t_param4,typename t_param5,typename t_param6, typename t_param7> THISCLASS(const t_param1 & p_param1,const t_param2 & p_param2,const t_param3 & p_param3,const t_param4 & p_param4,const t_param5 & p_param5,const t_param6 & p_param6,const t_param7 & p_param7) : MEMBER(p_param1,p_param2,p_param3,p_param4,p_param5,p_param6,p_param7) INITIALIZER \
+ template<typename t_param1,typename t_param2,typename t_param3,typename t_param4,typename t_param5,typename t_param6, typename t_param7, typename t_param8> THISCLASS(const t_param1 & p_param1,const t_param2 & p_param2,const t_param3 & p_param3,const t_param4 & p_param4,const t_param5 & p_param5,const t_param6 & p_param6,const t_param7 & p_param7, const t_param8 & p_param8) : MEMBER(p_param1,p_param2,p_param3,p_param4,p_param5,p_param6,p_param7, p_param8) INITIALIZER
+
+#define TEMPLATE_CONSTRUCTOR_FORWARD_FLOOD(THISCLASS,MEMBER) TEMPLATE_CONSTRUCTOR_FORWARD_FLOOD_WITH_INITIALIZER(THISCLASS,MEMBER,{})
+
+
+#ifdef _MSC_VER
+
+//Bah. I noticed the fact that std::exception carrying a custom message is MS-specific *after* making exception classes a part of ABI. To be nuked next time fb2k component backwards compatibility is axed.
+
+#define PFC_DECLARE_EXCEPTION(NAME,BASECLASS,DEFAULTMSG) \
+class NAME : public BASECLASS { \
+public: \
+ static const char * g_what() {return DEFAULTMSG;} \
+ NAME() : BASECLASS(DEFAULTMSG,0) {} \
+ NAME(const char * p_msg) : BASECLASS(p_msg) {} \
+ NAME(const char * p_msg,int) : BASECLASS(p_msg,0) {} \
+ NAME(const NAME & p_source) : BASECLASS(p_source) {} \
+};
+
+namespace pfc {
+ template<typename t_exception> PFC_NORETURN inline void throw_exception_with_message(const char * p_message) {
+ throw t_exception(p_message);
+ }
+}
+
+#else
+
+#define PFC_DECLARE_EXCEPTION(NAME,BASECLASS,DEFAULTMSG) \
+class NAME : public BASECLASS { \
+public: \
+ static const char * g_what() {return DEFAULTMSG;} \
+ const char* what() const throw() {return DEFAULTMSG;} \
+};
+
+namespace pfc {
+ template<typename t_base> class __exception_with_message_t : public t_base {
+ private: typedef __exception_with_message_t<t_base> t_self;
+ public:
+ __exception_with_message_t(const char * p_message) : m_message(NULL) {
+ set_message(p_message);
+ }
+ __exception_with_message_t() : m_message(NULL) {}
+ __exception_with_message_t(const t_self & p_source) : m_message(NULL) {set_message(p_source.m_message);}
+
+ const char* what() const throw() {return m_message != NULL ? m_message : "unnamed exception";}
+
+ const t_self & operator=(const t_self & p_source) {set_message(p_source.m_message);}
+
+ ~__exception_with_message_t() throw() {cleanup();}
+
+ private:
+ void set_message(const char * p_message) throw() {
+ cleanup();
+ if (p_message != NULL) m_message = strdup(p_message);
+ }
+ void cleanup() throw() {
+ if (m_message != NULL) {free(m_message); m_message = NULL;}
+ }
+ char * m_message;
+ };
+ PFC_NORETURN template<typename t_exception> void throw_exception_with_message(const char * p_message) {
+ throw __exception_with_message_t<t_exception>(p_message);
+ }
+}
+#endif
+
+namespace pfc {
+
+ template<typename p_type1,typename p_type2> class assert_same_type;
+ template<typename p_type> class assert_same_type<p_type,p_type> {};
+
+ template<typename p_type1,typename p_type2>
+ class is_same_type { public: enum {value = false}; };
+
+ template<typename p_type>
+ class is_same_type<p_type,p_type> { public: enum {value = true}; };
+
+// template<bool val> class static_assert;
+// template<> class static_assert<true> {};
+
+ template<bool val> class static_assert_t;
+ template<> class static_assert_t<true> {};
+
+#define PFC_STATIC_ASSERT(X) { pfc::static_assert_t<(X)>(); }
+
+ template<typename t_type>
+ void assert_raw_type() {static_assert_t< !traits_t<t_type>::needs_constructor && !traits_t<t_type>::needs_destructor >();}
+
+ template<typename t_type> class assert_byte_type;
+ template<> class assert_byte_type<t_uint8> {};
+ template<> class assert_byte_type<t_int8> {};
+
+
+ template<typename t_type> void __unsafe__memcpy_t(t_type * p_dst,const t_type * p_src,t_size p_count) {
+ ::memcpy(reinterpret_cast<void*>(p_dst), reinterpret_cast<const void*>(p_src), p_count * sizeof(t_type));
+ }
+
+ template<typename t_type> void __unsafe__in_place_destructor_t(t_type & p_item) throw() {
+ if (traits_t<t_type>::needs_destructor) try{ p_item.~t_type(); } catch(...) {}
+ }
+
+ template<typename t_type> void __unsafe__in_place_constructor_t(t_type & p_item) {
+ if (traits_t<t_type>::needs_constructor) {
+ t_type * ret = new(&p_item) t_type;
+ PFC_ASSERT(ret == &p_item);
+ }
+ }
+
+ template<typename t_type> void __unsafe__in_place_destructor_array_t(t_type * p_items, t_size p_count) throw() {
+ if (traits_t<t_type>::needs_destructor) {
+ t_type * walk = p_items;
+ for(t_size n=p_count;n;--n) __unsafe__in_place_destructor_t(*(walk++));
+ }
+ }
+
+ template<typename t_type> t_type * __unsafe__in_place_constructor_array_t(t_type * p_items,t_size p_count) {
+ if (traits_t<t_type>::needs_constructor) {
+ t_size walkptr = 0;
+ try {
+ for(walkptr=0;walkptr<p_count;++walkptr) __unsafe__in_place_constructor_t(p_items[walkptr]);
+ } catch(...) {
+ __unsafe__in_place_destructor_array_t(p_items,walkptr);
+ throw;
+ }
+ }
+ return p_items;
+ }
+
+ template<typename t_type> t_type * __unsafe__in_place_resize_array_t(t_type * p_items,t_size p_from,t_size p_to) {
+ if (p_from < p_to) __unsafe__in_place_constructor_array_t(p_items + p_from, p_to - p_from);
+ else if (p_from > p_to) __unsafe__in_place_destructor_array_t(p_items + p_to, p_from - p_to);
+ return p_items;
+ }
+
+ template<typename t_type,typename t_copy> void __unsafe__in_place_constructor_copy_t(t_type & p_item,const t_copy & p_copyfrom) {
+ if (traits_t<t_type>::needs_constructor) {
+ t_type * ret = new(&p_item) t_type(p_copyfrom);
+ PFC_ASSERT(ret == &p_item);
+ } else {
+ p_item = p_copyfrom;
+ }
+ }
+
+ template<typename t_type,typename t_copy> t_type * __unsafe__in_place_constructor_array_copy_t(t_type * p_items,t_size p_count, const t_copy * p_copyfrom) {
+ t_size walkptr = 0;
+ try {
+ for(walkptr=0;walkptr<p_count;++walkptr) __unsafe__in_place_constructor_copy_t(p_items[walkptr],p_copyfrom[walkptr]);
+ } catch(...) {
+ __unsafe__in_place_destructor_array_t(p_items,walkptr);
+ throw;
+ }
+ return p_items;
+ }
+
+ template<typename t_type,typename t_copy> t_type * __unsafe__in_place_constructor_array_copy_partial_t(t_type * p_items,t_size p_count, const t_copy * p_copyfrom,t_size p_copyfrom_count) {
+ if (p_copyfrom_count > p_count) p_copyfrom_count = p_count;
+ __unsafe__in_place_constructor_array_copy_t(p_items,p_copyfrom_count,p_copyfrom);
+ try {
+ __unsafe__in_place_constructor_array_t(p_items + p_copyfrom_count,p_count - p_copyfrom_count);
+ } catch(...) {
+ __unsafe__in_place_destructor_array_t(p_items,p_copyfrom_count);
+ throw;
+ }
+ return p_items;
+ }
+
+ template<typename t_ret> t_ret implicit_cast(t_ret val) {return val;}
+
+ template<typename t_ret,typename t_param>
+ t_ret * safe_ptr_cast(t_param * p_param) {
+ if (pfc::is_same_type<t_ret,t_param>::value) return p_param;
+ else {
+ if (p_param == NULL) return NULL;
+ else return p_param;
+ }
+ }
+
+ typedef std::exception exception;
+
+ PFC_DECLARE_EXCEPTION(exception_overflow,exception,"Overflow");
+ PFC_DECLARE_EXCEPTION(exception_bug_check,exception,"Bug check");
+ PFC_DECLARE_EXCEPTION(exception_invalid_params,exception_bug_check,"Invalid parameters");
+ PFC_DECLARE_EXCEPTION(exception_unexpected_recursion,exception_bug_check,"Unexpected recursion");
+ PFC_DECLARE_EXCEPTION(exception_not_implemented,exception_bug_check,"Feature not implemented");
+ PFC_DECLARE_EXCEPTION(exception_dynamic_assert,exception_bug_check,"dynamic_assert failure");
+
+ template<typename t_ret,typename t_param>
+ t_ret downcast_guarded(const t_param & p_param) {
+ t_ret temp = (t_ret) p_param;
+ if ((t_param) temp != p_param) throw exception_overflow();
+ return temp;
+ }
+
+ template<typename t_exception,typename t_ret,typename t_param>
+ t_ret downcast_guarded_ex(const t_param & p_param) {
+ t_ret temp = (t_ret) p_param;
+ if ((t_param) temp != p_param) throw t_exception();
+ return temp;
+ }
+
+ template<typename t_acc,typename t_add>
+ void accumulate_guarded(t_acc & p_acc, const t_add & p_add) {
+ t_acc delta = downcast_guarded<t_acc>(p_add);
+ delta += p_acc;
+ if (delta < p_acc) throw exception_overflow();
+ p_acc = delta;
+ }
+
+ //deprecated
+ inline void bug_check_assert(bool p_condition, const char * p_msg) {
+ if (!p_condition) {
+ PFC_ASSERT(0);
+ throw_exception_with_message<exception_bug_check>(p_msg);
+ }
+ }
+ //deprecated
+ inline void bug_check_assert(bool p_condition) {
+ if (!p_condition) {
+ PFC_ASSERT(0);
+ throw exception_bug_check();
+ }
+ }
+
+ inline void dynamic_assert(bool p_condition, const char * p_msg) {
+ if (!p_condition) {
+ PFC_ASSERT(0);
+ throw_exception_with_message<exception_dynamic_assert>(p_msg);
+ }
+ }
+ inline void dynamic_assert(bool p_condition) {
+ if (!p_condition) {
+ PFC_ASSERT(0);
+ throw exception_dynamic_assert();
+ }
+ }
+
+ template<typename T>
+ inline void swap_multi_t(T * p_buffer1,T * p_buffer2,t_size p_size) {
+ T * walk1 = p_buffer1, * walk2 = p_buffer2;
+ for(t_size n=p_size;n;--n) {
+ T temp (* walk1);
+ *walk1 = *walk2;
+ *walk2 = temp;
+ walk1++; walk2++;
+ }
+ }
+
+ template<typename T,t_size p_size>
+ inline void swap_multi_t(T * p_buffer1,T * p_buffer2) {
+ T * walk1 = p_buffer1, * walk2 = p_buffer2;
+ for(t_size n=p_size;n;--n) {
+ T temp (* walk1);
+ *walk1 = *walk2;
+ *walk2 = temp;
+ walk1++; walk2++;
+ }
+ }
+
+
+ template<t_size p_size>
+ inline void __unsafe__swap_raw_t(void * p_object1, void * p_object2) {
+ if (p_size % sizeof(t_size) == 0) {
+ swap_multi_t<t_size,p_size/sizeof(t_size)>(reinterpret_cast<t_size*>(p_object1),reinterpret_cast<t_size*>(p_object2));
+ } else {
+ swap_multi_t<t_uint8,p_size>(reinterpret_cast<t_uint8*>(p_object1),reinterpret_cast<t_uint8*>(p_object2));
+ }
+ }
+
+ template<typename T>
+ inline void swap_t(T & p_item1, T & p_item2) {
+ if (traits_t<T>::realloc_safe) {
+ __unsafe__swap_raw_t<sizeof(T)>( reinterpret_cast<void*>( &p_item1 ), reinterpret_cast<void*>( &p_item2 ) );
+ } else {
+ T temp(p_item2);
+ p_item2 = p_item1;
+ p_item1 = temp;
+ }
+ }
+
+ //! This is similar to plain p_item1 = p_item2; assignment, but optimized for the case where p_item2 content is no longer needed later on. This can be overridden for specific classes for optimal performance. \n
+ //! p_item2 value is undefined after performing a move_t. For an example, in certain cases move_t will fall back to swap_t.
+ template<typename T>
+ inline void move_t(T & p_item1, T & p_item2) {
+ typedef traits_t<T> t;
+ if (t::needs_constructor || t::needs_destructor) {
+ if (t::realloc_safe) swap_t(p_item1, p_item2);
+ else p_item1 = p_item2;
+ } else {
+ p_item1 = p_item2;
+ }
+ }
+
+ template<typename t_array>
+ t_size array_size_t(const t_array & p_array) {return p_array.get_size();}
+
+ template<typename t_item, t_size p_width>
+ t_size array_size_t(const t_item (&p_array)[p_width]) {return p_width;}
+
+ template<typename t_array, typename t_item> static bool array_isLast(const t_array & arr, const t_item & item) {
+ const t_size size = pfc::array_size_t(arr);
+ return size > 0 && arr[size-1] == item;
+ }
+ template<typename t_array, typename t_item> static bool array_isFirst(const t_array & arr, const t_item & item) {
+ const t_size size = pfc::array_size_t(arr);
+ return size > 0 && arr[0] == item;
+ }
+
+ template<typename t_array,typename t_filler>
+ inline void fill_t(t_array & p_buffer,const t_size p_count, const t_filler & p_filler) {
+ for(t_size n=0;n<p_count;n++)
+ p_buffer[n] = p_filler;
+ }
+
+ template<typename t_array,typename t_filler>
+ inline void fill_ptr_t(t_array * p_buffer,const t_size p_count, const t_filler & p_filler) {
+ for(t_size n=0;n<p_count;n++)
+ p_buffer[n] = p_filler;
+ }
+
+ template<typename t_item1, typename t_item2>
+ inline int compare_t(const t_item1 & p_item1, const t_item2 & p_item2) {
+ if (p_item1 < p_item2) return -1;
+ else if (p_item1 > p_item2) return 1;
+ else return 0;
+ }
+
+ //! For use with avltree/map etc.
+ class comparator_default {
+ public:
+ template<typename t_item1,typename t_item2>
+ inline static int compare(const t_item1 & p_item1,const t_item2 & p_item2) {return pfc::compare_t(p_item1,p_item2);}
+ };
+
+ template<typename t_comparator = pfc::comparator_default> class comparator_pointer { public:
+ template<typename t_item1,typename t_item2> static int compare(const t_item1 & p_item1,const t_item2 & p_item2) {return t_comparator::compare(*p_item1,*p_item2);}
+ };
+
+ template<typename t_primary,typename t_secondary> class comparator_dual { public:
+ template<typename t_item1,typename t_item2> static int compare(const t_item1 & p_item1,const t_item2 & p_item2) {
+ int state = t_primary::compare(p_item1,p_item2);
+ if (state != 0) return state;
+ return t_secondary::compare(p_item1,p_item2);
+ }
+ };
+
+ class comparator_memcmp {
+ public:
+ template<typename t_item1,typename t_item2>
+ inline static int compare(const t_item1 & p_item1,const t_item2 & p_item2) {
+ static_assert_t<sizeof(t_item1) == sizeof(t_item2)>();
+ return memcmp(&p_item1,&p_item2,sizeof(t_item1));
+ }
+ };
+
+ template<typename t_source1, typename t_source2>
+ t_size subtract_sorted_lists_calculate_count(const t_source1 & p_source1, const t_source2 & p_source2) {
+ t_size walk1 = 0, walk2 = 0, walk_out = 0;
+ const t_size max1 = p_source1.get_size(), max2 = p_source2.get_size();
+ for (;;) {
+ int state;
+ if (walk1 < max1 && walk2 < max2) {
+ state = pfc::compare_t(p_source1[walk1],p_source2[walk2]);
+ } else if (walk1 < max1) {
+ state = -1;
+ } else if (walk2 < max2) {
+ state = 1;
+ } else {
+ break;
+ }
+ if (state < 0) walk_out++;
+ if (state <= 0) walk1++;
+ if (state >= 0) walk2++;
+ }
+ return walk_out;
+ }
+
+ //! Subtracts p_source2 contents from p_source1 and stores result in p_destination. Both source lists must be sorted.
+ //! Note: duplicates will be carried over (and ignored for p_source2).
+ template<typename t_destination, typename t_source1, typename t_source2>
+ void subtract_sorted_lists(t_destination & p_destination,const t_source1 & p_source1, const t_source2 & p_source2) {
+ p_destination.set_size(subtract_sorted_lists_calculate_count(p_source1,p_source2));
+ t_size walk1 = 0, walk2 = 0, walk_out = 0;
+ const t_size max1 = p_source1.get_size(), max2 = p_source2.get_size();
+ for (;;) {
+ int state;
+ if (walk1 < max1 && walk2 < max2) {
+ state = pfc::compare_t(p_source1[walk1],p_source2[walk2]);
+ } else if (walk1 < max1) {
+ state = -1;
+ } else if (walk2 < max2) {
+ state = 1;
+ } else {
+ break;
+ }
+
+
+ if (state < 0) p_destination[walk_out++] = p_source1[walk1];
+ if (state <= 0) walk1++;
+ if (state >= 0) walk2++;
+ }
+ }
+
+ template<typename t_source1, typename t_source2>
+ t_size merge_sorted_lists_calculate_count(const t_source1 & p_source1, const t_source2 & p_source2) {
+ t_size walk1 = 0, walk2 = 0, walk_out = 0;
+ const t_size max1 = p_source1.get_size(), max2 = p_source2.get_size();
+ for (;;) {
+ int state;
+ if (walk1 < max1 && walk2 < max2) {
+ state = pfc::compare_t(p_source1[walk1],p_source2[walk2]);
+ } else if (walk1 < max1) {
+ state = -1;
+ } else if (walk2 < max2) {
+ state = 1;
+ } else {
+ break;
+ }
+ if (state <= 0) walk1++;
+ if (state >= 0) walk2++;
+ walk_out++;
+ }
+ return walk_out;
+ }
+
+ //! Merges p_source1 and p_source2, storing content in p_destination. Both source lists must be sorted.
+ //! Note: duplicates will be carried over.
+ template<typename t_destination, typename t_source1, typename t_source2>
+ void merge_sorted_lists(t_destination & p_destination,const t_source1 & p_source1, const t_source2 & p_source2) {
+ p_destination.set_size(merge_sorted_lists_calculate_count(p_source1,p_source2));
+ t_size walk1 = 0, walk2 = 0, walk_out = 0;
+ const t_size max1 = p_source1.get_size(), max2 = p_source2.get_size();
+ for (;;) {
+ int state;
+ if (walk1 < max1 && walk2 < max2) {
+ state = pfc::compare_t(p_source1[walk1],p_source2[walk2]);
+ } else if (walk1 < max1) {
+ state = -1;
+ } else if (walk2 < max2) {
+ state = 1;
+ } else {
+ break;
+ }
+ if (state < 0) {
+ p_destination[walk_out] = p_source1[walk1++];
+ } else if (state > 0) {
+ p_destination[walk_out] = p_source2[walk2++];
+ } else {
+ p_destination[walk_out] = p_source1[walk1];
+ walk1++; walk2++;
+ }
+ walk_out++;
+ }
+ }
+
+
+
+ template<typename t_array,typename T>
+ inline t_size append_t(t_array & p_array,const T & p_item)
+ {
+ t_size old_count = p_array.get_size();
+ p_array.set_size(old_count + 1);
+ p_array[old_count] = p_item;
+ return old_count;
+ }
+
+ template<typename t_array,typename T>
+ inline t_size append_swap_t(t_array & p_array,T & p_item)
+ {
+ t_size old_count = p_array.get_size();
+ p_array.set_size(old_count + 1);
+ swap_t(p_array[old_count],p_item);
+ return old_count;
+ }
+
+ template<typename t_array>
+ inline t_size insert_uninitialized_t(t_array & p_array,t_size p_index) {
+ t_size old_count = p_array.get_size();
+ if (p_index > old_count) p_index = old_count;
+ p_array.set_size(old_count + 1);
+ for(t_size n=old_count;n>p_index;n--) move_t(p_array[n], p_array[n-1]);
+ return p_index;
+ }
+
+ template<typename t_array,typename T>
+ inline t_size insert_t(t_array & p_array,const T & p_item,t_size p_index) {
+ t_size old_count = p_array.get_size();
+ if (p_index > old_count) p_index = old_count;
+ p_array.set_size(old_count + 1);
+ for(t_size n=old_count;n>p_index;n--)
+ move_t(p_array[n], p_array[n-1]);
+ p_array[p_index] = p_item;
+ return p_index;
+ }
+
+ template<typename t_array,typename T>
+ inline t_size insert_swap_t(t_array & p_array,T & p_item,t_size p_index) {
+ t_size old_count = p_array.get_size();
+ if (p_index > old_count) p_index = old_count;
+ p_array.set_size(old_count + 1);
+ for(t_size n=old_count;n>p_index;n--)
+ swap_t(p_array[n],p_array[n-1]);
+ swap_t(p_array[p_index],p_item);
+ return p_index;
+ }
+
+
+ template<typename T>
+ inline T max_t(const T & item1, const T & item2) {return item1 > item2 ? item1 : item2;};
+
+ template<typename T>
+ inline T min_t(const T & item1, const T & item2) {return item1 < item2 ? item1 : item2;};
+
+ template<typename T>
+ inline T abs_t(T item) {return item<0 ? -item : item;}
+
+ template<typename T>
+ inline T sqr_t(T item) {return item * item;}
+
+ template<typename T>
+ inline T clip_t(const T & p_item, const T & p_min, const T & p_max) {
+ if (p_item < p_min) return p_min;
+ else if (p_item <= p_max) return p_item;
+ else return p_max;
+ }
+
+
+
+
+
+ template<typename T>
+ inline void delete_t(T* ptr) {delete ptr;}
+
+ template<typename T>
+ inline void delete_array_t(T* ptr) {delete[] ptr;}
+
+ template<typename T>
+ inline T* clone_t(T* ptr) {return new T(*ptr);}
+
+
+ template<typename t_exception,typename t_int>
+ inline t_int mul_safe_t(t_int p_val1,t_int p_val2) {
+ if (p_val1 == 0 || p_val2 == 0) return 0;
+ t_int temp = (t_int) (p_val1 * p_val2);
+ if (temp / p_val1 != p_val2) throw t_exception();
+ return temp;
+ }
+ template<typename t_int>
+ t_int multiply_guarded(t_int v1, t_int v2) {
+ return mul_safe_t<exception_overflow>(v1, v2);
+ }
+
+ template<typename t_src,typename t_dst>
+ void memcpy_t(t_dst* p_dst,const t_src* p_src,t_size p_count) {
+ for(t_size n=0;n<p_count;n++) p_dst[n] = p_src[n];
+ }
+
+ template<typename t_dst,typename t_src>
+ void copy_array_loop_t(t_dst & p_dst,const t_src & p_src,t_size p_count) {
+ for(t_size n=0;n<p_count;n++) p_dst[n] = p_src[n];
+ }
+
+ template<typename t_src,typename t_dst>
+ void memcpy_backwards_t(t_dst * p_dst,const t_src * p_src,t_size p_count) {
+ p_dst += p_count; p_src += p_count;
+ for(t_size n=0;n<p_count;n++) *(--p_dst) = *(--p_src);
+ }
+
+ template<typename T,typename t_val>
+ void memset_t(T * p_buffer,const t_val & p_val,t_size p_count) {
+ for(t_size n=0;n<p_count;n++) p_buffer[n] = p_val;
+ }
+
+ template<typename T,typename t_val>
+ void memset_t(T &p_buffer,const t_val & p_val) {
+ const t_size width = pfc::array_size_t(p_buffer);
+ for(t_size n=0;n<width;n++) p_buffer[n] = p_val;
+ }
+
+ template<typename T>
+ void memset_null_t(T * p_buffer,t_size p_count) {
+ for(t_size n=0;n<p_count;n++) p_buffer[n] = 0;
+ }
+
+ template<typename T>
+ void memset_null_t(T &p_buffer) {
+ const t_size width = pfc::array_size_t(p_buffer);
+ for(t_size n=0;n<width;n++) p_buffer[n] = 0;
+ }
+
+ template<typename T>
+ void memmove_t(T* p_dst,const T* p_src,t_size p_count) {
+ if (p_dst == p_src) {/*do nothing*/}
+ else if (p_dst > p_src && p_dst < p_src + p_count) memcpy_backwards_t<T>(p_dst,p_src,p_count);
+ else memcpy_t<T>(p_dst,p_src,p_count);
+ }
+
+ template<typename TVal> void memxor_t(TVal * out, const TVal * s1, const TVal * s2, t_size count) {
+ for(t_size walk = 0; walk < count; ++walk) out[walk] = s1[walk] ^ s2[walk];
+ }
+ static void memxor(void * target, const void * source1, const void * source2, t_size size) {
+ memxor_t( reinterpret_cast<t_uint8*>(target), reinterpret_cast<const t_uint8*>(source1), reinterpret_cast<const t_uint8*>(source2), size);
+ }
+
+ template<typename T>
+ T* new_ptr_check_t(T* p_ptr) {
+ if (p_ptr == NULL) throw std::bad_alloc();
+ return p_ptr;
+ }
+
+ template<typename T>
+ int sgn_t(const T & p_val) {
+ if (p_val < 0) return -1;
+ else if (p_val > 0) return 1;
+ else return 0;
+ }
+
+ template<typename T> const T* empty_string_t();
+
+ template<> inline const char * empty_string_t<char>() {return "";}
+ template<> inline const wchar_t * empty_string_t<wchar_t>() {return L"";}
+
+
+ template<typename t_type,typename t_newval>
+ t_type replace_t(t_type & p_var,const t_newval & p_newval) {
+ t_type oldval = p_var;
+ p_var = p_newval;
+ return oldval;
+ }
+ template<typename t_type>
+ t_type replace_null_t(t_type & p_var) {
+ t_type ret = p_var;
+ p_var = NULL;
+ return ret;
+ }
+
+ template<t_size p_size_pow2>
+ inline bool is_ptr_aligned_t(const void * p_ptr) {
+ static_assert_t< (p_size_pow2 & (p_size_pow2 - 1)) == 0 >();
+ return ( ((t_size)p_ptr) & (p_size_pow2-1) ) == 0;
+ }
+
+
+ template<typename t_array>
+ void array_rangecheck_t(const t_array & p_array,t_size p_index) {
+ if (p_index >= pfc::array_size_t(p_array)) throw pfc::exception_overflow();
+ }
+
+ template<typename t_array>
+ void array_rangecheck_t(const t_array & p_array,t_size p_from,t_size p_to) {
+ if (p_from > p_to) throw pfc::exception_overflow();
+ array_rangecheck_t(p_array,p_from); array_rangecheck_t(p_array,p_to);
+ }
+
+ inline t_int32 rint32(double p_val) {return (t_int32) floor(p_val + 0.5);}
+ inline t_int64 rint64(double p_val) {return (t_int64) floor(p_val + 0.5);}
+
+
+
+
+ template<typename t_array>
+ inline t_size remove_mask_t(t_array & p_array,const bit_array & p_mask)//returns amount of items left
+ {
+ t_size n,count = p_array.get_size(), total = 0;
+
+ n = total = p_mask.find(true,0,count);
+
+ if (n<count)
+ {
+ for(n=p_mask.find(false,n+1,count-n-1);n<count;n=p_mask.find(false,n+1,count-n-1))
+ move_t(p_array[total++],p_array[n]);
+
+ p_array.set_size(total);
+
+ return total;
+ }
+ else return count;
+ }
+
+ template<typename t_array,typename t_compare>
+ t_size find_duplicates_sorted_t(t_array p_array,t_size p_count,t_compare p_compare,bit_array_var & p_out) {
+ t_size ret = 0;
+ t_size n;
+ if (p_count > 0)
+ {
+ p_out.set(0,false);
+ for(n=1;n<p_count;n++)
+ {
+ bool found = p_compare(p_array[n-1],p_array[n]) == 0;
+ if (found) ret++;
+ p_out.set(n,found);
+ }
+ }
+ return ret;
+ }
+
+ template<typename t_array,typename t_compare,typename t_permutation>
+ t_size find_duplicates_sorted_permutation_t(t_array p_array,t_size p_count,t_compare p_compare,t_permutation const & p_permutation,bit_array_var & p_out) {
+ t_size ret = 0;
+ t_size n;
+ if (p_count > 0) {
+ p_out.set(p_permutation[0],false);
+ for(n=1;n<p_count;n++)
+ {
+ bool found = p_compare(p_array[p_permutation[n-1]],p_array[p_permutation[n]]) == 0;
+ if (found) ret++;
+ p_out.set(p_permutation[n],found);
+ }
+ }
+ return ret;
+ }
+
+ template<typename t_char>
+ t_size strlen_t(const t_char * p_string,t_size p_length = ~0) {
+ for(t_size walk = 0;;walk++) {
+ if (walk >= p_length || p_string[walk] == 0) return walk;
+ }
+ }
+
+
+ template<typename t_array>
+ class __list_to_array_enumerator {
+ public:
+ __list_to_array_enumerator(t_array & p_array) : m_array(p_array), m_walk(0) {}
+ template<typename t_item>
+ void operator() (const t_item & p_item) {
+ PFC_ASSERT(m_walk < m_array.get_size());
+ m_array[m_walk++] = p_item;
+ }
+ void finalize() {
+ PFC_ASSERT(m_walk == m_array.get_size());
+ }
+ private:
+ t_size m_walk;
+ t_array & m_array;
+ };
+
+ template<typename t_list,typename t_array>
+ void list_to_array(t_array & p_array,const t_list & p_list) {
+ p_array.set_size(p_list.get_count());
+ __list_to_array_enumerator<t_array> enumerator(p_array);
+ p_list.enumerate(enumerator);
+ enumerator.finalize();
+ }
+
+ template<typename t_receiver>
+ class enumerator_add_item {
+ public:
+ enumerator_add_item(t_receiver & p_receiver) : m_receiver(p_receiver) {}
+ template<typename t_item> void operator() (const t_item & p_item) {m_receiver.add_item(p_item);}
+ private:
+ t_receiver & m_receiver;
+ };
+
+ template<typename t_receiver,typename t_giver>
+ void overwrite_list_enumerated(t_receiver & p_receiver,const t_giver & p_giver) {
+ enumerator_add_item<t_receiver> wrapper(p_receiver);
+ p_giver.enumerate(wrapper);
+ }
+
+ template<typename t_receiver,typename t_giver>
+ void copy_list_enumerated(t_receiver & p_receiver,const t_giver & p_giver) {
+ p_receiver.remove_all();
+ overwrite_list_enumerated(p_receiver,p_giver);
+ }
+
+ inline bool lxor(bool p_val1,bool p_val2) {
+ return p_val1 == !p_val2;
+ }
+
+ template<typename t_val>
+ inline void min_acc(t_val & p_acc,const t_val & p_val) {
+ if (p_val < p_acc) p_acc = p_val;
+ }
+
+ template<typename t_val>
+ inline void max_acc(t_val & p_acc,const t_val & p_val) {
+ if (p_val > p_acc) p_acc = p_val;
+ }
+
+ t_uint64 pow_int(t_uint64 base, t_uint64 exp);
+};
+
+
+#define PFC_CLASS_NOT_COPYABLE(THISCLASSNAME,THISTYPE) \
+ private: \
+ THISCLASSNAME(const THISTYPE&) {throw pfc::exception_bug_check();} \
+ const THISTYPE & operator=(const THISTYPE &) {throw pfc::exception_bug_check();}
+
+#define PFC_CLASS_NOT_COPYABLE_EX(THISTYPE) PFC_CLASS_NOT_COPYABLE(THISTYPE,THISTYPE)
\ No newline at end of file diff --git a/plugins/ListeningTo/src/players/foo_mlt/pfc/printf.cpp b/plugins/ListeningTo/src/players/foo_mlt/pfc/printf.cpp new file mode 100644 index 0000000000..cdfa6a5cf9 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/pfc/printf.cpp @@ -0,0 +1,117 @@ +#include "pfc.h"
+
+//implementations of deprecated string_printf methods, with a pragma to disable warnings when they reference other deprecated methods.
+
+#pragma warning(disable:4996)
+
+namespace pfc {
+
+void string_printf::run(const char * fmt,va_list list) {g_run(*this,fmt,list);}
+
+string_printf_va::string_printf_va(const char * fmt,va_list list) {string_printf::g_run(*this,fmt,list);}
+
+void string_printf::g_run(string_base & out,const char * fmt,va_list list)
+{
+ out.reset();
+ while(*fmt)
+ {
+ if (*fmt=='%')
+ {
+ fmt++;
+ if (*fmt=='%')
+ {
+ out.add_char('%');
+ fmt++;
+ }
+ else
+ {
+ bool force_sign = false;
+ if (*fmt=='+')
+ {
+ force_sign = true;
+ fmt++;
+ }
+ char padchar = (*fmt == '0') ? '0' : ' ';
+ t_size pad = 0;
+ while(*fmt>='0' && *fmt<='9')
+ {
+ pad = pad * 10 + (*fmt - '0');
+ fmt++;
+ }
+
+ if (*fmt=='s' || *fmt=='S')
+ {
+ const char * ptr = va_arg(list,const char*);
+ t_size len = strlen(ptr);
+ if (pad>len) out.add_chars(padchar,pad-len);
+ out.add_string(ptr);
+ fmt++;
+
+ }
+ else if (*fmt=='i' || *fmt=='I' || *fmt=='d' || *fmt=='D')
+ {
+ char temp[8*sizeof(int)];
+ int val = va_arg(list,int);
+ if (force_sign && val>0) out.add_char('+');
+ _itoa_s(val,temp,10);
+ t_size len = strlen(temp);
+ if (pad>len) out.add_chars(padchar,pad-len);
+ out.add_string(temp);
+ fmt++;
+ }
+ else if (*fmt=='u' || *fmt=='U')
+ {
+ char temp[8*sizeof(int)];
+ int val = va_arg(list,int);
+ if (force_sign && val>0) out.add_char('+');
+ _ultoa_s(val,temp,10);
+ t_size len = strlen(temp);
+ if (pad>len) out.add_chars(padchar,pad-len);
+ out.add_string(temp);
+ fmt++;
+ }
+ else if (*fmt=='x' || *fmt=='X')
+ {
+ char temp[8*sizeof(int)];
+ int val = va_arg(list,int);
+ if (force_sign && val>0) out.add_char('+');
+ _ultoa_s(val,temp,16);
+ if (*fmt=='X')
+ {
+ char * t = temp;
+ while(*t)
+ {
+ if (*t>='a' && *t<='z')
+ *t += 'A' - 'a';
+ t++;
+ }
+ }
+ t_size len = strlen(temp);
+ if (pad>len) out.add_chars(padchar,pad-len);
+ out.add_string(temp);
+ fmt++;
+ }
+ else if (*fmt=='c' || *fmt=='C')
+ {
+ out.add_char(va_arg(list,char));
+ fmt++;
+ }
+ }
+ }
+ else
+ {
+ out.add_char(*(fmt++));
+ }
+ }
+}
+
+string_printf::string_printf(const char * fmt,...)
+{
+ va_list list;
+ va_start(list,fmt);
+ run(fmt,list);
+ va_end(list);
+}
+
+
+}
\ No newline at end of file diff --git a/plugins/ListeningTo/src/players/foo_mlt/pfc/profiler.cpp b/plugins/ListeningTo/src/players/foo_mlt/pfc/profiler.cpp new file mode 100644 index 0000000000..3ec7ae5789 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/pfc/profiler.cpp @@ -0,0 +1,34 @@ +#include "pfc.h"
+
+#ifdef _WINDOWS
+namespace pfc {
+
+profiler_static::profiler_static(const char * p_name)
+{
+ name = p_name;
+ total_time = 0;
+ num_called = 0;
+}
+
+profiler_static::~profiler_static()
+{
+ try {
+ pfc::string_fixed_t<511> message;
+ message << "profiler: " << pfc::format_pad_left<pfc::string_fixed_t<127> >(48,' ',name) << " - " <<
+ pfc::format_pad_right<pfc::string_fixed_t<128> >(16,' ',pfc::format_uint(total_time) ) << " cycles";
+
+ if (num_called > 0) {
+ message << " (executed " << num_called << " times, " << (total_time / num_called) << " average)";
+ }
+ message << "\n";
+ OutputDebugStringA(message);
+ } catch(...) {
+ //should never happen
+ OutputDebugString(_T("unexpected profiler failure\n"));
+ }
+}
+
+}
+#else
+//PORTME
+#endif
diff --git a/plugins/ListeningTo/src/players/foo_mlt/pfc/profiler.h b/plugins/ListeningTo/src/players/foo_mlt/pfc/profiler.h new file mode 100644 index 0000000000..11715d3a5e --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/pfc/profiler.h @@ -0,0 +1,100 @@ +#ifndef _PFC_PROFILER_H_
+#define _PFC_PROFILER_H_
+
+#ifdef _WINDOWS
+
+#include <intrin.h>
+namespace pfc {
+class profiler_static {
+public:
+ profiler_static(const char * p_name);
+ ~profiler_static();
+ void add_time(t_int64 delta) {total_time+=delta;num_called++;}
+private:
+ const char * name;
+ t_uint64 total_time,num_called;
+};
+
+class profiler_local {
+public:
+ profiler_local(profiler_static * p_owner) {
+ owner = p_owner;
+ start = __rdtsc();
+ }
+ ~profiler_local() {
+ t_int64 end = __rdtsc();
+ owner->add_time(end-start);
+ }
+private:
+ t_int64 start;
+ profiler_static * owner;
+};
+
+#define profiler(name) \
+ static pfc::profiler_static profiler_static_##name(#name); \
+ pfc::profiler_local profiler_local_##name(&profiler_static_##name);
+
+
+class hires_timer {
+public:
+ void start() {
+ m_start = g_query();
+ }
+ double query() const {
+ return _query( g_query() );
+ }
+ double query_reset() {
+ t_uint64 current = g_query();
+ double ret = _query(current);
+ m_start = current;
+ return ret;
+ }
+private:
+ double _query(t_uint64 p_val) const {
+ return (double)( p_val - m_start ) / (double) g_query_freq();
+ }
+ static t_uint64 g_query() {
+ LARGE_INTEGER val;
+ if (!QueryPerformanceCounter(&val)) throw pfc::exception_not_implemented();
+ return val.QuadPart;
+ }
+ static t_uint64 g_query_freq() {
+ LARGE_INTEGER val;
+ if (!QueryPerformanceFrequency(&val)) throw pfc::exception_not_implemented();
+ return val.QuadPart;
+ }
+ t_uint64 m_start;
+};
+
+class lores_timer {
+public:
+ void start() {
+ _start(GetTickCount());
+ }
+
+ double query() const {
+ return _query(GetTickCount());
+ }
+ double query_reset() {
+ t_uint32 time = GetTickCount();
+ double ret = _query(time);
+ _start(time);
+ return ret;
+ }
+private:
+ void _start(t_uint32 p_time) {m_last_seen = m_start = p_time;}
+ double _query(t_uint32 p_time) const {
+ t_uint64 time = p_time;
+ if (time < (m_last_seen & 0xFFFFFFFF)) time += 0x100000000;
+ m_last_seen = (m_last_seen & 0xFFFFFFFF00000000) + time;
+ return (double)(m_last_seen - m_start) / 1000.0;
+ }
+ t_uint64 m_start;
+ mutable t_uint64 m_last_seen;
+};
+}
+#else
+//PORTME
+#endif
+
+#endif
diff --git a/plugins/ListeningTo/src/players/foo_mlt/pfc/ptr_list.h b/plugins/ListeningTo/src/players/foo_mlt/pfc/ptr_list.h new file mode 100644 index 0000000000..60e8dcd36d --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/pfc/ptr_list.h @@ -0,0 +1,47 @@ +#ifndef __PFC_PTR_LIST_H_
+#define __PFC_PTR_LIST_H_
+
+namespace pfc {
+
+ template<class T, class B = list_t<T*> >
+ class ptr_list_t : public B
+ {
+ public:
+ ptr_list_t() {}
+ ptr_list_t(const ptr_list_t<T> & p_source) {*this = p_source;}
+
+ void free_by_idx(t_size n) {free_mask(bit_array_one(n));}
+ void free_all() {this->remove_all_ex(free);}
+ void free_mask(const bit_array & p_mask) {this->remove_mask_ex(p_mask,free);}
+
+ void delete_item(T* ptr) {delete_by_idx(find_item(ptr));}
+
+ void delete_by_idx(t_size p_index) {
+ delete_mask(bit_array_one(p_index));
+ }
+
+ void delete_all() {
+ this->remove_all_ex(pfc::delete_t<T>);
+ }
+
+ void delete_mask(const bit_array & p_mask) {
+ this->remove_mask_ex(p_mask,pfc::delete_t<T>);
+ }
+
+ T * operator[](t_size n) const {return this->get_item(n);}
+ };
+
+ template<typename T,t_size N>
+ class ptr_list_hybrid_t : public ptr_list_t<T,list_hybrid_t<T*,N> > {
+ public:
+ ptr_list_hybrid_t() {}
+ ptr_list_hybrid_t(const ptr_list_hybrid_t<T,N> & p_source) {*this = p_source;}
+ };
+
+ typedef ptr_list_t<void> ptr_list;
+
+ template<typename item, typename base> class traits_t<ptr_list_t<item, base> > : public traits_t<base> {};
+}
+
+
+#endif //__PFC_PTR_LIST_H_
diff --git a/plugins/ListeningTo/src/players/foo_mlt/pfc/rcptr.h b/plugins/ListeningTo/src/players/foo_mlt/pfc/rcptr.h new file mode 100644 index 0000000000..1e193370b2 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/pfc/rcptr.h @@ -0,0 +1,258 @@ +namespace pfc {
+
+ struct _rcptr_null;
+ typedef _rcptr_null* t_rcptr_null;
+
+ static const t_rcptr_null rcptr_null = NULL;
+
+ class rc_container_base {
+ public:
+ long add_ref() throw() {
+ return ++m_counter;
+ }
+ long release() throw() {
+ long ret = --m_counter;
+ if (ret == 0) PFC_ASSERT_NO_EXCEPTION( delete this );
+ return ret;
+ }
+ protected:
+ virtual ~rc_container_base() {}
+ private:
+ refcounter m_counter;
+ };
+
+ template<typename t_object>
+ class rc_container_t : public rc_container_base {
+ public:
+ TEMPLATE_CONSTRUCTOR_FORWARD_FLOOD(rc_container_t,m_object)
+
+ t_object m_object;
+ };
+
+ template<typename t_object>
+ class rcptr_t {
+ private:
+ typedef rcptr_t<t_object> t_self;
+ typedef rc_container_base t_container;
+ typedef rc_container_t<t_object> t_container_impl;
+ public:
+ rcptr_t(t_rcptr_null) throw() {__init();}
+ rcptr_t() throw() {__init();}
+ rcptr_t(const t_self & p_source) throw() {__init(p_source);}
+ t_self const & operator=(const t_self & p_source) throw() {__copy(p_source); return *this;}
+
+ template<typename t_source>
+ rcptr_t(const rcptr_t<t_source> & p_source) throw() {__init(p_source);}
+ template<typename t_source>
+ const t_self & operator=(const rcptr_t<t_source> & p_source) throw() {__copy(p_source); return *this;}
+
+ const t_self & operator=(t_rcptr_null) throw() {release(); return *this;}
+
+/* template<typename t_object_cast>
+ operator rcptr_t<t_object_cast>() const throw() {
+ rcptr_t<t_object_cast> temp;
+ if (is_valid()) temp.__set_from_cast(this->m_container,this->m_ptr);
+ return temp;
+ }*/
+
+
+ template<typename t_other>
+ bool operator==(const rcptr_t<t_other> & p_other) const throw() {
+ return m_container == p_other.__container();
+ }
+
+ template<typename t_other>
+ bool operator!=(const rcptr_t<t_other> & p_other) const throw() {
+ return m_container != p_other.__container();
+ }
+
+ void __set_from_cast(t_container * p_container,t_object * p_ptr) throw() {
+ //addref first because in rare cases this is the same pointer as the one we currently own
+ if (p_container != NULL) p_container->add_ref();
+ release();
+ m_container = p_container;
+ m_ptr = p_ptr;
+ }
+
+ bool is_valid() const throw() {return m_container != NULL;}
+ bool is_empty() const throw() {return m_container == NULL;}
+
+
+ ~rcptr_t() throw() {release();}
+
+ void release() throw() {
+ t_container * temp = m_container;
+ m_ptr = NULL;
+ m_container = NULL;
+ if (temp != NULL) temp->release();
+ }
+
+
+ template<typename t_object_cast>
+ rcptr_t<t_object_cast> static_cast_t() const throw() {
+ rcptr_t<t_object_cast> temp;
+ if (is_valid()) temp.__set_from_cast(this->m_container,static_cast<t_object_cast*>(this->m_ptr));
+ return temp;
+ }
+
+ void new_t() {
+ on_new(new t_container_impl());
+ }
+
+ template<typename t_param1>
+ void new_t(t_param1 const & p_param1) {
+ on_new(new t_container_impl(p_param1));
+ }
+
+ template<typename t_param1,typename t_param2>
+ void new_t(t_param1 const & p_param1, t_param2 const & p_param2) {
+ on_new(new t_container_impl(p_param1,p_param2));
+ }
+
+ template<typename t_param1,typename t_param2,typename t_param3>
+ void new_t(t_param1 const & p_param1, t_param2 const & p_param2,t_param3 const & p_param3) {
+ on_new(new t_container_impl(p_param1,p_param2,p_param3));
+ }
+
+ template<typename t_param1,typename t_param2,typename t_param3,typename t_param4>
+ void new_t(t_param1 const & p_param1, t_param2 const & p_param2,t_param3 const & p_param3,t_param4 const & p_param4) {
+ on_new(new t_container_impl(p_param1,p_param2,p_param3,p_param4));
+ }
+
+ template<typename t_param1,typename t_param2,typename t_param3,typename t_param4,typename t_param5>
+ void new_t(t_param1 const & p_param1, t_param2 const & p_param2,t_param3 const & p_param3,t_param4 const & p_param4,t_param5 const & p_param5) {
+ on_new(new t_container_impl(p_param1,p_param2,p_param3,p_param4,p_param5));
+ }
+
+ template<typename t_param1,typename t_param2,typename t_param3,typename t_param4,typename t_param5,typename t_param6>
+ void new_t(t_param1 const & p_param1, t_param2 const & p_param2,t_param3 const & p_param3,t_param4 const & p_param4,t_param5 const & p_param5,t_param6 const & p_param6) {
+ on_new(new t_container_impl(p_param1,p_param2,p_param3,p_param4,p_param5,p_param6));
+ }
+
+ static t_self g_new_t() {
+ t_self temp;
+ temp.new_t();
+ return temp;
+ }
+
+ template<typename t_param1>
+ static t_self g_new_t(t_param1 const & p_param1) {
+ t_self temp;
+ temp.new_t(p_param1);
+ return temp;
+ }
+
+ template<typename t_param1,typename t_param2>
+ static t_self g_new_t(t_param1 const & p_param1,t_param2 const & p_param2) {
+ t_self temp;
+ temp.new_t(p_param1,p_param2);
+ return temp;
+ }
+
+ template<typename t_param1,typename t_param2,typename t_param3>
+ static t_self g_new_t(t_param1 const & p_param1,t_param2 const & p_param2,t_param3 const & p_param3) {
+ t_self temp;
+ temp.new_t(p_param1,p_param2,p_param3);
+ return temp;
+ }
+
+ template<typename t_param1,typename t_param2,typename t_param3,typename t_param4>
+ static t_self g_new_t(t_param1 const & p_param1,t_param2 const & p_param2,t_param3 const & p_param3,t_param4 const & p_param4) {
+ t_self temp;
+ temp.new_t(p_param1,p_param2,p_param3,p_param4);
+ return temp;
+ }
+
+ template<typename t_param1,typename t_param2,typename t_param3,typename t_param4,typename t_param5>
+ static t_self g_new_t(t_param1 const & p_param1,t_param2 const & p_param2,t_param3 const & p_param3,t_param4 const & p_param4,t_param5 const & p_param5) {
+ t_self temp;
+ temp.new_t(p_param1,p_param2,p_param3,p_param4,p_param5);
+ return temp;
+ }
+
+ t_object & operator*() const throw() {return *this->m_ptr;}
+
+ t_object * operator->() const throw() {return this->m_ptr;}
+
+
+ t_container * __container() const throw() {return m_container;}
+ private:
+ void __init() throw() {m_container = NULL; m_ptr = NULL;}
+
+ template<typename t_source>
+ void __init(const rcptr_t<t_source> & p_source) throw() {
+ m_container = p_source.__container();
+ m_ptr = &*p_source;
+ if (m_container != NULL) m_container->add_ref();
+ }
+ template<typename t_source>
+ void __copy(const rcptr_t<t_source> & p_source) throw() {
+ __set_from_cast(p_source.__container(),&*p_source);
+ }
+ void on_new(t_container_impl * p_container) throw() {
+ this->release();
+ p_container->add_ref();
+ this->m_ptr = &p_container->m_object;
+ this->m_container = p_container;
+ }
+
+ t_container * m_container;
+ t_object * m_ptr;
+ };
+
+ template<typename t_object>
+ rcptr_t<t_object> rcnew_t() {
+ rcptr_t<t_object> temp;
+ temp.new_t();
+ return temp;
+ }
+
+ template<typename t_object,typename t_param1>
+ rcptr_t<t_object> rcnew_t(t_param1 const & p_param1) {
+ rcptr_t<t_object> temp;
+ temp.new_t(p_param1);
+ return temp;
+ }
+
+ template<typename t_object,typename t_param1,typename t_param2>
+ rcptr_t<t_object> rcnew_t(t_param1 const & p_param1,t_param2 const & p_param2) {
+ rcptr_t<t_object> temp;
+ temp.new_t(p_param1,p_param2);
+ return temp;
+ }
+
+ template<typename t_object,typename t_param1,typename t_param2,typename t_param3>
+ rcptr_t<t_object> rcnew_t(t_param1 const & p_param1,t_param2 const & p_param2,t_param3 const & p_param3) {
+ rcptr_t<t_object> temp;
+ temp.new_t(p_param1,p_param2,p_param3);
+ return temp;
+ }
+
+ template<typename t_object,typename t_param1,typename t_param2,typename t_param3,typename t_param4>
+ rcptr_t<t_object> rcnew_t(t_param1 const & p_param1,t_param2 const & p_param2,t_param3 const & p_param3,t_param4 const & p_param4) {
+ rcptr_t<t_object> temp;
+ temp.new_t(p_param1,p_param2,p_param3,p_param4);
+ return temp;
+ }
+
+ template<typename t_object,typename t_param1,typename t_param2,typename t_param3,typename t_param4,typename t_param5>
+ rcptr_t<t_object> rcnew_t(t_param1 const & p_param1,t_param2 const & p_param2,t_param3 const & p_param3,t_param4 const & p_param4,t_param5 const & p_param5) {
+ rcptr_t<t_object> temp;
+ temp.new_t(p_param1,p_param2,p_param3,p_param4,p_param5);
+ return temp;
+ }
+
+ template<typename t_object,typename t_param1,typename t_param2,typename t_param3,typename t_param4,typename t_param5,typename t_param6>
+ rcptr_t<t_object> rcnew_t(t_param1 const & p_param1,t_param2 const & p_param2,t_param3 const & p_param3,t_param4 const & p_param4,t_param5 const & p_param5,t_param6 const & p_param6) {
+ rcptr_t<t_object> temp;
+ temp.new_t(p_param1,p_param2,p_param3,p_param4,p_param5,p_param6);
+ return temp;
+ }
+
+ class traits_rcptr : public traits_default {
+ public:
+ enum { realloc_safe = true, constructor_may_fail = false };
+ };
+
+ template<typename T> class traits_t<rcptr_t<T> > : public traits_rcptr {};
+}
\ No newline at end of file diff --git a/plugins/ListeningTo/src/players/foo_mlt/pfc/ref_counter.h b/plugins/ListeningTo/src/players/foo_mlt/pfc/ref_counter.h new file mode 100644 index 0000000000..2036165009 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/pfc/ref_counter.h @@ -0,0 +1,122 @@ +namespace pfc {
+ class counter {
+ public:
+ counter(long p_val = 0) : m_val(p_val) {}
+#ifdef _WINDOWS
+ long operator++() throw() {return InterlockedIncrement(&m_val);}
+ long operator--() throw() {return InterlockedDecrement(&m_val);}
+ long operator++(int) throw() {return InterlockedIncrement(&m_val)-1;}
+ long operator--(int) throw() {return InterlockedDecrement(&m_val)+1;}
+#else
+ long operator++() {return ++m_val;}
+ long operator--() {return --m_val;}
+ long operator++(int) {return m_val++;}
+ long operator--(int) {return m_val--;}
+#pragma message("PORTME")
+#endif
+ operator long() const throw() {return m_val;}
+ typedef long t_val;
+ private:
+ volatile long m_val;
+ };
+
+ typedef counter refcounter;
+
+ class NOVTABLE refcounted_object_root
+ {
+ public:
+ void refcount_add_ref() throw() {++m_counter;}
+ void refcount_release() throw() {if (--m_counter == 0) delete this;}
+ void _refcount_release_temporary() throw() {--m_counter;}//for internal use only!
+ protected:
+ refcounted_object_root() {}
+ virtual ~refcounted_object_root() {}
+ private:
+ refcounter m_counter;
+ };
+
+ template<typename T>
+ class refcounted_object_ptr_t {
+ private:
+ typedef refcounted_object_ptr_t<T> t_self;
+ public:
+ inline refcounted_object_ptr_t() throw() : m_ptr(NULL) {}
+ inline refcounted_object_ptr_t(T* p_ptr) throw() : m_ptr(NULL) {copy(p_ptr);}
+ inline refcounted_object_ptr_t(const t_self & p_source) throw() : m_ptr(NULL) {copy(p_source);}
+
+ template<typename t_source>
+ inline refcounted_object_ptr_t(t_source * p_ptr) throw() : m_ptr(NULL) {copy(p_ptr);}
+
+ template<typename t_source>
+ inline refcounted_object_ptr_t(const refcounted_object_ptr_t<t_source> & p_source) throw() : m_ptr(NULL) {copy(p_source);}
+
+ inline ~refcounted_object_ptr_t() throw() {if (m_ptr != NULL) m_ptr->refcount_release();}
+
+ template<typename t_source>
+ inline void copy(t_source * p_ptr) throw() {
+ T* torel = pfc::replace_t(m_ptr,pfc::safe_ptr_cast<T>(p_ptr));
+ if (m_ptr != NULL) m_ptr->refcount_add_ref();
+ if (torel != NULL) torel->refcount_release();
+
+ }
+
+ template<typename t_source>
+ inline void copy(const refcounted_object_ptr_t<t_source> & p_source) throw() {copy(p_source.get_ptr());}
+
+
+ inline const t_self & operator=(const t_self & p_source) throw() {copy(p_source); return *this;}
+ inline const t_self & operator=(T * p_ptr) throw() {copy(p_ptr); return *this;}
+
+ template<typename t_source> inline t_self & operator=(const refcounted_object_ptr_t<t_source> & p_source) throw() {copy(p_source); return *this;}
+ template<typename t_source> inline t_self & operator=(t_source * p_ptr) throw() {copy(p_ptr); return *this;}
+
+ inline void release() throw() {
+ T * temp = pfc::replace_t(m_ptr,(T*)NULL);
+ if (temp != NULL) temp->refcount_release();
+ }
+
+
+ inline T& operator*() const throw() {return *m_ptr;}
+
+ inline T* operator->() const throw() {PFC_ASSERT(m_ptr != NULL);return m_ptr;}
+
+ inline T* get_ptr() const throw() {return m_ptr;}
+
+ inline bool is_valid() const throw() {return m_ptr != NULL;}
+ inline bool is_empty() const throw() {return m_ptr == NULL;}
+
+ inline bool operator==(const t_self & p_item) const throw() {return m_ptr == p_item.get_ptr();}
+ inline bool operator!=(const t_self & p_item) const throw() {return m_ptr != p_item.get_ptr();}
+ inline bool operator>(const t_self & p_item) const throw() {return m_ptr > p_item.get_ptr();}
+ inline bool operator<(const t_self & p_item) const throw() {return m_ptr < p_item.get_ptr();}
+
+
+ inline T* _duplicate_ptr() const throw()//should not be used ! temporary !
+ {
+ if (m_ptr) m_ptr->refcount_add_ref();
+ return m_ptr;
+ }
+
+ inline T* detach() throw() {//should not be used ! temporary !
+ T* ret = m_ptr;
+ m_ptr = 0;
+ return ret;
+ }
+
+ inline void attach(T * p_ptr) throw() {//should not be used ! temporary !
+ release();
+ m_ptr = p_ptr;
+ }
+ inline t_self & operator<<(t_self & p_source) throw() {attach(p_source.detach());return *this;}
+ inline t_self & operator>>(t_self & p_dest) throw() {p_dest.attach(detach());return *this;}
+ private:
+ T* m_ptr;
+ };
+
+ template<typename T>
+ class traits_t<refcounted_object_ptr_t<T> > : public traits_default {
+ public:
+ enum { realloc_safe = true, constructor_may_fail = false};
+ };
+
+};
\ No newline at end of file diff --git a/plugins/ListeningTo/src/players/foo_mlt/pfc/selftest.cpp b/plugins/ListeningTo/src/players/foo_mlt/pfc/selftest.cpp new file mode 100644 index 0000000000..8e6d26abc7 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/pfc/selftest.cpp @@ -0,0 +1,30 @@ +#include "pfc.h"
+
+static void selftest() //never called, testing done at compile time
+{
+ PFC_STATIC_ASSERT( sizeof(t_uint8) == 1 );
+ PFC_STATIC_ASSERT( sizeof(t_uint16) == 2 );
+ PFC_STATIC_ASSERT( sizeof(t_uint32) == 4 );
+ PFC_STATIC_ASSERT( sizeof(t_uint64) == 8 );
+
+ PFC_STATIC_ASSERT( sizeof(t_int8) == 1 );
+ PFC_STATIC_ASSERT( sizeof(t_int16) == 2 );
+ PFC_STATIC_ASSERT( sizeof(t_int32) == 4 );
+ PFC_STATIC_ASSERT( sizeof(t_int64) == 8 );
+
+ PFC_STATIC_ASSERT( sizeof(t_float32) == 4 );
+ PFC_STATIC_ASSERT( sizeof(t_float64) == 8 );
+
+ PFC_STATIC_ASSERT( sizeof(t_size) == sizeof(void*) );
+ PFC_STATIC_ASSERT( sizeof(t_ssize) == sizeof(void*) );
+
+ PFC_STATIC_ASSERT( sizeof(wchar_t) == 2 || sizeof(wchar_t) == 4 );
+
+ PFC_STATIC_ASSERT( sizeof(GUID) == 16 );
+
+ /*typedef pfc::avltree_t<int> t_asdf;
+ t_asdf asdf; asdf.add_item(1);
+ t_asdf::iterator iter = asdf._first_var();
+ t_asdf::const_iterator iter2 = asdf._first_var();*/
+
+}
\ No newline at end of file diff --git a/plugins/ListeningTo/src/players/foo_mlt/pfc/sort.cpp b/plugins/ListeningTo/src/players/foo_mlt/pfc/sort.cpp new file mode 100644 index 0000000000..68a8da4ba6 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/pfc/sort.cpp @@ -0,0 +1,263 @@ +#include "pfc.h"
+
+#if defined(_M_IX86) || defined(_M_IX64)
+#include <intrin.h>
+#define PFC_HAVE_RDTSC
+#endif
+
+namespace pfc {
+
+void swap_void(void * item1,void * item2,t_size width)
+{
+ unsigned char * ptr1 = (unsigned char*)item1, * ptr2 = (unsigned char*)item2;
+ t_size n;
+ unsigned char temp;
+ for(n=0;n<width;n++)
+ {
+ temp = *ptr2;
+ *ptr2 = *ptr1;
+ *ptr1 = temp;
+ ptr1++;
+ ptr2++;
+ }
+}
+
+void reorder(reorder_callback & p_callback,const t_size * p_order,t_size p_count)
+{
+ t_size done_size = bit_array_bittable::g_estimate_size(p_count);
+ pfc::array_hybrid_t<unsigned char,1024> done;
+ done.set_size(done_size);
+ pfc::memset_t(done,(unsigned char)0);
+ t_size n;
+ for(n=0;n<p_count;n++)
+ {
+ t_size next = p_order[n];
+ if (next!=n && !bit_array_bittable::g_get(done,n))
+ {
+ t_size prev = n;
+ do
+ {
+ PFC_ASSERT(!bit_array_bittable::g_get(done,next));
+ PFC_ASSERT(next>n);
+ PFC_ASSERT(n<p_count);
+ p_callback.swap(prev,next);
+ bit_array_bittable::g_set(done,next,true);
+ prev = next;
+ next = p_order[next];
+ } while(next!=n);
+ //bit_array_bittable::g_set(done,n,true);
+ }
+ }
+}
+
+void reorder_void(void * data,t_size width,const t_size * order,t_size num,void (*swapfunc)(void * item1,void * item2,t_size width))
+{
+ unsigned char * base = (unsigned char *) data;
+ t_size done_size = bit_array_bittable::g_estimate_size(num);
+ pfc::array_hybrid_t<unsigned char,1024> done;
+ done.set_size(done_size);
+ pfc::memset_t(done,(unsigned char)0);
+ t_size n;
+ for(n=0;n<num;n++)
+ {
+ t_size next = order[n];
+ if (next!=n && !bit_array_bittable::g_get(done,n))
+ {
+ t_size prev = n;
+ do
+ {
+ PFC_ASSERT(!bit_array_bittable::g_get(done,next));
+ PFC_ASSERT(next>n);
+ PFC_ASSERT(n<num);
+ swapfunc(base+width*prev,base+width*next,width);
+ bit_array_bittable::g_set(done,next,true);
+ prev = next;
+ next = order[next];
+ } while(next!=n);
+ //bit_array_bittable::g_set(done,n,true);
+ }
+ }
+}
+
+namespace {
+
+class sort_callback_impl_legacy : public sort_callback
+{
+public:
+ sort_callback_impl_legacy(
+ void * p_base,t_size p_width,
+ int (*p_comp)(const void *, const void *),
+ void (*p_swap)(void *, void *, t_size)
+ ) :
+ m_base((char*)p_base), m_width(p_width),
+ m_comp(p_comp), m_swap(p_swap)
+ {
+ }
+
+
+ int compare(t_size p_index1, t_size p_index2) const
+ {
+ return m_comp(m_base + p_index1 * m_width, m_base + p_index2 * m_width);
+ }
+
+ void swap(t_size p_index1, t_size p_index2)
+ {
+ m_swap(m_base + p_index1 * m_width, m_base + p_index2 * m_width, m_width);
+ }
+
+private:
+ char * m_base;
+ t_size m_width;
+ int (*m_comp)(const void *, const void *);
+ void (*m_swap)(void *, void *, t_size);
+};
+}
+
+void sort_void_ex (
+ void *base,
+ t_size num,
+ t_size width,
+ int (*comp)(const void *, const void *),
+ void (*swap)(void *, void *, t_size) )
+{
+ sort(sort_callback_impl_legacy(base,width,comp,swap),num);
+}
+
+static void squaresort(pfc::sort_callback & p_callback,t_size const p_base,t_size const p_count) {
+ const t_size max = p_base + p_count;
+ for(t_size walk = p_base + 1; walk < max; ++walk) {
+ for(t_size prev = p_base; prev < walk; ++prev) {
+ p_callback.swap_check(prev,walk);
+ }
+ }
+}
+
+
+inline static void __sort_2elem_helper(pfc::sort_callback & p_callback,t_size & p_elem1,t_size & p_elem2) {
+ if (p_callback.compare(p_elem1,p_elem2) > 0) pfc::swap_t(p_elem1,p_elem2);
+}
+
+
+#ifdef PFC_HAVE_RDTSC
+static inline t_uint64 uniqueVal() {return __rdtsc();}
+#else
+static counter::t_val uniqueVal() {
+ static counter c; return ++c;
+}
+#endif
+
+static t_size myrand(t_size count) {
+ PFC_STATIC_ASSERT( RAND_MAX == 0x7FFF );
+
+ t_uint64 val;
+ val = (t_uint64) rand() | (t_uint64)( (t_uint32)rand() << 16 );
+
+ val ^= uniqueVal();
+
+ return (t_size)(val % count);
+}
+
+inline static t_size __pivot_helper(pfc::sort_callback & p_callback,t_size const p_base,t_size const p_count) {
+ PFC_ASSERT(p_count > 2);
+
+ //t_size val1 = p_base, val2 = p_base + (p_count / 2), val3 = p_base + (p_count - 1);
+
+ t_size val1 = myrand(p_count), val2 = myrand(p_count-1), val3 = myrand(p_count-2);
+ if (val2 >= val1) val2++;
+ if (val3 >= val1) val3++;
+ if (val3 >= val2) val3++;
+
+ val1 += p_base; val2 += p_base; val3 += p_base;
+
+ __sort_2elem_helper(p_callback,val1,val2);
+ __sort_2elem_helper(p_callback,val1,val3);
+ __sort_2elem_helper(p_callback,val2,val3);
+
+ return val2;
+}
+
+static void newsort(pfc::sort_callback & p_callback,t_size const p_base,t_size const p_count) {
+ if (p_count <= 4) {
+ squaresort(p_callback,p_base,p_count);
+ return;
+ }
+
+ t_size pivot = __pivot_helper(p_callback,p_base,p_count);
+
+ {
+ const t_size target = p_base + p_count - 1;
+ if (pivot != target) {
+ p_callback.swap(pivot,target); pivot = target;
+ }
+ }
+
+
+ t_size partition = p_base;
+ {
+ bool asdf = false;
+ for(t_size walk = p_base; walk < pivot; ++walk) {
+ const int comp = p_callback.compare(walk,pivot);
+ bool trigger = false;
+ if (comp == 0) {
+ trigger = asdf;
+ asdf = !asdf;
+ } else if (comp < 0) {
+ trigger = true;
+ }
+ if (trigger) {
+ if (partition != walk) p_callback.swap(partition,walk);
+ partition++;
+ }
+ }
+ }
+ if (pivot != partition) {
+ p_callback.swap(pivot,partition); pivot = partition;
+ }
+
+ newsort(p_callback,p_base,pivot-p_base);
+ newsort(p_callback,pivot+1,p_count-(pivot+1-p_base));
+}
+
+void sort(pfc::sort_callback & p_callback,t_size p_num) {
+ srand((unsigned int)(uniqueVal() ^ p_num));
+ newsort(p_callback,0,p_num);
+}
+
+
+void sort_void(void * base,t_size num,t_size width,int (*comp)(const void *, const void *) )
+{
+ sort_void_ex(base,num,width,comp,swap_void);
+}
+
+
+
+
+sort_callback_stabilizer::sort_callback_stabilizer(sort_callback & p_chain,t_size p_count)
+: m_chain(p_chain)
+{
+ m_order.set_size(p_count);
+ t_size n;
+ for(n=0;n<p_count;n++) m_order[n] = n;
+}
+
+int sort_callback_stabilizer::compare(t_size p_index1, t_size p_index2) const
+{
+ int ret = m_chain.compare(p_index1,p_index2);
+ if (ret == 0) ret = pfc::sgn_t((t_ssize)m_order[p_index1] - (t_ssize)m_order[p_index2]);
+ return ret;
+}
+
+void sort_callback_stabilizer::swap(t_size p_index1, t_size p_index2)
+{
+ m_chain.swap(p_index1,p_index2);
+ pfc::swap_t(m_order[p_index1],m_order[p_index2]);
+}
+
+
+void sort_stable(sort_callback & p_callback,t_size p_count)
+{
+ sort(sort_callback_stabilizer(p_callback,p_count),p_count);
+}
+
+}
+
diff --git a/plugins/ListeningTo/src/players/foo_mlt/pfc/sort.h b/plugins/ListeningTo/src/players/foo_mlt/pfc/sort.h new file mode 100644 index 0000000000..a02e1f5c4e --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/pfc/sort.h @@ -0,0 +1,181 @@ +namespace pfc {
+
+ void swap_void(void * item1,void * item2,t_size width);
+
+ void reorder_void(void * data,t_size width,const t_size * order,t_size num,void (*swapfunc)(void * item1,void * item2,t_size width) = swap_void);
+
+ class NOVTABLE reorder_callback
+ {
+ public:
+ virtual void swap(t_size p_index1,t_size p_index2) = 0;
+ };
+
+ void reorder(reorder_callback & p_callback,const t_size * p_order,t_size p_count);
+
+ template<typename t_container>
+ class reorder_callback_impl_t : public reorder_callback
+ {
+ public:
+ reorder_callback_impl_t(t_container & p_data) : m_data(p_data) {}
+ void swap(t_size p_index1,t_size p_index2)
+ {
+ pfc::swap_t(m_data[p_index1],m_data[p_index2]);
+ }
+ private:
+ t_container & m_data;
+ };
+
+ class reorder_callback_impl_delta : public reorder_callback
+ {
+ public:
+ reorder_callback_impl_delta(reorder_callback & p_data,t_size p_delta) : m_data(p_data), m_delta(p_delta) {}
+ void swap(t_size p_index1,t_size p_index2)
+ {
+ m_data.swap(p_index1+m_delta,p_index2+m_delta);
+ }
+ private:
+ reorder_callback & m_data;
+ t_size m_delta;
+ };
+
+ template<typename t_container>
+ void reorder_t(t_container & p_data,const t_size * p_order,t_size p_count)
+ {
+ reorder(reorder_callback_impl_t<t_container>(p_data),p_order,p_count);
+ }
+
+ template<typename t_container>
+ void reorder_partial_t(t_container & p_data,t_size p_base,const t_size * p_order,t_size p_count)
+ {
+ reorder(reorder_callback_impl_delta(reorder_callback_impl_t<t_container>(p_data),p_base),p_order,p_count);
+ }
+
+ template<typename T>
+ class reorder_callback_impl_ptr_t : public reorder_callback
+ {
+ public:
+ reorder_callback_impl_ptr_t(T * p_data) : m_data(p_data) {}
+ void swap(t_size p_index1,t_size p_index2)
+ {
+ pfc::swap_t(m_data[p_index1],m_data[p_index2]);
+ }
+ private:
+ T* m_data;
+ };
+
+
+ template<typename T>
+ void reorder_ptr_t(T* p_data,const t_size * p_order,t_size p_count)
+ {
+ reorder(reorder_callback_impl_ptr_t<T>(p_data),p_order,p_count);
+ }
+
+
+
+ class NOVTABLE sort_callback
+ {
+ public:
+ virtual int compare(t_size p_index1, t_size p_index2) const = 0;
+ virtual void swap(t_size p_index1, t_size p_index2) = 0;
+ void swap_check(t_size p_index1, t_size p_index2) {if (compare(p_index1,p_index2) > 0) swap(p_index1,p_index2);}
+ };
+
+ class sort_callback_stabilizer : public sort_callback
+ {
+ public:
+ sort_callback_stabilizer(sort_callback & p_chain,t_size p_count);
+ virtual int compare(t_size p_index1, t_size p_index2) const;
+ virtual void swap(t_size p_index1, t_size p_index2);
+ private:
+ sort_callback & m_chain;
+ array_t<t_size> m_order;
+ };
+
+ void sort(sort_callback & p_callback,t_size p_count);
+ void sort_stable(sort_callback & p_callback,t_size p_count);
+
+ void sort_void_ex(void *base,t_size num,t_size width, int (*comp)(const void *, const void *),void (*swap)(void *, void *, t_size) );
+ void sort_void(void * base,t_size num,t_size width,int (*comp)(const void *, const void *) );
+
+ template<typename t_container,typename t_compare>
+ class sort_callback_impl_simple_wrap_t : public sort_callback
+ {
+ public:
+ sort_callback_impl_simple_wrap_t(t_container & p_data, t_compare p_compare) : m_data(p_data), m_compare(p_compare) {}
+ int compare(t_size p_index1, t_size p_index2) const
+ {
+ return m_compare(m_data[p_index1],m_data[p_index2]);
+ }
+
+ void swap(t_size p_index1, t_size p_index2)
+ {
+ swap_t(m_data[p_index1],m_data[p_index2]);
+ }
+ private:
+ t_container & m_data;
+ t_compare m_compare;
+ };
+
+ template<typename t_container>
+ class sort_callback_impl_auto_wrap_t : public sort_callback
+ {
+ public:
+ sort_callback_impl_auto_wrap_t(t_container & p_data) : m_data(p_data) {}
+ int compare(t_size p_index1, t_size p_index2) const
+ {
+ return compare_t(m_data[p_index1],m_data[p_index2]);
+ }
+
+ void swap(t_size p_index1, t_size p_index2)
+ {
+ swap_t(m_data[p_index1],m_data[p_index2]);
+ }
+ private:
+ t_container & m_data;
+ };
+
+ template<typename t_container,typename t_compare,typename t_permutation>
+ class sort_callback_impl_permutation_wrap_t : public sort_callback
+ {
+ public:
+ sort_callback_impl_permutation_wrap_t(const t_container & p_data, t_compare p_compare,t_permutation const & p_permutation) : m_data(p_data), m_compare(p_compare), m_permutation(p_permutation) {}
+ int compare(t_size p_index1, t_size p_index2) const
+ {
+ return m_compare(m_data[m_permutation[p_index1]],m_data[m_permutation[p_index2]]);
+ }
+
+ void swap(t_size p_index1, t_size p_index2)
+ {
+ swap_t(m_permutation[p_index1],m_permutation[p_index2]);
+ }
+ private:
+ const t_container & m_data;
+ t_compare m_compare;
+ t_permutation const & m_permutation;
+ };
+
+ template<typename t_container,typename t_compare>
+ static void sort_t(t_container & p_data,t_compare p_compare,t_size p_count)
+ {
+ sort(sort_callback_impl_simple_wrap_t<t_container,t_compare>(p_data,p_compare),p_count);
+ }
+
+ template<typename t_container,typename t_compare>
+ static void sort_stable_t(t_container & p_data,t_compare p_compare,t_size p_count)
+ {
+ sort_stable(sort_callback_impl_simple_wrap_t<t_container,t_compare>(p_data,p_compare),p_count);
+ }
+
+ template<typename t_container,typename t_compare,typename t_permutation>
+ static void sort_get_permutation_t(const t_container & p_data,t_compare p_compare,t_size p_count,t_permutation const & p_permutation)
+ {
+ sort(sort_callback_impl_permutation_wrap_t<t_container,t_compare,t_permutation>(p_data,p_compare,p_permutation),p_count);
+ }
+
+ template<typename t_container,typename t_compare,typename t_permutation>
+ static void sort_stable_get_permutation_t(const t_container & p_data,t_compare p_compare,t_size p_count,t_permutation const & p_permutation)
+ {
+ sort_stable(sort_callback_impl_permutation_wrap_t<t_container,t_compare,t_permutation>(p_data,p_compare,p_permutation),p_count);
+ }
+
+}
diff --git a/plugins/ListeningTo/src/players/foo_mlt/pfc/stdafx.cpp b/plugins/ListeningTo/src/players/foo_mlt/pfc/stdafx.cpp new file mode 100644 index 0000000000..72044fc8ba --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/pfc/stdafx.cpp @@ -0,0 +1,2 @@ +//cpp used to generate precompiled header
+#include "pfc.h"
\ No newline at end of file diff --git a/plugins/ListeningTo/src/players/foo_mlt/pfc/string.cpp b/plugins/ListeningTo/src/players/foo_mlt/pfc/string.cpp new file mode 100644 index 0000000000..9b235c5845 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/pfc/string.cpp @@ -0,0 +1,930 @@ +#include "pfc.h"
+
+namespace pfc {
+
+void string_receiver::add_char(t_uint32 p_char)
+{
+ char temp[8];
+ t_size len = utf8_encode_char(p_char,temp);
+ if (len>0) add_string(temp,len);
+}
+
+void string_base::skip_trailing_char(unsigned skip)
+{
+ const char * str = get_ptr();
+ t_size ptr,trunc;
+ bool need_trunc = false;
+ for(ptr=0;str[ptr];)
+ {
+ unsigned c;
+ t_size delta = utf8_decode_char(str+ptr,c);
+ if (delta==0) break;
+ if (c==skip)
+ {
+ need_trunc = true;
+ trunc = ptr;
+ }
+ else
+ {
+ need_trunc = false;
+ }
+ ptr += delta;
+ }
+ if (need_trunc) truncate(trunc);
+}
+
+format_time::format_time(t_uint64 p_seconds) {
+ t_uint64 length = p_seconds;
+ unsigned weeks,days,hours,minutes,seconds;
+
+ weeks = (unsigned)( ( length / (60*60*24*7) ) );
+ days = (unsigned)( ( length / (60*60*24) ) % 7 );
+ hours = (unsigned) ( ( length / (60 * 60) ) % 24);
+ minutes = (unsigned) ( ( length / (60 ) ) % 60 );
+ seconds = (unsigned) ( ( length ) % 60 );
+
+ if (weeks) {
+ m_buffer << weeks << "wk ";
+ }
+ if (days || weeks) {
+ m_buffer << days << "d ";
+ }
+ if (hours || days || weeks) {
+ m_buffer << hours << ":" << format_uint(minutes,2) << ":" << format_uint(seconds,2);
+ } else {
+ m_buffer << minutes << ":" << format_uint(seconds,2);
+ }
+}
+
+bool is_path_separator(unsigned c)
+{
+ return c=='\\' || c=='/' || c=='|' || c==':';
+}
+
+bool is_path_bad_char(unsigned c)
+{
+#ifdef _WINDOWS
+ return c=='\\' || c=='/' || c=='|' || c==':' || c=='*' || c=='?' || c=='\"' || c=='>' || c=='<';
+#else
+#error portme
+#endif
+}
+
+
+
+char * strdup_n(const char * src,t_size len)
+{
+ len = strlen_max(src,len);
+ char * ret = (char*)malloc(len+1);
+ if (ret)
+ {
+ memcpy(ret,src,len);
+ ret[len]=0;
+ }
+ return ret;
+}
+
+string_filename::string_filename(const char * fn)
+{
+ fn += pfc::scan_filename(fn);
+ const char * ptr=fn,*dot=0;
+ while(*ptr && *ptr!='?')
+ {
+ if (*ptr=='.') dot=ptr;
+ ptr++;
+ }
+
+ if (dot && dot>fn) set_string(fn,dot-fn);
+ else set_string(fn);
+}
+
+string_filename_ext::string_filename_ext(const char * fn)
+{
+ fn += pfc::scan_filename(fn);
+ const char * ptr = fn;
+ while(*ptr && *ptr!='?') ptr++;
+ set_string(fn,ptr-fn);
+}
+
+string_extension::string_extension(const char * src)
+{
+ buffer[0]=0;
+ const char * start = src + pfc::scan_filename(src);
+ const char * end = start + strlen(start);
+ const char * ptr = end-1;
+ while(ptr>start && *ptr!='.')
+ {
+ if (*ptr=='?') end=ptr;
+ ptr--;
+ }
+
+ if (ptr>=start && *ptr=='.')
+ {
+ ptr++;
+ t_size len = end-ptr;
+ if (len<PFC_TABSIZE(buffer))
+ {
+ memcpy(buffer,ptr,len*sizeof(char));
+ buffer[len]=0;
+ }
+ }
+}
+
+
+bool has_path_bad_chars(const char * param)
+{
+ while(*param)
+ {
+ if (is_path_bad_char(*param)) return true;
+ param++;
+ }
+ return false;
+}
+
+void float_to_string(char * out,t_size out_max,double val,unsigned precision,bool b_sign) {
+ pfc::string_fixed_t<63> temp;
+ t_size outptr;
+
+ if (out_max == 0) return;
+ out_max--;//for null terminator
+
+ outptr = 0;
+
+ if (outptr == out_max) {out[outptr]=0;return;}
+
+ if (val<0) {out[outptr++] = '-'; val = -val;}
+ else if (b_sign) {out[outptr++] = '+';}
+
+ if (outptr == out_max) {out[outptr]=0;return;}
+
+
+ {
+ double powval = pow((double)10.0,(double)precision);
+ temp << (t_int64)floor(val * powval + 0.5);
+ //_i64toa(blargh,temp,10);
+ }
+
+ const t_size temp_len = temp.length();
+ if (temp_len <= precision)
+ {
+ out[outptr++] = '0';
+ if (outptr == out_max) {out[outptr]=0;return;}
+ out[outptr++] = '.';
+ if (outptr == out_max) {out[outptr]=0;return;}
+ t_size d;
+ for(d=precision-temp_len;d;d--)
+ {
+ out[outptr++] = '0';
+ if (outptr == out_max) {out[outptr]=0;return;}
+ }
+ for(d=0;d<temp_len;d++)
+ {
+ out[outptr++] = temp[d];
+ if (outptr == out_max) {out[outptr]=0;return;}
+ }
+ }
+ else
+ {
+ t_size d = temp_len;
+ const char * src = temp;
+ while(*src)
+ {
+ if (d-- == precision)
+ {
+ out[outptr++] = '.';
+ if (outptr == out_max) {out[outptr]=0;return;}
+ }
+ out[outptr++] = *(src++);
+ if (outptr == out_max) {out[outptr]=0;return;}
+ }
+ }
+ out[outptr] = 0;
+}
+
+static double pfc_string_to_float_internal(const char * src)
+{
+ bool neg = false;
+ t_int64 val = 0;
+ int div = 0;
+ bool got_dot = false;
+
+ while(*src==' ') src++;
+
+ if (*src=='-') {neg = true;src++;}
+ else if (*src=='+') src++;
+
+ while(*src)
+ {
+ if (*src>='0' && *src<='9')
+ {
+ int d = *src - '0';
+ val = val * 10 + d;
+ if (got_dot) div--;
+ src++;
+ }
+ else if (*src=='.' || *src==',')
+ {
+ if (got_dot) break;
+ got_dot = true;
+ src++;
+ }
+ else if (*src=='E' || *src=='e')
+ {
+ src++;
+ div += atoi(src);
+ break;
+ }
+ else break;
+ }
+ if (neg) val = -val;
+ return (double) val * pow(10.0,(double)div);
+}
+
+double string_to_float(const char * src,t_size max) {
+ //old function wants an oldstyle nullterminated string, and i don't currently care enough to rewrite it as it works appropriately otherwise
+ char blargh[128];
+ if (max > 127) max = 127;
+ t_size walk;
+ for(walk = 0; walk < max && src[walk]; walk++) blargh[walk] = src[walk];
+ blargh[walk] = 0;
+ return pfc_string_to_float_internal(blargh);
+}
+
+
+
+void string_base::convert_to_lower_ascii(const char * src,char replace)
+{
+ reset();
+ PFC_ASSERT(replace>0);
+ while(*src)
+ {
+ unsigned c;
+ t_size delta = utf8_decode_char(src,c);
+ if (delta==0) {c = replace; delta = 1;}
+ else if (c>=0x80) c = replace;
+ add_byte((char)c);
+ src += delta;
+ }
+}
+
+void convert_to_lower_ascii(const char * src,t_size max,char * out,char replace)
+{
+ t_size ptr = 0;
+ PFC_ASSERT(replace>0);
+ while(ptr<max && src[ptr])
+ {
+ unsigned c;
+ t_size delta = utf8_decode_char(src+ptr,c,max-ptr);
+ if (delta==0) {c = replace; delta = 1;}
+ else if (c>=0x80) c = replace;
+ *(out++) = (char)c;
+ ptr += delta;
+ }
+ *out = 0;
+}
+
+t_size strstr_ex(const char * p_string,t_size p_string_len,const char * p_substring,t_size p_substring_len) throw()
+{
+ p_string_len = strlen_max(p_string,p_string_len);
+ p_substring_len = strlen_max(p_substring,p_substring_len);
+ t_size index = 0;
+ while(index + p_substring_len <= p_string_len)
+ {
+ if (memcmp(p_string+index,p_substring,p_substring_len) == 0) return index;
+ t_size delta = utf8_char_len(p_string+index,p_string_len - index);
+ if (delta == 0) break;
+ index += delta;
+ }
+ return ~0;
+}
+
+unsigned atoui_ex(const char * p_string,t_size p_string_len)
+{
+ unsigned ret = 0; t_size ptr = 0;
+ while(ptr<p_string_len)
+ {
+ char c = p_string[ptr];
+ if (! ( c >= '0' && c <= '9' ) ) break;
+ ret = ret * 10 + (unsigned)( c - '0' );
+ ptr++;
+ }
+ return ret;
+}
+
+int strcmp_ex(const char* p1,t_size n1,const char* p2,t_size n2)
+{
+ t_size idx = 0;
+ n1 = strlen_max(p1,n1); n2 = strlen_max(p2,n2);
+ for (;;)
+ {
+ if (idx == n1 && idx == n2) return 0;
+ else if (idx == n1) return -1;//end of param1
+ else if (idx == n2) return 1;//end of param2
+
+ char c1 = p1[idx], c2 = p2[idx];
+ if (c1<c2) return -1;
+ else if (c1>c2) return 1;
+
+ idx++;
+ }
+}
+
+t_uint64 atoui64_ex(const char * src,t_size len) {
+ len = strlen_max(src,len);
+ t_uint64 ret = 0, mul = 1;
+ t_size ptr = len;
+ t_size start = 0;
+// start += skip_spacing(src+start,len-start);
+
+ while(ptr>start)
+ {
+ char c = src[--ptr];
+ if (c>='0' && c<='9')
+ {
+ ret += (c-'0') * mul;
+ mul *= 10;
+ }
+ else
+ {
+ ret = 0;
+ mul = 1;
+ }
+ }
+ return ret;
+}
+
+
+t_int64 atoi64_ex(const char * src,t_size len)
+{
+ len = strlen_max(src,len);
+ t_int64 ret = 0, mul = 1;
+ t_size ptr = len;
+ t_size start = 0;
+ bool neg = false;
+// start += skip_spacing(src+start,len-start);
+ if (start < len && src[start] == '-') {neg = true; start++;}
+// start += skip_spacing(src+start,len-start);
+
+ while(ptr>start)
+ {
+ char c = src[--ptr];
+ if (c>='0' && c<='9')
+ {
+ ret += (c-'0') * mul;
+ mul *= 10;
+ }
+ else
+ {
+ ret = 0;
+ mul = 1;
+ }
+ }
+ return neg ? -ret : ret;
+}
+
+int stricmp_ascii_ex(const char * const s1,t_size const len1,const char * const s2,t_size const len2) throw() {
+ t_size walk1 = 0, walk2 = 0;
+ for (;;) {
+ char c1 = (walk1 < len1) ? s1[walk1] : 0;
+ char c2 = (walk2 < len2) ? s2[walk2] : 0;
+ c1 = ascii_tolower(c1); c2 = ascii_tolower(c2);
+ if (c1<c2) return -1;
+ else if (c1>c2) return 1;
+ else if (c1 == 0) return 0;
+ walk1++;
+ walk2++;
+ }
+
+}
+int stricmp_ascii(const char * s1,const char * s2) throw() {
+ for (;;) {
+ char c1 = ascii_tolower(*s1), c2 = ascii_tolower(*s2);
+ if (c1<c2) return -1;
+ else if (c1>c2) return 1;
+ else if (c1 == 0) return 0;
+ s1++;
+ s2++;
+ }
+}
+
+format_float::format_float(double p_val,unsigned p_width,unsigned p_prec)
+{
+ char temp[64];
+ float_to_string(temp,64,p_val,p_prec,false);
+ temp[63] = 0;
+ t_size len = strlen(temp);
+ if (len < p_width)
+ m_buffer.add_chars(' ',p_width-len);
+ m_buffer += temp;
+}
+
+char format_hex_char(unsigned p_val)
+{
+ PFC_ASSERT(p_val < 16);
+ return (p_val < 10) ? p_val + '0' : p_val - 10 + 'A';
+}
+
+format_hex::format_hex(t_uint64 p_val,unsigned p_width)
+{
+ if (p_width > 16) p_width = 16;
+ else if (p_width == 0) p_width = 1;
+ char temp[16];
+ unsigned n;
+ for(n=0;n<16;n++)
+ {
+ temp[15-n] = format_hex_char((unsigned)(p_val & 0xF));
+ p_val >>= 4;
+ }
+
+ for(n=0;n<16 && temp[n] == '0';n++) {}
+
+ if (n > 16 - p_width) n = 16 - p_width;
+
+ char * out = m_buffer;
+ for (;n<16;n++)
+ *(out++) = temp[n];
+ *out = 0;
+}
+
+char format_hex_char_lowercase(unsigned p_val)
+{
+ PFC_ASSERT(p_val < 16);
+ return (p_val < 10) ? p_val + '0' : p_val - 10 + 'a';
+}
+
+format_hex_lowercase::format_hex_lowercase(t_uint64 p_val,unsigned p_width)
+{
+ if (p_width > 16) p_width = 16;
+ else if (p_width == 0) p_width = 1;
+ char temp[16];
+ unsigned n;
+ for(n=0;n<16;n++)
+ {
+ temp[15-n] = format_hex_char_lowercase((unsigned)(p_val & 0xF));
+ p_val >>= 4;
+ }
+
+ for(n=0;n<16 && temp[n] == '0';n++) {}
+
+ if (n > 16 - p_width) n = 16 - p_width;
+
+ char * out = m_buffer;
+ for (;n<16;n++)
+ *(out++) = temp[n];
+ *out = 0;
+}
+
+format_uint::format_uint(t_uint64 val,unsigned p_width,unsigned p_base)
+{
+
+ enum {max_width = PFC_TABSIZE(m_buffer) - 1};
+
+ if (p_width > max_width) p_width = max_width;
+ else if (p_width == 0) p_width = 1;
+
+ char temp[max_width];
+
+ unsigned n;
+ for(n=0;n<max_width;n++)
+ {
+ temp[max_width-1-n] = format_hex_char((unsigned)(val % p_base));
+ val /= p_base;
+ }
+
+ for(n=0;n<max_width && temp[n] == '0';n++) {}
+
+ if (n > max_width - p_width) n = max_width - p_width;
+
+ char * out = m_buffer;
+
+ for (;n<max_width;n++)
+ *(out++) = temp[n];
+ *out = 0;
+}
+
+format_fixedpoint::format_fixedpoint(t_int64 p_val,unsigned p_point)
+{
+ unsigned div = 1;
+ for(unsigned n=0;n<p_point;n++) div *= 10;
+
+ if (p_val < 0) {m_buffer << "-";p_val = -p_val;}
+
+
+ m_buffer << format_int(p_val / div) << "." << format_int(p_val % div, p_point);
+}
+
+format_int::format_int(t_int64 p_val,unsigned p_width,unsigned p_base)
+{
+ bool neg = false;
+ t_uint64 val;
+ if (p_val < 0) {neg = true; val = (t_uint64)(-p_val);}
+ else val = (t_uint64)p_val;
+
+ enum {max_width = PFC_TABSIZE(m_buffer) - 1};
+
+ if (p_width > max_width) p_width = max_width;
+ else if (p_width == 0) p_width = 1;
+
+ if (neg && p_width > 1) p_width --;
+
+ char temp[max_width];
+
+ unsigned n;
+ for(n=0;n<max_width;n++)
+ {
+ temp[max_width-1-n] = format_hex_char((unsigned)(val % p_base));
+ val /= p_base;
+ }
+
+ for(n=0;n<max_width && temp[n] == '0';n++) {}
+
+ if (n > max_width - p_width) n = max_width - p_width;
+
+ char * out = m_buffer;
+
+ if (neg) *(out++) = '-';
+
+ for (;n<max_width;n++)
+ *(out++) = temp[n];
+ *out = 0;
+}
+
+format_hexdump_lowercase::format_hexdump_lowercase(const void * p_buffer,t_size p_bytes,const char * p_spacing)
+{
+ t_size n;
+ const t_uint8 * buffer = (const t_uint8*)p_buffer;
+ for(n=0;n<p_bytes;n++)
+ {
+ if (n > 0 && p_spacing != 0) m_formatter << p_spacing;
+ m_formatter << format_hex_lowercase(buffer[n],2);
+ }
+}
+
+format_hexdump::format_hexdump(const void * p_buffer,t_size p_bytes,const char * p_spacing)
+{
+ t_size n;
+ const t_uint8 * buffer = (const t_uint8*)p_buffer;
+ for(n=0;n<p_bytes;n++)
+ {
+ if (n > 0 && p_spacing != 0) m_formatter << p_spacing;
+ m_formatter << format_hex(buffer[n],2);
+ }
+}
+
+
+
+string_replace_extension::string_replace_extension(const char * p_path,const char * p_ext)
+{
+ m_data = p_path;
+ t_size dot = m_data.find_last('.');
+ if (dot < m_data.scan_filename())
+ {//argh
+ m_data += ".";
+ m_data += p_ext;
+ }
+ else
+ {
+ m_data.truncate(dot+1);
+ m_data += p_ext;
+ }
+}
+
+string_directory::string_directory(const char * p_path)
+{
+ t_size ptr = scan_filename(p_path);
+ if (ptr > 1) {
+ if (is_path_separator(p_path[ptr-1]) && !is_path_separator(p_path[ptr-2])) --ptr;
+ }
+ m_data.set_string(p_path,ptr);
+}
+
+t_size scan_filename(const char * ptr)
+{
+ t_size n;
+ t_size _used = strlen(ptr);
+ for(n=_used-1;n!=~0;n--)
+ {
+ if (is_path_separator(ptr[n])) return n+1;
+ }
+ return 0;
+}
+
+
+
+t_size string_find_first(const char * p_string,char p_tofind,t_size p_start) {
+ for(t_size walk = p_start; p_string[walk]; ++walk) {
+ if (p_string[walk] == p_tofind) return walk;
+ }
+ return ~0;
+}
+t_size string_find_last(const char * p_string,char p_tofind,t_size p_start) {
+ return string_find_last_ex(p_string,~0,&p_tofind,1,p_start);
+}
+t_size string_find_first(const char * p_string,const char * p_tofind,t_size p_start) {
+ return string_find_first_ex(p_string,~0,p_tofind,~0,p_start);
+}
+t_size string_find_last(const char * p_string,const char * p_tofind,t_size p_start) {
+ return string_find_last_ex(p_string,~0,p_tofind,~0,p_start);
+}
+
+t_size string_find_first_ex(const char * p_string,t_size p_string_length,char p_tofind,t_size p_start) {
+ for(t_size walk = p_start; walk < p_string_length && p_string[walk]; ++walk) {
+ if (p_string[walk] == p_tofind) return walk;
+ }
+ return ~0;
+}
+t_size string_find_last_ex(const char * p_string,t_size p_string_length,char p_tofind,t_size p_start) {
+ return string_find_last_ex(p_string,p_string_length,&p_tofind,1,p_start);
+}
+t_size string_find_first_ex(const char * p_string,t_size p_string_length,const char * p_tofind,t_size p_tofind_length,t_size p_start) {
+ p_string_length = strlen_max(p_string,p_string_length); p_tofind_length = strlen_max(p_tofind,p_tofind_length);
+ if (p_string_length >= p_tofind_length) {
+ t_size max = p_string_length - p_tofind_length;
+ for(t_size walk = p_start; walk <= max; walk++) {
+ if (_strcmp_partial_ex(p_string+walk,p_string_length-walk,p_tofind,p_tofind_length) == 0) return walk;
+ }
+ }
+ return ~0;
+}
+t_size string_find_last_ex(const char * p_string,t_size p_string_length,const char * p_tofind,t_size p_tofind_length,t_size p_start) {
+ p_string_length = strlen_max(p_string,p_string_length); p_tofind_length = strlen_max(p_tofind,p_tofind_length);
+ if (p_string_length >= p_tofind_length) {
+ t_size max = min_t<t_size>(p_string_length - p_tofind_length,p_start);
+ for(t_size walk = max; walk != (t_size)(-1); walk--) {
+ if (_strcmp_partial_ex(p_string+walk,p_string_length-walk,p_tofind,p_tofind_length) == 0) return walk;
+ }
+ }
+ return ~0;
+}
+
+t_size string_find_first_nc(const char * p_string,t_size p_string_length,char c,t_size p_start) {
+ for(t_size walk = p_start; walk < p_string_length; walk++) {
+ if (p_string[walk] == c) return walk;
+ }
+ return ~0;
+}
+
+t_size string_find_first_nc(const char * p_string,t_size p_string_length,const char * p_tofind,t_size p_tofind_length,t_size p_start) {
+ if (p_string_length >= p_tofind_length) {
+ t_size max = p_string_length - p_tofind_length;
+ for(t_size walk = p_start; walk <= max; walk++) {
+ if (memcmp(p_string+walk, p_tofind, p_tofind_length) == 0) return walk;
+ }
+ }
+ return ~0;
+}
+
+
+bool string_is_numeric(const char * p_string,t_size p_length) throw() {
+ bool retval = false;
+ for(t_size walk = 0; walk < p_length && p_string[walk] != 0; walk++) {
+ if (!char_is_numeric(p_string[walk])) {retval = false; break;}
+ retval = true;
+ }
+ return retval;
+}
+
+
+void string_base::fix_dir_separator(char p_char) {
+ t_size length = get_length();
+ if (!ends_with(p_char)) add_byte(p_char);
+}
+bool string_base::ends_with(char c) {
+ t_size length = get_length();
+ return length > 0 && get_ptr()[length-1] == c;
+}
+
+bool is_multiline(const char * p_string,t_size p_len) {
+ for(t_size n = 0; n < p_len && p_string[n]; n++) {
+ switch(p_string[n]) {
+ case '\r':
+ case '\n':
+ return true;
+ }
+ }
+ return false;
+}
+
+static t_uint64 pow10_helper(unsigned p_extra) {
+ t_uint64 ret = 1;
+ for(unsigned n = 0; n < p_extra; n++ ) ret *= 10;
+ return ret;
+}
+
+format_time_ex::format_time_ex(double p_seconds,unsigned p_extra) {
+ t_uint64 pow10 = pow10_helper(p_extra);
+ t_uint64 ticks = pfc::rint64(pow10 * p_seconds);
+
+ m_buffer << pfc::format_time(ticks / pow10);
+ if (p_extra>0) {
+ m_buffer << "." << pfc::format_uint(ticks % pow10, p_extra);
+ }
+}
+
+t_uint32 charLower(t_uint32 param)
+{
+ if (param<128)
+ {
+ if (param>='A' && param<='Z') param += 'a' - 'A';
+ return param;
+ }
+#ifdef WIN32
+ else if (param<0x10000)
+ {
+ unsigned ret;
+#ifdef UNICODE
+ ret = (unsigned)CharLowerW((WCHAR*)param);
+#else
+#error Nein! Verboten!
+#endif
+ return ret;
+ }
+ else return param;
+#else
+ else
+ {
+ setlocale(LC_CTYPE,"");
+ return towlower(param);
+ }
+#endif
+}
+
+t_uint32 charUpper(t_uint32 param)
+{
+ if (param<128)
+ {
+ if (param>='a' && param<='z') param += 'A' - 'a';
+ return param;
+ }
+#ifdef WIN32
+ else if (param<0x10000)
+ {
+ unsigned ret;
+#ifdef UNICODE
+ ret = (unsigned)CharUpperW((WCHAR*)param);
+#else
+#error Nein! Verboten!
+#endif
+ return ret;
+ }
+ else return param;
+#else
+ else
+ {
+ setlocale(LC_CTYPE,"");
+ return towupper(param);
+ }
+#endif
+}
+
+void stringToUpperAppend(string_base & out, const char * src, t_size len) {
+ while(len && *src) {
+ unsigned c; t_size d;
+ d = utf8_decode_char(src,c,len);
+ if (d==0 || d>len) break;
+ out.add_char(charUpper(c));
+ src+=d;
+ len-=d;
+ }
+}
+void stringToLowerAppend(string_base & out, const char * src, t_size len) {
+ while(len && *src) {
+ unsigned c; t_size d;
+ d = utf8_decode_char(src,c,len);
+ if (d==0 || d>len) break;
+ out.add_char(charLower(c));
+ src+=d;
+ len-=d;
+ }
+}
+int stringCompareCaseInsensitiveEx(string_part_ref s1, string_part_ref s2) {
+ t_size w1 = 0, w2 = 0;
+ for (;;) {
+ unsigned c1, c2; t_size d1, d2;
+ d1 = utf8_decode_char(s1.m_ptr + w1, c1, s1.m_len - w1);
+ d2 = utf8_decode_char(s2.m_ptr + w2, c2, s2.m_len - w2);
+ if (d1 == 0 && d2 == 0) return 0;
+ else if (d1 == 0) return -1;
+ else if (d2 == 0) return 1;
+ else {
+ c1 = charLower(c1); c2 = charLower(c2);
+ if (c1 < c2) return -1;
+ else if (c1 > c2) return 1;
+ }
+ w1 += d1; w2 += d2;
+ }
+}
+int stringCompareCaseInsensitive(const char * s1, const char * s2) {
+ for (;;) {
+ unsigned c1, c2; t_size d1, d2;
+ d1 = utf8_decode_char(s1,c1);
+ d2 = utf8_decode_char(s2,c2);
+ if (d1 == 0 && d2 == 0) return 0;
+ else if (d1 == 0) return -1;
+ else if (d2 == 0) return 1;
+ else {
+ c1 = charLower(c1); c2 = charLower(c2);
+ if (c1 < c2) return -1;
+ else if (c1 > c2) return 1;
+ }
+ s1 += d1; s2 += d2;
+ }
+}
+
+format_file_size_short::format_file_size_short(t_uint64 size) {
+ t_uint64 scale = 1;
+ const char * unit = "B";
+ const char * const unitTable[] = {"B","KB","MB","GB","TB"};
+ for(t_size walk = 1; walk < PFC_TABSIZE(unitTable); ++walk) {
+ t_uint64 next = scale * 1024;
+ if (size < next) break;
+ scale = next; unit = unitTable[walk];
+ }
+ *this << ( size / scale );
+
+ if (scale > 1 && length() < 3) {
+ t_size digits = 3 - length();
+ const t_uint64 mask = pow_int(10,digits);
+ t_uint64 remaining = ( (size * mask / scale) % mask );
+ while(digits > 0 && (remaining % 10) == 0) {
+ remaining /= 10; --digits;
+ }
+ if (digits > 0) {
+ *this << "." << format_uint(remaining, (t_uint32)digits);
+ }
+ }
+ *this << unit;
+ m_scale = scale;
+}
+
+bool string_base::truncate_eol(t_size start)
+{
+ const char * ptr = get_ptr() + start;
+ for(t_size n=start;*ptr;n++)
+ {
+ if (*ptr==10 || *ptr==13)
+ {
+ truncate(n);
+ return true;
+ }
+ ptr++;
+ }
+ return false;
+}
+
+bool string_base::fix_eol(const char * append,t_size start)
+{
+ const bool rv = truncate_eol(start);
+ if (rv) add_string(append);
+ return rv;
+}
+
+bool string_base::limit_length(t_size length_in_chars,const char * append)
+{
+ bool rv = false;
+ const char * base = get_ptr(), * ptr = base;
+ while(length_in_chars && utf8_advance(ptr)) length_in_chars--;
+ if (length_in_chars==0)
+ {
+ truncate(ptr-base);
+ add_string(append);
+ rv = true;
+ }
+ return rv;
+}
+
+void urlEncodeAppendRaw(pfc::string_base & out, const char * in, t_size inSize) {
+ for(t_size walk = 0; walk < inSize; ++walk) {
+ const char c = in[walk];
+ if (c == ' ') out.add_byte('+');
+ else if (pfc::char_is_ascii_alphanumeric(c) || c == '_') out.add_byte(c);
+ else out << "%" << pfc::format_hex((t_uint8)c, 2);
+ }
+}
+void urlEncodeAppend(pfc::string_base & out, const char * in) {
+ for (;;) {
+ const char c = *(in++);
+ if (c == 0) break;
+ else if (c == ' ') out.add_byte('+');
+ else if (pfc::char_is_ascii_alphanumeric(c) || c == '_') out.add_byte(c);
+ else out << "%" << pfc::format_hex((t_uint8)c, 2);
+ }
+}
+void urlEncode(pfc::string_base & out, const char * in) {
+ out.reset(); urlEncodeAppend(out, in);
+}
+
+unsigned char_to_dec(char c) {
+ if (c >= '0' && c <= '9') return (unsigned)(c - '0');
+ else throw exception_invalid_params();
+}
+
+unsigned char_to_hex(char c) {
+ if (c >= '0' && c <= '9') return (unsigned)(c - '0');
+ else if (c >= 'a' && c <= 'f') return (unsigned)(c - 'a' + 10);
+ else if (c >= 'A' && c <= 'F') return (unsigned)(c - 'A' + 10);
+ else throw exception_invalid_params();
+}
+
+
+} //namespace pfc
diff --git a/plugins/ListeningTo/src/players/foo_mlt/pfc/string.h b/plugins/ListeningTo/src/players/foo_mlt/pfc/string.h new file mode 100644 index 0000000000..e5bb47011f --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/pfc/string.h @@ -0,0 +1,989 @@ +#ifndef _PFC_STRING_H_
+#define _PFC_STRING_H_
+
+namespace pfc {
+ inline t_size _strParamLen(const char * str) {
+ return strlen(str);
+ }
+
+
+ struct string_part_ref {
+ const char * m_ptr;
+ t_size m_len;
+
+
+ static string_part_ref make(const char * ptr, t_size len) {
+ string_part_ref val = {ptr, len}; return val;
+ }
+
+ string_part_ref substring(t_size base) const {
+ PFC_ASSERT( base <= m_len );
+ return make(m_ptr + base, m_len - base);
+ }
+ string_part_ref substring(t_size base, t_size len) const {
+ PFC_ASSERT( base <= m_len && base + len <= m_len );
+ return make(m_ptr + base, len);
+ }
+ };
+
+ static string_part_ref string_part(const char * ptr, t_size len) {
+ string_part_ref val = {ptr, len}; return val;
+ }
+
+
+ class NOVTABLE string_receiver {
+ public:
+ virtual void add_string(const char * p_string,t_size p_string_size = ~0) = 0;
+ inline void add_string_(const char * str) {add_string(str, _strParamLen(str));}
+
+ void add_char(t_uint32 c);//adds unicode char to the string
+ void add_byte(char c) {add_string(&c,1);}
+ void add_chars(t_uint32 p_char,t_size p_count) {for (;p_count;p_count--) add_char(p_char);}
+ protected:
+ string_receiver() {}
+ ~string_receiver() {}
+ };
+
+ t_size scan_filename(const char * ptr);
+
+ bool is_path_separator(unsigned c);
+ bool is_path_bad_char(unsigned c);
+ bool is_valid_utf8(const char * param,t_size max = ~0);
+ bool is_lower_ascii(const char * param);
+ bool is_multiline(const char * p_string,t_size p_len = ~0);
+ bool has_path_bad_chars(const char * param);
+ void recover_invalid_utf8(const char * src,char * out,unsigned replace);//out must be enough to hold strlen(char) + 1, or appropiately bigger if replace needs multiple chars
+ void convert_to_lower_ascii(const char * src,t_size max,char * out,char replace = '?');//out should be at least strlen(src)+1 long
+
+ inline char ascii_tolower(char c) {if (c >= 'A' && c <= 'Z') c += 'a' - 'A'; return c;}
+ inline char ascii_toupper(char c) {if (c >= 'a' && c <= 'z') c += 'A' - 'a'; return c;}
+
+ t_size string_find_first(const char * p_string,char p_tofind,t_size p_start = 0); //returns infinite if not found
+ t_size string_find_last(const char * p_string,char p_tofind,t_size p_start = ~0); //returns infinite if not found
+ t_size string_find_first(const char * p_string,const char * p_tofind,t_size p_start = 0); //returns infinite if not found
+ t_size string_find_last(const char * p_string,const char * p_tofind,t_size p_start = ~0); //returns infinite if not found
+
+ t_size string_find_first_ex(const char * p_string,t_size p_string_length,char p_tofind,t_size p_start = 0); //returns infinite if not found
+ t_size string_find_last_ex(const char * p_string,t_size p_string_length,char p_tofind,t_size p_start = ~0); //returns infinite if not found
+ t_size string_find_first_ex(const char * p_string,t_size p_string_length,const char * p_tofind,t_size p_tofind_length,t_size p_start = 0); //returns infinite if not found
+ t_size string_find_last_ex(const char * p_string,t_size p_string_length,const char * p_tofind,t_size p_tofind_length,t_size p_start = ~0); //returns infinite if not found
+
+
+ t_size string_find_first_nc(const char * p_string,t_size p_string_length,char c,t_size p_start = 0); // lengths MUST be valid, no checks are performed (faster than the other flavour)
+ t_size string_find_first_nc(const char * p_string,t_size p_string_length,const char * p_tofind,t_size p_tofind_length,t_size p_start = 0); // lengths MUST be valid, no checks are performed (faster than the other falvour);
+
+
+
+ template<typename t_char>
+ t_size strlen_max_t(const t_char * ptr,t_size max) {
+ PFC_ASSERT( ptr != NULL || max == 0 );
+ t_size n = 0;
+ while(n<max && ptr[n] != 0) n++;
+ return n;
+ }
+
+ inline t_size strlen_max(const char * ptr,t_size max) throw() {return strlen_max_t(ptr,max);}
+ inline t_size wcslen_max(const wchar_t * ptr,t_size max) throw() {return strlen_max_t(ptr,max);}
+
+#ifdef _WINDOWS
+ inline t_size tcslen_max(const TCHAR * ptr,t_size max) {return strlen_max_t(ptr,max);}
+#endif
+
+ bool string_is_numeric(const char * p_string,t_size p_length = ~0) throw();
+ inline bool char_is_numeric(char p_char) throw() {return p_char >= '0' && p_char <= '9';}
+ inline bool char_is_hexnumeric(char p_char) throw() {return char_is_numeric(p_char) || (p_char >= 'a' && p_char <= 'f') || (p_char >= 'A' && p_char <= 'F');}
+ inline bool char_is_ascii_alpha_upper(char p_char) throw() {return p_char >= 'A' && p_char <= 'Z';}
+ inline bool char_is_ascii_alpha_lower(char p_char) throw() {return p_char >= 'a' && p_char <= 'z';}
+ inline bool char_is_ascii_alpha(char p_char) throw() {return char_is_ascii_alpha_lower(p_char) || char_is_ascii_alpha_upper(p_char);}
+ inline bool char_is_ascii_alphanumeric(char p_char) throw() {return char_is_ascii_alpha(p_char) || char_is_numeric(p_char);}
+
+ unsigned atoui_ex(const char * ptr,t_size max);
+ t_int64 atoi64_ex(const char * ptr,t_size max);
+ t_uint64 atoui64_ex(const char * ptr,t_size max);
+
+ //Throws exception_invalid_params on failure.
+ unsigned char_to_hex(char c);
+ unsigned char_to_dec(char c);
+
+ //Throws exception_invalid_params or exception_overflow on failure.
+ template<typename t_uint> t_uint atohex(const char * in, t_size inLen) {
+ t_uint ret = 0;
+ const t_uint guard = (t_uint)0xF << (sizeof(t_uint) * 8 - 4);
+ for(t_size walk = 0; walk < inLen; ++walk) {
+ if (ret & guard) throw exception_overflow();
+ ret = (ret << 4) | char_to_hex(in[walk]);
+ }
+ return ret;
+ }
+ template<typename t_uint> t_uint atodec(const char * in, t_size inLen) {
+ t_uint ret = 0;
+ for(t_size walk = 0; walk < inLen; ++walk) {
+ const t_uint prev = ret;
+ ret = (ret * 10) + char_to_dec(in[walk]);
+ if ((ret / 10) != prev) throw exception_overflow();
+ }
+ return ret;
+ }
+
+ t_size strlen_utf8(const char * s,t_size num = ~0) throw();//returns number of characters in utf8 string; num - no. of bytes (optional)
+ t_size utf8_char_len(const char * s,t_size max = ~0) throw();//returns size of utf8 character pointed by s, in bytes, 0 on error
+ t_size utf8_char_len_from_header(char c) throw();
+ t_size utf8_chars_to_bytes(const char * string,t_size count) throw();
+
+ t_size strcpy_utf8_truncate(const char * src,char * out,t_size maxbytes);
+
+ t_size utf8_decode_char(const char * src,unsigned & out,t_size src_bytes) throw();//returns length in bytes
+ t_size utf8_decode_char(const char * src,unsigned & out) throw();//returns length in bytes
+
+ t_size utf8_encode_char(unsigned c,char * out) throw();//returns used length in bytes, max 6
+ t_size utf16_decode_char(const wchar_t * p_source,unsigned * p_out,t_size p_source_length = ~0) throw();
+ t_size utf16_encode_char(unsigned c,wchar_t * out) throw();
+
+
+ t_size strstr_ex(const char * p_string,t_size p_string_len,const char * p_substring,t_size p_substring_len) throw();
+
+
+ t_size skip_utf8_chars(const char * ptr,t_size count) throw();
+ char * strdup_n(const char * src,t_size len);
+ int stricmp_ascii(const char * s1,const char * s2) throw();
+ int stricmp_ascii_ex(const char * s1,t_size len1,const char * s2,t_size len2) throw();
+
+ int strcmp_ex(const char* p1,t_size n1,const char* p2,t_size n2) throw();
+
+ unsigned utf8_get_char(const char * src);
+
+ inline bool utf8_advance(const char * & var) throw() {
+ t_size delta = utf8_char_len(var);
+ var += delta;
+ return delta>0;
+ }
+
+ inline bool utf8_advance(char * & var) throw() {
+ t_size delta = utf8_char_len(var);
+ var += delta;
+ return delta>0;
+ }
+
+ inline const char * utf8_char_next(const char * src) throw() {return src + utf8_char_len(src);}
+ inline char * utf8_char_next(char * src) throw() {return src + utf8_char_len(src);}
+
+ class NOVTABLE string_base : public pfc::string_receiver {
+ public:
+ virtual const char * get_ptr() const = 0;
+ virtual void add_string(const char * p_string,t_size p_length = ~0) = 0;//same as string_receiver method
+ virtual void set_string(const char * p_string,t_size p_length = ~0) {reset();add_string(p_string,p_length);}
+ virtual void truncate(t_size len)=0;
+ virtual t_size get_length() const {return strlen(get_ptr());}
+ virtual char * lock_buffer(t_size p_requested_length) = 0;
+ virtual void unlock_buffer() = 0;
+
+ void set_string_(const char * str) {set_string(str, _strParamLen(str));}
+
+ inline const char * toString() const {return get_ptr();}
+
+ //! For compatibility with old conventions.
+ inline t_size length() const {return get_length();}
+
+ inline void reset() {truncate(0);}
+
+ inline bool is_empty() const {return *get_ptr()==0;}
+
+ void skip_trailing_char(unsigned c = ' ');
+
+ bool is_valid_utf8() const {return pfc::is_valid_utf8(get_ptr());}
+
+ void convert_to_lower_ascii(const char * src,char replace = '?');
+
+ inline const string_base & operator= (const char * src) {set_string_(src);return *this;}
+ inline const string_base & operator+= (const char * src) {add_string_(src);return *this;}
+ inline const string_base & operator= (const string_base & src) {set_string(src);return *this;}
+ inline const string_base & operator+= (const string_base & src) {add_string(src);return *this;}
+
+ bool operator==(const string_base & p_other) const {return strcmp(*this,p_other) == 0;}
+ bool operator!=(const string_base & p_other) const {return strcmp(*this,p_other) != 0;}
+ bool operator>(const string_base & p_other) const {return strcmp(*this,p_other) > 0;}
+ bool operator<(const string_base & p_other) const {return strcmp(*this,p_other) < 0;}
+ bool operator>=(const string_base & p_other) const {return strcmp(*this,p_other) >= 0;}
+ bool operator<=(const string_base & p_other) const {return strcmp(*this,p_other) <= 0;}
+
+ inline operator const char * () const {return get_ptr();}
+
+ t_size scan_filename() const {return pfc::scan_filename(get_ptr());}
+
+ t_size find_first(char p_char,t_size p_start = 0) const {return pfc::string_find_first(get_ptr(),p_char,p_start);}
+ t_size find_last(char p_char,t_size p_start = ~0) const {return pfc::string_find_last(get_ptr(),p_char,p_start);}
+ t_size find_first(const char * p_string,t_size p_start = 0) const {return pfc::string_find_first(get_ptr(),p_string,p_start);}
+ t_size find_last(const char * p_string,t_size p_start = ~0) const {return pfc::string_find_last(get_ptr(),p_string,p_start);}
+
+ void fix_dir_separator(char p_char);
+ bool ends_with(char c);
+
+ bool truncate_eol(t_size start = 0);
+ bool fix_eol(const char * append = " (...)",t_size start = 0);
+ bool limit_length(t_size length_in_chars,const char * append = " (...)");
+
+ protected:
+ string_base() {}
+ ~string_base() {}
+ };
+
+ template<t_size max_length>
+ class string_fixed_t : public pfc::string_base {
+ public:
+ inline string_fixed_t() {init();}
+ inline string_fixed_t(const string_fixed_t<max_length> & p_source) {init(); *this = p_source;}
+ inline string_fixed_t(const char * p_source) {init(); set_string(p_source);}
+
+ inline const string_fixed_t<max_length> & operator=(const string_fixed_t<max_length> & p_source) {set_string(p_source);return *this;}
+ inline const string_fixed_t<max_length> & operator=(const char * p_source) {set_string(p_source);return *this;}
+
+ char * lock_buffer(t_size p_requested_length) {
+ if (p_requested_length >= max_length) return NULL;
+ memset(m_data,0,sizeof(m_data));
+ return m_data;
+ }
+ void unlock_buffer() {
+ m_length = strlen(m_data);
+ }
+
+ inline operator const char * () const {return m_data;}
+
+ const char * get_ptr() const {return m_data;}
+
+ void add_string(const char * ptr,t_size len) {
+ len = strlen_max(ptr,len);
+ if (m_length + len < m_length || m_length + len > max_length) throw pfc::exception_overflow();
+ for(t_size n=0;n<len;n++) {
+ m_data[m_length++] = ptr[n];
+ }
+ m_data[m_length] = 0;
+ }
+ void truncate(t_size len) {
+ if (len > max_length) len = max_length;
+ if (m_length > len) {
+ m_length = len;
+ m_data[len] = 0;
+ }
+ }
+ t_size get_length() const {return m_length;}
+ private:
+ inline void init() {
+ PFC_STATIC_ASSERT(max_length>1);
+ m_length = 0; m_data[0] = 0;
+ }
+ t_size m_length;
+ char m_data[max_length+1];
+ };
+
+ template<template<typename> class t_alloc>
+ class string8_t : public pfc::string_base {
+ private:
+ typedef string8_t<t_alloc> t_self;
+ protected:
+ pfc::array_t<char,t_alloc> m_data;
+ t_size used;
+
+ inline void makespace(t_size s) {
+ if (t_alloc<char>::alloc_prioritizes_speed) {
+ m_data.set_size(s);
+ } else {
+ const t_size old_size = m_data.get_size();
+ if (old_size < s)
+ m_data.set_size(s + 16);
+ else if (old_size > s + 32)
+ m_data.set_size(s);
+ }
+ }
+
+ inline const char * _get_ptr() const throw() {return used > 0 ? m_data.get_ptr() : "";}
+
+ public:
+ inline void set_string_(const char * str) {set_string_nc(str, strlen(str));}
+ inline void add_string_(const char * str) {add_string_nc(str, strlen(str));}
+ void set_string_nc(const char * ptr, t_size len) {
+ PFC_ASSERT(! m_data.is_owned(ptr) );
+ PFC_ASSERT( strlen_max(ptr, len) == len );
+ makespace(len+1);
+ pfc::memcpy_t(m_data.get_ptr(),ptr,len);
+ used=len;
+ m_data[used]=0;
+ }
+ void add_string_nc(const char * ptr, t_size len) {
+ PFC_ASSERT(! m_data.is_owned(ptr) );
+ PFC_ASSERT( strlen_max(ptr, len) == len );
+ makespace(used+len+1);
+ pfc::memcpy_t(m_data.get_ptr() + used,ptr,len);
+ used+=len;
+ m_data[used]=0;
+ }
+ inline const t_self & operator= (const char * src) {set_string_(src);return *this;}
+ inline const t_self & operator+= (const char * src) {add_string_(src);return *this;}
+ inline const t_self & operator= (const string_base & src) {set_string(src);return *this;}
+ inline const t_self & operator+= (const string_base & src) {add_string(src);return *this;}
+ inline const t_self & operator= (const t_self & src) {set_string(src);return *this;}
+ inline const t_self & operator+= (const t_self & src) {add_string(src);return *this;}
+
+ inline const t_self & operator= (string_part_ref src) {set_string(src);return *this;}
+ inline const t_self & operator+= (string_part_ref src) {add_string(src);return *this;}
+
+ inline operator const char * () const throw() {return _get_ptr();}
+
+ string8_t() : used(0) {}
+ string8_t(const char * p_string) : used(0) {set_string_(p_string);}
+ string8_t(const char * p_string,t_size p_length) : used(0) {set_string(p_string,p_length);}
+ string8_t(const t_self & p_string) : used(0) {set_string(p_string);}
+ string8_t(const string_base & p_string) : used(0) {set_string(p_string);}
+ string8_t(string_part_ref ref) : used(0) {set_string(ref);}
+
+ void prealloc(t_size p_size) {m_data.prealloc(p_size+1);}
+
+ const char * get_ptr() const throw() {return _get_ptr();}
+
+ void add_string(const char * p_string,t_size p_length = ~0);
+ void set_string(const char * p_string,t_size p_length = ~0);
+
+ void set_string(string_part_ref ref) {set_string_nc(ref.m_ptr, ref.m_len);}
+ void add_string(string_part_ref ref) {add_string_nc(ref.m_ptr, ref.m_len);}
+
+ void truncate(t_size len)
+ {
+ if (used>len) {used=len;m_data[len]=0;makespace(used+1);}
+ }
+
+ t_size get_length() const throw() {return used;}
+
+
+ void set_char(unsigned offset,char c);
+
+ t_size replace_nontext_chars(char p_replace = '_');
+ t_size replace_char(unsigned c1,unsigned c2,t_size start = 0);
+ t_size replace_byte(char c1,char c2,t_size start = 0);
+ void fix_filename_chars(char def = '_',char leave=0);//replace "bad" characters, leave parameter can be used to keep eg. path separators
+ void remove_chars(t_size first,t_size count); //slow
+ void insert_chars(t_size first,const char * src, t_size count);//slow
+ void insert_chars(t_size first,const char * src);
+
+ //for string_buffer class
+ char * lock_buffer(t_size n)
+ {
+ if (n + 1 == 0) throw exception_overflow();
+ makespace(n+1);
+ pfc::memset_t(m_data,(char)0);
+ return m_data.get_ptr();;
+ }
+
+ void unlock_buffer() {
+ if (m_data.get_size() > 0) {
+ used=strlen(m_data.get_ptr());
+ makespace(used+1);
+ }
+ }
+
+ void force_reset() {used=0;m_data.force_reset();}
+
+ inline static void g_swap(t_self & p_item1,t_self & p_item2) {
+ pfc::swap_t(p_item1.m_data,p_item2.m_data);
+ pfc::swap_t(p_item1.used,p_item2.used);
+ }
+ };
+
+ typedef string8_t<pfc::alloc_standard> string8;
+ typedef string8_t<pfc::alloc_fast> string8_fast;
+ typedef string8_t<pfc::alloc_fast_aggressive> string8_fast_aggressive;
+ //for backwards compatibility
+ typedef string8_t<pfc::alloc_fast_aggressive> string8_fastalloc;
+
+
+ template<template<typename> class t_alloc> class traits_t<string8_t<t_alloc> > : public pfc::combine_traits<pfc::traits_vtable,pfc::traits_t<pfc::array_t<char,t_alloc> > > {
+ public:
+ enum {
+ needs_constructor = true,
+ };
+ };
+}
+
+
+
+#include "string8_impl.h"
+
+#define PFC_DEPRECATE_PRINTF PFC_DEPRECATE("Use string8/string_fixed_t with operator<< overloads instead.")
+
+namespace pfc {
+
+ class string_buffer {
+ private:
+ string_base & m_owner;
+ char * m_buffer;
+ public:
+ explicit string_buffer(string_base & p_string,t_size p_requested_length) : m_owner(p_string) {m_buffer = m_owner.lock_buffer(p_requested_length);}
+ ~string_buffer() {m_owner.unlock_buffer();}
+ char * get_ptr() {return m_buffer;}
+ operator char* () {return m_buffer;}
+ };
+
+ class PFC_DEPRECATE_PRINTF string_printf : public string8_fastalloc {
+ public:
+ static void g_run(string_base & out,const char * fmt,va_list list);
+ void run(const char * fmt,va_list list);
+
+ explicit string_printf(const char * fmt,...);
+ };
+
+ class PFC_DEPRECATE_PRINTF string_printf_va : public string8_fastalloc {
+ public:
+ string_printf_va(const char * fmt,va_list list);
+ };
+
+ class format_time {
+ public:
+ format_time(t_uint64 p_seconds);
+ const char * get_ptr() const {return m_buffer;}
+ operator const char * () const {return m_buffer;}
+ protected:
+ string_fixed_t<127> m_buffer;
+ };
+
+
+ class format_time_ex {
+ public:
+ format_time_ex(double p_seconds,unsigned p_extra = 3);
+ const char * get_ptr() const {return m_buffer;}
+ operator const char * () const {return m_buffer;}
+ private:
+ string_fixed_t<127> m_buffer;
+ };
+
+
+
+
+ class string_filename : public string8 {
+ public:
+ explicit string_filename(const char * fn);
+ };
+
+ class string_filename_ext : public string8 {
+ public:
+ explicit string_filename_ext(const char * fn);
+ };
+
+ class string_extension
+ {
+ char buffer[32];
+ public:
+ inline const char * get_ptr() const {return buffer;}
+ inline t_size length() const {return strlen(buffer);}
+ inline operator const char * () const {return buffer;}
+ inline const char * toString() const {return buffer;}
+ explicit string_extension(const char * src);
+ };
+
+
+ class string_replace_extension
+ {
+ public:
+ string_replace_extension(const char * p_path,const char * p_ext);
+ inline operator const char*() const {return m_data;}
+ private:
+ string8 m_data;
+ };
+
+ class string_directory
+ {
+ public:
+ string_directory(const char * p_path);
+ inline operator const char*() const {return m_data;}
+ private:
+ string8 m_data;
+ };
+
+ void float_to_string(char * out,t_size out_max,double val,unsigned precision,bool force_sign = false);//doesnt add E+X etc, has internal range limits, useful for storing float numbers as strings without having to bother with international coma/dot settings BS
+ double string_to_float(const char * src,t_size len = ~0);
+
+ template<>
+ inline void swap_t(string8 & p_item1,string8 & p_item2)
+ {
+ string8::g_swap(p_item1,p_item2);
+ }
+
+ class format_float
+ {
+ public:
+ format_float(double p_val,unsigned p_width = 0,unsigned p_prec = 7);
+ format_float(const format_float & p_source) {*this = p_source;}
+
+ inline const char * get_ptr() const {return m_buffer.get_ptr();}
+ inline const char * toString() const {return m_buffer.get_ptr();}
+ inline operator const char*() const {return m_buffer.get_ptr();}
+ private:
+ string8 m_buffer;
+ };
+
+ class format_int
+ {
+ public:
+ format_int(t_int64 p_val,unsigned p_width = 0,unsigned p_base = 10);
+ format_int(const format_int & p_source) {*this = p_source;}
+ inline const char * get_ptr() const {return m_buffer;}
+ inline const char * toString() const {return m_buffer;}
+ inline operator const char*() const {return m_buffer;}
+ private:
+ char m_buffer[64];
+ };
+
+
+ class format_uint {
+ public:
+ format_uint(t_uint64 p_val,unsigned p_width = 0,unsigned p_base = 10);
+ format_uint(const format_uint & p_source) {*this = p_source;}
+ inline const char * get_ptr() const {return m_buffer;}
+ inline const char * toString() const {return m_buffer;}
+ inline operator const char*() const {return m_buffer;}
+ private:
+ char m_buffer[64];
+ };
+
+ class format_hex
+ {
+ public:
+ format_hex(t_uint64 p_val,unsigned p_width = 0);
+ format_hex(const format_hex & p_source) {*this = p_source;}
+ inline const char * get_ptr() const {return m_buffer;}
+ inline const char * toString() const {return m_buffer;}
+ inline operator const char*() const {return m_buffer;}
+ private:
+ char m_buffer[17];
+ };
+
+ class format_hex_lowercase
+ {
+ public:
+ format_hex_lowercase(t_uint64 p_val,unsigned p_width = 0);
+ format_hex_lowercase(const format_hex_lowercase & p_source) {*this = p_source;}
+ inline const char * get_ptr() const {return m_buffer;}
+ inline operator const char*() const {return m_buffer;}
+ inline const char * toString() const {return m_buffer;}
+ private:
+ char m_buffer[17];
+ };
+
+ char format_hex_char_lowercase(unsigned p_val);
+ char format_hex_char(unsigned p_val);
+
+
+ typedef string8_fastalloc string_formatter;
+
+ class format_hexdump_ex {
+ public:
+ template<typename TWord> format_hexdump_ex(const TWord * buffer, t_size bufLen, const char * spacing = " ") {
+ for(t_size n = 0; n < bufLen; n++) {
+ if (n > 0 && spacing != NULL) m_formatter << spacing;
+ m_formatter << format_hex(buffer[n],sizeof(TWord) * 2);
+ }
+ }
+ inline const char * get_ptr() const {return m_formatter;}
+ inline operator const char * () const {return m_formatter;}
+ inline const char * toString() const {return m_formatter;}
+ private:
+ string_formatter m_formatter;
+ };
+
+ class format_hexdump
+ {
+ public:
+ format_hexdump(const void * p_buffer,t_size p_bytes,const char * p_spacing = " ");
+
+ inline const char * get_ptr() const {return m_formatter;}
+ inline operator const char * () const {return m_formatter;}
+ inline const char * toString() const {return m_formatter;}
+ private:
+ string_formatter m_formatter;
+ };
+
+ class format_hexdump_lowercase
+ {
+ public:
+ format_hexdump_lowercase(const void * p_buffer,t_size p_bytes,const char * p_spacing = " ");
+
+ inline const char * get_ptr() const {return m_formatter;}
+ inline operator const char * () const {return m_formatter;}
+ inline const char * toString() const {return m_formatter;}
+
+ private:
+ string_formatter m_formatter;
+ };
+
+ class format_fixedpoint
+ {
+ public:
+ format_fixedpoint(t_int64 p_val,unsigned p_point);
+ inline const char * get_ptr() const {return m_buffer;}
+ inline operator const char*() const {return m_buffer;}
+ inline const char * toString() const {return m_buffer;}
+ private:
+ string_formatter m_buffer;
+ };
+
+ class format_char {
+ public:
+ format_char(char p_char) {m_buffer[0] = p_char; m_buffer[1] = 0;}
+ inline const char * get_ptr() const {return m_buffer;}
+ inline operator const char*() const {return m_buffer;}
+ inline const char * toString() const {return m_buffer;}
+ private:
+ char m_buffer[2];
+ };
+
+ template<typename t_stringbuffer = pfc::string8_fastalloc>
+ class format_pad_left {
+ public:
+ format_pad_left(t_size p_chars,t_uint32 p_padding /* = ' ' */,const char * p_string,t_size p_string_length = ~0) {
+ t_size source_len = 0, source_walk = 0;
+
+ while(source_walk < p_string_length && source_len < p_chars) {
+ unsigned dummy;
+ t_size delta = pfc::utf8_decode_char(p_string + source_walk, dummy, p_string_length - source_walk);
+ if (delta == 0) break;
+ source_len++;
+ source_walk += delta;
+ }
+
+ m_buffer.add_string(p_string,source_walk);
+ m_buffer.add_chars(p_padding,p_chars - source_len);
+ }
+ inline const char * get_ptr() const {return m_buffer;}
+ inline operator const char*() const {return m_buffer;}
+ inline const char * toString() const {return m_buffer;}
+ private:
+ t_stringbuffer m_buffer;
+ };
+
+ template<typename t_stringbuffer = pfc::string8_fastalloc>
+ class format_pad_right {
+ public:
+ format_pad_right(t_size p_chars,t_uint32 p_padding /* = ' ' */,const char * p_string,t_size p_string_length = ~0) {
+ t_size source_len = 0, source_walk = 0;
+
+ while(source_walk < p_string_length && source_len < p_chars) {
+ unsigned dummy;
+ t_size delta = pfc::utf8_decode_char(p_string + source_walk, dummy, p_string_length - source_walk);
+ if (delta == 0) break;
+ source_len++;
+ source_walk += delta;
+ }
+
+ m_buffer.add_chars(p_padding,p_chars - source_len);
+ m_buffer.add_string(p_string,source_walk);
+ }
+ inline const char * get_ptr() const {return m_buffer;}
+ inline operator const char*() const {return m_buffer;}
+ inline const char * toString() const {return m_buffer;}
+ private:
+ t_stringbuffer m_buffer;
+ };
+
+ class format_array : public string_formatter {
+ public:
+ template<typename t_source> format_array(t_source const & source, const char * separator = ", ") {
+ const t_size count = array_size_t(source);
+ if (count > 0) {
+ *this << source[0];
+ for(t_size walk = 1; walk < count; ++walk) *this << separator << source[walk];
+ }
+ }
+ };
+
+
+ class format_file_size_short : public string_formatter {
+ public:
+ format_file_size_short(t_uint64 size);
+ t_uint64 get_used_scale() const {return m_scale;}
+ private:
+ t_uint64 m_scale;
+ };
+
+}
+
+inline pfc::string_base & operator<<(pfc::string_base & p_fmt,const char * p_source) {p_fmt.add_string_(p_source); return p_fmt;}
+inline pfc::string_base & operator<<(pfc::string_base & p_fmt,pfc::string_part_ref source) {p_fmt.add_string(source.m_ptr, source.m_len); return p_fmt;}
+inline pfc::string_base & operator<<(pfc::string_base & p_fmt,t_int32 p_val) {p_fmt.add_string(pfc::format_int(p_val)); return p_fmt;}
+inline pfc::string_base & operator<<(pfc::string_base & p_fmt,t_uint32 p_val) {p_fmt.add_string(pfc::format_uint(p_val)); return p_fmt;}
+inline pfc::string_base & operator<<(pfc::string_base & p_fmt,t_int64 p_val) {p_fmt.add_string(pfc::format_int(p_val)); return p_fmt;}
+inline pfc::string_base & operator<<(pfc::string_base & p_fmt,t_uint64 p_val) {p_fmt.add_string(pfc::format_uint(p_val)); return p_fmt;}
+inline pfc::string_base & operator<<(pfc::string_base & p_fmt,double p_val) {p_fmt.add_string(pfc::format_float(p_val)); return p_fmt;}
+inline pfc::string_base & operator<<(pfc::string_base & p_fmt,std::exception const & p_exception) {p_fmt.add_string(p_exception.what()); return p_fmt;}
+
+template<template<typename> class t_alloc> inline pfc::string8_t<t_alloc> & operator<< (pfc::string8_t<t_alloc> & str, const char * src) {str.add_string_(src); return str;}
+template<template<typename> class t_alloc> inline pfc::string8_t<t_alloc> & operator<< (pfc::string8_t<t_alloc> & str, pfc::string_base const & src) {str.add_string(src); return str;}
+template<template<typename> class t_alloc> inline pfc::string8_t<t_alloc> & operator<< (pfc::string8_t<t_alloc> & str, pfc::string_part_ref src) {str.add_string(src); return str;}
+
+
+
+
+namespace pfc {
+ template<typename t_char>
+ class string_simple_t {
+ private:
+ typedef string_simple_t<t_char> t_self;
+ public:
+ t_size length(t_size p_limit = ~0) const {return pfc::strlen_t(get_ptr(),p_limit);}
+ bool is_empty() const {return length(1) == 0;}
+ void set_string(const t_char * p_source,t_size p_length = ~0) {
+ t_size length = pfc::strlen_t(p_source,p_length);
+ m_buffer.set_size(length + 1);
+ pfc::memcpy_t(m_buffer.get_ptr(),p_source,length);
+ m_buffer[length] = 0;
+ }
+ string_simple_t() {}
+ string_simple_t(const t_char * p_source,t_size p_length = ~0) {set_string(p_source,p_length);}
+ const t_self & operator=(const t_char * p_source) {set_string(p_source);return *this;}
+ operator const t_char* () const {return get_ptr();}
+ const t_char * get_ptr() const {return m_buffer.get_size() > 0 ? m_buffer.get_ptr() : pfc::empty_string_t<t_char>();}
+ private:
+ pfc::array_t<t_char> m_buffer;
+ };
+
+ typedef string_simple_t<char> string_simple;
+
+ template<typename t_char> class traits_t<string_simple_t<t_char> > : public traits_t<array_t<t_char> > {};
+}
+
+
+namespace pfc {
+ class comparator_strcmp {
+ public:
+ inline static int compare(const char * p_item1,const char * p_item2) {return strcmp(p_item1,p_item2);}
+ inline static int compare(const wchar_t * item1, const wchar_t * item2) {return wcscmp(item1, item2);}
+ };
+
+ class comparator_stricmp_ascii {
+ public:
+ inline static int compare(const char * p_item1,const char * p_item2) {return pfc::stricmp_ascii(p_item1,p_item2);}
+ };
+
+
+
+ template<typename t_source> static void stringCombine(pfc::string_base & out, t_source const & in, const char * separator, const char * separatorLast) {
+ out.reset();
+ for(t_source::const_iterator walk = in.first(); walk.is_valid(); ++walk) {
+ if (!out.is_empty()) {
+ if (walk == in.last()) out << separatorLast;
+ else out << separator;
+ }
+ out << stringToPtr(*walk);
+ }
+ }
+
+ template<typename t_output, typename t_splitCheck>
+ void splitStringEx(t_output & p_output, const t_splitCheck & p_check, const char * p_string, t_size p_stringLen = ~0) {
+ t_size walk = 0, splitBase = 0;
+ const t_size max = strlen_max(p_string,p_stringLen);
+ for (;walk < max;) {
+ t_size delta = p_check(p_string + walk,max - walk);
+ if (delta > 0) {
+ if (walk > splitBase) p_output(p_string + splitBase, walk - splitBase);
+ splitBase = walk + delta;
+ } else {
+ delta = utf8_char_len(p_string + walk, max - walk);
+ if (delta == 0) break;
+ }
+ walk += delta;
+ }
+ if (walk > splitBase) p_output(p_string + splitBase, walk - splitBase);
+ }
+
+ class __splitStringSimple_calculateSubstringCount {
+ public:
+ __splitStringSimple_calculateSubstringCount() : m_count() {}
+ void operator() (const char *, t_size) {++m_count;}
+ t_size get() const {return m_count;}
+ private:
+ t_size m_count;
+ };
+
+ template<typename t_param> class _splitStringSimple_check;
+
+ template<> class _splitStringSimple_check<const char*> {
+ public:
+ _splitStringSimple_check(const char * p_chars) {
+ m_chars.set_size(strlen_utf8(p_chars));
+ for(t_size walk = 0, ptr = 0; walk < m_chars.get_size(); ++walk) {
+ ptr += utf8_decode_char(p_chars + ptr,m_chars[walk]);
+ }
+ }
+ t_size operator()(const char * p_string, t_size p_stringLen) const {
+ t_uint32 c;
+ t_size delta = utf8_decode_char(p_string, c, p_stringLen);
+ if (delta > 0) {
+ for(t_size walk = 0; walk < m_chars.get_size(); ++walk) {
+ if (m_chars[walk] == c) return delta;
+ }
+ }
+ return 0;
+ }
+ private:
+ array_t<t_uint32> m_chars;
+ };
+ template<> class _splitStringSimple_check<char> {
+ public:
+ _splitStringSimple_check(char c) : m_char(c) {}
+ t_size operator()(const char * str, t_size len) const {
+ PFC_ASSERT( len > 0 );
+ if (*str == m_char) return 1;
+ else return 0;
+ }
+ private:
+ const char m_char;
+ };
+ template<typename t_array>
+ class __splitStringSimple_arrayWrapper {
+ public:
+ __splitStringSimple_arrayWrapper(t_array & p_array) : m_walk(), m_array(p_array) {}
+ void operator()(const char * p_string, t_size p_stringLen) {
+ m_array[m_walk++] = string_part(p_string,p_stringLen);
+ }
+ private:
+ t_size m_walk;
+ t_array & m_array;
+ };
+ template<typename t_list>
+ class __splitStringSimple_listWrapper {
+ public:
+ __splitStringSimple_listWrapper(t_list & p_list) : m_list(p_list) {}
+ void operator()(const char * p_string, t_size p_stringLen) {
+ m_list += string_part(p_string, p_stringLen);
+ }
+ private:
+ t_list & m_list;
+ };
+
+ template<typename t_array, typename t_split>
+ void splitStringSimple_toArray(t_array & p_output, t_split p_split, const char * p_string, t_size p_stringLen = ~0) {
+ _splitStringSimple_check<t_split> check(p_split);
+
+ {
+ __splitStringSimple_calculateSubstringCount wrapper;
+ splitStringEx(wrapper,check,p_string,p_stringLen);
+ p_output.set_size(wrapper.get());
+ }
+
+ {
+ __splitStringSimple_arrayWrapper<t_array> wrapper(p_output);
+ splitStringEx(wrapper,check,p_string,p_stringLen);
+ }
+ }
+ template<typename t_list, typename t_split>
+ void splitStringSimple_toList(t_list & p_output, t_split p_split, const char * p_string, t_size p_stringLen = ~0) {
+ _splitStringSimple_check<t_split> check(p_split);
+
+ __splitStringSimple_listWrapper<t_list> wrapper(p_output);
+ splitStringEx(wrapper,check,p_string,p_stringLen);
+ }
+
+ template<typename t_out> void splitStringByLines(t_out & out, const char * str) {
+ for (;;) {
+ const char * next = strchr(str, '\n');
+ if (next == NULL) {
+ out += string_part(str, strlen(str)); break;
+ }
+ const char * walk = next;
+ while(walk > str && walk[-1] == '\r') --walk;
+ out += string_part(str, walk - str);
+ str = next + 1;
+ }
+ }
+ template<typename t_out> void splitStringByChar(t_out & out, const char * str, char c) {
+ for (;;) {
+ const char * next = strchr(str, c);
+ if (next == NULL) {
+ out += string_part(str, strlen(str)); break;
+ }
+ out += string_part(str, next - str);
+ str = next + 1;
+ }
+ }
+
+ void stringToUpperAppend(string_base & p_out, const char * p_source, t_size p_sourceLen);
+ void stringToLowerAppend(string_base & p_out, const char * p_source, t_size p_sourceLen);
+ int stringCompareCaseInsensitive(const char * s1, const char * s2);
+ int stringCompareCaseInsensitiveEx(string_part_ref s1, string_part_ref s2);
+ t_uint32 charLower(t_uint32 param);
+ t_uint32 charUpper(t_uint32 param);
+
+ template<typename T> static const char * stringToPtr(T const& val) {return val.get_ptr();}
+ static const char * stringToPtr(const char* val) {return val;}
+
+ template<typename T> static string_part_ref stringToRef(T const & val) {return string_part(val.get_ptr(), val.length());}
+ static string_part_ref stringToRef(string_part_ref val) {return val;}
+ static string_part_ref stringToRef(const char * val) {return string_part(val, strlen(val));}
+
+
+
+
+ class string_base_ref : public string_base {
+ public:
+ string_base_ref(const char * ptr) : m_ptr(ptr), m_len(strlen(ptr)) {}
+ const char * get_ptr() const {return m_ptr;}
+ t_size get_length() const {return m_len;}
+ private:
+ void add_string(const char * p_string,t_size p_length = ~0) {throw pfc::exception_not_implemented();}
+ void set_string(const char * p_string,t_size p_length = ~0) {throw pfc::exception_not_implemented();}
+ void truncate(t_size len) {throw pfc::exception_not_implemented();}
+ char * lock_buffer(t_size p_requested_length) {throw pfc::exception_not_implemented();}
+ void unlock_buffer() {throw pfc::exception_not_implemented();}
+ private:
+ const char * const m_ptr;
+ t_size const m_len;
+ };
+
+ //! Writes a string to a fixed-size buffer. Truncates the string if necessary. Always writes a null terminator.
+ template<typename TChar, t_size len, typename TSource>
+ void stringToBuffer(TChar (&buffer)[len], const TSource & source) {
+ PFC_STATIC_ASSERT(len>0);
+ t_size walk;
+ for(walk = 0; walk < len - 1 && source[walk] != 0; ++walk) {
+ buffer[walk] = source[walk];
+ }
+ buffer[walk] = 0;
+ }
+
+ //! Same as stringToBuffer() but throws exception_overflow() if the string could not be fully written, including null terminator.
+ template<typename TChar, t_size len, typename TSource>
+ void stringToBufferGuarded(TChar (&buffer)[len], const TSource & source) {
+ t_size walk;
+ for(walk = 0; source[walk] != 0; ++walk) {
+ if (walk >= len) throw exception_overflow();
+ buffer[walk] = source[walk];
+ }
+ if (walk >= len) throw exception_overflow();
+ buffer[walk] = 0;
+ }
+
+
+ template<typename t_char> int _strcmp_partial_ex(const t_char * p_string,t_size p_string_length,const t_char * p_substring,t_size p_substring_length) throw() {
+ for(t_size walk=0;walk<p_substring_length;walk++) {
+ t_char stringchar = (walk>=p_string_length ? 0 : p_string[walk]);
+ t_char substringchar = p_substring[walk];
+ int result = compare_t(stringchar,substringchar);
+ if (result != 0) return result;
+ }
+ return 0;
+ }
+
+ template<typename t_char> int strcmp_partial_ex_t(const t_char * p_string,t_size p_string_length,const t_char * p_substring,t_size p_substring_length) throw() {
+ p_string_length = strlen_max_t(p_string,p_string_length); p_substring_length = strlen_max_t(p_substring,p_substring_length);
+ return _strcmp_partial_ex(p_string,p_string_length,p_substring,p_substring_length);
+ }
+
+ template<typename t_char>
+ int strcmp_partial_t(const t_char * p_string,const t_char * p_substring) throw() {return strcmp_partial_ex_t(p_string,~0,p_substring,~0);}
+
+ static int strcmp_partial_ex(const char * str, t_size strLen, const char * substr, t_size substrLen) throw() {return strcmp_partial_ex(str, strLen, substr, substrLen); }
+ static int strcmp_partial(const char * str, const char * substr) throw() {return strcmp_partial_t(str, substr); }
+
+
+ void urlEncodeAppendRaw(pfc::string_base & out, const char * in, t_size inSize);
+ void urlEncodeAppend(pfc::string_base & out, const char * in);
+ void urlEncode(pfc::string_base & out, const char * in);
+}
+
+#endif //_PFC_STRING_H_
diff --git a/plugins/ListeningTo/src/players/foo_mlt/pfc/string8_impl.h b/plugins/ListeningTo/src/players/foo_mlt/pfc/string8_impl.h new file mode 100644 index 0000000000..a738b27e5f --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/pfc/string8_impl.h @@ -0,0 +1,117 @@ +namespace pfc {
+
+template<template<typename> class t_alloc>
+void string8_t<t_alloc>::add_string(const char * ptr,t_size len)
+{
+ if (m_data.is_owned(ptr)) {
+ add_string(string8(ptr,len));
+ } else {
+ len = strlen_max(ptr,len);
+ add_string_nc(ptr, len);
+ }
+}
+
+template<template<typename> class t_alloc>
+void string8_t<t_alloc>::set_string(const char * ptr,t_size len) {
+ if (m_data.is_owned(ptr)) {
+ set_string_(string8(ptr,len));
+ } else {
+ len = strlen_max(ptr,len);
+ set_string_nc(ptr, len);
+ }
+}
+
+template<template<typename> class t_alloc>
+void string8_t<t_alloc>::set_char(unsigned offset,char c)
+{
+ if (!c) truncate(offset);
+ else if (offset<used) m_data[offset]=c;
+}
+
+template<template<typename> class t_alloc>
+void string8_t<t_alloc>::fix_filename_chars(char def,char leave)//replace "bad" characters, leave parameter can be used to keep eg. path separators
+{
+ t_size n;
+ for(n=0;n<used;n++)
+ if (m_data[n]!=leave && pfc::is_path_bad_char(m_data[n])) m_data[n]=def;
+}
+
+template<template<typename> class t_alloc>
+void string8_t<t_alloc>::remove_chars(t_size first,t_size count)
+{
+ if (first>used) first = used;
+ if (first+count>used) count = used-first;
+ if (count>0)
+ {
+ t_size n;
+ for(n=first+count;n<=used;n++)
+ m_data[n-count]=m_data[n];
+ used -= count;
+ makespace(used+1);
+ }
+}
+
+template<template<typename> class t_alloc>
+void string8_t<t_alloc>::insert_chars(t_size first,const char * src, t_size count)
+{
+ if (first > used) first = used;
+
+ makespace(used+count+1);
+ t_size n;
+ for(n=used;(int)n>=(int)first;n--)
+ m_data[n+count] = m_data[n];
+ for(n=0;n<count;n++)
+ m_data[first+n] = src[n];
+
+ used+=count;
+}
+
+template<template<typename> class t_alloc>
+void string8_t<t_alloc>::insert_chars(t_size first,const char * src) {insert_chars(first,src,strlen(src));}
+
+
+template<template<typename> class t_alloc>
+t_size string8_t<t_alloc>::replace_nontext_chars(char p_replace)
+{
+ t_size ret = 0;
+ for(t_size n=0;n<used;n++)
+ {
+ if ((unsigned char)m_data[n] < 32) {m_data[n] = p_replace; ret++; }
+ }
+ return ret;
+}
+
+template<template<typename> class t_alloc>
+t_size string8_t<t_alloc>::replace_byte(char c1,char c2,t_size start)
+{
+ PFC_ASSERT(c1 != 0); PFC_ASSERT(c2 != 0);
+ t_size n, ret = 0;
+ for(n=start;n<used;n++)
+ {
+ if (m_data[n] == c1) {m_data[n] = c2; ret++;}
+ }
+ return ret;
+}
+
+template<template<typename> class t_alloc>
+t_size string8_t<t_alloc>::replace_char(unsigned c1,unsigned c2,t_size start)
+{
+ if (c1 < 128 && c2 < 128) return replace_byte((char)c1,(char)c2,start);
+
+ string8 temp(get_ptr()+start);
+ truncate(start);
+ const char * ptr = temp;
+ t_size rv = 0;
+ while(*ptr)
+ {
+ unsigned test;
+ t_size delta = utf8_decode_char(ptr,test);
+ if (delta==0 || test==0) break;
+ if (test == c1) {test = c2;rv++;}
+ add_char(test);
+ ptr += delta;
+ }
+ return rv;
+}
+
+}
diff --git a/plugins/ListeningTo/src/players/foo_mlt/pfc/stringNew.cpp b/plugins/ListeningTo/src/players/foo_mlt/pfc/stringNew.cpp new file mode 100644 index 0000000000..1e469a02a2 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/pfc/stringNew.cpp @@ -0,0 +1,82 @@ +#include "pfc.h"
+
+namespace pfc {
+
+t_size string::indexOf(char c,t_size base) const {
+ return pfc::string_find_first(ptr(),c,base);
+}
+t_size string::lastIndexOf(char c,t_size base) const {
+ return pfc::string_find_last(ptr(),c,base);
+}
+t_size string::indexOf(stringp s,t_size base) const {
+ return pfc::string_find_first(ptr(),s.ptr(),base);
+}
+t_size string::lastIndexOf(stringp s,t_size base) const {
+ return pfc::string_find_last(ptr(),s.ptr(),base);
+}
+t_size string::indexOfAnyChar(stringp _s,t_size base) const {
+ string s ( _s );
+ const t_size len = length();
+ const char* content = ptr();
+ for(t_size walk = 0; walk < len; ++walk) {
+ if (s.contains(content[walk])) return walk;
+ }
+ return ~0;
+}
+t_size string::lastIndexOfAnyChar(stringp _s,t_size base) const {
+ string s ( _s );
+ const char* content = ptr();
+ for(t_size _walk = length(); _walk > 0; --_walk) {
+ const t_size walk = _walk-1;
+ if (s.contains(content[walk])) return walk;
+ }
+ return ~0;
+}
+bool string::startsWith(char c) const {
+ return (*this)[0] == c;
+}
+bool string::startsWith(string s) const {
+ const char * walk = ptr();
+ const char * subWalk = s.ptr();
+ for (;;) {
+ if (*subWalk == 0) return true;
+ if (*walk != *subWalk) return false;
+ walk++; subWalk++;
+ }
+}
+bool string::endsWith(char c) const {
+ const t_size len = length();
+ if (len == 0) return false;
+ return ptr()[len-1] == c;
+}
+bool string::endsWith(string s) const {
+ const t_size len = length(), subLen = s.length();
+ if (subLen > len) return false;
+ return subString(len - subLen) == s;
+}
+
+char string::firstChar() const {
+ return (*this)[0];
+}
+char string::lastChar() const {
+ const t_size len = length();
+ return len > 0 ? (*this)[len-1] : (char)0;
+}
+
+string string::replace(stringp strOld, stringp strNew) const {
+ t_size walk = 0;
+ string ret;
+ for (;;) {
+ t_size next = indexOf(strOld, walk);
+ if (next == ~0) {
+ ret += subString(walk); break;
+ }
+ ret += subString(walk,next-walk) + strNew;
+ walk = next + strOld.length();
+ }
+ return ret;
+}
+bool string::contains(char c) const {return indexOf(c) != ~0;}
+bool string::contains(stringp s) const {return indexOf(s) != ~0;}
+bool string::containsAnyChar(stringp s) const {return indexOfAnyChar(s) != ~0;}
+}
diff --git a/plugins/ListeningTo/src/players/foo_mlt/pfc/stringNew.h b/plugins/ListeningTo/src/players/foo_mlt/pfc/stringNew.h new file mode 100644 index 0000000000..121221e738 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/pfc/stringNew.h @@ -0,0 +1,249 @@ +namespace pfc {
+ //helper, const methods only
+ class __stringEmpty : public string_base {
+ public:
+ const char * get_ptr() const {return "";}
+ void add_string(const char * p_string,t_size p_length = ~0) {throw exception_not_implemented();}
+ void set_string(const char * p_string,t_size p_length = ~0) {throw exception_not_implemented();}
+ void truncate(t_size len) {throw exception_not_implemented();}
+ t_size get_length() const {return 0;}
+ char * lock_buffer(t_size p_requested_length) {throw exception_not_implemented();}
+ void unlock_buffer() {throw exception_not_implemented();}
+ };
+
+ class stringp;
+
+ //! New EXPERIMENTAL string class, allowing efficient copies and returning from functions. \n
+ //! Does not implement the string_base interface so you still need string8 in many cases. \n
+ //! Safe to pass between DLLs, but since a reference is used, objects possibly created by other DLLs must be released before owning DLLs are unloaded.
+ class string {
+ public:
+ typedef rcptr_t<string_base const> t_data;
+ typedef rcptr_t<pfc::string8> t_dataImpl;
+
+ string() : m_content(rcnew_t<__stringEmpty>()) {}
+ string(const char * p_source) : m_content(rcnew_t<string8>(p_source)) {}
+ string(const char * p_source, t_size p_sourceLen) : m_content(rcnew_t<pfc::string8>(p_source,p_sourceLen)) {}
+ string(char * p_source) : m_content(rcnew_t<string8>(p_source)) {}
+ string(char * p_source, t_size p_sourceLen) : m_content(rcnew_t<pfc::string8>(p_source,p_sourceLen)) {}
+ string(t_data const & p_source) : m_content(p_source) {}
+ string(string_part_ref source) : m_content(rcnew_t<pfc::string8>(source)) {}
+ template<typename TSource> string(const TSource & p_source);
+
+ string const & toString() const {return *this;}
+
+ //warning, not length-checked anymore!
+ static string g_concatenateRaw(const char * item1, t_size len1, const char * item2, t_size len2) {
+ t_dataImpl impl; impl.new_t();
+ char * buffer = impl->lock_buffer(len1+len2);
+ memcpy_t(buffer,item1,len1);
+ memcpy_t(buffer+len1,item2,len2);
+ impl->unlock_buffer();
+ return string(t_data(impl));
+ }
+
+ string operator+(const string& p_item2) const {
+ return g_concatenateRaw(ptr(),length(),p_item2.ptr(),p_item2.length());
+ }
+ string operator+(const char * p_item2) const {
+ return g_concatenateRaw(ptr(),length(),p_item2,strlen(p_item2));
+ }
+
+ template<typename TSource> string operator+(const TSource & p_item2) const;
+
+ template<typename TSource>
+ const string & operator+=(const TSource & p_item) {
+ *this = *this + p_item;
+ return *this;
+ }
+
+ string subString(t_size base) const {
+ if (base > length()) throw exception_overflow();
+ return string(ptr() + base);
+ }
+ string subString(t_size base, t_size count) const {
+ return string(ptr() + base,count);
+ }
+
+ string toLower() const {
+ pfc::string8_fastalloc temp; temp.prealloc(128);
+ stringToLowerAppend(temp,ptr(),~0);
+ return string(temp.get_ptr());
+ }
+ string toUpper() const {
+ pfc::string8_fastalloc temp; temp.prealloc(128);
+ stringToUpperAppend(temp,ptr(),~0);
+ return string(temp.get_ptr());
+ }
+
+ string clone() const {return string(ptr());}
+
+ //! @returns ~0 if not found.
+ t_size indexOf(char c,t_size base = 0) const;
+ //! @returns ~0 if not found.
+ t_size lastIndexOf(char c,t_size base = ~0) const;
+ //! @returns ~0 if not found.
+ t_size indexOf(stringp s,t_size base = 0) const;
+ //! @returns ~0 if not found.
+ t_size lastIndexOf(stringp s,t_size base = ~0) const;
+ //! @returns ~0 if not found.
+ t_size indexOfAnyChar(stringp s,t_size base = 0) const;
+ //! @returns ~0 if not found.
+ t_size lastIndexOfAnyChar(stringp s,t_size base = ~0) const;
+
+ bool contains(char c) const;
+ bool contains(stringp s) const;
+
+ bool containsAnyChar(stringp s) const;
+
+ bool startsWith(char c) const;
+ bool startsWith(string s) const;
+ bool endsWith(char c) const;
+ bool endsWith(string s) const;
+
+ char firstChar() const;
+ char lastChar() const;
+
+ string replace(stringp strOld, stringp strNew) const;
+
+ static int g_compare(const string & p_item1, const string & p_item2) {return strcmp(p_item1.ptr(),p_item2.ptr());}
+ bool operator==(const string& p_other) const {return g_compare(*this,p_other) == 0;}
+ bool operator!=(const string& p_other) const {return g_compare(*this,p_other) != 0;}
+ bool operator<(const string& p_other) const {return g_compare(*this,p_other) < 0;}
+ bool operator>(const string& p_other) const {return g_compare(*this,p_other) > 0;}
+ bool operator<=(const string& p_other) const {return g_compare(*this,p_other) <= 0;}
+ bool operator>=(const string& p_other) const {return g_compare(*this,p_other) >= 0;}
+
+ const char * ptr() const {return m_content->get_ptr();}
+ const char * get_ptr() const {return m_content->get_ptr();}
+ t_size length() const {return m_content->get_length();}
+ t_size get_length() const {return m_content->get_length();}
+
+ void set_string(const char * ptr, t_size len = ~0) {
+ *this = string(ptr, len);
+ }
+
+ static bool isNonTextChar(char c) {return c >= 0 && c < 32;}
+
+ char operator[](t_size p_index) const {
+ PFC_ASSERT(p_index <= length());
+ return ptr()[p_index];
+ }
+ bool isEmpty() const {return length() == 0;}
+
+ class _comparatorCommon {
+ protected:
+ template<typename T> static const char * myStringToPtr(const T& val) {return stringToPtr(val);}
+ static const char * myStringToPtr(string_part_ref) {
+ PFC_ASSERT(!"Should never get here"); throw pfc::exception_invalid_params();
+ }
+ };
+
+ class comparatorCaseSensitive : private _comparatorCommon {
+ public:
+ template<typename T1,typename T2>
+ static int compare(T1 const& v1, T2 const& v2) {
+ if (is_same_type<T1, string_part_ref>::value || is_same_type<T2, string_part_ref>::value) {
+ return compare_ex(stringToRef(v1), stringToRef(v2));
+ } else {
+ return strcmp(myStringToPtr(v1),myStringToPtr(v2));
+ }
+ }
+ static int compare_ex(string_part_ref v1, string_part_ref v2) {
+ return strcmp_ex(v1.m_ptr, v1.m_len, v2.m_ptr, v2.m_len);
+ }
+ static int compare_ex(const char * v1, t_size l1, const char * v2, t_size l2) {
+ return strcmp_ex(v1, l1, v2, l2);
+ }
+ };
+ class comparatorCaseInsensitive : private _comparatorCommon {
+ public:
+ template<typename T1,typename T2>
+ static int compare(T1 const& v1, T2 const& v2) {
+ if (is_same_type<T1, string_part_ref>::value || is_same_type<T2, string_part_ref>::value) {
+ return stringCompareCaseInsensitiveEx(stringToRef(v1), stringToRef(v2));
+ } else {
+ return stringCompareCaseInsensitive(myStringToPtr(v1),myStringToPtr(v2));
+ }
+ }
+ };
+ class comparatorCaseInsensitiveASCII : private _comparatorCommon {
+ public:
+ template<typename T1,typename T2>
+ static int compare(T1 const& v1, T2 const& v2) {
+ if (is_same_type<T1, string_part_ref>::value || is_same_type<T2, string_part_ref>::value) {
+ return compare_ex(stringToRef(v1), stringToRef(v2));
+ } else {
+ return stricmp_ascii(myStringToPtr(v1),myStringToPtr(v2));
+ }
+ }
+ static int compare_ex(string_part_ref v1, string_part_ref v2) {
+ return stricmp_ascii_ex(v1.m_ptr, v1.m_len, v2.m_ptr, v2.m_len);
+ }
+ static int compare_ex(const char * v1, t_size l1, const char * v2, t_size l2) {
+ return stricmp_ascii_ex(v1, l1, v2, l2);
+ }
+ };
+
+ static bool g_equals(const string & p_item1, const string & p_item2) {return p_item1 == p_item2;}
+ static bool g_equalsCaseInsensitive(const string & p_item1, const string & p_item2) {return comparatorCaseInsensitive::compare(p_item1,p_item2) == 0;}
+
+ t_data _content() const {return m_content;}
+ private:
+ t_data m_content;
+ };
+
+ template<typename T> inline string toString(T const& val) {return val.toString();}
+ template<> inline string toString(t_int64 const& val) {return format_int(val).get_ptr();}
+ template<> inline string toString(t_int32 const& val) {return format_int(val).get_ptr();}
+ template<> inline string toString(t_int16 const& val) {return format_int(val).get_ptr();}
+ template<> inline string toString(t_uint64 const& val) {return format_uint(val).get_ptr();}
+ template<> inline string toString(t_uint32 const& val) {return format_uint(val).get_ptr();}
+ template<> inline string toString(t_uint16 const& val) {return format_uint(val).get_ptr();}
+ template<> inline string toString(float const& val) {return format_float(val).get_ptr();}
+ template<> inline string toString(double const& val) {return format_float(val).get_ptr();}
+ template<> inline string toString(char const& val) {return string(&val,1);}
+ inline const char * toString(std::exception const& val) {return val.what();}
+
+ template<typename TSource> string::string(const TSource & p_source) {
+ *this = pfc::toString(p_source);
+ }
+ template<typename TSource> string string::operator+(const TSource & p_item2) const {
+ return *this + pfc::toString(p_item2);
+ }
+
+ //! "String parameter" helper class, to use in function parameters, allowing functions to take any type of string as a parameter (const char*, string_base, string).
+ class stringp {
+ public:
+ stringp(const char * ptr) : m_ptr(ptr) {}
+ stringp(pfc::string const &s) : m_ptr(s.ptr()), m_s(s._content()) {}
+ stringp(pfc::string_base const &s) : m_ptr(s.get_ptr()) {}
+ template<typename TWhat> stringp(const TWhat& in) : m_ptr(in.toString()) {}
+
+ operator const char*() const {return m_ptr;}
+ const char * ptr() const {return m_ptr;}
+ const char * get_ptr() const {return m_ptr;}
+ pfc::string str() const {return m_s.is_valid() ? pfc::string(m_s) : pfc::string(m_ptr);}
+ operator pfc::string() const {return str();}
+ pfc::string toString() const {return str();}
+ t_size length() const {return m_s.is_valid() ? m_s->length() : strlen(m_ptr);}
+ private:
+ const char * const m_ptr;
+ pfc::string::t_data m_s;
+ };
+
+ template<typename TList>
+ string stringCombineList(const TList & list, stringp separator) {
+ typename TList::const_iterator iter = list.first();
+ string acc;
+ if (iter.is_valid()) {
+ acc = *iter;
+ for (++iter; iter.is_valid(); ++iter) {
+ acc = acc + separator + *iter;
+ }
+ }
+ return acc;
+ }
+
+ template<> class traits_t<string> : public traits_t<string::t_data> {};
+}
diff --git a/plugins/ListeningTo/src/players/foo_mlt/pfc/string_conv.cpp b/plugins/ListeningTo/src/players/foo_mlt/pfc/string_conv.cpp new file mode 100644 index 0000000000..52280337c6 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/pfc/string_conv.cpp @@ -0,0 +1,216 @@ +#include "pfc.h"
+
+
+#ifdef _WINDOWS
+
+namespace {
+ template<typename t_char, bool isChecked = true>
+ class string_writer_t {
+ public:
+ string_writer_t(t_char * p_buffer,t_size p_size) : m_buffer(p_buffer), m_size(p_size), m_writeptr(0) {}
+
+ void write(t_char p_char) {
+ if (isChecked) {
+ if (m_writeptr < m_size) {
+ m_buffer[m_writeptr++] = p_char;
+ }
+ } else {
+ m_buffer[m_writeptr++] = p_char;
+ }
+ }
+ void write_multi(const t_char * p_buffer,t_size p_count) {
+ if (isChecked) {
+ const t_size delta = pfc::min_t<t_size>(p_count,m_size-m_writeptr);
+ for(t_size n=0;n<delta;n++) {
+ m_buffer[m_writeptr++] = p_buffer[n];
+ }
+ } else {
+ for(t_size n = 0; n < p_count; ++n) {
+ m_buffer[m_writeptr++] = p_buffer[n];
+ }
+ }
+ }
+
+ void write_as_utf8(unsigned p_char) {
+ if (isChecked) {
+ char temp[6];
+ t_size n = pfc::utf8_encode_char(p_char,temp);
+ write_multi(temp,n);
+ } else {
+ m_writeptr += pfc::utf8_encode_char(p_char, m_buffer + m_writeptr);
+ }
+ }
+
+ void write_as_wide(unsigned p_char) {
+ if (isChecked) {
+ wchar_t temp[2];
+ t_size n = pfc::utf16_encode_char(p_char,temp);
+ write_multi(temp,n);
+ } else {
+ m_writeptr += pfc::utf16_encode_char(p_char, m_buffer + m_writeptr);
+ }
+ }
+
+ t_size finalize() {
+ if (isChecked) {
+ if (m_size == 0) return 0;
+ t_size terminator = pfc::min_t<t_size>(m_writeptr,m_size-1);
+ m_buffer[terminator] = 0;
+ return terminator;
+ } else {
+ m_buffer[m_writeptr] = 0;
+ return m_writeptr;
+ }
+ }
+ bool is_overrun() const {
+ return m_writeptr >= m_size;
+ }
+ private:
+ t_char * m_buffer;
+ t_size m_size;
+ t_size m_writeptr;
+ };
+
+
+
+};
+
+namespace pfc {
+ namespace stringcvt {
+
+
+ t_size convert_utf8_to_wide(wchar_t * p_out,t_size p_out_size,const char * p_in,t_size p_in_size) {
+ const t_size insize = p_in_size;
+ t_size inptr = 0;
+ string_writer_t<wchar_t> writer(p_out,p_out_size);
+
+ while(inptr < insize && !writer.is_overrun()) {
+ unsigned newchar = 0;
+ t_size delta = utf8_decode_char(p_in + inptr,newchar,insize - inptr);
+ if (delta == 0 || newchar == 0) break;
+ PFC_ASSERT(inptr + delta <= insize);
+ inptr += delta;
+ writer.write_as_wide(newchar);
+ }
+
+ return writer.finalize();
+ }
+
+ t_size convert_utf8_to_wide_unchecked(wchar_t * p_out,const char * p_in) {
+ t_size inptr = 0;
+ string_writer_t<wchar_t,false> writer(p_out,~0);
+
+ while(!writer.is_overrun()) {
+ unsigned newchar = 0;
+ t_size delta = utf8_decode_char(p_in + inptr,newchar);
+ if (delta == 0 || newchar == 0) break;
+ inptr += delta;
+ writer.write_as_wide(newchar);
+ }
+
+ return writer.finalize();
+ }
+
+ t_size convert_wide_to_utf8(char * p_out,t_size p_out_size,const wchar_t * p_in,t_size p_in_size) {
+ const t_size insize = p_in_size;
+ t_size inptr = 0;
+ string_writer_t<char> writer(p_out,p_out_size);
+
+ while(inptr < insize && !writer.is_overrun()) {
+ unsigned newchar = 0;
+ t_size delta = utf16_decode_char(p_in + inptr,&newchar,insize - inptr);
+ if (delta == 0 || newchar == 0) break;
+ PFC_ASSERT(inptr + delta <= insize);
+ inptr += delta;
+ writer.write_as_utf8(newchar);
+ }
+
+ return writer.finalize();
+ }
+
+ t_size estimate_utf8_to_wide(const char * p_in) {
+ t_size inptr = 0;
+ t_size retval = 1;//1 for null terminator
+ for (;;) {
+ unsigned newchar = 0;
+ t_size delta = utf8_decode_char(p_in + inptr,newchar);
+ if (delta == 0 || newchar == 0) break;
+ inptr += delta;
+
+ {
+ wchar_t temp[2];
+ retval += utf16_encode_char(newchar,temp);
+ }
+ }
+ return retval;
+ }
+
+ t_size estimate_utf8_to_wide(const char * p_in,t_size p_in_size) {
+ const t_size insize = p_in_size;
+ t_size inptr = 0;
+ t_size retval = 1;//1 for null terminator
+ while(inptr < insize) {
+ unsigned newchar = 0;
+ t_size delta = utf8_decode_char(p_in + inptr,newchar,insize - inptr);
+ if (delta == 0 || newchar == 0) break;
+ PFC_ASSERT(inptr + delta <= insize);
+ inptr += delta;
+
+ {
+ wchar_t temp[2];
+ retval += utf16_encode_char(newchar,temp);
+ }
+ }
+ return retval;
+ }
+
+ t_size estimate_wide_to_utf8(const wchar_t * p_in,t_size p_in_size) {
+ const t_size insize = p_in_size;
+ t_size inptr = 0;
+ t_size retval = 1;//1 for null terminator
+ while(inptr < insize) {
+ unsigned newchar = 0;
+ t_size delta = utf16_decode_char(p_in + inptr,&newchar,insize - inptr);
+ if (delta == 0 || newchar == 0) break;
+ PFC_ASSERT(inptr + delta <= insize);
+ inptr += delta;
+
+ {
+ char temp[6];
+ delta = utf8_encode_char(newchar,temp);
+ if (delta == 0) break;
+ retval += delta;
+ }
+ }
+ return retval;
+ }
+
+
+ t_size convert_codepage_to_wide(unsigned p_codepage,wchar_t * p_out,t_size p_out_size,const char * p_source,t_size p_source_size) {
+ if (p_out_size == 0) return 0;
+ memset(p_out,0,p_out_size * sizeof(*p_out));
+ MultiByteToWideChar(p_codepage,0,p_source,p_source_size,p_out,p_out_size);
+ p_out[p_out_size-1] = 0;
+ return wcslen(p_out);
+ }
+
+ t_size convert_wide_to_codepage(unsigned p_codepage,char * p_out,t_size p_out_size,const wchar_t * p_source,t_size p_source_size) {
+ if (p_out_size == 0) return 0;
+ memset(p_out,0,p_out_size * sizeof(*p_out));
+ WideCharToMultiByte(p_codepage,0,p_source,p_source_size,p_out,p_out_size,0,FALSE);
+ p_out[p_out_size-1] = 0;
+ return strlen(p_out);
+ }
+
+ t_size estimate_codepage_to_wide(unsigned p_codepage,const char * p_source,t_size p_source_size) {
+ return MultiByteToWideChar(p_codepage,0,p_source,strlen_max(p_source,p_source_size),0,0) + 1;
+ }
+ t_size estimate_wide_to_codepage(unsigned p_codepage,const wchar_t * p_source,t_size p_source_size) {
+ return WideCharToMultiByte(p_codepage,0,p_source,wcslen_max(p_source,p_source_size),0,0,0,FALSE) + 1;
+ }
+ }
+
+}
+
+#endif //_WINDOWS
+
diff --git a/plugins/ListeningTo/src/players/foo_mlt/pfc/string_conv.h b/plugins/ListeningTo/src/players/foo_mlt/pfc/string_conv.h new file mode 100644 index 0000000000..21a31e1731 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/pfc/string_conv.h @@ -0,0 +1,410 @@ +namespace pfc {
+
+ namespace stringcvt {
+
+#ifdef _WINDOWS
+ enum {
+ codepage_system = CP_ACP,
+ codepage_ascii = 20127,
+ codepage_iso_8859_1 = 28591,
+ };
+
+ //! Converts UTF-8 characters to wide character.
+ //! @param p_out Output buffer, receives converted string, with null terminator.
+ //! @param p_out_size Size of output buffer, in characters. If converted string is too long, it will be truncated. Null terminator is always written, unless p_out_size is zero.
+ //! @param p_source String to convert.
+ //! @param p_source_size Number of characters to read from p_source. If reading stops if null terminator is encountered earlier.
+ //! @returns Number of characters written, not counting null terminator.
+ t_size convert_utf8_to_wide(wchar_t * p_out,t_size p_out_size,const char * p_source,t_size p_source_size);
+
+
+ //! Estimates buffer size required to convert specified UTF-8 string to widechar.
+ //! @param p_source String to be converted.
+ //! @param p_source_size Number of characters to read from p_source. If reading stops if null terminator is encountered earlier.
+ //! @returns Number of characters to allocate, including space for null terminator.
+ t_size estimate_utf8_to_wide(const char * p_source,t_size p_source_size);
+
+ t_size estimate_utf8_to_wide(const char * p_source);
+
+ //! Converts wide character string to UTF-8.
+ //! @param p_out Output buffer, receives converted string, with null terminator.
+ //! @param p_out_size Size of output buffer, in characters. If converted string is too long, it will be truncated. Null terminator is always written, unless p_out_size is zero.
+ //! @param p_source String to convert.
+ //! @param p_source_size Number of characters to read from p_source. If reading stops if null terminator is encountered earlier.
+ //! @returns Number of characters written, not counting null terminator.
+ t_size convert_wide_to_utf8(char * p_out,t_size p_out_size,const wchar_t * p_source,t_size p_source_size);
+
+ //! Estimates buffer size required to convert specified wide character string to UTF-8.
+ //! @param p_source String to be converted.
+ //! @param p_source_size Number of characters to read from p_source. If reading stops if null terminator is encountered earlier.
+ //! @returns Number of characters to allocate, including space for null terminator.
+ t_size estimate_wide_to_utf8(const wchar_t * p_source,t_size p_source_size);
+
+
+
+ //! Converts string from specified codepage to wide character.
+ //! @param p_out Output buffer, receives converted string, with null terminator.
+ //! @param p_codepage Codepage ID of source string.
+ //! @param p_source String to convert.
+ //! @param p_source_size Number of characters to read from p_source. If reading stops if null terminator is encountered earlier.
+ //! @param p_out_size Size of output buffer, in characters. If converted string is too long, it will be truncated. Null terminator is always written, unless p_out_size is zero.
+ //! @returns Number of characters written, not counting null terminator.
+ t_size convert_codepage_to_wide(unsigned p_codepage,wchar_t * p_out,t_size p_out_size,const char * p_source,t_size p_source_size);
+
+ //! Estimates buffer size required to convert specified string from specified codepage to wide character.
+ //! @param p_codepage Codepage ID of source string.
+ //! @param p_source String to be converted.
+ //! @param p_source_size Number of characters to read from p_source. If reading stops if null terminator is encountered earlier.
+ //! @returns Number of characters to allocate, including space for null terminator.
+ t_size estimate_codepage_to_wide(unsigned p_codepage,const char * p_source,t_size p_source_size);
+
+ //! Converts string from wide character to specified codepage.
+ //! @param p_codepage Codepage ID of source string.
+ //! @param p_out Output buffer, receives converted string, with null terminator.
+ //! @param p_out_size Size of output buffer, in characters. If converted string is too long, it will be truncated. Null terminator is always written, unless p_out_size is zero.
+ //! @param p_source String to convert.
+ //! @param p_source_size Number of characters to read from p_source. If reading stops if null terminator is encountered earlier.
+ //! @returns Number of characters written, not counting null terminator.
+ t_size convert_wide_to_codepage(unsigned p_codepage,char * p_out,t_size p_out_size,const wchar_t * p_source,t_size p_source_size);
+
+ //! Estimates buffer size required to convert specified wide character string to specified codepage.
+ //! @param p_codepage Codepage ID of source string.
+ //! @param p_source String to be converted.
+ //! @param p_source_size Number of characters to read from p_source. If reading stops if null terminator is encountered earlier.
+ //! @returns Number of characters to allocate, including space for null terminator.
+ t_size estimate_wide_to_codepage(unsigned p_codepage,const wchar_t * p_source,t_size p_source_size);
+
+
+ //! Converts string from system codepage to wide character.
+ //! @param p_out Output buffer, receives converted string, with null terminator.
+ //! @param p_source String to convert.
+ //! @param p_source_size Number of characters to read from p_source. If reading stops if null terminator is encountered earlier.
+ //! @param p_out_size Size of output buffer, in characters. If converted string is too long, it will be truncated. Null terminator is always written, unless p_out_size is zero.
+ //! @returns Number of characters written, not counting null terminator.
+ inline t_size convert_ansi_to_wide(wchar_t * p_out,t_size p_out_size,const char * p_source,t_size p_source_size) {
+ return convert_codepage_to_wide(codepage_system,p_out,p_out_size,p_source,p_source_size);
+ }
+
+ //! Estimates buffer size required to convert specified system codepage string to wide character.
+ //! @param p_source String to be converted.
+ //! @param p_source_size Number of characters to read from p_source. If reading stops if null terminator is encountered earlier.
+ //! @returns Number of characters to allocate, including space for null terminator.
+ inline t_size estimate_ansi_to_wide(const char * p_source,t_size p_source_size) {
+ return estimate_codepage_to_wide(codepage_system,p_source,p_source_size);
+ }
+
+ //! Converts string from wide character to system codepage.
+ //! @param p_out Output buffer, receives converted string, with null terminator.
+ //! @param p_out_size Size of output buffer, in characters. If converted string is too long, it will be truncated. Null terminator is always written, unless p_out_size is zero.
+ //! @param p_source String to convert.
+ //! @param p_source_size Number of characters to read from p_source. If reading stops if null terminator is encountered earlier.
+ //! @returns Number of characters written, not counting null terminator.
+ inline t_size convert_wide_to_ansi(char * p_out,t_size p_out_size,const wchar_t * p_source,t_size p_source_size) {
+ return convert_wide_to_codepage(codepage_system,p_out,p_out_size,p_source,p_source_size);
+ }
+
+ //! Estimates buffer size required to convert specified wide character string to system codepage.
+ //! @param p_source String to be converted.
+ //! @param p_source_size Number of characters to read from p_source. If reading stops if null terminator is encountered earlier.
+ //! @returns Number of characters to allocate, including space for null terminator.
+ inline t_size estimate_wide_to_ansi(const wchar_t * p_source,t_size p_source_size) {
+ return estimate_wide_to_codepage(codepage_system,p_source,p_source_size);
+ }
+
+
+ //! estimate_utf8_to_wide_quick() functions use simple math to determine buffer size required for the conversion. The result is not accurate length of output string - it's just a safe estimate of required buffer size, possibly bigger than what's really needed. \n
+ //! These functions are meant for scenarios when speed is more important than memory usage.
+ inline t_size estimate_utf8_to_wide_quick(t_size sourceLen) {
+ return sourceLen + 1;
+ }
+ inline t_size estimate_utf8_to_wide_quick(const char * source) {
+ return estimate_utf8_to_wide_quick(strlen(source));
+ }
+ inline t_size estimate_utf8_to_wide_quick(const char * source, t_size sourceLen) {
+ return estimate_utf8_to_wide_quick(strlen_max(source, sourceLen));
+ }
+ t_size convert_utf8_to_wide_unchecked(wchar_t * p_out,const char * p_source);
+
+ template<typename t_char> const t_char * null_string_t();
+ template<> inline const char * null_string_t<char>() {return "";}
+ template<> inline const wchar_t * null_string_t<wchar_t>() {return L"";}
+
+ template<typename t_char> t_size strlen_t(const t_char * p_string,t_size p_string_size = ~0) {
+ for(t_size n=0;n<p_string_size;n++) {
+ if (p_string[n] == 0) return n;
+ }
+ return p_string_size;
+ }
+
+ template<typename t_char> bool string_is_empty_t(const t_char * p_string,t_size p_string_size = ~0) {
+ if (p_string_size == 0) return true;
+ return p_string[0] == 0;
+ }
+
+ template<typename t_char,template<typename t_allocitem> class t_alloc = pfc::alloc_standard> class char_buffer_t {
+ public:
+ char_buffer_t() {}
+ char_buffer_t(const char_buffer_t & p_source) : m_buffer(p_source.m_buffer) {}
+ void set_size(t_size p_count) {m_buffer.set_size(p_count);}
+ t_char * get_ptr_var() {return m_buffer.get_ptr();}
+ const t_char * get_ptr() const {
+ return m_buffer.get_size() > 0 ? m_buffer.get_ptr() : null_string_t<t_char>();
+ }
+ private:
+ pfc::array_t<t_char,t_alloc> m_buffer;
+ };
+
+ template<template<typename t_allocitem> class t_alloc = pfc::alloc_standard>
+ class string_utf8_from_wide_t {
+ public:
+ string_utf8_from_wide_t() {}
+ string_utf8_from_wide_t(const wchar_t * p_source,t_size p_source_size = ~0) {convert(p_source,p_source_size);}
+
+ void convert(const wchar_t * p_source,t_size p_source_size = ~0) {
+ t_size size = estimate_wide_to_utf8(p_source,p_source_size);
+ m_buffer.set_size(size);
+ convert_wide_to_utf8( m_buffer.get_ptr_var(),size,p_source,p_source_size);
+ }
+
+ operator const char * () const {return get_ptr();}
+ const char * get_ptr() const {return m_buffer.get_ptr();}
+ const char * toString() const {return get_ptr();}
+ bool is_empty() const {return string_is_empty_t(get_ptr());}
+ t_size length() const {return strlen_t(get_ptr());}
+
+ private:
+ char_buffer_t<char,t_alloc> m_buffer;
+ };
+ typedef string_utf8_from_wide_t<> string_utf8_from_wide;
+
+ template<template<typename t_allocitem> class t_alloc = pfc::alloc_standard>
+ class string_wide_from_utf8_t {
+ public:
+ string_wide_from_utf8_t() {}
+ string_wide_from_utf8_t(const char* p_source) {convert(p_source);}
+ string_wide_from_utf8_t(const char* p_source,t_size p_source_size) {convert(p_source,p_source_size);}
+
+ void convert(const char* p_source,t_size p_source_size) {
+ const t_size size = estimate_size(p_source, p_source_size);
+ m_buffer.set_size(size);
+ convert_utf8_to_wide( m_buffer.get_ptr_var(),size,p_source,p_source_size );
+ }
+ void convert(const char * p_source) {
+ m_buffer.set_size( estimate_size(p_source) );
+ convert_utf8_to_wide_unchecked(m_buffer.get_ptr_var(), p_source);
+ }
+
+ operator const wchar_t * () const {return get_ptr();}
+ const wchar_t * get_ptr() const {return m_buffer.get_ptr();}
+ bool is_empty() const {return string_is_empty_t(get_ptr());}
+ t_size length() const {return strlen_t(get_ptr());}
+
+ enum { alloc_prioritizes_speed = t_alloc<wchar_t>::alloc_prioritizes_speed };
+ private:
+
+ inline t_size estimate_size(const char * source, t_size sourceLen) {
+ return alloc_prioritizes_speed ? estimate_utf8_to_wide_quick(source, sourceLen) : estimate_utf8_to_wide(source,sourceLen);
+ }
+ inline t_size estimate_size(const char * source) {
+ return alloc_prioritizes_speed ? estimate_utf8_to_wide_quick(source) : estimate_utf8_to_wide(source,~0);
+ }
+ char_buffer_t<wchar_t,t_alloc> m_buffer;
+ };
+ typedef string_wide_from_utf8_t<> string_wide_from_utf8;
+ typedef string_wide_from_utf8_t<alloc_fast_aggressive> string_wide_from_utf8_fast;
+
+ template<template<typename t_allocitem> class t_alloc = pfc::alloc_standard>
+ class string_wide_from_codepage_t {
+ public:
+ string_wide_from_codepage_t() {}
+ string_wide_from_codepage_t(const string_wide_from_codepage_t<t_alloc> & p_source) : m_buffer(p_source.m_buffer) {}
+ string_wide_from_codepage_t(unsigned p_codepage,const char * p_source,t_size p_source_size = ~0) {convert(p_codepage,p_source,p_source_size);}
+
+ void convert(unsigned p_codepage,const char * p_source,t_size p_source_size = ~0) {
+ t_size size = estimate_codepage_to_wide(p_codepage,p_source,p_source_size);
+ m_buffer.set_size(size);
+ convert_codepage_to_wide(p_codepage, m_buffer.get_ptr_var(),size,p_source,p_source_size);
+ }
+
+ operator const wchar_t * () const {return get_ptr();}
+ const wchar_t * get_ptr() const {return m_buffer.get_ptr();}
+ bool is_empty() const {return string_is_empty_t(get_ptr());}
+ t_size length() const {return strlen_t(get_ptr());}
+
+ private:
+ char_buffer_t<wchar_t,t_alloc> m_buffer;
+ };
+ typedef string_wide_from_codepage_t<> string_wide_from_codepage;
+
+
+ template<template<typename t_allocitem> class t_alloc = pfc::alloc_standard>
+ class string_codepage_from_wide_t {
+ public:
+ string_codepage_from_wide_t() {}
+ string_codepage_from_wide_t(const string_codepage_from_wide_t<t_alloc> & p_source) : m_buffer(p_source.m_buffer) {}
+ string_codepage_from_wide_t(unsigned p_codepage,const wchar_t * p_source,t_size p_source_size = ~0) {convert(p_codepage,p_source,p_source_size);}
+
+ void convert(unsigned p_codepage,const wchar_t * p_source,t_size p_source_size = ~0) {
+ t_size size = estimate_wide_to_codepage(p_codepage,p_source,p_source_size);
+ m_buffer.set_size(size);
+ convert_wide_to_codepage(p_codepage, m_buffer.get_ptr_var(),size,p_source,p_source_size);
+ }
+
+ operator const char * () const {return get_ptr();}
+ const char * get_ptr() const {return m_buffer.get_ptr();}
+ bool is_empty() const {return string_is_empty_t(get_ptr());}
+ t_size length() const {return strlen_t(get_ptr());}
+
+ private:
+ char_buffer_t<char,t_alloc> m_buffer;
+ };
+ typedef string_codepage_from_wide_t<> string_codepage_from_wide;
+
+ class string_codepage_from_utf8 {
+ public:
+ string_codepage_from_utf8() {}
+ string_codepage_from_utf8(const string_codepage_from_utf8 & p_source) : m_buffer(p_source.m_buffer) {}
+ string_codepage_from_utf8(unsigned p_codepage,const char * p_source,t_size p_source_size = ~0) {convert(p_codepage,p_source,p_source_size);}
+
+ void convert(unsigned p_codepage,const char * p_source,t_size p_source_size = ~0) {
+ string_wide_from_utf8 temp;
+ temp.convert(p_source,p_source_size);
+ t_size size = estimate_wide_to_codepage(p_codepage,temp,~0);
+ m_buffer.set_size(size);
+ convert_wide_to_codepage(p_codepage,m_buffer.get_ptr_var(),size,temp,~0);
+ }
+
+ operator const char * () const {return get_ptr();}
+ const char * get_ptr() const {return m_buffer.get_ptr();}
+ bool is_empty() const {return string_is_empty_t(get_ptr());}
+ t_size length() const {return strlen_t(get_ptr());}
+
+ private:
+ char_buffer_t<char> m_buffer;
+ };
+
+ class string_utf8_from_codepage {
+ public:
+ string_utf8_from_codepage() {}
+ string_utf8_from_codepage(const string_utf8_from_codepage & p_source) : m_buffer(p_source.m_buffer) {}
+ string_utf8_from_codepage(unsigned p_codepage,const char * p_source,t_size p_source_size = ~0) {convert(p_codepage,p_source,p_source_size);}
+
+ void convert(unsigned p_codepage,const char * p_source,t_size p_source_size = ~0) {
+ string_wide_from_codepage temp;
+ temp.convert(p_codepage,p_source,p_source_size);
+ t_size size = estimate_wide_to_utf8(temp,~0);
+ m_buffer.set_size(size);
+ convert_wide_to_utf8( m_buffer.get_ptr_var(),size,temp,~0);
+ }
+
+ operator const char * () const {return get_ptr();}
+ const char * get_ptr() const {return m_buffer.get_ptr();}
+ bool is_empty() const {return string_is_empty_t(get_ptr());}
+ t_size length() const {return strlen_t(get_ptr());}
+
+ private:
+ char_buffer_t<char> m_buffer;
+ };
+
+
+ class string_utf8_from_ansi {
+ public:
+ string_utf8_from_ansi() {}
+ string_utf8_from_ansi(const string_utf8_from_ansi & p_source) : m_buffer(p_source.m_buffer) {}
+ string_utf8_from_ansi(const char * p_source,t_size p_source_size = ~0) : m_buffer(codepage_system,p_source,p_source_size) {}
+ operator const char * () const {return get_ptr();}
+ const char * get_ptr() const {return m_buffer.get_ptr();}
+ const char * toString() const {return get_ptr();}
+ bool is_empty() const {return string_is_empty_t(get_ptr());}
+ t_size length() const {return strlen_t(get_ptr());}
+ void convert(const char * p_source,t_size p_source_size = ~0) {m_buffer.convert(codepage_system,p_source,p_source_size);}
+
+ private:
+ string_utf8_from_codepage m_buffer;
+ };
+
+ class string_ansi_from_utf8 {
+ public:
+ string_ansi_from_utf8() {}
+ string_ansi_from_utf8(const string_ansi_from_utf8 & p_source) : m_buffer(p_source.m_buffer) {}
+ string_ansi_from_utf8(const char * p_source,t_size p_source_size = ~0) : m_buffer(codepage_system,p_source,p_source_size) {}
+ operator const char * () const {return get_ptr();}
+ const char * get_ptr() const {return m_buffer.get_ptr();}
+ bool is_empty() const {return string_is_empty_t(get_ptr());}
+ t_size length() const {return strlen_t(get_ptr());}
+
+ void convert(const char * p_source,t_size p_source_size = ~0) {m_buffer.convert(codepage_system,p_source,p_source_size);}
+
+ private:
+ string_codepage_from_utf8 m_buffer;
+ };
+
+ class string_wide_from_ansi {
+ public:
+ string_wide_from_ansi() {}
+ string_wide_from_ansi(const string_wide_from_ansi & p_source) : m_buffer(p_source.m_buffer) {}
+ string_wide_from_ansi(const char * p_source,t_size p_source_size = ~0) : m_buffer(codepage_system,p_source,p_source_size) {}
+ operator const wchar_t * () const {return get_ptr();}
+ const wchar_t * get_ptr() const {return m_buffer.get_ptr();}
+ bool is_empty() const {return string_is_empty_t(get_ptr());}
+ t_size length() const {return strlen_t(get_ptr());}
+
+ void convert(const char * p_source,t_size p_source_size = ~0) {m_buffer.convert(codepage_system,p_source,p_source_size);}
+
+ private:
+ string_wide_from_codepage m_buffer;
+ };
+
+ class string_ansi_from_wide {
+ public:
+ string_ansi_from_wide() {}
+ string_ansi_from_wide(const string_ansi_from_wide & p_source) : m_buffer(p_source.m_buffer) {}
+ string_ansi_from_wide(const wchar_t * p_source,t_size p_source_size = ~0) : m_buffer(codepage_system,p_source,p_source_size) {}
+ operator const char * () const {return get_ptr();}
+ const char * get_ptr() const {return m_buffer.get_ptr();}
+ bool is_empty() const {return string_is_empty_t(get_ptr());}
+ t_size length() const {return strlen_t(get_ptr());}
+
+ void convert(const wchar_t * p_source,t_size p_source_size = ~0) {m_buffer.convert(codepage_system,p_source,p_source_size);}
+
+ private:
+ string_codepage_from_wide m_buffer;
+ };
+
+#ifdef UNICODE
+ typedef string_wide_from_utf8 string_os_from_utf8;
+ typedef string_utf8_from_wide string_utf8_from_os;
+ typedef string_wide_from_utf8_fast string_os_from_utf8_fast;
+#else
+ typedef string_ansi_from_utf8 string_os_from_utf8;
+ typedef string_utf8_from_ansi string_utf8_from_os;
+ typedef string_ansi_from_utf8 string_os_from_utf8_fast;
+#endif
+
+ class string_utf8_from_os_ex {
+ public:
+ template<typename t_source> string_utf8_from_os_ex(const t_source * source, t_size sourceLen = ~0) {
+ convert(source,sourceLen);
+ }
+
+ void convert(const char * source, t_size sourceLen = ~0) {
+ m_buffer = string_utf8_from_ansi(source,sourceLen);
+ }
+ void convert(const wchar_t * source, t_size sourceLen = ~0) {
+ m_buffer = string_utf8_from_wide(source,sourceLen);
+ }
+
+ operator const char * () const {return get_ptr();}
+ const char * get_ptr() const {return m_buffer.get_ptr();}
+ bool is_empty() const {return m_buffer.is_empty();}
+ t_size length() const {return m_buffer.length();}
+ const char * toString() const {return get_ptr();}
+ private:
+ string8 m_buffer;
+ };
+ }
+
+#else
+//PORTME
+#endif
+};
diff --git a/plugins/ListeningTo/src/players/foo_mlt/pfc/string_list.h b/plugins/ListeningTo/src/players/foo_mlt/pfc/string_list.h new file mode 100644 index 0000000000..cb5b700abb --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/pfc/string_list.h @@ -0,0 +1,44 @@ +#ifndef _PFC_STRING_LIST_H_
+#define _PFC_STRING_LIST_H_
+
+namespace pfc {
+
+ typedef list_base_const_t<const char*> string_list_const;
+
+ class string_list_impl : public string_list_const
+ {
+ public:
+ t_size get_count() const {return m_data.get_size();}
+ void get_item_ex(const char* & p_out, t_size n) const {p_out = m_data[n];}
+
+ const char * operator[] (t_size n) const {return m_data[n];}
+ void add_item(const char * p_string) {pfc::append_t(m_data, p_string);}
+
+ template<typename t_what> void add_items(const t_what & p_source) {_append(p_source);}
+
+ void remove_all() {m_data.set_size(0);}
+
+ string_list_impl() {}
+ template<typename t_what> string_list_impl(const t_what & p_source) {_copy(p_source);}
+ template<typename t_what> string_list_impl & operator=(const t_what & p_source) {_copy(p_source); return *this;}
+ template<typename t_what> string_list_impl & operator|=(const string_list_impl & p_source) {_append(p_source); return *this;}
+ template<typename t_what> string_list_impl & operator+=(const t_what & p_source) {pfc::append_t(m_data, p_source); return *this;}
+
+ private:
+ template<typename t_what> void _append(const t_what & p_source) {
+ const t_size toadd = p_source.get_size(), base = m_data.get_size();
+ m_data.set_size(base+toadd);
+ for(t_size n=0;n<toadd;n++) m_data[base+n] = p_source[n];
+ }
+
+ template<typename t_what> void _copy(const t_what & p_source) {
+ const t_size newcount = p_source.get_size();
+ m_data.set_size(newcount);
+ for(t_size n=0;n<newcount;n++) m_data[n] = p_source[n];
+ }
+
+ pfc::array_t<pfc::string8,pfc::alloc_fast> m_data;
+ };
+}
+
+#endif //_PFC_STRING_LIST_H_
diff --git a/plugins/ListeningTo/src/players/foo_mlt/pfc/threads.cpp b/plugins/ListeningTo/src/players/foo_mlt/pfc/threads.cpp new file mode 100644 index 0000000000..71f7f27e1f --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/pfc/threads.cpp @@ -0,0 +1,23 @@ +#include "pfc.h"
+
+namespace pfc {
+ t_size getOptimalWorkerThreadCount() {
+#ifdef _WINDOWS
+ DWORD_PTR mask,system;
+ t_size ret = 0;
+ GetProcessAffinityMask(GetCurrentProcess(),&mask,&system);
+ for(t_size n=0;n<sizeof(mask)*8;n++) {
+ if (mask & ((DWORD_PTR)1<<n)) ret++;
+ }
+ if (ret == 0) return 1;
+ return ret;
+ }
+#else
+#error PORTME
+#endif
+
+ t_size getOptimalWorkerThreadCountEx(t_size taskCountLimit) {
+ if (taskCountLimit <= 1) return 1;
+ return pfc::min_t(taskCountLimit,getOptimalWorkerThreadCount());
+ }
+}
\ No newline at end of file diff --git a/plugins/ListeningTo/src/players/foo_mlt/pfc/threads.h b/plugins/ListeningTo/src/players/foo_mlt/pfc/threads.h new file mode 100644 index 0000000000..e71b61f94b --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/pfc/threads.h @@ -0,0 +1,70 @@ +namespace pfc {
+ t_size getOptimalWorkerThreadCount();
+ t_size getOptimalWorkerThreadCountEx(t_size taskCountLimit);
+
+#ifdef _WINDOWS
+ //! IMPORTANT: all classes derived from thread must call waitTillDone() in their destructor, to avoid object destruction during a virtual function call!
+ class thread {
+ public:
+ PFC_DECLARE_EXCEPTION(exception_creation, exception, "Could not create thread");
+ thread() : m_thread(INVALID_HANDLE_VALUE) {}
+ ~thread() {PFC_ASSERT(!isActive()); waitTillDone();}
+ void startWithPriority(int priority) {
+ close();
+ HANDLE thread;
+ thread = CreateThread(NULL,0,g_entry,reinterpret_cast<void*>(this),CREATE_SUSPENDED,NULL);
+ if (thread == NULL) throw exception_creation();
+ SetThreadPriority(thread, priority);
+ ResumeThread(thread);
+ m_thread = thread;
+ }
+ void setPriority(int priority) {
+ PFC_ASSERT(isActive());
+ SetThreadPriority(m_thread, priority);
+ }
+ void start() {
+ close();
+ HANDLE thread;
+ const int priority = GetThreadPriority(GetCurrentThread());
+ const bool overridePriority = (priority != THREAD_PRIORITY_NORMAL);
+ thread = CreateThread(NULL,0,g_entry,reinterpret_cast<void*>(this),overridePriority ? CREATE_SUSPENDED : 0,NULL);
+ if (thread == NULL) throw exception_creation();
+ if (overridePriority) {
+ SetThreadPriority(thread, priority);
+ ResumeThread(thread);
+ }
+ m_thread = thread;
+ }
+ bool isActive() const {
+ return m_thread != INVALID_HANDLE_VALUE;
+ }
+ void waitTillDone() {
+ close();
+ }
+ protected:
+ virtual void threadProc() {PFC_ASSERT(!"Stub thread entry - should not get here");}
+ private:
+ void close() {
+ if (isActive()) {
+ WaitForSingleObject(m_thread,INFINITE);
+ CloseHandle(m_thread); m_thread = INVALID_HANDLE_VALUE;
+ }
+ }
+
+ static DWORD CALLBACK g_entry(void* p_instance) {
+ return reinterpret_cast<thread*>(p_instance)->entry();
+ }
+ unsigned entry() {
+ try {
+ threadProc();
+ } catch(...) {}
+ return 0;
+ }
+ HANDLE m_thread;
+
+ PFC_CLASS_NOT_COPYABLE_EX(thread)
+ };
+#else
+#error PORTME
+#endif
+}
diff --git a/plugins/ListeningTo/src/players/foo_mlt/pfc/traits.h b/plugins/ListeningTo/src/players/foo_mlt/pfc/traits.h new file mode 100644 index 0000000000..0110eb5140 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/pfc/traits.h @@ -0,0 +1,81 @@ +namespace pfc {
+
+ class traits_default {
+ public:
+ enum {
+ realloc_safe = false,
+ needs_destructor = true,
+ needs_constructor = true,
+ constructor_may_fail = true
+ };
+ };
+
+ class traits_default_movable {
+ public:
+ enum {
+ realloc_safe = true,
+ needs_destructor = true,
+ needs_constructor = true,
+ constructor_may_fail = true
+ };
+ };
+
+ class traits_rawobject : public traits_default {
+ public:
+ enum {
+ realloc_safe = true,
+ needs_destructor = false,
+ needs_constructor = false,
+ constructor_may_fail = false
+ };
+ };
+
+ class traits_vtable {
+ public:
+ enum {
+ realloc_safe = true,
+ needs_destructor = true,
+ needs_constructor = true,
+ constructor_may_fail = false
+ };
+ };
+
+ template<typename T> class traits_t : public traits_default {};
+
+ template<typename traits1,typename traits2>
+ class combine_traits {
+ public:
+ enum {
+ realloc_safe = (traits1::realloc_safe && traits2::realloc_safe),
+ needs_destructor = (traits1::needs_destructor || traits2::needs_destructor),
+ needs_constructor = (traits1::needs_constructor || traits2::needs_constructor),
+ constructor_may_fail = (traits1::constructor_may_fail || traits2::constructor_may_fail),
+ };
+ };
+
+ template<typename type1, typename type2>
+ class traits_combined : public combine_traits<pfc::traits_t<type1>,pfc::traits_t<type2> > {};
+
+ template<typename T> class traits_t<T*> : public traits_rawobject {};
+
+ template<> class traits_t<char> : public traits_rawobject {};
+ template<> class traits_t<unsigned char> : public traits_rawobject {};
+ template<> class traits_t<wchar_t> : public traits_rawobject {};
+ template<> class traits_t<short> : public traits_rawobject {};
+ template<> class traits_t<unsigned short> : public traits_rawobject {};
+ template<> class traits_t<int> : public traits_rawobject {};
+ template<> class traits_t<unsigned int> : public traits_rawobject {};
+ template<> class traits_t<long> : public traits_rawobject {};
+ template<> class traits_t<unsigned long> : public traits_rawobject {};
+ template<> class traits_t<long long> : public traits_rawobject {};
+ template<> class traits_t<unsigned long long> : public traits_rawobject {};
+ template<> class traits_t<bool> : public traits_rawobject {};
+
+ template<> class traits_t<float> : public traits_rawobject {};
+ template<> class traits_t<double> : public traits_rawobject {};
+
+ template<> class traits_t<GUID> : public traits_rawobject {};
+
+ template<typename T,t_size p_count>
+ class traits_t<T[p_count]> : public traits_t<T> {};
+}
\ No newline at end of file diff --git a/plugins/ListeningTo/src/players/foo_mlt/pfc/utf8.cpp b/plugins/ListeningTo/src/players/foo_mlt/pfc/utf8.cpp new file mode 100644 index 0000000000..58663abbf2 --- /dev/null +++ b/plugins/ListeningTo/src/players/foo_mlt/pfc/utf8.cpp @@ -0,0 +1,323 @@ +#include "pfc.h"
+
+namespace pfc {
+//utf8 stuff
+
+static const t_uint8 mask_tab[6]={0x80,0xE0,0xF0,0xF8,0xFC,0xFE};
+
+static const t_uint8 val_tab[6]={0,0xC0,0xE0,0xF0,0xF8,0xFC};
+
+t_size utf8_char_len_from_header(char p_c) throw()
+{
+ t_uint8 c = (t_uint8)p_c;
+
+ t_size cnt = 0;
+ for (;;)
+ {
+ if ((p_c & mask_tab[cnt])==val_tab[cnt]) break;
+ if (++cnt>=6) return 0;
+ }
+
+ return cnt + 1;
+
+}
+t_size utf8_decode_char(const char *p_utf8,unsigned & wide) throw() {
+ const t_uint8 * utf8 = (const t_uint8*)p_utf8;
+ const t_size max = 6;
+
+ if (utf8[0]<0x80) {
+ wide = utf8[0];
+ return utf8[0]>0 ? 1 : 0;
+ }
+ wide = 0;
+
+ unsigned res=0;
+ unsigned n;
+ unsigned cnt=0;
+ for (;;)
+ {
+ if ((*utf8&mask_tab[cnt])==val_tab[cnt]) break;
+ if (++cnt>=max) return 0;
+ }
+ cnt++;
+
+ if (cnt==2 && !(*utf8&0x1E)) return 0;
+
+ if (cnt==1)
+ res=*utf8;
+ else
+ res=(0xFF>>(cnt+1))&*utf8;
+
+ for (n=1;n<cnt;n++)
+ {
+ if ((utf8[n]&0xC0) != 0x80)
+ return 0;
+ if (!res && n==2 && !((utf8[n]&0x7F) >> (7 - cnt)))
+ return 0;
+
+ res=(res<<6)|(utf8[n]&0x3F);
+ }
+
+ wide = res;
+
+ return cnt;
+}
+
+t_size utf8_decode_char(const char *p_utf8,unsigned & wide,t_size max) throw()
+{
+ const t_uint8 * utf8 = (const t_uint8*)p_utf8;
+
+ if (max==0) {
+ wide = 0;
+ return 0;
+ }
+
+ if (utf8[0]<0x80) {
+ wide = utf8[0];
+ return utf8[0]>0 ? 1 : 0;
+ }
+ if (max>6) max = 6;
+ wide = 0;
+
+ unsigned res=0;
+ unsigned n;
+ unsigned cnt=0;
+ for (;;)
+ {
+ if ((*utf8&mask_tab[cnt])==val_tab[cnt]) break;
+ if (++cnt>=max) return 0;
+ }
+ cnt++;
+
+ if (cnt==2 && !(*utf8&0x1E)) return 0;
+
+ if (cnt==1)
+ res=*utf8;
+ else
+ res=(0xFF>>(cnt+1))&*utf8;
+
+ for (n=1;n<cnt;n++)
+ {
+ if ((utf8[n]&0xC0) != 0x80)
+ return 0;
+ if (!res && n==2 && !((utf8[n]&0x7F) >> (7 - cnt)))
+ return 0;
+
+ res=(res<<6)|(utf8[n]&0x3F);
+ }
+
+ wide = res;
+
+ return cnt;
+}
+
+
+t_size utf8_encode_char(unsigned wide,char * target) throw()
+{
+ t_size count;
+
+ if (wide < 0x80)
+ count = 1;
+ else if (wide < 0x800)
+ count = 2;
+ else if (wide < 0x10000)
+ count = 3;
+ else if (wide < 0x200000)
+ count = 4;
+ else if (wide < 0x4000000)
+ count = 5;
+ else if (wide <= 0x7FFFFFFF)
+ count = 6;
+ else
+ return 0;
+ //if (count>max) return 0;
+
+ if (target == 0)
+ return count;
+
+ switch (count)
+ {
+ case 6:
+ target[5] = 0x80 | (wide & 0x3F);
+ wide = wide >> 6;
+ wide |= 0x4000000;
+ case 5:
+ target[4] = 0x80 | (wide & 0x3F);
+ wide = wide >> 6;
+ wide |= 0x200000;
+ case 4:
+ target[3] = 0x80 | (wide & 0x3F);
+ wide = wide >> 6;
+ wide |= 0x10000;
+ case 3:
+ target[2] = 0x80 | (wide & 0x3F);
+ wide = wide >> 6;
+ wide |= 0x800;
+ case 2:
+ target[1] = 0x80 | (wide & 0x3F);
+ wide = wide >> 6;
+ wide |= 0xC0;
+ case 1:
+ target[0] = wide;
+ }
+
+ return count;
+}
+
+t_size utf16_encode_char(unsigned cur_wchar,wchar_t * out) throw()
+{
+ if (cur_wchar < 0x10000) {
+ *out = (wchar_t) cur_wchar; return 1;
+ } else if (cur_wchar < (1 << 20)) {
+ unsigned c = cur_wchar - 0x10000;
+ //MSDN:
+ //The first (high) surrogate is a 16-bit code value in the range U+D800 to U+DBFF. The second (low) surrogate is a 16-bit code value in the range U+DC00 to U+DFFF. Using surrogates, Unicode can support over one million characters. For more details about surrogates, refer to The Unicode Standard, version 2.0.
+ out[0] = (wchar_t)(0xD800 | (0x3FF & (c>>10)) );
+ out[1] = (wchar_t)(0xDC00 | (0x3FF & c) ) ;
+ return 2;
+ } else {
+ *out = '?'; return 1;
+ }
+}
+
+t_size utf16_decode_char(const wchar_t * p_source,unsigned * p_out,t_size p_source_length) throw() {
+ if (p_source_length == 0) return 0;
+ else if (p_source_length == 1) {
+ *p_out = p_source[0];
+ return 1;
+ } else {
+ t_size retval = 0;
+ unsigned decoded = p_source[0];
+ if (decoded != 0)
+ {
+ retval = 1;
+ if ((decoded & 0xFC00) == 0xD800)
+ {
+ unsigned low = p_source[1];
+ if ((low & 0xFC00) == 0xDC00)
+ {
+ decoded = 0x10000 + ( ((decoded & 0x3FF) << 10) | (low & 0x3FF) );
+ retval = 2;
+ }
+ }
+ }
+ *p_out = decoded;
+ return retval;
+ }
+}
+
+
+unsigned utf8_get_char(const char * src)
+{
+ unsigned rv = 0;
+ utf8_decode_char(src,rv);
+ return rv;
+}
+
+
+t_size utf8_char_len(const char * s,t_size max) throw()
+{
+ unsigned dummy;
+ return utf8_decode_char(s,dummy,max);
+}
+
+t_size skip_utf8_chars(const char * ptr,t_size count) throw()
+{
+ t_size num = 0;
+ for (;count && ptr[num];count--)
+ {
+ t_size d = utf8_char_len(ptr+num);
+ if (d<=0) break;
+ num+=d;
+ }
+ return num;
+}
+
+bool is_valid_utf8(const char * param,t_size max) {
+ t_size walk = 0;
+ while(walk < max && param[walk] != 0) {
+ t_size d;
+ unsigned dummy;
+ d = utf8_decode_char(param + walk,dummy,max - walk);
+ if (d==0) return false;
+ walk += d;
+ if (walk > max) {
+ PFC_ASSERT(0);//should not be triggerable
+ return false;
+ }
+ }
+ return true;
+}
+
+bool is_lower_ascii(const char * param)
+{
+ while(*param)
+ {
+ if (*param<0) return false;
+ param++;
+ }
+ return true;
+}
+
+static bool check_end_of_string(const char * ptr)
+{
+ __try {
+ return !*ptr;
+ }
+ __except(1) {return true;}
+}
+
+unsigned strcpy_utf8_truncate(const char * src,char * out,unsigned maxbytes)
+{
+ unsigned rv = 0 , ptr = 0;
+ if (maxbytes>0)
+ {
+ maxbytes--;//for null
+ while(!check_end_of_string(src) && maxbytes>0)
+ {
+ __try {
+ t_size delta = utf8_char_len(src);
+ if (delta>maxbytes || delta==0) break;
+ do
+ {
+ out[ptr++] = *(src++);
+ } while(--delta);
+ } __except(1) { break; }
+ rv = ptr;
+ }
+ out[rv]=0;
+ }
+ return rv;
+}
+
+t_size strlen_utf8(const char * p,t_size num) throw()
+{
+ unsigned w;
+ t_size d;
+ t_size ret = 0;
+ for (;num;)
+ {
+ d = utf8_decode_char(p,w);
+ if (w==0 || d<=0) break;
+ ret++;
+ p+=d;
+ num-=d;
+ }
+ return ret;
+}
+
+t_size utf8_chars_to_bytes(const char * string,t_size count) throw()
+{
+ t_size bytes = 0;
+ while(count)
+ {
+ unsigned dummy;
+ t_size delta = utf8_decode_char(string+bytes,dummy);
+ if (delta==0) break;
+ bytes += delta;
+ count--;
+ }
+ return bytes;
+}
+
+}
\ No newline at end of file diff --git a/plugins/ListeningTo/src/players/wa_ipc.h b/plugins/ListeningTo/src/players/wa_ipc.h new file mode 100644 index 0000000000..a21b0eccac --- /dev/null +++ b/plugins/ListeningTo/src/players/wa_ipc.h @@ -0,0 +1,1022 @@ +/*
+** Copyright (C) 2003 Nullsoft, Inc.
+**
+** This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held
+** liable for any damages arising from the use of this software.
+**
+** Permission is granted to anyone to use this software for any purpose, including commercial applications, and to
+** alter it and redistribute it freely, subject to the following restrictions:
+**
+** 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software.
+** If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
+**
+** 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
+**
+** 3. This notice may not be removed or altered from any source distribution.
+**
+*/
+
+#ifndef _WA_IPC_H_
+#define _WA_IPC_H_
+
+/*
+** This is the modern replacement for the classic 'frontend.h'. Most of these
+** updates are designed for in-process use, i.e. from a plugin.
+**
+*/
+
+/* message used to sent many messages to winamp's main window.
+** most all of the IPC_* messages involve sending the message in the form of:
+** result = SendMessage(hwnd_winamp,WM_WA_IPC,(parameter),IPC_*);
+*/
+#define WM_WA_IPC WM_USER
+/* but some of them use WM_COPYDATA. be afraid.
+*/
+
+#define IPC_GETVERSION 0
+/* int version = SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETVERSION);
+**
+** Version will be 0x20yx for winamp 2.yx. versions previous to Winamp 2.0
+** typically (but not always) use 0x1zyx for 1.zx versions. Weird, I know.
+*/
+
+#define IPC_GETREGISTEREDVERSION 770
+
+
+typedef struct {
+ char *filename;
+ char *title;
+ int length;
+} enqueueFileWithMetaStruct; // send this to a IPC_PLAYFILE in a non WM_COPYDATA,
+// and you get the nice desired result. if title is NULL, it is treated as a "thing",
+// otherwise it's assumed to be a file (for speed)
+
+#define IPC_PLAYFILE 100 // dont be fooled, this is really the same as enqueufile
+#define IPC_ENQUEUEFILE 100
+/* sent as a WM_COPYDATA, with IPC_PLAYFILE as the dwData, and the string to play
+** as the lpData. Just enqueues, does not clear the playlist or change the playback
+** state.
+*/
+
+
+#define IPC_DELETE 101
+#define IPC_DELETE_INT 1101 // don't use this, it's used internally by winamp when
+ // dealing with some lame explorer issues.
+/* SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_DELETE);
+** Use IPC_DELETE to clear Winamp's internal playlist.
+*/
+
+
+#define IPC_STARTPLAY 102 // starts playback. almost like hitting play in Winamp.
+#define IPC_STARTPLAY_INT 1102 // used internally, don't bother using it (won't be any fun)
+
+
+#define IPC_CHDIR 103
+/* sent as a WM_COPYDATA, with IPC_CHDIR as the dwData, and the directory to change to
+** as the lpData.
+*/
+
+
+#define IPC_ISPLAYING 104
+/* int res = SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_ISPLAYING);
+** If it returns 1, it is playing. if it returns 3, it is paused,
+** if it returns 0, it is not playing.
+*/
+
+
+#define IPC_GETOUTPUTTIME 105
+/* int res = SendMessage(hwnd_winamp,WM_WA_IPC,mode,IPC_GETOUTPUTTIME);
+** returns the position in milliseconds of the current track (mode = 0),
+** or the track length, in seconds (mode = 1). Returns -1 if not playing or error.
+*/
+
+
+#define IPC_JUMPTOTIME 106
+/* (requires Winamp 1.60+)
+** SendMessage(hwnd_winamp,WM_WA_IPC,ms,IPC_JUMPTOTIME);
+** IPC_JUMPTOTIME sets the position in milliseconds of the
+** current song (approximately).
+** Returns -1 if not playing, 1 on eof, or 0 if successful
+*/
+
+#define IPC_GETMODULENAME 109
+#define IPC_EX_ISRIGHTEXE 666
+/* usually shouldnt bother using these, but here goes:
+** send a WM_COPYDATA with IPC_GETMODULENAME, and an internal
+** flag gets set, which if you send a normal WM_WA_IPC message with
+** IPC_EX_ISRIGHTEXE, it returns whether or not that filename
+** matches. lame, I know.
+*/
+
+#define IPC_WRITEPLAYLIST 120
+/* (requires Winamp 1.666+)
+** SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_WRITEPLAYLIST);
+**
+** IPC_WRITEPLAYLIST writes the current playlist to <winampdir>\\Winamp.m3u,
+** and returns the current playlist position.
+** Kinda obsoleted by some of the 2.x new stuff, but still good for when
+** using a front-end (instead of a plug-in)
+*/
+
+
+#define IPC_SETPLAYLISTPOS 121
+/* (requires Winamp 2.0+)
+** SendMessage(hwnd_winamp,WM_WA_IPC,position,IPC_SETPLAYLISTPOS)
+** IPC_SETPLAYLISTPOS sets the playlist position to 'position'. It
+** does not change playback or anything, it just sets position, and
+** updates the view if necessary
+*/
+
+
+#define IPC_SETVOLUME 122
+/* (requires Winamp 2.0+)
+** SendMessage(hwnd_winamp,WM_WA_IPC,volume,IPC_SETVOLUME);
+** IPC_SETVOLUME sets the volume of Winamp (from 0-255).
+*/
+
+
+#define IPC_SETPANNING 123
+/* (requires Winamp 2.0+)
+** SendMessage(hwnd_winamp,WM_WA_IPC,panning,IPC_SETPANNING);
+** IPC_SETPANNING sets the panning of Winamp (from 0 (left) to 255 (right)).
+*/
+
+
+#define IPC_GETLISTLENGTH 124
+/* (requires Winamp 2.0+)
+** int length = SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETLISTLENGTH);
+** IPC_GETLISTLENGTH returns the length of the current playlist, in
+** tracks.
+*/
+
+
+#define IPC_GETLISTPOS 125
+/* (requires Winamp 2.05+)
+** int pos=SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETLISTPOS);
+** IPC_GETLISTPOS returns the playlist position. A lot like IPC_WRITEPLAYLIST
+** only faster since it doesn't have to write out the list. Heh, silly me.
+*/
+
+
+#define IPC_GETINFO 126
+/* (requires Winamp 2.05+)
+** int inf=SendMessage(hwnd_winamp,WM_WA_IPC,mode,IPC_GETINFO);
+** IPC_GETINFO returns info about the current playing song. The value
+** it returns depends on the value of 'mode'.
+** Mode Meaning
+** ------------------
+** 0 Samplerate (i.e. 44100)
+** 1 Bitrate (i.e. 128)
+** 2 Channels (i.e. 2)
+** 3 (5+) Video LOWORD=w HIWORD=h
+** 4 (5+) > 65536, string (video description)
+*/
+
+
+#define IPC_GETEQDATA 127
+/* (requires Winamp 2.05+)
+** int data=SendMessage(hwnd_winamp,WM_WA_IPC,pos,IPC_GETEQDATA);
+** IPC_GETEQDATA queries the status of the EQ.
+** The value returned depends on what 'pos' is set to:
+** Value Meaning
+** ------------------
+** 0-9 The 10 bands of EQ data. 0-63 (+20db - -20db)
+** 10 The preamp value. 0-63 (+20db - -20db)
+** 11 Enabled. zero if disabled, nonzero if enabled.
+** 12 Autoload. zero if disabled, nonzero if enabled.
+*/
+
+
+#define IPC_SETEQDATA 128
+/* (requires Winamp 2.05+)
+** SendMessage(hwnd_winamp,WM_WA_IPC,pos,IPC_GETEQDATA);
+** SendMessage(hwnd_winamp,WM_WA_IPC,value,IPC_SETEQDATA);
+** IPC_SETEQDATA sets the value of the last position retrieved
+** by IPC_GETEQDATA. This is pretty lame, and we should provide
+** an extended version that lets you do a MAKELPARAM(pos,value).
+** someday...
+
+ new (2.92+):
+ if the high byte is set to 0xDB, then the third byte specifies
+ which band, and the bottom word specifies the value.
+*/
+
+#define IPC_ADDBOOKMARK 129
+/* (requires Winamp 2.4+)
+** Sent as a WM_COPYDATA, using IPC_ADDBOOKMARK, adds the specified
+** file/url to the Winamp bookmark list.
+*/
+/*
+In winamp 5+, we use this as a normal WM_WA_IPC and the string:
+
+ "filename\0title\0"
+
+ to notify the library/bookmark editor that a bookmark
+was added. Note that using this message in this context does not
+actually add the bookmark.
+do not use :)
+*/
+
+
+#define IPC_INSTALLPLUGIN 130
+/* not implemented, but if it was you could do a WM_COPYDATA with
+** a path to a .wpz, and it would install it.
+*/
+
+
+#define IPC_RESTARTWINAMP 135
+/* (requires Winamp 2.2+)
+** SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_RESTARTWINAMP);
+** IPC_RESTARTWINAMP will restart Winamp (isn't that obvious ? :)
+*/
+
+
+#define IPC_ISFULLSTOP 400
+/* (requires winamp 2.7+ I think)
+** ret=SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_ISFULLSTOP);
+** useful for when you're an output plugin, and you want to see
+** if the stop/close is a full stop, or just between tracks.
+** returns nonzero if it's full, zero if it's just a new track.
+*/
+
+
+#define IPC_INETAVAILABLE 242
+/* (requires Winamp 2.05+)
+** val=SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_INETAVAILABLE);
+** IPC_INETAVAILABLE will return 1 if the Internet connection is available for Winamp.
+*/
+
+
+#define IPC_UPDTITLE 243
+/* (requires Winamp 2.2+)
+** SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_UPDTITLE);
+** IPC_UPDTITLE will ask Winamp to update the informations about the current title.
+*/
+
+
+#define IPC_REFRESHPLCACHE 247
+/* (requires Winamp 2.2+)
+** SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_REFRESHPLCACHE);
+** IPC_REFRESHPLCACHE will flush the playlist cache buffer.
+** (send this if you want it to go refetch titles for tracks)
+*/
+
+
+#define IPC_GET_SHUFFLE 250
+/* (requires Winamp 2.4+)
+** val=SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GET_SHUFFLE);
+**
+** IPC_GET_SHUFFLE returns the status of the Shuffle option (1 if set)
+*/
+
+
+#define IPC_GET_REPEAT 251
+/* (requires Winamp 2.4+)
+** val=SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GET_REPEAT);
+**
+** IPC_GET_REPEAT returns the status of the Repeat option (1 if set)
+*/
+
+
+#define IPC_SET_SHUFFLE 252
+/* (requires Winamp 2.4+)
+** SendMessage(hwnd_winamp,WM_WA_IPC,value,IPC_SET_SHUFFLE);
+**
+** IPC_SET_SHUFFLE sets the status of the Shuffle option (1 to turn it on)
+*/
+
+
+#define IPC_SET_REPEAT 253
+/* (requires Winamp 2.4+)
+** SendMessage(hwnd_winamp,WM_WA_IPC,value,IPC_SET_REPEAT);
+**
+** IPC_SET_REPEAT sets the status of the Repeat option (1 to turn it on)
+*/
+
+
+#define IPC_ENABLEDISABLE_ALL_WINDOWS 259 // 0xdeadbeef to disable
+/* (requires Winamp 2.9+)
+** SendMessage(hwnd_winamp,WM_WA_IPC,enable?0:0xdeadbeef,IPC_MBOPENREAL);
+** sending with 0xdeadbeef as the param disables all winamp windows,
+** any other values will enable all winamp windows.
+*/
+
+
+#define IPC_GETWND 260
+/* (requires Winamp 2.9+)
+** HWND h=SendMessage(hwnd_winamp,WM_WA_IPC,IPC_GETWND_xxx,IPC_GETWND);
+** returns the HWND of the window specified.
+*/
+ #define IPC_GETWND_EQ 0 // use one of these for the param
+ #define IPC_GETWND_PE 1
+ #define IPC_GETWND_MB 2
+ #define IPC_GETWND_VIDEO 3
+#define IPC_ISWNDVISIBLE 261 // same param as IPC_GETWND
+
+
+
+
+/************************************************************************
+***************** in-process only (WE LOVE PLUGINS)
+************************************************************************/
+
+
+#define IPC_SETSKIN 200
+/* (requires Winamp 2.04+, only usable from plug-ins (not external apps))
+** SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)"skinname",IPC_SETSKIN);
+** IPC_SETSKIN sets the current skin to "skinname". Note that skinname
+** can be the name of a skin, a skin .zip file, with or without path.
+** If path isn't specified, the default search path is the winamp skins
+** directory.
+*/
+
+
+#define IPC_GETSKIN 201
+/* (requires Winamp 2.04+, only usable from plug-ins (not external apps))
+** SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)skinname_buffer,IPC_GETSKIN);
+** IPC_GETSKIN puts the directory where skin bitmaps can be found
+** into skinname_buffer.
+** skinname_buffer must be MAX_PATH characters in length.
+** When using a .zip'd skin file, it'll return a temporary directory
+** where the ZIP was decompressed.
+*/
+
+
+#define IPC_EXECPLUG 202
+/* (requires Winamp 2.04+, only usable from plug-ins (not external apps))
+** SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)"vis_file.dll",IPC_EXECPLUG);
+** IPC_EXECPLUG executes a visualization plug-in pointed to by WPARAM.
+** the format of this string can be:
+** "vis_whatever.dll"
+** "vis_whatever.dll,0" // (first mod, file in winamp plug-in dir)
+** "C:\\dir\\vis_whatever.dll,1"
+*/
+
+
+#define IPC_GETPLAYLISTFILE 211
+/* (requires Winamp 2.04+, only usable from plug-ins (not external apps))
+** char *name=SendMessage(hwnd_winamp,WM_WA_IPC,index,IPC_GETPLAYLISTFILE);
+** IPC_GETPLAYLISTFILE gets the filename of the playlist entry [index].
+** returns a pointer to it. returns NULL on error.
+*/
+
+
+#define IPC_GETPLAYLISTTITLE 212
+/* (requires Winamp 2.04+, only usable from plug-ins (not external apps))
+** char *name=SendMessage(hwnd_winamp,WM_WA_IPC,index,IPC_GETPLAYLISTTITLE);
+**
+** IPC_GETPLAYLISTTITLE gets the title of the playlist entry [index].
+** returns a pointer to it. returns NULL on error.
+*/
+
+
+#define IPC_GETHTTPGETTER 240
+/* retrieves a function pointer to a HTTP retrieval function.
+** if this is unsupported, returns 1 or 0.
+** the function should be:
+** int (*httpRetrieveFile)(HWND hwnd, char *url, char *file, char *dlgtitle);
+** if you call this function, with a parent window, a URL, an output file, and a dialog title,
+** it will return 0 on successful download, 1 on error.
+*/
+
+
+#define IPC_MBOPEN 241
+/* (requires Winamp 2.05+)
+** SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_MBOPEN);
+** SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)url,IPC_MBOPEN);
+** IPC_MBOPEN will open a new URL in the minibrowser. if url is NULL, it will open the Minibrowser window.
+*/
+
+
+
+#define IPC_CHANGECURRENTFILE 245
+/* (requires Winamp 2.05+)
+** SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)file,IPC_CHANGECURRENTFILE);
+** IPC_CHANGECURRENTFILE will set the current playlist item.
+*/
+
+
+#define IPC_GETMBURL 246
+/* (requires Winamp 2.2+)
+** char buffer[4096]; // Urls can be VERY long
+** SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)buffer,IPC_GETMBURL);
+** IPC_GETMBURL will retrieve the current Minibrowser URL into buffer.
+** buffer must be at least 4096 bytes long.
+*/
+
+
+#define IPC_MBBLOCK 248
+/* (requires Winamp 2.4+)
+** SendMessage(hwnd_winamp,WM_WA_IPC,value,IPC_MBBLOCK);
+**
+** IPC_MBBLOCK will block the Minibrowser from updates if value is set to 1
+*/
+
+#define IPC_MBOPENREAL 249
+/* (requires Winamp 2.4+)
+** SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)url,IPC_MBOPENREAL);
+**
+** IPC_MBOPENREAL works the same as IPC_MBOPEN except that it will works even if
+** IPC_MBBLOCK has been set to 1
+*/
+
+#define IPC_ADJUST_OPTIONSMENUPOS 280
+/* (requires Winamp 2.9+)
+** int newpos=SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)adjust_offset,IPC_ADJUST_OPTIONSMENUPOS);
+** moves where winamp expects the Options menu in the main menu. Useful if you wish to insert a
+** menu item above the options/skins/vis menus.
+*/
+
+#define IPC_GET_HMENU 281
+/* (requires Winamp 2.9+)
+** HMENU hMenu=SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GET_HMENU);
+** values for data:
+** 0 : main popup menu
+** 1 : main menubar file menu
+** 2 : main menubar options menu
+** 3 : main menubar windows menu
+** 4 : main menubar help menu
+** other values will return NULL.
+*/
+
+#define IPC_GET_EXTENDED_FILE_INFO 290 //pass a pointer to the following struct in wParam
+#define IPC_GET_EXTENDED_FILE_INFO_HOOKABLE 296
+/* (requires Winamp 2.9+)
+** to use, create an extendedFileInfoStruct, point the values filename and metadata to the
+** filename and metadata field you wish to query, and ret to a buffer, with retlen to the
+** length of that buffer, and then SendMessage(hwnd_winamp,WM_WA_IPC,&struct,IPC_GET_EXTENDED_FILE_INFO);
+** the results should be in the buffer pointed to by ret.
+** returns 1 if the decoder supports a getExtendedFileInfo method
+*/
+typedef struct {
+ char *filename;
+ char *metadata;
+ char *ret;
+ int retlen;
+} extendedFileInfoStruct;
+
+#define IPC_GET_BASIC_FILE_INFO 291 //pass a pointer to the following struct in wParam
+typedef struct {
+ char *filename;
+
+ int quickCheck; // set to 0 to always get, 1 for quick, 2 for default (if 2, quickCheck will be set to 0 if quick wasnot used)
+
+ // filled in by winamp
+ int length;
+ char *title;
+ int titlelen;
+} basicFileInfoStruct;
+
+#define IPC_GET_EXTLIST 292 //returns doublenull delimited. GlobalFree() it when done. if data is 0, returns raw extlist, if 1, returns something suitable for getopenfilename
+
+#define IPC_INFOBOX 293
+typedef struct {
+ HWND parent;
+ char *filename;
+} infoBoxParam;
+
+#define IPC_SET_EXTENDED_FILE_INFO 294 //pass a pointer to the a extendedFileInfoStruct in wParam
+/* (requires Winamp 2.9+)
+** to use, create an extendedFileInfoStruct, point the values filename and metadata to the
+** filename and metadata field you wish to write in ret. (retlen is not used). and then
+** SendMessage(hwnd_winamp,WM_WA_IPC,&struct,IPC_SET_EXTENDED_FILE_INFO);
+** returns 1 if the metadata is supported
+** Call IPC_WRITE_EXTENDED_FILE_INFO once you're done setting all the metadata you want to update
+*/
+
+#define IPC_WRITE_EXTENDED_FILE_INFO 295
+/* (requires Winamp 2.9+)
+** writes all the metadata set thru IPC_SET_EXTENDED_FILE_INFO to the file
+** returns 1 if the file has been successfully updated, 0 if error
+*/
+
+#define IPC_FORMAT_TITLE 297
+typedef struct
+{
+ char *spec; // NULL=default winamp spec
+ void *p;
+
+ char *out;
+ int out_len;
+
+ char * (*TAGFUNC)(char * tag, void * p); //return 0 if not found
+ void (*TAGFREEFUNC)(char * tag,void * p);
+} waFormatTitle;
+
+#define IPC_GETUNCOMPRESSINTERFACE 331
+/* returns a function pointer to uncompress().
+** int (*uncompress)(unsigned char *dest, unsigned long *destLen, const unsigned char *source, unsigned long sourceLen);
+** right out of zlib, useful for decompressing zlibbed data.
+** if you pass the parm of 0x10100000, it will return a wa_inflate_struct * to an inflate API.
+*/
+
+typedef struct {
+ int (*inflateReset)(void *strm);
+ int (*inflateInit_)(void *strm,const char *version, int stream_size);
+ int (*inflate)(void *strm, int flush);
+ int (*inflateEnd)(void *strm);
+ unsigned long (*crc32)(unsigned long crc, const unsigned char *buf, unsigned int len);
+} wa_inflate_struct;
+
+
+#define IPC_ADD_PREFS_DLG 332
+#define IPC_REMOVE_PREFS_DLG 333
+/* (requires Winamp 2.9+)
+** to use, allocate a prefsDlgRec structure (either on the heap or some global
+** data, but NOT on the stack), initialze the members:
+** hInst to the DLL instance where the resource is located
+** dlgID to the ID of the dialog,
+** proc to the window procedure for the dialog
+** name to the name of the prefs page in the prefs.
+** where to 0 (eventually we may add more options)
+** then, SendMessage(hwnd_winamp,WM_WA_IPC,&prefsRec,IPC_ADD_PREFS_DLG);
+**
+** you can also IPC_REMOVE_PREFS_DLG with the address of the same prefsRec,
+** but you shouldn't really ever have to.
+**
+*/
+#define IPC_OPENPREFSTOPAGE 380 // pass an id of a builtin page, or a &prefsDlgRec of prefs page to open
+
+typedef struct _prefsDlgRec {
+ HINSTANCE hInst;
+ int dlgID;
+ void *proc;
+
+ char *name;
+ int where; // 0 for options, 1 for plugins, 2 for skins, 3 for bookmarks, 4 for prefs
+
+
+ int _id;
+ struct _prefsDlgRec *next;
+} prefsDlgRec;
+
+
+#define IPC_GETINIFILE 334 // returns a pointer to winamp.ini
+#define IPC_GETINIDIRECTORY 335 // returns a pointer to the directory to put config files in (if you dont want to use winamp.ini)
+
+#define IPC_SPAWNBUTTONPOPUP 361 // param =
+// 0 = eject
+// 1 = previous
+// 2 = next
+// 3 = pause
+// 4 = play
+// 5 = stop
+
+#define IPC_OPENURLBOX 360 // pass a HWND to a parent, returns a HGLOBAL that needs to be freed with GlobalFree(), if successful
+#define IPC_OPENFILEBOX 362 // pass a HWND to a parent
+#define IPC_OPENDIRBOX 363 // pass a HWND to a parent
+
+// pass an HWND to a parent. call this if you take over the whole UI so that the dialogs are not appearing on the
+// bottom right of the screen since the main winamp window is at 3000x3000, call again with NULL to reset
+#define IPC_SETDIALOGBOXPARENT 364
+
+
+
+// pass 0 for a copy of the skin HBITMAP
+// pass 1 for name of font to use for playlist editor likeness
+// pass 2 for font charset
+// pass 3 for font size
+#define IPC_GET_GENSKINBITMAP 503
+
+
+#define IPC_GET_EMBEDIF 505 // pass an embedWindowState
+// returns an HWND embedWindow(embedWindowState *); if the data is NULL, otherwise returns the HWND directly
+typedef struct
+{
+ HWND me; //hwnd of the window
+
+ int flags;
+
+ RECT r;
+
+ void *user_ptr; // for application use
+
+ int extra_data[64]; // for internal winamp use
+} embedWindowState;
+
+#define EMBED_FLAGS_NORESIZE 1 // set this bit in embedWindowState.flags to keep window from being resizable
+#define EMBED_FLAGS_NOTRANSPARENCY 2 // set this bit in embedWindowState.flags to make gen_ff turn transparency off for this wnd
+
+
+#define IPC_EMBED_ENUM 532
+typedef struct embedEnumStruct
+{
+ int (*enumProc)(embedWindowState *ws, struct embedEnumStruct *param); // return 1 to abort
+ int user_data; // or more :)
+} embedEnumStruct;
+ // pass
+
+#define IPC_EMBED_ISVALID 533
+
+#define IPC_CONVERTFILE 506
+/* (requires Winamp 2.92+)
+** Converts a given file to a different format (PCM, MP3, etc...)
+** To use, pass a pointer to a waFileConvertStruct struct
+** This struct can be either on the heap or some global
+** data, but NOT on the stack. At least, until the conversion is done.
+**
+** eg: SendMessage(hwnd_winamp,WM_WA_IPC,&myConvertStruct,IPC_CONVERTFILE);
+**
+** Return value:
+** 0: Can't start the conversion. Look at myConvertStruct->error for details.
+** 1: Conversion started. Status messages will be sent to the specified callbackhwnd.
+** Be sure to call IPC_CONVERTFILE_END when your callback window receives the
+** IPC_CB_CONVERT_DONE message.
+*/
+typedef struct
+{
+ char *sourcefile; // "c:\\source.mp3"
+ char *destfile; // "c:\\dest.pcm"
+ int destformat[8]; // like 'PCM ',srate,nch,bps
+ HWND callbackhwnd; // window that will receive the IPC_CB_CONVERT notification messages
+
+ //filled in by winamp.exe
+ char *error; //if IPC_CONVERTFILE returns 0, the reason will be here
+
+ int bytes_done; //you can look at both of these values for speed statistics
+ int bytes_total;
+ int bytes_out;
+
+ int killswitch; // don't set it manually, use IPC_CONVERTFILE_END
+ int extra_data[64]; // for internal winamp use
+} convertFileStruct;
+
+#define IPC_CONVERTFILE_END 507
+/* (requires Winamp 2.92+)
+** Stop/ends a convert process started from IPC_CONVERTFILE
+** You need to call this when you receive the IPC_CB_CONVERTDONE message or when you
+** want to abort a conversion process
+**
+** eg: SendMessage(hwnd_winamp,WM_WA_IPC,&myConvertStruct,IPC_CONVERTFILE_END);
+**
+** No return value
+*/
+
+typedef struct {
+ HWND hwndParent;
+ int format;
+
+ //filled in by winamp.exe
+ HWND hwndConfig;
+ int extra_data[8];
+} convertConfigStruct;
+#define IPC_CONVERT_CONFIG 508
+#define IPC_CONVERT_CONFIG_END 509
+
+typedef struct
+{
+ void (*enumProc)(int user_data, const char *desc, int fourcc);
+ int user_data;
+} converterEnumFmtStruct;
+#define IPC_CONVERT_CONFIG_ENUMFMTS 510
+/* (requires Winamp 2.92+)
+*/
+
+
+typedef struct
+{
+ char cdletter;
+ char *playlist_file;
+ HWND callback_hwnd;
+
+ //filled in by winamp.exe
+ char *error;
+} burnCDStruct;
+#define IPC_BURN_CD 511
+/* (requires Winamp 5.0+)
+*/
+
+typedef struct
+{
+ convertFileStruct *cfs;
+ int priority;
+} convertSetPriority;
+#define IPC_CONVERT_SET_PRIORITY 512
+
+typedef struct
+{
+ char *filename;
+ char *title; // 2048 bytes
+ int length;
+ int force_useformatting; // can set this to 1 if you want to force a url to use title formatting shit
+} waHookTitleStruct;
+// return TRUE if you hook this
+#define IPC_HOOK_TITLES 850
+
+#define IPC_GETSADATAFUNC 800
+// 0: returns a char *export_sa_get() that returns 150 bytes of data
+// 1: returns a export_sa_setreq(int want);
+
+#define IPC_ISMAINWNDVISIBLE 900
+
+
+#define IPC_SETPLEDITCOLORS 920
+typedef struct
+{
+ int numElems;
+ int *elems;
+ HBITMAP bm; // set if you want to override
+} waSetPlColorsStruct;
+
+
+// the following IPC use waSpawnMenuParms as parameter
+#define IPC_SPAWNEQPRESETMENU 933
+#define IPC_SPAWNFILEMENU 934 //menubar
+#define IPC_SPAWNOPTIONSMENU 935 //menubar
+#define IPC_SPAWNWINDOWSMENU 936 //menubar
+#define IPC_SPAWNHELPMENU 937 //menubar
+#define IPC_SPAWNPLAYMENU 938 //menubar
+#define IPC_SPAWNPEFILEMENU 939 //menubar
+#define IPC_SPAWNPEPLAYLISTMENU 940 //menubar
+#define IPC_SPAWNPESORTMENU 941 //menubar
+#define IPC_SPAWNPEHELPMENU 942 //menubar
+#define IPC_SPAWNMLFILEMENU 943 //menubar
+#define IPC_SPAWNMLVIEWMENU 944 //menubar
+#define IPC_SPAWNMLHELPMENU 945 //menubar
+#define IPC_SPAWNPELISTOFPLAYLISTS 946
+
+typedef struct
+{
+ HWND wnd;
+ int xpos; // in screen coordinates
+ int ypos;
+} waSpawnMenuParms;
+
+// waSpawnMenuParms2 is used by the menubar submenus
+typedef struct
+{
+ HWND wnd;
+ int xpos; // in screen coordinates
+ int ypos;
+ int width;
+ int height;
+} waSpawnMenuParms2;
+
+
+// system tray sends this (you might want to simulate it)
+#define WM_WA_SYSTRAY WM_USER+1
+
+// input plugins send this when they are done playing back
+#define WM_WA_MPEG_EOF WM_USER+2
+
+
+
+//// video stuff
+
+#define IPC_IS_PLAYING_VIDEO 501 // returns >1 if playing, 0 if not, 1 if old version (so who knows):)
+#define IPC_GET_IVIDEOOUTPUT 500 // see below for IVideoOutput interface
+#define VIDEO_MAKETYPE(A,B,C,D) ((A) | ((B)<<8) | ((C)<<16) | ((D)<<24))
+#define VIDUSER_SET_INFOSTRING 0x1000
+#define VIDUSER_GET_VIDEOHWND 0x1001
+#define VIDUSER_SET_VFLIP 0x1002
+
+#ifndef NO_IVIDEO_DECLARE
+#ifdef __cplusplus
+
+class VideoOutput;
+class SubsItem;
+
+typedef struct {
+ unsigned char* baseAddr;
+ long rowBytes;
+} YV12_PLANE;
+
+typedef struct {
+ YV12_PLANE y;
+ YV12_PLANE u;
+ YV12_PLANE v;
+} YV12_PLANES;
+
+class IVideoOutput
+{
+ public:
+ virtual ~IVideoOutput() { }
+ virtual int open(int w, int h, int vflip, double aspectratio, unsigned int fmt)=0;
+ virtual void setcallback(LRESULT (*msgcallback)(void *token, HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam), void *token) { }
+ virtual void close()=0;
+ virtual void draw(void *frame)=0;
+ virtual void drawSubtitle(SubsItem *item) { }
+ virtual void showStatusMsg(const char *text) { }
+ virtual int get_latency() { return 0; }
+ virtual void notifyBufferState(int bufferstate) { } /* 0-255*/
+
+ virtual int extended(int param1, int param2, int param3) { return 0; } // Dispatchable, eat this!
+};
+#endif //cplusplus
+#endif//NO_IVIDEO_DECLARE
+
+// these messages are callbacks that you can grab by subclassing the winamp window
+
+// wParam =
+#define IPC_CB_WND_EQ 0 // use one of these for the param
+#define IPC_CB_WND_PE 1
+#define IPC_CB_WND_MB 2
+#define IPC_CB_WND_VIDEO 3
+#define IPC_CB_WND_MAIN 4
+
+#define IPC_CB_ONSHOWWND 600
+#define IPC_CB_ONHIDEWND 601
+
+#define IPC_CB_GETTOOLTIP 602
+
+#define IPC_CB_MISC 603
+ #define IPC_CB_MISC_TITLE 0
+ #define IPC_CB_MISC_VOLUME 1 // volume/pan
+ #define IPC_CB_MISC_STATUS 2
+ #define IPC_CB_MISC_EQ 3
+ #define IPC_CB_MISC_INFO 4
+ #define IPC_CB_MISC_VIDEOINFO 5
+
+#define IPC_CB_CONVERT_STATUS 604 // param value goes from 0 to 100 (percent)
+#define IPC_CB_CONVERT_DONE 605
+
+#define IPC_ADJUST_FFWINDOWSMENUPOS 606
+/* (requires Winamp 2.9+)
+** int newpos=SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)adjust_offset,IPC_ADJUST_FFWINDOWSMENUPOS);
+** moves where winamp expects the freeform windows in the menubar windows main menu. Useful if you wish to insert a
+** menu item above extra freeform windows.
+*/
+
+#define IPC_ISDOUBLESIZE 608
+
+#define IPC_ADJUST_FFOPTIONSMENUPOS 609
+/* (requires Winamp 2.9+)
+** int newpos=SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)adjust_offset,IPC_ADJUST_FFOPTIONSMENUPOS);
+** moves where winamp expects the freeform preferences item in the menubar windows main menu. Useful if you wish to insert a
+** menu item above preferences item.
+*/
+
+#define IPC_GETTIMEDISPLAYMODE 610 // returns 0 if displaying elapsed time or 1 if displaying remaining time
+
+#define IPC_SETVISWND 611 // param is hwnd, setting this allows you to receive ID_VIS_NEXT/PREVOUS/RANDOM/FS wm_commands
+#define ID_VIS_NEXT 40382
+#define ID_VIS_PREV 40383
+#define ID_VIS_RANDOM 40384
+#define ID_VIS_FS 40389
+#define ID_VIS_CFG 40390
+#define ID_VIS_MENU 40391
+
+#define IPC_GETVISWND 612 // returns the vis cmd handler hwnd
+#define IPC_ISVISRUNNING 613
+#define IPC_CB_VISRANDOM 628 // param is status of random
+
+#define IPC_SETIDEALVIDEOSIZE 614 // sent by winamp to winamp, trap it if you need it. width=HIWORD(param), height=LOWORD(param)
+
+#define IPC_GETSTOPONVIDEOCLOSE 615
+#define IPC_SETSTOPONVIDEOCLOSE 616
+
+typedef struct {
+ HWND hwnd;
+ int uMsg;
+ int wParam;
+ int lParam;
+} transAccelStruct;
+
+#define IPC_TRANSLATEACCELERATOR 617
+
+typedef struct {
+ int cmd;
+ int x;
+ int y;
+ int align;
+} windowCommand; // send this as param to an IPC_PLCMD, IPC_MBCMD, IPC_VIDCMD
+
+#define IPC_CB_ONTOGGLEAOT 618
+
+#define IPC_GETPREFSWND 619
+
+#define IPC_SET_PE_WIDTHHEIGHT 620 // data is a pointer to a POINT structure that holds width & height
+
+#define IPC_GETLANGUAGEPACKINSTANCE 621
+
+#define IPC_CB_PEINFOTEXT 622 // data is a string, ie: "04:21/45:02"
+
+#define IPC_CB_OUTPUTCHANGED 623 // output plugin was changed in config
+
+#define IPC_GETOUTPUTPLUGIN 625
+
+#define IPC_SETDRAWBORDERS 626
+#define IPC_DISABLESKINCURSORS 627
+#define IPC_CB_RESETFONT 629
+
+#define IPC_IS_FULLSCREEN 630 // returns 1 if video or vis is in fullscreen mode
+#define IPC_SET_VIS_FS_FLAG 631 // a vis should send this message with 1/as param to notify winamp that it has gone to or has come back from fullscreen mode
+
+#define IPC_SHOW_NOTIFICATION 632
+
+#define IPC_GETSKININFO 633
+
+// >>>>>>>>>>> Next is 634
+
+#define IPC_PLCMD 1000
+
+#define PLCMD_ADD 0
+#define PLCMD_REM 1
+#define PLCMD_SEL 2
+#define PLCMD_MISC 3
+#define PLCMD_LIST 4
+
+#define IPC_MBCMD 1001
+
+#define MBCMD_BACK 0
+#define MBCMD_FORWARD 1
+#define MBCMD_STOP 2
+#define MBCMD_RELOAD 3
+#define MBCMD_MISC 4
+
+#define IPC_VIDCMD 1002
+
+#define VIDCMD_FULLSCREEN 0
+#define VIDCMD_1X 1
+#define VIDCMD_2X 2
+#define VIDCMD_LIB 3
+#define VIDPOPUP_MISC 4
+
+#define IPC_MBURL 1003 //sets the URL
+#define IPC_MBGETCURURL 1004 //copies the current URL into wParam (have a 4096 buffer ready)
+#define IPC_MBGETDESC 1005 //copies the current URL description into wParam (have a 4096 buffer ready)
+#define IPC_MBCHECKLOCFILE 1006 //checks that the link file is up to date (otherwise updates it). wParam=parent HWND
+#define IPC_MBREFRESH 1007 //refreshes the "now playing" view in the library
+#define IPC_MBGETDEFURL 1008 //copies the default URL into wParam (have a 4096 buffer ready)
+
+#define IPC_STATS_LIBRARY_ITEMCNT 1300 // updates library count status
+
+// IPC 2000-3000 reserved for freeform messages, see gen_ff/ff_ipc.h
+#define IPC_FF_FIRST 2000
+#define IPC_FF_LAST 3000
+
+#define IPC_GETDROPTARGET 3001
+
+#define IPC_PLAYLIST_MODIFIED 3002 // sent to main wnd whenever the playlist is modified
+
+#define IPC_PLAYING_FILE 3003 // sent to main wnd with the file as parm whenever a file is played
+#define IPC_FILE_TAG_MAY_HAVE_UPDATED 3004 // sent to main wnd with the file as parm whenever a file tag might be updated
+
+
+#define IPC_ALLOW_PLAYTRACKING 3007
+// send nonzero to allow, zero to disallow
+
+#define IPC_HOOK_OKTOQUIT 3010 // return 0 to abort a quit, nonzero if quit is OK
+
+#define IPC_WRITECONFIG 3011 // pass 2 to write all, 1 to write playlist + common, 0 to write common+less common
+
+// pass a string to be the name to register, and returns a value > 65536, which is a unique value you can use
+// for custom WM_WA_IPC messages.
+#define IPC_REGISTER_WINAMP_IPCMESSAGE 65536
+
+/**************************************************************************/
+
+/*
+** Finally there are some WM_COMMAND messages that you can use to send
+** Winamp misc commands.
+**
+** To send these, use:
+**
+** SendMessage(hwnd_winamp, WM_COMMAND,command_name,0);
+*/
+
+#define WINAMP_OPTIONS_EQ 40036 // toggles the EQ window
+#define WINAMP_OPTIONS_PLEDIT 40040 // toggles the playlist window
+#define WINAMP_VOLUMEUP 40058 // turns the volume up a little
+#define WINAMP_VOLUMEDOWN 40059 // turns the volume down a little
+#define WINAMP_FFWD5S 40060 // fast forwards 5 seconds
+#define WINAMP_REW5S 40061 // rewinds 5 seconds
+
+// the following are the five main control buttons, with optionally shift
+// or control pressed
+// (for the exact functions of each, just try it out)
+#define WINAMP_BUTTON1 40044
+#define WINAMP_BUTTON2 40045
+#define WINAMP_BUTTON3 40046
+#define WINAMP_BUTTON4 40047
+#define WINAMP_BUTTON5 40048
+#define WINAMP_BUTTON1_SHIFT 40144
+#define WINAMP_BUTTON2_SHIFT 40145
+#define WINAMP_BUTTON3_SHIFT 40146
+#define WINAMP_BUTTON4_SHIFT 40147
+#define WINAMP_BUTTON5_SHIFT 40148
+#define WINAMP_BUTTON1_CTRL 40154
+#define WINAMP_BUTTON2_CTRL 40155
+#define WINAMP_BUTTON3_CTRL 40156
+#define WINAMP_BUTTON4_CTRL 40157
+#define WINAMP_BUTTON5_CTRL 40158
+
+#define WINAMP_FILE_PLAY 40029 // pops up the load file(s) box
+#define WINAMP_FILE_DIR 40187 // pops up the load directory box
+#define WINAMP_OPTIONS_PREFS 40012 // pops up the preferences
+#define WINAMP_OPTIONS_AOT 40019 // toggles always on top
+#define WINAMP_HELP_ABOUT 40041 // pops up the about box :)
+
+#define ID_MAIN_PLAY_AUDIOCD1 40323 // starts playing the audio CD in the first CD reader
+#define ID_MAIN_PLAY_AUDIOCD2 40323 // plays the 2nd
+#define ID_MAIN_PLAY_AUDIOCD3 40323 // plays the 3nd
+#define ID_MAIN_PLAY_AUDIOCD4 40323 // plays the 4nd
+
+// IDs 42000 to 45000 are reserved for gen_ff
+// IDs from 45000 to 57000 are reserved for library
+
+#endif//_WA_IPC_H_
+
+/*
+** EOF.. Enjoy.
+*/
\ No newline at end of file diff --git a/plugins/ListeningTo/src/players/winamp_mlt/GEN.H b/plugins/ListeningTo/src/players/winamp_mlt/GEN.H new file mode 100644 index 0000000000..a63da3461b --- /dev/null +++ b/plugins/ListeningTo/src/players/winamp_mlt/GEN.H @@ -0,0 +1,37 @@ +#ifndef NULLSOFT_WINAMP_GEN_H
+#define NULLSOFT_WINAMP_GEN_H
+
+#include <windows.h>
+
+#define GEN_INIT_SUCCESS 0
+
+// return values from the winampUninstallPlugin(HINSTANCE hdll, HWND parent, int param)
+// which determine if we can uninstall the plugin immediately or on winamp restart
+//
+// uninstall support was added from 5.0+ and uninstall now support from 5.5+
+// it is down to you to ensure that if uninstall now is returned that it will not cause a crash
+// (ie don't use if you've been subclassing the main window)
+#define GEN_PLUGIN_UNINSTALL_NOW 0x1
+#define GEN_PLUGIN_UNINSTALL_REBOOT 0x0
+
+typedef struct {
+ int version;
+ char *description;
+ int (*init)();
+ void (*config)();
+ void (*quit)();
+ HWND hwndParent;
+ HINSTANCE hDllInstance;
+} winampGeneralPurposePlugin;
+
+#define GPPHDR_VER 0x10
+#ifdef __cplusplus
+extern "C" {
+#endif
+//extern winampGeneralPurposePlugin *gen_plugins[256];
+typedef winampGeneralPurposePlugin * (*winampGeneralPurposePluginGetter)();
+#ifdef __cplusplus
+}
+#endif
+
+#endif
\ No newline at end of file diff --git a/plugins/ListeningTo/src/players/winamp_mlt/mlt_12.vcxproj.filters b/plugins/ListeningTo/src/players/winamp_mlt/mlt_12.vcxproj.filters new file mode 100644 index 0000000000..a6c1ed4343 --- /dev/null +++ b/plugins/ListeningTo/src/players/winamp_mlt/mlt_12.vcxproj.filters @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{cad9b2cf-439e-451d-958b-6dc6785718c5}</UniqueIdentifier>
+ <Extensions>cpp;c;cxx;rc;def;r;odl;idl;hpj;bat</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{344f8c05-4e5d-4161-8302-4f70b02998b1}</UniqueIdentifier>
+ <Extensions>h;hpp;hxx;hm;inl</Extensions>
+ </Filter>
+ <Filter Include="Resource Files">
+ <UniqueIdentifier>{5b68c6e2-f572-4488-8593-92c99a0943e2}</UniqueIdentifier>
+ <Extensions>ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="mlt_winamp.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="mlt_winamp.def">
+ <Filter>Source Files</Filter>
+ </None>
+ </ItemGroup>
+</Project>
\ No newline at end of file diff --git a/plugins/ListeningTo/src/players/winamp_mlt/mlt_14.vcxproj.filters b/plugins/ListeningTo/src/players/winamp_mlt/mlt_14.vcxproj.filters new file mode 100644 index 0000000000..a6c1ed4343 --- /dev/null +++ b/plugins/ListeningTo/src/players/winamp_mlt/mlt_14.vcxproj.filters @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{cad9b2cf-439e-451d-958b-6dc6785718c5}</UniqueIdentifier>
+ <Extensions>cpp;c;cxx;rc;def;r;odl;idl;hpj;bat</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{344f8c05-4e5d-4161-8302-4f70b02998b1}</UniqueIdentifier>
+ <Extensions>h;hpp;hxx;hm;inl</Extensions>
+ </Filter>
+ <Filter Include="Resource Files">
+ <UniqueIdentifier>{5b68c6e2-f572-4488-8593-92c99a0943e2}</UniqueIdentifier>
+ <Extensions>ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="mlt_winamp.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="mlt_winamp.def">
+ <Filter>Source Files</Filter>
+ </None>
+ </ItemGroup>
+</Project>
\ No newline at end of file diff --git a/plugins/ListeningTo/src/players/winamp_mlt/mlt_winamp.cpp b/plugins/ListeningTo/src/players/winamp_mlt/mlt_winamp.cpp new file mode 100644 index 0000000000..1844186570 --- /dev/null +++ b/plugins/ListeningTo/src/players/winamp_mlt/mlt_winamp.cpp @@ -0,0 +1,470 @@ +/* +Copyright (C) 2005-2009 Ricardo Pescuma Domenecci + +This is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public +License as published by the Free Software Foundation; either +version 2 of the License, or (at your option) any later version. + +This is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with this file; see the file license.txt. If +not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. +*/ + + +#include <windows.h> +#include <tchar.h> +#include <stdio.h> +#include <process.h> +#include "m_listeningto.h" + +#include "wa_ipc.h" +#include "GEN.h" + +// Plugin data ////////////////////////////////////////////////////////////////////////// + +int init(); +void quit(); +void config(); + +winampGeneralPurposePlugin plugin = { + GPPHDR_VER, + "Miranda ListeningTo Winamp Plugin", // Plug-in description + init, + config, + quit, + 0, // handle to Winamp main window, loaded by winamp when this dll is loaded + 0 // hinstance to this dll, loaded by winamp when this dll is loaded +}; + + +// Globals ////////////////////////////////////////////////////////////////////////////// + + +#define MIRANDA_DW_PROTECTION 0x8754 + +#define MESSAGE_WINDOWCLASS MIRANDA_WINDOWCLASS ".Winamp" + +#define DATA_SIZE 1024 + +#define WA_STATE_CHANGE 0x0000029A + +WNDPROC oldWndProc = NULL; +WNDPROC oldMainWndProc = NULL; +HMENU hMenuCreated = NULL; +HWND hMsgWnd = NULL; +HWND hPlWnd = NULL; +HINSTANCE hInst = NULL; + +// Message window proc +LRESULT CALLBACK MsgWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); + +// Playlist window message processor +LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); + + + +// Functions //////////////////////////////////////////////////////////////////////////// + + +void WindowThread(void *param) +{ + // Create window + WNDCLASS wc = {0}; + wc.lpfnWndProc = MsgWndProc; + wc.hInstance = hInst; + wc.lpszClassName = MESSAGE_WINDOWCLASS; + + RegisterClass(&wc); + + hMsgWnd = CreateWindow(MESSAGE_WINDOWCLASS, _T("Miranda ListeningTo Winamp Plugin"), + 0, 0, 0, 0, 0, NULL, NULL, hInst, NULL); + + if (hMsgWnd != NULL) + if (FindWindow(MIRANDA_WINDOWCLASS, NULL) != NULL) + SetTimer(hMsgWnd, 0, 5000, NULL); + + MSG msg; + BOOL bRet; + while( (bRet = GetMessage( &msg, NULL, 0, 0 )) != 0) + { + if (bRet == -1) + { + // handle the error and possibly exit + break; + } + else + { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + } + + _endthread(); +} + +extern "C" BOOL WINAPI DllMain(HINSTANCE hInstDll, DWORD fdwReason, LPVOID lpvReserved) +{ + if (fdwReason == DLL_PROCESS_ATTACH) + { + hInst = hInstDll; + + plugin.hwndParent = NULL; + + _beginthread(WindowThread, 0, NULL); + } + + return TRUE; +} + +// Winamp interface function +extern "C" __declspec(dllexport) winampGeneralPurposePlugin * winampGetGeneralPurposePlugin() +{ + KillTimer(hMsgWnd, 0); + + return &plugin; +} + +BOOL CALLBACK EnumWindowsProc(HWND hwnd, LPARAM lParam) +{ + // Find the windows + char class_name[1024]; + if (GetClassName(hwnd, class_name, sizeof(class_name))) + { + class_name[sizeof(class_name)-1] = '\0'; + + if (_strcmpi(MIRANDA_WINDOWCLASS, class_name) == 0) + { + COPYDATASTRUCT *cds = (COPYDATASTRUCT *)lParam; + SendMessage(hwnd, WM_COPYDATA, (WPARAM) plugin.hwndParent, (LPARAM) cds); + } + } + + return TRUE; +} + +inline void SendData(WCHAR *text) +{ + static WCHAR lastMsg[1024] = L""; + + if (wcscmp(lastMsg, text) == 0) + return; + + // Prepare the struct + COPYDATASTRUCT cds; + cds.dwData = MIRANDA_DW_PROTECTION; + cds.lpData = text; + cds.cbData = (wcslen(text) + 1) * sizeof(WCHAR); + + EnumWindows(EnumWindowsProc, (LPARAM) &cds); + + wcsncpy(lastMsg, text, 1024); + lastMsg[1023] = L'\0'; +} + + +void Concat(WCHAR *data, size_t &size, char *str, size_t len = 0) +{ + if (size < 3 * sizeof(WCHAR)) + return; + + if (str != NULL) + { + if (len == 0) + len = strlen(str); + + if (size >= len + 3) + { + MultiByteToWideChar(CP_ACP, 0, str, len * sizeof(char), &data[DATA_SIZE - size], size * sizeof(WCHAR)); + size -= len; + data[DATA_SIZE - size] = L'\0'; + } + } + + wcscat(data, L"\\0"); + size -= 2; +} + + +void GetMetadata(extendedFileInfoStruct *efi, char *field, WCHAR *data, size_t &size) +{ + efi->ret[0] = '\0'; + efi->metadata = field; + if (SendMessage(plugin.hwndParent, WM_WA_IPC, (WPARAM) efi, IPC_GET_EXTENDED_FILE_INFO_HOOKABLE) && efi->ret[0] != '\0') + { + Concat(data, size, efi->ret); + } + else + { + Concat(data, size, NULL); + } +} + + +void SendDataToMiranda(char *filename, char *title) +{ + extendedFileInfoStruct efi; + char tmp[256]; + + efi.ret = tmp; + efi.retlen = sizeof(tmp); + efi.filename = filename; + + WCHAR data[DATA_SIZE]; + size_t size = DATA_SIZE; + data[0] = L'\0'; + + // L"<Status 0-stoped 1-playing>\\0<Player>\\0<Type>\\0<Title>\\0<Artist>\\0<Album>\\0<Track>\\0<Year>\\0<Genre>\\0<Length (secs)>\\0\\0" + Concat(data, size, "1"); + Concat(data, size, "Winamp"); + + int version = SendMessage(plugin.hwndParent, WM_WA_IPC, 0, IPC_GETVERSION); + BOOL is_radio = (strstr(filename, "://") != 0) && (strncmp(filename, "cda://", 6) != 0); + + if (is_radio) + Concat(data, size, "Radio"); + else if (WINAMP_VERSION_MAJOR(version) >= 5 && SendMessage(plugin.hwndParent, WM_WA_IPC, 0, IPC_IS_PLAYING_VIDEO)) + Concat(data, size, "Video"); + else + Concat(data, size, "Music"); + + efi.ret[0] = '\0'; + efi.metadata = "TITLE"; + if (SendMessage(plugin.hwndParent, WM_WA_IPC, (WPARAM) &efi, IPC_GET_EXTENDED_FILE_INFO_HOOKABLE) && efi.ret[0] != '\0') + { + Concat(data, size, efi.ret); + } + else if (title != NULL && title[0] != '\0' && strcmpi(title, filename) != 0) + { + Concat(data, size, title); + } + else + { + char *name = strrchr(filename, '\\'); + if (name == NULL) + strrchr(filename, '/'); + + if (name == NULL) + { + Concat(data, size, NULL); + } + else + { + char *dot = strrchr(name, '.'); + Concat(data, size, name + 1, dot == NULL ? 0 : dot - name - 1); + } + } + + GetMetadata(&efi, "ARTIST", data, size); + GetMetadata(&efi, "ALBUM", data, size); + GetMetadata(&efi, "TRACK", data, size); + GetMetadata(&efi, "YEAR", data, size); + GetMetadata(&efi, "GENRE", data, size); + + efi.ret[0] = '\0'; + efi.metadata = "LENGTH"; + if (SendMessage(plugin.hwndParent, WM_WA_IPC, (WPARAM) &efi, IPC_GET_EXTENDED_FILE_INFO_HOOKABLE) + && efi.ret[0] != '\0' && efi.ret[1] != '\0') + { + char tmp[10]; + itoa(atoi(efi.ret) / 1000, tmp, 10); + Concat(data, size, tmp); + } + else + { + Concat(data, size, NULL); + } + Concat(data, size, NULL); + + SendData(data); +} + + +// Message window proc +LRESULT CALLBACK MsgWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + static BOOL last_was_stop = TRUE; + static DWORD last_notification = 0; + static char last_filename[1024] = {0}; + + switch(message) + { + case WM_TIMER: + { + KillTimer(hwnd, wParam); + + if (wParam == 0) + { + // Startup + if (plugin.hwndParent == NULL) + { + plugin.hwndParent = FindWindow("Winamp v1.x", NULL); + if (plugin.hwndParent != NULL) + { + init(); + + // If playing, show current song + if (SendMessage(plugin.hwndParent, WM_WA_IPC, 0, IPC_ISPLAYING) == 1) + if (FindWindow(MIRANDA_WINDOWCLASS, NULL) != NULL) + SetTimer(hMsgWnd, 1, 500, NULL); + } + } + } + else if (wParam == 1) + { + // Song change + if (SendMessage(plugin.hwndParent, WM_WA_IPC, 0, IPC_ISPLAYING) == 1) + { + int track = SendMessage(plugin.hwndParent, WM_WA_IPC, 0, IPC_GETLISTPOS); + char *filename = (char *) SendMessage(plugin.hwndParent, WM_WA_IPC, track, IPC_GETPLAYLISTFILE); + + if (filename == NULL || filename[0] == '\0') + { + if (!last_was_stop) + { + last_was_stop = TRUE; + + if (FindWindow(MIRANDA_WINDOWCLASS, NULL) != NULL) + SendData(L"0\\0Winamp\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0"); + } + } + else + { + BOOL is_radio = (strstr(filename, "://") != 0); + if (last_was_stop || is_radio || strcmpi(last_filename, filename) != 0) + { + last_was_stop = FALSE; + strncpy(last_filename, filename, sizeof(last_filename)); + last_filename[sizeof(last_filename) - 1] = '\0'; + + // Miranda is running? + if (FindWindow(MIRANDA_WINDOWCLASS, NULL) != NULL) + SendDataToMiranda(last_filename, (char *) SendMessage(plugin.hwndParent, WM_WA_IPC, track, IPC_GETPLAYLISTTITLE)); + + if (is_radio) + // To try to get info from radio stations + SetTimer(hMsgWnd, 1, 3000, NULL); + } + } + } + else + { + if (!last_was_stop) + { + last_was_stop = TRUE; + + if (FindWindow(MIRANDA_WINDOWCLASS, NULL) != NULL) + SendData(L"0\\0Winamp\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0"); + } + } + } + + break; + } + } + + return DefWindowProc(hwnd, message, wParam, lParam); +} + +// Playlist window message processor +LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + switch(message) + { + case WM_USER: + { + if(wParam == WA_STATE_CHANGE) + { + int type = HIWORD(lParam); + if(type == 0x4000 || type == 0) + { + KillTimer(hMsgWnd, 1); + SetTimer(hMsgWnd, 1, 1000, NULL); + } + } + break; + } + } + + return CallWindowProc(oldWndProc, hwnd, message, wParam, lParam); +} + + +LRESULT CALLBACK MainWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + switch(message) + { + case WM_COMMAND: + { + switch(wParam) + { + case 40045: // Play + case 40046: // Pause + { + KillTimer(hMsgWnd, 1); + SetTimer(hMsgWnd, 1, 500, NULL); + break; + } + } + break; + } + case WM_WA_IPC: + { + switch(lParam) + { + case IPC_PLAYING_FILE: + { + KillTimer(hMsgWnd, 1); + SetTimer(hMsgWnd, 1, 500, NULL); + break; + } + } + break; + } + case WM_CLOSE: + { + PostMessage(hMsgWnd, WM_TIMER, 1, 0); + PostMessage(hMsgWnd, WM_CLOSE, 0, 0); + break; + } + } + + return CallWindowProc(oldMainWndProc, hwnd, message, wParam, lParam); +} + + +void quit() +{ + if (oldMainWndProc != NULL) + SetWindowLongPtr(plugin.hwndParent, GWLP_WNDPROC, (LONG_PTR) oldMainWndProc); + + if (oldWndProc != NULL) + SetWindowLongPtr(hPlWnd, GWLP_WNDPROC, (LONG_PTR) oldWndProc); + + if (FindWindow(MIRANDA_WINDOWCLASS, NULL) != NULL) + SendData(L"0\\0Winamp\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0"); + +} + + +int init() +{ + KillTimer(hMsgWnd, 0); + + oldMainWndProc = (WNDPROC)SetWindowLongPtr(plugin.hwndParent, GWLP_WNDPROC, (LONG_PTR) MainWndProc); + + hPlWnd = (HWND) SendMessage(plugin.hwndParent, WM_WA_IPC, IPC_GETWND_PE, IPC_GETWND); + oldWndProc = (WNDPROC) SetWindowLongPtr(hPlWnd, GWLP_WNDPROC, (LONG_PTR)WndProc); + + return 0; +} + +void config() { + MessageBox(NULL, _T("Copyright (C) 2006 Ricardo Pescuma Domenecci"), _T("Miranda ListeningTo Winamp Plugin"), 0); +} diff --git a/plugins/ListeningTo/src/players/winamp_mlt/mlt_winamp_10.def b/plugins/ListeningTo/src/players/winamp_mlt/mlt_winamp_10.def new file mode 100644 index 0000000000..bd6c52c572 --- /dev/null +++ b/plugins/ListeningTo/src/players/winamp_mlt/mlt_winamp_10.def @@ -0,0 +1,4 @@ +DESCRIPTION 'Miranda ListeningTo Winamp Plugin'
+
+EXPORTS
+ winampGetGeneralPurposePlugin
diff --git a/plugins/ListeningTo/src/players/winamp_mlt/mlt_winamp_10.vcxproj b/plugins/ListeningTo/src/players/winamp_mlt/mlt_winamp_10.vcxproj new file mode 100644 index 0000000000..40a8705def --- /dev/null +++ b/plugins/ListeningTo/src/players/winamp_mlt/mlt_winamp_10.vcxproj @@ -0,0 +1,155 @@ +<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectName>ListeningTo_winamp_mlt</ProjectName>
+ <ProjectGuid>{8BBB15B7-D08B-475A-A58C-0C71D39FADB8}</ProjectGuid>
+ <RootNamespace>gen_mlt</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseOfMfc>false</UseOfMfc>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseOfMfc>false</UseOfMfc>
+ <UseOfAtl>false</UseOfAtl>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup>
+ <_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\Plugins\Listeningto\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\Obj\$(ProjectName)\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\Plugins\Listeningto\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\Obj\$(ProjectName)\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
+ <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">gen_mlt</TargetName>
+ <TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">gen_mlt</TargetName>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Midl>
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MkTypLibCompatible>true</MkTypLibCompatible>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <TargetEnvironment>Win32</TargetEnvironment>
+ <TypeLibraryName>.\Debug/mlt_winamp_9.tlb</TypeLibraryName>
+ <HeaderFileName>
+ </HeaderFileName>
+ </Midl>
+ <ClCompile>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MinimalRebuild>true</MinimalRebuild>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <AssemblerListingLocation>
+ </AssemblerListingLocation>
+ <ObjectFileName>$(IntDir)</ObjectFileName>
+ <ProgramDataBaseFileName>$(IntDir)</ProgramDataBaseFileName>
+ <BrowseInformation>true</BrowseInformation>
+ <WarningLevel>Level3</WarningLevel>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
+ <DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <AdditionalIncludeDirectories>..\..\..\ExternalAPI</AdditionalIncludeDirectories>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <Culture>0x0416</Culture>
+ </ResourceCompile>
+ <Link>
+ <ModuleDefinitionFile>
+ </ModuleDefinitionFile>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <RandomizedBaseAddress>false</RandomizedBaseAddress>
+ <DataExecutionPrevention>
+ </DataExecutionPrevention>
+ <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
+ <TargetMachine>MachineX86</TargetMachine>
+ <AdditionalLibraryDirectories>$(SolutionDir)\lib</AdditionalLibraryDirectories>
+ </Link>
+ <Bscmake>
+ <OutputFile>$(OutDir)$(TargetName).bsc</OutputFile>
+ </Bscmake>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Midl>
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MkTypLibCompatible>true</MkTypLibCompatible>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <TargetEnvironment>Win32</TargetEnvironment>
+ <TypeLibraryName>.\Release/mlt_winamp_9.tlb</TypeLibraryName>
+ <HeaderFileName>
+ </HeaderFileName>
+ </Midl>
+ <ClCompile>
+ <Optimization>MaxSpeed</Optimization>
+ <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
+ <PreprocessorDefinitions>NDEBUG;_WINDOWS;_USRDLL;MLT_WINAMP_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <StringPooling>true</StringPooling>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <AssemblerListingLocation>
+ </AssemblerListingLocation>
+ <ObjectFileName>$(IntDir)</ObjectFileName>
+ <ProgramDataBaseFileName>$(IntDir)</ProgramDataBaseFileName>
+ <WarningLevel>Level3</WarningLevel>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <AdditionalIncludeDirectories>..\..\..\..\ExternalAPI</AdditionalIncludeDirectories>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <Culture>0x0416</Culture>
+ </ResourceCompile>
+ <Link>
+ <ModuleDefinitionFile>
+ </ModuleDefinitionFile>
+ <RandomizedBaseAddress>false</RandomizedBaseAddress>
+ <DataExecutionPrevention>
+ </DataExecutionPrevention>
+ <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
+ <TargetMachine>MachineX86</TargetMachine>
+ <GenerateDebugInformation>
+ </GenerateDebugInformation>
+ <AdditionalLibraryDirectories>$(SolutionDir)\lib</AdditionalLibraryDirectories>
+ </Link>
+ <Bscmake>
+ <OutputFile>$(OutDir)$(TargetName).bsc</OutputFile>
+ </Bscmake>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClCompile Include="mlt_winamp.cpp">
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="mlt_winamp.def" />
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
\ No newline at end of file diff --git a/plugins/ListeningTo/src/players/winamp_mlt/mlt_winamp_10.vcxproj.filters b/plugins/ListeningTo/src/players/winamp_mlt/mlt_winamp_10.vcxproj.filters new file mode 100644 index 0000000000..a6c1ed4343 --- /dev/null +++ b/plugins/ListeningTo/src/players/winamp_mlt/mlt_winamp_10.vcxproj.filters @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{cad9b2cf-439e-451d-958b-6dc6785718c5}</UniqueIdentifier>
+ <Extensions>cpp;c;cxx;rc;def;r;odl;idl;hpj;bat</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{344f8c05-4e5d-4161-8302-4f70b02998b1}</UniqueIdentifier>
+ <Extensions>h;hpp;hxx;hm;inl</Extensions>
+ </Filter>
+ <Filter Include="Resource Files">
+ <UniqueIdentifier>{5b68c6e2-f572-4488-8593-92c99a0943e2}</UniqueIdentifier>
+ <Extensions>ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="mlt_winamp.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="mlt_winamp.def">
+ <Filter>Source Files</Filter>
+ </None>
+ </ItemGroup>
+</Project>
\ No newline at end of file diff --git a/plugins/ListeningTo/src/players/winamp_mlt/mlt_winamp_12.vcxproj b/plugins/ListeningTo/src/players/winamp_mlt/mlt_winamp_12.vcxproj new file mode 100644 index 0000000000..a4f73242ca --- /dev/null +++ b/plugins/ListeningTo/src/players/winamp_mlt/mlt_winamp_12.vcxproj @@ -0,0 +1,155 @@ +<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectName>ListeningTo_winamp_mlt</ProjectName>
+ <ProjectGuid>{8BBB15B7-D08B-475A-A58C-0C71D39FADB8}</ProjectGuid>
+ <RootNamespace>gen_mlt</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseOfMfc>false</UseOfMfc>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseOfMfc>false</UseOfMfc>
+ <UseOfAtl>false</UseOfAtl>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup>
+ <_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\Plugins\Listeningto\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\Obj\$(ProjectName)\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\Plugins\Listeningto\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\Obj\$(ProjectName)\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
+ <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">gen_mlt</TargetName>
+ <TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">gen_mlt</TargetName>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Midl>
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MkTypLibCompatible>true</MkTypLibCompatible>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <TargetEnvironment>Win32</TargetEnvironment>
+ <TypeLibraryName>.\Debug/mlt_winamp_9.tlb</TypeLibraryName>
+ <HeaderFileName>
+ </HeaderFileName>
+ </Midl>
+ <ClCompile>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MinimalRebuild>true</MinimalRebuild>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <AssemblerListingLocation>
+ </AssemblerListingLocation>
+ <ObjectFileName>$(IntDir)</ObjectFileName>
+ <ProgramDataBaseFileName>$(IntDir)</ProgramDataBaseFileName>
+ <BrowseInformation>true</BrowseInformation>
+ <WarningLevel>Level3</WarningLevel>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
+ <DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <AdditionalIncludeDirectories>..\..\..\ExternalAPI</AdditionalIncludeDirectories>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <Culture>0x0416</Culture>
+ </ResourceCompile>
+ <Link>
+ <ModuleDefinitionFile>
+ </ModuleDefinitionFile>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <RandomizedBaseAddress>false</RandomizedBaseAddress>
+ <DataExecutionPrevention>
+ </DataExecutionPrevention>
+ <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
+ <TargetMachine>MachineX86</TargetMachine>
+ <AdditionalLibraryDirectories>$(SolutionDir)\lib</AdditionalLibraryDirectories>
+ </Link>
+ <Bscmake>
+ <OutputFile>$(OutDir)$(TargetName).bsc</OutputFile>
+ </Bscmake>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Midl>
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MkTypLibCompatible>true</MkTypLibCompatible>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <TargetEnvironment>Win32</TargetEnvironment>
+ <TypeLibraryName>.\Release/mlt_winamp_9.tlb</TypeLibraryName>
+ <HeaderFileName>
+ </HeaderFileName>
+ </Midl>
+ <ClCompile>
+ <Optimization>MaxSpeed</Optimization>
+ <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
+ <PreprocessorDefinitions>NDEBUG;_WINDOWS;_USRDLL;MLT_WINAMP_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <StringPooling>true</StringPooling>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <AssemblerListingLocation>
+ </AssemblerListingLocation>
+ <ObjectFileName>$(IntDir)</ObjectFileName>
+ <ProgramDataBaseFileName>$(IntDir)</ProgramDataBaseFileName>
+ <WarningLevel>Level3</WarningLevel>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <AdditionalIncludeDirectories>..\..\..\..\ExternalAPI</AdditionalIncludeDirectories>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <Culture>0x0416</Culture>
+ </ResourceCompile>
+ <Link>
+ <ModuleDefinitionFile>
+ </ModuleDefinitionFile>
+ <RandomizedBaseAddress>false</RandomizedBaseAddress>
+ <DataExecutionPrevention>
+ </DataExecutionPrevention>
+ <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
+ <TargetMachine>MachineX86</TargetMachine>
+ <GenerateDebugInformation>
+ </GenerateDebugInformation>
+ <AdditionalLibraryDirectories>$(SolutionDir)\lib</AdditionalLibraryDirectories>
+ </Link>
+ <Bscmake>
+ <OutputFile>$(OutDir)$(TargetName).bsc</OutputFile>
+ </Bscmake>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClCompile Include="mlt_winamp.cpp">
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="mlt_winamp.def" />
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
\ No newline at end of file diff --git a/plugins/ListeningTo/src/players/winamp_mlt/mlt_winamp_14.vcxproj b/plugins/ListeningTo/src/players/winamp_mlt/mlt_winamp_14.vcxproj new file mode 100644 index 0000000000..b51fa069a3 --- /dev/null +++ b/plugins/ListeningTo/src/players/winamp_mlt/mlt_winamp_14.vcxproj @@ -0,0 +1,155 @@ +<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectName>ListeningTo_winamp_mlt</ProjectName>
+ <ProjectGuid>{8BBB15B7-D08B-475A-A58C-0C71D39FADB8}</ProjectGuid>
+ <RootNamespace>gen_mlt</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseOfMfc>false</UseOfMfc>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseOfMfc>false</UseOfMfc>
+ <UseOfAtl>false</UseOfAtl>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup>
+ <_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\Plugins\Listeningto\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\Obj\$(ProjectName)\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\Plugins\Listeningto\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\Obj\$(ProjectName)\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
+ <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">gen_mlt</TargetName>
+ <TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">gen_mlt</TargetName>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Midl>
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MkTypLibCompatible>true</MkTypLibCompatible>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <TargetEnvironment>Win32</TargetEnvironment>
+ <TypeLibraryName>.\Debug/mlt_winamp_9.tlb</TypeLibraryName>
+ <HeaderFileName>
+ </HeaderFileName>
+ </Midl>
+ <ClCompile>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MinimalRebuild>true</MinimalRebuild>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <AssemblerListingLocation>
+ </AssemblerListingLocation>
+ <ObjectFileName>$(IntDir)</ObjectFileName>
+ <ProgramDataBaseFileName>$(IntDir)</ProgramDataBaseFileName>
+ <BrowseInformation>true</BrowseInformation>
+ <WarningLevel>Level3</WarningLevel>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
+ <DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <AdditionalIncludeDirectories>..\..\..\ExternalAPI</AdditionalIncludeDirectories>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <Culture>0x0416</Culture>
+ </ResourceCompile>
+ <Link>
+ <ModuleDefinitionFile>
+ </ModuleDefinitionFile>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <RandomizedBaseAddress>false</RandomizedBaseAddress>
+ <DataExecutionPrevention>
+ </DataExecutionPrevention>
+ <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
+ <TargetMachine>MachineX86</TargetMachine>
+ <AdditionalLibraryDirectories>$(SolutionDir)\lib</AdditionalLibraryDirectories>
+ </Link>
+ <Bscmake>
+ <OutputFile>$(OutDir)$(TargetName).bsc</OutputFile>
+ </Bscmake>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Midl>
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MkTypLibCompatible>true</MkTypLibCompatible>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <TargetEnvironment>Win32</TargetEnvironment>
+ <TypeLibraryName>.\Release/mlt_winamp_9.tlb</TypeLibraryName>
+ <HeaderFileName>
+ </HeaderFileName>
+ </Midl>
+ <ClCompile>
+ <Optimization>MaxSpeed</Optimization>
+ <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
+ <PreprocessorDefinitions>NDEBUG;_WINDOWS;_USRDLL;MLT_WINAMP_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <StringPooling>true</StringPooling>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <AssemblerListingLocation>
+ </AssemblerListingLocation>
+ <ObjectFileName>$(IntDir)</ObjectFileName>
+ <ProgramDataBaseFileName>$(IntDir)</ProgramDataBaseFileName>
+ <WarningLevel>Level3</WarningLevel>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <AdditionalIncludeDirectories>..\..\..\..\ExternalAPI</AdditionalIncludeDirectories>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <Culture>0x0416</Culture>
+ </ResourceCompile>
+ <Link>
+ <ModuleDefinitionFile>
+ </ModuleDefinitionFile>
+ <RandomizedBaseAddress>false</RandomizedBaseAddress>
+ <DataExecutionPrevention>
+ </DataExecutionPrevention>
+ <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
+ <TargetMachine>MachineX86</TargetMachine>
+ <GenerateDebugInformation>
+ </GenerateDebugInformation>
+ <AdditionalLibraryDirectories>$(SolutionDir)\lib</AdditionalLibraryDirectories>
+ </Link>
+ <Bscmake>
+ <OutputFile>$(OutDir)$(TargetName).bsc</OutputFile>
+ </Bscmake>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClCompile Include="mlt_winamp.cpp">
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="mlt_winamp.def" />
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
\ No newline at end of file diff --git a/plugins/ListeningTo/src/players/winamp_mlt/wa_ipc.h b/plugins/ListeningTo/src/players/winamp_mlt/wa_ipc.h new file mode 100644 index 0000000000..0c6c16d39e --- /dev/null +++ b/plugins/ListeningTo/src/players/winamp_mlt/wa_ipc.h @@ -0,0 +1,2470 @@ +/*
+** Copyright (C) 1997-2008 Nullsoft, Inc.
+**
+** This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held
+** liable for any damages arising from the use of this software.
+**
+** Permission is granted to anyone to use this software for any purpose, including commercial applications, and to
+** alter it and redistribute it freely, subject to the following restrictions:
+**
+** 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software.
+** If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
+**
+** 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
+**
+** 3. This notice may not be removed or altered from any source distribution.
+**
+*/
+
+#ifndef _WA_IPC_H_
+#define _WA_IPC_H_
+
+#include <windows.h>
+#include <stddef.h>
+#if (_MSC_VER <= 1200)
+typedef int intptr_t;
+#endif
+/*
+** This is the modern replacement for the classic 'frontend.h'. Most of these
+** updates are designed for in-process use, i.e. from a plugin.
+**
+*/
+
+/* Most of the IPC_* messages involve sending the message in the form of:
+** result = SendMessage(hwnd_winamp,WM_WA_IPC,(parameter),IPC_*);
+** Where different then this is specified (typically with WM_COPYDATA variants)
+**
+** When you use SendMessage(hwnd_winamp,WM_WA_IPC,(parameter),IPC_*) and specify a IPC_*
+** which is not currently implemented/supported by the Winamp version being used then it
+** will return 1 for 'result'. This is a good way of helping to check if an api being
+** used which returns a function pointer, etc is even going to be valid.
+*/
+
+#define WM_WA_IPC WM_USER
+
+#define WINAMP_VERSION_MAJOR(winampVersion) ((winampVersion & 0x0000FF00) >> 12)
+#define WINAMP_VERSION_MINOR(winampVersion) (winampVersion & 0x000000FF) // returns, i.e. 0x12 for 5.12 and 0x10 for 5.1...
+
+
+#define IPC_GETVERSION 0
+/* int version = SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETVERSION);
+**
+** The version returned will be 0x20yx for Winamp 2.yx.
+** Versions previous to Winamp 2.0 typically (but not always) use 0x1zyx for 1.zx.
+** Just a bit weird but that's the way it goes.
+**
+** For Winamp 5.x it uses the format 0x50yx for Winamp 5.yx
+** e.g. 5.01 -> 0x5001
+** 5.09 -> 0x5009
+** 5.1 -> 0x5010
+**
+** Notes: For 5.02 this api will return the same value as for a 5.01 build.
+** For 5.07 this api will return the same value as for a 5.06 build.
+*/
+
+
+#define IPC_GETVERSIONSTRING 1
+
+
+#define IPC_GETREGISTEREDVERSION 770
+/* (requires Winamp 5.0+)
+** SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETREGISTEREDVERSION);
+**
+** This will open the Winamp Preferences and show the Winamp Pro page.
+*/
+
+
+typedef struct {
+ const char *filename;
+ const char *title;
+ int length;
+} enqueueFileWithMetaStruct; // send this to a IPC_PLAYFILE in a non WM_COPYDATA,
+// and you get the nice desired result. if title is NULL, it is treated as a "thing",
+// otherwise it's assumed to be a file (for speed)
+
+typedef struct {
+ const wchar_t *filename;
+ const wchar_t *title;
+ int length;
+} enqueueFileWithMetaStructW;
+
+#define IPC_PLAYFILE 100 // dont be fooled, this is really the same as enqueufile
+#define IPC_ENQUEUEFILE 100
+#define IPC_PLAYFILEW 1100
+#define IPC_ENQUEUEFILEW 1100
+/* This is sent as a WM_COPYDATA with IPC_PLAYFILE as the dwData member and the string
+** of the file / playlist to be enqueued into the playlist editor as the lpData member.
+** This will just enqueue the file or files since you can use this to enqueue a playlist.
+** It will not clear the current playlist or change the playback state.
+**
+** COPYDATASTRUCT cds = {0};
+** cds.dwData = IPC_ENQUEUEFILE;
+** cds.lpData = (void*)"c:\\test\\folder\\test.mp3";
+** cds.cbData = lstrlen((char*)cds.lpData)+1; // include space for null char
+** SendMessage(hwnd_winamp,WM_COPYDATA,0,(LPARAM)&cds);
+**
+**
+** With 2.9+ and all of the 5.x versions you can send this as a normal WM_WA_IPC
+** (non WM_COPYDATA) with an enqueueFileWithMetaStruct as the param.
+** If the title member is null then it is treated as a "thing" otherwise it will be
+** assumed to be a file (for speed).
+**
+** enqueueFileWithMetaStruct eFWMS = {0};
+** eFWMS.filename = "c:\\test\\folder\\test.mp3";
+** eFWMS.title = "Whipping Good";
+** eFWMS.length = 300; // this is the number of seconds for the track
+** SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)&eFWMS,IPC_ENQUEUEFILE);
+*/
+
+
+#define IPC_DELETE 101
+#define IPC_DELETE_INT 1101
+/* SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_DELETE);
+** Use this api to clear Winamp's internal playlist.
+** You should not need to use IPC_DELETE_INT since it is used internally by Winamp when
+** it is dealing with some lame Windows Explorer issues (hard to believe that!).
+*/
+
+
+#define IPC_STARTPLAY 102
+#define IPC_STARTPLAY_INT 1102
+/* SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_STARTPLAY);
+** Sending this will start playback and is almost the same as hitting the play button.
+** The IPC_STARTPLAY_INT version is used internally and you should not need to use it
+** since it won't be any fun.
+*/
+
+
+#define IPC_CHDIR 103
+/* This is sent as a WM_COPYDATA type message with IPC_CHDIR as the dwData value and the
+** directory you want to change to as the lpData member.
+**
+** COPYDATASTRUCT cds = {0};
+** cds.dwData = IPC_CHDIR;
+** cds.lpData = (void*)"c:\\download";
+** cds.cbData = lstrlen((char*)cds.lpData)+1; // include space for null char
+** SendMessage(hwnd_winamp,WM_COPYDATA,0,(LPARAM)&cds);
+**
+** The above example will make Winamp change to the directory 'C:\download'.
+*/
+
+
+#define IPC_ISPLAYING 104
+/* int res = SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_ISPLAYING);
+** This is sent to retrieve the current playback state of Winamp.
+** If it returns 1, Winamp is playing.
+** If it returns 3, Winamp is paused.
+** If it returns 0, Winamp is not playing.
+*/
+
+
+#define IPC_GETOUTPUTTIME 105
+/* int res = SendMessage(hwnd_winamp,WM_WA_IPC,mode,IPC_GETOUTPUTTIME);
+** This api can return two different sets of information about current playback status.
+**
+** If mode = 0 then it will return the position (in ms) of the currently playing track.
+** Will return -1 if Winamp is not playing.
+**
+** If mode = 1 then it will return the current track length (in seconds).
+** Will return -1 if there are no tracks (or possibly if Winamp cannot get the length).
+**
+** If mode = 2 then it will return the current track length (in milliseconds).
+** Will return -1 if there are no tracks (or possibly if Winamp cannot get the length).
+*/
+
+
+#define IPC_JUMPTOTIME 106
+/* (requires Winamp 1.60+)
+** SendMessage(hwnd_winamp,WM_WA_IPC,ms,IPC_JUMPTOTIME);
+** This api sets the current position (in milliseconds) for the currently playing song.
+** The resulting playback position may only be an approximate time since some playback
+** formats do not provide exact seeking e.g. mp3
+** This returns -1 if Winamp is not playing, 1 on end of file, or 0 if it was successful.
+*/
+
+
+#define IPC_GETMODULENAME 109
+#define IPC_EX_ISRIGHTEXE 666
+/* usually shouldnt bother using these, but here goes:
+** send a WM_COPYDATA with IPC_GETMODULENAME, and an internal
+** flag gets set, which if you send a normal WM_WA_IPC message with
+** IPC_EX_ISRIGHTEXE, it returns whether or not that filename
+** matches. lame, I know.
+*/
+
+
+#define IPC_WRITEPLAYLIST 120
+/* (requires Winamp 1.666+)
+** int cur = SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_WRITEPLAYLIST);
+**
+** IPC_WRITEPLAYLIST will write the current playlist to '<winampdir>\\Winamp.m3u' and
+** will also return the current playlist position (see IPC_GETLISTPOS).
+**
+** This is kinda obsoleted by some of the newer 2.x api items but it still is good for
+** use with a front-end program (instead of a plug-in) and you want to see what is in the
+** current playlist.
+**
+** This api will only save out extended file information in the #EXTINF entry if Winamp
+** has already read the data such as if the file was played of scrolled into view. If
+** Winamp has not read the data then you will only find the file with its filepath entry
+** (as is the base requirements for a m3u playlist).
+*/
+
+
+#define IPC_SETPLAYLISTPOS 121
+/* (requires Winamp 2.0+)
+** SendMessage(hwnd_winamp,WM_WA_IPC,position,IPC_SETPLAYLISTPOS)
+** IPC_SETPLAYLISTPOS sets the playlist position to the specified 'position'.
+** It will not change playback status or anything else. It will just set the current
+** position in the playlist and will update the playlist view if necessary.
+**
+** If you use SendMessage(hwnd_winamp,WM_COMMAND,MAKEWPARAM(WINAMP_BUTTON2,0),0);
+** after using IPC_SETPLAYLISTPOS then Winamp will start playing the file at 'position'.
+*/
+
+
+#define IPC_SETVOLUME 122
+/* (requires Winamp 2.0+)
+** SendMessage(hwnd_winamp,WM_WA_IPC,volume,IPC_SETVOLUME);
+** IPC_SETVOLUME sets the volume of Winamp (between the range of 0 to 255).
+**
+** If you pass 'volume' as -666 then the message will return the current volume.
+** int curvol = SendMessage(hwnd_winamp,WM_WA_IPC,-666,IPC_SETVOLUME);
+*/
+
+
+#define IPC_GETVOLUME(hwnd_winamp) SendMessage(hwnd_winamp,WM_WA_IPC,-666,IPC_SETVOLUME)
+/* (requires Winamp 2.0+)
+** int curvol = IPC_GETVOLUME(hwnd_winamp);
+** This will return the current volume of Winamp or
+*/
+
+
+#define IPC_SETPANNING 123
+/* (requires Winamp 2.0+)
+** SendMessage(hwnd_winamp,WM_WA_IPC,panning,IPC_SETPANNING);
+** IPC_SETPANNING sets the panning of Winamp from 0 (left) to 255 (right).
+**
+** At least in 5.x+ this works from -127 (left) to 127 (right).
+**
+** If you pass 'panning' as -666 to this api then it will return the current panning.
+** int curpan = SendMessage(hwnd_winamp,WM_WA_IPC,-666,IPC_SETPANNING);
+*/
+
+
+#define IPC_GETLISTLENGTH 124
+/* (requires Winamp 2.0+)
+** int length = SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETLISTLENGTH);
+** IPC_GETLISTLENGTH returns the length of the current playlist as the number of tracks.
+*/
+
+
+#define IPC_GETLISTPOS 125
+/* (requires Winamp 2.05+)
+** int pos=SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETLISTPOS);
+** IPC_GETLISTPOS returns the current playlist position (which is shown in the playlist
+** editor as a differently coloured text entry e.g is yellow for the classic skin).
+**
+** This api is a lot like IPC_WRITEPLAYLIST but a lot faster since it does not have to
+** write out the whole of the current playlist first.
+*/
+
+
+#define IPC_GETINFO 126
+/* (requires Winamp 2.05+)
+** int inf=SendMessage(hwnd_winamp,WM_WA_IPC,mode,IPC_GETINFO);
+** IPC_GETINFO returns info about the current playing song. The value
+** it returns depends on the value of 'mode'.
+** Mode Meaning
+** ------------------
+** 0 Samplerate, in kilohertz (i.e. 44)
+** 1 Bitrate (i.e. 128)
+** 2 Channels (i.e. 2)
+** 3 (5+) Video LOWORD=w HIWORD=h
+** 4 (5+) > 65536, string (video description)
+** 5 (5.25+) Samplerate, in hertz (i.e. 44100)
+*/
+
+
+#define IPC_GETEQDATA 127
+/* (requires Winamp 2.05+)
+** int data=SendMessage(hwnd_winamp,WM_WA_IPC,pos,IPC_GETEQDATA);
+** IPC_GETEQDATA queries the status of the EQ.
+** The value returned depends on what 'pos' is set to:
+** Value Meaning
+** ------------------
+** 0-9 The 10 bands of EQ data. 0-63 (+20db - -20db)
+** 10 The preamp value. 0-63 (+20db - -20db)
+** 11 Enabled. zero if disabled, nonzero if enabled.
+** 12 Autoload. zero if disabled, nonzero if enabled.
+*/
+
+
+#define IPC_SETEQDATA 128
+/* (requires Winamp 2.05+)
+** SendMessage(hwnd_winamp,WM_WA_IPC,pos,IPC_GETEQDATA);
+** SendMessage(hwnd_winamp,WM_WA_IPC,value,IPC_SETEQDATA);
+** IPC_SETEQDATA sets the value of the last position retrieved
+** by IPC_GETEQDATA. This is pretty lame, and we should provide
+** an extended version that lets you do a MAKELPARAM(pos,value).
+** someday...
+
+ new (2.92+):
+ if the high byte is set to 0xDB, then the third byte specifies
+ which band, and the bottom word specifies the value.
+*/
+
+
+#define IPC_ADDBOOKMARK 129
+#define IPC_ADDBOOKMARKW 131
+/* (requires Winamp 2.4+)
+** This is sent as a WM_COPYDATA using IPC_ADDBOOKMARK as the dwData value and the
+** directory you want to change to as the lpData member. This will add the specified
+** file / url to the Winamp bookmark list.
+**
+** COPYDATASTRUCT cds = {0};
+** cds.dwData = IPC_ADDBOOKMARK;
+** cds.lpData = (void*)"http://www.blah.com/listen.pls";
+** cds.cbData = lstrlen((char*)cds.lpData)+1; // include space for null char
+** SendMessage(hwnd_winamp,WM_COPYDATA,0,(LPARAM)&cds);
+**
+**
+** In Winamp 5.0+ we use this as a normal WM_WA_IPC and the string is null separated as
+** the filename and then the title of the entry.
+**
+** SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)(char*)"filename\0title\0",IPC_ADDBOOKMARK);
+**
+** This will notify the library / bookmark editor that a bookmark was added.
+** Note that using this message in this context does not actually add the bookmark.
+** Do not use, it is essentially just a notification type message :)
+*/
+
+
+#define IPC_INSTALLPLUGIN 130
+/* This is not implemented (and is very unlikely to be done due to safety concerns).
+** If it was then you could do a WM_COPYDATA with a path to a .wpz and it would then
+** install the plugin for you.
+**
+** COPYDATASTRUCT cds = {0};
+** cds.dwData = IPC_INSTALLPLUGIN;
+** cds.lpData = (void*)"c:\\path\\to\\file.wpz";
+** cds.cbData = lstrlen((char*)cds.lpData)+1; // include space for null char
+** SendMessage(hwnd_winamp,WM_COPYDATA,0,(LPARAM)&cds);
+*/
+
+
+#define IPC_RESTARTWINAMP 135
+/* (requires Winamp 2.2+)
+** SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_RESTARTWINAMP);
+** IPC_RESTARTWINAMP will restart Winamp (isn't that obvious ? :) )
+** If this fails to make Winamp start after closing then there is a good chance one (or
+** more) of the currently installed plugins caused Winamp to crash on exit (either as a
+** silent crash or a full crash log report before it could call itself start again.
+*/
+
+
+#define IPC_ISFULLSTOP 400
+/* (requires winamp 2.7+ I think)
+** int ret=SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_ISFULLSTOP);
+** This is useful for when you're an output plugin and you want to see if the stop/close
+** happening is a full stop or if you are just between tracks. This returns non zero if
+** it is a full stop or zero if it is just a new track.
+** benski> i think it's actually the other way around -
+** !0 for EOF and 0 for user pressing stop
+*/
+
+
+#define IPC_INETAVAILABLE 242
+/* (requires Winamp 2.05+)
+** int val=SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_INETAVAILABLE);
+** IPC_INETAVAILABLE will return 1 if an Internet connection is available for Winamp and
+** relates to the internet connection type setting on the main general preferences page
+** in the Winamp preferences.
+*/
+
+
+#define IPC_UPDTITLE 243
+/* (requires Winamp 2.2+)
+** SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_UPDTITLE);
+** IPC_UPDTITLE will ask Winamp to update the information about the current title and
+** causes GetFileInfo(..) in the input plugin associated with the current playlist entry
+** to be called. This can be called such as when an input plugin is buffering a file so
+** that it can cause the buffer percentage to appear in the playlist.
+*/
+
+
+#define IPC_REFRESHPLCACHE 247
+/* (requires Winamp 2.2+)
+** SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_REFRESHPLCACHE);
+** IPC_REFRESHPLCACHE will flush the playlist cache buffer and you send this if you want
+** Winamp to go refetch the titles for all of the entries in the current playlist.
+**
+** 5.3+: pass a wchar_t * string in wParam, and it'll do a strnicmp() before clearing the cache
+*/
+
+
+#define IPC_GET_SHUFFLE 250
+/* (requires Winamp 2.4+)
+** int val=SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GET_SHUFFLE);
+** IPC_GET_SHUFFLE returns the status of the shuffle option.
+** If set then it will return 1 and if not set then it will return 0.
+*/
+
+
+#define IPC_GET_REPEAT 251
+/* (requires Winamp 2.4+)
+** int val=SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GET_REPEAT);
+** IPC_GET_REPEAT returns the status of the repeat option.
+** If set then it will return 1 and if not set then it will return 0.
+*/
+
+
+#define IPC_SET_SHUFFLE 252
+/* (requires Winamp 2.4+)
+** SendMessage(hwnd_winamp,WM_WA_IPC,value,IPC_SET_SHUFFLE);
+** IPC_SET_SHUFFLE sets the status of the shuffle option.
+** If 'value' is 1 then shuffle is turned on.
+** If 'value' is 0 then shuffle is turned off.
+*/
+
+
+#define IPC_SET_REPEAT 253
+/* (requires Winamp 2.4+)
+** SendMessage(hwnd_winamp,WM_WA_IPC,value,IPC_SET_REPEAT);
+** IPC_SET_REPEAT sets the status of the repeat option.
+** If 'value' is 1 then shuffle is turned on.
+** If 'value' is 0 then shuffle is turned off.
+*/
+
+
+#define IPC_ENABLEDISABLE_ALL_WINDOWS 259 // 0xdeadbeef to disable
+/* (requires Winamp 2.9+)
+** SendMessage(hwnd_winamp,WM_WA_IPC,(enable?0:0xdeadbeef),IPC_ENABLEDISABLE_ALL_WINDOWS);
+** Sending this message with 0xdeadbeef as the param will disable all winamp windows and
+** any other values will enable all of the Winamp windows again. When disabled you won't
+** get any response on clicking or trying to do anything to the Winamp windows. If the
+** taskbar icon is shown then you may still have control ;)
+*/
+
+
+#define IPC_GETWND 260
+/* (requires Winamp 2.9+)
+** HWND h=SendMessage(hwnd_winamp,WM_WA_IPC,IPC_GETWND_xxx,IPC_GETWND);
+** returns the HWND of the window specified.
+*/
+ #define IPC_GETWND_EQ 0 // use one of these for the param
+ #define IPC_GETWND_PE 1
+ #define IPC_GETWND_MB 2
+ #define IPC_GETWND_VIDEO 3
+#define IPC_ISWNDVISIBLE 261 // same param as IPC_GETWND
+
+
+/************************************************************************
+***************** in-process only (WE LOVE PLUGINS)
+************************************************************************/
+
+#define IPC_SETSKINW 199
+#define IPC_SETSKIN 200
+/* (requires Winamp 2.04+, only usable from plug-ins (not external apps))
+** SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)"skinname",IPC_SETSKIN);
+** IPC_SETSKIN sets the current skin to "skinname". Note that skinname
+** can be the name of a skin, a skin .zip file, with or without path.
+** If path isn't specified, the default search path is the winamp skins
+** directory.
+*/
+
+
+#define IPC_GETSKIN 201
+#define IPC_GETSKINW 1201
+/* (requires Winamp 2.04+, only usable from plug-ins (not external apps))
+** SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)skinname_buffer,IPC_GETSKIN);
+** IPC_GETSKIN puts the directory where skin bitmaps can be found
+** into skinname_buffer.
+** skinname_buffer must be MAX_PATH characters in length.
+** When using a .zip'd skin file, it'll return a temporary directory
+** where the ZIP was decompressed.
+*/
+
+
+#define IPC_EXECPLUG 202
+/* (requires Winamp 2.04+, only usable from plug-ins (not external apps))
+** SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)"vis_file.dll",IPC_EXECPLUG);
+** IPC_EXECPLUG executes a visualization plug-in pointed to by WPARAM.
+** the format of this string can be:
+** "vis_whatever.dll"
+** "vis_whatever.dll,0" // (first mod, file in winamp plug-in dir)
+** "C:\\dir\\vis_whatever.dll,1"
+*/
+
+
+#define IPC_GETPLAYLISTFILE 211
+#define IPC_GETPLAYLISTFILEW 214
+/* (requires Winamp 2.04+, only usable from plug-ins (not external apps))
+** char *name=SendMessage(hwnd_winamp,WM_WA_IPC,index,IPC_GETPLAYLISTFILE);
+** IPC_GETPLAYLISTFILE gets the filename of the playlist entry [index].
+** returns a pointer to it. returns NULL on error.
+*/
+
+
+#define IPC_GETPLAYLISTTITLE 212
+#define IPC_GETPLAYLISTTITLEW 213
+/* (requires Winamp 2.04+, only usable from plug-ins (not external apps))
+** char *name=SendMessage(hwnd_winamp,WM_WA_IPC,index,IPC_GETPLAYLISTTITLE);
+**
+** IPC_GETPLAYLISTTITLE gets the title of the playlist entry [index].
+** returns a pointer to it. returns NULL on error.
+*/
+
+
+#define IPC_GETHTTPGETTER 240
+/* retrieves a function pointer to a HTTP retrieval function.
+** if this is unsupported, returns 1 or 0.
+** the function should be:
+** int (*httpRetrieveFile)(HWND hwnd, char *url, char *file, char *dlgtitle);
+** if you call this function, with a parent window, a URL, an output file, and a dialog title,
+** it will return 0 on successful download, 1 on error.
+*/
+
+
+#define IPC_GETHTTPGETTERW 1240
+/* int (*httpRetrieveFileW)(HWND hwnd, char *url, wchar_t *file, wchar_t *dlgtitle); */
+
+
+#define IPC_MBOPEN 241
+/* (requires Winamp 2.05+)
+** SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_MBOPEN);
+** SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)url,IPC_MBOPEN);
+** IPC_MBOPEN will open a new URL in the minibrowser. if url is NULL, it will open the Minibrowser window.
+*/
+
+
+#define IPC_CHANGECURRENTFILE 245
+/* (requires Winamp 2.05+)
+** SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)file,IPC_CHANGECURRENTFILE);
+** IPC_CHANGECURRENTFILE will set the current playlist item.
+*/
+
+
+#define IPC_CHANGECURRENTFILEW 1245
+/* (requires Winamp 5.3+)
+** SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)file,IPC_CHANGECURRENTFILEW);
+** IPC_CHANGECURRENTFILEW will set the current playlist item.
+*/
+
+
+#define IPC_GETMBURL 246
+/* (requires Winamp 2.2+)
+** char buffer[4096]; // Urls can be VERY long
+** SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)buffer,IPC_GETMBURL);
+** IPC_GETMBURL will retrieve the current Minibrowser URL into buffer.
+** buffer must be at least 4096 bytes long.
+*/
+
+
+#define IPC_MBBLOCK 248
+/* (requires Winamp 2.4+)
+** SendMessage(hwnd_winamp,WM_WA_IPC,value,IPC_MBBLOCK);
+**
+** IPC_MBBLOCK will block the Minibrowser from updates if value is set to 1
+*/
+
+
+#define IPC_MBOPENREAL 249
+/* (requires Winamp 2.4+)
+** SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)url,IPC_MBOPENREAL);
+**
+** IPC_MBOPENREAL works the same as IPC_MBOPEN except that it will works even if
+** IPC_MBBLOCK has been set to 1
+*/
+
+
+#define IPC_ADJUST_OPTIONSMENUPOS 280
+/* (requires Winamp 2.9+)
+** int newpos=SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)adjust_offset,IPC_ADJUST_OPTIONSMENUPOS);
+** moves where winamp expects the Options menu in the main menu. Useful if you wish to insert a
+** menu item above the options/skins/vis menus.
+*/
+
+
+#define IPC_GET_HMENU 281
+/* (requires Winamp 2.9+)
+** HMENU hMenu=SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GET_HMENU);
+** values for data:
+** 0 : main popup menu
+** 1 : main menubar file menu
+** 2 : main menubar options menu
+** 3 : main menubar windows menu
+** 4 : main menubar help menu
+** other values will return NULL.
+*/
+
+
+#define IPC_GET_EXTENDED_FILE_INFO 290 //pass a pointer to the following struct in wParam
+#define IPC_GET_EXTENDED_FILE_INFO_HOOKABLE 296
+/* (requires Winamp 2.9+)
+** to use, create an extendedFileInfoStruct, point the values filename and metadata to the
+** filename and metadata field you wish to query, and ret to a buffer, with retlen to the
+** length of that buffer, and then SendMessage(hwnd_winamp,WM_WA_IPC,&struct,IPC_GET_EXTENDED_FILE_INFO);
+** the results should be in the buffer pointed to by ret.
+** returns 1 if the decoder supports a getExtendedFileInfo method
+*/
+typedef struct {
+ const char *filename;
+ const char *metadata;
+ char *ret;
+ size_t retlen;
+} extendedFileInfoStruct;
+
+
+#define IPC_GET_BASIC_FILE_INFO 291 //pass a pointer to the following struct in wParam
+typedef struct {
+ const char *filename;
+
+ int quickCheck; // set to 0 to always get, 1 for quick, 2 for default (if 2, quickCheck will be set to 0 if quick wasnot used)
+
+ // filled in by winamp
+ int length;
+ char *title;
+ int titlelen;
+} basicFileInfoStruct;
+
+
+#define IPC_GET_BASIC_FILE_INFOW 1291 //pass a pointer to the following struct in wParam
+typedef struct {
+ const wchar_t *filename;
+
+ int quickCheck; // set to 0 to always get, 1 for quick, 2 for default (if 2, quickCheck will be set to 0 if quick wasnot used)
+
+ // filled in by winamp
+ int length;
+ wchar_t *title;
+ int titlelen;
+} basicFileInfoStructW;
+
+
+#define IPC_GET_EXTLIST 292 //returns doublenull delimited. GlobalFree() it when done. if data is 0, returns raw extlist, if 1, returns something suitable for getopenfilename
+#define IPC_GET_EXTLISTW 1292 // wide char version of above
+
+
+#define IPC_INFOBOX 293
+typedef struct {
+ HWND parent;
+ char *filename;
+} infoBoxParam;
+
+
+#define IPC_INFOBOXW 1293
+typedef struct {
+ HWND parent;
+ const wchar_t *filename;
+} infoBoxParamW;
+
+
+#define IPC_SET_EXTENDED_FILE_INFO 294 //pass a pointer to the a extendedFileInfoStruct in wParam
+/* (requires Winamp 2.9+)
+** to use, create an extendedFileInfoStruct, point the values filename and metadata to the
+** filename and metadata field you wish to write in ret. (retlen is not used). and then
+** SendMessage(hwnd_winamp,WM_WA_IPC,&struct,IPC_SET_EXTENDED_FILE_INFO);
+** returns 1 if the metadata is supported
+** Call IPC_WRITE_EXTENDED_FILE_INFO once you're done setting all the metadata you want to update
+*/
+
+
+#define IPC_WRITE_EXTENDED_FILE_INFO 295
+/* (requires Winamp 2.9+)
+** writes all the metadata set thru IPC_SET_EXTENDED_FILE_INFO to the file
+** returns 1 if the file has been successfully updated, 0 if error
+*/
+
+
+#define IPC_FORMAT_TITLE 297
+typedef struct
+{
+ char *spec; // NULL=default winamp spec
+ void *p;
+
+ char *out;
+ int out_len;
+
+ char * (*TAGFUNC)(const char * tag, void * p); //return 0 if not found
+ void (*TAGFREEFUNC)(char * tag,void * p);
+} waFormatTitle;
+
+
+#define IPC_FORMAT_TITLE_EXTENDED 298 // similiar to IPC_FORMAT_TITLE, but falls back to Winamp's %tags% if your passed tag function doesn't handle it
+typedef struct
+{
+ const wchar_t *filename;
+ int useExtendedInfo; // set to 1 if you want the Title Formatter to query the input plugins for any tags that your tag function fails on
+ const wchar_t *spec; // NULL=default winamp spec
+ void *p;
+
+ wchar_t *out;
+ int out_len;
+
+ wchar_t * (*TAGFUNC)(const wchar_t * tag, void * p); //return 0 if not found, -1 for empty tag
+ void (*TAGFREEFUNC)(wchar_t *tag, void *p);
+} waFormatTitleExtended;
+
+
+#define IPC_COPY_EXTENDED_FILE_INFO 299
+typedef struct
+{
+ const char *source;
+ const char *dest;
+} copyFileInfoStruct;
+
+
+#define IPC_COPY_EXTENDED_FILE_INFOW 1299
+typedef struct
+{
+ const wchar_t *source;
+ const wchar_t *dest;
+} copyFileInfoStructW;
+
+
+typedef struct {
+ int (*inflateReset)(void *strm);
+ int (*inflateInit_)(void *strm,const char *version, int stream_size);
+ int (*inflate)(void *strm, int flush);
+ int (*inflateEnd)(void *strm);
+ unsigned long (*crc32)(unsigned long crc, const unsigned char *buf, unsigned int len);
+} wa_inflate_struct;
+
+#define IPC_GETUNCOMPRESSINTERFACE 331
+/* returns a function pointer to uncompress().
+** int (*uncompress)(unsigned char *dest, unsigned long *destLen, const unsigned char *source, unsigned long sourceLen);
+** right out of zlib, useful for decompressing zlibbed data.
+** if you pass the parm of 0x10100000, it will return a wa_inflate_struct * to an inflate API.
+*/
+
+
+typedef struct _prefsDlgRec {
+ HINSTANCE hInst; // dll instance containing the dialog resource
+ int dlgID; // resource identifier of the dialog
+ void *proc; // window proceedure for handling the dialog defined as
+ // LRESULT CALLBACK PrefsPage(HWND,UINT,WPARAM,LPARAM)
+
+ char *name; // name shown for the prefs page in the treelist
+ intptr_t where; // section in the treelist the prefs page is to be added to
+ // 0 for General Preferences
+ // 1 for Plugins
+ // 2 for Skins
+ // 3 for Bookmarks (no longer in the 5.0+ prefs)
+ // 4 for Prefs (the old 'Setup' section - no longer in 5.0+)
+
+ intptr_t _id;
+ struct _prefsDlgRec *next; // no longer implemented as a linked list, now used by Winamp for other means
+} prefsDlgRec;
+
+typedef struct _prefsDlgRecW {
+ HINSTANCE hInst; // dll instance containing the dialog resource
+ int dlgID; // resource identifier of the dialog
+ void *proc; // window proceedure for handling the dialog defined as
+ // LRESULT CALLBACK PrefsPage(HWND,UINT,WPARAM,LPARAM)
+
+ wchar_t *name; // name shown for the prefs page in the treelist
+ intptr_t where; // section in the treelist the prefs page is to be added to
+ // 0 for General Preferences
+ // 1 for Plugins
+ // 2 for Skins
+ // 3 for Bookmarks (no longer in the 5.0+ prefs)
+ // 4 for Prefs (the old 'Setup' section - no longer in 5.0+)
+
+ intptr_t _id;
+ struct _prefsDlgRec *next; // no longer implemented as a linked list, now used by Winamp for other means
+} prefsDlgRecW;
+
+#define IPC_ADD_PREFS_DLG 332
+#define IPC_ADD_PREFS_DLGW 1332
+#define IPC_REMOVE_PREFS_DLG 333
+/* (requires Winamp 2.9+)
+** SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)&prefsRec,IPC_ADD_PREFS_DLG);
+** SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)&prefsRec,IPC_REMOVE_PREFS_DLG);
+**
+** IPC_ADD_PREFS_DLG:
+** To use this you need to allocate a prefsDlgRec structure (either on the heap or with
+** some global data but NOT on the stack) and then initialise the members of the structure
+** (see the definition of the prefsDlgRec structure above).
+**
+** hInst - dll instance of where the dialog resource is located.
+** dlgID - id of the dialog resource.
+** proc - dialog window procedure for the prefs dialog.
+** name - name of the prefs page as shown in the preferences list.
+** where - see above for the valid locations the page can be added.
+**
+** Then you do SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)&prefsRec,IPC_ADD_PREFS_DLG);
+**
+** example:
+**
+** prefsDlgRec* prefsRec = 0;
+** prefsRec = GlobalAlloc(GPTR,sizeof(prefsDlgRec));
+** prefsRec->hInst = hInst;
+** prefsRec->dlgID = IDD_PREFDIALOG;
+** prefsRec->name = "Pref Page";
+** prefsRec->where = 0;
+** prefsRec->proc = PrefsPage;
+** SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)&prefsRec,IPC_ADD_PREFS_DLG);
+**
+**
+** IPC_REMOVE_PREFS_DLG:
+** To use you pass the address of the same prefsRec you used when adding the prefs page
+** though you shouldn't really ever have to do this but it's good to clean up after you
+** when you're plugin is being unloaded.
+**
+** SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)&prefsRec,IPC_REMOVE_PREFS_DLG);
+**
+** IPC_ADD_PREFS_DLGW
+** requires Winamp 5.53+
+*/
+
+
+#define IPC_OPENPREFSTOPAGE 380
+/* SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)&prefsRec,IPC_OPENPREFSTOPAGE);
+**
+** There are two ways of opening a preferences page.
+**
+** The first is to pass an id of a builtin preferences page (see below for ids) or a
+** &prefsDlgRec of the preferences page to open and this is normally done if you are
+** opening a prefs page you added yourself.
+**
+** If the page id does not or the &prefsRec is not valid then the prefs dialog will be
+** opened to the first page available (usually the Winamp Pro page).
+**
+** (requires Winamp 5.04+)
+** Passing -1 for param will open the preferences dialog to the last page viewed.
+**
+** Note: v5.0 to 5.03 had a bug in this api
+**
+** On the first call then the correct prefs page would be opened to but on the next call
+** the prefs dialog would be brought to the front but the page would not be changed to the
+** specified.
+** In 5.04+ it will change to the prefs page specified if the prefs dialog is already open.
+*/
+
+/* Builtin Preference page ids (valid for 5.0+)
+** (stored in the lParam member of the TVITEM structure from the tree item)
+**
+** These can be useful if you want to detect a specific prefs page and add things to it
+** yourself or something like that ;)
+**
+** Winamp Pro 20
+** General Preferences 0
+** File Types 1
+** Playlist 23
+** Titles 21
+** Playback 42 (added in 5.25)
+** Station Info 41 (added in 5.11 & removed in 5.5)
+** Video 24
+** Localization 25 (added in 5.5)
+** Skins 40
+** Classic Skins 22
+** Plugins 30
+** Input 31
+** Output 32
+** Visualisation 33
+** DSP/Effect 34
+** General Purpose 35
+**
+** Note:
+** Custom page ids begin from 60
+** The value of the normal custom pages (Global Hotkeys, Jump To File, etc) is not
+** guaranteed since it depends on the order in which the plugins are loaded which can
+** change on different systems.
+**
+** Global Hotkeys, Jump To File, Media Library (under General Preferences and child pages),
+** Media Library (under Plugins), Portables, CD Ripping and Modern Skins are custom pages
+** created by the plugins shipped with Winamp.
+*/
+
+
+#define IPC_GETINIFILE 334
+/* (requires Winamp 2.9+)
+** char *ini=(char*)SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETINIFILE);
+** This returns a pointer to the full file path of winamp.ini.
+**
+** char ini_path[MAX_PATH] = {0};
+**
+** void GetIniFilePath(HWND hwnd){
+** if(SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETVERSION) >= 0x2900){
+** // this gets the string of the full ini file path
+** lstrcpyn(ini_path,(char*)SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETINIFILE),sizeof(ini_path));
+** }
+** else{
+** char* p = ini_path;
+** p += GetModuleFileName(0,ini_path,sizeof(ini_path)) - 1;
+** while(p && *p != '.'){p--;}
+** lstrcpyn(p+1,"ini",sizeof(ini_path));
+** }
+** }
+*/
+
+
+#define IPC_GETINIDIRECTORY 335
+/* (requires Winamp 2.9+)
+** char *dir=(char*)SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETINIDIRECTORY);
+** This returns a pointer to the directory where winamp.ini can be found and is
+** useful if you want store config files but you don't want to use winamp.ini.
+*/
+
+
+#define IPC_GETPLUGINDIRECTORY 336
+/* (requires Winamp 5.11+)
+** char *plugdir=(char*)SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETPLUGINDIRECTORY);
+** This returns a pointer to the directory where Winamp has its plugins stored and is
+** useful if you want store config files in plugins.ini in the plugins folder or for
+** accessing any local files in the plugins folder.
+*/
+
+
+#define IPC_GETM3UDIRECTORY 337
+/* (requires Winamp 5.11+)
+** char *m3udir=(char*)SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETM3UDIRECTORY);
+** This returns a pointer to the directory where winamp.m3u (and winamp.m3u8 if supported) is stored in.
+*/
+
+
+#define IPC_GETM3UDIRECTORYW 338
+/* (requires Winamp 5.3+)
+** wchar_t *m3udirW=(wchar_t*)SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETM3UDIRECTORYW);
+** This returns a pointer to the directory where winamp.m3u (and winamp.m3u8 if supported) is stored in.
+*/
+
+
+#define IPC_SPAWNBUTTONPOPUP 361 // param =
+// 0 = eject
+// 1 = previous
+// 2 = next
+// 3 = pause
+// 4 = play
+// 5 = stop
+
+
+#define IPC_OPENURLBOX 360
+/* (requires Winamp 5.0+)
+** HGLOBAL hglobal = (HGLOBAL)SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)(HWND)parent,IPC_OPENURLBOX);
+** You pass a hwnd for the dialog to be parented to (which modern skin support uses).
+** This will return a HGLOBAL that needs to be freed with GlobalFree() if this worked.
+*/
+
+
+#define IPC_OPENFILEBOX 362
+/* (requires Winamp 5.0+)
+** SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)(HWND)parent,IPC_OPENFILEBOX);
+** You pass a hwnd for the dialog to be parented to (which modern skin support uses).
+*/
+
+
+#define IPC_OPENDIRBOX 363
+/* (requires Winamp 5.0+)
+** SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)(HWND)parent,IPC_OPENDIRBOX);
+** You pass a hwnd for the dialog to be parented to (which modern skin support uses).
+*/
+
+
+#define IPC_SETDIALOGBOXPARENT 364
+/* (requires Winamp 5.0+)
+** SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)(HWND)parent,IPC_SETDIALOGBOXPARENT);
+** Pass 'parent' as the window which will be used as the parent for a number of the built
+** in Winamp dialogs and is useful when you are taking over the whole of the UI so that
+** the dialogs will not appear at the bottom right of the screen since the main winamp
+** window is located at 3000x3000 by gen_ff when this is used. Call this again with
+** parent = null to reset the parent back to the orginal Winamp window.
+*/
+
+#define IPC_GETDIALOGBOXPARENT 365
+/* (requires Winamp 5.51+)
+** HWND hwndParent = SendMessage(hwnd_winamp,WM_WA_IPC,0, IPC_GETDIALOGBOXPARENT);
+** hwndParent can/must be passed to all modal dialogs (including MessageBox) thats uses winamp as a parent
+*/
+
+#define IPC_UPDATEDIALOGBOXPARENT 366
+/* (requires Winamp 5.53+)
+** if you previous called IPC_SETDIALOGBOXPARENT, call this every time your window resizes
+*/
+
+#define IPC_DRO_MIN 401 // reserved for DrO
+#define IPC_SET_JTF_COMPARATOR 409
+/* pass me an int (__cdecl *)(const char *, const char *) in wParam */
+#define IPC_SET_JTF_COMPARATOR_W 410
+/* pass me an int (__cdecl *)(const wchar_t *, const wchar_t *) in wParam ... maybe someday :) */
+#define IPC_SET_JTF_DRAWTEXT 416
+
+#define IPC_DRO_MAX 499
+
+
+// pass 0 for a copy of the skin HBITMAP
+// pass 1 for name of font to use for playlist editor likeness
+// pass 2 for font charset
+// pass 3 for font size
+#define IPC_GET_GENSKINBITMAP 503
+
+
+typedef struct
+{
+ HWND me; //hwnd of the window
+
+ #define EMBED_FLAGS_NORESIZE 0x1
+ // set this bit to keep window from being resizable
+
+ #define EMBED_FLAGS_NOTRANSPARENCY 0x2
+ // set this bit to make gen_ff turn transparency off for this window
+
+ #define EMBED_FLAGS_NOWINDOWMENU 0x4
+ // set this bit to prevent gen_ff from automatically adding your window to the right-click menu
+
+ #define EMBED_FLAGS_GUID 0x8
+ // (5.31+) call SET_EMBED_GUID(yourEmbedWindowStateStruct, GUID) to define a GUID for this window
+
+ #define SET_EMBED_GUID(windowState, windowGUID) { windowState->flags |= EMBED_FLAGS_GUID; *((GUID *)&windowState->extra_data[4])=windowGUID; }
+ #define GET_EMBED_GUID(windowState) (*((GUID *)&windowState->extra_data[4]))
+
+ int flags; // see above
+
+ RECT r;
+ void *user_ptr; // for application use
+ int extra_data[64]; // for internal winamp use
+} embedWindowState;
+
+#define IPC_GET_EMBEDIF 505
+/* (requires Winamp 2.9+)
+** HWND myframe = (HWND)SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)&wa_wnd,IPC_GET_EMBEDIF);
+**
+** or
+**
+** HWND myframe = 0;
+** HWND (*embed)(embedWindowState *params)=0;
+** *(void**)&embed = (void*)SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GET_EMBEDIF);
+** myframe = embed(&wa_wnd);
+**
+** You pass an embedWindowState* and it will return a hwnd for the frame window or if you
+** pass wParam as null then it will return a HWND embedWindow(embedWindowState *);
+*/
+
+#define IPC_SKINWINDOW 534
+
+typedef struct __SKINWINDOWPARAM
+{
+ HWND hwndToSkin;
+ GUID windowGuid;
+} SKINWINDOWPARAM;
+
+
+
+#define IPC_EMBED_ENUM 532
+typedef struct embedEnumStruct
+{
+ int (*enumProc)(embedWindowState *ws, struct embedEnumStruct *param); // return 1 to abort
+ int user_data; // or more :)
+} embedEnumStruct;
+ // pass
+
+
+#define IPC_EMBED_ISVALID 533
+/* (requires Winamp 2.9+)
+** int valid = SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)embedhwnd,IPC_EMBED_ISVALID);
+** Pass a hwnd in the wParam to this to check if the hwnd is a valid embed window or not.
+*/
+
+
+#define IPC_CONVERTFILE 506
+/* (requires Winamp 2.92+)
+** Converts a given file to a different format (PCM, MP3, etc...)
+** To use, pass a pointer to a waFileConvertStruct struct
+** This struct can be either on the heap or some global
+** data, but NOT on the stack. At least, until the conversion is done.
+**
+** eg: SendMessage(hwnd_winamp,WM_WA_IPC,&myConvertStruct,IPC_CONVERTFILE);
+**
+** Return value:
+** 0: Can't start the conversion. Look at myConvertStruct->error for details.
+** 1: Conversion started. Status messages will be sent to the specified callbackhwnd.
+** Be sure to call IPC_CONVERTFILE_END when your callback window receives the
+** IPC_CB_CONVERT_DONE message.
+*/
+typedef struct
+{
+ char *sourcefile; // "c:\\source.mp3"
+ char *destfile; // "c:\\dest.pcm"
+ intptr_t destformat[8]; // like 'PCM ',srate,nch,bps.
+ //hack alert! you can set destformat[6]=mmioFOURCC('I','N','I',' '); and destformat[7]=(int)my_ini_file; (where my_ini_file is a char*)
+ HWND callbackhwnd; // window that will receive the IPC_CB_CONVERT notification messages
+
+ //filled in by winamp.exe
+ char *error; //if IPC_CONVERTFILE returns 0, the reason will be here
+
+ int bytes_done; //you can look at both of these values for speed statistics
+ int bytes_total;
+ int bytes_out;
+
+ int killswitch; // don't set it manually, use IPC_CONVERTFILE_END
+ intptr_t extra_data[64]; // for internal winamp use
+} convertFileStruct;
+
+
+#define IPC_CONVERTFILEW 515
+// (requires Winamp 5.36+)
+typedef struct
+{
+ wchar_t *sourcefile; // "c:\\source.mp3"
+ wchar_t *destfile; // "c:\\dest.pcm"
+ intptr_t destformat[8]; // like 'PCM ',srate,nch,bps.
+ //hack alert! you can set destformat[6]=mmioFOURCC('I','N','I',' '); and destformat[7]=(int)my_ini_file; (where my_ini_file is a char*)
+ HWND callbackhwnd; // window that will receive the IPC_CB_CONVERT notification messages
+
+ //filled in by winamp.exe
+ wchar_t *error; //if IPC_CONVERTFILE returns 0, the reason will be here
+
+ int bytes_done; //you can look at both of these values for speed statistics
+ int bytes_total;
+ int bytes_out;
+
+ int killswitch; // don't set it manually, use IPC_CONVERTFILE_END
+ intptr_t extra_data[64]; // for internal winamp use
+} convertFileStructW;
+
+
+#define IPC_CONVERTFILE_END 507
+/* (requires Winamp 2.92+)
+** Stop/ends a convert process started from IPC_CONVERTFILE
+** You need to call this when you receive the IPC_CB_CONVERTDONE message or when you
+** want to abort a conversion process
+**
+** eg: SendMessage(hwnd_winamp,WM_WA_IPC,&myConvertStruct,IPC_CONVERTFILE_END);
+**
+** No return value
+*/
+
+
+#define IPC_CONVERTFILEW_END 516
+// (requires Winamp 5.36+)
+
+typedef struct {
+ HWND hwndParent;
+ int format;
+
+ //filled in by winamp.exe
+ HWND hwndConfig;
+ int extra_data[8];
+ //hack alert! you can set extra_data[6]=mmioFOURCC('I','N','I',' '); and extra_data[7]=(int)my_ini_file; (where my_ini_file is a char*)
+} convertConfigStruct;
+
+
+#define IPC_CONVERT_CONFIG 508
+#define IPC_CONVERT_CONFIG_END 509
+
+typedef struct
+{
+ void (*enumProc)(intptr_t user_data, const char *desc, int fourcc);
+ intptr_t user_data;
+} converterEnumFmtStruct;
+#define IPC_CONVERT_CONFIG_ENUMFMTS 510
+/* (requires Winamp 2.92+)
+*/
+
+typedef struct
+{
+ char cdletter;
+ char *playlist_file;
+ HWND callback_hwnd;
+
+ //filled in by winamp.exe
+ char *error;
+} burnCDStruct;
+#define IPC_BURN_CD 511
+/* (requires Winamp 5.0+)
+*/
+
+typedef struct
+{
+ convertFileStruct *cfs;
+ int priority;
+} convertSetPriority;
+
+
+#define IPC_CONVERT_SET_PRIORITY 512
+
+typedef struct
+{
+ convertFileStructW *cfs;
+ int priority;
+} convertSetPriorityW;
+
+
+#define IPC_CONVERT_SET_PRIORITYW 517
+// (requires Winamp 5.36+)
+
+typedef struct
+{
+ unsigned int format; //fourcc value
+ char *item; // config item, eg "bitrate"
+ char *data; // buffer to recieve, or buffer that contains the data
+ int len; // length of the data buffer (only used when getting a config item)
+ char *configfile; // config file to read from
+} convertConfigItem;
+
+
+#define IPC_CONVERT_CONFIG_SET_ITEM 513 // returns TRUE if successful
+#define IPC_CONVERT_CONFIG_GET_ITEM 514 // returns TRUE if successful
+
+
+typedef struct
+{
+ const char *filename;
+ char *title; // 2048 bytes
+ int length;
+ int force_useformatting; // can set this to 1 if you want to force a url to use title formatting shit
+} waHookTitleStruct;
+
+#define IPC_HOOK_TITLES 850
+/* (requires Winamp 5.0+)
+** If you hook this message and modify the information then make sure to return TRUE.
+** If you don't hook the message then make sure you pass it on through the subclass chain.
+**
+** LRESULT CALLBACK WinampWndProc(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)
+** {
+** LRESULT ret = CallWindowProc((WNDPROC)WinampProc,hwnd,umsg,wParam,lParam);
+**
+** if(message==WM_WA_IPC && lParam==IPC_HOOK_TITLES)
+** {
+** waHookTitleStruct *ht = (waHookTitleStruct *) wParam;
+** // Doing ATF stuff with ht->title, whatever...
+** return TRUE;
+** }
+** return ret;
+** }
+*/
+
+typedef struct
+{
+ const wchar_t *filename;
+ wchar_t *title; // 2048 characters
+ int length;
+ int force_useformatting; // can set this to 1 if you want to force a url to use title formatting shit
+} waHookTitleStructW;
+#define IPC_HOOK_TITLESW 851
+/* (requires Winamp 5.3+)
+** See information on IPC_HOOK_TITLES for how to process this.
+*/
+
+
+#define IPC_GETSADATAFUNC 800
+// 0: returns a char *export_sa_get() that returns 150 bytes of data
+// 1: returns a export_sa_setreq(int want);
+
+
+#define IPC_GETVUDATAFUNC 801
+// 0: returns a int export_vu_get(int channel) that returns 0-255 (or -1 for bad channel)
+
+
+#define IPC_ISMAINWNDVISIBLE 900
+/* (requires Winamp 5.0+)
+** int visible=SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_ISMAINWNDVISIBLE);
+** You send this to Winamp to query if the main window is visible or not such as by
+** unchecking the option in the main right-click menu. If the main window is visible then
+** this will return 1 otherwise it returns 0.
+*/
+
+
+typedef struct
+{
+ int numElems;
+ int *elems;
+ HBITMAP bm; // set if you want to override
+} waSetPlColorsStruct;
+
+#define IPC_SETPLEDITCOLORS 920
+/* (requires Winamp 5.0+)
+** This is sent by gen_ff when a modern skin is being loaded to set the colour scheme for
+** the playlist editor. When sent numElems is usually 6 and matches with the 6 possible
+** colours which are provided be pledit.txt from the classic skins. The elems array is
+** defined as follows:
+**
+** elems = 0 => normal text
+** elems = 1 => current text
+** elems = 2 => normal background
+** elems = 3 => selected background
+** elems = 4 => minibroswer foreground
+** elems = 5 => minibroswer background
+**
+** if(uMsg == WM_WA_IPC && lParam == IPC_SETPLEDITCOLORS)
+** {
+** waSetPlColorsStruct* colStr = (waSetPlColorsStruct*)wp;
+** if(colStr)
+** {
+** // set or inspect the colours being used (basically for gen_ff's benefit)
+** }
+** }
+*/
+
+
+typedef struct
+{
+ HWND wnd;
+ int xpos; // in screen coordinates
+ int ypos;
+} waSpawnMenuParms;
+
+// waSpawnMenuParms2 is used by the menubar submenus
+typedef struct
+{
+ HWND wnd;
+ int xpos; // in screen coordinates
+ int ypos;
+ int width;
+ int height;
+} waSpawnMenuParms2;
+
+// the following IPC use waSpawnMenuParms as parameter
+#define IPC_SPAWNEQPRESETMENU 933
+#define IPC_SPAWNFILEMENU 934 //menubar
+#define IPC_SPAWNOPTIONSMENU 935 //menubar
+#define IPC_SPAWNWINDOWSMENU 936 //menubar
+#define IPC_SPAWNHELPMENU 937 //menubar
+#define IPC_SPAWNPLAYMENU 938 //menubar
+#define IPC_SPAWNPEFILEMENU 939 //menubar
+#define IPC_SPAWNPEPLAYLISTMENU 940 //menubar
+#define IPC_SPAWNPESORTMENU 941 //menubar
+#define IPC_SPAWNPEHELPMENU 942 //menubar
+#define IPC_SPAWNMLFILEMENU 943 //menubar
+#define IPC_SPAWNMLVIEWMENU 944 //menubar
+#define IPC_SPAWNMLHELPMENU 945 //menubar
+#define IPC_SPAWNPELISTOFPLAYLISTS 946
+
+
+#define WM_WA_SYSTRAY WM_USER+1
+/* This is sent by the system tray when an event happens (you might want to simulate it).
+**
+** if(uMsg == WM_WA_SYSTRAY)
+** {
+** switch(lParam)
+** {
+** // process the messages sent from the tray
+** }
+** }
+*/
+
+
+#define WM_WA_MPEG_EOF WM_USER+2
+/* Input plugins send this when they are done playing back the current file to inform
+** Winamp or anyother installed plugins that the current
+**
+** if(uMsg == WM_WA_MPEG_EOF)
+** {
+** // do what is needed here
+** }
+*/
+
+
+//// video stuff
+
+#define IPC_IS_PLAYING_VIDEO 501 // returns >1 if playing, 0 if not, 1 if old version (so who knows):)
+#define IPC_GET_IVIDEOOUTPUT 500 // see below for IVideoOutput interface
+#define VIDEO_MAKETYPE(A,B,C,D) ((A) | ((B)<<8) | ((C)<<16) | ((D)<<24))
+#define VIDUSER_SET_INFOSTRING 0x1000
+#define VIDUSER_GET_VIDEOHWND 0x1001
+#define VIDUSER_SET_VFLIP 0x1002
+#define VIDUSER_SET_TRACKSELINTERFACE 0x1003 // give your ITrackSelector interface as param2
+#define VIDUSER_OPENVIDEORENDERER 0x1004
+#define VIDUSER_CLOSEVIDEORENDERER 0x1005
+#define VIDUSER_GETPOPUPMENU 0x1006
+#define VIDUSER_SET_INFOSTRINGW 0x1007
+
+typedef struct
+{
+ int w;
+ int h;
+ int vflip;
+ double aspectratio;
+ unsigned int fmt;
+} VideoOpenStruct;
+
+#ifndef NO_IVIDEO_DECLARE
+#ifdef __cplusplus
+
+class VideoOutput;
+class SubsItem;
+
+#ifndef _NSV_DEC_IF_H_
+struct YV12_PLANE {
+ unsigned char* baseAddr;
+ long rowBytes;
+} ;
+
+struct YV12_PLANES {
+ YV12_PLANE y;
+ YV12_PLANE u;
+ YV12_PLANE v;
+};
+#endif
+
+class IVideoOutput
+{
+ public:
+ virtual ~IVideoOutput() { }
+ virtual int open(int w, int h, int vflip, double aspectratio, unsigned int fmt)=0;
+ virtual void setcallback(LRESULT (*msgcallback)(void *token, HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam), void *token) { (void)token; (void)msgcallback; /* to eliminate warning C4100 */ }
+ virtual void close()=0;
+ virtual void draw(void *frame)=0;
+ virtual void drawSubtitle(SubsItem *item) {UNREFERENCED_PARAMETER(item); }
+ virtual void showStatusMsg(const char *text) {UNREFERENCED_PARAMETER(text); }
+ virtual int get_latency() { return 0; }
+ virtual void notifyBufferState(int bufferstate) { UNREFERENCED_PARAMETER(bufferstate); } /* 0-255*/
+ virtual INT_PTR extended(INT_PTR param1, INT_PTR param2, INT_PTR param3) { UNREFERENCED_PARAMETER(param1); UNREFERENCED_PARAMETER(param2); UNREFERENCED_PARAMETER(param3); return 0; } // Dispatchable, eat this!
+};
+
+class ITrackSelector
+{
+ public:
+ virtual int getNumAudioTracks()=0;
+ virtual void enumAudioTrackName(int n, const char *buf, int size)=0;
+ virtual int getCurAudioTrack()=0;
+ virtual int getNumVideoTracks()=0;
+ virtual void enumVideoTrackName(int n, const char *buf, int size)=0;
+ virtual int getCurVideoTrack()=0;
+
+ virtual void setAudioTrack(int n)=0;
+ virtual void setVideoTrack(int n)=0;
+};
+
+#endif //cplusplus
+#endif//NO_IVIDEO_DECLARE
+
+// these messages are callbacks that you can grab by subclassing the winamp window
+
+// wParam =
+#define IPC_CB_WND_EQ 0 // use one of these for the param
+#define IPC_CB_WND_PE 1
+#define IPC_CB_WND_MB 2
+#define IPC_CB_WND_VIDEO 3
+#define IPC_CB_WND_MAIN 4
+
+#define IPC_CB_ONSHOWWND 600
+#define IPC_CB_ONHIDEWND 601
+
+#define IPC_CB_GETTOOLTIP 602
+
+#define IPC_CB_MISC 603
+ #define IPC_CB_MISC_TITLE 0 // start of playing/stop/pause
+ #define IPC_CB_MISC_VOLUME 1 // volume/pan
+ #define IPC_CB_MISC_STATUS 2 // start playing/stop/pause/ffwd/rwd
+ #define IPC_CB_MISC_EQ 3
+ #define IPC_CB_MISC_INFO 4
+ #define IPC_CB_MISC_VIDEOINFO 5
+ #define IPC_CB_MISC_TITLE_RATING 6 // (5.5+ for when the rating is changed via the songticker menu on current file)
+
+/* Example of using IPC_CB_MISC_STATUS to detect the start of track playback with 5.x
+**
+** if(lParam == IPC_CB_MISC && wParam == IPC_CB_MISC_STATUS)
+** {
+** if(SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_ISPLAYING) == 1 &&
+** !SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETOUTPUTTIME))
+** {
+** char* file = (char*)SendMessage(hwnd_winamp,WM_WA_IPC,
+** SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETLISTPOS),IPC_GETPLAYLISTFILE);
+** // only output if a valid file was found
+** if(file)
+** {
+** MessageBox(hwnd_winamp,file,"starting",0);
+** // or do something else that you need to do
+** }
+** }
+** }
+*/
+
+
+#define IPC_CB_CONVERT_STATUS 604 // param value goes from 0 to 100 (percent)
+#define IPC_CB_CONVERT_DONE 605
+
+
+#define IPC_ADJUST_FFWINDOWSMENUPOS 606
+/* (requires Winamp 2.9+)
+** int newpos=SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)adjust_offset,IPC_ADJUST_FFWINDOWSMENUPOS);
+** This will move where Winamp expects the freeform windows in the menubar windows main
+** menu. This is useful if you wish to insert a menu item above extra freeform windows.
+*/
+
+
+#define IPC_ISDOUBLESIZE 608
+/* (requires Winamp 5.0+)
+** int dsize=SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_ISDOUBLESIZE);
+** You send this to Winamp to query if the double size mode is enabled or not.
+** If it is on then this will return 1 otherwise it will return 0.
+*/
+
+
+#define IPC_ADJUST_FFOPTIONSMENUPOS 609
+/* (requires Winamp 2.9+)
+** int newpos=SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)adjust_offset,IPC_ADJUST_FFOPTIONSMENUPOS);
+** moves where winamp expects the freeform preferences item in the menubar windows main
+** menu. This is useful if you wish to insert a menu item above the preferences item.
+**
+** Note: This setting was ignored by gen_ff until it was fixed in 5.1
+** gen_ff would assume thatthe menu position was 11 in all cases and so when you
+** had two plugins attempting to add entries into the main right click menu it
+** would cause the 'colour themes' submenu to either be incorrectly duplicated or
+** to just disappear.instead.
+*/
+
+
+#define IPC_GETTIMEDISPLAYMODE 610
+/* (requires Winamp 5.0+)
+** int mode=SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETTIMEDISPLAYMODE);
+** This will return the status of the time display i.e. shows time elapsed or remaining.
+** This returns 0 if Winamp is displaying time elapsed or 1 for the time remaining.
+*/
+
+
+#define IPC_SETVISWND 611
+/* (requires Winamp 5.0+)
+** int viswnd=(HWND)SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)(HWND)viswnd,IPC_SETVISWND);
+** This allows you to set a window to receive the following message commands (which are
+** used as part of the modern skin integration).
+** When you have finished or your visualisation is closed then send wParam as zero to
+** ensure that things are correctly tidied up.
+*/
+
+/* The following messages are received as the LOWORD(wParam) of the WM_COMMAND message.
+** See %SDK%\winamp\wa5vis.txt for more info about visualisation integration in Winamp.
+*/
+#define ID_VIS_NEXT 40382
+#define ID_VIS_PREV 40383
+#define ID_VIS_RANDOM 40384
+#define ID_VIS_FS 40389
+#define ID_VIS_CFG 40390
+#define ID_VIS_MENU 40391
+
+
+#define IPC_GETVISWND 612
+/* (requires Winamp 5.0+)
+** int viswnd=(HWND)SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETVISWND);
+** This returns a HWND to the visualisation command handler window if set by IPC_SETVISWND.
+*/
+
+
+#define IPC_ISVISRUNNING 613
+/* (requires Winamp 5.0+)
+** int visrunning=SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_ISVISRUNNING);
+** This will return 1 if a visualisation is currently running and 0 if one is not running.
+*/
+
+
+#define IPC_CB_VISRANDOM 628 // param is status of random
+
+
+#define IPC_SETIDEALVIDEOSIZE 614
+/* (requires Winamp 5.0+)
+** This is sent by Winamp back to itself so it can be trapped and adjusted as needed with
+** the desired width in HIWORD(wParam) and the desired height in LOWORD(wParam).
+**
+** if(uMsg == WM_WA_IPC){
+** if(lParam == IPC_SETIDEALVIDEOSIZE){
+** wParam = MAKEWPARAM(height,width);
+** }
+** }
+*/
+
+
+#define IPC_GETSTOPONVIDEOCLOSE 615
+/* (requires Winamp 5.0+)
+** int sovc=SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETSTOPONVIDEOCLOSE);
+** This will return 1 if 'stop on video close' is enabled and 0 if it is disabled.
+*/
+
+
+#define IPC_SETSTOPONVIDEOCLOSE 616
+/* (requires Winamp 5.0+)
+** int sovc=SendMessage(hwnd_winamp,WM_WA_IPC,enabled,IPC_SETSTOPONVIDEOCLOSE);
+** Set enabled to 1 to enable and 0 to disable the 'stop on video close' option.
+*/
+
+
+typedef struct {
+ HWND hwnd;
+ int uMsg;
+ WPARAM wParam;
+ LPARAM lParam;
+} transAccelStruct;
+
+#define IPC_TRANSLATEACCELERATOR 617
+/* (requires Winamp 5.0+)
+** (deprecated as of 5.53x+)
+*/
+
+typedef struct {
+ int cmd;
+ int x;
+ int y;
+ int align;
+} windowCommand; // send this as param to an IPC_PLCMD, IPC_MBCMD, IPC_VIDCMD
+
+
+#define IPC_CB_ONTOGGLEAOT 618
+
+
+#define IPC_GETPREFSWND 619
+/* (requires Winamp 5.0+)
+** HWND prefs = (HWND)SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETPREFSWND);
+** This will return a handle to the preferences dialog if it is open otherwise it will
+** return zero. A simple check with the OS api IsWindow(..) is a good test if it's valid.
+**
+** e.g. this will open (or close if already open) the preferences dialog and show if we
+** managed to get a valid
+** SendMessage(hwnd_winamp,WM_COMMAND,MAKEWPARAM(WINAMP_OPTIONS_PREFS,0),0);
+** MessageBox(hwnd_winamp,(IsWindow((HWND)SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETPREFSWND))?"Valid":"Not Open"),0,MB_OK);
+*/
+
+
+#define IPC_SET_PE_WIDTHHEIGHT 620
+/* (requires Winamp 5.0+)
+** SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)&point,IPC_SET_PE_WIDTHHEIGHT);
+** You pass a pointer to a POINT structure which holds the width and height and Winamp
+** will set the playlist editor to that size (this is used by gen_ff on skin changes).
+** There does not appear to be any bounds limiting with this so it is possible to create
+** a zero size playlist editor window (which is a pretty silly thing to do).
+*/
+
+
+#define IPC_GETLANGUAGEPACKINSTANCE 621
+/* (requires Winamp 5.0+)
+** HINSTANCE hInst = (HINSTANCE)SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETLANGUAGEPACKINSTANCE);
+** This will return the HINSTANCE to the currently used language pack file for winamp.exe
+**
+** (5.5+)
+** If you pass 1 in wParam then you will have zero returned if a language pack is in use.
+** if (!SendMessage(hwnd_winamp,WM_WA_IPC,1,IPC_GETLANGUAGEPACKINSTANCE)) {
+** // winamp is currently using a language pack
+** }
+**
+** If you pass 2 in wParam then you will get the path to the language pack folder.
+** wchar_t* lngpackfolder = (wchar_t*)SendMessage(hwnd_winamp,WM_WA_IPC,2,IPC_GETLANGUAGEPACKINSTANCE);
+**
+** If you pass 3 in wParam then you will get the path to the currently extracted language pack.
+** wchar_t* lngpack = (wchar_t*)SendMessage(hwnd_winamp,WM_WA_IPC,3,IPC_GETLANGUAGEPACKINSTANCE);
+**
+** If you pass 4 in wParam then you will get the name of the currently used language pack.
+** wchar_t* lngname = (char*)SendMessage(hwnd_winamp,WM_WA_IPC,4,IPC_GETLANGUAGEPACKINSTANCE);
+*/
+#define LANG_IDENT_STR 0
+#define LANG_LANG_CODE 1
+#define LANG_COUNTRY_CODE 2
+/*
+** (5.51+)
+** If you pass 5 in LOWORD(wParam) then you will get the ident string/code string
+** (based on the param passed in the HIWORD(wParam) of the currently used language pack.
+** The string returned with LANG_IDENT_STR is used to represent the language that the
+** language pack is intended for following ISO naming conventions for consistancy.
+**
+** wchar_t* ident_str = (wchar_t*)SendMessage(hwnd_winamp,WM_WA_IPC,MAKEWPARAM(5,LANG_XXX),IPC_GETLANGUAGEPACKINSTANCE);
+**
+** e.g.
+** For the default language it will return the following for the different LANG_XXX codes
+** LANG_IDENT_STR -> "en-US" (max buffer size of this is 9 wchar_t)
+** LANG_LANG_CODE -> "en" (language code)
+** LANG_COUNTRY_CODE -> "US" (country code)
+**
+** On pre 5.51 installs you can get LANG_IDENT_STR using the following method
+** (you'll have to custom process the string returned if you want the langugage or country but that's easy ;) )
+**
+** #define LANG_PACK_LANG_ID 65534 (if you don't have lang.h)
+** HINSTANCE hInst = (HINSTANCE)SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETLANGUAGEPACKINSTANCE);
+** TCHAR buffer[9] = {0};
+** LoadString(hInst,LANG_PACK_LANG_ID,buffer,sizeof(buffer));
+**
+**
+**
+** The following example shows how using the basic api will allow you to load the playlist
+** context menu resource from the currently loaded language pack or it will fallback to
+** the default winamp.exe instance.
+**
+** HINSTANCE lang = (HINSTANCE)SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETLANGUAGEPACKINSTANCE);
+** HMENU popup = GetSubMenu(GetSubMenu((LoadMenu(lang?lang:GetModuleHandle(0),MAKEINTRESOURCE(101))),2),5);
+** // do processing as needed on the menu before displaying it
+** TrackPopupMenuEx(orig,TPM_LEFTALIGN|TPM_LEFTBUTTON|TPM_RIGHTBUTTON,rc.left,rc.bottom,hwnd_owner,0);
+** DestroyMenu(popup);
+**
+** If you need a specific menu handle then look at IPC_GET_HMENU for more information.
+*/
+
+
+#define IPC_CB_PEINFOTEXT 622 // data is a string, ie: "04:21/45:02"
+
+
+#define IPC_CB_OUTPUTCHANGED 623 // output plugin was changed in config
+
+
+#define IPC_GETOUTPUTPLUGIN 625
+/* (requires Winamp 5.0+)
+** char* outdll = (char*)SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETOUTPUTPLUGIN);
+** This returns a string of the current output plugin's dll name.
+** e.g. if the directsound plugin was selected then this would return 'out_ds.dll'.
+*/
+
+
+#define IPC_SETDRAWBORDERS 626
+/* (requires Winamp 5.0+)
+** SendMessage(hwnd_winamp,WM_WA_IPC,enabled,IPC_SETDRAWBORDERS);
+** Set enabled to 1 to enable and 0 to disable drawing of the playlist editor and winamp
+** gen class windows (used by gen_ff to allow it to draw its own window borders).
+*/
+
+
+#define IPC_DISABLESKINCURSORS 627
+/* (requires Winamp 5.0+)
+** SendMessage(hwnd_winamp,WM_WA_IPC,enabled,IPC_DISABLESKINCURSORS);
+** Set enabled to 1 to enable and 0 to disable the use of skinned cursors.
+*/
+
+
+#define IPC_GETSKINCURSORS 628
+/* (requires Winamp 5.36+)
+** data = (WACURSOR)cursorId. (check wa_dlg.h for values)
+*/
+
+
+#define IPC_CB_RESETFONT 629
+
+
+#define IPC_IS_FULLSCREEN 630
+/* (requires Winamp 5.0+)
+** int val=SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_IS_FULLSCREEN);
+** This will return 1 if the video or visualisation is in fullscreen mode or 0 otherwise.
+*/
+
+
+#define IPC_SET_VIS_FS_FLAG 631
+/* (requires Winamp 5.0+)
+** A vis should send this message with 1/as param to notify winamp that it has gone to or has come back from fullscreen mode
+*/
+
+
+#define IPC_SHOW_NOTIFICATION 632
+
+
+#define IPC_GETSKININFO 633
+#define IPC_GETSKININFOW 1633
+/* (requires Winamp 5.0+)
+** This is a notification message sent to the main Winamp window by itself whenever it
+** needs to get information to be shown about the current skin in the 'Current skin
+** information' box on the main Skins page in the Winamp preferences.
+**
+** When this notification is received and the current skin is one you are providing the
+** support for then you return a valid buffer for Winamp to be able to read from with
+** information about it such as the name of the skin file.
+**
+** if(uMsg == WM_WA_IPC && lParam == IPC_GETSKININFO){
+** if(is_our_skin()) {
+** return is_our_skin_name();
+** }
+** }
+*/
+
+
+#define IPC_GET_MANUALPLADVANCE 634
+/* (requires Winamp 5.03+)
+** int val=SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GET_MANUALPLADVANCE);
+** IPC_GET_MANUALPLADVANCE returns the status of the Manual Playlist Advance.
+** If enabled this will return 1 otherwise it will return 0.
+*/
+
+
+#define IPC_SET_MANUALPLADVANCE 635
+/* (requires Winamp 5.03+)
+** SendMessage(hwnd_winamp,WM_WA_IPC,value,IPC_SET_MANUALPLADVANCE);
+** IPC_SET_MANUALPLADVANCE sets the status of the Manual Playlist Advance option.
+** Set value = 1 to turn it on and value = 0 to turn it off.
+*/
+
+
+#define IPC_GET_NEXT_PLITEM 636
+/* (requires Winamp 5.04+)
+** SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_EOF_GET_NEXT_PLITEM);
+**
+** Sent to Winamp's main window when an item has just finished playback or the next
+** button has been pressed and requesting the new playlist item number to go to.
+**
+** Subclass this message in your application to return the new item number.
+** Return -1 for normal Winamp operation (default) or the new item number in
+** the playlist to be played instead of the originally selected next track.
+**
+** This is primarily provided for the JTFE plugin (gen_jumpex.dll).
+*/
+
+
+#define IPC_GET_PREVIOUS_PLITEM 637
+/* (requires Winamp 5.04+)
+** SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_EOF_GET_PREVIOUS_PLITEM);
+**
+** Sent to Winamp's main window when the previous button has been pressed and Winamp is
+** requesting the new playlist item number to go to.
+**
+** Return -1 for normal Winamp operation (default) or the new item number in
+** the playlist to be played instead of the originally selected previous track.
+**
+** This is primarily provided for the JTFE plugin (gen_jumpex.dll).
+*/
+
+
+#define IPC_IS_WNDSHADE 638
+/* (requires Winamp 5.04+)
+** int is_shaded=SendMessage(hwnd_winamp,WM_WA_IPC,wnd,IPC_IS_WNDSHADE);
+** Pass 'wnd' as an id as defined for IPC_GETWND or pass -1 to query the status of the
+** main window. This returns 1 if the window is in winshade mode and 0 if it is not.
+** Make sure you only test for this on a 5.04+ install otherwise you get a false result.
+** (See the notes about unhandled WM_WA_IPC messages).
+*/
+
+
+#define IPC_SETRATING 639
+/* (requires Winamp 5.04+ with ML)
+** int rating=SendMessage(hwnd_winamp,WM_WA_IPC,rating,IPC_SETRATING);
+** This will allow you to set the 'rating' on the current playlist entry where 'rating'
+** is an integer value from 0 (no rating) to 5 (5 stars).
+**
+** The following example should correctly allow you to set the rating for any specified
+** playlist entry assuming of course that you're trying to get a valid playlist entry.
+**
+** void SetPlaylistItemRating(int item_to_set, int rating_to_set){
+** int cur_pos=SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETLISTPOS);
+** SendMessage(hwnd_winamp,WM_WA_IPC,item_to_set,IPC_SETPLAYLISTPOS);
+** SendMessage(hwnd_winamp,WM_WA_IPC,rating_to_set,IPC_SETRATING);
+** SendMessage(hwnd_winamp,WM_WA_IPC,cur_pos,IPC_SETPLAYLISTPOS);
+** }
+*/
+
+
+#define IPC_GETRATING 640
+/* (requires Winamp 5.04+ with ML)
+** int rating=SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETRATING);
+** This returns the current playlist entry's rating between 0 (no rating) to 5 (5 stars).
+**
+** The following example should correctly allow you to get the rating for any specified
+** playlist entry assuming of course that you're trying to get a valid playlist entry.
+**
+** int GetPlaylistItemRating(int item_to_get, int rating_to_set){
+** int cur_pos=SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETLISTPOS), rating = 0;
+** SendMessage(hwnd_winamp,WM_WA_IPC,item_to_get,IPC_SETPLAYLISTPOS);
+** rating = SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETRATING);
+** SendMessage(hwnd_winamp,WM_WA_IPC,cur_pos,IPC_SETPLAYLISTPOS);
+** return rating;
+** }
+*/
+
+
+#define IPC_GETNUMAUDIOTRACKS 641
+/* (requires Winamp 5.04+)
+** int n = SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETNUMAUDIOTRACKS);
+** This will return the number of audio tracks available from the currently playing item.
+*/
+
+
+#define IPC_GETNUMVIDEOTRACKS 642
+/* (requires Winamp 5.04+)
+** int n = SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETNUMVIDEOTRACKS);
+** This will return the number of video tracks available from the currently playing item.
+*/
+
+
+#define IPC_GETAUDIOTRACK 643
+/* (requires Winamp 5.04+)
+** int cur = SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETAUDIOTRACK);
+** This will return the id of the current audio track for the currently playing item.
+*/
+
+
+#define IPC_GETVIDEOTRACK 644
+/* (requires Winamp 5.04+)
+** int cur = SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETVIDEOTRACK);
+** This will return the id of the current video track for the currently playing item.
+*/
+
+
+#define IPC_SETAUDIOTRACK 645
+/* (requires Winamp 5.04+)
+** SendMessage(hwnd_winamp,WM_WA_IPC,track,IPC_SETAUDIOTRACK);
+** This allows you to switch to a new audio track (if supported) in the current playing file.
+*/
+
+
+#define IPC_SETVIDEOTRACK 646
+/* (requires Winamp 5.04+)
+** SendMessage(hwnd_winamp,WM_WA_IPC,track,IPC_SETVIDEOTRACK);
+** This allows you to switch to a new video track (if supported) in the current playing file.
+*/
+
+
+#define IPC_PUSH_DISABLE_EXIT 647
+/* (requires Winamp 5.04+)
+** SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_PUSH_DISABLE_EXIT);
+** This will let you disable or re-enable the UI exit functions (close button, context
+** menu, alt-f4). Remember to call IPC_POP_DISABLE_EXIT when you are done doing whatever
+** was required that needed to prevent exit otherwise you have to kill the Winamp process.
+*/
+
+
+#define IPC_POP_DISABLE_EXIT 648
+/* (requires Winamp 5.04+)
+** SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_POP_DISABLE_EXIT);
+** See IPC_PUSH_DISABLE_EXIT
+*/
+
+
+#define IPC_IS_EXIT_ENABLED 649
+/* (requires Winamp 5.04+)
+** SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_IS_EXIT_ENABLED);
+** This will return 0 if the 'exit' option of Winamp's menu is disabled and 1 otherwise.
+*/
+
+
+#define IPC_IS_AOT 650
+/* (requires Winamp 5.04+)
+** SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_IS_AOT);
+** This will return the status of the always on top flag.
+** Note: This may not match the actual TOPMOST window flag while another fullscreen
+** application is focused if the user has the 'Disable always on top while fullscreen
+** applications are focused' option under the General Preferences page is checked.
+*/
+
+
+#define IPC_USES_RECYCLEBIN 651
+/* (requires Winamp 5.09+)
+** int use_bin=SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_USES_RECYCLEBIN);
+** This will return 1 if the deleted file should be sent to the recycle bin or
+** 0 if deleted files should be deleted permanently (default action for < 5.09).
+**
+** Note: if you use this on pre 5.09 installs of Winamp then it will return 1 which is
+** not correct but is due to the way that SendMessage(..) handles un-processed messages.
+** Below is a quick case for checking if the returned value is correct.
+**
+** if(SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_USES_RECYCLEBIN) &&
+** SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETVERSION)>=0x5009)
+** {
+** // can safely follow the option to recycle the file
+** }
+** else
+* {
+** // need to do a permanent delete of the file
+** }
+*/
+
+
+#define IPC_FLUSHAUDITS 652
+/*
+** SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_FLUSHAUDITS);
+**
+** Will flush any pending audits in the global audits queue
+**
+*/
+
+#define IPC_GETPLAYITEM_START 653
+#define IPC_GETPLAYITEM_END 654
+
+
+#define IPC_GETVIDEORESIZE 655
+#define IPC_SETVIDEORESIZE 656
+
+
+#define IPC_INITIAL_SHOW_STATE 657
+/* (requires Winamp 5.36+)
+** int show_state = SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_INITIAL_SHOW_STATE);
+** returns the processed value of nCmdShow when Winamp was started
+** (see MSDN documentation the values passed to WinMain(..) for what this should be)
+**
+** e.g.
+** if(SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_INITIAL_SHOW_STATE) == SW_SHOWMINIMIZED){
+** // we are starting minimised so process as needed (keep our window hidden)
+** }
+**
+** Useful for seeing if winamp was run minimised on startup so you can act accordingly.
+** On pre-5.36 versions this will effectively return SW_NORMAL/SW_SHOWNORMAL due to the
+** handling of unknown apis returning 1 from Winamp.
+*/
+
+// >>>>>>>>>>> Next is 658
+
+#define IPC_PLCMD 1000
+
+#define PLCMD_ADD 0
+#define PLCMD_REM 1
+#define PLCMD_SEL 2
+#define PLCMD_MISC 3
+#define PLCMD_LIST 4
+
+//#define IPC_MBCMD 1001
+
+#define MBCMD_BACK 0
+#define MBCMD_FORWARD 1
+#define MBCMD_STOP 2
+#define MBCMD_RELOAD 3
+#define MBCMD_MISC 4
+
+#define IPC_VIDCMD 1002
+
+#define VIDCMD_FULLSCREEN 0
+#define VIDCMD_1X 1
+#define VIDCMD_2X 2
+#define VIDCMD_LIB 3
+#define VIDPOPUP_MISC 4
+
+//#define IPC_MBURL 1003 //sets the URL
+//#define IPC_MBGETCURURL 1004 //copies the current URL into wParam (have a 4096 buffer ready)
+//#define IPC_MBGETDESC 1005 //copies the current URL description into wParam (have a 4096 buffer ready)
+//#define IPC_MBCHECKLOCFILE 1006 //checks that the link file is up to date (otherwise updates it). wParam=parent HWND
+//#define IPC_MBREFRESH 1007 //refreshes the "now playing" view in the library
+//#define IPC_MBGETDEFURL 1008 //copies the default URL into wParam (have a 4096 buffer ready)
+
+#define IPC_STATS_LIBRARY_ITEMCNT 1300 // updates library count status
+
+/*
+** IPC's in the message range 2000 - 3000 are reserved internally for freeform messages.
+** These messages are taken from ff_ipc.h which is part of the Modern skin integration.
+*/
+
+#define IPC_FF_FIRST 2000
+
+#define IPC_FF_COLOURTHEME_CHANGE IPC_FF_ONCOLORTHEMECHANGED
+#define IPC_FF_ONCOLORTHEMECHANGED IPC_FF_FIRST + 3
+/*
+** This is a notification message sent when the user changes the colour theme in a Modern
+** skin and can also be detected when the Modern skin is first loaded as the gen_ff plugin
+** applies relevant settings and styles (like the colour theme).
+**
+** The value of wParam is the name of the new color theme being switched to.
+** SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)(const char*)colour_theme_name,IPC_FF_ONCOLORTHEMECHANGED);
+**
+** (IPC_FF_COLOURTHEME_CHANGE is the name i (DrO) was using before getting a copy of
+** ff_ipc.h with the proper name in it).
+*/
+
+
+#define IPC_FF_ISMAINWND IPC_FF_FIRST + 4
+/*
+** int ismainwnd = (HWND)SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)(HWND)test_wnd,IPC_FF_ISMAINWND);
+**
+** This allows you to determine if the window handle passed to it is a modern skin main
+** window or not. If it is a main window or any of its windowshade variants then it will
+** return 1.
+**
+** Because of the way modern skins are implemented, it is possible for this message to
+** return a positive test result for a number of window handles within the current Winamp
+** process. This appears to be because you can have a visible main window, a compact main
+** window and also a winshaded version.
+**
+** The following code example below is one way of seeing how this api works since it will
+** enumerate all windows related to Winamp at the time and allows you to process as
+** required when a detection happens.
+**
+**
+** EnumThreadWindows(GetCurrentThreadId(),enumWndProc,0);
+**
+** BOOL CALLBACK enumWndProc(HWND hwnd, LPARAM lParam){
+**
+** if(SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)hwnd,IPC_FF_ISMAINWND)) {
+** // do processing in here
+** // or continue the enum for other main windows (if they exist)
+** // and just comment out the line below
+** return 0;
+** }
+** return 1;
+** }
+*/
+
+
+#define IPC_FF_GETCONTENTWND IPC_FF_FIRST + 5
+/*
+** HWND wa2embed = (HWND)SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)(HWND)test_wnd,IPC_FF_GETCONTENTWND);
+**
+** This will return the Winamp 2 window that is embedded in the window's container
+** i.e. if hwnd is the playlist editor windowshade hwnd then it will return the Winamp 2
+** playlist editor hwnd.
+**
+** If no content is found such as the window has nothing embedded then this will return
+** the hwnd passed to it.
+*/
+
+
+#define IPC_FF_NOTIFYHOTKEY IPC_FF_FIRST + 6
+/*
+** This is a notification message sent when the user uses a global hotkey combination
+** which had been registered with the gen_hotkeys plugin.
+**
+** The value of wParam is the description of the hotkey as passed to gen_hotkeys.
+** SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)(const char*)hotkey_desc,IPC_FF_NOTIFYHOTKEY);
+*/
+
+#define IPC_FF_LAST 3000
+
+
+/*
+** General IPC messages in Winamp
+**
+** All notification messages appear in the lParam of the main window message proceedure.
+*/
+
+
+#define IPC_GETDROPTARGET 3001
+/* (requires Winamp 5.0+)
+** IDropTarget* IDrop = (IDropTarget*)SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETDROPTARGET);
+**
+** You call this to retrieve a copy of the IDropTarget interface which Winamp created for
+** handling external drag and drop operations on to it's Windows. This is only really
+** useful if you're providing an alternate interface and want your Windows to provide the
+** same drag and drop support as Winamp normally provides the user. Check out MSDN or
+** your prefered search facility for more information about the IDropTarget interface and
+** what's needed to handle it in your own instance.
+*/
+
+
+#define IPC_PLAYLIST_MODIFIED 3002
+/* (requires Winamp 5.0+)
+** This is a notification message sent to the main Winamp window whenever the playlist is
+** modified in any way e.g. the addition/removal of a playlist entry.
+**
+** It is not a good idea to do large amounts of processing in this notification since it
+** will slow down Winamp as playlist entries are modified (especially when you're adding
+** in a large playlist).
+**
+** if(uMsg == WM_WA_IPC && lParam == IPC_PLAYLIST_MODIFIED)
+** {
+** // do what you need to do here
+** }
+*/
+
+
+#define IPC_PLAYING_FILE 3003
+/* (requires Winamp 5.0+)
+** This is a notification message sent to the main Winamp window when playback begins for
+** a file. This passes the full filepath in the wParam of the message received.
+**
+** if(uMsg == WM_WA_IPC && lParam == IPC_PLAYING_FILE)
+** {
+** // do what you need to do here, e.g.
+** process_file((char*)wParam);
+** }
+*/
+
+
+#define IPC_PLAYING_FILEW 13003
+/* (requires Winamp 5.0+)
+** This is a notification message sent to the main Winamp window when playback begins for
+** a file. This passes the full filepath in the wParam of the message received.
+**
+** if(uMsg == WM_WA_IPC && lParam == IPC_PLAYING_FILEW)
+** {
+** // do what you need to do here, e.g.
+** process_file((wchar_t*)wParam);
+** }
+*/
+
+
+#define IPC_FILE_TAG_MAY_HAVE_UPDATED 3004
+#define IPC_FILE_TAG_MAY_HAVE_UPDATEDW 3005
+/* (requires Winamp 5.0+)
+** This is a notification message sent to the main Winamp window when a file's tag
+** (e.g. id3) may have been updated. This appears to be sent when the InfoBox(..) function
+** of the associated input plugin returns a 1 (which is the file information dialog/editor
+** call normally).
+**
+** if(uMsg == WM_WA_IPC && lParam == IPC_FILE_TAG_MAY_HAVE_UPDATED)
+** {
+** // do what you need to do here, e.g.
+** update_info_on_file_update((char*)wParam);
+** }
+*/
+
+
+#define IPC_ALLOW_PLAYTRACKING 3007
+/* (requires Winamp 5.0+)
+** SendMessage(hwnd_winamp,WM_WA_IPC,allow,IPC_ALLOW_PLAYTRACKING);
+** Send allow as nonzero to allow play tracking and zero to disable the mode.
+*/
+
+
+#define IPC_HOOK_OKTOQUIT 3010
+/* (requires Winamp 5.0+)
+** This is a notification message sent to the main Winamp window asking if it's okay to
+** close or not. Return zero to prevent Winamp from closing or return anything non-zero
+** to allow Winamp to close.
+**
+** The best implementation of this option is to let the message pass through to the
+** original window proceedure since another plugin may want to have a say in the matter
+** with regards to Winamp closing.
+**
+** if(uMsg == WM_WA_IPC && lParam == IPC_HOOK_OKTOQUIT)
+** {
+** // do what you need to do here, e.g.
+** if(no_shut_down())
+** {
+** return 1;
+** }
+** }
+*/
+
+
+#define IPC_WRITECONFIG 3011
+/* (requires Winamp 5.0+)
+** SendMessage(hwnd_winamp,WM_WA_IPC,write_type,IPC_WRITECONFIG);
+**
+** Send write_type as 2 to write all config settings and the current playlist.
+**
+** Send write_type as 1 to write the playlist and common settings.
+** This won't save the following ini settings::
+**
+** defext, titlefmt, proxy, visplugin_name, dspplugin_name, check_ft_startup,
+** visplugin_num, pe_fontsize, visplugin_priority, visplugin_autoexec, dspplugin_num,
+** sticon, splash, taskbar, dropaotfs, ascb_new, ttips, riol, minst, whichicon,
+** whichicon2, addtolist, snap, snaplen, parent, hilite, disvis, rofiob, shownumsinpl,
+** keeponscreen, eqdsize, usecursors, fixtitles, priority, shuffle_morph_rate,
+** useexttitles, bifont, inet_mode, ospb, embedwnd_freesize, no_visseh
+** (the above was valid for 5.1)
+**
+** Send write_type as 0 to write the common and less common settings and no playlist.
+*/
+
+
+#define IPC_UPDATE_URL 3012
+// pass the URL (char *) in lparam, will be free()'d on done.
+
+
+#define IPC_GET_RANDFUNC 3015 // returns a function to get a random number
+/* (requires Winamp 5.1+)
+** int (*randfunc)(void) = (int(*)(void))SendMessage(plugin.hwndParent,WM_WA_IPC,0,IPC_GET_RANDFUNC);
+** if(randfunc && randfunc != 1){
+** randfunc();
+** }
+**
+** This will return a positive 32-bit number (essentially 31-bit).
+** The check for a returned value of 1 is because that's the default return value from
+** SendMessage(..) when it is not handled so is good to check for it in this situation.
+*/
+
+
+#define IPC_METADATA_CHANGED 3017
+/* (requires Winamp 5.1+)
+** int changed=SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)(char*)field,IPC_METADATA_CHANGED);
+** a plugin can SendMessage this to winamp if internal metadata has changes.
+** wParam should be a char * of what field changed
+**
+** Currently used for internal actions (and very few at that) the intent of this api is
+** to allow a plugin to call it when metadata has changed in the current playlist entry
+** e.g.a new id3v2 tag was found in a stream
+**
+** The wparam value can either be NULL or a pointer to an ansi string for the metadata
+** which has changed. This can be thought of as an advanced version of IPC_UPDTITLE and
+** could be used to allow for update of the current title when a specific tag changed.
+**
+** Not recommended to be used since there is not the complete handling implemented in
+** Winamp for it at the moment.
+*/
+
+
+#define IPC_SKIN_CHANGED 3018
+/* (requires Winamp 5.1+)
+** This is a notification message sent to the main Winamp window by itself whenever
+** the skin in use is changed. There is no information sent by the wParam for this.
+**
+** if(message == WM_WA_IPC && lparam == IPC_SKIN_CHANGED)
+** {
+** // do what you need to do to handle skin changes, e.g. call WADlg_init(hwnd_winamp);
+** }
+*/
+
+
+#define IPC_REGISTER_LOWORD_COMMAND 3019
+/* (requires Winamp 5.1+)
+** WORD id = SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_REGISTER_LOWORD_COMMAND);
+** This will assign you a unique id for making your own commands such as for extra menu
+** entries. The starting value returned by this message will potentially change as and
+** when the main resource file of Winamp is updated with extra data so assumptions cannot
+** be made on what will be returned and plugin loading order will affect things as well.
+
+** 5.33+
+** If you want to reserve more than one id, you can pass the number of ids required in wParam
+*/
+
+
+#define IPC_GET_DISPATCH_OBJECT 3020 // gets winamp main IDispatch * (for embedded webpages)
+#define IPC_GET_UNIQUE_DISPATCH_ID 3021 // gives you a unique dispatch ID that won't conflict with anything in winamp's IDispatch *
+#define IPC_ADD_DISPATCH_OBJECT 3022 // add your own dispatch object into winamp's. This lets embedded webpages access your functions
+// pass a pointer to DispatchInfo (see below). Winamp makes a copy of all this data so you can safely delete it later
+typedef struct
+{
+ wchar_t *name; // filled in by plugin, make sure it's a unicode string!! (i.e. L"myObject" instead of "myObject).
+ struct IDispatch *dispatch; // filled in by plugin
+ DWORD id; // filled in by winamp on return
+} DispatchInfo;
+
+// see IPC_JSAPI2_GET_DISPATCH_OBJECT for version 2 of the Dispatchable scripting interface
+
+#define IPC_GET_PROXY_STRING 3023
+/* (requires Winamp 5.11+)
+** char* proxy_string=(char*)SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GET_PROXY_STRING);
+** This will return the same string as is shown on the General Preferences page.
+*/
+
+
+#define IPC_USE_REGISTRY 3024
+/* (requires Winamp 5.11+)
+** int reg_enabled=SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_USE_REGISTRY);
+** This will return 0 if you should leave your grubby hands off the registry (i.e. for
+** lockdown mode). This is useful if Winamp is run from a USB drive and you can't alter
+** system settings, etc.
+*/
+
+
+#define IPC_GET_API_SERVICE 3025
+/* (requires Winamp 5.12+)
+** api_service* api_service = (api_service)SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GET_API_SERVICE);
+** This api will return Winamp's api_service pointer (which is what Winamp3 used, heh).
+** If this api is not supported in the Winamp version that is being used at the time then
+** the returned value from this api will be 1 which is a good version check.
+**
+** As of 5.12 there is support for .w5s plugins which reside in %WinampDir%\System and
+** are intended for common code that can be shared amongst other plugins e.g. jnetlib.w5s
+** which contains jnetlib in one instance instead of being duplicated multiple times in
+** all of the plugins which need internet access.
+**
+** Details on the .w5s specifications will come at some stage (possibly).
+*/
+
+
+typedef struct {
+ const wchar_t *filename;
+ const wchar_t *metadata;
+ wchar_t *ret;
+ size_t retlen;
+} extendedFileInfoStructW;
+
+#define IPC_GET_EXTENDED_FILE_INFOW 3026
+/* (requires Winamp 5.13+)
+** Pass a pointer to the above struct in wParam
+*/
+
+
+#define IPC_GET_EXTENDED_FILE_INFOW_HOOKABLE 3027
+#define IPC_SET_EXTENDED_FILE_INFOW 3028
+/* (requires Winamp 5.13+)
+** Pass a pointer to the above struct in wParam
+*/
+
+
+#define IPC_PLAYLIST_GET_NEXT_SELECTED 3029
+/* (requires 5.2+)
+** int pl_item = SendMessage(hwnd_winamp,WM_WA_IPC,start,IPC_PLAYLIST_GET_NEXT_SELECTED);
+**
+** This works just like the ListView_GetNextItem(..) macro for ListView controls.
+** 'start' is the index of the playlist item that you want to begin the search after or
+** set this as -1 for the search to begin with the first item of the current playlist.
+**
+** This will return the index of the selected playlist according to the 'start' value or
+** it returns -1 if there is no selection or no more selected items according to 'start'.
+**
+** Quick example:
+**
+** int sel = -1;
+** // keep incrementing the start of the search so we get all of the selected entries
+** while((sel = SendMessage(hwnd_winamp,WM_WA_IPC,sel,IPC_PLAYLIST_GET_NEXT_SELECTED))!=-1){
+** // show the playlist file entry of the selected item(s) if there were any
+** MessageBox(hwnd_winamp,(char*)SendMessage(hwnd_winamp,WM_WA_IPC,sel,IPC_GETPLAYLISTFILE),0,0);
+** }
+*/
+
+
+#define IPC_PLAYLIST_GET_SELECTED_COUNT 3030
+/* (requires 5.2+)
+** int selcnt = SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_PLAYLIST_GET_SELECTED_COUNT);
+** This will return the number of selected playlist entries.
+*/
+
+
+#define IPC_GET_PLAYING_FILENAME 3031
+// returns wchar_t * of the currently playing filename
+
+#define IPC_OPEN_URL 3032
+// send either ANSI or Unicode string (it'll figure it out, but it MUST start with "h"!, so don't send ftp:// or anything funny)
+// you can also send this one from another process via WM_COPYDATA (unicode only)
+
+
+#define IPC_USE_UXTHEME_FUNC 3033
+/* (requires Winamp 5.35+)
+** int ret = SendMessage(hwnd_winamp,WM_WA_IPC,param,IPC_USE_UXTHEME_FUNC);
+** param can be IPC_ISWINTHEMEPRESENT or IPC_ISAEROCOMPOSITIONACTIVE or a valid hwnd.
+**
+** If you pass a hwnd then it will apply EnableThemeDialogTexture(ETDT_ENABLETAB)
+** so your tabbed dialogs can use the correct theme (on supporting OSes ie XP+).
+**
+** Otherwise this will return a value based on the param passed (as defined below).
+** For compatability, the return value will be zero on success (as 1 is returned
+** for unsupported ipc calls on older Winamp versions)
+*/
+ #define IPC_ISWINTHEMEPRESENT 0
+/* This will return 0 if uxtheme.dll is present
+** int isthemethere = !SendMessage(hwnd_winamp,WM_WA_IPC,IPC_ISWINTHEMEPRESENT,IPC_USE_UXTHEME_FUNC);
+*/
+ #define IPC_ISAEROCOMPOSITIONACTIVE 1
+/* This will return 0 if aero composition is active
+** int isaero = !SendMessage(hwnd_winamp,WM_WA_IPC,IPC_ISAEROCOMPOSITIONACTIVE,IPC_USE_UXTHEME_FUNC);
+*/
+
+
+#define IPC_GET_PLAYING_TITLE 3034
+// returns wchar_t * of the current title
+
+
+#define IPC_CANPLAY 3035
+// pass const wchar_t *, returns an in_mod * or 0
+
+
+typedef struct {
+ // fill these in...
+ size_t size; // init to sizeof(artFetchData)
+ HWND parent; // parent window of the dialogue
+
+ // fill as much of these in as you can, otherwise leave them 0
+ const wchar_t *artist;
+ const wchar_t *album;
+ int year, amgArtistId, amgAlbumId;
+
+ int showCancelAll; // if set to 1, this shows a "Cancel All" button on the dialogue
+
+ // winamp will fill these in if the call returns successfully:
+ void* imgData; // a buffer filled with compressed image data. free with WASABI_API_MEMMGR->sysFree()
+ int imgDataLen; // the size of the buffer
+ wchar_t type[10]; // eg: "jpg"
+ const wchar_t *gracenoteFileId; // if you know it
+} artFetchData;
+
+#define IPC_FETCH_ALBUMART 3036
+/* pass an artFetchData*. This will show a dialog guiding the use through choosing art, and return when it's finished
+** return values:
+** 1: error showing dialog
+** 0: success
+** -1: cancel was pressed
+** -2: cancel all was pressed
+*/
+
+#define IPC_JSAPI2_GET_DISPATCH_OBJECT 3037
+/* pass your service's unique ID, as a wchar_t * string, in wParam
+** Winamp will copy the string, so don't worry about keeping it around
+** An IDispatch * object will be returned (cast the return value from SendMessage)
+** This IDispatch can be used for scripting/automation/VB interaction
+** Pass to IE via IDocHostUIHandler::GetExternal and it will become window.external in javscript
+*/
+
+#define IPC_REGISTER_WINAMP_IPCMESSAGE 65536
+/* (requires Winamp 5.0+)
+** DWORD id = SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)name,IPC_REGISTER_WINAMP_IPCMESSAGE);
+** The value 'id' returned is > 65536 and is incremented on subsequent calls for unique
+** 'name' values passed to it. By using the same 'name' in different plugins will allow a
+** common runtime api to be provided for the currently running instance of Winamp
+** e.g.
+** PostMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)my_param,registered_ipc);
+** Have a look at wa_hotkeys.h for an example on how this api is used in practice for a
+** custom WM_WA_IPC message.
+**
+** if(uMsg == WM_WA_IPC && lParam == id_from_register_winamp_ipcmessage){
+** // do things
+** }
+*/
+
+#endif//_WA_IPC_H_
\ No newline at end of file |