예제 #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;
}
예제 #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;
}
예제 #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;
}
예제 #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;
}
예제 #5
0
static int get_rtsp_streams(streams_struct **ppstream_head)
{
	int ret;
	int i = 0;
	char buf[PATH_MAX];

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

	if ( pstream_head != NULL && *ppstream_head != NULL )
	{
		interface_clearMenuEntries(_M &rtspStreamMenu); // don't leave thumb pointers to previous streams!
		clean_list(*ppstream_head);
		*ppstream_head = NULL;
	}

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

	ret = find_streams(ppstream_head);

	if ( !((ret == 0)&&(pstream_head != NULL)) )
	{
		int file;

		dprintf("%s: open %s\n", __FUNCTION__, appControlInfo.rtspInfo.streamFile);

		file = open(appControlInfo.rtspInfo.streamFile, O_RDONLY);

		if ( file > 0 )
		{
			while ( helperReadLine(file, buf) == 0 )
			{
				if ( strlen(buf) > 0 )
				{
					add_stream(ppstream_head, buf, i);
				}
				i++;
			}
		}
		ret = file;
	}

	return ret;
}
예제 #6
0
static int youtube_fillMenu( interfaceMenu_t* pMenu, void *pArg )
{
	int i;
	char *str;
	int page = (int) pArg;
	char url[64+MAX_FIELD_PATTERN_LENGTH];
	
	if(page == 1)
	{
		interface_clearMenuEntries( (interfaceMenu_t*)&YoutubeMenu );

		str = _T("VIDEO_SEARCH");
		interface_addMenuEntry( (interfaceMenu_t*)&YoutubeMenu, str, youtube_videoSearch, NULL, thumbnail_search );

		youtubeInfo.count = 0;
		youtubeInfo.index = 0;
	}

	if( youtubeInfo.search[0] == 0 )
		//snprintf(url, sizeof(url), "http://gdata.youtube.com/feeds/api/standardfeeds/recently_featured?format=5&max-results=%d&start-index=%d", YOUTUBE_LINKS_PER_PAGE, (page-1)*YOUTUBE_LINKS_PER_PAGE+1);
		snprintf(url, sizeof(url), "http://gdata.youtube.com/feeds/api/standardfeeds/top_rated?time=today&format=5&max-results=%d&start-index=%d", YOUTUBE_LINKS_PER_PAGE, (page-1)*YOUTUBE_LINKS_PER_PAGE+1);
	else
		//snprintf(url, sizeof(url), "http://gdata.youtube.com/feeds/api/videos?format=5&max-results=%d&start-index=%d&vq=%s", YOUTUBE_LINKS_PER_PAGE, (page-1)*YOUTUBE_LINKS_PER_PAGE+1, youtubeInfo.search);
		snprintf(url, sizeof(url), "http://gdata.youtube.com/feeds/api/videos?format=5&max-results=%d&start-index=%d&q=%s", YOUTUBE_LINKS_PER_PAGE, (page-1)*YOUTUBE_LINKS_PER_PAGE+1, youtubeInfo.search);

	youtube_getVideoList(url, youtube_addMenuEntry, page);

	if(( youtubeInfo.count == 0 ) && ( page == 1 ))
	{
		str = _T("NO_MOVIES");
		interface_addMenuEntryDisabled( (interfaceMenu_t*)&YoutubeMenu, str, thumbnail_info );
	}

	if(( youtubeInfo.search[0] == 0 ) && ( page == 1 ))
	{
		pthread_create(&youtubeInfo.search_thread, NULL, youtube_MenuVideoSearchThread, NULL);
		pthread_detach(youtubeInfo.search_thread);
	}

	return 0;
}
예제 #7
0
static int rtsp_displayStreamMenu(void* pArg)
{
	char channelEntry[MENU_ENTRY_INFO_LENGTH];
	streams_struct* stream_ptr=NULL;
	int which = GET_NUMBER(pArg);
	interfaceMenu_t *rtspMenu = (interfaceMenu_t*)&rtspStreamMenu;

	interface_clearMenuEntries(rtspMenu);
	interface_showLoadingAnimation();

	int streamNumber = 0;
	for (stream_ptr = pstream_head; stream_ptr != NULL; stream_ptr = stream_ptr->next)
	{
		sprintf(channelEntry, "%d: %s", streamNumber+1, stream_ptr->name ? stream_ptr->name : stream_ptr->stream);

		int entryIndex = interface_addMenuEntry(rtspMenu, channelEntry, rtsp_stream_change, CHANNEL_INFO_SET(which, streamNumber), thumbnail_vod) - 1;
		interface_setMenuEntryImage(rtspMenu, entryIndex, stream_ptr->thumb);
		//dprintf("%s: Compare current %s\n", __FUNCTION__, channelEntry);
		if ( strcmp(stream_info.ip, appControlInfo.rtspInfo.streamIP) == 0 && 
		     strcmp(stream_info.streamname, stream_ptr->stream) == 0 )
		{
			interface_setSelectedItem(rtspMenu, streamNumber);
		}
		streamNumber++;
	}

	if (streamNumber == 0)
	{
		char *str;
		str = _T("NO_MOVIES");
		interface_addMenuEntryDisabled(rtspMenu, str, thumbnail_info);
	}

	interface_hideLoadingAnimation();
	interface_displayMenu(1);

	return 0;
}
예제 #8
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;
}