Beispiel #1
0
static int youtube_keyCallback(interfaceMenu_t *pMenu, pinterfaceCommandEvent_t cmd, void* pArg)
{
	int selectedIndex = interface_getSelectedItem((interfaceMenu_t*)&YoutubeMenu);
	char url[YOUTUBE_LINK_SIZE];
	if (selectedIndex > 0 )
	{
		switch( cmd->command )
		{
			case interfaceCommandGreen:
				snprintf(url, sizeof(url), "http://www.youtube.com/watch?v=%s", youtubeInfo.videos[selectedIndex-1].video_id);
				eprintf("Youtube: Stream %02d: '%s'\n", selectedIndex-1, url);
				interface_showMessageBox(url, -1, 0);
				return 0;
#ifdef ENABLE_FAVORITES
			case interfaceCommandYellow:
				char description[MENU_ENTRY_INFO_LENGTH];
				interface_getMenuEntryInfo( (interfaceMenu_t*)&YoutubeMenu, selectedIndex, description, sizeof(description) );
				snprintf(url, sizeof(url), "http://www.youtube.com/watch?v=%s", youtubeInfo.videos[selectedIndex-1].video_id);
				eprintf("Youtube: Add to Playlist '%s'\n", url);
				playlist_addUrl( url, description );
				return 0;
				
				break;
#endif
			default:;
		}
	}
	return 1;
}
Beispiel #2
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;
}
Beispiel #3
0
static int rtsp_keyCallback(interfaceMenu_t *pMenu, pinterfaceCommandEvent_t cmd, void* pArg)
{
	unsigned int streamNumber;
	char URL[MAX_URL];

	if( cmd->command == interfaceCommandBlue )
	{
		rtsp_enterURL(pMenu, (void*)screenMain);
		return 0;
	}

	if(pMenu->selectedItem < 0)
	{
		return 1;
	}

	streamNumber = CHANNEL_INFO_GET_CHANNEL(pArg);

	if (GET_NUMBER(pArg) >= 0)
	{
		if (cmd->command == interfaceCommandYellow || cmd->command == interfaceCommandGreen)
		{
			if ( pstream_head == NULL ) {
				int ret=get_rtsp_streams(ppstream_head);
				if (ret != 0 || pstream_head == NULL) {
					eprintf("%s: Failed to find default stream\n", __FUNCTION__);
					interface_showMessageBox(_T("ERR_DEFAULT_STREAM"), thumbnail_warning, 0);
					return 0;
				}
			}
			streams_struct* stream_ptr = get_stream(streamNumber);
			if ( !stream_ptr ) {
				interface_showMessageBox(_T("ERR_STREAM_IN_LIST"), thumbnail_error, 0);
				eprintf("RTSP: Stream number not found in linked list\n");
				return 0;
			}

			sprintf(URL, "rtsp://%s:%d/%s", appControlInfo.rtspInfo.streamIP, appControlInfo.rtspInfo.RTSPPort, stream_ptr->stream);
			if( cmd->command == interfaceCommandYellow )
			{
				eprintf("RTSP: Add to Playlist '%s'\n",URL);
				playlist_addUrl(URL, stream_ptr->name ? stream_ptr->name : stream_ptr->stream);
			} else if (cmd->command == interfaceCommandGreen ||
			           cmd->command == interfaceCommandInfo)
			{
				eprintf("RTSP: Stream %03d: '%s'\n", streamNumber, URL);
				if( stream_ptr->poster && stream_ptr->poster[0] )
				{
					interface_showPosterBox( stream_ptr->description,
					                         stream_ptr->name ? stream_ptr->name : stream_ptr->stream,
					                         INTERFACE_BORDER_RED, INTERFACE_BORDER_GREEN, INTERFACE_BORDER_BLUE, INTERFACE_BORDER_ALPHA,
					                         thumbnail_vod,
					                         stream_ptr->poster, NULL, SET_NUMBER(streamNumber));
				}
				//interface_showMessageBox(URL, thumbnail_info, 0);
			}
			return 0;
		}
	}

	return 1;
}