[Mplayer-cvslog] CVS: main/libmpcodecs vd_ffmpeg.c,1.87,1.88
Michael Niedermayer CVS
michael at mplayerhq.hu
Fri Apr 25 02:57:32 CEST 2003
- Previous message: [Mplayer-cvslog] CVS: main/libvo vo_xv.c,1.138,1.139
- Next message: [Mplayer-cvslog] CVS: main/osdep timer-win2.c,NONE,1.1 glob.h,NONE,1.1 glob-win.c,NONE,1.1 Makefile,1.10,1.11 getch2-win.c,1.2,1.3
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/mplayer/main/libmpcodecs
In directory mail:/var/tmp.root/cvs-serv25653
Modified Files:
vd_ffmpeg.c
Log Message:
fallback to non-dr1 if the codec wants more than 1+2 buffers
Index: vd_ffmpeg.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/vd_ffmpeg.c,v
retrieving revision 1.87
retrieving revision 1.88
diff -u -r1.87 -r1.88
--- vd_ffmpeg.c 18 Apr 2003 22:12:36 -0000 1.87
+++ vd_ffmpeg.c 25 Apr 2003 00:57:04 -0000 1.88
@@ -70,6 +70,8 @@
int qp_stat[32];
double qp_sum;
double inv_qp_sum;
+ int ip_count;
+ int b_count;
} vd_ffmpeg_ctx;
//#ifdef FF_POSTPROCESS
@@ -162,6 +164,7 @@
if(sh->format == mmioFOURCC('H','F','Y','U'))
ctx->do_dr1=0;
ctx->b_age= ctx->ip_age[0]= ctx->ip_age[1]= 256*256*256*64;
+ ctx->ip_count= ctx->b_count= 0;
#if LIBAVCODEC_BUILD >= 4645
ctx->pic = avcodec_alloc_frame();
@@ -377,24 +380,27 @@
int width= avctx->width;
int height= avctx->height;
int align=15;
-
+//printf("get_buffer %d %d %d\n", pic->reference, ctx->ip_count, ctx->b_count);
if(avctx->pix_fmt == PIX_FMT_YUV410P)
align=63; //yes seriously, its really needed (16x16 chroma blocks in SVQ1 -> 64x64)
- if(init_vo(sh)<0){
- printf("init_vo failed\n");
-
- avctx->get_buffer= avcodec_default_get_buffer;
- avctx->release_buffer= avcodec_default_release_buffer;
- return avctx->get_buffer(avctx, pic);
- }
-
- if(!pic->reference)
+ if(!pic->reference){
+ ctx->b_count++;
flags|=(!avctx->hurry_up && ctx->do_slices) ?
MP_IMGFLAG_DRAW_CALLBACK:0;
- else
+ }else{
+ ctx->ip_count++;
flags|= MP_IMGFLAG_PRESERVE|MP_IMGFLAG_READABLE
| (ctx->do_slices ? MP_IMGFLAG_DRAW_CALLBACK : 0);
+ }
+
+ if(init_vo(sh)<0 || ctx->b_count>1 || ctx->ip_count>2){
+ printf("DR1 failure\n");
+
+ ctx->do_dr1=0; //FIXME
+ avctx->get_buffer= avcodec_default_get_buffer;
+ return avctx->get_buffer(avctx, pic);
+ }
if(avctx->has_b_frames){
type= MP_IMGTYPE_IPB;
@@ -471,12 +477,26 @@
}
static void release_buffer(struct AVCodecContext *avctx, AVFrame *pic){
+ mp_image_t* mpi= pic->opaque;
+ sh_video_t * sh = avctx->opaque;
+ vd_ffmpeg_ctx *ctx = sh->context;
int i;
-
+
+//printf("release buffer %d %d %d\n", mpi ? mpi->flags&MP_IMGFLAG_PRESERVE : -99, ctx->ip_count, ctx->b_count);
+
+ if(ctx->ip_count <= 2 && ctx->b_count<=1){
+ if(mpi->flags&MP_IMGFLAG_PRESERVE)
+ ctx->ip_count--;
+ else
+ ctx->b_count--;
+ }
#if LIBAVCODEC_BUILD >= 4644
- assert(pic->type == FF_BUFFER_TYPE_USER);
+ if(pic->type!=FF_BUFFER_TYPE_USER){
+ avcodec_default_release_buffer(avctx, pic);
+ return;
+ }
#endif
-
+
for(i=0; i<4; i++){
pic->data[i]= NULL;
}
@@ -539,6 +559,8 @@
ret = avcodec_decode_video(avctx, pic,
&got_picture, data, len);
+ dr1= ctx->do_dr1;
+
if(ret<0) mp_msg(MSGT_DECVIDEO,MSGL_WARN, "Error while decoding frame!\n");
//printf("repeat: %d\n", pic->repeat_pict);
//-- vstats generation
- Previous message: [Mplayer-cvslog] CVS: main/libvo vo_xv.c,1.138,1.139
- Next message: [Mplayer-cvslog] CVS: main/osdep timer-win2.c,NONE,1.1 glob.h,NONE,1.1 glob-win.c,NONE,1.1 Makefile,1.10,1.11 getch2-win.c,1.2,1.3
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the MPlayer-cvslog
mailing list