vlc_player_options.h 3.15 KB
Newer Older
1
/*****************************************************************************
2
 * Copyright (C) 2002-2014 VideoLAN and VLC authors
3 4 5
 * $Id$
 *
 * Authors: Sergey Radionov <rsatom@gmail.com>
6
 *          Felix Paul Kühne <fkuehne # videolan.org>
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
 *****************************************************************************/

#ifndef _VLC_PLAYER_OPTIONS_H_
#define _VLC_PLAYER_OPTIONS_H_

#include <string>
27 28 29
#include <cstring>
#include <cstdio>

30
static inline bool HTMLColor2RGB(const char *htmlColor, unsigned *r, unsigned *g, unsigned *b)
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
{
    if (!htmlColor)
        return false;
    switch (strlen(htmlColor)) {
        case 4:
            if (sscanf(htmlColor, "#%1x%1x%1x", r, g, b) != 3)
                return false;
            *r *= 0x11;
            *g *= 0x11;
            *b *= 0x11;
            return true;
        case 7:
            if (sscanf(htmlColor, "#%2x%2x%2x", r, g, b) != 3)
                return false;
            return true;
        default:
            return false;
    }
}

51 52 53 54 55 56 57

enum vlc_player_option_e
{
    po_autoplay,
    po_show_toolbar,
    po_enable_fullscreen,
    po_bg_text,
58 59
    po_bg_color,
    po_enable_branding
60 61 62 63 64 65
};

class vlc_player_options
{
public:
    vlc_player_options()
66
        :_autoplay(true), _show_toolbar(true), _enable_fullscreen(true), _enable_branding(true),
67 68
        _bg_color(/*black*/"#000000")
   {}
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

    void set_autoplay(bool ap){
        _autoplay = ap;
    }
    bool get_autoplay() const
        {return _autoplay;}

    void set_show_toolbar(bool st){
        _show_toolbar = st;
    }
    bool get_show_toolbar() const
        {return _show_toolbar;}

    void set_enable_fs(bool ef){
        _enable_fullscreen = ef;
    }
    bool get_enable_fs() const
        {return _enable_fullscreen;}

    void set_bg_text(const std::string& bt){
        _bg_text = bt;
    }
    const std::string& get_bg_text() const {
        return _bg_text;
    }

    void set_bg_color(const std::string& bc){
        _bg_color = bc;
    }
    const std::string& get_bg_color() const {
        return _bg_color;
    }

102 103 104 105 106 107
    void set_enable_branding(bool st){
        _enable_branding = st;
    }
    bool get_enable_branding() const
    {return _enable_branding;}

108 109 110 111
private:
    bool         _autoplay;
    bool         _show_toolbar;
    bool         _enable_fullscreen;
112
    bool         _enable_branding;
113 114 115 116 117 118
    std::string  _bg_text;
    //background color format is "#rrggbb"
    std::string  _bg_color;
};

#endif //_VLC_PLAYER_OPTIONS_H_