org.fourthline.cling.support.avtransport.lastchange.AVTransportLastChangeParser Java Examples
The following examples show how to use
org.fourthline.cling.support.avtransport.lastchange.AVTransportLastChangeParser.
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: AbstractAVTransportService.java From TVRemoteIME with GNU General Public License v2.0 | 4 votes |
protected AbstractAVTransportService() { this.propertyChangeSupport = new PropertyChangeSupport(this); this.lastChange = new LastChange(new AVTransportLastChangeParser()); }
Example #2
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 #3
Source File: ZxtMediaRenderer.java From TVRemoteIME with GNU General Public License v2.0 | 4 votes |
public ZxtMediaRenderer(int numberOfPlayers, String name, Context context) { mContext = context; // This is the backend which manages the actual player instances mediaPlayers = new ZxtMediaPlayers( numberOfPlayers, context, avTransportLastChange, renderingControlLastChange ) { // These overrides connect the player instances to the output/display @Override protected void onPlay(ZxtMediaPlayer player) { // getDisplayHandler().onPlay(player); } @Override protected void onStop(ZxtMediaPlayer player) { // getDisplayHandler().onStop(player); } }; // The connection manager doesn't have to do much, HTTP is stateless LocalService connectionManagerService = binder.read(ZxtConnectionManagerService.class); connectionManager = new DefaultServiceManager(connectionManagerService) { @Override protected Object createServiceInstance() throws Exception { return new ZxtConnectionManagerService(); } }; connectionManagerService.setManager(connectionManager); // The AVTransport just passes the calls on to the backend players LocalService<AVTransportService> avTransportService = binder.read(AVTransportService.class); avTransport = new LastChangeAwareServiceManager<AVTransportService>( avTransportService, new AVTransportLastChangeParser() ) { @Override protected AVTransportService createServiceInstance() throws Exception { return new AVTransportService(avTransportLastChange, mediaPlayers); } }; avTransportService.setManager(avTransport); // The Rendering Control just passes the calls on to the backend players LocalService<AudioRenderingControl> renderingControlService = binder.read(AudioRenderingControl.class); renderingControl = new LastChangeAwareServiceManager<AudioRenderingControl>( renderingControlService, new RenderingControlLastChangeParser() ) { @Override protected AudioRenderingControl createServiceInstance() throws Exception { return new AudioRenderingControl(renderingControlLastChange, mediaPlayers); } }; renderingControlService.setManager(renderingControl); try { UDN udn = UpnpUtil.uniqueSystemIdentifier("msidmr"); device = new LocalDevice( //TODO zxt new DeviceIdentity(udn), new UDADeviceType("MediaRenderer", 1), new DeviceDetails( name, new ManufacturerDetails(Utils.MANUFACTURER), new ModelDetails(Utils.DMR_NAME, Utils.DMR_DESC, "1", Utils.DMR_MODEL_URL), new DLNADoc[] { new DLNADoc("DMR", DLNADoc.Version.V1_5) }, new DLNACaps(new String[] { "av-upload" //, "image-upload", "audio-upload" }) ), new Icon[]{createDefaultDeviceIcon()}, new LocalService[]{ avTransportService, renderingControlService, connectionManagerService } ); Log.i(TAG, "getType: " + device.getType().toString()); } catch (ValidationException ex) { throw new RuntimeException(ex); } runLastChangePushThread(); }
Example #4
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 #5
Source File: AbstractAVTransportService.java From DroidDLNA with GNU General Public License v3.0 | 4 votes |
protected AbstractAVTransportService(PropertyChangeSupport propertyChangeSupport) { this.propertyChangeSupport = propertyChangeSupport; this.lastChange = new LastChange(new AVTransportLastChangeParser()); }
Example #6
Source File: ZxtMediaRenderer.java From DroidDLNA with GNU General Public License v3.0 | 4 votes |
public ZxtMediaRenderer(int numberOfPlayers,Context context) { mContext = context; // This is the backend which manages the actual player instances mediaPlayers = new ZxtMediaPlayers( numberOfPlayers, context, avTransportLastChange, renderingControlLastChange ) { // These overrides connect the player instances to the output/display @Override protected void onPlay(ZxtMediaPlayer player) { // getDisplayHandler().onPlay(player); } @Override protected void onStop(ZxtMediaPlayer player) { // getDisplayHandler().onStop(player); } }; // The connection manager doesn't have to do much, HTTP is stateless LocalService connectionManagerService = binder.read(ZxtConnectionManagerService.class); connectionManager = new DefaultServiceManager(connectionManagerService) { @Override protected Object createServiceInstance() throws Exception { return new ZxtConnectionManagerService(); } }; connectionManagerService.setManager(connectionManager); // The AVTransport just passes the calls on to the backend players LocalService<AVTransportService> avTransportService = binder.read(AVTransportService.class); avTransport = new LastChangeAwareServiceManager<AVTransportService>( avTransportService, new AVTransportLastChangeParser() ) { @Override protected AVTransportService createServiceInstance() throws Exception { return new AVTransportService(avTransportLastChange, mediaPlayers); } }; avTransportService.setManager(avTransport); // The Rendering Control just passes the calls on to the backend players LocalService<AudioRenderingControl> renderingControlService = binder.read(AudioRenderingControl.class); renderingControl = new LastChangeAwareServiceManager<AudioRenderingControl>( renderingControlService, new RenderingControlLastChangeParser() ) { @Override protected AudioRenderingControl createServiceInstance() throws Exception { return new AudioRenderingControl(renderingControlLastChange, mediaPlayers); } }; renderingControlService.setManager(renderingControl); try { UDN udn = UpnpUtil.uniqueSystemIdentifier("msidmr"); device = new LocalDevice( //TODO zxt new DeviceIdentity(udn), new UDADeviceType("MediaRenderer", 1), new DeviceDetails( SettingActivity.getRenderName(context) + " (" + android.os.Build.MODEL + ")", new ManufacturerDetails(Utils.MANUFACTURER), new ModelDetails(Utils.DMR_NAME, Utils.DMR_DESC, "1", Utils.DMR_MODEL_URL), new DLNADoc[] { new DLNADoc("DMR", DLNADoc.Version.V1_5) }, new DLNACaps(new String[] { "av-upload", "image-upload", "audio-upload" }) ), new Icon[]{createDefaultDeviceIcon()}, new LocalService[]{ avTransportService, renderingControlService, connectionManagerService } ); Log.i(TAG, "getType: " + device.getType().toString()); } catch (ValidationException ex) { throw new RuntimeException(ex); } runLastChangePushThread(); }
Example #7
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); }