Changeset 4584:959c2d722ca8 in roaraudio


Ignore:
Timestamp:
11/05/10 00:53:04 (12 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

enable VS file API to handle mime-types

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libroar/vs.c

    r4581 r4584  
    236236 ssize_t ret; 
    237237 int dir = O_RDONLY; 
    238  int codec; 
     238 int codec = -1; 
     239 const char * content_type; 
    239240 
    240241 _ckvss(-1); 
     
    266267 
    267268 if ( !(vss->flags & FLAG_STREAM) ) { 
    268   ret = roar_vio_read(file, buf, sizeof(buf)); 
    269  
    270   codec = roar_file_codecdetect(buf, ret); 
    271  
    272   if ( vss->info.codec == -1 ) { 
    273    roar_vio_close(file); 
    274    return -1; 
     269  if ( roar_vio_ctl(file, ROAR_VIO_CTL_GET_MIMETYPE, &content_type) != -1 ) { 
     270   codec = roar_mime2codec(content_type); 
     271  } 
     272 
     273  if ( codec == -1 ) { 
     274   ret = roar_vio_read(file, buf, sizeof(buf)); 
     275 
     276   codec = roar_file_codecdetect(buf, ret); 
     277 
     278   if ( codec == -1 ) { 
     279    roar_vio_close(file); 
     280    return -1; 
     281   } 
     282 
     283   if ( roar_vio_lseek(file, 0, SEEK_SET) != 0 ) { 
     284    roar_vio_close(file); 
     285    return -1; 
     286   } 
    275287  } 
    276288 
     
    281293  vss->info.codec    = codec; 
    282294  vss->info.bits     = ROAR_BITS_DEFAULT; 
    283  
    284   if ( roar_vio_lseek(file, 0, SEEK_SET) != 0 ) { 
    285    roar_vio_close(file); 
    286    return -1; 
    287   } 
    288295 
    289296  ret = roar_vs_stream(vss, &(vss->info), ROAR_DIR_PLAY, error); 
Note: See TracChangeset for help on using the changeset viewer.