Changeset 5221:aa6530a03260 in roaraudio for roarclients


Ignore:
Timestamp:
11/12/11 12:25:21 (12 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

Removed old functions from API (Closes: #186)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • roarclients/roarcatplay.c

    r5109 r5221  
    3535 printf("  --server SERVER    - Set server hostname\n" 
    3636        "  --simple           - Use the simple interface (default)\n" 
    37         "  --passive          - Use passiv playback (experimental, works only localy)\n" 
    38         "  --background       - Use background playback, impleys passive mode\n" 
    3937        "  --verbose          - Use verbose output\n" 
    4038        "  --help             - Show this help\n" 
     
    4341} 
    4442 
    45 #define MODE_SIMPLE  1 
    46 #define MODE_PASSIVE 2 
    47  
    4843int main (int argc, char * argv[]) { 
    4944 char * server   = NULL; 
     
    5146 int    i; 
    5247 char * file    = NULL; 
    53  int    mode    = MODE_SIMPLE; 
    54  int    bg      = 0; 
    5548 int    verbose = 0; 
    5649 roar_vs_t * vss; 
    5750 int err; 
    58 #ifdef ROAR_HAVE_UNIX 
    59  struct roar_connection con[1]; 
    60  struct roar_stream     stream[1]; 
    61 #endif 
    6251 
    6352 for (i = 1; i < argc; i++) { 
     
    6756   server = argv[++i]; 
    6857  } else if ( strcmp(k, "--simple") == 0 ) { 
    69    mode = MODE_SIMPLE; 
    70   } else if ( strcmp(k, "--passive") == 0 ) { 
    71    mode = MODE_PASSIVE; 
    72   } else if ( strcmp(k, "--background") == 0 ) { 
    73    bg = 1; 
     58   /* no op */ 
    7459  } else if ( strcmp(k, "--verbose") == 0 || strcmp(k, "-v") == 0 ) { 
    7560   verbose++; 
     
    8671 } 
    8772 
    88  if ( bg ) 
    89   mode = MODE_PASSIVE; 
    90  
    91 #ifndef ROAR_HAVE_UNIX 
    92  if ( mode == MODE_PASSIVE ) { 
    93   fprintf(stderr, "Error: passive mode is not supported on this system.\n"); 
    94   return 1; 
    95  } 
    96 #endif 
    97  
    98  if ( mode == MODE_PASSIVE ) { 
    99   fprintf(stderr, "Warning: passive mode is obsoleted and will be removed soon.\n"); 
    100  } 
    101  
    10273 if ( file == NULL ) 
    10374  file = "/dev/stdin"; 
    10475 
    105 #ifdef ROAR_HAVE_UNIX 
    106  if ( mode == MODE_PASSIVE ) { 
    107   if ( roar_simple_connect(con, server, "roarcatplay") == -1 ) { 
    108    ROAR_ERR("Can not connect to server"); 
    109    return 0; 
    110   } 
    111  
    112   if ( roar_file_play_full(con, file, 0, 1, stream) == -1 ) { 
    113    ROAR_ERR("Can not start playback"); 
    114    return 1; 
    115   } 
    116  
    117   if ( bg ) { 
    118    if ( roar_stream_attach_simple(con, stream, 0) == -1 ) { 
    119     ROAR_ERR("Can not attach stream to server"); 
    120    } 
    121   } else { 
    122    roar_sleep(10); 
    123   } 
    124  
    125   roar_disconnect(con); 
    126  
    127  } else { // MODE_SIMPLE 
    128 #endif 
    129   if ( (vss = roar_vs_new_from_file(server, "roarcatplay", file, &err)) == NULL ) { 
    130    ROAR_ERR("Can not start playback: %s", roar_error2str(err)); 
    131    return 1; 
    132   } 
    133   roar_vs_run(vss, NULL); 
    134   roar_vs_sync(vss, ROAR_VS_WAIT, NULL); 
    135   roar_vs_close(vss, ROAR_VS_FALSE, NULL); 
    136 #ifdef ROAR_HAVE_UNIX 
     76 if ( (vss = roar_vs_new_from_file(server, "roarcatplay", file, &err)) == NULL ) { 
     77  ROAR_ERR("Can not start playback: %s", roar_error2str(err)); 
     78  return 1; 
    13779 } 
    138 #endif 
     80 roar_vs_run(vss, NULL); 
     81 roar_vs_sync(vss, ROAR_VS_WAIT, NULL); 
     82 roar_vs_close(vss, ROAR_VS_FALSE, NULL); 
    13983 
    14084 return 0; 
Note: See TracChangeset for help on using the changeset viewer.