| Index: mojo/dart/packages/mojo_services/lib/mojo/media/media_metadata.mojom.dart
|
| diff --git a/mojo/dart/packages/_mojo_for_test_only/lib/mojo/test/rect.mojom.dart b/mojo/dart/packages/mojo_services/lib/mojo/media/media_metadata.mojom.dart
|
| similarity index 50%
|
| copy from mojo/dart/packages/_mojo_for_test_only/lib/mojo/test/rect.mojom.dart
|
| copy to mojo/dart/packages/mojo_services/lib/mojo/media/media_metadata.mojom.dart
|
| index b9688b9a14af518d53a9ccf9da4bb68bbfa25a5e..2f033b259578d99bcfe7bc9462dc27e97bdfef13 100644
|
| --- a/mojo/dart/packages/_mojo_for_test_only/lib/mojo/test/rect.mojom.dart
|
| +++ b/mojo/dart/packages/mojo_services/lib/mojo/media/media_metadata.mojom.dart
|
| @@ -2,7 +2,7 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -library rect_mojom;
|
| +library media_metadata_mojom;
|
|
|
| import 'dart:async';
|
|
|
| @@ -11,18 +11,21 @@ import 'package:mojo/core.dart' as core;
|
|
|
|
|
|
|
| -class Rect extends bindings.Struct {
|
| +class MediaMetadata extends bindings.Struct {
|
| static const List<bindings.StructDataHeader> kVersions = const [
|
| - const bindings.StructDataHeader(24, 0)
|
| + const bindings.StructDataHeader(64, 0)
|
| ];
|
| - int x = 0;
|
| - int y = 0;
|
| - int width = 0;
|
| - int height = 0;
|
| + int duration = 0;
|
| + String title = null;
|
| + String artist = null;
|
| + String album = null;
|
| + String publisher = null;
|
| + String genre = null;
|
| + String composer = null;
|
|
|
| - Rect() : super(kVersions.last.size);
|
| + MediaMetadata() : super(kVersions.last.size);
|
|
|
| - static Rect deserialize(bindings.Message message) {
|
| + static MediaMetadata deserialize(bindings.Message message) {
|
| var decoder = new bindings.Decoder(message);
|
| var result = decode(decoder);
|
| if (decoder.excessHandles != null) {
|
| @@ -31,11 +34,11 @@ class Rect extends bindings.Struct {
|
| return result;
|
| }
|
|
|
| - static Rect decode(bindings.Decoder decoder0) {
|
| + static MediaMetadata decode(bindings.Decoder decoder0) {
|
| if (decoder0 == null) {
|
| return null;
|
| }
|
| - Rect result = new Rect();
|
| + MediaMetadata result = new MediaMetadata();
|
|
|
| var mainDataHeader = decoder0.decodeStructDataHeader();
|
| if (mainDataHeader.version <= kVersions.last.version) {
|
| @@ -57,19 +60,31 @@ class Rect extends bindings.Struct {
|
| }
|
| if (mainDataHeader.version >= 0) {
|
|
|
| - result.x = decoder0.decodeInt32(8);
|
| + result.duration = decoder0.decodeUint64(8);
|
| }
|
| if (mainDataHeader.version >= 0) {
|
|
|
| - result.y = decoder0.decodeInt32(12);
|
| + result.title = decoder0.decodeString(16, true);
|
| }
|
| if (mainDataHeader.version >= 0) {
|
|
|
| - result.width = decoder0.decodeInt32(16);
|
| + result.artist = decoder0.decodeString(24, true);
|
| }
|
| if (mainDataHeader.version >= 0) {
|
|
|
| - result.height = decoder0.decodeInt32(20);
|
| + result.album = decoder0.decodeString(32, true);
|
| + }
|
| + if (mainDataHeader.version >= 0) {
|
| +
|
| + result.publisher = decoder0.decodeString(40, true);
|
| + }
|
| + if (mainDataHeader.version >= 0) {
|
| +
|
| + result.genre = decoder0.decodeString(48, true);
|
| + }
|
| + if (mainDataHeader.version >= 0) {
|
| +
|
| + result.composer = decoder0.decodeString(56, true);
|
| }
|
| return result;
|
| }
|
| @@ -77,29 +92,41 @@ class Rect extends bindings.Struct {
|
| void encode(bindings.Encoder encoder) {
|
| var encoder0 = encoder.getStructEncoderAtOffset(kVersions.last);
|
|
|
| - encoder0.encodeInt32(x, 8);
|
| + encoder0.encodeUint64(duration, 8);
|
| +
|
| + encoder0.encodeString(title, 16, true);
|
| +
|
| + encoder0.encodeString(artist, 24, true);
|
| +
|
| + encoder0.encodeString(album, 32, true);
|
|
|
| - encoder0.encodeInt32(y, 12);
|
| + encoder0.encodeString(publisher, 40, true);
|
|
|
| - encoder0.encodeInt32(width, 16);
|
| + encoder0.encodeString(genre, 48, true);
|
|
|
| - encoder0.encodeInt32(height, 20);
|
| + encoder0.encodeString(composer, 56, true);
|
| }
|
|
|
| String toString() {
|
| - return "Rect("
|
| - "x: $x" ", "
|
| - "y: $y" ", "
|
| - "width: $width" ", "
|
| - "height: $height" ")";
|
| + return "MediaMetadata("
|
| + "duration: $duration" ", "
|
| + "title: $title" ", "
|
| + "artist: $artist" ", "
|
| + "album: $album" ", "
|
| + "publisher: $publisher" ", "
|
| + "genre: $genre" ", "
|
| + "composer: $composer" ")";
|
| }
|
|
|
| Map toJson() {
|
| Map map = new Map();
|
| - map["x"] = x;
|
| - map["y"] = y;
|
| - map["width"] = width;
|
| - map["height"] = height;
|
| + map["duration"] = duration;
|
| + map["title"] = title;
|
| + map["artist"] = artist;
|
| + map["album"] = album;
|
| + map["publisher"] = publisher;
|
| + map["genre"] = genre;
|
| + map["composer"] = composer;
|
| return map;
|
| }
|
| }
|
|
|