* Do not create converters if target format has wildcards

for the respective aspect.
 * Put back tracing output.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38468 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus
2010-08-30 22:23:08 +00:00
parent 30816b7ebd
commit 0f7fb31be2
@@ -37,23 +37,29 @@ AudioAdapter::AudioAdapter(AudioReader* source, const media_format& format)
fFormat.u.raw_audio.byte_order = hostByteOrder; fFormat.u.raw_audio.byte_order = hostByteOrder;
if (source && source->Format().type == B_MEDIA_RAW_AUDIO) { if (source && source->Format().type == B_MEDIA_RAW_AUDIO) {
if (fFormat.u.raw_audio.format != source->Format().u.raw_audio.format if (fFormat.u.raw_audio.format != 0
|| source->Format().u.raw_audio.byte_order != hostByteOrder) { && (fFormat.u.raw_audio.format
!= source->Format().u.raw_audio.format
|| source->Format().u.raw_audio.byte_order != hostByteOrder)) {
TRACE("AudioAdapter() - using format converter\n"); TRACE("AudioAdapter() - using format converter\n");
fFormatConverter = new (nothrow) AudioFormatConverter(source, fFormatConverter = new (nothrow) AudioFormatConverter(source,
fFormat.u.raw_audio.format, hostByteOrder); fFormat.u.raw_audio.format, hostByteOrder);
source = fFormatConverter; source = fFormatConverter;
} }
if (fFormat.u.raw_audio.frame_rate if (fFormat.u.raw_audio.frame_rate != 0
&& fFormat.u.raw_audio.frame_rate
!= source->Format().u.raw_audio.frame_rate) { != source->Format().u.raw_audio.frame_rate) {
TRACE("AudioAdapter() - using resampler\n"); TRACE("AudioAdapter() - using resampler (%.1f -> %.1f)\n",
source->Format().u.raw_audio.frame_rate,
fFormat.u.raw_audio.frame_rate);
fResampler = new (nothrow) AudioResampler(source, fResampler = new (nothrow) AudioResampler(source,
fFormat.u.raw_audio.frame_rate); fFormat.u.raw_audio.frame_rate);
source = fResampler; source = fResampler;
} }
if (fFormat.u.raw_audio.channel_count if (fFormat.u.raw_audio.channel_count != 0
&& fFormat.u.raw_audio.channel_count
!= source->Format().u.raw_audio.channel_count) { != source->Format().u.raw_audio.channel_count) {
TRACE("AudioAdapter() - using channel converter (%ld -> %ld)\n", TRACE("AudioAdapter() - using channel converter (%ld -> %ld)\n",
source->Format().u.raw_audio.channel_count, source->Format().u.raw_audio.channel_count,
@@ -87,13 +93,13 @@ AudioAdapter::InitialLatency() const
status_t status_t
AudioAdapter::Read(void* buffer, int64 pos, int64 frames) AudioAdapter::Read(void* buffer, int64 pos, int64 frames)
{ {
// TRACE("AudioAdapter::Read(%p, %Ld, %Ld)\n", buffer, pos, frames); TRACE("AudioAdapter::Read(%p, %Ld, %Ld)\n", buffer, pos, frames);
status_t error = InitCheck(); status_t error = InitCheck();
if (error != B_OK) if (error != B_OK)
return error; return error;
pos += fOutOffset; pos += fOutOffset;
status_t ret = fFinalConverter->Read(buffer, pos, frames); status_t ret = fFinalConverter->Read(buffer, pos, frames);
// TRACE("AudioAdapter::Read() done: %s\n", strerror(ret)); TRACE("AudioAdapter::Read() done: %s\n", strerror(ret));
return ret; return ret;
} }