John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 1 | /* |
John Koleszar | c2140b8 | 2010-09-09 08:16:39 -0400 | [diff] [blame] | 2 | * Copyright (c) 2010 The WebM project authors. All Rights Reserved. |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 3 | * |
John Koleszar | 94c52e4 | 2010-06-18 12:39:21 -0400 | [diff] [blame] | 4 | * Use of this source code is governed by a BSD-style license |
John Koleszar | 09202d8 | 2010-06-04 16:19:40 -0400 | [diff] [blame] | 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 |
John Koleszar | 94c52e4 | 2010-06-18 12:39:21 -0400 | [diff] [blame] | 7 | * in the file PATENTS. All contributing project authors may |
John Koleszar | 09202d8 | 2010-06-04 16:19:40 -0400 | [diff] [blame] | 8 | * be found in the AUTHORS file in the root of the source tree. |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 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 | |
| 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 | } |