1 #import "ViewController.h"
2 #import "GStreamerBackend.h"
3 #import <UIKit/UIKit.h>
5 @interface ViewController () {
6 GStreamerBackend *gst_backend;
13 @implementation ViewController
16 * Methods from UIViewController
23 play_button.enabled = FALSE;
24 pause_button.enabled = FALSE;
26 /* Make these constant for now, later tutorials will change them */
30 gst_backend = [[GStreamerBackend alloc] init:self videoView:video_view];
33 - (void)didReceiveMemoryWarning
35 [super didReceiveMemoryWarning];
36 // Dispose of any resources that can be recreated.
39 /* Called when the Play button is pressed */
40 -(IBAction) play:(id)sender
45 /* Called when the Pause button is pressed */
46 -(IBAction) pause:(id)sender
51 - (void)viewDidLayoutSubviews
53 CGFloat view_width = video_container_view.bounds.size.width;
54 CGFloat view_height = video_container_view.bounds.size.height;
56 CGFloat correct_height = view_width * media_height / media_width;
57 CGFloat correct_width = view_height * media_width / media_height;
59 if (correct_height < view_height) {
60 video_height_constraint.constant = correct_height;
61 video_width_constraint.constant = view_width;
63 video_width_constraint.constant = correct_width;
64 video_height_constraint.constant = view_height;
69 * Methods from GstreamerBackendDelegate
72 -(void) gstreamerInitialized
74 dispatch_async(dispatch_get_main_queue(), ^{
75 play_button.enabled = TRUE;
76 pause_button.enabled = TRUE;
77 message_label.text = @"Ready";
81 -(void) gstreamerSetUIMessage:(NSString *)message
83 dispatch_async(dispatch_get_main_queue(), ^{
84 message_label.text = message;