Пример #1
0
ComponentResult XMRTPH264Packetizer_Open(XMRTPH264PacketizerGlobals globals, ComponentInstance self)
{
  ComponentResult err = noErr;
	
  globals = calloc(sizeof(XMRTPH264PacketizerGlobalsRecord), 1);
  if (!globals) {
    err = memFullErr;
    goto bail;
  }
	
  SetComponentInstanceStorage(self, (Handle)globals);
	
  globals->self = self;
  globals->target = self;
  globals->timeBase = 0;
  globals->timeScale = 0;
  globals->maxPacketSize_Soft = 1438;
  globals->maxPacketSize_Hard = 2500;
  globals->useNonInterleavedMode = false;
  globals->spsAtomData = NULL;
  globals->spsAtomLength = 0;
  globals->ppsAtomData = NULL;
  globals->ppsAtomLength = 0;
	
bail:
  return err;
}
static pascal ComponentResult __SoundComponentOpen(void* inUnused, ComponentInstance inSelf)
{
	ComponentResult theAnswer = 0;
	
	try
	{
		//	create the globals
		SMACIMAscomGlobals* theGlobals = new SMACIMAscomGlobals();
		
		//	creat the SMACIMAscom object
		theGlobals->mThis = new SMACIMAscom(inSelf);
		
		//	tell the Component Manager about our globals
		SetComponentInstanceStorage(inSelf, (Handle)theGlobals);
	}
	catch(UInt32 theError)
	{
		theAnswer = theError;
	}
	catch(...)
	{
		theAnswer = -50;
	}
	
	return theAnswer;
}
Пример #3
0
static ComponentResult volume_catcher_component_open(VolumeCatcherStorage *storage, ComponentInstance self)
{
	ComponentResult result = noErr;
	VolumeCatcherImpl *impl = VolumeCatcherImpl::getInstance();	
	
	storage = new VolumeCatcherStorage;

	storage->self = self;
	storage->delegate = NULL;

	result = OpenAComponent(impl->mOriginalDefaultOutput, &(storage->delegate));
	
	if(result != noErr)
	{
//		std::cerr << "OpenAComponent result = " << result << ", component ref = " << storage->delegate << std::endl;
		
		// If we failed to open the delagate component, our open is going to fail.  Clean things up.
		delete storage;
	}
	else
	{
		// Success -- set up this component's storage
		SetComponentInstanceStorage(self, (Handle)storage);

		// add this instance to the global list
		impl->mComponentInstances.push_back(storage);	
		
		// and set up the initial volume
		impl->setInstanceVolume(storage);
	}

	return result;
}
Пример #4
0
static pascal ComponentResult myComponentOpen(ComponentInstance ci, ComponentInstance self)
{
    DHData myData;
    Handle storage;

    ZeroMemory(&myData,sizeof(DHData));
    PtrToHand( &myData, &storage, sizeof(DHData));
    SetComponentInstanceStorage(self,storage);

    return noErr;
}
Пример #5
0
static pascal ComponentResult myComponentClose(ComponentInstance ci, ComponentInstance self)
{
    Handle storage = GetComponentInstanceStorage(self);
    DHData *data;
    if (storage)
    {
        data = (DHData*)*storage;
        if (data && data->dataRef.pReader != NULL)
            IAsyncReader_Release(data->dataRef.pReader);
        DisposeHandle(storage);
        SetComponentInstanceStorage(self,NULL);
    }
    return noErr;
}
// Open a new instance of the component.
// Allocate component instance storage ("globals") and associate it with the new instance so that other
// calls will receive it.
// Note that "one-shot" component calls like CallComponentVersion and ImageCodecGetCodecInfo work by opening
// an instance, making that call and then closing the instance, so you should avoid performing very expensive
// initialization operations in a component's Open function.
ComponentResult
VP8_Encoder_Open(
                 VP8EncoderGlobals glob,
                 ComponentInstance self)
{
  ComponentResult err = noErr;
  dbg_printf("[vp8e - %08lx] Open Called\n", (UInt32)glob);

  TouchActivityFile();

  glob = calloc(sizeof(VP8EncoderGlobalsRecord), 1);

  if (! glob)
  {
    err = memFullErr;
    goto bail;
  }

  SetComponentInstanceStorage(self, (Handle)glob);

  glob->self = self;
  glob->target = self;

  glob->nextDecodeNumber = 1;
  glob->frameCount = 0;
  glob->raw = NULL;
  glob->codec = NULL;
  glob->stats.sz =0;
  glob->stats.buf = NULL;
  //default to one pass
  glob->currentPass = VPX_RC_ONE_PASS;
  glob->sourceQueue.size = 0;
  glob->sourceQueue.max = 0;
  glob->sourceQueue.queue = NULL;
  glob->sourceQueue.frames_in =0;
  glob->sourceQueue.frames_out =0;
  glob->altRefFrame.buf =0;
  glob->altRefFrame.size =0;

  int i;
  for (i=0;i<TOTAL_CUSTOM_VP8_SETTINGS; i++)
  {
    glob->settings[i]= UINT_MAX;
  }

bail:
  dbg_printf("[vp8e - %08lx] Open Called exit %d \n", (UInt32)glob, err);
  return err;
}
Пример #7
0
static PyObject *CmpInstObj_SetComponentInstanceStorage(ComponentInstanceObject *_self, PyObject *_args)
{
	PyObject *_res = NULL;
	Handle theStorage;
#ifndef SetComponentInstanceStorage
	PyMac_PRECHECK(SetComponentInstanceStorage);
#endif
	if (!PyArg_ParseTuple(_args, "O&",
	                      ResObj_Convert, &theStorage))
		return NULL;
	SetComponentInstanceStorage(_self->ob_itself,
	                            theStorage);
	Py_INCREF(Py_None);
	_res = Py_None;
	return _res;
}
Пример #8
0
ComponentResult FFAvi_MovieImportOpen(ff_global_ptr storage, ComponentInstance self)
{
	ComponentResult result = noErr;
    ComponentDescription descout;
	
    GetComponentInfo((Component)self, &descout, 0, 0, 0);
	
	storage = malloc(sizeof(ff_global_context));
	if(!storage) goto bail;
	
	memset(storage, 0, sizeof(ff_global_context));
	storage->ci = self;
	
	SetComponentInstanceStorage(storage->ci, (Handle)storage);
	
	storage->componentType = descout.componentSubType;
	storage->movieLoadState = kMovieLoadStateLoading;
bail:
		return result;
} /* FFAvi_MovieImportOpen() */
RTPMPComponentVideo_Open(
	RTPMPComponentVideoInstanceData **	inGlobals,
	ComponentInstance					self )
{
	ComponentResult		theResult = noErr;
	RTPMediaPacketizer	theBase;
	
	
	inGlobals =
		REINTERPRET_CAST( RTPMPComponentVideoInstanceData ** )(
			NewHandleClear( sizeof( **inGlobals ) ) );
	
	if( inGlobals )
	{
		( **inGlobals ).itself = self;
		( **inGlobals ).itsFinalDerivation = self;
		( **inGlobals ).itsInitialized = false;
		
		SetComponentInstanceStorage( self, REINTERPRET_CAST( Handle )( inGlobals ) );
		
		theResult =
			OpenADefaultComponent(
				kRTPMediaPacketizerType, kRTPBaseMediaPacketizerType, &theBase );
		
		if( theResult == noErr )
		{
			( **inGlobals ).itsBase = theBase;
			theResult = CallComponentTarget( ( **inGlobals ).itsBase, self );
		}
	}
	
	else
	{
		theResult = MemError();
		
		if( theResult == noErr )
			theResult = memFullErr;
	}
	
	return( theResult );
}
Пример #10
0
pascal ComponentResult BIMOpenComponent( ComponentInstance inComponentInstance )
{
    ComponentResult result;
    Handle sessionHandle;

    result = noErr;
    sessionHandle = nil;

    //  If this is the first instance of our component, initalize our global state. Normally,
    //  this means that we load our text service menu, install event handlers for the menu,
    //  and initialize any global variables that persist across sessions.

    if( gInstanceRefCount == 0 )
        result = BIMInitialize( inComponentInstance, &gTextServiceMenu );
    gInstanceRefCount++;

    //	Now initialize a new session context. We store our per-session data in a session
    //	handle that is stored with the component instance.

    if( result == noErr ) {

        //  Get our component instance storage.

        sessionHandle = GetComponentInstanceStorage( inComponentInstance );

        //  Initialize the new session.

        result = BIMSessionOpen( inComponentInstance, (BIMSessionHandle *) &sessionHandle );

        //  Save the returned handle as our component instance storage.

        if( result == noErr )
            SetComponentInstanceStorage( inComponentInstance, sessionHandle );
    }

    return result;
}