OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef MEDIA_BASE_ANDROID_MEDIA_SOURCE_PLAYER_H_ | 5 #ifndef MEDIA_BASE_ANDROID_LEGACY_MEDIA_SOURCE_PLAYER_H_ |
6 #define MEDIA_BASE_ANDROID_MEDIA_SOURCE_PLAYER_H_ | 6 #define MEDIA_BASE_ANDROID_LEGACY_MEDIA_SOURCE_PLAYER_H_ |
7 | 7 |
8 #include <jni.h> | 8 #include <jni.h> |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/android/scoped_java_ref.h" | 13 #include "base/android/scoped_java_ref.h" |
14 #include "base/callback.h" | 14 #include "base/callback.h" |
15 #include "base/cancelable_callback.h" | 15 #include "base/cancelable_callback.h" |
16 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
17 #include "base/memory/weak_ptr.h" | 17 #include "base/memory/weak_ptr.h" |
18 #include "base/threading/thread.h" | 18 #include "base/threading/thread.h" |
19 #include "base/time/default_tick_clock.h" | 19 #include "base/time/default_tick_clock.h" |
20 #include "base/time/time.h" | 20 #include "base/time/time.h" |
21 #include "media/base/android/demuxer_android.h" | 21 #include "media/base/android/demuxer_android.h" |
22 #include "media/base/android/media_codec_bridge.h" | 22 #include "media/base/android/media_codec_bridge.h" |
23 #include "media/base/android/media_decoder_job.h" | 23 #include "media/base/android/media_decoder_job.h" |
24 #include "media/base/android/media_drm_bridge.h" | 24 #include "media/base/android/media_drm_bridge.h" |
25 #include "media/base/android/media_player_android.h" | 25 #include "media/base/android/media_player_android.h" |
26 #include "media/base/media_export.h" | 26 #include "media/base/media_export.h" |
27 #include "media/base/time_delta_interpolator.h" | 27 #include "media/base/time_delta_interpolator.h" |
28 | 28 |
29 namespace media { | 29 namespace media { |
30 | 30 |
31 class AudioDecoderJob; | 31 class AudioDecoderJob; |
32 class VideoDecoderJob; | 32 class VideoDecoderJob; |
33 | 33 |
34 // This class handles media source extensions on Android. It uses Android | 34 // This class handles media source extensions on Android. It uses Android |
35 // MediaCodec to decode audio and video streams in two separate threads. | 35 // MediaCodec to decode audio and video streams in two separate threads. |
36 class MEDIA_EXPORT MediaSourcePlayer : public MediaPlayerAndroid, | 36 class MEDIA_EXPORT LegacyMediaSourcePlayer : public MediaPlayerAndroid, |
37 public DemuxerAndroidClient { | 37 public DemuxerAndroidClient { |
38 public: | 38 public: |
39 // Constructs a player with the given ID and demuxer. |manager| must outlive | 39 // Constructs a player with the given ID and demuxer. |manager| must outlive |
40 // the lifetime of this object. | 40 // the lifetime of this object. |
41 MediaSourcePlayer(int player_id, | 41 LegacyMediaSourcePlayer(int player_id, |
42 MediaPlayerManager* manager, | 42 MediaPlayerManager* manager, |
43 const RequestMediaResourcesCB& request_media_resources_cb, | 43 const RequestMediaResourcesCB& request_resources_cb, |
44 scoped_ptr<DemuxerAndroid> demuxer, | 44 scoped_ptr<DemuxerAndroid> demuxer, |
45 const GURL& frame_url); | 45 const GURL& frame_url); |
46 ~MediaSourcePlayer() override; | 46 ~LegacyMediaSourcePlayer() override; |
47 | 47 |
48 // MediaPlayerAndroid implementation. | 48 // MediaPlayerAndroid implementation. |
49 void SetVideoSurface(gfx::ScopedJavaSurface surface) override; | 49 void SetVideoSurface(gfx::ScopedJavaSurface surface) override; |
50 void Start() override; | 50 void Start() override; |
51 void Pause(bool is_media_related_action) override; | 51 void Pause(bool is_media_related_action) override; |
52 void SeekTo(base::TimeDelta timestamp) override; | 52 void SeekTo(base::TimeDelta timestamp) override; |
53 void Release() override; | 53 void Release() override; |
54 void SetVolume(double volume) override; | 54 void SetVolume(double volume) override; |
55 int GetVideoWidth() override; | 55 int GetVideoWidth() override; |
56 int GetVideoHeight() override; | 56 int GetVideoHeight() override; |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 bool is_waiting_for_audio_decoder_; | 261 bool is_waiting_for_audio_decoder_; |
262 bool is_waiting_for_video_decoder_; | 262 bool is_waiting_for_video_decoder_; |
263 | 263 |
264 // Test-only callback for hooking the completion of the next decode cycle. | 264 // Test-only callback for hooking the completion of the next decode cycle. |
265 base::Closure decode_callback_for_testing_; | 265 base::Closure decode_callback_for_testing_; |
266 | 266 |
267 // Whether audio or video decoder is in the process of prerolling. | 267 // Whether audio or video decoder is in the process of prerolling. |
268 bool prerolling_; | 268 bool prerolling_; |
269 | 269 |
270 // Weak pointer passed to media decoder jobs for callbacks. | 270 // Weak pointer passed to media decoder jobs for callbacks. |
271 base::WeakPtr<MediaSourcePlayer> weak_this_; | 271 base::WeakPtr<LegacyMediaSourcePlayer> weak_this_; |
272 // NOTE: Weak pointers must be invalidated before all other member variables. | 272 // NOTE: Weak pointers must be invalidated before all other member variables. |
273 base::WeakPtrFactory<MediaSourcePlayer> weak_factory_; | 273 base::WeakPtrFactory<LegacyMediaSourcePlayer> weak_factory_; |
274 | 274 |
275 DISALLOW_COPY_AND_ASSIGN(MediaSourcePlayer); | 275 DISALLOW_COPY_AND_ASSIGN(LegacyMediaSourcePlayer); |
276 }; | 276 }; |
277 | 277 |
278 } // namespace media | 278 } // namespace media |
279 | 279 |
280 #endif // MEDIA_BASE_ANDROID_MEDIA_SOURCE_PLAYER_H_ | 280 #endif // MEDIA_BASE_ANDROID_LEGACY_MEDIA_SOURCE_PLAYER_H_ |
OLD | NEW |