Initial audio support
This commit is contained in:
@@ -52,13 +52,16 @@
|
||||
#include <comutil.h>
|
||||
#include "DeckLinkAPI_h.h"
|
||||
|
||||
#include "AudioSupport.h"
|
||||
#include "VideoFrameTransfer.h"
|
||||
#include "RuntimeHost.h"
|
||||
|
||||
#include <atomic>
|
||||
#include <cstdint>
|
||||
#include <functional>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <vector>
|
||||
#include <deque>
|
||||
|
||||
@@ -96,6 +99,8 @@ public:
|
||||
void paintGL();
|
||||
|
||||
void VideoFrameArrived(IDeckLinkVideoInputFrame* inputFrame, bool hasNoInputSource);
|
||||
void AudioPacketArrived(IDeckLinkAudioInputPacket* audioPacket);
|
||||
HRESULT RenderAudioSamples(BOOL preroll);
|
||||
void PlayoutFrameCompleted(IDeckLinkVideoFrame* completedFrame, BMDOutputFrameCompletionResult result);
|
||||
|
||||
private:
|
||||
@@ -112,12 +117,14 @@ private:
|
||||
// DeckLink
|
||||
IDeckLinkInput* mDLInput;
|
||||
IDeckLinkOutput* mDLOutput;
|
||||
IDeckLinkConfiguration* mDLInputConfiguration;
|
||||
IDeckLinkKeyer* mDLKeyer;
|
||||
std::deque<IDeckLinkMutableVideoFrame*> mDLOutputVideoFrameQueue;
|
||||
PinnedMemoryAllocator* mPlayoutAllocator;
|
||||
BMDTimeValue mFrameDuration;
|
||||
BMDTimeScale mFrameTimescale;
|
||||
unsigned mTotalPlayoutFrames;
|
||||
uint64_t mNextAudioSampleFrame;
|
||||
unsigned mInputFrameWidth;
|
||||
unsigned mInputFrameHeight;
|
||||
unsigned mOutputFrameWidth;
|
||||
@@ -139,6 +146,7 @@ private:
|
||||
GLuint mLayerTempTexture;
|
||||
GLuint mFBOTexture;
|
||||
GLuint mOutputTexture;
|
||||
GLuint mAudioDataTexture;
|
||||
GLuint mUnpinnedTextureBuffer;
|
||||
GLuint mDecodeFrameBuf;
|
||||
GLuint mLayerTempFrameBuf;
|
||||
@@ -157,6 +165,12 @@ private:
|
||||
std::unique_ptr<RuntimeHost> mRuntimeHost;
|
||||
std::unique_ptr<ControlServer> mControlServer;
|
||||
std::unique_ptr<OscServer> mOscServer;
|
||||
bool mAudioEnabled;
|
||||
bool mAudioPrerolling;
|
||||
std::mutex mAudioStateMutex;
|
||||
AudioDelayBuffer mAudioDelayBuffer;
|
||||
AudioAnalyzer mAudioAnalyzer;
|
||||
AudioAnalysisSnapshot mAudioAnalysis;
|
||||
|
||||
struct LayerProgram
|
||||
{
|
||||
@@ -209,6 +223,11 @@ private:
|
||||
void renderEffect();
|
||||
bool PollRuntimeChanges();
|
||||
void broadcastRuntimeState();
|
||||
void initializeAudioDelay();
|
||||
unsigned delayedAudioSampleFrames() const;
|
||||
AudioFrameBlock popAudioForVideoFrame(uint64_t videoFrameIndex);
|
||||
void updateAudioDataTexture(const AudioAnalysisSnapshot& analysis);
|
||||
void updateAudioStatus();
|
||||
bool updateGlobalParamsBuffer(const RuntimeRenderState& state, unsigned availableSourceHistoryLength, unsigned availableTemporalHistoryLength);
|
||||
bool validateTemporalTextureUnitBudget(const std::vector<RuntimeRenderState>& layerStates, std::string& error) const;
|
||||
bool ensureTemporalHistoryResources(const std::vector<RuntimeRenderState>& layerStates, std::string& error);
|
||||
@@ -341,7 +360,7 @@ public:
|
||||
// Render Delegate Class
|
||||
////////////////////////////////////////////
|
||||
|
||||
class PlayoutDelegate : public IDeckLinkVideoOutputCallback
|
||||
class PlayoutDelegate : public IDeckLinkVideoOutputCallback, public IDeckLinkAudioOutputCallback
|
||||
{
|
||||
OpenGLComposite* m_pOwner;
|
||||
LONG mRefCount;
|
||||
@@ -356,6 +375,7 @@ public:
|
||||
|
||||
virtual HRESULT STDMETHODCALLTYPE ScheduledFrameCompleted (IDeckLinkVideoFrame* completedFrame, BMDOutputFrameCompletionResult result);
|
||||
virtual HRESULT STDMETHODCALLTYPE ScheduledPlaybackHasStopped ();
|
||||
virtual HRESULT STDMETHODCALLTYPE RenderAudioSamples (BOOL preroll);
|
||||
};
|
||||
|
||||
#endif // __OPENGL_COMPOSITE_H__
|
||||
|
||||
Reference in New Issue
Block a user