macosx: add build option for macosx

Gitlab: #18
Change-Id: I1372c1881b894fd0cde76f5ad94067bd22192315
diff --git a/HelloWorld/CoinCircleVideoSubscriber.cpp b/HelloWorld/CoinCircleVideoSubscriber.cpp
index 46e8b8c..b3e7720 100644
--- a/HelloWorld/CoinCircleVideoSubscriber.cpp
+++ b/HelloWorld/CoinCircleVideoSubscriber.cpp
@@ -25,6 +25,7 @@
 }
 #include <accel.h>
 #include <frameUtils.h>
+#include <frameScaler.h>
 #include <pluglog.h>
 #include <stdio.h>
 #include <opencv2/imgproc.hpp>
@@ -65,19 +66,15 @@
     // GET RAW FRAME
     // Use a non-const Frame
     // Convert input frame to RGB
-    int inputHeight = pluginFrame->height;
-    int inputWidth = pluginFrame->width;
-    AVFrame* temp = transferToMainMemory(pluginFrame, AV_PIX_FMT_NV12);
-    AVFrame* bgrFrame = scaler.convertFormat(temp, AV_PIX_FMT_RGB24);
-    av_frame_unref(temp);
-    av_frame_free(&temp);
-    if (!bgrFrame)
+    uniqueFramePtr rgbFrame = {transferToMainMemory(pluginFrame, AV_PIX_FMT_NV12), frameFree};
+    rgbFrame.reset(FrameScaler::convertFormat(rgbFrame.get(), AV_PIX_FMT_RGB24));
+    if (!rgbFrame.get())
         return;
-    resultFrame = cv::Mat {bgrFrame->height,
-                           bgrFrame->width,
+    resultFrame = cv::Mat {rgbFrame->height,
+                           rgbFrame->width,
                            CV_8UC3,
-                           bgrFrame->data[0],
-                           static_cast<size_t>(bgrFrame->linesize[0])};
+                           rgbFrame->data[0],
+                           static_cast<size_t>(rgbFrame->linesize[0])};
 
     // First clone the frame as the original one is unusable because of
     // linespace
@@ -94,23 +91,12 @@
     }
 
     drawCoinCircle(angle);
-    copyByLine(bgrFrame->linesize[0]);
+    copyByLine(rgbFrame->linesize[0]);
 
     //======================================================================================
     // REPLACE AVFRAME DATA WITH FRAME DATA
-    if (bgrFrame->data[0]) {
-        uint8_t* frameData = bgrFrame->data[0];
-        if (angle == 90 || angle == -90) {
-            std::memmove(frameData,
-                         resultFrame.data,
-                         static_cast<size_t>(pluginFrame->width * pluginFrame->height * 3)
-                             * sizeof(uint8_t));
-        }
-
-        moveFrom(pluginFrame, bgrFrame);
-    }
-    av_frame_unref(bgrFrame);
-    av_frame_free(&bgrFrame);
+    rgbFrame.reset(FrameScaler::convertFormat(rgbFrame.get(), AV_PIX_FMT_YUV420P));
+    moveFrom(pluginFrame, rgbFrame.get());
 }
 
 void