1 /* ------------------------------------------------------------------ 2 * Copyright (C) 1998-2009 PacketVideo 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 13 * express or implied. 14 * See the License for the specific language governing permissions 15 * and limitations under the License. 16 * ------------------------------------------------------------------- 17 */ 18 /*********************************************************************************/ 19 /* ------------------------------------------------------------------- */ 20 /* MPEG-4 TrackHeaderAtom Class */ 21 /* ------------------------------------------------------------------- */ 22 /*********************************************************************************/ 23 /* 24 This TrackHeaderAtom Class specifies the characteristics of a single MPEG-4 25 track. 26 */ 27 28 29 #ifndef TRACKHEADERATOM_H_INCLUDED 30 #define TRACKHEADERATOM_H_INCLUDED 31 32 #ifndef OSCL_FILE_IO_H_INCLUDED 33 #include "oscl_file_io.h" 34 #endif 35 36 #ifndef FULLATOM_H_INCLUDED 37 #include "fullatom.h" 38 #endif 39 40 class TrackHeaderAtom : public FullAtom 41 { 42 43 public: 44 TrackHeaderAtom(MP4_FF_FILE *fp, uint32 size, uint32 type); 45 virtual ~TrackHeaderAtom(); 46 getTrackMediaType()47 int32 getTrackMediaType() const 48 { 49 return _mediaType; 50 } 51 getCreationTime()52 uint64 getCreationTime() const 53 { 54 if (getVersion() == 1) 55 return _creationTime64; 56 else 57 return _creationTime; 58 } getModificationTime()59 uint64 getModificationTime() const 60 { 61 if (getVersion() == 1) 62 return _modificationTime64; 63 else 64 return _modificationTime; 65 } 66 getTrackID()67 uint32 getTrackID() const 68 { 69 return _trackID; 70 } 71 getDuration()72 uint64 getDuration() const 73 { 74 if (getVersion() == 1) 75 return _duration64; 76 else 77 return _duration; 78 } 79 getLayer()80 int16 getLayer() 81 { 82 return _layer; 83 } getAlternateGroup()84 uint16 getAlternateGroup() 85 { 86 return _alternateGroup; 87 } getTextTrackWidth()88 int32 getTextTrackWidth() 89 { 90 return _width; 91 } getTextTrackHeight()92 int32 getTextTrackHeight() 93 { 94 return _height; 95 } getTextTrackXOffset()96 int32 getTextTrackXOffset() 97 { 98 return _tx; 99 } getTextTrackYOffset()100 int32 getTextTrackYOffset() 101 { 102 return _ty; 103 } 104 105 private: 106 int32 _mediaType; 107 108 uint32 _creationTime; // 4/8 (32/64bits) -- Will templatize later - using 32bits for now 109 uint64 _creationTime64; 110 111 uint32 _modificationTime; // 4/8 (32/64bits) -- Will templatize later - using 32bits for now 112 uint64 _modificationTime64; 113 114 uint32 _trackID; // 4 (32bits) 115 uint32 _reserved1; // = 0; 116 117 uint32 _duration; // 4/8 (32/64bits) -- Will templatize later - using 32bits for now 118 uint64 _duration64; 119 120 // Static reserved constants 121 uint32 _reserved2[3]; // = { 0, 0, 0 }; 122 uint16 _reserved3; // = 0; // 0x0100 if audio track 123 uint16 _reserved4; // = 0; 124 uint32 _reserved5[9]; // = { 0x00010000, 0, 0, 0, 0x00010000, 0, 0, 0, 0x40000000 }; 125 uint32 _reserved6; // = 0; // 0x01400000 if visual track 126 uint32 _reserved7; // = 0; // 0x00f00000 if visual track 127 128 // private member NOT to be rendered - only for internal use 129 uint32 _timeScale; 130 131 int16 _layer; 132 uint16 _alternateGroup; 133 int32 _width; 134 int32 _height; 135 int32 _tx; 136 int32 _ty; 137 }; 138 139 #endif // TRACKHEADERATOM_H_INCLUDED 140 141