Пример #1
0
 public Tag(GStreamer.Tag tag)
 {
     this.disc_id = tag.DiscID;
     this.music_brainz_id = tag.MusicBrainzID;
     this.current_track = tag.CurrentTrack;
     this.track_count = tag.TrackCount;
     this.duration = tag.Duration;
 }
Пример #2
0
        public static void Main(string[] args)
        {
            /* Init Gtk */
            Application.Init();

            Core.Init();

            /* Init GStreamer */
            GStreamer.Init();
            if (!GStreamer.CheckInstallation())
            {
                return;
            }

            GLib.ExceptionManager.UnhandledException += new GLib.UnhandledExceptionHandler(OnException);
            Version version = Assembly.GetExecutingAssembly().GetName().Version;

            try {
                AddinsManager manager = new AddinsManager(Config.PluginsConfigDir, Config.PluginsDir);
                manager.LoadConfigModifierAddins();
                GUIToolkit         guiToolkit        = new GUIToolkit(version);
                IMultimediaToolkit multimediaToolkit = new MultimediaFactory();
                manager.LoadExportProjectAddins(guiToolkit.MainWindow);
                manager.LoadImportProjectAddins(guiToolkit.MainWindow);
                try {
                    Core.Start(guiToolkit, multimediaToolkit);
                } catch (DBLockedException locked) {
                    string msg = Catalog.GetString("The database seems to be locked by another instance and " +
                                                   "the application will closed.");
                    Log.Exception(locked);
                    return;
                }
                Application.Run();
            } catch (Exception ex) {
                ProcessExecutionError(ex);
            }
        }
Пример #3
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource   = Resource.Layout.Toolbar;

            base.OnCreate(savedInstanceState);

            Xamarin.Essentials.Platform.Init(this, savedInstanceState);
            global::Xamarin.Forms.Forms.Init(this, savedInstanceState);

            if (ContextCompat.CheckSelfPermission(this, Manifest.Permission.RecordAudio) != (int)Permission.Granted)
            {
                ActivityCompat.RequestPermissions(this, new string[] { Manifest.Permission.RecordAudio }, 0);
            }

            //Os.Setenv("G_MESSAGES_DEBUG", "all", true);
            //Os.Setenv("G_DEBUG", "fatal-warnings", true);
            //Os.Setenv("GST_DEBUG", "6", true);
            //Os.Setenv("GST_DEBUG_NO_COLOR", "1", true);

            JavaSystem.LoadLibrary("gstreamer_android");
            GStreamer.Init(ApplicationContext);

            JavaSystem.LoadLibrary("gstwebrtc");

            //_webRtc = new WebRTCNative(ApplicationContext);
            _webRtc = new WebRTCJava(ApplicationContext);

            //string content = "";
            //AssetManager assets = this.Assets;
            //using (StreamReader sr = new StreamReader(assets.Open("ssl/certs/ca-certificates.crt")))
            //{
            //    content = sr.ReadToEnd();
            //}

            LoadApplication(new App(_webRtc, ""));
        }
Пример #4
0
 void Awake()
 {
     GStreamer.AddPluginsToPath();
 }
Пример #5
0
        //state changed
        void state_changed(GStreamer.StateEventArgs args)
        {
            if (StateChanged == null) return;

            switch (args.State)
            {
                case GStreamer.MediaStatus.Loaded:
                    StateChanged(new StateEventArgs (MediaStatus.Loaded));
                    break;
                case GStreamer.MediaStatus.Paused:
                    StateChanged(new StateEventArgs (MediaStatus.Paused));
                    break;
                case GStreamer.MediaStatus.Playing:
                    StateChanged(new StateEventArgs (MediaStatus.Playing));
                    break;
                case GStreamer.MediaStatus.Stopped:
                    StateChanged(new StateEventArgs (MediaStatus.Stopped));
                    break;
                case GStreamer.MediaStatus.Unloaded:
                    StateChanged(new StateEventArgs (MediaStatus.Unloaded));
                    break;
            }
        }
Пример #6
0
 //found video information
 void found_video_info(GStreamer.VideoInfoEventArgs args)
 {
     if (FoundVideoInfo != null)
     {
         VideoInfo info = new VideoInfo (args.VideoInfo);
         FoundVideoInfo (new VideoInfoEventArgs (info));
     }
 }
Пример #7
0
 //found a tag
 void found_tag(GStreamer.TagEventArgs args)
 {
     if (FoundTag != null)
     {
         Tag tag = new Tag (args.Tag);
         FoundTag (new TagEventArgs (tag));
     }
 }
