Ignore:
Timestamp:
Feb 8, 2006 10:43:39 PM (18 years ago)
Author:
bennylp
Message:

Finished new pjmedia rewrite

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjmedia/include/pjmedia/session.h

    r121 r159  
    2626 */ 
    2727 
    28 #include <pj/types.h> 
    29 #include <pjmedia/mediamgr.h> 
     28#include <pjmedia/endpoint.h> 
    3029#include <pjmedia/stream.h> 
    3130#include <pjmedia/sdp.h> 
     
    3938 */ 
    4039 
    41 /** Opaque declaration of media session. */ 
    42 typedef struct pj_media_session_t pj_media_session_t; 
    43  
    44 /** Media socket info. */ 
    45 typedef struct pj_media_sock_info 
    46 { 
    47     pj_sock_t       rtp_sock, rtcp_sock; 
    48     pj_sockaddr_in  rtp_addr_name; 
    49 } pj_media_sock_info; 
    50  
    51 /** Stream info. */ 
    52 typedef struct pj_media_stream_info 
    53 { 
    54     pj_str_t            type; 
    55     pj_media_dir_t      dir; 
    56     pj_str_t            transport; 
    57     pj_media_sock_info  sock_info; 
    58     pj_str_t            rem_addr; 
    59     unsigned short      rem_port; 
    60     unsigned            fmt_cnt; 
    61     pj_codec_id         fmt[PJSDP_MAX_FMT]; 
    62  
    63 } pj_media_stream_info; 
    64  
    65 /** Flag for modifying stream. */ 
    66 enum 
    67 { 
    68     PJ_MEDIA_STREAM_MODIFY_DIR = 1, 
    69 }; 
    7040 
    7141/** 
    72  * Create new session offering. 
     42 * Create new session offering based on the local and remote SDP. 
     43 * The session initially will be inactive. 
     44 * 
     45 * @param endpt         The PJMEDIA endpoint instance. 
     46 * @param stream_cnt    Maximum number of streams to be created. This 
     47 *                      also denotes the number of elements in the 
     48 *                      socket information. 
     49 * @param skinfo        Array of socket informations. The argument stream_cnt 
     50 *                      specifies the number of elements in this array. One 
     51 *                      element is needed for each media stream to be 
     52 *                      created in the session. 
     53 * @param local_sdp     The SDP describing local capability. 
     54 * @param rem_sdp       The SDP describing remote capability. 
     55 * @param p_session     Pointer to receive the media session. 
     56 * 
     57 * @return              PJ_SUCCESS if media session can be created  
     58 *                      successfully. 
    7359 */ 
    74 PJ_DECL(pj_media_session_t*)  
    75 pj_media_session_create ( pj_med_mgr_t *mgr, const pj_media_sock_info *skinfo ); 
     60PJ_DECL(pj_status_t) pjmedia_session_create( pjmedia_endpt *endpt,  
     61                                             unsigned stream_cnt, 
     62                                             const pjmedia_sock_info skinfo[], 
     63                                             const pjmedia_sdp_session *local_sdp, 
     64                                             const pjmedia_sdp_session *rem_sdp, 
     65                                             pjmedia_session **p_session ); 
     66 
    7667 
    7768/** 
    78  * Create new session based on peer's offering. 
     69 * Activate all streams in media session for the specified direction. 
     70 * 
     71 * @param session       The media session. 
     72 * @param dir           The direction to activate. 
     73 * 
     74 * @return              PJ_SUCCESS if success. 
    7975 */ 
    80 PJ_DECL(pj_media_session_t*)  
    81 pj_media_session_create_from_sdp ( pj_med_mgr_t *mgr, const pjsdp_session_desc *sdp, 
    82                                    const pj_media_sock_info *skinfo); 
     76PJ_DECL(pj_status_t) pjmedia_session_resume(pjmedia_session *session, 
     77                                            pjmedia_dir dir); 
     78 
    8379 
    8480/** 
    85  * Duplicate session. The new session is inactive. 
     81 * Suspend receipt and transmission of all streams in media session 
     82 * for the specified direction. 
     83 * 
     84 * @param session       The media session. 
     85 * @param dir           The media direction to suspend. 
     86 * 
     87 * @return              PJ_SUCCESS if success. 
    8688 */ 
    87 PJ_DECL(pj_media_session_t*) 
    88 pj_media_session_clone (const pj_media_session_t *session); 
     89PJ_DECL(pj_status_t) pjmedia_session_pause(pjmedia_session *session, 
     90                                           pjmedia_dir dir); 
    8991 
    9092/** 
    91  * Create SDP description from the session. 
     93 * Suspend receipt and transmission of individual stream in media session 
     94 * for the specified direction. 
     95 * 
     96 * @param session       The media session. 
     97 * @param index         The stream index. 
     98 * @param dir           The media direction to pause. 
     99 * 
     100 * @return              PJ_SUCCESS on success. 
    92101 */ 
    93 PJ_DECL(pjsdp_session_desc*) 
    94 pj_media_session_create_sdp ( const pj_media_session_t *session, pj_pool_t *pool, 
    95                               pj_bool_t only_first_fmt); 
     102PJ_DECL(pj_status_t) pjmedia_session_pause_stream( pjmedia_session *session, 
     103                                                   unsigned index, 
     104                                                   pjmedia_dir dir); 
    96105 
    97106/** 
    98  * Update session with SDP answer from peer. The session must NOT active. 
     107 * Activate individual stream in media session for the specified direction. 
     108 * 
     109 * @param session       The media session. 
     110 * @param index         The stream index. 
     111 * @param dir           The media direction to activate. 
     112 * 
     113 * @return              PJ_SUCCESS on success. 
    99114 */ 
    100 PJ_DECL(pj_status_t) 
    101 pj_media_session_update ( pj_media_session_t *session,  
    102                           const pjsdp_session_desc *sdp); 
     115PJ_DECL(pj_status_t) pjmedia_session_resume_stream(pjmedia_session *session, 
     116                                                   unsigned index, 
     117                                                   pjmedia_dir dir); 
    103118 
    104119/** 
    105120 * Enumerate media streams in the session. 
    106  * @return the actual number of streams. 
     121 * 
     122 * @param session       The media session. 
     123 * @param count         On input, specifies the number of elements in 
     124 *                      the array. On output, the number will be filled 
     125 *                      with number of streams in the session. 
     126 * @param strm_info     Array of stream info. 
     127 * 
     128 * @return              PJ_SUCCESS on success. 
    107129 */ 
    108 PJ_DECL(unsigned) 
    109 pj_media_session_enum_streams (const pj_media_session_t *session,  
    110                                unsigned count, const pj_media_stream_info *info[]); 
     130PJ_DECL(pj_status_t) pjmedia_session_enum_streams(const pjmedia_session *session, 
     131                                                  unsigned *count,  
     132                                                  pjmedia_stream_info strm_info[]); 
     133 
    111134 
    112135/** 
    113  * Get stream statistics. 
     136 * Get session statistics. The stream statistic shows various 
     137 * indicators such as packet count, packet lost, jitter, delay, etc. 
     138 * 
     139 * @param session       The media session. 
     140 * @param count         On input, specifies the number of elements in 
     141 *                      the array. On output, the number will be filled 
     142 *                      with number of streams in the session. 
     143 * @param stat          Array of stream statistics. 
     144 * 
     145 * @return              PJ_SUCCESS on success. 
    114146 */ 
    115 PJ_DECL(pj_status_t) 
    116 pj_media_session_get_stat (const pj_media_session_t *session, unsigned index, 
    117                            pj_media_stream_stat *tx_stat, 
    118                            pj_media_stream_stat *rx_stat); 
     147PJ_DECL(pj_status_t) pjmedia_session_get_stat(const pjmedia_session *session, 
     148                                              unsigned *count, 
     149                                              pjmedia_stream_stat stat[]); 
    119150 
    120151/** 
    121  * Modify stream, only when stream is inactive. 
     152 * Get individual stream statistics. The stream statistic shows various 
     153 * indicators such as packet count, packet lost, jitter, delay, etc. 
     154 * 
     155 * @param s             The media session. 
     156 * @param index         The stream index. 
     157 * @param stat          Stream statistics. 
     158 * 
     159 * @return              PJ_SUCCESS on success. 
    122160 */ 
    123 PJ_DECL(pj_status_t) 
    124 pj_media_session_modify_stream (pj_media_session_t *session, unsigned index, 
    125                                 unsigned modify_flag, const pj_media_stream_info *info); 
    126  
    127 /** 
    128  * Activate all streams in media session. 
    129  */ 
    130 PJ_DECL(pj_status_t) 
    131 pj_media_session_activate (pj_media_session_t *session); 
    132  
    133 /** 
    134  * Activate individual stream in media session. 
    135  */ 
    136 PJ_DECL(pj_status_t) 
    137 pj_media_session_activate_stream (pj_media_session_t *session, unsigned index); 
     161PJ_DECL(pj_status_t) pjmedia_session_get_stream_stat(const pjmedia_session *s, 
     162                                                     unsigned index, 
     163                                                     pjmedia_stream_stat *stat); 
    138164 
    139165/** 
    140166 * Destroy media session. 
     167 * 
     168 * @param session       The media session. 
     169 * 
     170 * @return              PJ_SUCCESS if success. 
    141171 */ 
    142 PJ_DECL(pj_status_t) 
    143 pj_media_session_destroy (pj_media_session_t *session); 
     172PJ_DECL(pj_status_t) pjmedia_session_destroy(pjmedia_session *session); 
     173 
    144174 
    145175 
Note: See TracChangeset for help on using the changeset viewer.