static void rtsp_setupPlayControl(void *pArg) { int streamNumber = CHANNEL_INFO_GET_CHANNEL(pArg); int buttons; buttons = interfacePlayControlStop|interfacePlayControlPause|interfacePlayControlRewind|interfacePlayControlFastForward|interfacePlayControlPlay; buttons |= appControlInfo.playbackInfo.playlistMode != playlistModeFavorites ? interfacePlayControlAddToPlaylist : interfacePlayControlMode; if (stream_info.custom_url == 0 || appControlInfo.playbackInfo.playlistMode != playlistModeNone) { buttons |= interfacePlayControlPrevious|interfacePlayControlNext; } if( streamNumber != CHANNEL_CUSTOM ) { sprintf(appControlInfo.playbackInfo.description, "%s: %s", _T("MOVIE"), stream_info.streamname); appControlInfo.playbackInfo.thumbnail[0] = 0; appControlInfo.playbackInfo.channel = streamNumber+1; } interface_playControlSetup(rtsp_play_callback, pArg, buttons, appControlInfo.playbackInfo.description, thumbnail_vod); if (stream_info.custom_url == 0 || appControlInfo.playbackInfo.playlistMode != playlistModeNone) { playControlChannelCallback set_channel; switch (appControlInfo.playbackInfo.playlistMode) { case playlistModeFavorites: set_channel = playlist_setChannel; saveAppSettings(); break; case playlistModeIPTV: set_channel = rtp_setChannel; interface_playControlSetProcessCommand(rtp_playControlProcessCommand); sprintf(appControlInfo.rtpMenuInfo.lastUrl,"rtsp://%s:%d/%s", stream_info.ip, stream_info.port, stream_info.streamname); saveAppSettings(); break; #ifdef ENABLE_DLNA case playlistModeDLNA: set_channel = dlna_setChannel; break; #endif default: set_channel = rtsp_setChannel; } interface_playControlSetChannelCallbacks(rtsp_startNextChannel, set_channel); } if( appControlInfo.playbackInfo.channel >= 0 ) interface_channelNumberShow(appControlInfo.playbackInfo.channel); }
static int voip_changeParam(interfaceMenu_t *pMenu, char *value, void* pArg) { char *dest; if( value == NULL ) return 1; switch((int)pArg) { case PARAM_SERVER: dest = appControlInfo.voipInfo.server; break; case PARAM_LOGIN: dest = appControlInfo.voipInfo.login; break; case PARAM_PASSWD: dest = appControlInfo.voipInfo.passwd; break; case PARAM_REALM: dest = appControlInfo.voipInfo.realm; break; default: dest = NULL; } if( dest == NULL ) { return -2; } strcpy(dest,value); if( saveAppSettings() != 0) { interface_showMessageBox(_T("SETTINGS_SAVE_ERROR"), thumbnail_warning, 0); } voip_fillAccountMenu(pMenu, (void*)-1); interface_displayMenu(1); return 0; }
MainWindow::~MainWindow() { saveAppSettings(); delete m_enum; delete m_serial; delete ui; }
int32_t st_changeOutputMode(videoOutput_t *p_videoOutput, const char *newOutputFormat) { uint32_t old_height; uint32_t new_height; uint32_t len; if(!p_videoOutput || !newOutputFormat) return -1; old_height = stHelper_getFormatHeight(p_videoOutput->currentFormat); new_height = stHelper_getFormatHeight(newOutputFormat); if (old_height != new_height) { gfx_stopEventThread(); gfx_terminate(); stHelper_sendToElcd("deinitfb"); st_setVideoFormat(p_videoOutput->name, newOutputFormat); stHelper_sendToElcd("initfb"); stHelper_waitForFBdevice("/dev/fb0"); if(p_videoOutput->isMajor) { if (new_height < 720 && interfaceInfo.screenHeight >= 720) { // Reset graphics mode for small resolutions appControlInfo.outputInfo.graphicsMode[0] = 0; saveAppSettings(); } if (appControlInfo.outputInfo.graphicsMode[0] == 0) { stHelper_setDirectFBMode(stHelper_getFormatWidth(new_height), new_height); } } gfx_init(0, NULL); interface_resize(); gfx_startEventThread(); needRestart = 1; } else { st_setVideoFormat(p_videoOutput->name, newOutputFormat); } len = sizeof(p_videoOutput->currentFormat); strncpy(p_videoOutput->currentFormat, newOutputFormat, len); p_videoOutput->currentFormat[len - 1] = 0; #ifdef ENABLE_FUSION fusion_fakeRestart(); #endif return 0; }
int voip_realDialNumber(interfaceMenu_t *pMenu, void *pArg) { int entryIndex = ENTRY_INFO_GET_INDEX((int)pArg), listIndex = ENTRY_INFO_GET_LIST((int)pArg), i; char *str = NULL; char uri[MAX_URL]; dprintf("%s: Dialing #%d from %d\n", __FUNCTION__,entryIndex, listIndex); if(entryIndex != LAST_DIALED) { switch(listIndex) { case LIST_ADDRESS: str = ADDRESSBOOK_FILENAME; break; case LIST_MISSED: str = MISSED_FILENAME; break; case LIST_ANSWERED: str = ANSWERED_FILENAME; break; case LIST_DIALED: str = DIALED_FILENAME; break; default :; } if( str == NULL ) { eprintf("VoIP: invalid list index\n"); return -2; } if( (i = m3u_getEntry( str, entryIndex)) != 0) { eprintf("VoIP: invalid entry index %d\n",entryIndex); return -2; } else { strcpy(appControlInfo.voipInfo.lastSip, m3u_url); } } saveAppSettings(); voip_addEntryToList(pMenu,(void*)LIST_DIALED); #ifdef ENABLE_VOIP_CONFERENCE sprintf(uri, "%c%s", appControlInfo.voipInfo.status == voipStatus_talking ? 'y' : 'm', appControlInfo.voipInfo.lastSip); #else sprintf(uri, "m%s", appControlInfo.voipInfo.lastSip); #endif eprintf("VoIP: Dialing '%s'\n",uri); voip_pipe_write( uri, strlen(uri)+1 ); return 0; }
static int voip_toggleEnabled(interfaceMenu_t *pMenu, void* pArg) { int showinfo = 1; appControlInfo.voipInfo.enabled = !appControlInfo.voipInfo.enabled; if( saveAppSettings() != 0) { interface_showMessageBox(_T("SETTINGS_SAVE_ERROR"), thumbnail_warning, 0); showinfo = 0; } voip_fillAccountMenu(pMenu, (void*)-1); interface_displayMenu(1); if (showinfo) { interface_showMessageBox(_T("PLEASE_WAIT"), thumbnail_info, 0); } if (appControlInfo.voipInfo.enabled) { system("/usr/local/etc/init.d/S95voip reload"); sleep(5); } else { system("/usr/local/etc/init.d/S95voip stop"); sleep(1); } if (showinfo) { interface_hideMessageBox(); } return 0; }
static void *voip_readPipeThread(void *pArg) { char buffer[BUFFER_SIZE], *buf, *str, *pos; int bytes_left, bytes_total; dprintf("%s: in\n", __FUNCTION__); while( appControlInfo.voipInfo.active ) { //dprintf("%s: read loop\n", __FUNCTION__); if( (bytes_total = voip_pipe_read(buffer, sizeof(buffer))) > 0) { bytes_left = bytes_total; while (bytes_left > 0) { buf = &buffer[bytes_total-bytes_left]; dprintf("%s: recieved '%s' %d/%d\n", __FUNCTION__,buf, bytes_left, bytes_total); bytes_left -= strlen(buf)+1; switch( buf[0] ) { case 'A': if( strncasecmp( buf, "Account deleted", 15 ) == 0) { appControlInfo.voipInfo.connected = 0; voip_loggingIn = 0; voip_fillMenu(interfaceInfo.currentMenu, (void*)0); voip_fillAccountMenu(interfaceInfo.currentMenu, NULL); } break; case 'I': str = &buf[2]; pos = index(str,'\n'); if(pos!=NULL) { time(&voip_lastCallTime); *pos = 0; strcpy(appControlInfo.voipInfo.lastSip,str); //from saveAppSettings(); str = &pos[1]; appControlInfo.voipInfo.status = voipStatus_incoming; voip_call_event(NULL); voip_fillMenu(interfaceInfo.currentMenu, (void*)0); // to (ignored) } break; case 'D': // Disconnect voip_hangup(interfaceInfo.currentMenu,NULL); break; case 'C': if(strncasecmp(buf,"Calling",7) == 0) { appControlInfo.voipInfo.status = voipStatus_dialing; voip_call_event(NULL); voip_fillMenu(interfaceInfo.currentMenu, (void*)0); } else if(strncasecmp(buf,"Connecting",10) == 0) { appControlInfo.voipInfo.status = voipStatus_talking; voip_call_event(NULL); voip_fillMenu(interfaceInfo.currentMenu, (void*)0); } break; case 'L'://Logged In/Logged out if( strncasecmp(buf,"Logged ",7) == 0) { appControlInfo.voipInfo.connected = buf[7] == 'I';// In/Out voip_loggingIn = 0; voip_fillMenu(interfaceInfo.currentMenu, (void*)0); voip_fillAccountMenu(interfaceInfo.currentMenu, NULL); } else if( strncasecmp(buf,"Logging ",8) == 0) { appControlInfo.voipInfo.connected = 0; voip_loggingIn = 1; voip_fillMenu(interfaceInfo.currentMenu, (void*)0); voip_fillAccountMenu(interfaceInfo.currentMenu, NULL); } break; case 'O': strcpy(appControlInfo.voipInfo.lastSip, &buf[1]); voip_addEntryToList(interfaceInfo.currentMenu, (void*)LIST_DIALED); break; case 'R': //Registration Failed if( strncasecmp( buf, "Registration Failed", 19) == 0 ) { appControlInfo.voipInfo.connected = 0; voip_loggingIn = 0; voip_fillMenu(interfaceInfo.currentMenu, (void*)0); voip_fillAccountMenu(interfaceInfo.currentMenu, NULL); interface_showMessageBox(_T("ERR_VOIP_REGISTER"), thumbnail_error, 3000); } break; case 'E': break; default: ; // ignore } interface_displayMenu(1); } } else { //eprintf("VoIP: Error reading NOTIFY pipe\n"); /*voip_cleanup(); break;*/ usleep(1000000); } } dprintf("%s: done\n", __FUNCTION__); //close(voip_socket); return NULL; }