/* $Id$ */ /* * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) * Copyright (C) 2003-2008 Benny Prijono * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __PJMEDIA_STREAM_H__ #define __PJMEDIA_STREAM_H__ /** * @file stream.h * @brief Media Stream. */ #include #include #include #include #include #include #include #include #include #include PJ_BEGIN_DECL /** * @defgroup PJMED_STRM Streams * @ingroup PJMEDIA_PORT * @brief Communicating with remote peer via the network * @{ * * A media stream is a bidirectional multimedia communication between two * endpoints. It corresponds to a media description (m= line) in SDP * session descriptor. * * A media stream consists of two unidirectional channels: * - encoding channel, which transmits unidirectional media to remote, and * - decoding channel, which receives unidirectional media from remote. * * A media stream exports media port interface (see @ref PJMEDIA_PORT) * and application normally uses this interface to interconnect the stream * to other PJMEDIA components. * * A media stream internally manages the following objects: * - an instance of media codec (see @ref PJMEDIA_CODEC), * - an @ref PJMED_JBUF, * - two instances of RTP sessions (#pjmedia_rtp_session, one for each * direction), * - one instance of RTCP session (#pjmedia_rtcp_session), * - and a reference to media transport to send and receive packets * to/from the network (see @ref PJMEDIA_TRANSPORT). * * Streams are created by calling #pjmedia_stream_create(), specifying * #pjmedia_stream_info structure in the parameter. Application can construct * the #pjmedia_stream_info structure manually, or use * #pjmedia_stream_info_from_sdp() or #pjmedia_session_info_from_sdp() * functions to construct the #pjmedia_stream_info from local and remote * SDP session descriptors. * * Application can also use @ref PJMEDIA_SESSION to indirectly create the * streams. */ /** * Opaque declaration for media channel. * Media channel is unidirectional flow of media from sender to * receiver. */ typedef struct pjmedia_channel pjmedia_channel; /** * This structure describes media stream information. Each media stream * corresponds to one "m=" line in SDP session descriptor, and it has * its own RTP/RTCP socket pair. */ typedef struct pjmedia_stream_info { pjmedia_type type; /**< Media type (audio, video) */ pjmedia_tp_proto proto; /**< Transport protocol (RTP/AVP, etc.) */ pjmedia_dir dir; /**< Media direction. */ pj_sockaddr rem_addr; /**< Remote RTP address */ pj_sockaddr rem_rtcp; /**< Optional remote RTCP address. If sin_family is zero, the RTP address will be calculated from RTP. */ pj_bool_t rtcp_mux; /**< Use RTP and RTCP multiplexing. */ #if defined(PJMEDIA_HAS_RTCP_XR) && (PJMEDIA_HAS_RTCP_XR != 0) pj_bool_t rtcp_xr_enabled; /**< Specify whether RTCP XR is enabled.*/ pj_uint32_t rtcp_xr_interval; /**< RTCP XR interval. */ pj_sockaddr rtcp_xr_dest;/**