VLC 4.0.0-dev
Loading...
Searching...
No Matches
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 *
6 * Authors: Laurent Aimar <fenrir _AT_ videolan _DOT_ org>
7 *
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.
12 *
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.
17 *
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 *****************************************************************************/
22
23#ifndef VLC_VIDEO_SPLITTER_H
24#define VLC_VIDEO_SPLITTER_H 1
25
26#include <vlc_es.h>
27#include <vlc_picture.h>
28#include <vlc_mouse.h>
29#include <vlc_vout_display.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 */
42typedef struct
44 /* Video format of the output */
47 /* Video output module
48 * Use NULL for default
49 */
50 char *psz_module;
53
54/** Structure describing a video splitter
55 */
58 struct vlc_object_t obj;
60 /* Module properties */
63 /* configuration */
66 /* Input format
67 * It is filled by the creator and cannot be modified.
68 */
71 /* Output formats
72 *
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.
76 */
77 int i_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,
84
85 void *p_sys;
86};
87
88/**
89 * It will create an array of pictures suitable as output.
90 *
91 * You must either returned them through pf_filter or by calling
92 * video_splitter_DeletePicture.
93 *
94 * If VLC_SUCCESS is not returned, pp_picture values are undefined.
95 */
96static inline int video_splitter_NewPicture(video_splitter_t *splitter,
97 picture_t *pics[])
98{
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]);
104
105 msg_Warn(splitter, "can't get output pictures");
106 return VLC_EGENERIC;
107 }
108 }
109 return VLC_SUCCESS;
110}
111
112/**
113 * It will release an array of pictures created by video_splitter_NewPicture.
114 * Provided for convenience.
115 */
116static inline void video_splitter_DeletePicture( video_splitter_t *p_splitter,
117 picture_t *pp_picture[] )
118{
119 for (int i = 0; i < p_splitter->i_output; i++)
120 picture_Release(pp_picture[i]);
121}
122
123/* */
126
127static inline int video_splitter_Filter( video_splitter_t *p_splitter,
128 picture_t *pp_dst[], picture_t *p_src )
129{
130 return p_splitter->pf_filter( p_splitter, pp_dst, p_src );
131}
132
133static inline int video_splitter_Mouse(video_splitter_t *splitter, int index,
135{
136 return (splitter->mouse != NULL)
137 ? splitter->mouse(splitter, index, ev) : VLC_SUCCESS;
138}
139
140#endif /* VLC_VIDEO_SPLITTER_H */
141
#define VLC_EGENERIC
Unspecified error.
Definition vlc_common.h:480
#define VLC_SUCCESS
No error.
Definition vlc_common.h:478
#define msg_Warn(p_this,...)
Definition vlc_messages.h:104
static void picture_Release(picture_t *picture)
Decrements the picture reference count.
Definition vlc_picture.h:374
picture_t * picture_NewFromFormat(const video_format_t *restrict fmt)
Definition picture.c:270
Definition vlc_configuration.h:320
Internal module descriptor.
Definition modules.h:76
Video picture.
Definition vlc_picture.h:130
video format description
Definition vlc_es.h:356
Structure describing a video splitter output properties.
Definition vlc_video_splitter.h:44
video_format_t fmt
Definition vlc_video_splitter.h:46
char * psz_module
Definition vlc_video_splitter.h:51
Structure describing a video splitter.
Definition vlc_video_splitter.h:58
struct vlc_object_t obj
Definition vlc_video_splitter.h:59
int(* pf_filter)(video_splitter_t *, picture_t *pp_dst[], picture_t *p_src)
Definition vlc_video_splitter.h:81
void * p_sys
Definition vlc_video_splitter.h:86
int(* mouse)(video_splitter_t *, int idx, struct vlc_window_mouse_event *)
Definition vlc_video_splitter.h:83
video_format_t fmt
Definition vlc_video_splitter.h:70
config_chain_t * p_cfg
Definition vlc_video_splitter.h:65
module_t * p_module
Definition vlc_video_splitter.h:62
int i_output
Definition vlc_video_splitter.h:78
video_splitter_output_t * p_output
Definition vlc_video_splitter.h:79
VLC object common members.
Definition vlc_objects.h:53
Window mouse event.
Definition vlc_window.h:103
const char * psz_name
Definition text_style.c:33
This file is a collection of common definitions and types.
This file defines the elementary streams format types.
This file defines picture structures and functions in vlc.
void video_splitter_Delete(video_splitter_t *)
Definition filter.c:207
video_splitter_t * video_splitter_New(vlc_object_t *, const char *psz_name, const video_format_t *)
Definition filter.c:185
static int video_splitter_NewPicture(video_splitter_t *splitter, picture_t *pics[])
It will create an array of pictures suitable as output.
Definition vlc_video_splitter.h:97
static int video_splitter_Filter(video_splitter_t *p_splitter, picture_t *pp_dst[], picture_t *p_src)
Definition vlc_video_splitter.h:128
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:117
static int video_splitter_Mouse(video_splitter_t *splitter, int index, struct vlc_window_mouse_event *ev)
Definition vlc_video_splitter.h:134
Video output display modules interface.