File indexing completed on 2025-01-05 03:52:08

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2017-09-24
0007  * Description : a media server to export collections through DLNA.
0008  *               Implementation inspired on Platinum File Media Server.
0009  *
0010  * SPDX-FileCopyrightText: 2017-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
0011  *
0012  * SPDX-License-Identifier: GPL-2.0-or-later
0013  *
0014  * ============================================================ */
0015 
0016 #ifndef DIGIKAM_DLNA_SERVER_H
0017 #define DIGIKAM_DLNA_SERVER_H
0018 
0019 // Qt includes
0020 
0021 #include <QImage>
0022 #include <QString>
0023 #include <QByteArray>
0024 
0025 // Qt includes
0026 
0027 #include <QApplication>
0028 #include <QStandardPaths>
0029 #include <QBuffer>
0030 #include <QIODevice>
0031 
0032 // Local includes
0033 
0034 #include "digikam_debug.h"
0035 #include "dmediaserver.h"
0036 #include "dlnaserverdelegate.h"
0037 
0038 // Platinum includes
0039 
0040 #include "Neptune.h"
0041 #include "PltMediaServer.h"
0042 
0043 using namespace Digikam;
0044 
0045 namespace DigikamGenericMediaServerPlugin
0046 {
0047 
0048 /**
0049  * File Media Server for digiKam.
0050  * The DLNAMediaServer class is based on PLT_MediaServer implementation
0051  * for a file system backed Media Server with album contents.
0052  */
0053 class DLNAMediaServer : public PLT_MediaServer,
0054                         public DLNAMediaServerDelegate
0055 {
0056 
0057 public:
0058 
0059     explicit DLNAMediaServer(const char*  friendly_name,
0060                              bool         show_ip = false,
0061                              const char*  uuid = nullptr,
0062                              NPT_UInt16   port = 0,
0063                              bool         port_rebind = false);
0064 
0065     void addAlbumsOnServer(const MediaServerMap& map);
0066 
0067     NPT_Result SetupIcons() override;
0068 
0069 protected:
0070 
0071     ~DLNAMediaServer()      override;
0072 
0073 private:
0074 
0075     QByteArray iconData(const QImage& img, int size, QString& uri, int& depth) const;
0076 };
0077 
0078 } // namespace DigikamGenericMediaServerPlugin
0079 
0080 #endif // DIGIKAM_DLNA_SERVER_H