MCPcopy Create free account
hub / github.com/IENT/YUView / parseAndAddNALUnit

Method parseAndAddNALUnit

YUViewLib/src/parser/AVC/ParserAnnexBAVC.cpp:180–577  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

178}
179
180ParserAnnexB::ParseResult
181ParserAnnexBAVC::parseAndAddNALUnit(int nalID,
182 const ByteVector & data,
183 std::optional<BitratePlotModel::BitrateEntry> bitrateEntry,
184 std::optional<pairUint64> nalStartEndPosFile,
185 std::shared_ptr<TreeItem> parent)
186{
187 ParserAnnexB::ParseResult parseResult;
188
189 if (nalID == -1 && data.empty())
190 {
191 if (this->curFrameData && this->curFrameData->poc)
192 {
193 // Save the info of the last frame
194 if (!this->addFrameToList(*this->curFrameData->poc,
195 this->curFrameData->fileStartEndPos,
196 this->curFrameData->isRandomAccess))
197 {
198 if (parent)
199 parent->createChildItem("Error - POC " + std::to_string(*this->curFrameData->poc) +
200 "alread in the POC list.");
201 return parseResult;
202 }
203 if (this->curFrameData->fileStartEndPos)
204 DEBUG_AVC("ParserAnnexBAVC::parseAndAddNALUnit Adding start/end "
205 << this->curFrameData->fileStartEndPos->first << "/"
206 << this->curFrameData->fileStartEndPos->second << " - POC "
207 << *this->curFrameData->poc
208 << (this->curFrameData->isRandomAccess ? " - ra" : ""));
209 else
210 DEBUG_AVC("ParserAnnexBAVC::parseAndAddNALUnit Adding start/end NA/NA - POC "
211 << *this->curFrameData->poc
212 << (this->curFrameData->isRandomAccess ? " - ra" : ""));
213 }
214 // The file ended
215 this->hrd.endOfFile(this->getHRDPlotModel());
216 return parseResult;
217 }
218
219 // Use the given tree item. If it is not set, use the nalUnitMode (if active).
220 // We don't set data (a name) for this item yet.
221 // We want to parse the item and then set a good description.
222 std::shared_ptr<TreeItem> nalRoot;
223 if (parent)
224 nalRoot = parent->createChildItem();
225 else if (packetModel->rootItem)
226 nalRoot = packetModel->rootItem->createChildItem();
227
228 if (nalRoot)
229 ParserAnnexB::logNALSize(data, nalRoot, nalStartEndPosFile);
230
231 reader::SubByteReaderLogging reader(data, nalRoot, "", getStartCodeOffset(data));
232
233 std::string specificDescription;
234 auto nalAVC = std::make_shared<NalUnitAVC>(nalID, nalStartEndPosFile);
235
236 std::optional<CurrentSliceData> currentSliceData;
237

Callers 3

parseExtradata_AVCMethod · 0.45
parseMethod · 0.45

Calls 15

getStartCodeOffsetFunction · 0.85
CurrentSliceDataClass · 0.85
addFrameToListMethod · 0.80
createChildItemMethod · 0.80
endOfFileMethod · 0.80
getHRDPlotModelMethod · 0.80
setCPBBufferSizeMethod · 0.80
addAUMethod · 0.80
setPropertiesMethod · 0.80
to_stringFunction · 0.70

Tested by

no test coverage detected