void playThread::run()
{
QMutex waitMutex;
printf("\n ************** Play Thread Started **************\n");
while(1)
{
printf("\n ************** Play Thread Started **************\n");
if (m_bToSuspend) {
waitMutex.lock();
m_waitCondt.wait(&waitMutex);
waitMutex.unlock();
}
pcap_t *fp;
struct pcap_pkthdr hdr;
char errbuf[PCAP_ERRBUF_SIZE];
pcap_t *descr= pcap_open_offline(D_T_Buff,errbuf);
const u_char * packet;
printf("D_T_Buff %s\n",D_T_Buff);
devss = pcap_lookupdev(errbuf);
if (devss == NULL) {
fprintf(stderr, "Couldn't find default device: %s\n", errbuf);
}
packet = pcap_next(descr, &hdr);
if ( pcap_open_live(devss, 100, 1,1000,errbuf ) == NULL)
{
}
struct timespec *req=new timespec;
struct timespec *rem=new timespec;
while (packet)
{
unsigned packetSize= hdr.len;
unsigned long packetTime= req->tv_sec = hdr.ts.tv_sec;
packetTime= req->tv_nsec = hdr.ts.tv_usec*1000L;
for (unsigned i=0; i < packetSize ;i++)
{
}
packet = pcap_next(descr, &hdr);
unsigned long packetTime1= rem->tv_sec = hdr.ts.tv_sec;
packetTime1= rem->tv_nsec = hdr.ts.tv_usec*1000L;
unsigned long delay = (packetTime1 - packetTime)/1000;
printf("Delay %ld",delay);
usleep(delay);
}
pcap_close(descr);
}
}