access: linsys: clear some warnings
[vlc.git] / include / vlc_video_splitter.h
blob9d2a603249c46b38f5c33a3ef4d46b5a78d19c33
1 /*****************************************************************************
2 * vlc_video_splitter.h: "video splitter" related structures and functions
3 *****************************************************************************
4 * Copyright (C) 2009 Laurent Aimar
5 * $Id$
7 * Authors: Laurent Aimar <fenrir _AT_ videolan _DOT_ org>
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.
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.
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 *****************************************************************************/
24 #ifndef VLC_VIDEO_SPLITTER_H
25 #define VLC_VIDEO_SPLITTER_H 1
27 #include <vlc_es.h>
28 #include <vlc_picture.h>
29 #include <vlc_mouse.h>
30 #include <vlc_vout_display.h>
32 /**
33 * \file
34 * This file defines the structure and types used by video splitter filters.
37 typedef struct video_splitter_t video_splitter_t;
38 typedef struct video_splitter_sys_t video_splitter_sys_t;
39 typedef struct video_splitter_owner_t video_splitter_owner_t;
41 /** Structure describing a video splitter output properties
43 typedef struct
45 /* Video format of the output */
46 video_format_t fmt;
48 /* Window hints */
49 struct
51 /* Relative position.
52 * (0,0) is equal to the default position.
54 int i_x;
55 int i_y;
57 /* Alignment inside the window
59 vlc_video_align_t align;
60 } window;
62 /* Video output module
63 * Use NULL for default
65 char *psz_module;
67 } video_splitter_output_t;
69 /** Structure describing a video splitter
71 struct video_splitter_t
73 struct vlc_common_members obj;
75 /* Module properties */
76 module_t *p_module;
78 /* configuration */
79 config_chain_t *p_cfg;
81 /* Input format
82 * It is filled by the creator and cannot be modified.
84 video_format_t fmt;
86 /* Output formats
88 * It can only be set in the open() function and must remain
89 * constant.
90 * The module is responsible for the allocation and deallocation.
92 int i_output;
93 video_splitter_output_t *p_output;
95 int (*pf_filter)( video_splitter_t *, picture_t *pp_dst[],
96 picture_t *p_src );
97 int (*pf_mouse) ( video_splitter_t *, vlc_mouse_t *,
98 int i_index,
99 const vlc_mouse_t *p_old, const vlc_mouse_t *p_new );
101 video_splitter_sys_t *p_sys;
103 /* Buffer allocation */
104 int (*pf_picture_new) ( video_splitter_t *, picture_t *pp_picture[] );
105 void (*pf_picture_del) ( video_splitter_t *, picture_t *pp_picture[] );
106 video_splitter_owner_t *p_owner;
110 * It will create an array of pictures suitable as output.
112 * You must either returned them through pf_filter or by calling
113 * video_splitter_DeletePicture.
115 * If VLC_SUCCESS is not returned, pp_picture values are undefined.
117 static inline int video_splitter_NewPicture( video_splitter_t *p_splitter,
118 picture_t *pp_picture[] )
120 int i_ret = p_splitter->pf_picture_new( p_splitter, pp_picture );
121 if( i_ret )
122 msg_Warn( p_splitter, "can't get output pictures" );
123 return i_ret;
127 * It will release an array of pictures created by video_splitter_NewPicture.
128 * Provided for convenience.
130 static inline void video_splitter_DeletePicture( video_splitter_t *p_splitter,
131 picture_t *pp_picture[] )
133 p_splitter->pf_picture_del( p_splitter, pp_picture );
136 /* */
137 video_splitter_t * video_splitter_New( vlc_object_t *, const char *psz_name, const video_format_t * );
138 void video_splitter_Delete( video_splitter_t * );
140 static inline int video_splitter_Filter( video_splitter_t *p_splitter,
141 picture_t *pp_dst[], picture_t *p_src )
143 return p_splitter->pf_filter( p_splitter, pp_dst, p_src );
145 static inline int video_splitter_Mouse( video_splitter_t *p_splitter,
146 vlc_mouse_t *p_mouse,
147 int i_index,
148 const vlc_mouse_t *p_old, const vlc_mouse_t *p_new )
150 if( !p_splitter->pf_mouse )
152 *p_mouse = *p_new;
153 return VLC_SUCCESS;
155 return p_splitter->pf_mouse( p_splitter, p_mouse, i_index, p_old, p_new );
158 #endif /* VLC_VIDEO_SPLITTER_H */