• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *  Copyright (c) 2010 The WebM project authors. All Rights Reserved.
3  *
4  *  Use of this source code is governed by a BSD-style license
5  *  that can be found in the LICENSE file in the root of the source
6  *  tree. An additional intellectual property rights grant can be found
7  *  in the file PATENTS.  All contributing project authors may
8  *  be found in the AUTHORS file in the root of the source tree.
9  */
10 
11 
12 /* This program is created to take command arguments and pass
13  * them to main() in example.c or example_xma.c, because the
14  * correspending part in example.c or example_xma.c does not
15  * work on Pocket PC platform.
16  * To modify the command arguments, go to "Property" page and
17  * fill in "Command arguments." For example:
18  *  --codec vp6 --flipuv --progress _bnd.vp6
19  */
20 #include <stdio.h>
21 #include <stdlib.h>
22 #include <string.h>
23 
24 #define MAX_NUM_ARG 64
25 #define MAX_SIZ_ARG 512
26 
27 extern "C"
28 {
29     int main(int argc, char **argv);
30 }
31 
wmain(int argc,wchar_t ** argv)32 int wmain(int argc, wchar_t **argv) {
33     char *cargv[MAX_NUM_ARG];
34     char chargv[MAX_SIZ_ARG];
35     int ret;
36 
37     /* transform command line arguments from (wchar_t *) to (char *) */
38     for(int i=0; i<argc; i++) {
39         wcstombs( chargv, argv[i], sizeof(chargv));
40         cargv[i] = _strdup(chargv);
41     }
42 
43     ret = main(argc, (char **)cargv);
44 
45     //free the memory located by _strdup()
46     for(int i=0; i<argc; i++)
47         free(cargv[i]);
48 
49     return ret;
50 }
51