demux: adaptive: pass sequence to chunks
[vlc.git] / include / vlc_video_splitter.h
blobc57538dc7ac806b8e651b188d1c0eb62942a3041
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 /* Video output module
48 * Use NULL for default
50 char *psz_module;
52 } video_splitter_output_t;
54 /** Structure describing a video splitter
56 struct video_splitter_t
58 struct vlc_object_t obj;
60 /* Module properties */
61 module_t *p_module;
63 /* configuration */
64 config_chain_t *p_cfg;
66 /* Input format
67 * It is filled by the creator and cannot be modified.
69 video_format_t fmt;
71 /* Output formats
73 * It can only be set in the open() function and must remain
74 * constant.
75 * The module is responsible for the allocation and deallocation.
77 int i_output;
78 video_splitter_output_t *p_output;
80 int (*pf_filter)( video_splitter_t *, picture_t *pp_dst[],
81 picture_t *p_src );
82 int (*mouse)(video_splitter_t *, int idx,
83 struct vout_window_mouse_event_t *);
85 void *p_sys;
88 /**
89 * It will create an array of pictures suitable as output.
91 * You must either returned them through pf_filter or by calling
92 * video_splitter_DeletePicture.
94 * If VLC_SUCCESS is not returned, pp_picture values are undefined.
96 static inline int video_splitter_NewPicture(video_splitter_t *splitter,
97 picture_t *pics[])
99 for (int i = 0; i < splitter->i_output; i++) {
100 pics[i] = picture_NewFromFormat(&splitter->p_output[i].fmt);
101 if (pics[i] == NULL) {
102 for (int j = 0; j < i; j++)
103 picture_Release(pics[j]);
105 msg_Warn(splitter, "can't get output pictures");
106 return VLC_EGENERIC;
109 return VLC_SUCCESS;
113 * It will release an array of pictures created by video_splitter_NewPicture.
114 * Provided for convenience.
116 static inline void video_splitter_DeletePicture( video_splitter_t *p_splitter,
117 picture_t *pp_picture[] )
119 for (int i = 0; i < p_splitter->i_output; i++)
120 picture_Release(pp_picture[i]);
123 /* */
124 video_splitter_t * video_splitter_New( vlc_object_t *, const char *psz_name, const video_format_t * );
125 void video_splitter_Delete( video_splitter_t * );
127 static inline int video_splitter_Filter( video_splitter_t *p_splitter,
128 picture_t *pp_dst[], picture_t *p_src )
130 return p_splitter->pf_filter( p_splitter, pp_dst, p_src );
133 static inline int video_splitter_Mouse(video_splitter_t *splitter, int index,
134 struct vout_window_mouse_event_t *ev)
136 return (splitter->mouse != NULL)
137 ? splitter->mouse(splitter, index, ev) : VLC_SUCCESS;
140 #endif /* VLC_VIDEO_SPLITTER_H */