Example #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);
}
Example #2
0
static OSErr QT_GetCodecSettingsFromScene(RenderData *rd, ReportList *reports)
{	
	Handle           myHandle = NULL;
	ComponentResult  myErr = noErr;

	QuicktimeCodecData *qcd = rd->qtcodecdata;

	/* if there is codecdata in the blendfile, convert it to a Quicktime handle */
	if (qcd) {
		myHandle = NewHandle(qcd->cdSize);
		PtrToHand(qcd->cdParms, &myHandle, qcd->cdSize);
	}
		
	/* restore codecsettings to the quicktime component */
	if (qcd->cdParms && qcd->cdSize) {
		myErr = SCSetSettingsFromAtomContainer((GraphicsExportComponent)qtdata->theComponent, (QTAtomContainer)myHandle);
		if (myErr != noErr) {
			BKE_report(reports, RPT_ERROR, "Quicktime: SCSetSettingsFromAtomContainer failed");
			goto bail;
		}

		/* update runtime codecsettings for use with the codec dialog */
		SCGetInfo(qtdata->theComponent, scDataRateSettingsType, &qtdata->aDataRateSetting);
		SCGetInfo(qtdata->theComponent, scSpatialSettingsType,  &qtdata->gSpatialSettings);
		SCGetInfo(qtdata->theComponent, scTemporalSettingsType, &qtdata->gTemporalSettings);


		/* Fill the render QuicktimeCodecSettigns struct */
		rd->qtcodecsettings.codecTemporalQuality = (qtdata->gTemporalSettings.temporalQuality * 100) / codecLosslessQuality;
		/* Do not override scene frame rate (qtdata->gTemporalSettings.framerate) */
		rd->qtcodecsettings.keyFrameRate = qtdata->gTemporalSettings.keyFrameRate;
		
		rd->qtcodecsettings.codecType = qtdata->gSpatialSettings.codecType;
		rd->qtcodecsettings.codec = (int)qtdata->gSpatialSettings.codec;
		rd->qtcodecsettings.colorDepth = qtdata->gSpatialSettings.depth;
		rd->qtcodecsettings.codecSpatialQuality = (qtdata->gSpatialSettings.spatialQuality * 100) / codecLosslessQuality;
		
		rd->qtcodecsettings.bitRate = qtdata->aDataRateSetting.dataRate;
		rd->qtcodecsettings.minSpatialQuality = (qtdata->aDataRateSetting.minSpatialQuality * 100) / codecLosslessQuality;
		rd->qtcodecsettings.minTemporalQuality = (qtdata->aDataRateSetting.minTemporalQuality * 100) / codecLosslessQuality;
		/* Frame duration is already known (qtdata->aDataRateSetting.frameDuration) */
		
	}
	else {
		BKE_report(reports, RPT_ERROR, "Quicktime: QT_GetCodecSettingsFromScene failed");
	}
bail:
	if (myHandle != NULL)
		DisposeHandle(myHandle);
		
	return((OSErr)myErr);
}
ComponentResult initVorbisComponent(WebMExportGlobalsPtr globals, GenericStreamPtr as)
{
    dbg_printf("[WebM] enter initVorbisComponent\n");
    ComponentResult err = noErr;
    if (globals->audioSettingsAtom == NULL)
        getDefaultVorbisAtom(globals);

    //This chunk initializes the Component instance that will be used for decompression  : TODO put this in its own function
    err = OpenADefaultComponent(StandardCompressionType, StandardCompressionSubTypeAudio, &as->aud.vorbisComponentInstance);

    if (err) goto bail;

    AudioStreamBasicDescription *inFormat = NULL;
    inFormat = calloc(1, sizeof(AudioStreamBasicDescription));

    if (inFormat == NULL) goto bail;

    err = getInputBasicDescription(as, inFormat);

    if (err) goto bail;

    getInputBasicDescription(as, inFormat);


    err = SCSetSettingsFromAtomContainer(as->aud.vorbisComponentInstance, globals->audioSettingsAtom);

    if (err) goto bail;

    err = QTGetComponentProperty(as->aud.vorbisComponentInstance, kQTPropertyClass_SCAudio,
                                 kQTSCAudioPropertyID_BasicDescription,
                                 sizeof(AudioStreamBasicDescription), &as->aud.asbd, NULL);

    if (err) goto bail;

    err = QTSetComponentProperty(as->aud.vorbisComponentInstance,  kQTPropertyClass_SCAudio, kQTSCAudioPropertyID_InputBasicDescription,
                                 sizeof(AudioStreamBasicDescription), inFormat);
bail:

    if (inFormat != NULL)
        free(inFormat);

    dbg_printf("[WebM]initVorbisComponent return %d\n", err);
    return err;
}