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 This PVA_FF_DecoderSpecificInfo Class that holds the Mpeg4 VOL header for the 20 video stream 21 */ 22 23 #define __IMPLEMENT_H263DecoderSpecificInfo3GPP__ 24 25 #include "h263decoderspecificinfo3gpp.h" 26 27 #include "atomutils.h" 28 29 PVA_FF_H263SpecficAtom::PVA_FF_H263SpecficAtom() 30 : PVA_FF_Atom(FourCharConstToUint32('d', '2', '6', '3')) 31 { 32 _VendorCode = PACKETVIDEO_FOURCC; 33 _encoder_version = 1; 34 _codec_level = 10; 35 _codec_profile = 0; 36 _max_width = 176; 37 _max_height = 144; 38 PV_MP4_FF_NEW(fp->auditCB, PVA_FF_H263DecBitrateAtom, (), _ph263_decbitrateatom); 39 40 recomputeSize(); 41 } 42 43 bool 44 PVA_FF_H263SpecficAtom::renderToFileStream(MP4_AUTHOR_FF_FILE_IO_WRAP *fp) 45 { 46 int32 rendered = 0; 47 48 if (!renderAtomBaseMembers(fp)) 49 { 50 return false; 51 } 52 rendered += getDefaultSize(); 53 54 // Render decoder specific info payload 55 if (!PVA_FF_AtomUtils::render32(fp, _VendorCode)) 56 { 57 return false; 58 } 59 rendered += 4; 60 61 if (!PVA_FF_AtomUtils::render8(fp, _encoder_version)) 62 { 63 return false; 64 } 65 rendered += 1; 66 67 if (!PVA_FF_AtomUtils::render8(fp, _codec_level)) 68 { 69 return false; 70 } 71 rendered += 1; 72 73 if (!PVA_FF_AtomUtils::render8(fp, _codec_profile)) 74 { 75 return false; 76 } 77 rendered += 1; 78 79 if (!_ph263_decbitrateatom->renderToFileStream(fp)) 80 { 81 return false; 82 } 83 rendered += _ph263_decbitrateatom->getSize(); 84 85 86 return true; 87 } 88 89 void 90 PVA_FF_H263SpecficAtom::recomputeSize() 91 { 92 int32 size = getDefaultSize(); 93 94 size += 7; // FOR DECODER SPECIFIC STRUCT 95 size += _ph263_decbitrateatom->getSize(); 96 _size = size; 97 98 if (_pparent != NULL) 99 { 100 _pparent->recomputeSize(); 101 } 102 } 103 104 105 106 107 PVA_FF_H263DecBitrateAtom::PVA_FF_H263DecBitrateAtom() 108 : PVA_FF_Atom(FourCharConstToUint32('b', 'i', 't', 'r')) 109 { 110 _avg_bitrate = 8000; 111 _max_bitrate = 8000; 112 recomputeSize(); 113 } 114 115 bool 116 PVA_FF_H263DecBitrateAtom::renderToFileStream(MP4_AUTHOR_FF_FILE_IO_WRAP *fp) 117 { 118 int32 rendered = 0; 119 120 if (!renderAtomBaseMembers(fp)) 121 { 122 return false; 123 } 124 rendered += getDefaultSize(); 125 126 // Render decoder bitrate info payload 127 if (!PVA_FF_AtomUtils::render32(fp, _avg_bitrate)) 128 { 129 return false; 130 } 131 rendered += 4; 132 133 if (!PVA_FF_AtomUtils::render32(fp, _max_bitrate)) 134 { 135 return false; 136 } 137 rendered += 4; 138 139 return true; 140 } 141 void 142 PVA_FF_H263DecBitrateAtom::recomputeSize() 143 { 144 int32 size = getDefaultSize(); 145 146 size += 8; 147 148 _size = size; 149 150 if (_pparent != NULL) 151 { 152 _pparent->recomputeSize(); 153 } 154 } 155