Home | History | Annotate | Download | only in android
      1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 #ifndef MEDIA_BASE_ANDROID_MEDIA_PLAYER_MANAGER_H_
      6 #define MEDIA_BASE_ANDROID_MEDIA_PLAYER_MANAGER_H_
      7 
      8 #include "base/basictypes.h"
      9 #include "base/time/time.h"
     10 #include "media/base/android/demuxer_stream_player_params.h"
     11 #include "media/base/media_export.h"
     12 
     13 namespace media {
     14 
     15 class MediaPlayerAndroid;
     16 class MediaResourceGetter;
     17 class MediaUrlInterceptor;
     18 
     19 // This class is responsible for managing active MediaPlayerAndroid objects.
     20 class MEDIA_EXPORT MediaPlayerManager {
     21  public:
     22   virtual ~MediaPlayerManager() {}
     23 
     24   // Returns a pointer to the MediaResourceGetter object.
     25   virtual MediaResourceGetter* GetMediaResourceGetter() = 0;
     26 
     27   // Returns a pointer to the MediaUrlInterceptor object or null.
     28   virtual MediaUrlInterceptor* GetMediaUrlInterceptor() = 0;
     29 
     30   // Called when time update messages need to be sent. Args: player ID,
     31   // current timestamp, current time ticks.
     32   virtual void OnTimeUpdate(int player_id,
     33                             base::TimeDelta current_timestamp,
     34                             base::TimeTicks current_time_ticks) = 0;
     35 
     36   // Called when media metadata changed. Args: player ID, duration of the
     37   // media, width, height, whether the metadata is successfully extracted.
     38   virtual void OnMediaMetadataChanged(
     39       int player_id,
     40       base::TimeDelta duration,
     41       int width,
     42       int height,
     43       bool success) = 0;
     44 
     45   // Called when playback completed. Args: player ID.
     46   virtual void OnPlaybackComplete(int player_id) = 0;
     47 
     48   // Called when media download was interrupted. Args: player ID.
     49   virtual void OnMediaInterrupted(int player_id) = 0;
     50 
     51   // Called when buffering has changed. Args: player ID, percentage
     52   // of the media.
     53   virtual void OnBufferingUpdate(int player_id, int percentage) = 0;
     54 
     55   // Called when seek completed. Args: player ID, current time.
     56   virtual void OnSeekComplete(
     57       int player_id,
     58       const base::TimeDelta& current_time) = 0;
     59 
     60   // Called when error happens. Args: player ID, error type.
     61   virtual void OnError(int player_id, int error) = 0;
     62 
     63   // Called when video size has changed. Args: player ID, width, height.
     64   virtual void OnVideoSizeChanged(int player_id, int width, int height) = 0;
     65 
     66   // Returns the player that's in the fullscreen mode currently.
     67   virtual MediaPlayerAndroid* GetFullscreenPlayer() = 0;
     68 
     69   // Returns the player with the specified id.
     70   virtual MediaPlayerAndroid* GetPlayer(int player_id) = 0;
     71 
     72   // Called by the player to get a hardware protected surface.
     73   virtual void RequestFullScreen(int player_id) = 0;
     74 
     75 #if defined(VIDEO_HOLE)
     76   // Returns true if a media player should use video-overlay for the embedded
     77   // encrypted video.
     78   virtual bool ShouldUseVideoOverlayForEmbeddedEncryptedVideo() = 0;
     79 #endif  // defined(VIDEO_HOLE)
     80 };
     81 
     82 }  // namespace media
     83 
     84 #endif  // MEDIA_BASE_ANDROID_MEDIA_PLAYER_MANAGER_H_
     85