Пример #8
0
 //raised error
 void error(GStreamer.ErrorEventArgs args)
 {
     if (Error != null)
         Error (new ErrorEventArgs (args.Error, args.Debug));
 }
Пример #9
0
 //buffer event raised
 void buffer(GStreamer.BufferEventArgs args)
 {
     if (Buffer != null)
         Buffer (new BufferEventArgs (args.Progress));
 }
Пример #10
0
 public bool FileNeedsRemux(MediaFile file)
 {
     return(GStreamer.FileNeedsRemux(file));
 }
Пример #11
0
        protected virtual void OnOpenbuttonClicked(object sender, System.EventArgs e)
        {
            if (useType == ProjectType.CaptureProject || useType == ProjectType.URICaptureProject)
            {
                string filename;

                filename = FileChooserHelper.SaveFile(this, Catalog.GetString("Output file"),
                                                      "Capture.mp4", Config.VideosDir, "MP4",
                                                      new string[] { "*.mp4" });
                if (filename != null)
                {
                    fileEntry.Text = System.IO.Path.ChangeExtension(filename, "mp4");
                }
            }
            else
            {
                MessageDialog md = null;
                string        folder, filename;

                folder   = System.Environment.GetFolderPath(Environment.SpecialFolder.Personal);
                filename = FileChooserHelper.OpenFile(this, Catalog.GetString("Open file"),
                                                      null, folder, null, null);
                if (filename == null)
                {
                    return;
                }

                try {
                    md = new MessageDialog((Gtk.Window) this.Toplevel,
                                           DialogFlags.Modal,
                                           MessageType.Info,
                                           Gtk.ButtonsType.None,
                                           Catalog.GetString("Analyzing video file:") + "\n" + filename);
                    md.Icon = Stetic.IconLoader.LoadIcon(this, "longomatch", Gtk.IconSize.Dialog);
                    md.Show();

                    mFile = PreviewMediaFile.DiscoverFile(filename);
                    if (!mFile.HasVideo || mFile.VideoCodec == "")
                    {
                        throw new Exception(Catalog.GetString("This file doesn't contain a video stream."));
                    }
                    if (mFile.HasVideo && mFile.Length == 0)
                    {
                        throw new Exception(Catalog.GetString("This file contains a video stream but its length is 0."));
                    }
                    if (GStreamer.FileNeedsRemux(mFile))
                    {
                        string q = Catalog.GetString("The file you are trying to load is not properly supported. " +
                                                     "Would you like to convert it into a more suitable format?");
                        if (MessagesHelpers.QuestionMessage(this, q))
                        {
                            var remux       = new Remuxer(mFile);
                            var newFilename = remux.Remux(this.Toplevel as Gtk.Window);
                            if (newFilename != null)
                            {
                                mFile = PreviewMediaFile.DiscoverFile(newFilename);
                            }
                        }
                    }
                    fileEntry.Text = mFile.FilePath;
                }
                catch (Exception ex) {
                    MessagesHelpers.ErrorMessage(this, ex.Message);
                }
                finally {
                    md.Destroy();
                }
            }
        }
 /// <summary>
 /// Unload the GStreamer's Log_handler
 /// </summary>
 void UnLoadGStreamer()
 {
     GStreamer.Unref();
 }
