AudioFilter

- creates plugin with reverb filter
- adjusts HelloWorld and GreenScreen to fit audio/video handling from daemon
- some code cleanup

Change-Id: If4fda4dc67b9b3db14fc7395ebf3d510923b454b
GitLab: #3
diff --git a/lib/accel.cpp b/lib/accel.cpp
index d5d92aa..90ff04a 100644
--- a/lib/accel.cpp
+++ b/lib/accel.cpp
@@ -18,9 +18,6 @@
  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
  */
 
-#ifndef ACCEL_H
-#define ACCEL_H
-
 #include "accel.h"
 
 extern "C" {
@@ -39,20 +36,22 @@
 }
 
 AVFrame*
-transferToMainMemory(AVFrame* framePtr, AVPixelFormat desiredFormat)
+transferToMainMemory(const AVFrame* framePtr, AVPixelFormat desiredFormat)
 {
     AVFrame* out = av_frame_alloc();
     auto desc = av_pix_fmt_desc_get(static_cast<AVPixelFormat>(framePtr->format));
 
     if (desc && !(desc->flags & AV_PIX_FMT_FLAG_HWACCEL)) {
-        out = framePtr;
-        return out;
+        av_frame_unref(out);
+        av_frame_free(&out);
+        return av_frame_clone(framePtr);
     }
 
     out->format = desiredFormat;
     if (av_hwframe_transfer_data(out, framePtr, 0) < 0) {
-        out = framePtr;
-        return out;
+        av_frame_unref(out);
+        av_frame_free(&out);
+        return av_frame_clone(framePtr);
     }
 
     out->pts = framePtr->pts;
@@ -63,5 +62,3 @@
     }
     return out;
 }
-
-#endif