Commit 3fad6cad authored by David Reid's avatar David Reid

API CHANGE: Add channel maps to ma_data_source_get_data_format().

This commit also removes the onGetChannelMap callback from the decoding
backend vtable.
parent def31404
...@@ -95,8 +95,7 @@ static ma_decoding_backend_vtable g_ma_decoding_backend_vtable_libvorbis = ...@@ -95,8 +95,7 @@ static ma_decoding_backend_vtable g_ma_decoding_backend_vtable_libvorbis =
ma_decoding_backend_init_file__libvorbis, ma_decoding_backend_init_file__libvorbis,
NULL, /* onInitFileW() */ NULL, /* onInitFileW() */
NULL, /* onInitMemory() */ NULL, /* onInitMemory() */
ma_decoding_backend_uninit__libvorbis, ma_decoding_backend_uninit__libvorbis
ma_decoding_backend_get_channel_map__libvorbis
}; };
...@@ -172,8 +171,7 @@ static ma_decoding_backend_vtable g_ma_decoding_backend_vtable_libopus = ...@@ -172,8 +171,7 @@ static ma_decoding_backend_vtable g_ma_decoding_backend_vtable_libopus =
ma_decoding_backend_init_file__libopus, ma_decoding_backend_init_file__libopus,
NULL, /* onInitFileW() */ NULL, /* onInitFileW() */
NULL, /* onInitMemory() */ NULL, /* onInitMemory() */
ma_decoding_backend_uninit__libopus, ma_decoding_backend_uninit__libopus
ma_decoding_backend_get_channel_map__libopus
}; };
...@@ -233,7 +231,7 @@ int main(int argc, char** argv) ...@@ -233,7 +231,7 @@ int main(int argc, char** argv)
/* Initialize the device. */ /* Initialize the device. */
result = ma_data_source_get_data_format(&decoder, &format, &channels, &sampleRate); result = ma_data_source_get_data_format(&decoder, &format, &channels, &sampleRate, NULL, 0);
if (result != MA_SUCCESS) { if (result != MA_SUCCESS) {
printf("Failed to retrieve decoder data format."); printf("Failed to retrieve decoder data format.");
ma_decoder_uninit(&decoder); ma_decoder_uninit(&decoder);
......
...@@ -56,9 +56,9 @@ static ma_result ma_libopus_ds_seek(ma_data_source* pDataSource, ma_uint64 frame ...@@ -56,9 +56,9 @@ static ma_result ma_libopus_ds_seek(ma_data_source* pDataSource, ma_uint64 frame
return ma_libopus_seek_to_pcm_frame((ma_libopus*)pDataSource, frameIndex); return ma_libopus_seek_to_pcm_frame((ma_libopus*)pDataSource, frameIndex);
} }
static ma_result ma_libopus_ds_get_data_format(ma_data_source* pDataSource, ma_format* pFormat, ma_uint32* pChannels, ma_uint32* pSampleRate) static ma_result ma_libopus_ds_get_data_format(ma_data_source* pDataSource, ma_format* pFormat, ma_uint32* pChannels, ma_uint32* pSampleRate, ma_channel* pChannelMap, size_t channelMapCap)
{ {
return ma_libopus_get_data_format((ma_libopus*)pDataSource, pFormat, pChannels, pSampleRate, NULL, 0); return ma_libopus_get_data_format((ma_libopus*)pDataSource, pFormat, pChannels, pSampleRate, pChannelMap, channelMapCap);
} }
static ma_result ma_libopus_ds_get_cursor(ma_data_source* pDataSource, ma_uint64* pCursor) static ma_result ma_libopus_ds_get_cursor(ma_data_source* pDataSource, ma_uint64* pCursor)
......
...@@ -57,9 +57,9 @@ static ma_result ma_libvorbis_ds_seek(ma_data_source* pDataSource, ma_uint64 fra ...@@ -57,9 +57,9 @@ static ma_result ma_libvorbis_ds_seek(ma_data_source* pDataSource, ma_uint64 fra
return ma_libvorbis_seek_to_pcm_frame((ma_libvorbis*)pDataSource, frameIndex); return ma_libvorbis_seek_to_pcm_frame((ma_libvorbis*)pDataSource, frameIndex);
} }
static ma_result ma_libvorbis_ds_get_data_format(ma_data_source* pDataSource, ma_format* pFormat, ma_uint32* pChannels, ma_uint32* pSampleRate) static ma_result ma_libvorbis_ds_get_data_format(ma_data_source* pDataSource, ma_format* pFormat, ma_uint32* pChannels, ma_uint32* pSampleRate, ma_channel* pChannelMap, size_t channelMapCap)
{ {
return ma_libvorbis_get_data_format((ma_libvorbis*)pDataSource, pFormat, pChannels, pSampleRate, NULL, 0); return ma_libvorbis_get_data_format((ma_libvorbis*)pDataSource, pFormat, pChannels, pSampleRate, pChannelMap, channelMapCap);
} }
static ma_result ma_libvorbis_ds_get_cursor(ma_data_source* pDataSource, ma_uint64* pCursor) static ma_result ma_libvorbis_ds_get_cursor(ma_data_source* pDataSource, ma_uint64* pCursor)
......
This diff is collapsed.
...@@ -96,8 +96,7 @@ static ma_decoding_backend_vtable g_ma_decoding_backend_vtable_libvorbis = ...@@ -96,8 +96,7 @@ static ma_decoding_backend_vtable g_ma_decoding_backend_vtable_libvorbis =
ma_decoding_backend_init_file__libvorbis, ma_decoding_backend_init_file__libvorbis,
NULL, /* onInitFileW() */ NULL, /* onInitFileW() */
NULL, /* onInitMemory() */ NULL, /* onInitMemory() */
ma_decoding_backend_uninit__libvorbis, ma_decoding_backend_uninit__libvorbis
ma_decoding_backend_get_channel_map__libvorbis
}; };
...@@ -173,8 +172,7 @@ static ma_decoding_backend_vtable g_ma_decoding_backend_vtable_libopus = ...@@ -173,8 +172,7 @@ static ma_decoding_backend_vtable g_ma_decoding_backend_vtable_libopus =
ma_decoding_backend_init_file__libopus, ma_decoding_backend_init_file__libopus,
NULL, /* onInitFileW() */ NULL, /* onInitFileW() */
NULL, /* onInitMemory() */ NULL, /* onInitMemory() */
ma_decoding_backend_uninit__libopus, ma_decoding_backend_uninit__libopus
ma_decoding_backend_get_channel_map__libopus
}; };
......
...@@ -73,7 +73,7 @@ MA_API ma_result ma_data_source_read_pcm_frames_f32(ma_data_source* pDataSource, ...@@ -73,7 +73,7 @@ MA_API ma_result ma_data_source_read_pcm_frames_f32(ma_data_source* pDataSource,
ma_format format; ma_format format;
ma_uint32 channels; ma_uint32 channels;
result = ma_data_source_get_data_format(pDataSource, &format, &channels, NULL); result = ma_data_source_get_data_format(pDataSource, &format, &channels, NULL, NULL, 0);
if (result != MA_SUCCESS) { if (result != MA_SUCCESS) {
return result; /* Failed to retrieve the data format of the data source. */ return result; /* Failed to retrieve the data format of the data source. */
} }
...@@ -96,7 +96,7 @@ MA_API ma_result ma_data_source_read_pcm_frames_and_mix_f32(ma_data_source* pDat ...@@ -96,7 +96,7 @@ MA_API ma_result ma_data_source_read_pcm_frames_and_mix_f32(ma_data_source* pDat
return MA_INVALID_ARGS; return MA_INVALID_ARGS;
} }
result = ma_data_source_get_data_format(pDataSource, &format, &channels, NULL); result = ma_data_source_get_data_format(pDataSource, &format, &channels, NULL, NULL, 0);
if (result != MA_SUCCESS) { if (result != MA_SUCCESS) {
return result; /* Failed to retrieve the data format of the data source. */ return result; /* Failed to retrieve the data format of the data source. */
} }
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment