Skip to content

Commit a90adda

Browse files
committed
Merge branch 'amlogic-grabber-refactor' of https://github.com/santievil/HyperHDR into amlogic-grabber-refactor
2 parents caba228 + f9b2ad5 commit a90adda

File tree

12 files changed

+109
-15
lines changed

12 files changed

+109
-15
lines changed

BUILDING.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ Use -D prefix when configuring the build.
1717
* ENABLE_PIPEWIRE = ON | OFF, enables the Pipewire software grabber (Linux)
1818
* ENABLE_PIPEWIRE_EGL = ON | OFF, enables EGL for the Pipewire grabber (Linux)
1919
* ENABLE_X11 = ON | OFF, enables the X11 software grabber (Linux)
20+
* ENABLE_AMLOGIC = ON | OFF, forces the Amlogic software grabber (Linux)
2021

2122
* HARDWARE GRABBERS
2223
* ENABLE_AVF = ON | OFF, enables the AVF USB grabber support (macOS)

CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ SET ( DEFAULT_X11 OFF )
4343
SET ( DEFAULT_PIPEWIRE OFF )
4444
SET ( DEFAULT_PIPEWIRE_EGL OFF )
4545
SET ( DEFAULT_FRAMEBUFFER OFF )
46+
SET ( DEFAULT_AMLOGIC OFF )
4647
SET ( DEFAULT_SOUNDCAPWINDOWS OFF )
4748
SET ( DEFAULT_SOUNDCAPMACOS OFF )
4849
SET ( DEFAULT_CEC OFF )
@@ -431,6 +432,9 @@ colorMe("ENABLE_DX = " ${ENABLE_DX})
431432
option(ENABLE_FRAMEBUFFER "Enable the framebuffer Linux system grabber" ${DEFAULT_FRAMEBUFFER})
432433
colorMe("ENABLE_FRAMEBUFFER = " ${ENABLE_FRAMEBUFFER})
433434

435+
option(ENABLE_AMLOGIC "Enable the Amlogic grabber" ${DEFAULT_AMLOGIC})
436+
colorMe("ENABLE_AMLOGIC = " ${ENABLE_AMLOGIC})
437+
434438
option(ENABLE_MAC_SYSTEM "Enable macOS system grabber" ${DEFAULT_MAC_SYSTEM})
435439
colorMe("ENABLE_MAC_SYSTEM = " ${ENABLE_MAC_SYSTEM})
436440

HyperhdrConfig.h.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
// framebuffer linux system grabber
1919
#cmakedefine ENABLE_FRAMEBUFFER
2020

21+
// amlogic system grabber
22+
#cmakedefine ENABLE_AMLOGIC
23+
2124
// macOs system grabber
2225
#cmakedefine ENABLE_MAC_SYSTEM
2326

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#pragma once
2+
3+
#include <base/SystemWrapper.h>
4+
#include <grabber/linux/amlogic/AmlogicGrabber.h>
5+
6+
class AmlogicWrapper : public SystemWrapper
7+
{
8+
Q_OBJECT
9+
10+
public:
11+
AmlogicWrapper(const QString& device, const QString& configurationPath);
12+
bool isActivated(bool forced) override;
13+
14+
protected:
15+
QString getGrabberInfo() override;
16+
17+
18+
private:
19+
AmlogicGrabber _grabber;
20+
};

include/grabber/linux/framebuffer/FrameBufGrabber.h

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@
2020
#include <utils/Components.h>
2121

2222

23-
//AML
24-
#include <grabber/linux/amlogic/Amvideocap.h>
25-
2623

