<commit_before>//
// Application.cs: Framework initialization for GStreamer
//
// Authors:
//   <NAME> (<EMAIL>)
//   <NAME> (<EMAIL>)
//
// Copyright (C) 2002 <NAME>
// Copyright (C) 2006 Novell, Inc.
//

using System;
using System.Runtime.InteropServices;

namespace Gst {
  public static class Application {
    public static void Init() {
      IntPtr argv = new IntPtr (0);
      int argc = 0;

      gst_init (ref argc, ref argv);
    }

    public static void Init (string progname, ref string [] args) {
      FullInit (progname, ref args, false);
    }

    public static void InitCheck (string progname, ref string [] args) {
      FullInit (progname, ref args, true);
    }

    public static void Deinit() {
      gst_deinit();
    }

    private static void FullInit (string progname, ref string [] args, bool check) {
      string [] progargs = new string[args.Length + 1];

      progargs[0] = progname;
      args.CopyTo (progargs, 1);

      GLib.Argv argv = new GLib.Argv (progargs);
      IntPtr argv_ptr = argv.Handle;
      int argc = progargs.Length;

      if (check) {
        IntPtr error_ptr;
        bool result = gst_init_check (ref argc, ref argv_ptr, out error_ptr);

        if (error_ptr != IntPtr.Zero) {
          throw new GLib.GException (error_ptr);
        } else if (!result) {
          throw new ApplicationException ("gst_init_check() failed: Reason unknown");
        }
      } else {
        gst_init (ref argc, ref argv_ptr);
      }

      if (argv_ptr != argv.Handle) {
        string init_call = check ? "gst_init_check()" : "gst_init()";
        throw new ApplicationException (init_call + " returned a new argv handle");
      }

      if (argc <= 1) {
        args = new string[0];
      } else {
        progargs = argv.GetArgs (argc);
        args = new string[argc - 1];
        System.Array.Copy (progargs, 1, args, 0, argc - 1);
      }
    }<commit_msg>Call the _get_type() functions of some types on Init() to make sure they're registred by Gtk#<commit_after>//
// Application.cs: Framework initialization for GStreamer
//
// Authors:
//   <NAME> (<EMAIL>)
//   <NAME> (<EMAIL>)
//
// Copyright (C) 2002 <NAME>
// Copyright (C) 2006 Novell, Inc.
//

using System;
using System.Runtime.InteropServices;

namespace Gst {
  public static class Application {
    public static void Init() {
      IntPtr argv = new IntPtr (0);
      int argc = 0;

      gst_init (ref argc, ref argv);
      RegisterManagedTypes ();
    }

    public static void Init (string progname, ref string [] args) {
      FullInit (progname, ref args, false);
    }

    public static void InitCheck (string progname, ref string [] args) {
      FullInit (progname, ref args, true);
    }

    public static void Deinit() {
      gst_deinit();
    }

    private static void RegisterManagedTypes() {
      GLib.GType t;

      t = Gst.Fraction.GType;
      t = Gst.DoubleRange.GType;
      t = Gst.IntRange.GType;
      t = Gst.FractionRange.GType;
      t = Gst.Fourcc.GType;
      t = Gst.Date.GType;
      t = Gst.List.GType;
      t = Gst.Array.GType;
      t = Gst.Caps.GType;
      t = Gst.Structure.GType;
      t = Gst.TagList.GType;
      t = Gst.MiniObject.GType;
    }

    private static void FullInit (string progname, ref string [] args, bool check) {
      string [] progargs = new string[args.Length + 1];

      progargs[0] = progname;
      args.CopyTo (progargs, 1);

      GLib.Argv argv = new GLib.Argv (progargs);
      IntPtr argv_ptr = argv.Handle;
      int argc = progargs.Length;

      if (check) {
        IntPtr error_ptr;
        bool result = gst_init_check (ref argc, ref argv_ptr, out error_ptr);

        if (error_ptr != IntPtr.Zero) {
          throw new GLib.GException (error_ptr);
        } else if (!result) {
          throw new ApplicationException ("gst_init_check() failed: Reason unknown");
        }
      } else {
        gst_init (ref argc, ref argv_ptr);
      }

      if (argv_ptr != argv.Handle) {
        string init_call = check ? "gst_init_check()" : "gst_init()";
        throw new ApplicationException (init_call + " returned a new argv handle");
      }

      if (argc <= 1) {
        args = new string[0];
      } else {
        progargs = argv.GetArgs (argc);
        args = new string[argc - 1];
        System.Array.Copy (progargs, 1, args, 0, argc - 1);
      }
      RegisterManagedTypes ();
    }
{'fraction_non_alphanumeric': 0.12067395264116576, 'fraction_numerical': 0.008652094717668488, 'mean_word_length': 2.261321455085375, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3492432', 'n_tokens_mistral': 1480, 'n_tokens_neox': 1389, 'n_words': 419}