Esempio n. 1
0
QTSS_Error ProcessRTSPRequest(QTSS_StandardRTSP_Params* inParams)
{
    QTSS_RTSPMethod* theMethod = NULL;
    UInt32 theMethodLen = 0;
    if ((QTSS_GetValuePtr(inParams->inRTSPRequest, qtssRTSPReqMethod, 0,
            (void**)&theMethod, &theMethodLen) != QTSS_NoErr) || (theMethodLen != sizeof(QTSS_RTSPMethod)))
    {
        Assert(0);
        return QTSS_RequestFailed;
    }
    
    switch (*theMethod)
    {
        case qtssDescribeMethod:
            return DoDescribe(inParams);
        case qtssSetupMethod:
            return DoSetup(inParams);
        case qtssPlayMethod:
            return DoPlay(inParams);
        case qtssTeardownMethod:
            // Tell the server that this session should be killed, and send a TEARDOWN response
            (void)QTSS_Teardown(inParams->inClientSession);
            (void)QTSS_SendStandardRTSPResponse(inParams->inRTSPRequest, inParams->inClientSession, 0);
            break;
        case qtssPauseMethod:
            (void)QTSS_Pause(inParams->inClientSession);
            (void)QTSS_SendStandardRTSPResponse(inParams->inRTSPRequest, inParams->inClientSession, 0);
            break;
        default:
            break;
    }           

    return QTSS_NoErr;
}
Esempio n. 2
0
 /// \brief Prepares the module for rendering.  This method is only
 /// called once and is always called before Render is called.
 void RenderModule::Setup(SceneView* view)
 {
   if (m_flags.test(eSetupRequired))
   {
     DoSetup(view);
     m_flags.reset(eSetupRequired);
   }
 }
