Ejemplo n.º 1
0
        public async Task GetCodecs()
        {
            var codecQuery = new CodecQuery();

            //IReadOnlyList<CodecInfo> result = await codecQuery.FindAllAsync(CodecKind.Video, CodecCategory.Encoder, "");
            try
            {
                IReadOnlyList <CodecInfo> result = await codecQuery.FindAllAsync(CodecKind.Audio, CodecCategory.Decoder, "");

                foreach (var codecInfo in result)
                {
                    TB.Text += "============================================================\n";
                    TB.Text += $"Codec: {codecInfo.DisplayName}\n";
                    TB.Text += $"Kind: {codecInfo.Kind}\n";
                    TB.Text += $"Category: {codecInfo.Category}\n";
                    TB.Text += $"Trusted: {codecInfo.IsTrusted}\n";

                    foreach (string subType in codecInfo.Subtypes)
                    {
                        TB.Text += $"   Subtype: {subType}\n";
                    }
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine($"Exception::{ex.Message}");
            }
        }
Ejemplo n.º 2
0
        private async void CodecQueryButton_Click(object sender, RoutedEventArgs e)
        {
            // <SnippetNewCodecQuery>
            var codecQuery = new CodecQuery();
            // </SnippetNewCodecQuery>

            // <SnippetFindAllEncoders>
            IReadOnlyList <CodecInfo> result =
                await codecQuery.FindAllAsync(CodecKind.Video, CodecCategory.Encoder, "");

            foreach (var codecInfo in result)
            {
                this.codecResultsTextBox.Text += "============================================================\n";
                this.codecResultsTextBox.Text += string.Format("Codec: {0}\n", codecInfo.DisplayName);
                this.codecResultsTextBox.Text += string.Format("Kind: {0}\n", codecInfo.Kind.ToString());
                this.codecResultsTextBox.Text += string.Format("Category: {0}\n", codecInfo.Category.ToString());
                this.codecResultsTextBox.Text += string.Format("Trusted: {0}\n", codecInfo.IsTrusted.ToString());

                foreach (string subType in codecInfo.Subtypes)
                {
                    this.codecResultsTextBox.Text += string.Format("   Subtype: {0}\n", subType);
                }
            }
            // </SnippetFindAllEncoders>


            // <SnippetIsH264Supported>
            IReadOnlyList <CodecInfo> h264Result = await codecQuery.FindAllAsync(CodecKind.Video, CodecCategory.Decoder, "H264");

            if (h264Result.Count > 0)
            {
                this.codecResultsTextBox.Text = "H264 decoder is present.";
            }
            // </SnippetIsH264Supported>


            // <SnippetIsFLACSupported>
            IReadOnlyList <CodecInfo> flacResult =
                await codecQuery.FindAllAsync(CodecKind.Audio, CodecCategory.Encoder, CodecSubtypes.AudioFormatFlac);

            if (flacResult.Count > 0)
            {
                AudioEncodingProperties audioProps = new AudioEncodingProperties();
                audioProps.Subtype       = CodecSubtypes.AudioFormatFlac;
                audioProps.SampleRate    = 44100;
                audioProps.ChannelCount  = 2;
                audioProps.Bitrate       = 128000;
                audioProps.BitsPerSample = 32;

                MediaEncodingProfile encodingProfile = new MediaEncodingProfile();
                encodingProfile.Audio = audioProps;
                encodingProfile.Video = null;
            }
            // </SnippetIsFLACSupported>
        }
 private async void MainPage_Loaded(object sender, RoutedEventArgs e)
 {
     try
     {
         var query  = new CodecQuery();
         var codecs = await query.FindAllAsync(CodecKind.Audio, CodecCategory.Encoder, "");
     }
     catch (Exception ex)
     {
         // It does not even go here
         Debug.WriteLine(ex);
     }
 }
Ejemplo n.º 4
0
        private async void MainPage_Loaded(object sender, RoutedEventArgs e)
        {
            var codecQuery = new CodecQuery();
            IReadOnlyList <CodecInfo> result;

            try
            {
                result = await codecQuery.FindAllAsync(CodecKind.Video, CodecCategory.Decoder, CodecSubtypes.VideoFormatHevc);
            }
            catch (Exception ex)
            {
                throw;
            }

            StringBuilder sb = new StringBuilder();

            foreach (var codecInfo in result)
            {
                sb.Append("============================================================\n");
                sb.Append(string.Format("Codec: {0}\n", codecInfo.DisplayName));
                sb.Append(string.Format("Kind: {0}\n", codecInfo.Kind.ToString()));
                sb.Append(string.Format("Category: {0}\n", codecInfo.Category.ToString()));
                sb.Append(string.Format("Trusted: {0}\n", codecInfo.IsTrusted.ToString()));

                foreach (string subType in codecInfo.Subtypes)
                {
                    sb.Append(string.Format("   Subtype: {0}\n", subType));
                }
            }

            Debug.WriteLine(sb.ToString());

            _player              = new MediaPlayer();
            _player.MediaFailed += Player_MediaFailed;
            _player.AutoPlay     = true;
            _player.PlaybackSession.BufferingStarted += PlaybackSession_BufferingStarted;
            _player.BufferingStarted += Player_BufferingStarted;
            _player.PlaybackSession.PlaybackStateChanged += PlaybackSession_PlaybackStateChanged;

            _protectionManager        = PlayReadyHelpers.InitializeProtectionManager(ServiceRequested);
            _player.ProtectionManager = _protectionManager;

            //_playReadyHelper = new PlayReadyHelper(); // From SDKTemplate.Helpers.PlayReadyHelper
            //_playReadyHelper.SetUpProtectionManager(_player);

            mediaPlayerElement.SetMediaPlayer(_player);
            mediaPlayerElement.AutoPlay = true;
        }
Ejemplo n.º 5
0
        private async void FindCodecsOnThisDevice()
        {
            string codecs     = "";
            var    codecQuery = new CodecQuery();
            var    results    = await codecQuery.FindAllAsync(CodecKind.Audio, CodecCategory.Encoder, "");

            foreach (var codecInfo in results)
            {
                codecs += "============================================================\n";
                codecs += string.Format("Codec: {0}\n", codecInfo.DisplayName);
                codecs += string.Format("Kind: {0}\n", codecInfo.Kind.ToString());
                codecs += string.Format("Category: {0}\n", codecInfo.Category.ToString());
                codecs += string.Format("Trusted: {0}\n", codecInfo.IsTrusted.ToString());

                foreach (string subType in codecInfo.Subtypes)
                {
                    codecs += string.Format("   Subtype: {0}\n", subType);
                }
            }

            Debug.WriteLine(codecs);
        }