| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 SERVICES_MEDIA_FRAMEWORK_METADATA_H_ | 5 #ifndef SERVICES_MEDIA_FRAMEWORK_METADATA_H_ |
| 6 #define SERVICES_MEDIA_FRAMEWORK_METADATA_H_ | 6 #define SERVICES_MEDIA_FRAMEWORK_METADATA_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "services/media/framework/ptr.h" | 12 #include "services/media/framework/safe_clone.h" |
| 13 | 13 |
| 14 namespace mojo { | 14 namespace mojo { |
| 15 namespace media { | 15 namespace media { |
| 16 | 16 |
| 17 class Metadata; | 17 class Metadata; |
| 18 | 18 |
| 19 // TODO(dalesat): Get rid of typedefs like these. | |
| 20 typedef UniquePtr<Metadata> MetadataPtr; | |
| 21 | |
| 22 // Container for content metadata. | 19 // Container for content metadata. |
| 23 // TODO(dalesat): Probably needs to be extensible. Consider using map-like. | 20 // TODO(dalesat): Probably needs to be extensible. Consider using map-like. |
| 24 class Metadata { | 21 class Metadata { |
| 25 public: | 22 public: |
| 26 // TODO(dalesat): Rename methods like this 'Create'. | 23 static std::unique_ptr<Metadata> Create( |
| 27 static MetadataPtr Create( | |
| 28 uint64_t duration_ns, | 24 uint64_t duration_ns, |
| 29 const std::string& title, | 25 const std::string& title, |
| 30 const std::string& artist, | 26 const std::string& artist, |
| 31 const std::string& album, | 27 const std::string& album, |
| 32 const std::string& publisher, | 28 const std::string& publisher, |
| 33 const std::string& genre, | 29 const std::string& genre, |
| 34 const std::string& composer); | 30 const std::string& composer); |
| 35 | 31 |
| 36 ~Metadata(); | 32 ~Metadata(); |
| 37 | 33 |
| 38 uint64_t duration_ns() const { return duration_ns_; } | 34 uint64_t duration_ns() const { return duration_ns_; } |
| 39 | 35 |
| 40 const std::string& title() const { return title_; } | 36 const std::string& title() const { return title_; } |
| 41 | 37 |
| 42 const std::string& artist() const { return artist_; } | 38 const std::string& artist() const { return artist_; } |
| 43 | 39 |
| 44 const std::string& album() const { return album_; } | 40 const std::string& album() const { return album_; } |
| 45 | 41 |
| 46 const std::string& publisher() const { return publisher_; } | 42 const std::string& publisher() const { return publisher_; } |
| 47 | 43 |
| 48 const std::string& genre() const { return genre_; } | 44 const std::string& genre() const { return genre_; } |
| 49 | 45 |
| 50 const std::string& composer() const { return composer_; } | 46 const std::string& composer() const { return composer_; } |
| 51 | 47 |
| 52 MetadataPtr Clone() const { | 48 std::unique_ptr<Metadata> Clone() const { |
| 53 return Create( | 49 return Create( |
| 54 duration_ns_, | 50 duration_ns_, |
| 55 title_, | 51 title_, |
| 56 artist_, | 52 artist_, |
| 57 album_, | 53 album_, |
| 58 publisher_, | 54 publisher_, |
| 59 genre_, | 55 genre_, |
| 60 composer_); | 56 composer_); |
| 61 } | 57 } |
| 62 | 58 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 78 std::string genre_; | 74 std::string genre_; |
| 79 std::string composer_; | 75 std::string composer_; |
| 80 | 76 |
| 81 DISALLOW_COPY_AND_ASSIGN(Metadata); | 77 DISALLOW_COPY_AND_ASSIGN(Metadata); |
| 82 }; | 78 }; |
| 83 | 79 |
| 84 } // namespace media | 80 } // namespace media |
| 85 } // namespace mojo | 81 } // namespace mojo |
| 86 | 82 |
| 87 #endif // SERVICES_MEDIA_FRAMEWORK_METADATA_H_ | 83 #endif // SERVICES_MEDIA_FRAMEWORK_METADATA_H_ |
| OLD | NEW |