#include "mojo/public/cpp/bindings/receiver.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "third_party/abseil-cpp/absl/types/optional.h"
+#include "tizen_src/chromium_impl/media/filters/media_player_tizen_client.h"
#include "ui/gfx/geometry/size.h"
namespace base {
class CONTENT_EXPORT TizenRendererImpl
: public media::Renderer,
- public media::mojom::MediaPlayerRendererExtension {
+ public media::mojom::MediaPlayerRendererExtension,
+ public media::MediaPlayerTizenClient {
public:
using RendererExtension = media::mojom::MediaPlayerRendererExtension;
using ClientExtension = media::mojom::MediaPlayerRendererClientExtension;
void SetPlaybackRate(double playback_rate) override;
void SetVolume(float volume) override;
base::TimeDelta GetMediaTime() override;
+ media::RendererType GetRendererType() override;
void OnSelectedVideoTracksChanged(
const std::vector<media::DemuxerStream*>& enabled_tracks,
base::OnceClosure change_completed_cb) override;
void OnUpdateAudioMutingState(bool muted) {}
void OnWebContentsDestroyed();
- // Should be removed.
void Seek(base::TimeDelta time, base::OnceClosure seek_cb);
void Suspend() override;
- // Proxy functions for MediaPlayerRendererClientExtension
- void OnVideoSizeChange(const gfx::Size& size);
- void OnDurationChange(base::TimeDelta duration);
- void OnBufferUpdate(base::TimeDelta time);
-
-#if defined(TIZEN_VIDEO_HOLE)
- void SetVideoHole(bool is_video_hole) final;
- void SetMediaGeometry(const gfx::RectF& rect) final;
-
- gfx::Rect GetViewportRect() const;
+ void ToggleFullscreenMode(bool is_fullscreen, ToggledFullscreenCB cb) final;
+
+ // MediaPlayerTizenClient implementation.
+ void OnError(media::PipelineStatus error) override;
+ void OnFallback(media::PipelineStatus fallback) override {}
+ void OnEnded() override;
+ void OnStatisticsUpdate(const media::PipelineStatistics& stats) override;
+ void OnSeekableTimeChange(base::TimeDelta min_time,
+ base::TimeDelta max_time,
+ bool is_live) override;
+ void OnBufferingStateChange(
+ media::BufferingState new_buffering_state,
+ media::BufferingStateChangeReason reason) override;
+ void OnWaiting(media::WaitingReason reason) override;
+ void OnAudioConfigChange(const media::AudioDecoderConfig& config) override;
+ void OnVideoConfigChange(const media::VideoDecoderConfig& config) override;
+ void OnVideoNaturalSizeChange(const gfx::Size& size) override;
+ void OnVideoOpacityChange(bool opaque) override;
+ void OnVideoFrameRateChange(absl::optional<int> fps) override;
+ void OnRequestSeek(base::TimeDelta time) override;
+ void OnRequestSuspend(bool resource_conflict) override;
+ void OnVideoSizeChange(const gfx::Size& size) override;
+ void OnDurationChange(base::TimeDelta duration) override;
+ void OnBufferUpdate(base::TimeDelta time) override;
+
+#if BUILDFLAG(IS_TIZEN_TV)
+ bool PlaybackNotificationEnabled();
+ void NotifyPlaybackState(int state,
+ int player_id = 0,
+ const std::string& url = "",
+ const std::string& mime_type = "",
+ bool* media_resource_acquired = NULL,
+ std::string* translated_url = NULL,
+ std::string* drm_info = NULL) override;
+ void OnLivePlaybackComplete() override;
#endif
+#if defined(TIZEN_TBM_SUPPORT)
+ void OnNewTbmFrameAvailable(uint32_t player_id,
+ gfx::TbmBufferHandle tbm_handle,
+ base::TimeDelta timestamp) override;
+ void OnTbmBufferExhausted(const gfx::TbmBufferHandle& tbm_handle) override;
+#else
void OnNewFrameAvailable(uint32_t playerId,
base::UnsafeSharedMemoryRegion frame,
uint32_t size,
base::TimeDelta timestamp,
uint32_t width,
- uint32_t height);
+ uint32_t height) override;
+#endif
-#if defined(TIZEN_TBM_SUPPORT)
- void OnNewTbmFrameAvailable(uint32_t player_id,
- gfx::TbmBufferHandle tbm_handle,
- base::TimeDelta timestamp);
- void OnTbmBufferExhausted(const gfx::TbmBufferHandle& tbm_handle) override;
+#if BUILDFLAG(IS_TIZEN_TV)
+ content::WebContentsDelegate* GetWebContentsDelegate() const override;
+#endif
+
+#if defined(TIZEN_VIDEO_HOLE)
+ void SetVideoHole(bool is_video_hole) final;
+ void SetMediaGeometry(const gfx::RectF& rect) final;
+ gfx::Rect GetViewportRect() const;
#endif
- void OnRequestSuspend(bool resource_conflict);
+#if BUILDFLAG(IS_TIZEN_TV)
+ void SetContentMimeType(const std::string& mime_type) override;
+ void SetParentalRatingResult(bool is_pass) override;
+#endif
private:
- class RendererClientInternal;
const float kDefaultVolume = 1.0;
enum State {
void SetStreamInfo();
void SetPlayerVolume();
+ void SetPlayerInitialize();
+ void SetPlayerPrepare();
#if defined(TIZEN_VIDEO_HOLE)
void SetPlayerVideoHole();
void SetPlayerMediaGeometry();
+ void OnWebViewMoved();
#endif
- void OnRendererEnded();
- void OnError(media::PipelineStatus error);
- void OnStatisticsUpdate(const media::PipelineStatistics& stats);
- void OnBufferingStateChange(media::BufferingState new_buffering_state,
- media::BufferingStateChangeReason reason);
- void OnWaiting(media::WaitingReason reason);
- void OnAudioConfigChange(const media::AudioDecoderConfig& config);
- void OnVideoConfigChange(const media::VideoDecoderConfig& config);
- void OnVideoNaturalSizeChange(const gfx::Size& size);
- void OnVideoOpacityChange(bool opaque);
- void OnVideoFrameRateChange(absl::optional<int> fps);
-
- void OnRequestSeek(base::TimeDelta time);
+ content::WebContents* GetWebContents() const;
media::RendererClient* client_ = nullptr;
// Temporary callback used for Initialize().
media::PipelineStatusCallback init_cb_;
- std::unique_ptr<RendererClientInternal> audio_renderer_client_;
- std::unique_ptr<RendererClientInternal> video_renderer_client_;
-
media::MediaResource* media_resource_ = nullptr;
media::DemuxerStream* audio_stream_ = nullptr;
media::DemuxerStream* video_stream_ = nullptr;
gfx::RectF video_rect_;
#endif
+#if BUILDFLAG(IS_TIZEN_TV)
+ int notify_playback_state_;
+ // Stores the mime type. Required for URL streams which are DASH
+ // content, so that we can set it to the media_player_ before calling
+ // initialize / prepare.
+ std::string mime_type_;
+#endif
+
WebContents* web_contents_ = nullptr;
base::WeakPtrFactory<TizenRendererImpl> weak_factory_{this};