Mercurial > mplayer.hg
changeset 34809:ea97bcb28df1
Allow direct rendering for non-reference frames in H.264.
This might work for other codecs that currently have DR
disabled, but H.264 is the only one tested so far.
author | reimar |
---|---|
date | Mon, 14 May 2012 18:11:24 +0000 |
parents | 275c92f137ac |
children | e48338dbd0cb |
files | libmpcodecs/vd_ffmpeg.c |
diffstat | 1 files changed, 11 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/libmpcodecs/vd_ffmpeg.c Sun May 13 19:55:27 2012 +0000 +++ b/libmpcodecs/vd_ffmpeg.c Mon May 14 18:11:24 2012 +0000 @@ -61,6 +61,7 @@ enum PixelFormat pix_fmt; int do_slices; int do_dr1; + int nonref_dr; ///< allow dr only for non-reference frames int vo_initialized; int best_csp; int qp_stat[32]; @@ -243,8 +244,9 @@ if(use_slices && (lavc_codec->capabilities&CODEC_CAP_DRAW_HORIZ_BAND) && !do_vis_debug) ctx->do_slices=1; - if(lavc_codec->capabilities&CODEC_CAP_DR1 && !do_vis_debug && lavc_codec->id != CODEC_ID_H264 && lavc_codec->id != CODEC_ID_INTERPLAY_VIDEO && lavc_codec->id != CODEC_ID_VP8 && lavc_codec->id != CODEC_ID_LAGARITH) + if(lavc_codec->capabilities&CODEC_CAP_DR1 && !do_vis_debug && lavc_codec->id != CODEC_ID_INTERPLAY_VIDEO && lavc_codec->id != CODEC_ID_VP8 && lavc_codec->id != CODEC_ID_LAGARITH) ctx->do_dr1=1; + ctx->nonref_dr = lavc_codec->id == CODEC_ID_H264; ctx->ip_count= ctx->b_count= 0; ctx->pic = avcodec_alloc_frame(); @@ -560,6 +562,12 @@ } } + if (ctx->nonref_dr) { + if (flags & MP_IMGFLAG_PRESERVE) + return avcodec_default_get_buffer(avctx, pic); + type = MP_IMGTYPE_TEMP; + } + if(init_vo(sh, avctx->pix_fmt) < 0){ avctx->release_buffer= avcodec_default_release_buffer; avctx->get_buffer= avcodec_default_get_buffer; @@ -677,6 +685,8 @@ sh_video_t *sh = avctx->opaque; vd_ffmpeg_ctx *ctx = sh->context; int i; + if (pic->type != FF_BUFFER_TYPE_USER) + return avcodec_default_release_buffer(avctx, pic); //printf("release buffer %d %d %d\n", mpi ? mpi->flags&MP_IMGFLAG_PRESERVE : -99, ctx->ip_count, ctx->b_count);