00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 package org.xbmc.android.jsonrpc.api.model;
00022
00023 import android.os.Parcel;
00024 import android.os.Parcelable;
00025 import java.util.ArrayList;
00026 import java.util.Arrays;
00027 import java.util.HashSet;
00028 import java.util.List;
00029 import java.util.Set;
00030 import org.codehaus.jackson.JsonNode;
00031 import org.codehaus.jackson.node.ArrayNode;
00032 import org.codehaus.jackson.node.ObjectNode;
00033 import org.xbmc.android.jsonrpc.api.AbstractModel;
00034
00035 public final class PlayerModel {
00036
00043 public static class AudioStream extends AbstractModel {
00044 public final static String API_TYPE = "Player.Audio.Stream";
00045
00046
00047 public static final String BITRATE = "bitrate";
00048 public static final String CHANNELS = "channels";
00049 public static final String CODEC = "codec";
00050 public static final String INDEX = "index";
00051 public static final String LANGUAGE = "language";
00052 public static final String NAME = "name";
00053
00054
00055 public final Integer bitrate;
00056 public final Integer channels;
00057 public final String codec;
00058 public final Integer index;
00059 public final String language;
00060 public final String name;
00061
00070 public AudioStream(Integer bitrate, Integer channels, String codec, Integer index, String language, String name) {
00071 this.bitrate = bitrate;
00072 this.channels = channels;
00073 this.codec = codec;
00074 this.index = index;
00075 this.language = language;
00076 this.name = name;
00077 }
00078
00083 public AudioStream(JsonNode node) {
00084 index = node.get(INDEX).getIntValue();
00085 language = node.get(LANGUAGE).getTextValue();
00086 name = node.get(NAME).getTextValue();
00087
00088 if (node.has(BITRATE)) {
00089 bitrate = node.get(BITRATE).getIntValue();
00090 } else {
00091 bitrate = null;
00092 }
00093
00094 if (node.has(CHANNELS)) {
00095 channels = node.get(CHANNELS).getIntValue();
00096 } else {
00097 channels = null;
00098 }
00099
00100 if (node.has(CODEC)) {
00101 codec = node.get(CODEC).getTextValue();
00102 } else {
00103 codec = null;
00104 }
00105 }
00106
00107 @Override
00108 public JsonNode toJsonNode() {
00109 final ObjectNode node = OM.createObjectNode();
00110 node.put(BITRATE, bitrate);
00111 node.put(CHANNELS, channels);
00112 node.put(CODEC, codec);
00113 node.put(INDEX, index);
00114 node.put(LANGUAGE, language);
00115 node.put(NAME, name);
00116 return node;
00117 }
00118
00124 static List<AudioStream> getPlayerModelAudioStreamList(JsonNode node, String key) {
00125 if (node.has(key)) {
00126 final ArrayNode a = (ArrayNode)node.get(key);
00127 final List<AudioStream> l = new ArrayList<AudioStream>(a.size());
00128 for (int i = 0; i < a.size(); i++) {
00129 l.add(new AudioStream((JsonNode)a.get(i)));
00130 }
00131 return l;
00132 }
00133 return new ArrayList<AudioStream>(0);
00134 }
00135
00141 @Override
00142 public void writeToParcel(Parcel parcel, int flags) {
00143 parcel.writeValue(bitrate);
00144 parcel.writeValue(channels);
00145 parcel.writeValue(codec);
00146 parcel.writeValue(index);
00147 parcel.writeValue(language);
00148 parcel.writeValue(name);
00149 }
00150
00154 protected AudioStream(Parcel parcel) {
00155 bitrate = parcel.readInt();
00156 channels = parcel.readInt();
00157 codec = parcel.readString();
00158 index = parcel.readInt();
00159 language = parcel.readString();
00160 name = parcel.readString();
00161 }
00162
00166 public static final Parcelable.Creator<AudioStream> CREATOR = new Parcelable.Creator<AudioStream>() {
00167 @Override
00168 public AudioStream createFromParcel(Parcel parcel) {
00169 return new AudioStream(parcel);
00170 }
00171 @Override
00172 public AudioStream[] newArray(int n) {
00173 return new AudioStream[n];
00174 }
00175 };
00176
00177 @Override
00178 public int describeContents() {
00179 return 0;
00180 }
00181 }
00182
00189 public static class NotificationsData extends AbstractModel {
00190 public final static String API_TYPE = "Player.Notifications.Data";
00191
00192
00193 public static final String ITEM = "item";
00194 public static final String PLAYER = "player";
00195
00196
00197 public final NotificationsModel.Item item;
00198 public final NotificationsPlayer player;
00199
00204 public NotificationsData(NotificationsModel.Item item, NotificationsPlayer player) {
00205 this.item = item;
00206 this.player = player;
00207 }
00208
00209 @Override
00210 public JsonNode toJsonNode() {
00211 final ObjectNode node = OM.createObjectNode();
00212 node.put(ITEM, item.toJsonNode());
00213 node.put(PLAYER, player.toJsonNode());
00214 return node;
00215 }
00216
00222 @Override
00223 public void writeToParcel(Parcel parcel, int flags) {
00224 parcel.writeValue(item);
00225 parcel.writeValue(player);
00226 }
00227
00231 protected NotificationsData(Parcel parcel) {
00232 item = parcel.<NotificationsModel.Item>readParcelable(NotificationsModel.Item.class.getClassLoader());
00233 player = parcel.<NotificationsPlayer>readParcelable(NotificationsPlayer.class.getClassLoader());
00234 }
00235
00239 public static final Parcelable.Creator<NotificationsData> CREATOR = new Parcelable.Creator<NotificationsData>() {
00240 @Override
00241 public NotificationsData createFromParcel(Parcel parcel) {
00242 return new NotificationsData(parcel);
00243 }
00244 @Override
00245 public NotificationsData[] newArray(int n) {
00246 return new NotificationsData[n];
00247 }
00248 };
00249
00250 @Override
00251 public int describeContents() {
00252 return 0;
00253 }
00254 }
00255
00262 public static class NotificationsPlayer extends AbstractModel {
00263 public final static String API_TYPE = "Player.Notifications.Player";
00264
00265
00266 public static final String PLAYERID = "playerid";
00267 public static final String SPEED = "speed";
00268
00269
00270 public final Integer playerid;
00271 public final Integer speed;
00272
00277 public NotificationsPlayer(Integer playerid, Integer speed) {
00278 this.playerid = playerid;
00279 this.speed = speed;
00280 }
00281
00282 @Override
00283 public JsonNode toJsonNode() {
00284 final ObjectNode node = OM.createObjectNode();
00285 node.put(PLAYERID, playerid);
00286 node.put(SPEED, speed);
00287 return node;
00288 }
00289
00295 @Override
00296 public void writeToParcel(Parcel parcel, int flags) {
00297 parcel.writeValue(playerid);
00298 parcel.writeValue(speed);
00299 }
00300
00304 protected NotificationsPlayer(Parcel parcel) {
00305 playerid = parcel.readInt();
00306 speed = parcel.readInt();
00307 }
00308
00312 public static final Parcelable.Creator<NotificationsPlayer> CREATOR = new Parcelable.Creator<NotificationsPlayer>() {
00313 @Override
00314 public NotificationsPlayer createFromParcel(Parcel parcel) {
00315 return new NotificationsPlayer(parcel);
00316 }
00317 @Override
00318 public NotificationsPlayer[] newArray(int n) {
00319 return new NotificationsPlayer[n];
00320 }
00321 };
00322
00323 @Override
00324 public int describeContents() {
00325 return 0;
00326 }
00327 }
00328
00335 public static class NotificationsPlayerSeek extends NotificationsPlayer {
00336 public final static String API_TYPE = "Player.Notifications.Player.Seek";
00337
00338
00339 public static final String SEEKOFFSET = "seekoffset";
00340 public static final String TIME = "time";
00341
00342
00343 public final GlobalModel.Time seekoffset;
00344 public final GlobalModel.Time time;
00345
00346 @Override
00347 public JsonNode toJsonNode() {
00348 final ObjectNode node = (ObjectNode)super.toJsonNode();
00349 node.put(SEEKOFFSET, seekoffset.toJsonNode());
00350 node.put(TIME, time.toJsonNode());
00351 return node;
00352 }
00353
00359 @Override
00360 public void writeToParcel(Parcel parcel, int flags) {
00361 super.writeToParcel(parcel, flags);
00362 parcel.writeValue(seekoffset);
00363 parcel.writeValue(time);
00364 }
00365
00369 protected NotificationsPlayerSeek(Parcel parcel) {
00370 super(parcel);
00371 seekoffset = parcel.<GlobalModel.Time>readParcelable(GlobalModel.Time.class.getClassLoader());
00372 time = parcel.<GlobalModel.Time>readParcelable(GlobalModel.Time.class.getClassLoader());
00373 }
00374
00378 public static final Parcelable.Creator<NotificationsPlayerSeek> CREATOR = new Parcelable.Creator<NotificationsPlayerSeek>() {
00379 @Override
00380 public NotificationsPlayerSeek createFromParcel(Parcel parcel) {
00381 return new NotificationsPlayerSeek(parcel);
00382 }
00383 @Override
00384 public NotificationsPlayerSeek[] newArray(int n) {
00385 return new NotificationsPlayerSeek[n];
00386 }
00387 };
00388
00389 @Override
00390 public int describeContents() {
00391 return 0;
00392 }
00393 }
00394
00403 public static class PositionTime extends AbstractModel {
00404 public final static String API_TYPE = "Player.Position.Time";
00405
00406
00407 public static final String HOURS = "hours";
00408 public static final String MILLISECONDS = "milliseconds";
00409 public static final String MINUTES = "minutes";
00410 public static final String SECONDS = "seconds";
00411
00412
00413 public final Integer hours;
00414 public final Integer milliseconds;
00415 public final Integer minutes;
00416 public final Integer seconds;
00417
00425 public PositionTime(Integer hours, Integer milliseconds, Integer minutes, Integer seconds) {
00426 this.hours = hours;
00427 this.milliseconds = milliseconds;
00428 this.minutes = minutes;
00429 this.seconds = seconds;
00430 }
00431
00432 @Override
00433 public JsonNode toJsonNode() {
00434 final ObjectNode node = OM.createObjectNode();
00435 node.put(HOURS, hours);
00436 node.put(MILLISECONDS, milliseconds);
00437 node.put(MINUTES, minutes);
00438 node.put(SECONDS, seconds);
00439 return node;
00440 }
00441
00447 @Override
00448 public void writeToParcel(Parcel parcel, int flags) {
00449 parcel.writeValue(hours);
00450 parcel.writeValue(milliseconds);
00451 parcel.writeValue(minutes);
00452 parcel.writeValue(seconds);
00453 }
00454
00458 protected PositionTime(Parcel parcel) {
00459 hours = parcel.readInt();
00460 milliseconds = parcel.readInt();
00461 minutes = parcel.readInt();
00462 seconds = parcel.readInt();
00463 }
00464
00468 public static final Parcelable.Creator<PositionTime> CREATOR = new Parcelable.Creator<PositionTime>() {
00469 @Override
00470 public PositionTime createFromParcel(Parcel parcel) {
00471 return new PositionTime(parcel);
00472 }
00473 @Override
00474 public PositionTime[] newArray(int n) {
00475 return new PositionTime[n];
00476 }
00477 };
00478
00479 @Override
00480 public int describeContents() {
00481 return 0;
00482 }
00483 }
00484
00491 public static class PropertyValue extends AbstractModel {
00492 public final static String API_TYPE = "Player.Property.Value";
00493
00494
00495 public static final String AUDIOSTREAMS = "audiostreams";
00496 public static final String CANCHANGESPEED = "canchangespeed";
00497 public static final String CANMOVE = "canmove";
00498 public static final String CANREPEAT = "canrepeat";
00499 public static final String CANROTATE = "canrotate";
00500 public static final String CANSEEK = "canseek";
00501 public static final String CANSHUFFLE = "canshuffle";
00502 public static final String CANZOOM = "canzoom";
00503 public static final String CURRENTAUDIOSTREAM = "currentaudiostream";
00504 public static final String CURRENTSUBTITLE = "currentsubtitle";
00505 public static final String LIVE = "live";
00506 public static final String PARTYMODE = "partymode";
00507 public static final String PERCENTAGE = "percentage";
00508 public static final String PLAYLISTID = "playlistid";
00509 public static final String POSITION = "position";
00510 public static final String REPEAT = "repeat";
00511 public static final String SHUFFLED = "shuffled";
00512 public static final String SPEED = "speed";
00513 public static final String SUBTITLEENABLED = "subtitleenabled";
00514 public static final String SUBTITLES = "subtitles";
00515 public static final String TIME = "time";
00516 public static final String TOTALTIME = "totaltime";
00517 public static final String TYPE = "type";
00518
00519
00520 public final List<AudioStream> audiostreams;
00521 public final Boolean canchangespeed;
00522 public final Boolean canmove;
00523 public final Boolean canrepeat;
00524 public final Boolean canrotate;
00525 public final Boolean canseek;
00526 public final Boolean canshuffle;
00527 public final Boolean canzoom;
00528 public final AudioStream currentaudiostream;
00529 public final Subtitle currentsubtitle;
00530 public final Boolean live;
00531 public final Boolean partymode;
00532 public final Double percentage;
00533 public final Integer playlistid;
00534 public final Integer position;
00535 public final String repeat;
00536 public final Boolean shuffled;
00537 public final Integer speed;
00538 public final Boolean subtitleenabled;
00539 public final List<Subtitle> subtitles;
00540 public final GlobalModel.Time time;
00541 public final GlobalModel.Time totaltime;
00542 public final String type;
00543
00569 public PropertyValue(List<AudioStream> audiostreams, Boolean canchangespeed, Boolean canmove, Boolean canrepeat, Boolean canrotate, Boolean canseek, Boolean canshuffle, Boolean canzoom, AudioStream currentaudiostream, Subtitle currentsubtitle, Boolean live, Boolean partymode, Double percentage, Integer playlistid, Integer position, String repeat, Boolean shuffled, Integer speed, Boolean subtitleenabled, List<Subtitle> subtitles, GlobalModel.Time time, GlobalModel.Time totaltime, String type) {
00570 this.audiostreams = audiostreams;
00571 this.canchangespeed = canchangespeed;
00572 this.canmove = canmove;
00573 this.canrepeat = canrepeat;
00574 this.canrotate = canrotate;
00575 this.canseek = canseek;
00576 this.canshuffle = canshuffle;
00577 this.canzoom = canzoom;
00578 this.currentaudiostream = currentaudiostream;
00579 this.currentsubtitle = currentsubtitle;
00580 this.live = live;
00581 this.partymode = partymode;
00582 this.percentage = percentage;
00583 this.playlistid = playlistid;
00584 this.position = position;
00585 this.repeat = repeat;
00586 this.shuffled = shuffled;
00587 this.speed = speed;
00588 this.subtitleenabled = subtitleenabled;
00589 this.subtitles = subtitles;
00590 this.time = time;
00591 this.totaltime = totaltime;
00592 this.type = type;
00593 }
00594
00599 public PropertyValue(JsonNode node) {
00600 audiostreams = AudioStream.getPlayerModelAudioStreamList(node, AUDIOSTREAMS);
00601 canchangespeed = parseBoolean(node, CANCHANGESPEED);
00602 canmove = parseBoolean(node, CANMOVE);
00603 canrepeat = parseBoolean(node, CANREPEAT);
00604 canrotate = parseBoolean(node, CANROTATE);
00605 canseek = parseBoolean(node, CANSEEK);
00606 canshuffle = parseBoolean(node, CANSHUFFLE);
00607 canzoom = parseBoolean(node, CANZOOM);
00608 currentaudiostream = node.has(CURRENTAUDIOSTREAM) && node.get(CURRENTAUDIOSTREAM).has(AudioStream.INDEX) ? new AudioStream(node.get(CURRENTAUDIOSTREAM)) : null;
00609 currentsubtitle = node.has(CURRENTSUBTITLE) ? new Subtitle(node.get(CURRENTSUBTITLE)) : null;
00610 live = parseBoolean(node, LIVE);
00611 partymode = parseBoolean(node, PARTYMODE);
00612 percentage = parseDouble(node, PERCENTAGE);
00613 playlistid = parseInt(node, PLAYLISTID);
00614 position = parseInt(node, POSITION);
00615 repeat = parseString(node, REPEAT);
00616 shuffled = parseBoolean(node, SHUFFLED);
00617 speed = parseInt(node, SPEED);
00618 subtitleenabled = parseBoolean(node, SUBTITLEENABLED);
00619 subtitles = Subtitle.getPlayerModelSubtitleList(node, SUBTITLES);
00620 time = node.has(TIME) ? new GlobalModel.Time(node.get(TIME)) : null;
00621 totaltime = node.has(TOTALTIME) ? new GlobalModel.Time(node.get(TOTALTIME)) : null;
00622 type = parseString(node, TYPE);
00623 }
00624
00625 @Override
00626 public JsonNode toJsonNode() {
00627 final ObjectNode node = OM.createObjectNode();
00628 final ArrayNode audiostreamsArray = OM.createArrayNode();
00629 for (AudioStream item : audiostreams) {
00630 audiostreamsArray.add(item.toJsonNode());
00631 }
00632 node.put(AUDIOSTREAMS, audiostreamsArray);
00633 node.put(CANCHANGESPEED, canchangespeed);
00634 node.put(CANMOVE, canmove);
00635 node.put(CANREPEAT, canrepeat);
00636 node.put(CANROTATE, canrotate);
00637 node.put(CANSEEK, canseek);
00638 node.put(CANSHUFFLE, canshuffle);
00639 node.put(CANZOOM, canzoom);
00640 node.put(CURRENTAUDIOSTREAM, currentaudiostream.toJsonNode());
00641 node.put(CURRENTSUBTITLE, currentsubtitle.toJsonNode());
00642 node.put(LIVE, live);
00643 node.put(PARTYMODE, partymode);
00644 node.put(PERCENTAGE, percentage);
00645 node.put(PLAYLISTID, playlistid);
00646 node.put(POSITION, position);
00647 node.put(REPEAT, repeat);
00648 node.put(SHUFFLED, shuffled);
00649 node.put(SPEED, speed);
00650 node.put(SUBTITLEENABLED, subtitleenabled);
00651 final ArrayNode subtitlesArray = OM.createArrayNode();
00652 for (Subtitle item : subtitles) {
00653 subtitlesArray.add(item.toJsonNode());
00654 }
00655 node.put(SUBTITLES, subtitlesArray);
00656 node.put(TIME, time.toJsonNode());
00657 node.put(TOTALTIME, totaltime.toJsonNode());
00658 node.put(TYPE, type);
00659 return node;
00660 }
00661
00667 static List<PropertyValue> getPlayerModelPropertyValueList(JsonNode node, String key) {
00668 if (node.has(key)) {
00669 final ArrayNode a = (ArrayNode)node.get(key);
00670 final List<PropertyValue> l = new ArrayList<PropertyValue>(a.size());
00671 for (int i = 0; i < a.size(); i++) {
00672 l.add(new PropertyValue((JsonNode)a.get(i)));
00673 }
00674 return l;
00675 }
00676 return new ArrayList<PropertyValue>(0);
00677 }
00678
00684 @Override
00685 public void writeToParcel(Parcel parcel, int flags) {
00686 parcel.writeInt(audiostreams.size());
00687 for (AudioStream item : audiostreams) {
00688 parcel.writeParcelable(item, flags);
00689 }
00690 parcel.writeInt(canchangespeed ? 1 : 0);
00691 parcel.writeInt(canmove ? 1 : 0);
00692 parcel.writeInt(canrepeat ? 1 : 0);
00693 parcel.writeInt(canrotate ? 1 : 0);
00694 parcel.writeInt(canseek ? 1 : 0);
00695 parcel.writeInt(canshuffle ? 1 : 0);
00696 parcel.writeInt(canzoom ? 1 : 0);
00697 parcel.writeValue(currentaudiostream);
00698 parcel.writeValue(currentsubtitle);
00699 parcel.writeInt(live ? 1 : 0);
00700 parcel.writeInt(partymode ? 1 : 0);
00701 parcel.writeValue(percentage);
00702 parcel.writeValue(playlistid);
00703 parcel.writeValue(position);
00704 parcel.writeValue(repeat);
00705 parcel.writeInt(shuffled ? 1 : 0);
00706 parcel.writeValue(speed);
00707 parcel.writeInt(subtitleenabled ? 1 : 0);
00708 parcel.writeInt(subtitles.size());
00709 for (Subtitle item : subtitles) {
00710 parcel.writeParcelable(item, flags);
00711 }
00712 parcel.writeValue(time);
00713 parcel.writeValue(totaltime);
00714 parcel.writeValue(type);
00715 }
00716
00720 protected PropertyValue(Parcel parcel) {
00721 final int audiostreamsSize = parcel.readInt();
00722 audiostreams = new ArrayList<AudioStream>(audiostreamsSize);
00723 for (int i = 0; i < audiostreamsSize; i++) {
00724 audiostreams.add(parcel.<AudioStream>readParcelable(AudioStream.class.getClassLoader()));
00725 }
00726 canchangespeed = parcel.readInt() == 1;
00727 canmove = parcel.readInt() == 1;
00728 canrepeat = parcel.readInt() == 1;
00729 canrotate = parcel.readInt() == 1;
00730 canseek = parcel.readInt() == 1;
00731 canshuffle = parcel.readInt() == 1;
00732 canzoom = parcel.readInt() == 1;
00733 currentaudiostream = parcel.<AudioStream>readParcelable(AudioStream.class.getClassLoader());
00734 currentsubtitle = parcel.<Subtitle>readParcelable(Subtitle.class.getClassLoader());
00735 live = parcel.readInt() == 1;
00736 partymode = parcel.readInt() == 1;
00737 percentage = parcel.readDouble();
00738 playlistid = parcel.readInt();
00739 position = parcel.readInt();
00740 repeat = parcel.readString();
00741 shuffled = parcel.readInt() == 1;
00742 speed = parcel.readInt();
00743 subtitleenabled = parcel.readInt() == 1;
00744 final int subtitlesSize = parcel.readInt();
00745 subtitles = new ArrayList<Subtitle>(subtitlesSize);
00746 for (int i = 0; i < subtitlesSize; i++) {
00747 subtitles.add(parcel.<Subtitle>readParcelable(Subtitle.class.getClassLoader()));
00748 }
00749 time = parcel.<GlobalModel.Time>readParcelable(GlobalModel.Time.class.getClassLoader());
00750 totaltime = parcel.<GlobalModel.Time>readParcelable(GlobalModel.Time.class.getClassLoader());
00751 type = parcel.readString();
00752 }
00753
00757 public static final Parcelable.Creator<PropertyValue> CREATOR = new Parcelable.Creator<PropertyValue>() {
00758 @Override
00759 public PropertyValue createFromParcel(Parcel parcel) {
00760 return new PropertyValue(parcel);
00761 }
00762 @Override
00763 public PropertyValue[] newArray(int n) {
00764 return new PropertyValue[n];
00765 }
00766 };
00767
00768 @Override
00769 public int describeContents() {
00770 return 0;
00771 }
00772
00776 public interface Repeat {
00777
00778 public final String OFF = "off";
00779 public final String ONE = "one";
00780 public final String ALL = "all";
00781
00782 public final static Set<String> values = new HashSet<String>(Arrays.asList(OFF, ONE, ALL));
00783 }
00784
00788 public interface Type {
00789
00790 public final String VIDEO = "video";
00791 public final String AUDIO = "audio";
00792 public final String PICTURE = "picture";
00793
00794 public final static Set<String> values = new HashSet<String>(Arrays.asList(VIDEO, AUDIO, PICTURE));
00795 }
00796 }
00797
00804 public static class Speed extends AbstractModel {
00805 public final static String API_TYPE = "Player.Speed";
00806
00807
00808 public static final String SPEED = "speed";
00809
00810
00811 public final Integer speed;
00812
00816 public Speed(Integer speed) {
00817 this.speed = speed;
00818 }
00819
00824 public Speed(JsonNode node) {
00825 speed = parseInt(node, SPEED);
00826 }
00827
00828 @Override
00829 public JsonNode toJsonNode() {
00830 final ObjectNode node = OM.createObjectNode();
00831 node.put(SPEED, speed);
00832 return node;
00833 }
00834
00840 static List<Speed> getPlayerModelSpeedList(JsonNode node, String key) {
00841 if (node.has(key)) {
00842 final ArrayNode a = (ArrayNode)node.get(key);
00843 final List<Speed> l = new ArrayList<Speed>(a.size());
00844 for (int i = 0; i < a.size(); i++) {
00845 l.add(new Speed((JsonNode)a.get(i)));
00846 }
00847 return l;
00848 }
00849 return new ArrayList<Speed>(0);
00850 }
00851
00857 @Override
00858 public void writeToParcel(Parcel parcel, int flags) {
00859 parcel.writeValue(speed);
00860 }
00861
00865 protected Speed(Parcel parcel) {
00866 speed = parcel.readInt();
00867 }
00868
00872 public static final Parcelable.Creator<Speed> CREATOR = new Parcelable.Creator<Speed>() {
00873 @Override
00874 public Speed createFromParcel(Parcel parcel) {
00875 return new Speed(parcel);
00876 }
00877 @Override
00878 public Speed[] newArray(int n) {
00879 return new Speed[n];
00880 }
00881 };
00882
00883 @Override
00884 public int describeContents() {
00885 return 0;
00886 }
00887 }
00888
00895 public static class Subtitle extends AbstractModel {
00896 public final static String API_TYPE = "Player.Subtitle";
00897
00898
00899 public static final String INDEX = "index";
00900 public static final String LANGUAGE = "language";
00901 public static final String NAME = "name";
00902
00903
00904 public final Integer index;
00905 public final String language;
00906 public final String name;
00907
00913 public Subtitle(Integer index, String language, String name) {
00914 this.index = index;
00915 this.language = language;
00916 this.name = name;
00917 }
00918
00923 public Subtitle(JsonNode node) {
00924 index = node.get(INDEX).getIntValue();
00925 language = node.get(LANGUAGE).getTextValue();
00926 name = node.get(NAME).getTextValue();
00927 }
00928
00929 @Override
00930 public JsonNode toJsonNode() {
00931 final ObjectNode node = OM.createObjectNode();
00932 node.put(INDEX, index);
00933 node.put(LANGUAGE, language);
00934 node.put(NAME, name);
00935 return node;
00936 }
00937
00943 static List<Subtitle> getPlayerModelSubtitleList(JsonNode node, String key) {
00944 if (node.has(key)) {
00945 final ArrayNode a = (ArrayNode)node.get(key);
00946 final List<Subtitle> l = new ArrayList<Subtitle>(a.size());
00947 for (int i = 0; i < a.size(); i++) {
00948 l.add(new Subtitle((JsonNode)a.get(i)));
00949 }
00950 return l;
00951 }
00952 return new ArrayList<Subtitle>(0);
00953 }
00954
00960 @Override
00961 public void writeToParcel(Parcel parcel, int flags) {
00962 parcel.writeValue(index);
00963 parcel.writeValue(language);
00964 parcel.writeValue(name);
00965 }
00966
00970 protected Subtitle(Parcel parcel) {
00971 index = parcel.readInt();
00972 language = parcel.readString();
00973 name = parcel.readString();
00974 }
00975
00979 public static final Parcelable.Creator<Subtitle> CREATOR = new Parcelable.Creator<Subtitle>() {
00980 @Override
00981 public Subtitle createFromParcel(Parcel parcel) {
00982 return new Subtitle(parcel);
00983 }
00984 @Override
00985 public Subtitle[] newArray(int n) {
00986 return new Subtitle[n];
00987 }
00988 };
00989
00990 @Override
00991 public int describeContents() {
00992 return 0;
00993 }
00994 }
00995
00999 public interface PropertyName {
01000
01001 public final String TYPE = "type";
01002 public final String PARTYMODE = "partymode";
01003 public final String SPEED = "speed";
01004 public final String TIME = "time";
01005 public final String PERCENTAGE = "percentage";
01006 public final String TOTALTIME = "totaltime";
01007 public final String PLAYLISTID = "playlistid";
01008 public final String POSITION = "position";
01009 public final String REPEAT = "repeat";
01010 public final String SHUFFLED = "shuffled";
01011 public final String CANSEEK = "canseek";
01012 public final String CANCHANGESPEED = "canchangespeed";
01013 public final String CANMOVE = "canmove";
01014 public final String CANZOOM = "canzoom";
01015 public final String CANROTATE = "canrotate";
01016 public final String CANSHUFFLE = "canshuffle";
01017 public final String CANREPEAT = "canrepeat";
01018 public final String CURRENTAUDIOSTREAM = "currentaudiostream";
01019 public final String AUDIOSTREAMS = "audiostreams";
01020 public final String SUBTITLEENABLED = "subtitleenabled";
01021 public final String CURRENTSUBTITLE = "currentsubtitle";
01022 public final String SUBTITLES = "subtitles";
01023 public final String LIVE = "live";
01024
01025 public final static Set<String> values = new HashSet<String>(Arrays.asList(TYPE, PARTYMODE, SPEED, TIME, PERCENTAGE, TOTALTIME, PLAYLISTID, POSITION, REPEAT, SHUFFLED, CANSEEK, CANCHANGESPEED, CANMOVE, CANZOOM, CANROTATE, CANSHUFFLE, CANREPEAT, CURRENTAUDIOSTREAM, AUDIOSTREAMS, SUBTITLEENABLED, CURRENTSUBTITLE, SUBTITLES, LIVE));
01026 }
01027
01031 public interface Repeat {
01032
01033 public final String OFF = "off";
01034 public final String ONE = "one";
01035 public final String ALL = "all";
01036
01037 public final static Set<String> values = new HashSet<String>(Arrays.asList(OFF, ONE, ALL));
01038 }
01039
01043 public interface Type {
01044
01045 public final String VIDEO = "video";
01046 public final String AUDIO = "audio";
01047 public final String PICTURE = "picture";
01048
01049 public final static Set<String> values = new HashSet<String>(Arrays.asList(VIDEO, AUDIO, PICTURE));
01050 }
01051 }