• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*!
2 * \copy
3 *     Copyright (c)  2013, Cisco Systems
4 *     All rights reserved.
5 *
6 *     Redistribution and use in source and binary forms, with or without
7 *     modification, are permitted provided that the following conditions
8 *     are met:
9 *
10 *        * Redistributions of source code must retain the above copyright
11 *          notice, this list of conditions and the following disclaimer.
12 *
13 *        * Redistributions in binary form must reproduce the above copyright
14 *          notice, this list of conditions and the following disclaimer in
15 *          the documentation and/or other materials provided with the
16 *          distribution.
17 *
18 *     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 *     "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 *     LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
21 *     FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
22 *     COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
23 *     INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
24 *     BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 *     LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26 *     CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 *     LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
28 *     ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 *     POSSIBILITY OF SUCH DAMAGE.
30 *
31 */
32
33extern int EncMain(int argc, char **argv);
34
35#import "ViewController.h"
36
37
38@interface ViewController ()
39
40@end
41
42@implementation ViewController
43@synthesize statusText=statusText_;
44
45- (void)viewDidLoad
46{
47    [super viewDidLoad];
48    statusText_.text = @"Status: Ready for Go";
49}
50
51- (void)didReceiveMemoryWarning
52{
53    [super didReceiveMemoryWarning];
54}
55
56- (IBAction) buttonPressed:(id)sender
57{
58    NSBundle * bundle = [NSBundle mainBundle];
59    NSString * encCfg = [bundle pathForResource:@"welsenc_ios" ofType:@"cfg"];
60    NSString * dlayerCfg = [bundle pathForResource:@"layer2" ofType:@"cfg"];
61    NSString * yuvFile = [bundle pathForResource:@"CiscoVT2people_320x192_12fps" ofType:@"yuv"];
62    NSString * bsfile = [NSString stringWithFormat:@"%@/%@", [self getPathForWrite], @"test.264"];
63    NSLog(@"WELS_INFO: enc config file: %@, yuv file %@", encCfg, yuvFile);
64    const char * argv[] = {
65        "dummy",
66        [encCfg UTF8String],
67        "-org",
68        [yuvFile UTF8String],
69        "-bf",
70        [bsfile UTF8String],
71        "-numl",
72        "1",
73        "-lconfig",
74        "0",
75        [dlayerCfg UTF8String],
76    };
77    NSLog(@"WELS_INFO: enc config file: %@", encCfg);
78    EncMain(sizeof(argv)/sizeof(argv[0]), (char**)&argv[0]);
79    statusText_.text = @"Status: Test Over";
80}
81
82- (NSString*) getPathForWrite {
83    NSArray * pathes =  NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
84    NSString * documentDirectory = [pathes objectAtIndex:0];
85    return documentDirectory;
86}
87
88
89@end
90