本文整理汇总了C++中MediaStream::Send方法的典型用法代码示例。如果您正苦于以下问题:C++ MediaStream::Send方法的具体用法?C++ MediaStream::Send怎么用?C++ MediaStream::Send使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MediaStream
的用法示例。
在下文中一共展示了MediaStream::Send方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Play
/* changed by [email protected] (see relaod.txt for info) */
int QTFileBroadcaster::Play(char *mTimeFile)
/* ***************************************************** */
{
SInt16 err = 0;
Float64 transmitTime = 0;
MediaStream *theStreamPtr = NULL;
RTpPacket rtpPacket;
unsigned int sleptTime;
SInt32 movieStartOffset = 0; //z
Bool16 negativeTime = false;
fMovieDuration = fRTPFilePtr->GetMovieDuration();
fSendTimeOffset = 0.0;
fMovieStart = true;
fNumMoviesPlayed ++;
if (fMovieEndTime > 0) // take into account the movie load time as well as the last movie early end.
{ UInt64 timeNow = PlayListUtils::Milliseconds();
fMovieIntervalTime = timeNow - fMovieEndTime;
SInt32 earlySleepTimeMilli = (SInt32)(fMovieTimeDiffMilli - fMovieIntervalTime);
earlySleepTimeMilli -= 40; // Don't sleep the entire time we need some time to execute or else we will be late
if (earlySleepTimeMilli > 0)
{ OSThread::Sleep( earlySleepTimeMilli);
}
}
fMovieStartTime = PlayListUtils::Milliseconds();
fMediaStreamList.MovieStarted(fMovieStartTime);
/* changed by [email protected] (see relaod.txt for info) */
if(mTimeFile!=NULL)
{
FILE *fTimeFile = NULL;
struct timeval start, dur, end;
struct tm tm_start, tm_dur, tm_end, timeResult;
memset (&start,0, sizeof(start));
SInt64 timenow = OS::Milliseconds();
start.tv_sec = (long) OS::TimeMilli_To_UnixTimeSecs(timenow);
start.tv_usec = (long) ((OS::TimeMilli_To_UnixTimeMilli(timenow) - (start.tv_sec * 1000)) * 1000);
dur.tv_sec = (long)fMovieDuration;
dur.tv_usec = (long)((fMovieDuration - dur.tv_sec) * 1000000);
end.tv_sec = start.tv_sec + dur.tv_sec + (long)((start.tv_usec + dur.tv_usec) / 1000000);
end.tv_usec = (start.tv_usec + dur.tv_usec) % 1000000;
time_t startSecs = start.tv_sec;
time_t endSecs = end.tv_sec;
memcpy(&tm_start, qtss_localtime(&startSecs, &timeResult), sizeof(struct tm));
memcpy(&tm_end, qtss_localtime(&endSecs, &timeResult), sizeof(struct tm));
tm_dur.tm_hour = dur.tv_sec / 3600;
tm_dur.tm_min = (dur.tv_sec % 3600) / 60;
tm_dur.tm_sec = (dur.tv_sec % 3600) % 60;
// initialize all current movie parameters to unkown ("-").
::strcpy(fCurrentMovieName, "-");
::strcpy(fCurrentMovieCopyright, "-");
::strcpy(fCurrentMovieComment, "-");
::strcpy(fCurrentMovieAuthor, "-");
::strcpy(fCurrentMovieArtist, "-");
::strcpy(fCurrentMovieAlbum, "-");
/* save start time, stop time and length of currently playing song to .current file */
fTimeFile = fopen(mTimeFile, "a");
if(fTimeFile)
{
SimpleString *theQTTextPtr = fMovieSDPParser->fQTTextLines.Begin();
while (theQTTextPtr != NULL)
{
char tmp[256];
::memcpy(tmp, theQTTextPtr->fTheString, theQTTextPtr->fLen);
tmp[theQTTextPtr->fLen] = 0;
// if this SDP parameter is needed for logging then cache it here so
// we can log it later.
if (::strstr(theQTTextPtr->fTheString, "a=x-qt-text-nam:")!=NULL)
::strcpy(fCurrentMovieName, &tmp[16]);
if (::strstr(theQTTextPtr->fTheString, "a=x-qt-text-cpy:")!=NULL)
::strcpy(fCurrentMovieCopyright, &tmp[16]);
if (::strstr(theQTTextPtr->fTheString, "a=x-qt-text-cmt:")!=NULL)
::strcpy(fCurrentMovieComment, &tmp[16]);
if (::strstr(theQTTextPtr->fTheString, "a=x-qt-text-aut:")!=NULL)
::strcpy(fCurrentMovieAuthor, &tmp[16]);
if (::strstr(theQTTextPtr->fTheString, "a=x-qt-text-ART:")!=NULL)
::strcpy(fCurrentMovieArtist, &tmp[16]);
if (::strstr(theQTTextPtr->fTheString, "a=x-qt-text-alb:")!=NULL)
::strcpy(fCurrentMovieAlbum, &tmp[16]);
fwrite(theQTTextPtr->fTheString,theQTTextPtr->fLen, sizeof(char),fTimeFile);
qtss_fprintf(fTimeFile,"\n");
theQTTextPtr = fMovieSDPParser->fQTTextLines.Next();
}
time_t startTime = (time_t) start.tv_sec;
time_t endTime = (time_t) end.tv_sec;
char buffer[kTimeStrSize];
char *timestringStart = qtss_ctime(&startTime, buffer, sizeof(buffer));
qtss_fprintf(fTimeFile,"b=%02d:%02d:%02d:%06d %ld %s", (int) tm_start.tm_hour, (int) tm_start.tm_min, (int) tm_start.tm_sec, (int)start.tv_usec, (long int) startTime, timestringStart);
//.........这里部分代码省略.........