org.fourthline.cling.support.model.MediaInfo Java Examples

The following examples show how to use org.fourthline.cling.support.model.MediaInfo. 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: ZxtMediaPlayer.java    From DroidDLNA with GNU General Public License v3.0 6 votes vote down vote up
synchronized public void setURI(URI uri, String type, String name, String currentURIMetaData) {
    Log.i(TAG, "setURI " + uri);

    currentMediaInfo = new MediaInfo(uri.toString(),currentURIMetaData);
    currentPositionInfo = new PositionInfo(1, "", uri.toString());

    getAvTransportLastChange().setEventedValue(getInstanceId(),
            new AVTransportVariable.AVTransportURI(uri),
            new AVTransportVariable.CurrentTrackURI(uri));

    transportStateChanged(TransportState.STOPPED);
    
    GPlayer.setMediaListener(new GstMediaListener());
    
    Intent intent = new Intent();
    intent.setClass(mContext, RenderPlayerService.class);
    intent.putExtra("type", type);
    intent.putExtra("name", name);
    intent.putExtra("playURI", uri.toString());
    mContext.startService(intent);
}
 
Example #2
Source File: ZxtMediaPlayer.java    From TVRemoteIME with GNU General Public License v2.0 6 votes vote down vote up
synchronized public void setURI(URI uri, String type, String name, String currentURIMetaData) {
    Log.i(TAG, "setURI " + uri);

    currentMediaInfo = new MediaInfo(uri.toString(),currentURIMetaData);
    currentPositionInfo = new PositionInfo(1, "", uri.toString());

    getAvTransportLastChange().setEventedValue(getInstanceId(),
            new AVTransportVariable.AVTransportURI(uri),
            new AVTransportVariable.CurrentTrackURI(uri));

    transportStateChanged(TransportState.STOPPED);
    
    IJKPlayer.setMediaListener(new GstMediaListener());
    
    Intent intent = new Intent();
    intent.setClass(mContext, RenderPlayerService.class);
    intent.putExtra("type", type);
    intent.putExtra("name", name);
    intent.putExtra("playURI", uri.toString());
    mContext.startService(intent);
}
 
Example #3
Source File: AbstractAVTransportService.java    From TVRemoteIME with GNU General Public License v2.0 5 votes vote down vote up
@UpnpAction(out = {
        @UpnpOutputArgument(name = "NrTracks", stateVariable = "NumberOfTracks", getterName = "getNumberOfTracks"),
        @UpnpOutputArgument(name = "MediaDuration", stateVariable = "CurrentMediaDuration", getterName = "getMediaDuration"),
        @UpnpOutputArgument(name = "CurrentURI", stateVariable = "AVTransportURI", getterName = "getCurrentURI"),
        @UpnpOutputArgument(name = "CurrentURIMetaData", stateVariable = "AVTransportURIMetaData", getterName = "getCurrentURIMetaData"),
        @UpnpOutputArgument(name = "NextURI", stateVariable = "NextAVTransportURI", getterName = "getNextURI"),
        @UpnpOutputArgument(name = "NextURIMetaData", stateVariable = "NextAVTransportURIMetaData", getterName = "getNextURIMetaData"),
        @UpnpOutputArgument(name = "PlayMedium", stateVariable = "PlaybackStorageMedium", getterName = "getPlayMedium"),
        @UpnpOutputArgument(name = "RecordMedium", stateVariable = "RecordStorageMedium", getterName = "getRecordMedium"),
        @UpnpOutputArgument(name = "WriteStatus", stateVariable = "RecordMediumWriteStatus", getterName = "getWriteStatus")
})
public abstract MediaInfo getMediaInfo(@UpnpInputArgument(name = "InstanceID") UnsignedIntegerFourBytes instanceId)
        throws AVTransportException;
 
Example #4
Source File: ZxtMediaPlayer.java    From DroidDLNA with GNU General Public License v3.0 5 votes vote down vote up
public void durationChanged(int duration) {
    log.fine("Duration Changed event received: " + duration);
    synchronized (ZxtMediaPlayer.this) {
        String newValue = ModelUtil.toTimeString(duration/1000);
        currentMediaInfo = new MediaInfo(currentMediaInfo.getCurrentURI(), "",
                new UnsignedIntegerFourBytes(1), newValue, StorageMedium.NETWORK);

        getAvTransportLastChange().setEventedValue(getInstanceId(),
                new AVTransportVariable.CurrentTrackDuration(newValue),
                new AVTransportVariable.CurrentMediaDuration(newValue));
    }
}
 
