Changeset 3786


Ignore:
Timestamp:
Oct 4, 2011 8:23:07 AM (12 years ago)
Author:
bennylp
Message:

Added pjsua_call_vid_stream_is_running() and pjmedia_vid_stream_is_running() API (closes #1379)

Location:
pjproject/trunk
Files:
4 edited

Legend:

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

    r3664 r3786  
    288288 
    289289/** 
     290 * Query if the stream is started on the specified direction. 
     291 * 
     292 * @param stream        The video stream. 
     293 * @param dir           The direction to be checked. 
     294 * 
     295 * @return              PJ_TRUE if stream is started. 
     296 */ 
     297PJ_DECL(pj_bool_t) pjmedia_vid_stream_is_running(pjmedia_vid_stream *stream, 
     298                                                 pjmedia_dir dir); 
     299 
     300/** 
    290301 * Pause the individual channel in the stream. 
    291302 * 
  • pjproject/trunk/pjmedia/src/pjmedia/vid_stream.c

    r3776 r3786  
    15991599 
    16001600/* 
     1601 * Check status. 
     1602 */ 
     1603PJ_DEF(pj_bool_t) pjmedia_vid_stream_is_running(pjmedia_vid_stream *stream, 
     1604                                                pjmedia_dir dir) 
     1605{ 
     1606    pj_bool_t is_running = PJ_TRUE; 
     1607 
     1608    PJ_ASSERT_RETURN(stream, PJ_FALSE); 
     1609 
     1610    if (dir & PJMEDIA_DIR_ENCODING) { 
     1611        is_running &= (stream->enc && !stream->enc->paused); 
     1612    } 
     1613 
     1614    if (dir & PJMEDIA_DIR_DECODING) { 
     1615        is_running &= (stream->dec && !stream->dec->paused); 
     1616    } 
     1617 
     1618    return is_running; 
     1619} 
     1620 
     1621/* 
    16011622 * Pause stream. 
    16021623 */ 
  • pjproject/trunk/pjsip/include/pjsua-lib/pjsua.h

    r3784 r3786  
    39413941 
    39423942/** 
     3943 * Determine if video stream for the specified call is currently running 
     3944 * (i.e. has been created, started, and not being paused) for the specified 
     3945 *  direction. 
     3946 * 
     3947 * @param call_id       Call identification. 
     3948 * @param med_idx       Media stream index, or -1 to specify default video 
     3949 *                      media. 
     3950 * @param dir           The direction to be checked. 
     3951 * 
     3952 * @return              PJ_TRUE if stream is currently running for the 
     3953 *                      specified direction. 
     3954 */ 
     3955PJ_DECL(pj_bool_t) pjsua_call_vid_stream_is_running(pjsua_call_id call_id, 
     3956                                                    int med_idx, 
     3957                                                    pjmedia_dir dir); 
     3958 
     3959/** 
    39433960 * Add, remove, modify, and/or manipulate video media stream for the 
    39443961 * specified call. This may trigger a re-INVITE or UPDATE to be sent 
  • pjproject/trunk/pjsip/src/pjsua-lib/pjsua_vid.c

    r3778 r3786  
    20392039 
    20402040 
     2041/* 
     2042 * Determine if video stream for the specified call is currently running 
     2043 * for the specified direction. 
     2044 */ 
     2045PJ_DEF(pj_bool_t) pjsua_call_vid_stream_is_running( pjsua_call_id call_id, 
     2046                                                    int med_idx, 
     2047                                                    pjmedia_dir dir) 
     2048{ 
     2049    pjsua_call *call; 
     2050    pjsua_call_media *call_med; 
     2051 
     2052    PJ_ASSERT_RETURN(call_id>=0 && call_id<(int)pjsua_var.ua_cfg.max_calls, 
     2053                     PJ_EINVAL); 
     2054 
     2055    /* Verify and normalize media index */ 
     2056    if (med_idx == -1) { 
     2057        med_idx = pjsua_call_get_vid_stream_idx(call_id); 
     2058    } 
     2059 
     2060    call = &pjsua_var.calls[call_id]; 
     2061    PJ_ASSERT_RETURN(med_idx >= 0 && med_idx < call->med_cnt, PJ_EINVAL); 
     2062 
     2063    call_med = &call->media[med_idx]; 
     2064 
     2065    /* Verify if the stream is transmitting video */ 
     2066    if (call_med->type != PJMEDIA_TYPE_VIDEO || (call_med->dir & dir) == 0 || 
     2067        !call_med->strm.v.stream) 
     2068    { 
     2069        return PJ_FALSE; 
     2070    } 
     2071 
     2072    return pjmedia_vid_stream_is_running(call_med->strm.v.stream, dir); 
     2073} 
     2074 
    20412075#endif /* PJSUA_HAS_VIDEO */ 
    20422076 
Note: See TracChangeset for help on using the changeset viewer.