handler_type* TAO_Buffer_Allocator<handler_type, alloc_type>::allocate (void) { handler_type* myvalue = 0; ACE_NEW_MALLOC_RETURN (myvalue, static_cast <handler_type*>( allocator_->malloc (sizeof (handler_type))), handler_type (), 0); return myvalue; }
void read(uint64_t size, byte_stream& bs) { full_box::read(size, bs); m_entry_count = bs.read_uint32_t(); m_remaining_bytes -= 4; // get handler to know which kind of sample we are reading. auto mdia = get_parent("mdia"); assert(mdia != nullptr); auto hdlr = std::dynamic_pointer_cast<const petro::box::hdlr>( mdia->get_child("hdlr")); for (uint32_t i = 0; i < m_entry_count; ++i) { uint32_t entry_size = bs.read_uint32_t(); std::string entry_type = bs.read_type(); std::shared_ptr<sample_entry> entry = nullptr; if (hdlr != nullptr) { std::string handler_type = hdlr->handler_type(); if (handler_type == "vide") // for video tracks { entry = std::make_shared<visual_sample_entry>(entry_type, shared_from_this()); entry->read(entry_size, bs); } else if (handler_type == "soun") // for audio tracks { entry = std::make_shared<audio_sample_entry>(entry_type, shared_from_this()); entry->read(entry_size, bs); } else if (handler_type == "hint") { entry = std::make_shared<hint_sample_entry>(entry_type, shared_from_this()); entry->read(entry_size, bs); } } if (!entry) { entry = std::make_shared<unknown_sample_entry>(entry_type, shared_from_this()); entry->read(entry_size, bs); } m_remaining_bytes -= entry->size(); m_children.push_back(entry); } bs.skip(m_remaining_bytes); }