Example #5
Source File: AbstractAVTransportService.java    From DroidDLNA with GNU General Public License v3.0 5 votes vote down vote up
@UpnpAction(out = {
        @UpnpOutputArgument(name = "NrTracks", stateVariable = "NumberOfTracks", getterName = "getNumberOfTracks"),
        @UpnpOutputArgument(name = "MediaDuration", stateVariable = "CurrentMediaDuration", getterName = "getMediaDuration"),
        @UpnpOutputArgument(name = "CurrentURI", stateVariable = "AVTransportURI", getterName = "getCurrentURI"),
        @UpnpOutputArgument(name = "CurrentURIMetaData", stateVariable = "AVTransportURIMetaData", getterName = "getCurrentURIMetaData"),
        @UpnpOutputArgument(name = "NextURI", stateVariable = "NextAVTransportURI", getterName = "getNextURI"),
        @UpnpOutputArgument(name = "NextURIMetaData", stateVariable = "NextAVTransportURIMetaData", getterName = "getNextURIMetaData"),
        @UpnpOutputArgument(name = "PlayMedium", stateVariable = "PlaybackStorageMedium", getterName = "getPlayMedium"),
        @UpnpOutputArgument(name = "RecordMedium", stateVariable = "RecordStorageMedium", getterName = "getRecordMedium"),
        @UpnpOutputArgument(name = "WriteStatus", stateVariable = "RecordMediumWriteStatus", getterName = "getWriteStatus")
})
public abstract MediaInfo getMediaInfo(@UpnpInputArgument(name = "InstanceID") UnsignedIntegerFourBytes instanceId)
        throws AVTransportException;
 
Example #6
Source File: AbstractAVTransportService.java    From DroidDLNA with 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 File: ZxtMediaPlayer.java    From TVRemoteIME with GNU General Public License v2.0 5 votes vote down vote up
public void durationChanged(int duration) {
    log.fine("Duration Changed event received: " + duration);
    synchronized (ZxtMediaPlayer.this) {
        String newValue = ModelUtil.toTimeString(duration/1000);
        currentMediaInfo = new MediaInfo(currentMediaInfo.getCurrentURI(), "",
                new UnsignedIntegerFourBytes(1), newValue, StorageMedium.NETWORK);

        getAvTransportLastChange().setEventedValue(getInstanceId(),
                new AVTransportVariable.CurrentTrackDuration(newValue),
                new AVTransportVariable.CurrentMediaDuration(newValue));
    }
}
 
Example #8
Source File: AbstractAVTransportService.java    From TVRemoteIME with 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 #9
Source File: ZxtMediaPlayer.java    From TVRemoteIME with GNU General Public License v2.0 4 votes vote down vote up
synchronized public MediaInfo getCurrentMediaInfo() {
    return currentMediaInfo;
}
 
Example #10
Source File: AVTransportService.java    From TVRemoteIME with GNU General Public License v2.0 4 votes vote down vote up
@Override
public MediaInfo getMediaInfo(UnsignedIntegerFourBytes instanceId) throws AVTransportException {
    return getInstance(instanceId).getCurrentMediaInfo();
}
 
Example #11
Source File: AVTransportService.java    From HPlayer with Apache License 2.0 4 votes vote down vote up
@Override
public MediaInfo getMediaInfo(@UpnpInputArgument(name = "InstanceID") UnsignedIntegerFourBytes unsignedIntegerFourBytes) throws AVTransportException {
    return null;
}
 
Example #12
Source File: AVTransportService.java    From TVRemoteIME with GNU General Public License v2.0 4 votes vote down vote up
public MediaInfo getMediaInfo(UnsignedIntegerFourBytes instanceId) throws AVTransportException {
    return findStateMachine(instanceId).getCurrentState().getTransport().getMediaInfo();
}
 
Example #13
Source File: GetMediaInfo.java    From DroidDLNA with GNU General Public License v3.0 4 votes vote down vote up
public void success(ActionInvocation invocation) {
    MediaInfo mediaInfo = new MediaInfo(invocation.getOutputMap());
    received(invocation, mediaInfo);
}
 
Example #14
Source File: AVTransportService.java    From DroidDLNA with GNU General Public License v3.0 4 votes vote down vote up
public MediaInfo getMediaInfo(UnsignedIntegerFourBytes instanceId) throws AVTransportException {
    return findStateMachine(instanceId).getCurrentState().getTransport().getMediaInfo();
}
 
Example #15
Source File: GetMediaInfoCallback.java    From DroidDLNA with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void received(ActionInvocation paramActionInvocation, MediaInfo paramMediaInfo) {
}
 
Example #16
Source File: ZxtMediaPlayer.java    From DroidDLNA with GNU General Public License v3.0 4 votes vote down vote up
synchronized public MediaInfo getCurrentMediaInfo() {
    return currentMediaInfo;
}
 
Example #17
Source File: GetMediaInfo.java    From TVRemoteIME with GNU General Public License v2.0 4 votes vote down vote up
public void success(ActionInvocation invocation) {
    MediaInfo mediaInfo = new MediaInfo(invocation.getOutputMap());
    received(invocation, mediaInfo);
}
 
Example #18
Source File: AVTransportService.java    From DroidDLNA with GNU General Public License v3.0 4 votes vote down vote up
@Override
public MediaInfo getMediaInfo(UnsignedIntegerFourBytes instanceId) throws AVTransportException {
    return getInstance(instanceId).getCurrentMediaInfo();
}
 
Example #19
Source File: GetMediaInfo.java    From TVRemoteIME with GNU General Public License v2.0 votes vote down vote up
public abstract void received(ActionInvocation invocation, MediaInfo mediaInfo); 
Example #20
Source File: GetMediaInfo.java    From DroidDLNA with GNU General Public License v3.0 votes vote down vote up
public abstract void received(ActionInvocation invocation, MediaInfo mediaInfo);