lastreftimeOMX = 0;
lastreftimePTS = 0;
firstsynched = false;
+ cur_clock_time=0;
+ //cur_pts=0;
mode=NORMAL;
xpos=ypos=0.f;
mymode=all_supp_modes+i;
Log::getInstance()->log("Video", Log::NOTICE, "Found native mode %dx%d %d Hz i: %d",
mymode->width,mymode->height,mymode->frame_rate,mymode->scan_mode);
+ native_width=mymode->width;
+ native_height=mymode->height;
}
}
clock_conf.nSize=sizeof(clock_conf);
clock_conf.nVersion.nVersion=OMX_VERSION;
clock_conf.eState=OMX_TIME_ClockStateWaitingForStartTime;
- clock_conf.nStartTime=0;
- clock_conf.nOffset=0;
+ clock_conf.nStartTime=intToOMXTicks(0);
+ clock_conf.nOffset=intToOMXTicks(0);
if (clock_references==1) clock_conf.nWaitMask=OMX_CLOCKPORT1;
else clock_conf.nWaitMask=OMX_CLOCKPORT0|OMX_CLOCKPORT1;
error=OMX_SetConfig(omx_clock,OMX_IndexConfigTimeClockState,&clock_conf);
clock_conf.nSize=sizeof(clock_conf);
clock_conf.nVersion.nVersion=OMX_VERSION;
clock_conf.eState=OMX_TIME_ClockStateWaitingForStartTime;
- clock_conf.nStartTime=0;
- clock_conf.nOffset=0;
+ clock_conf.nStartTime=intToOMXTicks(0);
+ clock_conf.nOffset=intToOMXTicks(0);
if (clock_references==1) clock_conf.nWaitMask=OMX_CLOCKPORT0;
else clock_conf.nWaitMask=OMX_CLOCKPORT0|OMX_CLOCKPORT1;
error=OMX_SetConfig(omx_clock,OMX_IndexConfigTimeClockState,&clock_conf);
clock_conf.nSize=sizeof(clock_conf);
clock_conf.nVersion.nVersion=OMX_VERSION;
clock_conf.eState=OMX_TIME_ClockStateRunning;
- clock_conf.nStartTime=0;
- clock_conf.nOffset=0;
+ clock_conf.nStartTime=intToOMXTicks(0);
+ clock_conf.nOffset=intToOMXTicks(0);
clock_conf.nWaitMask=OMX_CLOCKPORT1;
error=OMX_SetConfig(omx_clock,OMX_IndexConfigTimeClockState,&clock_conf);
if (error!=OMX_ErrorNone) {
clock_conf.nSize=sizeof(clock_conf);
clock_conf.nVersion.nVersion=OMX_VERSION;
clock_conf.eState=OMX_TIME_ClockStateStopped;
- clock_conf.nStartTime=0;
- clock_conf.nOffset=0;
+ clock_conf.nStartTime=intToOMXTicks(0);
+ clock_conf.nOffset=intToOMXTicks(0);
clock_conf.nWaitMask=OMX_CLOCKPORT1;
error=OMX_SetConfig(omx_clock,OMX_IndexConfigTimeClockState,&clock_conf);
if (error!=OMX_ErrorNone) {
- ft_type.xFramerate=0;//25*(1<<16);//demux->getFrameRate()*(1<<16);
+ ft_type.xFramerate=0*(1<<16);//25*(1<<16);//demux->getFrameRate()*(1<<16);
Log::getInstance()->log("Video", Log::DEBUG, "Framerate: %d",demux->getFrameRate());
error=OMX_SetParameter(omx_vid_dec,OMX_IndexParamVideoPortFormat,&ft_type);
if (error!=OMX_ErrorNone){
}*/
- playbacktimeoffset=-GetCurrentSystemTime();
+ //playbacktimeoffset=-GetCurrentSystemTime();
paused=false;
iframemode=false;
omx_running=true;
if (current.event_type==OMX_EventError) {
omx_events.erase(itty);
omx_event_mutex.Unlock();
- Log::getInstance()->log("Video", Log::DEBUG, "Command Finished on Error");
+ Log::getInstance()->log("Video", Log::DEBUG, "Command Finished on Error %x",current.data1);
return 0;
} else if (current.event_type==OMX_EventCmdComplete && current.data1==command && current.data2==data2) {
input_bufs_omx_free.clear();
input_bufs_omx_present.clear();
input_time_present.clear();
- input_time_pts.clear();
- input_is_last.clear();
+ //input_time_pts.clear();
+ //input_is_last.clear();
input_bufs_omx_mutex.Unlock();
}
-
-
-int VideoOMX::DeAllocateCodecsOMX()
+int VideoOMX::FlushRenderingPipe()
{
OMX_ERRORTYPE error;
- omx_running=false;
- Log::getInstance()->log("Video", Log::DEBUG, "enter deallocatecodecsomx");
- threadStop();
+ if (!dodeint) {
+
+ error = OMX_SendCommand(omx_vid_dec, OMX_CommandFlush,
+ omx_codec_output_port, NULL);
+ if (error != OMX_ErrorNone) {
+ Log::getInstance()->log("Video", Log::DEBUG,
+ "OMX_Flush codec out 1 failed %x", error);
- if (cur_input_buf_omx) {
- cur_input_buf_omx->nFlags|=OMX_BUFFERFLAG_EOS;
- OMX_ERRORTYPE error=ProtOMXEmptyThisBuffer(omx_vid_dec,cur_input_buf_omx);
- if (error!=OMX_ErrorNone) {
- Log::getInstance()->log("Video", Log::DEBUG, "OMX_EmptyThisBuffer failed %x", error);
}
- cur_input_buf_omx=NULL;//write out old data
- }
- clock_mutex.Lock();
- if (omx_vid_dec) {
- // first stop the omx elements
- if (!ChangeComponentState(omx_vid_dec,OMX_StateIdle)) {
- Log::getInstance()->log("Video", Log::DEBUG, "vid_dec ChangeComponentState");
+ error = OMX_SendCommand(omx_vid_sched, OMX_CommandFlush,
+ omx_shed_input_port, NULL);
+ if (error != OMX_ErrorNone) {
+ Log::getInstance()->log("Video", Log::DEBUG,
+ "OMX_Flush shed in 2 failed %x", error);
}
- clock_mutex.Unlock();
-
- idleClock();
- clock_mutex.Lock();
- if (dodeint) {
- if (!ChangeComponentState(omx_vid_deint, OMX_StateIdle)) {
- Log::getInstance()->log("Video", Log::DEBUG,
- "vid_deint ChangeComponentState");
+ if (!CommandFinished(omx_vid_dec, OMX_CommandFlush,
+ omx_codec_output_port)) {
+ Log::getInstance()->log("Video", Log::DEBUG,
+ "flush cmd codec 3 failed");
+ }
- }
+ if (!CommandFinished(omx_vid_sched, OMX_CommandFlush,
+ omx_shed_input_port)) {
+ Log::getInstance()->log("Video", Log::DEBUG,
+ "flush cmd shed 4 failed");
}
+ } else {
+ error = OMX_SendCommand(omx_vid_dec, OMX_CommandFlush,
+ omx_codec_output_port, NULL);
+ if (error != OMX_ErrorNone) {
+ Log::getInstance()->log("Video", Log::DEBUG,
+ "OMX_Flush codec out 5 failed %x", error);
+ }
- if (!ChangeComponentState(omx_vid_sched,OMX_StateIdle)) {
- Log::getInstance()->log("Video", Log::DEBUG, "vid_shed ChangeComponentState");
+ error = OMX_SendCommand(omx_vid_deint, OMX_CommandFlush,
+ omx_deint_input_port, NULL);
+ if (error != OMX_ErrorNone) {
+ Log::getInstance()->log("Video", Log::DEBUG,
+ "OMX_Flush deint in 6 failed %x", error);
}
- if (!ChangeComponentState(omx_vid_rend,OMX_StateIdle)) {
- Log::getInstance()->log("Video", Log::DEBUG, "vid_rend ChangeComponentState");
+ if (!CommandFinished(omx_vid_dec, OMX_CommandFlush,
+ omx_codec_output_port)) {
+ Log::getInstance()->log("Video", Log::DEBUG,
+ "flush cmd codec 7 failed");
+ }
+ if (!CommandFinished(omx_vid_deint, OMX_CommandFlush,
+ omx_deint_input_port)) {
+ Log::getInstance()->log("Video", Log::DEBUG,
+ "flush cmd deint 8 failed");
}
+ //m
+ error = OMX_SendCommand(omx_vid_deint, OMX_CommandFlush,
+ omx_deint_output_port, NULL);
+ if (error != OMX_ErrorNone) {
+ Log::getInstance()->log("Video", Log::DEBUG,
+ "OMX_Flush deint out 9 failed %x", error);
+ }
- // TODO proper deinit sequence
- // first flush all buffers
+ error = OMX_SendCommand(omx_vid_sched, OMX_CommandFlush,
+ omx_shed_input_port, NULL);
+ if (error != OMX_ErrorNone) {
+ Log::getInstance()->log("Video", Log::DEBUG,
+ "OMX_Flush shed in 10 failed %x", error);
- if (!dodeint) {
+ }
- error = OMX_SendCommand(omx_vid_dec, OMX_CommandFlush,
- omx_codec_output_port, NULL);
- if (error != OMX_ErrorNone) {
- Log::getInstance()->log("Video", Log::DEBUG,
- "OMX_Flush codec out failed %x", error);
+ if (!CommandFinished(omx_vid_deint, OMX_CommandFlush,
+ omx_deint_output_port)) {
+ Log::getInstance()->log("Video", Log::DEBUG,
+ "flush cmd deint 11 failed");
+ }
- }
+ if (!CommandFinished(omx_vid_sched, OMX_CommandFlush,
+ omx_shed_input_port)) {
+ Log::getInstance()->log("Video", Log::DEBUG,
+ "flush cmd shed 12 failed");
+ }
- error = OMX_SendCommand(omx_vid_sched, OMX_CommandFlush,
- omx_shed_input_port, NULL);
- if (error != OMX_ErrorNone) {
- Log::getInstance()->log("Video", Log::DEBUG,
- "OMX_Flush shed in failed %x", error);
- }
- if (!CommandFinished(omx_vid_dec, OMX_CommandFlush,
- omx_codec_output_port)) {
- Log::getInstance()->log("Video", Log::DEBUG,
- "flush cmd codec failed");
- }
+ }
- if (!CommandFinished(omx_vid_sched, OMX_CommandFlush,
- omx_shed_input_port)) {
- Log::getInstance()->log("Video", Log::DEBUG,
- "flush cmd shed failed");
- }
- } else {
- error = OMX_SendCommand(omx_vid_dec, OMX_CommandFlush,
- omx_codec_output_port, NULL);
- if (error != OMX_ErrorNone) {
- Log::getInstance()->log("Video", Log::DEBUG,
- "OMX_Flush codec out failed %x", error);
- }
- error = OMX_SendCommand(omx_vid_deint, OMX_CommandFlush,
- omx_deint_input_port, NULL);
- if (error != OMX_ErrorNone) {
- Log::getInstance()->log("Video", Log::DEBUG,
- "OMX_Flush deint in failed %x", error);
- }
+ error = OMX_SendCommand(omx_vid_rend, OMX_CommandFlush,
+ omx_rend_input_port, NULL);
+ if (error != OMX_ErrorNone) {
+ Log::getInstance()->log("Video", Log::DEBUG,
+ "OMX_Flush rend in failed %x", error);
- if (!CommandFinished(omx_vid_dec, OMX_CommandFlush,
- omx_codec_output_port)) {
- Log::getInstance()->log("Video", Log::DEBUG,
- "flush cmd codec failed");
- }
+ }
- if (!CommandFinished(omx_vid_deint, OMX_CommandFlush,
- omx_deint_input_port)) {
- Log::getInstance()->log("Video", Log::DEBUG,
- "flush cmd deint failed");
- }
+ error = OMX_SendCommand(omx_vid_sched, OMX_CommandFlush,
+ omx_shed_output_port, NULL);
+ if (error != OMX_ErrorNone) {
+ Log::getInstance()->log("Video", Log::DEBUG,
+ "OMX_Flush shed out failed %x", error);
- //m
- error = OMX_SendCommand(omx_vid_deint, OMX_CommandFlush,
- omx_deint_output_port, NULL);
- if (error != OMX_ErrorNone) {
- Log::getInstance()->log("Video", Log::DEBUG,
- "OMX_Flush deint out failed %x", error);
+ }
- }
- error = OMX_SendCommand(omx_vid_sched, OMX_CommandFlush,
- omx_shed_input_port, NULL);
- if (error != OMX_ErrorNone) {
- Log::getInstance()->log("Video", Log::DEBUG,
- "OMX_Flush shed in failed %x", error);
- }
+ if (!CommandFinished(omx_vid_rend, OMX_CommandFlush,
+ omx_rend_input_port)) {
+ Log::getInstance()->log("Video", Log::DEBUG,
+ "flush cmd shed rend failed");
+ }
- if (!CommandFinished(omx_vid_deint, OMX_CommandFlush,
- omx_deint_output_port)) {
- Log::getInstance()->log("Video", Log::DEBUG,
- "flush cmd deint failed");
- }
+ if (!CommandFinished(omx_vid_sched, OMX_CommandFlush,
+ omx_shed_output_port)) {
+ Log::getInstance()->log("Video", Log::DEBUG,
+ "flush cmd shed rend failed");
+ }
+}
- if (!CommandFinished(omx_vid_sched, OMX_CommandFlush,
- omx_shed_input_port)) {
- Log::getInstance()->log("Video", Log::DEBUG,
- "flush cmd shed failed");
- }
+int VideoOMX::DeAllocateCodecsOMX()
+{
+ OMX_ERRORTYPE error;
+ omx_running=false;
+ Log::getInstance()->log("Video", Log::DEBUG, "enter deallocatecodecsomx");
+ threadStop();
+ if (cur_input_buf_omx) {
+ cur_input_buf_omx->nFlags|=OMX_BUFFERFLAG_EOS;
+ OMX_ERRORTYPE error=ProtOMXEmptyThisBuffer(omx_vid_dec,cur_input_buf_omx);
+ if (error!=OMX_ErrorNone) {
+ Log::getInstance()->log("Video", Log::DEBUG, "OMX_EmptyThisBuffer failed %x", error);
}
+ cur_input_buf_omx=NULL;//write out old data
+ }
+ clock_mutex.Lock();
+ if (omx_vid_dec) {
+ // first stop the omx elements
+ if (!ChangeComponentState(omx_vid_dec,OMX_StateIdle)) {
+ Log::getInstance()->log("Video", Log::DEBUG, "vid_dec ChangeComponentState");
+ }
+ clock_mutex.Unlock();
+ idleClock();
+ clock_mutex.Lock();
- error = OMX_SendCommand(omx_vid_rend, OMX_CommandFlush,
- omx_rend_input_port, NULL);
- if (error != OMX_ErrorNone) {
- Log::getInstance()->log("Video", Log::DEBUG,
- "OMX_Flush rend in failed %x", error);
+ if (dodeint) {
+ if (!ChangeComponentState(omx_vid_deint, OMX_StateIdle)) {
+ Log::getInstance()->log("Video", Log::DEBUG,
+ "vid_deint ChangeComponentState");
+ }
}
- error = OMX_SendCommand(omx_vid_sched, OMX_CommandFlush,
- omx_shed_output_port, NULL);
- if (error != OMX_ErrorNone) {
- Log::getInstance()->log("Video", Log::DEBUG,
- "OMX_Flush shed out failed %x", error);
- }
+ if (!ChangeComponentState(omx_vid_sched,OMX_StateIdle)) {
+ Log::getInstance()->log("Video", Log::DEBUG, "vid_shed ChangeComponentState");
+ }
+ if (!ChangeComponentState(omx_vid_rend,OMX_StateIdle)) {
+ Log::getInstance()->log("Video", Log::DEBUG, "vid_rend ChangeComponentState");
- if (!CommandFinished(omx_vid_rend, OMX_CommandFlush,
- omx_rend_input_port)) {
- Log::getInstance()->log("Video", Log::DEBUG,
- "flush cmd shed rend failed");
}
- if (!CommandFinished(omx_vid_sched, OMX_CommandFlush,
- omx_shed_output_port)) {
- Log::getInstance()->log("Video", Log::DEBUG,
- "flush cmd shed rend failed");
- }
+
+
+ // TODO proper deinit sequence
+ // first flush all buffers
+ FlushRenderingPipe();
if (!paused) {
paused=true;
//maybe also change omx clock?
- pausetimecode=GetCurrentSystemTime();
+ //pausetimecode=GetCurrentSystemTime();
}
return 1;
Log::getInstance()->log("Video", Log::DEBUG, "enter unpause");
if (paused) {
- playbacktimeoffset+=GetCurrentSystemTime()-pausetimecode;
+ // playbacktimeoffset+=GetCurrentSystemTime()-pausetimecode;
paused=false; // may be also change omx clock
}
return 1;
}
-ULLONG VideoOMX::getCurrentTimestamp()
-{
- if (iframemode) return 0;
- return cur_pts;
+ULLONG VideoOMX::getCurrentTimestamp() {
+ if (iframemode)
+ return 0;
+ long long ncur_clock_time = cur_clock_time;
+ if (omx_running) {
+ clock_mutex.Lock();
+ OMX_ERRORTYPE error;
+ OMX_TIME_CONFIG_CLOCKSTATETYPE clock_conf;
+ memset(&clock_conf, 0, sizeof(clock_conf));
+ clock_conf.nSize = sizeof(clock_conf);
+ clock_conf.nVersion.nVersion = OMX_VERSION;
+ error= OMX_GetConfig(omx_clock, OMX_IndexConfigTimeClockState,
+ &clock_conf);
+ if (error != OMX_ErrorNone) {
+ Log::getInstance()->log("Video", Log::DEBUG,"getCurrentTimestamp IndexConfigTimeClockState failed %x",error);
+ }
+
+ if (clock_conf.eState == OMX_TIME_ClockStateRunning) {
+
+ OMX_TIME_CONFIG_TIMESTAMPTYPE cur_time_stamp;
+ memset(&cur_time_stamp, 0, sizeof(cur_time_stamp));
+ cur_time_stamp.nSize = sizeof(cur_time_stamp);
+ cur_time_stamp.nVersion.nVersion = OMX_VERSION;
+ cur_time_stamp.nPortIndex = omx_clock_output_port;
+ error = OMX_GetConfig(omx_clock, OMX_IndexConfigTimeCurrentMediaTime,
+ &cur_time_stamp);
+ if (error != OMX_ErrorNone) {
+ Log::getInstance()->log("Video",Log::DEBUG,"getCurrentTimestamp OMX_IndexConfigTimeCurrentMediaTime failed %x",error);
+ } else {
+ long long temp = cur_time_stamp.nTimestamp.nLowPart
+ | ((long long) cur_time_stamp.nTimestamp.nHighPart << 32);
+ ncur_clock_time = cur_clock_time = temp * 10LL;
+ }
+ }
+ clock_mutex.Unlock();
+ }
+
+ //ncur_clock_time -= startoffset;
+ ncur_clock_time -= lastreftimeOMX;
+ long long result = lastreftimePTS;
+ result += (long long) (ncur_clock_time / 10000LL * 90LL);
+ if (result < 0)
+ result = (1LL << 33) - result;
+ //Log::getInstance()->log("Video", Log::DEBUG,"getCurrentTimestamp %lld %lld %lld %lld %lld %lld",ncur_clock_time,cur_clock_time,lastreftimeOMX,lastreftimePTS,result,startoffset);
+
+ return result;
+
}
// to be removed
lastrefvideotime=0;
lastreftimeOMX=0;
lastreftimePTS=0;
- cur_pts=0;
+ //cur_pts=0;
}
-
+/*
long long VideoOMX::GetCurrentSystemTime()
{
struct timespec ts;
/* Log::getInstance()->log("Video", Log::DEBUG,
"Skipping frames1 %lld %lld %d",target_time-current_time,pts,Demuxer::getInstance()->getFrameRate());
Log::getInstance()->log("Video", Log::DEBUG, "skip detail pts: %lld target: %lld sys: %lld off: %lld diff %lld",pts,target_time,current_time,offset,
- target_time-current_time);*/
+ target_time-current_time);*
} else {
skipping=false;
}
skipping = true;
/* Log::getInstance()->log("Video", Log::DEBUG,"Skipping frames2 %lld %lld %d",target_time-current_time,pts,Demuxer::getInstance()->getFrameRate());
Log::getInstance()->log("Video", Log::DEBUG, "skip detail pts: %lld target: %lld sys: %lld off: %lld diff %lld",pts,target_time,current_time,offset,
- target_time-current_time);*/
+ target_time-current_time);*
} else {
skipping = false;
}
}
}
-
+*/
void VideoOMX::threadPostStopCleanup()
{
//Doing nothing
OMX_BUFFERHEADERTYPE* pict=NULL;
long long time;
- bool islast;
+ //bool islast;
if (!paused) {
input_bufs_omx_mutex.Lock();
if (input_bufs_omx_present.size()>0) {
- cur_pts=input_time_pts.front();
+ //cur_pts=input_time_pts.front();
pict=input_bufs_omx_present.front();
time=input_time_present.front();
- islast=input_is_last.front();
+ //islast=input_is_last.front();
input_bufs_omx_present.pop_front();
input_time_present.pop_front();
- input_time_pts.pop_front();
- input_is_last.pop_front();
+ //input_time_pts.pop_front();
+ //input_is_last.pop_front();
}
input_bufs_omx_mutex.Unlock();
}
if ( pict) {
//Log::getInstance()->log("Video", Log::DEBUG,
// "Got pict");
- if (time!=0 && FrameSkip(time) && !(pict->nFlags &OMX_BUFFERFLAG_STARTTIME)) {
+ if (time!=0 && /*FrameSkip(time)*/false && !(pict->nFlags &OMX_BUFFERFLAG_STARTTIME)) {
input_bufs_omx_mutex.Lock();
input_bufs_omx_free.push_back(pict);
} else {
// Log::getInstance()->log("Video", Log::DEBUG,
// "prot empty this buffer in");
- if (islast) FrameWaitforDisplay(time);
+ //if (islast) FrameWaitforDisplay(time);
OMX_ERRORTYPE error = ProtOMXEmptyThisBuffer(omx_vid_dec, pict);
if (error != OMX_ErrorNone) {
Log::getInstance()->log("Video", Log::DEBUG,
}
-void VideoOMX::PutBufferToPres(OMX_BUFFERHEADERTYPE* buffer, long long time, long long pts,bool islast)
+void VideoOMX::PutBufferToPres(OMX_BUFFERHEADERTYPE* buffer, long long time, /*long long pts,*/bool islast)
{
input_bufs_omx_mutex.Lock();
input_bufs_omx_present.push_back(buffer);
input_time_present.push_back(time);
- input_time_pts.push_back(pts);
- input_is_last.push_back(islast);
+ //input_time_pts.push_back(pts);
+// input_is_last.push_back(islast);
input_bufs_omx_mutex.Unlock();
}
if (!omx_running) return 0; // if we are not runnig do not do this
if (paused) return 0; //Block if we pause
- if (packet.synched && FrameSkip(packet.presentation_time)) {
+ /*if (packet.synched && FrameSkip(packet.presentation_time)) {
*samplepos=packet.length;
Log::getInstance()->log("Video", Log::DEBUG, "DeliverMediaPacketOMX Frameskip");
*samplepos=packet.length;
return packet.length;
- }
+ }*/
//long long current_media_time=GetCurrentSystemTime()+playbacktimeoffset;
/* if (packet.synched &&
(packet.presentation_time<0 /*|| // preroll skip frames
if (packet.disconti) {
firstsynched=false;
if (cur_input_buf_omx) {
- PutBufferToPres(cur_input_buf_omx, lastreftimeOMX,lastreftimePTS, true);
+ PutBufferToPres(cur_input_buf_omx, lastreftimeOMX,/*lastreftimePTS,*/ true);
cur_input_buf_omx=NULL;
}
}
if ( packet.synched ) {
if (cur_input_buf_omx) {
cur_input_buf_omx->nFlags|=OMX_BUFFERFLAG_ENDOFFRAME;
- PutBufferToPres(cur_input_buf_omx, lastreftimeOMX,lastreftimePTS,true);
+ PutBufferToPres(cur_input_buf_omx, lastreftimeOMX,/*lastreftimePTS,*/true);
cur_input_buf_omx=NULL;//write out old data
cur_input_buf_omx=input_bufs_omx_free.front();
cur_input_buf_omx->nFilledLen=0;
cur_input_buf_omx->nOffset=0;
- cur_input_buf_omx->nTimeStamp=0;
+ cur_input_buf_omx->nTimeStamp=intToOMXTicks(0);
input_bufs_omx_free.pop_front();
input_bufs_omx_mutex.Unlock();
}
Log::getInstance()->log("Video", Log::DEBUG, "Starttime");
omx_first_frame=false;
} else {
- //cur_input_buf_omx->nFlags=0;
- cur_input_buf_omx->nFlags|=OMX_BUFFERFLAG_TIME_UNKNOWN;
+ cur_input_buf_omx->nFlags=0;
+ //cur_input_buf_omx->nFlags|=OMX_BUFFERFLAG_TIME_UNKNOWN;
}
lastreftimeOMX=packet.presentation_time;
// Log::getInstance()->log("Video", Log::DEBUG, "Time code %lld pts %lld", lastreftimeOMX,packet.pts);
lastreftimePTS=packet.pts;
- cur_input_buf_omx->nTimeStamp=0;//lastreftimeOMX; // the clock component is faulty;
+ cur_input_buf_omx->nTimeStamp=intToOMXTicks(lastreftimeOMX/10LL); // the clock component is faulty;
}
else
{
cur_input_buf_omx->nFlags=OMX_BUFFERFLAG_TIME_UNKNOWN;
- cur_input_buf_omx->nTimeStamp=0;
+ cur_input_buf_omx->nTimeStamp=intToOMXTicks(0);
//Log::getInstance()->log("Video", Log::DEBUG, "packet unsynched marker");
- // ms->SetSyncPoint(TRUE);
}
if (packet.disconti) cur_input_buf_omx->nFlags|=OMX_BUFFERFLAG_DISCONTINUITY;
*samplepos+=cancopy;
// push old buffer out
- PutBufferToPres(cur_input_buf_omx, lastreftimeOMX,lastreftimePTS,false);
+ PutBufferToPres(cur_input_buf_omx, lastreftimeOMX,/*lastreftimePTS,*/false);
cur_input_buf_omx=NULL;
// get5 new buffer
input_bufs_omx_mutex.Lock();
cur_input_buf_omx=input_bufs_omx_free.front();
cur_input_buf_omx->nFilledLen=0;
cur_input_buf_omx->nOffset=0;
- cur_input_buf_omx->nTimeStamp=0;
+ cur_input_buf_omx->nFlags=OMX_BUFFERFLAG_TIME_UNKNOWN;
+ cur_input_buf_omx->nTimeStamp=intToOMXTicks(0);
input_bufs_omx_free.pop_front();
input_bufs_omx_mutex.Unlock();
- cur_input_buf_omx->nFlags=OMX_BUFFERFLAG_TIME_UNKNOWN;
-
}
memcpy(cur_input_buf_omx->pBuffer+cur_input_buf_omx->nFilledLen,
buffer+packet.pos_buffer+*samplepos,haveToCopy);
cur_input_buf_omx = input_bufs_omx_free.front();
cur_input_buf_omx->nFilledLen = 0;
cur_input_buf_omx->nOffset = 0;
- cur_input_buf_omx->nTimeStamp = 0;
+ cur_input_buf_omx->nTimeStamp = intToOMXTicks(0);
input_bufs_omx_free.pop_front();
input_bufs_omx_mutex.Unlock();
}
|= OMX_BUFFERFLAG_TIME_UNKNOWN;
}
- cur_input_buf_omx->nTimeStamp = 0;
- PutBufferToPres(cur_input_buf_omx, 0,0,false);
+ cur_input_buf_omx->nTimeStamp = intToOMXTicks(0);
+ PutBufferToPres(cur_input_buf_omx, 0,/*0,*/false);
cur_input_buf_omx = NULL;
if (!cur_input_buf_omx) {
cur_input_buf_omx = input_bufs_omx_free.front();
cur_input_buf_omx->nFilledLen = 0;
cur_input_buf_omx->nOffset = 0;
- cur_input_buf_omx->nTimeStamp = 0;
+ cur_input_buf_omx->nTimeStamp = intToOMXTicks(0);
+ cur_input_buf_omx->nFlags|= OMX_BUFFERFLAG_TIME_UNKNOWN;
input_bufs_omx_free.pop_front();
input_bufs_omx_mutex.Unlock();
break;
cur_input_buf_omx->nFlags |= OMX_BUFFERFLAG_TIME_UNKNOWN;
}
- cur_input_buf_omx->nTimeStamp = 0;
+ cur_input_buf_omx->nTimeStamp = intToOMXTicks(0);
- PutBufferToPres(cur_input_buf_omx, 0,0,false);
+ PutBufferToPres(cur_input_buf_omx, 0,/*0,*/false);
cur_input_buf_omx = NULL;
int VideoOMX::EnterIframePlayback()
{
+ Log::getInstance()->log("Video", Log::DEBUG,
+ "EnterIframePlayback");
if (cur_input_buf_omx) {
- PutBufferToPres(cur_input_buf_omx, lastreftimeOMX, lastreftimePTS,true);
+ PutBufferToPres(cur_input_buf_omx, lastreftimeOMX,/* lastreftimePTS,*/true);
cur_input_buf_omx = NULL;
}
input_bufs_omx_mutex.Lock();
input_bufs_omx_present.pop_front();
}
input_time_present.clear();
- input_time_pts.clear();
- input_is_last.clear();
+ /*input_time_pts.clear();
+ input_is_last.clear();*/
input_bufs_omx_mutex.Unlock();
+ Log::getInstance()->log("Video", Log::DEBUG,
+ "EnterIframePlayback 2");
+ clock_mutex.Lock();
+ FlushRenderingPipe();
+ clock_mutex.Unlock();
+ Log::getInstance()->log("Video", Log::DEBUG,
+ "leave IframePlayback");
iframemode=true;