• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 package com.coremedia.iso.boxes.threegpp26244;
2 
3 import com.coremedia.iso.IsoTypeReader;
4 import com.coremedia.iso.IsoTypeWriter;
5 import com.coremedia.iso.Utf8;
6 import com.googlecode.mp4parser.AbstractFullBox;
7 
8 import java.nio.ByteBuffer;
9 
10 /**
11  * Location Information Box as specified in TS 26.244.
12  */
13 public class LocationInformationBox extends AbstractFullBox {
14     public static final String TYPE = "loci";
15 
16     private String language;
17     private String name = "";
18     private int role;
19     private double longitude;
20     private double latitude;
21     private double altitude;
22     private String astronomicalBody = "";
23     private String additionalNotes = "";
24 
LocationInformationBox()25     public LocationInformationBox() {
26         super(TYPE);
27     }
28 
getLanguage()29     public String getLanguage() {
30         return language;
31     }
32 
setLanguage(String language)33     public void setLanguage(String language) {
34         this.language = language;
35     }
36 
getName()37     public String getName() {
38         return name;
39     }
40 
setName(String name)41     public void setName(String name) {
42         this.name = name;
43     }
44 
getRole()45     public int getRole() {
46         return role;
47     }
48 
setRole(int role)49     public void setRole(int role) {
50         this.role = role;
51     }
52 
getLongitude()53     public double getLongitude() {
54         return longitude;
55     }
56 
setLongitude(double longitude)57     public void setLongitude(double longitude) {
58         this.longitude = longitude;
59     }
60 
getLatitude()61     public double getLatitude() {
62         return latitude;
63     }
64 
setLatitude(double latitude)65     public void setLatitude(double latitude) {
66         this.latitude = latitude;
67     }
68 
getAltitude()69     public double getAltitude() {
70         return altitude;
71     }
72 
setAltitude(double altitude)73     public void setAltitude(double altitude) {
74         this.altitude = altitude;
75     }
76 
getAstronomicalBody()77     public String getAstronomicalBody() {
78         return astronomicalBody;
79     }
80 
setAstronomicalBody(String astronomicalBody)81     public void setAstronomicalBody(String astronomicalBody) {
82         this.astronomicalBody = astronomicalBody;
83     }
84 
getAdditionalNotes()85     public String getAdditionalNotes() {
86         return additionalNotes;
87     }
88 
setAdditionalNotes(String additionalNotes)89     public void setAdditionalNotes(String additionalNotes) {
90         this.additionalNotes = additionalNotes;
91     }
92 
getContentSize()93     protected long getContentSize() {
94         return 22 + Utf8.convert(name).length + Utf8.convert(astronomicalBody).length + Utf8.convert(additionalNotes).length;
95     }
96 
97     @Override
_parseDetails(ByteBuffer content)98     public void _parseDetails(ByteBuffer content) {
99         parseVersionAndFlags(content);
100         language = IsoTypeReader.readIso639(content);
101         name = IsoTypeReader.readString(content);
102         role = IsoTypeReader.readUInt8(content);
103         longitude = IsoTypeReader.readFixedPoint1616(content);
104         latitude = IsoTypeReader.readFixedPoint1616(content);
105         altitude = IsoTypeReader.readFixedPoint1616(content);
106         astronomicalBody = IsoTypeReader.readString(content);
107         additionalNotes = IsoTypeReader.readString(content);
108     }
109 
110 
111     @Override
getContent(ByteBuffer byteBuffer)112     protected void getContent(ByteBuffer byteBuffer) {
113         writeVersionAndFlags(byteBuffer);
114         IsoTypeWriter.writeIso639(byteBuffer, language);
115         byteBuffer.put(Utf8.convert(name));
116         byteBuffer.put((byte) 0);
117         IsoTypeWriter.writeUInt8(byteBuffer, role);
118         IsoTypeWriter.writeFixedPont1616(byteBuffer, longitude);
119         IsoTypeWriter.writeFixedPont1616(byteBuffer, latitude);
120         IsoTypeWriter.writeFixedPont1616(byteBuffer, altitude);
121         byteBuffer.put(Utf8.convert(astronomicalBody));
122         byteBuffer.put((byte) 0);
123         byteBuffer.put(Utf8.convert(additionalNotes));
124         byteBuffer.put((byte) 0);
125     }
126 }
127