PDA

View Full Version : QuickTime Movies with CB


junyx
2003.10.24, 05:49 AM
I'm working on my uDG entry Bubble Blast!, based on CB, and I have a problem. I would like to play a movie (with video and audio) in fullscreen mode. I made some tests and I think that CBMovie can work only with audio. So I added an NSMovieView as subview to my CBView. It works in windowed mode, but it doesn't work in fullscreen mode. Any suggestions? Thank you :rolleyes:

Josh
2003.10.24, 09:13 AM
I am pretty sure CBMovie works not only for sound but for movies as well.

junyx
2003.10.24, 12:02 PM
Originally posted by jabber
I am pretty sure CBMovie works not only for sound but for movies as well.

Maybe I'm doing something wrong: I load a movie into a CBMovie, then I create a texture with CBView's addTextureNamed:withMovie: and everything is ok, (like in the CBDemo code) but when I try to apply the texture to a CBCell with setTexture:textureNamed: the app crashes :?:
Thank you for your reply

Josh
2003.10.24, 12:10 PM
What does the backtrace say with the crash? What error does it give? Are you sure the movie you pass to addTextureNamed:withMovie: is valid?

junyx
2003.10.24, 12:28 PM
With the debugger and the crash log I noticed that the app crashes during [CBImageTexture drawRect:]
The console says "BubbleBlast! has exited due to signal 10 (SIGBUS)."
Are you sure the movie you pass to addTextureNamed:withMovie: is valid?
Yes, it plays its sound if I don't set it as CBCell's texture.
Thank you

kelvin
2003.10.24, 09:22 PM
d44 has been posted.
movie playback is fixed.

Josh
2003.10.25, 12:47 AM
:lol:

junyx
2003.10.25, 03:56 AM
it works! :wow: No words to describe kelvin... Thank you!
This forum is like a big family :p

junyx
2003.10.25, 05:22 AM
With d44 the movie plays correctly, but the game does't :p
The app crashes during [CBCell synchronizeTime:], called by [NSArray makeObjectsPerformSelector:withObject:], called by [CBView startAnimating].
What is changed from previous versions?
Thank you

kelvin
2003.10.25, 05:54 AM
nothing has changed in CBCell
did you clean and rebuild when you dropped in the new build of the frameworks?

junyx
2003.10.25, 06:27 AM
Originally posted by kelvin
did you clean and rebuild when you dropped in the new build of the frameworks?
Yes, I did. :???: It's strange, if I add to the project the old framework everything is ok, with the new one the app crashes (without changing the code)

junyx
2003.10.25, 06:32 AM
If I don't call [CBView startAnimating] it displays a static image, off course, but it works fine :?:

kelvin
2003.10.25, 06:41 PM
what version of CB were you using before all this trouble started?

what's the error on the synchcells call?

junyx
2003.10.27, 04:06 AM
Originally posted by kelvin
what version of CB were you using before all this trouble started?

I was using version 0.3.0d37 (8/11/03) (taken from version history)


what's the error on the synchcells call?

What do you mean? The first line in the debbuger's Frame column (so maybe the last method call) is objc_msgSend.
It also says "Program received signal: EXC_BAD_ACCESS"

Thank you

kelvin
2003.10.27, 04:47 AM
are you over releasing or over retaining your cells?

When creating cells they should be autoreleased when they are added to a view or supercell. The supercells retain their subcells when they enter the list. The [CBCell cell] method or one of its ilk are the most useful for creating cells.

junyx
2003.10.27, 05:01 AM
I wasn't autoreleasing some cells :p However the problem persists, the app crashes in the same way.

kelvin
2003.10.27, 05:06 AM
and you're sure that you aren't releasing cells when you shouldn't be?

junyx
2003.10.27, 05:22 AM
Originally posted by kelvin
and you're sure that you aren't releasing cells when you shouldn't be?

yes

kelvin
2003.10.27, 05:36 AM
something in one of the cell's subcell arrays is being released somehow. I really can't think of anything else without seeing a code sample.

