From 7f14cd7b96d181c235701cbb4a636634b14fa76c Mon Sep 17 00:00:00 2001
From: zhangmeng <775834166@qq.com>
Date: 星期一, 13 五月 2019 12:59:09 +0800
Subject: [PATCH] remove build

---
 csrc/wrapper.cpp |   19 +++++++++++++++----
 1 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/csrc/wrapper.cpp b/csrc/wrapper.cpp
index b095d36..ead51a0 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){
@@ -227,8 +238,8 @@
             unsigned char *data = (unsigned char*)malloc(frm->width * frm->height * 3);
             bridge_->copyPicture(data, frm);
             pic.data = data;
-            pic.w = frm->width;
-            pic.h = frm->height;
+            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