harvesterplugins/media/video/src/videoplugin.cpp
author hgs
Tue, 05 Oct 2010 13:32:14 +0530
changeset 26 367228f82b66
parent 19 08315a312857
child 27 7a8855317cbd
permissions -rw-r--r--
201039
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     1
/*
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     2
* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     3
* All rights reserved.
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     4
* This component and the accompanying materials are made available
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     6
* which accompanies this distribution, and is available
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     8
*
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     9
* Initial Contributors:
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    11
*
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    12
* Contributors:
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    13
*
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    14
* Description:  Media Video harvester plugin implementation
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    15
*
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    16
*/
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    17
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    18
//  Include Files
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    19
#include "videoplugin.h" //CVideoPlugin
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    20
#include <e32base.h>
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    21
#include "harvesterserverlogger.h"
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    22
#include "common.h"
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    23
#include "csearchdocument.h"
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    24
#include "ccpixindexer.h"
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    25
#include "mdeharvester.h"
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    26
#include "mdeobjectqueuemanager.h"
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    27
#include "mdsmediamonitor.h"
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    28
#include "mdssessionobjectutils.h"
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    29
#include "cpixmediavideodoc.h"
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    30
#include "cpixindexerutils.h"
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    31
#include "mmcmonitor.h"
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    32
#include "cpixmdedbmanager.h"
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    33
#include "mdsitementity.h"
2
208a4ba3894c Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    34
#include "OstTraceDefinitions.h"
208a4ba3894c Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    35
#ifdef OST_TRACE_COMPILER_IN_USE
208a4ba3894c Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    36
#include "videopluginTraces.h"
208a4ba3894c Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    37
#endif
208a4ba3894c Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    38
0
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    39
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    40
//Constants
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    41
_LIT(KPathTrailer, "\\root\\media\\video");
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    42
#define MEDIA_QBASEAPPCLASS   "@0:root media video"
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    43
#define LMEDIA_QBASEAPPCLASS  L"@0:root media video"
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    44
#define MEDIAAPPCLASS   "root media video"
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    45
#define LMEDIAAPPCLASS  L"root media video"
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    46
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    47
#define MEDIAGENERICAPPCLASS   ":root media video"
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    48
#define LMEDIAGENERICAPPCLASS  L":root media video"
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    49
#define DATABASEPATH           "\\root\\media\\video"
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    50
#define LDATABASEPATH           "\\root\\media\\video"
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    51
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    52
//Member Functions
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    53
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    54
CVideoPlugin* CVideoPlugin::NewL()
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    55
    {
26
hgs
parents: 19
diff changeset
    56
    CVideoPlugin* self = CVideoPlugin::NewLC();
hgs
parents: 19
diff changeset
    57
    CleanupStack::Pop(self);
hgs
parents: 19
diff changeset
    58
    return self;
hgs
parents: 19
diff changeset
    59
    }
hgs
parents: 19
diff changeset
    60
hgs
parents: 19
diff changeset
    61
CVideoPlugin* CVideoPlugin::NewLC()
hgs
parents: 19
diff changeset
    62
    {
hgs
parents: 19
diff changeset
    63
    CVideoPlugin* self = new (ELeave) CVideoPlugin();
hgs
parents: 19
diff changeset
    64
    CleanupStack::PushL(self);
hgs
parents: 19
diff changeset
    65
    self->ConstructL();
0
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    66
    return self;
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    67
    }
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    68
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    69
CVideoPlugin::CVideoPlugin()
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    70
    {
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    71
#ifdef __PERFORMANCE_DATA
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    72
    count = 0;
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    73
#endif
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    74
    //No implementation required.    
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    75
    }
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    76
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    77
CVideoPlugin::~CVideoPlugin()
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    78
    {    
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    79
    delete iMdeHarvester;
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    80
    delete iMdsMonitor;
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    81
    delete iObjectJobQueueManager;
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    82
    delete iMdsUtils;
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    83
    delete iVideoDocument;
19
08315a312857 201033_03
hgs
parents: 13
diff changeset
    84
    if ( iIndexerUtil )
08315a312857 201033_03
hgs
parents: 13
diff changeset
    85
      TRAP_IGNORE(iIndexerUtil->UnMountAllDrivesL(_L(MEDIAGENERICAPPCLASS)));
0
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    86
    delete iIndexerUtil;
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    87
    delete iMMcMonitor;
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    88
    delete iDBManager;
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    89
    delete iMdsItem;
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    90
    }
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    91
26
hgs
parents: 19
diff changeset
    92