junyx
2003.10.27, 05:55 AM
Really thank you, I'll made some checks.

Originally posted by kelvin
I really can't think of anything else without seeing a code sample.
Thank you, but at the moment I don't know exactly where the problem is and I should post the whole code :p
However it's going to be released :)

junyx
2003.10.28, 04:20 AM
I have some cells that are instances of CBCell's subclasses. Can this influence? In their init method they call [super init]. I autorelease them in this way:
cell = [[[MySubclass alloc] init] autorelease];
Thank you

kelvin
2003.10.28, 04:31 AM
CB has been known not to play nice with CBCell subclasses in the past. Can you show me the -init method of the subclass?

junyx
2003.10.28, 04:39 AM
I've two main subclasses. One has this init:
- (id)initBubble: (KindOfBubble) theKind withView: (CBView*) theView
{
self = [super init];

[self setView:theView];
[self setKind:theKind];
[self setStatus:kNoMove];
[self setKindOfDamage:kFullDamage];
[self setSound:TRUE];
[[self view] addCell:self];

switch([self kind])
{
case kBubbleTwo:
[self setTexture:[[self view] textureNamed:@"bubbleTwo"]];
break;

case kBubbleOne:
default:
[self setTexture:[[self view] textureNamed:@"bubbleOne"]];
break;
}

[self setRegPoint:NSMakePoint([self size].width/2.0,[self size].height/2.0)];

return self;
}

The other is similar.
Thank you

kelvin
2003.10.28, 07:07 AM
:p
*thwaps junyx*
ok I know the methods are hidden, but seriously...
:shock:
*blows steam*

DO NOT mess with the view property! CBCells have their view data managed automatically. -setView: is a hidden method that is used internally. By overriding it you are killing the view hierarchy. Don't mess with the view. The accessor provided will give you the view whose hierarchy contains that cell. Once a cell is added to a subcell of a view the -view accessor will return the view.

- (id)initBubble: (KindOfBubble) theKind withView: (CBView*) theView
{
if (![super init]) return nil;

[theView addCell:self];

[self setKind:theKind];
[self setStatus:kNoMove];
[self setKindOfDamage:kFullDamage];
[self setSound:TRUE];

switch([self kind])
{
case kBubbleTwo:
[self setTexture:[[self view] textureNamed:@"bubbleTwo"]];
break;

case kBubbleOne:
default:
[self setTexture:[[self view] textureNamed:@"bubbleOne"]];
break;
}

[self setRegPoint:NSMakePoint([self size].width/2.0,[self size].height/2.0)];

return self;
}

junyx
2003.10.28, 01:27 PM
I'm so sorry... :(
So CBView has its own setView: ... Oooops! :wacko: You just called [junyx dealloc] :p
Thank you, I'll correct the code

OneSadCookie
2003.10.28, 04:56 PM
You should really name your private methods beginning with an underscore Kelvin, to help avoid mistakes like this :rolleyes:

junyx
2003.10.31, 05:38 AM
It works now ;)
Thank you

kelvin
2003.10.31, 09:44 AM
Originally posted by OneSadCookie
You should really name your private methods beginning with an underscore Kelvin, to help avoid mistakes like this :rolleyes: indeed.

-setView: is a unique case however. it mirrors AppKit functionality where there is an public accessor for a managed property. Most of the other hidden methods are prefixed by an underscore. The main reason I didn't underscore the method was that I was thinking of making it public, but several design pitfalls ended up forcing me to make it private after I had written it.

-setView: is very tempting to the new user to toy with, with very _bad_ results. Even if I fully documented the method unintentional abuse would make it just not worth leaving open.

I was just surprised that junyx over wrote the method when there's a valid accessor. Though not so much in hindsight... I had a similar problem with a stanford grad student who was trying to directly access _view (which by the way doesn't work).

junyx
2003.11.03, 04:18 AM
It works now
I was using the old version :p It doesn't work. However I decided to use the old version without the movies, because time is running out

kelvin
2003.11.03, 04:24 AM
Time to PANIC!!!!:wacko: