void KaxCues::PositionSet(const KaxBlockGroup & BlockRef) { // look for the element in the temporary references std::vector<const KaxBlockBlob *>::iterator ListIdx; for (ListIdx = myTempReferences.begin(); ListIdx != myTempReferences.end(); ListIdx++) { const KaxInternalBlock &refTmp = **ListIdx; if (refTmp.GlobalTimecode() == BlockRef.GlobalTimecode() && refTmp.TrackNum() == BlockRef.TrackNumber()) { // found, now add the element to the entry list KaxCuePoint & NewPoint = AddNewChild<KaxCuePoint>(*this); NewPoint.PositionSet(**ListIdx, GlobalTimecodeScale()); myTempReferences.erase(ListIdx); break; } } }
START_LIBMATROSKA_NAMESPACE /*! \todo handle codec state checking \todo remove duplicate references (reference to 2 frames that each reference the same frame) */ void KaxCuePoint::PositionSet(const KaxBlockGroup & BlockReference, uint64 GlobalTimecodeScale) { // fill me KaxCueTime & NewTime = GetChild<KaxCueTime>(*this); *static_cast<EbmlUInteger*>(&NewTime) = BlockReference.GlobalTimecode() / GlobalTimecodeScale; KaxCueTrackPositions & NewPositions = AddNewChild<KaxCueTrackPositions>(*this); KaxCueTrack & TheTrack = GetChild<KaxCueTrack>(NewPositions); *static_cast<EbmlUInteger*>(&TheTrack) = BlockReference.TrackNumber(); KaxCueClusterPosition & TheClustPos = GetChild<KaxCueClusterPosition>(NewPositions); *static_cast<EbmlUInteger*>(&TheClustPos) = BlockReference.ClusterPosition(); #if MATROSKA_VERSION >= 2 // handle reference use if (BlockReference.ReferenceCount() != 0) { unsigned int i; for (i=0; i<BlockReference.ReferenceCount(); i++) { KaxCueReference & NewRefs = AddNewChild<KaxCueReference>(NewPositions); NewRefs.AddReference(BlockReference.Reference(i).RefBlock(), GlobalTimecodeScale); } } KaxCodecState *CodecState = static_cast<KaxCodecState *>(BlockReference.FindFirstElt(EBML_INFO(KaxCodecState))); if (CodecState != NULL) { KaxCueCodecState &CueCodecState = AddNewChild<KaxCueCodecState>(NewPositions); *static_cast<EbmlUInteger*>(&CueCodecState) = BlockReference.GetParentCluster()->GetParentSegment()->GetRelativePosition(CodecState->GetElementPosition()); } #endif // MATROSKA_VERSION SetValueIsSet(); }