1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

MinGW: Improve compatibility

With this patch applied, the DemoRunner should build under MinGW, and be
(nearly) feature-complete compared to the MSVC build.

Specifically, when building with MinGW:
- Adds support for accessibility
- Fixes build issues in the juce_video module
- Fixes a link issue in the VST3 wrapper when VST3_CAN_REPLACE_VST2 is
  defined
- Adds support for the new-style native FileChooser
- Tidies up some other low-severity warnings

Known issues:
- Direct2D rendering is still not supported when building with MinGW due
  to ABI compatibilities.
This commit is contained in:
reuk 2022-01-10 15:30:01 +00:00
parent b65803e8a3
commit 640194c878
No known key found for this signature in database
GPG key ID: 9ADCD339CFC98A11
37 changed files with 1283 additions and 478 deletions

View file

@ -53,9 +53,9 @@ if((CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") OR (CMAKE_CXX_COMPILER_FRONTEND_VARIA
$<$<CONFIG:Release>:$<IF:$<STREQUAL:"${CMAKE_CXX_COMPILER_ID}","MSVC">,-GL,-flto>>)
target_link_libraries(juce_recommended_lto_flags INTERFACE
$<$<CONFIG:Release>:$<$<STREQUAL:"${CMAKE_CXX_COMPILER_ID}","MSVC">:-LTCG>>)
elseif((CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
OR (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
OR (CMAKE_CXX_COMPILER_ID STREQUAL "GNU"))
elseif((NOT MINGW) AND ((CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
OR (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
OR (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")))
target_compile_options(juce_recommended_lto_flags INTERFACE $<$<CONFIG:Release>:-flto>)
target_link_libraries(juce_recommended_lto_flags INTERFACE $<$<CONFIG:Release>:-flto>)
endif()

View file

@ -58,7 +58,7 @@ JUCE_BEGIN_NO_SANITIZE ("vptr")
#if JUCE_VST3_CAN_REPLACE_VST2
#if ! JUCE_MSVC
#if ! JUCE_MSVC && ! defined (__cdecl)
#define __cdecl
#endif
@ -3541,10 +3541,12 @@ DECLARE_CLASS_IID (JuceAudioProcessor, 0x0101ABAB, 0xABCDEF01, JucePlugin_Manufa
DEF_CLASS_IID (JuceAudioProcessor)
#if JUCE_VST3_CAN_REPLACE_VST2
// Defined in PluginUtilities.cpp
void getUUIDForVST2ID (bool, uint8[16]);
FUID getFUIDForVST2ID (bool forControllerUID)
{
TUID uuid;
extern JUCE_API void getUUIDForVST2ID (bool, uint8[16]);
getUUIDForVST2ID (forControllerUID, (uint8*) uuid);
return FUID (uuid);
}

View file

@ -73,11 +73,6 @@
#define JucePlugin_Build_RTAS 0
#endif
#if ! (defined (_MSC_VER) || defined (__APPLE_CPP__) || defined (__APPLE_CC__) || defined (LINUX) || defined (__linux__))
#undef JucePlugin_Build_VST3
#define JucePlugin_Build_VST3 0
#endif
//==============================================================================
#if JucePlugin_Build_LV2 && ! defined (JucePlugin_LV2URI)
#error "You need to define the JucePlugin_LV2URI value!"

View file

@ -46,7 +46,7 @@ namespace juce
#define VST3_REPLACEMENT_AVAILABLE 1
// NB: Nasty old-fashioned code in here because it's copied from the Steinberg example code.
void JUCE_API getUUIDForVST2ID (bool forControllerUID, uint8 uuid[16])
void getUUIDForVST2ID (bool forControllerUID, uint8 uuid[16])
{
#if JUCE_MSVC
const auto juce_sprintf = [] (auto&& head, auto&&... tail) { sprintf_s (head, numElementsInArray (head), tail...); };

View file

@ -581,7 +581,7 @@ private:
tresult getInt (Steinberg::int64& result) const
{
if (kind != Kind::Int)
if (kind != Kind::tagInt)
return kResultFalse;
result = storage.storedInt;
@ -590,7 +590,7 @@ private:
tresult getFloat (double& result) const
{
if (kind != Kind::Float)
if (kind != Kind::tagFloat)
return kResultFalse;
result = storage.storedFloat;
@ -599,7 +599,7 @@ private:
tresult getString (Vst::TChar* data, Steinberg::uint32 numBytes) const
{
if (kind != Kind::String)
if (kind != Kind::tagString)
return kResultFalse;
std::memcpy (data,
@ -610,7 +610,7 @@ private:
tresult getBinary (const void*& data, Steinberg::uint32& numBytes) const
{
if (kind != Kind::Binary)
if (kind != Kind::tagBinary)
return kResultFalse;
data = storage.storedBinary.data();
@ -619,19 +619,19 @@ private:
}
private:
void constructFrom (Int x) noexcept { kind = Kind::Int; new (&storage.storedInt) Int (std::move (x)); }
void constructFrom (Float x) noexcept { kind = Kind::Float; new (&storage.storedFloat) Float (std::move (x)); }
void constructFrom (String x) noexcept { kind = Kind::String; new (&storage.storedString) String (std::move (x)); }
void constructFrom (Binary x) noexcept { kind = Kind::Binary; new (&storage.storedBinary) Binary (std::move (x)); }
void constructFrom (Int x) noexcept { kind = Kind::tagInt; new (&storage.storedInt) Int (std::move (x)); }
void constructFrom (Float x) noexcept { kind = Kind::tagFloat; new (&storage.storedFloat) Float (std::move (x)); }
void constructFrom (String x) noexcept { kind = Kind::tagString; new (&storage.storedString) String (std::move (x)); }
void constructFrom (Binary x) noexcept { kind = Kind::tagBinary; new (&storage.storedBinary) Binary (std::move (x)); }
void reset() noexcept
{
switch (kind)
{
case Kind::Int: break;
case Kind::Float: break;
case Kind::String: storage.storedString.~vector(); break;
case Kind::Binary: storage.storedBinary.~vector(); break;
case Kind::tagInt: break;
case Kind::tagFloat: break;
case Kind::tagString: storage.storedString.~vector(); break;
case Kind::tagBinary: storage.storedBinary.~vector(); break;
}
}
@ -639,14 +639,14 @@ private:
{
switch (other.kind)
{
case Kind::Int: constructFrom (std::move (other.storage.storedInt)); break;
case Kind::Float: constructFrom (std::move (other.storage.storedFloat)); break;
case Kind::String: constructFrom (std::move (other.storage.storedString)); break;
case Kind::Binary: constructFrom (std::move (other.storage.storedBinary)); break;
case Kind::tagInt: constructFrom (std::move (other.storage.storedInt)); break;
case Kind::tagFloat: constructFrom (std::move (other.storage.storedFloat)); break;
case Kind::tagString: constructFrom (std::move (other.storage.storedString)); break;
case Kind::tagBinary: constructFrom (std::move (other.storage.storedBinary)); break;
}
}
enum class Kind { Int, Float, String, Binary };
enum class Kind { tagInt, tagFloat, tagString, tagBinary };
union Storage
{

View file

@ -132,7 +132,9 @@
#define STRICT 1
#define WIN32_LEAN_AND_MEAN 1
#if JUCE_MINGW
#define _WIN32_WINNT 0x0600
#if ! defined (_WIN32_WINNT)
#define _WIN32_WINNT 0x0600
#endif
#else
#define _WIN32_WINNT 0x0602
#endif

View file

@ -53,8 +53,6 @@ void CriticalSection::exit() const noexcept { LeaveCriticalSection ((CRI
//==============================================================================
void JUCE_API juce_threadEntryPoint (void*);
static unsigned int STDMETHODCALLTYPE threadEntryProc (void* userData)
{
if (juce_messageWindowHandle != nullptr)

View file

@ -71,7 +71,7 @@ namespace juce
#pragma intrinsic (__debugbreak)
#endif
#define JUCE_BREAK_IN_DEBUGGER { __debugbreak(); }
#elif JUCE_INTEL && (JUCE_GCC || JUCE_MAC || JUCE_CLANG)
#elif JUCE_INTEL && (JUCE_GCC || JUCE_CLANG || JUCE_MAC)
#if JUCE_NO_INLINE_ASM
#define JUCE_BREAK_IN_DEBUGGER { }
#else

View file

@ -379,8 +379,7 @@ String Time::getTimeZone() const
{
String zone[2];
#if JUCE_WINDOWS
#if JUCE_MSVC || JUCE_CLANG
#if JUCE_WINDOWS && (JUCE_MSVC || JUCE_CLANG)
_tzset();
for (int i = 0; i < 2; ++i)
@ -390,9 +389,6 @@ String Time::getTimeZone() const
_get_tzname (&length, name, sizeof (name) - 1, i);
zone[i] = name;
}
#else
#warning "Can't find a replacement for tzset on mingw - ideas welcome!"
#endif
#else
tzset();

View file

@ -54,6 +54,14 @@
#endif
#if JUCE_USE_DIRECTWRITE || JUCE_DIRECT2D
/* This is a workaround for broken-by-default function definitions
in the MinGW headers. If you're using a newer distribution of MinGW,
then your headers may substitute the broken definitions with working definitions
when this flag is enabled. Unfortunately, not all MinGW headers contain this
workaround, so Direct2D remains disabled by default when building with MinGW.
*/
#define WIDL_EXPLICIT_AGGREGATE_RETURNS 1
/* If you hit a compile error trying to include these files, you may need to update
your version of the Windows SDK to the latest one. The DirectWrite and Direct2D
headers are in the version 7 SDKs.

View file

@ -201,6 +201,7 @@ namespace DirectWriteTypeLayout
ComSmartPtr<IDWriteFont> dwFont;
auto hr = fontCollection.GetFontFromFontFace (glyphRun.fontFace, dwFont.resetAndGetPointerAddress());
ignoreUnused (hr);
jassert (dwFont != nullptr);
ComSmartPtr<IDWriteFontFamily> dwFontFamily;
@ -289,6 +290,7 @@ namespace DirectWriteTypeLayout
ComSmartPtr<IDWriteFontFamily> fontFamily;
auto hr = fontCollection.GetFontFamily (fontIndex, fontFamily.resetAndGetPointerAddress());
ignoreUnused (hr);
ComSmartPtr<IDWriteFont> dwFont;
uint32 fontFacesCount = 0;
@ -394,6 +396,7 @@ namespace DirectWriteTypeLayout
UINT32 actualLineCount = 0;
auto hr = dwTextLayout->GetLineMetrics (nullptr, 0, &actualLineCount);
ignoreUnused (hr);
layout.ensureStorageAllocated ((int) actualLineCount);
@ -415,7 +418,7 @@ namespace DirectWriteTypeLayout
line.stringRange = Range<int> (lastLocation, lastLocation + (int) dwLineMetrics[i].length);
line.lineOrigin.y += yAdjustment;
yAdjustment += extraLineSpacing;
lastLocation += dwLineMetrics[i].length;
lastLocation += (int) dwLineMetrics[i].length;
}
}

View file

@ -36,6 +36,7 @@ namespace
uint32 index = 0;
BOOL exists = false;
auto hr = names->FindLocaleName (L"en-us", &index, &exists);
ignoreUnused (hr);
if (! exists)
index = 0;
@ -54,7 +55,7 @@ namespace
jassert (family != nullptr);
ComSmartPtr<IDWriteLocalizedStrings> familyNames;
auto hr = family->GetFamilyNames (familyNames.resetAndGetPointerAddress());
jassert (SUCCEEDED (hr)); ignoreUnused (hr);
jassertquiet (SUCCEEDED (hr));
return getLocalisedName (familyNames);
}
@ -63,7 +64,7 @@ namespace
jassert (font != nullptr);
ComSmartPtr<IDWriteLocalizedStrings> faceNames;
auto hr = font->GetFaceNames (faceNames.resetAndGetPointerAddress());
jassert (SUCCEEDED (hr)); ignoreUnused (hr);
jassertquiet (SUCCEEDED (hr));
return getLocalisedName (faceNames);
}
@ -152,6 +153,7 @@ public:
uint32 fontIndex = 0;
auto hr = fontCollection->FindFamilyName (font.getTypefaceName().toWideCharPointer(), &fontIndex, &fontFound);
ignoreUnused (hr);
if (! fontFound)
fontIndex = 0;

View file

@ -235,6 +235,7 @@ StringArray Font::findAllTypefaceStyles (const String& family)
BOOL fontFound = false;
uint32 fontIndex = 0;
auto hr = factories->systemFonts->FindFamilyName (family.toWideCharPointer(), &fontIndex, &fontFound);
ignoreUnused (hr);
if (! fontFound)
fontIndex = 0;

View file

@ -67,11 +67,8 @@
#include <vfw.h>
#include <commdlg.h>
#include <commctrl.h>
#if ! JUCE_MINGW
#include <UIAutomation.h>
#include <sapi.h>
#endif
#include <UIAutomation.h>
#include <sapi.h>
#if JUCE_WEB_BROWSER
#include <exdisp.h>
@ -310,26 +307,13 @@ JUCE_END_IGNORE_WARNINGS_GCC_LIKE
#include "native/juce_mac_MouseCursor.mm"
#elif JUCE_WINDOWS
#if ! JUCE_MINGW
#include "native/accessibility/juce_win32_WindowsUIAWrapper.h"
#include "native/accessibility/juce_win32_AccessibilityElement.h"
#include "native/accessibility/juce_win32_UIAHelpers.h"
#include "native/accessibility/juce_win32_UIAProviders.h"
#include "native/accessibility/juce_win32_AccessibilityElement.cpp"
#include "native/accessibility/juce_win32_Accessibility.cpp"
#else
namespace juce
{
namespace WindowsAccessibility
{
long getUiaRootObjectId() { return -1; }
bool handleWmGetObject (AccessibilityHandler*, WPARAM, LPARAM, LRESULT*) { return false; }
void revokeUIAMapEntriesForWindow (HWND) {}
}
}
#endif
#include "native/accessibility/juce_win32_ComInterfaces.h"
#include "native/accessibility/juce_win32_WindowsUIAWrapper.h"
#include "native/accessibility/juce_win32_AccessibilityElement.h"
#include "native/accessibility/juce_win32_UIAHelpers.h"
#include "native/accessibility/juce_win32_UIAProviders.h"
#include "native/accessibility/juce_win32_AccessibilityElement.cpp"
#include "native/accessibility/juce_win32_Accessibility.cpp"
#include "native/juce_win32_Windowing.cpp"
#include "native/juce_win32_DragAndDrop.cpp"
#include "native/juce_win32_FileChooser.cpp"
@ -383,8 +367,8 @@ namespace juce
#if JUCE_WINDOWS
namespace juce
{
MIDL_INTERFACE ("a5cd92ff-29be-454c-8d04-d82879fb3f1b")
juce_IVirtualDesktopManager : public IUnknown
JUCE_COMCLASS (JuceIVirtualDesktopManager, "a5cd92ff-29be-454c-8d04-d82879fb3f1b") : public IUnknown
{
public:
virtual HRESULT STDMETHODCALLTYPE IsWindowOnCurrentVirtualDesktop(
@ -400,13 +384,13 @@ public:
__RPC__in REFGUID desktopId) = 0;
};
JUCE_COMCLASS (juce_VirtualDesktopManager, "aa509086-5ca9-4c25-8f95-589d3c07b48a");
JUCE_COMCLASS (JuceVirtualDesktopManager, "aa509086-5ca9-4c25-8f95-589d3c07b48a");
} // namespace juce
#ifdef __CRT_UUID_DECL
__CRT_UUID_DECL (juce::juce_IVirtualDesktopManager, 0xa5cd92ff, 0x29be, 0x454c, 0x8d, 0x04, 0xd8, 0x28, 0x79, 0xfb, 0x3f, 0x1b)
__CRT_UUID_DECL (juce::juce_VirtualDesktopManager, 0xaa509086, 0x5ca9, 0x4c25, 0x8f, 0x95, 0x58, 0x9d, 0x3c, 0x07, 0xb4, 0x8a)
__CRT_UUID_DECL (juce::JuceIVirtualDesktopManager, 0xa5cd92ff, 0x29be, 0x454c, 0x8d, 0x04, 0xd8, 0x28, 0x79, 0xfb, 0x3f, 0x1b)
__CRT_UUID_DECL (juce::JuceVirtualDesktopManager, 0xaa509086, 0x5ca9, 0x4c25, 0x8f, 0x95, 0x58, 0x9d, 0x3c, 0x07, 0xb4, 0x8a)
#endif
bool juce::isWindowOnCurrentVirtualDesktop (void* x)
@ -416,16 +400,16 @@ bool juce::isWindowOnCurrentVirtualDesktop (void* x)
static auto* desktopManager = []
{
juce_IVirtualDesktopManager* result = nullptr;
JuceIVirtualDesktopManager* result = nullptr;
JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wlanguage-extension-token")
if (SUCCEEDED (CoCreateInstance (__uuidof (juce_VirtualDesktopManager), nullptr, CLSCTX_ALL, IID_PPV_ARGS (&result))))
if (SUCCEEDED (CoCreateInstance (__uuidof (JuceVirtualDesktopManager), nullptr, CLSCTX_ALL, IID_PPV_ARGS (&result))))
return result;
JUCE_END_IGNORE_WARNINGS_GCC_LIKE
return static_cast<juce_IVirtualDesktopManager*> (nullptr);
return static_cast<JuceIVirtualDesktopManager*> (nullptr);
}();
BOOL current = false;

View file

@ -159,7 +159,7 @@ void notifyAccessibilityEventInternal (const AccessibilityHandler& handler, Inte
|| eventType == InternalAccessibilityEvent::elementDestroyed)
{
if (auto* parent = handler.getParent())
sendAccessibilityAutomationEvent (*parent, UIA_LayoutInvalidatedEventId);
sendAccessibilityAutomationEvent (*parent, ComTypes::UIA_LayoutInvalidatedEventId);
return;
}
@ -176,9 +176,9 @@ void notifyAccessibilityEventInternal (const AccessibilityHandler& handler, Inte
{
switch (eventType)
{
case InternalAccessibilityEvent::focusChanged: return UIA_AutomationFocusChangedEventId;
case InternalAccessibilityEvent::windowOpened: return UIA_Window_WindowOpenedEventId;
case InternalAccessibilityEvent::windowClosed: return UIA_Window_WindowClosedEventId;
case InternalAccessibilityEvent::focusChanged: return ComTypes::UIA_AutomationFocusChangedEventId;
case InternalAccessibilityEvent::windowOpened: return ComTypes::UIA_Window_WindowOpenedEventId;
case InternalAccessibilityEvent::windowClosed: return ComTypes::UIA_Window_WindowClosedEventId;
case InternalAccessibilityEvent::elementCreated:
case InternalAccessibilityEvent::elementDestroyed:
case InternalAccessibilityEvent::elementMovedOrResized: break;
@ -219,10 +219,10 @@ void AccessibilityHandler::notifyAccessibilityEvent (AccessibilityEvent eventTyp
{
switch (eventType)
{
case AccessibilityEvent::textSelectionChanged: return UIA_Text_TextSelectionChangedEventId;
case AccessibilityEvent::textChanged: return UIA_Text_TextChangedEventId;
case AccessibilityEvent::structureChanged: return UIA_StructureChangedEventId;
case AccessibilityEvent::rowSelectionChanged: return UIA_SelectionItem_ElementSelectedEventId;
case AccessibilityEvent::textSelectionChanged: return ComTypes::UIA_Text_TextSelectionChangedEventId;
case AccessibilityEvent::textChanged: return ComTypes::UIA_Text_TextChangedEventId;
case AccessibilityEvent::structureChanged: return ComTypes::UIA_StructureChangedEventId;
case AccessibilityEvent::rowSelectionChanged: return ComTypes::UIA_SelectionItem_ElementSelectedEventId;
case AccessibilityEvent::titleChanged:
case AccessibilityEvent::valueChanged: break;
}
@ -238,7 +238,7 @@ struct SpVoiceWrapper : public DeletedAtShutdown
{
SpVoiceWrapper()
{
auto hr = voice.CoCreateInstance (CLSID_SpVoice);
auto hr = voice.CoCreateInstance (ComTypes::CLSID_SpVoice);
jassertquiet (SUCCEEDED (hr));
}

View file

@ -57,41 +57,41 @@ static auto roleToControlTypeId (AccessibilityRole roleType)
case AccessibilityRole::popupMenu:
case AccessibilityRole::dialogWindow:
case AccessibilityRole::splashScreen:
case AccessibilityRole::window: return UIA_WindowControlTypeId;
case AccessibilityRole::window: return ComTypes::UIA_WindowControlTypeId;
case AccessibilityRole::label:
case AccessibilityRole::staticText: return UIA_TextControlTypeId;
case AccessibilityRole::staticText: return ComTypes::UIA_TextControlTypeId;
case AccessibilityRole::column:
case AccessibilityRole::row: return UIA_HeaderItemControlTypeId;
case AccessibilityRole::row: return ComTypes::UIA_HeaderItemControlTypeId;
case AccessibilityRole::button: return UIA_ButtonControlTypeId;
case AccessibilityRole::toggleButton: return UIA_CheckBoxControlTypeId;
case AccessibilityRole::radioButton: return UIA_RadioButtonControlTypeId;
case AccessibilityRole::comboBox: return UIA_ComboBoxControlTypeId;
case AccessibilityRole::image: return UIA_ImageControlTypeId;
case AccessibilityRole::slider: return UIA_SliderControlTypeId;
case AccessibilityRole::editableText: return UIA_EditControlTypeId;
case AccessibilityRole::menuItem: return UIA_MenuItemControlTypeId;
case AccessibilityRole::menuBar: return UIA_MenuBarControlTypeId;
case AccessibilityRole::table: return UIA_TableControlTypeId;
case AccessibilityRole::tableHeader: return UIA_HeaderControlTypeId;
case AccessibilityRole::cell: return UIA_DataItemControlTypeId;
case AccessibilityRole::hyperlink: return UIA_HyperlinkControlTypeId;
case AccessibilityRole::list: return UIA_ListControlTypeId;
case AccessibilityRole::listItem: return UIA_ListItemControlTypeId;
case AccessibilityRole::tree: return UIA_TreeControlTypeId;
case AccessibilityRole::treeItem: return UIA_TreeItemControlTypeId;
case AccessibilityRole::progressBar: return UIA_ProgressBarControlTypeId;
case AccessibilityRole::group: return UIA_GroupControlTypeId;
case AccessibilityRole::scrollBar: return UIA_ScrollBarControlTypeId;
case AccessibilityRole::tooltip: return UIA_ToolTipControlTypeId;
case AccessibilityRole::button: return ComTypes::UIA_ButtonControlTypeId;
case AccessibilityRole::toggleButton: return ComTypes::UIA_CheckBoxControlTypeId;
case AccessibilityRole::radioButton: return ComTypes::UIA_RadioButtonControlTypeId;
case AccessibilityRole::comboBox: return ComTypes::UIA_ComboBoxControlTypeId;
case AccessibilityRole::image: return ComTypes::UIA_ImageControlTypeId;
case AccessibilityRole::slider: return ComTypes::UIA_SliderControlTypeId;
case AccessibilityRole::editableText: return ComTypes::UIA_EditControlTypeId;
case AccessibilityRole::menuItem: return ComTypes::UIA_MenuItemControlTypeId;
case AccessibilityRole::menuBar: return ComTypes::UIA_MenuBarControlTypeId;
case AccessibilityRole::table: return ComTypes::UIA_TableControlTypeId;
case AccessibilityRole::tableHeader: return ComTypes::UIA_HeaderControlTypeId;
case AccessibilityRole::cell: return ComTypes::UIA_DataItemControlTypeId;
case AccessibilityRole::hyperlink: return ComTypes::UIA_HyperlinkControlTypeId;
case AccessibilityRole::list: return ComTypes::UIA_ListControlTypeId;
case AccessibilityRole::listItem: return ComTypes::UIA_ListItemControlTypeId;
case AccessibilityRole::tree: return ComTypes::UIA_TreeControlTypeId;
case AccessibilityRole::treeItem: return ComTypes::UIA_TreeItemControlTypeId;
case AccessibilityRole::progressBar: return ComTypes::UIA_ProgressBarControlTypeId;
case AccessibilityRole::group: return ComTypes::UIA_GroupControlTypeId;
case AccessibilityRole::scrollBar: return ComTypes::UIA_ScrollBarControlTypeId;
case AccessibilityRole::tooltip: return ComTypes::UIA_ToolTipControlTypeId;
case AccessibilityRole::ignored:
case AccessibilityRole::unspecified: break;
};
return UIA_CustomControlTypeId;
return ComTypes::UIA_CustomControlTypeId;
}
//==============================================================================
@ -109,7 +109,7 @@ JUCE_COMRESULT AccessibilityNativeHandle::QueryInterface (REFIID refId, void** r
if (! isElementValid())
return (HRESULT) UIA_E_ELEMENTNOTAVAILABLE;
if ((refId == __uuidof (IRawElementProviderFragmentRoot) && ! isFragmentRoot()))
if ((refId == __uuidof (ComTypes::IRawElementProviderFragmentRoot) && ! isFragmentRoot()))
return E_NOINTERFACE;
return ComBaseClassHelper::QueryInterface (refId, result);
@ -133,7 +133,7 @@ JUCE_COMRESULT AccessibilityNativeHandle::get_ProviderOptions (ProviderOptions*
if (options == nullptr)
return E_INVALIDARG;
*options = ProviderOptions_ServerSideProvider | ProviderOptions_UseComThreading;
*options = (ProviderOptions) (ProviderOptions_ServerSideProvider | ProviderOptions_UseComThreading);
return S_OK;
}
@ -148,36 +148,36 @@ JUCE_COMRESULT AccessibilityNativeHandle::GetPatternProvider (PATTERNID pId, IUn
switch (pId)
{
case UIA_WindowPatternId:
case ComTypes::UIA_WindowPatternId:
{
if (fragmentRoot)
return new UIAWindowProvider (this);
break;
}
case UIA_TransformPatternId:
case ComTypes::UIA_TransformPatternId:
{
if (fragmentRoot)
return new UIATransformProvider (this);
break;
}
case UIA_TextPatternId:
case UIA_TextPattern2Id:
case ComTypes::UIA_TextPatternId:
case ComTypes::UIA_TextPattern2Id:
{
if (accessibilityHandler.getTextInterface() != nullptr)
return new UIATextProvider (this);
break;
}
case UIA_ValuePatternId:
case ComTypes::UIA_ValuePatternId:
{
if (accessibilityHandler.getValueInterface() != nullptr)
return new UIAValueProvider (this);
break;
}
case UIA_RangeValuePatternId:
case ComTypes::UIA_RangeValuePatternId:
{
if (accessibilityHandler.getValueInterface() != nullptr
&& accessibilityHandler.getValueInterface()->getRange().isValid())
@ -187,7 +187,7 @@ JUCE_COMRESULT AccessibilityNativeHandle::GetPatternProvider (PATTERNID pId, IUn
break;
}
case UIA_TogglePatternId:
case ComTypes::UIA_TogglePatternId:
{
if (accessibilityHandler.getCurrentState().isCheckable()
&& (accessibilityHandler.getActions().contains (AccessibilityActionType::toggle)
@ -198,7 +198,7 @@ JUCE_COMRESULT AccessibilityNativeHandle::GetPatternProvider (PATTERNID pId, IUn
break;
}
case UIA_SelectionPatternId:
case ComTypes::UIA_SelectionPatternId:
{
if (role == AccessibilityRole::list
|| role == AccessibilityRole::popupMenu
@ -209,7 +209,7 @@ JUCE_COMRESULT AccessibilityNativeHandle::GetPatternProvider (PATTERNID pId, IUn
break;
}
case UIA_SelectionItemPatternId:
case ComTypes::UIA_SelectionItemPatternId:
{
auto state = accessibilityHandler.getCurrentState();
@ -221,28 +221,28 @@ JUCE_COMRESULT AccessibilityNativeHandle::GetPatternProvider (PATTERNID pId, IUn
break;
}
case UIA_GridPatternId:
case ComTypes::UIA_GridPatternId:
{
if (accessibilityHandler.getTableInterface() != nullptr)
return new UIAGridProvider (this);
break;
}
case UIA_GridItemPatternId:
case ComTypes::UIA_GridItemPatternId:
{
if (accessibilityHandler.getCellInterface() != nullptr)
return new UIAGridItemProvider (this);
break;
}
case UIA_InvokePatternId:
case ComTypes::UIA_InvokePatternId:
{
if (accessibilityHandler.getActions().contains (AccessibilityActionType::press))
return new UIAInvokeProvider (this);
break;
}
case UIA_ExpandCollapsePatternId:
case ComTypes::UIA_ExpandCollapsePatternId:
{
if (accessibilityHandler.getActions().contains (AccessibilityActionType::showMenu)
&& accessibilityHandler.getCurrentState().isExpandable())
@ -313,7 +313,7 @@ JUCE_COMRESULT AccessibilityNativeHandle::GetPropertyValue (PROPERTYID propertyI
VariantHelpers::setBool (textInterface->isDisplayingProtectedText(), pRetVal);
break;
case UIA_IsPeripheralPropertyId:
case ComTypes::UIA_IsPeripheralPropertyId:
VariantHelpers::setBool (role == AccessibilityRole::tooltip
|| role == AccessibilityRole::popupMenu
|| role == AccessibilityRole::splashScreen,
@ -339,27 +339,27 @@ JUCE_COMRESULT AccessibilityNativeHandle::GetPropertyValue (PROPERTYID propertyI
}
//==============================================================================
JUCE_COMRESULT AccessibilityNativeHandle::Navigate (NavigateDirection direction, IRawElementProviderFragment** pRetVal)
JUCE_COMRESULT AccessibilityNativeHandle::Navigate (ComTypes::NavigateDirection direction, ComTypes::IRawElementProviderFragment** pRetVal)
{
return withCheckedComArgs (pRetVal, *this, [&]
{
auto* handler = [&]() -> AccessibilityHandler*
{
if (direction == NavigateDirection_Parent)
if (direction == ComTypes::NavigateDirection_Parent)
return accessibilityHandler.getParent();
if (direction == NavigateDirection_FirstChild
|| direction == NavigateDirection_LastChild)
if (direction == ComTypes::NavigateDirection_FirstChild
|| direction == ComTypes::NavigateDirection_LastChild)
{
auto children = accessibilityHandler.getChildren();
return children.empty() ? nullptr
: (direction == NavigateDirection_FirstChild ? children.front()
: children.back());
: (direction == ComTypes::NavigateDirection_FirstChild ? children.front()
: children.back());
}
if (direction == NavigateDirection_NextSibling
|| direction == NavigateDirection_PreviousSibling)
if (direction == ComTypes::NavigateDirection_NextSibling
|| direction == ComTypes::NavigateDirection_PreviousSibling)
{
if (auto* parent = accessibilityHandler.getParent())
{
@ -369,10 +369,10 @@ JUCE_COMRESULT AccessibilityNativeHandle::Navigate (NavigateDirection direction,
if (iter == siblings.end())
return nullptr;
if (direction == NavigateDirection_NextSibling && iter != std::prev (siblings.cend()))
if (direction == ComTypes::NavigateDirection_NextSibling && iter != std::prev (siblings.cend()))
return *std::next (iter);
if (direction == NavigateDirection_PreviousSibling && iter != siblings.cbegin())
if (direction == ComTypes::NavigateDirection_PreviousSibling && iter != siblings.cbegin())
return *std::prev (iter);
}
}
@ -413,7 +413,7 @@ JUCE_COMRESULT AccessibilityNativeHandle::GetRuntimeId (SAFEARRAY** pRetVal)
});
}
JUCE_COMRESULT AccessibilityNativeHandle::get_BoundingRectangle (UiaRect* pRetVal)
JUCE_COMRESULT AccessibilityNativeHandle::get_BoundingRectangle (ComTypes::UiaRect* pRetVal)
{
return withCheckedComArgs (pRetVal, *this, [&]
{
@ -452,7 +452,7 @@ JUCE_COMRESULT AccessibilityNativeHandle::SetFocus()
return S_OK;
}
JUCE_COMRESULT AccessibilityNativeHandle::get_FragmentRoot (IRawElementProviderFragmentRoot** pRetVal)
JUCE_COMRESULT AccessibilityNativeHandle::get_FragmentRoot (ComTypes::IRawElementProviderFragmentRoot** pRetVal)
{
return withCheckedComArgs (pRetVal, *this, [&]() -> HRESULT
{
@ -478,7 +478,7 @@ JUCE_COMRESULT AccessibilityNativeHandle::get_FragmentRoot (IRawElementProviderF
}
//==============================================================================
JUCE_COMRESULT AccessibilityNativeHandle::ElementProviderFromPoint (double x, double y, IRawElementProviderFragment** pRetVal)
JUCE_COMRESULT AccessibilityNativeHandle::ElementProviderFromPoint (double x, double y, ComTypes::IRawElementProviderFragment** pRetVal)
{
return withCheckedComArgs (pRetVal, *this, [&]
{
@ -500,7 +500,7 @@ JUCE_COMRESULT AccessibilityNativeHandle::ElementProviderFromPoint (double x, do
});
}
JUCE_COMRESULT AccessibilityNativeHandle::GetFocus (IRawElementProviderFragment** pRetVal)
JUCE_COMRESULT AccessibilityNativeHandle::GetFocus (ComTypes::IRawElementProviderFragment** pRetVal)
{
return withCheckedComArgs (pRetVal, *this, [&]
{

View file

@ -30,8 +30,8 @@ namespace juce
#define UIA_IsDialogPropertyId 30174
class AccessibilityNativeHandle : public ComBaseClassHelper<IRawElementProviderSimple,
IRawElementProviderFragment,
IRawElementProviderFragmentRoot>
ComTypes::IRawElementProviderFragment,
ComTypes::IRawElementProviderFragmentRoot>
{
public:
explicit AccessibilityNativeHandle (AccessibilityHandler& handler);
@ -51,15 +51,15 @@ public:
JUCE_COMRESULT GetPatternProvider (PATTERNID pId, IUnknown** provider) override;
JUCE_COMRESULT GetPropertyValue (PROPERTYID propertyId, VARIANT* pRetVal) override;
JUCE_COMRESULT Navigate (NavigateDirection direction, IRawElementProviderFragment** pRetVal) override;
JUCE_COMRESULT Navigate (ComTypes::NavigateDirection direction, ComTypes::IRawElementProviderFragment** pRetVal) override;
JUCE_COMRESULT GetRuntimeId (SAFEARRAY** pRetVal) override;
JUCE_COMRESULT get_BoundingRectangle (UiaRect* pRetVal) override;
JUCE_COMRESULT get_BoundingRectangle (ComTypes::UiaRect* pRetVal) override;
JUCE_COMRESULT GetEmbeddedFragmentRoots (SAFEARRAY** pRetVal) override;
JUCE_COMRESULT SetFocus() override;
JUCE_COMRESULT get_FragmentRoot (IRawElementProviderFragmentRoot** pRetVal) override;
JUCE_COMRESULT get_FragmentRoot (ComTypes::IRawElementProviderFragmentRoot** pRetVal) override;
JUCE_COMRESULT ElementProviderFromPoint (double x, double y, IRawElementProviderFragment** pRetVal) override;
JUCE_COMRESULT GetFocus (IRawElementProviderFragment** pRetVal) override;
JUCE_COMRESULT ElementProviderFromPoint (double x, double y, ComTypes::IRawElementProviderFragment** pRetVal) override;
JUCE_COMRESULT GetFocus (ComTypes::IRawElementProviderFragment** pRetVal) override;
private:
//==============================================================================

View file

@ -0,0 +1,371 @@
/*
==============================================================================
This file is part of the JUCE library.
Copyright (c) 2020 - Raw Material Software Limited
JUCE is an open source library subject to commercial or open-source
licensing.
By using JUCE, you agree to the terms of both the JUCE 6 End-User License
Agreement and JUCE Privacy Policy (both effective as of the 16th June 2020).
End User License Agreement: www.juce.com/juce-6-licence
Privacy Policy: www.juce.com/juce-privacy-policy
Or: You may also use this code under the terms of the GPL v3 (see
www.gnu.org/licenses).
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
DISCLAIMED.
==============================================================================
*/
namespace juce
{
namespace ComTypes
{
/*
These interfaces would normally be included in the system platform headers.
However, those headers are likely to be incomplete when building with
MinGW. In order to allow building accessible applications under MinGW,
we reproduce all necessary definitions here.
*/
struct UiaPoint
{
double x;
double y;
};
struct UiaRect
{
double left;
double top;
double width;
double height;
};
enum NavigateDirection
{
NavigateDirection_Parent = 0,
NavigateDirection_NextSibling = 1,
NavigateDirection_PreviousSibling = 2,
NavigateDirection_FirstChild = 3,
NavigateDirection_LastChild = 4
};
enum ExpandCollapseState
{
ExpandCollapseState_Collapsed = 0,
ExpandCollapseState_Expanded = 1,
ExpandCollapseState_PartiallyExpanded = 2,
ExpandCollapseState_LeafNode = 3
};
enum TextPatternRangeEndpoint
{
TextPatternRangeEndpoint_Start = 0,
TextPatternRangeEndpoint_End = 1
};
enum TextUnit
{
TextUnit_Character = 0,
TextUnit_Format = 1,
TextUnit_Word = 2,
TextUnit_Line = 3,
TextUnit_Paragraph = 4,
TextUnit_Page = 5,
TextUnit_Document = 6
};
enum SupportedTextSelection
{
SupportedTextSelection_None = 0,
SupportedTextSelection_Single = 1,
SupportedTextSelection_Multiple = 2
};
enum CaretPosition
{
CaretPosition_Unknown = 0,
CaretPosition_EndOfLine = 1,
CaretPosition_BeginningOfLine = 2
};
enum ToggleState
{
ToggleState_Off = 0,
ToggleState_On = 1,
ToggleState_Indeterminate = 2
};
enum WindowVisualState
{
WindowVisualState_Normal = 0,
WindowVisualState_Maximized = 1,
WindowVisualState_Minimized = 2
};
enum WindowInteractionState
{
WindowInteractionState_Running = 0,
WindowInteractionState_Closing = 1,
WindowInteractionState_ReadyForUserInteraction = 2,
WindowInteractionState_BlockedByModalWindow = 3,
WindowInteractionState_NotResponding = 4
};
const long UIA_InvokePatternId = 10000;
const long UIA_SelectionPatternId = 10001;
const long UIA_ValuePatternId = 10002;
const long UIA_RangeValuePatternId = 10003;
const long UIA_ExpandCollapsePatternId = 10005;
const long UIA_GridPatternId = 10006;
const long UIA_GridItemPatternId = 10007;
const long UIA_WindowPatternId = 10009;
const long UIA_SelectionItemPatternId = 10010;
const long UIA_TextPatternId = 10014;
const long UIA_TogglePatternId = 10015;
const long UIA_TransformPatternId = 10016;
const long UIA_TextPattern2Id = 10024;
const long UIA_StructureChangedEventId = 20002;
const long UIA_MenuOpenedEventId = 20003;
const long UIA_AutomationFocusChangedEventId = 20005;
const long UIA_MenuClosedEventId = 20007;
const long UIA_LayoutInvalidatedEventId = 20008;
const long UIA_Invoke_InvokedEventId = 20009;
const long UIA_SelectionItem_ElementSelectedEventId = 20012;
const long UIA_Text_TextSelectionChangedEventId = 20014;
const long UIA_Text_TextChangedEventId = 20015;
const long UIA_Window_WindowOpenedEventId = 20016;
const long UIA_Window_WindowClosedEventId = 20017;
const long UIA_IsPeripheralPropertyId = 30150;
const long UIA_IsReadOnlyAttributeId = 40015;
const long UIA_CaretPositionAttributeId = 40038;
const long UIA_ButtonControlTypeId = 50000;
const long UIA_CheckBoxControlTypeId = 50002;
const long UIA_ComboBoxControlTypeId = 50003;
const long UIA_EditControlTypeId = 50004;
const long UIA_HyperlinkControlTypeId = 50005;
const long UIA_ImageControlTypeId = 50006;
const long UIA_ListItemControlTypeId = 50007;
const long UIA_ListControlTypeId = 50008;
const long UIA_MenuBarControlTypeId = 50010;
const long UIA_MenuItemControlTypeId = 50011;
const long UIA_ProgressBarControlTypeId = 50012;
const long UIA_RadioButtonControlTypeId = 50013;
const long UIA_ScrollBarControlTypeId = 50014;
const long UIA_SliderControlTypeId = 50015;
const long UIA_TextControlTypeId = 50020;
const long UIA_ToolTipControlTypeId = 50022;
const long UIA_TreeControlTypeId = 50023;
const long UIA_TreeItemControlTypeId = 50024;
const long UIA_CustomControlTypeId = 50025;
const long UIA_GroupControlTypeId = 50026;
const long UIA_DataItemControlTypeId = 50029;
const long UIA_WindowControlTypeId = 50032;
const long UIA_HeaderControlTypeId = 50034;
const long UIA_HeaderItemControlTypeId = 50035;
const long UIA_TableControlTypeId = 50036;
interface IRawElementProviderFragmentRoot;
interface IRawElementProviderFragment;
JUCE_COMCLASS (IRawElementProviderFragmentRoot, "620ce2a5-ab8f-40a9-86cb-de3c75599b58") : public IUnknown
{
public:
JUCE_COMCALL ElementProviderFromPoint (double x, double y, __RPC__deref_out_opt IRawElementProviderFragment** pRetVal) = 0;
JUCE_COMCALL GetFocus (__RPC__deref_out_opt IRawElementProviderFragment * *pRetVal) = 0;
};
JUCE_COMCLASS (IRawElementProviderFragment, "f7063da8-8359-439c-9297-bbc5299a7d87") : public IUnknown
{
public:
JUCE_COMCALL Navigate (NavigateDirection direction, __RPC__deref_out_opt IRawElementProviderFragment** pRetVal) = 0;
JUCE_COMCALL GetRuntimeId (__RPC__deref_out_opt SAFEARRAY * *pRetVal) = 0;
JUCE_COMCALL get_BoundingRectangle (__RPC__out UiaRect * pRetVal) = 0;
JUCE_COMCALL GetEmbeddedFragmentRoots (__RPC__deref_out_opt SAFEARRAY * *pRetVal) = 0;
JUCE_COMCALL SetFocus() = 0;
JUCE_COMCALL get_FragmentRoot (__RPC__deref_out_opt IRawElementProviderFragmentRoot * *pRetVal) = 0;
};
JUCE_COMCLASS (IExpandCollapseProvider, "d847d3a5-cab0-4a98-8c32-ecb45c59ad24") : public IUnknown
{
public:
JUCE_COMCALL Expand() = 0;
JUCE_COMCALL Collapse() = 0;
JUCE_COMCALL get_ExpandCollapseState (__RPC__out ExpandCollapseState * pRetVal) = 0;
};
JUCE_COMCLASS (IGridItemProvider, "d02541f1-fb81-4d64-ae32-f520f8a6dbd1") : public IUnknown
{
public:
JUCE_COMCALL get_Row (__RPC__out int* pRetVal) = 0;
JUCE_COMCALL get_Column (__RPC__out int* pRetVal) = 0;
JUCE_COMCALL get_RowSpan (__RPC__out int* pRetVal) = 0;
JUCE_COMCALL get_ColumnSpan (__RPC__out int* pRetVal) = 0;
JUCE_COMCALL get_ContainingGrid (__RPC__deref_out_opt IRawElementProviderSimple * *pRetVal) = 0;
};
JUCE_COMCLASS (IGridProvider, "b17d6187-0907-464b-a168-0ef17a1572b1") : public IUnknown
{
public:
JUCE_COMCALL GetItem (int row, int column, __RPC__deref_out_opt IRawElementProviderSimple** pRetVal) = 0;
JUCE_COMCALL get_RowCount (__RPC__out int* pRetVal) = 0;
JUCE_COMCALL get_ColumnCount (__RPC__out int* pRetVal) = 0;
};
JUCE_COMCLASS (IInvokeProvider, "54fcb24b-e18e-47a2-b4d3-eccbe77599a2") : public IUnknown
{
public:
JUCE_COMCALL Invoke() = 0;
};
JUCE_COMCLASS (IRangeValueProvider, "36dc7aef-33e6-4691-afe1-2be7274b3d33") : public IUnknown
{
public:
JUCE_COMCALL SetValue (double val) = 0;
JUCE_COMCALL get_Value (__RPC__out double* pRetVal) = 0;
JUCE_COMCALL get_IsReadOnly (__RPC__out BOOL * pRetVal) = 0;
JUCE_COMCALL get_Maximum (__RPC__out double* pRetVal) = 0;
JUCE_COMCALL get_Minimum (__RPC__out double* pRetVal) = 0;
JUCE_COMCALL get_LargeChange (__RPC__out double* pRetVal) = 0;
JUCE_COMCALL get_SmallChange (__RPC__out double* pRetVal) = 0;
};
JUCE_COMCLASS (ISelectionProvider, "fb8b03af-3bdf-48d4-bd36-1a65793be168") : public IUnknown
{
public:
JUCE_COMCALL GetSelection (__RPC__deref_out_opt SAFEARRAY * *pRetVal) = 0;
JUCE_COMCALL get_CanSelectMultiple (__RPC__out BOOL * pRetVal) = 0;
JUCE_COMCALL get_IsSelectionRequired (__RPC__out BOOL * pRetVal) = 0;
};
JUCE_COMCLASS (ISelectionProvider2, "14f68475-ee1c-44f6-a869-d239381f0fe7") : public ISelectionProvider
{
JUCE_COMCALL get_FirstSelectedItem (IRawElementProviderSimple * *retVal) = 0;
JUCE_COMCALL get_LastSelectedItem (IRawElementProviderSimple * *retVal) = 0;
JUCE_COMCALL get_CurrentSelectedItem (IRawElementProviderSimple * *retVal) = 0;
JUCE_COMCALL get_ItemCount (int* retVal) = 0;
};
JUCE_COMCLASS (ISelectionItemProvider, "2acad808-b2d4-452d-a407-91ff1ad167b2") : public IUnknown
{
public:
JUCE_COMCALL Select() = 0;
JUCE_COMCALL AddToSelection() = 0;
JUCE_COMCALL RemoveFromSelection() = 0;
JUCE_COMCALL get_IsSelected (__RPC__out BOOL * pRetVal) = 0;
JUCE_COMCALL get_SelectionContainer (__RPC__deref_out_opt IRawElementProviderSimple * *pRetVal) = 0;
};
JUCE_COMCLASS (ITextRangeProvider, "5347ad7b-c355-46f8-aff5-909033582f63") : public IUnknown
{
public:
JUCE_COMCALL Clone (__RPC__deref_out_opt ITextRangeProvider * *pRetVal) = 0;
JUCE_COMCALL Compare (__RPC__in_opt ITextRangeProvider * range, __RPC__out BOOL * pRetVal) = 0;
JUCE_COMCALL CompareEndpoints (TextPatternRangeEndpoint endpoint, __RPC__in_opt ITextRangeProvider * targetRange, TextPatternRangeEndpoint targetEndpoint, __RPC__out int* pRetVal) = 0;
JUCE_COMCALL ExpandToEnclosingUnit (TextUnit unit) = 0;
JUCE_COMCALL FindAttribute (TEXTATTRIBUTEID attributeId, VARIANT val, BOOL backward, __RPC__deref_out_opt ITextRangeProvider * *pRetVal) = 0;
JUCE_COMCALL FindText (__RPC__in BSTR text, BOOL backward, BOOL ignoreCase, __RPC__deref_out_opt ITextRangeProvider * *pRetVal) = 0;
JUCE_COMCALL GetAttributeValue (TEXTATTRIBUTEID attributeId, __RPC__out VARIANT * pRetVal) = 0;
JUCE_COMCALL GetBoundingRectangles (__RPC__deref_out_opt SAFEARRAY * *pRetVal) = 0;
JUCE_COMCALL GetEnclosingElement (__RPC__deref_out_opt IRawElementProviderSimple * *pRetVal) = 0;
JUCE_COMCALL GetText (int maxLength, __RPC__deref_out_opt BSTR* pRetVal) = 0;
JUCE_COMCALL Move (TextUnit unit, int count, __RPC__out int* pRetVal) = 0;
JUCE_COMCALL MoveEndpointByUnit (TextPatternRangeEndpoint endpoint, TextUnit unit, int count, __RPC__out int* pRetVal) = 0;
JUCE_COMCALL MoveEndpointByRange (TextPatternRangeEndpoint endpoint, __RPC__in_opt ITextRangeProvider * targetRange, TextPatternRangeEndpoint targetEndpoint) = 0;
JUCE_COMCALL Select() = 0;
JUCE_COMCALL AddToSelection() = 0;
JUCE_COMCALL RemoveFromSelection() = 0;
JUCE_COMCALL ScrollIntoView (BOOL alignToTop) = 0;
JUCE_COMCALL GetChildren (__RPC__deref_out_opt SAFEARRAY * *pRetVal) = 0;
};
JUCE_COMCLASS (ITextProvider, "3589c92c-63f3-4367-99bb-ada653b77cf2") : public IUnknown
{
public:
JUCE_COMCALL GetSelection (__RPC__deref_out_opt SAFEARRAY * *pRetVal) = 0;
JUCE_COMCALL GetVisibleRanges (__RPC__deref_out_opt SAFEARRAY * *pRetVal) = 0;
JUCE_COMCALL RangeFromChild (__RPC__in_opt IRawElementProviderSimple * childElement, __RPC__deref_out_opt ITextRangeProvider * *pRetVal) = 0;
JUCE_COMCALL RangeFromPoint (UiaPoint point, __RPC__deref_out_opt ITextRangeProvider * *pRetVal) = 0;
JUCE_COMCALL get_DocumentRange (__RPC__deref_out_opt ITextRangeProvider * *pRetVal) = 0;
JUCE_COMCALL get_SupportedTextSelection (__RPC__out SupportedTextSelection * pRetVal) = 0;
};
JUCE_COMCLASS (ITextProvider2, "0dc5e6ed-3e16-4bf1-8f9a-a979878bc195") : public ITextProvider
{
public:
JUCE_COMCALL RangeFromAnnotation (__RPC__in_opt IRawElementProviderSimple * annotationElement, __RPC__deref_out_opt ITextRangeProvider * *pRetVal) = 0;
JUCE_COMCALL GetCaretRange (__RPC__out BOOL * isActive, __RPC__deref_out_opt ITextRangeProvider * *pRetVal) = 0;
};
JUCE_COMCLASS (IToggleProvider, "56d00bd0-c4f4-433c-a836-1a52a57e0892") : public IUnknown
{
public:
JUCE_COMCALL Toggle() = 0;
JUCE_COMCALL get_ToggleState (__RPC__out ToggleState * pRetVal) = 0;
};
JUCE_COMCLASS (ITransformProvider, "6829ddc4-4f91-4ffa-b86f-bd3e2987cb4c") : public IUnknown
{
public:
JUCE_COMCALL Move (double x, double y) = 0;
JUCE_COMCALL Resize (double width, double height) = 0;
JUCE_COMCALL Rotate (double degrees) = 0;
JUCE_COMCALL get_CanMove (__RPC__out BOOL * pRetVal) = 0;
JUCE_COMCALL get_CanResize (__RPC__out BOOL * pRetVal) = 0;
JUCE_COMCALL get_CanRotate (__RPC__out BOOL * pRetVal) = 0;
};
JUCE_COMCLASS (IValueProvider, "c7935180-6fb3-4201-b174-7df73adbf64a") : public IUnknown
{
public:
JUCE_COMCALL SetValue (__RPC__in LPCWSTR val) = 0;
JUCE_COMCALL get_Value (__RPC__deref_out_opt BSTR * pRetVal) = 0;
JUCE_COMCALL get_IsReadOnly (__RPC__out BOOL * pRetVal) = 0;
};
JUCE_COMCLASS (IWindowProvider, "987df77b-db06-4d77-8f8a-86a9c3bb90b9") : public IUnknown
{
public:
JUCE_COMCALL SetVisualState (WindowVisualState state) = 0;
JUCE_COMCALL Close() = 0;
JUCE_COMCALL WaitForInputIdle (int milliseconds, __RPC__out BOOL* pRetVal) = 0;
JUCE_COMCALL get_CanMaximize (__RPC__out BOOL * pRetVal) = 0;
JUCE_COMCALL get_CanMinimize (__RPC__out BOOL * pRetVal) = 0;
JUCE_COMCALL get_IsModal (__RPC__out BOOL * pRetVal) = 0;
JUCE_COMCALL get_WindowVisualState (__RPC__out WindowVisualState * pRetVal) = 0;
JUCE_COMCALL get_WindowInteractionState (__RPC__out WindowInteractionState * pRetVal) = 0;
JUCE_COMCALL get_IsTopmost (__RPC__out BOOL * pRetVal) = 0;
};
constexpr CLSID CLSID_SpVoice { 0x96749377, 0x3391, 0x11D2, { 0x9E, 0xE3, 0x00, 0xC0, 0x4F, 0x79, 0x73, 0x96 } };
} // namespace ComTypes
} // namespace juce
#ifdef __CRT_UUID_DECL
__CRT_UUID_DECL (juce::ComTypes::IRawElementProviderFragmentRoot, 0x620ce2a5, 0xab8f, 0x40a9, 0x86, 0xcb, 0xde, 0x3c, 0x75, 0x59, 0x9b, 0x58)
__CRT_UUID_DECL (juce::ComTypes::IRawElementProviderFragment, 0xf7063da8, 0x8359, 0x439c, 0x92, 0x97, 0xbb, 0xc5, 0x29, 0x9a, 0x7d, 0x87)
__CRT_UUID_DECL (juce::ComTypes::IExpandCollapseProvider, 0xd847d3a5, 0xcab0, 0x4a98, 0x8c, 0x32, 0xec, 0xb4, 0x5c, 0x59, 0xad, 0x24)
__CRT_UUID_DECL (juce::ComTypes::IGridItemProvider, 0xd02541f1, 0xfb81, 0x4d64, 0xae, 0x32, 0xf5, 0x20, 0xf8, 0xa6, 0xdb, 0xd1)
__CRT_UUID_DECL (juce::ComTypes::IGridProvider, 0xb17d6187, 0x0907, 0x464b, 0xa1, 0x68, 0x0e, 0xf1, 0x7a, 0x15, 0x72, 0xb1)
__CRT_UUID_DECL (juce::ComTypes::IInvokeProvider, 0x54fcb24b, 0xe18e, 0x47a2, 0xb4, 0xd3, 0xec, 0xcb, 0xe7, 0x75, 0x99, 0xa2)
__CRT_UUID_DECL (juce::ComTypes::IRangeValueProvider, 0x36dc7aef, 0x33e6, 0x4691, 0xaf, 0xe1, 0x2b, 0xe7, 0x27, 0x4b, 0x3d, 0x33)
__CRT_UUID_DECL (juce::ComTypes::ISelectionProvider, 0xfb8b03af, 0x3bdf, 0x48d4, 0xbd, 0x36, 0x1a, 0x65, 0x79, 0x3b, 0xe1, 0x68)
__CRT_UUID_DECL (juce::ComTypes::ISelectionProvider2, 0x14f68475, 0xee1c, 0x44f6, 0xa8, 0x69, 0xd2, 0x39, 0x38, 0x1f, 0x0f, 0xe7)
__CRT_UUID_DECL (juce::ComTypes::ISelectionItemProvider, 0x2acad808, 0xb2d4, 0x452d, 0xa4, 0x07, 0x91, 0xff, 0x1a, 0xd1, 0x67, 0xb2)
__CRT_UUID_DECL (juce::ComTypes::ITextRangeProvider, 0x5347ad7b, 0xc355, 0x46f8, 0xaf, 0xf5, 0x90, 0x90, 0x33, 0x58, 0x2f, 0x63)
__CRT_UUID_DECL (juce::ComTypes::ITextProvider, 0x3589c92c, 0x63f3, 0x4367, 0x99, 0xbb, 0xad, 0xa6, 0x53, 0xb7, 0x7c, 0xf2)
__CRT_UUID_DECL (juce::ComTypes::ITextProvider2, 0x0dc5e6ed, 0x3e16, 0x4bf1, 0x8f, 0x9a, 0xa9, 0x79, 0x87, 0x8b, 0xc1, 0x95)
__CRT_UUID_DECL (juce::ComTypes::IToggleProvider, 0x56d00bd0, 0xc4f4, 0x433c, 0xa8, 0x36, 0x1a, 0x52, 0xa5, 0x7e, 0x08, 0x92)
__CRT_UUID_DECL (juce::ComTypes::ITransformProvider, 0x6829ddc4, 0x4f91, 0x4ffa, 0xb8, 0x6f, 0xbd, 0x3e, 0x29, 0x87, 0xcb, 0x4c)
__CRT_UUID_DECL (juce::ComTypes::IValueProvider, 0xc7935180, 0x6fb3, 0x4201, 0xb1, 0x74, 0x7d, 0xf7, 0x3a, 0xdb, 0xf6, 0x4a)
__CRT_UUID_DECL (juce::ComTypes::IWindowProvider, 0x987df77b, 0xdb06, 0x4d77, 0x8f, 0x8a, 0x86, 0xa9, 0xc3, 0xbb, 0x90, 0xb9)
#endif

View file

@ -28,13 +28,10 @@ namespace juce
//==============================================================================
class UIAExpandCollapseProvider : public UIAProviderBase,
public ComBaseClassHelper<IExpandCollapseProvider>
public ComBaseClassHelper<ComTypes::IExpandCollapseProvider>
{
public:
explicit UIAExpandCollapseProvider (AccessibilityNativeHandle* nativeHandle)
: UIAProviderBase (nativeHandle)
{
}
using UIAProviderBase::UIAProviderBase;
//==============================================================================
JUCE_COMRESULT Expand() override
@ -47,13 +44,13 @@ public:
return invokeShowMenu();
}
JUCE_COMRESULT get_ExpandCollapseState (ExpandCollapseState* pRetVal) override
JUCE_COMRESULT get_ExpandCollapseState (ComTypes::ExpandCollapseState* pRetVal) override
{
return withCheckedComArgs (pRetVal, *this, [&]
{
*pRetVal = getHandler().getCurrentState().isExpanded()
? ExpandCollapseState_Expanded
: ExpandCollapseState_Collapsed;
? ComTypes::ExpandCollapseState_Expanded
: ComTypes::ExpandCollapseState_Collapsed;
return S_OK;
});
@ -70,8 +67,8 @@ private:
if (handler.getActions().invoke (AccessibilityActionType::showMenu))
{
sendAccessibilityAutomationEvent (handler, handler.getCurrentState().isExpanded()
? UIA_MenuOpenedEventId
: UIA_MenuClosedEventId);
? ComTypes::UIA_MenuOpenedEventId
: ComTypes::UIA_MenuClosedEventId);
return S_OK;
}

View file

@ -28,13 +28,10 @@ namespace juce
//==============================================================================
class UIAGridItemProvider : public UIAProviderBase,
public ComBaseClassHelper<IGridItemProvider>
public ComBaseClassHelper<ComTypes::IGridItemProvider>
{
public:
explicit UIAGridItemProvider (AccessibilityNativeHandle* nativeHandle)
: UIAProviderBase (nativeHandle)
{
}
using UIAProviderBase::UIAProviderBase;
//==============================================================================
JUCE_COMRESULT get_Row (int* pRetVal) override

View file

@ -28,13 +28,10 @@ namespace juce
//==============================================================================
class UIAGridProvider : public UIAProviderBase,
public ComBaseClassHelper<IGridProvider>
public ComBaseClassHelper<ComTypes::IGridProvider>
{
public:
explicit UIAGridProvider (AccessibilityNativeHandle* nativeHandle)
: UIAProviderBase (nativeHandle)
{
}
using UIAProviderBase::UIAProviderBase;
//==============================================================================
JUCE_COMRESULT GetItem (int row, int column, IRawElementProviderSimple** pRetVal) override

View file

@ -28,13 +28,10 @@ namespace juce
//==============================================================================
class UIAInvokeProvider : public UIAProviderBase,
public ComBaseClassHelper<IInvokeProvider>
public ComBaseClassHelper<ComTypes::IInvokeProvider>
{
public:
explicit UIAInvokeProvider (AccessibilityNativeHandle* nativeHandle)
: UIAProviderBase (nativeHandle)
{
}
using UIAProviderBase::UIAProviderBase;
//==============================================================================
JUCE_COMRESULT Invoke() override
@ -47,7 +44,7 @@ public:
if (handler.getActions().invoke (AccessibilityActionType::press))
{
if (isElementValid())
sendAccessibilityAutomationEvent (handler, UIA_Invoke_InvokedEventId);
sendAccessibilityAutomationEvent (handler, ComTypes::UIA_Invoke_InvokedEventId);
return S_OK;
}

View file

@ -28,13 +28,10 @@ namespace juce
//==============================================================================
class UIARangeValueProvider : public UIAProviderBase,
public ComBaseClassHelper<IRangeValueProvider>
public ComBaseClassHelper<ComTypes::IRangeValueProvider>
{
public:
explicit UIARangeValueProvider (AccessibilityNativeHandle* nativeHandle)
: UIAProviderBase (nativeHandle)
{
}
using UIAProviderBase::UIAProviderBase;
//==============================================================================
JUCE_COMRESULT SetValue (double val) override

View file

@ -28,21 +28,13 @@ namespace juce
JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wlanguage-extension-token")
JUCE_COMCLASS (ISelectionProvider2, "14f68475-ee1c-44f6-a869-d239381f0fe7") : public ISelectionProvider
{
JUCE_COMCALL get_FirstSelectedItem (IRawElementProviderSimple** retVal) = 0;
JUCE_COMCALL get_LastSelectedItem (IRawElementProviderSimple** retVal) = 0;
JUCE_COMCALL get_CurrentSelectedItem (IRawElementProviderSimple** retVal) = 0;
JUCE_COMCALL get_ItemCount (int* retVal) = 0;
};
//==============================================================================
class UIASelectionItemProvider : public UIAProviderBase,
public ComBaseClassHelper<ISelectionItemProvider>
public ComBaseClassHelper<ComTypes::ISelectionItemProvider>
{
public:
explicit UIASelectionItemProvider (AccessibilityNativeHandle* nativeHandle)
: UIAProviderBase (nativeHandle),
explicit UIASelectionItemProvider (AccessibilityNativeHandle* handle)
: UIAProviderBase (handle),
isRadioButton (getHandler().getRole() == AccessibilityRole::radioButton)
{
}
@ -58,7 +50,7 @@ public:
if (isRadioButton)
{
handler.getActions().invoke (AccessibilityActionType::press);
sendAccessibilityAutomationEvent (handler, UIA_SelectionItem_ElementSelectedEventId);
sendAccessibilityAutomationEvent (handler, ComTypes::UIA_SelectionItem_ElementSelectedEventId);
return S_OK;
}
@ -136,22 +128,19 @@ private:
//==============================================================================
class UIASelectionProvider : public UIAProviderBase,
public ComBaseClassHelper<ISelectionProvider2>
public ComBaseClassHelper<ComTypes::ISelectionProvider2>
{
public:
explicit UIASelectionProvider (AccessibilityNativeHandle* nativeHandle)
: UIAProviderBase (nativeHandle)
{
}
using UIAProviderBase::UIAProviderBase;
//==============================================================================
JUCE_COMRESULT QueryInterface (REFIID iid, void** result) override
{
if (iid == _uuidof (IUnknown) || iid == _uuidof (ISelectionProvider))
return castToType<ISelectionProvider> (result);
if (iid == __uuidof (IUnknown) || iid == __uuidof (ComTypes::ISelectionProvider))
return castToType<ComTypes::ISelectionProvider> (result);
if (iid == _uuidof (ISelectionProvider2))
return castToType<ISelectionProvider2> (result);
if (iid == __uuidof (ComTypes::ISelectionProvider2))
return castToType<ComTypes::ISelectionProvider2> (result);
*result = nullptr;
return E_NOINTERFACE;

View file

@ -28,24 +28,21 @@ namespace juce
//==============================================================================
class UIATextProvider : public UIAProviderBase,
public ComBaseClassHelper<ITextProvider2>
public ComBaseClassHelper<ComTypes::ITextProvider2>
{
public:
explicit UIATextProvider (AccessibilityNativeHandle* nativeHandle)
: UIAProviderBase (nativeHandle)
{
}
using UIAProviderBase::UIAProviderBase;
//==============================================================================
JUCE_COMRESULT QueryInterface (REFIID iid, void** result) override
{
JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wlanguage-extension-token")
if (iid == _uuidof (IUnknown) || iid == _uuidof (ITextProvider))
return castToType<ITextProvider> (result);
if (iid == __uuidof (IUnknown) || iid == __uuidof (ComTypes::ITextProvider))
return castToType<ComTypes::ITextProvider> (result);
if (iid == _uuidof (ITextProvider2))
return castToType<ITextProvider2> (result);
if (iid == __uuidof (ComTypes::ITextProvider2))
return castToType<ComTypes::ITextProvider2> (result);
*result = nullptr;
return E_NOINTERFACE;
@ -54,7 +51,7 @@ public:
}
//=============================================================================
JUCE_COMRESULT get_DocumentRange (ITextRangeProvider** pRetVal) override
JUCE_COMRESULT get_DocumentRange (ComTypes::ITextRangeProvider** pRetVal) override
{
return withTextInterface (pRetVal, [&] (const AccessibilityTextInterface& textInterface)
{
@ -63,11 +60,11 @@ public:
});
}
JUCE_COMRESULT get_SupportedTextSelection (SupportedTextSelection* pRetVal) override
JUCE_COMRESULT get_SupportedTextSelection (ComTypes::SupportedTextSelection* pRetVal) override
{
return withCheckedComArgs (pRetVal, *this, [&]
{
*pRetVal = SupportedTextSelection_Single;
*pRetVal = ComTypes::SupportedTextSelection_Single;
return S_OK;
});
}
@ -124,7 +121,7 @@ public:
});
}
JUCE_COMRESULT RangeFromChild (IRawElementProviderSimple*, ITextRangeProvider** pRetVal) override
JUCE_COMRESULT RangeFromChild (IRawElementProviderSimple*, ComTypes::ITextRangeProvider** pRetVal) override
{
return withCheckedComArgs (pRetVal, *this, []
{
@ -132,7 +129,7 @@ public:
});
}
JUCE_COMRESULT RangeFromPoint (UiaPoint point, ITextRangeProvider** pRetVal) override
JUCE_COMRESULT RangeFromPoint (ComTypes::UiaPoint point, ComTypes::ITextRangeProvider** pRetVal) override
{
return withTextInterface (pRetVal, [&] (const AccessibilityTextInterface& textInterface)
{
@ -146,7 +143,7 @@ public:
}
//==============================================================================
JUCE_COMRESULT GetCaretRange (BOOL* isActive, ITextRangeProvider** pRetVal) override
JUCE_COMRESULT GetCaretRange (BOOL* isActive, ComTypes::ITextRangeProvider** pRetVal) override
{
return withTextInterface (pRetVal, [&] (const AccessibilityTextInterface& textInterface)
{
@ -159,7 +156,7 @@ public:
});
}
JUCE_COMRESULT RangeFromAnnotation (IRawElementProviderSimple*, ITextRangeProvider** pRetVal) override
JUCE_COMRESULT RangeFromAnnotation (IRawElementProviderSimple*, ComTypes::ITextRangeProvider** pRetVal) override
{
return withCheckedComArgs (pRetVal, *this, []
{
@ -183,7 +180,7 @@ private:
//==============================================================================
class UIATextRangeProvider : public UIAProviderBase,
public ComBaseClassHelper<ITextRangeProvider>
public ComBaseClassHelper<ComTypes::ITextRangeProvider>
{
public:
UIATextRangeProvider (UIATextProvider& textProvider, Range<int> range)
@ -202,7 +199,7 @@ private:
return Select();
}
JUCE_COMRESULT Clone (ITextRangeProvider** pRetVal) override
JUCE_COMRESULT Clone (ComTypes::ITextRangeProvider** pRetVal) override
{
return withCheckedComArgs (pRetVal, *this, [&]
{
@ -211,7 +208,7 @@ private:
});
}
JUCE_COMRESULT Compare (ITextRangeProvider* range, BOOL* pRetVal) override
JUCE_COMRESULT Compare (ComTypes::ITextRangeProvider* range, BOOL* pRetVal) override
{
return withCheckedComArgs (pRetVal, *this, [&]
{
@ -220,9 +217,9 @@ private:
});
}
JUCE_COMRESULT CompareEndpoints (TextPatternRangeEndpoint endpoint,
ITextRangeProvider* targetRange,
TextPatternRangeEndpoint targetEndpoint,
JUCE_COMRESULT CompareEndpoints (ComTypes::TextPatternRangeEndpoint endpoint,
ComTypes::ITextRangeProvider* targetRange,
ComTypes::TextPatternRangeEndpoint targetEndpoint,
int* pRetVal) override
{
if (targetRange == nullptr)
@ -230,19 +227,19 @@ private:
return withCheckedComArgs (pRetVal, *this, [&]
{
auto offset = (endpoint == TextPatternRangeEndpoint_Start ? selectionRange.getStart()
: selectionRange.getEnd());
auto offset = (endpoint == ComTypes::TextPatternRangeEndpoint_Start ? selectionRange.getStart()
: selectionRange.getEnd());
auto otherRange = static_cast<UIATextRangeProvider*> (targetRange)->getSelectionRange();
auto otherOffset = (targetEndpoint == TextPatternRangeEndpoint_Start ? otherRange.getStart()
: otherRange.getEnd());
auto otherOffset = (targetEndpoint == ComTypes::TextPatternRangeEndpoint_Start ? otherRange.getStart()
: otherRange.getEnd());
*pRetVal = offset - otherOffset;
return S_OK;
});
}
JUCE_COMRESULT ExpandToEnclosingUnit (TextUnit unit) override
JUCE_COMRESULT ExpandToEnclosingUnit (ComTypes::TextUnit unit) override
{
if (! isElementValid())
return (HRESULT) UIA_E_ELEMENTNOTAVAILABLE;
@ -269,7 +266,7 @@ private:
return (HRESULT) UIA_E_NOTSUPPORTED;
}
JUCE_COMRESULT FindAttribute (TEXTATTRIBUTEID, VARIANT, BOOL, ITextRangeProvider** pRetVal) override
JUCE_COMRESULT FindAttribute (TEXTATTRIBUTEID, VARIANT, BOOL, ComTypes::ITextRangeProvider** pRetVal) override
{
return withCheckedComArgs (pRetVal, *this, []
{
@ -278,7 +275,7 @@ private:
}
JUCE_COMRESULT FindText (BSTR text, BOOL backward, BOOL ignoreCase,
ITextRangeProvider** pRetVal) override
ComTypes::ITextRangeProvider** pRetVal) override
{
return owner->withTextInterface (pRetVal, [&] (const AccessibilityTextInterface& textInterface)
{
@ -303,25 +300,25 @@ private:
switch (attributeId)
{
case UIA_IsReadOnlyAttributeId:
case ComTypes::UIA_IsReadOnlyAttributeId:
{
VariantHelpers::setBool (textInterface.isReadOnly(), pRetVal);
break;
}
case UIA_CaretPositionAttributeId:
case ComTypes::UIA_CaretPositionAttributeId:
{
auto cursorPos = textInterface.getTextInsertionOffset();
auto caretPos = [&]
{
if (cursorPos == 0)
return CaretPosition_BeginningOfLine;
return ComTypes::CaretPosition_BeginningOfLine;
if (cursorPos == textInterface.getTotalNumCharacters())
return CaretPosition_EndOfLine;
return ComTypes::CaretPosition_EndOfLine;
return CaretPosition_Unknown;
return ComTypes::CaretPosition_Unknown;
}();
VariantHelpers::setInt (caretPos, pRetVal);
@ -412,28 +409,28 @@ private:
});
}
JUCE_COMRESULT Move (TextUnit unit, int count, int* pRetVal) override
JUCE_COMRESULT Move (ComTypes::TextUnit unit, int count, int* pRetVal) override
{
return owner->withTextInterface (pRetVal, [&] (const AccessibilityTextInterface&)
{
if (count > 0)
{
MoveEndpointByUnit (TextPatternRangeEndpoint_End, unit, count, pRetVal);
MoveEndpointByUnit (TextPatternRangeEndpoint_Start, unit, count, pRetVal);
MoveEndpointByUnit (ComTypes::TextPatternRangeEndpoint_End, unit, count, pRetVal);
MoveEndpointByUnit (ComTypes::TextPatternRangeEndpoint_Start, unit, count, pRetVal);
}
else if (count < 0)
{
MoveEndpointByUnit (TextPatternRangeEndpoint_Start, unit, count, pRetVal);
MoveEndpointByUnit (TextPatternRangeEndpoint_End, unit, count, pRetVal);
MoveEndpointByUnit (ComTypes::TextPatternRangeEndpoint_Start, unit, count, pRetVal);
MoveEndpointByUnit (ComTypes::TextPatternRangeEndpoint_End, unit, count, pRetVal);
}
return S_OK;
});
}
JUCE_COMRESULT MoveEndpointByRange (TextPatternRangeEndpoint endpoint,
ITextRangeProvider* targetRange,
TextPatternRangeEndpoint targetEndpoint) override
JUCE_COMRESULT MoveEndpointByRange (ComTypes::TextPatternRangeEndpoint endpoint,
ComTypes::ITextRangeProvider* targetRange,
ComTypes::TextPatternRangeEndpoint targetEndpoint) override
{
if (targetRange == nullptr)
return E_INVALIDARG;
@ -441,11 +438,11 @@ private:
if (! isElementValid())
return (HRESULT) UIA_E_ELEMENTNOTAVAILABLE;
if (auto* textInterface = owner->getHandler().getTextInterface())
if (owner->getHandler().getTextInterface() != nullptr)
{
auto otherRange = static_cast<UIATextRangeProvider*> (targetRange)->getSelectionRange();
auto targetPoint = (targetEndpoint == TextPatternRangeEndpoint_Start ? otherRange.getStart()
: otherRange.getEnd());
auto targetPoint = (targetEndpoint == ComTypes::TextPatternRangeEndpoint_Start ? otherRange.getStart()
: otherRange.getEnd());
setEndpointChecked (endpoint, targetPoint);
return S_OK;
@ -454,8 +451,8 @@ private:
return (HRESULT) UIA_E_NOTSUPPORTED;
}
JUCE_COMRESULT MoveEndpointByUnit (TextPatternRangeEndpoint endpoint,
TextUnit unit,
JUCE_COMRESULT MoveEndpointByUnit (ComTypes::TextPatternRangeEndpoint endpoint,
ComTypes::TextUnit unit,
int count,
int* pRetVal) override
{
@ -464,8 +461,8 @@ private:
if (count == 0 || textInterface.getTotalNumCharacters() == 0)
return S_OK;
auto endpointToMove = (endpoint == TextPatternRangeEndpoint_Start ? selectionRange.getStart()
: selectionRange.getEnd());
auto endpointToMove = (endpoint == ComTypes::TextPatternRangeEndpoint_Start ? selectionRange.getStart()
: selectionRange.getEnd());
const auto direction = (count > 0 ? AccessibilityTextHelpers::Direction::forwards
: AccessibilityTextHelpers::Direction::backwards);
@ -536,23 +533,23 @@ private:
}
private:
static AccessibilityTextHelpers::BoundaryType getBoundaryType (TextUnit unit)
static AccessibilityTextHelpers::BoundaryType getBoundaryType (ComTypes::TextUnit unit)
{
switch (unit)
{
case TextUnit_Character:
case ComTypes::TextUnit_Character:
return AccessibilityTextHelpers::BoundaryType::character;
case TextUnit_Format:
case TextUnit_Word:
case ComTypes::TextUnit_Format:
case ComTypes::TextUnit_Word:
return AccessibilityTextHelpers::BoundaryType::word;
case TextUnit_Line:
case ComTypes::TextUnit_Line:
return AccessibilityTextHelpers::BoundaryType::line;
case TextUnit_Paragraph:
case TextUnit_Page:
case TextUnit_Document:
case ComTypes::TextUnit_Paragraph:
case ComTypes::TextUnit_Page:
case ComTypes::TextUnit_Document:
return AccessibilityTextHelpers::BoundaryType::document;
};
@ -560,9 +557,9 @@ private:
return AccessibilityTextHelpers::BoundaryType::character;
}
void setEndpointChecked (TextPatternRangeEndpoint endpoint, int newEndpoint)
void setEndpointChecked (ComTypes::TextPatternRangeEndpoint endpoint, int newEndpoint)
{
if (endpoint == TextPatternRangeEndpoint_Start)
if (endpoint == ComTypes::TextPatternRangeEndpoint_Start)
{
if (selectionRange.getEnd() < newEndpoint)
selectionRange.setEnd (newEndpoint);

View file

@ -28,13 +28,10 @@ namespace juce
//==============================================================================
class UIAToggleProvider : public UIAProviderBase,
public ComBaseClassHelper<IToggleProvider>
public ComBaseClassHelper<ComTypes::IToggleProvider>
{
public:
explicit UIAToggleProvider (AccessibilityNativeHandle* nativeHandle)
: UIAProviderBase (nativeHandle)
{
}
using UIAProviderBase::UIAProviderBase;
//==============================================================================
JUCE_COMRESULT Toggle() override
@ -58,7 +55,7 @@ public:
return (HRESULT) UIA_E_NOTSUPPORTED;
}
JUCE_COMRESULT get_ToggleState (ToggleState* pRetVal) override
JUCE_COMRESULT get_ToggleState (ComTypes::ToggleState* pRetVal) override
{
return withCheckedComArgs (pRetVal, *this, [&]
{
@ -68,10 +65,10 @@ public:
}
private:
ToggleState getCurrentToggleState() const
ComTypes::ToggleState getCurrentToggleState() const
{
return getHandler().getCurrentState().isChecked() ? ToggleState_On
: ToggleState_Off;
return getHandler().getCurrentState().isChecked() ? ComTypes::ToggleState_On
: ComTypes::ToggleState_Off;
}
//==============================================================================

View file

@ -28,13 +28,10 @@ namespace juce
//==============================================================================
class UIATransformProvider : public UIAProviderBase,
public ComBaseClassHelper<ITransformProvider>
public ComBaseClassHelper<ComTypes::ITransformProvider>
{
public:
explicit UIATransformProvider (AccessibilityNativeHandle* nativeHandle)
: UIAProviderBase (nativeHandle)
{
}
using UIAProviderBase::UIAProviderBase;
//==============================================================================
JUCE_COMRESULT Move (double x, double y) override

View file

@ -28,13 +28,10 @@ namespace juce
//==============================================================================
class UIAValueProvider : public UIAProviderBase,
public ComBaseClassHelper<IValueProvider>
public ComBaseClassHelper<ComTypes::IValueProvider>
{
public:
UIAValueProvider (AccessibilityNativeHandle* nativeHandle)
: UIAProviderBase (nativeHandle)
{
}
using UIAProviderBase::UIAProviderBase;
//==============================================================================
JUCE_COMRESULT SetValue (LPCWSTR val) override

View file

@ -28,16 +28,13 @@ namespace juce
//==============================================================================
class UIAWindowProvider : public UIAProviderBase,
public ComBaseClassHelper<IWindowProvider>
public ComBaseClassHelper<ComTypes::IWindowProvider>
{
public:
explicit UIAWindowProvider (AccessibilityNativeHandle* nativeHandle)
: UIAProviderBase (nativeHandle)
{
}
using UIAProviderBase::UIAProviderBase;
//==============================================================================
JUCE_COMRESULT SetVisualState (WindowVisualState state) override
JUCE_COMRESULT SetVisualState (ComTypes::WindowVisualState state) override
{
if (! isElementValid())
return (HRESULT) UIA_E_ELEMENTNOTAVAILABLE;
@ -46,15 +43,15 @@ public:
{
switch (state)
{
case WindowVisualState_Maximized:
case ComTypes::WindowVisualState_Maximized:
peer->setFullScreen (true);
break;
case WindowVisualState_Minimized:
case ComTypes::WindowVisualState_Minimized:
peer->setMinimised (true);
break;
case WindowVisualState_Normal:
case ComTypes::WindowVisualState_Normal:
peer->setFullScreen (false);
peer->setMinimised (false);
break;
@ -133,18 +130,18 @@ public:
});
}
JUCE_COMRESULT get_WindowVisualState (WindowVisualState* pRetVal) override
JUCE_COMRESULT get_WindowVisualState (ComTypes::WindowVisualState* pRetVal) override
{
return withCheckedComArgs (pRetVal, *this, [&]() -> HRESULT
{
if (auto* peer = getPeer())
{
if (peer->isFullScreen())
*pRetVal = WindowVisualState_Maximized;
*pRetVal = ComTypes::WindowVisualState_Maximized;
else if (peer->isMinimised())
*pRetVal = WindowVisualState_Minimized;
*pRetVal = ComTypes::WindowVisualState_Minimized;
else
*pRetVal = WindowVisualState_Normal;
*pRetVal = ComTypes::WindowVisualState_Normal;
return S_OK;
}
@ -153,15 +150,15 @@ public:
});
}
JUCE_COMRESULT get_WindowInteractionState (WindowInteractionState* pRetVal) override
JUCE_COMRESULT get_WindowInteractionState (ComTypes::WindowInteractionState* pRetVal) override
{
return withCheckedComArgs (pRetVal, *this, [&]() -> HRESULT
{
if (auto* peer = getPeer())
{
*pRetVal = peer->getComponent().isCurrentlyBlockedByAnotherModalComponent()
? WindowInteractionState::WindowInteractionState_BlockedByModalWindow
: WindowInteractionState::WindowInteractionState_Running;
? ComTypes::WindowInteractionState::WindowInteractionState_BlockedByModalWindow
: ComTypes::WindowInteractionState::WindowInteractionState_Running;
return S_OK;
}

View file

@ -127,7 +127,9 @@ private:
template <typename FuncType>
static FuncType getUiaFunction (HMODULE module, LPCSTR funcName)
{
JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wcast-function-type")
return (FuncType) GetProcAddress (module, funcName);
JUCE_END_IGNORE_WARNINGS_GCC_LIKE
}
//==============================================================================

View file

@ -23,10 +23,6 @@
==============================================================================
*/
#if JUCE_MINGW
LWSTDAPI IUnknown_GetWindow (IUnknown* punk, HWND* phwnd);
#endif
namespace juce
{
@ -253,7 +249,9 @@ private:
JUCE_COMRESULT updateHwnd (IFileDialog* d)
{
HWND hwnd = nullptr;
IUnknown_GetWindow (d, &hwnd);
if (auto window = ComSmartPtr<IFileDialog> { d }.getInterface<IOleWindow>())
window->GetWindow (&hwnd);
ScopedLock lock (owner.deletingDialog);
@ -501,13 +499,11 @@ private:
const Remover remover (*this);
#if ! JUCE_MINGW
if (SystemStats::getOperatingSystemType() >= SystemStats::WinVista
&& customComponent == nullptr)
{
return openDialogVistaAndUp (async);
}
#endif
return openDialogPreVista (async);
}
@ -781,9 +777,9 @@ class FileChooser::Native : public std::enable_shared_from_this<Native>,
public FileChooser::Pimpl
{
public:
Native (FileChooser& fileChooser, int flags, FilePreviewComponent* previewComp)
Native (FileChooser& fileChooser, int flagsIn, FilePreviewComponent* previewComp)
: owner (fileChooser),
nativeFileChooser (std::make_unique<Win32NativeFileChooser> (this, flags, previewComp, fileChooser.startingFile,
nativeFileChooser (std::make_unique<Win32NativeFileChooser> (this, flagsIn, previewComp, fileChooser.startingFile,
fileChooser.title, fileChooser.filters))
{
auto mainMon = Desktop::getInstance().getDisplays().getPrimaryDisplay()->userArea;

View file

@ -1133,7 +1133,6 @@ namespace IconConverters
if (auto* dc = ::CreateCompatibleDC (deviceContext.dc))
{
JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wfour-char-constants")
BITMAPV5HEADER header = {};
header.bV5Size = sizeof (BITMAPV5HEADER);
header.bV5Width = bm.bmWidth;
@ -1145,15 +1144,8 @@ namespace IconConverters
header.bV5GreenMask = 0x0000FF00;
header.bV5BlueMask = 0x000000FF;
header.bV5AlphaMask = 0xFF000000;
#if JUCE_MINGW
header.bV5CSType = 'Win ';
#else
header.bV5CSType = LCS_WINDOWS_COLOR_SPACE;
#endif
header.bV5CSType = 0x57696E20; // 'Win '
header.bV5Intent = LCS_GM_IMAGES;
JUCE_END_IGNORE_WARNINGS_GCC_LIKE
uint32* bitmapImageData = nullptr;
@ -4545,8 +4537,8 @@ class PreVistaMessageBox : public WindowsMessageBoxBase
public:
PreVistaMessageBox (const MessageBoxOptions& opts,
UINT extraFlags,
std::unique_ptr<ModalComponentManager::Callback>&& callback)
: WindowsMessageBoxBase (opts.getAssociatedComponent(), std::move (callback)),
std::unique_ptr<ModalComponentManager::Callback>&& cb)
: WindowsMessageBoxBase (opts.getAssociatedComponent(), std::move (cb)),
flags (extraFlags | getMessageBoxFlags (opts.getIconType())),
title (opts.getTitle()), message (opts.getMessage())
{
@ -4598,8 +4590,8 @@ class WindowsTaskDialog : public WindowsMessageBoxBase
{
public:
WindowsTaskDialog (const MessageBoxOptions& opts,
std::unique_ptr<ModalComponentManager::Callback>&& callback)
: WindowsMessageBoxBase (opts.getAssociatedComponent(), std::move (callback)),
std::unique_ptr<ModalComponentManager::Callback>&& cb)
: WindowsMessageBoxBase (opts.getAssociatedComponent(), std::move (cb)),
iconType (opts.getIconType()),
title (opts.getTitle()), message (opts.getMessage()),
button1 (opts.getButtonText (0)), button2 (opts.getButtonText (1)), button3 (opts.getButtonText (2))

View file

@ -28,8 +28,8 @@ namespace juce
struct InternalWebViewType
{
InternalWebViewType() {}
virtual ~InternalWebViewType() {}
InternalWebViewType() = default;
virtual ~InternalWebViewType() = default;
virtual void createBrowser() = 0;
virtual bool hasBrowserBeenCreated() = 0;
@ -47,20 +47,6 @@ struct InternalWebViewType
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (InternalWebViewType)
};
#if JUCE_MINGW
JUCE_DECLARE_UUID_GETTER (IOleClientSite, "00000118-0000-0000-c000-000000000046")
JUCE_DECLARE_UUID_GETTER (IDispatch, "00020400-0000-0000-c000-000000000046")
#ifndef WebBrowser
class WebBrowser;
#endif
#endif
JUCE_DECLARE_UUID_GETTER (DWebBrowserEvents2, "34A715A0-6587-11D0-924A-0020AFC7AC4D")
JUCE_DECLARE_UUID_GETTER (IConnectionPointContainer, "B196B284-BAB4-101A-B69C-00AA00341D07")
JUCE_DECLARE_UUID_GETTER (IWebBrowser2, "D30C1661-CDAF-11D0-8A3E-00C04FC9E26E")
JUCE_DECLARE_UUID_GETTER (WebBrowser, "8856F961-340A-11D0-A96B-00C04FD705A2")
//==============================================================================
class Win32WebView : public InternalWebViewType,
public ActiveXControlComponent

View file

@ -44,14 +44,11 @@
#import <AVKit/AVKit.h>
//==============================================================================
#elif JUCE_WINDOWS && ! JUCE_MINGW
/* If you're using the camera classes, you'll need access to a few DirectShow headers.
These files are provided in the normal Windows SDK. */
#include <dshow.h>
#include <dshowasf.h>
#include <evr.h>
#elif JUCE_WINDOWS
#include "wmsdkidl.h"
#include "native/juce_win32_ComTypes.h"
#if ! JUCE_DONT_AUTOLINK_TO_WIN32_LIBRARIES
#if ! JUCE_MINGW && ! JUCE_DONT_AUTOLINK_TO_WIN32_LIBRARIES
#pragma comment (lib, "strmiids.lib")
#if JUCE_USE_CAMERA

View file

@ -23,29 +23,6 @@
==============================================================================
*/
interface ISampleGrabberCB : public IUnknown
{
JUCE_COMCALL SampleCB (double, IMediaSample*) = 0;
JUCE_COMCALL BufferCB (double, BYTE*, long) = 0;
};
interface ISampleGrabber : public IUnknown
{
JUCE_COMCALL SetOneShot (BOOL) = 0;
JUCE_COMCALL SetMediaType (const AM_MEDIA_TYPE*) = 0;
JUCE_COMCALL GetConnectedMediaType (AM_MEDIA_TYPE*) = 0;
JUCE_COMCALL SetBufferSamples (BOOL) = 0;
JUCE_COMCALL GetCurrentBuffer (long*, long*) = 0;
JUCE_COMCALL GetCurrentSample (IMediaSample**) = 0;
JUCE_COMCALL SetCallback (ISampleGrabberCB*, long) = 0;
};
static const IID IID_ISampleGrabberCB = { 0x0579154A, 0x2B53, 0x4994, { 0xB0, 0xD0, 0xE7, 0x73, 0x14, 0x8E, 0xFF, 0x85 } };
static const IID IID_ISampleGrabber = { 0x6B652FFF, 0x11FE, 0x4fce, { 0x92, 0xAD, 0x02, 0x66, 0xB5, 0xD7, 0xC7, 0x8F } };
static const CLSID CLSID_SampleGrabber = { 0xC1F400A0, 0x3F08, 0x11d3, { 0x9F, 0x0B, 0x00, 0x60, 0x08, 0x03, 0x9E, 0x37 } };
static const CLSID CLSID_NullRenderer = { 0xC1F400A4, 0x3F08, 0x11d3, { 0x9F, 0x0B, 0x00, 0x60, 0x08, 0x03, 0x9E, 0x37 } };
struct CameraDevice::Pimpl : public ChangeBroadcaster
{
Pimpl (CameraDevice& ownerToUse, const String&, int index,
@ -53,7 +30,7 @@ struct CameraDevice::Pimpl : public ChangeBroadcaster
bool /*highQuality*/)
: owner (ownerToUse)
{
HRESULT hr = captureGraphBuilder.CoCreateInstance (CLSID_CaptureGraphBuilder2);
HRESULT hr = captureGraphBuilder.CoCreateInstance (ComTypes::CLSID_CaptureGraphBuilder2);
if (FAILED (hr))
return;
@ -61,7 +38,7 @@ struct CameraDevice::Pimpl : public ChangeBroadcaster
if (filter == nullptr)
return;
hr = graphBuilder.CoCreateInstance (CLSID_FilterGraph);
hr = graphBuilder.CoCreateInstance (ComTypes::CLSID_FilterGraph);
if (FAILED (hr))
return;
@ -69,15 +46,17 @@ struct CameraDevice::Pimpl : public ChangeBroadcaster
if (FAILED (hr))
return;
mediaControl = graphBuilder.getInterface<IMediaControl>();
mediaControl = graphBuilder.getInterface<ComTypes::IMediaControl>();
if (mediaControl == nullptr)
return;
{
ComSmartPtr<IAMStreamConfig> streamConfig;
ComSmartPtr<ComTypes::IAMStreamConfig> streamConfig;
hr = captureGraphBuilder->FindInterface (&PIN_CATEGORY_CAPTURE, nullptr, filter,
IID_IAMStreamConfig, (void**) streamConfig.resetAndGetPointerAddress());
JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wlanguage-extension-token")
hr = captureGraphBuilder->FindInterface (&ComTypes::PIN_CATEGORY_CAPTURE, nullptr, filter,
__uuidof (ComTypes::IAMStreamConfig), (void**) streamConfig.resetAndGetPointerAddress());
JUCE_END_IGNORE_WARNINGS_GCC_LIKE
if (streamConfig != nullptr)
{
@ -92,7 +71,7 @@ struct CameraDevice::Pimpl : public ChangeBroadcaster
if (FAILED (hr))
return;
hr = smartTee.CoCreateInstance (CLSID_SmartTee);
hr = smartTee.CoCreateInstance (ComTypes::CLSID_SmartTee);
if (FAILED (hr))
return;
@ -103,20 +82,23 @@ struct CameraDevice::Pimpl : public ChangeBroadcaster
if (! connectFilters (filter, smartTee))
return;
ComSmartPtr<IBaseFilter> sampleGrabberBase;
hr = sampleGrabberBase.CoCreateInstance (CLSID_SampleGrabber);
ComSmartPtr<ComTypes::IBaseFilter> sampleGrabberBase;
hr = sampleGrabberBase.CoCreateInstance (ComTypes::CLSID_SampleGrabber);
if (FAILED (hr))
return;
hr = sampleGrabberBase.QueryInterface (IID_ISampleGrabber, sampleGrabber);
JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wlanguage-extension-token")
hr = sampleGrabberBase.QueryInterface (__uuidof (ComTypes::ISampleGrabber), sampleGrabber);
JUCE_END_IGNORE_WARNINGS_GCC_LIKE
if (FAILED (hr))
return;
{
AM_MEDIA_TYPE mt = {};
mt.majortype = MEDIATYPE_Video;
mt.subtype = MEDIASUBTYPE_RGB24;
mt.formattype = FORMAT_VideoInfo;
ComTypes::AM_MEDIA_TYPE mt = {};
mt.majortype = ComTypes::MEDIATYPE_Video;
mt.subtype = ComTypes::MEDIASUBTYPE_RGB24;
mt.formattype = ComTypes::FORMAT_VideoInfo;
sampleGrabber->SetMediaType (&mt);
}
@ -127,27 +109,27 @@ struct CameraDevice::Pimpl : public ChangeBroadcaster
if (FAILED (hr))
return;
ComSmartPtr<IPin> grabberInputPin;
if (! (getPin (smartTee, PINDIR_OUTPUT, smartTeeCaptureOutputPin, "capture")
&& getPin (smartTee, PINDIR_OUTPUT, smartTeePreviewOutputPin, "preview")
&& getPin (sampleGrabberBase, PINDIR_INPUT, grabberInputPin)))
ComSmartPtr<ComTypes::IPin> grabberInputPin;
if (! (getPin (smartTee, ComTypes::PINDIR_OUTPUT, smartTeeCaptureOutputPin, "capture")
&& getPin (smartTee, ComTypes::PINDIR_OUTPUT, smartTeePreviewOutputPin, "preview")
&& getPin (sampleGrabberBase, ComTypes::PINDIR_INPUT, grabberInputPin)))
return;
hr = graphBuilder->Connect (smartTeePreviewOutputPin, grabberInputPin);
if (FAILED (hr))
return;
AM_MEDIA_TYPE mt = {};
ComTypes::AM_MEDIA_TYPE mt = {};
hr = sampleGrabber->GetConnectedMediaType (&mt);
if (auto* pVih = unalignedPointerCast<VIDEOINFOHEADER*> (mt.pbFormat))
if (auto* pVih = unalignedPointerCast<ComTypes::VIDEOINFOHEADER*> (mt.pbFormat))
{
width = pVih->bmiHeader.biWidth;
height = pVih->bmiHeader.biHeight;
}
ComSmartPtr<IBaseFilter> nullFilter;
hr = nullFilter.CoCreateInstance (CLSID_NullRenderer);
ComSmartPtr<ComTypes::IBaseFilter> nullFilter;
hr = nullFilter.CoCreateInstance (ComTypes::CLSID_NullRenderer);
hr = graphBuilder->AddFilter (nullFilter, _T("Null Renderer"));
if (connectFilters (sampleGrabberBase, nullFilter)
@ -291,12 +273,12 @@ struct CameraDevice::Pimpl : public ChangeBroadcaster
firstRecordedTime = Time::getCurrentTime() - RelativeTime (defaultCameraLatency);
recordNextFrameTime = false;
ComSmartPtr<IPin> pin;
if (getPin (filter, PINDIR_OUTPUT, pin))
ComSmartPtr<ComTypes::IPin> pin;
if (getPin (filter, ComTypes::PINDIR_OUTPUT, pin))
{
if (auto pushSource = pin.getInterface<IAMPushSource>())
if (auto pushSource = pin.getInterface<ComTypes::IAMPushSource>())
{
REFERENCE_TIME latency = 0;
ComTypes::REFERENCE_TIME latency = 0;
pushSource->GetLatency (&latency);
firstRecordedTime = firstRecordedTime - RelativeTime ((double) latency);
@ -359,11 +341,11 @@ struct CameraDevice::Pimpl : public ChangeBroadcaster
recordNextFrameTime = true;
previewMaxFPS = 60;
HRESULT hr = asfWriter.CoCreateInstance (CLSID_WMAsfWriter);
HRESULT hr = asfWriter.CoCreateInstance (ComTypes::CLSID_WMAsfWriter);
if (SUCCEEDED (hr))
{
if (auto fileSink = asfWriter.getInterface<IFileSinkFilter>())
if (auto fileSink = asfWriter.getInterface<ComTypes::IFileSinkFilter>())
{
hr = fileSink->SetFileName (file.getFullPathName().toWideCharPointer(), nullptr);
@ -373,11 +355,19 @@ struct CameraDevice::Pimpl : public ChangeBroadcaster
if (SUCCEEDED (hr))
{
if (auto asfConfig = asfWriter.getInterface<IConfigAsfWriter>())
if (auto asfConfig = asfWriter.getInterface<ComTypes::IConfigAsfWriter>())
{
asfConfig->SetIndexMode (true);
ComSmartPtr<IWMProfileManager> profileManager;
hr = WMCreateProfileManager (profileManager.resetAndGetPointerAddress());
using Fn = HRESULT (*) (IWMProfileManager**);
// This function is available on Windows 2000 and up, but we load it at runtime anway
// because some versions of MinGW ship with libraries that don't include this symbol.
if (auto* fn = reinterpret_cast<Fn> (wmvcoreLibrary.getFunction ("WMCreateProfileManager")))
hr = fn (profileManager.resetAndGetPointerAddress());
else
jassertfalse;
// This gibberish is the DirectShow profile for a video-only wmv file.
String prof ("<profile version=\"589824\" storageformat=\"1\" name=\"Quality\" description=\"Quality type for output.\">"
@ -414,9 +404,9 @@ struct CameraDevice::Pimpl : public ChangeBroadcaster
if (SUCCEEDED (hr))
{
ComSmartPtr<IPin> asfWriterInputPin;
ComSmartPtr<ComTypes::IPin> asfWriterInputPin;
if (getPin (asfWriter, PINDIR_INPUT, asfWriterInputPin, "Video Input 01"))
if (getPin (asfWriter, ComTypes::PINDIR_INPUT, asfWriterInputPin, "Video Input 01"))
{
hr = graphBuilder->Connect (smartTeeCaptureOutputPin, asfWriterInputPin);
@ -462,10 +452,10 @@ struct CameraDevice::Pimpl : public ChangeBroadcaster
previewMaxFPS = 60;
}
static ComSmartPtr<IBaseFilter> enumerateCameras (StringArray* names, const int deviceIndexToOpen)
static ComSmartPtr<ComTypes::IBaseFilter> enumerateCameras (StringArray* names, const int deviceIndexToOpen)
{
int index = 0;
ComSmartPtr<ICreateDevEnum> pDevEnum;
ComSmartPtr<ComTypes::ICreateDevEnum> pDevEnum;
struct Deleter
{
@ -474,10 +464,10 @@ struct CameraDevice::Pimpl : public ChangeBroadcaster
using ContextPtr = std::unique_ptr<IBindCtx, Deleter>;
if (SUCCEEDED (pDevEnum.CoCreateInstance (CLSID_SystemDeviceEnum)))
if (SUCCEEDED (pDevEnum.CoCreateInstance (ComTypes::CLSID_SystemDeviceEnum)))
{
ComSmartPtr<IEnumMoniker> enumerator;
HRESULT hr = pDevEnum->CreateClassEnumerator (CLSID_VideoInputDeviceCategory, enumerator.resetAndGetPointerAddress(), 0);
HRESULT hr = pDevEnum->CreateClassEnumerator (ComTypes::CLSID_VideoInputDeviceCategory, enumerator.resetAndGetPointerAddress(), 0);
if (SUCCEEDED (hr) && enumerator != nullptr)
{
@ -493,8 +483,10 @@ struct CameraDevice::Pimpl : public ChangeBroadcaster
return ContextPtr (ptr);
}();
ComSmartPtr<IBaseFilter> captureFilter;
hr = moniker->BindToObject (context.get(), nullptr, IID_IBaseFilter, (void**) captureFilter.resetAndGetPointerAddress());
ComSmartPtr<ComTypes::IBaseFilter> captureFilter;
JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wlanguage-extension-token")
hr = moniker->BindToObject (context.get(), nullptr, __uuidof (ComTypes::IBaseFilter), (void**) captureFilter.resetAndGetPointerAddress());
JUCE_END_IGNORE_WARNINGS_GCC_LIKE
if (SUCCEEDED (hr))
{
@ -535,20 +527,22 @@ struct CameraDevice::Pimpl : public ChangeBroadcaster
return devs;
}
struct GrabberCallback : public ComBaseClassHelperBase<ISampleGrabberCB>
struct GrabberCallback : public ComBaseClassHelperBase<ComTypes::ISampleGrabberCB>
{
GrabberCallback (Pimpl& p)
: ComBaseClassHelperBase (0), owner (p) {}
JUCE_COMRESULT QueryInterface (REFIID refId, void** result)
{
if (refId == IID_ISampleGrabberCB)
return castToType<ISampleGrabberCB> (result);
JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wlanguage-extension-token")
if (refId == __uuidof (ComTypes::ISampleGrabberCB))
return castToType<ComTypes::ISampleGrabberCB> (result);
JUCE_END_IGNORE_WARNINGS_GCC_LIKE
return ComBaseClassHelperBase<ISampleGrabberCB>::QueryInterface (refId, result);
return ComBaseClassHelperBase<ComTypes::ISampleGrabberCB>::QueryInterface (refId, result);
}
JUCE_COMRESULT SampleCB (double, IMediaSample*) { return E_FAIL; }
JUCE_COMRESULT SampleCB (double, ComTypes::IMediaSample*) { return E_FAIL; }
JUCE_COMRESULT BufferCB (double time, BYTE* buffer, long bufferSize)
{
@ -561,6 +555,7 @@ struct CameraDevice::Pimpl : public ChangeBroadcaster
JUCE_DECLARE_NON_COPYABLE (GrabberCallback)
};
DynamicLibrary wmvcoreLibrary { "wmvcore" };
CameraDevice& owner;
ComSmartPtr<GrabberCallback> callback;
@ -577,12 +572,12 @@ struct CameraDevice::Pimpl : public ChangeBroadcaster
Array<ViewerComponent*> viewerComps;
ComSmartPtr<ICaptureGraphBuilder2> captureGraphBuilder;
ComSmartPtr<IBaseFilter> filter, smartTee, asfWriter;
ComSmartPtr<IGraphBuilder> graphBuilder;
ComSmartPtr<ISampleGrabber> sampleGrabber;
ComSmartPtr<IMediaControl> mediaControl;
ComSmartPtr<IPin> smartTeePreviewOutputPin, smartTeeCaptureOutputPin;
ComSmartPtr<ComTypes::ICaptureGraphBuilder2> captureGraphBuilder;
ComSmartPtr<ComTypes::IBaseFilter> filter, smartTee, asfWriter;
ComSmartPtr<ComTypes::IGraphBuilder> graphBuilder;
ComSmartPtr<ComTypes::ISampleGrabber> sampleGrabber;
ComSmartPtr<ComTypes::IMediaControl> mediaControl;
ComSmartPtr<ComTypes::IPin> smartTeePreviewOutputPin, smartTeeCaptureOutputPin;
int activeUsers = 0;
Array<int> widths, heights;
DWORD graphRegistrationID;
@ -597,7 +592,7 @@ struct CameraDevice::Pimpl : public ChangeBroadcaster
JUCE_DECLARE_WEAK_REFERENCEABLE (Pimpl)
private:
void getVideoSizes (IAMStreamConfig* const streamConfig)
void getVideoSizes (ComTypes::IAMStreamConfig* const streamConfig)
{
widths.clear();
heights.clear();
@ -605,12 +600,12 @@ private:
int count = 0, size = 0;
streamConfig->GetNumberOfCapabilities (&count, &size);
if (size == sizeof (VIDEO_STREAM_CONFIG_CAPS))
if (size == (int) sizeof (ComTypes::VIDEO_STREAM_CONFIG_CAPS))
{
for (int i = 0; i < count; ++i)
{
VIDEO_STREAM_CONFIG_CAPS scc;
AM_MEDIA_TYPE* config;
ComTypes::VIDEO_STREAM_CONFIG_CAPS scc;
ComTypes::AM_MEDIA_TYPE* config;
HRESULT hr = streamConfig->GetStreamCaps (i, &config, (BYTE*) &scc);
@ -642,17 +637,17 @@ private:
}
}
bool selectVideoSize (IAMStreamConfig* const streamConfig,
bool selectVideoSize (ComTypes::IAMStreamConfig* const streamConfig,
const int minWidth, const int minHeight,
const int maxWidth, const int maxHeight)
{
int count = 0, size = 0, bestArea = 0, bestIndex = -1;
streamConfig->GetNumberOfCapabilities (&count, &size);
if (size == sizeof (VIDEO_STREAM_CONFIG_CAPS))
if (size == (int) sizeof (ComTypes::VIDEO_STREAM_CONFIG_CAPS))
{
AM_MEDIA_TYPE* config;
VIDEO_STREAM_CONFIG_CAPS scc;
ComTypes::AM_MEDIA_TYPE* config;
ComTypes::VIDEO_STREAM_CONFIG_CAPS scc;
for (int i = 0; i < count; ++i)
{
@ -690,22 +685,22 @@ private:
return false;
}
static bool getPin (IBaseFilter* filter, const PIN_DIRECTION wantedDirection,
ComSmartPtr<IPin>& result, const char* pinName = nullptr)
static bool getPin (ComTypes::IBaseFilter* filter, const ComTypes::PIN_DIRECTION wantedDirection,
ComSmartPtr<ComTypes::IPin>& result, const char* pinName = nullptr)
{
ComSmartPtr<IEnumPins> enumerator;
ComSmartPtr<IPin> pin;
ComSmartPtr<ComTypes::IEnumPins> enumerator;
ComSmartPtr<ComTypes::IPin> pin;
filter->EnumPins (enumerator.resetAndGetPointerAddress());
while (enumerator->Next (1, pin.resetAndGetPointerAddress(), nullptr) == S_OK)
{
PIN_DIRECTION dir;
ComTypes::PIN_DIRECTION dir;
pin->QueryDirection (&dir);
if (wantedDirection == dir)
{
PIN_INFO info = {};
ComTypes::PIN_INFO info = {};
pin->QueryPinInfo (&info);
if (pinName == nullptr || String (pinName).equalsIgnoreCase (String (info.achName)))
@ -719,12 +714,12 @@ private:
return false;
}
bool connectFilters (IBaseFilter* const first, IBaseFilter* const second) const
bool connectFilters (ComTypes::IBaseFilter* const first, ComTypes::IBaseFilter* const second) const
{
ComSmartPtr<IPin> in, out;
ComSmartPtr<ComTypes::IPin> in, out;
return getPin (first, PINDIR_OUTPUT, out)
&& getPin (second, PINDIR_INPUT, in)
return getPin (first, ComTypes::PINDIR_OUTPUT, out)
&& getPin (second, ComTypes::PINDIR_INPUT, in)
&& SUCCEEDED (graphBuilder->Connect (out, in));
}
@ -754,7 +749,7 @@ private:
void disconnectAnyViewers();
static void deleteMediaType (AM_MEDIA_TYPE* const pmt)
static void deleteMediaType (ComTypes::AM_MEDIA_TYPE* const pmt)
{
if (pmt->cbFormat != 0)
CoTaskMemFree ((PVOID) pmt->pbFormat);

View file

@ -0,0 +1,512 @@
/*
==============================================================================
This file is part of the JUCE library.
Copyright (c) 2020 - Raw Material Software Limited
JUCE is an open source library subject to commercial or open-source
licensing.
By using JUCE, you agree to the terms of both the JUCE 6 End-User License
Agreement and JUCE Privacy Policy (both effective as of the 16th June 2020).
End User License Agreement: www.juce.com/juce-6-licence
Privacy Policy: www.juce.com/juce-privacy-policy
Or: You may also use this code under the terms of the GPL v3 (see
www.gnu.org/licenses).
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
DISCLAIMED.
==============================================================================
*/
namespace juce
{
namespace ComTypes
{
/*
These interfaces would normally be included in the system platform headers.
However, those headers are likely to be incomplete when building with
MinGW. In order to allow building video applications under MinGW,
we reproduce all necessary definitions here.
*/
enum PIN_DIRECTION
{
PINDIR_INPUT = 0,
PINDIR_OUTPUT = PINDIR_INPUT + 1
};
enum VMRMode
{
VMRMode_Windowed = 0x1,
VMRMode_Windowless = 0x2,
VMRMode_Renderless = 0x4,
VMRMode_Mask = 0x7
};
enum VMR_ASPECT_RATIO_MODE
{
VMR_ARMODE_NONE = 0,
VMR_ARMODE_LETTER_BOX = VMR_ARMODE_NONE + 1
};
enum MFVideoAspectRatioMode
{
MFVideoARMode_None = 0,
MFVideoARMode_PreservePicture = 0x1,
MFVideoARMode_PreservePixel = 0x2,
MFVideoARMode_NonLinearStretch = 0x4,
MFVideoARMode_Mask = 0x7
};
enum FILTER_STATE
{
State_Stopped = 0,
State_Paused = State_Stopped + 1,
State_Running = State_Paused + 1
};
enum WMT_VERSION
{
WMT_VER_4_0 = 0x40000,
WMT_VER_7_0 = 0x70000,
WMT_VER_8_0 = 0x80000,
WMT_VER_9_0 = 0x90000
};
// We only ever refer to these through a pointer, so we don't need definitions for them.
struct IAMCopyCaptureFileProgress;
struct IBaseFilter;
struct IEnumFilters;
struct IEnumMediaTypes;
struct IReferenceClock;
struct IVMRImageCompositor;
struct FILTER_INFO;
struct AM_MEDIA_TYPE
{
GUID majortype;
GUID subtype;
BOOL bFixedSizeSamples;
BOOL bTemporalCompression;
ULONG lSampleSize;
GUID formattype;
IUnknown* pUnk;
ULONG cbFormat;
BYTE* pbFormat;
};
typedef LONGLONG REFERENCE_TIME;
typedef LONG_PTR OAEVENT;
typedef LONG_PTR OAHWND;
typedef double REFTIME;
typedef long OAFilterState;
enum Constants
{
EC_STATE_CHANGE = 0x32,
EC_REPAINT = 0x05,
EC_COMPLETE = 0x01,
EC_ERRORABORT = 0x03,
EC_ERRORABORTEX = 0x45,
EC_USERABORT = 0x02,
VFW_E_INVALID_FILE_FORMAT = (HRESULT) 0x8004022FL,
VFW_E_NOT_FOUND = (HRESULT) 0x80040216L,
VFW_E_UNKNOWN_FILE_TYPE = (HRESULT) 0x80040240L,
VFW_E_UNSUPPORTED_STREAM = (HRESULT) 0x80040265L,
VFW_E_CANNOT_CONNECT = (HRESULT) 0x80040217L,
VFW_E_CANNOT_LOAD_SOURCE_FILTER = (HRESULT) 0x80040241L,
VFW_E_NOT_CONNECTED = (HRESULT) 0x80040209L
};
struct MFVideoNormalizedRect
{
float left;
float top;
float right;
float bottom;
};
struct VIDEOINFOHEADER
{
RECT rcSource;
RECT rcTarget;
DWORD dwBitRate;
DWORD dwBitErrorRate;
REFERENCE_TIME AvgTimePerFrame;
BITMAPINFOHEADER bmiHeader;
};
struct VIDEO_STREAM_CONFIG_CAPS
{
GUID guid;
ULONG VideoStandard;
SIZE InputSize;
SIZE MinCroppingSize;
SIZE MaxCroppingSize;
int CropGranularityX;
int CropGranularityY;
int CropAlignX;
int CropAlignY;
SIZE MinOutputSize;
SIZE MaxOutputSize;
int OutputGranularityX;
int OutputGranularityY;
int StretchTapsX;
int StretchTapsY;
int ShrinkTapsX;
int ShrinkTapsY;
LONGLONG MinFrameInterval;
LONGLONG MaxFrameInterval;
LONG MinBitsPerSecond;
LONG MaxBitsPerSecond;
};
struct PIN_INFO
{
IBaseFilter* pFilter;
PIN_DIRECTION dir;
WCHAR achName[128];
};
JUCE_COMCLASS (ICreateDevEnum, "29840822-5B84-11D0-BD3B-00A0C911CE86") : public IUnknown
{
public:
JUCE_COMCALL CreateClassEnumerator (REFCLSID clsidDeviceClass, _Out_ IEnumMoniker * *ppEnumMoniker, DWORD dwFlags) = 0;
};
JUCE_COMCLASS (IPin, "56a86891-0ad4-11ce-b03a-0020af0ba770") : public IUnknown
{
public:
JUCE_COMCALL Connect (IPin * pReceivePin, _In_opt_ const AM_MEDIA_TYPE* pmt) = 0;
JUCE_COMCALL ReceiveConnection (IPin * pConnector, const AM_MEDIA_TYPE* pmt) = 0;
JUCE_COMCALL Disconnect() = 0;
JUCE_COMCALL ConnectedTo (_Out_ IPin * *pPin) = 0;
JUCE_COMCALL ConnectionMediaType (_Out_ AM_MEDIA_TYPE * pmt) = 0;
JUCE_COMCALL QueryPinInfo (_Out_ PIN_INFO * pInfo) = 0;
JUCE_COMCALL QueryDirection (_Out_ PIN_DIRECTION * pPinDir) = 0;
JUCE_COMCALL QueryId (_Out_ LPWSTR * Id) = 0;
JUCE_COMCALL QueryAccept (const AM_MEDIA_TYPE* pmt) = 0;
JUCE_COMCALL EnumMediaTypes (_Out_ IEnumMediaTypes * *ppEnum) = 0;
JUCE_COMCALL QueryInternalConnections (_Out_writes_to_opt_ (*nPin, *nPin) IPin * *apPin, ULONG * nPin) = 0;
JUCE_COMCALL EndOfStream() = 0;
JUCE_COMCALL BeginFlush() = 0;
JUCE_COMCALL EndFlush() = 0;
JUCE_COMCALL NewSegment (REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate) = 0;
};
JUCE_COMCLASS (IFilterGraph, "56a8689f-0ad4-11ce-b03a-0020af0ba770") : public IUnknown
{
public:
JUCE_COMCALL AddFilter (IBaseFilter * pFilter, LPCWSTR pName) = 0;
JUCE_COMCALL RemoveFilter (IBaseFilter * pFilter) = 0;
JUCE_COMCALL EnumFilters (_Out_ IEnumFilters * *ppEnum) = 0;
JUCE_COMCALL FindFilterByName (LPCWSTR pName, _Out_ IBaseFilter * *ppFilter) = 0;
JUCE_COMCALL ConnectDirect (IPin * ppinOut, IPin * ppinIn, _In_opt_ const AM_MEDIA_TYPE* pmt) = 0;
JUCE_COMCALL Reconnect (IPin * ppin) = 0;
JUCE_COMCALL Disconnect (IPin * ppin) = 0;
JUCE_COMCALL SetDefaultSyncSource() = 0;
};
JUCE_COMCLASS (IGraphBuilder, "56a868a9-0ad4-11ce-b03a-0020af0ba770") : public IFilterGraph
{
public:
JUCE_COMCALL Connect (IPin * ppinOut, IPin * ppinIn) = 0;
JUCE_COMCALL Render (IPin * ppinOut) = 0;
JUCE_COMCALL RenderFile (LPCWSTR lpcwstrFile, _In_opt_ LPCWSTR lpcwstrPlayList) = 0;
JUCE_COMCALL AddSourceFilter (LPCWSTR lpcwstrFileName, _In_opt_ LPCWSTR lpcwstrFilterName, _Out_ IBaseFilter * *ppFilter) = 0;
JUCE_COMCALL SetLogFile (DWORD_PTR hFile) = 0;
JUCE_COMCALL Abort() = 0;
JUCE_COMCALL ShouldOperationContinue() = 0;
};
JUCE_COMCLASS (IMediaFilter, "56a86899-0ad4-11ce-b03a-0020af0ba770") : public IPersist
{
public:
JUCE_COMCALL Stop() = 0;
JUCE_COMCALL Pause() = 0;
JUCE_COMCALL Run (REFERENCE_TIME tStart) = 0;
JUCE_COMCALL GetState (DWORD dwMilliSecsTimeout, _Out_ FILTER_STATE * State) = 0;
JUCE_COMCALL SetSyncSource (_In_opt_ IReferenceClock * pClock) = 0;
JUCE_COMCALL GetSyncSource (_Outptr_result_maybenull_ IReferenceClock * *pClock) = 0;
};
JUCE_COMCLASS (IEnumPins, "56a86892-0ad4-11ce-b03a-0020af0ba770") : public IUnknown
{
public:
JUCE_COMCALL Next (ULONG cPins, _Out_writes_to_ (cPins, *pcFetched) IPin * *ppPins, _Out_opt_ ULONG * pcFetched) = 0;
JUCE_COMCALL Skip (ULONG cPins) = 0;
JUCE_COMCALL Reset() = 0;
JUCE_COMCALL Clone (_Out_ IEnumPins * *ppEnum) = 0;
};
JUCE_COMCLASS (IBaseFilter, "56a86895-0ad4-11ce-b03a-0020af0ba770") : public IMediaFilter
{
public:
JUCE_COMCALL EnumPins (_Out_ IEnumPins * *ppEnum) = 0;
JUCE_COMCALL FindPin (LPCWSTR Id, _Out_ IPin * *ppPin) = 0;
JUCE_COMCALL QueryFilterInfo (_Out_ FILTER_INFO * pInfo) = 0;
JUCE_COMCALL JoinFilterGraph (_In_opt_ IFilterGraph * pGraph, _In_opt_ LPCWSTR pName) = 0;
JUCE_COMCALL QueryVendorInfo (_Out_ LPWSTR * pVendorInfo) = 0;
};
JUCE_COMCLASS (IVMRWindowlessControl, "0eb1088c-4dcd-46f0-878f-39dae86a51b7") : public IUnknown
{
public:
JUCE_COMCALL GetNativeVideoSize (LONG * lpWidth, LONG * lpHeight, LONG * lpARWidth, LONG * lpARHeight) = 0;
JUCE_COMCALL GetMinIdealVideoSize (LONG * lpWidth, LONG * lpHeight) = 0;
JUCE_COMCALL GetMaxIdealVideoSize (LONG * lpWidth, LONG * lpHeight) = 0;
JUCE_COMCALL SetVideoPosition (const LPRECT lpSRCRect, const LPRECT lpDSTRect) = 0;
JUCE_COMCALL GetVideoPosition (LPRECT lpSRCRect, LPRECT lpDSTRect) = 0;
JUCE_COMCALL GetAspectRatioMode (DWORD * lpAspectRatioMode) = 0;
JUCE_COMCALL SetAspectRatioMode (DWORD AspectRatioMode) = 0;
JUCE_COMCALL SetVideoClippingWindow (HWND hwnd) = 0;
JUCE_COMCALL RepaintVideo (HWND hwnd, HDC hdc) = 0;
JUCE_COMCALL DisplayModeChanged() = 0;
JUCE_COMCALL GetCurrentImage (BYTE * *lpDib) = 0;
JUCE_COMCALL SetBorderColor (COLORREF Clr) = 0;
JUCE_COMCALL GetBorderColor (COLORREF * lpClr) = 0;
JUCE_COMCALL SetColorKey (COLORREF Clr) = 0;
JUCE_COMCALL GetColorKey (COLORREF * lpClr) = 0;
};
JUCE_COMCLASS (IVMRFilterConfig, "9e5530c5-7034-48b4-bb46-0b8a6efc8e36") : public IUnknown
{
public:
JUCE_COMCALL SetImageCompositor (IVMRImageCompositor * lpVMRImgCompositor) = 0;
JUCE_COMCALL SetNumberOfStreams (DWORD dwMaxStreams) = 0;
JUCE_COMCALL GetNumberOfStreams (DWORD * pdwMaxStreams) = 0;
JUCE_COMCALL SetRenderingPrefs (DWORD dwRenderFlags) = 0;
JUCE_COMCALL GetRenderingPrefs (DWORD * pdwRenderFlags) = 0;
JUCE_COMCALL SetRenderingMode (DWORD Mode) = 0;
JUCE_COMCALL GetRenderingMode (DWORD * pMode) = 0;
};
JUCE_COMCLASS (IMFVideoDisplayControl, "a490b1e4-ab84-4d31-a1b2-181e03b1077a") : public IUnknown
{
public:
JUCE_COMCALL GetNativeVideoSize (__RPC__inout_opt SIZE * pszVideo, __RPC__inout_opt SIZE * pszARVideo) = 0;
JUCE_COMCALL GetIdealVideoSize (__RPC__inout_opt SIZE * pszMin, __RPC__inout_opt SIZE * pszMax) = 0;
JUCE_COMCALL SetVideoPosition (__RPC__in_opt const MFVideoNormalizedRect* pnrcSource, __RPC__in_opt const LPRECT prcDest) = 0;
JUCE_COMCALL GetVideoPosition (__RPC__out MFVideoNormalizedRect * pnrcSource, __RPC__out LPRECT prcDest) = 0;
JUCE_COMCALL SetAspectRatioMode (DWORD dwAspectRatioMode) = 0;
JUCE_COMCALL GetAspectRatioMode (__RPC__out DWORD * pdwAspectRatioMode) = 0;
JUCE_COMCALL SetVideoWindow (__RPC__in HWND hwndVideo) = 0;
JUCE_COMCALL GetVideoWindow (__RPC__deref_out_opt HWND * phwndVideo) = 0;
JUCE_COMCALL RepaintVideo() = 0;
JUCE_COMCALL GetCurrentImage (__RPC__inout BITMAPINFOHEADER * pBih, __RPC__deref_out_ecount_full_opt (*pcbDib) BYTE * *pDib, __RPC__out DWORD * pcbDib, __RPC__inout_opt LONGLONG * pTimeStamp) = 0;
JUCE_COMCALL SetBorderColor (COLORREF Clr) = 0;
JUCE_COMCALL GetBorderColor (__RPC__out COLORREF * pClr) = 0;
JUCE_COMCALL SetRenderingPrefs (DWORD dwRenderFlags) = 0;
JUCE_COMCALL GetRenderingPrefs (__RPC__out DWORD * pdwRenderFlags) = 0;
JUCE_COMCALL SetFullscreen (BOOL fFullscreen) = 0;
JUCE_COMCALL GetFullscreen (__RPC__out BOOL * pfFullscreen) = 0;
};
JUCE_COMCLASS (IMFGetService, "fa993888-4383-415a-a930-dd472a8cf6f7") : public IUnknown
{
public:
JUCE_COMCALL GetService (__RPC__in REFGUID guidService, __RPC__in REFIID riid, __RPC__deref_out_opt LPVOID * ppvObject) = 0;
};
JUCE_COMCLASS (IMediaControl, "56a868b1-0ad4-11ce-b03a-0020af0ba770") : public IDispatch
{
public:
JUCE_COMCALL Run() = 0;
JUCE_COMCALL Pause() = 0;
JUCE_COMCALL Stop() = 0;
JUCE_COMCALL GetState (LONG msTimeout, __RPC__out OAFilterState * pfs) = 0;
JUCE_COMCALL RenderFile (__RPC__in BSTR strFilename) = 0;
JUCE_COMCALL AddSourceFilter (__RPC__in BSTR strFilename, __RPC__deref_out_opt IDispatch * *ppUnk) = 0;
JUCE_COMCALL get_FilterCollection (__RPC__deref_out_opt IDispatch * *ppUnk) = 0;
JUCE_COMCALL get_RegFilterCollection (__RPC__deref_out_opt IDispatch * *ppUnk) = 0;
JUCE_COMCALL StopWhenReady() = 0;
};
JUCE_COMCLASS (IMediaPosition, "56a868b2-0ad4-11ce-b03a-0020af0ba770") : public IDispatch
{
public:
JUCE_COMCALL get_Duration (__RPC__out REFTIME * plength) = 0;
JUCE_COMCALL put_CurrentPosition (REFTIME llTime) = 0;
JUCE_COMCALL get_CurrentPosition (__RPC__out REFTIME * pllTime) = 0;
JUCE_COMCALL get_StopTime (__RPC__out REFTIME * pllTime) = 0;
JUCE_COMCALL put_StopTime (REFTIME llTime) = 0;
JUCE_COMCALL get_PrerollTime (__RPC__out REFTIME * pllTime) = 0;
JUCE_COMCALL put_PrerollTime (REFTIME llTime) = 0;
JUCE_COMCALL put_Rate (double dRate) = 0;
JUCE_COMCALL get_Rate (__RPC__out double* pdRate) = 0;
JUCE_COMCALL CanSeekForward (__RPC__out LONG * pCanSeekForward) = 0;
JUCE_COMCALL CanSeekBackward (__RPC__out LONG * pCanSeekBackward) = 0;
};
JUCE_COMCLASS (IMediaEvent, "56a868b6-0ad4-11ce-b03a-0020af0ba770") : public IDispatch
{
public:
JUCE_COMCALL GetEventHandle (__RPC__out OAEVENT * hEvent) = 0;
JUCE_COMCALL GetEvent (__RPC__out long* lEventCode, __RPC__out LONG_PTR* lParam1, __RPC__out LONG_PTR* lParam2, long msTimeout) = 0;
JUCE_COMCALL WaitForCompletion (long msTimeout, __RPC__out long* pEvCode) = 0;
JUCE_COMCALL CancelDefaultHandling (long lEvCode) = 0;
JUCE_COMCALL RestoreDefaultHandling (long lEvCode) = 0;
JUCE_COMCALL FreeEventParams (long lEvCode, LONG_PTR lParam1, LONG_PTR lParam2) = 0;
};
JUCE_COMCLASS (IMediaEventEx, "56a868c0-0ad4-11ce-b03a-0020af0ba770") : public IMediaEvent
{
public:
JUCE_COMCALL SetNotifyWindow (OAHWND hwnd, long lMsg, LONG_PTR lInstanceData) = 0;
JUCE_COMCALL SetNotifyFlags (long lNoNotifyFlags) = 0;
JUCE_COMCALL GetNotifyFlags (__RPC__out long* lplNoNotifyFlags) = 0;
};
JUCE_COMCLASS (IBasicAudio, "56a868b3-0ad4-11ce-b03a-0020af0ba770") : public IDispatch
{
public:
JUCE_COMCALL put_Volume (long lVolume) = 0;
JUCE_COMCALL get_Volume (__RPC__out long* plVolume) = 0;
JUCE_COMCALL put_Balance (long lBalance) = 0;
JUCE_COMCALL get_Balance (__RPC__out long* plBalance) = 0;
};
JUCE_COMCLASS (IMediaSample, "56a8689a-0ad4-11ce-b03a-0020af0ba770") : public IUnknown
{
public:
JUCE_COMCALL GetPointer (BYTE * *ppBuffer) = 0;
virtual long STDMETHODCALLTYPE GetSize() = 0;
JUCE_COMCALL GetTime (_Out_ REFERENCE_TIME * pTimeStart, _Out_ REFERENCE_TIME * pTimeEnd) = 0;
JUCE_COMCALL SetTime (_In_opt_ REFERENCE_TIME * pTimeStart, _In_opt_ REFERENCE_TIME * pTimeEnd) = 0;
JUCE_COMCALL IsSyncPoint() = 0;
JUCE_COMCALL SetSyncPoint (BOOL bIsSyncPoint) = 0;
JUCE_COMCALL IsPreroll() = 0;
JUCE_COMCALL SetPreroll (BOOL bIsPreroll) = 0;
virtual long STDMETHODCALLTYPE GetActualDataLength() = 0;
JUCE_COMCALL SetActualDataLength (long __MIDL__IMediaSample0000) = 0;
JUCE_COMCALL GetMediaType (_Out_ AM_MEDIA_TYPE * *ppMediaType) = 0;
JUCE_COMCALL SetMediaType (_In_ AM_MEDIA_TYPE * pMediaType) = 0;
JUCE_COMCALL IsDiscontinuity() = 0;
JUCE_COMCALL SetDiscontinuity (BOOL bDiscontinuity) = 0;
JUCE_COMCALL GetMediaTime (_Out_ LONGLONG * pTimeStart, _Out_ LONGLONG * pTimeEnd) = 0;
JUCE_COMCALL SetMediaTime (_In_opt_ LONGLONG * pTimeStart, _In_opt_ LONGLONG * pTimeEnd) = 0;
};
JUCE_COMCLASS (IFileSinkFilter, "a2104830-7c70-11cf-8bce-00aa00a3f1a6") : public IUnknown
{
public:
JUCE_COMCALL SetFileName (LPCOLESTR pszFileName, _In_opt_ const AM_MEDIA_TYPE* pmt) = 0;
JUCE_COMCALL GetCurFile (_Out_ LPOLESTR * ppszFileName, _Out_ AM_MEDIA_TYPE * pmt) = 0;
};
JUCE_COMCLASS (ICaptureGraphBuilder2, "93E5A4E0-2D50-11d2-ABFA-00A0C9C6E38D") : public IUnknown
{
public:
JUCE_COMCALL SetFiltergraph (IGraphBuilder * pfg) = 0;
JUCE_COMCALL GetFiltergraph (_Out_ IGraphBuilder * *ppfg) = 0;
JUCE_COMCALL SetOutputFileName (const GUID* pType, LPCOLESTR lpstrFile, _Outptr_ IBaseFilter** ppf, _Outptr_opt_ IFileSinkFilter** ppSink) = 0;
JUCE_COMCALL FindInterface (_In_opt_ const GUID* pCategory, _In_opt_ const GUID* pType, IBaseFilter* pf, REFIID riid, _Out_ void** ppint) = 0;
JUCE_COMCALL RenderStream (_In_opt_ const GUID* pCategory, const GUID* pType, IUnknown* pSource, IBaseFilter* pfCompressor, IBaseFilter* pfRenderer) = 0;
JUCE_COMCALL ControlStream (const GUID* pCategory, const GUID* pType, IBaseFilter* pFilter, _In_opt_ REFERENCE_TIME* pstart, _In_opt_ REFERENCE_TIME* pstop, WORD wStartCookie, WORD wStopCookie) = 0;
JUCE_COMCALL AllocCapFile (LPCOLESTR lpstr, DWORDLONG dwlSize) = 0;
JUCE_COMCALL CopyCaptureFile (_In_ LPOLESTR lpwstrOld, _In_ LPOLESTR lpwstrNew, int fAllowEscAbort, IAMCopyCaptureFileProgress* pCallback) = 0;
JUCE_COMCALL FindPin (IUnknown * pSource, PIN_DIRECTION pindir, _In_opt_ const GUID* pCategory, _In_opt_ const GUID* pType, BOOL fUnconnected, int num, _Out_ IPin** ppPin) = 0;
};
JUCE_COMCLASS (IAMStreamConfig, "C6E13340-30AC-11d0-A18C-00A0C9118956") : public IUnknown
{
public:
JUCE_COMCALL SetFormat (AM_MEDIA_TYPE * pmt) = 0;
JUCE_COMCALL GetFormat (_Out_ AM_MEDIA_TYPE * *ppmt) = 0;
JUCE_COMCALL GetNumberOfCapabilities (_Out_ int* piCount, _Out_ int* piSize) = 0;
JUCE_COMCALL GetStreamCaps (int iIndex, _Out_ AM_MEDIA_TYPE** ppmt, _Out_ BYTE* pSCC) = 0;
};
JUCE_COMCLASS (ISampleGrabberCB, "0579154A-2B53-4994-B0D0-E773148EFF85") : public IUnknown
{
JUCE_COMCALL SampleCB (double, ComTypes::IMediaSample*) = 0;
JUCE_COMCALL BufferCB (double, BYTE*, long) = 0;
};
JUCE_COMCLASS (ISampleGrabber, "6B652FFF-11FE-4fce-92AD-0266B5D7C78F") : public IUnknown
{
JUCE_COMCALL SetOneShot (BOOL) = 0;
JUCE_COMCALL SetMediaType (const ComTypes::AM_MEDIA_TYPE*) = 0;
JUCE_COMCALL GetConnectedMediaType (ComTypes::AM_MEDIA_TYPE*) = 0;
JUCE_COMCALL SetBufferSamples (BOOL) = 0;
JUCE_COMCALL GetCurrentBuffer (long*, long*) = 0;
JUCE_COMCALL GetCurrentSample (ComTypes::IMediaSample**) = 0;
JUCE_COMCALL SetCallback (ISampleGrabberCB*, long) = 0;
};
JUCE_COMCLASS (IAMLatency, "62EA93BA-EC62-11d2-B770-00C04FB6BD3D") : public IUnknown
{
public:
JUCE_COMCALL GetLatency (_Out_ REFERENCE_TIME * prtLatency) = 0;
};
JUCE_COMCLASS (IAMPushSource, "F185FE76-E64E-11d2-B76E-00C04FB6BD3D") : public IAMLatency
{
public:
JUCE_COMCALL GetPushSourceFlags (_Out_ ULONG * pFlags) = 0;
JUCE_COMCALL SetPushSourceFlags (ULONG Flags) = 0;
JUCE_COMCALL SetStreamOffset (REFERENCE_TIME rtOffset) = 0;
JUCE_COMCALL GetStreamOffset (_Out_ REFERENCE_TIME * prtOffset) = 0;
JUCE_COMCALL GetMaxStreamOffset (_Out_ REFERENCE_TIME * prtMaxOffset) = 0;
JUCE_COMCALL SetMaxStreamOffset (REFERENCE_TIME rtMaxOffset) = 0;
};
JUCE_COMCLASS (IConfigAsfWriter, "45086030-F7E4-486a-B504-826BB5792A3B") : public IUnknown
{
public:
JUCE_COMCALL ConfigureFilterUsingProfileId (DWORD dwProfileId) = 0;
JUCE_COMCALL GetCurrentProfileId (__RPC__out DWORD * pdwProfileId) = 0;
JUCE_COMCALL ConfigureFilterUsingProfileGuid (__RPC__in REFGUID guidProfile) = 0;
JUCE_COMCALL GetCurrentProfileGuid (__RPC__out GUID * pProfileGuid) = 0;
JUCE_COMCALL ConfigureFilterUsingProfile (__RPC__in_opt IWMProfile * pProfile) = 0;
JUCE_COMCALL GetCurrentProfile (__RPC__deref_out_opt IWMProfile * *ppProfile) = 0;
JUCE_COMCALL SetIndexMode (BOOL bIndexFile) = 0;
JUCE_COMCALL GetIndexMode (__RPC__out BOOL * pbIndexFile) = 0;
};
constexpr CLSID CLSID_CaptureGraphBuilder2 = { 0xBF87B6E1, 0x8C27, 0x11d0, { 0xB3, 0xF0, 0x00, 0xAA, 0x00, 0x37, 0x61, 0xC5 } };
constexpr CLSID CLSID_EnhancedVideoRenderer = { 0xfa10746c, 0x9b63, 0x4b6c, { 0xbc, 0x49, 0xfc, 0x30, 0x0e, 0xa5, 0xf2, 0x56 } };
constexpr CLSID CLSID_FilterGraph = { 0xe436ebb3, 0x524f, 0x11ce, { 0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70 } };
constexpr CLSID CLSID_NullRenderer = { 0xC1F400A4, 0x3F08, 0x11d3, { 0x9F, 0x0B, 0x00, 0x60, 0x08, 0x03, 0x9E, 0x37 } };
constexpr CLSID CLSID_SampleGrabber = { 0xC1F400A0, 0x3F08, 0x11d3, { 0x9F, 0x0B, 0x00, 0x60, 0x08, 0x03, 0x9E, 0x37 } };
constexpr CLSID CLSID_SmartTee = { 0xcc58e280, 0x8aa1, 0x11d1, { 0xb3, 0xf1, 0x00, 0xaa, 0x00, 0x37, 0x61, 0xc5 } };
constexpr CLSID CLSID_SystemDeviceEnum = { 0x62BE5D10, 0x60EB, 0x11d0, { 0xBD, 0x3B, 0x00, 0xA0, 0xC9, 0x11, 0xCE, 0x86 } };
constexpr CLSID CLSID_VideoInputDeviceCategory = { 0x860BB310, 0x5D01, 0x11d0, { 0xBD, 0x3B, 0x00, 0xA0, 0xC9, 0x11, 0xCE, 0x86 } };
constexpr CLSID CLSID_VideoMixingRenderer = { 0xb87beb7b, 0x8d29, 0x423F, { 0xae, 0x4d, 0x65, 0x82, 0xc1, 0x01, 0x75, 0xac } };
constexpr CLSID CLSID_WMAsfWriter = { 0x7c23220e, 0x55bb, 0x11d3, { 0x8b, 0x16, 0x00, 0xc0, 0x4f, 0xb6, 0xbd, 0x3d } };
constexpr CLSID FORMAT_VideoInfo = { 0x05589f80, 0xc356, 0x11ce, { 0xbf, 0x01, 0x00, 0xaa, 0x00, 0x55, 0x59, 0x5a } };
constexpr CLSID MEDIASUBTYPE_RGB24 = { 0xe436eb7d, 0x524f, 0x11ce, { 0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70 } };
constexpr CLSID MEDIATYPE_Video = { 0x73646976, 0x0000, 0x0010, { 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 } };
constexpr CLSID MR_VIDEO_RENDER_SERVICE = { 0x1092a86c, 0xab1a, 0x459a, { 0xa3, 0x36, 0x83, 0x1f, 0xbc, 0x4d, 0x11, 0xff } };
constexpr CLSID PIN_CATEGORY_CAPTURE = { 0xfb6c4281, 0x0353, 0x11d1, { 0x90, 0x5f, 0x00, 0x00, 0xc0, 0xcc, 0x16, 0xba } };
} // namespace ComTypes
} // namespace juce
#ifdef __CRT_UUID_DECL
__CRT_UUID_DECL (juce::ComTypes::IAMPushSource, 0xF185FE76, 0xE64E, 0x11d2, 0xB7, 0x6E, 0x00, 0xC0, 0x4F, 0xB6, 0xBD, 0x3D)
__CRT_UUID_DECL (juce::ComTypes::IAMStreamConfig, 0xC6E13340, 0x30AC, 0x11d0, 0xA1, 0x8C, 0x00, 0xA0, 0xC9, 0x11, 0x89, 0x56)
__CRT_UUID_DECL (juce::ComTypes::IBaseFilter, 0x56a86895, 0x0ad4, 0x11ce, 0xb0, 0x3a, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70)
__CRT_UUID_DECL (juce::ComTypes::IBasicAudio, 0x56a868b3, 0x0ad4, 0x11ce, 0xb0, 0x3a, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70)
__CRT_UUID_DECL (juce::ComTypes::ICaptureGraphBuilder2, 0x93E5A4E0, 0x2D50, 0x11d2, 0xAB, 0xFA, 0x00, 0xA0, 0xC9, 0xC6, 0xE3, 0x8D)
__CRT_UUID_DECL (juce::ComTypes::IConfigAsfWriter, 0x45086030, 0xF7E4, 0x486a, 0xB5, 0x04, 0x82, 0x6B, 0xB5, 0x79, 0x2A, 0x3B)
__CRT_UUID_DECL (juce::ComTypes::ICreateDevEnum, 0x29840822, 0x5B84, 0x11D0, 0xBD, 0x3B, 0x00, 0xA0, 0xC9, 0x11, 0xCE, 0x86)
__CRT_UUID_DECL (juce::ComTypes::IFileSinkFilter, 0xa2104830, 0x7c70, 0x11cf, 0x8b, 0xce, 0x00, 0xaa, 0x00, 0xa3, 0xf1, 0xa6)
__CRT_UUID_DECL (juce::ComTypes::IGraphBuilder, 0x56a868a9, 0x0ad4, 0x11ce, 0xb0, 0x3a, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70)
__CRT_UUID_DECL (juce::ComTypes::IMFGetService, 0xfa993888, 0x4383, 0x415a, 0xa9, 0x30, 0xdd, 0x47, 0x2a, 0x8c, 0xf6, 0xf7)
__CRT_UUID_DECL (juce::ComTypes::IMFVideoDisplayControl, 0xa490b1e4, 0xab84, 0x4d31, 0xa1, 0xb2, 0x18, 0x1e, 0x03, 0xb1, 0x07, 0x7a)
__CRT_UUID_DECL (juce::ComTypes::IMediaControl, 0x56a868b1, 0x0ad4, 0x11ce, 0xb0, 0x3a, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70)
__CRT_UUID_DECL (juce::ComTypes::IMediaEventEx, 0x56a868c0, 0x0ad4, 0x11ce, 0xb0, 0x3a, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70)
__CRT_UUID_DECL (juce::ComTypes::IMediaPosition, 0x56a868b2, 0x0ad4, 0x11ce, 0xb0, 0x3a, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70)
__CRT_UUID_DECL (juce::ComTypes::ISampleGrabber, 0x6B652FFF, 0x11FE, 0x4fce, 0x92, 0xAD, 0x02, 0x66, 0xB5, 0xD7, 0xC7, 0x8F)
__CRT_UUID_DECL (juce::ComTypes::ISampleGrabberCB, 0x0579154A, 0x2B53, 0x4994, 0xB0, 0xD0, 0xE7, 0x73, 0x14, 0x8E, 0xFF, 0x85)
__CRT_UUID_DECL (juce::ComTypes::IVMRFilterConfig, 0x9e5530c5, 0x7034, 0x48b4, 0xbb, 0x46, 0x0b, 0x8a, 0x6e, 0xfc, 0x8e, 0x36)
__CRT_UUID_DECL (juce::ComTypes::IVMRWindowlessControl, 0x0eb1088c, 0x4dcd, 0x46f0, 0x87, 0x8f, 0x39, 0xda, 0xe8, 0x6a, 0x51, 0xb7)
#endif

View file

@ -28,9 +28,9 @@ namespace VideoRenderers
//==============================================================================
struct Base
{
virtual ~Base() {}
virtual ~Base() = default;
virtual HRESULT create (ComSmartPtr<IGraphBuilder>&, ComSmartPtr<IBaseFilter>&, HWND) = 0;
virtual HRESULT create (ComSmartPtr<ComTypes::IGraphBuilder>&, ComSmartPtr<ComTypes::IBaseFilter>&, HWND) = 0;
virtual void setVideoWindow (HWND) = 0;
virtual void setVideoPosition (HWND) = 0;
virtual void repaintVideo (HWND, HDC) = 0;
@ -43,19 +43,19 @@ namespace VideoRenderers
{
VMR7() {}
HRESULT create (ComSmartPtr<IGraphBuilder>& graphBuilder,
ComSmartPtr<IBaseFilter>& baseFilter, HWND hwnd) override
HRESULT create (ComSmartPtr<ComTypes::IGraphBuilder>& graphBuilder,
ComSmartPtr<ComTypes::IBaseFilter>& baseFilter, HWND hwnd) override
{
ComSmartPtr<IVMRFilterConfig> filterConfig;
ComSmartPtr<ComTypes::IVMRFilterConfig> filterConfig;
HRESULT hr = baseFilter.CoCreateInstance (CLSID_VideoMixingRenderer);
HRESULT hr = baseFilter.CoCreateInstance (ComTypes::CLSID_VideoMixingRenderer);
if (SUCCEEDED (hr)) hr = graphBuilder->AddFilter (baseFilter, L"VMR-7");
if (SUCCEEDED (hr)) hr = baseFilter.QueryInterface (filterConfig);
if (SUCCEEDED (hr)) hr = filterConfig->SetRenderingMode (VMRMode_Windowless);
if (SUCCEEDED (hr)) hr = filterConfig->SetRenderingMode (ComTypes::VMRMode_Windowless);
if (SUCCEEDED (hr)) hr = baseFilter.QueryInterface (windowlessControl);
if (SUCCEEDED (hr)) hr = windowlessControl->SetVideoClippingWindow (hwnd);
if (SUCCEEDED (hr)) hr = windowlessControl->SetAspectRatioMode (VMR_ARMODE_LETTER_BOX);
if (SUCCEEDED (hr)) hr = windowlessControl->SetAspectRatioMode (ComTypes::VMR_ARMODE_LETTER_BOX);
return hr;
}
@ -92,7 +92,7 @@ namespace VideoRenderers
return windowlessControl->GetNativeVideoSize (&videoWidth, &videoHeight, nullptr, nullptr);
}
ComSmartPtr<IVMRWindowlessControl> windowlessControl;
ComSmartPtr<ComTypes::IVMRWindowlessControl> windowlessControl;
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (VMR7)
};
@ -101,21 +101,23 @@ namespace VideoRenderers
//==============================================================================
struct EVR : public Base
{
EVR() {}
EVR() = default;
HRESULT create (ComSmartPtr<IGraphBuilder>& graphBuilder,
ComSmartPtr<IBaseFilter>& baseFilter, HWND hwnd) override
HRESULT create (ComSmartPtr<ComTypes::IGraphBuilder>& graphBuilder,
ComSmartPtr<ComTypes::IBaseFilter>& baseFilter, HWND hwnd) override
{
ComSmartPtr<IMFGetService> getService;
ComSmartPtr<ComTypes::IMFGetService> getService;
HRESULT hr = baseFilter.CoCreateInstance (CLSID_EnhancedVideoRenderer);
HRESULT hr = baseFilter.CoCreateInstance (ComTypes::CLSID_EnhancedVideoRenderer);
if (SUCCEEDED (hr)) hr = graphBuilder->AddFilter (baseFilter, L"EVR");
if (SUCCEEDED (hr)) hr = baseFilter.QueryInterface (getService);
if (SUCCEEDED (hr)) hr = getService->GetService (MR_VIDEO_RENDER_SERVICE, IID_IMFVideoDisplayControl,
JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wlanguage-extension-token")
if (SUCCEEDED (hr)) hr = getService->GetService (ComTypes::MR_VIDEO_RENDER_SERVICE, __uuidof (ComTypes::IMFVideoDisplayControl),
(void**) videoDisplayControl.resetAndGetPointerAddress());
JUCE_END_IGNORE_WARNINGS_GCC_LIKE
if (SUCCEEDED (hr)) hr = videoDisplayControl->SetVideoWindow (hwnd);
if (SUCCEEDED (hr)) hr = videoDisplayControl->SetAspectRatioMode (MFVideoARMode_PreservePicture);
if (SUCCEEDED (hr)) hr = videoDisplayControl->SetAspectRatioMode (ComTypes::MFVideoARMode_PreservePicture);
return hr;
}
@ -127,7 +129,7 @@ namespace VideoRenderers
void setVideoPosition (HWND hwnd) override
{
const MFVideoNormalizedRect src = { 0.0f, 0.0f, 1.0f, 1.0f };
const ComTypes::MFVideoNormalizedRect src { 0.0f, 0.0f, 1.0f, 1.0f };
RECT dest;
GetClientRect (hwnd, &dest);
@ -151,7 +153,7 @@ namespace VideoRenderers
return hr;
}
ComSmartPtr<IMFVideoDisplayControl> videoDisplayControl;
ComSmartPtr<ComTypes::IMFVideoDisplayControl> videoDisplayControl;
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (EVR)
};
@ -358,6 +360,7 @@ private:
{
}
using ComponentMovementWatcher::componentMovedOrResized;
void componentMovedOrResized (bool, bool) override
{
if (owner.videoLoaded)
@ -373,6 +376,7 @@ private:
owner.recreateNativeWindowAsync();
}
using ComponentMovementWatcher::componentVisibilityChanged;
void componentVisibilityChanged() override
{
if (owner.videoLoaded)
@ -442,8 +446,8 @@ private:
createNativeWindow();
mediaEvent->CancelDefaultHandling (EC_STATE_CHANGE);
mediaEvent->SetNotifyWindow ((OAHWND) hwnd, graphEventID, 0);
mediaEvent->CancelDefaultHandling (ComTypes::EC_STATE_CHANGE);
mediaEvent->SetNotifyWindow ((ComTypes::OAHWND) hwnd, graphEventID, 0);
if (videoRenderer != nullptr)
videoRenderer->setVideoWindow (hwnd);
@ -493,7 +497,7 @@ private:
if (! createNativeWindow())
return Result::fail ("Can't create window");
HRESULT hr = graphBuilder.CoCreateInstance (CLSID_FilterGraph);
HRESULT hr = graphBuilder.CoCreateInstance (ComTypes::CLSID_FilterGraph);
// basic playback interfaces
if (SUCCEEDED (hr)) hr = graphBuilder.QueryInterface (mediaControl);
@ -555,8 +559,8 @@ private:
// set window to receive events
if (SUCCEEDED (hr))
{
mediaEvent->CancelDefaultHandling (EC_STATE_CHANGE);
hr = mediaEvent->SetNotifyWindow ((OAHWND) hwnd, graphEventID, 0);
mediaEvent->CancelDefaultHandling (ComTypes::EC_STATE_CHANGE);
hr = mediaEvent->SetNotifyWindow ((ComTypes::OAHWND) hwnd, graphEventID, 0);
}
if (SUCCEEDED (hr))
@ -577,18 +581,18 @@ private:
{
switch (hr)
{
case VFW_E_INVALID_FILE_FORMAT: return Result::fail ("Invalid file format");
case VFW_E_NOT_FOUND: return Result::fail ("File not found");
case VFW_E_UNKNOWN_FILE_TYPE: return Result::fail ("Unknown file type");
case VFW_E_UNSUPPORTED_STREAM: return Result::fail ("Unsupported stream");
case VFW_E_CANNOT_CONNECT: return Result::fail ("Cannot connect");
case VFW_E_CANNOT_LOAD_SOURCE_FILTER: return Result::fail ("Cannot load source filter");
case ComTypes::VFW_E_INVALID_FILE_FORMAT: return Result::fail ("Invalid file format");
case ComTypes::VFW_E_NOT_FOUND: return Result::fail ("File not found");
case ComTypes::VFW_E_UNKNOWN_FILE_TYPE: return Result::fail ("Unknown file type");
case ComTypes::VFW_E_UNSUPPORTED_STREAM: return Result::fail ("Unsupported stream");
case ComTypes::VFW_E_CANNOT_CONNECT: return Result::fail ("Cannot connect");
case ComTypes::VFW_E_CANNOT_LOAD_SOURCE_FILTER: return Result::fail ("Cannot load source filter");
}
TCHAR messageBuffer[512] = { 0 };
FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
nullptr, hr, MAKELANGID (LANG_NEUTRAL, SUBLANG_DEFAULT),
nullptr, (DWORD) hr, MAKELANGID (LANG_NEUTRAL, SUBLANG_DEFAULT),
messageBuffer, (DWORD) numElementsInArray (messageBuffer) - 1, nullptr);
return Result::fail (String (messageBuffer));
@ -633,28 +637,28 @@ private:
switch (ec)
{
case EC_REPAINT:
case ComTypes::EC_REPAINT:
component.repaint();
break;
case EC_COMPLETE:
case ComTypes::EC_COMPLETE:
component.stop();
component.setPosition (0.0);
break;
case EC_ERRORABORT:
case EC_ERRORABORTEX:
case ComTypes::EC_ERRORABORT:
case ComTypes::EC_ERRORABORTEX:
component.errorOccurred (getErrorMessageFromResult ((HRESULT) p1).getErrorMessage());
// intentional fallthrough
case EC_USERABORT:
case ComTypes::EC_USERABORT:
component.close();
break;
case EC_STATE_CHANGE:
case ComTypes::EC_STATE_CHANGE:
switch (p1)
{
case State_Paused: component.playbackStopped(); break;
case State_Running: component.playbackStarted(); break;
case ComTypes::State_Paused: component.playbackStopped(); break;
case ComTypes::State_Running: component.playbackStarted(); break;
default: break;
}
@ -697,7 +701,7 @@ private:
//==============================================================================
double getDuration() const
{
REFTIME duration;
ComTypes::REFTIME duration;
mediaPosition->get_Duration (&duration);
return duration;
}
@ -711,7 +715,7 @@ private:
double getPosition() const
{
REFTIME seconds;
ComTypes::REFTIME seconds;
mediaPosition->get_CurrentPosition (&seconds);
return seconds;
}
@ -747,12 +751,12 @@ private:
HWND hwnd = {};
HDC hdc = {};
ComSmartPtr<IGraphBuilder> graphBuilder;
ComSmartPtr<IMediaControl> mediaControl;
ComSmartPtr<IMediaPosition> mediaPosition;
ComSmartPtr<IMediaEventEx> mediaEvent;
ComSmartPtr<IBasicAudio> basicAudio;
ComSmartPtr<IBaseFilter> baseFilter;
ComSmartPtr<ComTypes::IGraphBuilder> graphBuilder;
ComSmartPtr<ComTypes::IMediaControl> mediaControl;
ComSmartPtr<ComTypes::IMediaPosition> mediaPosition;
ComSmartPtr<ComTypes::IMediaEventEx> mediaEvent;
ComSmartPtr<ComTypes::IBasicAudio> basicAudio;
ComSmartPtr<ComTypes::IBaseFilter> baseFilter;
std::unique_ptr<VideoRenderers::Base> videoRenderer;
@ -800,31 +804,31 @@ private:
bool isRendererConnected()
{
ComSmartPtr<IEnumPins> enumPins;
ComSmartPtr<ComTypes::IEnumPins> enumPins;
HRESULT hr = baseFilter->EnumPins (enumPins.resetAndGetPointerAddress());
if (SUCCEEDED (hr))
hr = enumPins->Reset();
ComSmartPtr<IPin> pin;
ComSmartPtr<ComTypes::IPin> pin;
while (SUCCEEDED (hr)
&& enumPins->Next (1, pin.resetAndGetPointerAddress(), nullptr) == S_OK)
{
ComSmartPtr<IPin> otherPin;
ComSmartPtr<ComTypes::IPin> otherPin;
hr = pin->ConnectedTo (otherPin.resetAndGetPointerAddress());
if (SUCCEEDED (hr))
{
PIN_DIRECTION direction;
ComTypes::PIN_DIRECTION direction;
hr = pin->QueryDirection (&direction);
if (SUCCEEDED (hr) && direction == PINDIR_INPUT)
if (SUCCEEDED (hr) && direction == ComTypes::PINDIR_INPUT)
return true;
}
else if (hr == VFW_E_NOT_CONNECTED)
else if (hr == ComTypes::VFW_E_NOT_CONNECTED)
{
hr = S_OK;
}