Exemplo n.º 1
0
        private bool ExecuteResultResponse(IMediaPlayer mediaPlayer, BaseRequest message, Stream outStream)
        {
            var success = true;

            switch (message)
            {
            case Load m: mediaPlayer.LoadMedia(m.Type, m.FileToLoad, m.StartPosition, m.StopPosition); break;

            case LocalFileStreamConnect m: mediaPlayer.ConnectLocalFileStream(m.PipeName); break;

            case CreateSnapshot m: success = mediaPlayer.CreateSnapshot(m.NumberOfVideoOutput, m.Width, m.Height, m.FilePath); break;

            case GetAudioTracks _: responseService.ReturnResultResponse(outStream, message, mediaPlayer.GetAudioTracks()); return(true);

            case GetVideoTracks _: responseService.ReturnResultResponse(outStream, message, mediaPlayer.GetVideoTracks()); return(true);

            default: return(false);
            }

            responseService.ReturnResultResponse(outStream, message, success);

            return(true);
        }