void CVideoPlugin::ConstructL()
hgs
parents: 19
diff changeset
    93
    {
hgs
parents: 19
diff changeset
    94
    iObjectJobQueueManager = CMdeObjectQueueManager::NewL(this);
hgs
parents: 19
diff changeset
    95
    }
hgs
parents: 19
diff changeset
    96
0
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    97
void CVideoPlugin::StartPluginL()
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    98
    {
2
208a4ba3894c Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    99
    OstTraceFunctionEntry0( CVIDEOPLUGIN_STARTPLUGINL_ENTRY );
0
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   100
    //Define the basic application class 
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   101
    CPIXLOGSTRING("CVideoPlugin::StartPluginL");
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   102
    iIndexerUtil = CCPixIndexerUtils::NewL( iSearchSession );
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   103
    TBuf<KMaxFileName> databasePathTemp;
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   104
    databasePathTemp.Append( KPathTrailer );
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   105
    iIndexerUtil->MountAllAvailableDriveL( _L(MEDIAGENERICAPPCLASS), databasePathTemp );
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   106
    // Instansiate harvesting and monitering
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   107
    iMdsUtils = CMdsSessionObjectUtils::NewL();
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   108
    iMdsUtils->InitializeL();
26
hgs
parents: 19
diff changeset
   109
    //iObjectJobQueueManager = CMdeObjectQueueManager::NewL( this );
0
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   110
    iMdeHarvester = CMdeHarvester::NewL( iMdsUtils->GetSession(), this,
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   111
                                         iObjectJobQueueManager );   
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   112
    iMdsMonitor = CMdsMediaMonitor::NewL( iMdsUtils->GetSession(), iObjectJobQueueManager );
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   113
    iMMcMonitor = CMMCMonitorUtil::NewL( this );//Observer is self
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   114
    iMMcMonitor->StartMonitoring();
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   115
    //start monitoring video items
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   116
    iMdsMonitor->StartMonitoringL( MdeConstants::Video::KVideoObject );
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   117
    iVideoDocument = CCPIXMediaVideoDoc::NewL(); //Doc fetcher
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   118
    // Start harvester for this plugin
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   119
    iObserver->AddHarvestingQueue(this, _L(MEDIA_QBASEAPPCLASS) );
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   120
    TUid uidOfPlugin = {0x20029ABA};
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   121
    iDBManager = CCPIXMDEDbManager::NewL(uidOfPlugin);
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   122
    iMdsItem = CMDSEntity::NewL();
2
208a4ba3894c Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   123
    OstTraceFunctionExit0( CVIDEOPLUGIN_STARTPLUGINL_EXIT );
0
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   124
    }
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   125
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   126
void CVideoPlugin::StartHarvestingL( const TDesC& /*aMedia*/ )
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   127
    {
2
208a4ba3894c Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   128
    OstTraceFunctionEntry0( CVIDEOPLUGIN_STARTHARVESTINGL_ENTRY );
0
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   129
    CPIXLOGSTRING("CVideoPlugin::StartHarvestingL");
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   130
    iDBManager->ResetL();
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   131
    iIndexerUtil->ResetAllL();
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   132
    //start video harvesting
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   133
#ifdef __PERFORMANCE_DATA
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   134
    iStartTime.UniversalTime();
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   135
#endif
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   136
    iMdeHarvester->DoHarvesetL( MdeConstants::Video::KVideoObject );      
2
208a4ba3894c Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   137
    OstTraceFunctionExit0( CVIDEOPLUGIN_STARTHARVESTINGL_EXIT );
0
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   138
    }
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   139
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   140
void CVideoPlugin::HarvestingCompletedL()
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   141
    {
2
208a4ba3894c Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   142
    OstTraceFunctionEntry0( CVIDEOPLUGIN_HARVESTINGCOMPLETEDL_ENTRY );
0
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   143
    CPIXLOGSTRING("CVideoPlugin::HarvestingCompletedL");
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   144
#ifdef __PERFORMANCE_DATA
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   145
    UpdatePerformaceDataL();
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   146
#endif
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   147
    iObserver->HarvestingCompleted(this, _L(MEDIA_QBASEAPPCLASS), KErrNone);    
2
208a4ba3894c Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   148
    OstTraceFunctionExit0( CVIDEOPLUGIN_HARVESTINGCOMPLETEDL_EXIT );
0
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   149
    }
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   150
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   151
//handle MMC event for the Drive
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   152
void CVideoPlugin::HandleMMCEventL(const TDriveNumber aDrive,const TBool aMMCInsertRemoval)
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   153
    {
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   154
    TBuf<KMaxFileName> databasePathTemp;
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   155
    databasePathTemp.Append(KPathTrailer);
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   156
    if(aMMCInsertRemoval) //MMC inserted
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   157
        {        
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   158
        iIndexerUtil->MountDriveL(aDrive,_L(MEDIAGENERICAPPCLASS),databasePathTemp);        
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   159
        //iIndexerUtil->GetIndexerFromDrive(aDrive)->ResetL();
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   160
        }
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   161
    else
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   162
        {
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   163
        //MMC is removed but we can not reset index here as Media physically not avilable so
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   164
        // we have to do at the time of insertion only
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   165
        //Unmount drive and also reset the index as we anyhow has to reindex on insertion back 
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   166
        iIndexerUtil->UnMountDriveL(aDrive,_L(MEDIAGENERICAPPCLASS),ETrue);
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   167
        }
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   168
    }
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   169
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   170
void CVideoPlugin::HandleMdeItemL( TItemId aObjId, TCPixActionType aActionType)
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   171
    {
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   172
    //Get the object from object utils and get the CPIX document and add delete or update
2
208a4ba3894c Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   173
    OstTrace1( TRACE_NORMAL, CVIDEOPLUGIN_HANDLEMDEITEML, "CVideoPlugin::HandleMdeItemL;aObjId=%d", aObjId );
0
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   174
    CPIXLOGSTRING2("CVideoPlugin::HandleMdeItemL(): aObjId = %d ", aObjId );
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   175
    // creating CSearchDocument object with unique ID for this application
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   176
    TBuf<KMaxFileName> docid_str;
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   177
    if (aActionType == ECPixAddAction || aActionType == ECPixUpdateAction )
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   178
        {
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   179
        //To Improve performance check here only before Getobject if it is Add event
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   180
        //and we already have in our database just return in case of update move forward
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   181
        if(iDBManager->IsAlreadyExistL(aObjId) && aActionType == ECPixAddAction)//Avoid reharvesting
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   182
           {
2
208a4ba3894c Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   183
           OstTrace0( TRACE_NORMAL, DUP1_CVIDEOPLUGIN_HANDLEMDEITEML, "CVideoPlugin::HandleMdeItemL(): Already harvested returning" );
0
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   184
           CPIXLOGSTRING("CVideoPlugin::HandleMdeItemL(): Already harvested returning");
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   185
           return;
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   186
           }
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   187
        CMdEObject& object= iMdsUtils->GetObjectL( aObjId,MdeConstants::Video::KVideoObject );        
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   188
        CMdENamespaceDef& defaultNamespaceDef = iMdsUtils->GetSession()->GetDefaultNamespaceDefL();        
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   189
        CMdEObjectDef& videoObjDef = defaultNamespaceDef.GetObjectDefL( MdeConstants::Video::KVideoObject );        
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   190
        CSearchDocument* index_item = iVideoDocument->GetCpixDocumentL(object,_L(MEDIAAPPCLASS),videoObjDef);
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   191
        iIndexer = iIndexerUtil->GetIndexerFromMediaId(object.MediaId());
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   192
        
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   193
        if (!iIndexer)
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   194
            {
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   195
            delete index_item;
2
208a4ba3894c Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   196
            OstTrace0( TRACE_NORMAL, DUP2_CVIDEOPLUGIN_HANDLEMDEITEML, "CVideoPlugin::HandleMdeItemL(): Indexer not found" );
0
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   197
            CPIXLOGSTRING("CVideoPlugin::HandleMdeItemL(): Indexer not found");
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   198
            return;
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   199
            }
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   200
        // Send for indexing
26
hgs
parents: 19
diff changeset
   201
        OstTrace0( TRACE_NORMAL, DUP12_CVIDEOPLUGIN_HANDLEMDEITEML, "CVideoPlugin::Indexing Video" );
hgs
parents: 19
diff changeset
   202
        
0
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   203
        if (aActionType == ECPixAddAction)
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   204
            {
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   205
#ifdef __PERFORMANCE_DATA
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   206
            ++count;
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   207
#endif
2
208a4ba3894c Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   208
            OstTrace0( TRACE_NORMAL, DUP3_CVIDEOPLUGIN_HANDLEMDEITEML, "CVideoPlugin::HandleMdeItemL(): Indexer found calling AddL" );
0
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   209
            CPIXLOGSTRING("CVideoPlugin::HandleMdeItemL(): Indexer found calling AddL");
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   210
            //First check if it already exist in database
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   211
            TRAPD(err, iIndexer->UpdateL(*index_item)); //Always Update to avoid reharvesting
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   212
            if (err == KErrNone)
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   213
                {
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   214
                //Add entity to database for later use
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   215
                iMdsItem->Reset();//reset existing values
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   216
                iMdsItem->Setkey(aObjId);
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   217
                iMdsItem->SetUri(iVideoDocument->GetUri());//Use the Absolute URI
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   218
                TDriveNumber drive;
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   219
                iIndexerUtil->GetDriveFromMediaId(object.MediaId(),drive);
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   220
                iMdsItem->SetDrive(drive);
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   221
                iDBManager->AddL(aObjId,*iMdsItem);//Add to SyncDB
2
208a4ba3894c Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   222
                OstTrace0( TRACE_NORMAL, DUP4_CVIDEOPLUGIN_HANDLEMDEITEML, "CVideoPlugin::HandleMdeItemL(): Added." );
0
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   223
                CPIXLOGSTRING("CVideoPlugin::HandleMdeItemL(): Added.");
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   224
                }
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   225
            else
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   226
                {
2
208a4ba3894c Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   227
                OstTrace1( TRACE_NORMAL, DUP5_CVIDEOPLUGIN_HANDLEMDEITEML, "CVideoPlugin::HandleMdeItemL;Error %d in adding", err );
0
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   228
                CPIXLOGSTRING2("CVideoPlugin::HandleMdeItemL(): Error %d in adding.", err);
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   229
                }           
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   230
            }
13
hgs
parents: 2
diff changeset
   231
        else
0
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   232
            {
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   233
            //If DocID for e.g \video\something.3gpp itself changes the we have to compare
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   234
            //existing URI with new one and Remove that first and Update to avoid 
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   235
            //Duplicate entries
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   236
            iMdsItem->Reset();//reset existing values
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   237
            TRAPD(err, iDBManager->GetItemL(aObjId,*iMdsItem));
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   238
            if(err == KErrNone)
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   239
                {
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   240
                //Get the drivenumber from the syncDB to delete the appropriate docId 
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   241
                //in case an item is moved to different drive, delete from the old drive first and later update.
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   242
                //comparing the absolute paths along with the root drives
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   243
                if(iMdsItem->GetPath().Compare(object.Uri()) != 0)
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   244
                    {
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   245
                    CCPixIndexer *tempIndexer;                
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   246
                    tempIndexer = iIndexerUtil->GetIndexerFromDrive(iMdsItem->DriveNumber());
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   247
                    tempIndexer->DeleteL(iMdsItem->Uri());
2
208a4ba3894c Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   248
                    OstTrace0( TRACE_NORMAL, DUP6_CVIDEOPLUGIN_HANDLEMDEITEML, "CVideoPlugin::HandleMdeItemL(): Deleted existing URI for update" );
0
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   249
                    CPIXLOGSTRING("CVideoPlugin::HandleMdeItemL(): Deleted existing URI for update");
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   250
                    }
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   251
                TRAPD(error, iIndexer->UpdateL(*index_item));
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   252
                if (error == KErrNone)
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   253
                    {
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   254
                    //Add as new
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   255
                    iMdsItem->Reset();//reset existing values
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   256
                    TDriveNumber drive;
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   257
                    iIndexerUtil->GetDriveFromMediaId(object.MediaId(),drive);
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   258
                    iMdsItem->Set(aObjId,iVideoDocument->GetUri(),drive);
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   259
                    iDBManager->UpdateL(aObjId,*iMdsItem);//Add to SyncDB
2
208a4ba3894c Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   260
                    OstTrace0( TRACE_NORMAL, DUP7_CVIDEOPLUGIN_HANDLEMDEITEML, "CVideoPlugin::HandleMdeItemL(): Updated." );
0
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   261
                    CPIXLOGSTRING("CVideoPlugin::HandleMdeItemL(): Updated.");
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   262
                    }
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   263
                else
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   264
                    {
2
208a4ba3894c Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   265
                    OstTrace1( TRACE_NORMAL, DUP8_CVIDEOPLUGIN_HANDLEMDEITEML, "CVideoPlugin::HandleMdeItemL;Error %d in updating", err );
0
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   266
                    CPIXLOGSTRING2("CVideoPlugin::HandleMdeItemL(): Error %d in updating.", error);
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   267
                    }   
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   268
                }
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   269
            //If a media item is added when downloading or streaming begins, add event is surpassed
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   270
            //by update or delete event because of delay introduced on monitered object by objectqueue manager
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   271
            //So add the Item first, when GetItemL() leaves with item not found
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   272
            else if(err == KErrNotFound)
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   273
                {
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   274
                TRAPD(error, iIndexer->UpdateL(*index_item));
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   275
                if (error == KErrNone)
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   276
                    {
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   277
                    //Add entity to database for later use
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   278
                    iMdsItem->Reset();//reset existing values
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   279
                    iMdsItem->Setkey(aObjId);
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   280
                    iMdsItem->SetUri(iVideoDocument->GetUri());//Use the Absolute URI
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   281
                    TDriveNumber drive;
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   282
                    iIndexerUtil->GetDriveFromMediaId(object.MediaId(),drive);
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   283
                    iMdsItem->SetDrive(drive);
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   284
                    iDBManager->AddL(aObjId,*iMdsItem);//Add to SyncDB
2
208a4ba3894c Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   285
                    OstTrace0( TRACE_NORMAL, DUP9_CVIDEOPLUGIN_HANDLEMDEITEML, "CVideoPlugin::HandleMdeItemL(): Added Item before Update." );
0
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   286
                    CPIXLOGSTRING("CVideoPlugin::HandleMdeItemL(): Added Item before Update.");
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   287
                    }
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   288
                }                    
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   289
            }
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   290
        delete index_item;
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   291
        iIndexer = NULL;        
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   292
        }
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   293
    else if (aActionType == ECPixRemoveAction)
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   294
            {
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   295
            // Remove the document
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   296
            //Get the Item from SyncDB for removed Item
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   297
            iMdsItem->Reset();//reset existing values
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   298
            TRAPD(error, iDBManager->GetItemL(aObjId,*iMdsItem));
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   299
            if (error == KErrNone)
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   300
                {
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   301
                iIndexer = iIndexerUtil->GetIndexerFromDrive(iMdsItem->DriveNumber());//Get Indexer from drive
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   302
                if(iIndexer) //If indexer found delete
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   303
                    {
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   304
                    docid_str.Copy(iMdsItem->Uri());
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   305
                    TRAPD(err, iIndexer->DeleteL(docid_str));//Delete it
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   306
                    if (err == KErrNone)
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   307
                        {
2
208a4ba3894c Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   308
                        OstTrace0( TRACE_NORMAL, DUP10_CVIDEOPLUGIN_HANDLEMDEITEML, "CVideoPlugin::HandleMdeItemL(): Deleted." );
0
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   309
                        CPIXLOGSTRING("CVideoPlugin::HandleMdeItemL(): Deleted.");
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   310
                        }
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   311
                    else
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   312
                        {
2
208a4ba3894c Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   313
                        OstTrace1( TRACE_NORMAL, DUP11_CVIDEOPLUGIN_HANDLEMDEITEML, "CVideoPlugin::HandleMdeItemL;Error %d in deleting", err );
0
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   314
                        CPIXLOGSTRING2("CVideoPlugin::HandleMdeItemL(): Error %d in deleting.", err);
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   315
                        }
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   316
                    }
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   317
                //delete entry from database
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   318
                iDBManager->RemoveL(iMdsItem->Key());
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   319
                }
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   320
            iIndexer = NULL;//Assign to null not pointing to any memory
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   321
            }    
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   322
    }
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   323
26
hgs
parents: 19
diff changeset
   324
