void* user_data;
rdpContext* rdpcontext;
+ wLog* log;
} AudinOpenSLESDevice;
static DWORD WINAPI audin_opensles_thread_func(LPVOID arg)
int rc = CHANNEL_RC_OK;
UINT error = CHANNEL_RC_OK;
DWORD status;
- DEBUG_DVC("opensles=%p", (void*) opensles);
+ WLog_Print(opensles->log, WLOG_DEBUG, "opensles=%p", (void*) opensles);
assert(opensles);
assert(opensles->frames_per_packet > 0);
assert(opensles->stopEvent);
if (!buffer.v)
{
error = CHANNEL_RC_NO_MEMORY;
- WLog_ERR(TAG, "calloc failed!");
+ WLog_Print(opensles->log, WLOG_ERROR, "calloc failed!");
if (opensles->rdpcontext)
setChannelError(opensles->rdpcontext, CHANNEL_RC_NO_MEMORY,
if (status == WAIT_FAILED)
{
error = GetLastError();
- WLog_ERR(TAG, "WaitForSingleObject failed with error %"PRIu32"!", error);
+ WLog_Print(opensles->log, WLOG_ERROR, "WaitForSingleObject failed with error %"PRIu32"!", error);
break;
}
if (rc < 0)
{
- WLog_ERR(TAG, "android_RecIn %d", rc);
+ WLog_Print(opensles->log, WLOG_ERROR, "android_RecIn %d", rc);
continue;
}
free(buffer.v);
out:
- DEBUG_DVC("thread shutdown.");
+ WLog_Print(opensles->log, WLOG_DEBUG, "thread shutdown.");
if (error && opensles->rdpcontext)
setChannelError(opensles->rdpcontext, error, "audin_opensles_thread_func reported an error");
static UINT audin_opensles_free(IAudinDevice* device)
{
AudinOpenSLESDevice* opensles = (AudinOpenSLESDevice*) device;
- DEBUG_DVC("device=%p", (void*) device);
+ WLog_Print(opensles->log, WLOG_DEBUG, "device=%p", (void*) device);
/* The function may have been called out of order,
* ignore duplicate requests. */
static BOOL audin_opensles_format_supported(IAudinDevice* device,
const AUDIO_FORMAT* format)
{
-#ifdef WITH_DEBUG_DVC
AudinOpenSLESDevice* opensles = (AudinOpenSLESDevice*) device;
-#endif
- DEBUG_DVC("device=%p, format=%p", (void*) opensles, (void*) format);
+ WLog_Print(opensles->log, WLOG_DEBUG, "device=%p, format=%p", (void*) opensles, (void*) format);
assert(format);
switch (format->wFormatTag)
break;
default:
- DEBUG_DVC("Encoding '%s' [0x%04X"PRIX16"] not supported",
- rdpsnd_get_audio_tag_string(format->wFormatTag),
- format->wFormatTag);
+ WLog_Print(opensles->log, WLOG_DEBUG, "Encoding '%s' [0x%04X"PRIX16"] not supported",
+ rdpsnd_get_audio_tag_string(format->wFormatTag),
+ format->wFormatTag);
break;
}
const AUDIO_FORMAT* format, UINT32 FramesPerPacket)
{
AudinOpenSLESDevice* opensles = (AudinOpenSLESDevice*) device;
- DEBUG_DVC("device=%p, format=%p, FramesPerPacket=%"PRIu32"",
- (void*) device, (void*) format, FramesPerPacket);
+ WLog_Print(opensles->log, WLOG_DEBUG, "device=%p, format=%p, FramesPerPacket=%"PRIu32"",
+ (void*) device, (void*) format, FramesPerPacket);
assert(format);
/* The function may have been called out of order, ignore
break;
default:
- WLog_ERR(TAG, "Encoding '%"PRIu16"' [%04"PRIX16"] not supported",
- format->wFormatTag,
- format->wFormatTag);
+ WLog_Print(opensles->log, WLOG_ERROR, "Encoding '%"PRIu16"' [%04"PRIX16"] not supported",
+ format->wFormatTag,
+ format->wFormatTag);
return ERROR_UNSUPPORTED_TYPE;
}
- DEBUG_DVC("aligned frames_per_packet=%"PRIu32", block_size=%"PRIu32"",
- opensles->frames_per_packet, opensles->block_size);
+ WLog_Print(opensles->log, WLOG_DEBUG, "frames_per_packet=%"PRIu32,
+ opensles->frames_per_packet);
return CHANNEL_RC_OK;
}
void* user_data)
{
AudinOpenSLESDevice* opensles = (AudinOpenSLESDevice*) device;
- DEBUG_DVC("device=%p, receive=%p, user_data=%p", (void*) device, (void*) receive,
- (void*) user_data);
+ WLog_Print(opensles->log, WLOG_DEBUG, "device=%p, receive=%p, user_data=%p", (void*) device,
+ (void*) receive,
+ (void*) user_data);
assert(opensles);
/* The function may have been called out of order,
opensles->frames_per_packet,
opensles->format.wBitsPerSample)))
{
- WLog_ERR(TAG, "android_OpenRecDevice failed!");
+ WLog_Print(opensles->log, WLOG_ERROR, "android_OpenRecDevice failed!");
return ERROR_INTERNAL_ERROR;
}
if (!(opensles->stopEvent = CreateEvent(NULL, TRUE, FALSE, NULL)))
{
- WLog_ERR(TAG, "CreateEvent failed!");
+ WLog_Print(opensles->log, WLOG_ERROR, "CreateEvent failed!");
goto error_out;
}
if (!(opensles->thread = CreateThread(NULL, 0,
audin_opensles_thread_func, opensles, 0, NULL)))
{
- WLog_ERR(TAG, "CreateThread failed!");
+ WLog_Print(opensles->log, WLOG_ERROR, "CreateThread failed!");
goto error_out;
}
{
UINT error;
AudinOpenSLESDevice* opensles = (AudinOpenSLESDevice*) device;
- DEBUG_DVC("device=%p", (void*) device);
+ WLog_Print(opensles->log, WLOG_DEBUG, "device=%p", (void*) device);
assert(opensles);
/* The function may have been called out of order,
* ignore duplicate requests. */
if (!opensles->stopEvent)
{
- WLog_ERR(TAG, "[ERROR] function called without matching open.");
+ WLog_Print(opensles->log, WLOG_ERROR, "[ERROR] function called without matching open.");
return ERROR_REQUEST_OUT_OF_SEQUENCE;
}
if (WaitForSingleObject(opensles->thread, INFINITE) == WAIT_FAILED)
{
error = GetLastError();
- WLog_ERR(TAG, "WaitForSingleObject failed with error %"PRIu32"", error);
+ WLog_Print(opensles->log, WLOG_ERROR, "WaitForSingleObject failed with error %"PRIu32"", error);
return error;
}
DWORD flags;
COMMAND_LINE_ARGUMENT_A* arg;
AudinOpenSLESDevice* opensles = (AudinOpenSLESDevice*) device;
- DEBUG_DVC("device=%p, args=%p", (void*) device, (void*) args);
+ WLog_Print(opensles->log, WLOG_DEBUG, "device=%p, args=%p", (void*) device, (void*) args);
flags = COMMAND_LINE_SIGIL_NONE | COMMAND_LINE_SEPARATOR_COLON | COMMAND_LINE_IGN_UNKNOWN_KEYWORD;
status = CommandLineParseArgumentsA(args->argc, args->argv,
audin_opensles_args, flags, opensles, NULL, NULL);
if (!opensles->device_name)
{
- WLog_ERR(TAG, "_strdup failed!");
+ WLog_Print(opensles->log, WLOG_ERROR, "_strdup failed!");
return CHANNEL_RC_NO_MEMORY;
}
}
ADDIN_ARGV* args;
AudinOpenSLESDevice* opensles;
UINT error;
- DEBUG_DVC("pEntryPoints=%p", (void*) pEntryPoints);
opensles = (AudinOpenSLESDevice*) calloc(1, sizeof(AudinOpenSLESDevice));
if (!opensles)
return CHANNEL_RC_NO_MEMORY;
}
+ opensles->log = WLog_Get(TAG);
opensles->iface.Open = audin_opensles_open;
opensles->iface.FormatSupported = audin_opensles_format_supported;
opensles->iface.SetFormat = audin_opensles_set_format;
if ((error = audin_opensles_parse_addin_args(opensles, args)))
{
- WLog_ERR(TAG, "audin_opensles_parse_addin_args failed with errorcode %"PRIu32"!", error);
+ WLog_Print(opensles->log, WLOG_ERROR,
+ "audin_opensles_parse_addin_args failed with errorcode %"PRIu32"!", error);
goto error_out;
}
if ((error = pEntryPoints->pRegisterAudinDevice(pEntryPoints->plugin, (IAudinDevice*) opensles)))
{
- WLog_ERR(TAG, "RegisterAudinDevice failed with error %"PRIu32"!", error);
+ WLog_Print(opensles->log, WLOG_ERROR, "RegisterAudinDevice failed with error %"PRIu32"!", error);
goto error_out;
}
SLresult result;
// create engine
result = slCreateEngine(&(p->engineObject), 0, NULL, 0, NULL, NULL);
- DEBUG_DVC("engineObject=%p", (void*) p->engineObject);
if (result != SL_RESULT_SUCCESS) goto engine_end;
// realize the engine
result = (*p->engineObject)->Realize(p->engineObject, SL_BOOLEAN_FALSE);
- DEBUG_DVC("Realize=%"PRIu32"", result);
if (result != SL_RESULT_SUCCESS) goto engine_end;
// get the engine interface, which is needed in order to create other objects
result = (*p->engineObject)->GetInterface(p->engineObject, SL_IID_ENGINE,
&(p->engineEngine));
- DEBUG_DVC("engineEngine=%p", (void*) p->engineEngine);
if (result != SL_RESULT_SUCCESS) goto engine_end;
// get the volume interface - important, this is optional!
result = (*p->engineObject)->GetInterface(p->engineObject, SL_IID_DEVICEVOLUME,
&(p->deviceVolume));
- DEBUG_DVC("deviceVolume=%p", (void*) p->deviceVolume);
if (result != SL_RESULT_SUCCESS)
{
const SLboolean req[] = {SL_BOOLEAN_TRUE};
result = (*p->engineEngine)->CreateAudioRecorder(p->engineEngine,
&(p->recorderObject), &audioSrc, &audioSnk, 1, id, req);
- DEBUG_DVC("p->recorderObject=%p", (void*) p->recorderObject);
assert(!result);
if (SL_RESULT_SUCCESS != result) goto end_recopen;
// realize the audio recorder
result = (*p->recorderObject)->Realize(p->recorderObject, SL_BOOLEAN_FALSE);
- DEBUG_DVC("Realize=%"PRIu32"", result);
assert(!result);
if (SL_RESULT_SUCCESS != result) goto end_recopen;
// get the record interface
result = (*p->recorderObject)->GetInterface(p->recorderObject,
SL_IID_RECORD, &(p->recorderRecord));
- DEBUG_DVC("p->recorderRecord=%p", (void*) p->recorderRecord);
assert(!result);
if (SL_RESULT_SUCCESS != result) goto end_recopen;
result = (*p->recorderObject)->GetInterface(p->recorderObject,
SL_IID_ANDROIDSIMPLEBUFFERQUEUE,
&(p->recorderBufferQueue));
- DEBUG_DVC("p->recorderBufferQueue=%p", (void*) p->recorderBufferQueue);
assert(!result);
if (SL_RESULT_SUCCESS != result) goto end_recopen;
// register callback on the buffer queue
result = (*p->recorderBufferQueue)->RegisterCallback(p->recorderBufferQueue,
bqRecorderCallback, p);
- DEBUG_DVC("p->recorderBufferQueue=%p", (void*) p->recorderBufferQueue);
assert(!result);
if (SL_RESULT_SUCCESS != result)
// close the OpenSL IO and destroy the audio engine
static void openSLDestroyEngine(OPENSL_STREAM* p)
{
- DEBUG_DVC("p=%p", (void*) p);
-
// destroy audio recorder object, and invalidate all associated interfaces
if (p->recorderObject != NULL)
{
// close the android audio device
void android_CloseRecDevice(OPENSL_STREAM* p)
{
- DEBUG_DVC("p=%p", (void*) p);
-
if (p == NULL)
return;
{
queue_element* e;
OPENSL_STREAM* p = (OPENSL_STREAM*) context;
- DEBUG_DVC("p=%p", (void*) p);
assert(p);
assert(p->next);
assert(p->prep);