videoplayback/videohelix/src/mpxvideoposterframesetter.cpp
author hgs
Thu, 24 Jun 2010 09:49:13 +0300
changeset 41 229f037ce963
parent 38 ff53afa8ad05
permissions -rw-r--r--
201025
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
38
hgs
parents:
diff changeset
     1
/*
hgs
parents:
diff changeset
     2
* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
hgs
parents:
diff changeset
     3
* All rights reserved.
hgs
parents:
diff changeset
     4
* This component and the accompanying materials are made available
hgs
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
hgs
parents:
diff changeset
     6
* which accompanies this distribution, and is available
hgs
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
hgs
parents:
diff changeset
     8
*
hgs
parents:
diff changeset
     9
* Initial Contributors:
hgs
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
hgs
parents:
diff changeset
    11
*
hgs
parents:
diff changeset
    12
* Contributors:
hgs
parents:
diff changeset
    13
*
hgs
parents:
diff changeset
    14
* Description: poster frame setter
hgs
parents:
diff changeset
    15
 *
hgs
parents:
diff changeset
    16
*/
hgs
parents:
diff changeset
    17
hgs
parents:
diff changeset
    18
// Version : %version: ou1cpsw#2 %
hgs
parents:
diff changeset
    19
hgs
parents:
diff changeset
    20
hgs
parents:
diff changeset
    21
// INCLUDE FILES
hgs
parents:
diff changeset
    22
#include <fbs.h>
hgs
parents:
diff changeset
    23
#include <mpxvideoplaybackdefs.h>
hgs
parents:
diff changeset
    24
hgs
parents:
diff changeset
    25
#include "mpxvideoposterframesetter.h"
hgs
parents:
diff changeset
    26
#include "mpxvideoplaybackcontroller.h"
hgs
parents:
diff changeset
    27
#include "mpxvideo_debug.h"
hgs
parents:
diff changeset
    28
hgs
parents:
diff changeset
    29
// ============================ MEMBER FUNCTIONS ===================================================
hgs
parents:
diff changeset
    30
hgs
parents:
diff changeset
    31
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
    32
// CMPXVideoPosterFrameSetter::CMPXVideoPosterFrameSetter
hgs
parents:
diff changeset
    33
// C++ default constructor can NOT contain any code, that might leave.
hgs
parents:
diff changeset
    34
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
    35
//
hgs
parents:
diff changeset
    36
CMPXVideoPosterFrameSetter::CMPXVideoPosterFrameSetter( CMPXVideoPlaybackController* aVideoPlaybackCtlr )
hgs
parents:
diff changeset
    37
    : iVideoPlaybackCtlr( aVideoPlaybackCtlr )
hgs
parents:
diff changeset
    38
{
hgs
parents:
diff changeset
    39
    MPX_ENTER_EXIT(_L("CMPXVideoPosterFrameSetter::CMPXVideoPosterFrameSetter()"));
hgs
parents:
diff changeset
    40
}
hgs
parents:
diff changeset
    41
hgs
parents:
diff changeset
    42
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
    43
// CMPXVideoPosterFrameSetter::ConstructL
hgs
parents:
diff changeset
    44
// Symbian 2nd phase constructor can leave.
hgs
parents:
diff changeset
    45
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
    46
//
hgs
parents:
diff changeset
    47
void CMPXVideoPosterFrameSetter::ConstructL()
hgs
parents:
diff changeset
    48
{
hgs
parents:
diff changeset
    49
    MPX_ENTER_EXIT(_L("CMPXVideoPosterFrameSetter::ConstructL()"));
hgs
parents:
diff changeset
    50
    
hgs
parents:
diff changeset
    51
    iTNManager = CThumbnailManager::NewL( *this );
hgs
parents:
diff changeset
    52
}
hgs
parents:
diff changeset
    53
hgs
parents:
diff changeset
    54
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
    55
// CMPXVideoPosterFrameSetter::NewL
hgs
parents:
diff changeset
    56
// Two-phased constructor.
hgs
parents:
diff changeset
    57
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
    58
