我已经将Github的最新代码打包为AVAnimator库。除了AutoPropertyRelease.h和AutoPropertyRelease.m,我还添加了文件夹AVAnimator和LZMASDK。

我正在使用以下代码来播放带有Alpha通道的视频(从另一个AVAnimator应用示例中采用):

 CGRect iPhoneExplosionRect = CGRectMake(0, -2, 640/2, 480/2);
CGRect iPadExplosionRect = CGRectMake(0, -5, 840, 630);

NSString *rgbResourceName = @"ExplosionAdjusted_rgb_CRF_30_24BPP.m4v";
NSString *alphaResourceName = @"ExplosionAdjusted_alpha_CRF_30_24BPP.m4v";

// Output filename

NSString *tmpFilename;
NSString *tmpPath;
tmpFilename = @"Explosion.mvid";
tmpPath = [AVFileUtil getTmpDirPath:tmpFilename];

// Set to TRUE to always decode from H.264

BOOL alwaysDecode = FALSE;

if (alwaysDecode && [AVFileUtil fileExists:tmpPath]) {
    BOOL worked = [[NSFileManager defaultManager] removeItemAtPath:tmpPath error:nil];
    NSAssert(worked, @"could not remove file %@", tmpPath);
}

// This loader will join 2 H.264 videos together into a single 32BPP .mvid

AVAssetJoinAlphaResourceLoader *resLoader = [AVAssetJoinAlphaResourceLoader aVAssetJoinAlphaResourceLoader];

resLoader.movieRGBFilename = rgbResourceName;
resLoader.movieAlphaFilename = alphaResourceName;
resLoader.outPath = tmpPath;
//resLoader.alwaysGenerateAdler = TRUE;

AVAnimatorMedia *media = [AVAnimatorMedia aVAnimatorMedia];
media.resourceLoader = resLoader;

self.expMedia = media;

// Frame decoder will read from generated .mvid file

AVMvidFrameDecoder *aVMvidFrameDecoder = [AVMvidFrameDecoder aVMvidFrameDecoder];
media.frameDecoder = aVMvidFrameDecoder;

// Create layer that video data will be directed into

CGRect expFrame;

if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
    expFrame = iPhoneExplosionRect;
} else {
    expFrame = iPadExplosionRect;
}

CALayer *layer = [CALayer layer];
layer.frame = expFrame;
}

if (FALSE) {
    layer.backgroundColor = [UIColor orangeColor].CGColor;
}

[self.view.layer addSublayer:layer];

AVAnimatorLayer *animatorLayer = [AVAnimatorLayer aVAnimatorLayer:layer];

self.expAnimatorLayer = animatorLayer;

// Finally connect the media object to the layer so that rendering will be
// sent to the layer.

[animatorLayer attachMedia:media];

//media.animatorRepeatCount = 3;
//media.animatorRepeatCount = 30;
//media.animatorRepeatCount = INT_MAX;

[media prepareToAnimate];


按下prepareToAnimate后,应用程序将在如下所述的断言下失败

** Assertion failure in -[AVMvidFrameDecoder advanceToFrame:], /Users/user/Documents/.../AVAnimator/AVMvidFrameDecoder.m:844

...*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'framebuffer num bytes'


是我正在使用的体系结构(32位和64位)引起该问题还是其他原因?

我希望有人可以让我走上正确的道路

自动对焦

最佳答案

我研究了这个断言以及可以重现它的不同方式。我尝试将拱形标志设置为在可执行文件中仅包含32位或仅64位代码,并在64位设备和模拟器上进行了测试。我无法重现该问题,并且不清楚如何发生。为了收集更多信息,我添加了额外的检查,该检查在分配帧缓冲区时以DEBUG或OPT模式进行编译,可以从github提取AVAnimator的最新版本,还是从patch here抓取补丁。请确保在您的代码版本中没有修改任何定义,并且您正在使用最新版本的Xcode。

10-08 07:26