multimediacommsengine/mmcesrv/mmcemediamanager/src/mcesrvsink.cpp
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Tue, 25 May 2010 13:07:26 +0300
branchRCL_3
changeset 12 91f50911ea81
parent 0 1bce908db942
permissions -rw-r--r--
Revision: 201019 Kit: 2010121

/*
* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description:    
*
*/




#include "mcesrvsink.h"
#include "mcesrvstream.h"
#include "mcemediamanager.h"
#include "mcecommediasink.h"
#include "mcertpsink.h"
#include "mceevent.h"
#include "mcesrvstreamiterator.h"
#include "mcesdpsession.h"

#define _MEDIA_SINK static_cast<CMceComMediaSink*>( &Data() )

// ============================ MEMBER FUNCTIONS ===============================


    
// -----------------------------------------------------------------------------
// CMceSrvSink::CMceSrvSink
// -----------------------------------------------------------------------------
//
CMceSrvSink::CMceSrvSink( CMceMediaManager& aManager,
                          CMceComMediaSink& aData )
    : CMceSrvEndpoint( aManager, aData )
    {
    
    }
 
// -----------------------------------------------------------------------------
// CMceSrvSink::~CMceSrvSink
// -----------------------------------------------------------------------------
//
CMceSrvSink::~CMceSrvSink()
    {
    //NOP
    }

// -----------------------------------------------------------------------------
// CMceSrvSink::MccPrepareCalledL
// -----------------------------------------------------------------------------
//
void CMceSrvSink::MccPrepareCalledL( CMceSrvStream& aStream )
    {

    if ( Data().iType == KMceRTPSink )
        {
        iSSRC = iManager->GetSSRCL( aStream );
        //store it also to sink
        _MEDIA_SINK->SetSSRC( iSSRC );
        }
    }

// -----------------------------------------------------------------------------
// CMceSrvSink::Endpoint
// -----------------------------------------------------------------------------
//
CMceSrvEndpoint& CMceSrvSink::Endpoint( CMceSrvStream& aStream )
    {
    return aStream.Sink();
    }

// -----------------------------------------------------------------------------
// CMceSrvSink::HandleSecureEventReceivedL
// -----------------------------------------------------------------------------
//
void CMceSrvSink::HandleSecureEventReceivedL( )
    {
	
	TMceSrvStreamIterator streams( Data().MediaStream()->Session()->MccStreams(), 
                                   Data() );
    CMceSrvStream* stream = NULL;
    while ( streams.Next( stream )  )
        {
        if ( stream->Codec().iIsEnabled &&
             Endpoint( *stream ).State() > CMceSrvStream::EPrepared &&
             Endpoint( *stream ).State() != CMceSrvStream::EPaused )
            {
            Data().MediaStream()->Session()->SdpSession().Manager().PauseL(  *(_MEDIA_SINK) );
            }
        }
    
    }
// End of file