Changeset 220:abcf312e32d6 in roaraudio
- Timestamp:
- 07/22/08 13:12:48 (16 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
roard/codecfilter_cmd.c
r200 r220 2 2 3 3 #include "roard.h" 4 5 #define CMDMAXLEN 1024 4 6 5 7 int cf_cmd_open(CODECFILTER_USERDATA_T * inst, int codec, … … 8 10 int socks[2]; 9 11 int execed = -1; 12 char cmd[CMDMAXLEN+1] = {0}; 13 char * tmp = NULL; 14 char tb[CMDMAXLEN+1]; 15 char * o = filter->options; 16 int i; 17 18 if ( !o ) 19 return -1; 20 21 for (i = 0; i < CMDMAXLEN && *o != 0; i++, o++) { 22 if ( *o == '%' ) { 23 // printf("ol: *o='%c' (escape)\n", *o); 24 tmp = NULL; 25 26 o++; 27 if ( *o == 0 ) { 28 break; 29 } else if ( *o == 'R' ) { 30 tmp = tb; 31 snprintf(tb, CMDMAXLEN, "%i", g_sa->rate); 32 } else if ( *o == 'B' ) { 33 tmp = tb; 34 snprintf(tb, CMDMAXLEN, "%i", g_sa->bits); 35 } else if ( *o == 'C' ) { 36 tmp = tb; 37 snprintf(tb, CMDMAXLEN, "%i", g_sa->channels); 38 } 39 40 // printf("*o='%c', tmp=%p\n", *o, tmp); 41 42 if ( tmp ) { 43 for (; i < CMDMAXLEN && *tmp != 0; i++, tmp++) 44 cmd[i] = *tmp; 45 i--; 46 } 47 } else { 48 // printf("ol: *o='%c' (copy to cmd[i=%i])\n", *o, i); 49 cmd[i] = *o; 50 } 51 } 52 53 cmd[i+1] = 0; 54 55 printf("cmd='%s'\n", cmd); 10 56 11 57 if ( socketpair(AF_UNIX, SOCK_STREAM, 0, socks) == -1 ) { … … 13 59 } 14 60 15 if ( lib_run_bg( filter->options, ((struct roar_stream*)info)->fh, socks[1], ROAR_STDERR, socks, 2) == -1 )61 if ( lib_run_bg(cmd, ((struct roar_stream*)info)->fh, socks[1], ROAR_STDERR, socks, 2) == -1 ) 16 62 return -1; 17 63
Note: See TracChangeset
for help on using the changeset viewer.