Adapt to Windows and change Name
Change-Id: I875ce8a6c90463021c0ee5979fe11a7f1f3a3869
diff --git a/lib/accel.h b/lib/accel.h
index 5bb32a1..08f42cf 100644
--- a/lib/accel.h
+++ b/lib/accel.h
@@ -1,10 +1,29 @@
+/**
+ * Copyright (C) 2020 Savoir-faire Linux Inc.
+ *
+ * Author: Aline Gondim Santos <aline.gondimsantos@savoirfairelinux.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
-
+extern "C" {
#include <libavutil/pixdesc.h>
#include <libavutil/hwcontext.h>
#include <libavutil/frame.h>
#include <libavutil/buffer.h>
-#include "pluglog.h"
+}
namespace DRing {
class MediaFrame;
@@ -19,7 +38,7 @@
extern "C" {
#if LIBAVUTIL_VERSION_MAJOR < 56
AVFrameSideData*
-av_frame_new_side_data_from_buf(AVFrame* frame, enum AVFrameSideDataType type, AVBufferRef* buf)
+av_frame_new_side_data_from_buf (AVFrame* frame, enum AVFrameSideDataType type, AVBufferRef* buf)
{
auto side_data = av_frame_new_side_data(frame, type, 0);
av_buffer_unref(&side_data->buf);
@@ -32,25 +51,26 @@
}
AVFrame*
-transferToMainMemory(AVFrame* framePtr, AVPixelFormat desiredFormat)
+transferToMainMemory (AVFrame* framePtr, AVPixelFormat desiredFormat)
{
- AVFrame* out = nullptr;
+ AVFrame* out;
auto desc = av_pix_fmt_desc_get(static_cast<AVPixelFormat>(framePtr->format));
+
if (desc && not (desc->flags & AV_PIX_FMT_FLAG_HWACCEL)) {
out = framePtr;
return out;
}
out->format = desiredFormat;
-
if (av_hwframe_transfer_data(out, framePtr, 0) < 0) {
out = framePtr;
return out;
}
out->pts = framePtr->pts;
- if (AVFrameSideData* side_data = av_frame_get_side_data(framePtr, AV_FRAME_DATA_DISPLAYMATRIX))
+ if (AVFrameSideData* side_data = av_frame_get_side_data(framePtr, AV_FRAME_DATA_DISPLAYMATRIX)) {
av_frame_new_side_data_from_buf(out, AV_FRAME_DATA_DISPLAYMATRIX, av_buffer_ref(side_data->buf));
+ }
return out;
}
\ No newline at end of file