From 633ab812c30fa2353800ad6431f41f25993ec6bd Mon Sep 17 00:00:00 2001 From: zhangmeng <775834166@qq.com> Date: 星期一, 13 五月 2019 12:43:07 +0800 Subject: [PATCH] add scale --- csrc/wrapper.cpp | 15 +++++++++++++-- 1 files changed, 13 insertions(+), 2 deletions(-) diff --git a/csrc/wrapper.cpp b/csrc/wrapper.cpp index b095d36..aa9b520 100644 --- a/csrc/wrapper.cpp +++ b/csrc/wrapper.cpp @@ -33,9 +33,13 @@ ,thread_(nullptr) ,stop_stream_(false) ,bridge_(NULL) + ,scale_w_(0) + ,scale_h_(0) + ,scale_f_(SWS_POINT) { makeTheWorld(); } + Wrapper::~Wrapper() { @@ -49,6 +53,12 @@ if(recorder_){ delete recorder_; recorder_ = NULL; } + } + + void Wrapper::ScalePicture(const int w, const int h, const int flags){ + scale_w_ = w; + scale_f_ = flags; + scale_h_ = h; } std::unique_ptr<ffwrapper::FormatIn> Wrapper::init_reader(const char* input){ @@ -76,8 +86,9 @@ AVPixelFormat pix_fmt = AV_PIX_FMT_BGR24; bridge_ = new cvbridge( - dec_ctx->width, dec_ctx->height, dec_ctx->pix_fmt, - dec_ctx->width, dec_ctx->height, pix_fmt, SWS_BICUBIC); + 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_); } if (!flag){ -- Gitblit v1.8.0