OpenShot Library | libopenshot
0.4.0
QtUtilities.h
Go to the documentation of this file.
1
7
// Copyright (c) 2008-2025 OpenShot Studios, LLC
8
//
9
// SPDX-License-Identifier: LGPL-3.0-or-later
10
11
#ifndef OPENSHOT_QT_UTILITIES_H
12
#define OPENSHOT_QT_UTILITIES_H
13
14
#include <iostream>
15
#include <Qt>
16
#include <QTextStream>
17
#include <cstdlib>
18
19
// Fix Qt::endl for older Qt versions
20
// From: https://bugreports.qt.io/browse/QTBUG-82680
21
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
22
namespace
Qt {
23
using
TextStreamFunction = QTextStream& (*)(QTextStream&);
24
constexpr TextStreamFunction endl = ::endl;
25
}
26
#endif
27
28
29
namespace
openshot
{
30
31
// Cross-platform aligned free function
32
inline
void
aligned_free
(
void
* ptr)
33
{
34
#if defined(_WIN32)
35
_aligned_free(ptr);
36
#else
37
free(ptr);
38
#endif
39
}
40
41
// Clean up buffer after QImage is deleted
42
static
inline
void
cleanUpBuffer(
void
*info)
43
{
44
if
(!info)
45
return
;
46
47
// Free the aligned memory buffer
48
aligned_free
(info);
49
}
50
}
// namespace
51
52
#endif // OPENSHOT_QT_UTILITIES_H
openshot
This namespace is the default namespace for all code in the openshot library.
Definition:
Compressor.h:28
openshot::aligned_free
void aligned_free(void *ptr)
Definition:
QtUtilities.h:32
Generated by
1.8.17