]> git.sesse.net Git - vlc/blob - src/video_output/vout_internal.h
Moved picture_heap_t out of vlc_vout.h
[vlc] / src / video_output / vout_internal.h
1 /*****************************************************************************
2  * vout_internal.h : Internal vout definitions
3  *****************************************************************************
4  * Copyright (C) 2008 the VideoLAN team
5  * Copyright (C) 2008 Laurent Aimar
6  * $Id$
7  *
8  * Authors: Laurent Aimar < fenrir _AT_ videolan _DOT_ org >
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23  *****************************************************************************/
24
25
26 #if defined(__PLUGIN__) || defined(__BUILTIN__) || !defined(__LIBVLC__)
27 # error This header file can only be included from LibVLC.
28 #endif
29
30 #ifndef _VOUT_INTERNAL_H
31 #define _VOUT_INTERNAL_H 1
32
33 #include "vout_control.h"
34 #include "snapshot.h"
35 #include "statistic.h"
36
37 /* Number of pictures required to computes the FPS rate */
38 #define VOUT_FPS_SAMPLES                20
39
40 /* */
41 typedef struct vout_sys_t vout_sys_t;
42
43 /**
44  * Video picture heap, either render (to store pictures used
45  * by the decoder) or output (to store pictures displayed by the vout plugin)
46  */
47 typedef struct
48 {
49     int i_pictures;                                   /**< current heap size */
50
51     /* Real pictures */
52     picture_t*      pp_picture[VOUT_MAX_PICTURES];             /**< pictures */
53     int             i_last_used_pic;              /**< last used pic in heap */
54 } picture_heap_t;
55
56 /* */
57 struct vout_thread_sys_t
58 {
59     /* module */
60     char       *psz_module_name;
61
62     /* Video output configuration */
63     config_chain_t *p_cfg;
64
65     /* Place holder for the vout_wrapper code */
66     vout_sys_t      *p_sys;
67
68     /* Thread & synchronization */
69     vlc_thread_t    thread;
70     vlc_cond_t      change_wait;
71     bool            b_ready;
72     bool            b_done;
73     bool            b_error;
74
75     /* */
76     bool            b_picture_displayed;
77     bool            b_picture_empty;
78     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     uint32_t        render_time;           /**< last picture render time */
89     unsigned int    i_par_num;           /**< monitor pixel aspect-ratio */
90     unsigned int    i_par_den;           /**< monitor pixel aspect-ratio */
91
92     /**
93      * These numbers are not supposed to be accurate, but are a
94      * good indication of the thread status */
95     count_t         c_fps_samples;                         /**< picture counts */
96     mtime_t         p_fps_sample[VOUT_FPS_SAMPLES];     /**< FPS samples dates */
97
98     /* Statistics */
99     vout_statistic_t statistic;
100
101     /* Pause */
102     bool            b_paused;
103     mtime_t         i_pause_date;
104
105     /* Filter chain */
106     bool           b_first_vout;  /* True if it is the first vout of the filter chain */
107     char           *psz_filter_chain;
108     bool            b_filter_change;
109
110     /* Video filter2 chain */
111     filter_chain_t *p_vf2_chain;
112     char           *psz_vf2;
113
114     /* Snapshot interface */
115     vout_snapshot_t snapshot;
116
117     /* Show media title on videoutput */
118     bool            b_title_show;
119     mtime_t         i_title_timeout;
120     int             i_title_position;
121
122     char            *psz_title;
123
124     /* Subpicture unit */
125     spu_t          *p_spu;
126
127     /* */
128     vlc_mouse_t     mouse;
129
130     /* */
131     vlc_mutex_t         picture_lock;                 /**< picture heap lock */
132     vlc_mutex_t         change_lock;                 /**< thread change lock */
133
134     uint16_t            i_changes;          /**< changes made to the thread.
135                                                       \see \ref vout_changes */
136     unsigned            b_fullscreen:1;       /**< toogle fullscreen display */
137     unsigned            b_on_top:1; /**< stay always on top of other windows */
138
139     picture_heap_t      render;                       /**< rendered pictures */
140     picture_heap_t      output;                          /**< direct buffers */
141
142     picture_t           p_picture[2*VOUT_MAX_PICTURES+1];      /**< pictures */
143 };
144
145 #define I_OUTPUTPICTURES p_vout->p->output.i_pictures
146 #define PP_OUTPUTPICTURE p_vout->p->output.pp_picture
147 #define I_RENDERPICTURES p_vout->p->render.i_pictures
148 #define PP_RENDERPICTURE p_vout->p->render.pp_picture
149
150 /** \defgroup vout_changes Flags for changes
151  * These flags are set in the vout_thread_t::i_changes field when another
152  * thread changed a variable
153  * @{
154  */
155 /** b_autoscale changed */
156 #define VOUT_SCALE_CHANGE       0x0008
157 /** b_on_top changed */
158 #define VOUT_ON_TOP_CHANGE      0x0010
159 /** b_fullscreen changed */
160 #define VOUT_FULLSCREEN_CHANGE  0x0040
161 /** i_zoom changed */
162 #define VOUT_ZOOM_CHANGE        0x0080
163 /** cropping parameters changed */
164 #define VOUT_CROP_CHANGE        0x1000
165 /** aspect ratio changed */
166 #define VOUT_ASPECT_CHANGE      0x2000
167 /** change/recreate picture buffers */
168 #define VOUT_PICTURE_BUFFERS_CHANGE 0x4000
169 /**@}*/
170
171
172 /* */
173 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 );
174 #define vout_AllocatePicture(a,b,c,d,e,f,g) \
175         vout_AllocatePicture(VLC_OBJECT(a),b,c,d,e,f,g)
176
177 /* DO NOT use vout_RenderPicture/vout_IntfInit unless you are in src/video_ouput */
178 picture_t *vout_RenderPicture( vout_thread_t *, picture_t *,
179                                subpicture_t *,
180                                mtime_t render_date );
181 void vout_IntfInit( vout_thread_t * );
182
183 /* DO NOT use vout_UsePictureLocked unless you are in src/video_ouput
184  *
185  * This function supposes that you call it with picture_lock taken.
186  */
187 void vout_UsePictureLocked( vout_thread_t *p_vout, picture_t *p_pic  );
188
189 /* */
190 int  vout_OpenWrapper (vout_thread_t *, const char *);
191 void vout_CloseWrapper(vout_thread_t *);
192 int  vout_InitWrapper(vout_thread_t *);
193 void vout_EndWrapper(vout_thread_t *);
194 int  vout_ManageWrapper(vout_thread_t *);
195 void vout_RenderWrapper(vout_thread_t *, picture_t *);
196 void vout_DisplayWrapper(vout_thread_t *, picture_t *);
197
198 #endif
199