Kstars

media.h
1/*
2 SPDX-FileCopyrightText: 2018 Jasem Mutlaq <mutlaqja@ikarustech.com>
3
4 Media Channel
5
6 SPDX-License-Identifier: GPL-2.0-or-later
7*/
8
9#pragma once
10
11#include <QtWebSockets/QWebSocket>
12#include <memory>
13
14#include "ekos/manager.h"
15#include "nodemanager.h"
16
17class FITSView;
18
19namespace EkosLive
20{
21class Media : public QObject
22{
24
25 public:
26 explicit Media(Ekos::Manager * manager, QVector<QSharedPointer<NodeManager>> &nodeManagers);
27 virtual ~Media() = default;
28
29 bool isConnected() const;
30 void sendResponse(const QString &command, const QJsonObject &payload);
31 void sendResponse(const QString &command, const QJsonArray &payload);
32
33 void registerCameras();
34
35 // Ekos Media Message to User
36 void sendFile(const QString &filename, const QString &uuid);
37 void sendData(const QSharedPointer<FITSData> &data, const QString &uuid);
38 void sendView(const QSharedPointer<FITSView> &view, const QString &uuid);
39 void sendUpdatedFrame(const QSharedPointer<FITSView> &view);
40 void sendModuleFrame(const QSharedPointer<FITSView> &view);
41
42 // Convenience functions
43 void sendDarkLibraryData(const QSharedPointer<FITSData> &data);
44
45 signals:
46 void connected();
47 void disconnected();
48
49 void newBoundingRect(QRect rect, QSize view, double currentZoom);
50 void newImage(const QByteArray &image);
51
52 public slots:
53 // Capture
54 void sendVideoFrame(const QSharedPointer<QImage> &frame);
55
56 // Correction Vector
57 void setCorrectionVector(QLineF correctionVector)
58 {
59 this->correctionVector = correctionVector;
60 }
61
62 // Polar View
63 void resetPolarView();
64
65 void processNewBLOB(IBLOB *bp);
66
67 private slots:
68 // Connection
69 void onConnected();
70 void onDisconnected();
71
72 // Communication
73 void onTextReceived(const QString &message);
74 void onBinaryReceived(const QByteArray &message);
75
76 // Metadata and Image upload
77 void uploadImage(const QByteArray &image);
78
79 private:
80 void dispatch(const QSharedPointer<FITSData> &data, const QString &uuid);
81 void upload(const QSharedPointer<FITSView> &view, const QString &uuid);
82
83 void upload(const QSharedPointer<FITSData> &data, const QImage &image, const StretchParams &params, const QString &uuid);
84 void stretch(const QSharedPointer<FITSData> &data, QImage &image, StretchParams &params) const;
85
86 Ekos::Manager * m_Manager { nullptr };
87 QVector<QSharedPointer<NodeManager>> m_NodeManagers;
88 QString extension;
89 QStringList temporaryFiles;
90 QLineF correctionVector;
91
92 bool m_sendBlobs { true};
93
94 // Image width for high-bandwidth setting
95 static const uint16_t HB_IMAGE_WIDTH = 1920;
96 // Video width for high-bandwidth setting
97 static const uint16_t HB_VIDEO_WIDTH = 1280;
98 // Image high bandwidth image quality (jpg)
99 static const uint8_t HB_IMAGE_QUALITY = 90;
100 // Video high bandwidth video quality (jpg)
101 static const uint8_t HB_VIDEO_QUALITY = 64;
102 // Image high bandwidth image quality (jpg) for PAH
103 static const uint8_t HB_PAH_IMAGE_QUALITY = 50;
104 // Video high bandwidth video quality (jpg) for PAH
105 static const uint8_t HB_PAH_VIDEO_QUALITY = 24;
106
107 // Retry every 5 seconds in case remote server is down
108 static const uint16_t RECONNECT_INTERVAL = 5000;
109 // Retry for 1 hour before giving up
110 static const uint16_t RECONNECT_MAX_TRIES = 720;
111
112 // Binary Metadata Size
113 static const uint16_t METADATA_PACKET = 512;
114
115 // HIPS Tile Width and Height
116 static const uint16_t HIPS_TILE_WIDTH = 512;
117 static const uint16_t HIPS_TILE_HEIGHT = 512;
118};
119}
Generic record interfaces and implementations.
Definition cloud.cpp:22
Q_OBJECTQ_OBJECT
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Mar 7 2025 11:55:43 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.