2004-07-07 22:43:04 +00:00
|
|
|
/** <title>NSMovie</title>
|
|
|
|
|
|
|
|
<abstract>Encapsulate a Quicktime movie</abstract>
|
|
|
|
|
|
|
|
Copyright <copy>(C) 2003 Free Software Foundation, Inc.</copy>
|
|
|
|
|
|
|
|
Author: Fred Kiefer <FredKiefer@gmx.de>
|
|
|
|
Date: March 2003
|
|
|
|
|
|
|
|
This file is part of the GNUstep GUI Library.
|
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or
|
2007-10-29 21:16:17 +00:00
|
|
|
modify it under the terms of the GNU Lesser General Public
|
2004-07-07 22:43:04 +00:00
|
|
|
License as published by the Free Software Foundation; either
|
2008-06-10 04:01:49 +00:00
|
|
|
version 2 of the License, or (at your option) any later version.
|
2004-07-07 22:43:04 +00:00
|
|
|
|
|
|
|
This library is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2007-10-29 21:16:17 +00:00
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
Lesser General Public License for more details.
|
2004-07-07 22:43:04 +00:00
|
|
|
|
2007-10-29 21:16:17 +00:00
|
|
|
You should have received a copy of the GNU Lesser General Public
|
2004-07-07 22:43:04 +00:00
|
|
|
License along with this library; see the file COPYING.LIB.
|
2007-10-29 21:16:17 +00:00
|
|
|
If not, see <http://www.gnu.org/licenses/> or write to the
|
|
|
|
Free Software Foundation, 51 Franklin Street, Fifth Floor,
|
|
|
|
Boston, MA 02110-1301, USA.
|
2004-07-07 22:43:04 +00:00
|
|
|
*/
|
|
|
|
|
2011-03-04 11:33:22 +00:00
|
|
|
#import <Foundation/NSArray.h>
|
|
|
|
#import <Foundation/NSCoder.h>
|
|
|
|
#import <Foundation/NSData.h>
|
|
|
|
#import <Foundation/NSURL.h>
|
|
|
|
#import "AppKit/NSMovie.h"
|
|
|
|
#import "AppKit/NSPasteboard.h"
|
2004-07-07 22:43:04 +00:00
|
|
|
|
|
|
|
@implementation NSMovie
|
|
|
|
|
|
|
|
+ (NSArray*) movieUnfilteredFileTypes
|
|
|
|
{
|
|
|
|
return [NSArray arrayWithObject: @"mov"];
|
|
|
|
}
|
|
|
|
|
|
|
|
+ (NSArray*) movieUnfilteredPasteboardTypes
|
|
|
|
{
|
|
|
|
// FIXME
|
|
|
|
return [NSArray arrayWithObject: @"QuickTimeMovie"];
|
|
|
|
}
|
|
|
|
|
|
|
|
+ (BOOL) canInitWithPasteboard: (NSPasteboard*)pasteboard
|
|
|
|
{
|
|
|
|
NSArray *pbTypes = [pasteboard types];
|
|
|
|
NSArray *myTypes = [self movieUnfilteredPasteboardTypes];
|
|
|
|
|
|
|
|
return ([pbTypes firstObjectCommonWithArray: myTypes] != nil);
|
|
|
|
}
|
|
|
|
|
|
|
|
- (id) initWithData: (NSData *)movie
|
|
|
|
{
|
|
|
|
if (movie == nil)
|
|
|
|
{
|
|
|
|
RELEASE(self);
|
|
|
|
return nil;
|
|
|
|
}
|
|
|
|
|
|
|
|
[super init];
|
|
|
|
ASSIGN(_movie, movie);
|
|
|
|
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (id) initWithMovie: (void*)movie
|
|
|
|
{
|
|
|
|
//FIXME
|
|
|
|
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (id) initWithURL: (NSURL*)url byReference: (BOOL)byRef
|
|
|
|
{
|
|
|
|
NSData* data = [url resourceDataUsingCache: YES];
|
|
|
|
|
|
|
|
self = [self initWithData: data];
|
|
|
|
|
|
|
|
if (byRef)
|
|
|
|
{
|
|
|
|
ASSIGN(_url, url);
|
|
|
|
}
|
|
|
|
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (id) initWithPasteboard: (NSPasteboard*)pasteboard
|
|
|
|
{
|
|
|
|
NSString *type;
|
|
|
|
NSData* data;
|
|
|
|
|
|
|
|
type = [pasteboard availableTypeFromArray:
|
2011-07-14 07:17:24 +00:00
|
|
|
[object_getClass(self) movieUnfilteredPasteboardTypes]];
|
2004-07-07 22:43:04 +00:00
|
|
|
if (type == nil)
|
|
|
|
{
|
|
|
|
//NSArray *array = [pasteboard propertyListForType: NSFilenamesPboardType];
|
|
|
|
// FIXME
|
|
|
|
data = nil;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
data = [pasteboard dataForType: type];
|
|
|
|
}
|
|
|
|
|
|
|
|
if (data == nil)
|
|
|
|
{
|
|
|
|
RELEASE(self);
|
|
|
|
return nil;
|
|
|
|
}
|
|
|
|
|
|
|
|
self = [self initWithData: data];
|
|
|
|
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void) dealloc
|
|
|
|
{
|
|
|
|
TEST_RELEASE(_url);
|
|
|
|
TEST_RELEASE(_movie);
|
|
|
|
|
|
|
|
[super dealloc];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void*) QTMovie
|
|
|
|
{
|
|
|
|
return (void*)[_movie bytes];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (NSURL*) URL
|
|
|
|
{
|
|
|
|
return _url;
|
|
|
|
}
|
|
|
|
|
|
|
|
// NSCopying protocoll
|
|
|
|
- (id) copyWithZone: (NSZone *)zone
|
|
|
|
{
|
|
|
|
NSMovie *new = (NSMovie*)NSCopyObject (self, 0, zone);
|
|
|
|
|
|
|
|
new->_movie = [_movie copyWithZone: zone];
|
|
|
|
new->_url = [_url copyWithZone: zone];
|
|
|
|
return new;
|
|
|
|
}
|
|
|
|
|
|
|
|
// NSCoding protocoll
|
|
|
|
- (void) encodeWithCoder: (NSCoder*)aCoder
|
|
|
|
{
|
* Source/NSEvent.m,
* Source/NSParagraphStyle.m: Use NSInteger instead of enumerator
type name for decoding and encoding.
* Header/AppKit/NSFontPanel.h,
* Header/AppKit/NSOpenPanel.h,
* Header/AppKit/NSDataLinkPanel.h,
* Source/NSDataLinkPanel.m,
* Header/AppKit/NSForm.h,
* Source/NSForm.m,
* Header/AppKit/NSHelpPanel.h,
* Source/NSHelpPanel.m,
* Source/NSColorPanel.m: Remove unused encoding/decoding
* methods.
* Source/NSCustomImageRep.m,
* Source/NSEPSImageRep.m,
* Source/NSMovie.m,
* Source/NSRulerMarker.m,
* Source/NSColorList.m: Flag missing keyed encoding/decoding.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@36377 72102866-910b-0410-8b05-ffd578937521
2013-03-17 19:53:50 +00:00
|
|
|
if ([aCoder allowsKeyedCoding])
|
|
|
|
{
|
|
|
|
// FIXME
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
[aCoder encodeObject: _movie];
|
|
|
|
[aCoder encodeObject: _url];
|
|
|
|
}
|
2004-07-07 22:43:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
- (id) initWithCoder: (NSCoder*)aDecoder
|
|
|
|
{
|
* Source/NSEvent.m,
* Source/NSParagraphStyle.m: Use NSInteger instead of enumerator
type name for decoding and encoding.
* Header/AppKit/NSFontPanel.h,
* Header/AppKit/NSOpenPanel.h,
* Header/AppKit/NSDataLinkPanel.h,
* Source/NSDataLinkPanel.m,
* Header/AppKit/NSForm.h,
* Source/NSForm.m,
* Header/AppKit/NSHelpPanel.h,
* Source/NSHelpPanel.m,
* Source/NSColorPanel.m: Remove unused encoding/decoding
* methods.
* Source/NSCustomImageRep.m,
* Source/NSEPSImageRep.m,
* Source/NSMovie.m,
* Source/NSRulerMarker.m,
* Source/NSColorList.m: Flag missing keyed encoding/decoding.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@36377 72102866-910b-0410-8b05-ffd578937521
2013-03-17 19:53:50 +00:00
|
|
|
if ([aDecoder allowsKeyedCoding])
|
|
|
|
{
|
|
|
|
// FIXME
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ASSIGN (_movie, [aDecoder decodeObject]);
|
|
|
|
ASSIGN (_url, [aDecoder decodeObject]);
|
|
|
|
}
|
2004-07-07 22:43:04 +00:00
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
@end
|