Skip to content

Commit 1681892

Browse files
committed
Add usage of progress to SimpleVideoFileFilter example.
1 parent 5e004b8 commit 1681892

File tree

3 files changed

+70
-149
lines changed

3 files changed

+70
-149
lines changed

examples/iOS/SimpleVideoFileFilter/SimpleVideoFileFilter/SimpleVideoFileFilterViewController.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@
66
GPUImageMovie *movieFile;
77
GPUImageOutput<GPUImageInput> *filter;
88
GPUImageMovieWriter *movieWriter;
9+
NSTimer * timer;
910
}
1011

12+
@property (retain, nonatomic) IBOutlet UILabel *progressLabel;
1113
- (IBAction)updatePixelWidth:(id)sender;
1214

1315
@end

examples/iOS/SimpleVideoFileFilter/SimpleVideoFileFilter/SimpleVideoFileFilterViewController.m

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,31 @@ - (void)viewDidLoad
5151
[movieWriter startRecording];
5252
[movieFile startProcessing];
5353

54+
timer = [NSTimer scheduledTimerWithTimeInterval:0.3f
55+
target:self
56+
selector:@selector(retrievingProgress)
57+
userInfo:nil
58+
repeats:YES];
59+
5460
[movieWriter setCompletionBlock:^{
5561
[filter removeTarget:movieWriter];
5662
[movieWriter finishRecording];
63+
64+
dispatch_async(dispatch_get_main_queue(), ^{
65+
[timer invalidate];
66+
self.progressLabel.text = @"100%";
67+
});
5768
}];
5869
}
5970

71+
- (void)retrievingProgress
72+
{
73+
self.progressLabel.text = [NSString stringWithFormat:@"%d%%", (int)(movieFile.progress * 100)];
74+
}
75+
6076
- (void)viewDidUnload
6177
{
78+
[self setProgressLabel:nil];
6279
[super viewDidUnload];
6380
}
6481

@@ -73,4 +90,8 @@ - (IBAction)updatePixelWidth:(id)sender
7390
[(GPUImagePixellateFilter *)filter setFractionalWidthOfAPixel:[(UISlider *)sender value]];
7491
}
7592

