本文整理匯總了C++中CloseComponent函數的典型用法代碼示例。如果您正苦於以下問題:C++ CloseComponent函數的具體用法?C++ CloseComponent怎麽用?C++ CloseComponent使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了CloseComponent函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: QTDR_CloseDownHandlers
void QTDR_CloseDownHandlers (void)
{
if (gDataReader != NULL) {
DataHCloseForRead(gDataReader);
CloseComponent(gDataReader);
gDataReader = NULL;
}
if (gDataWriter != NULL) {
DataHCloseForWrite(gDataWriter);
CloseComponent(gDataWriter);
gDataWriter = NULL;
}
// dispose of the data buffer
if (gDataBuffer != NULL)
DisposePtr(gDataBuffer);
// dispose of the routine descriptors
if (gReadDataHCompletionUPP != NULL)
DisposeDataHCompletionUPP(gReadDataHCompletionUPP);
if (gWriteDataHCompletionUPP != NULL)
DisposeDataHCompletionUPP(gWriteDataHCompletionUPP);
gDoneTransferring = false;
#if TARGET_OS_WIN32
// kill the timer that tasks the data handlers
KillTimer(NULL, gTimerID);
#endif
}
示例2: OSSpinLockLock
CoreAudioOutput::~CoreAudioOutput()
{
OSSpinLockLock(_spinlockAU);
if(_au != NULL)
{
AudioOutputUnitStop(_au);
AudioUnitUninitialize(_au);
#if defined(MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
if (IsOSXVersionSupported(10, 6, 0))
{
AudioComponentInstanceDispose(_au);
}
else
{
CloseComponent(_au);
}
#else
CloseComponent(_au);
#endif
_au = NULL;
}
OSSpinLockUnlock(_spinlockAU);
delete _buffer;
_buffer = NULL;
free(_spinlockAU);
_spinlockAU = NULL;
}
示例3: openMovSettingsPopup
void openMovSettingsPopup(TPropertyGroup *props, bool macBringToFront) {
#ifdef _WIN32
if (InitializeQTML(0) != noErr) return;
#endif
ComponentInstance ci =
OpenDefaultComponent(StandardCompressionType, StandardCompressionSubType);
QTAtomContainer atoms;
QTNewAtomContainer(&atoms);
fromPropertiesToAtoms(*props, atoms);
ComponentResult err;
if ((err = SCSetSettingsFromAtomContainer(ci, atoms)) != noErr) {
CloseComponent(ci);
ci = OpenDefaultComponent(StandardCompressionType,
StandardCompressionSubType);
assert(false);
}
QTDisposeAtomContainer(atoms);
#ifdef MACOSX
// Install an external procedure to use a callback filter on the request
// settings dialog
// On MACOSX we need to change the dialog appearance in order to pop-up in front
// of the
// toonz main window.
/*
gProcStruct.filterProc = NewSCModalFilterUPP(QTCmpr_FilterProc);
// I don't install any hook
gProcStruct.hookProc = NULL;
gProcStruct.customName[0] = 0;
// I don't use refcon
gProcStruct.refcon = 0;
// set the current extended procs
SCSetInfo(ci, scExtendedProcsType, &gProcStruct);
*/
#endif
err = SCRequestSequenceSettings(ci);
// assert(err==noErr);
QTAtomContainer atomsOut;
if (SCGetSettingsAsAtomContainer(ci, &atomsOut) != noErr) assert(false);
fromAtomsToProperties(atomsOut, *props);
QTDisposeAtomContainer(atomsOut);
CloseComponent(ci);
// int dataSize=0, numChildren = 0, numLevels=0;
// retrieveData(settings, kParentAtomIsContainer, dataSize, numChildren,
// numLevels);
}
示例4: osx_output_enable
static bool
osx_output_enable(struct audio_output *ao, GError **error_r)
{
struct osx_output *oo = (struct osx_output *)ao;
ComponentDescription desc;
desc.componentType = kAudioUnitType_Output;
desc.componentSubType = oo->component_subtype;
desc.componentManufacturer = kAudioUnitManufacturer_Apple;
desc.componentFlags = 0;
desc.componentFlagsMask = 0;
Component comp = FindNextComponent(NULL, &desc);
if (comp == 0) {
g_set_error(error_r, osx_output_quark(), 0,
"Error finding OS X component");
return false;
}
OSStatus status = OpenAComponent(comp, &oo->au);
if (status != noErr) {
g_set_error(error_r, osx_output_quark(), status,
"Unable to open OS X component: %s",
GetMacOSStatusCommentString(status));
return false;
}
if (!osx_output_set_device(oo, error_r)) {
CloseComponent(oo->au);
return false;
}
AURenderCallbackStruct callback;
callback.inputProc = osx_render;
callback.inputProcRefCon = oo;
ComponentResult result =
AudioUnitSetProperty(oo->au,
kAudioUnitProperty_SetRenderCallback,
kAudioUnitScope_Input, 0,
&callback, sizeof(callback));
if (result != noErr) {
CloseComponent(oo->au);
g_set_error(error_r, osx_output_quark(), result,
"unable to set callback for OS X audio unit");
return false;
}
return true;
}
示例5: close_coreaudio
static int close_coreaudio(audio_output_t *ao)
{
mpg123_coreaudio_t* ca = (mpg123_coreaudio_t*)ao->userptr;
if (ca) {
ca->decode_done = 1;
while(!ca->play_done && ca->play) usleep(10000);
/* No matter the error code, we want to close it (by brute force if necessary) */
AudioConverterDispose(ca->converter);
AudioOutputUnitStop(ca->outputUnit);
AudioUnitUninitialize(ca->outputUnit);
CloseComponent(ca->outputUnit);
/* Free the ring buffer */
sfifo_close( &ca->fifo );
/* Free the conversion buffer */
if (ca->buffer) {
free( ca->buffer );
ca->buffer = NULL;
}
}
return 0;
}
示例6: CoreAudioDrv_PCM_Shutdown
void CoreAudioDrv_PCM_Shutdown(void)
{
OSStatus result;
struct AudioUnitInputCallback callback;
if (!Initialised) {
return;
}
// stop processing the audio unit
CoreAudioDrv_PCM_StopPlayback();
// Remove the input callback
callback.inputProc = 0;
callback.inputProcRefCon = 0;
result = AudioUnitSetProperty(output_audio_unit,
kAudioUnitProperty_SetInputCallback,
kAudioUnitScope_Input,
0,
&callback,
sizeof(callback));
result = CloseComponent(output_audio_unit);
pthread_mutex_destroy(&mutex);
Initialised = 0;
}
示例7: HGetVol
//------------------------------------------------------------------------
bool pixel_map::save_as_qt(const char *filename) const
{
FSSpec fss;
OSErr err;
// get file specification to application directory
err = HGetVol(nil, &fss.vRefNum, &fss.parID);
if (err == noErr)
{
GraphicsExportComponent ge;
CopyCStringToPascal(filename, fss.name);
// I decided to use PNG as output image file type.
// There are a number of other available formats.
// Should I check the file suffix to choose the image file format?
err = OpenADefaultComponent(GraphicsExporterComponentType, kQTFileTypePNG, &ge);
if (err == noErr)
{
err = GraphicsExportSetInputGWorld(ge, m_pmap);
if (err == noErr)
{
err = GraphicsExportSetOutputFile (ge, &fss);
if (err == noErr)
{
GraphicsExportDoExport(ge, nil);
}
}
CloseComponent(ge);
}
}
return err == noErr;
}
示例8: OsxAudioUnitsOutput_Destroy
/*----------------------------------------------------------------------
| OsxAudioUnitsOutput_Destroy
+---------------------------------------------------------------------*/
static BLT_Result
OsxAudioUnitsOutput_Destroy(OsxAudioUnitsOutput* self)
{
/* drain the queue */
OsxAudioUnitsOutput_Drain(&ATX_BASE(self, BLT_OutputNode));
/* stop the audio pump */
OsxAudioUnitsOutput_Stop(&ATX_BASE_EX(self, BLT_BaseMediaNode, BLT_MediaNode));
/* close the audio unit */
if (self->audio_unit) {
ComponentResult result;
result = CloseComponent(self->audio_unit);
if (result != noErr) {
ATX_LOG_WARNING_1("CloseComponent failed (%d)", (int)result);
}
}
/* destroy the queue */
ATX_List_Destroy(self->packet_queue);
/* destroy the lock */
pthread_mutex_destroy(&self->lock);
/* destruct the inherited object */
BLT_BaseMediaNode_Destruct(&ATX_BASE(self, BLT_BaseMediaNode));
/* free the object memory */
ATX_FreeMemory(self);
return BLT_SUCCESS;
}
示例9: DirectAudioCodecClose
SMACsdec::~SMACsdec()
{
if(mDecoder != NULL)
{
#if USE_DIRECT_ADEC
DirectAudioCodecClose(mDecoder);
#else
CloseComponent(mDecoder);
#endif
}
delete[] mOutputBuffer;
delete[] mFloatBuffer;
#if TARGET_API_MAC_OSX
delete mThreadStateMutex;
mThreadStateMutex = NULL;
#endif
#if CaptureDataToFile
if(mOutputFileRefNum != -1)
{
FSCloseFork(mOutputFileRefNum);
}
#endif
}
示例10: qt_mac_createCGImageFromQImage
QList<QByteArray> QMacPasteboardMimePict::convertFromMime(const QString &mime, QVariant variant,
QString flav)
{
QList<QByteArray> ret;
if (!resolveMimeQuickTimeSymbols())
return ret;
if (!canConvert(mime, flav))
return ret;
QCFType<CGImageRef> cgimage = qt_mac_createCGImageFromQImage(qvariant_cast<QImage>(variant));
Handle pic = NewHandle(0);
GraphicsExportComponent graphicsExporter;
ComponentResult result = OpenADefaultComponent(GraphicsExporterComponentType,
kQTFileTypePicture, &graphicsExporter);
if (!result) {
unsigned long sizeWritten;
result = ptrGraphicsExportSetInputCGImage(graphicsExporter, cgimage);
if (!result)
result = ptrGraphicsExportSetOutputHandle(graphicsExporter, pic);
if (!result)
result = ptrGraphicsExportDoExport(graphicsExporter, &sizeWritten);
CloseComponent(graphicsExporter);
}
int size = GetHandleSize((Handle)pic);
// Skip the Picture File header (512 bytes) and feed the raw data
QByteArray ar(reinterpret_cast<char *>(*pic + 512), size - 512);
ret.append(ar);
DisposeHandle(pic);
return ret;
}
示例11: coreaudio_free
static void coreaudio_free(void *data)
{
coreaudio_t *dev = (coreaudio_t*)data;
if (!dev)
return;
if (dev->dev_alive)
{
AudioOutputUnitStop(dev->dev);
#ifdef OSX_PPC
CloseComponent(dev->dev);
#else
AudioComponentInstanceDispose(dev->dev);
#endif
}
if (dev->buffer)
fifo_free(dev->buffer);
slock_free(dev->lock);
scond_free(dev->cond);
free(dev);
}
示例12: coreaudio_free
static void coreaudio_free(void *data)
{
coreaudio_t *dev = (coreaudio_t*)data;
if (!dev)
return;
if (dev->dev_alive)
{
AudioOutputUnitStop(dev->dev);
#if (defined(__MACH__) && (defined(__ppc__) || defined(__ppc64__)))
CloseComponent(dev->dev);
#else
AudioComponentInstanceDispose(dev->dev);
#endif
}
if (dev->buffer)
fifo_free(dev->buffer);
slock_free(dev->lock);
scond_free(dev->cond);
free(dev);
}
示例13: osx_output_disable
static void
osx_output_disable(struct audio_output *ao)
{
struct osx_output *oo = (struct osx_output *)ao;
CloseComponent(oo->au);
}
示例14: qWarning
QVariant QMacPasteboardMimePict::convertToMime(const QString &mime, QList<QByteArray> data, QString flav)
{
if(data.count() > 1)
qWarning("QMacPasteboardMimePict: Cannot handle multiple member data");
QVariant ret;
if (!resolveMimeQuickTimeSymbols())
return ret;
if(!canConvert(mime, flav))
return ret;
const QByteArray &a = data.first();
// This function expects the 512 header (just to skip it, so create the extra space for it).
Handle pic = NewHandle(a.size() + 512);
memcpy(*pic + 512, a.constData(), a.size());
GraphicsImportComponent graphicsImporter;
ComponentResult result = OpenADefaultComponent(GraphicsImporterComponentType,
kQTFileTypePicture, &graphicsImporter);
QCFType<CGImageRef> cgImage;
if (!result)
result = ptrGraphicsImportSetDataHandle(graphicsImporter, pic);
if (!result)
result = ptrGraphicsImportCreateCGImage(graphicsImporter, &cgImage,
kGraphicsImportCreateCGImageUsingCurrentSettings);
if (!result)
ret = QVariant(QPixmap::fromMacCGImageRef(cgImage).toImage());
CloseComponent(graphicsImporter);
DisposeHandle(pic);
return ret;
}
示例15: verify_noerr
void AUEditWindow::CloseView ()
{
if (mEditView) {
verify_noerr(CloseComponent(mEditView));
mEditView = 0;
}
}