Mercurial > mplayer.hg
changeset 36315:e4ab2ab9eede
Factor out some common code.
author | reimar |
---|---|
date | Wed, 07 Aug 2013 18:21:06 +0000 |
parents | 57aad765dd8b |
children | 139f2b064ef9 |
files | libmpcodecs/vd_ffmpeg.c |
diffstat | 1 files changed, 14 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/libmpcodecs/vd_ffmpeg.c Wed Aug 07 15:01:06 2013 +0000 +++ b/libmpcodecs/vd_ffmpeg.c Wed Aug 07 18:21:06 2013 +0000 @@ -609,11 +609,7 @@ if(init_vo(sh, avctx->pix_fmt) < 0){ avctx->release_buffer= avcodec_default_release_buffer; - avctx->get_buffer= avcodec_default_get_buffer; - avctx->reget_buffer= avcodec_default_reget_buffer; - if (pic->data[0]) - release_buffer(avctx, pic); - return avctx->get_buffer(avctx, pic); + goto disable_dr1; } if (IMGFMT_IS_HWACCEL(ctx->best_csp)) { @@ -627,17 +623,7 @@ if (type == MP_IMGTYPE_IP || type == MP_IMGTYPE_IPB) { if(ctx->b_count>1 || ctx->ip_count>2){ mp_msg(MSGT_DECVIDEO, MSGL_WARN, MSGTR_MPCODECS_DRIFailure); - - ctx->do_dr1=0; //FIXME - // For frame-multithreading these contexts aren't - // the same and must both be updated. - ctx->avctx->get_buffer= - avctx->get_buffer= avcodec_default_get_buffer; - ctx->avctx->reget_buffer= - avctx->reget_buffer= avcodec_default_reget_buffer; - if (pic->data[0]) - release_buffer(avctx, pic); - return avctx->get_buffer(avctx, pic); + goto disable_dr1; } mp_msg(MSGT_DECVIDEO, MSGL_DBG2, type== MP_IMGTYPE_IPB ? "using IPB\n" : "using IP\n"); @@ -726,6 +712,18 @@ #endif pic->type= FF_BUFFER_TYPE_USER; return 0; + +disable_dr1: + ctx->do_dr1 = 0; + // For frame-multithreading these contexts aren't + // the same and must both be updated. + ctx->avctx->get_buffer = + avctx->get_buffer = avcodec_default_get_buffer; + ctx->avctx->reget_buffer = + avctx->reget_buffer = avcodec_default_reget_buffer; + if (pic->data[0]) + release_buffer(avctx, pic); + return avctx->get_buffer(avctx, pic); } static void release_buffer(struct AVCodecContext *avctx, AVFrame *pic){