#define STRTOUL strtoul\r
#define CLOSESOCKET closesocket\r
#define DEFAULT_TCP_WINDOWSIZENR 1 /*=2048*/\r
+ #define PLAYER_MAX_STREAMING_BUFFERS 120 // for video in uints of 50000 KB\r
\r
#define VOMP_HAS_EXIT\r
\r
// #define VPE_LIBAV_MPEG2_TRANSCODING\r
\r
#define DEFAULT_TCP_WINDOWSIZENR 6 /*=2048*/\r
+ #define PLAYER_MAX_STREAMING_BUFFERS 120 // for video in uints of 50000 KB\r
#define TV_NORM_SWITCHABLE\r
#define HANDLE_VT_SWITCHING\r
\r
#define Video_TYPE VideoMVP\r
#define Surface_TYPE SurfaceMVP //deprecated\r
#define DEFAULT_TCP_WINDOWSIZENR 1 /*=2048*/\r
+ #define PLAYER_MAX_STREAMING_BUFFERS 11 // for video in uints of 50000 KB\r
#define PAL_WSS\r
#define MVP_REMOTE_TYPES\r
\r
#define Video_TYPE VideoNMT\r
#define Surface_TYPE SurfaceDirectFB //deprecated\r
#define DEFAULT_TCP_WINDOWSIZENR 1 /*=2048*/\r
+ #define PLAYER_MAX_STREAMING_BUFFERS 11 // for video in uints of 50000 KB\r
\r
#define VOMP_LINUX_CLOCK CLOCK_REALTIME\r
\r
//Log::getInstance()->log("Video", Log::NOTICE, "EmptyBufferDone");
VideoOMX *video=(VideoOMX *)getInstance();
+/* long long temp =buffer->nTimeStamp.nLowPart
+ | ((long long) buffer->nTimeStamp.nHighPart << 32);
+ Log::getInstance()->log("Video", Log::NOTICE, "EBD Video %lld %x",temp,buffer->nFlags);*/
video->ReturnEmptyOMXBuffer(buffer);
return OMX_ErrorNone;
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;
+ clock_conf.eState=OMX_TIME_ClockStateStopped;
+ clock_conf.nStartTime=intToOMXTicks(0);
+ clock_conf.nOffset=intToOMXTicks(0);
+ error=OMX_SetConfig(omx_clock,OMX_IndexConfigTimeClockState,&clock_conf);
+ if (error!=OMX_ErrorNone) {
+ Log::getInstance()->log("Video", Log::DEBUG, "VuI Clock IndexConfigTimeClockState failed %x", error);
+ }
+
+
memset(&clock_conf,0,sizeof(clock_conf));
clock_conf.nSize=sizeof(clock_conf);
clock_conf.nVersion.nVersion=OMX_VERSION;
// protect the call to empty this buffer
int oldcancelstate;
int oldcanceltype;
+/* long long temp =buffer->nTimeStamp.nLowPart
+ | ((long long) buffer->nTimeStamp.nHighPart << 32);*/
+
pthread_testcancel();
pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &oldcancelstate);
pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, &oldcanceltype);
clock_mutex.Lock();
+// Diagnosis code
+/* OMX_ERRORTYPE error;
+ OMX_TIME_CONFIG_TIMESTAMPTYPE timestamp;
+ memset(×tamp, 0, sizeof(timestamp));
+ timestamp.nSize = sizeof(timestamp);
+ timestamp.nVersion.nVersion = OMX_VERSION;
+ timestamp.nPortIndex =omx_clock_output_port;
+
+ error = OMX_GetConfig(omx_clock, OMX_IndexConfigTimeCurrentMediaTime,
+ ×tamp);
+
+ if (error != OMX_ErrorNone) {
+ Log::getInstance()->log("Audio", Log::DEBUG,
+ "Init OMX_IndexConfigAudioRenderingLatencyfailed %x %d", error,
+ omx_rend_input_port);
+ }
+ long long temp2 =timestamp.nTimestamp.nLowPart
+ | ((long long) timestamp.nTimestamp.nHighPart << 32);
+
+
+ Log::getInstance()->log("Video", Log::NOTICE, "OMXETB %x %lld %lld %x",handle,temp,temp2,buffer->nFlags);*/
OMX_ERRORTYPE ret_val;
ret_val=OMX_EmptyThisBuffer(handle,buffer);
clock_mutex.Unlock();
return ret_val;
}
+bool VideoOMX::detectIFrame(const UCHAR *buffer,unsigned int length)
+{
+ const UCHAR* curbuf=buffer;
+ const UCHAR* curbufend=buffer+length;
+ unsigned int detector=0xFFFFFFFF;
+ bool gotaud=false; // have seen access unit delimiter
+
+ while (curbuf!=curbufend) {
+ detector<<=8;
+ detector|=*curbuf;
+ if (h264) {
+ if (detector==0x00000109) {
+ gotaud=true;
+ detector=0xFFFFFFFF;
+ } else if (gotaud &&detector==0x00000001) {
+ curbuf++;
+ if (curbuf!=curbufend) {
+ unsigned char picttype=(*curbuf)& 0x1F;
+ return picttype==0x07;
+ }
+ }
+ } else {
+ if (detector==0x00000100) {
+ curbuf++;
+ if (curbuf==curbufend) return false;
+ curbuf++;
+ if (curbuf==curbufend) return false;
+ unsigned char picttype=((*curbuf) >> 3) & 0x07;
+ return picttype==1;
+ }
+ }
+ curbuf++;
+ }
+
+ return false; // no frame found
+}
+
void VideoOMX::PrepareMediaSample(const MediaPacketList& mplist,UINT samplepos)
{
if (paused) return 0; //Block if we pause
//Log::getInstance()->log("Video", Log::DEBUG, "DeliverMediaPacketOMX time %lld",packet.presentation_time);
- if (packet.synched && packet.presentation_time <= 2000000) {
+/* if (packet.synched && packet.presentation_time <= 0) {
*samplepos = packet.length;
firstsynched = false;
Log::getInstance()->log("Video", Log::DEBUG,
"DeliverMediaPacketOMX Frameskip");
return packet.length;
- }
+ }*/
/*if (packet.synched && FrameSkip(packet.presentation_time)) {
*samplepos=packet.length;
// buffer[packet.pos_buffer+0],buffer[packet.pos_buffer+1],buffer[packet.pos_buffer+2],buffer[packet.pos_buffer+3]);
*samplepos+=headerstrip;
if ( packet.synched ) {
+ if (!firstsynched) {
+ // check if this is an I frame, the decoder does not like non I frames at startup!
+ if (!detectIFrame(buffer,packet.length)) {
+ *samplepos=packet.length;//if we have not processed at least one
+ return packet.length;//synched packet ignore it!
+ }
+ }
if (cur_input_buf_omx) {
cur_input_buf_omx->nFlags|=OMX_BUFFERFLAG_ENDOFFRAME;
PutBufferToPres(cur_input_buf_omx);