diff options
Diffstat (limited to 'sdk-ios-tutorial-link-against-gstreamer.md')
-rw-r--r-- | sdk-ios-tutorial-link-against-gstreamer.md | 73 |
1 files changed, 32 insertions, 41 deletions
diff --git a/sdk-ios-tutorial-link-against-gstreamer.md b/sdk-ios-tutorial-link-against-gstreamer.md index fdcf19d..7930593 100644 --- a/sdk-ios-tutorial-link-against-gstreamer.md +++ b/sdk-ios-tutorial-link-against-gstreamer.md @@ -1,30 +1,31 @@ # iOS tutorial 1: Link against GStreamer -# Goal![](attachments/thumbnails/3014792/3113601) +## Goal + +![screenshot] The first iOS tutorial is simple. The objective is to get the GStreamer version and display it on screen. It exemplifies how to link against the GStreamer library from Xcode using objective-C. -# Hello GStreamer\! +## Hello GStreamer! -The code for this project can be found in the tutorials folder of your -GStreamer SDK iOS installation. It was created using the GStreamer -Single View Application template. The view contains only a -`UILabel` that will be used to display the GStreamer's version to the -user. +The code for this project can be found in the tutorials folder of +**FIXME: where**. It was created using the GStreamer Single View +Application template. The view contains only a `UILabel` that will be +used to display the GStreamer's version to the user. -# The User Interface +## The User Interface -The UI uses storyboards and contains a single `View` with a centered -`UILabel`. The `ViewController` for the `View` links its -`label` variable to this `UILabel` as an `IBOutlet`. +The UI uses storyboards and contains a single `View` with a centered +`UILabel`. The `ViewController` for the `View` links its +`label` variable to this `UILabel` as an `IBOutlet`. **ViewController.h** ``` #import <UIKit/UIKit.h> - + @interface ViewController : UIViewController { IBOutlet UILabel *label; } @@ -34,18 +35,18 @@ The UI uses storyboards and contains a single `View` with a centered @end ``` -# The GStreamer backend +## The GStreamer backend All GStreamer-handling code is kept in a single Objective-C class called `GStreamerBackend`. In successive tutorials it will get expanded, but, for now, it only contains a method to retrieve the GStreamer version. -The `GStreamerBackend` is made in Objective-C so it can take care of the +The `GStreamerBackend` is made in Objective-C so it can take care of the few C-to-Objective-C conversions that might be necessary (like `char -*` to `NSString *`, for example). This eases the usage of this class by +*` to `NSString *`, for example). This eases the usage of this class by the UI code, which is typically made in pure Objective-C. -`GStreamerBackend` serves exactly the same purpose as the JNI code in -the [Android tutorials](Android%2Btutorials.html). +`GStreamerBackend` serves exactly the same purpose as the JNI code in +the [](sdk-android-tutorials.md). **GStreamerBackend.m** @@ -67,19 +68,19 @@ the [Android tutorials](Android%2Btutorials.html). @end ``` -The `getGStreamerVersion()` method simply calls -`gst_version_string()` to obtain a string describing this version of -GStreamer. This [Modified -UTF8](http://en.wikipedia.org/wiki/UTF-8#Modified_UTF-8) string is then -converted to a `NSString *` by ` NSString:stringWithUTF8String `and +The `getGStreamerVersion()` method simply calls +`gst_version_string()` to obtain a string describing this version of +GStreamer. This [Modified +UTF8](http://en.wikipedia.org/wiki/UTF-8#Modified_UTF-8) string is then +converted to a `NSString *` by ` NSString:stringWithUTF8String `and returned. Objective-C will take care of freeing the memory used by the -new `NSString *`, but we need to free the `char *` returned -by `gst_version_string()`. +new `NSString *`, but we need to free the `char *` returned +by `gst_version_string()`. -# The View Controller +## The View Controller The view controller instantiates the GStremerBackend and asks it for the -GStreamer version to display at the label. That's it\! +GStreamer version to display at the label. That's it! **ViewController.m** @@ -115,28 +116,18 @@ GStreamer version to display at the label. That's it\! @end ``` -# Conclusion +## Conclusion This ends the first iOS tutorial. It has shown that, due to the -compatibility of C and Objective-C, adding GStreamer support to an iOS +compatibility of C and Objective-C, adding GStreamer support to an iOS app is as easy as it is on a Desktop application. An extra Objective-C -wrapper has been added (the `GStreamerBackend` class) for clarity, but +wrapper has been added (the `GStreamerBackend` class) for clarity, but calls to the GStreamer framework are valid from any part of the application code. The following tutorials detail the few places in which care has to be taken when developing specifically for the iOS platform. -It has been a pleasure having you here, and see you soon\! - -## Attachments: +It has been a pleasure having you here, and see you soon! -![](images/icons/bullet_blue.gif) -[ios-tutorial1-screenshot.png](attachments/3014792/3113602.png) -(image/png) -![](images/icons/bullet_blue.gif) -[ios-tutorial1-screenshot.png](attachments/3014792/3113603.png) -(image/png) -![](images/icons/bullet_blue.gif) -[ios-tutorial1-screenshot.png](attachments/3014792/3113601.png) -(image/png) + [screenshot]: images/sdk-ios-tutorial-link-against-gstreamer-screenshot.png
\ No newline at end of file |