AJA NTV2 SDK  17.5.0.1242
NTV2 SDK 17.5.0.1242
ntv2streamplayer.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: MIT */
9 #ifndef _NTV2STREAMPLAYER_H
10 #define _NTV2STREAMPLAYER_H
11 
12 #include "ntv2democommon.h"
13 #include "ajabase/system/thread.h"
15 
16 
25 {
26  // Public Instance Methods
27  public:
33  NTV2StreamPlayer (const PlayerConfig & inConfig);
34 
35  virtual ~NTV2StreamPlayer (void);
36 
37  virtual AJAStatus Init (void);
38 
43  virtual AJAStatus Run (void);
44 
45  virtual void Quit (void);
46 
47  virtual bool IsRunning (void) const {return !mGlobalQuit;}
48 
53  virtual void GetStreamStatus (NTV2StreamChannel & outStatus);
54 
55 
56  // Protected Instance Methods
57  protected:
58  virtual AJAStatus SetUpVideo (void);
59  virtual bool RouteOutputSignal (void);
60  virtual AJAStatus SetUpHostBuffers (void);
61  virtual AJAStatus SetUpTestPatternBuffers (void);
62  virtual void StartConsumerThread (void);
63  virtual void ConsumeFrames (void);
64  virtual void StartProducerThread (void);
65  virtual void ProduceFrames (void);
66 
67  // Protected Class Methods
68  protected:
75  static void ConsumerThreadStatic (AJAThread * pThread, void * pContext);
76 
83  static void ProducerThreadStatic (AJAThread * pThread, void * pContext);
84 
85 
86  // Private Member Data
87  private:
88  struct FrameData
89  {
90  NTV2Buffer fVideoBuffer;
91  bool fDataReady;
92  };
93  typedef std::vector<FrameData> FrameDataArray;
94  typedef FrameDataArray::iterator FrameDataArrayIter;
95  typedef std::vector<NTV2Buffer> NTV2Buffers;
96 
97  PlayerConfig mConfig;
98  AJAThread mConsumerThread;
99  AJAThread mProducerThread;
100  CNTV2Card mDevice;
101  NTV2DeviceID mDeviceID;
102  NTV2TaskMode mSavedTaskMode;
103  ULWord mCurrentFrame;
104  ULWord mCurrentSample;
105  NTV2FormatDesc mFormatDesc;
106 
107  bool mGlobalQuit;
108  AJATimeCodeBurn mTCBurner;
109  FrameDataArray mHostBuffers;
110  ULWord mProducerIndex;
111  ULWord mConsumerIndex;
112  NTV2Buffers mTestPatRasters;
113 
114 }; // NTV2StreamPlayer
115 
116 #endif // _NTV2STREAMPLAYER_H
NTV2TaskMode
enum NTV2EveryFrameTaskMode NTV2TaskMode
NTV2StreamChannel
Definition: ntv2publicinterface.h:8702
NTV2FormatDescriptor
Describes a video frame for a given video standard or format and pixel format, including the total nu...
Definition: ntv2formatdescriptor.h:41
NTV2Buffer
A generic user-space buffer object that has an address and a length. Used most often to share an arbi...
Definition: ntv2publicinterface.h:6022
NTV2StreamPlayer::SetUpHostBuffers
virtual AJAStatus SetUpHostBuffers(void)
Sets up my host video & audio buffers.
Definition: ntv2streamplayer.cpp:205
NTV2StreamPlayer::Init
virtual AJAStatus Init(void)
Initializes me and prepares me to Run.
Definition: ntv2streamplayer.cpp:72
NTV2DeviceID
NTV2DeviceID
Identifies a specific AJA NTV2 device model number. The NTV2DeviceID is actually the PROM part number...
Definition: ntv2enums.h:20
NTV2StreamPlayer
I play out SD or HD test pattern (with timecode) to an output of an AJA device with or without audio ...
Definition: ntv2streamplayer.h:24
NTV2StreamPlayer::ConsumeFrames
virtual void ConsumeFrames(void)
My consumer thread that repeatedly plays frames using AutoCirculate (until quit).
Definition: ntv2streamplayer.cpp:384
NTV2StreamPlayer::Quit
virtual void Quit(void)
Gracefully stops me from running.
Definition: ntv2streamplayer.cpp:52
AJAThread
Definition: thread.h:69
NTV2StreamPlayer::~NTV2StreamPlayer
virtual ~NTV2StreamPlayer(void)
Definition: ntv2streamplayer.cpp:45
timecodeburn.h
Declares the AJATimeCodeBurn class.
AJAStatus
AJAStatus
Definition: types.h:378
NTV2StreamPlayer::StartConsumerThread
virtual void StartConsumerThread(void)
Starts my consumer thread.
Definition: ntv2streamplayer.cpp:362
NTV2StreamPlayer::SetUpVideo
virtual AJAStatus SetUpVideo(void)
Performs all video setup.
Definition: ntv2streamplayer.cpp:143
NTV2StreamPlayer::SetUpTestPatternBuffers
virtual AJAStatus SetUpTestPatternBuffers(void)
Creates my test pattern buffers.
Definition: ntv2streamplayer.cpp:236
ULWord
uint32_t ULWord
Definition: ajatypes.h:255
NTV2StreamPlayer::ConsumerThreadStatic
static void ConsumerThreadStatic(AJAThread *pThread, void *pContext)
This is the consumer thread's static callback function that gets called when the consumer thread star...
Definition: ntv2streamplayer.cpp:373
CNTV2Card
I interrogate and control an AJA video/audio capture/playout device.
Definition: ntv2card.h:28
NTV2StreamPlayer::Run
virtual AJAStatus Run(void)
Runs me.
Definition: ntv2streamplayer.cpp:348
ntv2democommon.h
This file contains some structures, constants, classes and functions that are used in some of the dem...
NTV2StreamPlayer::ProducerThreadStatic
static void ProducerThreadStatic(AJAThread *pThread, void *pContext)
This is the producer thread's static callback function that gets called when the producer thread star...
Definition: ntv2streamplayer.cpp:525
PlayerConfig
Configures an NTV2Player instance.
Definition: ntv2democommon.h:319
AJATimeCodeBurn
Definition: timecodeburn.h:19
NTV2StreamPlayer::RouteOutputSignal
virtual bool RouteOutputSignal(void)
Performs all widget/signal routing for playout.
Definition: ntv2streamplayer.cpp:282
thread.h
Declares the AJAThread class.
NTV2StreamPlayer::NTV2StreamPlayer
NTV2StreamPlayer(const PlayerConfig &inConfig)
Constructs me using the given configuration settings.
Definition: ntv2streamplayer.cpp:28
NTV2StreamPlayer::StartProducerThread
virtual void StartProducerThread(void)
Starts my producer thread.
Definition: ntv2streamplayer.cpp:515
NTV2StreamPlayer::GetStreamStatus
virtual void GetStreamStatus(NTV2StreamChannel &outStatus)
Provides status information about my output (playout) process.
Definition: ntv2streamplayer.cpp:602
NTV2StreamPlayer::ProduceFrames
virtual void ProduceFrames(void)
My producer thread that repeatedly produces video frames.
Definition: ntv2streamplayer.cpp:534