vout_internal.h 6.6 KB
Newer Older
Laurent Aimar's avatar
Laurent Aimar 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
/*****************************************************************************
 * vout_internal.h : Internal vout definitions
 *****************************************************************************
 * Copyright (C) 2008 the VideoLAN team
 * Copyright (C) 2008 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.
 *****************************************************************************/


#if defined(__PLUGIN__) || defined(__BUILTIN__) || !defined(__LIBVLC__)
# error This header file can only be included from LibVLC.
#endif

#ifndef _VOUT_INTERNAL_H
#define _VOUT_INTERNAL_H 1

33
#include "vout_control.h"
34
#include "snapshot.h"
35
#include "statistic.h"
36

37 38 39
/* Number of pictures required to computes the FPS rate */
#define VOUT_FPS_SAMPLES                20

40 41 42
/* */
typedef struct vout_sys_t vout_sys_t;

43 44 45 46 47 48 49 50 51 52 53 54 55
/**
 * Video picture heap, either render (to store pictures used
 * by the decoder) or output (to store pictures displayed by the vout plugin)
 */
typedef struct
{
    int i_pictures;                                   /**< current heap size */

    /* Real pictures */
    picture_t*      pp_picture[VOUT_MAX_PICTURES];             /**< pictures */
    int             i_last_used_pic;              /**< last used pic in heap */
} picture_heap_t;

56
/* */
57 58
struct vout_thread_sys_t
{
59 60 61
    /* module */
    char       *psz_module_name;

62 63 64 65 66 67
    /* Video output configuration */
    config_chain_t *p_cfg;

    /* Place holder for the vout_wrapper code */
    vout_sys_t      *p_sys;

68 69 70 71 72
    /* Thread & synchronization */
    vlc_thread_t    thread;
    vlc_cond_t      change_wait;
    bool            b_ready;
    bool            b_done;
73
    bool            b_error;
74

75
    /* */
76 77 78
    bool            b_picture_displayed;
    bool            b_picture_empty;
    mtime_t         i_picture_displayed_date;
79
    picture_t       *p_picture_displayed;
80
    int             i_picture_qtype;
81
    bool            b_picture_interlaced;
82
    vlc_cond_t      picture_wait;
83 84

    /* */
85
    vlc_mutex_t     vfilter_lock;         /**< video filter2 lock */
86 87

    /* */
88 89 90 91
    uint32_t        render_time;           /**< last picture render time */
    unsigned int    i_par_num;           /**< monitor pixel aspect-ratio */
    unsigned int    i_par_den;           /**< monitor pixel aspect-ratio */

92 93 94
    /**
     * These numbers are not supposed to be accurate, but are a
     * good indication of the thread status */
95 96
    count_t         c_fps_samples;                         /**< picture counts */
    mtime_t         p_fps_sample[VOUT_FPS_SAMPLES];     /**< FPS samples dates */
97 98

    /* Statistics */
99
    vout_statistic_t statistic;
100

Laurent Aimar's avatar
Laurent Aimar committed
101 102 103 104
    /* Pause */
    bool            b_paused;
    mtime_t         i_pause_date;

105
    /* Filter chain */
106
    bool           b_first_vout;  /* True if it is the first vout of the filter chain */
107 108 109 110 111 112 113
    char           *psz_filter_chain;
    bool            b_filter_change;

    /* Video filter2 chain */
    filter_chain_t *p_vf2_chain;
    char           *psz_vf2;

114
    /* Snapshot interface */
115
    vout_snapshot_t snapshot;
116 117 118 119 120

    /* Show media title on videoutput */
    bool            b_title_show;
    mtime_t         i_title_timeout;
    int             i_title_position;
121 122

    char            *psz_title;
123

124 125 126
    /* Subpicture unit */
    spu_t          *p_spu;

127 128
    /* */
    vlc_mouse_t     mouse;
129 130 131 132 133 134 135 136 137 138 139 140 141 142

    /* */
    vlc_mutex_t         picture_lock;                 /**< picture heap lock */
    vlc_mutex_t         change_lock;                 /**< thread change lock */

    uint16_t            i_changes;          /**< changes made to the thread.
                                                      \see \ref vout_changes */
    unsigned            b_fullscreen:1;       /**< toogle fullscreen display */
    unsigned            b_on_top:1; /**< stay always on top of other windows */

    picture_heap_t      render;                       /**< rendered pictures */
    picture_heap_t      output;                          /**< direct buffers */

    picture_t           p_picture[2*VOUT_MAX_PICTURES+1];      /**< pictures */
143 144
};

145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171
#define I_OUTPUTPICTURES p_vout->p->output.i_pictures
#define PP_OUTPUTPICTURE p_vout->p->output.pp_picture
#define I_RENDERPICTURES p_vout->p->render.i_pictures
#define PP_RENDERPICTURE p_vout->p->render.pp_picture

/** \defgroup vout_changes Flags for changes
 * These flags are set in the vout_thread_t::i_changes field when another
 * thread changed a variable
 * @{
 */
/** b_autoscale changed */
#define VOUT_SCALE_CHANGE       0x0008
/** b_on_top changed */
#define VOUT_ON_TOP_CHANGE      0x0010
/** b_fullscreen changed */
#define VOUT_FULLSCREEN_CHANGE  0x0040
/** i_zoom changed */
#define VOUT_ZOOM_CHANGE        0x0080
/** cropping parameters changed */
#define VOUT_CROP_CHANGE        0x1000
/** aspect ratio changed */
#define VOUT_ASPECT_CHANGE      0x2000
/** change/recreate picture buffers */
#define VOUT_PICTURE_BUFFERS_CHANGE 0x4000
/**@}*/


172 173 174 175 176
/* */
int vout_AllocatePicture( vlc_object_t *, picture_t *, uint32_t i_chroma, int i_width, int i_height, int i_sar_num, int i_sar_den );
#define vout_AllocatePicture(a,b,c,d,e,f,g) \
        vout_AllocatePicture(VLC_OBJECT(a),b,c,d,e,f,g)

177
/* DO NOT use vout_RenderPicture/vout_IntfInit unless you are in src/video_ouput */
Laurent Aimar's avatar
Laurent Aimar committed
178
picture_t *vout_RenderPicture( vout_thread_t *, picture_t *,
179 180
                               subpicture_t *,
                               mtime_t render_date );
181
void vout_IntfInit( vout_thread_t * );
Laurent Aimar's avatar
Laurent Aimar committed
182

183 184 185 186 187 188
/* DO NOT use vout_UsePictureLocked unless you are in src/video_ouput
 *
 * This function supposes that you call it with picture_lock taken.
 */
void vout_UsePictureLocked( vout_thread_t *p_vout, picture_t *p_pic  );

189 190 191
/* */
int  vout_OpenWrapper (vout_thread_t *, const char *);
void vout_CloseWrapper(vout_thread_t *);
192 193 194 195 196
int  vout_InitWrapper(vout_thread_t *);
void vout_EndWrapper(vout_thread_t *);
int  vout_ManageWrapper(vout_thread_t *);
void vout_RenderWrapper(vout_thread_t *, picture_t *);
void vout_DisplayWrapper(vout_thread_t *, picture_t *);
197

Laurent Aimar's avatar
Laurent Aimar committed
198 199
#endif