Пример #13
0
        public static void Main(string[] args)
        {
            CoreServices.Init();

            InitGtk();

            /* Init GStreamer */
            GStreamer.Init();
            //if (!GStreamer.CheckInstallation ())
            //	return;

            GLib.ExceptionManager.UnhandledException += new GLib.UnhandledExceptionHandler(OnException);
            Version version = Assembly.GetExecutingAssembly().GetName().Version;

            try {
                AddinsManager.Initialize(Config.PluginsConfigDir, Config.PluginsDir);
                AddinsManager.LoadConfigModifierAddins();
                Config.DrawingToolkit    = new CairoBackend();
                Config.EventsBroker      = new EventsBroker();
                Config.MultimediaToolkit = new MultimediaToolkit();
                Config.GUIToolkit        = new GUIToolkit(version);
                bool haveCodecs = AddinsManager.RegisterGStreamerPlugins();
                AddinsManager.LoadExportProjectAddins(Config.GUIToolkit.MainController);
                AddinsManager.LoadMultimediaBackendsAddins(Config.MultimediaToolkit);
                AddinsManager.LoadUIBackendsAddins(Config.GUIToolkit);
                AddinsManager.LoadServicesAddins();
                Config.GUIToolkit.Register <IPlayerView, PlayerView> (0);

                if (!haveCodecs)
                {
                    CodecsChoiceDialog ccd = new CodecsChoiceDialog();
                    int response           = ccd.Run();
                    if (response == (int)ResponseType.Accept)
                    {
                        try {
                            System.Diagnostics.Process.Start(Constants.WEBSITE);
                        } catch {
                        }
                    }
                    ccd.Destroy();
                }
                try {
                    CoreServices.Start(Config.GUIToolkit, Config.MultimediaToolkit);
                } catch (DBLockedException locked) {
                    string msg = Catalog.GetString("The database seems to be locked by another instance and " +
                                                   "the application will be closed.");
                    Config.GUIToolkit.ErrorMessage(msg);
                    Log.Exception(locked);
                    return;
                }
                AddinsManager.LoadDashboards(Config.CategoriesTemplatesProvider);
                AddinsManager.LoadImportProjectAddins(CoreServices.ProjectsImporter);

                ConfigureOSXApp();

                Application.Run();
            }  catch (AddinRequestShutdownException arse) {
                // Abort gracefully
            } catch (Exception ex) {
                ProcessExecutionError(ex);
            } finally {
                try {
                    AddinsManager.ShutdownMultimediaBackends();
                } catch {
                }
            }
        }
Пример #14
0
 public VideoInfo(GStreamer.VideoInfo video_info)
 {
     this.width = video_info.Width;
     this.height = video_info.Height;
     this.frame_rate = video_info.FrameRate;
 }
Пример #15
0
        /// <summary>
        /// overriding the OnCLosing is a bit cleaner than handling the event, since it
        /// is this object.
        ///
        /// This happens before FormClosed
        /// </summary>
        /// <param name="e"></param>
        protected override void OnClosing(CancelEventArgs e)
        {
            base.OnClosing(e);

            // speed up tile saving on exit
            GMap.NET.GMaps.Instance.CacheOnIdleRead  = false;
            GMap.NET.GMaps.Instance.BoostCacheEngine = true;

            log.Info("MainV2_FormClosing");

            Settings.Instance["MainHeight"]    = this.Height.ToString();
            Settings.Instance["MainWidth"]     = this.Width.ToString();
            Settings.Instance["MainMaximised"] = this.WindowState.ToString();

            Settings.Instance["MainLocX"] = this.Location.X.ToString();
            Settings.Instance["MainLocY"] = this.Location.Y.ToString();

            // close bases connection
            try
            {
                MainV2.comPort.logreadmode = false;
                //if (logfile != null)
                //    logfile.Close();

                //if (rawlogfile != null)
                //    rawlogfile.Close();

                //logfile = null;
                //rawlogfile = null;
            }
            catch
            {
            }

            // close all connections

            Utilities.adsb.Stop();

            GStreamer.StopAll();

            log.Info("closing vlcrender");
            try
            {
                while (vlcrender.store.Count > 0)
                {
                    vlcrender.store[0].Stop();
                }
            }
            catch
            {
            }

            log.Info("closing httpthread");

            // if we are waiting on a socket we need to force an abort
            httpserver.Stop();

            log.Info("sorting tlogs");
            //try
            //{
            //    System.Threading.ThreadPool.QueueUserWorkItem((WaitCallback)delegate
            //    {
            //        try
            //        {
            //            aeromagtec.Log.LogSort.SortLogs(Directory.GetFiles(Settings.Instance.LogDir, "*.tlog"));
            //        }
            //        catch
            //        {
            //        }
            //    }
            //        );
            //}
            //catch
            //{
            //}

            log.Info("closing MyView");

            // close all tabs
            //MyView.Dispose();

            log.Info("closing fd");
            try
            {
                FlightData.Dispose();
            }
            catch
            {
            }
            log.Info("closing fp");
            //try
            //{
            //    FlightPlanner.Dispose();
            //}
            //catch
            //{
            //}
            //log.Info("closing sim");
            //try
            //{
            //    Simulation.Dispose();
            //}
            //catch
            //{
            //}

            //try
            //{
            //    if (comPort.BaseStream.IsOpen)
            //        comPort.Close();
            //}
            //catch
            //{
            //} // i get alot of these errors, the port is still open, but not valid - user has unpluged usb

            // save config
            //SaveConfig();

            //Console.WriteLine(httpthread.IsAlive);

            log.Info("MainV2_FormClosing done");

            if (MONO)
            {
                this.Dispose();
            }
        }