iOS

From XiphWiki

Revision as of 20:28, 7 July 2014 by Brion (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

At least libogg, libvorbis, and libtheora build for and run on iOS without modification in their current incarnations.

Contents

Basic building

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; see #OgvKit for a relatively lightweight example.)

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

Experimental work in progress script 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

Adds about 2MB to app size.

Building

Build the C libraries first in a terminal:

  • Requires autoconf, automake, and libtool; can be installed via homebrew.
  • Run 'make' to build all C libraries

Once the C libs are built, you can fire up the OgvKit or OgvDemo projects in Xcode and run/test them directly:

  • OgvKit: Xcode project with the Obj-C wrapper built as a static library
  • OgvDemo: Xcode project with sample app, imports the OgvKit project


Notes

  • CLI makefile builds each library for armv7, armv7s, arm64 for devices and i386, x86_64 for simulator, then combines them to multi-arch universal binaries
  • wrapper library links to and encapsulates the low-level C libraries, so this should be usable in future Swift projects as well as Obj-C
  • libtheora
    • Must pass --disable-asm, as the asm code doesn't build for iOS (yet?) errs
    • doesn't build with iOS 7.1 SDK from the current git mirror -- need to get git mirror fixed or change build system to fetch from svn

Performance

See preliminary benchmarks at https://github.com/brion/OgvKit/wiki/Device-notes

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.

I have implemented an early test of this in OgvKit demo player; it works but, for instance 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.

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.

Related projects

  • ogv.js JavaScript codec works in iOS Safari


Retrieved from "http://wiki.xiph.org/IOS"
Personal tools


Main Page

Xiph.Org Projects

Audio—

Video—

Text—

Container—

Streaming—