1 /***
2 * Java DAB EPG API - Serialize/Deserialize To/From POJOs to XML/Binary as per
3 * ETSI specifications TS 102 818 (XML Specification for DAB EPG) and TS 102
4 * 371 (Transportation and Binary Encoding Specification for EPG).
5 *
6 * Copyright (C) 2007 GCap Media PLC
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
12 *
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 */
22 package com.gcapmedia.dab.epg;
23
24 import java.net.URL;
25 import java.util.Locale;
26
27 /***
28 * <p>Multimedia resource</p>
29 *
30 * <p>The optional <b>mimetype</b> attribute indicates the MIME type
31 * of the resource.</p>
32 *
33 * <p>The <b>language</b> attribute indicates the language of the source
34 * information and is in the form of an xml:lang attribute and RFC 3066.</p>
35 *
36 * <p>The <b>url</b> attribute points to the multimedia resource.</p>
37 *
38 * <p>The optional <b>type</b> attribute indicates the type of multimedia
39 * resource and is intended to support the correct presentation of the resource
40 * by the EPG decoder.
41 * </p>
42 *
43 * <p>NOTE: The context of the logo (i.e. is it related to an ensemble or a service or
44 * a programme etc.) is defined by the parent elements of the multimedia element.</p>
45 *
46 * <p>The optional <b>width</b> and <b>height</b> attributes define the size of the
47 * logo in pixels.</p>
48 */
49 public class Multimedia {
50
51 /***
52 * Multimedia MIME type
53 */
54 private String mimeType;
55
56 /***
57 * Multimedia language
58 */
59 private Locale locale;
60
61 /***
62 * Multimedia location
63 */
64 private URL url;
65
66 /***
67 * Media type
68 */
69 protected Type type;
70
71 /***
72 * Media width (for images)
73 */
74 protected int width;
75
76 /***
77 * Media height (for images)
78 */
79 protected int height;
80
81 /***
82 * Create a new multimedia object
83 * @param url Multimedia HREF
84 */
85 public Multimedia(URL url) {
86 this(url, Locale.ENGLISH);
87 }
88
89 /***
90 * Create a new multimedia object
91 * @param url Multimedia HREF
92 * @param locale Multimedia language
93 */
94 public Multimedia(URL url, Locale locale) {
95 this.url = url;
96 this.locale = locale;
97
98
99 if(url == null) {
100 throw new IllegalArgumentException("Must specify a URL");
101 }
102 if(locale == null) {
103 throw new IllegalArgumentException("Must specify a locale");
104 }
105 }
106
107 /***
108 * Sets the MIME type for this multimedia
109 * @param mimeType
110 */
111 public void setMimeType(String mimeType) {
112 this.mimeType = mimeType;
113 }
114
115 /***
116 * @return Returns the multimedia mime type
117 */
118 public String getMimeType() {
119 return mimeType;
120 }
121
122 /***
123 * @return Returns the multimedia URL
124 */
125 public URL getUrl() {
126 return url;
127 }
128
129 /***
130 * @return Returns the multimedia language
131 */
132 public String getLanguage() {
133 return locale.getLanguage();
134 }
135
136 public void setType(Type type) {
137 this.type = type;
138 }
139
140 public Type getType() {
141 return type;
142 }
143
144 public void setHeight(int height) {
145 this.height = height;
146 }
147
148 public int getHeight() {
149 return height;
150 }
151
152 public void setWidth(int width) {
153 this.width = width;
154 }
155
156 public int getWidth() {
157 return width;
158 }
159
160 /***
161 *
162 * The enumerated types allowed are defined here:
163 *
164 * <ul>
165 * <li>
166 * <b>logo_unrestricted</b>: An ensemble/service/programme/programme
167 * group/programme event logo. The image format is unrestricted and must
168 * be signalled with the <b>mimevalue</b>, <b>width</b> and <b>height</b>
169 * attributes.
170 * </li>
171 * <li>
172 * <b>logo_mono_square</b>: An ensemble/service/programme/programme
173 * group/programme event logo. This image must be in Wireless Bitmap (WBMP)
174 * format and must be 32x32 pixels. The <b>mimeValue</b>, <b>width</b> and
175 * <b>height</b> attributes should not be used. The intended use of this
176 * type of logo is as part of a list of available services on a receiver
177 * with limited display capabilities.
178 * </li>
179 * <li>
180 * <b>logo_colour_square</b>: An ensemble/service/programme/programme
181 * group/programme event logo. This image must be in PNG v1.1 format
182 * and must be 32x32 pixels at a colour depth of 256. The <b>mimeValue</b>,
183 * <b>width</b> and <b>height</b> attributes should not be used. The intended
184 * use of this type of logo is as part of a list of available services.
185 * </li>
186 * <li>
187 * <b>logo_mono_rectangle</b>: An ensemble/service/programme/programme
188 * group/programme event logo. This image must be in Wireless Bitmap (WBMP)
189 * format and must be 32 pixels high and between 33 pixels and 112 pixels
190 * (inclusive) wide. The <b>mimeValue</b>, <b>width</b> and <b>height</b>
191 * attributes should not be used. The intended use of this type of logo is
192 * to display at the top of a page for a particular service listing the
193 * programmes and can be used in place of the textual name for this service
194 * on a receiver with limited display capabilities.
195 * </li>
196 * <li>
197 * <b>logo_colour_rectangle</b>: An ensemble/service/programme/programme
198 * group/programme event logo. This images must be in PNG v1.1 format and must
199 * be 32 pixels high and between 33 pixels and 112 pixels
200 * (inclusive) wide. The <b>mimeValue</b>, <b>width</b> and <b>height</b>
201 * attributes should not be used. The intended use of this type of logo is
202 * to display at the top of a page for a particular service listing the
203 * programmes and can be used in place of the textual name for this service
204 * on a receiver with limited display capabilities.
205 * </li>
206 * </ul>
207 *
208 */
209 public static enum Type {
210
211 LOGO_UNRESTRICTED,
212
213 LOGO_MONO_SQUARE,
214
215 LOGO_COLOUR_SQUARE,
216
217 LOGO_MONO_RECTANGLE,
218
219 LOGO_COLOUR_RECTANGLE;
220
221 }
222
223 }