control.h 4.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
/*****************************************************************************
 * control.h : vout internal control
 *****************************************************************************
 * Copyright (C) 2009-2010 Laurent Aimar
 * $Id$
 *
 * Authors: Laurent Aimar <fenrir _AT_ videolan _DOT_ org>
 *
 * 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 2 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, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
 *****************************************************************************/

24 25
#ifndef LIBVLC_VOUT_INTERNAL_CONTROL_H
#define LIBVLC_VOUT_INTERNAL_CONTROL_H
26 27 28 29

/* */
enum {
    VOUT_CONTROL_INIT,
30
    VOUT_CONTROL_CLEAN,
31
    VOUT_CONTROL_REINIT,                /* cfg */
32

33
#if 0
34 35 36 37
    /* */
    VOUT_CONTROL_START,
    VOUT_CONTROL_STOP,
#endif
38
    VOUT_CONTROL_SUBPICTURE,            /* subpicture */
39
    VOUT_CONTROL_FLUSH_SUBPICTURE,      /* integer */
40 41
    VOUT_CONTROL_OSD_TITLE,             /* string */
    VOUT_CONTROL_CHANGE_FILTERS,        /* string */
42
    VOUT_CONTROL_CHANGE_SUB_SOURCES,    /* string */
Laurent Aimar's avatar
Laurent Aimar committed
43
    VOUT_CONTROL_CHANGE_SUB_MARGIN,     /* integer */
44 45 46 47 48

    VOUT_CONTROL_PAUSE,
    VOUT_CONTROL_RESET,
    VOUT_CONTROL_FLUSH,                 /* time */
    VOUT_CONTROL_STEP,                  /* time_ptr */
49 50 51 52 53

    VOUT_CONTROL_FULLSCREEN,            /* bool */
    VOUT_CONTROL_ON_TOP,                /* bool */
    VOUT_CONTROL_DISPLAY_FILLED,        /* bool */
    VOUT_CONTROL_ZOOM,                  /* pair */
54 55 56 57 58

    VOUT_CONTROL_ASPECT_RATIO,          /* pair */
    VOUT_CONTROL_CROP_BORDER,           /* border */
    VOUT_CONTROL_CROP_RATIO,            /* pair */
    VOUT_CONTROL_CROP_WINDOW,           /* window */
59 60 61 62 63 64 65 66
};

typedef struct {
    int type;

    union {
        bool    boolean;
        mtime_t time;
67 68
        mtime_t *time_ptr;
        char    *string;
69
        int     integer;
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
        struct {
            int a;
            int b;
        } pair;
        struct {
            bool is_on;
            mtime_t date;
        } pause;
        struct {
            int channel;
            char *string;
        } message;
        struct {
            unsigned left;
            unsigned top;
            unsigned right;
            unsigned bottom;
        } border;
        struct {
            unsigned x;
            unsigned y;
            unsigned width;
            unsigned height;
        } window;
94
        const vout_configuration_t *cfg;
95
        subpicture_t *subpicture;
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
    } u;
} vout_control_cmd_t;

void vout_control_cmd_Init(vout_control_cmd_t *, int type);
void vout_control_cmd_Clean(vout_control_cmd_t *);

typedef struct {
    vlc_mutex_t lock;
    vlc_cond_t  wait_request;
    vlc_cond_t  wait_acknowledge;

    /* */
    bool is_dead;
    bool is_sleeping;
    bool can_sleep;
    bool is_processing;
    DECL_ARRAY(vout_control_cmd_t) cmd;
} vout_control_t;

/* */
void vout_control_Init(vout_control_t *);
void vout_control_Clean(vout_control_t *);

/* controls outside of the vout thread */
void vout_control_WaitEmpty(vout_control_t *);

void vout_control_Push(vout_control_t *, vout_control_cmd_t *);
void vout_control_PushVoid(vout_control_t *, int type);
void vout_control_PushBool(vout_control_t *, int type, bool boolean);
125
void vout_control_PushInteger(vout_control_t *, int type, int integer);
126 127 128
void vout_control_PushTime(vout_control_t *, int type, mtime_t time);
void vout_control_PushMessage(vout_control_t *, int type, int channel, const char *string);
void vout_control_PushPair(vout_control_t *, int type, int a, int b);
129
void vout_control_PushString(vout_control_t *, int type, const char *string);
130 131 132 133 134 135 136
void vout_control_Wake(vout_control_t *);

/* control inside of the vout thread */
int vout_control_Pop(vout_control_t *, vout_control_cmd_t *, mtime_t deadline, mtime_t timeout);
void vout_control_Dead(vout_control_t *);

#endif