Buffer<QImage>* StreamingManager::Start()
{
  AVPacket  avpkt;
  AVFrame  *frame = avcodec_alloc_frame();
  av_init_packet(&avpkt);
  InitStreams();
  while (frameBuffer->Length() < FRAMEBUFFER_SIZE)
  {
    StreamConfig *decConfig = GetNextPacket(avFormatContextPtr, &avpkt);
    DecodeFrame(frame, &avpkt, decConfig);
  }

  return frameBuffer;
}
예제 #2
0
int main(int argc,char *argv[])
{
    char *filename;

    sdword size;
    ubyte *packet;

    if (argc < 2)
    {
        print("Usage: PktView filename.pkts [verbose]");
        return 0;
    }

    filename = argv[1];
    
    verbose = 0;
    if (argc >= 3)
    {
        if (stricmp(argv[2],"verbose") == 0)
        {
            verbose = 1;
        }
    }

    fp = fopen(filename,"rb");
    if (fp == NULL)
    {
        print("Error opening file %s",filename);
        return 0;
    }

    for (;;)
    {
        packet = GetNextPacket(&size);
        if (packet == NULL)
            break;
        if (size <= 0)
        {
            free(packet);
            break;
        }

        PrintPacketInfo(packet,size);
        free(packet);
    }

    fclose(fp);
    return 0;
}
예제 #3
0
void CRTPRecv::OnPollThreadStep()
{
	BeginDataAccess();
	// check incoming packets
	if (GotoFirstSourceWithData())
	{	
		//处理接收数据包.
		do
		{
			RTPPacket *pack = NULL;
			while ((pack = GetNextPacket()) != NULL)
			{
				m_RecvTimeStamp = GetTickCount();
				
				if (!m_RecvFlag)
				{
					//有新数据进来
					m_RecvFlag=TRUE;
					//获取对端地址
					RTPAddress *pAddress = (RTPAddress*)(GetCurrentSourceInfo()->GetRTPDataAddress());
					//添加远端到发送地址列表
					RTPIPv4Address *pIPV4Address = (RTPIPv4Address*)pAddress;
					//AddDestination(*pIPV4Address);
					
					//获取远端IP
					in_addr addr;
					addr.S_un.S_addr=pIPV4Address->GetIP();

					//通知出去
					//m_pRTPRecvStatusCallBack(EN_RTP_RECV_STATUS::StartRecv,inet_ntoa(addr),pIPV4Address->GetPort(),m_pRTPRecvStatusUserData);
				}
				HandleRTPData(pack);
				DeletePacket(pack);
			}
		} while (GotoNextSourceWithData());
	}
	EndDataAccess();
}