diff --git a/libs/openFrameworks/app/ofAppEGLWindow.cpp b/libs/openFrameworks/app/ofAppEGLWindow.cpp index 32ffb81fcf8..c8ce785af90 100644 --- a/libs/openFrameworks/app/ofAppEGLWindow.cpp +++ b/libs/openFrameworks/app/ofAppEGLWindow.cpp @@ -1,3 +1,5 @@ +#ifdef __unix__ + #include "ofAppEGLWindow.h" #include "ofGraphics.h" // used in runAppViaInfiniteLoop() @@ -28,6 +30,13 @@ #include // strlen +using std::string; +using std::map; +using std::make_shared; +using std::shared_ptr; +using std::endl; +using std::queue; + // native events struct udev* udev; struct udev_monitor* mon; @@ -412,7 +421,7 @@ void ofAppEGLWindow::setup(const ofAppEGLWindowSettings & _settings) { // pDisplay = ofGetEnv("DISPLAY"); // bool bIsX11Available = (pDisplay != NULL); - bool bIsX11Available = ofGetEnv("DISPLAY") != NULL; + bool bIsX11Available = !ofGetEnv("DISPLAY").empty(); if(settings.eglWindowPreference == OF_APP_WINDOW_AUTO) { if(bIsX11Available) { @@ -1427,7 +1436,7 @@ void ofAppEGLWindow::setupNativeInput(){ tc.c_lflag &= ~ECHO; tc.c_lflag |= ECHONL; tcsetattr(STDIN_FILENO, TCSAFLUSH, &tc); - + mb.mouseButtonState = 0; kb.shiftPressed = false; @@ -1495,7 +1504,7 @@ void ofAppEGLWindow::printInput(){ void ofAppEGLWindow::destroyNativeInput(){ ofLogNotice("ofAppEGLWindow") << "destroyNativeInput()"; - + for(device::iterator iter = inputDevices.begin(); iter != inputDevices.end(); iter++){ if(iter->second >= 0){ ::close(iter->second); @@ -1517,7 +1526,7 @@ void ofAppEGLWindow::processInput(int fd, const char * node){ static ofMouseEventArgs mouseEvent; struct input_event ev; char key = 0; - + bool pushKeyEvent = false; bool pushMouseEvent = false; bool pushTouchEvent = false; @@ -1567,7 +1576,7 @@ void ofAppEGLWindow::processInput(int fd, const char * node){ pushMouseEvent = true; } }else if(ev.code == BTN_TOUCH){ - if(ev.value == 0){ // release + if(ev.value == 0){ // release touchEvent.type = ofTouchEventArgs::up; touchEvent.id = 0; mt[touchEvent.id] = 0; @@ -1731,7 +1740,7 @@ void ofAppEGLWindow::processInput(int fd, const char * node){ }else{ ofLogNotice("ofAppEGLWindow") << "readKeyboardEvents(): input_event.code is outside of our small range"; } - } + } } }else if (ev.type == EV_REL){ int axis = ev.code; @@ -1782,7 +1791,7 @@ void ofAppEGLWindow::processInput(int fd, const char * node){ pushTouchEvent = true; } } - else + else { if (mt[touchEvent.id] == 0){ touchEvent.type = ofTouchEventArgs::down; @@ -1840,8 +1849,8 @@ void ofAppEGLWindow::processInput(int fd, const char * node){ } } - - + + if(pushKeyEvent){ lock(); @@ -1849,7 +1858,7 @@ void ofAppEGLWindow::processInput(int fd, const char * node){ unlock(); pushKeyEvent = false; } - + if(pushMouseEvent){ // lock the thread for a moment while we copy the data lock(); @@ -1925,7 +1934,7 @@ void ofAppEGLWindow::readNativeUDevEvents() { removeInput(devnode); } } - + udev_device_unref(dev); }else{ ofLogNotice("ofAppEGLWindow") << "readNativeUDevEvents(): device returned by receive_device() is NULL"; @@ -2304,3 +2313,5 @@ void ofAppEGLWindow::handleX11Event(const XEvent& event){ }*/ } } + +#endif diff --git a/libs/openFrameworks/app/ofAppEGLWindow.h b/libs/openFrameworks/app/ofAppEGLWindow.h index 7ea433c6905..d1b521dbc3e 100644 --- a/libs/openFrameworks/app/ofAppEGLWindow.h +++ b/libs/openFrameworks/app/ofAppEGLWindow.h @@ -1,3 +1,5 @@ +#ifdef __unix__ + #pragma once #include "ofAppBaseWindow.h" @@ -10,6 +12,8 @@ #include #include + +#include #include enum ofAppEGLWindowType { @@ -268,7 +272,7 @@ class ofAppEGLWindow : public ofAppBaseGLESWindow, public ofThread { void readNativeUDevEvents(); void readNativeInputEvents(); - void processInput(int fd, const char * node); + void processInput(int fd, const char * node); void addInput(const char * node, bool isMouse); void removeInput(const char * node); void printInput(); @@ -285,3 +289,5 @@ class ofAppEGLWindow : public ofAppBaseGLESWindow, public ofThread { std::shared_ptr currentRenderer; static ofAppEGLWindow * instance; }; + +#endif diff --git a/libs/openFrameworks/graphics/ofCairoRenderer.h b/libs/openFrameworks/graphics/ofCairoRenderer.h index fa212d63d5a..9ea06da1d30 100644 --- a/libs/openFrameworks/graphics/ofCairoRenderer.h +++ b/libs/openFrameworks/graphics/ofCairoRenderer.h @@ -196,7 +196,7 @@ class ofCairoRenderer: public ofBaseRenderer{ std::stack projectionStack; std::stack modelViewStack; std::stack viewportStack; - + ofMatrixMode currentMatrixMode; std::vector sphereVerts; diff --git a/libs/openFrameworks/sound/ofMediaFoundationSoundPlayer.cpp b/libs/openFrameworks/sound/ofMediaFoundationSoundPlayer.cpp index 74d22dcbf08..07d0d5a3857 100644 --- a/libs/openFrameworks/sound/ofMediaFoundationSoundPlayer.cpp +++ b/libs/openFrameworks/sound/ofMediaFoundationSoundPlayer.cpp @@ -1,3 +1,4 @@ +#ifdef _WIN32 #include "ofMediaFoundationSoundPlayer.h" #include "ofLog.h" @@ -168,7 +169,7 @@ void ofMediaFoundationSoundPlayer::sCloseAudioSystems() { sNumInstances--; if (sNumInstances <= 0) { ofLogVerbose("ofMediaFoundationSoundPlayer") << " closing XAudio2."; - sCloseXAudio2(); + sCloseXAudio2(); } ofMediaFoundationUtils::CloseMediaFoundation(); if (sNumInstances < 0) { @@ -189,7 +190,7 @@ ofMediaFoundationSoundPlayer::~ofMediaFoundationSoundPlayer() { //-------------------- bool ofMediaFoundationSoundPlayer::load(const of::filesystem::path & fileName, bool stream) { unload(); - + auto filePath = fileName; std::string fileStr = ofPathToString(fileName); bool bStream = false; @@ -223,7 +224,7 @@ bool ofMediaFoundationSoundPlayer::load(const of::filesystem::path & fileName, b LPCWSTR path = filePath.c_str(); - + hr = MFCreateSourceReaderFromURL( path, @@ -255,14 +256,14 @@ bool ofMediaFoundationSoundPlayer::load(const of::filesystem::path & fileName, b hr = mSrcReader->GetNativeMediaType(MF_SOURCE_READER_FIRST_AUDIO_STREAM, 0, &nativeType); auto nativeTypePtr = std::unique_ptr(nativeType); - // get a wave format + // get a wave format hr = MFCreateWaveFormatExFromMFMediaType(nativeType, &nativeFormat, &formatSize); - + mNumChannels = nativeFormat->nChannels; mSampleRate = nativeFormat->nSamplesPerSec; CoTaskMemFree(nativeFormat); - + ComPtr mediaType; hr = MFCreateMediaType(mediaType.GetAddressOf()); @@ -335,7 +336,7 @@ bool ofMediaFoundationSoundPlayer::load(const of::filesystem::path & fileName, b } ofLogVerbose("ofMediaFoundationSoundPlayer::load") << "made it all the way to the end."; - + if (!mBStreaming) { mSrcReader.Reset(); mSrcReader = nullptr; @@ -343,11 +344,11 @@ bool ofMediaFoundationSoundPlayer::load(const of::filesystem::path & fileName, b { - // create stream context for listening to voice + // create stream context for listening to voice mVoiceContext = std::make_shared(); // Create the source voice IXAudio2SourceVoice* pSourceVoice = nullptr; - // setting max freq ratio to 3, though it may need to be higher to play at a + // setting max freq ratio to 3, though it may need to be higher to play at a // faster pitch if (mBStreaming) { hr = sXAudio2->CreateSourceVoice( @@ -430,7 +431,7 @@ void ofMediaFoundationSoundPlayer::unload() { mTotalNumFrames = 0; mNumSamplesAlreadyPlayed = 0; mBRequestNewReaderSample = false; - + LeaveCriticalSection(&m_critSec); }; @@ -467,7 +468,7 @@ void ofMediaFoundationSoundPlayer::update(ofEventArgs& args) { } else { bRequestStop = true; // we need to request stop outside of the scope of the lock - // since stop() also locks to set vars + // since stop() also locks to set vars } } } @@ -497,7 +498,7 @@ void ofMediaFoundationSoundPlayer::update(ofEventArgs& args) { if (!xstate.BuffersQueued && mExtraVoices.size() < 1) { // we have reached the end // if (mBLoop) { - // set isPlaying to false, so that it will create a new instance + // set isPlaying to false, so that it will create a new instance // for mVoice and not an Extra Voice mPosPct = 0.0f; mBIsPlaying = false; @@ -530,7 +531,7 @@ void ofMediaFoundationSoundPlayer::play() { return; } - // don't want a ton of loops going on here + // don't want a ton of loops going on here if (mBLoop) { stop(); } @@ -539,7 +540,7 @@ void ofMediaFoundationSoundPlayer::play() { } if (mBStreaming) { - // just in case, multiplay is not supported for streams + // just in case, multiplay is not supported for streams _clearExtraVoices(); } @@ -583,7 +584,7 @@ void ofMediaFoundationSoundPlayer::play() { XAUDIO2_BUFFER buffer = {}; buffer.pAudioData = mBuffer.data(); // tell the source voice not to expect any data after this buffer - buffer.Flags = XAUDIO2_END_OF_STREAM; + buffer.Flags = XAUDIO2_END_OF_STREAM; buffer.AudioBytes = mBuffer.size(); hr = pSourceVoice->SubmitSourceBuffer(&buffer); @@ -605,7 +606,7 @@ void ofMediaFoundationSoundPlayer::play() { buffer.AudioBytes = mBuffer.size(); mVoice->SubmitSourceBuffer(&buffer); - + } mVoice->SetVolume(mVolume); @@ -711,7 +712,7 @@ void ofMediaFoundationSoundPlayer::setPaused(bool bP) { //-------------------- void ofMediaFoundationSoundPlayer::setLoop(bool bLp) { if (bLp) { - // we don't want a lot of looping iterations + // we don't want a lot of looping iterations _clearExtraVoices(); } mBLoop = bLp; @@ -740,7 +741,7 @@ void ofMediaFoundationSoundPlayer::setPosition(float pct) { ofLogWarning("ofMediaFoundationSoundPlayer::setPosition") << " unable to seek."; return; } - + // ok we need to kill buffers and resubmit a buffer if (mVoice) { std::ignore = mVoice->Stop(); @@ -785,7 +786,7 @@ void ofMediaFoundationSoundPlayer::setPositionMS(int ms) { }; //-------------------- -float ofMediaFoundationSoundPlayer::getPosition() const { +float ofMediaFoundationSoundPlayer::getPosition() const { return mPosPct; }; @@ -880,7 +881,7 @@ void ofMediaFoundationSoundPlayer::OnSourceReaderEvent(HRESULT hrStatus, DWORD d } hr = mediaBuffer->Unlock(); - + if (mVoice && mVoiceContext) { XAUDIO2_VOICE_STATE state; @@ -909,7 +910,7 @@ void ofMediaFoundationSoundPlayer::OnSourceReaderEvent(HRESULT hrStatus, DWORD d std::unique_lock lk(mSrcReaderMutex); mBRequestNewReaderSample = true; } - + } } @@ -953,7 +954,7 @@ void ofMediaFoundationSoundPlayer::_setPan(IXAudio2SourceVoice* avoice, float ap float outputMatrix[8]; for (int i = 0; i < 8; i++) outputMatrix[i] = 0; - // pan of -1.0 indicates all left speaker, + // pan of -1.0 indicates all left speaker, // 1.0 is all right speaker, 0.0 is split between left and right float left = 0.5f - apan / 2; float right = 0.5f + apan / 2; @@ -990,7 +991,7 @@ void ofMediaFoundationSoundPlayer::_setPan(IXAudio2SourceVoice* avoice, float ap // Assuming pVoice sends to pMasteringVoice - // TODO: Cache this + // TODO: Cache this XAUDIO2_VOICE_DETAILS MasterVoiceDetails; sXAudioMasteringVoice->GetVoiceDetails(&MasterVoiceDetails); @@ -1019,7 +1020,7 @@ bool ofMediaFoundationSoundPlayer::_readToBuffer(IMFSourceReader* areader) { HRESULT hr = areader->ReadSample( MF_SOURCE_READER_FIRST_AUDIO_STREAM, 0, // Flags. - &streamIndex, // Receives the actual stream index. + &streamIndex, // Receives the actual stream index. &flags, // Receives status flags. &llAudioTimeStamp, // Receives the time stamp. &audioSample // Receives the sample or NULL. @@ -1049,14 +1050,14 @@ bool ofMediaFoundationSoundPlayer::_readToBuffer(IMFSourceReader* areader) { if (hr != S_OK) { continue; } - + size_t numFramesRead = uint64_t(sampleBufferLength) / (bytes64 * numChannels64); ofLogVerbose("ofMediaFoundationSoundPlayer::_readToBuffer") << "sampleBufferLength : " << sampleBufferLength << " num frames: " << numFramesRead << std::endl; totalFrames += numFramesRead; std::vector tempBuffer; tempBuffer.resize(sampleBufferLength, 0); memcpy_s(tempBuffer.data(), sampleBufferLength, audioData, sampleBufferLength); - // add into the main buffer? + // add into the main buffer? mBuffer.insert(mBuffer.end(), tempBuffer.begin(), tempBuffer.end()); hr = mediaBuffer->Unlock(); @@ -1073,3 +1074,5 @@ bool ofMediaFoundationSoundPlayer::_readToBuffer(IMFSourceReader* areader) { ofLogVerbose("ofMediaFoundationSoundPlayer::_readToBuffer") << "Total frames read: " << (totalFrames) << " mTotalNumFrames: " << mTotalNumFrames << " dur millis: " << durMillis << " dur seconds: " << durSeconds << std::endl; return mBuffer.size() > 0; } + +#endif diff --git a/libs/openFrameworks/sound/ofMediaFoundationSoundPlayer.h b/libs/openFrameworks/sound/ofMediaFoundationSoundPlayer.h index d064318bb8d..ba6352adca4 100644 --- a/libs/openFrameworks/sound/ofMediaFoundationSoundPlayer.h +++ b/libs/openFrameworks/sound/ofMediaFoundationSoundPlayer.h @@ -1,3 +1,5 @@ +#ifdef _WIN32 + #pragma once #include "ofSoundBaseTypes.h" @@ -214,7 +216,7 @@ class ofMediaFoundationSoundPlayer : public ofBaseSoundPlayer, public of::MFSour unsigned int mDurationMS = 0; // 2 = INT_16, 3 = INT_24 and 4 = FLOAT_32 - // TODO: Adjust this based on file loaded + // TODO: Adjust this based on file loaded unsigned char mBytesPerSample = 2; uint64_t mTotalNumFrames = 0; size_t mBufferIndex = 0; @@ -301,3 +303,5 @@ class ofMediaFoundationSoundPlayer : public ofBaseSoundPlayer, public of::MFSour std::mutex mSrcReaderMutex; bool mBRequestNewReaderSample = false; }; + +#endif diff --git a/libs/openFrameworks/utils/ofUtils.h b/libs/openFrameworks/utils/ofUtils.h index 7d21af90bc1..b98c3957949 100644 --- a/libs/openFrameworks/utils/ofUtils.h +++ b/libs/openFrameworks/utils/ofUtils.h @@ -3,11 +3,7 @@ // MARK: TARGET_MINGW test #include "ofConstants.h" -#if !defined(TARGET_MINGW) - #include -#else - #include // MSYS2 : use of system-installed include -#endif +#include // MSYS2 : use of system-installed include #include #include // For ofToBinary. @@ -336,7 +332,7 @@ class urn { prepare(); return *this; } - + /// \brief Construct an urn initialized with contents /// \param Args the values template diff --git a/libs/openFrameworks/video/ofDirectShowGrabber.h b/libs/openFrameworks/video/ofDirectShowGrabber.h index 96545e48dcb..d6b4685e4da 100644 --- a/libs/openFrameworks/video/ofDirectShowGrabber.h +++ b/libs/openFrameworks/video/ofDirectShowGrabber.h @@ -1,3 +1,5 @@ +#ifdef _WIN32 + #pragma once // MARK: OF_VIDEO_CAPTURE_DIRECTSHOW @@ -39,16 +41,16 @@ class ofDirectShowGrabber : public ofBaseVideoGrabber{ bool isInitialized() const; bool setPixelFormat(ofPixelFormat pixelFormat); - ofPixelFormat getPixelFormat() const; + ofPixelFormat getPixelFormat() const; ofPixels & getPixels(); const ofPixels & getPixels() const; - + void close(); void clearMemory(); void videoSettings(); - + float getWidth() const; float getHeight() const; @@ -57,24 +59,25 @@ class ofDirectShowGrabber : public ofBaseVideoGrabber{ void setDesiredFrameRate(int framerate); - + protected: - + bool bChooseDevice; int deviceID; bool bVerbose; bool bGrabberInited; ofPixels pixels; int attemptFramerate; - bool bIsFrameNew; - - int width, height; + bool bIsFrameNew; + + int width, height; //--------------------------------- directshow #ifdef OF_VIDEO_CAPTURE_DIRECTSHOW int device; videoInput VI; bool bDoWeNeedToResize; - #endif + #endif }; +#endif diff --git a/libs/openFrameworks/video/ofDirectShowPlayer.cpp b/libs/openFrameworks/video/ofDirectShowPlayer.cpp index 8dae2b2eec8..6d447532e50 100644 --- a/libs/openFrameworks/video/ofDirectShowPlayer.cpp +++ b/libs/openFrameworks/video/ofDirectShowPlayer.cpp @@ -1,3 +1,5 @@ +#ifdef _WIN32 + #include "ofDirectShowPlayer.h" #include "ofPixels.h" // MARK: pixels, srcBuffer @@ -7,7 +9,7 @@ //------------------------------------------------------------------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------------------------------------------------------------------- -// DirectShow includes and helper methods +// DirectShow includes and helper methods //------------------------------------------------------------------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------------------------------------------------------------------- @@ -31,210 +33,210 @@ MIDL_INTERFACE("0579154A-2B53-4994-B0D0-E773148EFF85") ISampleGrabberCB : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE SampleCB( + virtual HRESULT STDMETHODCALLTYPE SampleCB( double SampleTime, IMediaSample *pSample) = 0; - - virtual HRESULT STDMETHODCALLTYPE BufferCB( + + virtual HRESULT STDMETHODCALLTYPE BufferCB( double SampleTime, BYTE *pBuffer, long BufferLen) = 0; - + }; MIDL_INTERFACE("6B652FFF-11FE-4fce-92AD-0266B5D7C78F") ISampleGrabber : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE SetOneShot( + virtual HRESULT STDMETHODCALLTYPE SetOneShot( BOOL OneShot) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetMediaType( + + virtual HRESULT STDMETHODCALLTYPE SetMediaType( const AM_MEDIA_TYPE *pType) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetConnectedMediaType( + + virtual HRESULT STDMETHODCALLTYPE GetConnectedMediaType( AM_MEDIA_TYPE *pType) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetBufferSamples( + + virtual HRESULT STDMETHODCALLTYPE SetBufferSamples( BOOL BufferThem) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetCurrentBuffer( + + virtual HRESULT STDMETHODCALLTYPE GetCurrentBuffer( /* [out][in] */ long *pBufferSize, /* [out] */ long *pBuffer) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetCurrentSample( + + virtual HRESULT STDMETHODCALLTYPE GetCurrentSample( /* [retval][out] */ IMediaSample **ppSample) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetCallback( + + virtual HRESULT STDMETHODCALLTYPE SetCallback( ISampleGrabberCB *pCallback, long WhichMethodToCallback) = 0; - + }; EXTERN_C const CLSID CLSID_SampleGrabber; EXTERN_C const IID IID_ISampleGrabber; EXTERN_C const CLSID CLSID_NullRenderer; -// GetUnconnectedPin -// Finds an unconnected pin on a filter in the desired direction -HRESULT GetUnconnectedPin( - IBaseFilter *pFilter, // Pointer to the filter. - PIN_DIRECTION PinDir, // Direction of the pin to find. - IPin **ppPin) // Receives a pointer to the pin. -{ - *ppPin = 0; - IEnumPins *pEnum = 0; - IPin *pPin = 0; - HRESULT hr = pFilter->EnumPins(&pEnum); - if (FAILED(hr)) - { - return hr; - } - while (pEnum->Next(1, &pPin, NULL) == S_OK) - { - PIN_DIRECTION ThisPinDir; - pPin->QueryDirection(&ThisPinDir); - if (ThisPinDir == PinDir) - { - IPin *pTmp = 0; - hr = pPin->ConnectedTo(&pTmp); - if (SUCCEEDED(hr)) // Already connected, not the pin we want. - { - pTmp->Release(); - } - else // Unconnected, this is the pin we want. - { - pEnum->Release(); - *ppPin = pPin; - return S_OK; - } - } - pPin->Release(); - } - pEnum->Release(); - // Did not find a matching pin. - return E_FAIL; -} - -// Disconnect any connections to the filter. -HRESULT DisconnectPins(IBaseFilter *pFilter) -{ - IEnumPins *pEnum = 0; - IPin *pPin = 0; - HRESULT hr = pFilter->EnumPins(&pEnum); - if (FAILED(hr)) - { - return hr; - } - - while (pEnum->Next(1, &pPin, NULL) == S_OK) - { - pPin->Disconnect(); - pPin->Release(); - } - pEnum->Release(); - - // Did not find a matching pin. - return S_OK; -} - -// ConnectFilters -// Connects a pin of an upstream filter to the pDest downstream filter -HRESULT ConnectFilters( - IGraphBuilder *pGraph, // Filter Graph Manager. - IPin *pOut, // Output pin on the upstream filter. - IBaseFilter *pDest) // Downstream filter. -{ - if ((pGraph == NULL) || (pOut == NULL) || (pDest == NULL)) - { - return E_POINTER; - } -#ifdef debug - PIN_DIRECTION PinDir; - pOut->QueryDirection(&PinDir); - _ASSERTE(PinDir == PINDIR_OUTPUT); -#endif - - // Find an input pin on the downstream filter. - IPin *pIn = 0; - HRESULT hr = GetUnconnectedPin(pDest, PINDIR_INPUT, &pIn); - if (FAILED(hr)) - { - return hr; - } - // Try to connect them. - hr = pGraph->Connect(pOut, pIn); - pIn->Release(); - return hr; -} - - - -// ConnectFilters -// Connects two filters -HRESULT ConnectFilters( - IGraphBuilder *pGraph, - IBaseFilter *pSrc, - IBaseFilter *pDest) -{ - if ((pGraph == NULL) || (pSrc == NULL) || (pDest == NULL)) - { - return E_POINTER; - } - - // Find an output pin on the first filter. - IPin *pOut = 0; - HRESULT hr = GetUnconnectedPin(pSrc, PINDIR_OUTPUT, &pOut); - if (FAILED(hr)) - { - return hr; - } - hr = ConnectFilters(pGraph, pOut, pDest); - pOut->Release(); - return hr; -} - -// LocalFreeMediaType -// Free the format buffer in the media type -void LocalFreeMediaType(AM_MEDIA_TYPE& mt) -{ - if (mt.cbFormat != 0) - { - CoTaskMemFree((PVOID)mt.pbFormat); - mt.cbFormat = 0; - mt.pbFormat = NULL; - } - if (mt.pUnk != NULL) - { - // Unecessary because pUnk should not be used, but safest. - mt.pUnk->Release(); - mt.pUnk = NULL; - } -} - -// LocalDeleteMediaType -// Free the format buffer in the media type, -// then delete the MediaType ptr itself -void LocalDeleteMediaType(AM_MEDIA_TYPE *pmt) -{ - if (pmt != NULL) - { - LocalFreeMediaType(*pmt); // See FreeMediaType for the implementation. - CoTaskMemFree(pmt); - } +// GetUnconnectedPin +// Finds an unconnected pin on a filter in the desired direction +HRESULT GetUnconnectedPin( + IBaseFilter *pFilter, // Pointer to the filter. + PIN_DIRECTION PinDir, // Direction of the pin to find. + IPin **ppPin) // Receives a pointer to the pin. +{ + *ppPin = 0; + IEnumPins *pEnum = 0; + IPin *pPin = 0; + HRESULT hr = pFilter->EnumPins(&pEnum); + if (FAILED(hr)) + { + return hr; + } + while (pEnum->Next(1, &pPin, NULL) == S_OK) + { + PIN_DIRECTION ThisPinDir; + pPin->QueryDirection(&ThisPinDir); + if (ThisPinDir == PinDir) + { + IPin *pTmp = 0; + hr = pPin->ConnectedTo(&pTmp); + if (SUCCEEDED(hr)) // Already connected, not the pin we want. + { + pTmp->Release(); + } + else // Unconnected, this is the pin we want. + { + pEnum->Release(); + *ppPin = pPin; + return S_OK; + } + } + pPin->Release(); + } + pEnum->Release(); + // Did not find a matching pin. + return E_FAIL; +} + +// Disconnect any connections to the filter. +HRESULT DisconnectPins(IBaseFilter *pFilter) +{ + IEnumPins *pEnum = 0; + IPin *pPin = 0; + HRESULT hr = pFilter->EnumPins(&pEnum); + if (FAILED(hr)) + { + return hr; + } + + while (pEnum->Next(1, &pPin, NULL) == S_OK) + { + pPin->Disconnect(); + pPin->Release(); + } + pEnum->Release(); + + // Did not find a matching pin. + return S_OK; +} + +// ConnectFilters +// Connects a pin of an upstream filter to the pDest downstream filter +HRESULT ConnectFilters( + IGraphBuilder *pGraph, // Filter Graph Manager. + IPin *pOut, // Output pin on the upstream filter. + IBaseFilter *pDest) // Downstream filter. +{ + if ((pGraph == NULL) || (pOut == NULL) || (pDest == NULL)) + { + return E_POINTER; + } +#ifdef debug + PIN_DIRECTION PinDir; + pOut->QueryDirection(&PinDir); + _ASSERTE(PinDir == PINDIR_OUTPUT); +#endif + + // Find an input pin on the downstream filter. + IPin *pIn = 0; + HRESULT hr = GetUnconnectedPin(pDest, PINDIR_INPUT, &pIn); + if (FAILED(hr)) + { + return hr; + } + // Try to connect them. + hr = pGraph->Connect(pOut, pIn); + pIn->Release(); + return hr; +} + + + +// ConnectFilters +// Connects two filters +HRESULT ConnectFilters( + IGraphBuilder *pGraph, + IBaseFilter *pSrc, + IBaseFilter *pDest) +{ + if ((pGraph == NULL) || (pSrc == NULL) || (pDest == NULL)) + { + return E_POINTER; + } + + // Find an output pin on the first filter. + IPin *pOut = 0; + HRESULT hr = GetUnconnectedPin(pSrc, PINDIR_OUTPUT, &pOut); + if (FAILED(hr)) + { + return hr; + } + hr = ConnectFilters(pGraph, pOut, pDest); + pOut->Release(); + return hr; +} + +// LocalFreeMediaType +// Free the format buffer in the media type +void LocalFreeMediaType(AM_MEDIA_TYPE& mt) +{ + if (mt.cbFormat != 0) + { + CoTaskMemFree((PVOID)mt.pbFormat); + mt.cbFormat = 0; + mt.pbFormat = NULL; + } + if (mt.pUnk != NULL) + { + // Unecessary because pUnk should not be used, but safest. + mt.pUnk->Release(); + mt.pUnk = NULL; + } +} + +// LocalDeleteMediaType +// Free the format buffer in the media type, +// then delete the MediaType ptr itself +void LocalDeleteMediaType(AM_MEDIA_TYPE *pmt) +{ + if (pmt != NULL) + { + LocalFreeMediaType(*pmt); // See FreeMediaType for the implementation. + CoTaskMemFree(pmt); + } } -HRESULT SaveGraphFile(IGraphBuilder *pGraph, WCHAR *wszPath) +HRESULT SaveGraphFile(IGraphBuilder *pGraph, WCHAR *wszPath) { - const WCHAR wszStreamName[] = L"ActiveMovieGraph"; + const WCHAR wszStreamName[] = L"ActiveMovieGraph"; HRESULT hr; - + IStorage *pStorage = NULL; hr = StgCreateDocfile( wszPath, STGM_CREATE | STGM_TRANSACTED | STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, &pStorage); - if(FAILED(hr)) + if(FAILED(hr)) { return hr; } @@ -244,9 +246,9 @@ HRESULT SaveGraphFile(IGraphBuilder *pGraph, WCHAR *wszPath) wszStreamName, STGM_WRITE | STGM_CREATE | STGM_SHARE_EXCLUSIVE, 0, 0, &pStream); - if (FAILED(hr)) + if (FAILED(hr)) { - pStorage->Release(); + pStorage->Release(); return hr; } @@ -255,7 +257,7 @@ HRESULT SaveGraphFile(IGraphBuilder *pGraph, WCHAR *wszPath) hr = pPersist->Save(pStream, TRUE); pStream->Release(); pPersist->Release(); - if (SUCCEEDED(hr)) + if (SUCCEEDED(hr)) { hr = pStorage->Commit(STGC_DEFAULT); } @@ -307,12 +309,12 @@ class DirectShowVideo : public ISampleGrabberCB{ tearDown(); middleSample.reset(); backSample.reset(); - releaseCom(); + releaseCom(); DeleteCriticalSection(&critSection); } void tearDown(){ - //printf("tearDown\n"); + //printf("tearDown\n"); if(m_pControl){ m_pControl->Release(); @@ -347,17 +349,17 @@ class DirectShowVideo : public ISampleGrabberCB{ if( m_pPosition ){ m_pPosition->Release(); } - clearValues(); + clearValues(); } void clearValues(){ hr = 0; m_pGraph = NULL; - m_pControl = NULL; - m_pEvent = NULL; - m_pSeek = NULL; - m_pAudio = NULL; + m_pControl = NULL; + m_pEvent = NULL; + m_pSeek = NULL; + m_pAudio = NULL; m_pGrabber = NULL; m_pGrabberF = NULL; m_pBasicVideo = NULL; @@ -365,26 +367,26 @@ class DirectShowVideo : public ISampleGrabberCB{ m_pSourceFile = NULL; m_pPosition = NULL; - timeNow = 0; - lPositionInSecs = 0; - lDurationInNanoSecs = 0; - lTotalDuration = 0; - rtNew = 0; - lPosition = 0; + timeNow = 0; + lPositionInSecs = 0; + lDurationInNanoSecs = 0; + lTotalDuration = 0; + rtNew = 0; + lPosition = 0; lvolume = -1000; - evCode = 0; - width = height = 0; - bVideoOpened = false; + evCode = 0; + width = height = 0; + bVideoOpened = false; bLoop = true; bPaused = false; bPlaying = false; - bEndReached = false; + bEndReached = false; bNewPixels = false; bFrameNew = false; - curMovieFrame = -1; + curMovieFrame = -1; frameCount = -1; - movieRate = 1.0; + movieRate = 1.0; averageTimePerFrame = 1.0/30.0; } @@ -403,7 +405,7 @@ class DirectShowVideo : public ISampleGrabberCB{ //------------------------------------------------ STDMETHODIMP SampleCB(double Time, IMediaSample *pSample){ - BYTE * ptrBuffer = NULL; + BYTE * ptrBuffer = NULL; HRESULT hr = pSample->GetPointer(&ptrBuffer); if(hr == S_OK){ @@ -437,71 +439,71 @@ class DirectShowVideo : public ISampleGrabberCB{ // Create the Filter Graph Manager and query for interfaces. - //printf("step 1\n"); + //printf("step 1\n"); hr = CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER,IID_IGraphBuilder, (void **)&m_pGraph); if (FAILED(hr)){ - tearDown(); + tearDown(); return false; } - //printf("step 2\n"); + //printf("step 2\n"); hr = m_pGraph->QueryInterface(IID_IMediaSeeking, (void**)&m_pSeek); if (FAILED(hr)){ - tearDown(); + tearDown(); return false; } hr = m_pGraph->QueryInterface(IID_IMediaPosition, (LPVOID *)&m_pPosition); if (FAILED(hr)){ - tearDown(); + tearDown(); return false; } hr = m_pGraph->QueryInterface(IID_IBasicAudio,(void**)&m_pAudio); if (FAILED(hr)){ - tearDown(); + tearDown(); return false; } // Use IGraphBuilder::QueryInterface (inherited from IUnknown) to get the IMediaControl interface. - //printf("step 4\n"); + //printf("step 4\n"); hr = m_pGraph->QueryInterface(IID_IMediaControl, (void **)&m_pControl); if (FAILED(hr)){ - tearDown(); + tearDown(); return false; - } - + } + // And get the Media Event interface, too. - //printf("step 5\n"); + //printf("step 5\n"); hr = m_pGraph->QueryInterface(IID_IMediaEvent, (void **)&m_pEvent); if (FAILED(hr)){ - tearDown(); + tearDown(); return false; - } + } //SAMPLE GRABBER (ALLOWS US TO GRAB THE BUFFER)// // Create the Sample Grabber. hr = CoCreateInstance(CLSID_SampleGrabber, NULL, CLSCTX_INPROC_SERVER,IID_IBaseFilter, (void**)&m_pGrabberF); if (FAILED(hr)){ - tearDown(); + tearDown(); return false; - } + } hr = m_pGraph->AddFilter(m_pGrabberF, L"Sample Grabber"); if (FAILED(hr)){ - tearDown(); + tearDown(); return false; } hr = m_pGrabberF->QueryInterface(IID_ISampleGrabber, (void**)&m_pGrabber); if (FAILED(hr)){ - tearDown(); + tearDown(); return false; } hr = m_pGrabber->SetCallback(this, 0); if (FAILED(hr)){ - tearDown(); + tearDown(); return false; } @@ -526,48 +528,48 @@ class DirectShowVideo : public ISampleGrabberCB{ } mt.formattype = FORMAT_VideoInfo; - //printf("step 5.5\n"); + //printf("step 5.5\n"); hr = m_pGrabber->SetMediaType(&mt); if (FAILED(hr)){ - tearDown(); + tearDown(); return false; } - //printf("step 6\n"); + //printf("step 6\n"); //this is the easier way to connect the graph, but we have to remove the video window manually hr = m_pGraph->RenderFile(path.c_str(), NULL); //this is the more manual way to do it - its a pain though because the audio won't be connected by default - /*hr = m_pGraph->AddSourceFilter(filePathW.c_str(), L"Source", &m_pSourceFile); + /*hr = m_pGraph->AddSourceFilter(filePathW.c_str(), L"Source", &m_pSourceFile); if (FAILED(hr)){ printf("unable to AddSourceFilter\n"); - tearDown(); + tearDown(); return false; }*/ //hr = ConnectFilters(m_pGraph, m_pSourceFile, m_pGrabberF); //if (FAILED(hr)){ // printf("unable to ConnectFilters(m_pGraph, m_pSourceFile, m_pGrabberF)\n"); - // tearDown(); + // tearDown(); // return false; //} - //printf("step 7\n"); + //printf("step 7\n"); if (SUCCEEDED(hr)){ //Set Params - One Shot should be false unless you want to capture just one buffer hr = m_pGrabber->SetOneShot(FALSE); if (FAILED(hr)){ printf("unable to set one shot\n"); - tearDown(); + tearDown(); return false; } - + //apparently setting to TRUE causes a small memory leak hr = m_pGrabber->SetBufferSamples(FALSE); if (FAILED(hr)){ printf("unable to set buffer samples\n"); - tearDown(); + tearDown(); return false; } @@ -576,31 +578,31 @@ class DirectShowVideo : public ISampleGrabberCB{ hr = CoCreateInstance(CLSID_NullRenderer, NULL, CLSCTX_INPROC_SERVER, IID_IBaseFilter, (void**)(&m_pNullRenderer)); if (FAILED(hr)){ printf("null renderer error\n"); - tearDown(); + tearDown(); return false; - } + } hr = m_pGraph->AddFilter(m_pNullRenderer, L"Render"); if (FAILED(hr)){ printf("unable to add null renderer\n"); - tearDown(); + tearDown(); return false; } - + //hr = ConnectFilters(m_pGraph, m_pGrabberF, m_pNullRenderer); //if (FAILED(hr)){ // printf("unable to ConnectFilters(m_pGraph, m_pGrabberF, m_pNullRenderer)\n"); - // tearDown(); + // tearDown(); // return false; //} - + AM_MEDIA_TYPE mt; ZeroMemory(&mt,sizeof(AM_MEDIA_TYPE)); - + hr = m_pGrabber->GetConnectedMediaType(&mt); if (FAILED(hr)){ printf("unable to call GetConnectedMediaType\n"); - tearDown(); + tearDown(); return false; } @@ -610,7 +612,7 @@ class DirectShowVideo : public ISampleGrabberCB{ averageTimePerFrame = infoheader->AvgTimePerFrame / 10000000.0; pixels.allocate(width, height, pixelFormat); - //printf("video dimensions are %i %i\n", width, height); + //printf("video dimensions are %i %i\n", width, height); //we need to manually change the output from the renderer window to the null renderer IBaseFilter * m_pVideoRenderer; @@ -648,7 +650,7 @@ class DirectShowVideo : public ISampleGrabberCB{ //we have to remove it as well otherwise the graph builder will reconnect it hr = m_pGraph->RemoveFilter(m_pVideoRenderer); - if (FAILED(hr)){ + if (FAILED(hr)){ printf("failed to remove the default renderer\n"); tearDown(); return false; @@ -658,24 +660,24 @@ class DirectShowVideo : public ISampleGrabberCB{ //now connect the null renderer to the grabber output, if we don't do this not frames will be captured hr = m_pNullRenderer->FindPin(L"In", &pinIn); - if (FAILED(hr)){ + if (FAILED(hr)){ printf("failed to find the input pin of the null renderer\n"); tearDown(); return false; } hr = pinOut->Connect(pinIn, NULL); - if (FAILED(hr)){ + if (FAILED(hr)){ printf("failed to connect the null renderer\n"); tearDown(); return false; } - //printf("step 8\n"); + //printf("step 8\n"); // Run the graph. - + //SaveGraphFile(m_pGraph, L"test2.grf"); - hr = m_pControl->Run(); + hr = m_pControl->Run(); //SaveGraphFile(m_pGraph, L"test3.grf"); // Now pause the graph. @@ -685,16 +687,16 @@ class DirectShowVideo : public ISampleGrabberCB{ if( FAILED(hr) || width == 0 || height == 0 ){ tearDown(); printf("Error occured while playing or pausing or opening the file\n"); - return false; + return false; } }else{ tearDown(); printf("Error occured while playing or pausing or opening the file\n"); - return false; + return false; } bVideoOpened = true; - return true; + return true; } void update(){ @@ -711,7 +713,7 @@ class DirectShowVideo : public ISampleGrabberCB{ if( curMovieFrame != frameCount ){ bFrameNew = true; }else{ - bFrameNew = false; + bFrameNew = false; } curMovieFrame = frameCount; @@ -721,10 +723,10 @@ class DirectShowVideo : public ISampleGrabberCB{ //printf("Restarting!\n"); setPosition(0.0); }else{ - bEndReached = true; + bEndReached = true; //printf("movie end reached!\n"); stop(); - updatePlayState(); + updatePlayState(); } } //printf("Event code: %#04x\n Params: %d, %d\n", eventCode, ptrParam1, ptrParam2); @@ -739,9 +741,9 @@ class DirectShowVideo : public ISampleGrabberCB{ //volume has to be log corrected/converted void setVolume(float volPct){ - if( isLoaded() ){ + if( isLoaded() ){ if( volPct < 0 ) volPct = 0.0; - if( volPct > 1 ) volPct = 1.0; + if( volPct > 1 ) volPct = 1.0; long vol = log10(volPct) * 4000.0; if(vol < -8000){ @@ -785,25 +787,25 @@ class DirectShowVideo : public ISampleGrabberCB{ void setPosition(float pct){ if( bVideoOpened ){ - if( pct < 0.0 ) pct = 0.0; - if( pct > 1.0 ) pct = 1.0; - + if( pct < 0.0 ) pct = 0.0; + if( pct > 1.0 ) pct = 1.0; + long long lDurationInNanoSecs = 0; m_pSeek->GetDuration(&lDurationInNanoSecs); - rtNew = ((float)lDurationInNanoSecs * pct); + rtNew = ((float)lDurationInNanoSecs * pct); hr = m_pSeek->SetPositions(&rtNew, AM_SEEKING_AbsolutePositioning,NULL,AM_SEEKING_NoPositioning); } } float getPosition(){ if( bVideoOpened ){ - float timeDur = getDurationInSeconds(); + float timeDur = getDurationInSeconds(); if( timeDur > 0.0 ){ - return getCurrentTimeInSeconds() / timeDur; + return getCurrentTimeInSeconds() / timeDur; } } - return 0.0; + return 0.0; } void setSpeed(float speed){ @@ -866,8 +868,8 @@ class DirectShowVideo : public ISampleGrabberCB{ void play(){ if( bVideoOpened ){ - m_pControl->Run(); - bEndReached = false; + m_pControl->Run(); + bEndReached = false; updatePlayState(); } } @@ -875,7 +877,7 @@ class DirectShowVideo : public ISampleGrabberCB{ void stop(){ if( bVideoOpened ){ if( isPlaying() ){ - setPosition(0.0); + setPosition(0.0); } m_pControl->Stop(); updatePlayState(); @@ -885,13 +887,13 @@ class DirectShowVideo : public ISampleGrabberCB{ void setPaused(bool bPaused){ if( bVideoOpened ){ if( bPaused ){ - m_pControl->Pause(); + m_pControl->Pause(); }else{ - m_pControl->Run(); + m_pControl->Run(); } updatePlayState(); } - + } void updatePlayState(){ @@ -900,7 +902,7 @@ class DirectShowVideo : public ISampleGrabberCB{ hr = m_pControl->GetState(4000, (OAFilterState*)&fs); if(hr==S_OK){ if( fs == State_Running ){ - bPlaying = true; + bPlaying = true; bPaused = false; } else if( fs == State_Paused ){ @@ -923,11 +925,11 @@ class DirectShowVideo : public ISampleGrabberCB{ } bool isLooping(){ - return bLoop; + return bLoop; } void setLoop(bool loop){ - bLoop = loop; + bLoop = loop; } bool isMovieDone(){ @@ -950,9 +952,9 @@ class DirectShowVideo : public ISampleGrabberCB{ //we have to do it like this as the frame based approach is not very accurate if( bVideoOpened && ( isPlaying() || isPaused() ) ){ int curFrame = getCurrentFrameNo(); - float curFrameF = curFrame; + float curFrameF = curFrame; for(int i = 1; i < 20; i++){ - setAproximateFrameF( curFrameF + 0.3 * (float)i ); + setAproximateFrameF( curFrameF + 0.3 * (float)i ); if( getCurrentFrameNo() >= curFrame + 1 ){ break; } @@ -964,9 +966,9 @@ class DirectShowVideo : public ISampleGrabberCB{ //we have to do it like this as the frame based approach is not very accurate if( bVideoOpened && ( isPlaying() || isPaused() ) ){ int curFrame = getCurrentFrameNo(); - float curFrameF = curFrame; + float curFrameF = curFrame; for(int i = 1; i < 20; i++){ - setAproximateFrameF( curFrameF - 0.3 * (float)i ); + setAproximateFrameF( curFrameF - 0.3 * (float)i ); if( getCurrentFrameNo() <= curFrame + 1 ){ break; } @@ -977,31 +979,31 @@ class DirectShowVideo : public ISampleGrabberCB{ void setAproximateFrameF(float frameF){ if( bVideoOpened ){ float pct = frameF / (float)getAproximateNoFrames(); - if( pct > 1.0 ) pct = 1.0; - if( pct < 0.0 ) pct = 0.0; - setPosition(pct); + if( pct > 1.0 ) pct = 1.0; + if( pct < 0.0 ) pct = 0.0; + setPosition(pct); } } void setAproximateFrame(int frame){ if( bVideoOpened ){ float pct = (float)frame / (float)getAproximateNoFrames(); - if( pct > 1.0 ) pct = 1.0; - if( pct < 0.0 ) pct = 0.0; - setPosition(pct); + if( pct > 1.0 ) pct = 1.0; + if( pct < 0.0 ) pct = 0.0; + setPosition(pct); } } int getCurrentFrameNo(){ if( bVideoOpened ){ - return getPosition() * (float) getAproximateNoFrames(); + return getPosition() * (float) getAproximateNoFrames(); } - return 0; + return 0; } int getAproximateNoFrames(){ if( bVideoOpened && averageTimePerFrame > 0.0 ){ - return getDurationInSeconds() / averageTimePerFrame; + return getDurationInSeconds() / averageTimePerFrame; } return 0; } @@ -1053,11 +1055,11 @@ class DirectShowVideo : public ISampleGrabberCB{ //this is the non-callback approach //void getPixels(unsigned char * dstBuffer){ - // + // // if(bVideoOpened && isFrameNew()){ - // long bufferSize = videoSize; + // long bufferSize = videoSize; // HRESULT hr = m_pGrabber->GetCurrentBuffer(&bufferSize, (long *)rawBuffer); - // + // // if(hr==S_OK){ // if (videoSize == bufferSize){ // processPixels(rawBuffer, dstBuffer, width, height, true, true); @@ -1077,11 +1079,11 @@ class DirectShowVideo : public ISampleGrabberCB{ IMediaControl *m_pControl; // Media Control interface IMediaEvent *m_pEvent; // Media Event interface IMediaSeeking *m_pSeek; // Media Seeking interface - IMediaPosition * m_pPosition; - IBasicAudio *m_pAudio; // Audio Settings interface + IMediaPosition * m_pPosition; + IBasicAudio *m_pAudio; // Audio Settings interface ISampleGrabber * m_pGrabber; IBaseFilter * m_pSourceFile; - IBaseFilter * m_pGrabberF; + IBaseFilter * m_pGrabberF; IBasicVideo * m_pBasicVideo; IBaseFilter * m_pNullRenderer; @@ -1089,21 +1091,21 @@ class DirectShowVideo : public ISampleGrabberCB{ LONGLONG lPositionInSecs; // Time in seconds LONGLONG lDurationInNanoSecs; // Duration in nanoseconds LONGLONG lTotalDuration; // Total duration - REFERENCE_TIME rtNew; // Reference time of movie + REFERENCE_TIME rtNew; // Reference time of movie long lPosition; // Desired position of movie used in FF & REW - long lvolume; // The volume level in 1/100ths dB Valid values range from -10,000 (silence) to 0 (full volume), 0 = 0 dB -10000 = -100 dB + long lvolume; // The volume level in 1/100ths dB Valid values range from -10,000 (silence) to 0 (full volume), 0 = 0 dB -10000 = -100 dB long evCode; // event variable, used to in file to complete wait. long width, height; - double averageTimePerFrame; + double averageTimePerFrame; bool bFrameNew; bool bNewPixels; bool bVideoOpened; - bool bPlaying; + bool bPlaying; bool bPaused; - bool bLoop; + bool bLoop; bool bEndReached; double movieRate; int curMovieFrame; @@ -1121,7 +1123,7 @@ class DirectShowVideo : public ISampleGrabberCB{ //---------------------------------------------------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------------------------------------------------- -// OF SPECIFIC IMPLEMENTATION BELOW +// OF SPECIFIC IMPLEMENTATION BELOW //---------------------------------------------------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------------------------------------------------- @@ -1142,7 +1144,7 @@ ofDirectShowPlayer & ofDirectShowPlayer::operator=(ofDirectShowPlayer&& other) { } player = std::move(other.player); - pixelFormat = std::move(other.pixelFormat); + pixelFormat = std::move(other.pixelFormat); return *this; } @@ -1179,10 +1181,10 @@ void ofDirectShowPlayer::stop(){ if( player && player->isLoaded() ){ player->stop(); } -} - +} + bool ofDirectShowPlayer::isFrameNew() const{ - return ( player && player->isFrameNew() ); + return ( player && player->isFrameNew() ); } const ofPixels & ofDirectShowPlayer::getPixels() const{ @@ -1197,7 +1199,7 @@ float ofDirectShowPlayer::getWidth() const{ if( player && player->isLoaded() ){ return player->getWidth(); } - return 0.0; + return 0.0; } float ofDirectShowPlayer::getHeight() const{ @@ -1206,18 +1208,18 @@ float ofDirectShowPlayer::getHeight() const{ } return 0.0; } - + bool ofDirectShowPlayer::isPaused() const{ - return ( player && player->isPaused() ); + return ( player && player->isPaused() ); } bool ofDirectShowPlayer::isLoaded() const{ - return ( player && player->isLoaded() ); + return ( player && player->isLoaded() ); } bool ofDirectShowPlayer::isPlaying() const{ - return ( player && player->isPlaying() ); -} + return ( player && player->isPlaying() ); +} bool ofDirectShowPlayer::setPixelFormat(ofPixelFormat pixelFormat){ switch (pixelFormat) { @@ -1233,9 +1235,9 @@ bool ofDirectShowPlayer::setPixelFormat(ofPixelFormat pixelFormat){ } ofPixelFormat ofDirectShowPlayer::getPixelFormat() const{ - return this->pixelFormat; + return this->pixelFormat; } - + //should implement! float ofDirectShowPlayer::getPosition() const{ if( player && player->isLoaded() ){ @@ -1248,7 +1250,7 @@ float ofDirectShowPlayer::getSpeed() const{ if( player && player->isLoaded() ){ return player->getSpeed(); } - return 0.0; + return 0.0; } float ofDirectShowPlayer::getDuration() const{ @@ -1260,9 +1262,9 @@ float ofDirectShowPlayer::getDuration() const{ bool ofDirectShowPlayer::getIsMovieDone() const{ - return ( player && player->isMovieDone() ); + return ( player && player->isMovieDone() ); } - + void ofDirectShowPlayer::setPaused(bool bPause){ if( player && player->isLoaded() ){ player->setPaused(bPause); @@ -1296,22 +1298,22 @@ void ofDirectShowPlayer::setLoopState(ofLoopType state){ void ofDirectShowPlayer::setSpeed(float speed){ if( player && player->isLoaded() ){ - player->setSpeed(speed); + player->setSpeed(speed); } } - + int ofDirectShowPlayer::getCurrentFrame() const{ if( player && player->isLoaded() ){ return player->getCurrentFrameNo(); } - return 0; + return 0; } int ofDirectShowPlayer::getTotalNumFrames() const{ if( player && player->isLoaded() ){ return player->getAproximateNoFrames(); } - return 0; + return 0; } ofLoopType ofDirectShowPlayer::getLoopState() const{ @@ -1319,20 +1321,20 @@ ofLoopType ofDirectShowPlayer::getLoopState() const{ if( player->isLooping() ){ return OF_LOOP_NORMAL; } - + } - return OF_LOOP_NONE; + return OF_LOOP_NONE; } void ofDirectShowPlayer::setFrame(int frame){ if( player && player->isLoaded() ){ - frame = ofClamp(frame, 0, getTotalNumFrames()); + frame = ofClamp(frame, 0, getTotalNumFrames()); return player->setAproximateFrame(frame); } } // frame 0 = first frame... - + void ofDirectShowPlayer::firstFrame(){ - setPosition(0.0); + setPosition(0.0); } void ofDirectShowPlayer::nextFrame(){ @@ -1346,3 +1348,5 @@ void ofDirectShowPlayer::previousFrame(){ player->preFrame(); } } + +#endif diff --git a/libs/openFrameworks/video/ofDirectShowPlayer.h b/libs/openFrameworks/video/ofDirectShowPlayer.h index f23a23b362b..ec19a2e4e4c 100644 --- a/libs/openFrameworks/video/ofDirectShowPlayer.h +++ b/libs/openFrameworks/video/ofDirectShowPlayer.h @@ -1,8 +1,11 @@ //DirectShowVideo and ofDirectShowPlayer written by Theodore Watson, Jan 2014 -//See the cpp file for the DirectShow implementation +//See the cpp file for the DirectShow implementation //To allow for QuickTime video playback install the K-Lite Mega Codec Pack 10.2 -#pragma once +#pragma once + +#ifdef _WIN32 + #include "ofVideoBaseTypes.h" template @@ -10,7 +13,7 @@ class ofPixels_; typedef ofPixels_ ofPixels; -class DirectShowVideo; +class DirectShowVideo; class ofDirectShowPlayer : public ofBaseVideoPlayer{ public: @@ -24,22 +27,22 @@ class ofDirectShowPlayer : public ofBaseVideoPlayer{ void update(); void close(); - + void play(); - void stop(); - + void stop(); + bool isFrameNew() const; const ofPixels & getPixels() const; ofPixels & getPixels(); - + float getWidth() const; float getHeight() const; - + bool isPaused() const; bool isLoaded() const; bool isPlaying() const; - + bool setPixelFormat(ofPixelFormat pixelFormat); ofPixelFormat getPixelFormat() const; @@ -47,18 +50,18 @@ class ofDirectShowPlayer : public ofBaseVideoPlayer{ float getSpeed() const; float getDuration() const; bool getIsMovieDone() const; - + void setPaused(bool bPause); void setPosition(float pct); void setVolume(float volume); // 0..1 void setLoopState(ofLoopType state); void setSpeed(float speed); void setFrame(int frame); // frame 0 = first frame... - + int getCurrentFrame() const; int getTotalNumFrames() const; ofLoopType getLoopState() const; - + void firstFrame(); void nextFrame(); void previousFrame(); @@ -67,3 +70,5 @@ class ofDirectShowPlayer : public ofBaseVideoPlayer{ std::shared_ptr player; ofPixelFormat pixelFormat; }; + +#endif diff --git a/libs/openFrameworks/video/ofMediaFoundationPlayer.cpp b/libs/openFrameworks/video/ofMediaFoundationPlayer.cpp index 84fc84f516c..a2191e9a220 100644 --- a/libs/openFrameworks/video/ofMediaFoundationPlayer.cpp +++ b/libs/openFrameworks/video/ofMediaFoundationPlayer.cpp @@ -3,21 +3,21 @@ ----------------------------------------------------------------------------- Based on code by Andrew Wright https://github.com/axjxwright/AX-MediaPlayer/ - + MIT License - + Copyright (c) 2021 Andrew Wright / AX Interactive - + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -28,6 +28,7 @@ ----------------------------------------------------------------------------- */ +#ifdef _WIN32 #include "ofPixels.h" #include "ofMediaFoundationPlayer.h" @@ -157,7 +158,7 @@ class BstrURL { _bstrStr = nullptr; } - operator BSTR() const { + operator BSTR() const { return _bstrStr; } private: @@ -293,10 +294,10 @@ bool SharedDXGLTexture::create(DXGI_FORMAT aDxFormat) { if (SUCCEEDED(dxMan->getD11Device()->CreateTexture2D(&desc, nullptr, mDXTex.GetAddressOf()))) { mGLDX_Handle = wglDXRegisterObjectNV( - dxMan->getGLHandleD3D(), + dxMan->getGLHandleD3D(), mDXTex.Get(), mOfTex->getTextureData().textureID, - GL_TEXTURE_2D, + GL_TEXTURE_2D, WGL_ACCESS_READ_ONLY_NV); D3D11_TEXTURE2D_DESC desc2; @@ -437,7 +438,7 @@ bool SharedDXGLTexture::updatePixels(ofTexture& aSrcTex, ofPixels& apix, ofPixel //---------------------------------------------- SharedDXGLTexture::~SharedDXGLTexture() { - // release the handle + // release the handle if (mGLDX_Handle != nullptr) { if (wglGetCurrentContext() != nullptr) { if (isLocked()) { @@ -467,7 +468,7 @@ bool WICTextureManager::allocate(ofPixelFormat afmt, int aw, int ah) { //---------------------------------------------- bool WICTextureManager::create(DXGI_FORMAT aDxFormat) { - + if (mBValid && mWicFactory) { unsigned int tw = static_cast(getWidth()); unsigned int th = static_cast(getHeight()); @@ -555,7 +556,7 @@ bool WICTextureManager::updatePixels(ofTexture& aSrcTex, ofPixels& apix, ofPixel apix.swapRgb(); } } else { - // swap around pixels + // swap around pixels apix.allocate(mSrcPixels.getWidth(), mSrcPixels.getHeight(), aTargetPixFormat); _swapPixelsFromSrc4ChannelTo3(apix); } @@ -758,7 +759,7 @@ bool ofMediaFoundationPlayer::_load(std::string name, bool abAsync) { m_spMediaEngine->SetAutoPlay(FALSE); - // now lets make a BSTR + // now lets make a BSTR m_spMediaEngine->SetSource(BstrURL(absPath)); hr = m_spMediaEngine->Load(); @@ -813,7 +814,7 @@ void ofMediaFoundationPlayer::close() { m_spMediaEngine = nullptr; - // clear out the events + // clear out the events { std::unique_lock lk(mMutexEvents); if (!mEventsQueue.empty()) { @@ -948,7 +949,7 @@ void ofMediaFoundationPlayer::update() { // now lets update the events in the queue bool bHasEvent = true; DWORD tevent; - while (bHasEvent && (numEventsProcessed < mMaxEventsToProcess) ) { + while (bHasEvent && (numEventsProcessed < mMaxEventsToProcess) ) { bHasEvent = false; { std::unique_lock lk(mMutexEvents); @@ -975,7 +976,7 @@ bool ofMediaFoundationPlayer::isFrameNew() const { void ofMediaFoundationPlayer::play() { if (m_spMediaEngine) { if (mBDone) { - setPosition(0.f); + setPosition(0.f); } m_spMediaEngine->Play(); mBDone = false; @@ -1315,7 +1316,7 @@ void ofMediaFoundationPlayer::handleMEEvent(DWORD aevent) { //); // MF_MT_FRAME_RATE DWORD nstreams; - + if (m_spEngineEx && SUCCEEDED(m_spEngineEx->GetNumberOfStreams(&nstreams)) ) { if (nstreams > 0) { @@ -1407,7 +1408,7 @@ void ofMediaFoundationPlayer::handleMEEvent(DWORD aevent) { } MF_MEDIA_ENGINE_EVENT mfEvent = static_cast(aevent); ofNotifyEvent(MFEngineEvent, mfEvent, this); - + } //----------------------------------------- @@ -1439,3 +1440,4 @@ bool ofMediaFoundationPlayer::updateDimensions() { return false; } +#endif diff --git a/libs/openFrameworks/video/ofMediaFoundationPlayer.h b/libs/openFrameworks/video/ofMediaFoundationPlayer.h index 7e53a177956..43b43970f69 100644 --- a/libs/openFrameworks/video/ofMediaFoundationPlayer.h +++ b/libs/openFrameworks/video/ofMediaFoundationPlayer.h @@ -2,21 +2,21 @@ ----------------------------------------------------------------------------- Based on code by Andrew Wright https://github.com/axjxwright/AX-MediaPlayer/ - + MIT License - + Copyright (c) 2021 Andrew Wright / AX Interactive - + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -27,6 +27,7 @@ ----------------------------------------------------------------------------- */ +#ifdef _WIN32 #pragma once @@ -52,7 +53,7 @@ namespace of { class ofMediaFoundationPlayer : public ofBaseVideoPlayer, public of::MediaEngineNotifyCallback { protected: friend class ofMediaFoundationSoundPlayer; - + // MediaEngineNotify: Implements the callback for Media Engine event notification. class ofMEEventProcessor : public IMFMediaEngineNotify { public: @@ -193,11 +194,11 @@ class ofMediaFoundationPlayer : public ofBaseVideoPlayer, public of::MediaEngine public: virtual bool allocate(ofPixelFormat afmt, int aw, int ah); virtual bool transferFrame(IMFMediaEngine* aengine) = 0; - virtual bool create(DXGI_FORMAT aDxFormat) = 0; + virtual bool create(DXGI_FORMAT aDxFormat) = 0; virtual bool isValid() = 0; virtual bool draw(ofPixels& apix) = 0; virtual bool updatePixels(ofTexture& aSrcTex, ofPixels& apix, ofPixelFormat aTargetPixFormat) = 0; - + int getWidth() { return mWidth; } int getHeight() { return mHeight; } @@ -215,7 +216,7 @@ class ofMediaFoundationPlayer : public ofBaseVideoPlayer, public of::MediaEngine }; protected: - + void handleMEEvent(DWORD aevent); void updateDuration(); bool updateDimensions(); @@ -248,7 +249,7 @@ class ofMediaFoundationPlayer : public ofBaseVideoPlayer, public of::MediaEngine static std::shared_ptr sDeviceManager; DXGI_FORMAT m_d3dFormat = DXGI_FORMAT_B8G8R8A8_UNORM; - + // Media Engine related Microsoft::WRL::ComPtr m_spMediaEngine; Microsoft::WRL::ComPtr m_spEngineEx; @@ -258,15 +259,17 @@ class ofMediaFoundationPlayer : public ofBaseVideoPlayer, public of::MediaEngine std::queue mEventsQueue; std::mutex mMutexEvents; // needed to copy the pixels while in lock() - // also an easy color conversion + // also an easy color conversion ofFbo mFbo; ofTexture mCopyTex; ofPixels mPixels; mutable bool mBUpdatePixels = false; - + bool mBLoadAsync = false; std::atomic_bool mBIsDoneAtomic; std::atomic_bool mBIsClosedAtomic; std::condition_variable mWaitCondition; - + }; + +#endif diff --git a/meson.build b/meson.build new file mode 100644 index 00000000000..f7c2569e38b --- /dev/null +++ b/meson.build @@ -0,0 +1,343 @@ +project('openFrameworks', 'cpp', + version : '0.12.0' +) + +inc = include_directories( + 'libs/openFrameworks/3d', + 'libs/openFrameworks/app', + 'libs/openFrameworks/communication', + 'libs/openFrameworks/events', + 'libs/openFrameworks/gl', + 'libs/openFrameworks/graphics', + 'libs/openFrameworks/math', + 'libs/openFrameworks/sound', + 'libs/openFrameworks/types', + 'libs/openFrameworks/utils', + 'libs/openFrameworks/video', + 'libs/openFrameworks', +) + +sources = files( + 'libs/openFrameworks/3d/of3dPrimitives.cpp', + 'libs/openFrameworks/3d/of3dUtils.cpp', + 'libs/openFrameworks/3d/ofCamera.cpp', + 'libs/openFrameworks/3d/ofEasyCam.cpp', + 'libs/openFrameworks/3d/ofNode.cpp', + 'libs/openFrameworks/app/ofAppGLFWWindow.cpp', + 'libs/openFrameworks/app/ofAppNoWindow.cpp', + 'libs/openFrameworks/app/ofAppRunner.cpp', + 'libs/openFrameworks/app/ofBaseApp.cpp', + 'libs/openFrameworks/app/ofMainLoop.cpp', + 'libs/openFrameworks/communication/ofArduino.cpp', + 'libs/openFrameworks/communication/ofSerial.cpp', + 'libs/openFrameworks/events/ofEvents.cpp', + 'libs/openFrameworks/gl/ofBufferObject.cpp', + 'libs/openFrameworks/gl/ofCubeMap.cpp', + 'libs/openFrameworks/gl/ofFbo.cpp', + 'libs/openFrameworks/gl/ofGLProgrammableRenderer.cpp', + 'libs/openFrameworks/gl/ofGLRenderer.cpp', + 'libs/openFrameworks/gl/ofGLUtils.cpp', + 'libs/openFrameworks/gl/ofLight.cpp', + 'libs/openFrameworks/gl/ofMaterial.cpp', + 'libs/openFrameworks/gl/ofShader.cpp', + 'libs/openFrameworks/gl/ofShadow.cpp', + 'libs/openFrameworks/gl/ofTexture.cpp', + 'libs/openFrameworks/gl/ofVbo.cpp', + 'libs/openFrameworks/gl/ofVboMesh.cpp', + 'libs/openFrameworks/graphics/of3dGraphics.cpp', + 'libs/openFrameworks/graphics/ofBitmapFont.cpp', + 'libs/openFrameworks/graphics/ofCairoRenderer.cpp', + 'libs/openFrameworks/graphics/ofGraphicsBaseTypes.cpp', + 'libs/openFrameworks/graphics/ofGraphicsCairo.cpp', + 'libs/openFrameworks/graphics/ofGraphics.cpp', + 'libs/openFrameworks/graphics/ofImage.cpp', + 'libs/openFrameworks/graphics/ofPath.cpp', + 'libs/openFrameworks/graphics/ofPixels.cpp', + 'libs/openFrameworks/graphics/ofRendererCollection.cpp', + 'libs/openFrameworks/graphics/ofTessellator.cpp', + 'libs/openFrameworks/graphics/ofTrueTypeFont.cpp', + 'libs/openFrameworks/math/ofMath.cpp', + 'libs/openFrameworks/math/ofMatrix3x3.cpp', + 'libs/openFrameworks/math/ofMatrix4x4.cpp', + 'libs/openFrameworks/math/ofQuaternion.cpp', + 'libs/openFrameworks/math/ofVec2f.cpp', + 'libs/openFrameworks/math/ofVec4f.cpp', + 'libs/openFrameworks/sound/ofFmodSoundPlayer.cpp', + 'libs/openFrameworks/sound/ofMediaFoundationSoundPlayer.cpp', + 'libs/openFrameworks/sound/ofOpenALSoundPlayer.cpp', + 'libs/openFrameworks/sound/ofRtAudioSoundStream.cpp', + 'libs/openFrameworks/sound/ofSoundBaseTypes.cpp', + 'libs/openFrameworks/sound/ofSoundBuffer.cpp', + 'libs/openFrameworks/sound/ofSoundPlayer.cpp', + 'libs/openFrameworks/sound/ofSoundStream.cpp', + 'libs/openFrameworks/types/ofBaseTypes.cpp', + 'libs/openFrameworks/types/ofColor.cpp', + 'libs/openFrameworks/types/ofParameter.cpp', + 'libs/openFrameworks/types/ofParameterGroup.cpp', + 'libs/openFrameworks/types/ofRectangle.cpp', + 'libs/openFrameworks/utils/ofFileUtils.cpp', + 'libs/openFrameworks/utils/ofFpsCounter.cpp', + 'libs/openFrameworks/utils/ofLog.cpp', + 'libs/openFrameworks/utils/ofMatrixStack.cpp', + 'libs/openFrameworks/utils/ofSystemUtils.cpp', + 'libs/openFrameworks/utils/ofThread.cpp', + 'libs/openFrameworks/utils/ofTimer.cpp', + 'libs/openFrameworks/utils/ofTimerFps.cpp', + 'libs/openFrameworks/utils/ofURLFileLoader.cpp', + 'libs/openFrameworks/utils/ofUtils.cpp', + 'libs/openFrameworks/utils/ofXml.cpp', + 'libs/openFrameworks/video/ofDirectShowGrabber.cpp', + 'libs/openFrameworks/video/ofDirectShowPlayer.cpp', + 'libs/openFrameworks/video/ofMediaFoundationPlayer.cpp', + 'libs/openFrameworks/video/ofVideoGrabber.cpp', + 'libs/openFrameworks/video/ofVideoPlayer.cpp', +) + +install_headers( + 'libs/openFrameworks/3d/of3dPrimitives.h', + 'libs/openFrameworks/3d/of3dUtils.h', + 'libs/openFrameworks/3d/ofCamera.h', + 'libs/openFrameworks/3d/ofEasyCam.h', + 'libs/openFrameworks/3d/ofMesh.h', + 'libs/openFrameworks/3d/ofNode.h', + 'libs/openFrameworks/app/ofAppBaseWindow.h', + 'libs/openFrameworks/app/ofAppGLFWWindow.h', + 'libs/openFrameworks/app/ofAppNoWindow.h', + 'libs/openFrameworks/app/ofAppRunner.h', + 'libs/openFrameworks/app/ofBaseApp.h', + 'libs/openFrameworks/app/ofIcon.h', + 'libs/openFrameworks/app/ofMainLoop.h', + 'libs/openFrameworks/app/ofWindowSettings.h', + 'libs/openFrameworks/communication/ofArduino.h', + 'libs/openFrameworks/communication/ofSerial.h', + 'libs/openFrameworks/events/ofEvent.h', + 'libs/openFrameworks/events/ofEvents.h', + 'libs/openFrameworks/events/ofEventUtils.h', + 'libs/openFrameworks/gl/ofBufferObject.h', + 'libs/openFrameworks/gl/ofCubeMap.h', + 'libs/openFrameworks/gl/ofCubeMapShaders.h', + 'libs/openFrameworks/gl/ofFbo.h', + 'libs/openFrameworks/gl/ofGLBaseTypes.h', + 'libs/openFrameworks/gl/ofGLProgrammableRenderer.h', + 'libs/openFrameworks/gl/ofGLRenderer.h', + 'libs/openFrameworks/gl/ofGLUtils.h', + 'libs/openFrameworks/gl/ofLight.h', + 'libs/openFrameworks/gl/ofMaterialBaseTypes.h', + 'libs/openFrameworks/gl/ofMaterial.h', + 'libs/openFrameworks/gl/ofShader.h', + 'libs/openFrameworks/gl/ofShadow.h', + 'libs/openFrameworks/gl/ofTexture.h', + 'libs/openFrameworks/gl/ofVbo.h', + 'libs/openFrameworks/gl/ofVboMesh.h', + 'libs/openFrameworks/graphics/of3dGraphics.h', + 'libs/openFrameworks/graphics/ofBitmapFont.h', + 'libs/openFrameworks/graphics/ofCairoRenderer.h', + 'libs/openFrameworks/graphics/ofGraphicsBaseTypes.h', + 'libs/openFrameworks/graphics/ofGraphicsCairo.h', + 'libs/openFrameworks/graphics/ofGraphicsConstants.h', + 'libs/openFrameworks/graphics/ofGraphics.h', + 'libs/openFrameworks/graphics/ofImage.h', + 'libs/openFrameworks/graphics/ofPath.h', + 'libs/openFrameworks/graphics/ofPixels.h', + 'libs/openFrameworks/graphics/ofPolyline.h', + 'libs/openFrameworks/graphics/ofRendererCollection.h', + 'libs/openFrameworks/graphics/ofTessellator.h', + 'libs/openFrameworks/graphics/ofTrueTypeFont.h', + 'libs/openFrameworks/math/ofMathConstants.h', + 'libs/openFrameworks/math/ofMath.h', + 'libs/openFrameworks/math/ofMatrix3x3.h', + 'libs/openFrameworks/math/ofMatrix4x4.h', + 'libs/openFrameworks/math/ofQuaternion.h', + 'libs/openFrameworks/math/ofVec2f.h', + 'libs/openFrameworks/math/ofVec3f.h', + 'libs/openFrameworks/math/ofVec4f.h', + 'libs/openFrameworks/math/ofVectorMath.h', + 'libs/openFrameworks/ofMain.h', + 'libs/openFrameworks/sound/ofAVEngineSoundPlayer.h', + 'libs/openFrameworks/sound/ofFmodSoundPlayer.h', + 'libs/openFrameworks/sound/ofMediaFoundationSoundPlayer.h', + 'libs/openFrameworks/sound/ofOpenALSoundPlayer.h', + 'libs/openFrameworks/sound/ofRtAudioSoundStream.h', + 'libs/openFrameworks/sound/ofSoundBaseTypes.h', + 'libs/openFrameworks/sound/ofSoundBuffer.h', + 'libs/openFrameworks/sound/ofSoundPlayer.h', + 'libs/openFrameworks/sound/ofSoundStream.h', + 'libs/openFrameworks/sound/ofSoundUtils.h', + 'libs/openFrameworks/types/ofBaseTypes.h', + 'libs/openFrameworks/types/ofColor.h', + 'libs/openFrameworks/types/ofParameter.h', + 'libs/openFrameworks/types/ofPoint.h', + 'libs/openFrameworks/types/ofRectangle.h', + 'libs/openFrameworks/types/ofTypes.h', + 'libs/openFrameworks/utils/ofConstants.h', + 'libs/openFrameworks/utils/ofFileUtils.h', + 'libs/openFrameworks/utils/ofFpsCounter.h', + 'libs/openFrameworks/utils/ofJson.h', + 'libs/openFrameworks/utils/ofLog.h', + 'libs/openFrameworks/utils/ofMatrixStack.h', + 'libs/openFrameworks/utils/ofNoise.h', + 'libs/openFrameworks/utils/ofRandomDistributions.h', + 'libs/openFrameworks/utils/ofRandomEngine.h', + 'libs/openFrameworks/utils/ofSingleton.h', + 'libs/openFrameworks/utils/ofSystemUtils.h', + 'libs/openFrameworks/utils/ofThreadChannel.h', + 'libs/openFrameworks/utils/ofThread.h', + 'libs/openFrameworks/utils/ofTimerFps.h', + 'libs/openFrameworks/utils/ofTimer.h', + 'libs/openFrameworks/utils/ofURLFileLoader.h', + 'libs/openFrameworks/utils/ofUtils.h', + 'libs/openFrameworks/utils/ofXml.h', + 'libs/openFrameworks/video/ofDirectShowGrabber.h', + 'libs/openFrameworks/video/ofDirectShowPlayer.h', + 'libs/openFrameworks/video/ofMediaFoundationPlayer.h', + 'libs/openFrameworks/video/ofVideoBaseTypes.h', + 'libs/openFrameworks/video/ofVideoGrabber.h', + 'libs/openFrameworks/video/ofVideoPlayer.h', + subdir: 'openframeworks' +) + +cmake = import('cmake') + +deps = [ + dependency('boost'), + dependency('cairo'), + dependency('fontconfig'), + dependency('freeglut', 'glut'), + dependency('freetype2'), + dependency('glew'), + dependency('glfw3'), + dependency('glm'), + dependency('libcrypto'), + dependency('libcurl'), + dependency('libmpg123'), + dependency('libtess2'), + dependency('nlohmann_json'), + dependency('openal'), + dependency('pugixml'), + dependency('rtaudio'), + dependency('sndfile'), + dependency('utf8cpp'), +] + +if host_machine.system() == 'linux' + + deps += [ + dependency('egl'), + dependency('gstreamer-1.0'), + dependency('gstreamer-app-1.0'), + dependency('gstreamer-plugins-bad-1.0'), + dependency('gstreamer-plugins-base-1.0'), + dependency('gstreamer-video-1.0'), + dependency('libudev'), + dependency('x11-xcb'), + dependency('xcursor'), + ] + + sources += files( + 'libs/openFrameworks/app/ofAppEGLWindow.cpp', + 'libs/openFrameworks/video/ofGstUtils.cpp', + 'libs/openFrameworks/video/ofGstVideoGrabber.cpp', + 'libs/openFrameworks/video/ofGstVideoPlayer.cpp', + ) + + install_headers( + 'libs/openFrameworks/app/ofAppEGLWindow.h', + 'libs/openFrameworks/video/ofGstUtils.h', + 'libs/openFrameworks/video/ofGstVideoGrabber.h', + 'libs/openFrameworks/video/ofGstVideoPlayer.h', + subdir: 'openframeworks' + ) + +elif host_machine.system() == 'darwin' + + deps += [ + dependency('Cocoa'), + dependency('AppKit'), + dependency('Foundation'), + dependency('AVKit'), + dependency('GLKit'), + dependency('AVFoundation'), + dependency('opengl'), + dependency('coremedia'), + dependency('corevideo'), + dependency('accelerate') + ] + add_languages('objcpp', native: false) + add_languages('objc', native: false) + add_project_arguments(['-ObjC++', '-fobjc-arc'], language: ['cpp', 'objcpp', 'objc']) + + sources += files( + 'libs/openFrameworks/sound/ofAVEngineSoundPlayer.mm', + 'libs/openFrameworks/video/ofAVFoundationGrabber.mm', + 'libs/openFrameworks/video/ofAVFoundationPlayer.mm', + 'libs/openFrameworks/video/ofAVFoundationVideoPlayer.m', + ) + + install_headers( + 'libs/openFrameworks/sound/ofAVEngineSoundPlayer.h', + 'libs/openFrameworks/video/ofAVFoundationGrabber.h', + 'libs/openFrameworks/video/ofAVFoundationPlayer.h', + 'libs/openFrameworks/video/ofAVFoundationGrabber.h', + 'libs/openFrameworks/video/ofAVFoundationPlayer.h', + 'libs/openFrameworks/video/ofAVFoundationVideoPlayer.h', + subdir: 'openframeworks' + ) + +endif + +# We need to treat this dependency independently +# because if it's not installed in the host system, +# we will use the .wrap file in the subprojects file AND +# need to change a define in the cmake subproject +uriparser_dep = dependency('uriparser', required: false) +if not uriparser_dep.found() + # disable the "URIPARSER_BUILD_DOCS" define that is default enabled in the subproject + # which pulls Doxygen dependency uselessly + uripaser_opts = cmake.subproject_options() + uripaser_opts.add_cmake_defines({'URIPARSER_BUILD_DOCS': false, 'URIPARSER_BUILD_TESTS': false}) + uripaser_proj = cmake.subproject('uriparser', options: uripaser_opts) + uriparser_dep = uripaser_proj.dependency('uriparser') +endif + +deps += [uriparser_dep] + +# Same: need to disable tests to not pull FFTW +kissfft_dep = dependency('kissfft-float', required: false) +if not kissfft_dep.found() + kissfft_opts = cmake.subproject_options() + kissfft_opts.add_cmake_defines({'KISSFFT_TEST': false}) + kissfft_proj = cmake.subproject('kissfft', options: kissfft_opts) + kissfft_dep = kissfft_proj.dependency('kissfft') +endif + +deps += [kissfft_dep] + +# FreeImage is a special snowflake: no pkg-config / cmake / etc.. file is installed by it +# so we need to use the compiler to find it +compiler = meson.get_compiler('cpp') +freeimage_dep = compiler.find_library('freeimage', has_headers: ['FreeImage.h'], required: false) +if not freeimage_dep.found() + freeimage_opts = cmake.subproject_options() + # doesn't compile with the define bellow + # freeimage_opts.add_cmake_defines({'BUILD_SHARED_LIBS': true}) + # We need -fPIC to link against the produced static library + freeimage_opts.add_cmake_defines({'CMAKE_POSITION_INDEPENDENT_CODE': true}) + freeimage_proj = cmake.subproject('freeimage', options: freeimage_opts) + freeimage_dep = freeimage_proj.dependency('FreeImage') +endif + +deps += [freeimage_dep] + +lib = library('openFrameworks', + sources, + include_directories: inc, + dependencies: deps, + install: true, +) + +openframeworks_dep = declare_dependency(link_with: lib, include_directories: inc, dependencies: deps) + +meson.override_dependency('openFrameworks', openframeworks_dep) + +pkg = import('pkgconfig') +pkg.generate(lib) diff --git a/subprojects/assimp.wrap b/subprojects/assimp.wrap new file mode 100644 index 00000000000..1ad7e74b671 --- /dev/null +++ b/subprojects/assimp.wrap @@ -0,0 +1,8 @@ +[wrap-git] +url = https://github.com/assimp/assimp.git +revision = v5.4.3 +depth = 1 +method = cmake + +[provide] +assimp = assimp_dep diff --git a/subprojects/cairo.wrap b/subprojects/cairo.wrap new file mode 100644 index 00000000000..edd7cf8d549 --- /dev/null +++ b/subprojects/cairo.wrap @@ -0,0 +1,10 @@ +[wrap-file] +directory = cairo-1.18.2 +source_url = https://www.cairographics.org/releases/cairo-1.18.2.tar.xz +source_filename = cairo-1.18.2.tar.xz +source_hash = a62b9bb42425e844cc3d6ddde043ff39dbabedd1542eba57a2eb79f85889d45a +source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/cairo_1.18.2-1/cairo-1.18.2.tar.xz +wrapdb_version = 1.18.2-1 + +[provide] +dependency_names = cairo, cairo-gobject diff --git a/subprojects/curl.wrap b/subprojects/curl.wrap new file mode 100644 index 00000000000..4472472eb3d --- /dev/null +++ b/subprojects/curl.wrap @@ -0,0 +1,13 @@ +[wrap-file] +directory = curl-8.10.0 +source_url = https://github.com/curl/curl/releases/download/curl-8_10_0/curl-8.10.0.tar.xz +source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/curl_8.10.0-1/curl-8.10.0.tar.xz +source_filename = curl-8.10.0.tar.xz +source_hash = e6b142f0e85e954759d37e26a3627e2278137595be80e3a860c4353e4335e5a0 +patch_filename = curl_8.10.0-1_patch.zip +patch_url = https://wrapdb.mesonbuild.com/v2/curl_8.10.0-1/get_patch +patch_hash = 82ff0ee3f852cc8221ee52c2f2b7624098452a219f64f45bb8d5d1b6bf921f0f +wrapdb_version = 8.10.0-1 + +[provide] +dependency_names = libcurl diff --git a/subprojects/fontconfig.wrap b/subprojects/fontconfig.wrap new file mode 100644 index 00000000000..c2b9d6bfa34 --- /dev/null +++ b/subprojects/fontconfig.wrap @@ -0,0 +1,10 @@ +[wrap-file] +directory = fontconfig-2.15.0 +source_url = https://www.freedesktop.org/software/fontconfig/release/fontconfig-2.15.0.tar.xz +source_filename = fontconfig-2.15.0.tar.xz +source_hash = 63a0658d0e06e0fa886106452b58ef04f21f58202ea02a94c39de0d3335d7c0e +source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/fontconfig_2.15.0-1/fontconfig-2.15.0.tar.xz +wrapdb_version = 2.15.0-1 + +[provide] +fontconfig = fontconfig_dep diff --git a/subprojects/freeglut.wrap b/subprojects/freeglut.wrap new file mode 100644 index 00000000000..d00a8f30f9c --- /dev/null +++ b/subprojects/freeglut.wrap @@ -0,0 +1,14 @@ +[wrap-file] +directory = freeglut-3.4.0 +source_url = http://downloads.sourceforge.net/freeglut/3.4.0/freeglut-3.4.0.tar.gz +source_filename = freeglut-3.4.0.tar.gz +source_hash = 3c0bcb915d9b180a97edaebd011b7a1de54583a838644dcd42bb0ea0c6f3eaec +patch_filename = freeglut_3.4.0-2_patch.zip +patch_url = https://wrapdb.mesonbuild.com/v2/freeglut_3.4.0-2/get_patch +patch_hash = fd3264ab2eafb8a1c711fc2b309e9c85e6a2bde0178d9c1e5f5785091a6b01bf +source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/freeglut_3.4.0-2/freeglut-3.4.0.tar.gz +wrapdb_version = 3.4.0-2 + +[provide] +freeglut = freeglut_dep +glut = freeglut_dep diff --git a/subprojects/freeimage.wrap b/subprojects/freeimage.wrap new file mode 100644 index 00000000000..1d4ad5031df --- /dev/null +++ b/subprojects/freeimage.wrap @@ -0,0 +1,9 @@ +[wrap-file] +directory = FreeImage-3.19.9 +source_url = https://github.com/danoli3/FreeImage/archive/refs/tags/3.19.9.zip +source_filename = FreeImage-3.19.9.zip +source_hash = 5bf3f5d85224f045c110dc2b4dc7d22c3d33a9ee6e2771b17fb06b3e5f462141 +method = cmake + +[provide] +freeimage = FreeImage_dep diff --git a/subprojects/freetype2.wrap b/subprojects/freetype2.wrap new file mode 100644 index 00000000000..acad6f4872d --- /dev/null +++ b/subprojects/freetype2.wrap @@ -0,0 +1,11 @@ +[wrap-file] +directory = freetype-2.13.3 +source_url = https://download.savannah.gnu.org/releases/freetype/freetype-2.13.3.tar.xz +source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/freetype2_2.13.3-1/freetype-2.13.3.tar.xz +source_filename = freetype-2.13.3.tar.xz +source_hash = 0550350666d427c74daeb85d5ac7bb353acba5f76956395995311a9c6f063289 +wrapdb_version = 2.13.3-1 + +[provide] +freetype2 = freetype_dep +freetype = freetype_dep diff --git a/subprojects/glew.wrap b/subprojects/glew.wrap new file mode 100644 index 00000000000..390dc9a336a --- /dev/null +++ b/subprojects/glew.wrap @@ -0,0 +1,12 @@ +[wrap-file] +directory = glew-2.2.0 +source_url = http://downloads.sourceforge.net/glew/glew-2.2.0.tgz +source_filename = glew-2.2.0.tgz +source_hash = d4fc82893cfb00109578d0a1a2337fb8ca335b3ceccf97b97e5cc7f08e4353e1 +patch_filename = glew_2.2.0-2_patch.zip +patch_url = https://wrapdb.mesonbuild.com/v2/glew_2.2.0-2/get_patch +patch_hash = df7bc80456da53f83e93e89ca5035d04cdff19a836c956887a684b2bee16eb9b +wrapdb_version = 2.2.0-2 + +[provide] +glew = glew_dep diff --git a/subprojects/glfw.wrap b/subprojects/glfw.wrap new file mode 100644 index 00000000000..c5a9751d262 --- /dev/null +++ b/subprojects/glfw.wrap @@ -0,0 +1,13 @@ +[wrap-file] +directory = glfw-3.3.10 +source_url = https://github.com/glfw/glfw/archive/refs/tags/3.3.10.tar.gz +source_filename = glfw-3.3.10.tar.gz +source_hash = 4ff18a3377da465386374d8127e7b7349b685288cb8e17122f7e1179f73769d5 +patch_filename = glfw_3.3.10-1_patch.zip +patch_url = https://wrapdb.mesonbuild.com/v2/glfw_3.3.10-1/get_patch +patch_hash = 3567f96c2576a5fc8c9cafd9059f919d7da404f6c22450c6c2ce3f9938909b8b +source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/glfw_3.3.10-1/glfw-3.3.10.tar.gz +wrapdb_version = 3.3.10-1 + +[provide] +glfw3 = glfw_dep diff --git a/subprojects/glm.wrap b/subprojects/glm.wrap new file mode 100644 index 00000000000..d75571ec0f1 --- /dev/null +++ b/subprojects/glm.wrap @@ -0,0 +1,13 @@ +[wrap-file] +directory = glm-1.0.1 +source_url = https://github.com/g-truc/glm/archive/refs/tags/1.0.1.tar.gz +source_filename = glm-1.0.1.tar.gz +source_hash = 9f3174561fd26904b23f0db5e560971cbf9b3cbda0b280f04d5c379d03bf234c +patch_filename = glm_1.0.1-1_patch.zip +patch_url = https://wrapdb.mesonbuild.com/v2/glm_1.0.1-1/get_patch +patch_hash = 25679275e26bc4c36bb617d1b4a52197039402af828d2a4bf67b3c0260a5df6a +source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/glm_1.0.1-1/glm-1.0.1.tar.gz +wrapdb_version = 1.0.1-1 + +[provide] +glm = glm_dep diff --git a/subprojects/kissfft.wrap b/subprojects/kissfft.wrap new file mode 100644 index 00000000000..c8ffcb7880e --- /dev/null +++ b/subprojects/kissfft.wrap @@ -0,0 +1,8 @@ +[wrap-git] +url = https://github.com/mborgerding/kissfft.git +revision = 131.1.0 +depth = 1 +method = cmake + +[provide] +kissfft-float = kissfft_dep diff --git a/subprojects/libsndfile.wrap b/subprojects/libsndfile.wrap new file mode 100644 index 00000000000..f75feb9dcb4 --- /dev/null +++ b/subprojects/libsndfile.wrap @@ -0,0 +1,13 @@ +[wrap-file] +directory = libsndfile-1.2.2 +source_url = https://github.com/libsndfile/libsndfile/releases/download/1.2.2/libsndfile-1.2.2.tar.xz +source_filename = libsndfile-1.2.2.tar.xz +source_hash = 3799ca9924d3125038880367bf1468e53a1b7e3686a934f098b7e1d286cdb80e +patch_filename = libsndfile_1.2.2-1_patch.zip +patch_url = https://wrapdb.mesonbuild.com/v2/libsndfile_1.2.2-1/get_patch +patch_hash = 0438f3ea86b2facf4fe05f761c717f3b71e144cb59e60504e49ecd25874d67ad +source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/libsndfile_1.2.2-1/libsndfile-1.2.2.tar.xz +wrapdb_version = 1.2.2-1 + +[provide] +sndfile = libsndfile_dep diff --git a/subprojects/libtess2.wrap b/subprojects/libtess2.wrap new file mode 100644 index 00000000000..9d41e6ff05d --- /dev/null +++ b/subprojects/libtess2.wrap @@ -0,0 +1,13 @@ +[wrap-git] +url = https://github.com/memononen/libtess2.git +revision = v1.0.2 +depth = 1 + +# Loads "overrides" (aka move files from that folder to the cloned one) from packagefiles/libtess2 +# this is to "meson-ize" the project +# There are many meson-ized projects in here https://mesonbuild.com/Wrapdb-projects.html +# more information on how to use them here https://mesonbuild.com/Wrap-dependency-system-manual.html +patch_directory = libtess2 + +[provide] +dependency_names = libtess2_dep diff --git a/subprojects/libxcursor.wrap b/subprojects/libxcursor.wrap new file mode 100644 index 00000000000..ee219917ccb --- /dev/null +++ b/subprojects/libxcursor.wrap @@ -0,0 +1,12 @@ +[wrap-file] +directory = libXcursor-1.2.1 +source_url = https://xorg.freedesktop.org/releases/individual/lib/libXcursor-1.2.1.tar.xz +source_filename = libXrandr-1.2.1.tar.xz +source_hash = 46c143731610bafd2070159a844571b287ac26192537d047a39df06155492104 +patch_filename = libxcursor_1.2.1-1_patch.zip +patch_url = https://wrapdb.mesonbuild.com/v2/libxcursor_1.2.1-1/get_patch +patch_hash = ca8df86b74b8b4065e69ca7620a539c034deb08f9e1dbe58a444984da0e8c2fb +wrapdb_version = 1.2.1-1 + +[provide] +xcursor = xcursor_dep diff --git a/subprojects/nlohmann_json.wrap b/subprojects/nlohmann_json.wrap new file mode 100644 index 00000000000..8c4667613cc --- /dev/null +++ b/subprojects/nlohmann_json.wrap @@ -0,0 +1,11 @@ +[wrap-file] +directory = nlohmann_json-3.11.3 +lead_directory_missing = true +source_url = https://github.com/nlohmann/json/releases/download/v3.11.3/include.zip +source_filename = nlohmann_json-3.11.3.zip +source_hash = a22461d13119ac5c78f205d3df1db13403e58ce1bb1794edc9313677313f4a9d +source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/nlohmann_json_3.11.3-1/nlohmann_json-3.11.3.zip +wrapdb_version = 3.11.3-1 + +[provide] +nlohmann_json = nlohmann_json_dep diff --git a/subprojects/openal-soft.wrap b/subprojects/openal-soft.wrap new file mode 100644 index 00000000000..a46c525c326 --- /dev/null +++ b/subprojects/openal-soft.wrap @@ -0,0 +1,13 @@ +[wrap-file] +directory = openal-soft-1.23.1 +source_url = https://github.com/kcat/openal-soft/archive/refs/tags/1.23.1.tar.gz +source_filename = openal-soft-1.23.1.tar.gz +source_hash = dfddf3a1f61059853c625b7bb03de8433b455f2f79f89548cbcbd5edca3d4a4a +patch_filename = openal-soft_1.23.1-2_patch.zip +patch_url = https://wrapdb.mesonbuild.com/v2/openal-soft_1.23.1-2/get_patch +patch_hash = e03c3afe0bb40a931d25d41d92a08b90e3c33b217d1b47210b26ca6627eb3aa3 +source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/openal-soft_1.23.1-2/openal-soft-1.23.1.tar.gz +wrapdb_version = 1.23.1-2 + +[provide] +openal = openal_dep diff --git a/subprojects/openssl.wrap b/subprojects/openssl.wrap new file mode 100644 index 00000000000..873d55106e9 --- /dev/null +++ b/subprojects/openssl.wrap @@ -0,0 +1,15 @@ +[wrap-file] +directory = openssl-3.0.8 +source_url = https://www.openssl.org/source/openssl-3.0.8.tar.gz +source_filename = openssl-3.0.8.tar.gz +source_hash = 6c13d2bf38fdf31eac3ce2a347073673f5d63263398f1f69d0df4a41253e4b3e +patch_filename = openssl_3.0.8-3_patch.zip +patch_url = https://wrapdb.mesonbuild.com/v2/openssl_3.0.8-3/get_patch +patch_hash = 300da189e106942347d61a4a4295aa2edbcf06184f8d13b4cee0bed9fb936963 +source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/openssl_3.0.8-3/openssl-3.0.8.tar.gz +wrapdb_version = 3.0.8-3 + +[provide] +libcrypto = libcrypto_dep +libssl = libssl_dep +openssl = openssl_dep diff --git a/subprojects/packagefiles/libtess2/meson.build b/subprojects/packagefiles/libtess2/meson.build new file mode 100644 index 00000000000..3a3c67c8c52 --- /dev/null +++ b/subprojects/packagefiles/libtess2/meson.build @@ -0,0 +1,43 @@ +project('libtess2', 'c', +version : '0.12.0', +default_options : [ + 'buildtype=release', + 'optimization=3', + 'default_library=static', + 'prefer_static=true', + 'b_ndebug=if-release', + 'c_args=-pipe', + 'cpp_args=-pipe', +] +) + +inc = include_directories( + 'Include', + 'Source' +) + +install_headers('Include/tesselator.h') + +sources = files( + 'Source/bucketalloc.c', + 'Source/dict.c', + 'Source/geom.c', + 'Source/mesh.c', + 'Source/priorityq.c', + 'Source/sweep.c', + 'Source/tess.c', +) + +lib = library('tess2', + sources, + include_directories: inc, + install: true) + +libtess2_dep = declare_dependency(include_directories: 'Include', link_with: lib) + +# This is to make meson projects using this one as subproject find the dependency +# automagically when doing "dependency('libtess2')" +meson.override_dependency('libtess2', libtess2_dep) + +pkg = import('pkgconfig') +pkg.generate(lib) diff --git a/subprojects/pugixml.wrap b/subprojects/pugixml.wrap new file mode 100644 index 00000000000..0d169a78257 --- /dev/null +++ b/subprojects/pugixml.wrap @@ -0,0 +1,13 @@ +[wrap-file] +directory = pugixml-1.14 +source_url = https://github.com/zeux/pugixml/archive/v1.14.tar.gz +source_filename = pugixml-1.14.tar.gz +source_hash = 610f98375424b5614754a6f34a491adbddaaec074e9044577d965160ec103d2e +patch_filename = pugixml_1.14-1_patch.zip +patch_url = https://wrapdb.mesonbuild.com/v2/pugixml_1.14-1/get_patch +patch_hash = 23ceabbd7bc74a6cc6c2e6f625a9b0840a070e1225d85d3cc29c27b6cc059135 +source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/pugixml_1.14-1/pugixml-1.14.tar.gz +wrapdb_version = 1.14-1 + +[provide] +pugixml = pugixml_dep diff --git a/subprojects/rtaudio.wrap b/subprojects/rtaudio.wrap new file mode 100644 index 00000000000..ef129dadba6 --- /dev/null +++ b/subprojects/rtaudio.wrap @@ -0,0 +1,10 @@ +[wrap-file] +directory = rtaudio-6.0.1 +source_url = http://www.music.mcgill.ca/~gary/rtaudio/release/rtaudio-6.0.1.tar.gz +source_filename = rtaudio-6.0.1.tar.gz +source_hash = 42d29cc2b5fa378ba3a978faeb1885a0075acf0fecb5ee50f0d76f6c7d8ab28c +source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/rtaudio_6.0.1-1/rtaudio-6.0.1.tar.gz +wrapdb_version = 6.0.1-1 + +[provide] +dependency_names = rtaudio diff --git a/subprojects/uriparser.wrap b/subprojects/uriparser.wrap new file mode 100644 index 00000000000..b4037b780f9 --- /dev/null +++ b/subprojects/uriparser.wrap @@ -0,0 +1,8 @@ +[wrap-git] +url = https://github.com/uriparser/uriparser.git +revision = uriparser-0.9.8 +depth = 1 +method = cmake + +[provide] +uriparser = uriparser_dep diff --git a/subprojects/utfcpp.wrap b/subprojects/utfcpp.wrap new file mode 100644 index 00000000000..1416c2c132d --- /dev/null +++ b/subprojects/utfcpp.wrap @@ -0,0 +1,13 @@ +[wrap-file] +directory = utfcpp-4.0.5 +source_url = https://github.com/nemtrif/utfcpp/archive/refs/tags/v4.0.5.tar.gz +source_filename = utfcpp-4.0.5.tar.gz +source_hash = ffc668a310e77607d393f3c18b32715f223da1eac4c4d6e0579a11df8e6b59cf +patch_filename = utfcpp_4.0.5-1_patch.zip +patch_url = https://wrapdb.mesonbuild.com/v2/utfcpp_4.0.5-1/get_patch +patch_hash = bedf83d77b07a2fb84582722aaf748498cab0267b023ff8460dae3730a2d0819 +source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/utfcpp_4.0.5-1/utfcpp-4.0.5.tar.gz +wrapdb_version = 4.0.5-1 + +[provide] +utf8cpp = utfcpp_dep