NAP
videoaudio.h
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2  * License, v. 2.0. If a copy of the MPL was not distributed with this
3  * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4 
5 #pragma once
6 
7 // Std includes
8 #include <mutex>
9 
10 // Nap includes
11 #include <rtti/objectptr.h>
12 
13 // Video includes
14 #include <video.h>
15 
16 // Audio includes
17 #include <audio/core/audionode.h>
18 
19 namespace nap
20 {
21  namespace audio
22  {
26  class NAPAPI VideoNode : public Node
27  {
28  public:
32  VideoNode(NodeManager& nodeManager, int channelCount, bool mDecodeAudio);
33 
37  int getChannelCount() const { return mOutputs.size(); }
38 
43  OutputPin& getOutput(int channel) { return *mOutputs[channel]; }
44 
49  void setVideo(Video& video);
50 
51  private:
52  // Inherited form Node
53  void process() override final;
54 
55  nap::Slot<Video&> mVideoDestructedSlot = { this, &nap::audio::VideoNode::videoDestructed };
56  void videoDestructed(Video&);
57 
58  std::vector<std::unique_ptr<OutputPin>> mOutputs;
59  Video* mVideo = nullptr;
60  AudioFormat mAudioFormat;
61  std::vector<float> mDataBuffer;
62  std::mutex mVideoMutex;
63  bool mDecodeAudio = true;
64  };
65  }
66 }
nap::audio::VideoNode::getChannelCount
int getChannelCount() const
Definition: videoaudio.h:37
nap::Slot
Slot.
Definition: signalslot.h:21
nap::Video
Definition: video.h:400
nap::AudioFormat
Definition: video.h:40
nap::audio::VideoNode
Definition: videoaudio.h:26
nap::audio::NodeManager
Definition: audionodemanager.h:33
nap::audio::OutputPin
Definition: audiopin.h:204
nap::audio::Node
Definition: audionode.h:33
nap::audio::VideoNode::getOutput
OutputPin & getOutput(int channel)
Definition: videoaudio.h:43
nap
Definition: templateapp.h:17