| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 CHROME_COMMON_MEDIA_ROUTER_MEDIA_STATUS_H_ | 5 #ifndef CHROME_COMMON_MEDIA_ROUTER_MEDIA_STATUS_H_ |
| 6 #define CHROME_COMMON_MEDIA_ROUTER_MEDIA_STATUS_H_ | 6 #define CHROME_COMMON_MEDIA_ROUTER_MEDIA_STATUS_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| 11 | 11 |
| 12 namespace media_router { | 12 namespace media_router { |
| 13 | 13 |
| 14 // Represents the current state of a media content. | 14 // Represents the current state of a media content. |
| 15 struct MediaStatus { | 15 struct MediaStatus { |
| 16 public: | 16 public: |
| 17 enum class PlayState { PLAYING, PAUSED, BUFFERING }; |
| 18 |
| 17 MediaStatus(); | 19 MediaStatus(); |
| 18 MediaStatus(const MediaStatus& other); | 20 MediaStatus(const MediaStatus& other); |
| 19 ~MediaStatus(); | 21 ~MediaStatus(); |
| 20 | 22 |
| 21 MediaStatus& operator=(const MediaStatus& other); | 23 MediaStatus& operator=(const MediaStatus& other); |
| 22 bool operator==(const MediaStatus& other) const; | 24 bool operator==(const MediaStatus& other) const; |
| 23 | 25 |
| 24 // The main title of the media. For example, in a MediaStatus representing | 26 // The main title of the media. For example, in a MediaStatus representing |
| 25 // a YouTube Cast session, this could be the title of the video. | 27 // a YouTube Cast session, this could be the title of the video. |
| 26 std::string title; | 28 std::string title; |
| 27 | 29 |
| 28 // Text describing the media, or a secondary title. For example, in a | 30 // Text describing the media, or a secondary title. For example, in a |
| 29 // MediaStatus representing a YouTube Cast session, this could be "YouTube". | 31 // MediaStatus representing a YouTube Cast session, this could be "YouTube". |
| 30 std::string description; | 32 std::string description; |
| 31 | 33 |
| 32 // If this is true, the media can be played and paused. | 34 // If this is true, the media can be played and paused. |
| 33 bool can_play_pause = false; | 35 bool can_play_pause = false; |
| 34 | 36 |
| 35 // If this is true, the media can be muted and unmuted. | 37 // If this is true, the media can be muted and unmuted. |
| 36 bool can_mute = false; | 38 bool can_mute = false; |
| 37 | 39 |
| 38 // If this is true, the media's volume can be changed. | 40 // If this is true, the media's volume can be changed. |
| 39 bool can_set_volume = false; | 41 bool can_set_volume = false; |
| 40 | 42 |
| 41 // If this is true, the media's current playback position can be changed. | 43 // If this is true, the media's current playback position can be changed. |
| 42 bool can_seek = false; | 44 bool can_seek = false; |
| 43 | 45 |
| 44 bool is_paused = false; | 46 PlayState play_state = PlayState::PLAYING; |
| 45 | 47 |
| 46 bool is_muted = false; | 48 bool is_muted = false; |
| 47 | 49 |
| 48 // Current volume of the media, with 1 being the highest and 0 being the | 50 // Current volume of the media, with 1 being the highest and 0 being the |
| 49 // lowest/no sound. When |is_muted| is true, there should be no sound | 51 // lowest/no sound. When |is_muted| is true, there should be no sound |
| 50 // regardless of |volume|. | 52 // regardless of |volume|. |
| 51 float volume = 0; | 53 float volume = 0; |
| 52 | 54 |
| 53 // The length of the media. A value of zero indicates that this is a media | 55 // The length of the media. A value of zero indicates that this is a media |
| 54 // with no set duration (e.g. a live stream). | 56 // with no set duration (e.g. a live stream). |
| 55 base::TimeDelta duration; | 57 base::TimeDelta duration; |
| 56 | 58 |
| 57 // Current playback position. Must be less than or equal to |duration|. | 59 // Current playback position. Must be less than or equal to |duration|. |
| 58 base::TimeDelta current_time; | 60 base::TimeDelta current_time; |
| 59 }; | 61 }; |
| 60 | 62 |
| 61 } // namespace media_router | 63 } // namespace media_router |
| 62 | 64 |
| 63 #endif // CHROME_COMMON_MEDIA_ROUTER_MEDIA_STATUS_H_ | 65 #endif // CHROME_COMMON_MEDIA_ROUTER_MEDIA_STATUS_H_ |
| OLD | NEW |