MovieExportComponent codecname
Subject : MovieExportComponent codecname
From: nick briggs <email@hidden >
Date: Tue, 26 Sep 2006 15:00:12 +0100
Delivered-to: email@hidden
Delivered-to: email@hidden
Hi
Our aim is to read a MovieExportComponent's codecName, we've tried a
couple of approaches listed below, which are clearly flawed, as
neither work.
How best to go about this?
In this case we are reading settings from an archived
QTAtomContainer, but we get the same problem if going via
MovieExportDoUserDialog
Here's one approach, SCGetInfo returns badComponentSelector.
-----------------------------------------
OSErr err = noErr;
QTAtomContainer settings;
ComponentDescription compDesc;
Component movieExporterComponent = 0;
MovieExportComponent exporter = NULL;
SCSpatialSettings ss;
compDesc.componentType = MovieExportType;
compDesc.componentSubType = kQTFileTypeMovie;
compDesc.componentManufacturer = kAppleManufacturer;
compDesc.componentFlags = 0;
compDesc.componentFlagsMask = cmpIsMissing;
movieExporterComponent = FindNextComponent(NULL, &compDesc);
if (movieExporterComponent == NULL){
return;
}
err = OpenAComponent(movieExporterComponent, &exporter);
if (err){
goto bail;
}
NSData *data = [[NSKeyedUnarchiver unarchiveObjectWithFile:path]
retain];
if(data) {
settings = NewHandle([data length]);
if(settings) {
[data getBytes:*settings];
}else{
goto bail;
}
}
err = MovieExportSetSettingsFromAtomContainer(exporter, settings);
if (err){
goto bail;
}
err = SCGetInfo(exporter, scSpatialSettingsType, &ss);
if (err){
NSLog(@"SCGetInfo:%d",err); //badComponentSelector
goto bail;
}
-----------------------------------------
Another approach, this time we get noCodecErr
-----------------------------------------
OSErr err = noErr;
QTAtomContainer settings;
QTAtom videAtom = 0;
QTAtom nameAtom = 0;
CodecInfo ci;
SCSpatialSettings ss;
NSData *data = [NSKeyedUnarchiver unarchiveObjectWithFile:path];
if(data) {
settings = NewHandle([data length]);
if(settings) {
[data getBytes:*settings];
}else{
goto bail;
}
}
videAtom = QTFindChildByID(settings, kParentAtomIsContainer,
kQTSettingsVideo, 1, NULL);
if (!videAtom) {
goto bail;
}
nameAtom = QTFindChildByID(settings, videAtom,
scSpatialSettingsType, 1, NULL); // scCodecManufacturerType
if (!nameAtom) {
goto bail;
}
long dataSize, *dataPtr;
err = QTGetAtomDataPtr(settings, nameAtom, &dataSize, (Ptr*)&dataPtr);
if (err != noErr) {
goto bail;
}
memcpy(&ss, &dataPtr, dataSize);
err = GetCodecInfo(&ci, ss.codecType,ss.codec);
if (err != noErr) {
NSLog(@"err:%d", err); //noCodecError
goto bail;
}
-----------------------------------------
Cheers
Nick
_______________________________________________
Do not post admin requests to the list. They will be ignored.
QuickTime-API mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quicktime-api/email@hidden
This email sent to email@hidden
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE
Contact Apple | Terms of Use | Privacy Policy
Copyright © 2007 Apple Inc. All rights reserved.