Commit bfdefb79 authored by Ghislain MARY's avatar Ghislain MARY

Add Visual Studio project for Windows 10.

parent d69288a1
......@@ -31,7 +31,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
const IID IID_IAudioCaptureClient = __uuidof(IAudioCaptureClient);
const IID IID_IAudioRenderClient = __uuidof(IAudioRenderClient);
#if BUILD_FOR_WINDOWS_PHONE
#if defined(MS2_WINDOWS_PHONE) || defined(MS2_WINDOWS_UNIVERSAL)
const IID IID_IAudioClient2 = __uuidof(IAudioClient2);
#else
const IID IID_IAudioClient = __uuidof(IAudioClient);
......@@ -44,18 +44,17 @@ const IID IID_IMMDeviceEnumerator = __uuidof(IMMDeviceEnumerator);
*****************************************************************************/
static void ms_wasapi_read_init(MSFilter *f) {
MSWASAPIReader *r = new MSWASAPIReader();
MSWASAPIReaderPtr r = MSWASAPIReaderNew();
f->data = r;
}
static void ms_wasapi_read_preprocess(MSFilter *f) {
MSWASAPIReader *r = (MSWASAPIReader *)f->data;
MSWASAPIReaderType r = MSWASAPI_READER(f->data);
r->activate();
}
static void ms_wasapi_read_process(MSFilter *f) {
MSWASAPIReader *r = (MSWASAPIReader *)f->data;
MSWASAPIReaderType r = MSWASAPI_READER(f->data);
if (!r->isStarted()) {
r->start();
}
......@@ -63,14 +62,14 @@ static void ms_wasapi_read_process(MSFilter *f) {
}
static void ms_wasapi_read_postprocess(MSFilter *f) {
MSWASAPIReader *r = (MSWASAPIReader *)f->data;
MSWASAPIReaderType r = MSWASAPI_READER(f->data);
r->stop();
r->deactivate();
}
static void ms_wasapi_read_uninit(MSFilter *f) {
MSWASAPIReader *r = (MSWASAPIReader *)f->data;
delete r;
MSWASAPIReaderPtr ptr = static_cast<MSWASAPIReaderPtr>(f->data);
delete ptr;
}
......@@ -85,7 +84,7 @@ static int ms_wasapi_read_set_sample_rate(MSFilter *f, void *arg) {
}
static int ms_wasapi_read_get_sample_rate(MSFilter *f, void *arg) {
MSWASAPIReader *r = (MSWASAPIReader *)f->data;
MSWASAPIReaderType r = MSWASAPI_READER(f->data);
*((int *)arg) = r->getRate();
return 0;
}
......@@ -97,7 +96,7 @@ static int ms_wasapi_read_set_nchannels(MSFilter *f, void *arg) {
}
static int ms_wasapi_read_get_nchannels(MSFilter *f, void *arg) {
MSWASAPIReader *r = (MSWASAPIReader *)f->data;
MSWASAPIReaderType r = MSWASAPI_READER(f->data);
*((int *)arg) = r->getNChannels();
return 0;
}
......@@ -174,18 +173,17 @@ MS_FILTER_DESC_EXPORT(ms_wasapi_read_desc)
*****************************************************************************/
static void ms_wasapi_write_init(MSFilter *f) {
MSWASAPIWriter *w = new MSWASAPIWriter();
MSWASAPIWriterPtr w = MSWASAPIWriterNew();
f->data = w;
}
static void ms_wasapi_write_preprocess(MSFilter *f) {
MSWASAPIWriter *w = (MSWASAPIWriter *)f->data;
MSWASAPIWriterType w = MSWASAPI_WRITER(f->data);
w->activate();
}
static void ms_wasapi_write_process(MSFilter *f) {
MSWASAPIWriter *w = (MSWASAPIWriter *)f->data;
MSWASAPIWriterType w = MSWASAPI_WRITER(f->data);
if (!w->isStarted()) {
w->start();
}
......@@ -193,14 +191,14 @@ static void ms_wasapi_write_process(MSFilter *f) {
}
static void ms_wasapi_write_postprocess(MSFilter *f) {
MSWASAPIWriter *w = (MSWASAPIWriter *)f->data;
MSWASAPIWriterType w = MSWASAPI_WRITER(f->data);
w->stop();
w->deactivate();
}
static void ms_wasapi_write_uninit(MSFilter *f) {
MSWASAPIWriter *w = (MSWASAPIWriter *)f->data;
delete w;
MSWASAPIWriterPtr ptr = static_cast<MSWASAPIWriterPtr>(f->data);
delete ptr;
}
......@@ -215,7 +213,7 @@ static int ms_wasapi_write_set_sample_rate(MSFilter *f, void *arg) {
}
static int ms_wasapi_write_get_sample_rate(MSFilter *f, void *arg) {
MSWASAPIWriter *w = (MSWASAPIWriter *)f->data;
MSWASAPIWriterType w = MSWASAPI_WRITER(f->data);
*((int *)arg) = w->getRate();
return 0;
}
......@@ -227,7 +225,7 @@ static int ms_wasapi_write_set_nchannels(MSFilter *f, void *arg) {
}
static int ms_wasapi_write_get_nchannels(MSFilter *f, void *arg) {
MSWASAPIWriter *w = (MSWASAPIWriter *)f->data;
MSWASAPIWriterType w = MSWASAPI_WRITER(f->data);
*((int *)arg) = w->getNChannels();
return 0;
}
......@@ -329,7 +327,7 @@ static MSSndCardDesc ms_wasapi_snd_card_desc = {
NULL
};
#if BUILD_FOR_WINDOWS_PHONE
#if defined(MS2_WINDOWS_PHONE) || defined(MS2_WINDOWS_UNIVERSAL)
static MSSndCard *ms_wasapi_phone_snd_card_new(void) {
MSSndCard *card = ms_snd_card_new(&ms_wasapi_snd_card_desc);
card->name = ms_strdup("WASAPI sound card");
......@@ -449,7 +447,7 @@ error:
#endif
static void ms_wasapi_snd_card_detect(MSSndCardManager *m) {
#if BUILD_FOR_WINDOWS_PHONE
#if defined(MS2_WINDOWS_PHONE) || defined(MS2_WINDOWS_UNIVERSAL)
MSSndCard *card = ms_wasapi_phone_snd_card_new();
ms_snd_card_manager_add_card(m, card);
#else
......@@ -464,7 +462,7 @@ static void ms_wasapi_snd_card_detect(MSSndCardManager *m) {
static MSFilter *ms_wasapi_snd_card_create_reader(MSSndCard *card) {
MSFilter *f = ms_filter_new_from_desc(&ms_wasapi_read_desc);
WasapiSndCard *wasapicard = static_cast<WasapiSndCard *>(card->data);
MSWASAPIReader *reader = static_cast<MSWASAPIReader *>(f->data);
MSWASAPIReaderType reader = MSWASAPI_READER(f->data);
reader->init(wasapicard->id);
return f;
}
......@@ -472,7 +470,7 @@ static MSFilter *ms_wasapi_snd_card_create_reader(MSSndCard *card) {
static MSFilter *ms_wasapi_snd_card_create_writer(MSSndCard *card) {
MSFilter *f = ms_filter_new_from_desc(&ms_wasapi_write_desc);
WasapiSndCard *wasapicard = static_cast<WasapiSndCard *>(card->data);
MSWASAPIWriter *writer = static_cast<MSWASAPIWriter *>(f->data);
MSWASAPIWriterType writer = MSWASAPI_WRITER(f->data);
writer->init(wasapicard->id);
return f;
}
......
......@@ -23,23 +23,27 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#pragma once
#if !defined(WINAPI_FAMILY_PARTITION) || !defined(WINAPI_PARTITION_PHONE)
/* Old version of Visual Studio, no support of Windows Phone. */
#define BUILD_FOR_WINDOWS_PHONE 0
#else
#define BUILD_FOR_WINDOWS_PHONE WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE)
#endif
#include <mediastreamer2/mscommon.h>
#include <vector>
#include <objbase.h>
#include <audioclient.h>
#if BUILD_FOR_WINDOWS_PHONE
#ifdef MS2_WINDOWS_UNIVERSAL
#include <wrl\implements.h>
#endif
#ifdef MS2_WINDOWS_PHONE
#include <phoneaudioclient.h>
#else
#include <mmdeviceapi.h>
#include <functiondiscoverykeys_devpkey.h>
#endif
#ifdef MS2_WINDOWS_UNIVERSAL
using namespace Microsoft::WRL;
using namespace Windows::Media::Devices;
#endif
#define REPORT_ERROR(msg, result) \
if (result != S_OK) { \
ms_error(msg, result); \
......@@ -62,7 +66,7 @@ extern const IID IID_IAudioClient2;
extern const IID IID_IAudioCaptureClient;
extern const IID IID_IAudioRenderClient;
#if !BUILD_FOR_WINDOWS_PHONE
#ifdef MS2_WINDOWS_DESKTOP
extern const CLSID CLSID_MMDeviceEnumerator;
extern const IID IID_IMMDeviceEnumerator;
#endif
......@@ -51,13 +51,26 @@ bool MSWASAPIReader::smInstantiated = false;
MSWASAPIReader::MSWASAPIReader()
: mAudioClient(NULL), mAudioCaptureClient(NULL), mBufferFrameCount(0), mIsInitialized(false), mIsActivated(false), mIsStarted(false)
{
#ifdef MS2_WINDOWS_UNIVERSAL
mActivationEvent = CreateEventEx(nullptr, nullptr, 0, EVENT_ALL_ACCESS);
if (!mActivationEvent) {
ms_error("Could not create activation event of the MSWASAPI audio input interface [%i]", GetLastError());
return;
}
#endif
}
MSWASAPIReader::~MSWASAPIReader()
{
RELEASE_CLIENT(mAudioClient);
#if BUILD_FOR_WINDOWS_PHONE
#ifdef MS2_WINDOWS_PHONE
FREE_PTR(mCaptureId);
#endif
#ifdef MS2_WINDOWS_UNIVERSAL
if (mActivationEvent != INVALID_HANDLE_VALUE) {
CloseHandle(mActivationEvent);
mActivationEvent = INVALID_HANDLE_VALUE;
}
#endif
smInstantiated = false;
}
......@@ -67,9 +80,29 @@ void MSWASAPIReader::init(LPCWSTR id)
{
HRESULT result;
WAVEFORMATEX *pWfx = NULL;
#if defined(MS2_WINDOWS_PHONE) || defined(MS2_WINDOWS_UNIVERSAL)
AudioClientProperties properties = { 0 };
#endif
#if BUILD_FOR_WINDOWS_PHONE
AudioClientProperties properties;
#if defined(MS2_WINDOWS_UNIVERSAL)
ComPtr<IActivateAudioInterfaceAsyncOperation> asyncOp;
mCaptureId = MediaDevice::GetDefaultAudioCaptureId(AudioDeviceRole::Communications);
if (mCaptureId == nullptr) {
ms_error("Could not get the CaptureID of the MSWASAPI audio input interface");
goto error;
}
if (smInstantiated) {
ms_error("An MSWASAPIReader is already instantiated. A second one can not be created.");
goto error;
}
result = ActivateAudioInterfaceAsync(mCaptureId->Data(), IID_IAudioClient2, nullptr, this, &asyncOp);
REPORT_ERROR("Could not activate the MSWASAPI audio input interface [%i]", result);
WaitForSingleObjectEx(mActivationEvent, INFINITE, FALSE);
if (mAudioClient == nullptr) {
ms_error("Could not create the MSWASAPI audio input interface client");
goto error;
}
#elif defined(MS2_WINDOWS_PHONE)
mCaptureId = GetDefaultAudioCaptureId(Communications);
if (mCaptureId == NULL) {
ms_error("Could not get the CaptureId of the MSWASAPI audio input interface");
......@@ -83,11 +116,6 @@ void MSWASAPIReader::init(LPCWSTR id)
result = ActivateAudioInterface(mCaptureId, IID_IAudioClient2, (void **)&mAudioClient);
REPORT_ERROR("Could not activate the MSWASAPI audio input interface [%x]", result);
properties.cbSize = sizeof AudioClientProperties;
properties.bIsOffload = false;
properties.eCategory = AudioCategory_Communications;
result = mAudioClient->SetClientProperties(&properties);
REPORT_ERROR("Could not set properties of the MSWASAPI audio output interface [%x]", result);
#else
IMMDeviceEnumerator *pEnumerator = NULL;
IMMDevice *pDevice = NULL;
......@@ -101,6 +129,13 @@ void MSWASAPIReader::init(LPCWSTR id)
result = pDevice->Activate(IID_IAudioClient, CLSCTX_ALL, NULL, (void **)&mAudioClient);
SAFE_RELEASE(pDevice);
REPORT_ERROR("mswasapi: Could not activate the capture device", result);
#endif
#if defined(MS2_WINDOWS_PHONE) || defined(MS2_WINDOWS_UNIVERSAL)
properties.cbSize = sizeof(AudioClientProperties);
properties.bIsOffload = false;
properties.eCategory = AudioCategory_Communications;
result = mAudioClient->SetClientProperties(&properties);
REPORT_ERROR("Could not set properties of the MSWASAPI audio input interface [%x]", result);
#endif
result = mAudioClient->GetMixFormat(&pWfx);
REPORT_ERROR("Could not get the mix format of the MSWASAPI audio input interface [%x]", result);
......@@ -129,7 +164,7 @@ int MSWASAPIReader::activate()
if (!mIsInitialized) goto error;
#if BUILD_FOR_WINDOWS_PHONE
#ifdef MS2_WINDOWS_PHONE
flags = AUDCLNT_SESSIONFLAGS_EXPIREWHENUNOWNED | AUDCLNT_SESSIONFLAGS_DISPLAY_HIDE | AUDCLNT_SESSIONFLAGS_DISPLAY_HIDEWHENEXPIRED;
#endif
......@@ -254,4 +289,53 @@ void MSWASAPIReader::silence(MSFilter *f)
memset(om->b_wptr, 0, bufsize);
om->b_wptr += bufsize;
ms_queue_put(f->outputs[0], om);
}
\ No newline at end of file
}
#ifdef MS2_WINDOWS_UNIVERSAL
//
// ActivateCompleted()
//
// Callback implementation of ActivateAudioInterfaceAsync function. This will be called on MTA thread
// when results of the activation are available.
//
HRESULT MSWASAPIReader::ActivateCompleted(IActivateAudioInterfaceAsyncOperation *operation)
{
HRESULT hr = S_OK;
HRESULT hrActivateResult = S_OK;
ComPtr<IUnknown> audioInterface;
hr = operation->GetActivateResult(&hrActivateResult, &audioInterface);
if (FAILED(hr)) goto exit;
hr = hrActivateResult;
if (FAILED(hr)) goto exit;
audioInterface.CopyTo(&mAudioClient);
if (mAudioClient == nullptr) {
hr = E_NOINTERFACE;
goto exit;
}
exit:
if (FAILED(hr)) {
SAFE_RELEASE(mAudioClient);
SAFE_RELEASE(mAudioCaptureClient);
}
SetEvent(mActivationEvent);
return S_OK;
}
MSWASAPIReaderPtr MSWASAPIReaderNew()
{
MSWASAPIReaderPtr r = new MSWASAPIReaderWrapper();
r->reader = Make<MSWASAPIReader>();
return r;
}
#else
MSWASAPIReaderPtr MSWASAPIReaderNew()
{
return (MSWASAPIReaderPtr) new MSWASAPIReader();
}
#endif
......@@ -29,7 +29,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "mswasapi.h"
class MSWASAPIReader {
class MSWASAPIReader
#ifdef MS2_WINDOWS_UNIVERSAL
: public RuntimeClass< RuntimeClassFlags< ClassicCom >, FtmBase, IActivateAudioInterfaceCompletionHandler >
#endif
{
public:
MSWASAPIReader();
virtual ~MSWASAPIReader();
......@@ -45,12 +49,21 @@ public:
int getRate() { return mRate; }
int getNChannels() { return mNChannels; }
#ifdef MS2_WINDOWS_UNIVERSAL
// IActivateAudioInterfaceCompletionHandler
STDMETHOD(ActivateCompleted)(IActivateAudioInterfaceAsyncOperation *operation);
#endif
private:
void silence(MSFilter *f);
static bool smInstantiated;
#ifdef MS2_WINDOWS_UNIVERSAL
Platform::String^ mCaptureId;
HANDLE mActivationEvent;
#else
LPCWSTR mCaptureId;
#if BUILD_FOR_WINDOWS_PHONE
#endif
#if defined(MS2_WINDOWS_PHONE) || defined(MS2_WINDOWS_UNIVERSAL)
IAudioClient2 *mAudioClient;
#else
IAudioClient *mAudioClient;
......@@ -63,3 +76,22 @@ private:
int mRate;
int mNChannels;
};
#ifdef MS2_WINDOWS_UNIVERSAL
#define MSWASAPI_READER(w) ((MSWASAPIReaderType)((MSWASAPIReaderPtr)(w))->reader)
typedef ComPtr<MSWASAPIReader> MSWASAPIReaderType;
struct MSWASAPIReaderWrapper
{
MSWASAPIReaderType reader;
};
typedef struct MSWASAPIReaderWrapper* MSWASAPIReaderPtr;
#else
#define MSWASAPI_READER(w) ((MSWASAPIReaderType)(w))
typedef MSWASAPIReader* MSWASAPIReaderPtr;
typedef MSWASAPIReader* MSWASAPIReaderType;
#endif
MSWASAPIReaderPtr MSWASAPIReaderNew();
......@@ -50,13 +50,26 @@ bool MSWASAPIWriter::smInstantiated = false;
MSWASAPIWriter::MSWASAPIWriter()
: mAudioClient(NULL), mAudioRenderClient(NULL), mBufferFrameCount(0), mIsInitialized(false), mIsActivated(false), mIsStarted(false)
{
#ifdef MS2_WINDOWS_UNIVERSAL
mActivationEvent = CreateEventEx(nullptr, nullptr, 0, EVENT_ALL_ACCESS);
if (!mActivationEvent) {
ms_error("Could not create activation event of the MSWASAPI audio output interface [%i]", GetLastError());
return;
}
#endif
}
MSWASAPIWriter::~MSWASAPIWriter()
{
RELEASE_CLIENT(mAudioClient);
#if BUILD_FOR_WINDOWS_PHONE
#ifdef MS2_WINDOWS_PHONE
FREE_PTR(mRenderId);
#endif
#ifdef MS2_WINDOWS_UNIVERSAL
if (mActivationEvent != INVALID_HANDLE_VALUE) {
CloseHandle(mActivationEvent);
mActivationEvent = INVALID_HANDLE_VALUE;
}
#endif
smInstantiated = false;
}
......@@ -65,9 +78,29 @@ MSWASAPIWriter::~MSWASAPIWriter()
void MSWASAPIWriter::init(LPCWSTR id) {
HRESULT result;
WAVEFORMATEX *pWfx = NULL;
#if defined(MS2_WINDOWS_PHONE) || defined(MS2_WINDOWS_UNIVERSAL)
AudioClientProperties properties = { 0 };
#endif
#if BUILD_FOR_WINDOWS_PHONE
AudioClientProperties properties;
#if defined(MS2_WINDOWS_UNIVERSAL)
IActivateAudioInterfaceAsyncOperation *asyncOp;
mRenderId = MediaDevice::GetDefaultAudioRenderId(AudioDeviceRole::Communications);
if (mRenderId == nullptr) {
ms_error("Could not get the RenderID of the MSWASAPI audio output interface");
goto error;
}
if (smInstantiated) {
ms_error("An MSWASAPIWriter is already instantiated. A second one can not be created.");
goto error;
}
result = ActivateAudioInterfaceAsync(mRenderId->Data(), IID_IAudioClient2, nullptr, this, &asyncOp);
REPORT_ERROR("Could not activate the MSWASAPI audio output interface [%i]", result);
WaitForSingleObjectEx(mActivationEvent, INFINITE, FALSE);
if (mAudioClient == nullptr) {
ms_error("Could not create the MSWASAPI audio output interface client");
goto error;
}
#elif defined(MS2_WINDOWS_PHONE)
mRenderId = GetDefaultAudioRenderId(Communications);
if (mRenderId == NULL) {
ms_error("Could not get the RenderId of the MSWASAPI audio output interface");
......@@ -81,11 +114,6 @@ void MSWASAPIWriter::init(LPCWSTR id) {
result = ActivateAudioInterface(mRenderId, IID_IAudioClient2, (void **)&mAudioClient);
REPORT_ERROR("Could not activate the MSWASAPI audio output interface [%i]", result);
properties.cbSize = sizeof AudioClientProperties;
properties.bIsOffload = false;
properties.eCategory = AudioCategory_Communications;
result = mAudioClient->SetClientProperties(&properties);
REPORT_ERROR("Could not set properties of the MSWASAPI audio output interface [%x]", result);
#else
IMMDeviceEnumerator *pEnumerator = NULL;
IMMDevice *pDevice = NULL;
......@@ -99,6 +127,13 @@ void MSWASAPIWriter::init(LPCWSTR id) {
result = pDevice->Activate(IID_IAudioClient, CLSCTX_ALL, NULL, (void **)&mAudioClient);
SAFE_RELEASE(pDevice);
REPORT_ERROR("mswasapi: Could not activate the rendering device", result);
#endif
#if defined(MS2_WINDOWS_PHONE) || defined(MS2_WINDOWS_UNIVERSAL)
properties.cbSize = sizeof(AudioClientProperties);
properties.bIsOffload = false;
properties.eCategory = AudioCategory_Communications;
result = mAudioClient->SetClientProperties(&properties);
REPORT_ERROR("Could not set properties of the MSWASAPI audio output interface [%x]", result);
#endif
result = mAudioClient->GetMixFormat(&pWfx);
REPORT_ERROR("Could not get the mix format of the MSWASAPI audio output interface [%x]", result);
......@@ -148,7 +183,7 @@ int MSWASAPIWriter::activate()
} else {
REPORT_ERROR("Audio format not supported by the MSWASAPI audio output interface [%x]", result);
}
result = mAudioClient->Initialize(AUDCLNT_SHAREMODE_SHARED, 0, requestedDuration, 0, pUsedWfx, NULL);
result = mAudioClient->Initialize(AUDCLNT_SHAREMODE_SHARED, AUDCLNT_STREAMFLAGS_NOPERSIST, requestedDuration, 0, pUsedWfx, nullptr);
REPORT_ERROR("Could not initialize the MSWASAPI audio output interface [%x]", result);
result = mAudioClient->GetBufferSize(&mBufferFrameCount);
REPORT_ERROR("Could not get buffer size for the MSWASAPI audio output interface [%x]", result);
......@@ -253,3 +288,59 @@ void MSWASAPIWriter::drop(MSFilter *f) {
freemsg(im);
}
}
#ifdef MS2_WINDOWS_UNIVERSAL
//
// ActivateCompleted()
//
// Callback implementation of ActivateAudioInterfaceAsync function. This will be called on MTA thread
// when results of the activation are available.
//
HRESULT MSWASAPIWriter::ActivateCompleted(IActivateAudioInterfaceAsyncOperation *operation)
{
HRESULT hr = S_OK;
HRESULT hrActivateResult = S_OK;
IUnknown *audioInterface = nullptr;
if (mIsInitialized) {
hr = E_NOT_VALID_STATE;
goto exit;
}
hr = operation->GetActivateResult(&hrActivateResult, &audioInterface);
if (SUCCEEDED(hr) && SUCCEEDED(hrActivateResult))
{
audioInterface->QueryInterface(IID_PPV_ARGS(&mAudioClient));
if (mAudioClient == nullptr) {
hr = E_FAIL;
goto exit;
}
}
exit:
SAFE_RELEASE(audioInterface);
if (FAILED(hr))
{
SAFE_RELEASE(mAudioClient);
SAFE_RELEASE(mAudioRenderClient);
}
SetEvent(mActivationEvent);
return S_OK;
}
MSWASAPIWriterPtr MSWASAPIWriterNew()
{
MSWASAPIWriterPtr w = new MSWASAPIWriterWrapper();
w->writer = Make<MSWASAPIWriter>();
return w;
}
#else
MSWASAPIWriterPtr MSWASAPIWriterNew()
{
return (MSWASAPIWriterPtr) new MSWASAPIWriter();
}
#endif
......@@ -29,10 +29,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "mswasapi.h"
class MSWASAPIWriter {
class MSWASAPIWriter
#ifdef MS2_WINDOWS_UNIVERSAL
: public RuntimeClass< RuntimeClassFlags< ClassicCom >, FtmBase, IActivateAudioInterfaceCompletionHandler >
#endif
{
public:
MSWASAPIWriter();
virtual ~MSWASAPIWriter();
void init(LPCWSTR id);
int activate();
......@@ -45,12 +48,24 @@ public:
int getRate() { return mRate; }
int getNChannels() { return mNChannels; }
#ifdef MS2_WINDOWS_UNIVERSAL
// IActivateAudioInterfaceCompletionHandler
STDMETHOD(ActivateCompleted)(IActivateAudioInterfaceAsyncOperation *operation);
#endif
private:
~MSWASAPIWriter();
void drop(MSFilter *f);
HRESULT configureAudioClient();
static bool smInstantiated;
#ifdef MS2_WINDOWS_UNIVERSAL
Platform::String^ mRenderId;
HANDLE mActivationEvent;
#else
LPCWSTR mRenderId;
#if BUILD_FOR_WINDOWS_PHONE
#endif
#if defined(MS2_WINDOWS_PHONE) || defined(MS2_WINDOWS_UNIVERSAL)
IAudioClient2 *mAudioClient;
#else
IAudioClient *mAudioClient;
......@@ -63,3 +78,22 @@ private:
int mRate;
int mNChannels;
};
#ifdef MS2_WINDOWS_UNIVERSAL
#define MSWASAPI_WRITER(w) ((MSWASAPIWriterType)((MSWASAPIWriterPtr)(w))->writer)
typedef ComPtr<MSWASAPIWriter> MSWASAPIWriterType;
struct MSWASAPIWriterWrapper
{
MSWASAPIWriterType writer;
};
typedef struct MSWASAPIWriterWrapper* MSWASAPIWriterPtr;
#else
#define MSWASAPI_WRITER(w) ((MSWASAPIWriterType)(w))
typedef MSWASAPIWriter* MSWASAPIWriterPtr;
typedef MSWASAPIWriter* MSWASAPIWriterType;
#endif
MSWASAPIWriterPtr MSWASAPIWriterNew();
This diff is collapsed.
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|ARM">
<Configuration>Debug</Configuration>
<Platform>ARM</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|ARM">
<Configuration>Release</Configuration>
<Platform>ARM</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\mswasapi.cpp" />
<ClCompile Include="..\..\mswasapi_reader.cpp" />
<ClCompile Include="..\..\mswasapi_writer.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\mswasapi.h" />
<ClInclude Include="..\..\mswasapi_reader.h" />
<ClInclude Include="..\..\mswasapi_writer.h" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\linphone\mediastreamer2\build\windows10\mediastreamer2\mediastreamer2.vcxproj">
<Project>{88e3c241-eb6f-4c84-80dc-89b8961daf80}</Project>
</ProjectReference>
<ProjectReference Include="..\..\..\linphone\oRTP\build\windows10\ortp\ortp.vcxproj">
<Project>{2e56b851-9d8d-40e5-84bb-e4ee63b71d25}</Project>
</ProjectReference>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{266b769a-c04e-424c-9033-7209f0425bc0}</ProjectGuid>
<Keyword>WindowsRuntimeComponent</Keyword>
<ProjectName>libmswasapi</ProjectName>
<RootNamespace>libmswasapi</RootNamespace>
<DefaultLanguage>en-US</DefaultLanguage>
<MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion>
<AppContainerApplication>true</AppContainerApplication>
<ApplicationType>Windows Store</ApplicationType>
<ApplicationTypeRevision>8.2</ApplicationTypeRevision>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)'=='Debug'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Release'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<GenerateManifest>false</GenerateManifest>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)'=='Debug'">
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<PreprocessorDefinitions>_WINRT_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalUsingDirectories>$(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories)</AdditionalUsingDirectories>
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
<DisableSpecificWarnings>28204</DisableSpecificWarnings>
<AdditionalIncludeDirectories>$(ProjectDir)..\..\..\linphone\mediastreamer2\include;$(ProjectDir)..\..\..\linphone\oRTP\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)'=='Release'">
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<PreprocessorDefinitions>_WINRT_DLL;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalUsingDirectories>$(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories)</AdditionalUsingDirectories>
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
<DisableSpecificWarnings>28204</DisableSpecificWarnings>
<AdditionalIncludeDirectories>$(ProjectDir)..\..\..\linphone\mediastreamer2\include;$(ProjectDir)..\..\..\linphone\oRTP\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
</Link>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment