RE: MovieExportComponent codecname
Subject : RE: MovieExportComponent codecname
From: nick briggs <email@hidden >
Date: Wed, 27 Sep 2006 11:17:43 +0100
Delivered-to: email@hidden
Delivered-to: email@hidden
replacing QTGetAtomDataPtr with QTCopyDataToPtr did the trick.
Thanks
Nick
Begin forwarded message:
From: nick briggs <email@hidden>
Date: 26 September 2006 20:31:03 BDT
To: email@hidden
Subject: Re: MovieExportComponent codecname
Thanks
don't you want GetComponentInfo()?
GetCodecInfo(), as listed below, returns the strings "QuickTimeMove"
and "Exports a Quicktime Movie File into a Quicktime movie" for
Component name and component info respectively. What we need is the
codec that the exporter uses, such as DV PAL, MPEG 4 etc.
ComponentDescription cd;
Handle cn = NewHandle(0);
Handle ci = NewHandle(0);
err = GetComponentInfo(movieExporterComponent,
&cd,
cn,
ci,
nil);
if(err){
NSLog(@"GetComponentInfo err:%d", err);
goto bail;
}
CopyPascalStringToC((const unsigned char*)*cn, (char*)*cn);
NSLog(@"%@", [NSString stringWithCString:*cn]);
CopyPascalStringToC((const unsigned char*)*ci, (char*)*ci);
NSLog(@"%@", [NSString stringWithCString:*ci]);
Nick
On 26 Sep 2006, at 20:04, email@hidden wrote:
Message: 4
Date: Tue, 26 Sep 2006 15:00:12 +0100
From: nick briggs <email@hidden>
Subject: MovieExportComponent codecname
To: email@hidden
Message-ID: <email@hidden >
Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed
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.