Ignore:
Timestamp:
Jul 19, 2011 3:42:28 AM (13 years ago)
Author:
nanang
Message:

Re #1326: Initial code integration from branch 2.0-dev to trunk as "2.0-pre-alpha-svn".

Location:
pjproject/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk

  • pjproject/trunk/pjsip/include/pjsua-lib/pjsua_internal.h

    r3553 r3664  
    4040 
    4141    /** Running (media_start() has been called) */ 
    42     PJSUA_MED_TP_RUNNING 
     42    PJSUA_MED_TP_RUNNING, 
     43 
     44    /** Disabled (transport is initialized, but media is being disabled) */ 
     45    PJSUA_MED_TP_DISABLED 
    4346 
    4447} pjsua_med_tp_st; 
     48 
     49/** Forward decl of pjsua call */ 
     50typedef struct pjsua_call pjsua_call; 
     51 
     52 
     53/** 
     54 * Call's media stream. 
     55 */ 
     56typedef struct pjsua_call_media 
     57{ 
     58    pjsua_call          *call;      /**< Parent call.                       */ 
     59    pjmedia_type         type;      /**< Media type.                        */ 
     60    unsigned             idx;       /**< This media index in parent call.   */ 
     61    pjsua_call_media_status state;  /**< Media state.                       */ 
     62    pjmedia_dir          dir;       /**< Media direction.                   */ 
     63 
     64    /** The stream */ 
     65    struct { 
     66        /** Audio stream */ 
     67        struct { 
     68            pjmedia_stream *stream;    /**< The audio stream.               */ 
     69            int             conf_slot; /**< Slot # in conference bridge.    */ 
     70        } a; 
     71 
     72        /** Video stream */ 
     73        struct { 
     74            pjmedia_vid_stream  *stream;    /**< The video stream.          */ 
     75            pjsua_vid_win_id     cap_win_id;/**< The video capture window   */ 
     76            pjsua_vid_win_id     rdr_win_id;/**< The video render window    */ 
     77            pjmedia_vid_dev_index cap_dev;  /**< The video capture device   */ 
     78            pjmedia_vid_dev_index rdr_dev;  /**< The video-in render device */ 
     79        } v; 
     80 
     81    } strm; 
     82 
     83    pj_uint32_t          ssrc;      /**< RTP SSRC                           */ 
     84    pj_uint32_t          rtp_tx_ts; /**< Initial RTP timestamp for sender.  */ 
     85    pj_uint16_t          rtp_tx_seq;/**< Initial RTP sequence for sender.   */ 
     86    pj_uint8_t           rtp_tx_seq_ts_set; 
     87                                    /**< Bitmask flags if initial RTP sequence 
     88                                         and/or timestamp for sender are set. 
     89                                         bit 0/LSB : sequence flag 
     90                                         bit 1     : timestamp flag         */ 
     91 
     92    pjmedia_transport   *tp;        /**< Current media transport (can be 0) */ 
     93    pj_status_t          tp_ready;  /**< Media transport status.            */ 
     94    pjmedia_transport   *tp_orig;   /**< Original media transport           */ 
     95    pj_bool_t            tp_auto_del; /**< May delete media transport   */ 
     96    pjsua_med_tp_st      tp_st;     /**< Media transport state              */ 
     97    pj_sockaddr          rtp_addr;  /**< Current RTP source address 
     98                                            (used to update ICE default 
     99                                            address)                        */ 
     100    pjmedia_srtp_use     rem_srtp_use; /**< Remote's SRTP usage policy.     */ 
     101 
     102    pjmedia_event_subscription esub_rend;/**< Subscribe renderer events.     */ 
     103    pjmedia_event_subscription esub_cap;/**< Subscribe capture events.      */ 
     104} pjsua_call_media; 
     105 
     106/** 
     107 * Maximum number of SDP "m=" lines to be supported. 
     108 */ 
     109#define PJSUA_MAX_CALL_MEDIA            PJMEDIA_MAX_SDP_MEDIA 
    45110 
    46111/**  
     
    49114 * by accessing dlg->mod_data[pjsua.mod.id]. 
    50115 */ 
    51 typedef struct pjsua_call 
     116struct pjsua_call 
    52117{ 
    53118    unsigned             index;     /**< Index in pjsua array.              */ 
     
    64129    pjsua_call_hold_type call_hold_type; /**< How to do call hold.          */ 
    65130    pj_bool_t            local_hold;/**< Flag for call-hold by local.       */ 
    66     pjsua_call_media_status media_st;/**< Media state.                      */ 
    67     pjmedia_dir          media_dir; /**< Media direction.                   */ 
    68     pjmedia_session     *session;   /**< The media session.                 */ 
    69     int                  audio_idx; /**< Index of m=audio in SDP.           */ 
    70     pj_uint32_t          ssrc;      /**< RTP SSRC                           */ 
    71     pj_uint32_t          rtp_tx_ts; /**< Initial RTP timestamp for sender.  */ 
    72     pj_uint16_t          rtp_tx_seq;/**< Initial RTP sequence for sender.   */ 
    73     pj_uint8_t           rtp_tx_seq_ts_set; 
    74                                     /**< Bitmask flags if initial RTP sequence 
    75                                          and/or timestamp for sender are set. 
    76                                          bit 0/LSB : sequence flag  
    77                                          bit 1     : timestamp flag         */ 
    78     int                  conf_slot; /**< Slot # in conference bridge.       */ 
     131 
     132    unsigned             med_cnt;   /**< Number of media in SDP.            */ 
     133    pjsua_call_media     media[PJSUA_MAX_CALL_MEDIA]; /**< Array of media   */ 
     134    int                  audio_idx; /**< First active audio media.          */ 
     135 
    79136    pjsip_evsub         *xfer_sub;  /**< Xfer server subscription, if this 
    80137                                         call was triggered by xfer.        */ 
    81     pjmedia_transport   *med_tp;    /**< Current media transport.           */ 
    82     pj_status_t          med_tp_ready;/**< Media transport status.          */ 
    83     pjmedia_transport   *med_orig;  /**< Original media transport           */ 
    84     pj_bool_t            med_tp_auto_del; /**< May delete media transport   */ 
    85     pjsua_med_tp_st      med_tp_st; /**< Media transport state              */ 
    86     pj_sockaddr          med_rtp_addr; /**< Current RTP source address 
    87                                             (used to update ICE default 
    88                                             address)                        */ 
    89138    pj_stun_nat_type     rem_nat_type; /**< NAT type of remote endpoint.    */ 
    90     pjmedia_srtp_use     rem_srtp_use; /**< Remote's SRTP usage policy.     */ 
    91139 
    92140    char    last_text_buf_[128];    /**< Buffer for last_text.              */ 
     
    100148                                          contains multiple codecs.         */ 
    101149 
    102 } pjsua_call; 
     150}; 
    103151 
    104152 
     
    260308} pjsua_stun_resolve; 
    261309 
     310typedef enum pjsua_vid_win_type 
     311{ 
     312    PJSUA_WND_TYPE_NONE, 
     313    PJSUA_WND_TYPE_PREVIEW, 
     314    PJSUA_WND_TYPE_STREAM 
     315} pjsua_vid_win_type; 
     316 
     317typedef struct pjsua_vid_win 
     318{ 
     319    pjsua_vid_win_type           type;          /**< Type.              */ 
     320    pj_pool_t                   *pool;          /**< Own pool.          */ 
     321    unsigned                     ref_cnt;       /**< Reference counter. */ 
     322    pjmedia_vid_port            *vp_cap;        /**< Capture vidport.   */ 
     323    pjmedia_vid_port            *vp_rend;       /**< Renderer vidport   */ 
     324    pjmedia_port                *tee;           /**< Video tee          */ 
     325    pjmedia_vid_dev_index        preview_cap_id;/* Capture dev id       */ 
     326} pjsua_vid_win; 
    262327 
    263328/** 
     
    271336    pj_pool_t           *pool;      /**< pjsua's private pool.          */ 
    272337    pj_mutex_t          *mutex;     /**< Mutex protection for this data */ 
     338    pjsua_state          state;     /**< Library state.                 */ 
    273339 
    274340    /* Logging: */ 
     
    340406    pjmedia_master_port *null_snd;  /**< Master port for null sound.    */ 
    341407    pjmedia_port        *null_port; /**< Null port.                     */ 
    342  
     408    pj_bool_t            snd_is_on; /**< Media flow is currently active */ 
     409 
     410    /* Video device */ 
     411    pjmedia_vid_dev_index vcap_dev;  /**< Capture device ID.            */ 
     412    pjmedia_vid_dev_index vrdr_dev;  /**< Playback device ID.           */ 
    343413 
    344414    /* File players: */ 
     
    349419    unsigned             rec_cnt;   /**< Number of file recorders.      */ 
    350420    pjsua_file_data      recorder[PJSUA_MAX_RECORDERS];/**< Array of recs.*/ 
     421 
     422    /* Video windows */ 
     423#if PJSUA_HAS_VIDEO 
     424    pjsua_vid_win        win[PJSUA_MAX_VID_WINS]; /**< Array of windows */ 
     425#endif 
    351426}; 
    352427 
     
    402477#define PJSUA_UNLOCK() 
    403478#endif 
     479 
     480/* Core */ 
     481void pjsua_set_state(pjsua_state new_state); 
    404482 
    405483/****** 
     
    439517pj_status_t pjsua_media_channel_deinit(pjsua_call_id call_id); 
    440518 
     519pj_status_t pjsua_call_media_init(pjsua_call_media *call_med, 
     520                                  pjmedia_type type, 
     521                                  const pjsua_transport_config *tcfg, 
     522                                  int security_level, 
     523                                  int *sip_err_code); 
     524pj_status_t video_channel_update(pjsua_call_media *call_med, 
     525                                 pj_pool_t *tmp_pool, 
     526                                 const pjmedia_sdp_session *local_sdp, 
     527                                 const pjmedia_sdp_session *remote_sdp); 
     528void stop_video_stream(pjsua_call_media *call_med); 
     529 
    441530 
    442531/** 
     
    580669                char *buf, pj_size_t size); 
    581670 
     671/* 
     672 * Video 
     673 */ 
     674pj_status_t pjsua_vid_subsys_init(void); 
     675pj_status_t pjsua_vid_subsys_start(void); 
     676pj_status_t pjsua_vid_subsys_destroy(void); 
     677 
     678PJ_INLINE(void) pjsua_vid_win_reset(pjsua_vid_win_id wid) 
     679{ 
     680#if PJSUA_HAS_VIDEO 
     681    pjsua_vid_win *w = &pjsua_var.win[wid]; 
     682    pj_pool_t *pool = w->pool; 
     683 
     684    pj_bzero(w, sizeof(*w)); 
     685    if (pool) pj_pool_reset(pool); 
     686    w->ref_cnt = 0; 
     687    w->pool = pool; 
     688    w->preview_cap_id = PJMEDIA_VID_INVALID_DEV; 
     689#endif 
     690} 
     691 
    582692 
    583693PJ_END_DECL 
Note: See TracChangeset for help on using the changeset viewer.