Ignore:
Timestamp:
Jul 15, 2011 7:41:02 AM (13 years ago)
Author:
nanang
Message:

Re #1263:

  • Replaced video stream operation DISABLE into REMOVE.
  • Replaced video stream operation ENABLE into CHANGEDIR.
  • Added new param: media direction, used in operation ADD and CHANGEDIR.
  • Updated video stream operation START_TRANSMIT to ignore capture device param (as changing capture device is handled by CHANGE_CAP_DEV operation).
File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/branches/projects/2.0-dev/pjsip-apps/src/pjsua/pjsua_app.c

    r3652 r3657  
    33243324    puts("|                                                                             |"); 
    33253325    puts("| vid help                  Show this help screen                             |"); 
    3326     puts("| vid call rx on|off        Enable/disable incoming video for current call    |"); 
    3327     puts("| vid call tx on|off        Enable/disable video tx for current call          |"); 
     3326    puts("| vid call rx on|off N      Enable/disable video rx for stream N in curr call |"); 
     3327    puts("| vid call tx on|off N      Enable/disable video tx for stream N in curr call |"); 
    33283328    puts("| vid call add              Add video stream for current call                 |"); 
    3329     puts("| vid call enable/disable N Enable/disable stream #N for current call         |"); 
    3330     puts("| vid call set-cap N ID     Set capture dev ID for stream #N for current call |"); 
     3329    puts("| vid call enable/disable N Enable/disable stream #N in current call          |"); 
     3330    puts("| vid call set-cap N ID     Set capture dev ID for stream #N in current call |"); 
    33313331    puts("| vid dev list              List all video devices                            |"); 
    33323332    puts("| vid dev refresh           Refresh video device list                         |"); 
     
    37693769        pjsua_call_vid_strm_op_param param; 
    37703770 
    3771         if (argc == 4 && strcmp(argv[2], "rx")==0) { 
     3771        if (argc == 5 && strcmp(argv[2], "rx")==0) { 
     3772            pjsua_stream_info si; 
    37723773            pj_bool_t on = (strcmp(argv[3], "on") == 0); 
    3773             PJ_TODO(vid_enable_disable_video_RX_on_call); 
    3774             PJ_LOG(1,(THIS_FILE, "Not implemented")); 
     3774 
     3775            param.med_idx = atoi(argv[4]); 
     3776            if (pjsua_call_get_stream_info(current_call, param.med_idx, &si) || 
     3777                si.type != PJMEDIA_TYPE_VIDEO) 
     3778            { 
     3779                PJ_PERROR(1,(THIS_FILE, PJ_EINVAL, "Invalid stream")); 
     3780                return; 
     3781            } 
     3782 
     3783            if (on) param.dir = (si.info.vid.dir | PJMEDIA_DIR_DECODING); 
     3784            else param.dir = (si.info.vid.dir & PJMEDIA_DIR_ENCODING); 
     3785 
     3786            pjsua_call_set_vid_strm(current_call, PJSUA_CALL_VID_STRM_CHANGE_DIR, &param); 
    37753787        } 
    3776         else if (argc == 4 && strcmp(argv[2], "tx")==0) { 
     3788        else if (argc == 5 && strcmp(argv[2], "tx")==0) { 
    37773789            pj_bool_t on = (strcmp(argv[3], "on") == 0); 
    37783790            pjsua_call_vid_strm_op op = on? PJSUA_CALL_VID_STRM_START_TRANSMIT : 
    37793791                                            PJSUA_CALL_VID_STRM_STOP_TRANSMIT; 
    3780             pjsua_call_set_vid_strm(current_call, op, NULL); 
     3792 
     3793            param.med_idx = atoi(argv[4]); 
     3794 
     3795            pjsua_call_set_vid_strm(current_call, op, &param); 
    37813796        } 
    37823797        else if (argc == 3 && strcmp(argv[2], "add")==0) { 
    37833798            pjsua_call_set_vid_strm(current_call, PJSUA_CALL_VID_STRM_ADD, NULL); 
    37843799        } 
    3785         else if (argc == 4 &&  
     3800        else if (argc >= 3 &&  
    37863801                 (strcmp(argv[2], "disable")==0 || strcmp(argv[2], "enable")==0)) 
    37873802        { 
    37883803            pj_bool_t enable = (strcmp(argv[2], "enable") == 0); 
    3789             pjsua_call_vid_strm_op op = enable? PJSUA_CALL_VID_STRM_ENABLE : 
    3790                                                 PJSUA_CALL_VID_STRM_DISABLE; 
     3804            pjsua_call_vid_strm_op op = enable? PJSUA_CALL_VID_STRM_CHANGE_DIR : 
     3805                                                PJSUA_CALL_VID_STRM_REMOVE; 
     3806 
    37913807            param.med_idx = argc >= 4? atoi(argv[3]) : -1; 
     3808            param.dir = PJMEDIA_DIR_ENCODING_DECODING; 
    37923809            pjsua_call_set_vid_strm(current_call, op, &param); 
    37933810        } 
    3794         else if (argc == 5 && strcmp(argv[2], "set-cap")==0) { 
     3811        else if (argc >= 3 && strcmp(argv[2], "set-cap")==0) { 
    37953812            param.med_idx = argc >= 4? atoi(argv[3]) : -1; 
    37963813            param.cap_dev = argc >= 5? atoi(argv[4]) : PJMEDIA_VID_DEFAULT_CAPTURE_DEV; 
     
    37983815        } else 
    37993816            goto on_error; 
    3800     } else if (strcmp(argv[1], "dev")==0) { 
     3817    } else if (argc >= 3 && strcmp(argv[1], "dev")==0) { 
    38013818        if (strcmp(argv[2], "list")==0) { 
    38023819            vid_list_devs(); 
Note: See TracChangeset for help on using the changeset viewer.