DWORD WINAPI Run(LPVOID args)
{
	getchar();
	ILibStopChain(MR_RendererChain);
	CodecWrapper_UnInit();
	return 0;
}
DWORD WINAPI Run(LPVOID args)
{
	//getche();
	STBS_Run();
	ILibStopChain(StbChain);
	return 0;
}
void BreakSink(int s)
{
	UNREFERENCED_PARAMETER( s );

	signal(SIGINT, SIG_IGN);	// To ignore any more ctrl c interrupts
	
	ILibStopChain(chain); // Shutdown the Chain
}
void CMediaBrowserPPCDlg::OnClose() 
{
	if (ExitFlag == true)
	{
		CDialog::OnClose();
	}
	else
	{
		ILibStopChain(chain);
	}
}
BOOL CtrlHandler( DWORD fdwCtrlType ) 
{
	switch( fdwCtrlType ) 
	{ 
		// Handle the CTRL-C signal. 
		case CTRL_C_EVENT: 
		case CTRL_BREAK_EVENT: 
			mDataChannel = NULL;
			ILibStopChain(chain); // Shutdown the chain
			return( TRUE );
		default: 
			return FALSE; 
	} 
}
// PRIVATE - Called by the chaining system to clean up. Usualy called before the
// application is terminated.
void RemoteIODestroyChain(void* object)
{
	struct RIODataObject* remoteio = (struct RIODataObject*)object;
	ILibStopChain(remoteio->WorkerChain);

#ifdef _WIN32_WCE
	WaitForSingleObject(RIO->WorkerThread,INFINITE);
#elif WIN32
	WaitForSingleObject(RIO->WorkerThread,INFINITE);
#elif _POSIX
	pthread_join(RIO->WorkerThread,NULL);
#endif

	UpnpRemoteIOClient_ChannelManager_ClearAllChannels(NULL);	
	if(RIO->PeerConnection!=NULL) {free(RIO->PeerConnection);}

	RemoteIO_RefCounter--;
	if (RemoteIO_RefCounter == 0) sem_destroy(&RemoteIOLock);	
}
Example #7
0
	__declspec(dllexport) void ILibWrapper_StopChain(void *chain)
	{
		ILibStopChain(chain);
	}
