Changeset 3630:89a9079f8e3f in roaraudio for libroar/stream.c


Ignore:
Timestamp:
03/08/10 02:23:23 (14 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

implemented roles, still need some support to set them

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libroar/stream.c

    r3540 r3630  
    394394 memset(info, 0, sizeof(struct roar_stream_info)); 
    395395 info->mixer = -1; 
     396 info->role  = ROAR_ROLE_UNKNOWN; 
    396397 
    397398 info->block_size     = data[2]; 
     
    419420 } else { 
    420421  info->mixer         = data[10]; 
     422 } 
     423 
     424 if ( m.datalen < 12*2 ) { 
     425  return 0; 
     426 } else { 
     427  info->role          = data[11]; 
    421428 } 
    422429 
     
    858865} 
    859866 
     867struct { 
     868 int    role; 
     869 char * name; 
     870} _libroar_role[] = { 
     871 {ROAR_ROLE_UNKNOWN,          "unknown"         }, 
     872 {ROAR_ROLE_NONE,             "none"            }, 
     873 {ROAR_ROLE_MUSIC,            "music"           }, 
     874 {ROAR_ROLE_VIDEO,            "video"           }, 
     875 {ROAR_ROLE_GAME,             "game"            }, 
     876 {ROAR_ROLE_EVENT,            "event"           }, 
     877 {ROAR_ROLE_BEEP,             "beep"            }, 
     878 {ROAR_ROLE_PHONE,            "phone"           }, 
     879 {ROAR_ROLE_BACKGROUND_MUSIC, "background music"}, 
     880 {ROAR_ROLE_BACKGROUND_MUSIC, "background_music"}, // alias 
     881 {-1, NULL} 
     882}; 
     883 
     884int    roar_str2role  (char * role) { 
     885 int i; 
     886 
     887 for (i = 0; _libroar_role[i].name != NULL; i++) 
     888  if ( !strcasecmp(_libroar_role[i].name, role) ) 
     889   return _libroar_role[i].role; 
     890 
     891 return ROAR_ROLE_UNKNOWN; 
     892} 
     893 
     894char * roar_role2str  (int    role) { 
     895 int i; 
     896 
     897 for (i = 0; _libroar_role[i].name != NULL; i++) 
     898  if ( _libroar_role[i].role == role ) 
     899   return _libroar_role[i].name; 
     900 
     901 return "unknown"; 
     902} 
     903 
    860904//ll 
Note: See TracChangeset for help on using the changeset viewer.