1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Net;
5 using System.Windows;
6 using System.Windows.Controls;
7 using System.Windows.Navigation;
8 using Microsoft.Phone.Controls;
9 using Microsoft.Phone.Shell;
10 using CodecApp.Resources;
11 using CodecRTComponent;
12 
13 namespace CodecApp {
14 public partial class MainPage : PhoneApplicationPage {
15   // Constructor
16   private CodecRunTimeComponent vRTCCodec;
17   // Constructor
MainPage()18   public MainPage() {
19     InitializeComponent();
20 
21     vRTCCodec = new CodecRunTimeComponent();
22     // Sample code to localize the ApplicationBar
23     //BuildLocalizedApplicationBar();
24   }
25 
Button_Click_CallEncoder(object sender, RoutedEventArgs e)26   private void Button_Click_CallEncoder (object sender, RoutedEventArgs e) {
27     int iRetVal         = 0;
28     float fFPS          = 0.0F;
29     double dEncoderTime = 0.0;
30     int iEncodedFrame   = 0;
31     string sEncoderInfo = "Encoder performance: \n";
32 
33     iRetVal = vRTCCodec.Encode();
34 
35     if (0 == iRetVal) {
36       fFPS = vRTCCodec.GetEncFPS();
37       dEncoderTime = vRTCCodec.GetEncTime();
38       iEncodedFrame = vRTCCodec.GetEncodedFrameNum();
39       sEncoderInfo += "FPS         : " + fFPS.ToString() + "\n";
40       sEncoderInfo += "EncTime(sec): " + dEncoderTime.ToString() + "\n";
41       sEncoderInfo += "EncodedNum  : " + iEncodedFrame.ToString() + "\n";
42       EncoderInfo.Text = sEncoderInfo;
43     } else {
44       EncoderInfo.Text = "ebcoded failed!...";
45     }
46   }
47 
Button_Click__CallDecoder(object sender, RoutedEventArgs e)48   private void Button_Click__CallDecoder (object sender, RoutedEventArgs e) {
49     int iRetVal = 0;
50     float fFPS = 0.0F;
51     double dDecoderTime = 0.0;
52     int iDecodedFrame = 0;
53     string sDecoderInfo = "Decoder performance: \n";
54 
55     iRetVal = vRTCCodec.Decode();
56 
57     if (0 == iRetVal) {
58       fFPS = vRTCCodec.GetDecFPS();
59       dDecoderTime = vRTCCodec.GetDecTime();
60       iDecodedFrame = vRTCCodec.GetDecodedFrameNum();
61       sDecoderInfo += "FPS         : " + fFPS.ToString() + "\n";
62       sDecoderInfo += "DecTime(sec): " + dDecoderTime.ToString() + "\n";
63       sDecoderInfo += "DecodedNum  : " + iDecodedFrame.ToString() + "\n";
64       DecoderInfo.Text = sDecoderInfo;
65     } else {
66       DecoderInfo.Text = "decoded failed!...";
67     }
68   }
69 
70   // Sample code for building a localized ApplicationBar
71   //private void BuildLocalizedApplicationBar()
72   //{
73   //    // Set the page's ApplicationBar to a new instance of ApplicationBar.
74   //    ApplicationBar = new ApplicationBar();
75 
76   //    // Create a new button and set the text value to the localized string from AppResources.
77   //    ApplicationBarIconButton appBarButton = new ApplicationBarIconButton(new Uri("/Assets/AppBar/appbar.add.rest.png", UriKind.Relative));
78   //    appBarButton.Text = AppResources.AppBarButtonText;
79   //    ApplicationBar.Buttons.Add(appBarButton);
80 
81   //    // Create a new menu item with the localized string from AppResources.
82   //    ApplicationBarMenuItem appBarMenuItem = new ApplicationBarMenuItem(AppResources.AppBarMenuItemText);
83   //    ApplicationBar.MenuItems.Add(appBarMenuItem);
84   //}
85 }
86 }