Example #8
0
//
//  FUNCTION: WndProc(HWND, unsigned, WORD, LONG)
//
//  PURPOSE:  Processes messages for the main window.
//
//  WM_COMMAND	- process the application menu
//  WM_PAINT	- Paint the main window
//  WM_DESTROY	- post a quit message and return
//
//
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	HDC hdc;
	int wmId, wmEvent;
	PAINTSTRUCT ps;
	wchar_t* str;
	wchar_t* s;
	HBRUSH brush;
	COLORREF color;

	switch (message) 
	{
		case WM_COMMAND:
			wmId    = LOWORD(wParam); 
			wmEvent = HIWORD(wParam); 
			// Parse the menu selections:
			switch (wmId)
			{	
				case IDM_HELP_ABOUT:
					DialogBox(g_hInst, (LPCTSTR)IDD_ABOUTBOX, hWnd, (DLGPROC)About);
				    break;
				case IDOK:
				case IDM_EXIT:
					SendMessage(hWnd, WM_CLOSE, 0, 0);
					break;
				case ID_FILE_TOGGLESWITCH:
					SwitchPower = !SwitchPower;
					InvalidateRect(hWndMainWindow,NULL,false);
					UPnPSetState_SwitchPower_Status(UPnPmicroStack,SwitchPower);
					break;
				case ID_FILE_DIMMERUP:
					DimmingService += 20;
					if (DimmingService > 100) DimmingService = 100;
					InvalidateRect(hWndMainWindow,NULL,false);
					UPnPSetState_DimmingService_LoadLevelStatus(UPnPmicroStack,DimmingService);
					break;
				case ID_FILE_DIMMERDOWN:
					DimmingService -= 20;
					if (DimmingService < 0) DimmingService = 0;
					InvalidateRect(hWndMainWindow,NULL,false);
					UPnPSetState_DimmingService_LoadLevelStatus(UPnPmicroStack,DimmingService);
					break;
				default:
				   return DefWindowProc(hWnd, message, wParam, lParam);
			}
			break;
		case WM_CLOSE:
			ILibStopChain(UPnPmicroStackChain);
			break;
		case WM_CREATE:
			g_hwndCB = CreateRpCommandBar(hWnd);
            // Initialize the shell activate info structure
            memset (&s_sai, 0, sizeof (s_sai));
            s_sai.cbSize = sizeof (s_sai);
			UPnPThread = CreateThread(NULL, 0, &UPnPMain, 0, 0, NULL ); 
			break;
		case WM_PAINT:
			RECT rt;

			hdc = BeginPaint(hWnd, &ps);

			color = RGB(128,128,128);
			if (SwitchPower == true)
			{
				color = RGB(128+DimmingService,128+DimmingService,128-DimmingService);
			}

			GetClientRect(hWnd, &rt);
			brush = CreateSolidBrush(color);
			SetBkColor(hdc,color);
			FillRect(hdc,&rt,brush);
			DeleteObject(brush);

			if (SwitchPower == true) s = TEXT("ON"); else s = TEXT("OFF");
			str = (unsigned short*)malloc(400);
			swprintf(str,TEXT("Power %s, Dimmer %d"),s,DimmingService);
			DrawText(hdc, str, -1, &rt, DT_SINGLELINE | DT_VCENTER | DT_CENTER);
			free(str);

			EndPaint(hWnd, &ps);
			break; 
		case WM_DESTROY:
			CommandBar_Destroy(g_hwndCB);
			PostQuitMessage(0);
			break;
		case WM_ACTIVATE:
            // Notify shell of our activate message
			SHHandleWMActivate(hWnd, wParam, lParam, &s_sai, FALSE);
     		break;
		case WM_SETTINGCHANGE:
			SHHandleWMSettingChange(hWnd, wParam, lParam, &s_sai);
     		break;
		default:
			return DefWindowProc(hWnd, message, wParam, lParam);
   }
   return 0;
}
Example #9
0
DWORD WINAPI Run(LPVOID args)
{
	getchar();
	ILibStopChain(UpnpmicroStackChain);
	return 0;
}
Example #10
0
/*
 *	This method executes when somebody does CTRL-BREAK.
 */