93+
- (void)dealloc {
94+
[_progressLabel release];
95+
[super dealloc];
96+
}
7697
@end
Lines changed: 47 additions & 149 deletions
Original file line numberDiff line numberDiff line change
@@ -1,149 +1,47 @@
1-
<?xml version="1.0" encoding="UTF-8"?>
2-
<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="8.00">
3-
<data>
4-
<int key="IBDocument.SystemTarget">1024</int>
5-
<string key="IBDocument.SystemVersion">13A510d</string>
6-
<string key="IBDocument.InterfaceBuilderVersion">4457.9</string>
7-
<string key="IBDocument.AppKitVersion">1242.11</string>
8-
<string key="IBDocument.HIToolboxVersion">683.00</string>
9-
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
10-
<string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
11-
<string key="NS.object.0">3682.9</string>
12-
</object>
13-
<array key="IBDocument.IntegratedClassDependencies">
14-
<string>IBProxyObject</string>
15-
<string>IBUISlider</string>
16-
<string>IBUIView</string>
17-
</array>
18-
<array key="IBDocument.PluginDependencies">
19-
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
20-
</array>
21-
<object class="NSMutableDictionary" key="IBDocument.Metadata">
22-
<string key="NS.key.0">PluginDependencyRecalculationVersion</string>
23-
<integer value="1" key="NS.object.0"/>
24-
</object>
25-
<array class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
26-
<object class="IBProxyObject" id="372490531">
27-
<string key="IBProxiedObjectIdentifier">IBFilesOwner</string>
28-
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
29-
</object>
30-
<object class="IBProxyObject" id="975951072">
31-
<string key="IBProxiedObjectIdentifier">IBFirstResponder</string>
32-
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
33-
</object>
34-
<object class="IBUIView" id="191373211">
35-
<nil key="NSNextResponder"/>
36-
<int key="NSvFlags">274</int>
37-
<array class="NSMutableArray" key="NSSubviews">
38-
<object class="IBUISlider" id="601521545">
39-
<reference key="NSNextResponder" ref="191373211"/>
40-
<int key="NSvFlags">266</int>
41-
<string key="NSFrame">{{18, 418}, {284, 23}}</string>
42-
<reference key="NSSuperview" ref="191373211"/>
43-
<string key="NSReuseIdentifierKey">_NS:623</string>
44-
<bool key="IBUIOpaque">NO</bool>
45-
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
46-
<int key="IBUIContentHorizontalAlignment">0</int>
47-
<int key="IBUIContentVerticalAlignment">0</int>
48-
<float key="IBUIValue">0.10000000149011612</float>
49-
<float key="IBUIMaxValue">0.20000000298023224</float>
50-
</object>
51-
</array>
52-
<string key="NSFrame">{{0, 20}, {320, 460}}</string>
53-
<reference key="NSNextKeyView" ref="601521545"/>
54-
<object class="NSColor" key="IBUIBackgroundColor">
55-
<int key="NSColorSpace">3</int>
56-
<bytes key="NSWhite">MQA</bytes>
57-
<object class="NSColorSpace" key="NSCustomColorSpace">
58-
<int key="NSID">2</int>
59-
</object>
60-
</object>
61-
<object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics"/>
62-
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
63-
</object>
64-
</array>
65-
<object class="IBObjectContainer" key="IBDocument.Objects">
66-
<bool key="usesAutoincrementingIDs">NO</bool>
67-
<array class="NSMutableArray" key="connectionRecords">
68-
<object class="IBConnectionRecord">
69-
<object class="IBCocoaTouchOutletConnection" key="connection">
70-
<string key="label">view</string>
71-
<reference key="source" ref="372490531"/>
72-
<reference key="destination" ref="191373211"/>
73-
</object>
74-
<string key="id">3</string>
75-
</object>
76-
<object class="IBConnectionRecord">
77-
<object class="IBCocoaTouchEventConnection" key="connection">
78-
<string key="label">updatePixelWidth:</string>
79-
<reference key="source" ref="601521545"/>
80-
<reference key="destination" ref="372490531"/>
81-
<int key="IBEventType">13</int>
82-
</object>
83-
<string key="id">5</string>
84-
</object>
85-
</array>
86-
<object class="IBMutableOrderedSet" key="objectRecords">
87-
<array key="orderedObjects">
88-
<object class="IBObjectRecord">
89-
<string key="id">0</string>
90-
<array key="object" id="0"/>
91-
<reference key="children" ref="1000"/>
92-
<nil key="parent"/>
93-
</object>
94-
<object class="IBObjectRecord">
95-
<string key="id">1</string>
96-
<reference key="object" ref="191373211"/>
97-
<array class="NSMutableArray" key="children">
98-
<reference ref="601521545"/>
99-
</array>
100-
<reference key="parent" ref="0"/>
101-
</object>
102-
<object class="IBObjectRecord">
103-
<string key="id">-1</string>
104-
<reference key="object" ref="372490531"/>
105-
<reference key="parent" ref="0"/>
106-
<string key="objectName">File's Owner</string>
107-
</object>
108-
<object class="IBObjectRecord">
109-
<string key="id">-2</string>
110-
<reference key="object" ref="975951072"/>
111-
<reference key="parent" ref="0"/>
112-
</object>
113-
<object class="IBObjectRecord">
114-
<string key="id">4</string>
115-
<reference key="object" ref="601521545"/>
116-
<reference key="parent" ref="191373211"/>
117-
</object>
118-
</array>
119-
</object>
120-
<dictionary class="NSMutableDictionary" key="flattenedProperties">
121-
<string key="-1.CustomClassName">SimpleVideoFileFilterViewController</string>
122-
<string key="-1.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
123-
<string key="-2.CustomClassName">UIResponder</string>
124-
<string key="-2.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
125-
<string key="1.CustomClassName">GPUImageView</string>
126-
<string key="1.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
127-
<string key="4.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
128-
</dictionary>
129-
<dictionary class="NSMutableDictionary" key="unlocalizedProperties"/>
130-
<nil key="activeLocalization"/>
131-
<dictionary class="NSMutableDictionary" key="localizations"/>
132-
<nil key="sourceID"/>
133-
</object>
134-
<object class="IBClassDescriber" key="IBDocument.Classes"/>
135-
<int key="IBDocument.localizationMode">0</int>
136-
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaTouchFramework</string>
137-
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults">
138-
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS</string>
139-
<real value="1024" key="NS.object.0"/>
140-
</object>
141-
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
142-
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3</string>
143-
<integer value="4600" key="NS.object.0"/>
144-
</object>
145-
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
146-
<int key="IBDocument.defaultPropertyAccessControl">3</int>
147-
<string key="IBCocoaTouchPluginVersion">3682.9</string>
148-
</data>
149-
</archive>
1+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="5056" systemVersion="13C64" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
3+
<dependencies>
4+
<deployment defaultVersion="1024" identifier="iOS"/>
5+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3733"/>
6+
</dependencies>
7+
<objects>
8+
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="SimpleVideoFileFilterViewController">
9+
<connections>
10+
<outlet property="progressLabel" destination="0Bh-Mw-8m8" id="iXn-m6-F5Y"/>
11+
<outlet property="view" destination="1" id="3"/>
12+
</connections>
13+
</placeholder>
14+
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
15+
<view contentMode="scaleToFill" id="1" customClass="GPUImageView">
16+
<rect key="frame" x="0.0" y="0.0" width="320" height="480"/>
17+
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
18+
<subviews>
19+
<slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" value="0.10000000149011612" minValue="0.0" maxValue="0.20000000298023224" id="4">
20+
<rect key="frame" x="18" y="432" width="284" height="29"/>
21+
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
22+
<connections>
23+
<action selector="updatePixelWidth:" destination="-1" eventType="valueChanged" id="5"/>
24+
</connections>
25+
</slider>
26+
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Progress :" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="a1V-Qt-sTP">
27+
<rect key="frame" x="176" y="27" width="86" height="30"/>
28+
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
29+
<color key="backgroundColor" red="0.38982780612244894" green="0.38982780612244894" blue="0.38982780612244894" alpha="1" colorSpace="calibratedRGB"/>
30+
<fontDescription key="fontDescription" type="system" pointSize="17"/>
31+
<color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
32+
<nil key="highlightedColor"/>
33+
</label>
34+
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="100%" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="0Bh-Mw-8m8">
35+
<rect key="frame" x="262" y="27" width="48" height="30"/>
36+
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
37+
<color key="backgroundColor" red="0.38982780610000001" green="0.38982780610000001" blue="0.38982780610000001" alpha="1" colorSpace="calibratedRGB"/>
38+
<fontDescription key="fontDescription" type="system" pointSize="17"/>
39+
<color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
40+
<nil key="highlightedColor"/>
41+
</label>
42+
</subviews>
43+
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
44+
<simulatedStatusBarMetrics key="simulatedStatusBarMetrics"/>
45+
</view>
46+
</objects>
47+
</document>

0 commit comments

Comments
 (0)