comparison vb.c @ 9821:0813b30e7db9 libavcodec

Get new buffer during frame decoding in VB video decoder, not only once during decoder initialization.
author kostya
date Sat, 06 Jun 2009 08:46:08 +0000
parents 54bc8a2727b0
children d7ed9dcc78e3
comparison
equal deleted inserted replaced
9820:b72fbafc9408 9821:0813b30e7db9
183 int flags; 183 int flags;
184 uint32_t size; 184 uint32_t size;
185 int rest = buf_size; 185 int rest = buf_size;
186 int offset = 0; 186 int offset = 0;
187 187
188 if(c->pic.data[0])
189 avctx->release_buffer(avctx, &c->pic);
190 c->pic.reference = 1;
191 if(avctx->get_buffer(avctx, &c->pic) < 0){
192 av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
193 return -1;
194 }
195
188 c->stream = buf; 196 c->stream = buf;
189 flags = bytestream_get_le16(&c->stream); 197 flags = bytestream_get_le16(&c->stream);
190 rest -= 2; 198 rest -= 2;
191 199
192 if(flags & VB_HAS_GMC){ 200 if(flags & VB_HAS_GMC){
242 250
243 c->avctx = avctx; 251 c->avctx = avctx;
244 avctx->pix_fmt = PIX_FMT_PAL8; 252 avctx->pix_fmt = PIX_FMT_PAL8;
245 253
246 if (avcodec_check_dimensions(avctx, avctx->width, avctx->height) < 0) { 254 if (avcodec_check_dimensions(avctx, avctx->width, avctx->height) < 0) {
247 return -1;
248 }
249
250 c->pic.reference = 1;
251 if(avctx->get_buffer(avctx, &c->pic) < 0){
252 av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
253 return -1; 255 return -1;
254 } 256 }
255 257
256 c->frame = av_malloc( avctx->width * avctx->height); 258 c->frame = av_malloc( avctx->width * avctx->height);
257 c->prev_frame = av_malloc( avctx->width * avctx->height); 259 c->prev_frame = av_malloc( avctx->width * avctx->height);