import "unknwn.idl";
import "mmstream.idl";

typedef enum 
{
	MCF_SEND,
	MCF_RECV,
	MCF_AUDIO,
	MCF_VIDEO,
	MCF_DEFAULT_DEVICE
} MC_FLAGS;

interface IMediaChannel;

[
	object,
	uuid(c35a34fa-b92b-11d1-aa97-00c04fc9b202),
	pointer_default(unique),
]
interface IMediaChannelBuilder : IUnknown
{
	HRESULT CreateMediaChannel([in] MC_FLAGS flags, [out] IMediaChannel **ppIMC);
}

typedef enum 
{
	SM_AUTO,
	SM_MANUAL
} SILENCE_MODE;

[
	object,
	uuid(c515aa5e-b92b-11d1-aa97-00c04fc9b202),
	pointer_default(unique),
]
interface IAudioDevice : IUnknown
{
	HRESULT GetDeviceCount([out] UINT *pcDevices);
	HRESULT EnumerateInputDevices([in] UINT index, [out] DWORD *pDeviceId, [out] BSTR *pDeviceName);
	HRESULT EnumerateOutputDevices(UINT index, [out] DWORD *pDeviceId, [out] BSTR *pDeviceName);
	HRESULT SetInputDeviceId([in] UINT deviceId);
	HRESULT SetOutputDeviceId([in] UINT deviceId);
	HRESULT GetInputDeviceId([out] UINT *pdeviceId);
	HRESULT GetOutputDeviceId([out] UINT *pdeviceId);
	HRESULT SetDuplexMode ([in] BOOL );
	HRESULT GetDuplexMode ( [out] BOOL *pDuplexType);
	HRESULT SetSilenceSuppressionMode( [in] SILENCE_MODE mode);
	HRESULT GetSilenceSuppressionMode( [out] SILENCE_MODE *mode);
	HRESULT SetEchoCancellationMode( [in] BOOL fEnabled);
	HRESULT GetEchoCancellationMode( [out] BOOL *pfEnabled);
	HRESULT GetSignalStrength(UINT *pSignalStrength);
	HRESULT SetVolume([in] UINT vol);
	HRESULT GetVolume([out] UINT *pvol);
}

[
	object,
	uuid(0296d416-b92c-11d1-aa97-00c04fc9b202),
	pointer_default(unique),
]
interface IVideoDevice : IUnknown
{
	HRESULT GetDeviceCount([out] UINT *pcDevices);
	HRESULT EnumerateInputDevices(UINT index, [out] DWORD *pDeviceId, [out] BSTR *pDeviceName);
	HRESULT SetInputDeviceId([in] UINT deviceId);
	HRESULT GetInputDeviceId([out] UINT *pdeviceId);
	HRESULT ShowDeviceDialog();
}

typedef enum 
{
	MCS_UNCONFIGURED,
	MCS_STOPPED,
	MCS_STARTED
} MC_STATE;

[
	object,
	uuid(17a7db52-b92c-11d1-aa97-00c04fc9b202),
	pointer_default(unique),
]
interface IMediaChannel : IUnknown
{
	HRESULT Start();
//	HRESULT Start(int iDropFrame);
	HRESULT Stop();
	HRESULT GetState(MC_STATE *pState);
	HRESULT SetNetworkInterface( IUnknown *);       // IRTPSend or IRTPRecv
	HRESULT SetMaxBitRate(UINT bitrate);            // Flow control
	HRESULT SetStreamSource(IMediaStream *);        // for send channels only

	HRESULT Configure([in, size_is(cbFormat)] BYTE *pFormat, [in] UINT cbFormat, [in, size_is (cbParams)]BYTE *pChannelParams, UINT cbParams);
	// for audio, pFormat will point to a WAVEFORMATEX and pChannelParams will point to AUDIO_CHANNEL_PARAMS
	// for video, pFormat will point to a VIDEOFORMATEX and pChannelParams will point to VIDEO_CHANNEL_PARAMS
}

[
	object,
	uuid(377d00f6-b92c-11d1-aa97-00c04fc9b202),
	pointer_default(unique),
]
interface IAudioChannel : IMediaChannel
{
//      HRESULT GetSignalStrength(UINT *pSignalStrength);
}

[
	object,
	uuid(4c4da8b4-b92c-11d1-aa97-00c04fc9b202),
	pointer_default(unique),
]
interface IVideoChannel : IMediaChannel
{
	HRESULT SetTemporalSpatialTradeoff([in] UINT T_S_Tradeoff);
	HRESULT GetTemporalSpatialTradeoff([out] UINT *pT_S_Tradeoff);
	HRESULT SendKeyFrame();
}


