Exemplo n.º 1
0
int rtsp_fillStreamMenu(interfaceMenu_t *pMenu, void* pArg)
{
	int which;
	//int position = 0;
	char *str;

	which = GET_NUMBER(pArg);

	interface_clearMenuEntries((interfaceMenu_t*)&rtspStreamMenu);

	str = _T("SEARCHING_MOVIES");
	interface_addMenuEntryDisabled((interfaceMenu_t*)&rtspStreamMenu, str, thumbnail_search);

	collectFlag++;

	if( collectThread == 0)
	{
		pthread_create(&collectThread, NULL, rtsp_list_updater, SET_NUMBER(which));
		pthread_detach(collectThread);
	}

	interface_setSelectedItem((interfaceMenu_t*)&rtspStreamMenu, MENU_ITEM_MAIN);

	interface_menuActionShowMenu(pMenu, (void*)&rtspStreamMenu);

	return 0;
}
Exemplo n.º 2
0
static int voip_fillAnsweredCallsMenu(interfaceMenu_t *pMenu, void *pArg)
{
	FILE *file;
	char *str;
	int i = 0;

	interface_clearMenuEntries((interfaceMenu_t*)&AnsweredCallsMenu);

	str = _T("CLEARLIST");
	interface_addMenuEntry((interfaceMenu_t*)&AnsweredCallsMenu, str, voip_clearList, (void*)ENTRY_INFO_SET(LIST_ANSWERED,LAST_DIALED), thumbnail_dial);

	file = m3u_initFile(ANSWERED_FILENAME, "r");
	if(file != NULL)
	{
		while ( m3u_readEntry(file) == 0 )
		{
			interface_addMenuEntry((interfaceMenu_t*)&AnsweredCallsMenu, m3u_description, voip_dialNumber, (void*)ENTRY_INFO_SET(LIST_ANSWERED,i), thumbnail_voip );
			i++;
		}
	}
	if( i == 0)
	{
		str = _T("NO_ANSWERED_CALLS");
		interface_addMenuEntryDisabled((interfaceMenu_t*)&AnsweredCallsMenu, str, -1 );
	}
	interface_menuActionShowMenu(pMenu, (void*)&AnsweredCallsMenu);
	interface_displayMenu(1);
	return 0;
}
Exemplo n.º 3
0
static int voip_fillAddressBookMenu(interfaceMenu_t *pMenu, void *pArg)
{
	int i = 0;
	char *str;
	FILE *file;
	
	interface_clearMenuEntries((interfaceMenu_t*)&AddressBookMenu);

	str = _T("ADD");
	interface_addMenuEntry((interfaceMenu_t*)&AddressBookMenu, str, voip_newAddressBookURI, (void*)ENTRY_INFO_SET(LIST_ADDRESS, LAST_DIALED), thumbnail_dial);

	file = m3u_initFile(ADDRESSBOOK_FILENAME, "r");
	if(file != NULL)
	{
		while ( m3u_readEntry(file) == 0 )
		{
			interface_addMenuEntry((interfaceMenu_t*)&AddressBookMenu, m3u_description, voip_dialNumber, (void*)ENTRY_INFO_SET(LIST_ADDRESS, i), thumbnail_account_buddy );
			i++;
		}
	}
	if(i == 0)
	{
		str = _T("ADDRESS_BOOK_EMPTY");
		interface_addMenuEntryDisabled((interfaceMenu_t*)&AddressBookMenu, str, -1 );
	}
	if( interface_getSelectedItem( (interfaceMenu_t*)&AddressBookMenu ) >= i )
	{
		interface_setSelectedItem( (interfaceMenu_t*)&AddressBookMenu, i );
	}

	interface_menuActionShowMenu(pMenu, (void*)&AddressBookMenu);
	interface_displayMenu(1);
	return 0;
}
Exemplo n.º 4
0
static int voip_fillAccountMenu(interfaceMenu_t *pMenu, void *pArg)
{
	char buf[MENU_ENTRY_INFO_LENGTH], *str;

	interface_clearMenuEntries((interfaceMenu_t*)&AccountMenu);

	snprintf(buf,MENU_ENTRY_INFO_LENGTH, "%s: %s", _T("VOIP_ENABLE"), appControlInfo.voipInfo.enabled ? _T("ON") : _T("OFF"));
	interface_addMenuEntry((interfaceMenu_t*)&AccountMenu, buf, voip_toggleEnabled, NULL, appControlInfo.voipInfo.enabled ? thumbnail_yes : thumbnail_no);

	if (appControlInfo.voipInfo.enabled)
	{
		//snprintf(buf,MENU_ENTRY_INFO_LENGTH, "SIP: %s", appControlInfo.voipInfo.sip);
		//interface_addMenuEntry((interfaceMenu_t*)&AccountMenu, interfaceMenuEntryText, buf, strlen(buf), 0, voip_toggleParam, NULL, NULL, (void*)PARAM_SIP, thumbnail_account);
		str = _T( voip_loggingIn ? "SERVER_QUERY" : (appControlInfo.voipInfo.connected || appControlInfo.voipInfo.server[0] == 0 ? "DISCONNECT" : "LOGIN_TO_SERVER") );
		interface_addMenuEntryCustom((interfaceMenu_t*)&AccountMenu, interfaceMenuEntryText,
			str, strlen(str), appControlInfo.voipInfo.connected || appControlInfo.voipInfo.server[0] != 0,
			appControlInfo.voipInfo.connected || appControlInfo.voipInfo.server[0] == 0 ? voip_logoutFromServer : voip_reloginToServer,
			NULL, NULL, NULL, NULL, appControlInfo.voipInfo.connected ? thumbnail_account_active : thumbnail_account_inactive);
		snprintf(buf,MENU_ENTRY_INFO_LENGTH, "%s: %s", _T("SERVER"), appControlInfo.voipInfo.server[0] != 0 ? appControlInfo.voipInfo.server : _T("NONE") );
		interface_addMenuEntry((interfaceMenu_t*)&AccountMenu, buf, voip_toggleParam, (void*)PARAM_SERVER, thumbnail_account);
		if( appControlInfo.voipInfo.server[0] != 0 )
		{
			snprintf(buf,MENU_ENTRY_INFO_LENGTH, "%s: %s", _T("LOGIN"), appControlInfo.voipInfo.login);
			interface_addMenuEntry((interfaceMenu_t*)&AccountMenu, buf, voip_toggleParam, (void*)PARAM_LOGIN, thumbnail_account);
			snprintf(buf,MENU_ENTRY_INFO_LENGTH, "%s: ***", _T("PASSWORD")/*, appControlInfo.voipInfo.passwd*/);
			interface_addMenuEntry((interfaceMenu_t*)&AccountMenu, buf, voip_toggleParam, (void*)PARAM_PASSWD, thumbnail_account);
			/*snprintf(buf,MENU_ENTRY_INFO_LENGTH, "%s: %s", _T("REALM"), appControlInfo.voipInfo.realm);
			interface_addMenuEntry((interfaceMenu_t*)&AccountMenu, buf, voip_toggleParam, (void*)PARAM_REALM, thumbnail_account);*/
		}
	}

	if( appControlInfo.voipInfo.connected == 0 && appControlInfo.voipInfo.server[0] == 0 && interface_getSelectedItem((interfaceMenu_t*)&AccountMenu) == 0 )
	{
		interface_setSelectedItem((interfaceMenu_t*)&AccountMenu, MENU_ITEM_BACK);
	}

	interface_setMenuLogo((interfaceMenu_t*)&AccountMenu, appControlInfo.voipInfo.connected ? thumbnail_account_active : thumbnail_account_inactive, -1, 0, 0, 0);

	if( pArg != NULL || (interfaceInfo.currentMenu == (interfaceMenu_t*)&AccountMenu) )
	{
		interface_menuActionShowMenu(pMenu, (void*)&AccountMenu);
		interface_displayMenu(1);
	}

	return 0;
}
Exemplo n.º 5
0
static int menu_keyCallback(interfaceMenu_t *pMenu, pinterfaceCommandEvent_t cmd, void* pArg)
{
	switch (cmd->command)
	{
#ifdef ENABLE_FAVORITES
		case interfaceCommandBlue:
			interface_menuActionShowMenu(pMenu, &playlistMenu);
			return 0;
#endif
#ifdef ENABLE_PVR
		case interfaceCommandRecord:
			pvr_initPvrMenu(pMenu, SET_NUMBER(pvrJobTypeRTP));
			return 0;
#endif
		default:;
	}
	return 1;
}
Exemplo n.º 6
0
static int rtsp_play_callback(interfacePlayControlButton_t button, void *pArg)
{
	int which = CHANNEL_INFO_GET_SCREEN(pArg);
	//int streamNumber = CHANNEL_INFO_GET_CHANNEL(pArg);
	char url[MAX_URL];

	dprintf("%s: in %d\n", __FUNCTION__, button);

	if ( button == interfacePlayControlPrevious )
	{
		rtsp_startNextChannel(1, pArg);
	} else if ( button == interfacePlayControlNext )
	{
		rtsp_startNextChannel(0, pArg);
	} else if ( button == interfacePlayControlSetPosition )
	{
		double position = 0.0;
		if ( !appControlInfo.rtspInfo.active )
		{
			position					=	interface_playControlSliderGetPosition();
			appControlInfo.playbackInfo.scale = 1.0;
			rtsp_startVideo(which);
			gfx_setVideoProviderPosition(screenMain,position);
		} else
		{
			position	=	interface_playControlSliderGetPosition();
			if (gfx_videoProviderIsPaused(screenMain))
			{
				gfx_resumeVideoProvider(screenMain);
			}
			gfx_setVideoProviderPosition(screenMain,position);
			//appControlInfo.playbackInfo.scale = 1.0
			gfx_setSpeed(screenMain, appControlInfo.playbackInfo.scale);
			if( appControlInfo.playbackInfo.scale == 1.0 )
			{
				interface_notifyText(NULL, 0);
				interface_playControlSelect(interfacePlayControlPlay);
			} else
			{
				sprintf(url, "%1.0fx", appControlInfo.playbackInfo.scale);
				interface_notifyText(url, 0);
				interface_playControlSelect(appControlInfo.playbackInfo.scale > 0.0 ? interfacePlayControlFastForward : interfacePlayControlRewind);
			}
		}
		return 0;
	} else if ( button == interfacePlayControlPlay )
	{
		if ( !appControlInfo.rtspInfo.active )
		{
			appControlInfo.playbackInfo.scale = 1.0;
			rtsp_startVideo(which);
		} else
		{
			appControlInfo.playbackInfo.scale = 1.0;
			if (gfx_videoProviderIsPaused(screenMain))
			{
				gfx_resumeVideoProvider(screenMain);
			}
			gfx_setSpeed(screenMain, appControlInfo.playbackInfo.scale);
			interface_notifyText(NULL, 0);
			interface_playControlSelect(interfacePlayControlPlay);
		}
	} else if ( button == interfacePlayControlStop )
	{
		if ( appControlInfo.rtspInfo.active )
		{
			void *show_menu = NULL;
			switch (appControlInfo.playbackInfo.playlistMode)
			{
				case playlistModeIPTV: show_menu = (void*)&rtpStreamMenu; break;
				case playlistModeFavorites: show_menu = (void*)&playlistMenu; break;
#ifdef ENABLE_DLNA
				case playlistModeDLNA: show_menu = (void*)&BrowseServersMenu; break;
#endif
				default: show_menu = (void*)&rtspStreamMenu;
			}
			rtsp_stopVideo(which);
/*
#ifdef ENABLE_VIDIMAX
			dprintf("%s(stop): currentMenu %s\n", __FUNCTION__, interfaceInfo.currentMenu->name);
			if (interfaceInfo.currentMenu == (interfaceMenu_t*)&VidimaxMenu){
				show_menu = (void*)&VidimaxMenu;
			}
#endif
*/
			interface_menuActionShowMenu(interfaceInfo.currentMenu, show_menu);
			interface_showMenu(1, 1);
		}
	} else if ( button == interfacePlayControlPause )
	{
		if ( appControlInfo.rtspInfo.active )
		{
			if (gfx_videoProviderIsPaused(screenMain))
			{
				//appControlInfo.playbackInfo.scale = 1.0;
				gfx_resumeVideoProvider(screenMain);
				gfx_setSpeed(screenMain, appControlInfo.playbackInfo.scale);
				interface_playControlSelect(interfacePlayControlPlay);
			} else
			{
				eprintf("%s: gfx_stopVideoProvider...\n", __FUNCTION__);
				gfx_stopVideoProvider(screenMain, 0, 0);
				interface_playControlSelect(interfacePlayControlPause);
			}
		}
	} else if ( button == interfacePlayControlFastForward )
	{
		if ( !appControlInfo.rtspInfo.active )
		{
			rtsp_startVideo(which);
			gfx_setSpeed(screenMain, appControlInfo.playbackInfo.scale);
		} else
		{
			float newScale;

			if (gfx_videoProviderIsPaused(screenMain))
				gfx_resumeVideoProvider(screenMain);

			if( appControlInfo.playbackInfo.scale >= MAX_SCALE )
				newScale = 0.0;
			else if( appControlInfo.playbackInfo.scale > 0.0 )
				newScale = appControlInfo.playbackInfo.scale * 2;
			else if( appControlInfo.playbackInfo.scale < -2.0 )
				newScale = appControlInfo.playbackInfo.scale / 2;
			else
				newScale = 1.0;

			if( newScale != 0.0 && gfx_setSpeed(screenMain, newScale) == 0 )
				appControlInfo.playbackInfo.scale = newScale;
		}
		if( appControlInfo.playbackInfo.scale == 1.0 )
		{
			interface_notifyText(NULL, 0);
			interface_playControlSelect(interfacePlayControlPlay);
		} else
		{
			sprintf(url, "%1.0fx", appControlInfo.playbackInfo.scale);
			interface_notifyText(url, 0);
			interface_playControlSelect(appControlInfo.playbackInfo.scale > 0.0 ? interfacePlayControlFastForward : interfacePlayControlRewind);
		}
	} else if ( button == interfacePlayControlRewind )
	{
		if ( !appControlInfo.rtspInfo.active )
		{
			rtsp_startVideo(which);
			gfx_setSpeed(screenMain, appControlInfo.playbackInfo.scale);
		} else
		{
			float newScale;

			if (gfx_videoProviderIsPaused(screenMain))
				gfx_resumeVideoProvider(screenMain);

			if( appControlInfo.playbackInfo.scale >= 2.0 )
				newScale = appControlInfo.playbackInfo.scale / 2;
			else if( appControlInfo.playbackInfo.scale > 0.0 )
				newScale = -2.0;
			else if( appControlInfo.playbackInfo.scale > -MAX_SCALE )
				newScale = appControlInfo.playbackInfo.scale * 2;
			else
				newScale = 0.0;

			if( newScale != 0.0 && gfx_setSpeed(screenMain, newScale) == 0 )
				appControlInfo.playbackInfo.scale = newScale;
		}
		if( appControlInfo.playbackInfo.scale == 1.0 )
		{
			interface_notifyText(NULL, 0);
			interface_playControlSelect(interfacePlayControlPlay);
		} else
		{
			sprintf(url, "%1.0fx", appControlInfo.playbackInfo.scale);
			interface_notifyText(url, 0);
			interface_playControlSelect(appControlInfo.playbackInfo.scale > 0.0 ? interfacePlayControlFastForward : interfacePlayControlRewind);
		}
	} else if (button == interfacePlayControlInfo)
	{
		interface_playControlSliderEnable(!interface_playControlSliderIsEnabled());
		interface_displayMenu(1);
		return 0;
	} else if (button == interfacePlayControlAddToPlaylist)
	{
		sprintf(url,"rtsp://%s:%d/%s",
			stream_info.ip,
			stream_info.port,
			stream_info.streamname);
		playlist_addUrl(url, stream_info.streamname);
	} else if(button == interfacePlayControlMode && appControlInfo.playbackInfo.playlistMode == playlistModeIPTV && appControlInfo.rtpMenuInfo.epg[0] != 0 )
	{
		rtp_showEPG(which, rtsp_setupPlayControl);
	} else
	{
		// default action
		return 1;
	}

	interface_displayMenu(1);

	dprintf("%s: done\n", __FUNCTION__);

	return 0;
}
Exemplo n.º 7
0
int voip_fillMenu(interfaceMenu_t *pMenu, void *pArg)
{
	char *str;
	char buffer[MENU_ENTRY_INFO_LENGTH];
	int redial_available = 0;
	menuActionFunction pAction;
	int show = (int)pArg;

	interface_clearMenuEntries((interfaceMenu_t*)&VoIPMenu);

	if(appControlInfo.voipInfo.active)
	{
		switch(appControlInfo.voipInfo.status)
		{
			case voipStatus_incoming: str = _T("ANSWER_CALL"); pAction = voip_answerCall; break;
			case voipStatus_dialing:
			case voipStatus_talking:  str = _T("HANGUP");      pAction = voip_hangup; break;
			default: str = _T("DIAL"); pAction = voip_enterURI;
		}
		interface_addMenuEntry((interfaceMenu_t*)&VoIPMenu, str, pAction, NULL, thumbnail_dial);
#ifdef ENABLE_VOIP_CONFERENCE
		if (appControlInfo.voipInfo.status == voipStatus_talking)
		{
			str = _T("DIAL_CONFERENCE");
			interface_addMenuEntry((interfaceMenu_t*)&VoIPMenu, str,voip_enterURI, NULL, thumbnail_dial);
		}
#endif
		if( appControlInfo.voipInfo.lastSip[4] != 0 )
		{
			sprintf(buffer,"%s (%s)",_T("REDIAL"), appControlInfo.voipInfo.lastSip);
			str = buffer;
			redial_available = appControlInfo.voipInfo.status == voipStatus_idle;
		} else
		{
			str = _T("REDIAL");
		}
		interface_addMenuEntryCustom((interfaceMenu_t*)&VoIPMenu, interfaceMenuEntryText, str, strlen(str)+1, redial_available, voip_dialNumber, NULL, NULL, NULL, (void*)ENTRY_INFO_SET(-1,LAST_DIALED), thumbnail_redial);
	
		str = _T("ADDRESS_BOOK");
		interface_addMenuEntry((interfaceMenu_t*)&VoIPMenu, str, voip_fillAddressBookMenu, NULL, thumbnail_address_book);
		str = _T("MISSED_CALLS");
		interface_addMenuEntry((interfaceMenu_t*)&VoIPMenu, str, voip_fillMissedCallsMenu, NULL, thumbnail_missed_calls);
		str = _T("ANSWERED_CALLS");
		interface_addMenuEntry((interfaceMenu_t*)&VoIPMenu, str, voip_fillAnsweredCallsMenu, NULL, thumbnail_answered_calls);
		str = _T("DIALED_NUMBERS");
		interface_addMenuEntry((interfaceMenu_t*)&VoIPMenu, str, voip_fillDialedNumbersMenu, NULL, thumbnail_dialed_numbers);
		str = _T("ACCOUNT");
		interface_addMenuEntry((interfaceMenu_t*)&VoIPMenu, str, voip_fillAccountMenu, (void*)-1, appControlInfo.voipInfo.connected ? thumbnail_account_active : thumbnail_account_inactive);
	} else
	{
		voip_init();

		if(appControlInfo.voipInfo.active)
			return voip_fillMenu(pMenu, pArg);

		/*str = _T("RECONNECT");
		interface_addMenuEntry((interfaceMenu_t*)&VoIPMenu, interfaceMenuEntryText, str, strlen(str), 1, voip_enterURI, NULL, NULL, NULL, thumbnail_dial);*/
		str = _T("VOIP_UNAVAILABLE");
		interface_addMenuEntryDisabled((interfaceMenu_t*)&VoIPMenu, str, -1);
	}
	if( show || interfaceInfo.currentMenu == (interfaceMenu_t*)&VoIPMenu )
	{
		interface_menuActionShowMenu(pMenu, (void*)&VoIPMenu);
	}	
	return 0;
}