PDA

View Full Version : QTMovie tracks count == 0??




Chirone
Mar 26, 2009, 07:12 PM
if i load an existing quicktime clip as a QTMovie, and it has a video and audio track i should be able to get the tracks by going
[mQTMovie tracks]
right?
and being an NSArray i should just be able to go
[[mQTMovie tracks] count]
and get the number of tracks right?
for some reason the count is 0...

has anyone else had this sort of problem?



lee1210
Mar 26, 2009, 09:40 PM
Is nQTMovie nil? How did you initialize it? Do other things you call on it work?

-Lee

Chirone
Mar 26, 2009, 10:27 PM
ok,

i just printed the number in the wrong string format for the quicktime clip from disk....
i went
printf("on load: %f\n", [[mQTMovie tracks] count]);
instead of
printf("on load: %d\n", [[mQTMovie tracks] count]);
which i didn't think would make a difference... maybe i'm too used to java *shudder*...

however, this line
printf("QTGraphics tracks: %d\n", [[mQTGraphics tracks] count]);
prints out 0 tracks....

i think there is something wrong with the way it was initialized but i can't figure out what's wrong...

i initialize it like this:
mQTGraphics = [QTMovie movie];
[mQTGraphics setAttribute: [NSNumber numberWithBool: YES] forKey: QTMovieEditableAttribute];
that should be fine right? i'm just grabbing an empty QTMovie and making it editable

then i add images to it
NSBitmapImageRep *image = [self getCurrentFrame];

QTTime time = QTMakeTime(100, 10);
NSDictionary *attrs = [NSDictionary dictionaryWithObject:@"png " forKey:QTAddImageCodecType];
NSImage *img = [[NSImage alloc] initWithData:[image TIFFRepresentation]];

[mQTMovieExport addImage:img forDuration:time withAttributes:attrs];

[image release];
Surely that should work... it worked for the other QTMovie that was initialized like this:
mQTMovieExport = [[QTMovie alloc] initToWritableFile:[savePanel filename] error:nil];

what's so different about the two methods of initializing that one will add images and the other wont? :confused:

yomi.odeleye
Mar 28, 2009, 01:51 PM
Hi Every one. I just want to find out is there a way to join Two or more QTMovies together. If any one knows any line of code that can help me plx let me know. Thank you very much.