35
|
1 |
/*
|
|
2 |
* Copyright (c) 2009 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: Implimentation of QMpxVideoPlaybackWrapper
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
36
|
18 |
// Version : %version: 4 %
|
35
|
19 |
|
|
20 |
|
|
21 |
#include "mpxvideo_debug.h"
|
|
22 |
#include "mpxvideoplaybackwrapper.h"
|
|
23 |
#include "mpxvideoplayerappuiengine.h"
|
|
24 |
|
|
25 |
|
|
26 |
// -------------------------------------------------------------------------------------------------
|
|
27 |
// QMpxVideoPlaybackWrapper::QMpxVideoPlaybackWrapper()
|
|
28 |
// -------------------------------------------------------------------------------------------------
|
|
29 |
//
|
|
30 |
QMpxVideoPlaybackWrapper::QMpxVideoPlaybackWrapper()
|
|
31 |
{
|
|
32 |
MPX_ENTER_EXIT(_L("QMpxVideoPlaybackWrapper::QMpxVideoPlaybackWrapper()"));
|
|
33 |
|
|
34 |
initializePlugins();
|
|
35 |
}
|
|
36 |
|
|
37 |
// -------------------------------------------------------------------------------------------------
|
|
38 |
// QMpxVideoPlaybackWrapper::~QMpxVideoPlaybackWrapper()
|
|
39 |
// -------------------------------------------------------------------------------------------------
|
|
40 |
//
|
|
41 |
QMpxVideoPlaybackWrapper::~QMpxVideoPlaybackWrapper()
|
|
42 |
{
|
|
43 |
MPX_ENTER_EXIT(_L("QMpxVideoPlaybackWrapper::~QMpxVideoPlaybackWrapper()"));
|
|
44 |
|
|
45 |
if ( mUiEngine )
|
|
46 |
{
|
|
47 |
delete mUiEngine;
|
|
48 |
mUiEngine = NULL;
|
|
49 |
}
|
|
50 |
}
|
|
51 |
|
|
52 |
// -------------------------------------------------------------------------------------------------
|
|
53 |
// QMpxVideoPlaybackWrapper::initializePlugins()
|
|
54 |
// -------------------------------------------------------------------------------------------------
|
|
55 |
//
|
|
56 |
void QMpxVideoPlaybackWrapper::initializePlugins()
|
|
57 |
{
|
|
58 |
MPX_ENTER_EXIT(_L("QMpxVideoPlaybackWrapper::initializePlugins()"));
|
|
59 |
|
|
60 |
TRAPD( err, mUiEngine = CMpxVideoPlayerAppUiEngine::NewL( this ) );
|
|
61 |
MPX_DEBUG(_L("QMpxVideoPlaybackWrapper::initializePlugins err = %d"), err);
|
|
62 |
}
|
|
63 |
|
|
64 |
// -------------------------------------------------------------------------------------------------
|
|
65 |
// QMpxVideoPlaybackWrapper::playMedia()
|
|
66 |
// -------------------------------------------------------------------------------------------------
|
|
67 |
//
|
|
68 |
int QMpxVideoPlaybackWrapper::playMedia( QString aFileName )
|
|
69 |
{
|
36
|
70 |
MPX_ENTER_EXIT(_L("QMpxVideoPlaybackWrapper::playMedia"));
|
|
71 |
|
|
72 |
TBuf<KMaxFileName> filename( aFileName.utf16() );
|
|
73 |
int error = openFileWithNativePath( filename );
|
|
74 |
|
|
75 |
MPX_DEBUG(_L("QMpxVideoPlaybackWrapper::playMedia err = %d"), error);
|
|
76 |
|
|
77 |
return error;
|
|
78 |
}
|
35
|
79 |
|
36
|
80 |
// -------------------------------------------------------------------------------------------------
|
|
81 |
// QMpxVideoPlaybackWrapper::playMedia()
|
|
82 |
// -------------------------------------------------------------------------------------------------
|
|
83 |
//
|
|
84 |
int QMpxVideoPlaybackWrapper::playMedia( RFile aFile )
|
|
85 |
{
|
|
86 |
MPX_ENTER_EXIT(_L("QMpxVideoPlaybackWrapper::playMedia"));
|
|
87 |
|
|
88 |
TRAPD( error, mUiEngine->OpenFileL( aFile ) );
|
35
|
89 |
|
|
90 |
MPX_DEBUG(_L("QMpxVideoPlaybackWrapper::playMedia err = %d"), error);
|
|
91 |
|
|
92 |
return error;
|
|
93 |
}
|
|
94 |
|
|
95 |
// -------------------------------------------------------------------------------------------------
|
|
96 |
// QMpxVideoPlaybackWrapper::openPlaybackView()
|
|
97 |
// -------------------------------------------------------------------------------------------------
|
|
98 |
//
|
|
99 |
void QMpxVideoPlaybackWrapper::openPlaybackView()
|
|
100 |
{
|
|
101 |
MPX_ENTER_EXIT(_L("QMpxVideoPlaybackWrapper::openPlaybackView()"));
|
|
102 |
|
|
103 |
emit handlePlaybackView( MpxHbVideoCommon::ActivatePlaybackView );
|
|
104 |
}
|
|
105 |
|
|
106 |
// -------------------------------------------------------------------------------------------------
|
|
107 |
// QMpxVideoPlaybackWrapper::postInit()
|
|
108 |
// -------------------------------------------------------------------------------------------------
|
|
109 |
//
|
|
110 |
void QMpxVideoPlaybackWrapper::lateInit()
|
|
111 |
{
|
|
112 |
MPX_ENTER_EXIT(_L("QMpxVideoPlaybackWrapper::postInit()"));
|
|
113 |
|
|
114 |
TRAP_IGNORE( mUiEngine->LateInitL() );
|
|
115 |
}
|
|
116 |
|
36
|
117 |
// -------------------------------------------------------------------------------------------------
|
|
118 |
// QMpxVideoPlaybackWrapper::openFileWithNativePath()
|
|
119 |
// -------------------------------------------------------------------------------------------------
|
|
120 |
//
|
|
121 |
int QMpxVideoPlaybackWrapper::openFileWithNativePath(const TDesC& aFileName)
|
|
122 |
{
|
|
123 |
MPX_DEBUG(_L("QMpxVideoPlaybackWrapper::openFileWithNativePath()"));
|
|
124 |
|
|
125 |
int err = KErrNone;
|
|
126 |
|
|
127 |
int fwdSlashPos = aFileName.LocateF('/');
|
|
128 |
|
|
129 |
if( fwdSlashPos == KErrNotFound )
|
|
130 |
{
|
|
131 |
// no fwd slashes found => filepath is already in
|
|
132 |
// preferred format eg. c:\\data\\videos\\test.3gp
|
|
133 |
//
|
|
134 |
TRAP( err, mUiEngine->OpenFileL( aFileName ) );
|
|
135 |
}
|
|
136 |
else
|
|
137 |
{
|
|
138 |
HBufC* fileName = NULL;
|
|
139 |
|
|
140 |
TRAP( err, fileName = aFileName.AllocL() );
|
|
141 |
|
|
142 |
if ( err == KErrNone )
|
|
143 |
{
|
|
144 |
int count( fileName->Des().Length() );
|
|
145 |
|
|
146 |
for ( int j = fwdSlashPos ; j < count; ++j )
|
|
147 |
{
|
|
148 |
if ( fileName->Des()[j]== '/' )
|
|
149 |
{
|
|
150 |
fileName->Des()[j]='\\';
|
|
151 |
}
|
|
152 |
}
|
|
153 |
|
|
154 |
}
|
|
155 |
|
|
156 |
TRAP( err, mUiEngine->OpenFileL( fileName->Des() ) );
|
|
157 |
|
|
158 |
if ( fileName )
|
|
159 |
{
|
|
160 |
delete fileName;
|
|
161 |
fileName = NULL;
|
|
162 |
}
|
|
163 |
}
|
|
164 |
|
|
165 |
return err;
|
|
166 |
}
|
|
167 |
|
|
168 |
|
35
|
169 |
// End of File
|