comparison avpacket.c @ 9360:66e270967340 libavcodec

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.
author reimar
date Wed, 08 Apr 2009 20:19:12 +0000
parents 2108342734cc
children d322325fc00e
comparison
equal deleted inserted replaced
9359:f978e4a699c5 9360:66e270967340
60 pkt->size = size; 60 pkt->size = size;
61 pkt->destruct = av_destruct_packet; 61 pkt->destruct = av_destruct_packet;
62 return 0; 62 return 0;
63 } 63 }
64 64
65 void av_shrink_packet(AVPacket *pkt, int size)
66 {
67 if (pkt->size <= size) return;
68 pkt->size = size;
69 memset(pkt->data + size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
70 }
71
65 int av_dup_packet(AVPacket *pkt) 72 int av_dup_packet(AVPacket *pkt)
66 { 73 {
67 if (((pkt->destruct == av_destruct_packet_nofree) || (pkt->destruct == NULL)) && pkt->data) { 74 if (((pkt->destruct == av_destruct_packet_nofree) || (pkt->destruct == NULL)) && pkt->data) {
68 uint8_t *data; 75 uint8_t *data;
69 /* We duplicate the packet and don't forget to add the padding again. */ 76 /* We duplicate the packet and don't forget to add the padding again. */