Changeset 4659:3bbce4638653 in roaraudio


Ignore:
Timestamp:
12/12/10 22:53:18 (13 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

use VS API for roarvorbis

File:
1 edited

Legend:

Unmodified
Added
Removed
  • roarclients/roarvorbis.c

    r4656 r4659  
    8787 
    8888 
    89 int update_stream (struct roar_connection * con, 
    90                    struct roar_stream     * s, 
    91                    struct roar_vio_calls  * vio, 
    92                    OggVorbis_File         * vf, 
    93                    char                   * file, 
    94                    struct roar_audio_info * info, 
    95                    struct roar_vio_calls  * vclt) { 
     89int update_stream (struct roar_connection *  con, 
     90                   roar_vs_t              ** vss, 
     91                   OggVorbis_File         *  vf, 
     92                   char                   *  file, 
     93                   struct roar_audio_info *  info, 
     94                   struct roar_vio_calls  *  vclt) { 
     95 struct roar_stream     * s; 
    9696 vorbis_info *vi = ov_info(vf, -1); 
    9797 int    bits     = 16; 
    98  int    codec    = ROAR_CODEC_DEFAULT; 
     98 int    codec    = ROAR_CODEC_PCM_S_LE; 
    9999 char **ptr = ov_comment(vf, -1)->user_comments; 
    100100 char key[ROAR_META_MAX_NAMELEN], value[LIBROAR_BUFFER_MSGDATA] = {0}; 
     
    119119 
    120120 if ( need_new_stream ) { 
    121   if ( need_close ) 
    122    roar_vio_close(vio); 
     121  if ( need_close ) { 
     122   roar_vs_sync(*vss, ROAR_VS_WAIT, NULL); 
     123   roar_vs_close(*vss, ROAR_VS_FALSE, NULL); 
     124  } 
    123125 
    124126  fprintf(stderr, "Audio: %i channel, %liHz\n\n", vi->channels, vi->rate); 
     
    126128  info->rate     = vi->rate; 
    127129  info->channels = vi->channels; 
    128  
    129   if ( roar_vio_simple_new_stream_obj(vio, con, s, vi->rate, vi->channels, bits, codec, ROAR_DIR_PLAY) == -1 ) { 
     130  info->bits     = bits; 
     131  info->codec    = codec; 
     132 
     133  *vss = roar_vs_new_from_con(con, NULL); 
     134  if ( *vss == NULL ) { 
    130135   roar_disconnect(con); 
    131136   return -1; 
    132137  } 
     138 
     139  if ( roar_vs_stream(*vss, info, ROAR_DIR_PLAY, NULL) == -1 ) { 
     140   roar_vs_close(*vss, ROAR_VS_TRUE, NULL); 
     141   roar_disconnect(con); 
     142   return -1; 
     143  } 
     144 
    133145  need_new_stream = 0; 
    134146 } 
    135147 
     148 s = roar_vs_stream_obj(*vss, NULL); 
    136149 
    137150 meta.value = value; 
     
    192205   ptr++; 
    193206 } 
     207 
     208 fprintf(stderr, "\n"); 
    194209 
    195210 *value      = 0; 
     
    221236 int    i; 
    222237 struct roar_connection con; 
    223  struct roar_stream     s; 
    224  struct roar_vio_calls  vio; 
     238 roar_vs_t * vss = NULL; 
    225239 OggVorbis_File vf; 
    226240 int eof=0; 
     
    297311 
    298312  if ( last_section != current_section ) 
    299    if ( update_stream(&con, &s, &vio, &vf, file, &info, vcltfile == NULL ? NULL : &vclt) == -1 ) { 
     313   if ( update_stream(&con, &vss, &vf, file, &info, vcltfile == NULL ? NULL : &vclt) == -1 ) { 
    300314    roar_vio_close(&in); 
    301315    if ( vcltfile != NULL ) 
     
    313327      case we (the app) cares.  In this case, we don't. */ 
    314328  } else { 
    315    roar_vio_write(&vio, pcmout, ret); 
     329   roar_vs_write(vss, pcmout, ret, NULL); 
    316330  } 
    317331 } 
     
    320334 
    321335// fclose(in); 
    322  roar_vio_close(&vio); 
     336 roar_vs_close(vss, ROAR_VS_FALSE, NULL); 
    323337 roar_disconnect(&con); 
    324338 
Note: See TracChangeset for help on using the changeset viewer.