Add av_shrink_packet function for use in av_get_packet that reduces pkt->size

and ensures the following padding is correctly initialized to 0.

Originally committed as revision 18378 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Reimar Döffinger
2009-04-08 20:19:12 +00:00
parent c81604f862
commit feb993e579
3 changed files with 16 additions and 1 deletions

View File

@@ -62,6 +62,13 @@ int av_new_packet(AVPacket *pkt, int size)
return 0;
}
void av_shrink_packet(AVPacket *pkt, int size)
{
if (pkt->size <= size) return;
pkt->size = size;
memset(pkt->data + size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
}
int av_dup_packet(AVPacket *pkt)
{
if (((pkt->destruct == av_destruct_packet_nofree) || (pkt->destruct == NULL)) && pkt->data) {