Exemple #1
0
bool Eventing::ProcessRequest( HttpWorkerThread * /*pThread*/, HTTPRequest *pRequest )
{
    if (pRequest)
    {
        if ( pRequest->m_sBaseUrl != "/" )
            return false;

        if ( pRequest->m_sMethod != m_sEventMethodName )
            return false;

        LOG(VB_UPNP, LOG_INFO, QString("Eventing::ProcessRequest - Method (%1)")
                                   .arg(pRequest->m_sMethod ));

        switch( pRequest->m_eType )
        {
            case RequestTypeSubscribe   : HandleSubscribe   ( pRequest ); break;
            case RequestTypeUnsubscribe : HandleUnsubscribe ( pRequest ); break;
            default:
                UPnp::FormatErrorResponse( pRequest, UPnPResult_InvalidAction );
                break;
        }       
    }

    return( true );

}
Exemple #2
0
    void RosterMaintaner::OnPresence(pugi::xml_node Node)
    {
        std::string Type = Node.attribute("type").value();

        if(Type == "subscribe")
        {
            HandleSubscribe(Node);
            return;
        }
        if(Type == "subscribed")
        {
            HandleSubscribe(Node);
            return;
        }
        if(Type == "unsubscribe")
        {
            HandleSubscribe(Node);
            return;
        }
        if(Type == "unsubscribed")
        {
            HandleSubscribed(Node);
            return;
        }

        if(PresenceHandler == nullptr)
            return;

        JID From(Node.attribute("from").value());
        int Priority = 0;

        Priority = Node.child("priority").text().as_int();

        pugi::xml_node ShowTag = Node.child("show");
        std::string Show = ShowTag.text().as_string();

        pugi::xml_node StatusTag = Node.child("status");
        std::string Status = StatusTag.text().as_string();

        PresenceHandler->OnPresence(From, Type != "unavailable",
                                    Priority,
                                    Status,
                                    Show);
    }
Exemple #3
0
void
BasicPacketFlow::Play(BOOL bWouldBlock)
{
    // If this play is not really going to unpause us, becuase the other
    // pause is still in effect, then do nothing.
    if ((bWouldBlock && m_bPaused) || (!bWouldBlock && m_ulWouldBlocking))
	return;

    BOOL bInitialPlayReceived = m_bInitialPlayReceived;
    BOOL bWasPaused           = IsPaused();

    if (m_bIsMulticast)
	return;

    if (m_bInSeek)
    {
	m_bPlayPendingOnSeek = TRUE;
	return;
    }

    HX_ASSERT(m_uFirstStreamRegistered != 0xFFFF);
    if (m_pStreams[m_uFirstStreamRegistered].m_pTransport->isNullSetup())
	return;

    if (m_bAutoSubscription && !m_bSubscribed)
    {
    	// subscribe to all rules...
    	PacketStream* pStream = 0;
    	for (UINT16 unStreamNum = 0;
             unStreamNum < m_unStreamCount;
             unStreamNum++)
    	{
    	    pStream = &m_pStreams[unStreamNum];
	    if (!pStream->m_bStreamRegistered)
	    {
		continue;
	    }
    	    for (INT32 lRuleNumber = 0;
                 lRuleNumber < pStream->m_lNumRules;
                 lRuleNumber++)
    	    {    
    		HandleSubscribe(lRuleNumber, unStreamNum);
	    }
	}	
    }

    HandleTimeLineStateChange(TRUE);
    m_bInitialSubscriptionDone = TRUE; // It better be done by now!

    if (!bWouldBlock)
    {
        // can we get multiple PLAYs ?
        if (m_bPaused || !bInitialPlayReceived)
        {
            HXTimeval hxt = m_pAccurateClock->GetTimeOfDay();
            m_tvRTSPPlayTime.tv_sec = hxt.tv_sec;
            m_tvRTSPPlayTime.tv_usec = hxt.tv_usec;
        }
	m_bPaused = FALSE;
    }

    if (bWasPaused)
    {
        HandleResume();
    }

    m_pFlowMgr->RecalcConstantBitRate();

    if (m_pRateManager)
    {
	IHXPacketFlowControl* pRateMgrFlowControl = NULL;
	if (HXR_OK == m_pRateManager->QueryInterface(IID_IHXPacketFlowControl,
						     (void**)&pRateMgrFlowControl))
	{
	    pRateMgrFlowControl->Play();
	    HX_RELEASE(pRateMgrFlowControl);
	}
    }

    InitialStartup();
 
    if (!m_bInitialPlayReceived)
    {
	m_bInitialPlayReceived = TRUE;

	// Until now, we have not added the bandwidth for this Flow to
	// the overall total, because we didn't know if the content was
	// being served from a downstream cache. Now, we know that's not
	// the case because the RealProxy wouldn't send a play request.
	m_pFlowMgr->CommitPendingBandwidth();

	// Tell the bandwidth calculators to commit their bandwidth as well
	for (UINT16 n = 0; n < m_unStreamCount; n++)
	{
	    if (m_pStreams[n].m_bStreamRegistered)
	    {
		m_pStreams[n].CommitPendingBandwidth();
	    }
	}
    }

 
    return;
}