- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page