2724
class FrameBufGrabber : public Grabber
2825
{
@@ -68,16 +65,6 @@ public slots:
6865
bool init() override;
6966

7067
void uninit() override;
71-
72-
73-
//AMLOGIC
74-
bool isVideoPlayingAML();
75-
void closeDeviceAML(int& fd);
76-
bool openDeviceAML(int& fd, const char* dev);
77-
bool initAmlogic();
78-
bool stopAmlogic();
79-
bool grabFrameAmlogic();
80-
bool grabFrameFramebuffer();
8168

8269
private:
8370
QString _configurationPath;

sources/grabber/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ if (ENABLE_FRAMEBUFFER)
1010
add_subdirectory(linux/framebuffer)
1111
endif(ENABLE_FRAMEBUFFER)
1212

13+
if (ENABLE_AMLOGIC)
14+
add_subdirectory(linux/amlogic)
15+
endif(ENABLE_AMLOGIC)
16+
1317
if (ENABLE_V4L2)
1418
add_subdirectory(linux/v4l2)
1519
endif (ENABLE_V4L2)
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/* AmlogicWrapper.cpp
2+
*
3+
* MIT License
4+
*
5+
* Copyright (c) 2020-2025 awawa-dev
6+
*
7+
* Project homesite: https://github.com/awawa-dev/HyperHDR
8+
*
9+
* Permission is hereby granted, free of charge, to any person obtaining a copy
10+
* of this software and associated documentation files (the "Software"), to deal
11+
* in the Software without restriction, including without limitation the rights
12+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13+
* copies of the Software, and to permit persons to whom the Software is
14+
* furnished to do so, subject to the following conditions:
15+
*
16+
* The above copyright notice and this permission notice shall be included in all
17+
* copies or substantial portions of the Software.
18+
19+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25+
* SOFTWARE.
26+
*/
27+
28+
#include <QMetaType>
29+
#include <grabber/linux/amlogic/AmlogicWrapper.h>
30+
31+
32+
AmlogicWrapper::AmlogicWrapper(const QString &device,
33+
const QString & configurationPath )
34+
: SystemWrapper("AMLOGIC_SYSTEM:"+device.left(14), &_grabber)
35+
, _grabber(device, configurationPath)
36+
{
37+
qRegisterMetaType<Image<ColorRgb>>("Image<ColorRgb>");
38+
connect(&_grabber, &Grabber::SignalNewCapturedFrame, this, &SystemWrapper::newCapturedFrameHandler, Qt::DirectConnection);
39+
connect(&_grabber, &Grabber::SignalCapturingException, this, &SystemWrapper::capturingExceptionHandler, Qt::DirectConnection);
40+
}
41+
42+
QString AmlogicWrapper::getGrabberInfo()
43+
{
44+
return "amlogic";
45+
}
46+
47+
bool AmlogicWrapper::isActivated(bool forced)
48+
{
49+
return _grabber.isActivated();
50+
}
51+
52+

sources/grabber/linux/amlogic/IonBuffer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* more details.
1414
*
1515
*/
16-
#include "IonBuffer.h"
16+
#include <grabber/linux/amlogic/IonBuffer.h>
1717

1818
int IonBuffer::ion_fd = -1;
1919

sources/grabber/linux/framebuffer/FrameBufGrabber.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,4 +332,4 @@ void FrameBufGrabber::setCropping(unsigned cropLeft, unsigned cropRight, unsigne
332332
_cropRight = cropRight;
333333
_cropTop = cropTop;
334334
_cropBottom = cropBottom;
335-
}
335+
}

sources/hyperhdr/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,10 @@ if (ENABLE_FRAMEBUFFER)
9898
target_link_libraries(hyperhdr framebuffer-grabber "${CMAKE_DL_LIBS}")
9999
endif ()
100100

101+
if (ENABLE_AMLOGIC)
102+
target_link_libraries(hyperhdr amlogic-grabber "${CMAKE_DL_LIBS}")
103+
endif ()
104+
101105
if (ENABLE_PIPEWIRE)
102106
target_link_libraries(hyperhdr Pipewire-grabber "${CMAKE_DL_LIBS}")
103107
endif ()

0 commit comments

Comments
 (0)