Changeset 159 for pjproject/trunk/pjmedia/include/pjmedia/stream.h
- Timestamp:
- Feb 8, 2006 10:43:39 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjmedia/include/pjmedia/stream.h
r121 r159 28 28 #include <pjmedia/sound.h> 29 29 #include <pjmedia/codec.h> 30 #include <pjmedia/ mediamgr.h>30 #include <pjmedia/endpoint.h> 31 31 #include <pj/sock.h> 32 32 … … 40 40 */ 41 41 42 typedef struct pj_media_stream_t pj_media_stream_t; 42 /** 43 * Opaque declaration for media channel. 44 * Media channel is unidirectional flow of media from sender to 45 * receiver. 46 */ 47 typedef struct pjmedia_channel pjmedia_channel; 43 48 44 /** Parameter for creating channel. */ 45 typedef struct pj_media_stream_create_param 49 /** 50 * This structure describes media stream information. Each media stream 51 * corresponds to one "m=" line in SDP session descriptor, and it has 52 * its own RTP/RTCP socket pair. 53 */ 54 struct pjmedia_stream_info 46 55 { 47 /** Codec ID, must NOT be NULL. */ 48 pj_codec_id *codec_id; 56 pjmedia_type type; /**< Media type (audio, video) */ 57 pjmedia_dir dir; /**< Media direction. */ 58 pjmedia_sock_info sock_info; /**< Media transport (RTP/RTCP sockets) */ 59 pj_sockaddr_in rem_addr; /**< Remote RTP address */ 60 pjmedia_codec_info fmt; /**< Codec format info. */ 61 pj_uint32_t ssrc; /**< RTP SSRC. */ 62 int jb_min; /**< Jitter buffer min delay. */ 63 int jb_max; /**< Jitter buffer max delay. */ 64 int jb_maxcnt; /**< Jitter buffer max delay. */ 65 }; 49 66 50 /** Media manager, must NOT be NULL. */51 pj_med_mgr_t *mediamgr;52 67 53 /** Direction: IN_OUT, or IN only, or OUT only. */ 54 pj_media_dir_t dir; 68 /** 69 * Individual channel statistic. 70 */ 71 struct pjmedia_channel_stat 72 { 73 pj_uint32_t pkt; /**< Total number of packets. */ 74 pj_uint32_t bytes; /**< Total number of bytes, including RTP hdr. */ 75 pj_uint32_t lost; /**< Total number of packet lost */ 76 }; 55 77 56 /** RTP socket. */ 57 pj_sock_t rtp_sock; 78 /** 79 * Stream statistic. 80 */ 81 struct pjmedia_stream_stat 82 { 83 pjmedia_channel_stat enc; /**< Encoder statistics. */ 84 pjmedia_channel_stat dec; /**< Decoder statistics. */ 85 }; 58 86 59 /** RTCP socket. */60 pj_sock_t rtcp_sock;61 87 62 /** Address of remote */ 63 pj_sockaddr_in *remote_addr; 88 /** 89 * Create a media stream based on the specified stream parameter. 90 * All channels in the stream initially will be inactive. 91 * 92 * @param endpt Media endpoint. 93 * @param pool Pool to allocate memory for the stream. A large 94 * number of memory may be needed because jitter 95 * buffer needs to preallocate some storage. 96 * @param info Stream information. 97 * @param p_stream Pointer to receive the media stream. 98 * 99 * @return PJ_SUCCESS on success. 100 */ 101 PJ_DECL(pj_status_t) pjmedia_stream_create(pjmedia_endpt *endpt, 102 pj_pool_t *pool, 103 const pjmedia_stream_info *info, 104 pjmedia_stream **p_stream); 64 105 65 /** RTP SSRC */ 66 pj_uint32_t ssrc; 106 /** 107 * Destroy the media stream. 108 * 109 * @param stream The media stream. 110 * 111 * @return PJ_SUCCESS on success. 112 */ 113 PJ_DECL(pj_status_t) pjmedia_stream_destroy(pjmedia_stream *stream); 67 114 68 /** Jitter buffer parameters. */ 69 int jb_min, jb_max, jb_maxcnt; 115 /** 116 * Start the media stream. This will start the appropriate channels 117 * in the media stream, depending on the media direction that was set 118 * when the stream was created. 119 * 120 * @param stream The media stream. 121 * 122 * @return PJ_SUCCESS on success. 123 */ 124 PJ_DECL(pj_status_t) pjmedia_stream_start(pjmedia_stream *stream); 70 125 71 } pj_media_stream_create_param;72 126 73 typedef struct pj_media_stream_stat 74 { 75 pj_uint32_t pkt_tx, pkt_rx; /* packets transmitted/received */ 76 pj_uint32_t oct_tx, oct_rx; /* octets transmitted/received */ 77 pj_uint32_t jitter; /* receive jitter in ms */ 78 pj_uint32_t pkt_lost; /* total packet lost count */ 79 } pj_media_stream_stat; 127 /** 128 * Get the stream statistics. 129 * 130 * @param stream The media stream. 131 * @param stat Media stream statistics. 132 * 133 * @return PJ_SUCCESS on success. 134 */ 135 PJ_DECL(pj_status_t) pjmedia_stream_get_stat( const pjmedia_stream *stream, 136 pjmedia_stream_stat *stat); 80 137 81 PJ_DECL(pj_status_t) pj_media_stream_create (pj_pool_t *pool, 82 pj_media_stream_t **enc_stream, 83 pj_media_stream_t **dec_stream, 84 pj_media_stream_create_param *param); 85 PJ_DECL(pj_status_t) pj_media_stream_start (pj_media_stream_t *stream); 86 PJ_DECL(pj_status_t) pj_media_stream_get_stat (const pj_media_stream_t *stream, 87 pj_media_stream_stat *stat); 88 PJ_DECL(pj_status_t) pj_media_stream_pause (pj_media_stream_t *stream); 89 PJ_DECL(pj_status_t) pj_media_stream_resume (pj_media_stream_t *stream); 90 PJ_DECL(pj_status_t) pj_media_stream_destroy (pj_media_stream_t *stream); 138 /** 139 * Pause the individual channel in the stream. 140 * 141 * @param channel The media channel. 142 * @param dir Which direction to pause. 143 * 144 * @return PJ_SUCCESS on success. 145 */ 146 PJ_DECL(pj_status_t) pjmedia_stream_pause( pjmedia_stream *stream, 147 pjmedia_dir dir); 148 149 /** 150 * Resume the individual channel in the stream. 151 * 152 * @param channel The media channel. 153 * @param dir Which direction to resume. 154 * 155 * @return PJ_SUCCESS on success; 156 */ 157 PJ_DECL(pj_status_t) pjmedia_stream_resume(pjmedia_stream *stream, 158 pjmedia_dir dir); 159 91 160 92 161 /**
Note: See TracChangeset
for help on using the changeset viewer.