AMR-NB デコード サポートを iOS アプリに追加しようとしていましたが、これは以前に成功しました。しかし、使用していたフレームワーク (PhoneGap、現在は Cordova) をアップグレードしてから、新しいプロジェクトを開始し、すべてのコードを新しいプロジェクトに移行したところ、フレーズのリンク中に AMR-NB lib でエラーが発生し始めました。
「file」および「lipo -info」コマンドを使用して .a lib ファイルをチェックしており、fat lib に i386 の arch が含まれていること、およびビルド フレーズのリンク フレーズに既に含まれていることを確認しました。新しいプロジェクトと古いプロジェクトのビルド設定を比較してきましたが、これを解決する運がありませんでした。
どこが間違っているのか誰か知っていますか?どうも!
更新: amrFileCodec.h と CJ-Func.m のコードのフラグメントを追加
amrFileCodec.h
// amrFileCodec.h
// Created by Tang Xiaoping on 9/27/11.
// Copyright 2011 test. All rights reserved.
#ifndef amrFileCodec_h
#define amrFileCodec_h
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "interf_dec.h"
#include "interf_enc.h"
...
// 将AMR文件解码成WAVE文件
int DecodeAMRFileToWAVEFile(const char* pchAMRFileName, const char* pchWAVEFilename);
#endif
CJ-Func.m
// CJ-Func.m
// iBear
// Created by Chris Jiang on 11-4-22.
// Copyright 2011 Individual. All rights reserved.
#import "CJ-Func.h"
#import "interf_dec.h"
#import "interf_enc.h"
#import "amrFileCodec.h"
@implementation MyPGPlugFunc
...
- (void)decodeAMR:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options {
NSArray *currentPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *basePath = [currentPaths objectAtIndex:0];
NSString *wavDir = [basePath stringByAppendingPathComponent:@"tmp/wav"];
NSString *wavPath = [basePath stringByAppendingPathComponent:[arguments objectAtIndex:1]];
NSLog(@"[CJ-FUNC] Decoding %@ to %@", [arguments objectAtIndex:0], wavPath);
BOOL isDir = YES;
NSFileManager *fileMgr = [NSFileManager defaultManager];
if ( ![fileMgr fileExistsAtPath:wavDir isDirectory:&isDir] ) {
if ( ![fileMgr createDirectoryAtPath:wavDir withIntermediateDirectories:YES attributes:nil error:nil] )
NSLog(@"[CJ-FUNC] ERROR: tmp/wav directory creation failed");
else
NSLog(@"[CJ-FUNC] tmp/wav directory created");
}
[fileMgr release];
int encRes = DecodeAMRFileToWAVEFile(
[[arguments objectAtIndex:0] cStringUsingEncoding:NSASCIIStringEncoding],
[wavPath cStringUsingEncoding:NSASCIIStringEncoding]
);
if ( encRes <= 0 )
[self writeJavascript:[NSString stringWithFormat:@"%@();", [arguments objectAtIndex:3]]];
else
[self writeJavascript:[NSString stringWithFormat:@"%@('%@');", [arguments objectAtIndex:2], wavPath]];
}
@end