aout: change rate argument
[vlc.git] / include / vlc_video_splitter.h
bloba645d58fdc1b57119925925127eb987a73f740a0
1 /*****************************************************************************
2 * vlc_video_splitter.h: "video splitter" related structures and functions
3 *****************************************************************************
4 * Copyright (C) 2009 Laurent Aimar
6 * Authors: Laurent Aimar <fenrir _AT_ videolan _DOT_ org>
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU Lesser General Public License as published by
10 * the Free Software Foundation; either version 2.1 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public License
19 * along with this program; if not, write to the Free Software Foundation,
20 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
21 *****************************************************************************/
23 #ifndef VLC_VIDEO_SPLITTER_H
24 #define VLC_VIDEO_SPLITTER_H 1
26 #include <vlc_es.h>
27 #include <vlc_picture.h>
28 #include <vlc_mouse.h>
29 #include <vlc_vout_display.h>
31 /**
32 * \file
33 * This file defines the structure and types used by video splitter filters.
36 typedef struct video_splitter_t video_splitter_t;
38 struct vout_window_mouse_event_t;
40 /** Structure describing a video splitter output properties
42 typedef struct
44 /* Video format of the output */
45 video_format_t fmt;
47 /* Window hints */
48 struct
50 /* Relative position.
51 * (0,0) is equal to the default position.
53 int i_x;
54 int i_y;
56 /* Alignment inside the window
58 vlc_video_align_t align;
59 } window;
61 /* Video output module
62 * Use NULL for default
64 char *psz_module;
66 } video_splitter_output_t;
68 /** Structure describing a video splitter
70 struct video_splitter_t
72 struct vlc_common_members obj;
74 /* Module properties */
75 module_t *p_module;
77 /* configuration */
78 config_chain_t *p_cfg;
80 /* Input format
81 * It is filled by the creator and cannot be modified.
83 video_format_t fmt;
85 /* Output formats
87 * It can only be set in the open() function and must remain
88 * constant.
89 * The module is responsible for the allocation and deallocation.
91 int i_output;
92 video_splitter_output_t *p_output;
94 int (*pf_filter)( video_splitter_t *, picture_t *pp_dst[],
95 picture_t *p_src );
96 int (*mouse)(video_splitter_t *, int idx,
97 struct vout_window_mouse_event_t *);
99 void *p_sys;
103 * It will create an array of pictures suitable as output.
105 * You must either returned them through pf_filter or by calling
106 * video_splitter_DeletePicture.
108 * If VLC_SUCCESS is not returned, pp_picture values are undefined.
110 static inline int video_splitter_NewPicture(video_splitter_t *splitter,
111 picture_t *pics[])
113 for (int i = 0; i < splitter->i_output; i++) {
114 pics[i] = picture_NewFromFormat(&splitter->p_output[i].fmt);
115 if (pics[i] == NULL) {
116 for (int j = 0; j < i; j++)
117 picture_Release(pics[j]);
119 msg_Warn(splitter, "can't get output pictures");
120 return VLC_EGENERIC;
123 return VLC_SUCCESS;
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 for (int i = 0; i < p_splitter->i_output; i++)
134 picture_Release(pp_picture[i]);
137 /* */
138 video_splitter_t * video_splitter_New( vlc_object_t *, const char *psz_name, const video_format_t * );
139 void video_splitter_Delete( video_splitter_t * );
141 static inline int video_splitter_Filter( video_splitter_t *p_splitter,
142 picture_t *pp_dst[], picture_t *p_src )
144 return p_splitter->pf_filter( p_splitter, pp_dst, p_src );
147 static inline int video_splitter_Mouse(video_splitter_t *splitter, int index,
148 struct vout_window_mouse_event_t *ev)
150 return (splitter->mouse != NULL)
151 ? splitter->mouse(splitter, index, ev) : VLC_SUCCESS;
154 #endif /* VLC_VIDEO_SPLITTER_H */