57
|
1 |
/*
|
|
2 |
* Copyright (c) 2008 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: class for MPX Video File Details
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
// Version : %version: 12 %
|
|
19 |
|
|
20 |
|
|
21 |
//
|
|
22 |
// INCLUDE FILES
|
|
23 |
//
|
|
24 |
#include <f32file.h>
|
|
25 |
#include <uri16.h>
|
|
26 |
|
|
27 |
#include "mpxvideo_debug.h"
|
|
28 |
#include "mpxvideoplaybackviewfiledetails.h"
|
|
29 |
|
|
30 |
// ============================ MEMBER FUNCTIONS ===================================================
|
|
31 |
|
|
32 |
CMPXVideoPlaybackViewFileDetails*
|
|
33 |
CMPXVideoPlaybackViewFileDetails::NewL()
|
|
34 |
{
|
|
35 |
MPX_ENTER_EXIT(_L("CMPXVideoPlaybackViewFileDetails::NewL()"));
|
|
36 |
|
|
37 |
CMPXVideoPlaybackViewFileDetails* p = new (ELeave) CMPXVideoPlaybackViewFileDetails();
|
|
38 |
CleanupStack::PushL(p);
|
|
39 |
p->ConstructL();
|
|
40 |
CleanupStack::Pop(p);
|
|
41 |
return p;
|
|
42 |
}
|
|
43 |
|
|
44 |
CMPXVideoPlaybackViewFileDetails::~CMPXVideoPlaybackViewFileDetails()
|
|
45 |
{
|
|
46 |
MPX_ENTER_EXIT(_L("CMPXVideoPlaybackViewFileDetails::~CMPXVideoPlaybackViewFileDetails()"));
|
|
47 |
|
|
48 |
ClearFileDetails();
|
|
49 |
}
|
|
50 |
|
|
51 |
void
|
|
52 |
CMPXVideoPlaybackViewFileDetails::ConstructL()
|
|
53 |
{
|
|
54 |
MPX_ENTER_EXIT(_L("CMPXVideoPlaybackViewFileDetails::ConstructL()"));
|
|
55 |
iSeekable = ETrue;
|
|
56 |
}
|
|
57 |
|
|
58 |
void
|
|
59 |
CMPXVideoPlaybackViewFileDetails::ClearFileDetails()
|
|
60 |
{
|
|
61 |
MPX_ENTER_EXIT(_L("CMPXVideoPlaybackViewFileDetails::ClearFileDetails()"));
|
|
62 |
|
|
63 |
if ( iMimeType )
|
|
64 |
{
|
|
65 |
delete iMimeType;
|
|
66 |
iMimeType = NULL;
|
|
67 |
}
|
|
68 |
|
|
69 |
if ( iTitle )
|
|
70 |
{
|
|
71 |
delete iTitle;
|
|
72 |
iTitle = NULL;
|
|
73 |
}
|
|
74 |
|
|
75 |
if ( iArtist )
|
|
76 |
{
|
|
77 |
delete iArtist;
|
|
78 |
iArtist = NULL;
|
|
79 |
}
|
|
80 |
|
|
81 |
if ( iClipName )
|
|
82 |
{
|
|
83 |
delete iClipName;
|
|
84 |
iClipName = NULL;
|
|
85 |
}
|
|
86 |
|
|
87 |
iPlaybackMode = EMPXVideoLocal;
|
|
88 |
iSeekable = ETrue;
|
|
89 |
iAudioEnabled = EFalse;
|
|
90 |
iVideoEnabled = EFalse;
|
|
91 |
iPartialPlayback = EFalse;
|
|
92 |
|
|
93 |
iDuration = 0;
|
|
94 |
iTvOutConnected = EFalse;
|
|
95 |
iDrmProtected = EFalse;
|
|
96 |
|
|
97 |
iVideoHeight = 0;
|
|
98 |
iVideoWidth = 0;
|
|
99 |
iBitRate = 0;
|
|
100 |
iFourCCCode = 0;
|
|
101 |
}
|
|
102 |
|
|
103 |
// -------------------------------------------------------------------------------------------------
|
|
104 |
// CMPXVideoPlaybackViewFileDetails::GenerateFileNameL
|
|
105 |
// -------------------------------------------------------------------------------------------------
|
|
106 |
//
|
|
107 |
EXPORT_C HBufC* CMPXVideoPlaybackViewFileDetails::GenerateFileNameL()
|
|
108 |
{
|
|
109 |
MPX_ENTER_EXIT( _L( "CMPXVideoPlaybackViewFileDetails::GenerateFileNameL()" ) );
|
|
110 |
|
|
111 |
HBufC* fileName = NULL;
|
|
112 |
|
|
113 |
if ( iClipName &&
|
|
114 |
iClipName->Length() &&
|
|
115 |
EMPXVideoStreaming != iPlaybackMode &&
|
|
116 |
EMPXVideoLiveStreaming != iPlaybackMode )
|
|
117 |
{
|
|
118 |
//
|
|
119 |
// Get only file name for media details viewer
|
|
120 |
//
|
|
121 |
TParse parse;
|
|
122 |
parse.Set( iClipName->Des(), NULL, NULL );
|
|
123 |
fileName = ( parse.Name() ).AllocL();
|
|
124 |
}
|
|
125 |
|
|
126 |
return fileName;
|
|
127 |
}
|
|
128 |
|
|
129 |
// -------------------------------------------------------------------------------------------------
|
|
130 |
// CMPXVideoPlaybackViewFileDetails::GenerateFileTitleL
|
|
131 |
// -------------------------------------------------------------------------------------------------
|
|
132 |
//
|
|
133 |
EXPORT_C HBufC* CMPXVideoPlaybackViewFileDetails::GenerateFileTitleL()
|
|
134 |
{
|
|
135 |
MPX_ENTER_EXIT( _L( "CMPXVideoPlaybackViewFileDetails::GenerateFileTitleL()" ) );
|
|
136 |
|
|
137 |
HBufC* fileTitle = NULL;
|
|
138 |
|
|
139 |
if ( iTitle && iTitle->Length() )
|
|
140 |
{
|
|
141 |
//
|
|
142 |
// use file title in metadata as title cotent directly
|
|
143 |
//
|
|
144 |
fileTitle = iTitle->AllocL();
|
|
145 |
}
|
|
146 |
else if ( ( EMPXVideoStreaming == iPlaybackMode || EMPXVideoLiveStreaming == iPlaybackMode ) &&
|
|
147 |
iClipName && iClipName->Length() )
|
|
148 |
{
|
|
149 |
//
|
|
150 |
// parse file name in URL
|
|
151 |
//
|
|
152 |
TUriParser parser;
|
|
153 |
|
|
154 |
if ( parser.Parse( iClipName->Des() ) == KErrNone )
|
|
155 |
{
|
|
156 |
|
|
157 |
MPX_DEBUG(
|
|
158 |
_L( " streaming link: schema = %S, urihost = %S, uriPort = %S, uriPath = %S" ),
|
|
159 |
&( parser.Extract( EUriScheme ) ),
|
|
160 |
&( parser.Extract( EUriHost ) ),
|
|
161 |
&( parser.Extract( EUriPort ) ),
|
|
162 |
&( parser.Extract( EUriPath ) ) );
|
|
163 |
|
|
164 |
HBufC* nameAndTail = NULL;
|
|
165 |
|
|
166 |
MPX_TRAPD( err, nameAndTail = parser.GetFileNameL( EUriFileNameTail ) );
|
|
167 |
|
|
168 |
if ( KErrNone == err && nameAndTail )
|
|
169 |
{
|
|
170 |
CleanupStack::PushL( nameAndTail );
|
|
171 |
TInt extPos = nameAndTail->Des().LocateReverse( KExtDelimiter );
|
|
172 |
|
|
173 |
if ( extPos > 0 )
|
|
174 |
{
|
|
175 |
fileTitle = ( nameAndTail->Des().Left( extPos ) ).AllocL();
|
|
176 |
}
|
|
177 |
else
|
|
178 |
{
|
|
179 |
fileTitle = nameAndTail->Des().AllocL();
|
|
180 |
}
|
|
181 |
|
|
182 |
CleanupStack::PopAndDestroy( nameAndTail );
|
|
183 |
}
|
|
184 |
}
|
|
185 |
}
|
|
186 |
|
|
187 |
return fileTitle;
|
|
188 |
}
|
|
189 |
|
|
190 |
// EOF
|