本文整理汇总了C++中VideoFrame::SetDuration方法的典型用法代码示例。如果您正苦于以下问题:C++ VideoFrame::SetDuration方法的具体用法?C++ VideoFrame::SetDuration怎么用?C++ VideoFrame::SetDuration使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VideoFrame
的用法示例。
在下文中一共展示了VideoFrame::SetDuration方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: EncodeVideo
//.........这里部分代码省略.........
//Not enougth space
Error("Not enought space to copy FLV encodec frame [frame:%d,encoded:%d",frame.GetMaxMediaSize(),encoded->GetLength());
//NExt
continue;
}
//Check
if (frameTime)
{
timespec ts;
//Lock
pthread_mutex_lock(&mutex);
//Calculate timeout
calcAbsTimeout(&ts,&prev,frameTime);
//Wait next or stopped
int canceled = !pthread_cond_timedwait(&cond,&mutex,&ts);
//Unlock
pthread_mutex_unlock(&mutex);
//Check if we have been canceled
if (canceled)
//Exit
break;
}
//Set sending time of previous frame
getUpdDifTime(&prev);
//Set timestamp
encoded->SetTimestamp(getDifTime(&first)/1000);
//Set next one
frameTime = 1000/fps;
//Set duration
encoded->SetDuration(frameTime);
//Get full frame
frame.SetVideoFrame(encoded->GetData(),encoded->GetLength());
//Set buffer size
frame.SetMediaSize(encoded->GetLength());
//Check type
if (encoded->IsIntra())
//Set type
frame.SetFrameType(RTMPVideoFrame::INTRA);
else
//Set type
frame.SetFrameType(RTMPVideoFrame::INTER);
//If we need desc but yet not have it
if (!frameDesc && encoded->IsIntra() && videoCodec==VideoCodec::H264)
{
//Create new description
AVCDescriptor desc;
//Set values
desc.SetConfigurationVersion(1);
desc.SetAVCProfileIndication(0x42);
desc.SetProfileCompatibility(0x80);
desc.SetAVCLevelIndication(0x0C);
desc.SetNALUnitLength(3);
//Get encoded data
BYTE *data = encoded->GetData();
//Get size
DWORD size = encoded->GetLength();
//get from frame