AJA NTV2 SDK  17.5.0.1242
NTV2 SDK 17.5.0.1242
NTV2CCPlayer Class Reference

I am an object that can inject text captions into an SDI output of an AJA device in real time. I'm capable of simultaneously generating and injecting text into more than one NTV2Line21Channel, at independent rates, and NTV2Line21Modes. Each caption channel's configuration is specified by a CCGeneratorConfig struct. I make use of the AJACircularBuffer, which simplifies implementing a producer/consumer model, in which a "producer" thread produces the background video frames, and a "consumer" thread (i.e., the "play" thread) sends those frames to the AJA device. I demonstrate how to use the "AJA CC LIB" caption library to embed captions into an SDI output signal. More...

#include <ntv2ccplayer.h>

Public Member Functions

 NTV2CCPlayer (const CCPlayerConfig &inConfigData)
 Constructs me using the given configuration settings. More...
 
virtual ~NTV2CCPlayer (void)
 
virtual AJAStatus Init (void)
 Initializes me and prepares me to Run. More...
 
virtual AJAStatus Run (void)
 Runs me. More...
 
virtual void Quit (const bool inQuitImmediately=(0))
 Stops me. More...
 
virtual void GetStatus (size_t &outMessagesQueued, size_t &outBytesQueued, size_t &outTotMsgsEnq, size_t &outTotBytesEnq, size_t &outTotMsgsDeq, size_t &outTotBytesDeq, size_t &outMaxQueDepth, size_t &outDroppedFrames) const
 Returns status information from my caption encoder. More...
 

Protected Types

typedef std::vector< AJAThreadAJAThreadList
 
typedef AJAThreadList::const_iterator AJAThreadListConstIter
 

Protected Member Functions

virtual AJAStatus SetUpBackgroundPatternBuffer (void)
 Sets up my gray background field. More...
 
virtual AJAStatus SetUpOutputVideo (void)
 Sets up everything I need to play video. More...
 
virtual AJAStatus RouteOutputSignal (void)
 Sets up signal routing for playout. More...
 
virtual void StartPlayoutThread (void)
 Starts my playout thread. More...
 
virtual void PlayoutFrames (void)
 Repeatedly plays frames (until time to quit). More...
 
virtual void StartCaptionGeneratorThreads (void)
 Starts my caption generator threads. More...
 
virtual void GenerateCaptions (const NTV2Line21Channel inCCChannel)
 This is the thread function that produces caption messages for a given caption channel. More...
 
virtual bool DeviceAncExtractorIsAvailable (void)
 
TimecodeFormat NTV2FrameRate2TimecodeFormat (NTV2FrameRate inFrameRate)
 

Static Protected Member Functions

static void PlayThreadStatic (AJAThread *pThread, void *pContext)
 This is the playout thread's static callback function that gets called when the playout thread runs. This function gets "Attached" to the playout thread's AJAThread instance. More...
 
static void CaptionGeneratorThreadStatic (AJAThread *pThread, void *pContext)
 This is the caption generator thread's static callback function that gets called when the caption generator thread runs. This function gets "Attached" to the generator thread's AJAThread instance. More...
 

Detailed Description

I am an object that can inject text captions into an SDI output of an AJA device in real time. I'm capable of simultaneously generating and injecting text into more than one NTV2Line21Channel, at independent rates, and NTV2Line21Modes. Each caption channel's configuration is specified by a CCGeneratorConfig struct. I make use of the AJACircularBuffer, which simplifies implementing a producer/consumer model, in which a "producer" thread produces the background video frames, and a "consumer" thread (i.e., the "play" thread) sends those frames to the AJA device. I demonstrate how to use the "AJA CC LIB" caption library to embed captions into an SDI output signal.

Definition at line 125 of file ntv2ccplayer.h.

Member Typedef Documentation

◆ AJAThreadList

typedef std::vector<AJAThread> NTV2CCPlayer::AJAThreadList
protected

Definition at line 219 of file ntv2ccplayer.h.

◆ AJAThreadListConstIter

typedef AJAThreadList::const_iterator NTV2CCPlayer::AJAThreadListConstIter
protected

Definition at line 220 of file ntv2ccplayer.h.

Constructor & Destructor Documentation

◆ NTV2CCPlayer()

NTV2CCPlayer::NTV2CCPlayer ( const CCPlayerConfig inConfigData)

Constructs me using the given configuration settings.

Note
I'm not completely initialized and ready for use until after my Init method has been called.
Parameters
[in]inConfigDataSpecifies the player configuration.

Definition at line 859 of file ntv2ccplayer.cpp.

◆ ~NTV2CCPlayer()

NTV2CCPlayer::~NTV2CCPlayer ( void  )
virtual

Definition at line 878 of file ntv2ccplayer.cpp.

Member Function Documentation

◆ CaptionGeneratorThreadStatic()

void NTV2CCPlayer::CaptionGeneratorThreadStatic ( AJAThread pThread,
void *  pContext 
)
staticprotected

This is the caption generator thread's static callback function that gets called when the caption generator thread runs. This function gets "Attached" to the generator thread's AJAThread instance.

