Esempio n. 1
0
 internal void UnmapDiscVolume(string uuid)
 {
     lock (this) {
         if (Sources.ContainsKey(uuid))
         {
             DiscSource source = Sources[uuid];
             source.StopPlayingDisc();
             ServiceManager.SourceManager.RemoveSource(source);
             Sources.Remove(uuid);
             Log.DebugFormat("Unmapping disc ({0})", uuid);
         }
     }
 }
Esempio n. 2
0
        protected virtual void HandleDeviceCommand(DiscSource source, DeviceCommandAction action)
        {
            if ((action & DeviceCommandAction.Activate) != 0)
            {
                ServiceManager.SourceManager.SetActiveSource(source);
            }

            if ((action & DeviceCommandAction.Play) != 0)
            {
                ServiceManager.PlaybackController.NextSource = source;
                if (!ServiceManager.PlayerEngine.IsPlaying())
                {
                    ServiceManager.PlaybackController.Next();
                }
            }
        }
Esempio n. 3
0
        protected virtual void MapDiscVolume(IDiscVolume volume)
        {
            DiscSource source = null;

            lock (this) {
                if (Sources.ContainsKey(volume.Uuid))
                {
                    Log.Debug("Already mapped");
                    return;
                }

                source = GetDiscSource(volume);

                if (source == null)
                {
                    return;
                }

                Sources.Add(volume.Uuid, source);
                ServiceManager.SourceManager.AddSource(source);

                // If there are any queued device commands, see if they are to be
                // handled by this new volume (e.g. --device-activate-play=cdda://sr0/)
                try {
                    if (unhandled_device_commands != null)
                    {
                        foreach (DeviceCommand command in unhandled_device_commands)
                        {
                            if (DeviceCommandMatchesSource(source, command))
                            {
                                HandleDeviceCommand(source, command.Action);
                                unhandled_device_commands.Remove(command);
                                if (unhandled_device_commands.Count == 0)
                                {
                                    unhandled_device_commands = null;
                                }
                                break;
                            }
                        }
                    }
                } catch (Exception e) {
                    Log.Exception(e);
                }

                Log.DebugFormat("Mapping disc ({0})", volume.Uuid);
            }
        }
Esempio n. 4
0
        protected virtual void HandleDeviceCommand(DiscSource source, DeviceCommandAction action)
        {
            if ((action & DeviceCommandAction.Activate) != 0) {
                ServiceManager.SourceManager.SetActiveSource (source);
            }

            if ((action & DeviceCommandAction.Play) != 0) {
                ServiceManager.PlaybackController.NextSource = source;
                if (!ServiceManager.PlayerEngine.IsPlaying ()) {
                    ServiceManager.PlaybackController.Next ();
                }
            }
        }
Esempio n. 5
0
 protected abstract bool DeviceCommandMatchesSource(DiscSource source, DeviceCommand command);
Esempio n. 6
0
 protected abstract bool DeviceCommandMatchesSource(DiscSource source, DeviceCommand command);