QTSS_Error ProcessRTSPRequest(QTSS_StandardRTSP_Params* inParams)
{
    QTSS_RTSPMethod* theMethod = NULL;

	UInt32 theLen = 0;
    if ((QTSS_GetValuePtr(inParams->inRTSPRequest, qtssRTSPReqMethod, 0,
            (void**)&theMethod, &theLen) != QTSS_NoErr) || (theLen != sizeof(QTSS_RTSPMethod)))
    {
        Assert(0);
        return QTSS_RequestFailed;
    }

    if (*theMethod == qtssDescribeMethod)
        return DoDescribe(inParams);
    if (*theMethod == qtssSetupMethod)
        return DoSetup(inParams);
        
    RTPSessionOutput** theOutput = NULL;
    QTSS_Error theErr = QTSS_GetValuePtr(inParams->inClientSession, sOutputAttr, 0, (void**)&theOutput, &theLen);
    if ((theErr != QTSS_NoErr) || (theLen != sizeof(RTPSessionOutput*))) // a broadcaster push session
    {   if (*theMethod == qtssPlayMethod || *theMethod == qtssRecordMethod)
            return DoPlay(inParams, NULL);
        else
            return QTSS_RequestFailed;
    }

    switch (*theMethod)
    {
        case qtssPlayMethod:
            return DoPlay(inParams, (*theOutput)->GetReflectorSession());
        case qtssTeardownMethod:
            // Tell the server that this session should be killed, and send a TEARDOWN response
            (void)QTSS_Teardown(inParams->inClientSession);
            (void)QTSS_SendStandardRTSPResponse(inParams->inRTSPRequest, inParams->inClientSession, 0);
            break;
        case qtssPauseMethod:
            (void)QTSS_Pause(inParams->inClientSession);
            (void)QTSS_SendStandardRTSPResponse(inParams->inRTSPRequest, inParams->inClientSession, 0);
            break;
        default:
            break;
    }           
    return QTSS_NoErr;
}
Esempio n. 4
0
Dialog::Dialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::Dialog)
{
    ui->setupUi(this);

    timer = new QTimer(this);
    counter1thread = NULL;
    counter2thread = NULL;
    counter3thread = NULL;
    counter4thread = NULL;

    LCDThread1 = NULL;
    LCDThread2 = NULL;
    LCDThread3 = NULL;
    LCDThread4 = NULL;
//    counter1thread = new QThread(this);
//    counter2thread = new QThread(this);
//    counter3thread = new QThread(this);
//    counter4thread = new QThread(this);

//    LCDThread1 = new CountingThread;
//    LCDThread2 = new CountingThread;
//    LCDThread3 = new CountingThread;
//    LCDThread4 = new CountingThread;

//    connect(LCDThread1, SIGNAL(NumberChanged(int)), this, SLOT(onLCD1NumberChanged(int)));
//    connect(LCDThread2, SIGNAL(NumberChanged(int)), this, SLOT(onLCD2NumberChanged(int)));
//    connect(LCDThread3, SIGNAL(NumberChanged(int)), this, SLOT(onLCD3NumberChanged(int)));
//    connect(LCDThread4, SIGNAL(NumberChanged(int)), this, SLOT(onLCD4NumberChanged(int)));
    DoSetup();

    connect(timer, SIGNAL(timeout()), this, SLOT(updateProgressBar()));

    timer->start(300);
}
Esempio n. 5
0
bool wxGLCanvas::Create(wxWindow *parent,
                        wxWindowID id,
                        const wxPoint& pos,
                        const wxSize& size,
                        long style,
                        const wxString& name,
                        const int *attribList,
                        const wxPalette& palette)
{
    // Create the window first: we will either use it as is or use it to query
    // for multisampling support and recreate it later with another pixel format
    if ( !CreateWindow(parent, id, pos, size, style, name) )
        return false;

    PIXELFORMATDESCRIPTOR pfd;
    const int setupVal = DoSetup(pfd, attribList);
    if ( setupVal == 0 ) // PixelFormat error
        return false;

    if ( setupVal == -1 ) // FSAA requested
    {
        // now that we have a valid OpenGL window, query it for FSAA support
        int pixelFormat;
        {
            wxGLContext ctx(this);
            ctx.SetCurrent(*this);
            pixelFormat = ::ChoosePixelFormatARB(m_hDC, attribList);
        }

        if ( pixelFormat > 0 )
        {
            // from http://msdn.microsoft.com/en-us/library/ms537559(VS.85).aspx:
            //
            //      Setting the pixel format of a window more than once can
            //      lead to significant complications for the Window Manager
            //      and for multithread applications, so it is not allowed. An
            //      application can only set the pixel format of a window one
            //      time. Once a window's pixel format is set, it cannot be
            //      changed.
            //
            // so we need to delete the old window and create the new one

            // destroy Window
            ::ReleaseDC(GetHwnd(), m_hDC);
            m_hDC = 0;

            parent->RemoveChild(this);
            const HWND hwnd = GetHwnd();
            DissociateHandle(); // will do SetHWND(0);
            ::DestroyWindow(hwnd);

            // now recreate with FSAA pixelFormat
            if ( !CreateWindow(parent, id, pos, size, style, name) )
                return false;

            if ( !::SetPixelFormat(m_hDC, pixelFormat, &pfd) )
            {
                wxLogLastError(_T("SetPixelFormat"));
                return false;
            }
        }
    }

#if wxUSE_PALETTE
    if ( !SetupPalette(palette) )
        return false;
#else // !wxUSE_PALETTE
    wxUnusedVar(palette);
#endif // wxUSE_PALETTE/!wxUSE_PALETTE

    return true;
}
Esempio n. 6
0
void Dialog::on_pushButton_clicked()
{
    DoSetup();
}
Esempio n. 7
0
// Thread executed
void watchThread::RunThread(IThreadHandle *pHandle)
{
	// Infinite Loop while loaded
	while (extensionLoaded)
	{		
		// steam connection setup
		if (!setup && extensionLoaded)
		{
			setup = DoSetup();
		}

		// Extension loaded?
		if (extensionLoaded)
		{
			// Sleep here, sleeping is sooo good :)
			Sleeping(2000);
		}


		// Item in list?
		if (extensionLoaded && queueStart != NULL)
		{
			// Login
			steamUser->LogOnWithPassword(true, queueStart->getUsername(), queueStart->getPassword());


			// Finished or Error?
			bool finished = false;
			bool foundError = false;

			// Last Callback
			CallbackMsg_t callBack;

			// Timeout
			time_t timeout = time(0) + 10;


			// Not longer as 10 seconds
			while(time(0) < timeout && extensionLoaded)
			{
				// Get last callbacks
				while (GetCallback(pipeSteam, &callBack) && extensionLoaded)
				{
					// Free it
					FreeLastCallback(pipeSteam);


					// Logged In?
					if (callBack.m_iCallback == SteamServersConnected_t::k_iCallback && extensionLoaded)
					{
						Sleeping(rand() % 200 + 1);


						bool foundData = false;
						bool foundUser = false;
						char *message = queueStart->getMessage();


						// Logged in!
						steamUser->SetSelfAsPrimaryChatDestination();
						steamFriends->SetPersonaState(queueStart->getOnline());
						

						// Sleep before sending
						Sleeping(rand() % 400 + 1);
						

						// Add all Recipients and send message
						for (int i = 0; i < MAX_RECIPIENTS; i++)
						{
							// Break if unloaded
							if (!extensionLoaded)
							{
								break;
							}

							// Valid Steamid?
							if (recipients[i] != NULL && steamFriends != NULL)
							{
								// We found one
								foundUser = true;

								// Add Recipients
								if (extensionLoaded && steamFriends->GetFriendRelationship(*recipients[i]) != k_EFriendRelationshipFriend)
								{
									steamFriends->AddFriend(*recipients[i]);
								}


								// Sleep before message
								Sleeping(2);


								// Send him the message
								if (extensionLoaded)
								{
									if (steamFriends->ReplyToFriendMessage(*recipients[i], message))
									{
										// We found one
										foundData = true;
									}
									else if (steamFriends->SendMsgToFriend(*recipients[i], k_EChatEntryTypeChatMsg, message, strlen(message + 1)))
									{
										foundData = true;
									}
								}
							}
						}


						// Array is empty?
						if (!foundUser)
						{
							// Array is Empty !
							prepareForward(queueStart->getCallback(), ARRAY_EMPTY, k_EResultOK);

							// Found Error
							foundError = true;
						}

						// no receiver?
						else if (!foundData)
						{
							prepareForward(queueStart->getCallback(), NO_RECEIVER, k_EResultOK);

							// Found Error
							foundError = true;
						}
						else
						{
							// Success :)
							prepareForward(queueStart->getCallback(), SUCCESS, k_EResultOK);

							finished = true;
						}
					}


					// Error on connect
					else if (callBack.m_iCallback == SteamServerConnectFailure_t::k_iCallback && extensionLoaded)
					{
						// Get Error Code
						SteamServerConnectFailure_t *error = (SteamServerConnectFailure_t *)callBack.m_pubParam;


						// We have a Login Error
						prepareForward(queueStart->getCallback(), LOGIN_ERROR, (EResult)error->m_eResult);


						// Found Error
						foundError = true;
					}


					// We found a error or finished -> stop here
					if (foundError || finished || !extensionLoaded)
					{
						break;
					}
				}


				// We found a error -> stop here
				if (foundError || finished || !extensionLoaded)
				{
					break;
				}


				// Sleep here
				Sleeping(10);
			}


			// Timeout
			if (!foundError && !finished)
			{
				prepareForward(queueStart->getCallback(), TIMEOUT_ERROR, k_EResultOK);
			}


			// Remove last
			queueStart->remove();

			
			// Extension loaded?
			if (extensionLoaded)
			{
				// Sleep here
				Sleeping(200);

				// Logout
				steamUser->LogOff();
			}
		}
	}
}
Esempio n. 8
0
HRESULT CAssemblyDownload::DownloadComplete(HRESULT hrResult,
                                            LPOLESTR pwzFileName,
                                            const FILETIME *pftLastMod,
                                            BOOL bTerminate)
{
    CCriticalSection           cs(&_cs);

    // Terminate the protocol


    _hrResult = cs.Lock();
    if (FAILED(_hrResult)) {
        goto Exit;
    }
    
    if (_state == ADLSTATE_DONE) {
        _hrResult = HRESULT_FROM_WIN32(ERROR_CANCELLED);
        cs.Unlock();
        goto Exit;
    }
    else if (_state == ADLSTATE_ABORT) {
        // Only happens from the fatal abort case
        _hrResult = HRESULT_FROM_WIN32(ERROR_CANCELLED);
    }
    else {
        _state = ADLSTATE_DOWNLOAD_COMPLETE;
        _hrResult = hrResult;
    }

    cs.Unlock();

    if (SUCCEEDED(hrResult)) {
        // Download successful, change to next state.
        ASSERT(pwzFileName);

        _hrResult = cs.Lock();
        if (FAILED(_hrResult)) {
            goto Exit;
        }

        if (_state != ADLSTATE_ABORT) {
            _state = ADLSTATE_SETUP;
        }

        cs.Unlock();

        hrResult = DoSetup(pwzFileName, pftLastMod);
        if (hrResult == S_FALSE) {
            hrResult = DownloadNextCodebase();
        }
    }
    else {
        // Failed Download. 
        if (_hrResult != HRESULT_FROM_WIN32(ERROR_CANCELLED)) {
            hrResult = DownloadNextCodebase();
        }
        else {
            // This is the fatal abort case
            CompleteAll(NULL);
        }
    }

Exit:
    return hrResult;
}
 FileOperationsViewTestClass()
     : ViewTestClass() {
     DoSetup();
 }