Parameters
[in]pThreadA valid pointer to the caption generator thread's AJAThread instance.
[in]pContextContext information to pass to the thread. (For this application, this will be set to point to the NTV2CCPlayer instance.)

Definition at line 1390 of file ntv2ccplayer.cpp.

◆ DeviceAncExtractorIsAvailable()

bool NTV2CCPlayer::DeviceAncExtractorIsAvailable ( void  )
protectedvirtual
Returns
True if the device supports ancillary data extraction, and the driver supports the new AutoCirculate calls.

Definition at line 930 of file ntv2ccplayer.cpp.

◆ GenerateCaptions()

void NTV2CCPlayer::GenerateCaptions ( const NTV2Line21Channel  inCCChannel)
protectedvirtual

This is the thread function that produces caption messages for a given caption channel.

Parameters
[in]inCCChannelSpecifies the caption channel to generate captions for.

Definition at line 1407 of file ntv2ccplayer.cpp.

◆ GetStatus()

void NTV2CCPlayer::GetStatus ( size_t &  outMessagesQueued,
size_t &  outBytesQueued,
size_t &  outTotMsgsEnq,
size_t &  outTotBytesEnq,
size_t &  outTotMsgsDeq,
size_t &  outTotBytesDeq,
size_t &  outMaxQueDepth,
size_t &  outDroppedFrames 
) const
virtual

Returns status information from my caption encoder.

Parameters
[out]outMessagesQueuedReceives the current number of messages currently enqueued in my caption encoder.
[out]outBytesQueuedReceives the current number of bytes currently enqueued in my caption encoder.
[out]outTotMsgsEnqReceives the total number of messages ever enqueued by my caption encoder.
[out]outTotBytesEnqReceives the total number of bytes ever enqueued by my caption encoder.
[out]outTotMsgsDeqReceives the total number of messages ever dequeued by my caption encoder.
[out]outTotBytesDeqReceives the total number of bytes ever dequeued by my caption encoder.
[out]outMaxQueDepthReceives the encoder's highest queue depth.
[out]outDroppedFramesReceives the dropped frame count.

Definition at line 1825 of file ntv2ccplayer.cpp.

◆ Init()

AJAStatus NTV2CCPlayer::Init ( void  )
virtual

Initializes me and prepares me to Run.

Definition at line 944 of file ntv2ccplayer.cpp.

◆ NTV2FrameRate2TimecodeFormat()

TimecodeFormat NTV2CCPlayer::NTV2FrameRate2TimecodeFormat ( NTV2FrameRate  inFrameRate)
protected

◆ PlayoutFrames()

void NTV2CCPlayer::PlayoutFrames ( void  )
protectedvirtual

Repeatedly plays frames (until time to quit).

Definition at line 1571 of file ntv2ccplayer.cpp.

◆ PlayThreadStatic()

void NTV2CCPlayer::PlayThreadStatic ( AJAThread pThread,
void *  pContext 
)
staticprotected

This is the playout thread's static callback function that gets called when the playout thread runs. This function gets "Attached" to the playout thread's AJAThread instance.

Parameters
[in]pThreadA valid pointer to the playout thread's AJAThread instance.
[in]pContextContext information to pass to the thread. (For this application, this will be set to point to the NTV2CCPlayer instance.)

Definition at line 1562 of file ntv2ccplayer.cpp.

◆ Quit()

void NTV2CCPlayer::Quit ( const bool  inQuitImmediately = (0))
virtual

Stops me.

Parameters
[in]inQuitImmediatelyIf true, terminates the caption player immediately; otherwise, waits until all captions enqueued in the encoder have finished playing. Defaults to false;
Note
This method will block until my caption generator and playout threads have terminated.

Definition at line 893 of file ntv2ccplayer.cpp.

◆ RouteOutputSignal()

AJAStatus NTV2CCPlayer::RouteOutputSignal ( void  )
protectedvirtual

Sets up signal routing for playout.

Definition at line 1189 of file ntv2ccplayer.cpp.

◆ Run()

AJAStatus NTV2CCPlayer::Run ( void  )
virtual

Runs me.

Note
Do not call this method without first calling my Init method.

Definition at line 1350 of file ntv2ccplayer.cpp.

◆ SetUpBackgroundPatternBuffer()

AJAStatus NTV2CCPlayer::SetUpBackgroundPatternBuffer ( void  )
protectedvirtual

Sets up my gray background field.

Definition at line 1018 of file ntv2ccplayer.cpp.

◆ SetUpOutputVideo()

AJAStatus NTV2CCPlayer::SetUpOutputVideo ( void  )
protectedvirtual

Sets up everything I need to play video.

Definition at line 1050 of file ntv2ccplayer.cpp.

◆ StartCaptionGeneratorThreads()

void NTV2CCPlayer::StartCaptionGeneratorThreads ( void  )
protectedvirtual

Starts my caption generator threads.

Definition at line 1375 of file ntv2ccplayer.cpp.

◆ StartPlayoutThread()

void NTV2CCPlayer::StartPlayoutThread ( void  )
protectedvirtual

Starts my playout thread.

Definition at line 1552 of file ntv2ccplayer.cpp.


The documentation for this class was generated from the following files: