Skip to content

Latest commit

 

History

History
79 lines (55 loc) · 2.16 KB

File metadata and controls

79 lines (55 loc) · 2.16 KB
 
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
/*
scanclr: Estimate length (sample count) of a mpeg file and compare to length from exact scan.
copyright 2009 by the mpg123 project - free software under the terms of the LGPL 2.1
see COPYING and AUTHORS files in distribution or http://mpg123.org
CLR example initially written by Malcolm Boczek
Based on scan.c example initially written by Thomas Orgis
*/
/* Note the lack of error checking here.
While it would be nicer to inform the user about troubles, libmpg123 is designed _not_ to bite you on operations with invalid handles , etc.
You just jet invalid results on invalid operations... */
/* Ditto for mpg123clr (MB) */
/*
1.9.0.0 24-Sep-09 Function names harmonized with libmpg123 (mb)
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using mpg123clr;
namespace scanclr
{
class Program
{
static void Main(string[] args)
{
if (args.Length < 1)
{
Console.WriteLine("\nI will give you the estimated and exact sample lengths of MPEG audio files.\n");
Console.WriteLine("\nUsage: scanclr <mpeg audio file list>\n\n");
Console.WriteLine("Press any key to exit:");
while (Console.Read() == 0) ;
return;
}
mpg123clr.mpg.ErrorCode err;
err = mpg123.mpg123_init();
mpg123 mp = new mpg123();
err = mp.mpg123_new();
mp.mpg123_param(mpg123clr.mpg.parms.resync_limit, -1, 0);
foreach (string name in args)
{
err = mp.mpg123_open(name);
long a, b;
a = mp.mpg123_length();
mp.mpg123_scan();
b = mp.mpg123_length();
mp.mpg123_close();
Console.WriteLine(string.Format("File {0}: estimated {1} vs. scanned {2}", name, a, b));
}
Console.WriteLine("\nPress any key to exit:");
while (Console.Read() == 0) ;
mp.Dispose();
mpg123.mpg123_exit();
}
}
}