Changeset 4709 for pjproject


Ignore:
Timestamp:
Jan 22, 2014 8:02:56 AM (10 years ago)
Author:
bennylp
Message:

More re #1655: added CLI command to toggle audio output route

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app_cli.c

    r4634 r4709  
    8686#define CMD_MEDIA_ADJUST_VOL        ((CMD_MEDIA*10)+4) 
    8787#define CMD_MEDIA_CODEC_PRIO        ((CMD_MEDIA*10)+5) 
     88#define CMD_MEDIA_SPEAKER_TOGGLE    ((CMD_MEDIA*10)+6) 
    8889 
    8990/* status & config level 2 command */ 
     
    13421343    case CMD_MEDIA_CODEC_PRIO: 
    13431344        status = cmd_set_codec_prio(cval);       
     1345        break; 
     1346    case CMD_MEDIA_SPEAKER_TOGGLE: 
     1347        { 
     1348            static int route = PJMEDIA_AUD_DEV_ROUTE_DEFAULT; 
     1349            status = pjsua_snd_get_setting(PJMEDIA_AUD_DEV_CAP_OUTPUT_ROUTE, 
     1350                                           &route); 
     1351            if (status != PJ_SUCCESS) { 
     1352                PJ_PERROR(2, (THIS_FILE, status, 
     1353                              "Warning: unable to retrieve route setting")); 
     1354            } 
     1355 
     1356            if (route == PJMEDIA_AUD_DEV_ROUTE_LOUDSPEAKER) 
     1357                route = PJMEDIA_AUD_DEV_ROUTE_DEFAULT; 
     1358            else 
     1359                route = PJMEDIA_AUD_DEV_ROUTE_LOUDSPEAKER; 
     1360 
     1361            PJ_LOG(4,(THIS_FILE, "Setting output route to %s %s", 
     1362                      (route==PJMEDIA_AUD_DEV_ROUTE_DEFAULT? 
     1363                                      "default" : "loudspeaker"), 
     1364                      (status? "anyway" : ""))); 
     1365 
     1366            status = pjsua_snd_set_setting(PJMEDIA_AUD_DEV_CAP_OUTPUT_ROUTE, 
     1367                                           &route, PJ_TRUE); 
     1368            PJ_PERROR(4,(THIS_FILE, status, "Result")); 
     1369        } 
    13441370        break; 
    13451371    }     
     
    28312857        "    <ARG name='speaker_port' type='int' desc='Speaker Level'/>" 
    28322858        "  </CMD>" 
     2859        "  <CMD name='speakertog' id='4006' desc='Toggle audio output route' />" 
    28332860        "  <CMD name='codec_prio' id='4005' sc='Cp' " 
    28342861        "   desc='Arrange codec priorities'>" 
Note: See TracChangeset for help on using the changeset viewer.