public static void Main(string [] args)
    {
        if (args.Length < 2)
        {
            Console.WriteLine("Usage: mono decodebin-transcoder.exe <input-file> <output-file>");
            return;
        }

        Gst.Application.Init();
        loop = new GLib.MainLoop();

        DecodeBinTranscoder transcoder = new DecodeBinTranscoder();

        transcoder.Error += delegate(object o, ErrorArgs eargs) {
            Console.WriteLine("Error: {0}", eargs.Error);
            transcoder.Dispose();
            loop.Quit();
        };

        transcoder.Finished += delegate {
            Console.WriteLine("\nFinished");
            transcoder.Dispose();
            loop.Quit();
        };

        transcoder.Progress += delegate(object o, ProgressArgs pargs) {
            Console.Write("\rEncoding: {0} / {1} ({2:00.00}%) ",
                          new TimeSpan((pargs.Position / (long)Clock.Second) * TimeSpan.TicksPerSecond),
                          new TimeSpan((pargs.Duration / (long)Clock.Second) * TimeSpan.TicksPerSecond),
                          ((double)pargs.Position / (double)pargs.Duration) * 100.0);
        };

        transcoder.Transcode(args[0], args[1]);

        loop.Run();
    }
Пример #2
0
  public static void Main (string [] args) {
    if (args.Length < 2) {
      Console.WriteLine ("Usage: mono decodebin-transcoder.exe <input-file> <output-file>");
      return;
    }

    Gst.Application.Init();
    loop = new GLib.MainLoop();

    DecodeBinTranscoder transcoder = new DecodeBinTranscoder();

    transcoder.Error += delegate (object o, ErrorArgs eargs) {
      Console.WriteLine ("Error: {0}", eargs.Error);
      transcoder.Dispose();
      loop.Quit();
    };

    transcoder.Finished += delegate {
      Console.WriteLine ("\nFinished");
      transcoder.Dispose();
      loop.Quit();
    };

    transcoder.Progress += delegate (object o, ProgressArgs pargs) {
      Console.Write ("\rEncoding: {0} / {1} ({2:00.00}%) ",
                     new TimeSpan ( (pargs.Position / (long) Clock.Second) * TimeSpan.TicksPerSecond),
                     new TimeSpan ( (pargs.Duration / (long) Clock.Second) * TimeSpan.TicksPerSecond),
                     ( (double) pargs.Position / (double) pargs.Duration) * 100.0);
    };

    transcoder.Transcode (args[0], args[1]);

    loop.Run();
  }