void BreakSink(int s)
{
	ILibStopChain(UpnpMicroStackChain);
}
void BreakSink(int s)
{
	ILibStopChain(StbChain);
}
/* Calling RNDStopCP() will cause the Control Point thread to fall out after clean up */
DWORD WINAPI Run(LPVOID args)
{
	getchar();
	ILibStopChain(RND_CP_chain);
	return 0;
}
Example #13
0
//
//  FUNCTION: WndProc(HWND, unsigned, WORD, LONG)
//
//  PURPOSE:  Processes messages for the main window.
//
//  WM_COMMAND	- process the application menu
//  WM_PAINT	- Paint the main window
//  WM_DESTROY	- post a quit message and return
//
//
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	int wmId, wmEvent,i;
	PAINTSTRUCT ps;
	HDC hdc;
	char* str[100];
	RECT rt;

	switch (message) 
	{
	case WM_COMMAND:
		wmId    = LOWORD(wParam); 
		wmEvent = HIWORD(wParam); 
		// Parse the menu selections:
		switch (wmId)
		{
		case IDM_ABOUT:
			DialogBox(hInst, (LPCTSTR)IDD_ABOUTBOX, hWnd, (DLGPROC)About);
			break;
		case IDM_EXIT:
			ILibStopChain(TheChain);
			break;
		default:
			return DefWindowProc(hWnd, message, wParam, lParam);
		}
		break;
	case WM_PAINT:

		// Paint the complete screen here. Quite workout to get the UI looking
		// event half decent using Win32 directly.
		hdc = BeginPaint(hWnd, &ps);
		GetClientRect(hWndMainWindow, &rt);

		// Paint the top portion of the screen
		RECT r;
		r.left = 1;
		r.right = rt.right-1;
		r.top = 0;
		r.bottom = 40;
		FillRect(hdc,&r,GetSysColorBrush(COLOR_SCROLLBAR));
		DrawEdge(hdc,&r,EDGE_RAISED,BF_RECT);
		DrawIcon(hdc,8,5,HICON_MEDIASERVER2);
		SetBkColor(hdc,GetSysColor(COLOR_SCROLLBAR));

		// Paint the title
		r.left = 50;
		r.right = rt.right-1;
		r.top = 4;
		r.bottom = 50;
		DrawText(hdc,TEXT("Intel Micro Media Server"),-1,&r,0);

		// Paint the transfer count stat label & value
		r.left = 50;
		r.right = rt.right-1;
		r.top = 20;
		r.bottom = 50;
		if (MmsCurrentTransfersCount == 0)
		{
			DrawText(hdc,TEXT("No File Transfers          "),-1,&r,0);
		}
		if (MmsCurrentTransfersCount == 1)
		{
			DrawText(hdc,TEXT("1 File Transfer          "),-1,&r,0);
		}
		if (MmsCurrentTransfersCount > 1)
		{
			sprintf((char*)str,"%d File Transfers        ",MmsCurrentTransfersCount);
			DrawText(hdc,(LPCSTR)str,-1,&r,0);
		}

		// Paint the main portion of the screen
		r.left = 1;
		r.right = rt.right-1;
		r.top = 42;
		r.bottom = 267;
		FillRect(hdc,&r,GetSysColorBrush(COLOR_SCROLLBAR));

		// Paint global media server stats labels
		r.left = 8;
		r.right = 150;
		r.top = 50;
		r.bottom = 70;
		DrawText(hdc,TEXT("Browse Requests"),-1,&r,0);
		r.left = 8;
		r.right = 150;
		r.top = 70;
		r.bottom = 90;
		DrawText(hdc,TEXT("HTTP Requests"),-1,&r,0);

		// Paint global media server stats values
		sprintf((char*)str,"%d",MmsBrowseCount);
		r.left = 180;
		r.right = rt.right-5;
		r.top = 50;
		r.bottom = 70;
		DrawText(hdc,(LPCSTR)str,-1,&r,DT_RIGHT);
		sprintf((char*)str,"%d",MmsHttpRequestCount);
		r.left = 180;
		r.right = rt.right-5;
		r.top = 70;
		r.bottom = 90;
		DrawText(hdc,(LPCSTR)str,-1,&r,DT_RIGHT);

		// Paint the transfer window edge
		r.left = 2;
		r.right = rt.right-1;
		r.top = 94;
		r.bottom = 264;
		DrawEdge(hdc,&r,EDGE_SUNKEN,BF_RECT);

		// Paint the white transfer window
		r.left = 4;
		r.right = rt.right-5;
		r.top = 96;
		r.bottom = 262;
		FillRect(hdc,&r,GetSysColorBrush(COLOR_MENU));

		// Draw all of the active transfers on the screen (up to 5)
		for (i=0;i<5;i++)
		{
			DrawTransferInfo(hdc,i,g_DownloadStatsMapping[i]);
		}

		EndPaint(hWnd, &ps);
		break;
	case WM_CREATE:
		// Clear up all of the active transfers.
		for (i=0;i<DOWNLOAD_STATS_ARRAY_SIZE;i++) {g_DownloadStatsMapping[i] = -1;}

		// Load all of the icon resources we will need to draw the UI.
		HICON_MEDIASERVER  = LoadIcon(g_hInst, (LPCTSTR)IDI_MEDIASERVER);
		HICON_MEDIASERVER2 = LoadIcon(g_hInst, (LPCTSTR)IDI_MEDIASERVER2);
		HICON_RIGHTARROW   = LoadIcon(g_hInst, (LPCTSTR)IDI_RIGHTARROW);
		HICON_LEFTARROW    = LoadIcon(g_hInst, (LPCTSTR)IDI_LEFTARROW);

		CreateThread(NULL, 0, &UPnPMain, hWnd, 0, NULL ); 
		break;
	case WM_CLOSE:
		ILibStopChain(TheChain);
		break;
	case WM_DESTROY:
		PostQuitMessage(0);
		break;
	default:
		return DefWindowProc(hWnd, message, wParam, lParam);
	}
	return 0;
}
Example #14
0
void CAirPlayServer::Stop()
{
    ILibStopChain(MicroStackChain);
}
/*
 *	This method executes when somebody does CTRL-BREAK.
 */
