Changeset 3630:89a9079f8e3f in roaraudio


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

Files:
7 edited

Legend:

Unmodified
Added
Removed
  • include/libroar/stream.h

    r3538 r3630  
    7676#define ROAR_STREAMSTATE_CLOSING    4 
    7777 
     78// PA currently defines: video, music, game, event, phone, animation, production, a11y 
     79// RA includes         : YES    YES    YES   YES    YES    NO         NO          NO 
     80 
     81#define ROAR_ROLE_UNKNOWN          -1 
     82#define ROAR_ROLE_NONE              0 
     83#define ROAR_ROLE_MUSIC             1 
     84#define ROAR_ROLE_VIDEO             2 
     85#define ROAR_ROLE_GAME              3 
     86#define ROAR_ROLE_EVENT             4 
     87#define ROAR_ROLE_BEEP              5 
     88#define ROAR_ROLE_PHONE             6 
     89#define ROAR_ROLE_BACKGROUND_MUSIC  7 
     90 
    7891struct roar_stream_info { 
    7992 int block_size; 
     
    8699 int state; 
    87100 int mixer; 
     101 int role; 
    88102}; 
    89103 
     
    134148char * roar_streamstate2str(int streamstate); 
    135149 
     150int    roar_str2role  (char * role); 
     151char * roar_role2str  (int    role); 
     152 
    136153#endif 
    137154 
  • 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 
  • roarclients/roarctl.c

    r3560 r3630  
    384384     printf("Stream state          : %s\n",   roar_streamstate2str(info.state)); 
    385385 
     386    if ( g_verbose > 1 ) 
     387     printf("Stream role           : %s\n",   roar_role2str(info.role)); 
     388 
    386389    *flags = 0; 
    387390    if ( info.flags & ROAR_FLAG_PRIMARY ) 
  • roard/beep.c

    r3582 r3630  
    165165 } 
    166166 
     167 if ( streams_set_role(stream, ROAR_ROLE_BEEP) == -1 ) { 
     168  streams_delete(stream); 
     169  return -1; 
     170 } 
     171 
    167172 if ( (buf = beep_fill_buffer(beep, &(s->info))) == NULL ) { 
    168173  streams_delete(stream); 
  • roard/include/streams.h

    r3542 r3630  
    9191 int mixer_stream; 
    9292 struct roardsp_chanmap chanmap; 
     93 int role; 
    9394} * g_streams[ROAR_STREAMS_MAX]; 
    9495 
     
    110111int streams_set_mixer_stream(int id, int mixer); 
    111112int streams_get_mixer_stream(int id, int mixer); 
     113 
     114int streams_set_role   (int id, int role); 
    112115 
    113116int streams_get_subsys (int id); 
  • roard/req.c

    r3575 r3630  
    596596    audio_info = &(s->info); 
    597597 
    598     mes->datalen = 2*11; 
     598    mes->datalen = 2*12; 
    599599 
    600600    d[ 2] = ROAR_OUTPUT_CALC_OUTBUFSIZE(audio_info); 
     
    607607    d[ 9] = (ss->flags & 0xFFFF0000) >> 16; 
    608608    d[10] = ss->mixer_stream; 
     609    d[11] = ss->role; 
    609610 
    610611    ROAR_DBG("req_on_get_stream_para(*): ss->driver_id=%i", ss->driver_id); 
  • roard/streams.c

    r3557 r3630  
    107107   s->prethru         = NULL; 
    108108   s->mixer_stream    = -1; 
     109   s->role            = ROAR_ROLE_UNKNOWN; 
    109110 
    110111   s->mixer.scale     = 65535; 
     
    376377} 
    377378 
     379int streams_set_role   (int id, int role) { 
     380 struct roar_stream_server * ss; 
     381 
     382 _CHECK_SID(id); 
     383 
     384 if ( (ss = g_streams[id]) == NULL ) 
     385  return -1; 
     386 
     387 ss->role = role; 
     388 
     389 return 0; 
     390} 
     391 
    378392int streams_get_subsys (int id) { 
    379393 struct roar_stream_server * ss; 
Note: See TracChangeset for help on using the changeset viewer.