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.h

    r3553 r3664  
    251251#define PJSUA_INVALID_ID            (-1) 
    252252 
     253/** Disabled features temporarily for media reorganization */ 
     254#define DISABLED_FOR_TICKET_1185        0 
     255 
    253256/** Call identification */ 
    254257typedef int pjsua_call_id; 
     
    282285#   define PJSUA_ACC_MAX_PROXIES    8 
    283286#endif 
    284  
    285 #if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0) 
    286287 
    287288/** 
     
    304305#endif 
    305306 
    306 #endif 
    307  
    308307/** 
    309308 * Controls whether PJSUA-LIB should add ICE media feature tag 
     
    325324#   define PJSUA_ACQUIRE_CALL_TIMEOUT 2000 
    326325#endif 
     326 
     327/** 
     328 * Is video enabled. 
     329 */ 
     330#ifndef PJSUA_HAS_VIDEO 
     331#   define PJSUA_HAS_VIDEO              PJMEDIA_HAS_VIDEO 
     332#endif 
     333 
     334/** 
     335 * This enumeration represents pjsua state. 
     336 */ 
     337typedef enum pjsua_state 
     338{ 
     339    /** 
     340     * The library has not been initialized. 
     341     */ 
     342    PJSUA_STATE_NULL, 
     343 
     344    /** 
     345     * After pjsua_create() is called but before pjsua_init() is called. 
     346     */ 
     347    PJSUA_STATE_CREATED, 
     348 
     349    /** 
     350     * After pjsua_init() is called but before pjsua_start() is called. 
     351     */ 
     352    PJSUA_STATE_INIT, 
     353 
     354    /** 
     355     * After pjsua_start() is called but before everything is running. 
     356     */ 
     357    PJSUA_STATE_STARTING, 
     358 
     359    /** 
     360     * After pjsua_start() is called and before pjsua_destroy() is called. 
     361     */ 
     362    PJSUA_STATE_RUNNING, 
     363 
     364    /** 
     365     * After pjsua_destroy() is called but before the function returns. 
     366     */ 
     367    PJSUA_STATE_CLOSING 
     368 
     369} pjsua_state; 
     370 
     371 
     372/** 
     373 * This enumeration represents video stream operation on a call. 
     374 * See also #pjsua_call_vid_strm_op_param for further info. 
     375 */ 
     376typedef enum pjsua_call_vid_strm_op 
     377{ 
     378    /** 
     379     * Add a new video stream. 
     380     */ 
     381    PJSUA_CALL_VID_STRM_ADD, 
     382 
     383    /** 
     384     * Remove/disable an existing video stream. 
     385     */ 
     386    PJSUA_CALL_VID_STRM_REMOVE, 
     387 
     388    /** 
     389     * Change direction of a video stream. 
     390     */ 
     391    PJSUA_CALL_VID_STRM_CHANGE_DIR, 
     392 
     393    /** 
     394     * Change capture device of a video stream. 
     395     */ 
     396    PJSUA_CALL_VID_STRM_CHANGE_CAP_DEV, 
     397 
     398    /** 
     399     * Start transmitting video stream. 
     400     */ 
     401    PJSUA_CALL_VID_STRM_START_TRANSMIT, 
     402 
     403    /** 
     404     * Stop transmitting video stream. 
     405     */ 
     406    PJSUA_CALL_VID_STRM_STOP_TRANSMIT, 
     407 
     408} pjsua_call_vid_strm_op; 
     409 
     410 
     411/** 
     412 * Parameters for video stream operation on a call. 
     413 */ 
     414typedef struct pjsua_call_vid_strm_op_param 
     415{ 
     416    /** 
     417     * Specify the media stream index. This can be set to -1 to denote 
     418     * the default video stream in the call, which is the first active 
     419     * video stream or any first video stream if none is active. 
     420     * 
     421     * This field is valid for all video stream operations, except 
     422     * PJSUA_CALL_VID_STRM_ADD. 
     423     * 
     424     * Default: -1 (first active video stream, or any first video stream 
     425     *              if none is active) 
     426     */ 
     427    int med_idx; 
     428  
     429    /** 
     430     * Specify the media stream direction. 
     431     * 
     432     * This field is valid for the following video stream operations: 
     433     * PJSUA_CALL_VID_STRM_ADD and PJSUA_CALL_VID_STRM_CHANGE_DIR. 
     434     * 
     435     * Default: PJMEDIA_DIR_ENCODING_DECODING 
     436     */ 
     437    pjmedia_dir dir; 
     438  
     439    /** 
     440     * Specify the video capture device ID. This can be set to 
     441     * PJMEDIA_VID_DEFAULT_CAPTURE_DEV to specify the default capture 
     442     * device as configured in the account. 
     443     * 
     444     * This field is valid for the following video stream operations: 
     445     * PJSUA_CALL_VID_STRM_ADD and PJSUA_CALL_VID_STRM_CHANGE_CAP_DEV. 
     446     * 
     447     * Default: capture device configured in account. 
     448     */ 
     449    pjmedia_vid_dev_index cap_dev; 
     450 
     451} pjsua_call_vid_strm_op_param; 
    327452 
    328453 
     
    484609     * 
    485610     * @param call_id       Call identification. 
    486      * @param sess          Media session for the call. 
     611     * @param strm          Media stream. 
    487612     * @param stream_idx    Stream index in the media session. 
    488613     * @param p_port        On input, it specifies the media port of the 
     
    492617     */ 
    493618    void (*on_stream_created)(pjsua_call_id call_id,  
    494                               pjmedia_session *sess, 
     619                              pjmedia_stream *strm, 
    495620                              unsigned stream_idx,  
    496621                              pjmedia_port **p_port); 
     
    501626     * 
    502627     * @param call_id       Call identification. 
    503      * @param sess          Media session for the call. 
     628     * @param strm          Media stream. 
    504629     * @param stream_idx    Stream index in the media session. 
    505630     */ 
    506631    void (*on_stream_destroyed)(pjsua_call_id call_id, 
    507                                 pjmedia_session *sess,  
     632                                pjmedia_stream *strm, 
    508633                                unsigned stream_idx); 
    509634 
     
    9191044                                   pj_status_t status, void *param); 
    9201045 
     1046    /** 
     1047     * Callback when the sound device is about to be opened or closed. 
     1048     * This callback will be called even when null sound device or no 
     1049     * sound device is configured by the application (i.e. the 
     1050     * #pjsua_set_null_snd_dev() and #pjsua_set_no_snd_dev() APIs). 
     1051     * This API is mostly useful when the application wants to manage 
     1052     * the sound device by itself (i.e. with #pjsua_set_no_snd_dev()), 
     1053     * to get notified when it should open or close the sound device. 
     1054     * 
     1055     * @param operation The value will be set to 0 to signal that sound 
     1056     *                  device is about to be closed, and 1 to be opened. 
     1057     * 
     1058     * @return          The callback must return PJ_SUCCESS at the moment. 
     1059     */ 
     1060    pj_status_t (*on_snd_dev_operation)(int operation); 
     1061 
     1062    /** 
     1063     * Notification about media events such as video notifications. This 
     1064     * callback will most likely be called from media threads, thus 
     1065     * application must not perform heavy processing in this callback. 
     1066     * Especially, application must not destroy the call or media in this 
     1067     * callback. If application needs to perform more complex tasks to 
     1068     * handle the event, it should post the task to another thread. 
     1069     * 
     1070     * @param call_id   The call id. 
     1071     * @param med_idx   The media stream index. 
     1072     * @param event     The media event. 
     1073     */ 
     1074    void (*on_call_media_event)(pjsua_call_id call_id, 
     1075                                unsigned med_idx, 
     1076                                pjmedia_event *event); 
     1077 
    9211078} pjsua_callback; 
    9221079 
     
    11551312    pj_str_t        user_agent; 
    11561313 
    1157 #if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0) 
    11581314    /** 
    11591315     * Specify default value of secure media transport usage.  
     
    11851341 
    11861342    /** 
    1187      * Specify whether SRTP in PJMEDIA_SRTP_OPTIONAL mode should compose  
     1343     * Specify whether SRTP in PJMEDIA_SRTP_OPTIONAL mode should compose 
    11881344     * duplicated media in SDP offer, i.e: unsecured and secured version. 
    1189      * Otherwise, the SDP media will be composed as unsecured media but  
     1345     * Otherwise, the SDP media will be composed as unsecured media but 
    11901346     * with SDP "crypto" attribute. 
    11911347     * 
     
    11931349     */ 
    11941350    pj_bool_t        srtp_optional_dup_offer; 
    1195 #endif 
    11961351 
    11971352    /** 
     
    13511506 */ 
    13521507PJ_DECL(pj_status_t) pjsua_destroy(void); 
     1508 
     1509 
     1510/** 
     1511 * Retrieve pjsua state. 
     1512 * 
     1513 * @return      pjsua state. 
     1514 */ 
     1515PJ_DECL(pjsua_state) pjsua_get_state(void); 
    13531516 
    13541517 
     
    20942257#endif 
    20952258 
    2096  
    20972259/** 
    20982260 * This structure describes account configuration to be specified when 
     
    23992561    pj_str_t         ka_data; 
    24002562 
    2401 #if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0) 
     2563    /** 
     2564     * Maximum number of simultaneous active audio streams to be allowed 
     2565     * for calls on this account. Setting this to zero will disable audio 
     2566     * in calls on this account. 
     2567     * 
     2568     * Default: 1 
     2569     */ 
     2570    unsigned         max_audio_cnt; 
     2571 
     2572    /** 
     2573     * Maximum number of simultaneous active video streams to be allowed 
     2574     * for calls on this account. Setting this to zero will disable video 
     2575     * in calls on this account, regardless of other video settings. 
     2576     * 
     2577     * Default: 1 
     2578     */ 
     2579    unsigned         max_video_cnt; 
     2580 
     2581    /** 
     2582     * Specify whether incoming video should be shown to screen by default. 
     2583     * This applies to incoming call (INVITE), incoming re-INVITE, and 
     2584     * incoming UPDATE requests. 
     2585     * 
     2586     * Regardless of this setting, application can detect incoming video 
     2587     * by implementing \a on_call_media_state() callback and enumerating 
     2588     * the media stream(s) with #pjsua_call_get_info(). Once incoming 
     2589     * video is recognised, application may retrieve the window associated 
     2590     * with the incoming video and show or hide it with 
     2591     * #pjsua_vid_win_set_show(). 
     2592     * 
     2593     * Default: PJ_FALSE 
     2594     */ 
     2595    pj_bool_t        vid_in_auto_show; 
     2596 
     2597    /** 
     2598     * Specify whether outgoing video should be activated by default when 
     2599     * making outgoing calls and/or when incoming video is detected. This 
     2600     * applies to incoming and outgoing calls, incoming re-INVITE, and 
     2601     * incoming UPDATE. If the setting is non-zero, outgoing video 
     2602     * transmission will be started as soon as response to these requests 
     2603     * is sent (or received). 
     2604     * 
     2605     * Regardless of the value of this setting, application can start and 
     2606     * stop outgoing video transmission with #pjsua_call_set_vid_out(). 
     2607     * 
     2608     * Default: PJ_FALSE 
     2609     */ 
     2610    pj_bool_t        vid_out_auto_transmit; 
     2611 
     2612    /** 
     2613     * Specify the default capture device to be used by this account. If 
     2614     * \a vid_out_auto_transmit is enabled, this device will be used for 
     2615     * capturing video. 
     2616     * 
     2617     * Default: PJMEDIA_VID_DEFAULT_CAPTURE_DEV 
     2618     */ 
     2619    pjmedia_vid_dev_index vid_cap_dev; 
     2620 
     2621    /** 
     2622     * Specify the default rendering device to be used by this account. 
     2623     * 
     2624     * Default: PJMEDIA_VID_DEFAULT_RENDER_DEV 
     2625     */ 
     2626    pjmedia_vid_dev_index vid_rend_dev; 
     2627 
     2628    /** 
     2629     * Media transport config. 
     2630     */ 
     2631    pjsua_transport_config rtp_cfg; 
     2632 
    24022633    /** 
    24032634     * Specify whether secure media transport should be used for this account. 
     
    24232654 
    24242655    /** 
    2425      * Specify whether SRTP in PJMEDIA_SRTP_OPTIONAL mode should compose  
     2656     * Specify whether SRTP in PJMEDIA_SRTP_OPTIONAL mode should compose 
    24262657     * duplicated media in SDP offer, i.e: unsecured and secured version. 
    2427      * Otherwise, the SDP media will be composed as unsecured media but  
     2658     * Otherwise, the SDP media will be composed as unsecured media but 
    24282659     * with SDP "crypto" attribute. 
    24292660     * 
     
    24312662     */ 
    24322663    pj_bool_t        srtp_optional_dup_offer; 
    2433 #endif 
    24342664 
    24352665    /** 
     
    29273157#endif 
    29283158 
     3159/** 
     3160 * Maximum active video windows 
     3161 */ 
     3162#ifndef PJSUA_MAX_VID_WINS 
     3163#   define PJSUA_MAX_VID_WINS       16 
     3164#endif 
     3165 
     3166/** 
     3167 * Video window ID. 
     3168 */ 
     3169typedef int pjsua_vid_win_id; 
    29293170 
    29303171 
     
    29353176typedef enum pjsua_call_media_status 
    29363177{ 
    2937     /** Call currently has no media */ 
     3178    /** 
     3179     * Call currently has no media, or the media is not used. 
     3180     */ 
    29383181    PJSUA_CALL_MEDIA_NONE, 
    29393182 
    2940     /** The media is active */ 
     3183    /** 
     3184     * The media is active 
     3185     */ 
    29413186    PJSUA_CALL_MEDIA_ACTIVE, 
    29423187 
    2943     /** The media is currently put on hold by local endpoint */ 
     3188    /** 
     3189     * The media is currently put on hold by local endpoint 
     3190     */ 
    29443191    PJSUA_CALL_MEDIA_LOCAL_HOLD, 
    29453192 
    2946     /** The media is currently put on hold by remote endpoint */ 
     3193    /** 
     3194     * The media is currently put on hold by remote endpoint 
     3195     */ 
    29473196    PJSUA_CALL_MEDIA_REMOTE_HOLD, 
    29483197 
    2949     /** The media has reported error (e.g. ICE negotiation) */ 
     3198    /** 
     3199     * The media has reported error (e.g. ICE negotiation) 
     3200     */ 
    29503201    PJSUA_CALL_MEDIA_ERROR 
    29513202 
     
    29943245    pj_str_t            last_status_text; 
    29953246 
    2996     /** Call media status. */ 
     3247    /** Media status of the first audio stream. */ 
    29973248    pjsua_call_media_status media_status; 
    29983249 
    2999     /** Media direction */ 
     3250    /** Media direction of the first audio stream. */ 
    30003251    pjmedia_dir         media_dir; 
    30013252 
    3002     /** The conference port number for the call */ 
     3253    /** The conference port number for the first audio stream. */ 
    30033254    pjsua_conf_port_id  conf_slot; 
     3255 
     3256    /** Number of media streams in this call */ 
     3257    unsigned            media_cnt; 
     3258 
     3259    /** Array of media stream information */ 
     3260    struct 
     3261    { 
     3262        /** Media index in SDP. */ 
     3263        unsigned                index; 
     3264 
     3265        /** Media type. */ 
     3266        pjmedia_type            type; 
     3267 
     3268        /** Media direction. */ 
     3269        pjmedia_dir             dir; 
     3270 
     3271        /** Call media status. */ 
     3272        pjsua_call_media_status status; 
     3273 
     3274        /** The specific media stream info. */ 
     3275        union { 
     3276            /** Audio stream */ 
     3277            struct { 
     3278                /** The conference port number for the call.  */ 
     3279                pjsua_conf_port_id   conf_slot; 
     3280            } aud; 
     3281 
     3282            /** Video stream */ 
     3283            struct { 
     3284                /** 
     3285                 * The window id for incoming video, if any, or 
     3286                 * PJSUA_INVALID_ID. 
     3287                 */ 
     3288                pjsua_vid_win_id     win_in; 
     3289 
     3290                /** The video capture device for outgoing transmission, 
     3291                 *  if any, or PJMEDIA_VID_INVALID_DEV 
     3292                 */ 
     3293                pjmedia_vid_dev_index   cap_dev; 
     3294 
     3295            } vid; 
     3296        } stream; 
     3297 
     3298    } media[PJMEDIA_MAX_SDP_MEDIA]; 
    30043299 
    30053300    /** Up-to-date call connected duration (zero when call is not  
     
    30503345} pjsua_call_flag; 
    30513346 
     3347 
     3348/** 
     3349 * Media stream info. 
     3350 */ 
     3351typedef struct pjsua_stream_info 
     3352{ 
     3353    /** Media type of this stream. */ 
     3354    pjmedia_type type; 
     3355 
     3356    /** Stream info (union). */ 
     3357    union { 
     3358        /** Audio stream info */ 
     3359        pjmedia_stream_info     aud; 
     3360 
     3361        /** Video stream info */ 
     3362        pjmedia_vid_stream_info vid; 
     3363    } info; 
     3364 
     3365} pjsua_stream_info; 
     3366 
     3367 
     3368/** 
     3369 * Media stream statistic. 
     3370 */ 
     3371typedef struct pjsua_stream_stat 
     3372{ 
     3373    /** RTCP statistic. */ 
     3374    pjmedia_rtcp_stat   rtcp; 
     3375 
     3376    /** Jitter buffer statistic. */ 
     3377    pjmedia_jb_state    jbuf; 
     3378 
     3379} pjsua_stream_stat; 
     3380 
     3381 
    30523382/** 
    30533383 * Get maximum number of calls configured in pjsua. 
     
    31233453 
    31243454/** 
    3125  * Retrieve the media session associated with this call. Note that the media 
    3126  * session may not be available depending on the current call's media status 
    3127  * (the pjsua_call_media_status information in pjsua_call_info). Application 
    3128  * may use the media session to retrieve more detailed information about the 
    3129  * call's media. 
     3455 * Get the conference port identification associated with the call. 
    31303456 * 
    31313457 * @param call_id       Call identification. 
    31323458 * 
    3133  * @return              Call media session. 
    3134  */ 
    3135 PJ_DECL(pjmedia_session*) pjsua_call_get_media_session(pjsua_call_id call_id); 
    3136  
    3137  
    3138 /** 
    3139  * Retrieve the media transport instance that is used for this call.  
    3140  * Application may use the media transport to query more detailed information 
    3141  * about the media transport. 
    3142  * 
    3143  * @param cid           Call identification (the call_id). 
    3144  * 
    3145  * @return              Call media transport. 
    3146  */ 
    3147 PJ_DECL(pjmedia_transport*) pjsua_call_get_media_transport(pjsua_call_id cid); 
    3148  
    3149  
    3150 /** 
    3151  * Get the conference port identification associated with the call. 
    3152  * 
    3153  * @param call_id       Call identification. 
    3154  * 
    3155  * @return              Conference port ID, or PJSUA_INVALID_ID when the  
     3459 * @return              Conference port ID, or PJSUA_INVALID_ID when the 
    31563460 *                      media has not been established or is not active. 
    31573461 */ 
     
    35033807                                     unsigned maxlen, 
    35043808                                     const char *indent); 
     3809 
     3810/** 
     3811 * Get the media stream index of the default video stream in the call. 
     3812 * Typically this will just retrieve the stream index of the first 
     3813 * activated video stream in the call. 
     3814 * 
     3815 * @param call_id       Call identification. 
     3816 * 
     3817 * @return              The media stream index or -1 if no video stream 
     3818 *                      is present in the call. 
     3819 */ 
     3820PJ_DECL(int) pjsua_call_get_vid_stream_idx(pjsua_call_id call_id); 
     3821 
     3822 
     3823/** 
     3824 * Add, remove, modify, and/or manipulate video media stream for the 
     3825 * specified call. This may trigger a re-INVITE or UPDATE to be sent 
     3826 * for the call. 
     3827 * 
     3828 * @param call_id       Call identification. 
     3829 * @param op            The video stream operation to be performed, 
     3830 *                      possible values are #pjsua_call_vid_strm_op. 
     3831 * @param param         The parameters for the video stream operation, 
     3832 *                      or NULL for the default parameter values 
     3833 *                      (see #pjsua_call_vid_strm_op_param). 
     3834 * 
     3835 * @return              PJ_SUCCESS on success or the appropriate error. 
     3836 */ 
     3837PJ_DECL(pj_status_t) pjsua_call_set_vid_strm ( 
     3838                                pjsua_call_id call_id, 
     3839                                pjsua_call_vid_strm_op op, 
     3840                                const pjsua_call_vid_strm_op_param *param); 
     3841 
     3842 
     3843/** 
     3844 * Get media stream info for the specified media index. 
     3845 * 
     3846 * @param call_id       The call identification. 
     3847 * @param med_idx       Media stream index. 
     3848 * @param psi           To be filled with the stream info. 
     3849 * 
     3850 * @return              PJ_SUCCESS on success or the appropriate error. 
     3851 */ 
     3852PJ_DECL(pj_status_t) pjsua_call_get_stream_info(pjsua_call_id call_id, 
     3853                                                unsigned med_idx, 
     3854                                                pjsua_stream_info *psi); 
     3855 
     3856/** 
     3857 *  Get media stream statistic for the specified media index. 
     3858 * 
     3859 * @param call_id       The call identification. 
     3860 * @param med_idx       Media stream index. 
     3861 * @param psi           To be filled with the stream statistic. 
     3862 * 
     3863 * @return              PJ_SUCCESS on success or the appropriate error. 
     3864 */ 
     3865PJ_DECL(pj_status_t) pjsua_call_get_stream_stat(pjsua_call_id call_id, 
     3866                                                unsigned med_idx, 
     3867                                                pjsua_stream_stat *stat); 
     3868 
     3869/** 
     3870 * Get media transport info for the specified media index. 
     3871 * 
     3872 * @param call_id       The call identification. 
     3873 * @param med_idx       Media stream index. 
     3874 * @param t             To be filled with the transport info. 
     3875 * 
     3876 * @return              PJ_SUCCESS on success or the appropriate error. 
     3877 */ 
     3878PJ_DECL(pj_status_t) pjsua_call_get_transport_info(pjsua_call_id call_id, 
     3879                                                   unsigned med_idx, 
     3880                                                   pjmedia_transport_info *t); 
     3881 
     3882 
    35053883 
    35063884/** 
     
    43124690 
    43134691    /** 
     4692     * Codec description. 
     4693     */ 
     4694    pj_str_t            desc; 
     4695 
     4696    /** 
    43144697     * Internal buffer. 
    43154698     */ 
    4316     char                buf_[32]; 
     4699    char                buf_[64]; 
    43174700 
    43184701} pjsua_codec_info; 
     
    43734756 
    43744757} pjsua_media_transport; 
    4375  
    4376  
    43774758 
    43784759 
     
    49245305 
    49255306 
    4926  
    4927  
     5307#if DISABLED_FOR_TICKET_1185 
    49285308/** 
    49295309 * Create UDP media transports for all the calls. This function creates 
     
    49365316 * @return              PJ_SUCCESS on success, or the appropriate error code. 
    49375317 */ 
    4938 PJ_DECL(pj_status_t)  
     5318PJ_DECL(pj_status_t) 
    49395319pjsua_media_transports_create(const pjsua_transport_config *cfg); 
    49405320 
     
    49535333 * @return              PJ_SUCCESS on success, or the appropriate error code. 
    49545334 */ 
    4955 PJ_DECL(pj_status_t)  
     5335PJ_DECL(pj_status_t) 
    49565336pjsua_media_transports_attach( pjsua_media_transport tp[], 
    49575337                               unsigned count, 
    49585338                               pj_bool_t auto_delete); 
    4959  
    4960  
     5339#endif 
     5340 
     5341 
     5342/* end of MEDIA API */ 
    49615343/** 
    49625344 * @} 
     
    49645346 
    49655347 
    4966  
     5348/***************************************************************************** 
     5349 * VIDEO API 
     5350 */ 
     5351 
     5352 
     5353/** 
     5354 * @defgroup PJSUA_LIB_VIDEO PJSUA-API Video 
     5355 * @ingroup PJSUA_LIB 
     5356 * @brief Video support 
     5357 * @{ 
     5358 */ 
     5359 
     5360/* 
     5361 * Video devices API 
     5362 */ 
     5363 
     5364/** 
     5365 * Get the number of video devices installed in the system. 
     5366 * 
     5367 * @return              The number of devices. 
     5368 */ 
     5369PJ_DECL(unsigned) pjsua_vid_dev_count(void); 
     5370 
     5371/** 
     5372 * Retrieve the video device info for the specified device index. 
     5373 * 
     5374 * @param id            The device index. 
     5375 * @param vdi           Device info to be initialized. 
     5376 * 
     5377 * @return              PJ_SUCCESS on success, or the appropriate error code. 
     5378 */ 
     5379PJ_DECL(pj_status_t) pjsua_vid_dev_get_info(pjmedia_vid_dev_index id, 
     5380                                            pjmedia_vid_dev_info *vdi); 
     5381 
     5382/** 
     5383 * Enum all video devices installed in the system. 
     5384 * 
     5385 * @param info          Array of info to be initialized. 
     5386 * @param count         On input, specifies max elements in the array. 
     5387 *                      On return, it contains actual number of elements 
     5388 *                      that have been initialized. 
     5389 * 
     5390 * @return              PJ_SUCCESS on success, or the appropriate error code. 
     5391 */ 
     5392PJ_DECL(pj_status_t) pjsua_vid_enum_devs(pjmedia_vid_dev_info info[], 
     5393                                         unsigned *count); 
     5394 
     5395 
     5396/* 
     5397 * Video preview API 
     5398 */ 
     5399 
     5400/** 
     5401 * Parameters for starting video preview with pjsua_vid_preview_start(). 
     5402 * Application should initialize this structure with 
     5403 * pjsua_vid_preview_param_default(). 
     5404 */ 
     5405typedef struct pjsua_vid_preview_param 
     5406{ 
     5407    /** 
     5408     * Device ID for the video renderer to be used for rendering the 
     5409     * capture stream for preview. 
     5410     */ 
     5411    pjmedia_vid_dev_index       rend_id; 
     5412} pjsua_vid_preview_param; 
     5413 
     5414 
     5415/** 
     5416 * Start video preview window for the specified capture device. 
     5417 * 
     5418 * @param id            The capture device ID where its preview will be 
     5419 *                      started. 
     5420 * @param prm           Optional video preview parameters. Specify NULL 
     5421 *                      to use default values. 
     5422 * 
     5423 * @return              PJ_SUCCESS on success, or the appropriate error code. 
     5424 */ 
     5425PJ_DECL(pj_status_t) pjsua_vid_preview_start(pjmedia_vid_dev_index id, 
     5426                                             pjsua_vid_preview_param *prm); 
     5427 
     5428/** 
     5429 * Get the preview window handle associated with the capture device, if any. 
     5430 * 
     5431 * @param id            The capture device ID. 
     5432 * 
     5433 * @return              The window ID of the preview window for the 
     5434 *                      specified capture device ID, or NULL if preview 
     5435 *                      does not exist. 
     5436 */ 
     5437PJ_DECL(pjsua_vid_win_id) pjsua_vid_preview_get_win(pjmedia_vid_dev_index id); 
     5438 
     5439/** 
     5440 * Stop video preview. 
     5441 * 
     5442 * @param id            The capture device ID. 
     5443 * 
     5444 * @return              PJ_SUCCESS on success, or the appropriate error code. 
     5445 */ 
     5446PJ_DECL(pj_status_t) pjsua_vid_preview_stop(pjmedia_vid_dev_index id); 
     5447 
     5448 
     5449/* 
     5450 * Video window manipulation API. 
     5451 */ 
     5452 
     5453/** 
     5454 * This structure describes video window info. 
     5455 */ 
     5456typedef struct pjsua_vid_win_info 
     5457{ 
     5458    /** 
     5459     * Window show status. The window is hidden if false. 
     5460     */ 
     5461    pj_bool_t   show; 
     5462 
     5463    /** 
     5464     * Window position. 
     5465     */ 
     5466    pjmedia_coord pos; 
     5467 
     5468    /** 
     5469     * Window size. 
     5470     */ 
     5471    pjmedia_rect_size size; 
     5472 
     5473} pjsua_vid_win_info; 
     5474 
     5475 
     5476/** 
     5477 * Enumerates all video windows. 
     5478 * 
     5479 * @param id            Array of window ID to be initialized. 
     5480 * @param count         On input, specifies max elements in the array. 
     5481 *                      On return, it contains actual number of elements 
     5482 *                      that have been initialized. 
     5483 * 
     5484 * @return              PJ_SUCCESS on success, or the appropriate error code. 
     5485 */ 
     5486PJ_DECL(pj_status_t) pjsua_vid_enum_wins(pjsua_vid_win_id wids[], 
     5487                                         unsigned *count); 
     5488 
     5489 
     5490/** 
     5491 * Get window info. 
     5492 * 
     5493 * @param wid           The video window ID. 
     5494 * @param wi            The video window info to be initialized. 
     5495 * 
     5496 * @return              PJ_SUCCESS on success, or the appropriate error code. 
     5497 */ 
     5498PJ_DECL(pj_status_t) pjsua_vid_win_get_info(pjsua_vid_win_id wid, 
     5499                                            pjsua_vid_win_info *wi); 
     5500 
     5501/** 
     5502 * Show or hide window. 
     5503 * 
     5504 * @param wid           The video window ID. 
     5505 * @param show          Set to PJ_TRUE to show the window, PJ_FALSE to 
     5506 *                      hide the window. 
     5507 * 
     5508 * @return              PJ_SUCCESS on success, or the appropriate error code. 
     5509 */ 
     5510PJ_DECL(pj_status_t) pjsua_vid_win_set_show(pjsua_vid_win_id wid, 
     5511                                            pj_bool_t show); 
     5512 
     5513/** 
     5514 * Set video window position. 
     5515 * 
     5516 * @param wid           The video window ID. 
     5517 * @param pos           The window position. 
     5518 * 
     5519 * @return              PJ_SUCCESS on success, or the appropriate error code. 
     5520 */ 
     5521PJ_DECL(pj_status_t) pjsua_vid_win_set_pos(pjsua_vid_win_id wid, 
     5522                                           const pjmedia_coord *pos); 
     5523 
     5524/** 
     5525 * Resize window. 
     5526 * 
     5527 * @param wid           The video window ID. 
     5528 * @param size          The new window size. 
     5529 * 
     5530 * @return              PJ_SUCCESS on success, or the appropriate error code. 
     5531 */ 
     5532PJ_DECL(pj_status_t) pjsua_vid_win_set_size(pjsua_vid_win_id wid, 
     5533                                            const pjmedia_rect_size *size); 
     5534 
     5535 
     5536 
     5537/* 
     5538 * Video codecs API 
     5539 */ 
     5540 
     5541/** 
     5542 * Enum all supported video codecs in the system. 
     5543 * 
     5544 * @param id            Array of ID to be initialized. 
     5545 * @param count         On input, specifies max elements in the array. 
     5546 *                      On return, it contains actual number of elements 
     5547 *                      that have been initialized. 
     5548 * 
     5549 * @return              PJ_SUCCESS on success, or the appropriate error code. 
     5550 */ 
     5551PJ_DECL(pj_status_t) pjsua_vid_enum_codecs( pjsua_codec_info id[], 
     5552                                            unsigned *count ); 
     5553 
     5554 
     5555/** 
     5556 * Change video codec priority. 
     5557 * 
     5558 * @param codec_id      Codec ID, which is a string that uniquely identify 
     5559 *                      the codec (such as "H263/90000"). Please see pjsua 
     5560 *                      manual or pjmedia codec reference for details. 
     5561 * @param priority      Codec priority, 0-255, where zero means to disable 
     5562 *                      the codec. 
     5563 * 
     5564 * @return              PJ_SUCCESS on success, or the appropriate error code. 
     5565 */ 
     5566PJ_DECL(pj_status_t) pjsua_vid_codec_set_priority( const pj_str_t *codec_id, 
     5567                                                   pj_uint8_t priority ); 
     5568 
     5569 
     5570/** 
     5571 * Get video codec parameters. 
     5572 * 
     5573 * @param codec_id      Codec ID. 
     5574 * @param param         Structure to receive video codec parameters. 
     5575 * 
     5576 * @return              PJ_SUCCESS on success, or the appropriate error code. 
     5577 */ 
     5578PJ_DECL(pj_status_t) pjsua_vid_codec_get_param( 
     5579                                        const pj_str_t *codec_id, 
     5580                                        pjmedia_vid_codec_param *param); 
     5581 
     5582 
     5583/** 
     5584 * Set video codec parameters. 
     5585 * 
     5586 * @param codec_id      Codec ID. 
     5587 * @param param         Codec parameter to set. Set to NULL to reset 
     5588 *                      codec parameter to library default settings. 
     5589 * 
     5590 * @return              PJ_SUCCESS on success, or the appropriate error code. 
     5591 */ 
     5592PJ_DECL(pj_status_t) pjsua_vid_codec_set_param(  
     5593                                        const pj_str_t *codec_id, 
     5594                                        const pjmedia_vid_codec_param *param); 
     5595 
     5596 
     5597 
     5598/* end of VIDEO API */ 
    49675599/** 
    49685600 * @} 
    49695601 */ 
    49705602 
     5603 
     5604/** 
     5605 * @} 
     5606 */ 
     5607 
    49715608PJ_END_DECL 
    49725609 
Note: See TracChangeset for help on using the changeset viewer.