- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
嘿伙计们...我已经无计可施了。过去三天我似乎一直在关注这个问题,但距离解决它还很远。我有一个视频队列,我正在后台线程中逐个转换这些视频。大多数时候它会按预期工作,但时不时地,我会遇到奇怪的崩溃,总是在同一点。我一生都无法弄清楚为什么会发生这种情况。我已启用垃圾收集。这是我的转换代码。
这是堆栈跟踪。
编辑:经过更多的调试,我回到了可能与垃圾收集器相关的结论。如果我将以下行放在转换视频的行之前,我看到的这些错误的数量会急剧增加......
[[NSGarbageCollector defaultCollector] 彻底收集];
NSInvalidArgumentException
-[NSPathStore2 objectForKey:]: unrecognized selector sent to instance 0x1073570
(
0 CoreFoundation 0x92fc16ba __raiseError + 410
1 libobjc.A.dylib 0x901b4509 objc_exception_throw + 56
2 CoreFoundation 0x9300e90b -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
3 CoreFoundation 0x92f67c36 ___forwarding___ + 950
4 CoreFoundation 0x92f67802 _CF_forwarding_prep_0 + 50
5 QTKit 0x903d3280 MovieProgressProc + 62
6 QuickTime 0x95a66062 convertFileProgress + 212
7 QuickTime3GPP 0x1e7bcaa2 Spit3GP2_Progress + 180
8 QuickTime3GPP 0x1e7c01d8 Spit3GP2_FromProceduresToDataRef + 3438
9 CarbonCore 0x90b0d054 _ZL38CallComponentFunctionCommonWithStoragePPcP19ComponentParametersPFlvEm + 54
10 QuickTime3GPP 0x1e7be33d Spit3GP2_ComponentDispatch + 129
11 CarbonCore 0x90b057c9 CallComponentDispatch + 29
12 QuickTime 0x95befb97 MovieExportFromProceduresToDataRef + 49
13 QuickTime3GPP 0x1e7bdf84 Spit3GP2_ToDataRef + 1987
14 CarbonCore 0x90b1865d callComponentStorage_4444444 + 63
15 CarbonCore 0x90b0d054 _ZL38CallComponentFunctionCommonWithStoragePPcP19ComponentParametersPFlvEm + 54
16 QuickTime3GPP 0x1e7be33d Spit3GP2_ComponentDispatch + 129
17 CarbonCore 0x90b057c9 CallComponentDispatch + 29
18 QuickTime 0x95befbe2 MovieExportToDataRef + 73
19 QuickTime 0x95a6e9bb ConvertMovieToDataRef_priv + 1690
20 QuickTime 0x95bdc591 ConvertMovieToDataRef + 71
21 QTKit 0x903e0954 -[QTMovie_QuickTime writeToDataReference:withAttributes:error:] + 2692
22 QTKit 0x903c5110 -[QTMovie_QuickTime writeToFile:withAttributes:error:] + 111
23 Mevee 0x0005871d -[ConversionQueue convertVideo:] + 509
24 Mevee 0x00058341 -[ConversionQueue startConvertingItems] + 145
25 Foundation 0x9520fbf0 -[NSThread main] + 45
26 Foundation 0x9520fba0 __NSThread__main__ + 1499
27 libSystem.B.dylib 0x9475a85d _pthread_start + 345
28 libSystem.B.dylib 0x9475a6e2 thread_start + 34
)
- (id) init
{
if(!(self = [super init])) return self;
convertingIndex = 0;
conversionPaths = [[NSMutableArray alloc] init];
[conversionPaths addObject:@"/Users/Morgan/Desktop/Convertable Media/Movies/2 Fast 2 Furious/2 Fast 2 Furious.mp4"];
[conversionPaths addObject:@"/Users/Morgan/Desktop/Convertable Media/Movies/101 Dalmations/101 Dalmations.mp4"];
[conversionPaths addObject:@"/Users/Morgan/Desktop/Convertable Media/Movies/300/300.mp4"];
[conversionPaths addObject:@"/Users/Morgan/Desktop/Convertable Media/Movies/1408/1408.mp4"];
[conversionPaths addObject:@"/Users/Morgan/Desktop/Convertable Media/Movies/A Few Good Men/A Few Good Men.mp4"];
[conversionPaths addObject:@"/Users/Morgan/Desktop/Convertable Media/Movies/A Goofy Movie/A Goofy Movie.mp4"];
[conversionPaths addObject:@"/Users/Morgan/Desktop/Convertable Media/Movies/A Single Man/A Single Man.mp4"];
[conversionPaths addObject:@"/Users/Morgan/Desktop/Convertable Media/Movies/A View to a Kill/A View to a Kill.mp4"];
[conversionPaths addObject:@"/Users/Morgan/Desktop/Convertable Media/Movies/Across the Universe/Across the Universe.mp4"];
backgroundThread = [[NSThread alloc] initWithTarget:self selector:@selector(startConvertingItems) object:nil];
[backgroundThread start];
return self;
}
- (void) startProcessingQueue
{
}
- (void) startConvertingItems
{
NSInteger iterations = 0;
while(iterations < 100)
{
NSString* nextPath = [conversionPaths objectAtIndex:convertingIndex];
NSLog(@"ITERATION %d", iterations);
[self convertVideo:nextPath];
convertingIndex += 1;
if(convertingIndex >= [conversionPaths count])
convertingIndex = 0;
iterations += 1;
}
}
- (void) openMovieOnMainThread:(NSString*)path
{
NSError* error = nil;
movie = [[QTMovie alloc] initWithFile:path error:&error];
if(movie == nil || error != nil || ![movie detachFromCurrentThread])
movie = nil;
}
- (void) closeMovieOnMainThread
{
//[movie attachToCurrentThread];
//[movie release];
}
- (BOOL) convertVideo: (NSString*)path
{
[self performSelectorOnMainThread:@selector(openMovieOnMainThread:) withObject:path waitUntilDone:YES];
if(movie == nil) {
NSLog(@"ERROR OPENING MOVIE");
return NO;
}
[QTMovie enterQTKitOnThreadDisablingThreadSafetyProtection];
[movie attachToCurrentThread];
[movie setDelegate:self];
NSString* tempItemPath = @"/Users/Morgan/Desktop/test.mp4";
NSDictionary *attrs = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithBool:YES], QTMovieExport,
[NSNumber numberWithLong:'3gpp'], QTMovieExportType,
nil];
NSError* error = nil;
if(![movie writeToFile:tempItemPath withAttributes:attrs error:&error]) {
NSLog(@"ERROR CONVERTING MOVIE");
return NO;
}
[movie invalidate];
[movie detachFromCurrentThread];
[QTMovie exitQTKitOnThread];
[self performSelectorOnMainThread:@selector(closeMovieOnMainThread) withObject:nil waitUntilDone:YES];
return YES;
}
- (BOOL)movie:(QTMovie *)aMovie shouldContinueOperation:(NSString *)op withPhase:(QTMovieOperationPhase)phase atPercent:(NSNumber *)percent withAttributes:(NSDictionary *)attributes
{
switch (phase)
{
case QTMovieOperationBeginPhase:
NSLog(@"Conversion started");
break;
case QTMovieOperationUpdatePercentPhase:
NSLog(@"Conversion progress: %f", [percent floatValue]);
break;
case QTMovieOperationEndPhase:
NSLog(@"Conversion finished.");
break;
}
return YES;
}
最佳答案
啊...我发现那是愚蠢的垃圾收集器。重新设计了我的应用程序,使其能够使用引用计数而不是垃圾收集,并且一切顺利。还有其他人遇到过类似的垃圾收集错误吗?我对电影文件的根对象有很强的引用,所以我认为这不是问题所在。
关于cocoa - 令人难以置信的 QTMovie 导出崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5959930/
我正在尝试创建一个在最小化时在扩展坞中播放的视频播放器。我从 QTMovie 中抓取当前帧并间歇性地将其设置为最小化图标,但是当窗口最小化时,影片(或关联的 QTMovieView)会暂停。我怎样才能
我正在尝试使用 cocoa 和 Qtkit 为 OSX 构建一个简单的应用程序。我希望应用程序一启动就开始播放电影。我创建了一个要播放的应用程序,它可以通过引用文件的位置来播放桌面上的 .mov 文件
我正在开发一个程序原型(prototype),(在当前阶段)只需要能够加载电影并调整播放速度。我已经解决了用户界面,并且可以正常播放,但我还没有设法弄清楚如何调整播放速度。 我相信 -[QTMovie
我有一个 Cocoa 应用程序,它应该完全同步地播放两个不同的 QTMovie 对象。两部电影的分辨率、大小等相同,但长度可能不同。电影经过压缩,因此必须是多线程的。 我目前的方法是: NSMutab
嘿伙计们...我已经无计可施了。过去三天我似乎一直在关注这个问题,但距离解决它还很远。我有一个视频队列,我正在后台线程中逐个转换这些视频。大多数时候它会按预期工作,但时不时地,我会遇到奇怪的崩溃,总是
我有一个简单的基础工具,可以将电影的每一帧导出为 .tiff 文件。相关代码如下: NSString* movieLoc = [NSString stringWithCString:argv[1]];
我正在研究桌面视频捕捉。我实现了截图抓取,效果很快。然后我通过 addImage:forDuration:withAttributes: 将每个屏幕截图添加到 QTMovie,但它的工作速度非常慢,因
我有一个简单的音频播放应用程序,它使用 QTMovie 来实现它的一些功能。我还在开发一个支持以太网的小型板来传输 MP3 或 PCM 数据。 有什么方法可以“抓取”QTMovie 输出的内容,将其格
因此,QTMovie 有 QTMovieDidEndNotification,但没有 QTMovieDidStartNotification。当 QTMovie 开始播放时我如何收到通知? 最佳答案
我正在尝试通过 QTKit 创建 QTVR 电影,并且我已经获得了电影中的所有帧。然而,设置必要的属性似乎没有任何效果。例如: NSNumber *val = [NSNumber numberWith
我只是想知道 QTMovie 类是否确实处理 URL 重定向,因为我正在用它流式传输音频文件,并且流 URL 可以包含重定向。有时电影不会开始播放,但不会抛出错误(我总是在主线程上操作,我知道这个类不
我刚刚升级到 Mountain Lion 和 Xcode 4.4,现在每当我在现有应用程序的 QTMovieView 上加载电影时,我都会收到这些警告。 2012-08-09 23:56:16.132
如何以编程方式判断 QTMovie 正在播放还是暂停? 看起来很简单,但我梳理了QTMovie和 QTMovieView文档相当广泛,但找不到任何此类内容。我错过了什么? 最佳答案 您可能正在查找电影
我知道,如果我想根据需要向 QTMovie 提供来自任意源的数据,我可能必须处理 QTDataReference 类,但不幸的是,我对类似内容的经验仅限于使用音频缓冲区的音频数据回调在 iPhone
接下来是一个初始化方法。它从文件创建电影结构,着眼于提取原始像素进行处理,如 Apple QA1443 所示。 。然后将其包装在 QTMovie 中 – sourceMovie = [QTMovie
我想使用我拥有的 QTMovie 导出它,并在预定的时间内淡入和淡出音频。我想尽可能在 Cocoa 中执行此操作。这部电影可能只有音频。我的研究发现了两种可能性: 使用较新的音频上下文插入 API
我正在使用带有 QTMovieOpenForPlaybackAttribute:YES 的 QTMovie,并使用 QTMovieView 来显示它。我需要计算它达到的帧速率。 我能想到的一种方法是在
我正在尝试在 ScreenSaverView 类中创建一个可以播放 QTMovie 的屏幕保护程序。我想我必须使用 QTMovieView,但我无法弄清楚如何在不使用界面生成器的情况下创建和初始化 Q
因此,我尝试采用可变大小(从几 MB 到大于 GB 的任何位置)QTMovie 对象,并使用 writeToFile:withAttributes: 将其导出到磁盘。由于这需要很长时间并锁定 UI,我
我遇到了一个疯狂的问题...... 一个带有QTMovieView的简单Cocoa应用程序,其中设置了一个特定的电影文件或一个手动加载和渲染QTMovie的应用程序工作正常,但是,如果我只是链接我的自
我是一名优秀的程序员,十分优秀!