//
hgs
parents:
diff changeset
    59
CMPXVideoPosterFrameSetter* CMPXVideoPosterFrameSetter::NewL( CMPXVideoPlaybackController* aVideoPlaybackCtlr )
hgs
parents:
diff changeset
    60
{
hgs
parents:
diff changeset
    61
    MPX_ENTER_EXIT(_L("CMPXVideoPosterFrameSetter::NewL()"));
hgs
parents:
diff changeset
    62
hgs
parents:
diff changeset
    63
    CMPXVideoPosterFrameSetter* self = new( ELeave ) CMPXVideoPosterFrameSetter( aVideoPlaybackCtlr );
hgs
parents:
diff changeset
    64
    CleanupStack::PushL( self );
hgs
parents:
diff changeset
    65
    self->ConstructL();
hgs
parents:
diff changeset
    66
    CleanupStack::Pop();
hgs
parents:
diff changeset
    67
    return self;
hgs
parents:
diff changeset
    68
}
hgs
parents:
diff changeset
    69
hgs
parents:
diff changeset
    70
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
    71
// CMPXVideoPosterFrameSetter::~CMPXVideoPosterFrameSetter
hgs
parents:
diff changeset
    72
// Destructor
hgs
parents:
diff changeset
    73
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
    74
//
hgs
parents:
diff changeset
    75
CMPXVideoPosterFrameSetter::~CMPXVideoPosterFrameSetter()
hgs
parents:
diff changeset
    76
{
hgs
parents:
diff changeset
    77
    MPX_ENTER_EXIT(_L("CMPXVideoPosterFrameSetter::~CMPXVideoPosterFrameSetter()"));
hgs
parents:
diff changeset
    78
hgs
parents:
diff changeset
    79
    if ( iTNManager )
hgs
parents:
diff changeset
    80
    {
hgs
parents:
diff changeset
    81
        delete iTNManager;
hgs
parents:
diff changeset
    82
        iTNManager = NULL;
hgs
parents:
diff changeset
    83
    }
hgs
parents:
diff changeset
    84
}
hgs
parents:
diff changeset
    85
hgs
parents:
diff changeset
    86
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
    87
// CMPXVideoPosterFrameSetter::RequestPosterFrameL
hgs
parents:
diff changeset
    88
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
    89
//
hgs
parents:
diff changeset
    90
void CMPXVideoPosterFrameSetter::RequestPosterFrame()
hgs
parents:
diff changeset
    91
{
hgs
parents:
diff changeset
    92
    MPX_ENTER_EXIT(_L("CMPXVideoPosterFrameSetter::RequestPosterFrame()"));
hgs
parents:
diff changeset
    93
    
hgs
parents:
diff changeset
    94
    if ( ! iVideoPlaybackCtlr->iFileDetails->iDrmProtected )
hgs
parents:
diff changeset
    95
    {
hgs
parents:
diff changeset
    96
        TRAP_IGNORE( iVideoPlaybackCtlr->iPlayer->GetFrameL() );    
hgs
parents:
diff changeset
    97
    }
hgs
parents:
diff changeset
    98
    else
hgs
parents:
diff changeset
    99
    {
hgs
parents:
diff changeset
   100
        MPX_TRAPD(err, 
hgs
parents:
diff changeset
   101
                  iVideoPlaybackCtlr->iState->SendErrorToViewL(KMPXVideoSetPosterFrameNotSupported));     
hgs
parents:
diff changeset
   102
    }   
hgs
parents:
diff changeset
   103
}
hgs
parents:
diff changeset
   104
hgs
parents:
diff changeset
   105
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   106
// CMPXVideoPosterFrameSetter::HandlePosterFrameReady
hgs
parents:
diff changeset
   107
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   108
//
hgs
parents:
diff changeset
   109
