Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.

AVSync::SetPosition() problem

mazhurin1
Beginner
358 Views

Hello,

I am writing a MP4 player using AVSync class. It works fine. The problem arised when I tried to implement a simple scrolling throught the video file (when the video is paused). I use AVSync::SetPosition() method which calls m_pSplitter->SetPosition(dfPos). But I see nothing on the screen. It looks like VideoRenderer has nothing to display in this case.

Do I miss something?

Regards,

Anton

0 Kudos
4 Replies
Vladimir_Dudnik
Employee
358 Views

Did you try to decode after re-positioning? Change position in bitstreams do not decode frame, it just set new position.

Regards,
Vladimir

0 Kudos
mazhurin
Beginner
358 Views

Hi Vladimir,

Thank you for the reply, but I still have problem.

1) I decode frames as you suggested. I call AVSync->Init(); AVSync->SetPosition(); and then my new function AVSync->RenderCurrentFrame(). See below (I uses VideoProc() as a template):

bool
AVSync::RenderCurrentFrame()
{
UMC::Status umcSplitRes = UMC::UMC_OK;
UMC::MediaDataEx data;
UMC::VideoData out_data;
UMC::Status umcRes = UMC::UMC_OK;

out_data.Init(m_DecodedFrameSize.width,
m_DecodedFrameSize.height,
m_cFormat);

umcRes = m_pVideoRender->LockInputBuffer(&out_data);

double dfDecTime = 0;
do
{

if ((4 >= data.GetDataSize() || umcRes == UMC::UMC_NOT_ENOUGH_DATA)
&& UMC::UMC_OK == umcSplitRes)
{
umcSplitRes = umcRes = m_pSplitter->GetNextVideoData(&data);
vm_debug_trace(1, VM_STRING("VideoProc: data size from splitter is %d "),
data.GetDataSize());
if(UMC::UMC_WAIT_FOR_REPOSITION == umcSplitRes)
{
umcSplitRes = UMC::UMC_OK;
}
}
else
{ umcRes = UMC::UMC_OK; }

if (UMC::UMC_OK == umcRes && NULL == data.GetDataPointer())
{ umcSplitRes = UMC::UMC_END_OF_STREAM; }

if (UMC::UMC_END_OF_STREAM == umcSplitRes)
{ umcRes = UMC::UMC_OK; }

out_data.SetTime(data.GetTime());

if (UMC::UMC_OK == umcRes)
{

if (UMC::UMC_END_OF_STREAM != umcSplitRes)
{
umcRes = GetFrameStub(&data, out_data, dfDecTime);
}
else // sweap reference frames from the decoder
{
umcRes = GetFrameStub(NULL, out_data, dfDecTime);
}

if(umcRes != UMC::UMC_OK)
&n bsp; { vm_time_sleep(10);}
}

} while (UMC::UMC_NOT_ENOUGH_DATA == umcRes ||
UMC::UMC_NOT_FIND_SYNCWORD == umcRes);

m_pVideoRender->UnLockInputBuffer(&out_data);

if (UMC::UMC_OK != umcRes)
{
return false;
}

m_pVideoRender->GetRenderFrame();
m_pVideoRender->RenderFrame();
return true;
}

2) After thatI always had UMC_NOT_INITIALIZED from GetFrameStub().I added another function

void AVSync::InitializeDecoder()
{
UMC::Status umcSplitRes = UMC::UMC_OK;
UMC::MediaDataEx data;
UMC::VideoData out_data;
UMC::Status umcRes = UMC::UMC_OK;

out_data.Init(m_DecodedFrameSize.width,
m_DecodedFrameSize.height,
m_cFormat);

double dfDecTime = 0;
do
{
umcSplitRes = umcRes = m_pSplitter->GetNextVideoData(&data);
if (data.GetDataSize() <= 0)
break;
umcRes = GetFrameStub(&data, out_data, dfDecTime);
} while (UMC::UMC_FAILED_TO_INITIALIZE == umcRes);

return;
}

3) After that m_pSplitter->GetNextVideoData() couldn't find the next I-Frame. I modifiyed UMC::MPEG4EncoderParams.IVOPdist from 300 to 1 in my mp4 encoder.

4) After that m_pSplitter->GetNextVideoData() always returns the very first frame.

Please tell me what I do wrong since it's pretty hard for me to understandwhat is happening in m_pSplitter->GetNextVideoData() function.

Thanks, Anton

PS: My debug window

Reposition starts
m_pSplitter->SetPosition started = 2.624000
m_pSplitter->SetPosition returned
Reposition ends: v = 2.550 a = 2.560
VideoProc: data size from splitter is 2812
Splitter PTS: 2.600000
Decoder PTS: 2.600000
Reposition starts
m_pSplitter->SetPosition started = 1.707000
m_pSplitter->SetPosition returned
Reposition ends: v = 1.650 a = 1.672
VideoProc: data size from splitter is 3716
Splitter PTS: 1.700000
Decoder PTS: 1.700000

0 Kudos
mfarook
Beginner
358 Views
I am trying to implement the same thing. Have you had any progress?
0 Kudos
mikl_la
Beginner
358 Views

so did someone implement the setPosition/getPosition functions by himself? or are there other possibilities to get such funktionality?

0 Kudos
Reply