开发者

WAVEFORMATEX - how to read codecdata at the end?

开发者 https://www.devze.com 2023-01-01 12:43 出处:网络
I\'ve a WAVEFORMATEX struct with some codecdata at the end of it (10 bytes). I\'m using C++. How do I access the data at the end? (this is a purely technical question).

I've a WAVEFORMATEX struct with some codecdata at the end of it (10 bytes).

I'm using C++.

How do I access the data at the end? (this is a purely technical question).

I tried :

WAVEFORMATEX* wav = (WAVEFORMATEX*)pmt->pbFormat;
    WORD me = wav->cbSize;
    wav = wav + sizeof(WAVEFORMATEX);
    BYTE* arr = new BYTE[me];
    memcpy(arr, (BYTE*)wav, m开发者_运维问答e);

Didnt work.

Thanks

Roey


You've done a little mistake in pointer arithmetic. After

wav = wav + sizeof(WAVEFORMATEX);

wav points far beyond the end of the buffer (because wav is not CHAR* but WAVEFORMATEX*). You need to write:

wav = wav + 1;
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号