1 // Copyright 2023 Samsung Electronics Inc. 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.
5 #ifndef MEDIA_FILTERS_MEDIA_PLAYER_BRIDGE_CAPI_TV_H_
6 #define MEDIA_FILTERS_MEDIA_PLAYER_BRIDGE_CAPI_TV_H_
8 #include <player_product.h>
10 #include "media/filters/media_player_bridge_capi.h"
21 // This class is focus on HBBTV/HLS feature on Tizen TV.
22 class MEDIA_EXPORT MediaPlayerBridgeCapiTV : public MediaPlayerBridgeCapi {
24 MediaPlayerBridgeCapiTV(const GURL& url,
25 const std::string& user_agent,
27 ~MediaPlayerBridgeCapiTV() override;
28 void Initialize(VideoRendererSink* sink) override;
30 void Prepare() override;
31 void Release() override;
32 void Pause(bool is_media_related_action) override;
33 void SetContentMimeType(const std::string& mime_type) override;
34 void PlaybackCompleteUpdate() override;
35 bool PreloadIfNeeded(int& ret) override;
36 void UpdateMediaType() override;
37 void UpdateDuration() override;
39 void AppendUrlHighBitRate(const std::string& url);
40 bool CheckHighBitRate();
41 void HandleDownloadableFontInfo(const std::string& scheme_id_uri,
42 const std::string& value,
43 const std::string& data,
45 void OnPlayerPreloading();
47 void OnDrmError(int err_code, char* err_str);
48 void SetParentalRatingResult(bool is_pass) override;
49 void HandleParentalRatingInfo(const std::string& info,
50 const std::string& url);
53 void PlayerPrepared() override;
56 void PlayerPreloaded();
58 void SetDisplayAtPausedState();
59 bool CheckLiveStreaming() const;
60 bool HBBTVResourceAcquired();
61 bool SetDrmInfo(std::string& drm_info);
62 bool SetMediaDRMInfo(const std::string&, const std::string&);
63 bool is_preloaded_{false};
64 bool is_player_seek_available_{true};
65 void StartSeekableTimeUpdateTimer();
66 void StopSeekableTimeUpdateTimer();
67 void OnSeekableTimeUpdateTimerFired();
68 void GetAdaptiveStreamingInfo();
69 void UpdateSeekableTime();
71 bool GetLiveStreamingDuration(int64_t* min, int64_t* max);
72 bool GetDashLiveDuration(int64_t* duration);
73 std::string GetDashInfo();
75 StreamType stream_type_{OTHER_STREAM};
76 std::string hbbtv_url_{""}; // url_ + HIGHBITRATE(if mpd)
77 std::string mime_type_ = "";
78 std::string clean_url_{""}; // Original url without suffix t/period
79 std::string mrs_url_{""};
80 std::string content_id_{""}; // clean_url + period,only report to APP
82 bool parental_rating_pass_{false};
84 base::TimeDelta min_seekable_time_{base::TimeDelta()};
85 base::TimeDelta max_seekable_time_{base::TimeDelta()};
86 base::RepeatingTimer seekable_time_update_timer_;
87 // NOTE: Weak pointers must be invalidated before all other member variables.
88 base::WeakPtrFactory<MediaPlayerBridgeCapiTV> weak_factory_;
92 #endif // MEDIA_FILTERS_MEDIA_PLAYER_BRIDGE_CAPI_TV_H_