Develop and Download Open Source Software

Browse Subversion Repository

Annotation of /XspfQT/XspfQTMovieLoader.m

Parent Directory Parent Directory | Revision Log Revision Log


Revision 307 - (hide annotations) (download)
Thu Feb 18 13:36:23 2010 UTC (14 years, 2 months ago) by masakih
File size: 2069 byte(s)
[Fix] インポートするヘッダファイル名を直しきれていなかったのを修正。
1 masaki 180 //
2     // XspfQTMovieLoader.m
3     // XspfQT
4     //
5     // Created by Hori,Masaki on 09/03/14.
6     // Copyright 2009 masakih. All rights reserved.
7     //
8    
9     #import "XspfQTMovieLoader.h"
10    
11 masakih 307 #import "NSURL-HMExtensions.h"
12 masaki 180
13     @implementation XspfQTMovieLoader
14     + (id)loaderWithMovieURL:(NSURL *)inMovieURL delegate:(id)inDelegate
15     {
16     return [[[[self class] alloc] initWithMovieURL:inMovieURL delegate:inDelegate] autorelease];
17     }
18     - (id)initWithMovieURL:(NSURL *)inMovieURL delegate:(id)inDelegate
19     {
20     self = [super init];
21     if(self) {
22    
23     @try {
24     [self setDelegate:inDelegate];
25     }
26     @catch (XspfQTMovieLoader *me) {
27     [self autorelease];
28     return nil;
29     }
30     [self setMovieURL:inMovieURL];
31     }
32    
33     return self;
34     }
35    
36     - (void)dealloc
37     {
38     [movieURL release];
39     [movie release];
40    
41     [super dealloc];
42     }
43    
44     - (void)setMovieURL:(NSURL *)url
45     {
46     if([url isEqualUsingLocalhost:movieURL]) return;
47    
48     [self setQTMovie:nil];
49     [movieURL autorelease];
50     movieURL = [url retain];
51     }
52     - (NSURL *)movieURL
53     {
54     return movieURL;
55     }
56     - (void)setQTMovie:(QTMovie *)newMovie
57     {
58     [movie release];
59     movie = [newMovie retain];
60     }
61     - (QTMovie *)qtMovie
62     {
63     return movie;
64     }
65    
66     - (void)setDelegate:(id)inDelegate
67     {
68     if(inDelegate && ![inDelegate respondsToSelector:@selector(setQTMovie:)]) {
69     NSLog(@"Delegate should be respond to selector setQTMovie:");
70     @throw self;
71     }
72    
73     delegate = inDelegate;
74     }
75     - (id)delegate
76     {
77     return delegate;
78     }
79    
80     - (void)load
81     {
82     QTMovie *newMovie = nil;
83    
84     if(movie) return;
85    
86     if(![QTMovie canInitWithURL:movieURL]) goto finish;
87    
88     NSError *error = nil;
89     // NSDictionary *attrs = [NSDictionary dictionaryWithObjectsAndKeys:
90     // [self location], QTMovieURLAttribute,
91     // [NSNumber numberWithBool:NO], QTMovieOpenAsyncOKAttribute,
92     // nil];
93     // movie = [[QTMovie alloc] initWithAttributes:attrs error:&error];
94     newMovie = [[QTMovie alloc] initWithURL:movieURL error:&error];
95     if(error) {
96     NSLog(@"%@", error);
97     }
98    
99     finish:
100     [self setQTMovie:[newMovie autorelease]];
101     [delegate setQTMovie:movie];
102     }
103     - (void)loadInBG
104     {
105     [self performSelector:@selector(load) withObject:nil afterDelay:0.0];
106     }
107    
108     @end

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26