【发布时间】:2012-04-19 15:31:06
【问题描述】:
我了解要在 iOS 应用程序中使用 FFmpeg,您需要使用 ./configure 和 make 来生成 .a 文件,然后将其添加到项目中。
我的问题是,一旦 .a 文件出现在项目导航器和 Link Binary With Libraries 部分中,你如何在你的类中实际使用它们?我看到没有“框架”可以在#import 语句,所以我不知道如何访问类的方法和属性。
【问题讨论】:
我了解要在 iOS 应用程序中使用 FFmpeg,您需要使用 ./configure 和 make 来生成 .a 文件,然后将其添加到项目中。
我的问题是,一旦 .a 文件出现在项目导航器和 Link Binary With Libraries 部分中,你如何在你的类中实际使用它们?我看到没有“框架”可以在#import 语句,所以我不知道如何访问类的方法和属性。
【问题讨论】:
每个.a文件都有一些实现文件,每个实现文件都有一个接口文件,objc-c的实现文件是.m/.mm,接口文件是.h和C/C++一样,所以如果你想使用库,您需要导入头文件(.h)。头文件可以告诉你类的方法和属性
【讨论】:
您只需将头文件 (.h) 导入您的实现 (.m) 文件并继续。举个例子;
#import "avformat.h"
// Some code goes here
/*
* avformat_open_input(AVFormatContext **ps, const char *filename, AVInputFormat *fmt, AVDictionary **options)
*/
int openInputValue = avformat_open_input(&pFormatCtx, utf8FilePath, inputFormat, nil);
NSLog(@"%s - %d # openInputValue = %d", __PRETTY_FUNCTION__, __LINE__, openInputValue);
【讨论】: