Community
cancel
Showing results for 
Search instead for 
Did you mean: 
bcisrd
Beginner
57 Views

H264VideoDecoder Init Help

I am attempting to use H264VideoDecoder to view a network Camera. Imy problem is getting the decoder initialize properly. Using rtsp I am getting SDP with the following:

m=video 0 RTP/AVP 98
b=AS:0
a=rtpmap:98 H264/90000
a=fmtp:98 packetization-mode=1; profile-level-id=4d001f; sprop-parameter-sets=J00AH9oFB+Q=,KO48gA==

I believe to understand packetization-modeand sprop-parameter-sets. I don't understand how to use profile-level-id in conjuction with H264VideoDecoder? Below is a code snippet "m_pvidDecoder->GetInfo (&params)" always returns VM_NOT_INITIALIZED?

Can someone direct me on why this does not work?

I am using IPP 6.1.1.035 compiled using Microsoft Visual Studio 2005 C++ on windows xp.

//////////////////////////////////////////
//Code Snippet
/////////////////////////////////////////

//-------------------------------------------------------------
bool Init (BYTE *pData, unsigned long nSize)
{
bool bRetVal = false;
UMC::Status nStatus;
m_pvidDecoder = new UMC::H264VideoDecoder();
if (m_pvidDecoder)
{
m_inVid.SetBufferPointer (pData, nSize);
m_inVid.SetDataSize (nSize);
m_VidDecodeParams.pPostProcessing = NULL;
m_VidDecodeParams.info.stream_type = UMC::H264_VIDEO;
m_VidDecodeParams.numThreads = m_nThreadCount;
m_VidDecodeParams.lFlags = 0;
m_VidDecodeParams.m_pData = &m_inVid;
nStatus = m_pvidDecoder->Init(&m_VidDecodeParams);
if(nStatus == UMC::UMC_OK)
{
UMC::H264VideoDecoderParams params;
nStatus = m_pvidDecoder->GetInfo (&params);
if(nStatus == UMC::UMC_OK)
{
nStatus = m_outVid.Init (params.info.clip_info.width, params.info.clip_info.height, UMC::RGB24, 8);
if(nStatus == UMC::UMC_OK)
{
nStatus = m_outVid.Alloc ();
if(nStatus == UMC::UMC_OK)
{
bRetVal = true;
}
}
}
}
}
return (bRetVal);
}

//----------------------------------------------------------------------------------
void SetParameters ()
{
int nSPSSize = vlc_b64_decode_binary (&pSPS, strSPS);
int nPPSSize = vlc_b64_decode_binary (&pPPS, strPPS);
m_pBuffer[m_nSize + 0] = 0;
m_pBuffer[m_nSize + 1] = 0;
m_pBuffer[m_nSize + 2] = 0;
m_pBuffer[m_nSize + 3] = 1;
m_nSize += 4;
memcpy_s(&(m_pBuffer[m_nSize]), (m_nBufSize - m_nSize), pSPS, nSPSSize);
m_nSize += nSPSSize;
m_pBuffer[m_nSize + 0] = 0;
m_pBuffer[m_nSize + 1] = 0;
m_pBuffer[m_nSize + 2] = 0;
m_pBuffer[m_nSize + 3] = 1;
m_nCurrentSize += 4;
memcpy_s(&(m_pBuffer[m_nSize]), (m_nBufSize - m_nSize), pPPS, nPPSSize);
m_nSize += nPPSSize;
Init (m_pBuffer, m_nSize);
}

0 Kudos
2 Replies
bcisrd
Beginner
57 Views

Okey, it appearsonly usingsprop-parameter-sets to initialize the decoder was the problem.When I created a BYTE array with the 2 elem of sprop-parameter-sets along with SPS and PPS, from the RTP stream,calling Init (...)succeeded without error.

I was mistaken that the 2 elements of sprop-parameter-sets were the same as SPS and PPS!? (A little confused by this?)

Now the decoder's GetFrame call is returning VM_NOT_ENOUGH_DATA. I have seen several threads on this topic so will be researching that.

Though Any and All comments are welcome.
bcisrd
Beginner
57 Views

Okey, it appearsonly usingsprop-parameter-sets to initialize the decoder was the problem.When I created a BYTE array with the 2 elem of sprop-parameter-sets along with SPS and PPS, from the RTP stream,calling Init (...)succeeded without error.

I was mistaken that the 2 elements of sprop-parameter-sets were the same as SPS and PPS!? (A little confused by this?)

Now the decoder's GetFrame call is returning VM_NOT_ENOUGH_DATA. I have seen several threads on this topic so will be researching that.

Though Any and All comments are welcome.
Reply