VLC  4.0.0-dev
vout_internal.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * vout_internal.h : Internal vout definitions
3  *****************************************************************************
4  * Copyright (C) 2008-2018 VLC authors and VideoLAN
5  * Copyright (C) 2008 Laurent Aimar
6  *
7  * Authors: Laurent Aimar < fenrir _AT_ videolan _DOT_ org >
8  *
9  * This program is free software; you can redistribute it and/or modify it
10  * under the terms of the GNU Lesser General Public License as published by
11  * the Free Software Foundation; either version 2.1 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public License
20  * along with this program; if not, write to the Free Software Foundation,
21  * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22  *****************************************************************************/
23 
24 #ifndef LIBVLC_VOUT_INTERNAL_H
25 #define LIBVLC_VOUT_INTERNAL_H 1
26 
27 #include <vlc_vout_display.h>
28 
29 typedef struct input_thread_t input_thread_t;
30 typedef struct vlc_clock_t vlc_clock_t;
31 
32 /* It should be high enough to absorbe jitter due to difficult picture(s)
33  * to decode but not too high as memory is not that cheap.
34  *
35  * It can be made lower at compilation time if needed, but performance
36  * may be degraded.
37  */
38 #define VOUT_MAX_PICTURES (20)
39 
40 /**
41  * Vout configuration
42  */
43 typedef struct {
48  void *mouse_opaque;
50 
51 /**
52  * Creates a video output.
53  */
55 
57 
58 /**
59  * Setup the vout for the given configuration and get an associated decoder device.
60  *
61  * \param vout the video configuration requested.
62  * \return pointer to a decoder device reference to use with the vout or NULL
63  */
65 
66 /**
67  * Returns a suitable vout or release the given one.
68  *
69  * If cfg->fmt is non NULL and valid, a vout will be returned, reusing cfg->vout
70  * is possible, otherwise it returns NULL.
71  * If cfg->vout is not used, it will be closed and released.
72  *
73  * You can release the returned value either by vout_Request() or vout_Close().
74  *
75  * \param cfg the video configuration requested.
76  * \param input used to get attachments for spu filters
77  * \param vctx pointer to the video context to use with the vout or NULL
78  * \retval 0 on success
79  * \retval -1 on error
80  */
82 
83 /**
84  * Disables a vout.
85  *
86  * This disables a vout, but keeps it for later reuse.
87  */
88 void vout_Stop(vout_thread_t *);
89 
90 /**
91  * Stop the display plugin, but keep its window plugin for later reuse.
92  */
94 
95 /**
96  * Set the new source format for a started vout
97  *
98  * \retval 0 on success
99  * \retval -1 on error, the vout needs to be restarted to handle the format
100  */
101 int vout_ChangeSource( vout_thread_t *p_vout, const video_format_t *fmt );
102 
105 };
106 
107 struct vout_crop {
108  enum vout_crop_mode mode;
109  union {
111  struct {
112  unsigned x;
113  unsigned y;
114  unsigned width;
115  unsigned height;
117  struct {
118  unsigned left;
119  unsigned right;
120  unsigned top;
121  unsigned bottom;
123  };
124 };
125 
126 static inline bool vout_CropEqual(const struct vout_crop *a,
127  const struct vout_crop *b)
128 {
129  if (a->mode != b->mode)
130  return false;
131 
132  switch (a->mode) {
133  case VOUT_CROP_NONE:
134  return true;
135  case VOUT_CROP_RATIO:
136  return a->ratio.num * b->ratio.den == b->ratio.num * a->ratio.den;
137  case VOUT_CROP_WINDOW:
138  return memcmp(&a->window, &b->window, sizeof (a->window)) == 0;
139  case VOUT_CROP_BORDER:
140  return memcmp(&a->border, &b->border, sizeof (a->border)) == 0;
141  default:
143  }
144 }
145 
146 bool vout_ParseCrop(struct vout_crop *, const char *crop_str);
147 bool GetAspectRatio(const char *ar_str, unsigned *num, unsigned *den);
148 
149 /* TODO to move them to vlc_vout.h */
150 void vout_ChangeFullscreen(vout_thread_t *, const char *id);
152 void vout_ChangeWindowState(vout_thread_t *, unsigned state);
153 void vout_ChangeDisplaySize(vout_thread_t *, unsigned width, unsigned height,
154  void (*ack_cb)(void *), void *opaque);
155 void vout_ChangeDisplayFilled(vout_thread_t *, bool is_filled);
156 void vout_ChangeZoom(vout_thread_t *, unsigned num, unsigned den);
157 void vout_ChangeDisplayAspectRatio(vout_thread_t *, unsigned num, unsigned den);
158 void vout_ChangeCrop(vout_thread_t *, const struct vout_crop *);
159 void vout_ControlChangeFilters(vout_thread_t *, const char *);
161 void vout_ControlChangeSubSources(vout_thread_t *, const char *);
162 void vout_ControlChangeSubFilters(vout_thread_t *, const char *);
165 
166 /* */
168 void vout_IntfInit( vout_thread_t * );
171 
172 /* */
174  vlc_clock_t *clock,
175  enum vlc_vout_order *out_order );
177 void spu_Attach( spu_t *, input_thread_t *input );
178 void spu_Detach( spu_t * );
179 void spu_SetClockDelay(spu_t *spu, size_t channel_id, vlc_tick_t delay);
180 void spu_SetClockRate(spu_t *spu, size_t channel_id, float rate);
183 
184 /**
185  * This function will (un)pause the display of pictures.
186  * It is thread safe
187  */
188 void vout_ChangePause( vout_thread_t *, bool b_paused, vlc_tick_t i_date );
189 
190 /**
191  * This function will change the rate of the vout
192  * It is thread safe
193  */
194 void vout_ChangeRate( vout_thread_t *, float rate );
195 
196 /**
197  * This function will change the delay of the vout
198  * It is thread safe
199  */
200 void vout_ChangeDelay( vout_thread_t *, vlc_tick_t delay );
201 
202 /**
203  * This function will change the rate of the spu channel
204  * It is thread safe
205  */
206 void vout_ChangeSpuRate( vout_thread_t *, size_t channel_id, float rate );
207 /**
208  * This function will change the delay of the spu channel
209  * It is thread safe
210  */
211 void vout_ChangeSpuDelay( vout_thread_t *, size_t channel_id, vlc_tick_t delay );
212 
213 
214 /**
215  * Updates the pointing device state.
216  */
217 void vout_MouseState(vout_thread_t *, const vlc_mouse_t *);
218 
219 /**
220  * This function will return and reset internal statistics.
221  */
222 void vout_GetResetStatistic( vout_thread_t *p_vout, unsigned *pi_displayed,
223  unsigned *pi_lost, unsigned *pi_late );
224 
225 /**
226  * This function will force to display the next picture while paused
227  */
228 void vout_NextPicture( vout_thread_t *p_vout, vlc_tick_t *pi_duration );
229 
230 /**
231  * This function will ask the display of the input title
232  */
233 void vout_DisplayTitle( vout_thread_t *p_vout, const char *psz_title );
234 
235 /**
236  * This function will return true if no more pictures are to be displayed.
237  */
238 bool vout_IsEmpty( vout_thread_t *p_vout );
239 
241 
242 #endif // LIBVLC_VOUT_INTERNAL_H
#define VLC_USED
Definition: fourcc_gen.c:32
#define vlc_assert_unreachable()
Impossible branch assertion.
Definition: vlc_common.h:254
vlc_vout_order
vout or spu_channel order
Definition: vlc_vout.h:71
static thread_local struct @78 state
Main structure representing an input thread.
Definition: input_internal.h:49
Subpicture unit descriptor.
Definition: vlc_spu.h:48
video format description
Definition: vlc_es.h:352
Definition: clock.c:65
Decoder context struct.
Definition: vlc_codec.h:567
Mouse state.
Definition: vlc_mouse.h:46
VLC object common members.
Definition: vlc_objects.h:45
Definition: fourcc_gen.c:34
unsigned num
Definition: fourcc_gen.c:34
unsigned den
Definition: fourcc_gen.c:34
Definition: vlc_subpicture.h:86
Definition: decoder_helpers.c:229
Viewpoints.
Definition: vlc_viewpoint.h:41
Vout configuration.
Definition: vout_internal.h:43
vout_thread_t * vout
Definition: vout_internal.h:44
vlc_mouse_event mouse_event
Definition: vout_internal.h:47
const video_format_t * fmt
Definition: vout_internal.h:46
vlc_clock_t * clock
Definition: vout_internal.h:45
Definition: vout_internal.h:107
unsigned width
Definition: vout_internal.h:114
unsigned right
Definition: vout_internal.h:119
unsigned y
Definition: vout_internal.h:113
unsigned x
Definition: vout_internal.h:112
unsigned left
Definition: vout_internal.h:118
enum vout_crop_mode mode
Definition: vout_internal.h:108
vlc_rational_t ratio
Definition: vout_internal.h:110
struct vout_crop::@124::@127 border
unsigned bottom
Definition: vout_internal.h:121
unsigned height
Definition: vout_internal.h:115
unsigned top
Definition: vout_internal.h:120
struct vout_crop::@124::@126 window
Video output thread descriptor.
Definition: vlc_vout.h:55
void(* vlc_mouse_event)(const vlc_mouse_t *mouse, void *user_data)
Mouse event callback.
Definition: vlc_mouse.h:62
int64_t vlc_tick_t
High precision date or time interval.
Definition: vlc_tick.h:45
Video output display modules interface.
ssize_t spu_RegisterChannelInternal(spu_t *, vlc_clock_t *, enum vlc_vout_order *)
Definition: vout_subpictures.c:2002
static bool vout_CropEqual(const struct vout_crop *a, const struct vout_crop *b)
Definition: vout_internal.h:126
ssize_t vout_RegisterSubpictureChannelInternal(vout_thread_t *, vlc_clock_t *clock, enum vlc_vout_order *out_order)
Definition: video_output.c:404
vout_thread_t * vout_CreateDummy(vlc_object_t *obj)
Definition: video_output.c:2005
void vout_IntfInit(vout_thread_t *)
Definition: vout_intf.c:287
int vout_ChangeSource(vout_thread_t *p_vout, const video_format_t *fmt)
Set the new source format for a started vout.
Definition: video_output.c:2105
void vout_ChangeSpuDelay(vout_thread_t *, size_t channel_id, vlc_tick_t delay)
This function will change the delay of the spu channel It is thread safe.
Definition: video_output.c:1645
void vout_ChangeSpuChannelMargin(vout_thread_t *, enum vlc_vout_order order, int)
Definition: video_output.c:711
bool vout_ParseCrop(struct vout_crop *, const char *crop_str)
void vout_DisplayTitle(vout_thread_t *p_vout, const char *psz_title)
This function will ask the display of the input title.
Definition: video_output.c:350
bool GetAspectRatio(const char *ar_str, unsigned *num, unsigned *den)
Definition: vout_intf.c:511
vlc_decoder_device * vout_GetDevice(vout_thread_t *vout)
Setup the vout for the given configuration and get an associated decoder device.
Definition: video_output.c:2236
void vout_ControlChangeSubFilters(vout_thread_t *, const char *)
Definition: video_output.c:703
void vout_CreateVars(vout_thread_t *)
Definition: vout_intf.c:154
void vout_ChangeDisplayFilled(vout_thread_t *, bool is_filled)
Definition: video_output.c:569
void vout_GetResetStatistic(vout_thread_t *p_vout, unsigned *pi_displayed, unsigned *pi_lost, unsigned *pi_late)
This function will return and reset internal statistics.
void vout_ChangePause(vout_thread_t *, bool b_paused, vlc_tick_t i_date)
This function will (un)pause the display of pictures.
Definition: video_output.c:1530
vout_crop_mode
Definition: vout_internal.h:103
@ VOUT_CROP_RATIO
Definition: vout_internal.h:104
@ VOUT_CROP_NONE
Definition: vout_internal.h:104
@ VOUT_CROP_BORDER
Definition: vout_internal.h:104
@ VOUT_CROP_WINDOW
Definition: vout_internal.h:104
void vout_ControlChangeFilters(vout_thread_t *, const char *)
Definition: video_output.c:664
void vout_ChangeZoom(vout_thread_t *, unsigned num, unsigned den)
Definition: video_output.c:586
void vout_ChangeDelay(vout_thread_t *, vlc_tick_t delay)
This function will change the delay of the vout It is thread safe.
Definition: video_output.c:1623
void vout_ChangeFullscreen(vout_thread_t *, const char *id)
Definition: video_output.c:518
void vout_ChangeViewpoint(vout_thread_t *, const vlc_viewpoint_t *)
Definition: video_output.c:720
void vout_ChangeRate(vout_thread_t *, float rate)
This function will change the rate of the vout It is thread safe.
Definition: video_output.c:1635
bool vout_IsEmpty(vout_thread_t *p_vout)
This function will return true if no more pictures are to be displayed.
Definition: video_output.c:340
void spu_ChangeChannelOrderMargin(spu_t *, enum vlc_vout_order, int)
Definition: vout_subpictures.c:2107
void vout_MouseState(vout_thread_t *, const vlc_mouse_t *)
Updates the pointing device state.
Definition: video_output.c:363
void vout_ChangeWindowed(vout_thread_t *)
Definition: video_output.c:527
void vout_ControlChangeInterlacing(vout_thread_t *, bool)
Definition: video_output.c:686
void vout_ChangeWindowState(vout_thread_t *, unsigned state)
Definition: video_output.c:538
int vout_Request(const vout_configuration_t *cfg, vlc_video_context *vctx, input_thread_t *input)
Returns a suitable vout or release the given one.
Definition: video_output.c:2170
void vout_Stop(vout_thread_t *)
Disables a vout.
Definition: video_output.c:1926
void spu_SetClockDelay(spu_t *spu, size_t channel_id, vlc_tick_t delay)
Definition: vout_subpictures.c:1752
vout_thread_t * vout_Create(vlc_object_t *obj)
Creates a video output.
Definition: video_output.c:2016
void spu_SetHighlight(spu_t *, const vlc_spu_highlight_t *)
Definition: vout_subpictures.c:2127
void spu_SetClockRate(spu_t *spu, size_t channel_id, float rate)
Definition: vout_subpictures.c:1764
void vout_IntfReinit(vout_thread_t *)
Definition: vout_intf.c:308
void vout_ControlChangeSubSources(vout_thread_t *, const char *)
Definition: video_output.c:695
void vout_NextPicture(vout_thread_t *p_vout, vlc_tick_t *pi_duration)
This function will force to display the next picture while paused.
Definition: video_output.c:1600
void spu_Attach(spu_t *, input_thread_t *input)
Attach the SPU to an input.
Definition: vout_subpictures.c:1724
void vout_IntfDeinit(vlc_object_t *)
Definition: vout_intf.c:322
void vout_ChangeDisplayAspectRatio(vout_thread_t *, unsigned num, unsigned den)
Definition: video_output.c:627
void vout_ChangeSpuRate(vout_thread_t *, size_t channel_id, float rate)
This function will change the rate of the spu channel It is thread safe.
Definition: video_output.c:1654
void spu_Detach(spu_t *)
Detach the SPU from its attached input.
Definition: vout_subpictures.c:1744
void vout_ChangeDisplaySize(vout_thread_t *, unsigned width, unsigned height, void(*ack_cb)(void *), void *opaque)
Definition: video_output.c:547
void vout_StopDisplay(vout_thread_t *)
Stop the display plugin, but keep its window plugin for later reuse.
Definition: video_output.c:1904
void vout_ChangeCrop(vout_thread_t *, const struct vout_crop *)
void vout_SetSpuHighlight(vout_thread_t *p_vout, const vlc_spu_highlight_t *)
Definition: video_output.c:434