1 /*****************************************************************************
2 * vlc_video_splitter.h: "video splitter" related structures and functions
3 *****************************************************************************
4 * Copyright (C) 2009 Laurent Aimar
7 * Authors: Laurent Aimar <fenrir _AT_ videolan _DOT_ org>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 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 General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, 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
28 #include <vlc_picture.h>
29 #include <vlc_mouse.h>
33 * This file defines the structure and types used by video splitter filters.
36 typedef struct video_splitter_t video_splitter_t;
37 typedef struct video_splitter_sys_t video_splitter_sys_t;
38 typedef struct video_splitter_owner_t video_splitter_owner_t;
40 /** Structure describing a video splitter output properties
44 /* Video format of the output */
51 * (0,0) is equal to the default position.
56 /* Alignment inside the window
61 /* Video output module
62 * Use NULL for default
66 } video_splitter_output_t;
68 /** Structure describing a video splitter
70 struct video_splitter_t
74 /* Module properties */
78 config_chain_t *p_cfg;
81 * It is filled by the creator and cannot be modified.
87 * It can only be set in the open() function and must remain
89 * The module is responsible for the allocation and deallocation.
92 video_splitter_output_t *p_output;
94 int (*pf_filter)( video_splitter_t *, picture_t *pp_dst[],
96 int (*pf_mouse) ( video_splitter_t *, vlc_mouse_t *,
98 const vlc_mouse_t *p_old, const vlc_mouse_t *p_new );
100 video_splitter_sys_t *p_sys;
102 /* Buffer allocation */
103 int (*pf_picture_new) ( video_splitter_t *, picture_t *pp_picture[] );
104 void (*pf_picture_del) ( video_splitter_t *, picture_t *pp_picture[] );
105 video_splitter_owner_t *p_owner;
109 * It will create an array of pictures suitable as output.
111 * You must either returned them through pf_filter or by calling
112 * video_splitter_DeletePicture.
114 * If VLC_SUCCESS is not returned, pp_picture values are undefined.
116 static inline int video_splitter_NewPicture( video_splitter_t *p_splitter,
117 picture_t *pp_picture[] )
119 int i_ret = p_splitter->pf_picture_new( p_splitter, pp_picture );
121 msg_Warn( p_splitter, "can't get output pictures" );
126 * It will release an array of pictures created by video_splitter_NewPicture.
127 * Provided for convenience.
129 static inline void video_splitter_DeletePicture( video_splitter_t *p_splitter,
130 picture_t *pp_picture[] )
132 p_splitter->pf_picture_del( p_splitter, pp_picture );
136 VLC_EXPORT( video_splitter_t *, video_splitter_New, ( vlc_object_t *, const char *psz_name, const video_format_t * ) );
137 VLC_EXPORT( void, video_splitter_Delete, ( video_splitter_t * ) );
139 static inline int video_splitter_Filter( video_splitter_t *p_splitter,
140 picture_t *pp_dst[], picture_t *p_src )
142 return p_splitter->pf_filter( p_splitter, pp_dst, p_src );
144 static inline int video_splitter_Mouse( video_splitter_t *p_splitter,
145 vlc_mouse_t *p_mouse,
147 const vlc_mouse_t *p_old, const vlc_mouse_t *p_new )
149 if( !p_splitter->pf_mouse )
154 return p_splitter->pf_mouse( p_splitter, p_mouse, i_index, p_old, p_new );
157 #endif /* VLC_VIDEO_SPLITTER_H */