int CPGSSub::ParsePresentationSegment(REFERENCE_TIME rt, CGolombBuffer* pGBuffer) { m_pCurrentPresentationSegment.Free(); m_pCurrentPresentationSegment.Attach(DEBUG_NEW HDMV_PRESENTATION_SEGMENT()); m_pCurrentPresentationSegment->rtStart = rt; m_pCurrentPresentationSegment->rtStop = UNKNOWN_TIME; // Unknown for now ParseVideoDescriptor(pGBuffer, &m_pCurrentPresentationSegment->video_descriptor); ParseCompositionDescriptor(pGBuffer, &m_pCurrentPresentationSegment->composition_descriptor); m_pCurrentPresentationSegment->palette_update_flag = !!(pGBuffer->ReadByte() & 0x80); m_pCurrentPresentationSegment->CLUT.id = pGBuffer->ReadByte(); m_pCurrentPresentationSegment->objectCount = pGBuffer->ReadByte(); TRACE_PGSSUB(_T("CPGSSub::ParsePresentationSegment Size = %d, state = %#x, nObjectNumber = %d\n"), pGBuffer->GetSize(), m_pCurrentPresentationSegment->composition_descriptor.bState, m_pCurrentPresentationSegment->objectCount); for (int i = 0; i < m_pCurrentPresentationSegment->objectCount; i++) { std::unique_ptr<CompositionObject> pCompositionObject(DEBUG_NEW CompositionObject()); if (ParseCompositionObject(pGBuffer, pCompositionObject)) { m_pCurrentPresentationSegment->objects.emplace_back(std::move(pCompositionObject)); } } return m_pCurrentPresentationSegment->objectCount; }
int CPGSSub::ParsePresentationSegment(REFERENCE_TIME rt, CGolombBuffer* pGBuffer) { m_pCurrentPresentationSegment = CAutoPtr<HDMV_PRESENTATION_SEGMENT>(DEBUG_NEW HDMV_PRESENTATION_SEGMENT()); m_pCurrentPresentationSegment->rtStart = rt; m_pCurrentPresentationSegment->rtStop = INFINITE_TIME; // Unknown for now ParseVideoDescriptor(pGBuffer, &m_pCurrentPresentationSegment->video_descriptor); ParseCompositionDescriptor(pGBuffer, &m_pCurrentPresentationSegment->composition_descriptor); m_pCurrentPresentationSegment->palette_update_flag = !!(pGBuffer->ReadByte() & 0x80); m_pCurrentPresentationSegment->CLUT.id = pGBuffer->ReadByte(); m_pCurrentPresentationSegment->objectCount = pGBuffer->ReadByte(); TRACE_PGSSUB(_T("CPGSSub::ParsePresentationSegment Size = %d, state = %#x, nObjectNumber = %d\n"), pGBuffer->GetSize(), m_pCurrentPresentationSegment->composition_descriptor.bState, m_pCurrentPresentationSegment->objectCount); for (int i = 0; i < m_pCurrentPresentationSegment->objectCount; i++) { CAutoPtr<CompositionObject> pCompositionObject(DEBUG_NEW CompositionObject()); ParseCompositionObject(pGBuffer, pCompositionObject); m_pCurrentPresentationSegment->objects.AddTail(pCompositionObject); } return m_pCurrentPresentationSegment->objectCount; }