26
|
1 |
/*
|
|
2 |
* Copyright (c) 2002-2007 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: This class is used for playing video.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#ifndef CMMAVIDEOPLAYER_H
|
|
19 |
#define CMMAVIDEOPLAYER_H
|
|
20 |
|
|
21 |
// INCLUDES
|
|
22 |
#include <AccMonitor.h>
|
|
23 |
#include <jutils.h>
|
|
24 |
#include "cmmaaudioplayer.h"
|
|
25 |
#include "mmmaguiplayer.h"
|
|
26 |
#include "mmmasnapshot.h"
|
|
27 |
#include "cmmasurfacewindow.h"
|
|
28 |
|
|
29 |
// FORWARD DECLARATIONS
|
|
30 |
class CMMAEventSource;
|
|
31 |
class CAccMonitorInfo;
|
|
32 |
|
|
33 |
// CONSTANTS
|
|
34 |
// Error code from MMF meaning that video is missing sound,
|
|
35 |
// but still can be played.
|
|
36 |
const TInt KNotCompleteVideoError = -12017;
|
|
37 |
// Error blitting video to display
|
|
38 |
const TInt KMMVideoBlitError = -12015;
|
|
39 |
_LIT(KMMAVideoPlayer, "VideoPlayer");
|
|
40 |
|
|
41 |
// CLASS DECLARATION
|
|
42 |
/**
|
|
43 |
* This class is used for playing video.
|
|
44 |
*
|
|
45 |
*/
|
|
46 |
NONSHARABLE_CLASS(CMMAVideoPlayer): public CMMAAudioPlayer,
|
|
47 |
public MMMAGuiPlayer,
|
|
48 |
public MMMASnapshot,
|
|
49 |
public MAccMonitorObserver
|
|
50 |
{
|
|
51 |
public: // Construction
|
|
52 |
static CMMAVideoPlayer* NewLC(
|
|
53 |
CMMAMMFResolver* aResolver);
|
|
54 |
|
|
55 |
// Destructor
|
|
56 |
~CMMAVideoPlayer();
|
|
57 |
|
|
58 |
protected:
|
|
59 |
// C++ constructor
|
|
60 |
CMMAVideoPlayer(CMMAMMFResolver* aResolver);
|
|
61 |
|
|
62 |
void ConstructL();
|
|
63 |
|
|
64 |
public: // from CMMAPlayer
|
|
65 |
IMPORT_C void SetPlayerListenerObjectL(jobject aListenerObject,
|
|
66 |
JNIEnv* aJni,
|
|
67 |
MMMAEventPoster* aEventPoster);
|
|
68 |
void RealizeL();
|
|
69 |
void PrefetchL();
|
|
70 |
|
|
71 |
protected: // from CMMAudioPlayer
|
|
72 |
IMPORT_C void ReadCompletedL(TInt aStatus, const TDesC8& aData);
|
|
73 |
void HandleEvent(const TMMFEvent& aEvent);
|
|
74 |
IMPORT_C const TDesC& Type();
|
|
75 |
|
|
76 |
public: // From MMMAGuiPlayer
|
|
77 |
IMPORT_C void SetDisplayL(MMMADisplay* aDisplay);
|
|
78 |
IMPORT_C TSize SourceSize();
|
|
79 |
IMPORT_C void NotifyWithStringEvent(CMMAPlayerEvent::TEventType aEventType,
|
|
80 |
const TDesC& aStringEventData);
|
|
81 |
|
|
82 |
IMPORT_C MMMASnapshot* SnapshoterL();
|
|
83 |
|
|
84 |
public: // From MMMASnapshot
|
|
85 |
IMPORT_C MMMASnapshot::TEncoding TakeSnapshotL(TRequestStatus* aStatus,
|
|
86 |
const TSize& aSize,
|
|
87 |
const CMMAImageSettings& aSettings);
|
|
88 |
IMPORT_C CFbsBitmap* SnapshotBitmap();
|
|
89 |
IMPORT_C HBufC8* SnapshotEncoded();
|
|
90 |
|
|
91 |
public: // from MAccMonitorObserver
|
|
92 |
void ConnectedL(CAccMonitorInfo* aAccessoryInfo );
|
|
93 |
void DisconnectedL(CAccMonitorInfo* aAccessoryInfo);
|
|
94 |
void AccMonitorObserverError( TInt aError );
|
|
95 |
|
|
96 |
protected: // New methods
|
|
97 |
void CompletePrefetch(TInt aError);
|
|
98 |
void PrepareDisplay();
|
|
99 |
void SourceSizeChanged();
|
|
100 |
|
|
101 |
protected: // Data
|
|
102 |
CMMASurfaceWindow* iSurfaceWindow;
|
|
103 |
RMMFVideoControllerCustomCommands iVideoControllerCustomCommands;
|
|
104 |
RMMFVideoPlayControllerCustomCommands iVideoPlayControllerCustomCommands;
|
|
105 |
RMMFVideoPlaySurfaceSupportCustomCommands iVideoPlaySurfaceSupportCustomCommands;
|
|
106 |
|
|
107 |
private: // Data
|
|
108 |
// not owned
|
|
109 |
MMMADisplay* iDisplay;
|
|
110 |
|
|
111 |
TSize iSourceSize;
|
|
112 |
|
|
113 |
TFileName iFileExtension;
|
|
114 |
|
|
115 |
/**
|
|
116 |
* struct to keep track of Surface
|
|
117 |
*/
|
|
118 |
struct MMASurface
|
|
119 |
{
|
|
120 |
// owned, should be freed using
|
|
121 |
// RMMFVideoPlaySurfaceSupportCustomCommands::SurfaceRemoved().
|
|
122 |
TSurfaceId iPrevSurfaceId;
|
|
123 |
TBool iPrevSurfaceAvailable;
|
|
124 |
} iMMASurface;
|
|
125 |
|
|
126 |
// owned
|
|
127 |
CFbsBitmap* iEmptySnapshotImage;
|
|
128 |
|
|
129 |
// owned
|
|
130 |
CActiveSchedulerWait* iActiveSchedulerWait;
|
|
131 |
|
|
132 |
/**
|
|
133 |
* owned
|
|
134 |
* used for listening to audio/video cable connection status.
|
|
135 |
*/
|
|
136 |
CAccMonitor *iAccMonitor;
|
|
137 |
RAccMonCapabilityArray iAccMonCapabilityArray;
|
|
138 |
TBool isHDMICableConnected;
|
|
139 |
};
|
|
140 |
|
|
141 |
#endif // CMMAVIDEOPLAYER_H
|