Video.h 4.94 KB
Newer Older
atraczyk's avatar
atraczyk committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156
/**************************************************************************
* Copyright (C) 2016 by Savoir-faire Linux                                *
* Author: Jäger Nicolas <nicolas.jager@savoirfairelinux.com>              *
* Author: Traczyk Andreas <andreas.traczyk@savoirfairelinux.com>          *
*                                                                         *
* This program 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.                                     *
*                                                                         *
* This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.   *
**************************************************************************/

#pragma once

using namespace Platform;

namespace RingClientUWP
{

namespace Video
{

ref class Rate;
ref class Resolution;
ref class Device;

public ref class Size sealed
{
internal:
    unsigned int                width                   ();
    unsigned int                height                  ();

    void setWidth               ( unsigned int width    );
    void setHeight              ( unsigned int height   );

public:
    Size() { };
    Size(unsigned int w, unsigned int h):
        m_Width(w),
        m_Height(h) { };
    Size(Size^ rhs):
        m_Width(rhs->m_Width),
        m_Height(rhs->m_Height) { };

private:
    unsigned int m_Width;
    unsigned int m_Height;

};

public ref class Rate sealed
{
internal:
    String^                     name            ();
    unsigned int                value           ();

    void setName                (   String^         name  );
    void setValue               (   unsigned int    value );

private:
    String^                     m_name;
    unsigned int                m_value;

};

public ref class Channel sealed
{
internal:
    String^                     name                ();
    Resolution^                 currentResolution   ();
    Vector<Resolution^>^        resolutionList      ();

    void setName                (   String^     name             );
    void setCurrentResolution   (   Resolution^ currentResolution);

public:
    Channel();

private:
    String^                     m_name;
    Resolution^                 m_currentResolution;
    Vector<Resolution^>^        m_validResolutions;

};

public ref class Resolution sealed
{
internal:
    String^                     name            ();
    Rate^                       activeRate      ();
    Vector<Rate^>^              rateList        ();
    Size^                       size            ();
    String^                     format          ();

    bool setActiveRate          (   Rate^   rate    );
    void setWidth               (   int     width   );
    void setHeight              (   int     height  );
    void setFormat              (   String^ format  );

public:
    Resolution();
    Resolution(Size^ size);

private:
    Rate^                       m_currentRate;
    Vector<Rate^>^              m_validRates;
    Size^                       m_size;
    String^                     m_format;

};

public ref class Device sealed
{
internal:
    class PreferenceNames {
    public:
        constexpr static const char* RATE    = "rate"   ;
        constexpr static const char* NAME    = "name"   ;
        constexpr static const char* CHANNEL = "channel";
        constexpr static const char* SIZE    = "size"   ;
    };

    Vector<Channel^>^           channelList     ();
    String^                     id              ();
    String^                     name            ();
    Channel^                    channel         ();

    bool setCurrentChannel      (   Channel^ channel    );
    void setName                (   String^ name        );
    

public:
    Device(String^ id);
    void SetDeviceProperties(String^ format, int width, int height, int rate);

    void save                   ();
    bool isActive               ();

private:
    String^                     m_deviceId        ;
    String^                     m_name            ;
    Channel^                    m_currentChannel  ;
    Vector<Channel^>^           m_channels        ;
    bool                        m_requireSave     ;

};

} /* namespace Video */
} /* namespace RingClientUWP */