Java Code Examples for org.fourthline.cling.support.lastchange.LastChange

The following examples show how to use org.fourthline.cling.support.lastchange.LastChange. These examples are extracted from open source projects. 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 Project: TVRemoteIME   Author: kingthy   File: AbstractAVTransportService.java    License: GNU General Public License v2.0 5 votes vote down vote up
@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 #2
Source Project: TVRemoteIME   Author: kingthy   File: AVTransport.java    License: GNU General Public License v2.0 5 votes vote down vote up
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 #3
Source Project: TVRemoteIME   Author: kingthy   File: AbstractAudioRenderingControl.java    License: GNU General Public License v2.0 5 votes vote down vote up
@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 #4
Source Project: TVRemoteIME   Author: kingthy   File: ZxtMediaPlayer.java    License: GNU General Public License v2.0 5 votes vote down vote up
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 #5
Source Project: TVRemoteIME   Author: kingthy   File: ZxtMediaPlayers.java    License: GNU General Public License v2.0 5 votes vote down vote up
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 #6
Source Project: DroidDLNA   Author: offbye   File: AbstractAVTransportService.java    License: GNU General Public License v3.0 5 votes vote down vote up
@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 #7
Source Project: DroidDLNA   Author: offbye   File: AVTransport.java    License: GNU General Public License v3.0 5 votes vote down vote up
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 #8
Source Project: DroidDLNA   Author: offbye   File: AbstractAudioRenderingControl.java    License: GNU General Public License v3.0 5 votes vote down vote up
@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 #9
Source Project: DroidDLNA   Author: offbye   File: ZxtMediaPlayer.java    License: GNU General Public License v3.0 5 votes vote down vote up
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 Project: DroidDLNA   Author: offbye   File: ZxtMediaPlayers.java    License: GNU General Public License v3.0 5 votes vote down vote up
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 #11
Source Project: TVRemoteIME   Author: kingthy   File: AbstractAVTransportService.java    License: GNU General Public License v2.0 4 votes vote down vote up
protected AbstractAVTransportService() {
    this.propertyChangeSupport = new PropertyChangeSupport(this);
    this.lastChange = new LastChange(new AVTransportLastChangeParser());
}
 
Example #12
Source Project: TVRemoteIME   Author: kingthy   File: AbstractAVTransportService.java    License: GNU General Public License v2.0 4 votes vote down vote up
protected AbstractAVTransportService(LastChange lastChange) {
    this.propertyChangeSupport = new PropertyChangeSupport(this);
    this.lastChange = lastChange;
}
 
Example #13
Source Project: TVRemoteIME   Author: kingthy   File: AbstractAVTransportService.java    License: GNU General Public License v2.0 4 votes vote down vote up
protected AbstractAVTransportService(PropertyChangeSupport propertyChangeSupport) {
    this.propertyChangeSupport = propertyChangeSupport;
    this.lastChange = new LastChange(new AVTransportLastChangeParser());
}
 
Example #14
Source Project: TVRemoteIME   Author: kingthy   File: AbstractAVTransportService.java    License: GNU General Public License v2.0 4 votes vote down vote up
protected AbstractAVTransportService(PropertyChangeSupport propertyChangeSupport, LastChange lastChange) {
    this.propertyChangeSupport = propertyChangeSupport;
    this.lastChange = lastChange;
}
 
Example #15
Source Project: TVRemoteIME   Author: kingthy   File: AbstractAVTransportService.java    License: GNU General Public License v2.0 4 votes vote down vote up
@Override
public LastChange getLastChange() {
    return lastChange;
}
 
Example #16
Source Project: TVRemoteIME   Author: kingthy   File: AVTransportService.java    License: GNU General Public License v2.0 4 votes vote down vote up
protected AVTransport createTransport(UnsignedIntegerFourBytes instanceId, LastChange lastChange) {
    return new AVTransport(instanceId, lastChange, StorageMedium.NETWORK);
}
 
Example #17
Source Project: TVRemoteIME   Author: kingthy   File: AVTransport.java    License: GNU General Public License v2.0 4 votes vote down vote up
public AVTransport(UnsignedIntegerFourBytes instanceID, LastChange lastChange, StorageMedium possiblePlayMedium) {
    this(instanceID, lastChange, new StorageMedium[]{possiblePlayMedium});
}
 
