migrating to the latest JUCE version
This commit is contained in:
@ -1,243 +1,239 @@
|
||||
/*
|
||||
==============================================================================
|
||||
|
||||
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
|
||||
{
|
||||
|
||||
#if JUCE_MAC
|
||||
#include "../native/juce_mac_CameraDevice.h"
|
||||
#elif JUCE_WINDOWS
|
||||
#include "../native/juce_win32_CameraDevice.h"
|
||||
#elif JUCE_IOS
|
||||
JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wunguarded-availability-new")
|
||||
|
||||
#include "../native/juce_ios_CameraDevice.h"
|
||||
|
||||
JUCE_END_IGNORE_WARNINGS_GCC_LIKE
|
||||
#elif JUCE_ANDROID
|
||||
#include "../native/juce_android_CameraDevice.h"
|
||||
#endif
|
||||
|
||||
#if JUCE_ANDROID || JUCE_IOS
|
||||
//==============================================================================
|
||||
class CameraDevice::CameraFactory
|
||||
{
|
||||
public:
|
||||
static CameraFactory& getInstance()
|
||||
{
|
||||
static CameraFactory factory;
|
||||
return factory;
|
||||
}
|
||||
|
||||
void openCamera (int index, OpenCameraResultCallback resultCallback,
|
||||
int minWidth, int minHeight, int maxWidth, int maxHeight, bool useHighQuality)
|
||||
{
|
||||
auto cameraId = getAvailableDevices()[index];
|
||||
|
||||
if (getCameraIndex (cameraId) != -1)
|
||||
{
|
||||
// You are trying to open the same camera twice.
|
||||
jassertfalse;
|
||||
return;
|
||||
}
|
||||
|
||||
std::unique_ptr<CameraDevice> device (new CameraDevice (cameraId, index,
|
||||
minWidth, minHeight, maxWidth,
|
||||
maxHeight, useHighQuality));
|
||||
|
||||
camerasToOpen.add ({ nextRequestId++,
|
||||
std::unique_ptr<CameraDevice> (device.release()),
|
||||
resultCallback });
|
||||
|
||||
auto& pendingOpen = camerasToOpen.getReference (camerasToOpen.size() - 1);
|
||||
|
||||
pendingOpen.device->pimpl->open ([this] (const String& deviceId, const String& error)
|
||||
{
|
||||
int cIndex = getCameraIndex (deviceId);
|
||||
|
||||
if (cIndex == -1)
|
||||
return;
|
||||
|
||||
auto& cameraPendingOpen = camerasToOpen.getReference (cIndex);
|
||||
|
||||
if (error.isEmpty())
|
||||
cameraPendingOpen.resultCallback (cameraPendingOpen.device.release(), error);
|
||||
else
|
||||
cameraPendingOpen.resultCallback (nullptr, error);
|
||||
|
||||
int id = cameraPendingOpen.requestId;
|
||||
|
||||
MessageManager::callAsync ([this, id]() { removeRequestWithId (id); });
|
||||
});
|
||||
}
|
||||
|
||||
private:
|
||||
int getCameraIndex (const String& cameraId) const
|
||||
{
|
||||
for (int i = 0; i < camerasToOpen.size(); ++i)
|
||||
{
|
||||
auto& pendingOpen = camerasToOpen.getReference (i);
|
||||
|
||||
if (pendingOpen.device->pimpl->getCameraId() == cameraId)
|
||||
return i;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
void removeRequestWithId (int id)
|
||||
{
|
||||
for (int i = camerasToOpen.size(); --i >= 0;)
|
||||
{
|
||||
if (camerasToOpen.getReference (i).requestId == id)
|
||||
{
|
||||
camerasToOpen.remove (i);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct PendingCameraOpen
|
||||
{
|
||||
int requestId;
|
||||
std::unique_ptr<CameraDevice> device;
|
||||
OpenCameraResultCallback resultCallback;
|
||||
};
|
||||
|
||||
Array<PendingCameraOpen> camerasToOpen;
|
||||
static int nextRequestId;
|
||||
};
|
||||
|
||||
int CameraDevice::CameraFactory::nextRequestId = 0;
|
||||
|
||||
#endif
|
||||
|
||||
//==============================================================================
|
||||
CameraDevice::CameraDevice (const String& nm, int index, int minWidth, int minHeight, int maxWidth, int maxHeight, bool useHighQuality)
|
||||
: name (nm), pimpl (new Pimpl (*this, name, index, minWidth, minHeight, maxWidth, maxHeight, useHighQuality))
|
||||
{
|
||||
}
|
||||
|
||||
CameraDevice::~CameraDevice()
|
||||
{
|
||||
jassert (juce::MessageManager::getInstance()->currentThreadHasLockedMessageManager());
|
||||
|
||||
stopRecording();
|
||||
pimpl.reset();
|
||||
}
|
||||
|
||||
Component* CameraDevice::createViewerComponent()
|
||||
{
|
||||
return new ViewerComponent (*this);
|
||||
}
|
||||
|
||||
void CameraDevice::takeStillPicture (std::function<void (const Image&)> pictureTakenCallback)
|
||||
{
|
||||
pimpl->takeStillPicture (pictureTakenCallback);
|
||||
}
|
||||
|
||||
void CameraDevice::startRecordingToFile (const File& file, int quality)
|
||||
{
|
||||
stopRecording();
|
||||
pimpl->startRecordingToFile (file, quality);
|
||||
}
|
||||
|
||||
Time CameraDevice::getTimeOfFirstRecordedFrame() const
|
||||
{
|
||||
return pimpl->getTimeOfFirstRecordedFrame();
|
||||
}
|
||||
|
||||
void CameraDevice::stopRecording()
|
||||
{
|
||||
pimpl->stopRecording();
|
||||
}
|
||||
|
||||
void CameraDevice::addListener (Listener* listenerToAdd)
|
||||
{
|
||||
if (listenerToAdd != nullptr)
|
||||
pimpl->addListener (listenerToAdd);
|
||||
}
|
||||
|
||||
void CameraDevice::removeListener (Listener* listenerToRemove)
|
||||
{
|
||||
if (listenerToRemove != nullptr)
|
||||
pimpl->removeListener (listenerToRemove);
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
StringArray CameraDevice::getAvailableDevices()
|
||||
{
|
||||
JUCE_AUTORELEASEPOOL
|
||||
{
|
||||
return Pimpl::getAvailableDevices();
|
||||
}
|
||||
}
|
||||
|
||||
CameraDevice* CameraDevice::openDevice (int index,
|
||||
int minWidth, int minHeight,
|
||||
int maxWidth, int maxHeight,
|
||||
bool useHighQuality)
|
||||
{
|
||||
jassert (juce::MessageManager::getInstance()->currentThreadHasLockedMessageManager());
|
||||
|
||||
#if ! JUCE_ANDROID && ! JUCE_IOS
|
||||
std::unique_ptr<CameraDevice> d (new CameraDevice (getAvailableDevices() [index], index,
|
||||
minWidth, minHeight, maxWidth, maxHeight, useHighQuality));
|
||||
if (d != nullptr && d->pimpl->openedOk())
|
||||
return d.release();
|
||||
#else
|
||||
ignoreUnused (index, minWidth, minHeight);
|
||||
ignoreUnused (maxWidth, maxHeight, useHighQuality);
|
||||
|
||||
// Use openDeviceAsync to open a camera device on iOS or Android.
|
||||
jassertfalse;
|
||||
#endif
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void CameraDevice::openDeviceAsync (int index, OpenCameraResultCallback resultCallback,
|
||||
int minWidth, int minHeight, int maxWidth, int maxHeight, bool useHighQuality)
|
||||
{
|
||||
jassert (juce::MessageManager::getInstance()->currentThreadHasLockedMessageManager());
|
||||
|
||||
if (resultCallback == nullptr)
|
||||
{
|
||||
// A valid callback must be passed.
|
||||
jassertfalse;
|
||||
return;
|
||||
}
|
||||
|
||||
#if JUCE_ANDROID || JUCE_IOS
|
||||
CameraFactory::getInstance().openCamera (index, std::move (resultCallback),
|
||||
minWidth, minHeight, maxWidth, maxHeight, useHighQuality);
|
||||
#else
|
||||
auto* device = openDevice (index, minWidth, minHeight, maxWidth, maxHeight, useHighQuality);
|
||||
|
||||
resultCallback (device, device != nullptr ? String() : "Could not open camera device");
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace juce
|
||||
/*
|
||||
==============================================================================
|
||||
|
||||
This file is part of the JUCE library.
|
||||
Copyright (c) 2022 - 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 7 End-User License
|
||||
Agreement and JUCE Privacy Policy.
|
||||
|
||||
End User License Agreement: www.juce.com/juce-7-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
|
||||
{
|
||||
|
||||
#if JUCE_MAC
|
||||
#include "../native/juce_mac_CameraDevice.h"
|
||||
#elif JUCE_WINDOWS
|
||||
#include "../native/juce_win32_CameraDevice.h"
|
||||
#elif JUCE_IOS
|
||||
#include "../native/juce_ios_CameraDevice.h"
|
||||
#elif JUCE_ANDROID
|
||||
#include "../native/juce_android_CameraDevice.h"
|
||||
#endif
|
||||
|
||||
#if JUCE_ANDROID || JUCE_IOS
|
||||
//==============================================================================
|
||||
class CameraDevice::CameraFactory
|
||||
{
|
||||
public:
|
||||
static CameraFactory& getInstance()
|
||||
{
|
||||
static CameraFactory factory;
|
||||
return factory;
|
||||
}
|
||||
|
||||
void openCamera (int index, OpenCameraResultCallback resultCallback,
|
||||
int minWidth, int minHeight, int maxWidth, int maxHeight, bool useHighQuality)
|
||||
{
|
||||
auto cameraId = getAvailableDevices()[index];
|
||||
|
||||
if (getCameraIndex (cameraId) != -1)
|
||||
{
|
||||
// You are trying to open the same camera twice.
|
||||
jassertfalse;
|
||||
return;
|
||||
}
|
||||
|
||||
std::unique_ptr<CameraDevice> device (new CameraDevice (cameraId, index,
|
||||
minWidth, minHeight, maxWidth,
|
||||
maxHeight, useHighQuality));
|
||||
|
||||
camerasToOpen.add ({ nextRequestId++,
|
||||
std::unique_ptr<CameraDevice> (device.release()),
|
||||
resultCallback });
|
||||
|
||||
auto& pendingOpen = camerasToOpen.getReference (camerasToOpen.size() - 1);
|
||||
|
||||
pendingOpen.device->pimpl->open ([this] (const String& deviceId, const String& error)
|
||||
{
|
||||
int cIndex = getCameraIndex (deviceId);
|
||||
|
||||
if (cIndex == -1)
|
||||
return;
|
||||
|
||||
auto& cameraPendingOpen = camerasToOpen.getReference (cIndex);
|
||||
|
||||
if (error.isEmpty())
|
||||
cameraPendingOpen.resultCallback (cameraPendingOpen.device.release(), error);
|
||||
else
|
||||
cameraPendingOpen.resultCallback (nullptr, error);
|
||||
|
||||
int id = cameraPendingOpen.requestId;
|
||||
|
||||
MessageManager::callAsync ([this, id]() { removeRequestWithId (id); });
|
||||
});
|
||||
}
|
||||
|
||||
private:
|
||||
int getCameraIndex (const String& cameraId) const
|
||||
{
|
||||
for (int i = 0; i < camerasToOpen.size(); ++i)
|
||||
{
|
||||
auto& pendingOpen = camerasToOpen.getReference (i);
|
||||
|
||||
if (pendingOpen.device->pimpl->getCameraId() == cameraId)
|
||||
return i;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
void removeRequestWithId (int id)
|
||||
{
|
||||
for (int i = camerasToOpen.size(); --i >= 0;)
|
||||
{
|
||||
if (camerasToOpen.getReference (i).requestId == id)
|
||||
{
|
||||
camerasToOpen.remove (i);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct PendingCameraOpen
|
||||
{
|
||||
int requestId;
|
||||
std::unique_ptr<CameraDevice> device;
|
||||
OpenCameraResultCallback resultCallback;
|
||||
};
|
||||
|
||||
Array<PendingCameraOpen> camerasToOpen;
|
||||
static int nextRequestId;
|
||||
};
|
||||
|
||||
int CameraDevice::CameraFactory::nextRequestId = 0;
|
||||
|
||||
#endif
|
||||
|
||||
//==============================================================================
|
||||
CameraDevice::CameraDevice (const String& nm, int index, int minWidth, int minHeight, int maxWidth, int maxHeight, bool useHighQuality)
|
||||
: name (nm), pimpl (new Pimpl (*this, name, index, minWidth, minHeight, maxWidth, maxHeight, useHighQuality))
|
||||
{
|
||||
}
|
||||
|
||||
CameraDevice::~CameraDevice()
|
||||
{
|
||||
jassert (juce::MessageManager::getInstance()->currentThreadHasLockedMessageManager());
|
||||
|
||||
stopRecording();
|
||||
pimpl.reset();
|
||||
}
|
||||
|
||||
Component* CameraDevice::createViewerComponent()
|
||||
{
|
||||
return new ViewerComponent (*this);
|
||||
}
|
||||
|
||||
void CameraDevice::takeStillPicture (std::function<void (const Image&)> pictureTakenCallback)
|
||||
{
|
||||
pimpl->takeStillPicture (pictureTakenCallback);
|
||||
}
|
||||
|
||||
void CameraDevice::startRecordingToFile (const File& file, int quality)
|
||||
{
|
||||
stopRecording();
|
||||
pimpl->startRecordingToFile (file, quality);
|
||||
}
|
||||
|
||||
Time CameraDevice::getTimeOfFirstRecordedFrame() const
|
||||
{
|
||||
return pimpl->getTimeOfFirstRecordedFrame();
|
||||
}
|
||||
|
||||
void CameraDevice::stopRecording()
|
||||
{
|
||||
pimpl->stopRecording();
|
||||
}
|
||||
|
||||
void CameraDevice::addListener (Listener* listenerToAdd)
|
||||
{
|
||||
if (listenerToAdd != nullptr)
|
||||
pimpl->addListener (listenerToAdd);
|
||||
}
|
||||
|
||||
void CameraDevice::removeListener (Listener* listenerToRemove)
|
||||
{
|
||||
if (listenerToRemove != nullptr)
|
||||
pimpl->removeListener (listenerToRemove);
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
StringArray CameraDevice::getAvailableDevices()
|
||||
{
|
||||
JUCE_AUTORELEASEPOOL
|
||||
{
|
||||
return Pimpl::getAvailableDevices();
|
||||
}
|
||||
}
|
||||
|
||||
CameraDevice* CameraDevice::openDevice (int index,
|
||||
int minWidth, int minHeight,
|
||||
int maxWidth, int maxHeight,
|
||||
bool useHighQuality)
|
||||
{
|
||||
jassert (juce::MessageManager::getInstance()->currentThreadHasLockedMessageManager());
|
||||
|
||||
#if ! JUCE_ANDROID && ! JUCE_IOS
|
||||
std::unique_ptr<CameraDevice> d (new CameraDevice (getAvailableDevices() [index], index,
|
||||
minWidth, minHeight, maxWidth, maxHeight, useHighQuality));
|
||||
if (d != nullptr && d->pimpl->openedOk())
|
||||
return d.release();
|
||||
#else
|
||||
ignoreUnused (index, minWidth, minHeight);
|
||||
ignoreUnused (maxWidth, maxHeight, useHighQuality);
|
||||
|
||||
// Use openDeviceAsync to open a camera device on iOS or Android.
|
||||
jassertfalse;
|
||||
#endif
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void CameraDevice::openDeviceAsync (int index, OpenCameraResultCallback resultCallback,
|
||||
int minWidth, int minHeight, int maxWidth, int maxHeight, bool useHighQuality)
|
||||
{
|
||||
jassert (juce::MessageManager::getInstance()->currentThreadHasLockedMessageManager());
|
||||
|
||||
if (resultCallback == nullptr)
|
||||
{
|
||||
// A valid callback must be passed.
|
||||
jassertfalse;
|
||||
return;
|
||||
}
|
||||
|
||||
#if JUCE_ANDROID || JUCE_IOS
|
||||
CameraFactory::getInstance().openCamera (index, std::move (resultCallback),
|
||||
minWidth, minHeight, maxWidth, maxHeight, useHighQuality);
|
||||
#else
|
||||
auto* device = openDevice (index, minWidth, minHeight, maxWidth, maxHeight, useHighQuality);
|
||||
|
||||
resultCallback (device, device != nullptr ? String() : "Could not open camera device");
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace juce
|
||||
|
@ -1,260 +1,260 @@
|
||||
/*
|
||||
==============================================================================
|
||||
|
||||
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
|
||||
{
|
||||
|
||||
#if JUCE_USE_CAMERA || DOXYGEN
|
||||
|
||||
//==============================================================================
|
||||
/**
|
||||
Controls any video capture devices that might be available.
|
||||
|
||||
Use getAvailableDevices() to list the devices that are attached to the
|
||||
system, then call openDevice() or openDeviceAsync() to open one for use.
|
||||
Once you have a CameraDevice object, you can get a viewer component from it,
|
||||
and use its methods to stream to a file or capture still-frames.
|
||||
|
||||
@tags{Video}
|
||||
*/
|
||||
class JUCE_API CameraDevice
|
||||
{
|
||||
public:
|
||||
/** Destructor. */
|
||||
virtual ~CameraDevice();
|
||||
|
||||
//==============================================================================
|
||||
/** Returns a list of the available cameras on this machine.
|
||||
|
||||
You can open one of these devices by calling openDevice() or openDeviceAsync().
|
||||
*/
|
||||
static StringArray getAvailableDevices();
|
||||
|
||||
/** Synchronously opens a camera device. This function should not be used on iOS or
|
||||
Android, use openDeviceAsync() instead.
|
||||
|
||||
The index parameter indicates which of the items returned by getAvailableDevices()
|
||||
to open.
|
||||
|
||||
The size constraints allow the method to choose between different resolutions if
|
||||
the camera supports this. If the resolution can't be specified (e.g. on the Mac)
|
||||
then these will be ignored.
|
||||
|
||||
On Mac, if highQuality is false, then the camera will be opened in preview mode
|
||||
which will allow the OS to drop frames if the computer cannot keep up in processing
|
||||
the frames.
|
||||
*/
|
||||
static CameraDevice* openDevice (int deviceIndex,
|
||||
int minWidth = 128, int minHeight = 64,
|
||||
int maxWidth = 1024, int maxHeight = 768,
|
||||
bool highQuality = true);
|
||||
|
||||
using OpenCameraResultCallback = std::function<void (CameraDevice*, const String& /*error*/)>;
|
||||
|
||||
/** Asynchronously opens a camera device on iOS (iOS 7+) or Android (API 21+).
|
||||
On other platforms, the function will simply call openDevice(). Upon completion,
|
||||
resultCallback will be invoked with valid CameraDevice* and an empty error
|
||||
String on success, or nullptr CameraDevice and a non-empty error String on failure.
|
||||
|
||||
This is the preferred method of opening a camera device, because it works on all
|
||||
platforms, whereas synchronous openDevice() does not work on iOS & Android.
|
||||
|
||||
The index parameter indicates which of the items returned by getAvailableDevices()
|
||||
to open.
|
||||
|
||||
The size constraints allow the method to choose between different resolutions if
|
||||
the camera supports this. If the resolution can't be specified then these will be
|
||||
ignored.
|
||||
|
||||
On iOS, if you want to switch a device, it is more efficient to open a new device
|
||||
before closing the older one, because this way both devices can share the same
|
||||
underlying camera session. Otherwise, the session needs to be close first, and this
|
||||
is a lengthy process that can take several seconds.
|
||||
|
||||
The Android implementation currently supports a maximum recording resolution of
|
||||
1080p. Choosing a larger size will result in larger pictures taken, but the video
|
||||
will be capped at 1080p.
|
||||
*/
|
||||
static void openDeviceAsync (int deviceIndex,
|
||||
OpenCameraResultCallback resultCallback,
|
||||
int minWidth = 128, int minHeight = 64,
|
||||
int maxWidth = 1024, int maxHeight = 768,
|
||||
bool highQuality = true);
|
||||
|
||||
//==============================================================================
|
||||
/** Returns the name of this device */
|
||||
const String& getName() const noexcept { return name; }
|
||||
|
||||
/** Creates a component that can be used to display a preview of the
|
||||
video from this camera.
|
||||
|
||||
Note: While you can change the size of the preview component, the actual
|
||||
preview display may be smaller than the size requested, because the correct
|
||||
aspect ratio is maintained automatically.
|
||||
*/
|
||||
Component* createViewerComponent();
|
||||
|
||||
//==============================================================================
|
||||
/** Triggers a still picture capture. Upon completion, pictureTakenCallback will
|
||||
be invoked on a message thread.
|
||||
|
||||
On Android, before calling takeStillPicture(), you need to create a preview with
|
||||
createViewerComponent() and you need to make it visible on screen.
|
||||
|
||||
Android does not support simultaneous video recording and still picture capture.
|
||||
*/
|
||||
void takeStillPicture (std::function<void (const Image&)> pictureTakenCallback);
|
||||
|
||||
/** Starts recording video to the specified file.
|
||||
|
||||
You should use getFileExtension() to find out the correct extension to
|
||||
use for your filename.
|
||||
|
||||
If the file exists, it will be deleted before the recording starts.
|
||||
|
||||
This method may not start recording instantly, so if you need to know the
|
||||
exact time at which the file begins, you can call getTimeOfFirstRecordedFrame()
|
||||
after the recording has finished.
|
||||
|
||||
The quality parameter can be 0, 1, or 2, to indicate low, medium, or high. It may
|
||||
or may not be used, depending on the driver.
|
||||
|
||||
On Android, before calling startRecordingToFile(), you need to create a preview with
|
||||
createViewerComponent() and you need to make it visible on screen.
|
||||
|
||||
The Android camera also requires exclusive access to the audio device, so make sure
|
||||
you close any open audio devices with AudioDeviceManager::closeAudioDevice() first.
|
||||
|
||||
Android does not support simultaneous video recording and still picture capture.
|
||||
|
||||
@see AudioDeviceManager::closeAudioDevice, AudioDeviceManager::restartLastAudioDevice
|
||||
*/
|
||||
void startRecordingToFile (const File& file, int quality = 2);
|
||||
|
||||
/** Stops recording, after a call to startRecordingToFile(). */
|
||||
void stopRecording();
|
||||
|
||||
/** Returns the file extension that should be used for the files
|
||||
that you pass to startRecordingToFile().
|
||||
|
||||
This may be platform-specific, e.g. ".mov" or ".avi".
|
||||
*/
|
||||
static String getFileExtension();
|
||||
|
||||
/** After calling stopRecording(), this method can be called to return the timestamp
|
||||
of the first frame that was written to the file.
|
||||
*/
|
||||
Time getTimeOfFirstRecordedFrame() const;
|
||||
|
||||
/** Set this callback to be notified whenever an error occurs. You may need to close
|
||||
and reopen the device to be able to use it further. */
|
||||
std::function<void (const String& /*error*/)> onErrorOccurred;
|
||||
|
||||
//==============================================================================
|
||||
/**
|
||||
Receives callbacks with individual frames from a CameraDevice. It is mainly
|
||||
useful for processing multiple frames that has to be done as quickly as
|
||||
possible. The callbacks can be called from any thread.
|
||||
|
||||
If you just need to take one picture, you should use takeStillPicture() instead.
|
||||
|
||||
@see CameraDevice::addListener
|
||||
*/
|
||||
class JUCE_API Listener
|
||||
{
|
||||
public:
|
||||
Listener() {}
|
||||
virtual ~Listener() {}
|
||||
|
||||
/** This method is called when a new image arrives.
|
||||
|
||||
This may be called by any thread, so be careful about thread-safety,
|
||||
and make sure that you process the data as quickly as possible to
|
||||
avoid glitching!
|
||||
|
||||
Simply add a listener to be continuously notified about new frames becoming
|
||||
available and remove the listener when you no longer need new frames.
|
||||
|
||||
If you just need to take one picture, use takeStillPicture() instead.
|
||||
|
||||
@see CameraDevice::takeStillPicture
|
||||
*/
|
||||
virtual void imageReceived (const Image& image) = 0;
|
||||
};
|
||||
|
||||
/** Adds a listener to receive images from the camera.
|
||||
|
||||
Be very careful not to delete the listener without first removing it by calling
|
||||
removeListener().
|
||||
*/
|
||||
void addListener (Listener* listenerToAdd);
|
||||
|
||||
/** Removes a listener that was previously added with addListener(). */
|
||||
void removeListener (Listener* listenerToRemove);
|
||||
|
||||
private:
|
||||
String name;
|
||||
|
||||
struct Pimpl;
|
||||
std::unique_ptr<Pimpl> pimpl;
|
||||
|
||||
struct ViewerComponent;
|
||||
friend struct ViewerComponent;
|
||||
|
||||
CameraDevice (const String& name, int index,
|
||||
int minWidth, int minHeight, int maxWidth, int maxHeight, bool highQuality);
|
||||
|
||||
#if JUCE_ANDROID || JUCE_IOS
|
||||
class CameraFactory;
|
||||
#endif
|
||||
|
||||
#if JUCE_ANDROID
|
||||
friend void juce_cameraDeviceStateClosed (int64);
|
||||
friend void juce_cameraDeviceStateDisconnected (int64);
|
||||
friend void juce_cameraDeviceStateError (int64, int);
|
||||
friend void juce_cameraDeviceStateOpened (int64, void*);
|
||||
|
||||
friend void juce_cameraCaptureSessionActive (int64, void*);
|
||||
friend void juce_cameraCaptureSessionClosed (int64, void*);
|
||||
friend void juce_cameraCaptureSessionConfigureFailed (int64, void*);
|
||||
friend void juce_cameraCaptureSessionConfigured (int64, void*);
|
||||
friend void juce_cameraCaptureSessionReady (int64, void*);
|
||||
|
||||
friend void juce_cameraCaptureSessionCaptureCompleted (int64, bool, void*, void*, void*);
|
||||
friend void juce_cameraCaptureSessionCaptureFailed (int64, bool, void*, void*, void*);
|
||||
friend void juce_cameraCaptureSessionCaptureProgressed (int64, bool, void*, void*, void*);
|
||||
friend void juce_cameraCaptureSessionCaptureSequenceAborted (int64, bool, void*, int);
|
||||
friend void juce_cameraCaptureSessionCaptureSequenceCompleted (int64, bool, void*, int, int64);
|
||||
friend void juce_cameraCaptureSessionCaptureStarted (int64, bool, void*, void*, int64, int64);
|
||||
|
||||
friend void juce_deviceOrientationChanged (int64, int);
|
||||
#endif
|
||||
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (CameraDevice)
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace juce
|
||||
/*
|
||||
==============================================================================
|
||||
|
||||
This file is part of the JUCE library.
|
||||
Copyright (c) 2022 - 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 7 End-User License
|
||||
Agreement and JUCE Privacy Policy.
|
||||
|
||||
End User License Agreement: www.juce.com/juce-7-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
|
||||
{
|
||||
|
||||
#if JUCE_USE_CAMERA || DOXYGEN
|
||||
|
||||
//==============================================================================
|
||||
/**
|
||||
Controls any video capture devices that might be available.
|
||||
|
||||
Use getAvailableDevices() to list the devices that are attached to the
|
||||
system, then call openDevice() or openDeviceAsync() to open one for use.
|
||||
Once you have a CameraDevice object, you can get a viewer component from it,
|
||||
and use its methods to stream to a file or capture still-frames.
|
||||
|
||||
@tags{Video}
|
||||
*/
|
||||
class JUCE_API CameraDevice
|
||||
{
|
||||
public:
|
||||
/** Destructor. */
|
||||
virtual ~CameraDevice();
|
||||
|
||||
//==============================================================================
|
||||
/** Returns a list of the available cameras on this machine.
|
||||
|
||||
You can open one of these devices by calling openDevice() or openDeviceAsync().
|
||||
*/
|
||||
static StringArray getAvailableDevices();
|
||||
|
||||
/** Synchronously opens a camera device. This function should not be used on iOS or
|
||||
Android, use openDeviceAsync() instead.
|
||||
|
||||
The index parameter indicates which of the items returned by getAvailableDevices()
|
||||
to open.
|
||||
|
||||
The size constraints allow the method to choose between different resolutions if
|
||||
the camera supports this. If the resolution can't be specified (e.g. on the Mac)
|
||||
then these will be ignored.
|
||||
|
||||
On Mac, if highQuality is false, then the camera will be opened in preview mode
|
||||
which will allow the OS to drop frames if the computer cannot keep up in processing
|
||||
the frames.
|
||||
*/
|
||||
static CameraDevice* openDevice (int deviceIndex,
|
||||
int minWidth = 128, int minHeight = 64,
|
||||
int maxWidth = 1024, int maxHeight = 768,
|
||||
bool highQuality = true);
|
||||
|
||||
using OpenCameraResultCallback = std::function<void (CameraDevice*, const String& /*error*/)>;
|
||||
|
||||
/** Asynchronously opens a camera device on iOS (iOS 7+) or Android (API 21+).
|
||||
On other platforms, the function will simply call openDevice(). Upon completion,
|
||||
resultCallback will be invoked with valid CameraDevice* and an empty error
|
||||
String on success, or nullptr CameraDevice and a non-empty error String on failure.
|
||||
|
||||
This is the preferred method of opening a camera device, because it works on all
|
||||
platforms, whereas synchronous openDevice() does not work on iOS & Android.
|
||||
|
||||
The index parameter indicates which of the items returned by getAvailableDevices()
|
||||
to open.
|
||||
|
||||
The size constraints allow the method to choose between different resolutions if
|
||||
the camera supports this. If the resolution can't be specified then these will be
|
||||
ignored.
|
||||
|
||||
On iOS, if you want to switch a device, it is more efficient to open a new device
|
||||
before closing the older one, because this way both devices can share the same
|
||||
underlying camera session. Otherwise, the session needs to be close first, and this
|
||||
is a lengthy process that can take several seconds.
|
||||
|
||||
The Android implementation currently supports a maximum recording resolution of
|
||||
1080p. Choosing a larger size will result in larger pictures taken, but the video
|
||||
will be capped at 1080p.
|
||||
*/
|
||||
static void openDeviceAsync (int deviceIndex,
|
||||
OpenCameraResultCallback resultCallback,
|
||||
int minWidth = 128, int minHeight = 64,
|
||||
int maxWidth = 1024, int maxHeight = 768,
|
||||
bool highQuality = true);
|
||||
|
||||
//==============================================================================
|
||||
/** Returns the name of this device */
|
||||
const String& getName() const noexcept { return name; }
|
||||
|
||||
/** Creates a component that can be used to display a preview of the
|
||||
video from this camera.
|
||||
|
||||
Note: While you can change the size of the preview component, the actual
|
||||
preview display may be smaller than the size requested, because the correct
|
||||
aspect ratio is maintained automatically.
|
||||
*/
|
||||
Component* createViewerComponent();
|
||||
|
||||
//==============================================================================
|
||||
/** Triggers a still picture capture. Upon completion, pictureTakenCallback will
|
||||
be invoked on a message thread.
|
||||
|
||||
On Android, before calling takeStillPicture(), you need to create a preview with
|
||||
createViewerComponent() and you need to make it visible on screen.
|
||||
|
||||
Android does not support simultaneous video recording and still picture capture.
|
||||
*/
|
||||
void takeStillPicture (std::function<void (const Image&)> pictureTakenCallback);
|
||||
|
||||
/** Starts recording video to the specified file.
|
||||
|
||||
You should use getFileExtension() to find out the correct extension to
|
||||
use for your filename.
|
||||
|
||||
If the file exists, it will be deleted before the recording starts.
|
||||
|
||||
This method may not start recording instantly, so if you need to know the
|
||||
exact time at which the file begins, you can call getTimeOfFirstRecordedFrame()
|
||||
after the recording has finished.
|
||||
|
||||
The quality parameter can be 0, 1, or 2, to indicate low, medium, or high. It may
|
||||
or may not be used, depending on the driver.
|
||||
|
||||
On Android, before calling startRecordingToFile(), you need to create a preview with
|
||||
createViewerComponent() and you need to make it visible on screen.
|
||||
|
||||
The Android camera also requires exclusive access to the audio device, so make sure
|
||||
you close any open audio devices with AudioDeviceManager::closeAudioDevice() first.
|
||||
|
||||
Android does not support simultaneous video recording and still picture capture.
|
||||
|
||||
@see AudioDeviceManager::closeAudioDevice, AudioDeviceManager::restartLastAudioDevice
|
||||
*/
|
||||
void startRecordingToFile (const File& file, int quality = 2);
|
||||
|
||||
/** Stops recording, after a call to startRecordingToFile(). */
|
||||
void stopRecording();
|
||||
|
||||
/** Returns the file extension that should be used for the files
|
||||
that you pass to startRecordingToFile().
|
||||
|
||||
This may be platform-specific, e.g. ".mov" or ".avi".
|
||||
*/
|
||||
static String getFileExtension();
|
||||
|
||||
/** After calling stopRecording(), this method can be called to return the timestamp
|
||||
of the first frame that was written to the file.
|
||||
*/
|
||||
Time getTimeOfFirstRecordedFrame() const;
|
||||
|
||||
/** Set this callback to be notified whenever an error occurs. You may need to close
|
||||
and reopen the device to be able to use it further. */
|
||||
std::function<void (const String& /*error*/)> onErrorOccurred;
|
||||
|
||||
//==============================================================================
|
||||
/**
|
||||
Receives callbacks with individual frames from a CameraDevice. It is mainly
|
||||
useful for processing multiple frames that has to be done as quickly as
|
||||
possible. The callbacks can be called from any thread.
|
||||
|
||||
If you just need to take one picture, you should use takeStillPicture() instead.
|
||||
|
||||
@see CameraDevice::addListener
|
||||
*/
|
||||
class JUCE_API Listener
|
||||
{
|
||||
public:
|
||||
Listener() {}
|
||||
virtual ~Listener() {}
|
||||
|
||||
/** This method is called when a new image arrives.
|
||||
|
||||
This may be called by any thread, so be careful about thread-safety,
|
||||
and make sure that you process the data as quickly as possible to
|
||||
avoid glitching!
|
||||
|
||||
Simply add a listener to be continuously notified about new frames becoming
|
||||
available and remove the listener when you no longer need new frames.
|
||||
|
||||
If you just need to take one picture, use takeStillPicture() instead.
|
||||
|
||||
@see CameraDevice::takeStillPicture
|
||||
*/
|
||||
virtual void imageReceived (const Image& image) = 0;
|
||||
};
|
||||
|
||||
/** Adds a listener to receive images from the camera.
|
||||
|
||||
Be very careful not to delete the listener without first removing it by calling
|
||||
removeListener().
|
||||
*/
|
||||
void addListener (Listener* listenerToAdd);
|
||||
|
||||
/** Removes a listener that was previously added with addListener(). */
|
||||
void removeListener (Listener* listenerToRemove);
|
||||
|
||||
private:
|
||||
String name;
|
||||
|
||||
struct Pimpl;
|
||||
std::unique_ptr<Pimpl> pimpl;
|
||||
|
||||
struct ViewerComponent;
|
||||
friend struct ViewerComponent;
|
||||
|
||||
CameraDevice (const String& name, int index,
|
||||
int minWidth, int minHeight, int maxWidth, int maxHeight, bool highQuality);
|
||||
|
||||
#if JUCE_ANDROID || JUCE_IOS
|
||||
class CameraFactory;
|
||||
#endif
|
||||
|
||||
#if JUCE_ANDROID
|
||||
friend void juce_cameraDeviceStateClosed (int64);
|
||||
friend void juce_cameraDeviceStateDisconnected (int64);
|
||||
friend void juce_cameraDeviceStateError (int64, int);
|
||||
friend void juce_cameraDeviceStateOpened (int64, void*);
|
||||
|
||||
friend void juce_cameraCaptureSessionActive (int64, void*);
|
||||
friend void juce_cameraCaptureSessionClosed (int64, void*);
|
||||
friend void juce_cameraCaptureSessionConfigureFailed (int64, void*);
|
||||
friend void juce_cameraCaptureSessionConfigured (int64, void*);
|
||||
friend void juce_cameraCaptureSessionReady (int64, void*);
|
||||
|
||||
friend void juce_cameraCaptureSessionCaptureCompleted (int64, bool, void*, void*, void*);
|
||||
friend void juce_cameraCaptureSessionCaptureFailed (int64, bool, void*, void*, void*);
|
||||
friend void juce_cameraCaptureSessionCaptureProgressed (int64, bool, void*, void*, void*);
|
||||
friend void juce_cameraCaptureSessionCaptureSequenceAborted (int64, bool, void*, int);
|
||||
friend void juce_cameraCaptureSessionCaptureSequenceCompleted (int64, bool, void*, int, int64);
|
||||
friend void juce_cameraCaptureSessionCaptureStarted (int64, bool, void*, void*, int64, int64);
|
||||
|
||||
friend void juce_deviceOrientationChanged (int64, int);
|
||||
#endif
|
||||
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (CameraDevice)
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace juce
|
||||
|
143
deps/juce/modules/juce_video/juce_video.cpp
vendored
143
deps/juce/modules/juce_video/juce_video.cpp
vendored
@ -1,73 +1,70 @@
|
||||
/*
|
||||
==============================================================================
|
||||
|
||||
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.
|
||||
|
||||
==============================================================================
|
||||
*/
|
||||
|
||||
#ifdef JUCE_VIDEO_H_INCLUDED
|
||||
/* When you add this cpp file to your project, you mustn't include it in a file where you've
|
||||
already included any other headers - just put it inside a file on its own, possibly with your config
|
||||
flags preceding it, but don't include anything else. That also includes avoiding any automatic prefix
|
||||
header files that the compiler may be using.
|
||||
*/
|
||||
#error "Incorrect use of JUCE cpp file"
|
||||
#endif
|
||||
|
||||
#define JUCE_CORE_INCLUDE_OBJC_HELPERS 1
|
||||
#define JUCE_CORE_INCLUDE_JNI_HELPERS 1
|
||||
#define JUCE_CORE_INCLUDE_COM_SMART_PTR 1
|
||||
#define JUCE_CORE_INCLUDE_NATIVE_HEADERS 1
|
||||
|
||||
#include "juce_video.h"
|
||||
|
||||
#if JUCE_MAC || JUCE_IOS
|
||||
#import <AVFoundation/AVFoundation.h>
|
||||
#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>
|
||||
|
||||
#if ! JUCE_DONT_AUTOLINK_TO_WIN32_LIBRARIES
|
||||
#pragma comment (lib, "strmiids.lib")
|
||||
|
||||
#if JUCE_USE_CAMERA
|
||||
#pragma comment (lib, "Strmiids.lib")
|
||||
#pragma comment (lib, "wmvcore.lib")
|
||||
#endif
|
||||
|
||||
#if JUCE_MEDIAFOUNDATION
|
||||
#pragma comment (lib, "mfuuid.lib")
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//==============================================================================
|
||||
#include "playback/juce_VideoComponent.cpp"
|
||||
|
||||
#if JUCE_USE_CAMERA
|
||||
#include "capture/juce_CameraDevice.cpp"
|
||||
#endif
|
||||
/*
|
||||
==============================================================================
|
||||
|
||||
This file is part of the JUCE library.
|
||||
Copyright (c) 2022 - 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 7 End-User License
|
||||
Agreement and JUCE Privacy Policy.
|
||||
|
||||
End User License Agreement: www.juce.com/juce-7-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.
|
||||
|
||||
==============================================================================
|
||||
*/
|
||||
|
||||
#ifdef JUCE_VIDEO_H_INCLUDED
|
||||
/* When you add this cpp file to your project, you mustn't include it in a file where you've
|
||||
already included any other headers - just put it inside a file on its own, possibly with your config
|
||||
flags preceding it, but don't include anything else. That also includes avoiding any automatic prefix
|
||||
header files that the compiler may be using.
|
||||
*/
|
||||
#error "Incorrect use of JUCE cpp file"
|
||||
#endif
|
||||
|
||||
#define JUCE_CORE_INCLUDE_OBJC_HELPERS 1
|
||||
#define JUCE_CORE_INCLUDE_JNI_HELPERS 1
|
||||
#define JUCE_CORE_INCLUDE_COM_SMART_PTR 1
|
||||
#define JUCE_CORE_INCLUDE_NATIVE_HEADERS 1
|
||||
|
||||
#include "juce_video.h"
|
||||
|
||||
#if JUCE_MAC || JUCE_IOS
|
||||
#import <AVFoundation/AVFoundation.h>
|
||||
#import <AVKit/AVKit.h>
|
||||
|
||||
//==============================================================================
|
||||
#elif JUCE_WINDOWS
|
||||
#include "wmsdkidl.h"
|
||||
#include "native/juce_win32_ComTypes.h"
|
||||
|
||||
#if ! JUCE_MINGW && ! JUCE_DONT_AUTOLINK_TO_WIN32_LIBRARIES
|
||||
#pragma comment (lib, "strmiids.lib")
|
||||
|
||||
#if JUCE_USE_CAMERA
|
||||
#pragma comment (lib, "Strmiids.lib")
|
||||
#pragma comment (lib, "wmvcore.lib")
|
||||
#endif
|
||||
|
||||
#if JUCE_MEDIAFOUNDATION
|
||||
#pragma comment (lib, "mfuuid.lib")
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//==============================================================================
|
||||
#include "playback/juce_VideoComponent.cpp"
|
||||
|
||||
#if JUCE_USE_CAMERA
|
||||
#include "capture/juce_CameraDevice.cpp"
|
||||
#endif
|
||||
|
206
deps/juce/modules/juce_video/juce_video.h
vendored
206
deps/juce/modules/juce_video/juce_video.h
vendored
@ -1,103 +1,103 @@
|
||||
/*
|
||||
==============================================================================
|
||||
|
||||
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.
|
||||
|
||||
==============================================================================
|
||||
*/
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
The block below describes the properties of this module, and is read by
|
||||
the Projucer to automatically generate project code that uses it.
|
||||
For details about the syntax and how to create or use a module, see the
|
||||
JUCE Module Format.md file.
|
||||
|
||||
|
||||
BEGIN_JUCE_MODULE_DECLARATION
|
||||
|
||||
ID: juce_video
|
||||
vendor: juce
|
||||
version: 6.1.2
|
||||
name: JUCE video playback and capture classes
|
||||
description: Classes for playing video and capturing camera input.
|
||||
website: http://www.juce.com/juce
|
||||
license: GPL/Commercial
|
||||
minimumCppStandard: 14
|
||||
|
||||
dependencies: juce_gui_extra
|
||||
OSXFrameworks: AVKit AVFoundation CoreMedia
|
||||
iOSFrameworks: AVKit AVFoundation CoreMedia
|
||||
|
||||
END_JUCE_MODULE_DECLARATION
|
||||
|
||||
*******************************************************************************/
|
||||
|
||||
|
||||
#pragma once
|
||||
#define JUCE_VIDEO_H_INCLUDED
|
||||
|
||||
//==============================================================================
|
||||
#include <juce_gui_extra/juce_gui_extra.h>
|
||||
|
||||
//==============================================================================
|
||||
/** Config: JUCE_USE_CAMERA
|
||||
Enables camera support using the CameraDevice class (Mac, Windows, iOS, Android).
|
||||
*/
|
||||
#ifndef JUCE_USE_CAMERA
|
||||
#define JUCE_USE_CAMERA 0
|
||||
#endif
|
||||
|
||||
#ifndef JUCE_CAMERA_LOG_ENABLED
|
||||
#define JUCE_CAMERA_LOG_ENABLED 0
|
||||
#endif
|
||||
|
||||
#if JUCE_CAMERA_LOG_ENABLED
|
||||
#define JUCE_CAMERA_LOG(x) DBG(x)
|
||||
#else
|
||||
#define JUCE_CAMERA_LOG(x) {}
|
||||
#endif
|
||||
|
||||
#if ! (JUCE_MAC || JUCE_WINDOWS || JUCE_IOS || JUCE_ANDROID)
|
||||
#undef JUCE_USE_CAMERA
|
||||
#endif
|
||||
|
||||
//==============================================================================
|
||||
/** Config: JUCE_SYNC_VIDEO_VOLUME_WITH_OS_MEDIA_VOLUME
|
||||
Enables synchronisation between video playback volume and OS media volume.
|
||||
Currently supported on Android only.
|
||||
*/
|
||||
#ifndef JUCE_SYNC_VIDEO_VOLUME_WITH_OS_MEDIA_VOLUME
|
||||
#define JUCE_SYNC_VIDEO_VOLUME_WITH_OS_MEDIA_VOLUME 1
|
||||
#endif
|
||||
|
||||
#ifndef JUCE_VIDEO_LOG_ENABLED
|
||||
#define JUCE_VIDEO_LOG_ENABLED 1
|
||||
#endif
|
||||
|
||||
#if JUCE_VIDEO_LOG_ENABLED
|
||||
#define JUCE_VIDEO_LOG(x) DBG(x)
|
||||
#else
|
||||
#define JUCE_VIDEO_LOG(x) {}
|
||||
#endif
|
||||
|
||||
//==============================================================================
|
||||
#include "playback/juce_VideoComponent.h"
|
||||
#include "capture/juce_CameraDevice.h"
|
||||
/*
|
||||
==============================================================================
|
||||
|
||||
This file is part of the JUCE library.
|
||||
Copyright (c) 2022 - 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 7 End-User License
|
||||
Agreement and JUCE Privacy Policy.
|
||||
|
||||
End User License Agreement: www.juce.com/juce-7-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.
|
||||
|
||||
==============================================================================
|
||||
*/
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
The block below describes the properties of this module, and is read by
|
||||
the Projucer to automatically generate project code that uses it.
|
||||
For details about the syntax and how to create or use a module, see the
|
||||
JUCE Module Format.md file.
|
||||
|
||||
|
||||
BEGIN_JUCE_MODULE_DECLARATION
|
||||
|
||||
ID: juce_video
|
||||
vendor: juce
|
||||
version: 7.0.2
|
||||
name: JUCE video playback and capture classes
|
||||
description: Classes for playing video and capturing camera input.
|
||||
website: http://www.juce.com/juce
|
||||
license: GPL/Commercial
|
||||
minimumCppStandard: 14
|
||||
|
||||
dependencies: juce_gui_extra
|
||||
OSXFrameworks: AVKit AVFoundation CoreMedia
|
||||
iOSFrameworks: AVKit AVFoundation CoreMedia
|
||||
|
||||
END_JUCE_MODULE_DECLARATION
|
||||
|
||||
*******************************************************************************/
|
||||
|
||||
|
||||
#pragma once
|
||||
#define JUCE_VIDEO_H_INCLUDED
|
||||
|
||||
//==============================================================================
|
||||
#include <juce_gui_extra/juce_gui_extra.h>
|
||||
|
||||
//==============================================================================
|
||||
/** Config: JUCE_USE_CAMERA
|
||||
Enables camera support using the CameraDevice class (Mac, Windows, iOS, Android).
|
||||
*/
|
||||
#ifndef JUCE_USE_CAMERA
|
||||
#define JUCE_USE_CAMERA 0
|
||||
#endif
|
||||
|
||||
#ifndef JUCE_CAMERA_LOG_ENABLED
|
||||
#define JUCE_CAMERA_LOG_ENABLED 0
|
||||
#endif
|
||||
|
||||
#if JUCE_CAMERA_LOG_ENABLED
|
||||
#define JUCE_CAMERA_LOG(x) DBG(x)
|
||||
#else
|
||||
#define JUCE_CAMERA_LOG(x) {}
|
||||
#endif
|
||||
|
||||
#if ! (JUCE_MAC || JUCE_WINDOWS || JUCE_IOS || JUCE_ANDROID)
|
||||
#undef JUCE_USE_CAMERA
|
||||
#endif
|
||||
|
||||
//==============================================================================
|
||||
/** Config: JUCE_SYNC_VIDEO_VOLUME_WITH_OS_MEDIA_VOLUME
|
||||
Enables synchronisation between video playback volume and OS media volume.
|
||||
Currently supported on Android only.
|
||||
*/
|
||||
#ifndef JUCE_SYNC_VIDEO_VOLUME_WITH_OS_MEDIA_VOLUME
|
||||
#define JUCE_SYNC_VIDEO_VOLUME_WITH_OS_MEDIA_VOLUME 1
|
||||
#endif
|
||||
|
||||
#ifndef JUCE_VIDEO_LOG_ENABLED
|
||||
#define JUCE_VIDEO_LOG_ENABLED 1
|
||||
#endif
|
||||
|
||||
#if JUCE_VIDEO_LOG_ENABLED
|
||||
#define JUCE_VIDEO_LOG(x) DBG(x)
|
||||
#else
|
||||
#define JUCE_VIDEO_LOG(x) {}
|
||||
#endif
|
||||
|
||||
//==============================================================================
|
||||
#include "playback/juce_VideoComponent.h"
|
||||
#include "capture/juce_CameraDevice.h"
|
||||
|
8
deps/juce/modules/juce_video/juce_video.mm
vendored
8
deps/juce/modules/juce_video/juce_video.mm
vendored
@ -2,15 +2,15 @@
|
||||
==============================================================================
|
||||
|
||||
This file is part of the JUCE library.
|
||||
Copyright (c) 2020 - Raw Material Software Limited
|
||||
Copyright (c) 2022 - 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).
|
||||
By using JUCE, you agree to the terms of both the JUCE 7 End-User License
|
||||
Agreement and JUCE Privacy Policy.
|
||||
|
||||
End User License Agreement: www.juce.com/juce-6-licence
|
||||
End User License Agreement: www.juce.com/juce-7-licence
|
||||
Privacy Policy: www.juce.com/juce-privacy-policy
|
||||
|
||||
Or: You may also use this code under the terms of the GPL v3 (see
|
||||
|
@ -2,15 +2,15 @@
|
||||
==============================================================================
|
||||
|
||||
This file is part of the JUCE library.
|
||||
Copyright (c) 2020 - Raw Material Software Limited
|
||||
Copyright (c) 2022 - 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).
|
||||
By using JUCE, you agree to the terms of both the JUCE 7 End-User License
|
||||
Agreement and JUCE Privacy Policy.
|
||||
|
||||
End User License Agreement: www.juce.com/juce-6-licence
|
||||
End User License Agreement: www.juce.com/juce-7-licence
|
||||
Privacy Policy: www.juce.com/juce-privacy-policy
|
||||
|
||||
Or: You may also use this code under the terms of the GPL v3 (see
|
||||
|
@ -2,15 +2,15 @@
|
||||
==============================================================================
|
||||
|
||||
This file is part of the JUCE library.
|
||||
Copyright (c) 2020 - Raw Material Software Limited
|
||||
Copyright (c) 2022 - 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).
|
||||
By using JUCE, you agree to the terms of both the JUCE 7 End-User License
|
||||
Agreement and JUCE Privacy Policy.
|
||||
|
||||
End User License Agreement: www.juce.com/juce-6-licence
|
||||
End User License Agreement: www.juce.com/juce-7-licence
|
||||
Privacy Policy: www.juce.com/juce-privacy-policy
|
||||
|
||||
Or: You may also use this code under the terms of the GPL v3 (see
|
||||
|
@ -2,15 +2,15 @@
|
||||
==============================================================================
|
||||
|
||||
This file is part of the JUCE library.
|
||||
Copyright (c) 2020 - Raw Material Software Limited
|
||||
Copyright (c) 2022 - 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).
|
||||
By using JUCE, you agree to the terms of both the JUCE 7 End-User License
|
||||
Agreement and JUCE Privacy Policy.
|
||||
|
||||
End User License Agreement: www.juce.com/juce-6-licence
|
||||
End User License Agreement: www.juce.com/juce-7-licence
|
||||
Privacy Policy: www.juce.com/juce-privacy-policy
|
||||
|
||||
Or: You may also use this code under the terms of the GPL v3 (see
|
||||
|
@ -2,15 +2,15 @@
|
||||
==============================================================================
|
||||
|
||||
This file is part of the JUCE library.
|
||||
Copyright (c) 2020 - Raw Material Software Limited
|
||||
Copyright (c) 2022 - 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).
|
||||
By using JUCE, you agree to the terms of both the JUCE 7 End-User License
|
||||
Agreement and JUCE Privacy Policy.
|
||||
|
||||
End User License Agreement: www.juce.com/juce-6-licence
|
||||
End User License Agreement: www.juce.com/juce-7-licence
|
||||
Privacy Policy: www.juce.com/juce-privacy-policy
|
||||
|
||||
Or: You may also use this code under the terms of the GPL v3 (see
|
||||
|
@ -2,15 +2,15 @@
|
||||
==============================================================================
|
||||
|
||||
This file is part of the JUCE library.
|
||||
Copyright (c) 2020 - Raw Material Software Limited
|
||||
Copyright (c) 2022 - 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).
|
||||
By using JUCE, you agree to the terms of both the JUCE 7 End-User License
|
||||
Agreement and JUCE Privacy Policy.
|
||||
|
||||
End User License Agreement: www.juce.com/juce-6-licence
|
||||
End User License Agreement: www.juce.com/juce-7-licence
|
||||
Privacy Policy: www.juce.com/juce-privacy-policy
|
||||
|
||||
Or: You may also use this code under the terms of the GPL v3 (see
|
||||
|
@ -2,15 +2,15 @@
|
||||
==============================================================================
|
||||
|
||||
This file is part of the JUCE library.
|
||||
Copyright (c) 2020 - Raw Material Software Limited
|
||||
Copyright (c) 2022 - 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).
|
||||
By using JUCE, you agree to the terms of both the JUCE 7 End-User License
|
||||
Agreement and JUCE Privacy Policy.
|
||||
|
||||
End User License Agreement: www.juce.com/juce-6-licence
|
||||
End User License Agreement: www.juce.com/juce-7-licence
|
||||
Privacy Policy: www.juce.com/juce-privacy-policy
|
||||
|
||||
Or: You may also use this code under the terms of the GPL v3 (see
|
||||
|
@ -2,15 +2,15 @@
|
||||
==============================================================================
|
||||
|
||||
This file is part of the JUCE library.
|
||||
Copyright (c) 2020 - Raw Material Software Limited
|
||||
Copyright (c) 2022 - 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).
|
||||
By using JUCE, you agree to the terms of both the JUCE 7 End-User License
|
||||
Agreement and JUCE Privacy Policy.
|
||||
|
||||
End User License Agreement: www.juce.com/juce-6-licence
|
||||
End User License Agreement: www.juce.com/juce-7-licence
|
||||
Privacy Policy: www.juce.com/juce-privacy-policy
|
||||
|
||||
Or: You may also use this code under the terms of the GPL v3 (see
|
||||
|
File diff suppressed because it is too large
Load Diff
3705
deps/juce/modules/juce_video/native/juce_android_Video.h
vendored
3705
deps/juce/modules/juce_video/native/juce_android_Video.h
vendored
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
1665
deps/juce/modules/juce_video/native/juce_mac_Video.h
vendored
1665
deps/juce/modules/juce_video/native/juce_mac_Video.h
vendored
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
512
deps/juce/modules/juce_video/native/juce_win32_ComTypes.h
vendored
Normal file
512
deps/juce/modules/juce_video/native/juce_win32_ComTypes.h
vendored
Normal file
@ -0,0 +1,512 @@
|
||||
/*
|
||||
==============================================================================
|
||||
|
||||
This file is part of the JUCE library.
|
||||
Copyright (c) 2022 - 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 7 End-User License
|
||||
Agreement and JUCE Privacy Policy.
|
||||
|
||||
End User License Agreement: www.juce.com/juce-7-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
|
1922
deps/juce/modules/juce_video/native/juce_win32_Video.h
vendored
1922
deps/juce/modules/juce_video/native/juce_win32_Video.h
vendored
File diff suppressed because it is too large
Load Diff
@ -1,166 +1,166 @@
|
||||
/*
|
||||
==============================================================================
|
||||
|
||||
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
|
||||
{
|
||||
|
||||
#if ! (JUCE_LINUX || JUCE_BSD)
|
||||
|
||||
#if JUCE_MAC || JUCE_IOS
|
||||
#include "../native/juce_mac_Video.h"
|
||||
#elif JUCE_WINDOWS
|
||||
#include "../native/juce_win32_Video.h"
|
||||
#elif JUCE_ANDROID
|
||||
#include "../native/juce_android_Video.h"
|
||||
#endif
|
||||
|
||||
//==============================================================================
|
||||
VideoComponent::VideoComponent (bool useNativeControlsIfAvailable)
|
||||
: pimpl (new Pimpl (*this, useNativeControlsIfAvailable))
|
||||
{
|
||||
addAndMakeVisible (pimpl.get());
|
||||
}
|
||||
|
||||
VideoComponent::~VideoComponent()
|
||||
{
|
||||
pimpl.reset();
|
||||
}
|
||||
|
||||
Result VideoComponent::load (const File& file)
|
||||
{
|
||||
return loadInternal (file, false);
|
||||
}
|
||||
|
||||
Result VideoComponent::load (const URL& url)
|
||||
{
|
||||
return loadInternal (url, false);
|
||||
}
|
||||
|
||||
void VideoComponent::loadAsync (const URL& url, std::function<void (const URL&, Result)> callback)
|
||||
{
|
||||
if (callback == nullptr)
|
||||
{
|
||||
jassertfalse;
|
||||
return;
|
||||
}
|
||||
|
||||
#if JUCE_ANDROID || JUCE_IOS || JUCE_MAC
|
||||
pimpl->loadAsync (url, callback);
|
||||
#else
|
||||
auto result = loadInternal (url, true);
|
||||
callback (url, result);
|
||||
#endif
|
||||
}
|
||||
|
||||
void VideoComponent::closeVideo()
|
||||
{
|
||||
pimpl->close();
|
||||
// Closing on Android is async and resized() will be called internally by pimpl once
|
||||
// close operation finished.
|
||||
#if ! JUCE_ANDROID// TODO JUCE_IOS too?
|
||||
resized();
|
||||
#endif
|
||||
}
|
||||
|
||||
bool VideoComponent::isVideoOpen() const { return pimpl->isOpen(); }
|
||||
|
||||
File VideoComponent::getCurrentVideoFile() const { return pimpl->currentFile; }
|
||||
URL VideoComponent::getCurrentVideoURL() const { return pimpl->currentURL; }
|
||||
|
||||
double VideoComponent::getVideoDuration() const { return pimpl->getDuration(); }
|
||||
Rectangle<int> VideoComponent::getVideoNativeSize() const { return pimpl->getNativeSize(); }
|
||||
|
||||
void VideoComponent::play() { pimpl->play(); }
|
||||
void VideoComponent::stop() { pimpl->stop(); }
|
||||
|
||||
bool VideoComponent::isPlaying() const { return pimpl->isPlaying(); }
|
||||
|
||||
void VideoComponent::setPlayPosition (double newPos) { pimpl->setPosition (newPos); }
|
||||
double VideoComponent::getPlayPosition() const { return pimpl->getPosition(); }
|
||||
|
||||
void VideoComponent::setPlaySpeed (double newSpeed) { pimpl->setSpeed (newSpeed); }
|
||||
double VideoComponent::getPlaySpeed() const { return pimpl->getSpeed(); }
|
||||
|
||||
void VideoComponent::setAudioVolume (float newVolume) { pimpl->setVolume (newVolume); }
|
||||
float VideoComponent::getAudioVolume() const { return pimpl->getVolume(); }
|
||||
|
||||
void VideoComponent::resized()
|
||||
{
|
||||
auto r = getLocalBounds();
|
||||
|
||||
if (isVideoOpen() && ! r.isEmpty())
|
||||
{
|
||||
auto nativeSize = getVideoNativeSize();
|
||||
|
||||
if (nativeSize.isEmpty())
|
||||
{
|
||||
// if we've just opened the file and are still waiting for it to
|
||||
// figure out the size, start our timer..
|
||||
if (! isTimerRunning())
|
||||
startTimer (50);
|
||||
}
|
||||
else
|
||||
{
|
||||
r = RectanglePlacement (RectanglePlacement::centred).appliedTo (nativeSize, r);
|
||||
stopTimer();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
stopTimer();
|
||||
}
|
||||
|
||||
pimpl->setBounds (r);
|
||||
}
|
||||
|
||||
void VideoComponent::timerCallback()
|
||||
{
|
||||
resized();
|
||||
}
|
||||
|
||||
template <class FileOrURL>
|
||||
Result VideoComponent::loadInternal (const FileOrURL& fileOrUrl, bool loadAsync)
|
||||
{
|
||||
#if JUCE_ANDROID || JUCE_IOS
|
||||
ignoreUnused (fileOrUrl, loadAsync);
|
||||
|
||||
// You need to use loadAsync on Android & iOS.
|
||||
jassertfalse;
|
||||
return Result::fail ("load() is not supported on this platform. Use loadAsync() instead.");
|
||||
#else
|
||||
auto result = pimpl->load (fileOrUrl);
|
||||
|
||||
if (loadAsync)
|
||||
startTimer (50);
|
||||
else
|
||||
resized();
|
||||
|
||||
return result;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace juce
|
||||
/*
|
||||
==============================================================================
|
||||
|
||||
This file is part of the JUCE library.
|
||||
Copyright (c) 2022 - 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 7 End-User License
|
||||
Agreement and JUCE Privacy Policy.
|
||||
|
||||
End User License Agreement: www.juce.com/juce-7-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
|
||||
{
|
||||
|
||||
#if ! (JUCE_LINUX || JUCE_BSD)
|
||||
|
||||
#if JUCE_MAC || JUCE_IOS
|
||||
#include "../native/juce_mac_Video.h"
|
||||
#elif JUCE_WINDOWS
|
||||
#include "../native/juce_win32_Video.h"
|
||||
#elif JUCE_ANDROID
|
||||
#include "../native/juce_android_Video.h"
|
||||
#endif
|
||||
|
||||
//==============================================================================
|
||||
VideoComponent::VideoComponent (bool useNativeControlsIfAvailable)
|
||||
: pimpl (new Pimpl (*this, useNativeControlsIfAvailable))
|
||||
{
|
||||
addAndMakeVisible (pimpl.get());
|
||||
}
|
||||
|
||||
VideoComponent::~VideoComponent()
|
||||
{
|
||||
pimpl.reset();
|
||||
}
|
||||
|
||||
Result VideoComponent::load (const File& file)
|
||||
{
|
||||
return loadInternal (file, false);
|
||||
}
|
||||
|
||||
Result VideoComponent::load (const URL& url)
|
||||
{
|
||||
return loadInternal (url, false);
|
||||
}
|
||||
|
||||
void VideoComponent::loadAsync (const URL& url, std::function<void (const URL&, Result)> callback)
|
||||
{
|
||||
if (callback == nullptr)
|
||||
{
|
||||
jassertfalse;
|
||||
return;
|
||||
}
|
||||
|
||||
#if JUCE_ANDROID || JUCE_IOS || JUCE_MAC
|
||||
pimpl->loadAsync (url, callback);
|
||||
#else
|
||||
auto result = loadInternal (url, true);
|
||||
callback (url, result);
|
||||
#endif
|
||||
}
|
||||
|
||||
void VideoComponent::closeVideo()
|
||||
{
|
||||
pimpl->close();
|
||||
// Closing on Android is async and resized() will be called internally by pimpl once
|
||||
// close operation finished.
|
||||
#if ! JUCE_ANDROID// TODO JUCE_IOS too?
|
||||
resized();
|
||||
#endif
|
||||
}
|
||||
|
||||
bool VideoComponent::isVideoOpen() const { return pimpl->isOpen(); }
|
||||
|
||||
File VideoComponent::getCurrentVideoFile() const { return pimpl->currentFile; }
|
||||
URL VideoComponent::getCurrentVideoURL() const { return pimpl->currentURL; }
|
||||
|
||||
double VideoComponent::getVideoDuration() const { return pimpl->getDuration(); }
|
||||
Rectangle<int> VideoComponent::getVideoNativeSize() const { return pimpl->getNativeSize(); }
|
||||
|
||||
void VideoComponent::play() { pimpl->play(); }
|
||||
void VideoComponent::stop() { pimpl->stop(); }
|
||||
|
||||
bool VideoComponent::isPlaying() const { return pimpl->isPlaying(); }
|
||||
|
||||
void VideoComponent::setPlayPosition (double newPos) { pimpl->setPosition (newPos); }
|
||||
double VideoComponent::getPlayPosition() const { return pimpl->getPosition(); }
|
||||
|
||||
void VideoComponent::setPlaySpeed (double newSpeed) { pimpl->setSpeed (newSpeed); }
|
||||
double VideoComponent::getPlaySpeed() const { return pimpl->getSpeed(); }
|
||||
|
||||
void VideoComponent::setAudioVolume (float newVolume) { pimpl->setVolume (newVolume); }
|
||||
float VideoComponent::getAudioVolume() const { return pimpl->getVolume(); }
|
||||
|
||||
void VideoComponent::resized()
|
||||
{
|
||||
auto r = getLocalBounds();
|
||||
|
||||
if (isVideoOpen() && ! r.isEmpty())
|
||||
{
|
||||
auto nativeSize = getVideoNativeSize();
|
||||
|
||||
if (nativeSize.isEmpty())
|
||||
{
|
||||
// if we've just opened the file and are still waiting for it to
|
||||
// figure out the size, start our timer..
|
||||
if (! isTimerRunning())
|
||||
startTimer (50);
|
||||
}
|
||||
else
|
||||
{
|
||||
r = RectanglePlacement (RectanglePlacement::centred).appliedTo (nativeSize, r);
|
||||
stopTimer();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
stopTimer();
|
||||
}
|
||||
|
||||
pimpl->setBounds (r);
|
||||
}
|
||||
|
||||
void VideoComponent::timerCallback()
|
||||
{
|
||||
resized();
|
||||
}
|
||||
|
||||
template <class FileOrURL>
|
||||
Result VideoComponent::loadInternal (const FileOrURL& fileOrUrl, bool loadAsync)
|
||||
{
|
||||
#if JUCE_ANDROID || JUCE_IOS
|
||||
ignoreUnused (fileOrUrl, loadAsync);
|
||||
|
||||
// You need to use loadAsync on Android & iOS.
|
||||
jassertfalse;
|
||||
return Result::fail ("load() is not supported on this platform. Use loadAsync() instead.");
|
||||
#else
|
||||
auto result = pimpl->load (fileOrUrl);
|
||||
|
||||
if (loadAsync)
|
||||
startTimer (50);
|
||||
else
|
||||
resized();
|
||||
|
||||
return result;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace juce
|
||||
|
@ -1,190 +1,190 @@
|
||||
/*
|
||||
==============================================================================
|
||||
|
||||
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.
|
||||
|
||||
==============================================================================
|
||||
*/
|
||||
|
||||
#ifndef JUCE_VIDEOCOMPONENT_H_INCLUDED
|
||||
#define JUCE_VIDEOCOMPONENT_H_INCLUDED
|
||||
|
||||
namespace juce
|
||||
{
|
||||
|
||||
//==============================================================================
|
||||
/**
|
||||
A component that can play a movie.
|
||||
|
||||
Use the load() method to open a video once you've added this component to
|
||||
a parent (or put it on the desktop).
|
||||
|
||||
@tags{Video}
|
||||
*/
|
||||
class JUCE_API VideoComponent : public Component,
|
||||
private Timer
|
||||
{
|
||||
public:
|
||||
//==============================================================================
|
||||
/** Creates an empty VideoComponent.
|
||||
|
||||
Use the loadAsync() or load() method to open a video once you've added
|
||||
this component to a parent (or put it on the desktop).
|
||||
|
||||
If useNativeControlsIfAvailable is enabled and a target OS has a video view with
|
||||
dedicated controls for transport etc, that view will be used. In opposite
|
||||
case a bare video view without any controls will be presented, allowing you to
|
||||
tailor your own UI. Currently this flag is used on iOS and 64bit macOS.
|
||||
Android, Windows and 32bit macOS will always use plain video views without
|
||||
dedicated controls.
|
||||
*/
|
||||
VideoComponent (bool useNativeControlsIfAvailable);
|
||||
|
||||
/** Destructor. */
|
||||
~VideoComponent() override;
|
||||
|
||||
//==============================================================================
|
||||
/** Tries to load a video from a local file.
|
||||
|
||||
This function is supported on macOS and Windows. For iOS and Android, use
|
||||
loadAsync() instead.
|
||||
|
||||
@returns an error if the file failed to be loaded correctly
|
||||
|
||||
@see loadAsync
|
||||
*/
|
||||
Result load (const File& file);
|
||||
|
||||
/** Tries to load a video from a URL.
|
||||
|
||||
This function is supported on macOS and Windows. For iOS and Android, use
|
||||
loadAsync() instead.
|
||||
|
||||
@returns an error if the file failed to be loaded correctly
|
||||
|
||||
@see loadAsync
|
||||
*/
|
||||
Result load (const URL& url);
|
||||
|
||||
/** Tries to load a video from a URL asynchronously. When finished, invokes the
|
||||
callback supplied to the function on the message thread.
|
||||
|
||||
This is the preferred way of loading content, since it works not only on
|
||||
macOS and Windows, but also on iOS and Android. On Windows, it will internally
|
||||
call load().
|
||||
|
||||
@see load
|
||||
*/
|
||||
void loadAsync (const URL& url, std::function<void (const URL&, Result)> loadFinishedCallback);
|
||||
|
||||
/** Closes the video and resets the component. */
|
||||
void closeVideo();
|
||||
|
||||
/** Returns true if a video is currently open. */
|
||||
bool isVideoOpen() const;
|
||||
|
||||
/** Returns the last file that was loaded.
|
||||
If nothing is open, or if it was a URL rather than a file, this will return File().
|
||||
*/
|
||||
File getCurrentVideoFile() const;
|
||||
|
||||
/** Returns the last URL that was loaded.
|
||||
If nothing is open, or if it was a file rather than a URL, this will return URL().
|
||||
*/
|
||||
URL getCurrentVideoURL() const;
|
||||
|
||||
//==============================================================================
|
||||
/** Returns the length of the video, in seconds. */
|
||||
double getVideoDuration() const;
|
||||
|
||||
/** Returns the video's natural size, in pixels.
|
||||
If no video is loaded, an empty rectangle will be returned.
|
||||
*/
|
||||
Rectangle<int> getVideoNativeSize() const;
|
||||
|
||||
/** Starts the video playing. */
|
||||
void play();
|
||||
|
||||
/** Stops the video playing. */
|
||||
void stop();
|
||||
|
||||
/** Returns true if the video is currently playing. */
|
||||
bool isPlaying() const;
|
||||
|
||||
/** Sets the video's position to a given time. */
|
||||
void setPlayPosition (double newPositionSeconds);
|
||||
|
||||
/** Returns the current play position of the video. */
|
||||
double getPlayPosition() const;
|
||||
|
||||
/** Changes the video playback rate.
|
||||
A value of 1.0 is normal speed, greater values will play faster, smaller
|
||||
values play more slowly.
|
||||
*/
|
||||
void setPlaySpeed (double newSpeed);
|
||||
|
||||
/** Returns the current play speed of the video. */
|
||||
double getPlaySpeed() const;
|
||||
|
||||
/** Changes the video's playback volume.
|
||||
@param newVolume the volume in the range 0 (silent) to 1.0 (full)
|
||||
*/
|
||||
void setAudioVolume (float newVolume);
|
||||
|
||||
/** Returns the video's playback volume.
|
||||
@returns the volume in the range 0 (silent) to 1.0 (full)
|
||||
*/
|
||||
float getAudioVolume() const;
|
||||
|
||||
#if JUCE_SYNC_VIDEO_VOLUME_WITH_OS_MEDIA_VOLUME
|
||||
/** Set this callback to be notified whenever OS global media volume changes.
|
||||
Currently used on Android only.
|
||||
*/
|
||||
std::function<void()> onGlobalMediaVolumeChanged;
|
||||
#endif
|
||||
|
||||
/** Set this callback to be notified whenever the playback starts. */
|
||||
std::function<void()> onPlaybackStarted;
|
||||
|
||||
/** Set this callback to be notified whenever the playback stops. */
|
||||
std::function<void()> onPlaybackStopped;
|
||||
|
||||
/** Set this callback to be notified whenever an error occurs. Upon error, you
|
||||
may need to load the video again. */
|
||||
std::function<void (const String& /*error*/)> onErrorOccurred;
|
||||
|
||||
private:
|
||||
//==============================================================================
|
||||
struct Pimpl;
|
||||
std::unique_ptr<Pimpl> pimpl;
|
||||
|
||||
void resized() override;
|
||||
void timerCallback() override;
|
||||
|
||||
template <class FileOrURL>
|
||||
Result loadInternal (const FileOrURL&, bool);
|
||||
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (VideoComponent)
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace juce
|
||||
/*
|
||||
==============================================================================
|
||||
|
||||
This file is part of the JUCE library.
|
||||
Copyright (c) 2022 - 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 7 End-User License
|
||||
Agreement and JUCE Privacy Policy.
|
||||
|
||||
End User License Agreement: www.juce.com/juce-7-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.
|
||||
|
||||
==============================================================================
|
||||
*/
|
||||
|
||||
#ifndef JUCE_VIDEOCOMPONENT_H_INCLUDED
|
||||
#define JUCE_VIDEOCOMPONENT_H_INCLUDED
|
||||
|
||||
namespace juce
|
||||
{
|
||||
|
||||
//==============================================================================
|
||||
/**
|
||||
A component that can play a movie.
|
||||
|
||||
Use the load() method to open a video once you've added this component to
|
||||
a parent (or put it on the desktop).
|
||||
|
||||
@tags{Video}
|
||||
*/
|
||||
class JUCE_API VideoComponent : public Component,
|
||||
private Timer
|
||||
{
|
||||
public:
|
||||
//==============================================================================
|
||||
/** Creates an empty VideoComponent.
|
||||
|
||||
Use the loadAsync() or load() method to open a video once you've added
|
||||
this component to a parent (or put it on the desktop).
|
||||
|
||||
If useNativeControlsIfAvailable is enabled and a target OS has a video view with
|
||||
dedicated controls for transport etc, that view will be used. In opposite
|
||||
case a bare video view without any controls will be presented, allowing you to
|
||||
tailor your own UI. Currently this flag is used on iOS and 64bit macOS.
|
||||
Android, Windows and 32bit macOS will always use plain video views without
|
||||
dedicated controls.
|
||||
*/
|
||||
VideoComponent (bool useNativeControlsIfAvailable);
|
||||
|
||||
/** Destructor. */
|
||||
~VideoComponent() override;
|
||||
|
||||
//==============================================================================
|
||||
/** Tries to load a video from a local file.
|
||||
|
||||
This function is supported on macOS and Windows. For iOS and Android, use
|
||||
loadAsync() instead.
|
||||
|
||||
@returns an error if the file failed to be loaded correctly
|
||||
|
||||
@see loadAsync
|
||||
*/
|
||||
Result load (const File& file);
|
||||
|
||||
/** Tries to load a video from a URL.
|
||||
|
||||
This function is supported on macOS and Windows. For iOS and Android, use
|
||||
loadAsync() instead.
|
||||
|
||||
@returns an error if the file failed to be loaded correctly
|
||||
|
||||
@see loadAsync
|
||||
*/
|
||||
Result load (const URL& url);
|
||||
|
||||
/** Tries to load a video from a URL asynchronously. When finished, invokes the
|
||||
callback supplied to the function on the message thread.
|
||||
|
||||
This is the preferred way of loading content, since it works not only on
|
||||
macOS and Windows, but also on iOS and Android. On Windows, it will internally
|
||||
call load().
|
||||
|
||||
@see load
|
||||
*/
|
||||
void loadAsync (const URL& url, std::function<void (const URL&, Result)> loadFinishedCallback);
|
||||
|
||||
/** Closes the video and resets the component. */
|
||||
void closeVideo();
|
||||
|
||||
/** Returns true if a video is currently open. */
|
||||
bool isVideoOpen() const;
|
||||
|
||||
/** Returns the last file that was loaded.
|
||||
If nothing is open, or if it was a URL rather than a file, this will return File().
|
||||
*/
|
||||
File getCurrentVideoFile() const;
|
||||
|
||||
/** Returns the last URL that was loaded.
|
||||
If nothing is open, or if it was a file rather than a URL, this will return URL().
|
||||
*/
|
||||
URL getCurrentVideoURL() const;
|
||||
|
||||
//==============================================================================
|
||||
/** Returns the length of the video, in seconds. */
|
||||
double getVideoDuration() const;
|
||||
|
||||
/** Returns the video's natural size, in pixels.
|
||||
If no video is loaded, an empty rectangle will be returned.
|
||||
*/
|
||||
Rectangle<int> getVideoNativeSize() const;
|
||||
|
||||
/** Starts the video playing. */
|
||||
void play();
|
||||
|
||||
/** Stops the video playing. */
|
||||
void stop();
|
||||
|
||||
/** Returns true if the video is currently playing. */
|
||||
bool isPlaying() const;
|
||||
|
||||
/** Sets the video's position to a given time. */
|
||||
void setPlayPosition (double newPositionSeconds);
|
||||
|
||||
/** Returns the current play position of the video. */
|
||||
double getPlayPosition() const;
|
||||
|
||||
/** Changes the video playback rate.
|
||||
A value of 1.0 is normal speed, greater values will play faster, smaller
|
||||
values play more slowly.
|
||||
*/
|
||||
void setPlaySpeed (double newSpeed);
|
||||
|
||||
/** Returns the current play speed of the video. */
|
||||
double getPlaySpeed() const;
|
||||
|
||||
/** Changes the video's playback volume.
|
||||
@param newVolume the volume in the range 0 (silent) to 1.0 (full)
|
||||
*/
|
||||
void setAudioVolume (float newVolume);
|
||||
|
||||
/** Returns the video's playback volume.
|
||||
@returns the volume in the range 0 (silent) to 1.0 (full)
|
||||
*/
|
||||
float getAudioVolume() const;
|
||||
|
||||
#if JUCE_SYNC_VIDEO_VOLUME_WITH_OS_MEDIA_VOLUME
|
||||
/** Set this callback to be notified whenever OS global media volume changes.
|
||||
Currently used on Android only.
|
||||
*/
|
||||
std::function<void()> onGlobalMediaVolumeChanged;
|
||||
#endif
|
||||
|
||||
/** Set this callback to be notified whenever the playback starts. */
|
||||
std::function<void()> onPlaybackStarted;
|
||||
|
||||
/** Set this callback to be notified whenever the playback stops. */
|
||||
std::function<void()> onPlaybackStopped;
|
||||
|
||||
/** Set this callback to be notified whenever an error occurs. Upon error, you
|
||||
may need to load the video again. */
|
||||
std::function<void (const String& /*error*/)> onErrorOccurred;
|
||||
|
||||
private:
|
||||
//==============================================================================
|
||||
struct Pimpl;
|
||||
std::unique_ptr<Pimpl> pimpl;
|
||||
|
||||
void resized() override;
|
||||
void timerCallback() override;
|
||||
|
||||
template <class FileOrURL>
|
||||
Result loadInternal (const FileOrURL&, bool);
|
||||
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (VideoComponent)
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace juce
|
||||
|
Reference in New Issue
Block a user