• R/O
  • SSH
  • HTTPS

xspfqt: Commit


Commit MetaInfo

Révision390 (tree)
l'heure2013-07-02 23:11:00
Auteurmasakih

Message de Log

[New] 動画の連結中にそれを示す動画を再生

Change Summary

Modification

--- branches/divideMovieViewController/XspfQTDocument.m (revision 389)
+++ branches/divideMovieViewController/XspfQTDocument.m (revision 390)
@@ -111,6 +111,7 @@
111111 {
112112 self = [super init];
113113 if(self) {
114+// _player = [[XspfQTPlayer alloc] init];
114115 _player = [[XspfQTPlayerMovieMode alloc] init];
115116 }
116117
--- branches/divideMovieViewController/XspfQTMovieWindowController.m (revision 389)
+++ branches/divideMovieViewController/XspfQTMovieWindowController.m (revision 390)
@@ -599,9 +599,13 @@
599599 {
600600 QTMovie *qt = self.qtMovie;
601601 if(qt) {
602- // force update time indicator.
603- [qt willChangeValueForKey:@"currentTime"];
604- [qt didChangeValueForKey:@"currentTime"];
602+ // see XspfQTPlayerMovieMode joinTheMoviesMovie method.
603+ NSString *displayName = [qt attributeForKey:QTMovieDisplayNameAttribute];
604+ if(![displayName isEqualToString:@"JoinTheMovie"]) {
605+ // force update time indicator.
606+ [qt willChangeValueForKey:@"currentTime"];
607+ [qt didChangeValueForKey:@"currentTime"];
608+ }
605609 }
606610
607611 // Hide cursor and controller, if mouse didn't move for 3 seconds.
--- branches/divideMovieViewController/XspfQTPlayerMovieMode.m (revision 389)
+++ branches/divideMovieViewController/XspfQTPlayerMovieMode.m (revision 390)
@@ -20,7 +20,12 @@
2020
2121 static NSString *XspfQTCurrentTrackKey = @"currentTrack";
2222
23+static NSString *joinTheMovies = @"JoinTheMovies";
24+static NSString *joinTheMoviesExt = @"m4v";
2325
26+static QTMovie *joinTheMoviesMovie = nil;
27+
28+
2429 @interface XspfQTPlayerMovieMode ()
2530
2631 @property (retain) XspfQTMovieLoader *loader;
@@ -71,6 +76,22 @@
7176 [super dealloc];
7277 }
7378
79+- (QTMovie *)joinTheMoviesMovie
80+{
81+ if(joinTheMoviesMovie) return joinTheMoviesMovie;
82+
83+ NSString *path = [[NSBundle mainBundle] pathForResource:joinTheMovies ofType:joinTheMoviesExt];
84+
85+ NSError *error = nil;
86+ joinTheMoviesMovie = [[QTMovie alloc] initWithFile:path error:&error];
87+ [joinTheMoviesMovie setAttribute:[NSNumber numberWithBool:YES] forKey:QTMovieLoopsAttribute];
88+
89+ // for do not update time indicator.
90+ [joinTheMoviesMovie setAttribute:@"JoinTheMovie" forKey:QTMovieDisplayNameAttribute];
91+
92+ return joinTheMoviesMovie;
93+}
94+
7495 - (void)setPlaylist:(HMXSPFComponent *)newList
7596 {
7697 if(_playlist == newList) return;
@@ -154,41 +175,45 @@
154175 }
155176 - (void)joinMovie
156177 {
157- QTMovie *theMovie = [QTMovie movie];
158- [theMovie setMovieAttributes:@{QTMovieEditableAttribute:@YES}];
159-
160- HMXSPFComponent *trackList = self.trackList;
161-
162- NSMutableArray *aDurations = [NSMutableArray array];
163-
164- NSArray *children = [trackList children];
165- BOOL firstTime = YES;
166- for(HMXSPFComponent *track in children) {
167- //
168- self.loader.movieURL = [track movieLocation];
169- [self.loader load];
170- QTMovie *aMovie = self.loader.qtMovie;
178+ dispatch_queue_t queue = dispatch_queue_create("join movies", 0);
179+ dispatch_async(queue, ^() {
180+ QTMovie *theMovie = [QTMovie movie];
181+ [theMovie setMovieAttributes:@{QTMovieEditableAttribute:@YES}];
171182
172- QTTime qttime = [aMovie duration];
173- [aDurations addObject:[NSValue valueWithQTTime:qttime]];
174- id t = [NSValueTransformer valueTransformerForName:@"XspfQTTimeDateTransformer"];
175- [track setCurrentTrackDuration:[t transformedValue:[NSValue valueWithQTTime:qttime]]];
183+ HMXSPFComponent *trackList = self.trackList;
176184
177- QTTimeRange aMovieRange = QTMakeTimeRange(QTZeroTime, [aMovie duration]);
178- if(firstTime) {
179- [aMovie setSelection:aMovieRange];
180- [theMovie appendSelectionFromMovie:aMovie];
181- } else {
182- QTTime insertPoint = [theMovie duration];
183- insertPoint = QTTimeDecrement(insertPoint, QTMakeTimeWithTimeInterval(0.05));
184- [theMovie insertSegmentOfMovie:aMovie timeRange:aMovieRange atTime:insertPoint];
185+ NSMutableArray *aDurations = [NSMutableArray array];
186+
187+ NSArray *children = [trackList children];
188+ BOOL firstTime = YES;
189+ for(HMXSPFComponent *track in children) {
190+ self.loader.movieURL = [track movieLocation];
191+ [self.loader load];
192+ QTMovie *aMovie = self.loader.qtMovie;
193+
194+ QTTime qttime = [aMovie duration];
195+ [aDurations addObject:[NSValue valueWithQTTime:qttime]];
196+ id t = [NSValueTransformer valueTransformerForName:@"XspfQTTimeDateTransformer"];
197+ [track setCurrentTrackDuration:[t transformedValue:[NSValue valueWithQTTime:qttime]]];
198+
199+ QTTimeRange aMovieRange = QTMakeTimeRange(QTZeroTime, [aMovie duration]);
200+ if(firstTime) {
201+ [aMovie setSelection:aMovieRange];
202+ [theMovie appendSelectionFromMovie:aMovie];
203+ } else {
204+ QTTime insertPoint = [theMovie duration];
205+ insertPoint = QTTimeDecrement(insertPoint, QTMakeTimeWithTimeInterval(0.05));
206+ [theMovie insertSegmentOfMovie:aMovie timeRange:aMovieRange atTime:insertPoint];
207+ }
208+ firstTime = NO;
185209 }
186- firstTime = NO;
187- }
188-
189- [self buildStartPositionsWithDurations:aDurations];
190-
191- self.playingMovie = theMovie;
210+
211+ [self buildStartPositionsWithDurations:aDurations];
212+
213+ dispatch_async(dispatch_get_main_queue(), ^(void){
214+ self.playingMovie = theMovie;
215+ });
216+ });
192217 }
193218
194219 - (void)moveToStartPointNuber:(id)number
@@ -210,6 +235,8 @@
210235 [self.playingMovie play];
211236 } else {
212237 self.didJoin = YES;
238+ self.playingMovie = [self joinTheMoviesMovie];
239+ [self.playingMovie play];
213240 [self joinMovie];
214241 }
215242 }
Afficher sur ancien navigateur de dépôt.