/* pixel data starts 48 bytes in, after 3x16-byte tables */
stream_ptr = 48;
+ if(s->frame.data[0])
+ avctx->release_buffer(avctx, &s->frame);
+
s->frame.reference = 0;
if(avctx->get_buffer(avctx, &s->frame) < 0) {
fprintf(stderr, "get_buffer() failed\n");
*data_size=sizeof(AVFrame);
*(AVFrame*)data= s->frame;
- avctx->release_buffer(avctx, &s->frame);
-
return buf_size;
}
else
avctx->aspect_ratio = 4.0 / 3.0;
+ if(s->picture.data[0])
+ avctx->release_buffer(avctx, &s->picture);
+
s->picture.reference= 0;
if(avctx->get_buffer(avctx, &s->picture) < 0) {
fprintf(stderr, "get_buffer() failed\n");
*data_size = sizeof(AVFrame);
*(AVFrame*)data= s->picture;
- avctx->release_buffer(avctx, &s->picture);
-
return packet_size;
}
init_get_bits(&s->gb, s->bitstream_buffer, buf_size*8);
+ if(p->data[0])
+ avctx->release_buffer(avctx, p);
+
p->reference= 0;
if(avctx->get_buffer(avctx, p) < 0){
fprintf(stderr, "get_buffer() failed\n");
emms_c();
*picture= *p;
-
- avctx->release_buffer(avctx, p);
-
*data_size = sizeof(AVFrame);
return (get_bits_count(&s->gb)+31)/32*4;
iv_decode_frame(s, buf, buf_size);
+ if(s->frame.data[0])
+ avctx->release_buffer(avctx, &s->frame);
+
s->frame.reference = 0;
if(avctx->get_buffer(avctx, &s->frame) < 0) {
fprintf(stderr, "get_buffer() failed\n");
*data_size=sizeof(AVFrame);
*(AVFrame*)data= s->frame;
- avctx->release_buffer(avctx, &s->frame);
-
return buf_size;
}
s->mb_skiped = 0;
assert(s->last_picture_ptr==NULL || s->out_format != FMT_H264);
-
+
/* mark&release old frames */
if (s->pict_type != B_TYPE && s->last_picture_ptr) {
avctx->release_buffer(avctx, (AVFrame*)s->last_picture_ptr);
}
}
}
-
alloc:
if(!s->encoding){
+ /* release non refernce frames */
+ for(i=0; i<MAX_PICTURE_COUNT; i++){
+ if(s->picture[i].data[0] && !s->picture[i].reference /*&& s->picture[i].type!=FF_BUFFER_TYPE_SHARED*/){
+ s->avctx->release_buffer(s->avctx, (AVFrame*)&s->picture[i]);
+ }
+ }
+
i= find_unused_picture(s, 0);
pic= (AVFrame*)&s->picture[i];
assert(i<MAX_PICTURE_COUNT);
#endif
- /* release non refernce frames */
- for(i=0; i<MAX_PICTURE_COUNT; i++){
- if(s->picture[i].data[0] && !s->picture[i].reference /*&& s->picture[i].type!=FF_BUFFER_TYPE_SHARED*/)
- s->avctx->release_buffer(s->avctx, (AVFrame*)&s->picture[i]);
+ if(s->encoding){
+ /* release non refernce frames */
+ for(i=0; i<MAX_PICTURE_COUNT; i++){
+ if(s->picture[i].data[0] && !s->picture[i].reference /*&& s->picture[i].type!=FF_BUFFER_TYPE_SHARED*/){
+ s->avctx->release_buffer(s->avctx, (AVFrame*)&s->picture[i]);
+ }
+ }
}
-
// clear copies, to avoid confusion
#if 0
memset(&s->last_picture, 0, sizeof(Picture));