How to convert DFT to DCT
It depends on which DCT (there are more than four of them), the idea is to take your original data and append to it a mirror-reflection copy of that data.  Now your data is twice as long, and you perform an FFT on twice the length.  but you have some symmetry to it that allows you to toss half of the data in the result of the DFT.

exactly how, depends on if it's DCT I, DCT II, DCT III, DCT IV, or the "MDCT" or whatever is the DCT flavor of the month.

looks like something useful here.  it may need further exploration.