forked from videolan/vlc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vlc_video_splitter.h
158 lines (135 loc) · 4.91 KB
/
vlc_video_splitter.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
/*****************************************************************************
* vlc_video_splitter.h: "video splitter" related structures and functions
*****************************************************************************
* Copyright (C) 2009 Laurent Aimar
* $Id$
*
* Authors: Laurent Aimar <fenrir _AT_ videolan _DOT_ org>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef VLC_VIDEO_SPLITTER_H
#define VLC_VIDEO_SPLITTER_H 1
#include <vlc_es.h>
#include <vlc_picture.h>
#include <vlc_mouse.h>
/**
* \file
* This file defines the structure and types used by video splitter filters.
*/
typedef struct video_splitter_t video_splitter_t;
typedef struct video_splitter_sys_t video_splitter_sys_t;
typedef struct video_splitter_owner_t video_splitter_owner_t;
/** Structure describing a video splitter output properties
*/
typedef struct
{
/* Video format of the output */
video_format_t fmt;
/* Window hints */
struct
{
/* Relative position.
* (0,0) is equal to the default position.
*/
int i_x;
int i_y;
/* Alignment inside the window
*/
int i_align;
} window;
/* Video output module
* Use NULL for default
*/
char *psz_module;
} video_splitter_output_t;
/** Structure describing a video splitter
*/
struct video_splitter_t
{
VLC_COMMON_MEMBERS
/* Module properties */
module_t *p_module;
/* configuration */
config_chain_t *p_cfg;
/* Input format
* It is filled by the creator and cannot be modified.
*/
video_format_t fmt;
/* Output formats
*
* It can only be set in the open() function and must remain
* constant.
* The module is responsible for the allocation and deallocation.
*/
int i_output;
video_splitter_output_t *p_output;
int (*pf_filter)( video_splitter_t *, picture_t *pp_dst[],
picture_t *p_src );
int (*pf_mouse) ( video_splitter_t *, vlc_mouse_t *,
int i_index,
const vlc_mouse_t *p_old, const vlc_mouse_t *p_new );
video_splitter_sys_t *p_sys;
/* Buffer allocation */
int (*pf_picture_new) ( video_splitter_t *, picture_t *pp_picture[] );
void (*pf_picture_del) ( video_splitter_t *, picture_t *pp_picture[] );
video_splitter_owner_t *p_owner;
};
/**
* It will create an array of pictures suitable as output.
*
* You must either returned them through pf_filter or by calling
* video_splitter_DeletePicture.
*
* If VLC_SUCCESS is not returned, pp_picture values are undefined.
*/
static inline int video_splitter_NewPicture( video_splitter_t *p_splitter,
picture_t *pp_picture[] )
{
int i_ret = p_splitter->pf_picture_new( p_splitter, pp_picture );
if( i_ret )
msg_Warn( p_splitter, "can't get output pictures" );
return i_ret;
}
/**
* It will release an array of pictures created by video_splitter_NewPicture.
* Provided for convenience.
*/
static inline void video_splitter_DeletePicture( video_splitter_t *p_splitter,
picture_t *pp_picture[] )
{
p_splitter->pf_picture_del( p_splitter, pp_picture );
}
/* */
VLC_API video_splitter_t * video_splitter_New( vlc_object_t *, const char *psz_name, const video_format_t * );
VLC_API void video_splitter_Delete( video_splitter_t * );
static inline int video_splitter_Filter( video_splitter_t *p_splitter,
picture_t *pp_dst[], picture_t *p_src )
{
return p_splitter->pf_filter( p_splitter, pp_dst, p_src );
}
static inline int video_splitter_Mouse( video_splitter_t *p_splitter,
vlc_mouse_t *p_mouse,
int i_index,
const vlc_mouse_t *p_old, const vlc_mouse_t *p_new )
{
if( !p_splitter->pf_mouse )
{
*p_mouse = *p_new;
return VLC_SUCCESS;
}
return p_splitter->pf_mouse( p_splitter, p_mouse, i_index, p_old, p_new );
}
#endif /* VLC_VIDEO_SPLITTER_H */