vtprotocols/src/cvideoconfighandler.cpp
changeset 0 ed9695c8bcbe
equal deleted inserted replaced
-1:000000000000 0:ed9695c8bcbe
       
     1 /*
       
     2 * Copyright (c) 2004-2006 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <pv_2way_symbian_interface.h>
       
    20 #include <pv_mp4_h263_enc_extension_interface_symbian.h>
       
    21 #include "mvtprotocolhandler.h"
       
    22 #include "cvideoconfighandler.h"
       
    23 
       
    24 #ifdef _DEBUG
       
    25 #    define __IF_DEBUG(t) {RDebug::t;}
       
    26 #else
       
    27 #    define __IF_DEBUG(t)
       
    28 #endif
       
    29 
       
    30 // -----------------------------------------------------------------------------
       
    31 // TVideoConfigHandler::TVideoConfigHandler
       
    32 // Constructor.
       
    33 // -----------------------------------------------------------------------------
       
    34 //
       
    35 TVideoConfigHandler::TVideoConfigHandler(MVtProtocolHandler* aProtocolHandler) : iProtocolHandler(aProtocolHandler)
       
    36     {
       
    37     __IF_DEBUG(Print(_L("VTProto: TVideoConfigHandler::TVideoConfigHandler<")));
       
    38     __IF_DEBUG(Print(_L("VTProto: TVideoConfigHandler::TVideoConfigHandler>")));	
       
    39     }
       
    40     
       
    41 // -----------------------------------------------------------------------------
       
    42 // TVideoConfigHandler::MPvMp4H263EncExtensionCommandCompletedL
       
    43 // Handle an event that has been generated.
       
    44 // -----------------------------------------------------------------------------
       
    45 //
       
    46 void TVideoConfigHandler::MPvMp4H263EncExtensionCommandCompletedL(const CPVCmdResponse& aResponse)
       
    47     {
       
    48     __IF_DEBUG(Print(_L("VTProto: TVideoConfigHandler::MPvMp4H263EncExtensionCommandCompletedL<")));	
       
    49     TVtCommandType cmdType = (TVtCommandType)aResponse.GetCmdType();
       
    50     TInt cmdId = aResponse.GetCmdId();
       
    51     TInt cmdResponse = aResponse.GetCmdStatus();
       
    52     TVtCommandResponse commandRsp(cmdType, cmdId, cmdResponse);
       
    53     iProtocolHandler->HandleVideoEncoderCommandCompletedL(commandRsp);
       
    54     __IF_DEBUG(Print(_L("VTProto: TVideoConfigHandler::MPvMp4H263EncExtensionCommandCompletedL>")));	
       
    55     }
       
    56 
       
    57 // -----------------------------------------------------------------------------
       
    58 // TVideoConfigHandler::HandleMPvMp4H263EncExtensionInformationalEventL
       
    59 // Handle an information event.
       
    60 // -----------------------------------------------------------------------------
       
    61 //
       
    62 void TVideoConfigHandler::HandleMPvMp4H263EncExtensionInformationalEventL(const CPVAsyncInformationalEvent& aEvent)
       
    63     {
       
    64     __IF_DEBUG(Print(_L("VTProto: TVideoConfigHandler::HandleMPvMp4H263EncExtensionInformationalEventL<")));		
       
    65     const TUint8* buffer = aEvent.GetLocalBuffer();
       
    66     TInt eventType = aEvent.GetEventType();
       
    67     TVtIndicationEvent vtEvent(eventType, buffer);
       
    68     iProtocolHandler->HandleVideoEncoderInformationalEventL(vtEvent);
       
    69     __IF_DEBUG(Print(_L("VTProto: TVideoConfigHandler::HandleMPvMp4H263EncExtensionInformationalEventL>")));	
       
    70     }
       
    71  
       
    72 // -----------------------------------------------------------------------------
       
    73 // CVideoConfigCommand::SetObserverL
       
    74 // This API allows the user to specify separate observers for the extension interface.
       
    75 // -----------------------------------------------------------------------------
       
    76 //
       
    77 void CVideoConfigCommand::SetObserverL(MVtProtocolHandler* aHandler)
       
    78     {
       
    79     __IF_DEBUG(Print(_L("VTProto: CVideoConfigCommand::SetObserverL<")));	
       
    80     iVideoConfigHandler = new (ELeave)TVideoConfigHandler(aHandler);
       
    81     iH263Encoder->SetObserver(iVideoConfigHandler);
       
    82     __IF_DEBUG(Print(_L("VTProto: CVideoConfigCommand::SetObserverL>")));
       
    83     }
       
    84 
       
    85 // -----------------------------------------------------------------------------
       
    86 // CVideoConfigCommand::SetIntraFrameInterval
       
    87 // Sets the I-Frame refresh rate of the encoded output.
       
    88 // -----------------------------------------------------------------------------
       
    89 //
       
    90 TInt CVideoConfigCommand::SetIntraFrameInterval(TUint32 aIFrameInterval)
       
    91     {
       
    92     __IF_DEBUG(Print(_L("VTProto: CVideoConfigCommand::SetIntraFrameInterval")));
       
    93     __IF_DEBUG(Print(_L("VTProto: CVideoConfigCommand::SetIntraFrameInterval aIFrameInterval %d"), aIFrameInterval));			
       
    94     return iH263Encoder->SetIFrameInterval(aIFrameInterval);
       
    95     }
       
    96 
       
    97 // -----------------------------------------------------------------------------
       
    98 // CVideoConfigCommand::RequestNextIntraFrame
       
    99 // Requests the encoder to encode the next frame as an I-Frame.
       
   100 // -----------------------------------------------------------------------------
       
   101 //
       
   102 TInt CVideoConfigCommand::RequestNextIntraFrame()
       
   103     {
       
   104     __IF_DEBUG(Print(_L("VTProto: CVideoConfigCommand::RequestNextIntraFrame")));
       
   105     return iH263Encoder->RequestIFrame();
       
   106     }
       
   107 
       
   108 // -----------------------------------------------------------------------------
       
   109 // CVideoConfigCommand::SetVideoFrameRate
       
   110 // Sets the frame rate of encoded output for the specified layer.
       
   111 // -----------------------------------------------------------------------------
       
   112 //
       
   113 TInt CVideoConfigCommand::SetVideoFrameRate(TUint32 aFrameRate)
       
   114     {
       
   115     __IF_DEBUG(Print(_L("VTProto: CVideoConfigCommand::SetVideoFrameRate")));
       
   116     __IF_DEBUG(Print(_L("VTProto: CVideoConfigCommand::SetVideoFrameRate aFrameRate %d"), aFrameRate));		
       
   117     return iH263Encoder->SetOutputFrameRate(aFrameRate);
       
   118     }
       
   119     
       
   120 
       
   121 // -----------------------------------------------------------------------------
       
   122 // CVideoConfigCommand::~CVideoConfigCommand
       
   123 // Destructor.
       
   124 // -----------------------------------------------------------------------------
       
   125 //
       
   126 CVideoConfigCommand::~CVideoConfigCommand()
       
   127     {
       
   128     __IF_DEBUG(Print(_L("VTProto: CVideoConfigCommand::~CVideoConfigCommand")));	
       
   129     delete iVideoConfigHandler;
       
   130     __IF_DEBUG(Print(_L("VTProto: CVideoConfigCommand::~CVideoConfigCommand")));
       
   131     }
       
   132 
       
   133 // end of file