org.fourthline.cling.support.lastchange.LastChange Java Examples
The following examples show how to use
org.fourthline.cling.support.lastchange.LastChange.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ZxtMediaPlayers.java From DroidDLNA with GNU General Public License v3.0 | 5 votes |
public ZxtMediaPlayers(int numberOfPlayers, Context context, LastChange avTransportLastChange, LastChange renderingControlLastChange) { super(numberOfPlayers); this.mContext = context; this.avTransportLastChange = avTransportLastChange; this.renderingControlLastChange = renderingControlLastChange; for (int i = 0; i < numberOfPlayers; i++) { ZxtMediaPlayer player = new ZxtMediaPlayer( new UnsignedIntegerFourBytes(i), mContext, avTransportLastChange, renderingControlLastChange ) { @Override protected void transportStateChanged(TransportState newState) { super.transportStateChanged(newState); if (newState.equals(TransportState.PLAYING)) { onPlay(this); } else if (newState.equals(TransportState.STOPPED)) { onStop(this); } } }; put(player.getInstanceId(), player); } }
Example #2
Source File: AbstractAVTransportService.java From DroidDLNA with GNU General Public License v3.0 | 5 votes |
@Override public void appendCurrentState(LastChange lc, UnsignedIntegerFourBytes instanceId) throws Exception { MediaInfo mediaInfo = getMediaInfo(instanceId); TransportInfo transportInfo = getTransportInfo(instanceId); TransportSettings transportSettings = getTransportSettings(instanceId); PositionInfo positionInfo = getPositionInfo(instanceId); DeviceCapabilities deviceCaps = getDeviceCapabilities(instanceId); lc.setEventedValue( instanceId, new AVTransportVariable.AVTransportURI(URI.create(mediaInfo.getCurrentURI())), new AVTransportVariable.AVTransportURIMetaData(mediaInfo.getCurrentURIMetaData()), new AVTransportVariable.CurrentMediaDuration(mediaInfo.getMediaDuration()), new AVTransportVariable.CurrentPlayMode(transportSettings.getPlayMode()), new AVTransportVariable.CurrentRecordQualityMode(transportSettings.getRecQualityMode()), new AVTransportVariable.CurrentTrack(positionInfo.getTrack()), new AVTransportVariable.CurrentTrackDuration(positionInfo.getTrackDuration()), new AVTransportVariable.CurrentTrackMetaData(positionInfo.getTrackMetaData()), new AVTransportVariable.CurrentTrackURI(URI.create(positionInfo.getTrackURI())), new AVTransportVariable.CurrentTransportActions(getCurrentTransportActions(instanceId)), new AVTransportVariable.NextAVTransportURI(URI.create(mediaInfo.getNextURI())), new AVTransportVariable.NextAVTransportURIMetaData(mediaInfo.getNextURIMetaData()), new AVTransportVariable.NumberOfTracks(mediaInfo.getNumberOfTracks()), new AVTransportVariable.PossiblePlaybackStorageMedia(deviceCaps.getPlayMedia()), new AVTransportVariable.PossibleRecordQualityModes(deviceCaps.getRecQualityModes()), new AVTransportVariable.PossibleRecordStorageMedia(deviceCaps.getRecMedia()), new AVTransportVariable.RecordMediumWriteStatus(mediaInfo.getWriteStatus()), new AVTransportVariable.RecordStorageMedium(mediaInfo.getRecordMedium()), new AVTransportVariable.TransportPlaySpeed(transportInfo.getCurrentSpeed()), new AVTransportVariable.TransportState(transportInfo.getCurrentTransportState()), new AVTransportVariable.TransportStatus(transportInfo.getCurrentTransportStatus()) ); }
Example #3
Source File: AbstractAVTransportService.java From TVRemoteIME with GNU General Public License v2.0 | 5 votes |
@Override public void appendCurrentState(LastChange lc, UnsignedIntegerFourBytes instanceId) throws Exception { MediaInfo mediaInfo = getMediaInfo(instanceId); TransportInfo transportInfo = getTransportInfo(instanceId); TransportSettings transportSettings = getTransportSettings(instanceId); PositionInfo positionInfo = getPositionInfo(instanceId); DeviceCapabilities deviceCaps = getDeviceCapabilities(instanceId); lc.setEventedValue( instanceId, new AVTransportVariable.AVTransportURI(URI.create(mediaInfo.getCurrentURI())), new AVTransportVariable.AVTransportURIMetaData(mediaInfo.getCurrentURIMetaData()), new AVTransportVariable.CurrentMediaDuration(mediaInfo.getMediaDuration()), new AVTransportVariable.CurrentPlayMode(transportSettings.getPlayMode()), new AVTransportVariable.CurrentRecordQualityMode(transportSettings.getRecQualityMode()), new AVTransportVariable.CurrentTrack(positionInfo.getTrack()), new AVTransportVariable.CurrentTrackDuration(positionInfo.getTrackDuration()), new AVTransportVariable.CurrentTrackMetaData(positionInfo.getTrackMetaData()), new AVTransportVariable.CurrentTrackURI(URI.create(positionInfo.getTrackURI())), new AVTransportVariable.CurrentTransportActions(getCurrentTransportActions(instanceId)), new AVTransportVariable.NextAVTransportURI(URI.create(mediaInfo.getNextURI())), new AVTransportVariable.NextAVTransportURIMetaData(mediaInfo.getNextURIMetaData()), new AVTransportVariable.NumberOfTracks(mediaInfo.getNumberOfTracks()), new AVTransportVariable.PossiblePlaybackStorageMedia(deviceCaps.getPlayMedia()), new AVTransportVariable.PossibleRecordQualityModes(deviceCaps.getRecQualityModes()), new AVTransportVariable.PossibleRecordStorageMedia(deviceCaps.getRecMedia()), new AVTransportVariable.RecordMediumWriteStatus(mediaInfo.getWriteStatus()), new AVTransportVariable.RecordStorageMedium(mediaInfo.getRecordMedium()), new AVTransportVariable.TransportPlaySpeed(transportInfo.getCurrentSpeed()), new AVTransportVariable.TransportState(transportInfo.getCurrentTransportState()), new AVTransportVariable.TransportStatus(transportInfo.getCurrentTransportStatus()) ); }
Example #4
Source File: ZxtMediaPlayers.java From TVRemoteIME with GNU General Public License v2.0 | 5 votes |
public ZxtMediaPlayers(int numberOfPlayers, Context context, LastChange avTransportLastChange, LastChange renderingControlLastChange) { super(numberOfPlayers); this.mContext = context; this.avTransportLastChange = avTransportLastChange; this.renderingControlLastChange = renderingControlLastChange; for (int i = 0; i < numberOfPlayers; i++) { ZxtMediaPlayer player = new ZxtMediaPlayer( new UnsignedIntegerFourBytes(i), mContext, avTransportLastChange, renderingControlLastChange ) { @Override protected void transportStateChanged(TransportState newState) { super.transportStateChanged(newState); if (newState.equals(TransportState.PLAYING)) { onPlay(this); } else if (newState.equals(TransportState.STOPPED)) { onStop(this); } } }; put(player.getInstanceId(), player); } }
Example #5
Source File: AVTransport.java From TVRemoteIME with GNU General Public License v2.0 | 5 votes |
public AVTransport(UnsignedIntegerFourBytes instanceID, LastChange lastChange, StorageMedium[] possiblePlayMedia) { this.instanceID = instanceID; this.lastChange = lastChange; setDeviceCapabilities(new DeviceCapabilities(possiblePlayMedia)); setMediaInfo(new MediaInfo()); setTransportInfo(new TransportInfo()); setPositionInfo(new PositionInfo()); setTransportSettings(new TransportSettings()); }
Example #6
Source File: ZxtMediaPlayer.java From DroidDLNA with GNU General Public License v3.0 | 5 votes |
public ZxtMediaPlayer(UnsignedIntegerFourBytes instanceId,Context context, LastChange avTransportLastChange, LastChange renderingControlLastChange) { super(); this.instanceId = instanceId; this.mContext = context; this.avTransportLastChange = avTransportLastChange; this.renderingControlLastChange = renderingControlLastChange; try { // Disconnect the old bus listener /* TODO: That doesn't work for some reason... getPipeline().getBus().disconnect( (Bus.STATE_CHANGED) Reflections.getField(getClass(), "stateChanged").get(this) ); */ // Connect a fixed bus state listener // getPipeline().getBus().connect(busStateChanged); // Connect a bus tag listener // getPipeline().getBus().connect(busTag); } catch (Exception ex) { throw new RuntimeException(ex); } // addMediaListener(new GstMediaListener()); // setVideoSink(videoComponent.getElement()); }
Example #7
Source File: AbstractAudioRenderingControl.java From DroidDLNA with GNU General Public License v3.0 | 5 votes |
@Override public void appendCurrentState(LastChange lc, UnsignedIntegerFourBytes instanceId) throws Exception { for (Channel channel : getCurrentChannels()) { String channelString = channel.name(); lc.setEventedValue( instanceId, new RenderingControlVariable.Mute(new ChannelMute(channel, getMute(instanceId, channelString))), new RenderingControlVariable.Loudness(new ChannelLoudness(channel, getLoudness(instanceId, channelString))), new RenderingControlVariable.Volume(new ChannelVolume(channel, getVolume(instanceId, channelString).getValue().intValue())), new RenderingControlVariable.VolumeDB(new ChannelVolumeDB(channel, getVolumeDB(instanceId, channelString))), new RenderingControlVariable.PresetNameList(PresetName.FactoryDefaults.name()) ); } }
Example #8
Source File: AVTransport.java From DroidDLNA with GNU General Public License v3.0 | 5 votes |
public AVTransport(UnsignedIntegerFourBytes instanceID, LastChange lastChange, StorageMedium[] possiblePlayMedia) { this.instanceID = instanceID; this.lastChange = lastChange; setDeviceCapabilities(new DeviceCapabilities(possiblePlayMedia)); setMediaInfo(new MediaInfo()); setTransportInfo(new TransportInfo()); setPositionInfo(new PositionInfo()); setTransportSettings(new TransportSettings()); }
Example #9
Source File: ZxtMediaPlayer.java From TVRemoteIME with GNU General Public License v2.0 | 5 votes |
public ZxtMediaPlayer(UnsignedIntegerFourBytes instanceId,Context context, LastChange avTransportLastChange, LastChange renderingControlLastChange) { super(); this.instanceId = instanceId; this.mContext = context; this.avTransportLastChange = avTransportLastChange; this.renderingControlLastChange = renderingControlLastChange; try { // Disconnect the old bus listener /* TODO: That doesn't work for some reason... getPipeline().getBus().disconnect( (Bus.STATE_CHANGED) Reflections.getField(getClass(), "stateChanged").get(this) ); */ // Connect a fixed bus state listener // getPipeline().getBus().connect(busStateChanged); // Connect a bus tag listener // getPipeline().getBus().connect(busTag); } catch (Exception ex) { throw new RuntimeException(ex); } // addMediaListener(new GstMediaListener()); // setVideoSink(videoComponent.getElement()); }
Example #10
Source File: AbstractAudioRenderingControl.java From TVRemoteIME with GNU General Public License v2.0 | 5 votes |
@Override public void appendCurrentState(LastChange lc, UnsignedIntegerFourBytes instanceId) throws Exception { for (Channel channel : getCurrentChannels()) { String channelString = channel.name(); lc.setEventedValue( instanceId, new RenderingControlVariable.Mute(new ChannelMute(channel, getMute(instanceId, channelString))), new RenderingControlVariable.Loudness(new ChannelLoudness(channel, getLoudness(instanceId, channelString))), new RenderingControlVariable.Volume(new ChannelVolume(channel, getVolume(instanceId, channelString).getValue().intValue())), new RenderingControlVariable.VolumeDB(new ChannelVolumeDB(channel, getVolumeDB(instanceId, channelString))), new RenderingControlVariable.PresetNameList(PresetName.FactoryDefaults.name()) ); } }
Example #11
Source File: AbstractAudioRenderingControl.java From DroidDLNA with GNU General Public License v3.0 | 4 votes |
protected AbstractAudioRenderingControl(PropertyChangeSupport propertyChangeSupport, LastChange lastChange) { this.propertyChangeSupport = propertyChangeSupport; this.lastChange = lastChange; }
Example #12
Source File: AbstractAVTransportService.java From DroidDLNA with GNU General Public License v3.0 | 4 votes |
@Override public LastChange getLastChange() { return lastChange; }
Example #13
Source File: AVTransportService.java From DroidDLNA with GNU General Public License v3.0 | 4 votes |
protected AVTransport createTransport(UnsignedIntegerFourBytes instanceId, LastChange lastChange) { return new AVTransport(instanceId, lastChange, StorageMedium.NETWORK); }
Example #14
Source File: AVTransport.java From DroidDLNA with GNU General Public License v3.0 | 4 votes |
public AVTransport(UnsignedIntegerFourBytes instanceID, LastChange lastChange, StorageMedium possiblePlayMedium) { this(instanceID, lastChange, new StorageMedium[]{possiblePlayMedium}); }
Example #15
Source File: AVTransport.java From DroidDLNA with GNU General Public License v3.0 | 4 votes |
public LastChange getLastChange() { return lastChange; }
Example #16
Source File: AbstractAudioRenderingControl.java From DroidDLNA with GNU General Public License v3.0 | 4 votes |
protected AbstractAudioRenderingControl() { this.propertyChangeSupport = new PropertyChangeSupport(this); this.lastChange = new LastChange(new RenderingControlLastChangeParser()); }
Example #17
Source File: AbstractAudioRenderingControl.java From DroidDLNA with GNU General Public License v3.0 | 4 votes |
protected AbstractAudioRenderingControl(LastChange lastChange) { this.propertyChangeSupport = new PropertyChangeSupport(this); this.lastChange = lastChange; }
Example #18
Source File: AbstractAudioRenderingControl.java From DroidDLNA with GNU General Public License v3.0 | 4 votes |
protected AbstractAudioRenderingControl(PropertyChangeSupport propertyChangeSupport) { this.propertyChangeSupport = propertyChangeSupport; this.lastChange = new LastChange(new RenderingControlLastChangeParser()); }
Example #19
Source File: AbstractAVTransportService.java From DroidDLNA with GNU General Public License v3.0 | 4 votes |
protected AbstractAVTransportService() { this.propertyChangeSupport = new PropertyChangeSupport(this); this.lastChange = new LastChange(new AVTransportLastChangeParser()); }
Example #20
Source File: AbstractAudioRenderingControl.java From DroidDLNA with GNU General Public License v3.0 | 4 votes |
@Override public LastChange getLastChange() { return lastChange; }
Example #21
Source File: ZxtMediaPlayer.java From DroidDLNA with GNU General Public License v3.0 | 4 votes |
public LastChange getAvTransportLastChange() { return avTransportLastChange; }
Example #22
Source File: ZxtMediaPlayer.java From DroidDLNA with GNU General Public License v3.0 | 4 votes |
public LastChange getRenderingControlLastChange() { return renderingControlLastChange; }
Example #23
Source File: AVTransportService.java From DroidDLNA with GNU General Public License v3.0 | 4 votes |
protected AVTransportService(LastChange lastChange, Map<UnsignedIntegerFourBytes, ZxtMediaPlayer> players) { super(lastChange); this.players = players; }
Example #24
Source File: AudioRenderingControl.java From DroidDLNA with GNU General Public License v3.0 | 4 votes |
protected AudioRenderingControl(LastChange lastChange, Map<UnsignedIntegerFourBytes, ZxtMediaPlayer> players) { super(lastChange); this.players = players; }
Example #25
Source File: DLNAController.java From Popeens-DSub with GNU General Public License v3.0 | 4 votes |
@Override public void create(final boolean playing, final int seconds) { downloadService.setPlayerState(PlayerState.PREPARING); callback = new SubscriptionCallback(getTransportService(), 600) { @Override protected void failed(GENASubscription genaSubscription, UpnpResponse upnpResponse, Exception e, String msg) { Log.w(TAG, "Register subscription callback failed: " + msg, e); } @Override protected void established(GENASubscription genaSubscription) { Action seekAction = genaSubscription.getService().getAction("Seek"); if(seekAction != null) { StateVariable seekMode = genaSubscription.getService().getStateVariable("A_ARG_TYPE_SeekMode"); for(String allowedValue: seekMode.getTypeDetails().getAllowedValues()) { if("REL_TIME".equals(allowedValue)) { supportsSeek = true; } } } Action setupNextAction = genaSubscription.getService().getAction("SetNextAVTransportURI"); if(setupNextAction != null) { supportsSetupNext = true; } startSong(downloadService.getCurrentPlaying(), playing, seconds); downloadService.postDelayed(searchDLNA, SEARCH_UPDATE_INTERVAL_SECONDS); } @Override protected void ended(GENASubscription genaSubscription, CancelReason cancelReason, UpnpResponse upnpResponse) { Log.i(TAG, "Ended subscription"); if(cancelReason != null) { Log.i(TAG, "Cancel Reason: " + cancelReason.toString()); } if(upnpResponse != null) { Log.i(TAG, "Reponse Message: " + upnpResponse.getStatusMessage()); Log.i(TAG, "Response Details: " + upnpResponse.getResponseDetails()); } } @Override protected void eventReceived(GENASubscription genaSubscription) { Map<String, StateVariableValue> m = genaSubscription.getCurrentValues(); try { String lastChangeText = m.get("LastChange").toString(); lastChangeText = lastChangeText.replace(",X_DLNA_SeekTime","").replace(",X_DLNA_SeekByte", ""); LastChange lastChange = new LastChange(new AVTransportLastChangeParser(), lastChangeText); if (lastChange.getEventedValue(0, AVTransportVariable.TransportState.class) == null) { return; } switch (lastChange.getEventedValue(0, AVTransportVariable.TransportState.class).getValue()) { case PLAYING: downloadService.setPlayerState(PlayerState.STARTED); break; case PAUSED_PLAYBACK: downloadService.setPlayerState(PlayerState.PAUSED); break; case STOPPED: boolean failed = false; for(StateVariableValue val: m.values()) { if(val.toString().indexOf("TransportStatus val=\"ERROR_OCCURRED\"") != -1) { Log.w(TAG, "Failed to load with event: " + val.toString()); failed = true; } } if(failed) { failedLoad(); } else if(downloadService.getPlayerState() == PlayerState.STARTED) { // Played until the end downloadService.onSongCompleted(); } else { downloadService.setPlayerState(PlayerState.STOPPED); } break; case TRANSITIONING: downloadService.setPlayerState(PlayerState.PREPARING); break; case NO_MEDIA_PRESENT: downloadService.setPlayerState(PlayerState.IDLE); break; default: } } catch (Exception e) { Log.w(TAG, "Failed to parse UPNP event", e); } } @Override protected void eventsMissed(GENASubscription genaSubscription, int i) { Log.w(TAG, "Event missed: " + i); } }; controlPoint.execute(callback); }
Example #26
Source File: AbstractAudioRenderingControl.java From TVRemoteIME with GNU General Public License v2.0 | 4 votes |
protected AbstractAudioRenderingControl(PropertyChangeSupport propertyChangeSupport) { this.propertyChangeSupport = propertyChangeSupport; this.lastChange = new LastChange(new RenderingControlLastChangeParser()); }
Example #27
Source File: AbstractAVTransportService.java From TVRemoteIME with GNU General Public License v2.0 | 4 votes |
protected AbstractAVTransportService(LastChange lastChange) { this.propertyChangeSupport = new PropertyChangeSupport(this); this.lastChange = lastChange; }
Example #28
Source File: AbstractAVTransportService.java From TVRemoteIME with GNU General Public License v2.0 | 4 votes |
protected AbstractAVTransportService(PropertyChangeSupport propertyChangeSupport) { this.propertyChangeSupport = propertyChangeSupport; this.lastChange = new LastChange(new AVTransportLastChangeParser()); }
Example #29
Source File: AbstractAVTransportService.java From TVRemoteIME with GNU General Public License v2.0 | 4 votes |
protected AbstractAVTransportService(PropertyChangeSupport propertyChangeSupport, LastChange lastChange) { this.propertyChangeSupport = propertyChangeSupport; this.lastChange = lastChange; }
Example #30
Source File: AbstractAVTransportService.java From TVRemoteIME with GNU General Public License v2.0 | 4 votes |
@Override public LastChange getLastChange() { return lastChange; }