Coding style cleanup.
This commit is contained in:
@@ -3,7 +3,8 @@
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
//! Multi-audio replacement media addon for BeOS
|
||||
|
||||
//! Media add-on for drivers that use the multi audio interface
|
||||
|
||||
|
||||
#include "MultiAudioNode.h"
|
||||
@@ -67,7 +68,7 @@ public:
|
||||
uint64 fSamplesSent;
|
||||
volatile uint32 fBufferCycle;
|
||||
multi_buffer_info fOldBufferInfo;
|
||||
Resampler *fResampler;
|
||||
Resampler* fResampler;
|
||||
};
|
||||
|
||||
|
||||
@@ -193,33 +194,48 @@ MultiAudioNode::MultiAudioNode(BMediaAddOn* addon, const char* name,
|
||||
AddNodeKind(B_PHYSICAL_INPUT);
|
||||
|
||||
// initialize our preferred format objects
|
||||
memset(&fOutputPreferredFormat, 0, sizeof(fOutputPreferredFormat)); // set everything to wildcard first
|
||||
memset(&fOutputPreferredFormat, 0, sizeof(fOutputPreferredFormat));
|
||||
// set everything to wildcard first
|
||||
fOutputPreferredFormat.type = B_MEDIA_RAW_AUDIO;
|
||||
fOutputPreferredFormat.u.raw_audio.format = MultiAudio::convert_to_media_format(fDevice->FormatInfo().output.format);
|
||||
fOutputPreferredFormat.u.raw_audio.valid_bits = MultiAudio::convert_to_valid_bits(fDevice->FormatInfo().output.format);
|
||||
fOutputPreferredFormat.u.raw_audio.format
|
||||
= MultiAudio::convert_to_media_format(
|
||||
fDevice->FormatInfo().output.format);
|
||||
fOutputPreferredFormat.u.raw_audio.valid_bits
|
||||
= MultiAudio::convert_to_valid_bits(
|
||||
fDevice->FormatInfo().output.format);
|
||||
fOutputPreferredFormat.u.raw_audio.channel_count = 2;
|
||||
fOutputPreferredFormat.u.raw_audio.frame_rate = MultiAudio::convert_to_sample_rate(fDevice->FormatInfo().output.rate); // measured in Hertz
|
||||
fOutputPreferredFormat.u.raw_audio.frame_rate
|
||||
= MultiAudio::convert_to_sample_rate(fDevice->FormatInfo().output.rate);
|
||||
// measured in Hertz
|
||||
fOutputPreferredFormat.u.raw_audio.byte_order = B_MEDIA_HOST_ENDIAN;
|
||||
|
||||
// we'll use the consumer's preferred buffer size, if any
|
||||
fOutputPreferredFormat.u.raw_audio.buffer_size = fDevice->BufferList().return_playback_buffer_size
|
||||
* (fOutputPreferredFormat.u.raw_audio.format & media_raw_audio_format::B_AUDIO_SIZE_MASK)
|
||||
* fOutputPreferredFormat.u.raw_audio.channel_count;
|
||||
fOutputPreferredFormat.u.raw_audio.buffer_size
|
||||
= fDevice->BufferList().return_playback_buffer_size
|
||||
* (fOutputPreferredFormat.u.raw_audio.format
|
||||
& media_raw_audio_format::B_AUDIO_SIZE_MASK)
|
||||
* fOutputPreferredFormat.u.raw_audio.channel_count;
|
||||
|
||||
// initialize our preferred format objects
|
||||
memset(&fInputPreferredFormat, 0, sizeof(fInputPreferredFormat)); // set everything to wildcard first
|
||||
memset(&fInputPreferredFormat, 0, sizeof(fInputPreferredFormat));
|
||||
// set everything to wildcard first
|
||||
fInputPreferredFormat.type = B_MEDIA_RAW_AUDIO;
|
||||
fInputPreferredFormat.u.raw_audio.format = MultiAudio::convert_to_media_format(fDevice->FormatInfo().input.format);
|
||||
fInputPreferredFormat.u.raw_audio.valid_bits = MultiAudio::convert_to_valid_bits(fDevice->FormatInfo().input.format);
|
||||
fInputPreferredFormat.u.raw_audio.format
|
||||
= MultiAudio::convert_to_media_format(
|
||||
fDevice->FormatInfo().input.format);
|
||||
fInputPreferredFormat.u.raw_audio.valid_bits
|
||||
= MultiAudio::convert_to_valid_bits(fDevice->FormatInfo().input.format);
|
||||
fInputPreferredFormat.u.raw_audio.channel_count = 2;
|
||||
fInputPreferredFormat.u.raw_audio.frame_rate = MultiAudio::convert_to_sample_rate(fDevice->FormatInfo().input.rate); // measured in Hertz
|
||||
fInputPreferredFormat.u.raw_audio.frame_rate
|
||||
= MultiAudio::convert_to_sample_rate(fDevice->FormatInfo().input.rate); // measured in Hertz
|
||||
fInputPreferredFormat.u.raw_audio.byte_order = B_MEDIA_HOST_ENDIAN;
|
||||
|
||||
// we'll use the consumer's preferred buffer size, if any
|
||||
fInputPreferredFormat.u.raw_audio.buffer_size = fDevice->BufferList().return_record_buffer_size
|
||||
* (fInputPreferredFormat.u.raw_audio.format & media_raw_audio_format::B_AUDIO_SIZE_MASK)
|
||||
* fInputPreferredFormat.u.raw_audio.channel_count;
|
||||
|
||||
fInputPreferredFormat.u.raw_audio.buffer_size
|
||||
= fDevice->BufferList().return_record_buffer_size
|
||||
* (fInputPreferredFormat.u.raw_audio.format
|
||||
& media_raw_audio_format::B_AUDIO_SIZE_MASK)
|
||||
* fInputPreferredFormat.u.raw_audio.channel_count;
|
||||
|
||||
if (config != NULL) {
|
||||
fConfig = *config;
|
||||
@@ -237,8 +253,6 @@ MultiAudioNode::~MultiAudioNode()
|
||||
|
||||
_StopOutputThread();
|
||||
BMediaEventLooper::Quit();
|
||||
|
||||
fWeb = NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -258,24 +272,29 @@ MultiAudioNode::GetFlavor(flavor_info* info, int32 id)
|
||||
return;
|
||||
|
||||
info->flavor_flags = 0;
|
||||
info->possible_count = 1; // one flavor at a time
|
||||
info->in_format_count = 0; // no inputs
|
||||
info->possible_count = 1;
|
||||
// one flavor at a time
|
||||
info->in_format_count = 0;
|
||||
// no inputs
|
||||
info->in_formats = 0;
|
||||
info->out_format_count = 0; // no outputs
|
||||
info->out_format_count = 0;
|
||||
// no outputs
|
||||
info->out_formats = 0;
|
||||
info->internal_id = id;
|
||||
|
||||
info->name = (char*)"MultiAudioNode Node";
|
||||
info->info = (char*)"The MultiAudioNode node outputs to multi_audio "
|
||||
"drivers.";
|
||||
info->name = const_cast<char*>("MultiAudioNode Node");
|
||||
info->info = const_cast<char*>("The MultiAudioNode node outputs to "
|
||||
"multi_audio drivers.");
|
||||
info->kinds = B_BUFFER_CONSUMER | B_BUFFER_PRODUCER | B_TIME_SOURCE
|
||||
| B_PHYSICAL_OUTPUT | B_PHYSICAL_INPUT | B_CONTROLLABLE;
|
||||
info->in_format_count = 1; // 1 input
|
||||
info->in_format_count = 1;
|
||||
// 1 input
|
||||
media_format* inFormats = new media_format[info->in_format_count];
|
||||
GetFormat(&inFormats[0]);
|
||||
info->in_formats = inFormats;
|
||||
|
||||
info->out_format_count = 1; // 1 output
|
||||
info->out_format_count = 1;
|
||||
// 1 output
|
||||
media_format* outFormats = new media_format[info->out_format_count];
|
||||
GetFormat(&outFormats[0]);
|
||||
info->out_formats = outFormats;
|
||||
@@ -315,7 +334,7 @@ void
|
||||
MultiAudioNode::Preroll()
|
||||
{
|
||||
CALLED();
|
||||
// XXX:Performance opportunity
|
||||
// TODO: Performance opportunity
|
||||
BMediaNode::Preroll();
|
||||
}
|
||||
|
||||
@@ -343,15 +362,21 @@ MultiAudioNode::NodeRegistered()
|
||||
|
||||
for (int32 i = 0; i < fDevice->Description().output_channel_count; i++) {
|
||||
if (currentInput == NULL
|
||||
|| (fDevice->Description().channels[i].designations & B_CHANNEL_MONO_BUS)
|
||||
|| (fDevice->Description().channels[currentId].designations & B_CHANNEL_STEREO_BUS
|
||||
&& ( fDevice->Description().channels[i].designations & B_CHANNEL_LEFT ||
|
||||
!(fDevice->Description().channels[i].designations & B_CHANNEL_STEREO_BUS)))
|
||||
|| (fDevice->Description().channels[currentId].designations & B_CHANNEL_SURROUND_BUS
|
||||
&& ( fDevice->Description().channels[i].designations & B_CHANNEL_LEFT ||
|
||||
!(fDevice->Description().channels[i].designations & B_CHANNEL_SURROUND_BUS)))
|
||||
) {
|
||||
PRINT(("NodeRegistered() : creating an input for %" B_PRIi32 "\n",
|
||||
|| (fDevice->Description().channels[i].designations
|
||||
& B_CHANNEL_MONO_BUS) != 0
|
||||
|| ((fDevice->Description().channels[currentId].designations
|
||||
& B_CHANNEL_STEREO_BUS) != 0
|
||||
&& ((fDevice->Description().channels[i].designations
|
||||
& B_CHANNEL_LEFT) != 0
|
||||
|| (fDevice->Description().channels[i].designations
|
||||
& B_CHANNEL_STEREO_BUS) == 0))
|
||||
|| ((fDevice->Description().channels[currentId].designations
|
||||
& B_CHANNEL_SURROUND_BUS) != 0
|
||||
&& ((fDevice->Description().channels[i].designations
|
||||
& B_CHANNEL_LEFT) != 0
|
||||
|| (fDevice->Description().channels[i].designations
|
||||
& B_CHANNEL_SURROUND_BUS) == 0))) {
|
||||
PRINT(("NodeRegistered(): creating an input for %" B_PRIi32 "\n",
|
||||
i));
|
||||
PRINT(("%" B_PRId32 "\t%d\t0x%" B_PRIx32 "\t0x%" B_PRIx32 "\n",
|
||||
fDevice->Description().channels[i].channel_id,
|
||||
@@ -375,16 +400,18 @@ MultiAudioNode::NodeRegistered()
|
||||
Resampler(currentInput->fPreferredFormat.AudioFormat(),
|
||||
fOutputPreferredFormat.AudioFormat());
|
||||
|
||||
currentInput->fChannelId = fDevice->Description().channels[i].channel_id;
|
||||
currentInput->fChannelId
|
||||
= fDevice->Description().channels[i].channel_id;
|
||||
fInputs.AddItem(currentInput);
|
||||
|
||||
currentId = i;
|
||||
} else {
|
||||
PRINT(("NodeRegistered() : adding a channel\n"));
|
||||
PRINT(("NodeRegistered(): adding a channel\n"));
|
||||
currentInput->fPreferredFormat.u.raw_audio.channel_count++;
|
||||
currentInput->fInput.format = currentInput->fPreferredFormat;
|
||||
}
|
||||
currentInput->fInput.format.u.raw_audio.format = media_raw_audio_format::wildcard.format;
|
||||
currentInput->fInput.format.u.raw_audio.format
|
||||
= media_raw_audio_format::wildcard.format;
|
||||
}
|
||||
|
||||
node_output *currentOutput = NULL;
|
||||
@@ -394,15 +421,21 @@ MultiAudioNode::NodeRegistered()
|
||||
i < fDevice->Description().output_channel_count
|
||||
+ fDevice->Description().input_channel_count; i++) {
|
||||
if (currentOutput == NULL
|
||||
|| (fDevice->Description().channels[i].designations & B_CHANNEL_MONO_BUS)
|
||||
|| (fDevice->Description().channels[currentId].designations & B_CHANNEL_STEREO_BUS
|
||||
&& ( fDevice->Description().channels[i].designations & B_CHANNEL_LEFT ||
|
||||
!(fDevice->Description().channels[i].designations & B_CHANNEL_STEREO_BUS)))
|
||||
|| (fDevice->Description().channels[currentId].designations & B_CHANNEL_SURROUND_BUS
|
||||
&& ( fDevice->Description().channels[i].designations & B_CHANNEL_LEFT ||
|
||||
!(fDevice->Description().channels[i].designations & B_CHANNEL_SURROUND_BUS)))
|
||||
) {
|
||||
PRINT(("NodeRegistered() : creating an output for %" B_PRIi32 "\n",
|
||||
|| (fDevice->Description().channels[i].designations
|
||||
& B_CHANNEL_MONO_BUS) != 0
|
||||
|| ((fDevice->Description().channels[currentId].designations
|
||||
& B_CHANNEL_STEREO_BUS) != 0
|
||||
&& ((fDevice->Description().channels[i].designations
|
||||
& B_CHANNEL_LEFT) != 0
|
||||
|| (fDevice->Description().channels[i].designations
|
||||
& B_CHANNEL_STEREO_BUS) == 0))
|
||||
|| ((fDevice->Description().channels[currentId].designations
|
||||
& B_CHANNEL_SURROUND_BUS) != 0
|
||||
&& ((fDevice->Description().channels[i].designations
|
||||
& B_CHANNEL_LEFT) != 0
|
||||
|| (fDevice->Description().channels[i].designations
|
||||
& B_CHANNEL_SURROUND_BUS) == 0))) {
|
||||
PRINT(("NodeRegistered(): creating an output for %" B_PRIi32 "\n",
|
||||
i));
|
||||
PRINT(("%" B_PRId32 "\t%d\t0x%" B_PRIx32 "\t0x%" B_PRIx32 "\n",
|
||||
fDevice->Description().channels[i].channel_id,
|
||||
@@ -427,12 +460,13 @@ MultiAudioNode::NodeRegistered()
|
||||
Resampler(fInputPreferredFormat.AudioFormat(),
|
||||
currentOutput->fPreferredFormat.AudioFormat());
|
||||
|
||||
currentOutput->fChannelId = fDevice->Description().channels[i].channel_id;
|
||||
currentOutput->fChannelId
|
||||
= fDevice->Description().channels[i].channel_id;
|
||||
fOutputs.AddItem(currentOutput);
|
||||
|
||||
currentId = i;
|
||||
} else {
|
||||
PRINT(("NodeRegistered() : adding a channel\n"));
|
||||
PRINT(("NodeRegistered(): adding a channel\n"));
|
||||
currentOutput->fPreferredFormat.u.raw_audio.channel_count++;
|
||||
currentOutput->fOutput.format = currentOutput->fPreferredFormat;
|
||||
}
|
||||
@@ -459,7 +493,7 @@ MultiAudioNode::NodeRegistered()
|
||||
index++;
|
||||
}
|
||||
|
||||
PRINT(("apply configuration in : %" B_PRIdBIGTIME "\n",
|
||||
PRINT(("apply configuration in: %" B_PRIdBIGTIME "\n",
|
||||
system_time() - start));
|
||||
|
||||
SetPriority(B_REAL_TIME_PRIORITY);
|
||||
@@ -543,14 +577,19 @@ MultiAudioNode::AcceptFormat(const media_destination& dest,
|
||||
format->u.raw_audio.format = media_raw_audio_format::B_AUDIO_FLOAT;
|
||||
else*/
|
||||
format->u.raw_audio.format = channel->fPreferredFormat.u.raw_audio.format;
|
||||
format->u.raw_audio.valid_bits = channel->fPreferredFormat.u.raw_audio.valid_bits;
|
||||
format->u.raw_audio.valid_bits
|
||||
= channel->fPreferredFormat.u.raw_audio.valid_bits;
|
||||
|
||||
format->u.raw_audio.frame_rate = channel->fPreferredFormat.u.raw_audio.frame_rate;
|
||||
format->u.raw_audio.channel_count = channel->fPreferredFormat.u.raw_audio.channel_count;
|
||||
format->u.raw_audio.frame_rate
|
||||
= channel->fPreferredFormat.u.raw_audio.frame_rate;
|
||||
format->u.raw_audio.channel_count
|
||||
= channel->fPreferredFormat.u.raw_audio.channel_count;
|
||||
format->u.raw_audio.byte_order = B_MEDIA_HOST_ENDIAN;
|
||||
format->u.raw_audio.buffer_size = fDevice->BufferList().return_playback_buffer_size
|
||||
* (format->u.raw_audio.format & media_raw_audio_format::B_AUDIO_SIZE_MASK)
|
||||
* format->u.raw_audio.channel_count;
|
||||
format->u.raw_audio.buffer_size
|
||||
= fDevice->BufferList().return_playback_buffer_size
|
||||
* (format->u.raw_audio.format
|
||||
& media_raw_audio_format::B_AUDIO_SIZE_MASK)
|
||||
* format->u.raw_audio.channel_count;
|
||||
|
||||
/*media_format myFormat;
|
||||
GetFormat(&myFormat);
|
||||
@@ -573,10 +612,10 @@ MultiAudioNode::GetNextInput(int32* cookie, media_input* _input)
|
||||
if (*cookie >= fInputs.CountItems() || *cookie < 0)
|
||||
return B_BAD_INDEX;
|
||||
|
||||
node_input *channel = (node_input *)fInputs.ItemAt(*cookie);
|
||||
node_input* channel = (node_input*)fInputs.ItemAt(*cookie);
|
||||
*_input = channel->fInput;
|
||||
*cookie += 1;
|
||||
PRINT(("input.format : %" B_PRIu32 "\n",
|
||||
PRINT(("input.format: %" B_PRIu32 "\n",
|
||||
channel->fInput.format.u.raw_audio.format));
|
||||
return B_OK;
|
||||
}
|
||||
@@ -605,22 +644,26 @@ MultiAudioNode::BufferReceived(BBuffer* buffer)
|
||||
}
|
||||
break;*/
|
||||
case B_MEDIA_RAW_AUDIO:
|
||||
if (buffer->Flags() & BBuffer::B_SMALL_BUFFER) {
|
||||
fprintf(stderr,"NOT IMPLEMENTED: B_SMALL_BUFFER in MultiAudioNode::BufferReceived\n");
|
||||
// XXX: implement this part
|
||||
if ((buffer->Flags() & BBuffer::B_SMALL_BUFFER) != 0) {
|
||||
fprintf(stderr, "NOT IMPLEMENTED: B_SMALL_BUFFER in "
|
||||
"MultiAudioNode::BufferReceived\n");
|
||||
// TODO: implement this part
|
||||
buffer->Recycle();
|
||||
} else {
|
||||
media_timed_event event(buffer->Header()->start_time, BTimedEventQueue::B_HANDLE_BUFFER,
|
||||
buffer, BTimedEventQueue::B_RECYCLE_BUFFER);
|
||||
media_timed_event event(buffer->Header()->start_time,
|
||||
BTimedEventQueue::B_HANDLE_BUFFER, buffer,
|
||||
BTimedEventQueue::B_RECYCLE_BUFFER);
|
||||
status_t status = EventQueue()->AddEvent(event);
|
||||
if (status != B_OK) {
|
||||
fprintf(stderr,"EventQueue()->AddEvent(event) in MultiAudioNode::BufferReceived failed\n");
|
||||
fprintf(stderr, "EventQueue()->AddEvent(event) in "
|
||||
"MultiAudioNode::BufferReceived failed\n");
|
||||
buffer->Recycle();
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr,"unexpected buffer type in MultiAudioNode::BufferReceived\n");
|
||||
fprintf(stderr, "unexpected buffer type in "
|
||||
"MultiAudioNode::BufferReceived\n");
|
||||
buffer->Recycle();
|
||||
break;
|
||||
}
|
||||
@@ -631,11 +674,10 @@ void
|
||||
MultiAudioNode::ProducerDataStatus(const media_destination& forWhom,
|
||||
int32 status, bigtime_t atPerformanceTime)
|
||||
{
|
||||
//CALLED();
|
||||
|
||||
node_input *channel = _FindInput(forWhom);
|
||||
node_input* channel = _FindInput(forWhom);
|
||||
if (channel == NULL) {
|
||||
fprintf(stderr,"invalid destination received in MultiAudioNode::ProducerDataStatus\n");
|
||||
fprintf(stderr, "invalid destination received in "
|
||||
"MultiAudioNode::ProducerDataStatus\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -653,7 +695,7 @@ MultiAudioNode::GetLatencyFor(const media_destination& forWhom,
|
||||
if (_latency == NULL || _timeSource == NULL)
|
||||
return B_BAD_VALUE;
|
||||
|
||||
node_input *channel = _FindInput(forWhom);
|
||||
node_input* channel = _FindInput(forWhom);
|
||||
if (channel == NULL)
|
||||
return B_MEDIA_BAD_DESTINATION;
|
||||
|
||||
@@ -671,11 +713,10 @@ MultiAudioNode::Connected(const media_source& producer,
|
||||
CALLED();
|
||||
if (out_input == 0) {
|
||||
fprintf(stderr, "<- B_BAD_VALUE\n");
|
||||
return B_BAD_VALUE; // no crashing
|
||||
return B_BAD_VALUE;
|
||||
}
|
||||
|
||||
node_input *channel = _FindInput(where);
|
||||
|
||||
node_input* channel = _FindInput(where);
|
||||
if (channel == NULL) {
|
||||
fprintf(stderr, "<- B_MEDIA_BAD_DESTINATION\n");
|
||||
return B_MEDIA_BAD_DESTINATION;
|
||||
@@ -699,8 +740,8 @@ MultiAudioNode::Disconnected(const media_source& producer,
|
||||
const media_destination& where)
|
||||
{
|
||||
CALLED();
|
||||
node_input *channel = _FindInput(where);
|
||||
|
||||
node_input* channel = _FindInput(where);
|
||||
if (channel == NULL || channel->fInput.source != producer)
|
||||
return;
|
||||
|
||||
@@ -719,15 +760,15 @@ MultiAudioNode::FormatChanged(const media_source& producer,
|
||||
const media_format& format)
|
||||
{
|
||||
CALLED();
|
||||
node_input *channel = _FindInput(consumer);
|
||||
|
||||
if(channel==NULL) {
|
||||
fprintf(stderr,"<- B_MEDIA_BAD_DESTINATION\n");
|
||||
node_input* channel = _FindInput(consumer);
|
||||
|
||||
if (channel==NULL) {
|
||||
fprintf(stderr, "<- B_MEDIA_BAD_DESTINATION\n");
|
||||
return B_MEDIA_BAD_DESTINATION;
|
||||
}
|
||||
if (channel->fInput.source != producer) {
|
||||
if (channel->fInput.source != producer)
|
||||
return B_MEDIA_BAD_SOURCE;
|
||||
}
|
||||
|
||||
return B_ERROR;
|
||||
}
|
||||
@@ -735,15 +776,12 @@ MultiAudioNode::FormatChanged(const media_source& producer,
|
||||
|
||||
status_t
|
||||
MultiAudioNode::SeekTagRequested(const media_destination& destination,
|
||||
bigtime_t in_target_time,
|
||||
uint32 in_flags,
|
||||
media_seek_tag * out_seek_tag,
|
||||
bigtime_t * out_tagged_time,
|
||||
uint32 * out_flags)
|
||||
bigtime_t targetTime, uint32 flags, media_seek_tag* _seekTag,
|
||||
bigtime_t* _taggedTime, uint32* _flags)
|
||||
{
|
||||
CALLED();
|
||||
return BBufferConsumer::SeekTagRequested(destination,in_target_time,in_flags,
|
||||
out_seek_tag,out_tagged_time,out_flags);
|
||||
return BBufferConsumer::SeekTagRequested(destination, targetTime, flags,
|
||||
_seekTag, _taggedTime, _flags);
|
||||
}
|
||||
|
||||
|
||||
@@ -754,13 +792,13 @@ status_t
|
||||
MultiAudioNode::FormatSuggestionRequested(media_type type, int32 /*quality*/,
|
||||
media_format* format)
|
||||
{
|
||||
// FormatSuggestionRequested() is not necessarily part of the format negotiation
|
||||
// process; it's simply an interrogation -- the caller wants to see what the node's
|
||||
// preferred data format is, given a suggestion by the caller.
|
||||
// FormatSuggestionRequested() is not necessarily part of the format
|
||||
// negotiation process; it's simply an interrogation -- the caller
|
||||
// wants to see what the node's preferred data format is, given a
|
||||
// suggestion by the caller.
|
||||
CALLED();
|
||||
|
||||
if (!format)
|
||||
{
|
||||
if (format == NULL) {
|
||||
fprintf(stderr, "\tERROR - NULL format pointer passed in!\n");
|
||||
return B_BAD_VALUE;
|
||||
}
|
||||
@@ -769,39 +807,46 @@ MultiAudioNode::FormatSuggestionRequested(media_type type, int32 /*quality*/,
|
||||
*format = fInputPreferredFormat;
|
||||
|
||||
// a wildcard type is okay; we can specialize it
|
||||
if (type == B_MEDIA_UNKNOWN_TYPE) type = B_MEDIA_RAW_AUDIO;
|
||||
if (type == B_MEDIA_UNKNOWN_TYPE)
|
||||
type = B_MEDIA_RAW_AUDIO;
|
||||
|
||||
// we only support raw audio
|
||||
if (type != B_MEDIA_RAW_AUDIO) return B_MEDIA_BAD_FORMAT;
|
||||
else return B_OK;
|
||||
if (type != B_MEDIA_RAW_AUDIO)
|
||||
return B_MEDIA_BAD_FORMAT;
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
MultiAudioNode::FormatProposal(const media_source& output, media_format* format)
|
||||
{
|
||||
// FormatProposal() is the first stage in the BMediaRoster::Connect() process. We hand
|
||||
// out a suggested format, with wildcards for any variations we support.
|
||||
// FormatProposal() is the first stage in the BMediaRoster::Connect()
|
||||
// process. We hand out a suggested format, with wildcards for any
|
||||
// variations we support.
|
||||
CALLED();
|
||||
node_output *channel = _FindOutput(output);
|
||||
|
||||
// is this a proposal for our select output?
|
||||
if (channel == NULL)
|
||||
{
|
||||
fprintf(stderr, "MultiAudioNode::FormatProposal returning B_MEDIA_BAD_SOURCE\n");
|
||||
node_output* channel = _FindOutput(output);
|
||||
if (channel == NULL) {
|
||||
fprintf(stderr, "MultiAudioNode::FormatProposal returning "
|
||||
"B_MEDIA_BAD_SOURCE\n");
|
||||
return B_MEDIA_BAD_SOURCE;
|
||||
}
|
||||
|
||||
// we only support floating-point raw audio, so we always return that, but we
|
||||
// supply an error code depending on whether we found the proposal acceptable.
|
||||
// We only support floating-point raw audio, so we always return that,
|
||||
// but we supply an error code depending on whether we found the proposal
|
||||
// acceptable.
|
||||
media_type requestedType = format->type;
|
||||
*format = channel->fPreferredFormat;
|
||||
if ((requestedType != B_MEDIA_UNKNOWN_TYPE) && (requestedType != B_MEDIA_RAW_AUDIO))
|
||||
{
|
||||
fprintf(stderr, "MultiAudioNode::FormatProposal returning B_MEDIA_BAD_FORMAT\n");
|
||||
if (requestedType != B_MEDIA_UNKNOWN_TYPE
|
||||
&& requestedType != B_MEDIA_RAW_AUDIO) {
|
||||
fprintf(stderr, "MultiAudioNode::FormatProposal returning "
|
||||
"B_MEDIA_BAD_FORMAT\n");
|
||||
return B_MEDIA_BAD_FORMAT;
|
||||
}
|
||||
else return B_OK; // raw audio or wildcard type, either is okay by us
|
||||
// raw audio or wildcard type, either is okay by us
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -818,17 +863,17 @@ MultiAudioNode::FormatChangeRequested(const media_source& source,
|
||||
|
||||
|
||||
status_t
|
||||
MultiAudioNode::GetNextOutput(int32* cookie, media_output* out_output)
|
||||
MultiAudioNode::GetNextOutput(int32* cookie, media_output* _output)
|
||||
{
|
||||
CALLED();
|
||||
|
||||
if ((*cookie < fOutputs.CountItems()) && (*cookie >= 0)) {
|
||||
node_output *channel = (node_output *)fOutputs.ItemAt(*cookie);
|
||||
*out_output = channel->fOutput;
|
||||
if (*cookie < fOutputs.CountItems() && *cookie >= 0) {
|
||||
node_output* channel = (node_output*)fOutputs.ItemAt(*cookie);
|
||||
*_output = channel->fOutput;
|
||||
*cookie += 1;
|
||||
return B_OK;
|
||||
} else
|
||||
return B_BAD_INDEX;
|
||||
}
|
||||
return B_BAD_INDEX;
|
||||
}
|
||||
|
||||
|
||||
@@ -842,37 +887,35 @@ MultiAudioNode::DisposeOutputCookie(int32 cookie)
|
||||
|
||||
|
||||
status_t
|
||||
MultiAudioNode::SetBufferGroup(const media_source& for_source,
|
||||
MultiAudioNode::SetBufferGroup(const media_source& forSource,
|
||||
BBufferGroup* newGroup)
|
||||
{
|
||||
CALLED();
|
||||
|
||||
node_output *channel = _FindOutput(for_source);
|
||||
|
||||
// is this our output?
|
||||
if (channel == NULL)
|
||||
{
|
||||
fprintf(stderr, "MultiAudioNode::SetBufferGroup returning B_MEDIA_BAD_SOURCE\n");
|
||||
node_output* channel = _FindOutput(forSource);
|
||||
if (channel == NULL) {
|
||||
fprintf(stderr, "MultiAudioNode::SetBufferGroup returning "
|
||||
"B_MEDIA_BAD_SOURCE\n");
|
||||
return B_MEDIA_BAD_SOURCE;
|
||||
}
|
||||
|
||||
// Are we being passed the buffer group we're already using?
|
||||
if (newGroup == channel->fBufferGroup) return B_OK;
|
||||
if (newGroup == channel->fBufferGroup)
|
||||
return B_OK;
|
||||
|
||||
// Ahh, someone wants us to use a different buffer group. At this point we delete
|
||||
// the one we are using and use the specified one instead. If the specified group is
|
||||
// NULL, we need to recreate one ourselves, and use *that*. Note that if we're
|
||||
// caching a BBuffer that we requested earlier, we have to Recycle() that buffer
|
||||
// *before* deleting the buffer group, otherwise we'll deadlock waiting for that
|
||||
// buffer to be recycled!
|
||||
delete channel->fBufferGroup; // waits for all buffers to recycle
|
||||
if (newGroup != NULL)
|
||||
{
|
||||
// Ahh, someone wants us to use a different buffer group. At this point
|
||||
// we delete the one we are using and use the specified one instead.
|
||||
// If the specified group is NULL, we need to recreate one ourselves, and
|
||||
// use *that*. Note that if we're caching a BBuffer that we requested
|
||||
// earlier, we have to Recycle() that buffer *before* deleting the buffer
|
||||
// group, otherwise we'll deadlock waiting for that buffer to be recycled!
|
||||
delete channel->fBufferGroup;
|
||||
// waits for all buffers to recycle
|
||||
if (newGroup != NULL) {
|
||||
// we were given a valid group; just use that one from now on
|
||||
channel->fBufferGroup = newGroup;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
// we were passed a NULL group pointer; that means we construct
|
||||
// our own buffer group to use from now on
|
||||
size_t size = channel->fOutput.format.u.raw_audio.buffer_size;
|
||||
@@ -901,7 +944,8 @@ MultiAudioNode::PrepareToConnect(const media_source& what,
|
||||
// is this our output?
|
||||
node_output* channel = _FindOutput(what);
|
||||
if (channel == NULL) {
|
||||
fprintf(stderr, "MultiAudioNode::PrepareToConnect returning B_MEDIA_BAD_SOURCE\n");
|
||||
fprintf(stderr, "MultiAudioNode::PrepareToConnect returning "
|
||||
"B_MEDIA_BAD_SOURCE\n");
|
||||
return B_MEDIA_BAD_SOURCE;
|
||||
}
|
||||
|
||||
@@ -937,11 +981,7 @@ MultiAudioNode::PrepareToConnect(const media_source& what,
|
||||
channel->fOutput.format = *format;
|
||||
|
||||
*source = channel->fOutput.source;
|
||||
#ifdef __HAIKU__
|
||||
strlcpy(name, channel->fOutput.name, B_MEDIA_NAME_LENGTH);
|
||||
#else
|
||||
strncpy(name, channel->fOutput.name, B_MEDIA_NAME_LENGTH);
|
||||
#endif
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
@@ -956,14 +996,15 @@ MultiAudioNode::Connect(status_t error, const media_source& source,
|
||||
// is this our output?
|
||||
node_output* channel = _FindOutput(source);
|
||||
if (channel == NULL) {
|
||||
fprintf(stderr, "MultiAudioNode::Connect returning (cause : B_MEDIA_BAD_SOURCE)\n");
|
||||
fprintf(stderr, "MultiAudioNode::Connect returning (cause: "
|
||||
"B_MEDIA_BAD_SOURCE)\n");
|
||||
return;
|
||||
}
|
||||
|
||||
// If something earlier failed, Connect() might still be called, but with
|
||||
// a non-zero error code. When that happens we simply unreserve the
|
||||
// connection and do nothing else.
|
||||
if (error) {
|
||||
if (error != B_OK) {
|
||||
channel->fOutput.destination = media_destination::null;
|
||||
channel->fOutput.format = channel->fPreferredFormat;
|
||||
return;
|
||||
@@ -973,15 +1014,12 @@ MultiAudioNode::Connect(status_t error, const media_source& source,
|
||||
// format that we agreed on, and report our connection name again.
|
||||
channel->fOutput.destination = destination;
|
||||
channel->fOutput.format = format;
|
||||
#ifdef __HAIKU__
|
||||
strlcpy(name, channel->fOutput.name, B_MEDIA_NAME_LENGTH);
|
||||
#else
|
||||
strncpy(name, channel->fOutput.name, B_MEDIA_NAME_LENGTH);
|
||||
#endif
|
||||
|
||||
// reset our buffer duration, etc. to avoid later calculations
|
||||
bigtime_t duration = channel->fOutput.format.u.raw_audio.buffer_size * 10000
|
||||
/ ((channel->fOutput.format.u.raw_audio.format & media_raw_audio_format::B_AUDIO_SIZE_MASK)
|
||||
/ ((channel->fOutput.format.u.raw_audio.format
|
||||
& media_raw_audio_format::B_AUDIO_SIZE_MASK)
|
||||
* channel->fOutput.format.u.raw_audio.channel_count)
|
||||
/ ((int32)(channel->fOutput.format.u.raw_audio.frame_rate / 100));
|
||||
|
||||
@@ -1002,7 +1040,7 @@ MultiAudioNode::Connect(status_t error, const media_source& source,
|
||||
// a buffer group (via SetBufferGroup()) prior to this. That can happen,
|
||||
// for example, if the consumer calls SetOutputBuffersFor() on us from
|
||||
// within its Connected() method.
|
||||
if (!channel->fBufferGroup)
|
||||
if (channel->fBufferGroup == NULL)
|
||||
_AllocateBuffers(*channel);
|
||||
|
||||
_StartOutputThreadIfNeeded();
|
||||
@@ -1018,7 +1056,8 @@ MultiAudioNode::Disconnect(const media_source& what,
|
||||
// is this our output?
|
||||
node_output* channel = _FindOutput(what);
|
||||
if (channel == NULL) {
|
||||
fprintf(stderr, "MultiAudioNode::Disconnect() returning (cause : B_MEDIA_BAD_SOURCE)\n");
|
||||
fprintf(stderr, "MultiAudioNode::Disconnect() returning (cause: "
|
||||
"B_MEDIA_BAD_SOURCE)\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1045,7 +1084,7 @@ MultiAudioNode::LateNoticeReceived(const media_source& what, bigtime_t howMuch,
|
||||
CALLED();
|
||||
|
||||
// is this our output?
|
||||
node_output *channel = _FindOutput(what);
|
||||
node_output* channel = _FindOutput(what);
|
||||
if (channel == NULL)
|
||||
return;
|
||||
|
||||
@@ -1091,7 +1130,7 @@ MultiAudioNode::EnableOutput(const media_source& what, bool enabled,
|
||||
// enable/disable that one. But this node only has one output, so I
|
||||
// just make sure the given source matches, then set the enable state
|
||||
// accordingly.
|
||||
node_output *channel = _FindOutput(what);
|
||||
node_output* channel = _FindOutput(what);
|
||||
if (channel != NULL)
|
||||
channel->fOutputEnabled = enabled;
|
||||
}
|
||||
@@ -1115,7 +1154,6 @@ void
|
||||
MultiAudioNode::HandleEvent(const media_timed_event* event, bigtime_t lateness,
|
||||
bool realTimeEvent)
|
||||
{
|
||||
//CALLED();
|
||||
switch (event->type) {
|
||||
case BTimedEventQueue::B_START:
|
||||
_HandleStart(event, lateness, realTimeEvent);
|
||||
@@ -1140,7 +1178,8 @@ MultiAudioNode::HandleEvent(const media_timed_event* event, bigtime_t lateness,
|
||||
_HandleParameter(event, lateness, realTimeEvent);
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr," unknown event type: %" B_PRId32 "\n", event->type);
|
||||
fprintf(stderr," unknown event type: %" B_PRId32 "\n",
|
||||
event->type);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1150,12 +1189,11 @@ status_t
|
||||
MultiAudioNode::_HandleBuffer(const media_timed_event* event,
|
||||
bigtime_t lateness, bool realTimeEvent)
|
||||
{
|
||||
//CALLED();
|
||||
BBuffer* buffer = const_cast<BBuffer*>((BBuffer*)event->pointer);
|
||||
if (buffer == NULL)
|
||||
return B_BAD_VALUE;
|
||||
|
||||
//PRINT(("buffer->Header()->destination : %i\n", buffer->Header()->destination));
|
||||
//PRINT(("buffer->Header()->destination: %i\n", buffer->Header()->destination));
|
||||
|
||||
node_input* channel = _FindInput(buffer->Header()->destination);
|
||||
if (channel == NULL) {
|
||||
@@ -1169,15 +1207,15 @@ MultiAudioNode::_HandleBuffer(const media_timed_event* event,
|
||||
// lateness doesn't matter in offline mode or in recording mode
|
||||
//mLateBuffers++;
|
||||
NotifyLateProducer(channel->fInput.source, lateness, event->event_time);
|
||||
fprintf(stderr," <- LATE BUFFER : %" B_PRIdBIGTIME "\n", lateness);
|
||||
fprintf(stderr," <- LATE BUFFER: %" B_PRIdBIGTIME "\n", lateness);
|
||||
buffer->Recycle();
|
||||
} else {
|
||||
//WriteBuffer(buffer, *channel);
|
||||
// TODO: This seems like a very fragile mechanism to wait until
|
||||
// the previous buffer for this channel has been processed...
|
||||
if (channel->fBuffer != NULL) {
|
||||
PRINT(("MultiAudioNode::HandleBuffer snoozing recycling channelId : %"
|
||||
B_PRIi32 ", how_early:%" B_PRIdBIGTIME "\n",
|
||||
PRINT(("MultiAudioNode::HandleBuffer snoozing recycling channelId: "
|
||||
"%" B_PRIi32 ", how_early:%" B_PRIdBIGTIME "\n",
|
||||
channel->fChannelId, lateness));
|
||||
//channel->fBuffer->Recycle();
|
||||
snooze(100);
|
||||
@@ -1186,7 +1224,7 @@ MultiAudioNode::_HandleBuffer(const media_timed_event* event,
|
||||
else
|
||||
channel->fBuffer = buffer;
|
||||
} else {
|
||||
//PRINT(("MultiAudioNode::HandleBuffer writing channelId : %li, how_early:%Ld\n", channel->fChannelId, howEarly));
|
||||
//PRINT(("MultiAudioNode::HandleBuffer writing channelId: %li, how_early:%Ld\n", channel->fChannelId, howEarly));
|
||||
channel->fBuffer = buffer;
|
||||
}
|
||||
}
|
||||
@@ -1198,9 +1236,8 @@ status_t
|
||||
MultiAudioNode::_HandleDataStatus(const media_timed_event* event,
|
||||
bigtime_t lateness, bool realTimeEvent)
|
||||
{
|
||||
//CALLED();
|
||||
PRINT(("MultiAudioNode::HandleDataStatus status:%" B_PRIi32
|
||||
", lateness:%" B_PRIiBIGTIME "\n", event->data, lateness));
|
||||
PRINT(("MultiAudioNode::HandleDataStatus status:%" B_PRIi32 ", lateness:%"
|
||||
B_PRIiBIGTIME "\n", event->data, lateness));
|
||||
switch (event->data) {
|
||||
case B_DATA_NOT_AVAILABLE:
|
||||
break;
|
||||
@@ -1216,7 +1253,7 @@ MultiAudioNode::_HandleDataStatus(const media_timed_event* event,
|
||||
|
||||
|
||||
status_t
|
||||
MultiAudioNode::_HandleStart(const media_timed_event *event, bigtime_t lateness,
|
||||
MultiAudioNode::_HandleStart(const media_timed_event* event, bigtime_t lateness,
|
||||
bool realTimeEvent)
|
||||
{
|
||||
CALLED();
|
||||
@@ -1337,7 +1374,7 @@ MultiAudioNode::GetParameterValue(int32 id, bigtime_t* lastChange, void* value,
|
||||
{
|
||||
CALLED();
|
||||
|
||||
PRINT(("id : %" B_PRIi32 "\n", id));
|
||||
PRINT(("id: %" B_PRIi32 "\n", id));
|
||||
BParameter* parameter = NULL;
|
||||
for (int32 i = 0; i < fWeb->CountParameters(); i++) {
|
||||
parameter = fWeb->ParameterAt(i);
|
||||
@@ -1387,7 +1424,7 @@ MultiAudioNode::GetParameterValue(int32 id, bigtime_t* lastChange, void* value,
|
||||
info.item_count = 2;
|
||||
values[1].id = controls[id + 1 - 100].id;
|
||||
}
|
||||
} else if(parameter->Type() == BParameter::B_DISCRETE_PARAMETER) {
|
||||
} else if (parameter->Type() == BParameter::B_DISCRETE_PARAMETER) {
|
||||
info.item_count = 1;
|
||||
values[0].id = control_id;
|
||||
}
|
||||
@@ -1408,7 +1445,7 @@ MultiAudioNode::GetParameterValue(int32 id, bigtime_t* lastChange, void* value,
|
||||
|
||||
for (uint32 i = 0; i < *size / sizeof(float); i++) {
|
||||
PRINT(("GetParameterValue B_CONTINUOUS_PARAMETER value[%"
|
||||
B_PRIi32 "] : %f\n", i, ((float*)value)[i]));
|
||||
B_PRIi32 "]: %f\n", i, ((float*)value)[i]));
|
||||
}
|
||||
} else if (parameter->Type() == BParameter::B_DISCRETE_PARAMETER) {
|
||||
BDiscreteParameter* discrete = (BDiscreteParameter*)parameter;
|
||||
@@ -1420,8 +1457,8 @@ MultiAudioNode::GetParameterValue(int32 id, bigtime_t* lastChange, void* value,
|
||||
*size = sizeof(int32);
|
||||
|
||||
for (uint32 i = 0; i < *size / sizeof(int32); i++) {
|
||||
PRINT(("GetParameterValue B_DISCRETE_PARAMETER value[%" B_PRIi32
|
||||
"] : %" B_PRIi32 "\n", i, ((int32*)value)[i]));
|
||||
PRINT(("GetParameterValue B_DISCRETE_PARAMETER value[%"
|
||||
B_PRIi32 "]: %" B_PRIi32 "\n", i, ((int32*)value)[i]));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1435,8 +1472,8 @@ MultiAudioNode::SetParameterValue(int32 id, bigtime_t performanceTime,
|
||||
const void* value, size_t size)
|
||||
{
|
||||
CALLED();
|
||||
PRINT(("id : %" B_PRIi32 ", performance_time : %" B_PRIdBIGTIME
|
||||
", size : %" B_PRIuSIZE "\n", id, performanceTime, size));
|
||||
PRINT(("id: %" B_PRIi32 ", performance_time: %" B_PRIdBIGTIME
|
||||
", size: %" B_PRIuSIZE "\n", id, performanceTime, size));
|
||||
|
||||
BParameter* parameter = NULL;
|
||||
for (int32 i = 0; i < fWeb->CountParameters(); i++) {
|
||||
@@ -1450,7 +1487,8 @@ MultiAudioNode::SetParameterValue(int32 id, bigtime_t performanceTime,
|
||||
|
||||
if (id == PARAMETER_ID_OUTPUT_FREQUENCY
|
||||
|| (id == PARAMETER_ID_INPUT_FREQUENCY
|
||||
&& (fDevice->Description().output_rates & B_SR_SAME_AS_INPUT))) {
|
||||
&& (fDevice->Description().output_rates
|
||||
& B_SR_SAME_AS_INPUT) != 0)) {
|
||||
uint32 rate;
|
||||
if (size < sizeof(rate))
|
||||
return;
|
||||
@@ -1461,8 +1499,7 @@ MultiAudioNode::SetParameterValue(int32 id, bigtime_t performanceTime,
|
||||
|
||||
// create a cookie RequestCompleted() can get the old frame rate from,
|
||||
// if anything goes wrong
|
||||
FrameRateChangeCookie* cookie
|
||||
= new(std::nothrow) FrameRateChangeCookie;
|
||||
FrameRateChangeCookie* cookie = new(std::nothrow) FrameRateChangeCookie;
|
||||
if (cookie == NULL)
|
||||
return;
|
||||
|
||||
@@ -1514,8 +1551,7 @@ MultiAudioNode::SetParameterValue(int32 id, bigtime_t performanceTime,
|
||||
|
||||
// create a cookie RequestCompleted() can get the old frame rate from,
|
||||
// if anything goes wrong
|
||||
FrameRateChangeCookie* cookie
|
||||
= new(std::nothrow) FrameRateChangeCookie;
|
||||
FrameRateChangeCookie* cookie = new(std::nothrow) FrameRateChangeCookie;
|
||||
if (cookie == NULL)
|
||||
return;
|
||||
|
||||
@@ -1564,7 +1600,7 @@ MultiAudioNode::SetParameterValue(int32 id, bigtime_t performanceTime,
|
||||
if (parameter->Type() == BParameter::B_CONTINUOUS_PARAMETER) {
|
||||
for (uint32 i = 0; i < size / sizeof(float); i++) {
|
||||
PRINT(("SetParameterValue B_CONTINUOUS_PARAMETER value[%" B_PRIi32
|
||||
"] : %f\n", i, ((float*)value)[i]));
|
||||
"]: %f\n", i, ((float*)value)[i]));
|
||||
}
|
||||
info.item_count = 1;
|
||||
values[0].id = control_id;
|
||||
@@ -1578,7 +1614,7 @@ MultiAudioNode::SetParameterValue(int32 id, bigtime_t performanceTime,
|
||||
} else if (parameter->Type() == BParameter::B_DISCRETE_PARAMETER) {
|
||||
for (uint32 i = 0; i < size / sizeof(int32); i++) {
|
||||
PRINT(("SetParameterValue B_DISCRETE_PARAMETER value[%" B_PRIi32
|
||||
"] : %" B_PRIi32 "\n", i, ((int32*)value)[i]));
|
||||
"]: %" B_PRIi32 "\n", i, ((int32*)value)[i]));
|
||||
}
|
||||
|
||||
BDiscreteParameter* discrete = (BDiscreteParameter*)parameter;
|
||||
@@ -1605,18 +1641,19 @@ BParameterWeb*
|
||||
MultiAudioNode::MakeParameterWeb()
|
||||
{
|
||||
CALLED();
|
||||
BParameterWeb* web = new BParameterWeb;
|
||||
BParameterWeb* web = new BParameterWeb();
|
||||
|
||||
PRINT(("MixControlInfo().control_count : %" B_PRIi32 "\n",
|
||||
PRINT(("MixControlInfo().control_count: %" B_PRIi32 "\n",
|
||||
fDevice->MixControlInfo().control_count));
|
||||
|
||||
BParameterGroup* generalGroup = web->MakeGroup(B_TRANSLATE("General"));
|
||||
|
||||
const multi_description& description = fDevice->Description();
|
||||
|
||||
if (description.output_rates & B_SR_SAME_AS_INPUT) {
|
||||
_CreateFrequencyParameterGroup(generalGroup, B_TRANSLATE("Input & Output"),
|
||||
PARAMETER_ID_INPUT_FREQUENCY, description.input_rates);
|
||||
if ((description.output_rates & B_SR_SAME_AS_INPUT) != 0) {
|
||||
_CreateFrequencyParameterGroup(generalGroup,
|
||||
B_TRANSLATE("Input & Output"), PARAMETER_ID_INPUT_FREQUENCY,
|
||||
description.input_rates);
|
||||
} else {
|
||||
_CreateFrequencyParameterGroup(generalGroup, B_TRANSLATE("Input"),
|
||||
PARAMETER_ID_INPUT_FREQUENCY, description.input_rates);
|
||||
@@ -1627,7 +1664,8 @@ MultiAudioNode::MakeParameterWeb()
|
||||
multi_mix_control* controls = fDevice->MixControlInfo().controls;
|
||||
|
||||
for (int i = 0; i < fDevice->MixControlInfo().control_count; i++) {
|
||||
if (controls[i].flags & B_MULTI_MIX_GROUP && controls[i].parent == 0) {
|
||||
if ((controls[i].flags & B_MULTI_MIX_GROUP) != 0
|
||||
&& controls[i].parent == 0) {
|
||||
PRINT(("NEW_GROUP\n"));
|
||||
BParameterGroup* child = web->MakeGroup(
|
||||
_GetControlName(controls[i]));
|
||||
@@ -1692,15 +1730,15 @@ MultiAudioNode::_ProcessGroup(BParameterGroup* group, int32 index,
|
||||
|
||||
if (i + 1 < fDevice->MixControlInfo().control_count
|
||||
&& controls[i + 1].master == controls[i].id
|
||||
&& controls[i + 1].flags & B_MULTI_MIX_GAIN) {
|
||||
&& (controls[i + 1].flags & B_MULTI_MIX_GAIN) != 0) {
|
||||
group->ParameterAt(numParameters)->SetChannelCount(
|
||||
group->ParameterAt(numParameters)->CountChannels() + 1);
|
||||
i++;
|
||||
}
|
||||
|
||||
PRINT(("num parameters : %" B_PRId32 "\n", numParameters));
|
||||
PRINT(("num parameters: %" B_PRId32 "\n", numParameters));
|
||||
if (numParameters > 0) {
|
||||
(group->ParameterAt(numParameters - 1))->AddOutput(
|
||||
group->ParameterAt(numParameters - 1)->AddOutput(
|
||||
group->ParameterAt(numParameters));
|
||||
numParameters++;
|
||||
}
|
||||
@@ -1714,7 +1752,7 @@ MultiAudioNode::_ProcessGroup(BParameterGroup* group, int32 index,
|
||||
B_MEDIA_RAW_AUDIO, name, B_ENABLE);
|
||||
}
|
||||
if (numParameters > 0) {
|
||||
(group->ParameterAt(numParameters - 1))->AddOutput(
|
||||
group->ParameterAt(numParameters - 1)->AddOutput(
|
||||
group->ParameterAt(numParameters));
|
||||
numParameters++;
|
||||
}
|
||||
@@ -1735,7 +1773,7 @@ MultiAudioNode::_ProcessMux(BDiscreteParameter* parameter, int32 index)
|
||||
if (controls[i].parent != parent->id)
|
||||
continue;
|
||||
|
||||
if (controls[i].flags & B_MULTI_MIX_MUX_VALUE) {
|
||||
if ((controls[i].flags & B_MULTI_MIX_MUX_VALUE) != 0) {
|
||||
PRINT(("NEW_MUX_VALUE\n"));
|
||||
parameter->AddItem(itemIndex, _GetControlName(controls[i]));
|
||||
itemIndex++;
|
||||
@@ -1750,7 +1788,8 @@ MultiAudioNode::_CreateFrequencyParameterGroup(BParameterGroup* parentGroup,
|
||||
{
|
||||
BParameterGroup* group = parentGroup->MakeGroup(name);
|
||||
BDiscreteParameter* frequencyParam = group->MakeDiscreteParameter(
|
||||
parameterID, B_MEDIA_NO_TYPE, BString(name) << B_TRANSLATE(" frequency:"),
|
||||
parameterID, B_MEDIA_NO_TYPE,
|
||||
BString(name) << B_TRANSLATE(" frequency:"),
|
||||
B_GENERIC);
|
||||
|
||||
for (int32 i = 0; kSampleRateInfos[i].name != NULL; i++) {
|
||||
@@ -1796,9 +1835,9 @@ MultiAudioNode::_OutputThread()
|
||||
fDevice->BufferExchange(&bufferInfo);
|
||||
|
||||
//PRINT(("MultiAudioNode::RunThread: buffer exchanged\n"));
|
||||
//PRINT(("MultiAudioNode::RunThread: played_real_time : %Ld\n", bufferInfo.played_real_time));
|
||||
//PRINT(("MultiAudioNode::RunThread: played_frames_count : %Ld\n", bufferInfo.played_frames_count));
|
||||
//PRINT(("MultiAudioNode::RunThread: buffer_cycle : %li\n", bufferInfo.playback_buffer_cycle));
|
||||
//PRINT(("MultiAudioNode::RunThread: played_real_time: %Ld\n", bufferInfo.played_real_time));
|
||||
//PRINT(("MultiAudioNode::RunThread: played_frames_count: %Ld\n", bufferInfo.played_frames_count));
|
||||
//PRINT(("MultiAudioNode::RunThread: buffer_cycle: %li\n", bufferInfo.playback_buffer_cycle));
|
||||
|
||||
for (int32 i = 0; i < fInputs.CountItems(); i++) {
|
||||
node_input* input = (node_input*)fInputs.ItemAt(i);
|
||||
@@ -1811,7 +1850,7 @@ MultiAudioNode::_OutputThread()
|
||||
|| fDevice->BufferList().return_playback_buffers == 1)
|
||||
&& (input->fInput.source != media_source::null
|
||||
|| input->fChannelId == 0)) {
|
||||
//PRINT(("playback_buffer_cycle ok input : %li %ld\n", i, bufferInfo.playback_buffer_cycle));
|
||||
//PRINT(("playback_buffer_cycle ok input: %li %ld\n", i, bufferInfo.playback_buffer_cycle));
|
||||
|
||||
input->fBufferCycle = (bufferInfo.playback_buffer_cycle - 1
|
||||
+ fDevice->BufferList().return_playback_buffers)
|
||||
@@ -1840,15 +1879,15 @@ MultiAudioNode::_OutputThread()
|
||||
// mark buffer free
|
||||
release_sem(fBufferFreeSem);
|
||||
} else {
|
||||
//PRINT(("playback_buffer_cycle non ok input : %i\n", i));
|
||||
//PRINT(("playback_buffer_cycle non ok input: %i\n", i));
|
||||
}
|
||||
}
|
||||
|
||||
PRINT(("MultiAudioNode::RunThread: recorded_real_time : %" B_PRIdBIGTIME
|
||||
PRINT(("MultiAudioNode::RunThread: recorded_real_time: %" B_PRIdBIGTIME
|
||||
"\n", bufferInfo.recorded_real_time));
|
||||
PRINT(("MultiAudioNode::RunThread: recorded_frames_count : %"
|
||||
PRINT(("MultiAudioNode::RunThread: recorded_frames_count: %"
|
||||
B_PRId64 "\n", bufferInfo.recorded_frames_count));
|
||||
PRINT(("MultiAudioNode::RunThread: record_buffer_cycle : %" B_PRIi32
|
||||
PRINT(("MultiAudioNode::RunThread: record_buffer_cycle: %" B_PRIi32
|
||||
"\n", bufferInfo.record_buffer_cycle));
|
||||
|
||||
for (int32 i = 0; i < fOutputs.CountItems(); i++) {
|
||||
@@ -1878,14 +1917,15 @@ MultiAudioNode::_OutputThread()
|
||||
err = SendBuffer(buffer, output->fOutput.source,
|
||||
output->fOutput.destination);
|
||||
}
|
||||
if (err) {
|
||||
if (err != B_OK) {
|
||||
buffer->Recycle();
|
||||
} else {
|
||||
// track how much media we've delivered so far
|
||||
size_t numSamples
|
||||
= output->fOutput.format.u.raw_audio.buffer_size
|
||||
/ (output->fOutput.format.u.raw_audio.format
|
||||
& media_raw_audio_format::B_AUDIO_SIZE_MASK);
|
||||
/ (output->fOutput.format.u.raw_audio.format
|
||||
& media_raw_audio_format
|
||||
::B_AUDIO_SIZE_MASK);
|
||||
output->fSamplesSent += numSamples;
|
||||
}
|
||||
}
|
||||
@@ -2115,15 +2155,15 @@ MultiAudioNode::_UpdateTimeSource(multi_buffer_info& info,
|
||||
|
||||
|
||||
BBuffer*
|
||||
MultiAudioNode::_FillNextBuffer(multi_buffer_info &info, node_output &output)
|
||||
MultiAudioNode::_FillNextBuffer(multi_buffer_info& info, node_output& output)
|
||||
{
|
||||
//CALLED();
|
||||
// get a buffer from our buffer group
|
||||
//PRINT(("buffer size : %i, buffer duration : %i\n", fOutput.format.u.raw_audio.buffer_size, BufferDuration()));
|
||||
//PRINT(("MBI.record_buffer_cycle : %i\n", MBI.record_buffer_cycle));
|
||||
//PRINT(("MBI.recorded_real_time : %i\n", MBI.recorded_real_time));
|
||||
//PRINT(("MBI.recorded_frames_count : %i\n", MBI.recorded_frames_count));
|
||||
if (!output.fBufferGroup)
|
||||
//PRINT(("buffer size: %i, buffer duration: %i\n", fOutput.format.u.raw_audio.buffer_size, BufferDuration()));
|
||||
//PRINT(("MBI.record_buffer_cycle: %i\n", MBI.record_buffer_cycle));
|
||||
//PRINT(("MBI.recorded_real_time: %i\n", MBI.recorded_real_time));
|
||||
//PRINT(("MBI.recorded_frames_count: %i\n", MBI.recorded_frames_count));
|
||||
if (output.fBufferGroup == NULL)
|
||||
return NULL;
|
||||
|
||||
BBuffer* buffer = output.fBufferGroup->RequestBuffer(
|
||||
@@ -2182,28 +2222,24 @@ status_t
|
||||
MultiAudioNode::GetConfigurationFor(BMessage* message)
|
||||
{
|
||||
CALLED();
|
||||
|
||||
BParameter *parameter = NULL;
|
||||
void *buffer;
|
||||
size_t bufferSize = 128;
|
||||
bigtime_t lastChange;
|
||||
status_t err;
|
||||
|
||||
if (message == NULL)
|
||||
return B_BAD_VALUE;
|
||||
|
||||
buffer = malloc(bufferSize);
|
||||
size_t bufferSize = 128;
|
||||
void* buffer = malloc(bufferSize);
|
||||
if (buffer == NULL)
|
||||
return B_NO_MEMORY;
|
||||
|
||||
for (int32 i = 0; i < fWeb->CountParameters(); i++) {
|
||||
parameter = fWeb->ParameterAt(i);
|
||||
BParameter* parameter = fWeb->ParameterAt(i);
|
||||
if (parameter->Type() != BParameter::B_CONTINUOUS_PARAMETER
|
||||
&& parameter->Type() != BParameter::B_DISCRETE_PARAMETER)
|
||||
continue;
|
||||
|
||||
PRINT(("getting parameter %" B_PRIi32 "\n", parameter->ID()));
|
||||
size_t size = bufferSize;
|
||||
bigtime_t lastChange;
|
||||
status_t err;
|
||||
while ((err = GetParameterValue(parameter->ID(), &lastChange, buffer,
|
||||
&size)) == B_NO_MEMORY && bufferSize < 128 * 1024) {
|
||||
bufferSize += 128;
|
||||
@@ -2217,7 +2253,7 @@ MultiAudioNode::GetConfigurationFor(BMessage* message)
|
||||
message->AddInt32("parameterID", parameter->ID());
|
||||
message->AddData("parameterData", B_RAW_TYPE, buffer, size, false);
|
||||
} else {
|
||||
PRINT(("parameter err : %s\n", strerror(err)));
|
||||
PRINT(("parameter err: %s\n", strerror(err)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -32,207 +32,235 @@ class node_output;
|
||||
class MultiAudioNode : public BBufferConsumer, public BBufferProducer,
|
||||
public BTimeSource, public BMediaEventLooper, public BControllable {
|
||||
protected:
|
||||
virtual ~MultiAudioNode();
|
||||
virtual ~MultiAudioNode();
|
||||
|
||||
public:
|
||||
MultiAudioNode(BMediaAddOn* addon, const char* name,
|
||||
MultiAudioDevice* device, int32 internalID,
|
||||
BMessage* config);
|
||||
MultiAudioNode(BMediaAddOn* addon,
|
||||
const char* name, MultiAudioDevice* device,
|
||||
int32 internalID, BMessage* config);
|
||||
|
||||
virtual status_t InitCheck() const;
|
||||
virtual status_t InitCheck() const;
|
||||
|
||||
static void GetFlavor(flavor_info* info, int32 id);
|
||||
static void GetFormat(media_format* outFormat);
|
||||
static void GetFlavor(flavor_info* info, int32 id);
|
||||
static void GetFormat(media_format* outFormat);
|
||||
|
||||
status_t GetConfigurationFor(BMessage* message);
|
||||
status_t GetConfigurationFor(BMessage* message);
|
||||
|
||||
// BMediaNode methods
|
||||
virtual BMediaAddOn* AddOn(int32* internalID) const;
|
||||
virtual status_t HandleMessage(int32 message, const void* data,
|
||||
size_t size);
|
||||
virtual BMediaAddOn* AddOn(int32* internalID) const;
|
||||
virtual status_t HandleMessage(int32 message, const void* data,
|
||||
size_t size);
|
||||
|
||||
protected:
|
||||
virtual void Preroll();
|
||||
virtual void NodeRegistered();
|
||||
virtual status_t RequestCompleted(const media_request_info& info);
|
||||
virtual void SetTimeSource(BTimeSource* timeSource);
|
||||
virtual void Preroll();
|
||||
virtual void NodeRegistered();
|
||||
virtual status_t RequestCompleted(
|
||||
const media_request_info& info);
|
||||
virtual void SetTimeSource(BTimeSource* timeSource);
|
||||
|
||||
// BBufferConsumer methods
|
||||
|
||||
virtual status_t AcceptFormat(const media_destination& dest,
|
||||
media_format* format);
|
||||
virtual status_t GetNextInput(int32* cookie, media_input* input);
|
||||
virtual void DisposeInputCookie(int32 cookie);
|
||||
virtual void BufferReceived(BBuffer* buffer);
|
||||
virtual void ProducerDataStatus(const media_destination& forWhom,
|
||||
int32 status, bigtime_t atPerformanceTime);
|
||||
virtual status_t GetLatencyFor(const media_destination& forWhom,
|
||||
bigtime_t* latency, media_node_id* timeSource);
|
||||
virtual status_t Connected(const media_source& producer,
|
||||
const media_destination& where,
|
||||
const media_format& withFormat,
|
||||
media_input* input);
|
||||
virtual void Disconnected(const media_source& producer,
|
||||
const media_destination& where);
|
||||
virtual status_t FormatChanged(const media_source& producer,
|
||||
const media_destination& consumer,
|
||||
int32 changeTag, const media_format& format);
|
||||
virtual status_t AcceptFormat(const media_destination& dest,
|
||||
media_format* format);
|
||||
virtual status_t GetNextInput(int32* cookie, media_input* input);
|
||||
virtual void DisposeInputCookie(int32 cookie);
|
||||
virtual void BufferReceived(BBuffer* buffer);
|
||||
virtual void ProducerDataStatus(
|
||||
const media_destination& forWhom,
|
||||
int32 status, bigtime_t atPerformanceTime);
|
||||
virtual status_t GetLatencyFor(const media_destination& forWhom,
|
||||
bigtime_t* latency,
|
||||
media_node_id* timeSource);
|
||||
virtual status_t Connected(const media_source& producer,
|
||||
const media_destination& where,
|
||||
const media_format& withFormat,
|
||||
media_input* input);
|
||||
virtual void Disconnected(const media_source& producer,
|
||||
const media_destination& where);
|
||||
virtual status_t FormatChanged(const media_source& producer,
|
||||
const media_destination& consumer,
|
||||
int32 changeTag,
|
||||
const media_format& format);
|
||||
|
||||
virtual status_t SeekTagRequested(
|
||||
const media_destination& destination,
|
||||
bigtime_t targetTime, uint32 flags,
|
||||
media_seek_tag* _seekTag, bigtime_t* _taggedTime,
|
||||
uint32* _flags);
|
||||
virtual status_t SeekTagRequested(
|
||||
const media_destination& destination,
|
||||
bigtime_t targetTime, uint32 flags,
|
||||
media_seek_tag* _seekTag,
|
||||
bigtime_t* _taggedTime, uint32* _flags);
|
||||
|
||||
// BBufferProducer methods
|
||||
|
||||
virtual status_t FormatSuggestionRequested(media_type type,
|
||||
int32 quality, media_format* format);
|
||||
virtual status_t FormatSuggestionRequested(media_type type,
|
||||
int32 quality, media_format* format);
|
||||
|
||||
virtual status_t FormatProposal(const media_source& output,
|
||||
media_format* format);
|
||||
virtual status_t FormatProposal(const media_source& output,
|
||||
media_format* format);
|
||||
|
||||
virtual status_t FormatChangeRequested(const media_source& source,
|
||||
const media_destination& destination,
|
||||
media_format* io_format, int32* _deprecated);
|
||||
virtual status_t GetNextOutput(int32* cookie,
|
||||
media_output* out_output);
|
||||
virtual status_t DisposeOutputCookie(int32 cookie);
|
||||
virtual status_t FormatChangeRequested(
|
||||
const media_source& source,
|
||||
const media_destination& destination,
|
||||
media_format* ioFormat,
|
||||
int32* _deprecated);
|
||||
virtual status_t GetNextOutput(int32* cookie,
|
||||
media_output* _output);
|
||||
virtual status_t DisposeOutputCookie(int32 cookie);
|
||||
|
||||
virtual status_t SetBufferGroup(const media_source& for_source,
|
||||
BBufferGroup* group);
|
||||
virtual status_t SetBufferGroup(const media_source& forSource,
|
||||
BBufferGroup* group);
|
||||
|
||||
virtual status_t PrepareToConnect(const media_source& what,
|
||||
const media_destination& where,
|
||||
media_format* format, media_source* source,
|
||||
char* name);
|
||||
virtual status_t PrepareToConnect(const media_source& what,
|
||||
const media_destination& where,
|
||||
media_format* format, media_source* source,
|
||||
char* name);
|
||||
|
||||
virtual void Connect(status_t error, const media_source& source,
|
||||
const media_destination& destination,
|
||||
const media_format& format, char* name);
|
||||
virtual void Disconnect(const media_source& what,
|
||||
const media_destination& where);
|
||||
virtual void Connect(status_t error,
|
||||
const media_source& source,
|
||||
const media_destination& destination,
|
||||
const media_format& format, char* name);
|
||||
virtual void Disconnect(const media_source& what,
|
||||
const media_destination& where);
|
||||
|
||||
virtual void LateNoticeReceived(const media_source& what,
|
||||
bigtime_t howMuch, bigtime_t performanceTime);
|
||||
virtual void LateNoticeReceived(const media_source& what,
|
||||
bigtime_t howMuch,
|
||||
bigtime_t performanceTime);
|
||||
|
||||
virtual void EnableOutput(const media_source& what, bool enabled,
|
||||
int32* _deprecated);
|
||||
virtual void AdditionalBufferRequested(const media_source& source,
|
||||
media_buffer_id previousBuffer,
|
||||
bigtime_t previousTime,
|
||||
const media_seek_tag* previousTag);
|
||||
virtual void EnableOutput(const media_source& what,
|
||||
bool enabled, int32* _deprecated);
|
||||
virtual void AdditionalBufferRequested(
|
||||
const media_source& source,
|
||||
media_buffer_id previousBuffer,
|
||||
bigtime_t previousTime,
|
||||
const media_seek_tag* previousTag);
|
||||
|
||||
// BMediaEventLooper methods
|
||||
virtual void HandleEvent(const media_timed_event* event,
|
||||
bigtime_t lateness, bool realTimeEvent = false);
|
||||
virtual void HandleEvent(const media_timed_event* event,
|
||||
bigtime_t lateness,
|
||||
bool realTimeEvent = false);
|
||||
|
||||
// BTimeSource methods
|
||||
virtual void SetRunMode(run_mode mode);
|
||||
virtual status_t TimeSourceOp(const time_source_op_info& op,
|
||||
void *_reserved);
|
||||
virtual void SetRunMode(run_mode mode);
|
||||
virtual status_t TimeSourceOp(const time_source_op_info& op,
|
||||
void *_reserved);
|
||||
|
||||
// BControllable methods
|
||||
virtual status_t GetParameterValue(int32 id, bigtime_t* lastChange,
|
||||
void* value, size_t* size);
|
||||
virtual void SetParameterValue(int32 id, bigtime_t when,
|
||||
const void* value, size_t size);
|
||||
virtual BParameterWeb* MakeParameterWeb();
|
||||
virtual status_t GetParameterValue(int32 id,
|
||||
bigtime_t* lastChange, void* value,
|
||||
size_t* size);
|
||||
virtual void SetParameterValue(int32 id, bigtime_t when,
|
||||
const void* value, size_t size);
|
||||
virtual BParameterWeb* MakeParameterWeb();
|
||||
|
||||
private:
|
||||
// private unimplemented
|
||||
MultiAudioNode(const MultiAudioNode& clone);
|
||||
MultiAudioNode& operator=(const MultiAudioNode& clone);
|
||||
MultiAudioNode(const MultiAudioNode& clone);
|
||||
MultiAudioNode& operator=(const MultiAudioNode& clone);
|
||||
|
||||
status_t _HandleStart(const media_timed_event* event,
|
||||
bigtime_t lateness, bool realTimeEvent = false);
|
||||
status_t _HandleSeek(const media_timed_event* event,
|
||||
bigtime_t lateness, bool realTimeEvent = false);
|
||||
status_t _HandleWarp(const media_timed_event* event,
|
||||
bigtime_t lateness, bool realTimeEvent = false);
|
||||
status_t _HandleStop(const media_timed_event* event,
|
||||
bigtime_t lateness, bool realTimeEvent = false);
|
||||
status_t _HandleBuffer(const media_timed_event* event,
|
||||
bigtime_t lateness, bool realTimeEvent = false);
|
||||
status_t _HandleDataStatus(const media_timed_event* event,
|
||||
bigtime_t lateness, bool realTimeEvent = false);
|
||||
status_t _HandleParameter(const media_timed_event* event,
|
||||
bigtime_t lateness, bool realTimeEvent = false);
|
||||
status_t _HandleStart(const media_timed_event* event,
|
||||
bigtime_t lateness,
|
||||
bool realTimeEvent = false);
|
||||
status_t _HandleSeek(const media_timed_event* event,
|
||||
bigtime_t lateness,
|
||||
bool realTimeEvent = false);
|
||||
status_t _HandleWarp(const media_timed_event* event,
|
||||
bigtime_t lateness,
|
||||
bool realTimeEvent = false);
|
||||
status_t _HandleStop(const media_timed_event* event,
|
||||
bigtime_t lateness,
|
||||
bool realTimeEvent = false);
|
||||
status_t _HandleBuffer(const media_timed_event* event,
|
||||
bigtime_t lateness,
|
||||
bool realTimeEvent = false);
|
||||
status_t _HandleDataStatus(
|
||||
const media_timed_event* event,
|
||||
bigtime_t lateness,
|
||||
bool realTimeEvent = false);
|
||||
status_t _HandleParameter(const media_timed_event* event,
|
||||
bigtime_t lateness,
|
||||
bool realTimeEvent = false);
|
||||
|
||||
char* _PlaybackBuffer(int32 cycle, int32 channel)
|
||||
{ return fDevice->BufferList().playback_buffers
|
||||
[cycle][channel].base; }
|
||||
uint32 _PlaybackStride(int32 cycle, int32 channel)
|
||||
{ return fDevice->BufferList().playback_buffers
|
||||
[cycle][channel].stride; }
|
||||
char* _PlaybackBuffer(int32 cycle, int32 channel)
|
||||
{ return fDevice->BufferList()
|
||||
.playback_buffers
|
||||
[cycle][channel].base; }
|
||||
uint32 _PlaybackStride(int32 cycle, int32 channel)
|
||||
{ return fDevice->BufferList()
|
||||
.playback_buffers
|
||||
[cycle][channel].stride; }
|
||||
|
||||
char* _RecordBuffer(int32 cycle, int32 channel)
|
||||
{ return fDevice->BufferList().record_buffers
|
||||
[cycle][channel].base; }
|
||||
uint32 _RecordStride(int32 cycle, int32 channel)
|
||||
{ return fDevice->BufferList().record_buffers
|
||||
[cycle][channel].stride; }
|
||||
char* _RecordBuffer(int32 cycle, int32 channel)
|
||||
{ return fDevice->BufferList()
|
||||
.record_buffers
|
||||
[cycle][channel].base; }
|
||||
uint32 _RecordStride(int32 cycle, int32 channel)
|
||||
{ return fDevice->BufferList()
|
||||
.record_buffers
|
||||
[cycle][channel].stride; }
|
||||
|
||||
void _WriteZeros(node_input& input, uint32 bufferCycle);
|
||||
void _FillWithZeros(node_input& input);
|
||||
void _FillNextBuffer(node_input& channel,
|
||||
BBuffer* buffer);
|
||||
void _WriteZeros(node_input& input,
|
||||
uint32 bufferCycle);
|
||||
void _FillWithZeros(node_input& input);
|
||||
void _FillNextBuffer(node_input& channel,
|
||||
BBuffer* buffer);
|
||||
|
||||
static int32 _OutputThreadEntry(void* data);
|
||||
int32 _OutputThread();
|
||||
status_t _StartOutputThreadIfNeeded();
|
||||
status_t _StopOutputThread();
|
||||
static int32 _OutputThreadEntry(void* data);
|
||||
int32 _OutputThread();
|
||||
status_t _StartOutputThreadIfNeeded();
|
||||
status_t _StopOutputThread();
|
||||
|
||||
void _AllocateBuffers(node_output& channel);
|
||||
BBuffer* _FillNextBuffer(multi_buffer_info& info,
|
||||
node_output& output);
|
||||
void _UpdateTimeSource(multi_buffer_info& info,
|
||||
multi_buffer_info& oldInfo, node_input& input);
|
||||
void _AllocateBuffers(node_output& channel);
|
||||
BBuffer* _FillNextBuffer(multi_buffer_info& info,
|
||||
node_output& output);
|
||||
void _UpdateTimeSource(multi_buffer_info& info,
|
||||
multi_buffer_info& oldInfo,
|
||||
node_input& input);
|
||||
|
||||
node_output* _FindOutput(media_source source);
|
||||
node_input* _FindInput(media_destination destination);
|
||||
node_input* _FindInput(int32 destinationId);
|
||||
node_output* _FindOutput(media_source source);
|
||||
node_input* _FindInput(media_destination destination);
|
||||
node_input* _FindInput(int32 destinationId);
|
||||
|
||||
const char* _GetControlName(multi_mix_control& control);
|
||||
void _ProcessGroup(BParameterGroup* group, int32 index,
|
||||
int32& numParameters);
|
||||
void _ProcessMux(BDiscreteParameter* parameter,
|
||||
int32 index);
|
||||
void _CreateFrequencyParameterGroup(
|
||||
BParameterGroup* parentGroup, const char* name,
|
||||
int32 parameterID, uint32 rateMask);
|
||||
const char* _GetControlName(multi_mix_control& control);
|
||||
void _ProcessGroup(BParameterGroup* group,
|
||||
int32 index, int32& numParameters);
|
||||
void _ProcessMux(BDiscreteParameter* parameter,
|
||||
int32 index);
|
||||
void _CreateFrequencyParameterGroup(
|
||||
BParameterGroup* parentGroup,
|
||||
const char* name, int32 parameterID,
|
||||
uint32 rateMask);
|
||||
|
||||
status_t _SetNodeInputFrameRate(float frameRate);
|
||||
status_t _SetNodeOutputFrameRate(float frameRate);
|
||||
void _UpdateInternalLatency(const media_format& format);
|
||||
status_t _SetNodeInputFrameRate(float frameRate);
|
||||
status_t _SetNodeOutputFrameRate(float frameRate);
|
||||
void _UpdateInternalLatency(
|
||||
const media_format& format);
|
||||
|
||||
private:
|
||||
status_t fInitStatus;
|
||||
status_t fInitStatus;
|
||||
|
||||
BMediaAddOn* fAddOn;
|
||||
int32 fId;
|
||||
BMediaAddOn* fAddOn;
|
||||
int32 fId;
|
||||
|
||||
BLocker fBufferLock;
|
||||
BLocker fBufferLock;
|
||||
|
||||
BList fInputs;
|
||||
TimeComputer fTimeComputer;
|
||||
BList fInputs;
|
||||
TimeComputer fTimeComputer;
|
||||
|
||||
bigtime_t fLatency;
|
||||
BList fOutputs;
|
||||
media_format fOutputPreferredFormat;
|
||||
media_format fInputPreferredFormat;
|
||||
bigtime_t fLatency;
|
||||
BList fOutputs;
|
||||
media_format fOutputPreferredFormat;
|
||||
media_format fInputPreferredFormat;
|
||||
|
||||
bigtime_t fInternalLatency;
|
||||
// this is computed from the real (negotiated) chunk size and bit rate,
|
||||
// not the defaults that are in the parameters
|
||||
bigtime_t fBufferPeriod;
|
||||
bigtime_t fInternalLatency;
|
||||
// this is computed from the real (negotiated) chunk size and bit rate,
|
||||
// not the defaults that are in the parameters
|
||||
bigtime_t fBufferPeriod;
|
||||
|
||||
sem_id fBufferFreeSem;
|
||||
thread_id fThread;
|
||||
MultiAudioDevice* fDevice;
|
||||
bool fTimeSourceStarted;
|
||||
BParameterWeb* fWeb;
|
||||
BMessage fConfig;
|
||||
sem_id fBufferFreeSem;
|
||||
thread_id fThread;
|
||||
MultiAudioDevice* fDevice;
|
||||
bool fTimeSourceStarted;
|
||||
BParameterWeb* fWeb;
|
||||
BMessage fConfig;
|
||||
};
|
||||
|
||||
|
||||
#endif // MULTI_AUDIO_NODE_H
|
||||
|
||||
Reference in New Issue
Block a user