Пример #1
0
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);
}
Пример #2
0
static OSErr QT_SaveCodecSettingsToScene(RenderData *rd, ReportList *reports)
{	
	QTAtomContainer  myContainer = NULL;
	ComponentResult  myErr = noErr;
	Ptr              myPtr;
	long             mySize = 0;

	CodecInfo        ci;

	QuicktimeCodecData *qcd = rd->qtcodecdata;
	
	/* check if current scene already has qtcodec settings, and clear them */
	if (qcd) {
		free_qtcodecdata(qcd);
	}
	else {
		qcd = rd->qtcodecdata = MEM_callocN(sizeof(QuicktimeCodecData), "QuicktimeCodecData");
	}

	/* obtain all current codec settings */
	SCSetInfo(qtdata->theComponent, scTemporalSettingsType, &qtdata->gTemporalSettings);
	SCSetInfo(qtdata->theComponent, scSpatialSettingsType,  &qtdata->gSpatialSettings);
	SCSetInfo(qtdata->theComponent, scDataRateSettingsType, &qtdata->aDataRateSetting);

	/* retreive codecdata from quicktime in a atomcontainer */
	myErr = SCGetSettingsAsAtomContainer(qtdata->theComponent,  &myContainer);
	if (myErr != noErr) {
		BKE_report(reports, RPT_ERROR, "Quicktime: SCGetSettingsAsAtomContainer failed");
		goto bail;
	}

	/* get the size of the atomcontainer */
	mySize = GetHandleSize((Handle)myContainer);

	/* lock and convert the atomcontainer to a *valid* pointer */
	QTLockContainer(myContainer);
	myPtr = *(Handle)myContainer;

	/* copy the Quicktime data into the blender qtcodecdata struct */
	if (myPtr) {
		qcd->cdParms = MEM_mallocN(mySize, "qt.cdParms");
		memcpy(qcd->cdParms, myPtr, mySize);
		qcd->cdSize = mySize;

		GetCodecInfo(&ci, qtdata->gSpatialSettings.codecType, 0);
	}
	else {
		BKE_report(reports, RPT_ERROR, "Quicktime: QT_SaveCodecSettingsToScene failed"); 
	}

	QTUnlockContainer(myContainer);

bail:
	if (myContainer != NULL)
		QTDisposeAtomContainer(myContainer);
		
	return((OSErr)myErr);
}