IOS: Difference between revisions
(Rework page a little, add GStreamer information) |
No edit summary |
||
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
At least libogg, libvorbis, and libtheora build for and run on iOS without modification in their current incarnations. | At least libogg, libvorbis, and libtheora build for and run on iOS without modification in their current incarnations. | ||
== | == Cross-compiling == | ||
Cross-compile on OS X with Xcode command-line tools and the iOS SDK. You may have to install autoconf, | Cross-compile on OS X with Xcode command-line tools and the iOS SDK. You may have to install autoconf, automake, and libtool from Homebrew or manually. | ||
The cross-compiled | The cross-compiled autotools builds only generate one architecture at a time, so you may wish to combine the output libraries into 'universal' form using lipo. (The frameworks listed below do this for you in their build systems or leave linking to Xcode.) | ||
== CocoaPods == | |||
[https://cocoapods.org/ CocoaPods] is a source-centric package manager for iOS and Mac OS X projects built with Xcode. libogg, libvorbis, and libtheora packages [https://github.com/brion/OGVKit-Specs are in progress]. | |||
See [[#OGVKit]] for a player widget wrapping these packages. | |||
To use the low-level libraries directly in a CocoaPods app, add them to your Podfile: | |||
<pre> | |||
source 'https://github.com/CocoaPods/Specs.git' | |||
source 'https://github.com/brion/OGVKit-Specs.git' # temporary package home | |||
target 'MyProject' | |||
pod 'libtheora' | |||
pod 'libvorbis' | |||
# note 'libogg' will be automatically pulled in as a dependency | |||
end | |||
</pre> | |||
and re-run <code>pod install</code>. | |||
Todo: | |||
* use subspecs to enable/disable encoders | |||
* enable assembly acceleration for Theora | |||
* package libopus | |||
* upload the podspec to CocoaPods main repo | |||
* possibly upstream the podspec into the libraries | |||
== Frameworks == | == Frameworks == | ||
Line 30: | Line 58: | ||
May add a few dozen megs to your app size. | May add a few dozen megs to your app size. | ||
=== | === OGVKit === | ||
Work in progress package to build the libraries and wrap them with a high-level Objective-C interface that can be easily dropped into in an Xcode project: https://github.com/brion/OGVKit | |||
OGVKit is designed to be deployed as a [[#CocoaPods]] package, so it can be easily dropped into an Xcode project. | |||
Currently supports basic Ogg Theora/Vorbis and WebM VP8/Vorbis playback; seeking is in progress and the API is being cleaned up. | |||
<pre> | |||
source 'https://github.com/CocoaPods/Specs.git' | |||
source 'https://github.com/brion/OGVKit-Specs.git' # temporary package home | |||
target 'MyProject' | |||
pod 'OGVKit' | |||
end | |||
</pre> | |||
and re-run <code>pod install</code>. | |||
The package can be trimmed down with subspecs, for instance to include only Ogg Vorbis playback (thus skipping other codecs): | |||
<pre> | |||
pod 'OGVKit/Decoder/Ogg/Vorbis' | |||
</pre> | |||
Adds about 2-5MB to app size depending on options. | |||
=== Performance === | === Performance === | ||
See preliminary benchmarks at https://github.com/brion/ | See preliminary benchmarks at https://github.com/brion/OGVKit/wiki/Device-notes and https://github.com/brion/OGVKit/wiki/Energy-usage | ||
== OS integration == | == OS integration == | ||
Line 75: | Line 105: | ||
It is possible for an app that plays Ogg media to register its file types with the system, allowing other apps that may download files (Safari, Mail, Dropbox, etc) to prompt to open them in the player. | It is possible for an app that plays Ogg media to register its file types with the system, allowing other apps that may download files (Safari, Mail, Dropbox, etc) to prompt to open them in the player. | ||
VLC for iOS implements this but there are usability problems inherent in the system: Safari will download the entire file and '''then''' hand it off to the player, so you cannot play during the download. | |||
=== URL handler === | === URL handler === | ||
Line 83: | Line 113: | ||
It is possible for an app that plays Ogg media to register a URL handler, which would allow other apps or web content to launch the player. A remote URL could be included as a parameter on that URL, allowing apps or web content to hand off something to download-and-play progressively. | It is possible for an app that plays Ogg media to register a URL handler, which would allow other apps or web content to launch the player. A remote URL could be included as a parameter on that URL, allowing apps or web content to hand off something to download-and-play progressively. | ||
Unfortunately you can't do something like register for 'http[s]://*/*.ogv' -- you can only register a scheme such as 'x-ogvkit-player'. So you can't accept arbitrary HTTP or HTTPS links; the calling app or web content needs to know your app-specific URL scheme. | VLC for iOS implements this; prepend 'vlc:' to a URL to download or stream it in VLC. | ||
Unfortunately you can't do something like register for 'http[s]://*/*.ogv' -- you can only register a scheme such as 'vlc' or 'x-ogvkit-player'. So you can't accept arbitrary HTTP or HTTPS links; the calling app or web content needs to know your app-specific URL scheme. | |||
== Related projects == | == Related projects == |
Latest revision as of 05:14, 20 June 2015
At least libogg, libvorbis, and libtheora build for and run on iOS without modification in their current incarnations.
Cross-compiling
Cross-compile on OS X with Xcode command-line tools and the iOS SDK. You may have to install autoconf, automake, and libtool from Homebrew or manually.
The cross-compiled autotools builds only generate one architecture at a time, so you may wish to combine the output libraries into 'universal' form using lipo. (The frameworks listed below do this for you in their build systems or leave linking to Xcode.)
CocoaPods
CocoaPods is a source-centric package manager for iOS and Mac OS X projects built with Xcode. libogg, libvorbis, and libtheora packages are in progress.
See #OGVKit for a player widget wrapping these packages.
To use the low-level libraries directly in a CocoaPods app, add them to your Podfile:
source 'https://github.com/CocoaPods/Specs.git' source 'https://github.com/brion/OGVKit-Specs.git' # temporary package home target 'MyProject' pod 'libtheora' pod 'libvorbis' # note 'libogg' will be automatically pulled in as a dependency end
and re-run pod install
.
Todo:
- use subspecs to enable/disable encoders
- enable assembly acceleration for Theora
- package libopus
- upload the podspec to CocoaPods main repo
- possibly upstream the podspec into the libraries
Frameworks
GStreamer
GStreamer is available for iOS in the 0.10-based SDK from http://gstreamer.com/ or the mainline GStreamer 1.x series builds, includes Ogg codecs by default, and should automatically disable patented codecs if not enabled.
- Note that the GStreamer packaging for iOS does not provide a high-level Objective-C player widget, but sample code looks relatively straightforward to connect a GStreamer pipeline to a CAEGLLayer or such.
- Warning: the current build infrastructure only produces armv7 and 32-bit simulator builds of the libraries, which means you can't use it in a 64-bit build of your app.
Commercial consulting for the 0.10 SDK is available through GStreamer.com's partners Collabora and Fluendo.
May add about 13MB to app size, depending on options selected.
MobileVLCKit
MobileVLCKit wraps many codecs including the main Xiph ones, and has a high-level Objective-C player interface that can be instantiated immediately in an app.
However note that the build system compiles in *lots* of patented codecs by default, which may make this tricky for US-based developers.
VLC developers are pretty responsive, but concentrate on the VLC player case.
May add a few dozen megs to your app size.
OGVKit
Work in progress package to build the libraries and wrap them with a high-level Objective-C interface that can be easily dropped into in an Xcode project: https://github.com/brion/OGVKit
OGVKit is designed to be deployed as a #CocoaPods package, so it can be easily dropped into an Xcode project.
Currently supports basic Ogg Theora/Vorbis and WebM VP8/Vorbis playback; seeking is in progress and the API is being cleaned up.
source 'https://github.com/CocoaPods/Specs.git' source 'https://github.com/brion/OGVKit-Specs.git' # temporary package home target 'MyProject' pod 'OGVKit' end
and re-run pod install
.
The package can be trimmed down with subspecs, for instance to include only Ogg Vorbis playback (thus skipping other codecs):
pod 'OGVKit/Decoder/Ogg/Vorbis'
Adds about 2-5MB to app size depending on options.
Performance
See preliminary benchmarks at https://github.com/brion/OGVKit/wiki/Device-notes and https://github.com/brion/OGVKit/wiki/Energy-usage
OS integration
Native codecs
NO
iOS's native media framework is AVFoundation, which unfortunately is not extensible with codec or file type plugins. :(
It should be possible for an Obj-C wrapper library to use the same audio and video buffer types for input/output as AVFoundation does, however, which will make it easier to hook them up together for transcoding or live encoding from the camera.
File type handler
YES
It is possible for an app that plays Ogg media to register its file types with the system, allowing other apps that may download files (Safari, Mail, Dropbox, etc) to prompt to open them in the player.
VLC for iOS implements this but there are usability problems inherent in the system: Safari will download the entire file and then hand it off to the player, so you cannot play during the download.
URL handler
YES, BUT
It is possible for an app that plays Ogg media to register a URL handler, which would allow other apps or web content to launch the player. A remote URL could be included as a parameter on that URL, allowing apps or web content to hand off something to download-and-play progressively.
VLC for iOS implements this; prepend 'vlc:' to a URL to download or stream it in VLC.
Unfortunately you can't do something like register for 'http[s]://*/*.ogv' -- you can only register a scheme such as 'vlc' or 'x-ogvkit-player'. So you can't accept arbitrary HTTP or HTTPS links; the calling app or web content needs to know your app-specific URL scheme.
Related projects
- ogv.js JavaScript codec works in iOS Safari