Example #18
Source Project: TVRemoteIME   Author: kingthy   File: AVTransport.java    License: GNU General Public License v2.0 4 votes vote down vote up
public LastChange getLastChange() {
    return lastChange;
}
 
Example #19
Source Project: TVRemoteIME   Author: kingthy   File: AbstractAudioRenderingControl.java    License: GNU General Public License v2.0 4 votes vote down vote up
protected AbstractAudioRenderingControl() {
    this.propertyChangeSupport = new PropertyChangeSupport(this);
    this.lastChange = new LastChange(new RenderingControlLastChangeParser());
}
 
Example #20
Source Project: TVRemoteIME   Author: kingthy   File: AbstractAudioRenderingControl.java    License: GNU General Public License v2.0 4 votes vote down vote up
protected AbstractAudioRenderingControl(LastChange lastChange) {
    this.propertyChangeSupport = new PropertyChangeSupport(this);
    this.lastChange = lastChange;
}
 
Example #21
Source Project: TVRemoteIME   Author: kingthy   File: AbstractAudioRenderingControl.java    License: GNU General Public License v2.0 4 votes vote down vote up
protected AbstractAudioRenderingControl(PropertyChangeSupport propertyChangeSupport) {
    this.propertyChangeSupport = propertyChangeSupport;
    this.lastChange = new LastChange(new RenderingControlLastChangeParser());
}
 
Example #22
Source Project: TVRemoteIME   Author: kingthy   File: AbstractAudioRenderingControl.java    License: GNU General Public License v2.0 4 votes vote down vote up
protected AbstractAudioRenderingControl(PropertyChangeSupport propertyChangeSupport, LastChange lastChange) {
    this.propertyChangeSupport = propertyChangeSupport;
    this.lastChange = lastChange;
}
 
Example #23
Source Project: TVRemoteIME   Author: kingthy   File: AbstractAudioRenderingControl.java    License: GNU General Public License v2.0 4 votes vote down vote up
@Override
public LastChange getLastChange() {
    return lastChange;
}
 
Example #24
Source Project: TVRemoteIME   Author: kingthy   File: ZxtMediaPlayer.java    License: GNU General Public License v2.0 4 votes vote down vote up
public LastChange getAvTransportLastChange() {
    return avTransportLastChange;
}
 
Example #25
Source Project: TVRemoteIME   Author: kingthy   File: ZxtMediaPlayer.java    License: GNU General Public License v2.0 4 votes vote down vote up
public LastChange getRenderingControlLastChange() {
    return renderingControlLastChange;
}
 
Example #26
Source Project: TVRemoteIME   Author: kingthy   File: AVTransportService.java    License: GNU General Public License v2.0 4 votes vote down vote up
protected AVTransportService(LastChange lastChange, Map<UnsignedIntegerFourBytes, ZxtMediaPlayer> players) {
    super(lastChange);
    this.players = players;
}
 
Example #27
Source Project: TVRemoteIME   Author: kingthy   File: AudioRenderingControl.java    License: GNU General Public License v2.0 4 votes vote down vote up
protected AudioRenderingControl(LastChange lastChange, Map<UnsignedIntegerFourBytes, ZxtMediaPlayer> players) {
    super(lastChange);
    this.players = players;
}
 
Example #28
Source Project: DroidDLNA   Author: offbye   File: AbstractAVTransportService.java    License: GNU General Public License v3.0 4 votes vote down vote up
protected AbstractAVTransportService() {
    this.propertyChangeSupport = new PropertyChangeSupport(this);
    this.lastChange = new LastChange(new AVTransportLastChangeParser());
}
 
Example #29
Source Project: DroidDLNA   Author: offbye   File: AbstractAVTransportService.java    License: GNU General Public License v3.0 4 votes vote down vote up
protected AbstractAVTransportService(LastChange lastChange) {
    this.propertyChangeSupport = new PropertyChangeSupport(this);
    this.lastChange = lastChange;
}
 
Example #30
Source Project: DroidDLNA   Author: offbye   File: AbstractAVTransportService.java    License: GNU General Public License v3.0 4 votes vote down vote up
protected AbstractAVTransportService(PropertyChangeSupport propertyChangeSupport) {
    this.propertyChangeSupport = propertyChangeSupport;
    this.lastChange = new LastChange(new AVTransportLastChangeParser());
}