Esempio n. 10
0
bool wxGLCanvas::Create(wxWindow *parent,
                        wxWindowID id,
                        const wxPoint& pos,
                        const wxSize& size,
                        long style,
                        const wxString& name,
                        const int *attribList,
                        const wxPalette& palette)
{
    // Create the window first: we will either use it as is or use it to query
    // for multisampling support and recreate it later with another pixel format
    if ( !CreateWindow(parent, id, pos, size, style, name) )
        return false;

    // these will be used for the context creation attributes
    // if a core profile is requested
    bool useGLCoreProfile = false;

    // the minimum gl core version is 3.0
    int glVersionMajor = 3,
        glVersionMinor = 0;

    // Check for a core profile request
    if ( attribList )
    {
        for ( int i = 0; attribList[i]; )
        {
            switch ( attribList[i++] )
            {
                case WX_GL_CORE_PROFILE:
                    useGLCoreProfile = true;
                    break;

                case WX_GL_MAJOR_VERSION:
                    glVersionMajor = attribList[i++];
                    break;

                case WX_GL_MINOR_VERSION:
                    glVersionMinor = attribList[i++];
                    break;

                default:
                    // ignore all other flags for now
                    break;
            }
        }
    }

    if ( useGLCoreProfile )
    {
        s_wglContextAttribs[0] = WGL_CONTEXT_MAJOR_VERSION_ARB;
        s_wglContextAttribs[1] = glVersionMajor;
        s_wglContextAttribs[2] = WGL_CONTEXT_MINOR_VERSION_ARB;
        s_wglContextAttribs[3] = glVersionMinor;
        s_wglContextAttribs[4] = WGL_CONTEXT_FLAGS_ARB;
        s_wglContextAttribs[5] = WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB;
        s_wglContextAttribs[6] = WGL_CONTEXT_PROFILE_MASK_ARB;
        s_wglContextAttribs[7] = WGL_CONTEXT_CORE_PROFILE_BIT_ARB;
        s_wglContextAttribs[8] = 0; // terminate
    }
    else // create legacy/compatibility context
    {
        s_wglContextAttribs[0] = 0;
    }


    PIXELFORMATDESCRIPTOR pfd;
    const int setupVal = DoSetup(pfd, attribList);
    if ( setupVal == 0 ) // PixelFormat error
        return false;

    if ( setupVal == -1 ) // FSAA requested
    {
        // now that we have a valid OpenGL window, query it for FSAA support
        int pixelFormat;
        {
            wxGLContext ctx(this);
            ctx.SetCurrent(*this);
            pixelFormat = ::ChoosePixelFormatARB(m_hDC, attribList);
        }

        if ( pixelFormat > 0 )
        {
            // from http://msdn.microsoft.com/en-us/library/ms537559(VS.85).aspx:
            //
            //      Setting the pixel format of a window more than once can
            //      lead to significant complications for the Window Manager
            //      and for multithread applications, so it is not allowed. An
            //      application can only set the pixel format of a window one
            //      time. Once a window's pixel format is set, it cannot be
            //      changed.
            //
            // so we need to delete the old window and create the new one

            // destroy Window
            ::ReleaseDC(GetHwnd(), m_hDC);
            m_hDC = 0;

            parent->RemoveChild(this);
            const HWND hwnd = GetHwnd();
            DissociateHandle(); // will do SetHWND(0);
            ::DestroyWindow(hwnd);

            // now recreate with FSAA pixelFormat
            if ( !CreateWindow(parent, id, pos, size, style, name) )
                return false;

            if ( !::SetPixelFormat(m_hDC, pixelFormat, &pfd) )
            {
                wxLogLastError(wxT("SetPixelFormat"));
                return false;
            }
        }
    }

#if wxUSE_PALETTE
    if ( !SetupPalette(palette) )
        return false;
#else // !wxUSE_PALETTE
    wxUnusedVar(palette);
#endif // wxUSE_PALETTE/!wxUSE_PALETTE

    return true;
}