Beispiel #1
0
        public MediaDtmfMessage(ReadOnlyMemory <byte> data) : base(MsgType.MEDIA_DTMF, data)
        {
            var span = base.Raw.Span;

            Duration  = BinaryPrimitives.ReadUInt16LittleEndian(span);
            Key       = (char)span[2];
            Direction = (MediaDirection)span[3];
        }
Beispiel #2
0
 public MediaToneMessage(ushort handle, MediaDirection direction, uint offset, Tone[] tones) : base(handle, MsgType.MEDIA_TONE2)
 {
     if (tones.Length > 0xff)
     {
         throw new ArgumentOutOfRangeException(nameof(tones), "max 255 tones allowed");
     }
     Direction = direction;
     Offset    = offset;
     Tones     = tones;
 }
Beispiel #3
0
        /// <summary>
        /// Set the video stream direction.
        /// </summary>
        /// <param name="direction">The meadia stream direction.</param>
        /// <param name="mediaIndex">The video media index, usually 1 unless a new video has been added.</param>
        public void SetVideoStreamDirection(MediaDirection direction, int mediaIndex = 1)
        {
            if (_hasVideo)
            {
                // Set as tranmit.
                VideoStreamOperation videoStreamOperation = VideoStreamOperation.PJSUA_CALL_VID_STRM_CHANGE_DIR;

                // Set the video stream options.
                CallSetVideoStreamParam callSetVideoStreamParam = new CallSetVideoStreamParam();
                callSetVideoStreamParam.CaptureDevice = _mediaManager.GetVideoCaptureDeviceID();
                callSetVideoStreamParam.Direction     = direction;
                callSetVideoStreamParam.MediaIndex    = mediaIndex;

                // Start transmitting the capture.
                _call.SetVideoStream(videoStreamOperation, callSetVideoStreamParam);
            }
        }
Beispiel #4
0
 /// <summary>
 /// Get MediaDirection.
 /// </summary>
 /// <param name="mediaDirection">The current MediaDirection.</param>
 /// <returns>The MediaDirection.</returns>
 internal static pjsua2.pjmedia_dir GetMediaDirection(MediaDirection mediaDirection)
 {
     // Select the srtp signaling.
     switch (mediaDirection)
     {
         case MediaDirection.PJMEDIA_DIR_DECODING:
             return pjsua2.pjmedia_dir.PJMEDIA_DIR_DECODING;
         case MediaDirection.PJMEDIA_DIR_ENCODING:
             return pjsua2.pjmedia_dir.PJMEDIA_DIR_ENCODING;
         case MediaDirection.PJMEDIA_DIR_ENCODING_DECODING:
             return pjsua2.pjmedia_dir.PJMEDIA_DIR_ENCODING_DECODING;
         case MediaDirection.PJMEDIA_DIR_NONE:
             return pjsua2.pjmedia_dir.PJMEDIA_DIR_NONE;
         default:
             return pjsua2.pjmedia_dir.PJMEDIA_DIR_NONE;
     }
 }