using Compat

################################################################################
# Export definitions supported by our export script                            #
################################################################################
export RTP_PAYLOAD_SIZE

# typealias 
export ToxAv
export ToxAVCallback
export ToxAvAudioCallback
export ToxAvVideoCallback
export ToxAvCallbackID
export ToxAvCallType
export ToxAvCallState
export ToxAvError
export ToxAvCapabilities

# const
export av_OnInvite
export av_OnRinging
export av_OnStart
export av_OnCancel
export av_OnReject
export av_OnEnd
export av_OnRequestTimeout
export av_OnPeerTimeout
export av_OnPeerCSChange
export av_OnSelfCSChange
export av_TypeAudio
export av_TypeVideo
export av_CallNonExistent
export av_CallInviting
export av_CallStarting
export av_CallActive
export av_CallHold
export av_CallHungUp
export av_ErrorNone
export av_ErrorUnknown
export av_ErrorNoCall
export av_ErrorInvalidState
export av_ErrorAlreadyInCallWithPeer
export av_ErrorReachedCallLimit
export av_ErrorInitializingCodecs
export av_ErrorSettingVideoResolution
export av_ErrorSettingVideoBitrate
export av_ErrorSplittingVideoPayload
export av_ErrorEncodingVideo
export av_ErrorEncodingAudio
export av_ErrorSendingPayload
export av_ErrorCreatingRtpSessions
export av_ErrorNoRtpSession
export av_ErrorInvalidCodecState
export av_ErrorPacketTooLarge
export av_AudioEncoding
export av_AudioDecoding
export av_VideoEncoding
export av_VideoDecoding

export ToxAvCSettings

################################################################################
# This is the code generated by Clang (Anonymous enums removed)                #
################################################################################
const RTP_PAYLOAD_SIZE = 65535

typealias ToxAv Void
typealias ToxAVCallback Ptr{Void}
typealias ToxAvAudioCallback Ptr{Void}
typealias ToxAvVideoCallback Ptr{Void}

# begin enum ToxAvCallbackID
typealias ToxAvCallbackID Uint32
const av_OnInvite = (UInt32)(0)
const av_OnRinging = (UInt32)(1)
const av_OnStart = (UInt32)(2)
const av_OnCancel = (UInt32)(3)
const av_OnReject = (UInt32)(4)
const av_OnEnd = (UInt32)(5)
const av_OnRequestTimeout = (UInt32)(6)
const av_OnPeerTimeout = (UInt32)(7)
const av_OnPeerCSChange = (UInt32)(8)
const av_OnSelfCSChange = (UInt32)(9)
# end enum ToxAvCallbackID

# begin enum ToxAvCallType
typealias ToxAvCallType Uint32
const av_TypeAudio = (UInt32)(192)
const av_TypeVideo = (UInt32)(193)
# end enum ToxAvCallType

# begin enum ToxAvCallState
typealias ToxAvCallState Cint
const av_CallNonExistent = (Int32)(-1)
const av_CallInviting = (Int32)(0)
const av_CallStarting = (Int32)(1)
const av_CallActive = (Int32)(2)
const av_CallHold = (Int32)(3)
const av_CallHungUp = (Int32)(4)
# end enum ToxAvCallState

# begin enum ToxAvError
typealias ToxAvError Cint
const av_ErrorNone = (Int32)(0)
const av_ErrorUnknown = (Int32)(-1)
const av_ErrorNoCall = (Int32)(-20)
const av_ErrorInvalidState = (Int32)(-21)
const av_ErrorAlreadyInCallWithPeer = (Int32)(-22)
const av_ErrorReachedCallLimit = (Int32)(-23)
const av_ErrorInitializingCodecs = (Int32)(-30)
const av_ErrorSettingVideoResolution = (Int32)(-31)
const av_ErrorSettingVideoBitrate = (Int32)(-32)
const av_ErrorSplittingVideoPayload = (Int32)(-33)
const av_ErrorEncodingVideo = (Int32)(-34)
const av_ErrorEncodingAudio = (Int32)(-35)
const av_ErrorSendingPayload = (Int32)(-40)
const av_ErrorCreatingRtpSessions = (Int32)(-41)
const av_ErrorNoRtpSession = (Int32)(-50)
const av_ErrorInvalidCodecState = (Int32)(-51)
const av_ErrorPacketTooLarge = (Int32)(-52)
# end enum ToxAvError

# begin enum ToxAvCapabilities
typealias ToxAvCapabilities Uint32
const av_AudioEncoding = (UInt32)(1)
const av_AudioDecoding = (UInt32)(2)
const av_VideoEncoding = (UInt32)(4)
const av_VideoDecoding = (UInt32)(8)
# end enum ToxAvCapabilities

################################################################################
# Added by hand                                                                #
################################################################################
immutable ToxAvCSettings
	call_type::ToxAvCallType
	video_bitrate::UInt32
	max_video_width::UInt16
	max_video_height::UInt16
	audio_bitrate::UInt32
	audio_frame_duration::UInt16
	audio_sample_rate::UInt32
	audio_channels::UInt32
end

function ToxAvCSettings()
	# some stupid default values
    ToxAvCSettings(av_TypeAudio, 0, 0, 0, 0, 0, 0, 0 )
end