|
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
|
2 /* vim:set ts=2 sw=2 sts=2 et cindent: */ |
|
3 /* |
|
4 * Copyright (c) 2014 The Linux Foundation. All rights reserved. |
|
5 * Copyright (C) 2009 The Android Open Source Project |
|
6 * |
|
7 * Licensed under the Apache License, Version 2.0 (the "License"); |
|
8 * you may not use this file except in compliance with the License. |
|
9 * You may obtain a copy of the License at |
|
10 * |
|
11 * http://www.apache.org/licenses/LICENSE-2.0 |
|
12 * |
|
13 * Unless required by applicable law or agreed to in writing, software |
|
14 * distributed under the License is distributed on an "AS IS" BASIS, |
|
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
16 * See the License for the specific language governing permissions and |
|
17 * limitations under the License. |
|
18 */ |
|
19 |
|
20 #ifndef AUDIO_OFFLOAD_PLAYER_BASE_H_ |
|
21 #define AUDIO_OFFLOAD_PLAYER_BASE_H_ |
|
22 |
|
23 #include "MediaDecoderOwner.h" |
|
24 #include "MediaOmxDecoder.h" |
|
25 |
|
26 namespace mozilla { |
|
27 |
|
28 class MediaOmxDecoder; |
|
29 |
|
30 /** |
|
31 * AudioOffloadPlayer interface class which has funtions used by MediaOmxDecoder |
|
32 * This is to reduce the dependency of AudioOffloadPlayer in MediaOmxDecoder |
|
33 */ |
|
34 class AudioOffloadPlayerBase |
|
35 { |
|
36 typedef android::status_t status_t; |
|
37 typedef android::MediaSource MediaSource; |
|
38 |
|
39 public: |
|
40 virtual ~AudioOffloadPlayerBase() {}; |
|
41 |
|
42 // Caller retains ownership of "aSource". |
|
43 virtual void SetSource(const android::sp<MediaSource> &aSource) {} |
|
44 |
|
45 // Start the source if it's not already started and open the AudioSink to |
|
46 // create an offloaded audio track |
|
47 virtual status_t Start(bool aSourceAlreadyStarted = false) |
|
48 { |
|
49 return android::NO_INIT; |
|
50 } |
|
51 |
|
52 virtual status_t ChangeState(MediaDecoder::PlayState aState) |
|
53 { |
|
54 return android::NO_INIT; |
|
55 } |
|
56 |
|
57 virtual void SetVolume(double aVolume) {} |
|
58 |
|
59 virtual double GetMediaTimeSecs() { return 0; } |
|
60 |
|
61 // To update progress bar when the element is visible |
|
62 virtual void SetElementVisibility(bool aIsVisible) {} |
|
63 |
|
64 // Update ready state based on current play state. Not checking data |
|
65 // availability since offloading is currently done only when whole compressed |
|
66 // data is available |
|
67 virtual MediaDecoderOwner::NextFrameStatus GetNextFrameStatus() |
|
68 { |
|
69 return MediaDecoderOwner::NEXT_FRAME_UNAVAILABLE; |
|
70 } |
|
71 }; |
|
72 |
|
73 } // namespace mozilla |
|
74 |
|
75 #endif // AUDIO_OFFLOAD_PLAYER_BASE_H_ |