Don't look up pid/tid on YAGL_LOG_FUNC_SET
[sdk/emulator/qemu.git] / audio / ossaudio.c
index bdc4b76..0edd7ea 100644 (file)
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-#include <stdlib.h>
-#include <sys/mman.h>
-#include <sys/types.h>
+#include "qemu/osdep.h"
 #include <sys/ioctl.h>
 #include <sys/soundcard.h>
 #include "qemu-common.h"
 #include "qemu/main-loop.h"
 #include "qemu/host-utils.h"
 #include "audio.h"
+#include "trace.h"
 
 #define AUDIO_CAP "oss"
 #include "audio_int.h"
@@ -44,7 +43,6 @@ typedef struct OSSConf {
     int fragsize;
     const char *devpath_out;
     const char *devpath_in;
-    int debug;
     int exclusive;
     int policy;
 } OSSConf;
@@ -314,9 +312,7 @@ static int oss_open (int in, struct oss_params *req,
         int version;
 
         if (!oss_get_version (fd, &version, typ)) {
-            if (conf->debug) {
-                dolog ("OSS version = %#x\n", version);
-            }
+            trace_oss_version(version);
 
             if (version >= 0x040000) {
                 int policy = conf->policy;
@@ -427,7 +423,6 @@ static int oss_run_out (HWVoiceOut *hw, int live)
     struct audio_buf_info abinfo;
     struct count_info cntinfo;
     int bufsize;
-    OSSConf *conf = oss->conf;
 
     bufsize = hw->samples << hw->info.shift;
 
@@ -452,19 +447,12 @@ static int oss_run_out (HWVoiceOut *hw, int live)
         }
 
         if (abinfo.bytes > bufsize) {
-            if (conf->debug) {
-                dolog ("warning: Invalid available size, size=%d bufsize=%d\n"
-                       "please report your OS/audio hw to av1474@comtv.ru\n",
-                       abinfo.bytes, bufsize);
-            }
+            trace_oss_invalid_available_size(abinfo.bytes, bufsize);
             abinfo.bytes = bufsize;
         }
 
         if (abinfo.bytes < 0) {
-            if (conf->debug) {
-                dolog ("warning: Invalid available size, size=%d bufsize=%d\n",
-                       abinfo.bytes, bufsize);
-            }
+            trace_oss_invalid_available_size(abinfo.bytes, bufsize);
             return 0;
         }
 
@@ -852,7 +840,6 @@ static OSSConf glob_conf = {
     .fragsize = 4096,
     .devpath_out = "/dev/dsp",
     .devpath_in = "/dev/dsp",
-    .debug = 0,
     .exclusive = 0,
     .policy = 5
 };
@@ -864,6 +851,7 @@ static void *oss_audio_init (void)
 
     if (access(conf->devpath_in, R_OK | W_OK) < 0 ||
         access(conf->devpath_out, R_OK | W_OK) < 0) {
+        g_free(conf);
         return NULL;
     }
     return conf;
@@ -909,7 +897,7 @@ static struct audio_option oss_options[] = {
         .name  = "EXCLUSIVE",
         .tag   = AUD_OPT_BOOL,
         .valp  = &glob_conf.exclusive,
-        .descr = "Open device in exclusive mode (vmix wont work)"
+        .descr = "Open device in exclusive mode (vmix won't work)"
     },
 #ifdef USE_DSP_POLICY
     {
@@ -919,12 +907,6 @@ static struct audio_option oss_options[] = {
         .descr = "Set the timing policy of the device, -1 to use fragment mode",
     },
 #endif
-    {
-        .name  = "DEBUG",
-        .tag   = AUD_OPT_BOOL,
-        .valp  = &glob_conf.debug,
-        .descr = "Turn on some debugging messages"
-    },
     { /* End of list */ }
 };