void CVideoPlugin::PausePluginL()
hgs
parents: 19
diff changeset
   325
    {
hgs
parents: 19
diff changeset
   326
    OstTraceFunctionEntry0( CVIDEOPLUGIN_PAUSEPLUGINL_ENTRY );
hgs
parents: 19
diff changeset
   327
    iObjectJobQueueManager->PauseL();
hgs
parents: 19
diff changeset
   328
    OstTraceFunctionExit0( CVIDEOPLUGIN_PAUSEPLUGINL_EXIT );
hgs
parents: 19
diff changeset
   329
    }
hgs
parents: 19
diff changeset
   330
hgs
parents: 19
diff changeset
   331
void CVideoPlugin::ResumePluginL()
hgs
parents: 19
diff changeset
   332
    {
hgs
parents: 19
diff changeset
   333
    OstTraceFunctionEntry0( CVIDEOPLUGIN_RESUMEPLUGINL_ENTRY );
hgs
parents: 19
diff changeset
   334
    iObjectJobQueueManager->ResumeL();
hgs
parents: 19
diff changeset
   335
    OstTraceFunctionExit0( CVIDEOPLUGIN_RESUMEPLUGINL_EXIT );
hgs
parents: 19
diff changeset
   336
    }
hgs
parents: 19
diff changeset
   337
