VLC  3.0.15
vlc_video_splitter.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * vlc_video_splitter.h: "video splitter" related structures and functions
3  *****************************************************************************
4  * Copyright (C) 2009 Laurent Aimar
5  * $Id: a5afba5230b0fb5b42c5cff3daab70a1e527f9eb $
6  *
7  * Authors: Laurent Aimar <fenrir _AT_ videolan _DOT_ org>
8  *
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.
13  *
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.
18  *
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  *****************************************************************************/
23 
24 #ifndef VLC_VIDEO_SPLITTER_H
25 #define VLC_VIDEO_SPLITTER_H 1
26 
27 #include <vlc_es.h>
28 #include <vlc_picture.h>
29 #include <vlc_mouse.h>
30 
31 /**
32  * \file
33  * This file defines the structure and types used by video splitter filters.
34  */
35 
39 
40 /** Structure describing a video splitter output properties
41  */
42 typedef struct
43 {
44  /* Video format of the output */
46 
47  /* Window hints */
48  struct
49  {
50  /* Relative position.
51  * (0,0) is equal to the default position.
52  */
53  int i_x;
54  int i_y;
55 
56  /* Alignment inside the window
57  */
58  int i_align;
59  } window;
60 
61  /* Video output module
62  * Use NULL for default
63  */
64  char *psz_module;
65 
67 
68 /** Structure describing a video splitter
69  */
71 {
73 
74  /* Module properties */
76 
77  /* configuration */
79 
80  /* Input format
81  * It is filled by the creator and cannot be modified.
82  */
84 
85  /* Output formats
86  *
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.
90  */
91  int i_output;
93 
94  int (*pf_filter)( video_splitter_t *, picture_t *pp_dst[],
95  picture_t *p_src );
97  int i_index,
98  const vlc_mouse_t *p_old, const vlc_mouse_t *p_new );
99 
101 
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[] );
106 };
107 
108 /**
109  * It will create an array of pictures suitable as output.
110  *
111  * You must either returned them through pf_filter or by calling
112  * video_splitter_DeletePicture.
113  *
114  * If VLC_SUCCESS is not returned, pp_picture values are undefined.
115  */
116 static inline int video_splitter_NewPicture( video_splitter_t *p_splitter,
117  picture_t *pp_picture[] )
118 {
119  int i_ret = p_splitter->pf_picture_new( p_splitter, pp_picture );
120  if( i_ret )
121  msg_Warn( p_splitter, "can't get output pictures" );
122  return i_ret;
123 }
124 
125 /**
126  * It will release an array of pictures created by video_splitter_NewPicture.
127  * Provided for convenience.
128  */
129 static inline void video_splitter_DeletePicture( video_splitter_t *p_splitter,
130  picture_t *pp_picture[] )
131 {
132  p_splitter->pf_picture_del( p_splitter, pp_picture );
133 }
134 
135 /* */
138 
139 static inline int video_splitter_Filter( video_splitter_t *p_splitter,
140  picture_t *pp_dst[], picture_t *p_src )
141 {
142  return p_splitter->pf_filter( p_splitter, pp_dst, p_src );
143 }
144 static inline int video_splitter_Mouse( video_splitter_t *p_splitter,
145  vlc_mouse_t *p_mouse,
146  int i_index,
147  const vlc_mouse_t *p_old, const vlc_mouse_t *p_new )
148 {
149  if( !p_splitter->pf_mouse )
150  {
151  *p_mouse = *p_new;
152  return VLC_SUCCESS;
153  }
154  return p_splitter->pf_mouse( p_splitter, p_mouse, i_index, p_old, p_new );
155 }
156 
157 #endif /* VLC_VIDEO_SPLITTER_H */
158 
vlc_mouse_t
Mouse state.
Definition: vlc_mouse.h:45
video_splitter_output_t
Structure describing a video splitter output properties.
Definition: vlc_video_splitter.h:42
vlc_es.h
video_splitter_DeletePicture
static void video_splitter_DeletePicture(video_splitter_t *p_splitter, picture_t *pp_picture[])
It will release an array of pictures created by video_splitter_NewPicture.
Definition: vlc_video_splitter.h:129
video_splitter_output_t::i_x
int i_x
Definition: vlc_video_splitter.h:53
VLC_COMMON_MEMBERS
#define VLC_COMMON_MEMBERS
Backward compatibility macro.
Definition: vlc_common.h:453
video_splitter_t::p_cfg
config_chain_t * p_cfg
Definition: vlc_video_splitter.h:78
video_splitter_t::p_output
video_splitter_output_t * p_output
Definition: vlc_video_splitter.h:92
vlc_common.h
video_splitter_NewPicture
static int video_splitter_NewPicture(video_splitter_t *p_splitter, picture_t *pp_picture[])
It will create an array of pictures suitable as output.
Definition: vlc_video_splitter.h:116
video_splitter_t::pf_filter
int(* pf_filter)(video_splitter_t *, picture_t *pp_dst[], picture_t *p_src)
Definition: vlc_video_splitter.h:94
video_splitter_t::fmt
video_format_t fmt
Definition: vlc_video_splitter.h:83
video_format_t
video format description
Definition: vlc_es.h:325
video_splitter_t::p_owner
video_splitter_owner_t * p_owner
Definition: vlc_video_splitter.h:105
video_splitter_t::p_sys
video_splitter_sys_t * p_sys
Definition: vlc_video_splitter.h:100
video_splitter_output_t::fmt
video_format_t fmt
Definition: vlc_video_splitter.h:45
video_splitter_t::pf_mouse
int(* pf_mouse)(video_splitter_t *, vlc_mouse_t *, int i_index, const vlc_mouse_t *p_old, const vlc_mouse_t *p_new)
Definition: vlc_video_splitter.h:96
picture_t
Video picture.
Definition: vlc_picture.h:68
msg_Warn
#define msg_Warn(p_this,...)
Definition: vlc_messages.h:84
video_splitter_t::pf_picture_new
int(* pf_picture_new)(video_splitter_t *, picture_t *pp_picture[])
Definition: vlc_video_splitter.h:103
config_chain_t
Definition: vlc_configuration.h:155
module_t
Internal module descriptor.
Definition: modules.h:79
video_splitter_Mouse
static 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)
Definition: vlc_video_splitter.h:144
video_splitter_output_t::i_y
int i_y
Definition: vlc_video_splitter.h:54
psz_name
const char * psz_name
Definition: vlc_codecs.h:315
video_splitter_sys_t
struct video_splitter_sys_t video_splitter_sys_t
Definition: vlc_video_splitter.h:37
video_splitter_output_t::i_align
int i_align
Definition: vlc_video_splitter.h:58
video_splitter_t::pf_picture_del
void(* pf_picture_del)(video_splitter_t *, picture_t *pp_picture[])
Definition: vlc_video_splitter.h:104
video_splitter_t
Structure describing a video splitter.
Definition: vlc_video_splitter.h:70
video_splitter_owner_t
Definition: display.c:1267
vlc_mouse.h
video_splitter_Filter
static int video_splitter_Filter(video_splitter_t *p_splitter, picture_t *pp_dst[], picture_t *p_src)
Definition: vlc_video_splitter.h:139
vlc_object_t
The main vlc_object_t structure.
Definition: vlc_objects.h:39
VLC_SUCCESS
#define VLC_SUCCESS
No error.
Definition: vlc_common.h:349
vlc_picture.h
video_splitter_New
video_splitter_t * video_splitter_New(vlc_object_t *, const char *psz_name, const video_format_t *)
Definition: filter.c:189
video_splitter_t::p_module
module_t * p_module
Definition: vlc_video_splitter.h:75
video_splitter_output_t::psz_module
char * psz_module
Definition: vlc_video_splitter.h:64
video_splitter_Delete
void video_splitter_Delete(video_splitter_t *)
Definition: filter.c:211
video_splitter_t::i_output
int i_output
Definition: vlc_video_splitter.h:91