1
/* $Id: vid_tee.h 3664 2011-07-19 03:42:28Z nanang $ */
3
* Copyright (C) 2011 Teluu Inc. (http://www.teluu.com)
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation; either version 2 of the License, or
8
* (at your option) any later version.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
#ifndef __PJMEDIA_VID_TEE_H__
20
#define __PJMEDIA_VID_TEE_H__
24
* @brief Video tee (source duplicator).
26
#include <pjmedia/port.h>
29
* @addtogroup PJMEDIA_VID_TEE Video source duplicator
30
* @ingroup PJMEDIA_PORT
31
* @brief Duplicate video data from a media port into multiple media port
35
* This section describes media port to duplicate video data in the stream.
37
* A video tee branches video stream flow from one source port to multiple
38
* destination ports by simply duplicating the video data supplied by the
39
* source port and delivering the copy to all registered destinations.
41
* The video tee is a unidirectional port, i.e: data flows from source port
42
* to destination ports only. Also, the video source port MUST actively call
43
* pjmedia_port_put_frame() to the video tee and the video destination ports
44
* MUST NEVER call pjmedia_port_get_frame() to the video tee. Please note that
45
* there is no specific order of which destination port will receive a frame
48
* The video tee is not thread-safe, so it is application responsibility
49
* to synchronize video tee operations, e.g: make sure the source port is
50
* paused during adding or removing a destination port.
57
* Enumeration of video tee flags.
59
typedef enum pjmedia_vid_tee_flag
62
* Tell the video tee that the destination port will do in-place
63
* processing, so the delivered data may be modified by this port.
64
* If this flag is used, buffer will be copied before being given to
65
* the destination port.
67
PJMEDIA_VID_TEE_DST_DO_IN_PLACE_PROC = 4,
69
} pjmedia_vid_tee_flag;
73
* Create a video tee port with the specified source media port. Application
74
* should destroy the tee with pjmedia_port_destroy() as usual. Note that
75
* destroying the tee does not destroy its destination ports.
77
* @param pool The pool.
78
* @param fmt The source media port's format.
79
* @param max_dst_cnt The maximum number of destination ports supported.
80
* @param p_vid_tee Pointer to receive the video tee port.
82
* @return PJ_SUCCESS on success, or the appropriate
85
PJ_DECL(pj_status_t) pjmedia_vid_tee_create(pj_pool_t *pool,
86
const pjmedia_format *fmt,
88
pjmedia_port **p_vid_tee);
91
* Add a destination media port to the video tee. For this function, the
92
* destination port's media format must match the source format.
94
* @param vid_tee The video tee.
95
* @param option Video tee option, see @pjmedia_vid_tee_flag.
96
* @param port The destination media port.
98
* @return PJ_SUCCESS on success, or the appropriate error
101
PJ_DECL(pj_status_t) pjmedia_vid_tee_add_dst_port(pjmedia_port *vid_tee,
107
* Add a destination media port to the video tee. This function will also
108
* create a converter if the destination port's media format does not match
111
* @param vid_tee The video tee.
112
* @param option Video tee option, see @pjmedia_vid_tee_flag.
113
* @param port The destination media port.
115
* @return PJ_SUCCESS on success, or the appropriate error
118
PJ_DECL(pj_status_t) pjmedia_vid_tee_add_dst_port2(pjmedia_port *vid_tee,
124
* Remove a destination media port from the video tee.
126
* @param vid_tee The video tee.
127
* @param port The destination media port to be removed.
129
* @return PJ_SUCCESS on success, or the appropriate error
132
PJ_DECL(pj_status_t) pjmedia_vid_tee_remove_dst_port(pjmedia_port *vid_tee,
142
#endif /* __PJMEDIA_VID_TEE_H__ */