void CMPXVideoPosterFrameSetter::HandlePosterFrameReady(TInt aError)
hgs
parents:
diff changeset
   110
{
hgs
parents:
diff changeset
   111
    MPX_ENTER_EXIT(_L("CMPXVideoPosterFrameSetter::HandlePosterFrameReady()"));
hgs
parents:
diff changeset
   112
    
hgs
parents:
diff changeset
   113
    if ( aError == KErrNone )
hgs
parents:
diff changeset
   114
    {     
hgs
parents:
diff changeset
   115
        CThumbnailObjectSource* tnSource( 0 );
hgs
parents:
diff changeset
   116
        TRAP_IGNORE
hgs
parents:
diff changeset
   117
        (
hgs
parents:
diff changeset
   118
            tnSource = CThumbnailObjectSource::NewL( &iVideoPlaybackCtlr->iPlayer->GetBitmap(),
hgs
parents:
diff changeset
   119
                                                      iVideoPlaybackCtlr->iClipName->Des() );
hgs
parents:
diff changeset
   120
            
hgs
parents:
diff changeset
   121
            CleanupStack::PushL( tnSource );
hgs
parents:
diff changeset
   122
            iRequestId = iTNManager->SetThumbnailL( *tnSource );
hgs
parents:
diff changeset
   123
            CleanupStack::PopAndDestroy( tnSource );
hgs
parents:
diff changeset
   124
        );    
hgs
parents:
diff changeset
   125
    }        
hgs
parents:
diff changeset
   126
}
hgs
parents:
diff changeset
   127
hgs
parents:
diff changeset
   128
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   129
// CMPXVideoPosterFrameSetter::ThumbnailPreviewReady
hgs
parents:
diff changeset
   130
//
hgs
parents:
diff changeset
   131
// callback method from MThumbnailManagerObserver
hgs
parents:
diff changeset
   132
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   133
//
hgs
parents:
diff changeset
   134
void CMPXVideoPosterFrameSetter::ThumbnailPreviewReady( MThumbnailData& /*aThumbnail*/,
hgs
parents:
diff changeset
   135
                                                        TThumbnailRequestId /*aId*/ )
hgs
parents:
diff changeset
   136
{
hgs
parents:
diff changeset
   137
    MPX_ENTER_EXIT(_L("CMPXVideoPosterFrameSetter::ThumbnailPreviewReady()"));
hgs
parents:
diff changeset
   138
}
hgs
parents:
diff changeset
   139
hgs
parents:
diff changeset
   140
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   141
// CMPXVideoPosterFrameSetter::ThumbnailReady
hgs
parents:
diff changeset
   142
//
hgs
parents:
diff changeset
   143
// callback method from MThumbnailManagerObserver
hgs
parents:
diff changeset
   144
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   145
//
hgs
parents:
diff changeset
   146
void CMPXVideoPosterFrameSetter::ThumbnailReady( TInt aError, 
hgs
parents:
diff changeset
   147
                                                 MThumbnailData& /*aThumbnail*/,
hgs
parents:
diff changeset
   148
                                                 TThumbnailRequestId /*aId*/ )
hgs
parents:
diff changeset
   149
{
hgs
parents:
diff changeset
   150
    MPX_DEBUG(_L("CMPXVideoPosterFrameSetter::ThumbnailReady() aError = %d"), aError );
hgs
parents:
diff changeset
   151
    
hgs
parents:
diff changeset
   152
    if ( aError == KErrNone )
hgs
parents:
diff changeset
   153
    {
hgs
parents:
diff changeset
   154
        MPX_TRAPD( err, 
hgs
parents:
diff changeset
   155
                   iVideoPlaybackCtlr->iState->SendErrorToViewL( KMPXVideoSetPosterFrameSuccess ) );    
hgs
parents:
diff changeset
   156
    }
hgs
parents:
diff changeset
   157
    else
hgs
parents:
diff changeset
   158
    {
hgs
parents:
diff changeset
   159
        MPX_TRAPD( err, 
hgs
parents:
diff changeset
   160
                   iVideoPlaybackCtlr->iState->SendErrorToViewL( KMPXVideoSetPosterFrameFailure ) );    
hgs
parents:
diff changeset
   161
    }
hgs
parents:
diff changeset
   162
}
hgs
parents:
diff changeset
   163
hgs
parents:
diff changeset
   164
//  End of File