使用一个框架时,我们可能有这么三个问题:
- 这个框架是做什么的?
- 为什么要使用这个框架而不是其他的框架?
- 怎么用这个框架?
这个框架是做什么的?
Apple 在 iOS Technology Overview 中的 Audio Technologies 和 Video Technologies 分别是这么介绍 AVFoundation 的:
AV Foundation is an Objective-C interface for managing the recording and playback of audio and video. Use this framework for recording audio and when you need fine-grained control over the audio playback process.
AV Foundation provides advanced video playback and recording capabilities. Use this framework in situations where you need more control over the presentation or recording of video. For example, augmented reality apps could use this framework to layer live video content with other app-provided content.
从这两个介绍中我们可以知道 AVFoundation 是用来播放和录制音频和视频的。
在 AVFoundation Programming Guide 中则是这么介绍的:
AVFoundation is one of several frameworks that you can use to play and create time-based audiovisual media. It provides an Objective-C interface you use to work on a detailed level with time-based audiovisual data. For example, you can use it to examine, create, edit, or reencode media files. You can also get input streams from devices and manipulate video during realtime capture and playback.
从这里我们可以知道它不仅可以播放和创建基于时间的视听媒体,还可以让我们在很细微的层面去操作这些视听数据。例如,你可以使用它检查、创建、编辑或者重编码媒体文件。你还可以用它从设备那里拿到输出流,并且可以在实时的捕获和播放过程中操作视频。
所以结论就是:这个框架是处理音频和视频的,而且处理的粒度可以非常细。
继续阅读