/// <summary>
        /// Initialize the service, creating the Recorder object, connecting events and adding GUI elements
        /// </summary>
        void IExtensionService.Initialize()
        {
            recorder = new Recorder ();
            active_encoder = recorder.SetActiveEncoder (active_encoder);

            ServiceManager.PlaybackController.TrackStarted += delegate {
                if (recording) {
                    StartRecording ();
                }
            };

            ServiceManager.PlaybackController.Stopped += delegate {
                if (recording) {
                    StopRecording ();
                }
            };

            ServiceManager.PlayerEngine.ConnectEvent (OnEndOfStream, PlayerEvent.EndOfStream);
            ServiceManager.PlayerEngine.ConnectEvent (OnStateChange, PlayerEvent.StateChange);
            ServiceManager.PlayerEngine.ConnectEvent (OnMetadata, PlayerEvent.TrackInfoUpdated);
            ServiceManager.SourceManager.ActiveSourceChanged += OnSourceChanged;

            action_service = ServiceManager.Get<InterfaceActionService> ();
            actions = new ActionGroup ("Streamrecorder");

            actions.Add (new ActionEntry[] { new ActionEntry ("StreamrecorderAction", null,
                             AddinManager.CurrentLocalizer.GetString ("_Streamrecorder"), null, null, null),
                             new ActionEntry ("StreamrecorderConfigureAction", Stock.Properties,
                                 AddinManager.CurrentLocalizer.GetString ("_Configure"), null,
                                 AddinManager.CurrentLocalizer.GetString ("Configure the Streamrecorder plugin"), OnConfigure) });

            actions.Add (new ToggleActionEntry[] { new ToggleActionEntry ("StreamrecorderEnableAction", Stock.MediaRecord,
                             AddinManager.CurrentLocalizer.GetString ("_Activate streamrecorder"), null,
                             AddinManager.CurrentLocalizer.GetString ("Activate streamrecorder process"),
                             OnActivateStreamrecorder, recording) });

            action_service.UIManager.InsertActionGroup (actions, 0);
            ui_menu_id = action_service.UIManager.AddUiFromResource ("StreamrecorderMenu.xml");
        }
        public void DelayedInitialize()
        {
            recorder = new Recorder ();
            active_encoder = recorder.SetActiveEncoder (active_encoder);
            recorder.Create ();

            ServiceManager.PlayerEngine.ConnectEvent (OnStateChange, PlayerEvent.StateChange);
            ServiceManager.PlayerEngine.ConnectEvent (OnMetadata, PlayerEvent.TrackInfoUpdated);
        }