本文整理汇总了C++中BMediaRoster::Disconnect方法的典型用法代码示例。如果您正苦于以下问题:C++ BMediaRoster::Disconnect方法的具体用法?C++ BMediaRoster::Disconnect怎么用?C++ BMediaRoster::Disconnect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BMediaRoster
的用法示例。
在下文中一共展示了BMediaRoster::Disconnect方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: fprintf
NodeHarnessWin::~NodeHarnessWin()
{
BMediaRoster* r = BMediaRoster::Roster();
// tear down the node network
if (mIsRunning) StopNodes();
if (mIsConnected)
{
status_t err;
// Ordinarily we'd stop *all* of the nodes in the chain at this point. However,
// one of the nodes is the System Mixer, and stopping the Mixer is a Bad Idea (tm).
// So, we just disconnect from it, and release our references to the nodes that
// we're using. We *are* supposed to do that even for global nodes like the Mixer.
err = r->Disconnect(mConnection.producer.node, mConnection.source,
mConnection.consumer.node, mConnection.destination);
if (err)
{
fprintf(stderr, "* Error disconnecting nodes: %ld (%s)\n", err, strerror(err));
}
r->ReleaseNode(mConnection.producer);
r->ReleaseNode(mConnection.consumer);
}
}
示例2:
NodeHarnessWin::~NodeHarnessWin()
{
BMediaRoster* r = BMediaRoster::Roster();
// tear down the node network
if (mIsRunning) StopNodes();
if (mIsConnected)
{
printf("Total late buffers: %ld\n", mLogNode->LateBuffers());
r->StopNode(mConnection.consumer, 0, true);
r->Disconnect(mConnection.producer.node, mConnection.source,
mConnection.consumer.node, mConnection.destination);
r->ReleaseNode(mConnection.producer);
r->ReleaseNode(mConnection.consumer);
}
}
示例3:
// Play must stop before the distructor is called; otherwise, a fatel
// error occures if the playback is in a subclass.
GameSoundBuffer::~GameSoundBuffer()
{
BMediaRoster* roster = BMediaRoster::Roster();
if (fIsConnected) {
// Ordinarily we'd stop *all* of the nodes in the chain at this point. However,
// one of the nodes is the System Mixer, and stopping the Mixer is a Bad Idea (tm).
// So, we just disconnect from it, and release our references to the nodes that
// we're using. We *are* supposed to do that even for global nodes like the Mixer.
roster->Disconnect(fConnection->producer.node, fConnection->source,
fConnection->consumer.node, fConnection->destination);
roster->ReleaseNode(fConnection->producer);
roster->ReleaseNode(fConnection->consumer);
}
delete fGainRamp;
delete fPanRamp;
delete fConnection;
delete fNode;
}
示例4: SetRef
// -------------------------------------------------------- //
// implementation of BFileInterface
// -------------------------------------------------------- //
status_t MediaReader::SetRef(
const entry_ref & file,
bool create,
bigtime_t * out_time)
{
CALLED();
status_t status = AbstractFileInterfaceNode::SetRef(file,B_READ_ONLY,create,out_time);
if (status != B_OK) {
PRINT("AbstractFileInterfaceNode::SetRef returned an error\n");
return status;
}
if (output.destination == media_destination::null) {
// reset the format, and set the requirements imposed by this file
GetFormat(&output.format);
AddRequirements(&output.format);
return B_OK;
}
// if we are connected we may have to re-negotiate the connection
media_format format;
GetFormat(&format);
AddRequirements(&format);
if (format_is_acceptible(format,output.format)) {
fprintf(stderr," compatible format = no re-negotiation necessary\n");
return B_OK;
}
// first try the easy way : SORRY DEPRECATED into private :-(
// this code from MediaWriter would be different for MediaReader even if it worked...
// int32 change_tag = NewChangeTag();
// status = this->BBufferConsumer::RequestFormatChange(output.source,output.destination,&format,&change_tag);
// if (status == B_OK) {
// fprintf(stderr," format change successful\n");
// return B_OK;
// }
// okay, the hard way requires we get the MediaRoster
BMediaRoster * roster = BMediaRoster::Roster(&status);
if (roster == 0)
return B_MEDIA_SYSTEM_FAILURE;
if (status != B_OK)
return status;
// before disconnect one should always stop the nodes (bebook says)
// requires run_state cast since the return type on RunState() is
// wrong [int32]
run_state destinationRunState = run_state(RunState());
if (destinationRunState == BMediaEventLooper::B_STARTED)
Stop(0,true); // stop us right now
// should also stop the destination if it is running, but how?
/* BMediaNode destinationNode = ??
run_state destinationRunState = destinationNode->??;
status = destinationNode->StopNode(??,0,true);
if (status != B_OK) {
return status;
} */
// we should disconnect right now
media_destination outputDestination = output.destination;
status = roster->Disconnect(output.source.id,output.source,
output.destination.id,output.destination);
if (status != B_OK)
return status;
// if that went okay, we'll try reconnecting
media_output connectOutput;
media_input connectInput;
status = roster->Connect(output.source,outputDestination,
&format,&connectOutput,&connectInput);
if (status != B_OK)
return status;
// now restart if necessary
if (destinationRunState == BMediaEventLooper::B_STARTED) {
Start(0);
}
return status;
}