View Javadoc
1   /*
2    * Copyright (C) 2013 4th Line GmbH, Switzerland
3    *
4    * The contents of this file are subject to the terms of either the GNU
5    * Lesser General Public License Version 2 or later ("LGPL") or the
6    * Common Development and Distribution License Version 1 or later
7    * ("CDDL") (collectively, the "License"). You may not use this file
8    * except in compliance with the License. See LICENSE.txt for more
9    * information.
10   *
11   * This program is distributed in the hope that it will be useful,
12   * but WITHOUT ANY WARRANTY; without even the implied warranty of
13   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14   */
15  
16  package org.fourthline.cling.support.model;
17  
18  import org.seamless.util.MimeType;
19  
20  import java.net.URI;
21  
22  /**
23   * @author Christian Bauer
24   */
25  public class Res {
26  
27      protected URI importUri;
28      protected ProtocolInfo protocolInfo;
29      protected Long size;
30      protected String duration;
31      protected Long bitrate;
32      protected Long sampleFrequency;
33      protected Long bitsPerSample;
34      protected Long nrAudioChannels;
35      protected Long colorDepth;
36      protected String protection;
37      protected String resolution;
38  
39      protected String value;
40  
41      public Res() {
42      }
43  
44      public Res(String httpGetMimeType, Long size, String duration, Long bitrate, String value) {
45          this(new ProtocolInfo(Protocol.HTTP_GET, ProtocolInfo.WILDCARD, httpGetMimeType, ProtocolInfo.WILDCARD), size, duration, bitrate, value);
46      }
47      
48      public Res(MimeType httpGetMimeType, Long size, String duration, Long bitrate, String value) {
49          this(new ProtocolInfo(httpGetMimeType), size, duration, bitrate, value);
50      }
51  
52      public Res(MimeType httpGetMimeType, Long size, String value) {
53          this(new ProtocolInfo(httpGetMimeType), size, value);
54      }
55  
56      public Res(ProtocolInfo protocolInfo, Long size, String value) {
57          this.protocolInfo = protocolInfo;
58          this.size = size;
59          this.value = value;
60      }
61  
62      public Res(ProtocolInfo protocolInfo, Long size, String duration, Long bitrate, String value) {
63          this.protocolInfo = protocolInfo;
64          this.size = size;
65          this.duration = duration;
66          this.bitrate = bitrate;
67          this.value = value;
68      }
69  
70      public Res(URI importUri, ProtocolInfo protocolInfo, Long size, String duration, Long bitrate, Long sampleFrequency, Long bitsPerSample, Long nrAudioChannels, Long colorDepth, String protection, String resolution, String value) {
71          this.importUri = importUri;
72          this.protocolInfo = protocolInfo;
73          this.size = size;
74          this.duration = duration;
75          this.bitrate = bitrate;
76          this.sampleFrequency = sampleFrequency;
77          this.bitsPerSample = bitsPerSample;
78          this.nrAudioChannels = nrAudioChannels;
79          this.colorDepth = colorDepth;
80          this.protection = protection;
81          this.resolution = resolution;
82          this.value = value;
83      }
84  
85      public URI getImportUri() {
86          return importUri;
87      }
88  
89      public void setImportUri(URI importUri) {
90          this.importUri = importUri;
91      }
92  
93      public ProtocolInfo getProtocolInfo() {
94          return protocolInfo;
95      }
96  
97      public void setProtocolInfo(ProtocolInfo protocolInfo) {
98          this.protocolInfo = protocolInfo;
99      }
100 
101     public Long getSize() {
102         return size;
103     }
104 
105     public void setSize(Long size) {
106         this.size = size;
107     }
108 
109     public String getDuration() {
110         return duration;
111     }
112 
113     public void setDuration(String duration) {
114         this.duration = duration;
115     }
116 
117     public Long getBitrate() {
118         return bitrate;
119     }
120 
121     public void setBitrate(Long bitrate) {
122         this.bitrate = bitrate;
123     }
124 
125     public Long getSampleFrequency() {
126         return sampleFrequency;
127     }
128 
129     public void setSampleFrequency(Long sampleFrequency) {
130         this.sampleFrequency = sampleFrequency;
131     }
132 
133     public Long getBitsPerSample() {
134         return bitsPerSample;
135     }
136 
137     public void setBitsPerSample(Long bitsPerSample) {
138         this.bitsPerSample = bitsPerSample;
139     }
140 
141     public Long getNrAudioChannels() {
142         return nrAudioChannels;
143     }
144 
145     public void setNrAudioChannels(Long nrAudioChannels) {
146         this.nrAudioChannels = nrAudioChannels;
147     }
148 
149     public Long getColorDepth() {
150         return colorDepth;
151     }
152 
153     public void setColorDepth(Long colorDepth) {
154         this.colorDepth = colorDepth;
155     }
156 
157     public String getProtection() {
158         return protection;
159     }
160 
161     public void setProtection(String protection) {
162         this.protection = protection;
163     }
164 
165     public String getResolution() {
166         return resolution;
167     }
168 
169     public void setResolution(String resolution) {
170         this.resolution = resolution;
171     }
172 
173     public void setResolution(int x, int y) {
174         this.resolution = x + "x" + y;
175     }
176 
177     public int getResolutionX() {
178         return getResolution() != null && getResolution().split("x").length == 2
179                 ? Integer.valueOf(getResolution().split("x")[0])
180                 : 0;
181     }
182 
183     public int getResolutionY() {
184         return getResolution() != null && getResolution().split("x").length == 2
185                 ? Integer.valueOf(getResolution().split("x")[1])
186                 : 0;
187     }
188 
189     public String getValue() {
190         return value;
191     }
192 
193     public void setValue(String value) {
194         this.value = value;
195     }
196 }