Index: ChangeLog
===================================================================
--- ChangeLog	(revision 4611)
+++ ChangeLog	(revision 4614)
@@ -8,4 +8,5 @@
 	* Added RSound's new 32 bit support to libroarrsound
 	* Updated docs
+	* Support dir parameter in OINFO command (Closes: #31)
 
 v. 0.4beta1 - Mon Nov 01 2010 16:14 CET
Index: include/libroar/ctl.h
===================================================================
--- include/libroar/ctl.h	(revision 4384)
+++ include/libroar/ctl.h	(revision 4614)
@@ -47,4 +47,5 @@
 int roar_terminate      (struct roar_connection * con, int terminate);
 int roar_server_oinfo   (struct roar_connection * con, struct roar_stream * s);
+int roar_server_oinfo2  (struct roar_connection * con, struct roar_stream * s, int dir);
 
 
Index: libroar/ctl.c
===================================================================
--- libroar/ctl.c	(revision 4385)
+++ libroar/ctl.c	(revision 4614)
@@ -56,5 +56,9 @@
 }
 
-int roar_server_oinfo   (struct roar_connection * con, struct roar_stream * sa) {
+int roar_server_oinfo   (struct roar_connection * con, struct roar_stream * s) {
+ return roar_server_oinfo2(con, s, -1);
+}
+
+int roar_server_oinfo2  (struct roar_connection * con, struct roar_stream * s, int dir) {
  struct roar_message mes;
 
@@ -62,5 +66,12 @@
 
  mes.cmd     = ROAR_CMD_SERVER_OINFO;
- mes.datalen = 0;
+
+ if ( dir == -1 ) {
+  mes.datalen = 0;
+ } else {
+  mes.datalen = 2;
+  mes.data[0] = 0;
+  mes.data[1] = dir;
+ }
 
  if ( roar_req(con, &mes, NULL) == -1 )
@@ -70,5 +81,5 @@
   return -1;
 
- if ( roar_stream_m2s(sa, &mes) == -1 )
+ if ( roar_stream_m2s(s, &mes) == -1 )
   return -1;
 
Index: roarclients/roarctl.c
===================================================================
--- roarclients/roarctl.c	(revision 4603)
+++ roarclients/roarctl.c	(revision 4614)
@@ -116,4 +116,5 @@
         "  serverinfo              - Gets general information about the server\n"
         "  serveroinfo             - Gets Information about server output\n"
+        "  serveroinfo2 DIR        - Gets Information about server output for stream direction dir\n"
         "  serverstandards         - Gets list of server supported standards\n"
         "  listclients             - Gets Information about clients\n"
@@ -231,8 +232,8 @@
 #undef _pm
 
-void server_oinfo (struct roar_connection * con) {
+void server_oinfo (struct roar_connection * con, int dir) {
  struct roar_stream s;
 
- if ( roar_server_oinfo(con, &s) == -1 ) {
+ if ( roar_server_oinfo2(con, &s, dir) == -1 ) {
   fprintf(stderr, "Error: can not get server output info\n");
   return;
@@ -1145,5 +1146,12 @@
    server_info(&con);
   } else if ( !strcmp(k, "serveroinfo") ) {
-   server_oinfo(&con);
+   server_oinfo(&con, -1);
+  } else if ( !strcmp(k, "serveroinfo2") ) {
+   t = roar_str2dir(argv[++i]);
+   if ( t == -1 ) {
+    fprintf(stderr, "Error: unknown stream direction: %s\n", argv[i]);
+   } else {
+    server_oinfo(&con, t);
+   }
   } else if ( !strcmp(k, "serverstandards") ) {
    server_standards(&con);
@@ -1153,5 +1161,5 @@
    list_streams(&con);
   } else if ( !strcmp(k, "allinfo") ) {
-   server_oinfo(&con);
+   server_oinfo(&con, -1);
    printf("\n");
    list_clients(&con);
Index: roard/include/streams.h
===================================================================
--- roard/include/streams.h	(revision 4552)
+++ roard/include/streams.h	(revision 4614)
@@ -136,4 +136,5 @@
 int streams_set_role   (int id, int role);
 
+int streams_dir2subsys (int dir);
 int streams_get_subsys (int id);
 int streams_get_ssdir  (int id);
Index: roard/req.c
===================================================================
--- roard/req.c	(revision 4552)
+++ roard/req.c	(revision 4614)
@@ -624,5 +624,19 @@
 int req_on_server_oinfo    (int client, struct roar_message * mes, char ** data, uint32_t flags[2]) {
  struct roar_stream s;
+ int dir = ROAR_DIR_PLAY;
+ int subsys;
 //ROAR_DIR_OUTPUT
+
+ if ( mes->datalen != 0 ) {
+  if ( mes->datalen != 2 )
+   return -1;
+
+  if ( mes->data[0] != 0 )
+   return -1;
+
+  dir = mes->data[1];
+ }
+
+ subsys = streams_dir2subsys(dir);
 
  memset(&s, 0, sizeof(struct roar_stream));
@@ -630,9 +644,41 @@
  s.dir           = ROAR_DIR_MIXING;
  s.pos_rel_id    = -1;
- s.info.rate     = g_sa->rate;
- s.info.bits     = g_sa->bits;
- s.info.channels = g_sa->channels;
- s.info.codec    = g_sa->codec;
- s.pos           = g_pos;
+
+ switch (subsys) {
+  case ROAR_SUBSYS_WAVEFORM:
+    s.info.rate     = g_sa->rate;
+    s.info.bits     = g_sa->bits;
+    s.info.channels = g_sa->channels;
+    s.info.codec    = g_sa->codec;
+    s.pos           = g_pos;
+   break;
+#ifndef ROAR_WITHOUT_DCOMP_MIDI
+  case ROAR_SUBSYS_MIDI:
+   break;
+#endif
+#ifndef ROAR_WITHOUT_DCOMP_LIGHT
+  case ROAR_SUBSYS_LIGHT:
+    s.info.rate     = ROAR_OUTPUT_CFREQ;
+    s.info.bits     = ROAR_LIGHT_BITS;
+    s.info.channels = g_light_state.channels;
+   break;
+#endif
+#ifndef ROAR_WITHOUT_DCOMP_RAW
+  case ROAR_SUBSYS_RAW:
+    // no need to set anything here.
+   break;
+#endif
+#ifndef ROAR_WITHOUT_DCOMP_RDTCS
+  case ROAR_SUBSYS_RDTCS:
+    s.info.rate     = ROAR_OUTPUT_CFREQ;
+    s.info.bits     = ROAR_RDTCS_BITS;
+    s.info.channels = ROAR_RDTCS_CHANNELS;
+    s.info.codec    = ROAR_RDTCS_CODEC;
+   break;
+#endif
+  default:
+    return -1;
+   break;
+ }
 
  if ( roar_stream_s2m(&s, mes) == -1 )
Index: roard/streams.c
===================================================================
--- roard/streams.c	(revision 4553)
+++ roard/streams.c	(revision 4614)
@@ -447,5 +447,12 @@
   return -1;
 
- switch (ROAR_STREAM(ss)->dir) {
+ if ( ROAR_STREAM(ss)->dir == ROAR_DIR_THRU )
+  return streams_get_subsys(ROAR_STREAM(ss)->pos_rel_id);
+
+ return streams_dir2subsys(ROAR_STREAM(ss)->dir);
+}
+
+int streams_dir2subsys (int dir) {
+ switch (dir) {
   case ROAR_DIR_PLAY:
   case ROAR_DIR_RECORD:
@@ -471,7 +478,4 @@
   case ROAR_DIR_COMPLEX_OUT:
     return ROAR_SUBSYS_COMPLEX;
-   break;
-  case ROAR_DIR_THRU:
-    return streams_get_subsys(ROAR_STREAM(ss)->pos_rel_id);
    break;
   case ROAR_DIR_MIXING:
