Skip to content

Commit

Permalink
event logger. iwyu
Browse files Browse the repository at this point in the history
  • Loading branch information
rectalogic committed Jan 1, 2024
1 parent 79cdfd0 commit 8254205
Show file tree
Hide file tree
Showing 8 changed files with 56 additions and 5 deletions.
11 changes: 10 additions & 1 deletion src/mediafx/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ qt_policy(SET QTP0001 NEW)
find_package(PkgConfig)
pkg_search_module(ffms2 REQUIRED IMPORTED_TARGET ffms2)

option(EVENT_LOGGER "Enable event logger" OFF)

qt_add_library(mediafx STATIC
session.cpp
mediafx.cpp
Expand All @@ -30,13 +32,20 @@ qt_add_library(mediafx STATIC
media.cpp
interval.h
)

target_include_directories(mediafx PUBLIC ./)
target_include_directories(mediafx PRIVATE ${FFMS2_INCLUDE_DIRS})
target_compile_options(mediafx PUBLIC ${FFMS2_CFLAGS})

qt_add_executable(mediafxtool
main.cpp
)

if(EVENT_LOGGER)
target_sources(mediafxtool PRIVATE event_logger.h)
add_compile_definitions(EVENTLOGGER)
endif()

set_property(TARGET mediafxtool PROPERTY OUTPUT_NAME mediafx)

qt_add_qml_module(mediafx
Expand All @@ -51,7 +60,7 @@ endif()

if(${Qt6WebEngineQuick_FOUND})
target_link_libraries(mediafx PUBLIC Qt6::WebEngineQuick)
add_definitions(-DWEBENGINEQUICK)
add_compile_definitions(WEBENGINEQUICK)
endif()

target_link_libraries(mediafxtool PRIVATE mediafx mediafxplugin)
Expand Down
2 changes: 0 additions & 2 deletions src/mediafx/encoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@
#include <QSize>
#include <QString>
#include <QStringLiteral>
#include <QtTypes>
#include <chrono>
#include <math.h>
#include <stdio.h>
using namespace std::chrono;

Expand Down
36 changes: 36 additions & 0 deletions src/mediafx/event_logger.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* Copyright (C) 2023 Andrew Wason
*
* This file is part of mediaFX.
*
* mediaFX 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.
*
* mediaFX 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 mediaFX.
* If not, see <https://www.gnu.org/licenses/>.
*/

#pragma once

#include <QDebug>
#include <QEvent>
#include <QObject>

class EventLogger : public QObject {
Q_OBJECT
public:
EventLogger(QObject* parent = nullptr)
: QObject(parent) {};

protected:
bool eventFilter(QObject* obj, QEvent* event) override
{
qDebug() << obj << event->type();
return false;
}
};
7 changes: 7 additions & 0 deletions src/mediafx/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
*/

#include "encoder.h"
#ifdef EVENTLOGGER
#include "event_logger.h"
#endif
#include "session.h"
#include <QCommandLineParser>
#include <QGuiApplication>
Expand Down Expand Up @@ -51,6 +54,10 @@ int main(int argc, char* argv[])

QGuiApplication app(argc, argv);

#ifdef EVENTLOGGER
app.installEventFilter(new EventLogger(&app));
#endif

app.setOrganizationDomain(qSL("mediafx.stream"));
app.setOrganizationName(qSL("mediaFX"));
app.setApplicationName(qSL("mediaFX"));
Expand Down
2 changes: 1 addition & 1 deletion src/mediafx/media.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

#pragma once

#include "media_clip.h"
#include "media_clip.h" // IWYU pragma: keep
#include <QObject>
#include <QtQmlIntegration>
class QVideoSink;
Expand Down
1 change: 1 addition & 0 deletions src/mediafx/media_clip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include <QString>
#include <QUrl>
#include <algorithm>
#include <chrono>
#include <ffms.h>

MediaClip::MediaClip(QObject* parent)
Expand Down
1 change: 1 addition & 0 deletions src/mediafx/render_control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

#include "render_control.h"
#include <QByteArray>
#include <QCoreApplication>
#include <QDebug>
#include <QMessageLogContext>
#include <QQuickRenderTarget>
Expand Down
1 change: 0 additions & 1 deletion src/mediafx/session.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

#pragma once

#include "interval.h"
#include <QEvent>
#include <QList>
#include <QObject>
Expand Down

0 comments on commit 8254205

Please sign in to comment.