File: Default.aspx

package info (click to toggle)
libmediainfo 25.04%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 18,532 kB
  • sloc: cpp: 253,735; ansic: 6,551; asm: 2,100; xml: 1,476; cs: 1,189; sh: 1,169; java: 1,032; python: 653; makefile: 442; pascal: 197; javascript: 169
file content (104 lines) | stat: -rw-r--r-- 3,822 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<%
//  Copyright (c) MediaArea.net SARL. All Rights Reserved.
 //
 // Use of this source code is governed by a BSD-style license that can
 // be found in the License.html file in the root of the source tree.
 ///

//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//
// Microsoft Asp.net C# example
//
// To make this example working, you must put MediaInfo.Dll and Example.ogg
// in the "./Bin/" folder
// and add MediaInfoDll.cs to your project
//
// Know issue: I don't know what is the default path when a file
//             is open without path.
//             Complete file name (path+filename) must be provided
//             Don't hesitate to contact Info@MediaArea.net if you know how
//             to open Example.ogg in the bin directory whereever is located
//             the project.
//
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
%>


<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="asp_net_web_application._Default" %>
<%@Import Namespace="MediaInfoLib" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <%
        //Test if version of DLL is compatible : 3rd argument is "version of DLL tested;Your application name;Your application version"
        String ToDisplay;
        MediaInfo MI = new MediaInfo();

        ToDisplay = MI.Option("Info_Version", "0.7.0.0;MediaInfoDLL_Example_CS;0.7.0.0");
        if (ToDisplay.Length == 0)
        {
            Response.Write("MediaInfo.Dll: this version of the DLL is not compatible");
            return;
        }

        //Information about MediaInfo
        ToDisplay += "\r\n\r\nInfo_Parameters\r\n";
        ToDisplay += MI.Option("Info_Parameters");

        ToDisplay += "\r\n\r\nInfo_Capacities\r\n";
        ToDisplay += MI.Option("Info_Capacities");

        ToDisplay += "\r\n\r\nInfo_Codecs\r\n";
        ToDisplay += MI.Option("Info_Codecs");

        //An example of how to use the library
        ToDisplay += "\r\n\r\nOpen\r\n";
        MI.Open("Example.ogg"); //Must be the complete path (ie "C:\\Example.ogg")

        ToDisplay += "\r\n\r\nInform with Complete=false\r\n";
        MI.Option("Complete");
        ToDisplay += MI.Inform();

        ToDisplay += "\r\n\r\nInform with Complete=true\r\n";
        MI.Option("Complete", "1");
        ToDisplay += MI.Inform();

        ToDisplay += "\r\n\r\nCustom Inform\r\n";
        MI.Option("Inform", "General;File size is %FileSize% bytes");
        ToDisplay += MI.Inform();

        ToDisplay += "\r\n\r\nGet with Stream=General and Parameter='FileSize'\r\n";
        ToDisplay += MI.Get(0, 0, "FileSize");

        ToDisplay += "\r\n\r\nGet with Stream=General and Parameter=46\r\n";
        ToDisplay += MI.Get(0, 0, 46);

        ToDisplay += "\r\n\r\nCount_Get with StreamKind=Stream_Audio\r\n";
        ToDisplay += MI.Count_Get(StreamKind.Audio);

        ToDisplay += "\r\n\r\nGet with Stream=General and Parameter='AudioCount'\r\n";
        ToDisplay += MI.Get(StreamKind.General, 0, "AudioCount");

        ToDisplay += "\r\n\r\nGet with Stream=Audio and Parameter='StreamCount'\r\n";
        ToDisplay += MI.Get(StreamKind.Audio, 0, "StreamCount");

        ToDisplay += "\r\n\r\nClose\r\n";
        MI.Close();

        //Formatting to HTML
        ToDisplay=ToDisplay.Replace("\r\n", "<br />\r\n");
        
        //Displaying the text
        Response.Write(ToDisplay);
        %>
    </div>
    </form>
</body>
</html>