Commit b0397e0e authored by Zdenek Kabelac's avatar Zdenek Kabelac
Browse files

* DR1 support

Originally committed as revision 1157 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 8664c807
...@@ -551,18 +551,39 @@ static int dvvideo_decode_frame(AVCodecContext *avctx, ...@@ -551,18 +551,39 @@ static int dvvideo_decode_frame(AVCodecContext *avctx,
else else
mb_pos_ptr = dv_place_420; mb_pos_ptr = dv_place_420;
if (avctx->flags & CODEC_FLAG_DR1 && avctx->get_buffer_callback)
{
s->width = -1;
avctx->dr_buffer[0] = avctx->dr_buffer[1] = avctx->dr_buffer[2] = 0;
if(avctx->get_buffer_callback(avctx, width, height, I_TYPE) < 0){
fprintf(stderr, "get_buffer() failed\n");
return -1;
}
}
/* (re)alloc picture if needed */ /* (re)alloc picture if needed */
if (s->width != width || s->height != height) { if (s->width != width || s->height != height) {
for(i=0;i<3;i++) if (!(avctx->flags & CODEC_FLAG_DR1))
av_freep(&s->current_picture[i]); for(i=0;i<3;i++) {
if (avctx->dr_buffer[i] != s->current_picture[i])
av_freep(&s->current_picture[i]);
avctx->dr_buffer[i] = 0;
}
for(i=0;i<3;i++) { for(i=0;i<3;i++) {
size = width * height; if (avctx->dr_buffer[i]) {
s->linesize[i] = width; s->current_picture[i] = avctx->dr_buffer[i];
if (i >= 1) { s->linesize[i] = (i == 0) ? avctx->dr_stride : avctx->dr_uvstride;
size >>= 2; } else {
s->linesize[i] >>= s->sampling_411 ? 2 : 1; size = width * height;
} s->linesize[i] = width;
s->current_picture[i] = av_malloc(size); if (i >= 1) {
size >>= 2;
s->linesize[i] >>= s->sampling_411 ? 2 : 1;
}
s->current_picture[i] = av_malloc(size);
}
if (!s->current_picture[i]) if (!s->current_picture[i])
return -1; return -1;
} }
...@@ -614,6 +635,7 @@ static int dvvideo_decode_end(AVCodecContext *avctx) ...@@ -614,6 +635,7 @@ static int dvvideo_decode_end(AVCodecContext *avctx)
int i; int i;
for(i=0;i<3;i++) for(i=0;i<3;i++)
if (avctx->dr_buffer[i] != s->current_picture[i])
av_freep(&s->current_picture[i]); av_freep(&s->current_picture[i]);
return 0; return 0;
} }
...@@ -627,7 +649,7 @@ AVCodec dvvideo_decoder = { ...@@ -627,7 +649,7 @@ AVCodec dvvideo_decoder = {
NULL, NULL,
dvvideo_decode_end, dvvideo_decode_end,
dvvideo_decode_frame, dvvideo_decode_frame,
0, CODEC_CAP_DR1,
NULL NULL
}; };
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment