|
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: poster frame setter |
|
15 * |
|
16 */ |
|
17 |
|
18 // Version : %version: ou1cpsw#2 % |
|
19 |
|
20 |
|
21 // INCLUDE FILES |
|
22 #include <fbs.h> |
|
23 #include <mpxvideoplaybackdefs.h> |
|
24 |
|
25 #include "mpxvideoposterframesetter.h" |
|
26 #include "mpxvideoplaybackcontroller.h" |
|
27 #include "mpxvideo_debug.h" |
|
28 |
|
29 // ============================ MEMBER FUNCTIONS =================================================== |
|
30 |
|
31 // ------------------------------------------------------------------------------------------------- |
|
32 // CMPXVideoPosterFrameSetter::CMPXVideoPosterFrameSetter |
|
33 // C++ default constructor can NOT contain any code, that might leave. |
|
34 // ------------------------------------------------------------------------------------------------- |
|
35 // |
|
36 CMPXVideoPosterFrameSetter::CMPXVideoPosterFrameSetter( CMPXVideoPlaybackController* aVideoPlaybackCtlr ) |
|
37 : iVideoPlaybackCtlr( aVideoPlaybackCtlr ) |
|
38 { |
|
39 MPX_ENTER_EXIT(_L("CMPXVideoPosterFrameSetter::CMPXVideoPosterFrameSetter()")); |
|
40 } |
|
41 |
|
42 // ------------------------------------------------------------------------------------------------- |
|
43 // CMPXVideoPosterFrameSetter::ConstructL |
|
44 // Symbian 2nd phase constructor can leave. |
|
45 // ------------------------------------------------------------------------------------------------- |
|
46 // |
|
47 void CMPXVideoPosterFrameSetter::ConstructL() |
|
48 { |
|
49 MPX_ENTER_EXIT(_L("CMPXVideoPosterFrameSetter::ConstructL()")); |
|
50 |
|
51 iTNManager = CThumbnailManager::NewL( *this ); |
|
52 } |
|
53 |
|
54 // ------------------------------------------------------------------------------------------------- |
|
55 // CMPXVideoPosterFrameSetter::NewL |
|
56 // Two-phased constructor. |
|
57 // ------------------------------------------------------------------------------------------------- |
|
58 // |
|
59 CMPXVideoPosterFrameSetter* CMPXVideoPosterFrameSetter::NewL( CMPXVideoPlaybackController* aVideoPlaybackCtlr ) |
|
60 { |
|
61 MPX_ENTER_EXIT(_L("CMPXVideoPosterFrameSetter::NewL()")); |
|
62 |
|
63 CMPXVideoPosterFrameSetter* self = new( ELeave ) CMPXVideoPosterFrameSetter( aVideoPlaybackCtlr ); |
|
64 CleanupStack::PushL( self ); |
|
65 self->ConstructL(); |
|
66 CleanupStack::Pop(); |
|
67 return self; |
|
68 } |
|
69 |
|
70 // ------------------------------------------------------------------------------------------------- |
|
71 // CMPXVideoPosterFrameSetter::~CMPXVideoPosterFrameSetter |
|
72 // Destructor |
|
73 // ------------------------------------------------------------------------------------------------- |
|
74 // |
|
75 CMPXVideoPosterFrameSetter::~CMPXVideoPosterFrameSetter() |
|
76 { |
|
77 MPX_ENTER_EXIT(_L("CMPXVideoPosterFrameSetter::~CMPXVideoPosterFrameSetter()")); |
|
78 |
|
79 if ( iTNManager ) |
|
80 { |
|
81 delete iTNManager; |
|
82 iTNManager = NULL; |
|
83 } |
|
84 } |
|
85 |
|
86 // ------------------------------------------------------------------------------------------------- |
|
87 // CMPXVideoPosterFrameSetter::RequestPosterFrameL |
|
88 // ------------------------------------------------------------------------------------------------- |
|
89 // |
|
90 void CMPXVideoPosterFrameSetter::RequestPosterFrame() |
|
91 { |
|
92 MPX_ENTER_EXIT(_L("CMPXVideoPosterFrameSetter::RequestPosterFrame()")); |
|
93 |
|
94 if ( ! iVideoPlaybackCtlr->iFileDetails->iDrmProtected ) |
|
95 { |
|
96 TRAP_IGNORE( iVideoPlaybackCtlr->iPlayer->GetFrameL() ); |
|
97 } |
|
98 else |
|
99 { |
|
100 MPX_TRAPD(err, |
|
101 iVideoPlaybackCtlr->iState->SendErrorToViewL(KMPXVideoSetPosterFrameNotSupported)); |
|
102 } |
|
103 } |
|
104 |
|
105 // ------------------------------------------------------------------------------------------------- |
|
106 // CMPXVideoPosterFrameSetter::HandlePosterFrameReady |
|
107 // ------------------------------------------------------------------------------------------------- |
|
108 // |
|
109 void CMPXVideoPosterFrameSetter::HandlePosterFrameReady(TInt aError) |
|
110 { |
|
111 MPX_ENTER_EXIT(_L("CMPXVideoPosterFrameSetter::HandlePosterFrameReady()")); |
|
112 |
|
113 if ( aError == KErrNone ) |
|
114 { |
|
115 CThumbnailObjectSource* tnSource( 0 ); |
|
116 TRAP_IGNORE |
|
117 ( |
|
118 tnSource = CThumbnailObjectSource::NewL( &iVideoPlaybackCtlr->iPlayer->GetBitmap(), |
|
119 iVideoPlaybackCtlr->iClipName->Des() ); |
|
120 |
|
121 CleanupStack::PushL( tnSource ); |
|
122 iRequestId = iTNManager->SetThumbnailL( *tnSource ); |
|
123 CleanupStack::PopAndDestroy( tnSource ); |
|
124 ); |
|
125 } |
|
126 } |
|
127 |
|
128 // ------------------------------------------------------------------------------------------------- |
|
129 // CMPXVideoPosterFrameSetter::ThumbnailPreviewReady |
|
130 // |
|
131 // callback method from MThumbnailManagerObserver |
|
132 // ------------------------------------------------------------------------------------------------- |
|
133 // |
|
134 void CMPXVideoPosterFrameSetter::ThumbnailPreviewReady( MThumbnailData& /*aThumbnail*/, |
|
135 TThumbnailRequestId /*aId*/ ) |
|
136 { |
|
137 MPX_ENTER_EXIT(_L("CMPXVideoPosterFrameSetter::ThumbnailPreviewReady()")); |
|
138 } |
|
139 |
|
140 // ------------------------------------------------------------------------------------------------- |
|
141 // CMPXVideoPosterFrameSetter::ThumbnailReady |
|
142 // |
|
143 // callback method from MThumbnailManagerObserver |
|
144 // ------------------------------------------------------------------------------------------------- |
|
145 // |
|
146 void CMPXVideoPosterFrameSetter::ThumbnailReady( TInt aError, |
|
147 MThumbnailData& /*aThumbnail*/, |
|
148 TThumbnailRequestId /*aId*/ ) |
|
149 { |
|
150 MPX_DEBUG(_L("CMPXVideoPosterFrameSetter::ThumbnailReady() aError = %d"), aError ); |
|
151 |
|
152 if ( aError == KErrNone ) |
|
153 { |
|
154 MPX_TRAPD( err, |
|
155 iVideoPlaybackCtlr->iState->SendErrorToViewL( KMPXVideoSetPosterFrameSuccess ) ); |
|
156 } |
|
157 else |
|
158 { |
|
159 MPX_TRAPD( err, |
|
160 iVideoPlaybackCtlr->iState->SendErrorToViewL( KMPXVideoSetPosterFrameFailure ) ); |
|
161 } |
|
162 } |
|
163 |
|
164 // End of File |