18 #define NTV2_AUDIOSIZE_MAX (401 * 1024) 25 const bool inQuadMode,
26 const uint32_t inAudioChannels,
27 const bool inTimeCodeBurn,
28 const bool inInfoMode,
30 const uint32_t inMaxFrames)
41 mDeviceSpecifier (inDeviceSpecifier),
42 mWithAudio (inAudioChannels != 0),
55 mWithInfo (inInfoMode),
56 mWithAnc (inTimeCodeBurn),
59 mNumAudioChannels (0),
60 mFileAudioChannels (inAudioChannels),
61 mMaxFrames (inMaxFrames),
63 mLastFrameInput (
false),
64 mLastFrameRaw (
false),
65 mLastFrameHevc (
false),
66 mLastFrameVideo (
false),
67 mLastFrameAudio (
false),
69 mVideoInputFrameCount (0),
70 mVideoProcessFrameCount (0),
71 mCodecRawFrameCount (0),
72 mCodecHevcFrameCount (0),
73 mVideoFileFrameCount (0),
74 mAudioFileFrameCount (0)
76 ::memset (mACInputBuffer, 0x0,
sizeof (mACInputBuffer));
77 ::memset (mVideoRawBuffer, 0x0,
sizeof (mVideoRawBuffer));
78 ::memset (mVideoHevcBuffer, 0x0,
sizeof (mVideoHevcBuffer));
79 ::memset (mAudioInputBuffer, 0x0,
sizeof (mAudioInputBuffer));
107 if (mACInputBuffer[bufferNdx].pVideoBuffer)
112 if (mACInputBuffer[bufferNdx].pInfoBuffer)
117 if (mACInputBuffer[bufferNdx].pAudioBuffer)
123 if (mVideoRawBuffer[bufferNdx].pVideoBuffer)
128 if (mVideoRawBuffer[bufferNdx].pInfoBuffer)
133 if (mVideoRawBuffer[bufferNdx].pAudioBuffer)
139 if (mVideoHevcBuffer[bufferNdx].pVideoBuffer)
144 if (mVideoHevcBuffer[bufferNdx].pInfoBuffer)
149 if (mVideoHevcBuffer[bufferNdx].pAudioBuffer)
160 if (mAudioInputBuffer[bufferNdx].pVideoBuffer)
165 if (mAudioInputBuffer[bufferNdx].pInfoBuffer)
167 delete [] mAudioInputBuffer[bufferNdx].
pInfoBuffer;
170 if (mAudioInputBuffer[bufferNdx].pAudioBuffer)
183 if (mM31 && !mLastFrame && !mGlobalQuit)
191 for (i = 0; i < timeout; i++)
193 if (mLastFrameVideo && (!mWithAudio || mLastFrameAudio))
break;
197 { cerr <<
"## ERROR: Wait for last frame timeout" << endl; }
201 { cerr <<
"## ERROR: ChangeEHState ready to stop failed" << endl; }
204 { cerr <<
"## ERROR: ChangeEHState stop failed" << endl; }
208 { cerr <<
"## ERROR: ChangeVInState stop failed" << endl; }
214 { cerr <<
"## ERROR: ChangeMainState to init failed" << endl; }
221 while (mACInputThread.
Active())
224 while (mVideoProcessThread.
Active())
227 while (mCodecRawThread.
Active())
230 while (mCodecHevcThread.
Active())
233 while (mVideoFileThread.
Active())
236 while (mAudioFileThread.
Active())
265 { cerr <<
"## ERROR: Device '" << mDeviceSpecifier <<
"' not found" << endl;
return AJA_STATUS_OPEN; }
268 mM31 =
new CNTV2m31 (&mDevice);
281 mVideoFormat = CNTV2m31::GetPresetVideoFormat(mPreset);
282 mPixelFormat = CNTV2m31::GetPresetFrameBufferFormat(mPreset);
283 mVif = CNTV2m31::IsPresetVIF(mPreset);
284 mQuad = CNTV2m31::IsPresetUHD(mPreset);
285 mInterlaced = CNTV2m31::IsPresetInterlaced(mPreset);
307 switch (mInputChannel)
340 if(!CNTV2m31::ConvertVideoFormatToPreset(mVideoFormat, mPixelFormat, mVif, mPreset))
343 mQuad = CNTV2m31::IsPresetUHD(mPreset);
344 mInterlaced = CNTV2m31::IsPresetInterlaced(mPreset);
367 status = mHevcCommon->
SetupHEVC (mM31, mPreset, mEncodeChannel, mMultiStream, mWithInfo);
377 if (mMultiStream) oss <<
"raw_" << (mInputChannel+1) <<
".hevc";
else oss <<
"raw.hevc";
387 if (mMultiStream) oss <<
"raw_" << (mInputChannel+1) <<
".txt";
else oss <<
"raw.txt";
397 if (mMultiStream) oss <<
"raw_" << (mInputChannel+1) <<
".aiff";
else oss <<
"raw.aiff";
476 else if (mMultiStream)
483 mDevice.
SetVideoFormat (mVideoFormat,
false,
false, mInputChannel);
590 for (
unsigned bufferNdx = 0; bufferNdx <
VIDEO_RING_SIZE; bufferNdx++ )
593 mACInputBuffer[bufferNdx].
pVideoBuffer =
new uint32_t [mVideoBufferSize/4];
597 mACInputBuffer[bufferNdx].
pInfoBuffer =
new uint32_t [mPicInfoBufferSize/4];
601 mACInputCircularBuffer.
Add (& mACInputBuffer[bufferNdx]);
606 for (
unsigned bufferNdx = 0; bufferNdx <
VIDEO_RING_SIZE; bufferNdx++ )
609 mVideoRawBuffer[bufferNdx].
pVideoBuffer =
new uint32_t [mVideoBufferSize/4];
613 mVideoRawBuffer[bufferNdx].
pInfoBuffer =
new uint32_t [mPicInfoBufferSize/4];
617 mVideoRawCircularBuffer.
Add (& mVideoRawBuffer[bufferNdx]);
622 for (
unsigned bufferNdx = 0; bufferNdx <
VIDEO_RING_SIZE; bufferNdx++ )
625 mVideoHevcBuffer[bufferNdx].
pVideoBuffer =
new uint32_t [mVideoBufferSize/4];
629 mVideoHevcBuffer[bufferNdx].
pInfoBuffer =
new uint32_t [mEncInfoBufferSize/4];
633 mVideoHevcCircularBuffer.
Add (& mVideoHevcBuffer[bufferNdx]);
640 for (
unsigned bufferNdx = 0; bufferNdx <
AUDIO_RING_SIZE; bufferNdx++ )
643 mAudioInputBuffer[bufferNdx].
pAudioBuffer =
new uint32_t [mAudioBufferSize/4];
646 mAudioInputCircularBuffer.
Add (& mAudioInputBuffer[bufferNdx]);
775 cout << endl <<
"## WARNING: No video signal present on the input connector" << endl;
798 mACInputThread.
Start();
808 NTV2EncodeHEVC * pApp (reinterpret_cast <NTV2EncodeHEVC *> (pContext));
821 { cerr <<
"## ERROR: Device '" << mDeviceSpecifier <<
"' not found" << endl;
return; }
843 inputXfer.
SetVideoBuffer (pVideoData->pVideoBuffer, pVideoData->videoBufferSize);
858 pVideoData->videoDataSize = pVideoData->videoBufferSize;
859 pVideoData->audioDataSize = 0;
860 pVideoData->lastFrame = mLastFrame;
862 if (mWithAudio && pAudioData)
874 pVideoData->timeCodeDBB = timecode.
fDBB;
875 pVideoData->timeCodeLow = timecode.
fLo;
876 pVideoData->timeCodeHigh = timecode.
fHi;
886 memset(pInfo, 0, pVideoData->infoBufferSize);
893 pPicData->ptsValueLow = (uint32_t)(pts & 0xffffffff);
894 pPicData->ptsValueHigh = (uint32_t)((pts >> 32) & 0x1);
895 pPicData->pictureNumber = mVideoInputFrameCount + 1;
902 pPicData->serialNumber = mVideoInputFrameCount*2;
903 pPicData->pictureNumber = mVideoInputFrameCount*2 + 1;
913 pPicData->serialNumber = mVideoInputFrameCount*2 + 1;
914 pPicData->ptsValueLow = (uint32_t)(pts & 0xffffffff);
915 pPicData->ptsValueHigh = (uint32_t)((pts >> 32) & 0x1);
916 pPicData->pictureNumber = mVideoInputFrameCount*2 + 2;
923 if(pVideoData->lastFrame && !mLastFrameInput)
925 printf (
"\nCapture last frame number %d\n", mVideoInputFrameCount );
926 mLastFrameInput =
true;
929 mVideoInputFrameCount++;
931 if (mWithAudio && pAudioData)
961 mVideoProcessThread.
Start();
971 NTV2EncodeHEVC * pApp (reinterpret_cast <NTV2EncodeHEVC *> (pContext));
992 mVideoProcessFrameCount++;
1012 mCodecRawThread.
Start();
1022 NTV2EncodeHEVC * pApp (reinterpret_cast <NTV2EncodeHEVC *> (pContext));
1036 { cerr <<
"## ERROR: Device '" << mDeviceSpecifier <<
"' not found" << endl;
return; }
1039 m31 =
new CNTV2m31 (&ntv2Device);
1041 while (!mGlobalQuit)
1055 if (mCodecRawFrameCount == 3)
1068 m31->RawTransfer(mPreset, mEncodeChannel,
1069 (uint8_t*)pFrameData->pVideoBuffer,
1070 pFrameData->videoDataSize,
1071 (uint8_t*)pFrameData->pInfoBuffer,
1072 pFrameData->infoDataSize,
1075 m31->RawTransfer(mPreset, mEncodeChannel,
1076 (uint8_t*)pFrameData->pVideoBuffer,
1077 pFrameData->videoDataSize,
1079 pFrameData->infoDataSize2,
1080 true, pFrameData->lastFrame);
1084 m31->RawTransfer(mPreset, mEncodeChannel,
1085 (uint8_t*)pFrameData->pVideoBuffer,
1086 pFrameData->videoDataSize,
1089 m31->RawTransfer(mPreset, mEncodeChannel,
1090 (uint8_t*)pFrameData->pVideoBuffer,
1091 pFrameData->videoDataSize,
1092 true, pFrameData->lastFrame);
1099 m31->RawTransfer(mEncodeChannel,
1100 (uint8_t*)pFrameData->pVideoBuffer,
1101 pFrameData->videoDataSize,
1102 (uint8_t*)pFrameData->pInfoBuffer,
1103 pFrameData->infoDataSize,
1104 pFrameData->lastFrame);
1108 m31->RawTransfer(mEncodeChannel,
1109 (uint8_t*)pFrameData->pVideoBuffer,
1110 pFrameData->videoDataSize,
1111 pFrameData->lastFrame);
1115 if (pFrameData->lastFrame)
1117 mLastFrameRaw =
true;
1120 mCodecRawFrameCount++;
1144 mCodecHevcThread.
Start();
1154 NTV2EncodeHEVC * pApp (reinterpret_cast <NTV2EncodeHEVC *> (pContext));
1167 { cerr <<
"## ERROR: Device '" << mDeviceSpecifier <<
"' not found" << endl;
return; }
1170 m31 =
new CNTV2m31 (&ntv2Device);
1172 while (!mGlobalQuit)
1178 if (!mLastFrameHevc)
1183 uint8_t* pVideoBuffer = (uint8_t*)pFrameData->
pVideoBuffer;
1184 uint8_t* pInfoBuffer = (uint8_t*)pFrameData->pInfoBuffer;
1185 uint32_t videoBufferSize = pFrameData->videoBufferSize;
1189 m31->EncTransfer(mEncodeChannel,
1194 pFrameData->videoDataSize,
1195 pFrameData->infoDataSize,
1196 pFrameData->lastFrame);
1199 pFrameData->videoDataSize = mHevcCommon->
AlignDataBuffer(pVideoBuffer,
1201 pFrameData->videoDataSize,
1206 pFrameData->infoDataSize,
1210 pVideoBuffer = ((uint8_t*)pFrameData->pVideoBuffer) + pFrameData->videoDataSize;
1211 pInfoBuffer = ((uint8_t*)pFrameData->pInfoBuffer) +
sizeof(
HevcEncodedInfo);
1212 videoBufferSize = pFrameData->videoBufferSize - pFrameData->videoDataSize;
1216 m31->EncTransfer(mEncodeChannel,
1221 pFrameData->videoDataSize2,
1222 pFrameData->infoDataSize2,
1223 pFrameData->lastFrame);
1226 pFrameData->videoDataSize2 = mHevcCommon->
AlignDataBuffer(pVideoBuffer,
1228 pFrameData->videoDataSize2,
1233 pFrameData->infoDataSize2,
1239 m31->EncTransfer(mEncodeChannel,
1240 (uint8_t*)pFrameData->pVideoBuffer,
1241 pFrameData->videoBufferSize,
1242 (uint8_t*)pFrameData->pInfoBuffer,
1243 pFrameData->infoBufferSize,
1244 pFrameData->videoDataSize,
1245 pFrameData->infoDataSize,
1246 pFrameData->lastFrame);
1249 pFrameData->videoDataSize = mHevcCommon->
AlignDataBuffer(pFrameData->pVideoBuffer,
1250 pFrameData->videoBufferSize,
1251 pFrameData->videoDataSize,
1254 pFrameData->infoDataSize = mHevcCommon->
AlignDataBuffer(pFrameData->pInfoBuffer,
1255 pFrameData->infoBufferSize,
1256 pFrameData->infoDataSize,
1260 if (pFrameData->lastFrame)
1262 mLastFrameHevc =
true;
1265 mCodecHevcFrameCount++;
1282 mVideoFileThread.
Start();
1292 NTV2EncodeHEVC * pApp (reinterpret_cast <NTV2EncodeHEVC *> (pContext));
1300 while (!mGlobalQuit)
1306 if (!mLastFrameVideo)
1309 mHevcCommon->
WriteHevcData(pFrameData->pVideoBuffer, pFrameData->videoDataSize + pFrameData->videoDataSize2);
1314 mHevcCommon->
WriteEncData(pFrameData->pInfoBuffer, pFrameData->infoDataSize);
1319 if (pFrameData->lastFrame)
1321 printf (
"Video file last frame number %d\n", mVideoFileFrameCount );
1322 mLastFrameVideo =
true;
1325 mVideoFileFrameCount++;
1341 mAudioFileThread.
Start();
1351 NTV2EncodeHEVC * pApp (reinterpret_cast <NTV2EncodeHEVC *> (pContext));
1359 while (!mGlobalQuit)
1365 if (!mLastFrameAudio)
1368 mHevcCommon->
WriteAiffData(pFrameData->pAudioBuffer, mNumAudioChannels, pFrameData->audioDataSize/mNumAudioChannels/4);
1370 if (pFrameData->lastFrame)
1372 printf (
"Audio file last frame number %d\n", mAudioFileFrameCount );
1373 mLastFrameAudio =
true;
1377 mAudioFileFrameCount++;
1419 std::string timeString;
1421 mTimeCode.
Set(frameNumber);
1423 mTimeCode.
QueryString(timeString, mTimeBase,
false);
1426 mTimeCode.
QueryString(timeString, mTimeBase,
false);
virtual void RouteInputSignal(void)
Sets up device routing for capture.
NTV2FrameRate GetNTV2FrameRateFromVideoFormat(const NTV2VideoFormat inVideoFormat)
virtual NTV2VideoFormat GetSDIInputVideoFormat(NTV2Channel inChannel, bool inIsProgressive=(0))
Returns the video format of the signal that is present on the given SDI input source.
Specifies the device's internal clock.
virtual bool SetReference(const NTV2ReferenceSource inRefSource, const bool inKeepFramePulseSelect=(0))
Sets the device's clock reference source. See Video Output Clocking & Synchronization for more inform...
virtual bool ReleaseStreamForApplication(ULWord inApplicationType, int32_t inProcessID)
Releases exclusive use of the AJA device for the given process, permitting other processes to acquire...
virtual ~NTV2EncodeHEVC()
void SetAJAFrameRate(AJA_FrameRate ajaFrameRate)
virtual bool AddConnection(const NTV2InputXptID inSignalInput, const NTV2OutputXptID inSignalOutput=NTV2_XptBlack)
Adds a connection between a widget's signal input (sink) and another widget's signal output (source)...
AJAStatus Add(FrameDataPtr pInFrameData)
Appends a new frame buffer to me, increasing my frame storage capacity by one frame.
uint32_t * pAudioBuffer
Pointer to host audio buffer.
I interrogate and control an AJA video/audio capture/playout device.
NTV2FrameBufferFormat
Identifies a particular video frame buffer pixel format. See Device Frame Buffer Formats for details...
bool SetBuffers(ULWord *pInVideoBuffer, const ULWord inVideoByteCount, ULWord *pInAudioBuffer, const ULWord inAudioByteCount, ULWord *pInANCBuffer, const ULWord inANCByteCount, ULWord *pInANCF2Buffer=NULL, const ULWord inANCF2ByteCount=0)
Sets my buffers for use in a subsequent call to CNTV2Card::AutoCirculateTransfer. ...
virtual bool SetVideoFormat(const NTV2VideoFormat inVideoFormat, const bool inIsAJARetail=(!(0)), const bool inKeepVancSettings=(0), const NTV2Channel inChannel=NTV2_CHANNEL1)
Configures the AJA device to handle a specific video format.
virtual bool Set4kSquaresEnable(const bool inIsEnabled, const NTV2Channel inChannel)
Enables or disables SMPTE 425 "2K quadrants" mode for the given FrameStore bank on the device...
virtual void AudioFileWorker(void)
Repeatedly removes audio samples from the audio input ring and writes them to the audio output file...
ULWord GetBufferLevel(void) const
double GetFramesPerSecond(const NTV2FrameRate inFrameRate)
#define AJA_FAILURE(_status_)
NTV2InputSource NTV2ChannelToInputSource(const NTV2Channel inChannel, const NTV2IOKinds inKinds=NTV2_IOKINDS_SDI)
virtual void StartVideoProcessThread(void)
Start the video process thread.
Capture (input) mode, which writes into device SDRAM.
uint32_t videoBufferSize
Size of host video buffer (bytes)
struct HevcEncodedInfo HevcEncodedInfo
Declares the AJATime class.
virtual AJAStatus SetPriority(AJAThreadPriority priority)
virtual bool GetSDIInput3GbPresent(bool &outValue, const NTV2Channel channel)
virtual void VideoInputWorker(void)
Repeatedly captures video frames using AutoCirculate and add them to the video input ring...
FrameDataPtr StartConsumeNextBuffer(void)
The thread that's responsible for processing incoming frames – the consumer – calls this function t...
Obtain audio samples from the audio that's embedded in the video HANC.
AJAStatus CreateAiffFile(const std::string &inFileName, uint32_t numChannels, uint32_t maxFrames, uint32_t bufferSize)
virtual M31VideoPreset GetCodecPreset(void)
Get the codec preset.
virtual bool SetAudioRate(const NTV2AudioRate inRate, const NTV2AudioSystem inAudioSystem=NTV2_AUDIOSYSTEM_1)
Sets the NTV2AudioRate for the given Audio System.
virtual AJAStatus Start()
virtual bool EnableInputInterrupt(const NTV2Channel channel=NTV2_CHANNEL1)
Allows the CNTV2Card instance to wait for and respond to input vertical blanking interrupts originati...
virtual bool SubscribeInputVerticalEvent(const NTV2Channel inChannel=NTV2_CHANNEL1)
Causes me to be notified when an input vertical blanking interrupt occurs on the given input channel...
Declares the NTV2EncodeHEVC class.
void EndConsumeNextBuffer(void)
The consumer thread calls this function to signal that it has finished processing the frame it obtain...
virtual bool AutoCirculateGetStatus(const NTV2Channel inChannel, AUTOCIRCULATE_STATUS &outStatus)
Returns the current AutoCirculate status for the given channel.
NTV2EncodeHEVC(const std::string inDeviceSpecifier="0", const NTV2Channel inChannel=NTV2_CHANNEL1, const M31VideoPreset inM31Preset=M31_FILE_1280X720_420_8_5994p, const NTV2FrameBufferFormat inPixelFormat=NTV2_FBF_10BIT_YCBCR_420PL2, const bool inQuadMode=(0), const uint32_t inAudioChannels=0, const bool inTimeCodeBurn=(0), const bool inInfoMode=(0), const bool inTsiMode=(0), const uint32_t inMaxFrames=0xffffffff)
Constructs me using the given settings.
virtual bool SetFrameBufferFormat(NTV2Channel inChannel, NTV2FrameBufferFormat inNewFormat, bool inIsAJARetail=(!(0)), NTV2HDRXferChars inXferChars=NTV2_VPID_TC_SDR_TV, NTV2HDRColorimetry inColorimetry=NTV2_VPID_Color_Rec709, NTV2HDRLuminance inLuminance=NTV2_VPID_Luminance_YCbCr)
Sets the frame buffer format for the given FrameStore on the AJA device.
NTV2EmbeddedAudioInput NTV2ChannelToEmbeddedAudioInput(const NTV2Channel inChannel)
Converts the given NTV2Channel value into its equivalent NTV2EmbeddedAudioInput.
NTV2Channel
These enum values are mostly used to identify a specific widget_framestore. They're also commonly use...
This class is a collection of widget input-to-output connections that can be applied all-at-once to a...
virtual class DeviceCapabilities & features(void)
virtual bool SetMultiFormatMode(const bool inEnable)
Enables or disables multi-format (per channel) device operation. If enabled, each device channel can ...
AJA_FrameRate GetAJAFrameRate(NTV2FrameRate frameRate)
AJAStatus DetermineInputFormat(NTV2VideoFormat sdiFormat, bool quad, NTV2VideoFormat &videoFormat)
int64_t FramesToMicroseconds(int64_t frames, bool round=false) const
uint32_t timeCodeHigh
Time code data high.
ULWord GetProcessedFrameCount(void) const
uint32_t audioBufferSize
Size of host audio buffer (bytes)
uint32_t infoBufferSize
Size of the host information buffer (bytes)
This struct replaces the old RP188_STRUCT.
UWord GetNumAudioSystems(void)
virtual bool SetAudioSystemInputSource(const NTV2AudioSystem inAudioSystem, const NTV2AudioSource inAudioSource, const NTV2EmbeddedAudioInput inEmbeddedInput)
Sets the audio source for the given NTV2AudioSystem on the device.
HevcPictureData pictureData
struct HevcPictureData HevcPictureData
Playout (output) mode, which reads from device SDRAM.
ULWord GetDisplayHeight(const NTV2VideoFormat videoFormat)
virtual bool SetMode(const NTV2Channel inChannel, const NTV2Mode inNewValue, const bool inIsRetail=(!(0)))
Determines if a given FrameStore on the AJA device will be used to capture or playout video...
AJAStatus CreateEncFile(const std::string &inFileName, uint32_t maxFrames)
static bool GetFirstDeviceFromArgument(const std::string &inArgument, CNTV2Card &outDevice)
Rescans the host, and returns an open CNTV2Card instance for the AJA device that matches a command li...
virtual bool SetSDITransmitEnable(const NTV2Channel inChannel, const bool inEnable)
Sets the specified bidirectional SDI connector to act as an input or an output.
virtual bool AutoCirculateTransfer(const NTV2Channel inChannel, AUTOCIRCULATE_TRANSFER &transferInfo)
Transfers all or part of a frame as specified in the given AUTOCIRCULATE_TRANSFER object to/from the ...
virtual void CodecRawWorker(void)
Repeatedly removes video frames from the raw video ring and transfers them to the codec...
virtual bool AcquireStreamForApplication(ULWord inApplicationType, int32_t inProcessID)
Reserves exclusive use of the AJA device for a given process, preventing other processes on the host ...
void SetAbortFlag(const bool *pAbortFlag)
Tells me the boolean variable I should monitor such that when it gets set to "true" will cause any th...
virtual AJAStatus SetupVideo(void)
Sets up everything I need for capturing video.
AJAStatus SetupHEVC(CNTV2m31 *pM31, M31VideoPreset preset, M31Channel encodeChannel, bool multiStream, bool withInfo)
ULWord GetVideoActiveSize(const NTV2VideoFormat inVideoFormat, const NTV2FrameBufferFormat inFBFormat, const NTV2VANCMode inVancMode=NTV2_VANCMODE_OFF)
virtual bool SetEveryFrameServices(const NTV2TaskMode m)
virtual NTV2VideoFormat GetInputVideoFormat(const NTV2InputSource inVideoSource=NTV2_INPUTSOURCE_SDI1, const bool inIsProgressive=(0))
Returns the video format of the signal that is present on the given input source. ...
AJA_PixelFormat GetAJAPixelFormat(NTV2FrameBufferFormat pixelFormat)
static void Sleep(const int32_t inMilliseconds)
Suspends execution of the current thread for a given number of milliseconds.
static void VideoFileThreadStatic(AJAThread *pThread, void *pContext)
This is the video file writer thread's static callback function that gets called when the thread star...
void WriteEncData(void *pBuffer, uint32_t bufferSize)
2: OEM (recommended): device configured by client application(s) with some driver involvement...
uint32_t AlignDataBuffer(void *pBuffer, uint32_t bufferSize, uint32_t dataSize, uint32_t alignBytes, uint8_t fill)
ULWord acAudioTransferSize
Number of bytes captured into the audio buffer.
virtual bool ApplySignalRoute(const CNTV2SignalRouter &inRouter, const bool inReplace=(0))
Applies the given routing table to the AJA device.
void WriteAiffData(void *pBuffer, uint32_t numChannels, uint32_t numSamples)
ULWord GetDroppedFrameCount(void) const
virtual bool SetTsiFrameEnable(const bool inIsEnabled, const NTV2Channel inChannel)
Enables or disables SMPTE 425 two-sample interleave (Tsi) frame mode on the device.
Specifies channel or FrameStore 8 (or the 8th item).
struct HevcPictureInfo HevcPictureInfo
AJA_EXPORT bool RenderTimeCodeFont(AJA_PixelFormat pixelFormat, uint32_t numPixels, uint32_t numLines)
uint32_t timeCodeLow
Time code data low.
virtual void Quit(void)
Gracefully stops me from running.
Specifies channel or FrameStore 2 (or the 2nd item).
virtual NTV2DeviceID GetDeviceID(void)
void WriteHevcData(void *pBuffer, uint32_t bufferSize)
virtual void GetStatus(AVHevcStatus &outStatus)
Provides status information about my input (capture) process.
virtual void SetupHostBuffers(void)
Sets up my circular buffers.
uint32_t audioDataSize
Size of audio data (bytes)
virtual void StartCodecHevcThread(void)
Start the codec hevc thread.
virtual void SetupAutoCirculate(void)
Initializes AutoCirculate.
virtual bool AutoCirculateStop(const NTV2Channel inChannel, const bool inAbort=(0))
Stops AutoCirculate for the given channel, and releases the on-device frame buffers that were allocat...
static void CodecHevcThreadStatic(AJAThread *pThread, void *pContext)
This is the codec hevc thread's static callback function that gets called when the thread starts...
Declares the AJAProcess class.
virtual bool UnsubscribeInputVerticalEvent(const NTV2Channel inChannel=NTV2_CHANNEL1)
Unregisters me so I'm no longer notified when an input VBI is signaled on the given input channel...
virtual AJAStatus Run(void)
Runs me.
virtual void VideoProcessWorker(void)
Repeatedly removes video frames from the video input ring, calls a custom video process method and ad...
This object specifies the information that will be transferred to or from the AJA device in the CNTV2...
virtual bool SetAudioBufferSize(const NTV2AudioBufferSize inValue, const NTV2AudioSystem inAudioSystem=NTV2_AUDIOSYSTEM_1)
Changes the size of the audio buffer that is used for a given Audio System in the AJA device...
virtual bool GetEveryFrameServices(NTV2TaskMode &m)
#define NTV2_AUDIOSIZE_MAX
static void VideoProcessThreadStatic(AJAThread *pThread, void *pContext)
This is the video process thread's static callback function that gets called when the thread starts...
void EndProduceNextBuffer(void)
The producer thread calls this function to signal that it has finished populating the frame it obtain...
This identifies the first Audio System.
virtual void StartAudioFileThread(void)
Start the audio file writer thread.
virtual bool WaitForOutputVerticalInterrupt(const NTV2Channel inChannel=NTV2_CHANNEL1, UWord inRepeatCount=1)
Efficiently sleeps the calling thread/process until the next one or more field (interlaced video) or ...
static const ULWord kDemoAppSignature((((uint32_t)( 'D'))<< 24)|(((uint32_t)( 'E'))<< 16)|(((uint32_t)( 'M'))<< 8)|(((uint32_t)( 'O'))<< 0))
Declares numerous NTV2 utility functions.
uint32_t videoDataSize2
Size of field 2 video data (bytes)
virtual AJAStatus SetupAudio(void)
Sets up everything I need for capturing audio.
virtual void CodecHevcWorker(void)
Repeatedly transfers hevc frames from the codec and adds them to the hevc ring.
virtual AJAStatus Attach(AJAThreadFunction *pThreadFunction, void *pUserContext)
FrameDataPtr StartProduceNextBuffer(void)
The thread that's responsible for providing frames – the producer – calls this function to populate...
virtual void VideoFileWorker(void)
Repeatedly removes hevc frame from the hevc ring and writes them to the hevc output file...
static void VideoInputThreadStatic(AJAThread *pThread, void *pContext)
This is the video input thread's static callback function that gets called when the thread starts...
void SetStdTimecodeForHfr(bool bStdTc)
virtual bool SetSDIOutLevelAtoLevelBConversion(const UWord inOutputSpigot, const bool inEnable)
Enables or disables 3G level A to 3G level B conversion at the SDI output widget (assuming the AJA de...
This is returned from the CNTV2Card::AutoCirculateGetStatus function.
bool lastFrame
Indicates last captured frame.
Instances of me capture frames in real time from a video signal provided to an input of an AJA device...
void QueryString(std::string &str, const AJATimeBase &timeBase, bool bDropFrame, bool bStdTcForHfr, AJATimecodeNotation notation=AJA_TIMECODE_LEGACY)
1: Standard/Retail: device configured by AJA ControlPanel, service/daemon, and driver.
Specifies channel or FrameStore 1 (or the first item).
virtual bool AutoCirculateStart(const NTV2Channel inChannel, const ULWord64 inStartTime=0)
Starts AutoCirculating the specified channel that was previously initialized by CNTV2Card::AutoCircul...
AUTOCIRCULATE_TRANSFER_STATUS acTransferStatus
Contains status information that's valid after CNTV2Card::AutoCirculateTransfer returns, including the driver buffer level, number of frames processed or dropped, audio and anc transfer byte counts, and a complete FRAME_STAMP that has even more detailed clocking information.
virtual bool AutoCirculateInitForOutput(const NTV2Channel inChannel, const UWord inFrameCount=7, const NTV2AudioSystem inAudioSystem=NTV2_AUDIOSYSTEM_INVALID, const ULWord inOptionFlags=0, const UByte inNumChannels=1, const UWord inStartFrameNumber=0, const UWord inEndFrameNumber=0)
Prepares for subsequent AutoCirculate playout, designating a contiguous block of frame buffers on the...
static void AudioFileThreadStatic(AJAThread *pThread, void *pContext)
This is the audio file writer thread's static callback function that gets called when the thread star...
virtual bool SetSDIInLevelBtoLevelAConversion(const NTV2ChannelSet &inSDIInputs, const bool inEnable)
Enables or disables 3G level B to 3G level A conversion at the SDI input(s).
static void CodecRawThreadStatic(AJAThread *pThread, void *pContext)
This is the codec raw thread's static callback function that gets called when the thread starts...
uint32_t * pVideoBuffer
Pointer to host video buffer.
ULWord GetDisplayWidth(const NTV2VideoFormat videoFormat)
virtual void StartVideoInputThread(void)
Start the video input thread.
bool GetInputTimeCode(NTV2_RP188 &outTimeCode, const NTV2TCIndex inTCIndex=NTV2_TCINDEX_SDI1) const
Intended for capture, answers with a specific timecode captured in my acTransferStatus member's acFra...
This structure encapsulates the video and audio buffers used by the HEVC demo applications. The demo programs that employ producer/consumer threads use a fixed number of these buffers.
AJA_EXPORT bool BurnTimeCode(void *pBaseVideoAddress, const std::string &inTimeCodeStr, const uint32_t inYPercent)
NTV2AudioSystem NTV2ChannelToAudioSystem(const NTV2Channel inChannel)
Converts the given NTV2Channel value into its equivalent NTV2AudioSystem.
uint32_t * pInfoBuffer
Picture information (raw) or encode information (hevc)
bool HasAvailableInputFrame(void) const
Specifies channel or FrameStore 4 (or the 4th item).
Specifies channel or FrameStore 5 (or the 5th item).
bool IsRunning(void) const
uint32_t videoDataSize
Size of video data (bytes)
ULWord fLo
| BG 4 | Secs10 | BG 3 | Secs 1 | BG 2 | Frms10 | BG 1 | Frms 1 |
Specifies channel or FrameStore 6 (or the 6th item).
UWord GetMaxAudioChannels(void)
uint32_t infoDataSize2
Size of the field 2 information data (bytes)
virtual void StartCodecRawThread(void)
Start the codec raw thread.
virtual bool AutoCirculateInitForInput(const NTV2Channel inChannel, const UWord inFrameCount=7, const NTV2AudioSystem inAudioSystem=NTV2_AUDIOSYSTEM_INVALID, const ULWord inOptionFlags=0, const UByte inNumChannels=1, const UWord inStartFrameNumber=0, const UWord inEndFrameNumber=0)
Prepares for subsequent AutoCirculate ingest, designating a contiguous block of frame buffers on the ...
virtual AJAStatus ProcessVideoFrame(AVHevcDataBuffer *pSrcFrame, AVHevcDataBuffer *pDstFrame, uint32_t frameNumber)
Default do-nothing function for processing the captured frames.
#define AUTOCIRCULATE_WITH_RP188
Use this to AutoCirculate with RP188.
Specifies channel or FrameStore 7 (or the 7th item).
bool SetAudioBuffer(ULWord *pInAudioBuffer, const ULWord inAudioByteCount)
Sets my audio buffer for use in a subsequent call to CNTV2Card::AutoCirculateTransfer.
virtual void StartVideoFileThread(void)
Start the video file writer thread.
8-Bit 4:2:0 2-Plane YCbCr
Identifies the 1st SDI video input.
uint32_t infoDataSize
Size of the information data (bytes)
AJAStatus CreateHevcFile(const std::string &inFileName, uint32_t maxFrames)
virtual bool SetNumberAudioChannels(const ULWord inNumChannels, const NTV2AudioSystem inAudioSystem=NTV2_AUDIOSYSTEM_1)
Sets the number of audio channels to be concurrently captured or played for a given Audio System on t...
ULWord fHi
| BG 8 | Hrs 10 | BG 7 | Hrs 1 | BG 6 | Mins10 | BG 5 | Mins 1 |
Declares device capability functions.
virtual bool WaitForInputVerticalInterrupt(const NTV2Channel inChannel=NTV2_CHANNEL1, UWord inRepeatCount=1)
Efficiently sleeps the calling thread/process until the next one or more field (interlaced video) or ...
bool CanDoMultiFormat(void)
This identifies the mode in which there are no VANC lines in the frame buffer.
bool SetVideoBuffer(ULWord *pInVideoBuffer, const ULWord inVideoByteCount)
Sets my video buffer for use in a subsequent call to CNTV2Card::AutoCirculateTransfer.
Specifies channel or FrameStore 3 (or the 3rd item).
NTV2ReferenceSource NTV2InputSourceToReferenceSource(const NTV2InputSource inInputSource)
Converts a given NTV2InputSource to its equivalent NTV2ReferenceSource value.
Audio clock derived from the video input.
virtual bool SetEmbeddedAudioClock(const NTV2EmbeddedAudioClock inValue, const NTV2AudioSystem inAudioSystem=NTV2_AUDIOSYSTEM_1)
Sets the NTV2EmbeddedAudioClock setting for the given NTV2AudioSystem.
uint32_t timeCodeDBB
Time code data dbb.
void SetRP188(const uint32_t inDBB, const uint32_t inLo, const uint32_t inHi, const AJATimeBase &inTimeBase)
virtual AJAStatus Init(void)
Initializes me and prepares me to Run.
virtual bool EnableChannel(const NTV2Channel inChannel)
Enables the given FrameStore.