void BreakSink(int s)
{
	ILibStopChain(MR_RendererChain);
}
Example #16
0
void BreakSink(int s)
{
	ILibStopChain(UPnPmicroStackChain);
}
//
//  FUNCTION: WndProc(HWND, unsigned, WORD, LONG)
//
//  PURPOSE:  Processes messages for the main window.
//
//  WM_COMMAND	- process the application menu
//  WM_PAINT	- Paint the main window
//  WM_DESTROY	- post a quit message and return
//
//
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	HDC hdc;
	int wmId, wmEvent;
	PAINTSTRUCT ps;
	unsigned short* str[100];
	RECT rt;
	int i;

	switch (message) 
	{
		case WM_COMMAND:
			wmId    = LOWORD(wParam); 
			wmEvent = HIWORD(wParam); 
			// Parse the menu selections:
			switch (wmId)
			{	
				case IDM_HELP_ABOUT:
					DialogBox(g_hInst, (LPCTSTR)IDD_ABOUTBOX, hWnd, (DLGPROC)About);
				    break;
				case IDOK:
					SendMessage(hWnd, WM_ACTIVATE, MAKEWPARAM(WA_INACTIVE, 0), (LPARAM)hWnd);
					SendMessage(hWnd, WM_CLOSE, 0, 0);
					break;
				case ID_TOOLS_EXIT:
					ILibStopChain(TheChain);
					break;
				default:
				   return DefWindowProc(hWnd, message, wParam, lParam);
			}
			break;
		case WM_CREATE:
			g_hwndCB = CreateRpCommandBar(hWnd); // Initialize the shell activate info structure

			// Clear up all of the active transfers.
			for (i=0;i<10;i++) {g_DownloadStatsMapping[i] = -1;}

			// Load all of the icon resources we will need to draw the UI.
			HICON_MEDIASERVER  = LoadIcon(g_hInst, (LPCTSTR)IDI_MEDIASERVER);
			HICON_MEDIASERVER2 = LoadIcon(g_hInst, (LPCTSTR)IDI_MEDIASERVER2);
			HICON_RIGHTARROW   = LoadIcon(g_hInst, (LPCTSTR)IDI_RIGHTARROW);
			HICON_LEFTARROW    = LoadIcon(g_hInst, (LPCTSTR)IDI_LEFTARROW);

			// Create the Micro Media Server thread. This thread will exist for
			// the duration of the application and will be owned by the media
			// server library.
			CreateThread(NULL, 0, &UPnPMain, 0, 0, NULL ); 

            memset (&s_sai, 0, sizeof (s_sai));
            s_sai.cbSize = sizeof (s_sai);

			break;
		case WM_PAINT:
		
			// Paint the complete screen here. Quite workout to get the UI looking
			// event half decent using Win32 directly.
			GetClientRect(hWndMainWindow, &rt);
			hdc = BeginPaint(hWnd, &ps);
			
			// Paint the top portion of the screen
			RECT r;
			r.left = 1;
			r.right = rt.right-1;
			r.top = 0;
			r.bottom = 40;
			FillRect(hdc,&r,GetSysColorBrush(COLOR_SCROLLBAR));
			DrawEdge(hdc,&r,EDGE_RAISED,BF_RECT);
			DrawIcon(hdc,8,5,HICON_MEDIASERVER2);
			SetBkColor(hdc,GetSysColor(COLOR_SCROLLBAR));
			
			// Paint the title
			r.left = 50;
			r.right = rt.right-1;
			r.top = 4;
			r.bottom = 50;
			DrawText(hdc,TEXT("Intel Micro Media Server"),-1,&r,0);

			// Paint the transfer count stat label & value
			r.left = 50;
			r.right = rt.right-1;
			r.top = 20;
			r.bottom = 50;
			if (MmsCurrentTransfersCount == 0)
			{
				DrawText(hdc,TEXT("No File Transfers          "),-1,&r,0);
			}
			if (MmsCurrentTransfersCount == 1)
			{
				DrawText(hdc,TEXT("1 File Transfer          "),-1,&r,0);
			}
			if (MmsCurrentTransfersCount > 1)
			{
				wsprintf((unsigned short*)str,TEXT("%d File Transfers        "),MmsCurrentTransfersCount);
				DrawText(hdc,(unsigned short*)str,-1,&r,0);
			}

			// Paint the main portion of the screen
			r.left = 1;
			r.right = rt.right-1;
			r.top = 42;
			r.bottom = 267;
			FillRect(hdc,&r,GetSysColorBrush(COLOR_SCROLLBAR));

			// Paint global media server stats labels
			r.left = 8;
			r.right = 150;
			r.top = 50;
			r.bottom = 70;
			DrawText(hdc,TEXT("Browse Requests"),-1,&r,0);
			r.left = 8;
			r.right = 150;
			r.top = 70;
			r.bottom = 90;
			DrawText(hdc,TEXT("HTTP Requests"),-1,&r,0);

			// Paint global media server stats values
			wsprintf((unsigned short*)str,TEXT("%d"),MmsBrowseCount);
			r.left = 180;
			r.right = rt.right-5;
			r.top = 50;
			r.bottom = 70;
			DrawText(hdc,(unsigned short*)str,-1,&r,DT_RIGHT);
			wsprintf((unsigned short*)str,TEXT("%d"),MmsHttpRequestCount);
			r.left = 180;
			r.right = rt.right-5;
			r.top = 70;
			r.bottom = 90;
			DrawText(hdc,(unsigned short*)str,-1,&r,DT_RIGHT);

			// Paint the transfer window edge
			r.left = 2;
			r.right = rt.right-1;
			r.top = 94;
			r.bottom = 264;
			DrawEdge(hdc,&r,EDGE_SUNKEN,BF_RECT);

			// Paint the white transfer window
			r.left = 4;
			r.right = rt.right-5;
			r.top = 96;
			r.bottom = 262;
			FillRect(hdc,&r,GetSysColorBrush(COLOR_MENU));

			// Draw all of the active transfers on the screen (up to 5)
			for (i=0;i<5;i++)
			{
				DrawTransferInfo(hdc,i,g_DownloadStatsMapping[i]);
			}

			EndPaint(hWnd, &ps);
			break;

		case WM_CLOSE:
			ILibStopChain(TheChain);
			break;
		case WM_DESTROY:
			DestroyIcon(HICON_MEDIASERVER);
			DestroyIcon(HICON_MEDIASERVER2);
			DestroyIcon(HICON_RIGHTARROW);
			DestroyIcon(HICON_LEFTARROW);
			CommandBar_Destroy(g_hwndCB);
			PostQuitMessage(0);
			break;
		case WM_ACTIVATE:
            // Notify shell of our activate message
			SHHandleWMActivate(hWnd, wParam, lParam, &s_sai, FALSE);
     		break;
		case WM_SETTINGCHANGE:
			SHHandleWMSettingChange(hWnd, wParam, lParam, &s_sai);
     		break;
		default:
			return DefWindowProc(hWnd, message, wParam, lParam);
   }
   return 0;
}