From 140218bc5942c6d104b3b292dcec68d3f1a0bed1 Mon Sep 17 00:00:00 2001 From: zhangmeng <775834166@qq.com> Date: 星期三, 03 七月 2019 10:50:34 +0800 Subject: [PATCH] del .idea --- csrc/wrapper.cpp | 13 ++++++++----- 1 files changed, 8 insertions(+), 5 deletions(-) diff --git a/csrc/wrapper.cpp b/csrc/wrapper.cpp index ead51a0..321a66a 100644 --- a/csrc/wrapper.cpp +++ b/csrc/wrapper.cpp @@ -84,11 +84,13 @@ auto dec_ctx = in->getCodecContext(); if(bridge_)delete bridge_; + scale_w_ = scale_w_ == 0 || scale_w_ > dec_ctx->width ? dec_ctx->width : scale_w_; + scale_h_ = scale_h_ == 0 || scale_h_ > dec_ctx->height ? dec_ctx->height : scale_h_; + AVPixelFormat pix_fmt = AV_PIX_FMT_BGR24; bridge_ = new cvbridge( dec_ctx->width, dec_ctx->height, dec_ctx->pix_fmt, - scale_w_?scale_w_:dec_ctx->width, scale_h_?scale_h_:dec_ctx->height, pix_fmt, - scale_f_); + scale_w_, scale_h_, pix_fmt, scale_f_); } if (!flag){ @@ -235,11 +237,12 @@ pic_bgr24 pic; if(bridge_){ AVFrame *frm = frame->getAVFrame(); - unsigned char *data = (unsigned char*)malloc(frm->width * frm->height * 3); + pic.w = scale_w_; + pic.h = scale_h_; + + unsigned char *data = (unsigned char*)malloc(pic.w * pic.h * 3); bridge_->copyPicture(data, frm); pic.data = data; - pic.w = scale_w_ ? scale_w_ : frm->width; - pic.h = scale_h_ ? scale_h_ : frm->height; } if(func_dec_){ func_dec_(pic.data, pic.w, pic.h); -- Gitblit v1.8.0