1 /* |
|
2 * Copyright (c) 2002 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 creating video player. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include <logger.h> |
|
21 |
|
22 #include "cmmavideoplayerfactory.h" |
|
23 #include "cmmastoptimecontrol.h" |
|
24 #include "cmmavideoplayer.h" |
|
25 #include "cmmavideocontrol.h" |
|
26 #include "cmmaaudiovolumecontrol.h" |
|
27 #include "cmmammfresolver.h" |
|
28 #include "cmmavideoframepositioningcontrol.h" |
|
29 #include "cmmammfratecontrol.h" |
|
30 |
|
31 |
|
32 // audio content type |
|
33 _LIT(KMMAAudio, "audio"); |
|
34 // Length of KMMAAudio descriptor |
|
35 const TInt KMMAAudioLength = 5; |
|
36 |
|
37 CMMAVideoPlayerFactory* CMMAVideoPlayerFactory::NewLC() |
|
38 { |
|
39 CMMAVideoPlayerFactory* pFactory = |
|
40 new(ELeave) CMMAVideoPlayerFactory(); |
|
41 CleanupStack::PushL(pFactory); |
|
42 return pFactory; |
|
43 } |
|
44 |
|
45 CMMAVideoPlayerFactory::CMMAVideoPlayerFactory() |
|
46 { |
|
47 } |
|
48 |
|
49 |
|
50 CMMAVideoPlayerFactory::~CMMAVideoPlayerFactory() |
|
51 { |
|
52 } |
|
53 |
|
54 #ifdef RD_JAVA_OMA_DRM_V2 |
|
55 CMMAPlayer* CMMAVideoPlayerFactory::CreatePlayerWithFileL(const TDesC& aContentType, |
|
56 const TDesC* aFileName) |
|
57 { |
|
58 iFileName = aFileName; |
|
59 return CMMAMMFPlayerFactory::CreatePlayerL(aContentType); |
|
60 } |
|
61 #endif // RD_JAVA_OMA_DRM_V2 |
|
62 |
|
63 CMMAPlayer* CMMAVideoPlayerFactory::CreatePlayerL( |
|
64 CMMAMMFResolver* aResolver) |
|
65 { |
|
66 HBufC* cType = aResolver->ContentType(); |
|
67 |
|
68 // Video player may not accept audio content types. |
|
69 if (cType && |
|
70 cType->Length() >= KMMAAudioLength && |
|
71 (aResolver->ContentType()->Mid(0, KMMAAudioLength) == KMMAAudio)) |
|
72 { |
|
73 return NULL; |
|
74 } |
|
75 |
|
76 #ifdef RD_JAVA_OMA_DRM_V2 |
|
77 if (iFileName) |
|
78 { |
|
79 aResolver->SetFileNameL(iFileName); |
|
80 iFileName = NULL; |
|
81 } |
|
82 #endif // RD_JAVA_OMA_DRM_V2 |
|
83 |
|
84 CMMAVideoPlayer* player = CMMAVideoPlayer::NewLC(aResolver); |
|
85 |
|
86 CMMAVideoControl* videoControl = new(ELeave) CMMAVideoControl(player); |
|
87 CleanupStack::PushL(videoControl); |
|
88 player->AddControlL(videoControl); |
|
89 CleanupStack::Pop(videoControl); |
|
90 |
|
91 CMMAAudioVolumeControl* audioVolumeControl = CMMAAudioVolumeControl::NewL(player); |
|
92 CleanupStack::PushL(audioVolumeControl); |
|
93 player->AddControlL(audioVolumeControl); |
|
94 CleanupStack::Pop(audioVolumeControl); |
|
95 |
|
96 CMMAStopTimeControl* stopTimeControl = CMMAStopTimeControl::NewL(player); |
|
97 CleanupStack::PushL(stopTimeControl); |
|
98 player->AddControlL(stopTimeControl); |
|
99 CleanupStack::Pop(stopTimeControl); |
|
100 |
|
101 // FramePositioningControl is only supported for file locator |
|
102 if (player->IsFilePlayer()) |
|
103 { |
|
104 CMMAVideoFramePositioningControl* framePositioningControl = |
|
105 CMMAVideoFramePositioningControl::NewL(player); |
|
106 CleanupStack::PushL(framePositioningControl); |
|
107 player->AddControlL(framePositioningControl); |
|
108 CleanupStack::Pop(framePositioningControl); |
|
109 } |
|
110 |
|
111 CMMAMMFRateControl* rateControl = CMMAMMFRateControl::NewL(player); |
|
112 CleanupStack::PushL(rateControl); |
|
113 player->AddControlL(rateControl); |
|
114 CleanupStack::Pop(rateControl); |
|
115 |
|
116 |
|
117 CleanupStack::Pop(); // player |
|
118 return player; |
|
119 } |
|
120 |
|
121 |
|
122 void CMMAVideoPlayerFactory::MediaIdsL(RArray<TUid>& aMediaIds) |
|
123 { |
|
124 User::LeaveIfError(aMediaIds.Append(KUidMediaTypeVideo)); |
|
125 User::LeaveIfError(aMediaIds.Append(KUidMediaTypeAudio)); |
|
126 } |
|
127 // END OF FILE |
|