Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Getting "this archiver cannot encode structs" when calling QTMovie frameImageAtTime when I specify the QTMovieFrameImageSize on 10.5.6 server
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Getting "this archiver cannot encode structs" when calling QTMovie frameImageAtTime when I specify the QTMovieFrameImageSize on 10.5.6 server



The code worked fine with 10.5.5 and QT 7.5.5, but I upgraded to
10.5.6 and QT 7.6 and now I get the aforementioned exception every
time I try to get the frameImage if I specify the
QTMovieFrameImageSize(an NSSize wrapped in an NSValue using the
[NSValue valueFromSize] method) in my attributes dictionary.    I
followed Apple's own
tutorial(http://developer.apple.com/SampleCode/QTKitMovieFrameImage/listing3.html),
and I have posted code below.

The exception says that the archiver cannot encode structs, but I am
passing an NSValue.  What has changed?  If I take out the
QTMovieFrameImageSize attribute, the code works fine but the resulting
image is much bigger than I desire.

Is there any way to format the NSSize object so that the
NSKeyedArchiver will accept it?

Thank you for your time,

-Joel L. Tucci

Code and exception below:

+(void)writePosterImageToFile:(QTMovie *)movie fileName:(NSString
*)fileName width:(int)width height:(int)height {

     //We get the "poster frame" of the movie which is the first
interesting frame

     [movie gotoPosterTime];

     NSSize picSize=NSMakeSize(width,height);
     NSValue *sizeValue=[NSValue valueWithSize:picSize];

     [[QTMovieProcessor dataForMovieFrame:movie size:sizeValue]
writeToFile:fileName atomically:YES];

}



+(NSData *)dataForMovieFrame:(QTMovie *)movie size:(NSValue *)sizeValue {

     NSDictionary *attributes=[NSDictionary
dictionaryWithObjectsAndKeys:sizeValue,QTMovieFrameImageSize,
QTMovieFrameImageTypeCGImageRef,QTMovieFrameImageType,nil];

     CGImageRef movieImage=(CGImageRef)[movie frameImageAtTime:[movie
currentTime] withAttributes:attributes error:nil];


Application Specific Information:
*** Terminating app due to uncaught exception
'NSInvalidArgumentException', reason: '*** -[NSKeyedArchiver
encodeValueOfObjCType:at:]: this archiver cannot encode structs'

Thread 0 Crashed:
0   libSystem.B.dylib             	0x00007fff81ad5ec6 __kill + 10
1   libstdc++.6.dylib             	0x00007fff81670085
dyld_stub__Unwind_DeleteException + 0
2   libobjc.A.dylib               	0x00007fff8197eadf _objc_terminate + 102
3   libstdc++.6.dylib             	0x00007fff8166e425
__gxx_personality_v0 + 1259
4   libstdc++.6.dylib             	0x00007fff8166e45b std::terminate() + 19
5   libstdc++.6.dylib             	0x00007fff8166e54c __cxa_rethrow + 0
6   libobjc.A.dylib               	0x00007fff8197e966 objc_exception_rethrow + 0
7   com.apple.CoreFoundation      	0x00007fff8455fb25 +[NSException
raise:format:arguments:] + 149
8   com.apple.CoreFoundation      	0x00007fff8455fbc5 +[NSException
raise:format:] + 149
9   com.apple.Foundation          	0x00007fff836e4218
-[NSKeyedArchiver encodeValueOfObjCType:at:] + 616
10  com.apple.Foundation          	0x00007fff837a5016 -[NSValue
encodeWithCoder:] + 166
11  com.apple.Foundation          	0x00007fff8363aa25 _encodeObject + 645
12  com.apple.Foundation          	0x00007fff836a616b
-[NSKeyedArchiver _encodeArrayOfObjects:forKey:] + 555
13  com.apple.Foundation          	0x00007fff83658b15
-[NSDictionary(NSDictionary) encodeWithCoder:] + 1061
14  com.apple.Foundation          	0x00007fff8363aa25 _encodeObject + 645
15  com.apple.QTKit               	0x000000011399b92a serialize + 204
16  com.apple.QTKit               	0x00000001139bc08f -[QTMovie
frameImageAtTime:withAttributes:error:] + 87
17  libQTMovieViewComponent.jnilib	0x000000011331c7ae
+[QTMovieProcessor dataForMovieFrame:size:] + 171
18  libQTMovieViewComponent.jnilib	0x000000011331c872
+[QTMovieProcessor writePosterImageToFile:fileName:width:height:] +
117
19  libQTMovieViewComponent.jnilib	0x000000011331bd3e
Java_cmtc_video_quicktime_QTMovieController_exportPosterImage + 258
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
QuickTime-API mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

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 © 2011 Apple Inc. All rights reserved.