M4Err ReadIPMPDUpdate(BitStream *bs, IPMPDescriptorUpdate *ipmpUp, u32 ComSize) { Descriptor *tmp; u32 tmpSize = 0, nbBytes = 0; M4Err e = M4OK; if (! ipmpUp) return M4BadParam; while (nbBytes < ComSize) { e = ParseDescriptor(bs, &tmp, &tmpSize); if (e) return e; e = AddToIPMPDUpdate(ipmpUp, tmp); if (e) return e; nbBytes += tmpSize + GetSizeFieldSize(tmpSize); } //OD commands are aligned BS_Align(bs); if (nbBytes != ComSize) return M4ReadODCommandFailed; return e; }
GF_Err gf_odf_read_ipmp_update(GF_BitStream *bs, GF_IPMPUpdate *ipmpUp, u32 gf_odf_size_command) { GF_Descriptor *tmp; u32 tmpSize = 0, nbBytes = 0; GF_Err e = GF_OK; if (!ipmpUp) return GF_BAD_PARAM; while (nbBytes < gf_odf_size_command) { e = gf_odf_parse_descriptor(bs, &tmp, &tmpSize); if (e) return e; e = AddToIPMPDUpdate(ipmpUp, tmp); if (e) return e; nbBytes += tmpSize + gf_odf_size_field_size(tmpSize); } //OD commands are aligned gf_bs_align(bs); if (nbBytes != gf_odf_size_command) return GF_ODF_INVALID_COMMAND; return e; }