Media (Intel® Video Processing Library, Intel Media SDK)
Access community support with transcoding, decoding, and encoding in applications using media tools like Intel® oneAPI Video Processing Library and Intel® Media SDK
Announcements
The Intel Media SDK project is no longer active. For continued support and access to new features, Intel Media SDK users are encouraged to read the transition guide on upgrading from Intel® Media SDK to Intel® Video Processing Library (VPL), and to move to VPL as soon as possible.
For more information, see the VPL website.

Intel Media SDK with ffmpeg

Adi_S_
Beginner
448 Views

Hi Petter,

  I have a question about the ffmpeg code.

In FFMPEGReader::ReadNextFrame(), the heart of the function (and the whole code samplw really) is:

[cpp]
memmove(pBS->Data, pBS->Data + pBS->DataOffset, pBS->DataLength);
pBS->DataOffset = 0;
memcpy(pBS->Data + pBS->DataLength, pOutBuf, outBufSize);
pBS->DataLength += outBufSize; 
[/cpp] 

I don't understand what line (1) above does.
Is it a copy/paste error (it also appear again a fewlines down in the MPEG2 case)?

Thanks,
Adi 

0 Kudos
2 Replies
Petter_L_Intel
Employee
448 Views

Hi Adi,

This is to ensure that any remaining bitstream data from previous processing is not lost. the memmove call moves the remaining data to the beginning of the buffer. The following memcpy call appends the buffer with the new data.

Regards,
Petter 

0 Kudos
Adi_S_
Beginner
448 Views

Thanks, Petter.
When I made the code read a network stream the av_free_packet(&packet); line consistently crashed.
I needed to add:

if(pOutBuf!=packet.data)
      av_free(pOutBuf);

for the case where av_bitstream_filter_filter() does not allocate a new packet buffer.

Adi

0 Kudos
Reply