wdummy.c 2.32 KB
Newer Older
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
/**
 * @file wdummy.c
 * @brief Dummy video window provider for legacy video plugins
 */
/*****************************************************************************
 * Copyright © 2009, 2018 Rémi Denis-Courmont
 *
 * 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.
 *****************************************************************************/

#ifdef HAVE_CONFIG_H
# include <config.h>
#endif

#include <stdarg.h>

#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_vout_window.h>

static int Control(vout_window_t *wnd, int query, va_list ap)
{
    switch (query)
    {
        case VOUT_WINDOW_SET_SIZE:
        {
            unsigned width = va_arg(ap, unsigned);
            unsigned height = va_arg(ap, unsigned);

            vout_window_ReportSize(wnd, width, height);
            return VLC_SUCCESS;
        }

        case VOUT_WINDOW_SET_STATE:
        case VOUT_WINDOW_SET_FULLSCREEN:
48
        case VOUT_WINDOW_UNSET_FULLSCREEN:
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
            /* These controls deserve a proper window provider. Move along. */
            return VLC_EGENERIC;

        default:
            msg_Warn(wnd, "unsupported control query %d", query);
            return VLC_EGENERIC;
    }
}

static int Open(vout_window_t *wnd, const vout_window_cfg_t *cfg)
{
    wnd->type = VOUT_WINDOW_TYPE_DUMMY;
    wnd->control = Control;
    vout_window_ReportSize(wnd, cfg->width, cfg->height);
    return VLC_SUCCESS;
}

vlc_module_begin()
    set_shortname(N_("Dummy window"))
    set_description(N_("Dummy window"))
    set_category(CAT_VIDEO)
    set_subcategory(SUBCAT_VIDEO_VOUT)
    set_capability("vout window", 1)
    set_callbacks(Open, NULL)
73
    add_shortcut("dummy")
74
vlc_module_end()