- Timestamp:
- Jul 12, 2011 1:45:21 AM (13 years ago)
- Location:
- pjproject/branches/projects/2.0-dev/pjmedia
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/branches/projects/2.0-dev/pjmedia/build/Makefile
r3606 r3616 68 68 transport_ice.o transport_loop.o transport_srtp.o transport_udp.o \ 69 69 types.o vid_codec.o vid_codec_util.o \ 70 vid eoport.o vid_stream.o \70 vid_port.o vid_stream.o vid_tee.o \ 71 71 wav_player.o wav_playlist.o wav_writer.o wave.o \ 72 72 wsola.o -
pjproject/branches/projects/2.0-dev/pjmedia/include/pjmedia/vid_tee.h
r3614 r3616 46 46 * The video tee is not thread-safe, so it is application responsibility 47 47 * to synchronize video tee operations, e.g: make sure the source port is 48 * paused during adding or removing a destination channel.48 * paused during adding or removing a destination port. 49 49 */ 50 50 … … 60 60 * Tell the video tee that the destination port will do in-place 61 61 * processing, so the delivered data may be modified by this port. 62 * If this flag is used, buffer will be copied before being given to 63 * the destination port. 62 64 */ 63 65 PJMEDIA_VID_TEE_DST_DO_IN_PLACE_PROC = 4, … … 67 69 68 70 /** 69 * Create a video tee port with the specified source media port. 71 * Create a video tee port with the specified source media port. Application 72 * should destroy the tee with pjmedia_port_destroy() as usual. Note that 73 * destroying the tee does not destroy its destination ports. 70 74 * 71 75 * @param pool The pool. 72 * @param src The source media port.73 * @param max_ ch_cnt The maximum channel count.76 * @param fmt The source media port's format. 77 * @param max_dst_cnt The maximum number of destination ports supported. 74 78 * @param p_vid_tee Pointer to receive the video tee port. 75 79 * … … 78 82 */ 79 83 PJ_DECL(pj_status_t) pjmedia_vid_tee_create(pj_pool_t *pool, 80 pjmedia_format *fmt,81 unsigned max_ ch_cnt,84 const pjmedia_format *fmt, 85 unsigned max_dst_cnt, 82 86 pjmedia_port **p_vid_tee); 83 87 … … 86 90 * 87 91 * @param vid_tee The video tee. 88 * @param ch_option Channeloption, see @pjmedia_vid_tee_flag.92 * @param option Video tee option, see @pjmedia_vid_tee_flag. 89 93 * @param port The destination media port. 90 94 * … … 92 96 * code. 93 97 */ 94 PJ_DECL(pj_status_t) pjmedia_vid_tee_add_ channel(pjmedia_port *vid_tee,95 unsigned option,96 pjmedia_port *port);98 PJ_DECL(pj_status_t) pjmedia_vid_tee_add_dst_port(pjmedia_port *vid_tee, 99 unsigned option, 100 pjmedia_port *port); 97 101 98 102 … … 106 110 * code. 107 111 */ 108 PJ_DECL(pj_status_t) pjmedia_vid_tee_remove_ channel(pjmedia_port *vid_tee,109 pjmedia_port *port);112 PJ_DECL(pj_status_t) pjmedia_vid_tee_remove_dst_port(pjmedia_port *vid_tee, 113 pjmedia_port *port); 110 114 111 115 -
pjproject/branches/projects/2.0-dev/pjmedia/src/pjmedia/vid_tee.c
r3614 r3616 26 26 27 27 28 typedef struct vid_tee_ channel28 typedef struct vid_tee_dst_port 29 29 { 30 30 pjmedia_port *dst; 31 31 unsigned option; 32 } vid_tee_ channel;32 } vid_tee_dst_port; 33 33 34 34 … … 38 38 void *buf; 39 39 pj_size_t buf_size; 40 unsigned channel_maxcnt;41 unsigned channel_cnt;42 vid_tee_ channel *channels;40 unsigned dst_port_maxcnt; 41 unsigned dst_port_cnt; 42 vid_tee_dst_port *dst_ports; 43 43 } vid_tee_port; 44 44 … … 52 52 */ 53 53 PJ_DEF(pj_status_t) pjmedia_vid_tee_create( pj_pool_t *pool, 54 pjmedia_format *fmt,55 unsigned max_ ch_cnt,54 const pjmedia_format *fmt, 55 unsigned max_dst_cnt, 56 56 pjmedia_port **p_vid_tee) 57 57 { … … 69 69 70 70 /* Initialize video tee structure */ 71 tee->channel_maxcnt = max_ch_cnt; 72 tee->channels = (vid_tee_channel*)pj_pool_calloc(pool, max_ch_cnt, 73 sizeof(vid_tee_channel)); 71 tee->dst_port_maxcnt = max_dst_cnt; 72 tee->dst_ports = (vid_tee_dst_port*) 73 pj_pool_calloc(pool, max_dst_cnt, 74 sizeof(vid_tee_dst_port)); 74 75 75 76 /* Initialize video tee buffer, its size is one frame */ … … 110 111 * Add a destination media port to the video tee. 111 112 */ 112 PJ_DEF(pj_status_t) pjmedia_vid_tee_add_ channel(pjmedia_port *vid_tee,113 PJ_DEF(pj_status_t) pjmedia_vid_tee_add_dst_port(pjmedia_port *vid_tee, 113 114 unsigned option, 114 115 pjmedia_port *port) … … 120 121 PJ_EINVAL); 121 122 122 if (tee-> channel_cnt >= tee->channel_maxcnt)123 if (tee->dst_port_cnt >= tee->dst_port_maxcnt) 123 124 return PJ_ETOOMANY; 124 125 … … 133 134 } 134 135 135 tee-> channels[tee->channel_cnt].dst = port;136 tee-> channels[tee->channel_cnt].option = option;137 ++tee-> channel_cnt;136 tee->dst_ports[tee->dst_port_cnt].dst = port; 137 tee->dst_ports[tee->dst_port_cnt].option = option; 138 ++tee->dst_port_cnt; 138 139 139 140 return PJ_SUCCESS; … … 144 145 * Remove a destination media port from the video tee. 145 146 */ 146 PJ_DECL(pj_status_t) pjmedia_vid_tee_remove_ channel(pjmedia_port *vid_tee,147 pjmedia_port *port)147 PJ_DECL(pj_status_t) pjmedia_vid_tee_remove_dst_port(pjmedia_port *vid_tee, 148 pjmedia_port *port) 148 149 { 149 150 vid_tee_port *tee = (vid_tee_port*)vid_tee; … … 153 154 PJ_EINVAL); 154 155 155 for (i = 0; i < tee-> channel_cnt; ++i) {156 if (tee-> channels[i].dst == port) {157 pj_array_erase(tee-> channels, sizeof(tee->channels[0]),158 tee-> channel_cnt, i);159 --tee-> channel_cnt;156 for (i = 0; i < tee->dst_port_cnt; ++i) { 157 if (tee->dst_ports[i].dst == port) { 158 pj_array_erase(tee->dst_ports, sizeof(tee->dst_ports[0]), 159 tee->dst_port_cnt, i); 160 --tee->dst_port_cnt; 160 161 return PJ_SUCCESS; 161 162 } … … 171 172 unsigned i; 172 173 173 for (i = 0; i < tee-> channel_cnt; ++i) {174 for (i = 0; i < tee->dst_port_cnt; ++i) { 174 175 pjmedia_frame frame_ = *frame; 175 176 176 /* For channels that do in-place processing, we need to duplicate177 /* For dst_ports that do in-place processing, we need to duplicate 177 178 * the data source first. 178 179 */ 179 if (tee-> channels[i].option & PJMEDIA_VID_TEE_DST_DO_IN_PLACE_PROC) {180 if (tee->dst_ports[i].option & PJMEDIA_VID_TEE_DST_DO_IN_PLACE_PROC) { 180 181 PJ_ASSERT_RETURN(tee->buf_size <= frame->size, PJ_ETOOBIG); 181 182 frame_.buf = tee->buf; … … 185 186 186 187 /* Deliver the data */ 187 pjmedia_port_put_frame(tee-> channels[i].dst, &frame_);188 pjmedia_port_put_frame(tee->dst_ports[i].dst, &frame_); 188 189 } 189 190
Note: See TracChangeset
for help on using the changeset viewer.