0
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   338
#ifdef __PERFORMANCE_DATA
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   339
void CVideoPlugin::UpdateLogL()
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   340
    {
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   341
    UpdatePerformaceDataL();
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   342
    }
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   343
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   344
void CVideoPlugin::UpdatePerformaceDataL()
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   345
    {
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   346
    TTime now;
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   347
    
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   348
    iCompleteTime.UniversalTime();
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   349
    TTimeIntervalMicroSeconds timeDiff = iCompleteTime.MicroSecondsFrom(iStartTime);
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   350
    
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   351
    RFs fileSession;
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   352
    RFile perfFile;
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   353
    User::LeaveIfError( fileSession.Connect () );
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   354
    
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   355
    
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   356
    /* Open file if it exists, otherwise create it and write content in it */
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   357
    
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   358
        if(perfFile.Open(fileSession, _L("c:\\data\\VideoPerf.txt"), EFileWrite))
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   359
                   User::LeaveIfError(perfFile.Create (fileSession, _L("c:\\data\\VideoPerf.txt"), EFileWrite));
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   360
    
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   361
    HBufC8 *heap = HBufC8::NewL(100);
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   362
    TPtr8 ptr = heap->Des();
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   363
    now.HomeTime();
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   364
    TBuf<50> timeString;             
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   365
                
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   366
    _LIT(KOwnTimeFormat,"%:0%H%:1%T%:2%S");
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   367
    now.FormatL(timeString,KOwnTimeFormat);
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   368
    ptr.AppendNum(now.DateTime().Day());
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   369
    ptr.Append(_L("/"));
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   370
    ptr.AppendNum(now.DateTime().Month());
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   371
    ptr.Append(_L("/"));
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   372
    ptr.AppendNum(now.DateTime().Year());
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   373
    ptr.Append(_L(":"));
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   374
    ptr.Append(timeString);
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   375
    ptr.Append(_L("--"));
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   376
    ptr.AppendNum(count);
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   377
    ptr.Append( _L(" :Time took for Harvesting Video is : "));
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   378
    ptr.AppendNum(timeDiff.Int64()/1000) ;
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   379
    ptr.Append(_L(" MilliSeonds \n"));
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   380
    TInt myInt = 0;
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   381
    perfFile.Seek(ESeekEnd,myInt);
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   382
    perfFile.Write (ptr);
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   383
    perfFile.Close ();
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   384
    fileSession.Close ();
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   385
    delete heap;
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   386
    }
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   387
#endif