diff --git a/yaacc/src/main/AndroidManifest.xml b/yaacc/src/main/AndroidManifest.xml
index 33bec904..b22bd4ee 100644
--- a/yaacc/src/main/AndroidManifest.xml
+++ b/yaacc/src/main/AndroidManifest.xml
@@ -9,9 +9,12 @@
+
+
+
itemList.smoothScrollToPosition(lastPosition.getPositionId()), 100);
+ ((LinearLayoutManager) itemList.getLayoutManager()).scrollToPositionWithOffset(lastPosition.getPositionId(), 0);
+ itemList.postDelayed(() -> {
+ ((LinearLayoutManager) itemList.getLayoutManager()).scrollToPositionWithOffset(lastPosition.getPositionId(), 0);
+ }, 200);
bItemAdapter.clear();
bItemAdapter.loadMore();
diff --git a/yaacc/src/main/java/de/yaacc/browser/TabBrowserActivity.java b/yaacc/src/main/java/de/yaacc/browser/TabBrowserActivity.java
index 3967fa27..e56961bd 100644
--- a/yaacc/src/main/java/de/yaacc/browser/TabBrowserActivity.java
+++ b/yaacc/src/main/java/de/yaacc/browser/TabBrowserActivity.java
@@ -18,6 +18,8 @@
package de.yaacc.browser;
import android.Manifest;
+import android.content.ActivityNotFoundException;
+import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
@@ -26,6 +28,8 @@
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
+import android.os.PowerManager;
+import android.provider.Settings;
import android.util.Log;
import android.util.TypedValue;
import android.view.ContextMenu;
@@ -88,9 +92,10 @@ public class TabBrowserActivity extends AppCompatActivity implements OnClickList
Manifest.permission.CHANGE_WIFI_MULTICAST_STATE,
Manifest.permission.READ_EXTERNAL_STORAGE,
Manifest.permission.WRITE_EXTERNAL_STORAGE,
- Manifest.permission.GET_TASKS,
Manifest.permission.RECEIVE_BOOT_COMPLETED,
- Manifest.permission.WAKE_LOCK
+ Manifest.permission.WAKE_LOCK,
+ Manifest.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS
+
};
private static final String CURRENT_TAB_KEY = "currentTab";
//FIXME dirty
@@ -170,6 +175,8 @@ public void onPageSelected(int position) {
Log.d(getClass().getName(), "All permissions granted");
}
+ checkBatteryOptimizationEnabled();
+
// local server startup
upnpClient = ((Yaacc) getApplicationContext()).getUpnpClient();
if (upnpClient == null) {
@@ -188,6 +195,21 @@ public void onPageSelected(int position) {
Log.d(this.getClass().getName(), "on create took: " + (System.currentTimeMillis() - start));
}
+ private void checkBatteryOptimizationEnabled() {
+ Intent intent = new Intent();
+ String packageName = getPackageName();
+ PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
+ if (!pm.isIgnoringBatteryOptimizations(packageName)) {
+ intent.setAction(Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS);
+ intent.setData(Uri.parse("package:" + packageName));
+ }
+ try {
+ startActivity(intent);
+ } catch (ActivityNotFoundException ex) {
+ Log.d(getClass().getName(), "Ignoring exception ActivityNotFoundException during check for battery optimization");
+ }
+ }
+
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
diff --git a/yaacc/src/main/java/de/yaacc/player/AVTransportController.java b/yaacc/src/main/java/de/yaacc/player/AVTransportController.java
index 2cc4cf06..3c3558ae 100644
--- a/yaacc/src/main/java/de/yaacc/player/AVTransportController.java
+++ b/yaacc/src/main/java/de/yaacc/player/AVTransportController.java
@@ -32,7 +32,6 @@
import de.yaacc.R;
import de.yaacc.upnp.ActionState;
-import de.yaacc.upnp.SynchronizationInfo;
import de.yaacc.upnp.UpnpClient;
public class AVTransportController extends AVTransportPlayer {
@@ -48,7 +47,6 @@ public AVTransportController(UpnpClient upnpClient, Device, ?, ?> receiverDevi
+ "@" + deviceName;
setName(deviceName);
setShortName(receiverDevice.getDetails().getFriendlyName());
- setSyncInfo(new SynchronizationInfo());
}
public void onServiceConnected(ComponentName className, IBinder binder) {
diff --git a/yaacc/src/main/java/de/yaacc/player/AVTransportPlayer.java b/yaacc/src/main/java/de/yaacc/player/AVTransportPlayer.java
index 91c6302b..4a2bea20 100644
--- a/yaacc/src/main/java/de/yaacc/player/AVTransportPlayer.java
+++ b/yaacc/src/main/java/de/yaacc/player/AVTransportPlayer.java
@@ -68,7 +68,6 @@ public class AVTransportPlayer extends AbstractPlayer {
private PositionInfo currentPositionInfo;
private ActionState positionActionState = null;
private URI albumArtUri;
- private long itemDuration;
/**
@@ -176,13 +175,13 @@ protected void startItem(PlayableItem playableItem, Object loadedItem) {
return;
}
Log.d(getClass().getName(), "Action SetAVTransportURI ");
- itemDuration = playableItem.getDuration();
final ActionState actionState = new ActionState();
actionState.actionFinished = false;
Item item = playableItem.getItem();
String metadata;
try {
metadata = new DIDLParser().generate((item == null) ? new DIDLContent() : new DIDLContent().addItem(item), false);
+
} catch (Exception e) {
Log.d(getClass().getName(), "Error while generating Didl-Item xml: " + e);
metadata = "";
@@ -562,7 +561,7 @@ private void doExit() {
try {
Thread.sleep(200);
} catch (InterruptedException e) {
- e.printStackTrace();
+ Log.w(getClass().getName(), e);
}
};
waitForActionComplete(actionState, fn);
diff --git a/yaacc/src/main/java/de/yaacc/player/AbstractPlayer.java b/yaacc/src/main/java/de/yaacc/player/AbstractPlayer.java
index 8aef89bf..09f4b22a 100644
--- a/yaacc/src/main/java/de/yaacc/player/AbstractPlayer.java
+++ b/yaacc/src/main/java/de/yaacc/player/AbstractPlayer.java
@@ -41,17 +41,14 @@
import java.net.URI;
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.Calendar;
import java.util.Collections;
import java.util.Date;
import java.util.List;
-import java.util.Locale;
import java.util.Timer;
import java.util.TimerTask;
import de.yaacc.R;
import de.yaacc.Yaacc;
-import de.yaacc.upnp.SynchronizationInfo;
import de.yaacc.upnp.UpnpClient;
/**
@@ -73,7 +70,6 @@ public abstract class AbstractPlayer implements Player, ServiceConnection {
private PlayerService playerService;
private String name;
private String shortName;
- private SynchronizationInfo syncInfo;
private boolean paused;
private Object loadedItem = null;
private int currentLoadedIndex = -1;
@@ -201,7 +197,7 @@ public void previous() {
cancelTimer();
currentIndex--;
if (currentIndex < 0) {
- if (items.size() > 0) {
+ if (!items.isEmpty()) {
currentIndex = items.size() - 1;
} else {
currentIndex = 0;
@@ -249,7 +245,7 @@ public void run() {
doPause();
setProcessingCommand(false);
}
- }, getExecutionTime());
+ }, new Date(System.currentTimeMillis()));
}
/*
@@ -288,9 +284,7 @@ public void run() {
setProcessingCommand(false);
}
}
- }, getExecutionTime());
-
-
+ }, new Date(System.currentTimeMillis()));
}
@@ -320,14 +314,14 @@ public void run() {
toast.show();
});
}
- if (items.size() > 0) {
+ if (!items.isEmpty()) {
stopItem(items.get(currentIndex));
}
isPlaying = false;
paused = false;
setProcessingCommand(false);
}
- }, getExecutionTime());
+ }, new Date(System.currentTimeMillis()));
}
/**
@@ -459,7 +453,7 @@ protected Object loadItem(int toLoadIndex) {
}
protected void loadItem(int previousIndex, int nextIndex) {
- if (items.size() == 0)
+ if (items.isEmpty())
return;
PlayableItem playableItem = items.get(nextIndex);
Object loadedItem = loadItem(nextIndex);
@@ -571,23 +565,14 @@ public void startTimer(final long duration) {
);
Log.d(getClass().getName(), "AndAllowWhileIdle alarm event in: " + (System.currentTimeMillis() + duration));
}
- } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
+ } else {
alarmManager.setExact(
AlarmManager.RTC_WAKEUP,
System.currentTimeMillis() + duration,
alarmIntent
);
Log.d(getClass().getName(), "exact alarm event in: " + (System.currentTimeMillis() + duration));
- } else {
- alarmManager.set(
- AlarmManager.RTC_WAKEUP,
- System.currentTimeMillis() + duration,
- alarmIntent
- );
- Log.d(getClass().getName(), "set alarm event in: " + (System.currentTimeMillis() + duration));
}
-
-
});
}
@@ -759,40 +744,6 @@ public URI getAlbumArt() {
return null;
}
- @Override
- public SynchronizationInfo getSyncInfo() {
- return syncInfo;
- }
-
- @Override
- public void setSyncInfo(SynchronizationInfo syncInfo) {
- if (syncInfo == null) {
- syncInfo = new SynchronizationInfo();
- }
- this.syncInfo = syncInfo;
- }
-
- protected Date getExecutionTime() {
- Calendar execTime = Calendar.getInstance(Locale.getDefault());
- if (getSyncInfo() != null) {
- execTime.set(Calendar.HOUR_OF_DAY, getSyncInfo().getReferencedPresentationTimeOffset().getHour());
- execTime.set(Calendar.MINUTE, getSyncInfo().getReferencedPresentationTimeOffset().getMinute());
- execTime.set(Calendar.SECOND, getSyncInfo().getReferencedPresentationTimeOffset().getSecond());
- execTime.set(Calendar.MILLISECOND, getSyncInfo().getReferencedPresentationTimeOffset().getMillis());
- execTime.add(Calendar.HOUR, getSyncInfo().getOffset().getHour());
- execTime.add(Calendar.MINUTE, getSyncInfo().getOffset().getMinute());
- execTime.add(Calendar.SECOND, getSyncInfo().getOffset().getSecond());
- execTime.add(Calendar.MILLISECOND, getSyncInfo().getOffset().getMillis());
- Log.d(getClass().getName(), "ReferencedRepresentationTimeOffset: " + getSyncInfo().getReferencedPresentationTimeOffset());
- }
- Log.d(getClass().getName(), "current time: " + new Date() + " get execution time: " + execTime.getTime());
- if (execTime.getTime().getTime() <= System.currentTimeMillis()) {
- Log.d(getClass().getName(), "ExecutionTime is in past!! We will start immediately");
- return null;
-
- }
- return execTime.getTime();
- }
protected void executeCommand(TimerTask command, Date executionTime) {
if (execTimer != null) {
@@ -853,12 +804,12 @@ public boolean hasActionGetMute() {
@Override
public void fastForward(int i) {
- seekTo(getCurrentPosition() + (i * 1000));
+ seekTo(getCurrentPosition() + (i * 1000L));
}
@Override
public void fastRewind(int i) {
- seekTo(getCurrentPosition() - (i * 1000));
+ seekTo(getCurrentPosition() - (i * 1000L));
}
}
diff --git a/yaacc/src/main/java/de/yaacc/player/LocalImagePlayer.java b/yaacc/src/main/java/de/yaacc/player/LocalImagePlayer.java
index 4d02249d..2929e273 100644
--- a/yaacc/src/main/java/de/yaacc/player/LocalImagePlayer.java
+++ b/yaacc/src/main/java/de/yaacc/player/LocalImagePlayer.java
@@ -34,6 +34,7 @@
import java.net.URI;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Date;
import java.util.List;
import java.util.Timer;
import java.util.TimerTask;
@@ -42,7 +43,6 @@
import de.yaacc.Yaacc;
import de.yaacc.imageviewer.ImageViewerActivity;
import de.yaacc.imageviewer.ImageViewerBroadcastReceiver;
-import de.yaacc.upnp.SynchronizationInfo;
import de.yaacc.upnp.UpnpClient;
import de.yaacc.util.NotificationId;
@@ -58,7 +58,6 @@ public class LocalImagePlayer implements Player, ServiceConnection {
private Timer commandExecutionTimer;
private String name;
private String shortName;
- private SynchronizationInfo syncInfo;
private PendingIntent notificationIntent;
private PlayerService playerService;
private boolean isPlaying;
@@ -190,7 +189,7 @@ public void run() {
setPlaying(false);
}
- }, getExecutionTime());
+ }, new Date());
}
@@ -218,7 +217,7 @@ public void run() {
setPlaying(true);
}
- }, getExecutionTime());
+ }, new Date());
}
@@ -245,7 +244,7 @@ public void run() {
setPlaying(false);
}
- }, getExecutionTime());
+ }, new Date());
}
@@ -500,22 +499,6 @@ public void setIcon(Bitmap icon) {
}
- @Override
- public SynchronizationInfo getSyncInfo() {
- return syncInfo;
- }
-
- @Override
- public void setSyncInfo(SynchronizationInfo syncInfo) {
- if (syncInfo == null) {
- syncInfo = new SynchronizationInfo();
- }
- this.syncInfo = syncInfo;
- }
-
- private long getExecutionTime() {
- return getSyncInfo().getOffset().toNanos() / 1000000 + 600L;
- }
//TODO Refactor not every player has a volume control
public boolean getMute() {
diff --git a/yaacc/src/main/java/de/yaacc/player/Player.java b/yaacc/src/main/java/de/yaacc/player/Player.java
index 87aeb2a1..cc90b806 100644
--- a/yaacc/src/main/java/de/yaacc/player/Player.java
+++ b/yaacc/src/main/java/de/yaacc/player/Player.java
@@ -24,8 +24,6 @@
import java.net.URI;
import java.util.List;
-import de.yaacc.upnp.SynchronizationInfo;
-
/**
* A Player is able to play stop a couple of MediaObjects
@@ -194,20 +192,7 @@ public interface Player {
void setIcon(Bitmap icon);
- /**
- * Get the synchronization information
- *
- * @return the info object
- */
- SynchronizationInfo getSyncInfo();
-
- /**
- * Set the synchronization information
- *
- * @param syncInfo the info object
- */
- void setSyncInfo(SynchronizationInfo syncInfo);
-
+
boolean getMute();
diff --git a/yaacc/src/main/java/de/yaacc/player/PlayerService.java b/yaacc/src/main/java/de/yaacc/player/PlayerService.java
index 34cf70c9..ef3207f9 100644
--- a/yaacc/src/main/java/de/yaacc/player/PlayerService.java
+++ b/yaacc/src/main/java/de/yaacc/player/PlayerService.java
@@ -43,7 +43,6 @@
import de.yaacc.R;
import de.yaacc.Yaacc;
import de.yaacc.browser.TabBrowserActivity;
-import de.yaacc.upnp.SynchronizationInfo;
import de.yaacc.upnp.UpnpClient;
import de.yaacc.util.NotificationId;
@@ -127,9 +126,9 @@ public HandlerThread getPlayerHandlerThread() {
}
public Player getPlayer(int playerId) {
- Log.d(this.getClass().getName(), "Get Player for id " + playerId);
+ Log.v(this.getClass().getName(), "Get Player for id " + playerId);
if (currentActivePlayer.get(playerId) == null) {
- Log.d(this.getClass().getName(), "Get Player not found");
+ Log.v(this.getClass().getName(), "Get Player not found");
}
return currentActivePlayer.get(playerId);
}
@@ -143,8 +142,7 @@ public Player getPlayer(int playerId) {
* @param items the items to be played
* @return the player
*/
- public List createPlayer(UpnpClient upnpClient,
- SynchronizationInfo syncInfo, List items) {
+ public List createPlayer(UpnpClient upnpClient, List items) {
Log.d(getClass().getName(), "create player...");
List resultList = new ArrayList<>();
if (items.isEmpty()) {
@@ -169,7 +167,7 @@ public List createPlayer(UpnpClient upnpClient,
}
Log.d(getClass().getName(), "video:" + video + " image: " + image + " audio:" + music);
for (Device, ?, ?> device : upnpClient.getReceiverDevices()) {
- result = createPlayer(upnpClient, device, video, image, music, syncInfo);
+ result = createPlayer(upnpClient, device, video, image, music);
if (result != null) {
addPlayer(result);
result.setItems(items.toArray(new PlayableItem[0]));
@@ -199,7 +197,7 @@ public boolean onUnbind(Intent intent) {
* @return the player or null if no device is present
*/
private Player createPlayer(UpnpClient upnpClient, Device receiverDevice,
- boolean video, boolean image, boolean music, SynchronizationInfo syncInfo) {
+ boolean video, boolean image, boolean music) {
if (receiverDevice == null) {
Toast toast = Toast.makeText(upnpClient.getContext(), upnpClient.getContext().getString(R.string.error_no_receiver_device_found), Toast.LENGTH_SHORT);
toast.show();
@@ -217,30 +215,17 @@ private Player createPlayer(UpnpClient upnpClient, Device receiverDevice,
} else if (!video && !image && music) {
contentType = "music";
}
-
- if (receiverDevice.getType().getVersion() == 3) {
- for (Player player : getCurrentPlayersOfType(SyncAVTransportPlayer.class)) {
- if (((SyncAVTransportPlayer) player).getDeviceId().equals(receiverDevice.getIdentity().getUdn().getIdentifierString())
- && ((SyncAVTransportPlayer) player).getContentType().equals(contentType)) {
- shutdown(player);
- }
- }
- result = new SyncAVTransportPlayer(upnpClient, receiverDevice, upnpClient.getContext()
- .getString(R.string.playerNameAvTransport)
- + "-" + contentType + "@"
- + deviceName, receiverDevice.getDetails().getFriendlyName(), contentType);
- } else {
- for (Player player : getCurrentPlayersOfType(AVTransportPlayer.class)) {
- if (((AVTransportPlayer) player).getDeviceId().equals(receiverDevice.getIdentity().getUdn().getIdentifierString())
- && ((AVTransportPlayer) player).getContentType().equals(contentType)) {
- shutdown(player);
- }
+ for (Player player : getCurrentPlayersOfType(AVTransportPlayer.class)) {
+ if (((AVTransportPlayer) player).getDeviceId().equals(receiverDevice.getIdentity().getUdn().getIdentifierString())
+ && ((AVTransportPlayer) player).getContentType().equals(contentType)) {
+ shutdown(player);
}
- result = new AVTransportPlayer(upnpClient, receiverDevice, upnpClient.getContext()
- .getString(R.string.playerNameAvTransport)
- + "-" + contentType + "@"
- + deviceName, receiverDevice.getDetails().getFriendlyName(), contentType);
}
+ result = new AVTransportPlayer(upnpClient, receiverDevice, upnpClient.getContext()
+ .getString(R.string.playerNameAvTransport)
+ + "-" + contentType + "@"
+ + deviceName, receiverDevice.getDetails().getFriendlyName(), contentType);
+
} else {
if (video && !image && !music) {
// use videoplayer
@@ -268,7 +253,6 @@ private Player createPlayer(UpnpClient upnpClient, Device receiverDevice,
R.string.playerShortNameMultiContent));
}
}
- result.setSyncInfo(syncInfo);
return result;
}
@@ -309,20 +293,6 @@ public Player getCurrentPlayerById(Integer id) {
return currentActivePlayer.get(id);
}
- /**
- * returns all current players of the given type.
- *
- * @param typeClazz the requested type
- * @return the currentPlayer
- */
- public List getCurrentPlayersOfType(Class typeClazz, SynchronizationInfo syncInfo) {
-
- List players = getCurrentPlayersOfType(typeClazz);
- for (Player player : players) {
- player.setSyncInfo(syncInfo);
- }
- return players;
- }
/**
* returns all current players of the given type.
@@ -330,7 +300,7 @@ public List getCurrentPlayersOfType(Class typeClazz, SynchronizationInfo
* @param typeClazz the requested type
* @return the currentPlayer
*/
- public List getCurrentPlayersOfType(Class typeClazz) {
+ public List getCurrentPlayersOfType(Class> typeClazz) {
List players = new ArrayList<>();
for (Player player : getCurrentPlayers()) {
if (typeClazz.isInstance(player)) {
diff --git a/yaacc/src/main/java/de/yaacc/player/PlayerServiceBroadcastReceiver.java b/yaacc/src/main/java/de/yaacc/player/PlayerServiceBroadcastReceiver.java
index 1735f17f..569c6528 100644
--- a/yaacc/src/main/java/de/yaacc/player/PlayerServiceBroadcastReceiver.java
+++ b/yaacc/src/main/java/de/yaacc/player/PlayerServiceBroadcastReceiver.java
@@ -47,12 +47,12 @@ public void onReceive(Context context, Intent intent) {
Log.d(this.getClass().getName(), "Execute Action on playerService: " + playerService);
if (ACTION_NEXT.equals(intent.getAction())) {
Integer playerId = intent.getIntExtra(AbstractPlayer.PLAYER_ID, -1);
- Log.d(this.getClass().getName(), "Player of intent not found: " + playerId + " Intent: " + intent.getStringExtra("ID"));
Player player = playerService.getCurrentPlayerById(playerId);
if (player != null) {
+ Log.d(this.getClass().getName(), "Player of intent found: " + playerId + " Intent: " + intent);
player.next();
} else {
- Log.d(this.getClass().getName(), "Player of intent not found: " + playerId);
+ Log.d(this.getClass().getName(), "Player of intent not found: " + playerId + " Intent: " + intent);
}
}
}
diff --git a/yaacc/src/main/java/de/yaacc/player/SyncAVTransportPlayer.java b/yaacc/src/main/java/de/yaacc/player/SyncAVTransportPlayer.java
deleted file mode 100644
index f53fea56..00000000
--- a/yaacc/src/main/java/de/yaacc/player/SyncAVTransportPlayer.java
+++ /dev/null
@@ -1,966 +0,0 @@
-/*
- * Copyright (C) 2013 Tobias Schoene www.yaacc.de
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-package de.yaacc.player;
-
-import android.app.Activity;
-import android.app.PendingIntent;
-import android.content.Context;
-import android.content.Intent;
-import android.net.Uri;
-import android.util.Log;
-import android.widget.Toast;
-
-import org.fourthline.cling.model.action.ActionInvocation;
-import org.fourthline.cling.model.message.UpnpResponse;
-import org.fourthline.cling.model.meta.Device;
-import org.fourthline.cling.model.meta.Service;
-import org.fourthline.cling.model.types.UnsignedIntegerFourBytes;
-import org.fourthline.cling.support.avtransport.callback.GetPositionInfo;
-import org.fourthline.cling.support.avtransport.callback.Seek;
-import org.fourthline.cling.support.avtransport.callback.SetAVTransportURI;
-import org.fourthline.cling.support.contentdirectory.DIDLParser;
-import org.fourthline.cling.support.model.DIDLContent;
-import org.fourthline.cling.support.model.PositionInfo;
-import org.fourthline.cling.support.model.item.Item;
-import org.fourthline.cling.support.renderingcontrol.callback.GetMute;
-import org.fourthline.cling.support.renderingcontrol.callback.GetVolume;
-import org.fourthline.cling.support.renderingcontrol.callback.SetMute;
-import org.fourthline.cling.support.renderingcontrol.callback.SetVolume;
-
-import java.net.URI;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.TimeZone;
-import java.util.Timer;
-import java.util.TimerTask;
-import java.util.UUID;
-import java.util.concurrent.Future;
-
-import de.yaacc.R;
-import de.yaacc.upnp.UpnpClient;
-import de.yaacc.upnp.callback.avtransport.AdjustSyncOffset;
-import de.yaacc.upnp.callback.avtransport.GetSyncOffset;
-import de.yaacc.upnp.callback.avtransport.SetSyncOffset;
-import de.yaacc.upnp.callback.avtransport.SyncPause;
-import de.yaacc.upnp.callback.avtransport.SyncPlay;
-import de.yaacc.upnp.callback.avtransport.SyncStop;
-import de.yaacc.upnp.model.types.SyncOffset;
-import de.yaacc.util.Watchdog;
-
-/**
- * A Player for playing on a remote avtransport device which supports syncplay
- *
- * @author Tobias Schoene (openbit)
- */
-public class SyncAVTransportPlayer extends AbstractPlayer {
- public static final String PLAYER_ID = "PlayerId";
- private String deviceId = "";
- private int id;
- private String contentType;
- private PositionInfo currentPositionInfo;
- private ActionState positionActionState = null;
-
-
- /**
- * @param receiverDevice the receiver device
- * @param upnpClient the client
- * @param name playerName
- */
- public SyncAVTransportPlayer(UpnpClient upnpClient, Device, ?, ?> receiverDevice, String name, String shortName, String contentType) {
- this(upnpClient);
- deviceId = receiverDevice.getIdentity().getUdn().getIdentifierString();
- setName(name);
- setShortName(shortName);
- this.contentType = contentType;
- id = Math.abs(UUID.randomUUID().hashCode());
-
- }
-
- /**
- * @param upnpClient the client
- */
- public SyncAVTransportPlayer(UpnpClient upnpClient) {
- super(upnpClient);
-
- }
-
- private Device, ?, ?> getDevice() {
- return getUpnpClient().getDevice(deviceId);
- }
-
- public String getDeviceId() {
- return deviceId;
- }
-
- public String getContentType() {
- return contentType;
- }
-
- /* (non-Javadoc)
- * @see de.yaacc.player.AbstractPlayer#stopItem(de.yaacc.player.PlayableItem)
- */
- @Override
- protected void stopItem(PlayableItem playableItem) {
- if (getDevice() == null) {
- Log.d(getClass().getName(),
- "No receiver device found: "
- + deviceId);
- return;
- }
- Service, ?> service = getUpnpClient().getAVTransportService(getDevice());
- if (service == null) {
- Log.d(getClass().getName(),
- "No AVTransport-Service found on Device: "
- + getDevice().getDisplayString());
- return;
- }
- Log.d(getClass().getName(), "Action SetAVTransportURI ");
- final ActionState actionState = new ActionState();
-// Now start Stopping
- Log.d(getClass().getName(), "Action SyncStop");
- actionState.actionFinished = false;
-
- SyncStop actionCallback = new SyncStop(new UnsignedIntegerFourBytes(id), service, getSyncInfo().getReferencedPresentationTime(), getSyncInfo().getReferencedClockId()) {
- @Override
- public void failure(ActionInvocation actioninvocation,
- UpnpResponse upnpresponse, String s) {
- Log.d(getClass().getName(), "Failure UpnpResponse: "
- + upnpresponse);
- Log.d(getClass().getName(),
- upnpresponse != null ? "UpnpResponse: "
- + upnpresponse.getResponseDetails() : "");
- Log.d(getClass().getName(), "s: " + s);
- actionState.actionFinished = true;
- }
-
- @Override
- public void success(ActionInvocation actioninvocation) {
- super.success(actioninvocation);
- actionState.actionFinished = true;
- }
- };
- getUpnpClient().getControlPoint().execute(actionCallback);
- }
-
- /* (non-Javadoc)
- * @see de.yaacc.player.AbstractPlayer#loadItem(de.yaacc.player.PlayableItem)
- */
- @Override
- protected Object loadItem(PlayableItem playableItem) {
- return playableItem;
- }
-
- /* (non-Javadoc)
- * @see de.yaacc.player.AbstractPlayer#startItem(de.yaacc.player.PlayableItem, java.lang.Object)
- */
- @Override
- protected void startItem(PlayableItem playableItem, Object loadedItem) {
- if (playableItem == null || getDevice() == null)
- return;
- Log.d(getClass().getName(), "Uri: " + playableItem.getUri());
- Log.d(getClass().getName(), "Duration: " + playableItem.getDuration());
- Log.d(getClass().getName(),
- "MimeType: " + playableItem.getMimeType());
- Log.d(getClass().getName(), "Title: " + playableItem.getTitle());
- Service, ?> service = getUpnpClient().getAVTransportService(getDevice());
- if (service == null) {
- Log.d(getClass().getName(),
- "No AVTransport-Service found on Device: "
- + getDevice().getDisplayString());
- return;
- }
- Log.d(getClass().getName(), "Action SetAVTransportURI ");
- final ActionState actionState = new ActionState();
- actionState.actionFinished = false;
- Item item = playableItem.getItem();
- String metadata;
- try {
- metadata = (item == null) ? "" : new DIDLParser().generate(new DIDLContent().addItem(item), false);
- if ("NOT_IMPLEMENTED".equals(metadata)) {
- metadata = "";
- }
- } catch (Exception e) {
- Log.d(getClass().getName(), "Error while generating Didl-Item xml: " + e);
- metadata = "";
- }
-
- InternalSetAVTransportURI setAVTransportURI = new InternalSetAVTransportURI(new UnsignedIntegerFourBytes(id),
- service, playableItem.getUri().toString(), actionState, metadata);
- getUpnpClient().getControlPoint().execute(setAVTransportURI);
- waitForActionComplete(actionState);
- int tries = 1;
- if (setAVTransportURI.hasFailures) {
- //another try
- Log.d(getClass().getName(), "setAVTransportURI.hasFailures");
- while (setAVTransportURI.hasFailures && tries < 4) {
- tries++;
- Log.d(getClass().getName(), "setAVTransportURI.hasFailures retry:" + tries);
- setAVTransportURI.hasFailures = false;
- getUpnpClient().getControlPoint().execute(setAVTransportURI);
- waitForActionComplete(actionState);
- }
- }
- if (setAVTransportURI.hasFailures) {
- //another try
- Log.d(getClass().getName(), "Can't set AVTransportURI. Giving up");
- return;
- }
-// Now start Playing
- Log.d(getClass().getName(), "Action SyncPlay");
- actionState.actionFinished = false;
- SyncPlay actionCallback = new SyncPlay(new UnsignedIntegerFourBytes(id), service, "", "", getSyncInfo().getReferencedPresentationTime(), getSyncInfo().getReferencedClockId()) {
- @Override
- public void failure(ActionInvocation actioninvocation,
- UpnpResponse upnpresponse, String s) {
- Log.d(getClass().getName(), "Failure UpnpResponse: "
- + upnpresponse);
- Log.d(getClass().getName(),
- upnpresponse != null ? "UpnpResponse: "
- + upnpresponse.getResponseDetails() : "");
- Log.d(getClass().getName(), "s: " + s);
- actionState.actionFinished = true;
- }
-
- @Override
- public void success(ActionInvocation actioninvocation) {
- super.success(actioninvocation);
- actionState.actionFinished = true;
- }
- };
- getUpnpClient().getControlPoint().execute(actionCallback);
- }
-
- public long getCurrentPosition() {
- if (currentPositionInfo == null) {
- getPositionInfo();
- }
- if (currentPositionInfo != null) {
- Log.v(getClass().getName(), "Elapsed time: " + currentPositionInfo.getTrackElapsedSeconds() + " in millis: " + currentPositionInfo.getTrackRemainingSeconds() * 1000);
- return currentPositionInfo.getTrackElapsedSeconds() * 1000;
- }
- return -1;
-
- }
-
- /**
- * Watchdog for async calls to complete
- */
- private void waitForActionComplete(final ActionState actionState) {
- actionState.watchdogFlag = false;
- new Timer().schedule(new TimerTask() {
- @Override
- public void run() {
- actionState.watchdogFlag = true;
- }
- }, 30000L); // 30sec. Watchdog
- while (!(actionState.actionFinished || actionState.watchdogFlag)) {
-// wait for local device is connected
- }
- if (actionState.watchdogFlag) {
- Log.d(getClass().getName(), "Watchdog timeout!");
- }
- if (actionState.actionFinished) {
- Log.d(getClass().getName(), "Action completed!");
- }
- }
-
- /*
- * (non-Javadoc)
- * @see de.yaacc.player.AbstractPlayer#getNotificationIntent()
- */
- @Override
- public PendingIntent getNotificationIntent() {
- Intent notificationIntent = new Intent(getContext(),
- AVTransportPlayerActivity.class);
- Log.d(getClass().getName(), "Put id into intent: " + getId());
- notificationIntent.setData(Uri.parse("http://0.0.0.0/" + getId() + "")); //just for making the intents different http://stackoverflow.com/questions/10561419/scheduling-more-than-one-pendingintent-to-same-activity-using-alarmmanager
- notificationIntent.putExtra(PLAYER_ID, getId());
- return PendingIntent.getActivity(getContext(), 0,
- notificationIntent, PendingIntent.FLAG_IMMUTABLE);
-
- }
-
- /*
- * (non-Javadoc)
- * @see de.yaacc.player.AbstractPlayer#getNotificationId()
- */
- @Override
- protected int getNotificationId() {
- return id;
- }
-
- public void callPause() {
-
- if (getDevice() == null) {
- Log.d(getClass().getName(),
- "No receiver device found: "
- + deviceId);
- return;
- }
- Service, ?> service = getUpnpClient().getAVTransportService(getDevice());
- if (service == null) {
- Log.d(getClass().getName(),
- "No AVTransport-Service found on Device: "
- + getDevice().getDisplayString());
- return;
- }
- Log.d(getClass().getName(), "Action SyncPause ");
- final ActionState actionState = new ActionState();
- actionState.actionFinished = false;
- SyncPause actionCallback = new SyncPause(new UnsignedIntegerFourBytes(id), service, getSyncInfo().getOffset().toString(), getSyncInfo().getReferencedClockId()) {
- @Override
- public void failure(ActionInvocation actioninvocation,
- UpnpResponse upnpresponse, String s) {
- Log.d(getClass().getName(), "Failure UpnpResponse: "
- + upnpresponse);
- Log.d(getClass().getName(),
- upnpresponse != null ? "UpnpResponse: "
- + upnpresponse.getResponseDetails() : "");
- Log.d(getClass().getName(), "s: " + s);
- actionState.actionFinished = true;
- }
-
- @Override
- public void success(ActionInvocation actioninvocation) {
- super.success(actioninvocation);
- actionState.actionFinished = true;
- }
- };
- getUpnpClient().getControlPoint().execute(actionCallback);
- }
-
- @Override
- public URI getAlbumArt() {
- return null;
- }
-
- public void getSyncOffset() {
-
- if (getDevice() == null) {
- Log.d(getClass().getName(),
- "No receiver device found: "
- + deviceId);
- return;
- }
- Service, ?> service = getUpnpClient().getAVTransportService(getDevice());
- if (service == null) {
- Log.d(getClass().getName(),
- "No AVTransport-Service found on Device: "
- + getDevice().getDisplayString());
- return;
- }
- Log.d(getClass().getName(), "Action GetSyncOffset ");
- final ActionState actionState = new ActionState();
- actionState.actionFinished = false;
- String result = "";
- GetSyncOffset actionCallback = new GetSyncOffset(new UnsignedIntegerFourBytes(id), service, result) {
- @Override
- public void failure(ActionInvocation actioninvocation,
- UpnpResponse upnpresponse, String s) {
- Log.d(getClass().getName(), "Failure UpnpResponse: "
- + upnpresponse);
- Log.d(getClass().getName(),
- upnpresponse != null ? "UpnpResponse: "
- + upnpresponse.getResponseDetails() : "");
- Log.d(getClass().getName(), "s: " + s);
- actionState.actionFinished = true;
- }
-
- @Override
- public void success(ActionInvocation actioninvocation) {
- super.success(actioninvocation);
- actionState.actionFinished = true;
- }
- };
- Future> callbackFuture = getUpnpClient().getControlPoint().execute(actionCallback);
- while (!callbackFuture.isDone() || !callbackFuture.isCancelled()) ;
- if (callbackFuture.isDone()) {
- getSyncInfo().setOffset(new SyncOffset(result));
- }
- }
-
- public void setSyncOffset(SyncOffset offset) {
- getSyncInfo().setOffset(offset);
- if (getDevice() == null) {
- Log.d(getClass().getName(),
- "No receiver device found: "
- + deviceId);
- return;
- }
- Service, ?> service = getUpnpClient().getAVTransportService(getDevice());
- if (service == null) {
- Log.d(getClass().getName(),
- "No AVTransport-Service found on Device: "
- + getDevice().getDisplayString());
- return;
- }
- Log.d(getClass().getName(), "Action SetSyncOffset ");
- final ActionState actionState = new ActionState();
- actionState.actionFinished = false;
- SetSyncOffset actionCallback = new SetSyncOffset(new UnsignedIntegerFourBytes(id), service, offset.toString()) {
- @Override
- public void failure(ActionInvocation actioninvocation,
- UpnpResponse upnpresponse, String s) {
- Log.d(getClass().getName(), "Failure UpnpResponse: "
- + upnpresponse);
- Log.d(getClass().getName(),
- upnpresponse != null ? "UpnpResponse: "
- + upnpresponse.getResponseDetails() : "");
- Log.d(getClass().getName(), "s: " + s);
- actionState.actionFinished = true;
- }
-
- @Override
- public void success(ActionInvocation actioninvocation) {
- super.success(actioninvocation);
- actionState.actionFinished = true;
- }
- };
- getUpnpClient().getControlPoint().execute(actionCallback);
- }
-
- public void adjustSyncOffset(SyncOffset offset) {
- getSyncInfo().getOffset().add(offset);
- if (getDevice() == null) {
- Log.d(getClass().getName(),
- "No receiver device found: "
- + deviceId);
- return;
- }
- Service, ?> service = getUpnpClient().getAVTransportService(getDevice());
- if (service == null) {
- Log.d(getClass().getName(),
- "No AVTransport-Service found on Device: "
- + getDevice().getDisplayString());
- return;
- }
- Log.d(getClass().getName(), "Action AdjustSyncOffset ");
- final ActionState actionState = new ActionState();
- actionState.actionFinished = false;
- AdjustSyncOffset actionCallback = new AdjustSyncOffset(new UnsignedIntegerFourBytes(id), service, offset.toString()) {
- @Override
- public void failure(ActionInvocation actioninvocation,
- UpnpResponse upnpresponse, String s) {
- Log.d(getClass().getName(), "Failure UpnpResponse: "
- + upnpresponse);
- Log.d(getClass().getName(),
- upnpresponse != null ? "UpnpResponse: "
- + upnpresponse.getResponseDetails() : "");
- Log.d(getClass().getName(), "s: " + s);
- actionState.actionFinished = true;
- }
-
- @Override
- public void success(ActionInvocation actioninvocation) {
- super.success(actioninvocation);
- actionState.actionFinished = true;
- }
- };
- getUpnpClient().getControlPoint().execute(actionCallback);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see de.yaacc.player.Player#pause()
- */
- @Override
- public void pause() {
- if (isProcessingCommand())
- return;
- setProcessingCommand(true);
- executeCommand(new TimerTask() {
- @Override
- public void run() {
- cancelTimer();
- Context context = getUpnpClient().getContext();
- if (context instanceof Activity) {
- ((Activity) context).runOnUiThread(() -> {
- Toast toast = Toast.makeText(getContext(), getContext()
- .getResources().getString(R.string.pause)
- + getPositionString(), Toast.LENGTH_SHORT);
- toast.show();
- });
- }
- setPlaying(false);
- setProcessingCommand(false);
-
- }
- }, getExecutionTime());
- callPause();
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see de.yaacc.player.Player#start()
- */
- @Override
- public void play() {
- if (isProcessingCommand())
- return;
- setProcessingCommand(true);
- executeCommand(new TimerTask() {
- @Override
- public void run() {
- if (getCurrentIndex() < getItems().size()) {
- Context context = getUpnpClient().getContext();
- if (context instanceof Activity) {
- ((Activity) context).runOnUiThread(() -> {
- Toast toast = Toast.makeText(getContext(), getContext()
- .getResources().getString(R.string.play)
- + getPositionString(), Toast.LENGTH_SHORT);
- toast.show();
- });
- }
- // Start the pictureShow
- setPlaying(true);
- setProcessingCommand(false);
- }
-
- }
- }, getExecutionTime());
- loadItem(getCurrentIndex(), getCurrentIndex());
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see de.yaacc.player.Player#stop()
- */
- @Override
- public void stop() {
- if (isProcessingCommand())
- return;
- setProcessingCommand(true);
- executeCommand(new TimerTask() {
- @Override
- public void run() {
- cancelTimer();
- setCurrentIndex(0);
- Context context = getUpnpClient().getContext();
- if (context instanceof Activity) {
- ((Activity) context).runOnUiThread(() -> {
- Toast toast = Toast.makeText(getContext(), getContext()
- .getResources().getString(R.string.stop)
- + getPositionString(), Toast.LENGTH_SHORT);
- toast.show();
- });
- }
- setPlaying(false);
- setProcessingCommand(false);
- }
- }, getExecutionTime());
-
- if (getItems().size() > 0) {
- stopItem(getItems().get(getCurrentIndex()));
- }
-
- }
-
- public boolean getMute() {
- if (getDevice() == null) {
- Log.d(getClass().getName(),
- "No receiver device found: "
- + deviceId);
- return false;
- }
- Service, ?> service = getUpnpClient().getRenderingControlService(getDevice());
- if (service == null) {
- Log.d(getClass().getName(),
- "No AVTransport-Service found on Device: "
- + getDevice().getDisplayString());
- return false;
- }
- Log.d(getClass().getName(), "Action get Mute ");
- final ActionState actionState = new ActionState();
- actionState.actionFinished = false;
- GetMute actionCallback = new GetMute(new UnsignedIntegerFourBytes(id), service) {
- @Override
- public void failure(ActionInvocation actioninvocation,
- UpnpResponse upnpresponse, String s) {
- Log.d(getClass().getName(), "Failure UpnpResponse: "
- + upnpresponse);
- Log.d(getClass().getName(),
- upnpresponse != null ? "UpnpResponse: "
- + upnpresponse.getResponseDetails() : "");
- Log.d(getClass().getName(), "s: " + s);
- actionState.actionFinished = true;
- }
-
- @Override
- public void success(ActionInvocation actioninvocation) {
- super.success(actioninvocation);
- actionState.actionFinished = true;
- }
-
- @Override
- public void received(ActionInvocation actionInvocation, boolean currentMute) {
- actionState.result = currentMute;
-
- }
- };
- getUpnpClient().getControlPoint().execute(actionCallback);
- Watchdog watchdog = Watchdog.createWatchdog(10000L);
- watchdog.start();
-
- while (!actionState.actionFinished && !watchdog.hasTimeout()) {
- //active wait
- }
- if (watchdog.hasTimeout()) {
- Log.d(getClass().getName(), "Timeout occurred");
- } else {
- watchdog.cancel();
- }
- return actionState.result != null && (Boolean) actionState.result;
-
-
- }
-
- public void setMute(boolean mute) {
- if (getDevice() == null) {
- Log.d(getClass().getName(),
- "No receiver device found: "
- + deviceId);
- return;
- }
- Service, ?> service = getUpnpClient().getRenderingControlService(getDevice());
- if (service == null) {
- Log.d(getClass().getName(),
- "No AVTransport-Service found on Device: "
- + getDevice().getDisplayString());
- return;
- }
- Log.d(getClass().getName(), "Action set Mute ");
- final ActionState actionState = new ActionState();
- actionState.actionFinished = false;
- SetMute actionCallback = new SetMute(new UnsignedIntegerFourBytes(id), service, mute) {
- @Override
- public void failure(ActionInvocation actioninvocation,
- UpnpResponse upnpresponse, String s) {
- Log.d(getClass().getName(), "Failure UpnpResponse: "
- + upnpresponse);
- Log.d(getClass().getName(),
- upnpresponse != null ? "UpnpResponse: "
- + upnpresponse.getResponseDetails() : "");
- Log.d(getClass().getName(), "s: " + s);
- actionState.actionFinished = true;
- }
-
- @Override
- public void success(ActionInvocation actioninvocation) {
- super.success(actioninvocation);
- actionState.actionFinished = true;
- }
- };
- getUpnpClient().getControlPoint().execute(actionCallback);
- }
-
- public int getVolume() {
- if (getDevice() == null) {
- Log.d(getClass().getName(),
- "No receiver device found: "
- + deviceId);
- return 0;
- }
- Service, ?> service = getUpnpClient().getRenderingControlService(getDevice());
- if (service == null) {
- Log.d(getClass().getName(),
- "No AVTransport-Service found on Device: "
- + getDevice().getDisplayString());
- return 0;
- }
- Log.d(getClass().getName(), "Action get Volume ");
- final ActionState actionState = new ActionState();
- actionState.actionFinished = false;
- GetVolume actionCallback = new GetVolume(new UnsignedIntegerFourBytes(id), service) {
- @Override
- public void failure(ActionInvocation actioninvocation,
- UpnpResponse upnpresponse, String s) {
- Log.d(getClass().getName(), "Failure UpnpResponse: "
- + upnpresponse);
- Log.d(getClass().getName(),
- upnpresponse != null ? "UpnpResponse: "
- + upnpresponse.getResponseDetails() : "");
- Log.d(getClass().getName(), "s: " + s);
- actionState.actionFinished = true;
- }
-
- @Override
- public void success(ActionInvocation actioninvocation) {
- super.success(actioninvocation);
- actionState.actionFinished = true;
- }
-
- @Override
- public void received(ActionInvocation actionInvocation, int currentVolume) {
- actionState.result = currentVolume;
-
- }
- };
- getUpnpClient().getControlPoint().execute(actionCallback);
- Watchdog watchdog = Watchdog.createWatchdog(10000L);
- watchdog.start();
-
- while (!actionState.actionFinished && !watchdog.hasTimeout()) {
- //active wait
- }
- if (watchdog.hasTimeout()) {
- Log.d(getClass().getName(), "Timeout occurred");
- } else {
- watchdog.cancel();
- }
- return actionState.result == null ? 0 : (Integer) actionState.result;
-
-
- }
-
- public void setVolume(int volume) {
- if (getDevice() == null) {
- Log.d(getClass().getName(),
- "No receiver device found: "
- + deviceId);
- return;
- }
- Service, ?> service = getUpnpClient().getRenderingControlService(getDevice());
- if (service == null) {
- Log.d(getClass().getName(),
- "No AVTransport-Service found on Device: "
- + getDevice().getDisplayString());
- return;
- }
- Log.d(getClass().getName(), "Action set Volume ");
- final ActionState actionState = new ActionState();
- actionState.actionFinished = false;
- SetVolume actionCallback = new SetVolume(new UnsignedIntegerFourBytes(id), service, volume) {
- @Override
- public void failure(ActionInvocation actioninvocation,
- UpnpResponse upnpresponse, String s) {
- Log.d(getClass().getName(), "Failure UpnpResponse: "
- + upnpresponse);
- Log.d(getClass().getName(),
- upnpresponse != null ? "UpnpResponse: "
- + upnpresponse.getResponseDetails() : "");
- Log.d(getClass().getName(), "s: " + s);
- actionState.actionFinished = true;
- }
-
- @Override
- public void success(ActionInvocation actioninvocation) {
- super.success(actioninvocation);
- actionState.actionFinished = true;
- }
- };
- getUpnpClient().getControlPoint().execute(actionCallback);
- }
-
- @Override
- public void seekTo(long millisecondsFromStart) {
- if (getDevice() == null) {
- Log.d(getClass().getName(),
- "No receiver device found: "
- + deviceId);
- return;
- }
- Service, ?> service = getUpnpClient().getAVTransportService(getDevice());
- if (service == null) {
- Log.d(getClass().getName(),
- "No AVTransport-Service found on Device: "
- + getDevice().getDisplayString());
- return;
- }
- Log.d(getClass().getName(), "Action seek ");
- final ActionState actionState = new ActionState();
- actionState.actionFinished = false;
- SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm:ss");
- dateFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
- String relativeTimeTarget = dateFormat.format(millisecondsFromStart);
- Seek seekAction = new Seek(new UnsignedIntegerFourBytes(id), service, relativeTimeTarget) {
- @Override
- public void success(ActionInvocation invocation) {
- //super.success(invocation);
- Log.d(getClass().getName(), "success seek");
- executeCommand(new TimerTask() {
- @Override
- public void run() {
- updateTimer();
- }
- }, new Date(System.currentTimeMillis() + 2000)); //wait two seconds before reading time from renderer
-
- }
-
- @Override
- public void failure(ActionInvocation arg0, UpnpResponse arg1, String arg2) {
- Log.d(getClass().getName(), "fail seek");
- }
- };
- getUpnpClient().getControlPoint().execute(seekAction);
-
- }
-
- protected void getPositionInfo() {
- if (positionActionState != null && !positionActionState.actionFinished) {
- return;
- }
- Log.d(getClass().getName(),
- "GetPositioninfo");
- if (getDevice() == null) {
- Log.d(getClass().getName(),
- "No receiver device found: "
- + deviceId);
- return;
- }
- Service, ?> service = getUpnpClient().getAVTransportService(getDevice());
- if (service == null) {
- Log.d(getClass().getName(),
- "No AVTransport-Service found on Device: "
- + getDevice().getDisplayString());
- return;
- }
- Log.d(getClass().getName(), "Action get position info ");
- positionActionState = new ActionState();
- positionActionState.actionFinished = false;
- GetPositionInfo actionCallback = new GetPositionInfo(new UnsignedIntegerFourBytes(id), service) {
- @Override
- public void failure(ActionInvocation actioninvocation,
- UpnpResponse upnpresponse, String s) {
- Log.d(getClass().getName(), "Failure UpnpResponse: "
- + upnpresponse);
- Log.d(getClass().getName(),
- upnpresponse != null ? "UpnpResponse: "
- + upnpresponse.getResponseDetails() : "");
- Log.d(getClass().getName(), "s: " + s);
- positionActionState.actionFinished = true;
- }
-
- @Override
- public void success(ActionInvocation actioninvocation) {
- super.success(actioninvocation);
- positionActionState.actionFinished = true;
- }
-
- @Override
- public void received(ActionInvocation actionInvocation, PositionInfo positionInfo) {
- positionActionState.result = positionInfo;
- currentPositionInfo = positionInfo;
- Log.d(getClass().getName(), "received Positioninfo= RelTime: " + positionInfo.getRelTime());
-
- }
- };
-
- getUpnpClient().getControlPoint().execute(actionCallback);
-
-
- }
-
- @Override
- public String getDuration() {
- if (currentPositionInfo == null) {
- getPositionInfo();
- }
- if (currentPositionInfo != null) {
- return currentPositionInfo.getTrackDuration();
- }
- return "00:00:00";
- }
-
- @Override
- public String getElapsedTime() {
- getPositionInfo();
-
- if (currentPositionInfo != null) {
- return currentPositionInfo.getRelTime();
- }
- return "00:00:00";
- }
-
- @Override
- public long getRemainingTime() {
- if (currentPositionInfo == null) {
- getPositionInfo();
- }
- if (currentPositionInfo != null) {
- return currentPositionInfo.getTrackRemainingSeconds() * 1000;
- }
- return -1;
- }
-
- private static class InternalSetAVTransportURI extends SetAVTransportURI {
- public boolean hasFailures = false;
- ActionState actionState;
-
- private InternalSetAVTransportURI(UnsignedIntegerFourBytes instanceId, Service, ?> service, String uri,
- ActionState actionState, String metadata) {
- super(instanceId, service, uri, metadata);
- this.actionState = actionState;
- }
-
- @Override
- public void failure(ActionInvocation actioninvocation,
- UpnpResponse upnpresponse, String s) {
- Log.d(getClass().getName(), "Failure UpnpResponse: " + upnpresponse);
- if (upnpresponse != null) {
- Log.d(getClass().getName(),
- "UpnpResponse: " + upnpresponse.getResponseDetails());
- Log.d(getClass().getName(),
- "UpnpResponse: " + upnpresponse.getStatusMessage());
- Log.d(getClass().getName(),
- "UpnpResponse: " + upnpresponse.getStatusCode());
- }
- hasFailures = true;
- Log.d(getClass().getName(), "s: " + s);
- actionState.actionFinished = true;
- }
-
- @Override
- public void success(ActionInvocation actioninvocation) {
- super.success(actioninvocation);
- actionState.actionFinished = true;
- }
- }
-
- private static class ActionState {
- public boolean actionFinished = false;
- public boolean watchdogFlag = false;
- public Object result = null;
- }
-
-
- public boolean hasActionGetVolume() {
- if (getDevice() == null) {
- Log.d(getClass().getName(),
- "No receiver device found: "
- + deviceId);
- return false;
- }
- return getUpnpClient().hasActionGetVolume(getDevice());
- }
-
- public boolean hasActionGetMute() {
- if (getDevice() == null) {
- Log.d(getClass().getName(),
- "No receiver device found: "
- + deviceId);
- return false;
- }
- return getUpnpClient().hasActionGetMute(getDevice());
- }
-}
-
diff --git a/yaacc/src/main/java/de/yaacc/settings/SettingsFragment.java b/yaacc/src/main/java/de/yaacc/settings/SettingsFragment.java
index 0dbf7579..890c669d 100644
--- a/yaacc/src/main/java/de/yaacc/settings/SettingsFragment.java
+++ b/yaacc/src/main/java/de/yaacc/settings/SettingsFragment.java
@@ -34,12 +34,7 @@ public class SettingsFragment extends PreferenceFragmentCompat {
@Override
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
setPreferencesFromResource(R.xml.preference, rootKey);
- EditTextPreference numberPreference = findPreference(getString(R.string.settings_device_playback_offset_key));
- if (numberPreference != null) {
- numberPreference.setOnBindEditTextListener(
- editText -> editText.setInputType(InputType.TYPE_CLASS_NUMBER));
- }
- numberPreference = findPreference(getString(R.string.settings_browse_load_threads_key));
+ EditTextPreference numberPreference = findPreference(getString(R.string.settings_browse_load_threads_key));
if (numberPreference != null) {
numberPreference.setOnBindEditTextListener(
editText -> editText.setInputType(InputType.TYPE_CLASS_NUMBER));
diff --git a/yaacc/src/main/java/de/yaacc/upnp/SynchronizationInfo.java b/yaacc/src/main/java/de/yaacc/upnp/SynchronizationInfo.java
deleted file mode 100644
index d1421fdf..00000000
--- a/yaacc/src/main/java/de/yaacc/upnp/SynchronizationInfo.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Copyright (C) 2014 Tobias Schoene www.yaacc.de
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-package de.yaacc.upnp;
-
-import de.yaacc.upnp.model.types.SyncOffset;
-
-/**
- * @author Tobias Schoene (TheOpenBit)
- */
-public class SynchronizationInfo {
- String speed = "";
- String referencedPositionUnits = "";
- String referencedPosition = "";
- String referencedPresentationTime = "";
- String referencedClockId = "";
-
-
- SyncOffset offset = new SyncOffset();
-
- public SynchronizationInfo() {
- }
-
- public SynchronizationInfo(String speed, String referencedPositionUnits, String referencedPosition, String referencedPresentationTime, String referencedClockId) {
- this.speed = speed;
- this.referencedPositionUnits = referencedPositionUnits;
- this.referencedPosition = referencedPosition;
- this.referencedPresentationTime = referencedPresentationTime;
- this.referencedClockId = referencedClockId;
- }
-
- public String getReferencedClockId() {
- return referencedClockId;
- }
-
- public void setReferencedClockId(String referencedClockId) {
- this.referencedClockId = referencedClockId;
- }
-
- public String getSpeed() {
- return speed;
- }
-
- public void setSpeed(String speed) {
- this.speed = speed;
- }
-
- public String getReferencedPositionUnits() {
- return referencedPositionUnits;
- }
-
- public void setReferencedPositionUnits(String referencedPositionUnits) {
- this.referencedPositionUnits = referencedPositionUnits;
- }
-
- public String getReferencedPosition() {
- return referencedPosition;
- }
-
- public void setReferencedPosition(String referencedPosition) {
- this.referencedPosition = referencedPosition;
- }
-
- public String getReferencedPresentationTime() {
- return referencedPresentationTime;
- }
-
- public void setReferencedPresentationTime(String referencedPresentationTime) {
- this.referencedPresentationTime = referencedPresentationTime;
- }
-
- public SyncOffset getReferencedPresentationTimeOffset() {
- return new SyncOffset(referencedPresentationTime);
- }
-
- public SyncOffset getOffset() {
- return offset;
- }
-
- public void setOffset(SyncOffset offset) {
- this.offset = offset;
- }
-}
diff --git a/yaacc/src/main/java/de/yaacc/upnp/UpnpClient.java b/yaacc/src/main/java/de/yaacc/upnp/UpnpClient.java
index 944db087..46834859 100644
--- a/yaacc/src/main/java/de/yaacc/upnp/UpnpClient.java
+++ b/yaacc/src/main/java/de/yaacc/upnp/UpnpClient.java
@@ -18,6 +18,7 @@
*/
package de.yaacc.upnp;
+import android.annotation.SuppressLint;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
@@ -86,15 +87,12 @@
import java.security.NoSuchAlgorithmException;
import java.time.Duration;
import java.util.ArrayList;
-import java.util.Calendar;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
-import java.util.Date;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
-import java.util.Locale;
import java.util.Optional;
import java.util.Set;
import java.util.concurrent.TimeUnit;
@@ -110,7 +108,6 @@
import de.yaacc.player.PlayerService;
import de.yaacc.upnp.callback.contentdirectory.ContentDirectoryBrowseActionCallback;
import de.yaacc.upnp.callback.contentdirectory.ContentDirectoryBrowseResult;
-import de.yaacc.upnp.model.types.SyncOffset;
import de.yaacc.upnp.server.YaaccUpnpServerService;
import de.yaacc.upnp.server.avtransport.AvTransport;
import de.yaacc.util.FileDownloader;
@@ -128,7 +125,7 @@ public class UpnpClient implements RegistryListener, ServiceConnection {
SharedPreferences preferences;
private UpnpService upnpService;
private Context context;
- private boolean mute = false;
+
private PlayerService playerService;
private Device, ?, ?> localDummyDevice;
@@ -153,8 +150,7 @@ public boolean initialize(Context context) {
this.preferences = PreferenceManager.getDefaultSharedPreferences(context);
// FIXME check if this is right: Context.BIND_AUTO_CREATE kills the
// service after closing the activity
- boolean result = context.bindService(new Intent(context, UpnpRegistryService.class), this, Context.BIND_AUTO_CREATE);
- return result;
+ return context.bindService(new Intent(context, UpnpRegistryService.class), this, Context.BIND_AUTO_CREATE);
}
return false;
}
@@ -169,17 +165,6 @@ public boolean startService() {
return true;
}
- private SyncOffset getDeviceSyncOffset() {
- int offsetValue = Integer.parseInt(preferences.getString(getContext().getString(R.string.settings_device_playback_offset_key), "0"));
- if (offsetValue > 999) {
- Editor editor = preferences.edit();
- editor.putString(getContext().getString(R.string.settings_device_playback_offset_key), String.valueOf(999));
- editor.apply();
- offsetValue = 999;
- }
- return new SyncOffset(true, 0, 0, 0, offsetValue, 0, 0);
- }
-
private void fireReceiverDeviceAdded(Device, ?, ?> device) {
for (UpnpClientListener listener : new ArrayList<>(listeners)) {
listener.receiverDeviceAdded(device);
@@ -649,7 +634,7 @@ private void enrichWithCover(ContentDirectoryBrowseResult callbackResult) {
if (cont == null) {
return;
}
- if (cont.getContainers().size() != 0) {
+ if (!cont.getContainers().isEmpty()) {
return;
}
URI albumArtUri = null;
@@ -750,16 +735,7 @@ public List initializePlayers(List- items) {
if (!waitForPlayerServiceComeUp()) {
return Collections.emptyList();
}
- SynchronizationInfo synchronizationInfo = new SynchronizationInfo();
- synchronizationInfo.setOffset(getDeviceSyncOffset()); //device specific offset
-
- Calendar now = Calendar.getInstance(Locale.getDefault());
- now.add(Calendar.MILLISECOND, Integer.parseInt(preferences.getString(getContext().getString(R.string.settings_default_playback_delay_key), "0")));
- String referencedPresentationTime = new SyncOffset(true, now.get(Calendar.HOUR_OF_DAY), now.get(Calendar.MINUTE), now.get(Calendar.SECOND), now.get(Calendar.MILLISECOND), 0, 0).toString();
- Log.d(getClass().getName(), "CurrentTime: " + new Date() + " representationTime: " + referencedPresentationTime);
- synchronizationInfo.setReferencedPresentationTime(referencedPresentationTime);
-
- return playerService.createPlayer(this, synchronizationInfo, toPlayableItems(items));
+ return playerService.createPlayer(this, toPlayableItems(items));
}
@NonNull
@@ -809,13 +785,13 @@ public List initializePlayers(AvTransport transport) {
PlayableItem playableItem = new PlayableItem();
List items = new ArrayList<>();
if (transport == null) {
- return playerService.createPlayer(this, null, items);
+ return playerService.createPlayer(this, items);
}
Log.d(getClass().getName(), "TransportId: " + transport.getInstanceId());
PositionInfo positionInfo = transport.getPositionInfo();
Log.d(getClass().getName(), "positionInfo: " + positionInfo);
if (positionInfo == null) {
- return playerService.createPlayer(this, transport.getSynchronizationInfo(), items);
+ return playerService.createPlayer(this, items);
}
DIDLContent metadata = null;
try {
@@ -857,7 +833,7 @@ public List initializePlayers(AvTransport transport) {
Log.d(getClass().getName(), "Current duration: " + positionInfo.getTrackDuration());
Log.d(getClass().getName(), "TrackMetaData: " + positionInfo.getTrackMetaData());
Log.d(getClass().getName(), "MimeType: " + playableItem.getMimeType());
- return playerService.createPlayer(this, transport.getSynchronizationInfo(), items);
+ return playerService.createPlayer(this, items);
}
/**
@@ -882,12 +858,10 @@ public List getCurrentPlayers(AvTransport transport) {
if (playerService == null) {
return Collections.emptyList();
}
- List items = new ArrayList<>();
+
if (transport == null) {
return Collections.emptyList();
}
- SynchronizationInfo synchronizationInfo = transport.getSynchronizationInfo();
- synchronizationInfo.setOffset(getDeviceSyncOffset());
Log.d(getClass().getName(), "TransportId: " + transport.getInstanceId());
PositionInfo positionInfo = transport.getPositionInfo();
@@ -921,13 +895,13 @@ public List getCurrentPlayers(AvTransport transport) {
break;
}
}
- if (mimeType.equals("")) {
+ if (mimeType.isEmpty()) {
mimeType = MimeTypeMap.getSingleton().getMimeTypeFromExtension(fileExtension);
}
playableItem.setMimeType(mimeType);
playableItem.setUri(Uri.parse(positionInfo.getTrackURI()));
Log.d(getClass().getName(), "MimeType: " + playableItem.getMimeType());
- return playerService.getCurrentPlayersOfType(playerService.getPlayerClassForMimeType(mimeType), synchronizationInfo);
+ return playerService.getCurrentPlayersOfType(playerService.getPlayerClassForMimeType(mimeType));
}
/**
@@ -1028,7 +1002,7 @@ public void setReceiverDeviceIds(Set receiverDeviceIds) {
}
}
// remove all unknown ids
- receiverDeviceIds.removeAll(unknowsIds);
+ unknowsIds.forEach(receiverDeviceIds::remove);
setReceiverDeviceIds(receiverDeviceIds);
return result;
}
@@ -1238,16 +1212,7 @@ public List initializePlayersWithPlayableItems(List items)
if (!waitForPlayerServiceComeUp()) {
return Collections.emptyList();
}
- SynchronizationInfo synchronizationInfo = new SynchronizationInfo();
- synchronizationInfo.setOffset(getDeviceSyncOffset()); //device specific offset
-
- Calendar now = Calendar.getInstance(Locale.getDefault());
- now.add(Calendar.MILLISECOND, Integer.valueOf(preferences.getString(getContext().getString(R.string.settings_default_playback_delay_key), "0")));
- String referencedPresentationTime = new SyncOffset(true, now.get(Calendar.HOUR_OF_DAY), now.get(Calendar.MINUTE), now.get(Calendar.SECOND), now.get(Calendar.MILLISECOND), 0, 0).toString();
- Log.d(getClass().getName(), "CurrentTime: " + new Date().toString() + " representationTime: " + referencedPresentationTime);
- synchronizationInfo.setReferencedPresentationTime(referencedPresentationTime);
-
- return playerService.createPlayer(this, synchronizationInfo, items);
+ return playerService.createPlayer(this, items);
}
public boolean getMute(Device, ?, ?> device) {
@@ -1578,10 +1543,9 @@ public DeviceDetails getDetails() {
public void addToPlaylist(DIDLObject item) {
List
- itemList = toItemList(item);
- if (getCurrentPlayers().stream().filter(
- p -> getReceiverDevices().stream()
- .map(d -> d.getIdentity().getUdn().getIdentifierString())
- .collect(Collectors.toList()).contains(p.getDeviceId())).collect(Collectors.toList()).isEmpty()) {
+ if (getCurrentPlayers().stream().noneMatch(p -> getReceiverDevices().stream()
+ .map(d -> d.getIdentity().getUdn().getIdentifierString())
+ .collect(Collectors.toList()).contains(p.getDeviceId()))) {
initializePlayers(itemList);
} else {
getCurrentPlayers().stream().filter(
@@ -1602,7 +1566,7 @@ public PlayableItem createPlayableItem(Uri uri) throws IOException {
final String title = "shared with ♥ by yaacc";
//auto closeable requires Android code level 29 current min level is 27
try (MediaMetadataRetriever metaRetriever = new MediaMetadataRetriever()) {
- Res res = null;
+ Res res;
try {
metaRetriever.setDataSource(uriString);
long duration = Long.parseLong(metaRetriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DURATION));
@@ -1630,8 +1594,8 @@ public PlayableItem createPlayableItem(Uri uri) throws IOException {
if (this.getPreferences().getBoolean(getContext().getString(R.string.settings_local_server_proxy_chkbx), false)) {
String contentKey = sha256(uriString);
String proxyUrl = "http://" + YaaccUpnpServerService.getIpAddress(getContext()) + ":" + YaaccUpnpServerService.PORT + "/" + YaaccUpnpServerService.PROXY_PATH + "/" + contentKey;
- this.getPreferences().edit().putString(YaaccUpnpServerService.PROXY_LINK_KEY_PREFIX + contentKey, uriString).commit();
- this.getPreferences().edit().putString(YaaccUpnpServerService.PROXY_LINK_MIME_TYPE_KEY_PREFIX + contentKey, item.getMimeType()).commit();
+ this.getPreferences().edit().putString(YaaccUpnpServerService.PROXY_LINK_KEY_PREFIX + contentKey, uriString).apply();
+ this.getPreferences().edit().putString(YaaccUpnpServerService.PROXY_LINK_MIME_TYPE_KEY_PREFIX + contentKey, item.getMimeType()).apply();
item.setUri(Uri.parse(proxyUrl));
res.setValue(proxyUrl);
}
@@ -1646,8 +1610,8 @@ private static String sha256(String input) {
byte[] hash = digest.digest(
input.getBytes(StandardCharsets.UTF_8));
StringBuilder hexString = new StringBuilder(2 * hash.length);
- for (int i = 0; i < hash.length; i++) {
- String hex = Integer.toHexString(0xff & hash[i]);
+ for (byte b : hash) {
+ String hex = Integer.toHexString(0xff & b);
if (hex.length() == 1) {
hexString.append('0');
}
@@ -1660,6 +1624,7 @@ private static String sha256(String input) {
}
}
+ @SuppressLint("DefaultLocale")
private String parseMillisToTimeStringTo(long millis) {
Duration duration = Duration.ofMillis(millis);
long durationSeconds = duration.getSeconds();
diff --git a/yaacc/src/main/java/de/yaacc/upnp/callback/avtransport/AdjustSyncOffset.java b/yaacc/src/main/java/de/yaacc/upnp/callback/avtransport/AdjustSyncOffset.java
deleted file mode 100644
index c9136a38..00000000
--- a/yaacc/src/main/java/de/yaacc/upnp/callback/avtransport/AdjustSyncOffset.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (C) 2014 Tobias Schoene www.yaacc.de
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-package de.yaacc.upnp.callback.avtransport;
-
-import android.util.Log;
-
-import org.fourthline.cling.controlpoint.ActionCallback;
-import org.fourthline.cling.model.action.ActionInvocation;
-import org.fourthline.cling.model.meta.Service;
-import org.fourthline.cling.model.types.UnsignedIntegerFourBytes;
-
-/**
- * @author Tobias Schoene (TheOpenBit)
- */
-public abstract class AdjustSyncOffset extends ActionCallback {
-
-
- public AdjustSyncOffset(UnsignedIntegerFourBytes instanceId, Service, ?> service, String adjustment) {
- super(new ActionInvocation(service.getAction("AdjustSyncOffset")));
- getActionInvocation().setInput("InstanceID", instanceId);
- getActionInvocation().setInput("Adjustment", adjustment);
-
- }
-
- @Override
- public void success(ActionInvocation invocation) {
- Log.d(getClass().getName(), "Execution successful");
- }
-
-}
diff --git a/yaacc/src/main/java/de/yaacc/upnp/callback/avtransport/GetSyncOffset.java b/yaacc/src/main/java/de/yaacc/upnp/callback/avtransport/GetSyncOffset.java
deleted file mode 100644
index 14e42248..00000000
--- a/yaacc/src/main/java/de/yaacc/upnp/callback/avtransport/GetSyncOffset.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (C) 2014 Tobias Schoene www.yaacc.de
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-package de.yaacc.upnp.callback.avtransport;
-
-import android.util.Log;
-
-import org.fourthline.cling.controlpoint.ActionCallback;
-import org.fourthline.cling.model.action.ActionInvocation;
-import org.fourthline.cling.model.meta.Service;
-import org.fourthline.cling.model.types.UnsignedIntegerFourBytes;
-
-/**
- * @author Tobias Schoene (TheOpenBit)
- */
-public abstract class GetSyncOffset extends ActionCallback {
-
-
- public GetSyncOffset(UnsignedIntegerFourBytes instanceId, Service, ?> service, String syncOffset) {
- super(new ActionInvocation(service.getAction("GetSyncOffset")));
- getActionInvocation().setInput("InstanceID", instanceId);
- getActionInvocation().setOutput("CurrentSyncOffset", syncOffset);
-
- }
-
- @Override
- public void success(ActionInvocation invocation) {
- Log.d(getClass().getName(), "Execution successful");
- }
-}
-
diff --git a/yaacc/src/main/java/de/yaacc/upnp/callback/avtransport/SetSyncOffset.java b/yaacc/src/main/java/de/yaacc/upnp/callback/avtransport/SetSyncOffset.java
deleted file mode 100644
index 54ecc2b6..00000000
--- a/yaacc/src/main/java/de/yaacc/upnp/callback/avtransport/SetSyncOffset.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (C) 2014 Tobias Schoene www.yaacc.de
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-package de.yaacc.upnp.callback.avtransport;
-
-import android.util.Log;
-
-import org.fourthline.cling.controlpoint.ActionCallback;
-import org.fourthline.cling.model.action.ActionInvocation;
-import org.fourthline.cling.model.meta.Service;
-import org.fourthline.cling.model.types.UnsignedIntegerFourBytes;
-
-/**
- * @author Tobias Schoene (TheOpenBit)
- */
-public abstract class SetSyncOffset extends ActionCallback {
-
-
- public SetSyncOffset(UnsignedIntegerFourBytes instanceId, Service, ?> service, String syncOffset) {
- super(new ActionInvocation(service.getAction("SetSyncOffset")));
- getActionInvocation().setInput("InstanceID", instanceId);
- getActionInvocation().setInput("NewSyncOffset", syncOffset);
-
- }
-
- @Override
- public void success(ActionInvocation invocation) {
- Log.d(getClass().getName(), "Execution successful");
- }
-
-}
diff --git a/yaacc/src/main/java/de/yaacc/upnp/callback/avtransport/SyncPause.java b/yaacc/src/main/java/de/yaacc/upnp/callback/avtransport/SyncPause.java
deleted file mode 100644
index 18459eb4..00000000
--- a/yaacc/src/main/java/de/yaacc/upnp/callback/avtransport/SyncPause.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (C) 2014 Tobias Schoene www.yaacc.de
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-package de.yaacc.upnp.callback.avtransport;
-
-import android.util.Log;
-
-import org.fourthline.cling.controlpoint.ActionCallback;
-import org.fourthline.cling.model.action.ActionInvocation;
-import org.fourthline.cling.model.meta.Service;
-import org.fourthline.cling.model.types.UnsignedIntegerFourBytes;
-
-/**
- * @author Tobias Schoene (TheOpenBit)
- */
-public abstract class SyncPause extends ActionCallback {
-
-
- public SyncPause(UnsignedIntegerFourBytes instanceId, Service, ?> service, String pauseTime, String referenceClockId) {
- super(new ActionInvocation(service.getAction("SyncPause")));
- getActionInvocation().setInput("InstanceID", instanceId);
- getActionInvocation().setInput("PauseTime", pauseTime);
- getActionInvocation().setInput("ReferenceClockId", referenceClockId);
-
- }
-
- @Override
- public void success(ActionInvocation invocation) {
- Log.d(getClass().getName(), "Execution successful");
- }
-
-}
diff --git a/yaacc/src/main/java/de/yaacc/upnp/callback/avtransport/SyncPlay.java b/yaacc/src/main/java/de/yaacc/upnp/callback/avtransport/SyncPlay.java
deleted file mode 100644
index f1110150..00000000
--- a/yaacc/src/main/java/de/yaacc/upnp/callback/avtransport/SyncPlay.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (C) 2014 Tobias Schoene www.yaacc.de
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-package de.yaacc.upnp.callback.avtransport;
-
-import android.util.Log;
-
-import org.fourthline.cling.controlpoint.ActionCallback;
-import org.fourthline.cling.model.action.ActionInvocation;
-import org.fourthline.cling.model.meta.Service;
-import org.fourthline.cling.model.types.UnsignedIntegerFourBytes;
-
-/**
- * @author Tobias Schoene (TheOpenBit)
- */
-public abstract class SyncPlay extends ActionCallback {
-
-
- public SyncPlay(UnsignedIntegerFourBytes instanceId, Service, ?> service, String referencePositionUnits, String referencePosition, String referencePresentationTime, String referenceClockId) {
- super(new ActionInvocation(service.getAction("SyncPlay")));
- getActionInvocation().setInput("InstanceID", instanceId);
- getActionInvocation().setInput("ReferencePositionUnits", referencePositionUnits);
- getActionInvocation().setInput("ReferencePosition", referencePosition);
- getActionInvocation().setInput("ReferencePresentationTime", referencePresentationTime);
- getActionInvocation().setInput("ReferenceClockId", referenceClockId);
- }
-
- @Override
- public void success(ActionInvocation invocation) {
- Log.d(getClass().getName(), "Execution successful");
- }
-
-}
diff --git a/yaacc/src/main/java/de/yaacc/upnp/callback/avtransport/SyncStop.java b/yaacc/src/main/java/de/yaacc/upnp/callback/avtransport/SyncStop.java
deleted file mode 100644
index ce3cdc50..00000000
--- a/yaacc/src/main/java/de/yaacc/upnp/callback/avtransport/SyncStop.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (C) 2014 Tobias Schoene www.yaacc.de
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-package de.yaacc.upnp.callback.avtransport;
-
-import android.util.Log;
-
-import org.fourthline.cling.controlpoint.ActionCallback;
-import org.fourthline.cling.model.action.ActionInvocation;
-import org.fourthline.cling.model.meta.Service;
-import org.fourthline.cling.model.types.UnsignedIntegerFourBytes;
-
-/**
- * @author Tobias Schoene (TheOpenBit)
- */
-public abstract class SyncStop extends ActionCallback {
-
-
- public SyncStop(UnsignedIntegerFourBytes instanceId, Service, ?> service, String stopTime, String referenceClockId) {
- super(new ActionInvocation(service.getAction("SyncStop")));
- getActionInvocation().setInput("InstanceID", instanceId);
- getActionInvocation().setInput("StopTime", stopTime);
- getActionInvocation().setInput("ReferenceClockId", referenceClockId);
-
- }
-
- @Override
- public void success(ActionInvocation invocation) {
- Log.d(getClass().getName(), "Execution successful");
- }
-
-}
diff --git a/yaacc/src/main/java/de/yaacc/upnp/server/avtransport/AvTransport.java b/yaacc/src/main/java/de/yaacc/upnp/server/avtransport/AvTransport.java
index 2466e528..38ad60c3 100644
--- a/yaacc/src/main/java/de/yaacc/upnp/server/avtransport/AvTransport.java
+++ b/yaacc/src/main/java/de/yaacc/upnp/server/avtransport/AvTransport.java
@@ -22,24 +22,14 @@
import org.fourthline.cling.support.model.AVTransport;
import org.fourthline.cling.support.model.StorageMedium;
-import de.yaacc.upnp.SynchronizationInfo;
/**
* @author Tobias Schoene (TheOpenBit)
*/
public class AvTransport extends AVTransport {
- SynchronizationInfo synchronizationInfo = new SynchronizationInfo();
-
public AvTransport(UnsignedIntegerFourBytes instanceID, LastChange lastChange, StorageMedium possiblePlayMedium) {
super(instanceID, lastChange, possiblePlayMedium);
}
- public SynchronizationInfo getSynchronizationInfo() {
- return synchronizationInfo;
- }
-
- public void setSynchronizationInfo(SynchronizationInfo synchronizationInfo) {
- this.synchronizationInfo = synchronizationInfo;
- }
}
diff --git a/yaacc/src/main/java/de/yaacc/upnp/server/avtransport/AvTransportMediaRendererNoMediaPresent.java b/yaacc/src/main/java/de/yaacc/upnp/server/avtransport/AvTransportMediaRendererNoMediaPresent.java
index 0efc51e0..80b8afd0 100644
--- a/yaacc/src/main/java/de/yaacc/upnp/server/avtransport/AvTransportMediaRendererNoMediaPresent.java
+++ b/yaacc/src/main/java/de/yaacc/upnp/server/avtransport/AvTransportMediaRendererNoMediaPresent.java
@@ -71,30 +71,6 @@ public Class extends AbstractState>> setTransportURI(URI uri,
return AvTransportMediaRendererPlaying.class;
}
- @Override
- public Class extends AbstractState>> syncPlay(String speed, String referencedPositionUnits, String referencedPosition, String referencedPresentationTime, String referencedClockId) {
- getTransport().getSynchronizationInfo().setSpeed(speed);
- getTransport().getSynchronizationInfo().setReferencedPositionUnits(referencedPositionUnits);
- getTransport().getSynchronizationInfo().setReferencedPosition(referencedPosition);
- getTransport().getSynchronizationInfo().setReferencedPresentationTime(referencedPresentationTime);
- getTransport().getSynchronizationInfo().setReferencedClockId(referencedClockId);
- return AvTransportMediaRendererPlaying.class;
- }
-
- @Override
- public Class extends AbstractState>> syncPause(String referencedPresentationTime, String referencedClockId) {
- getTransport().getSynchronizationInfo().setReferencedPresentationTime(referencedPresentationTime);
- getTransport().getSynchronizationInfo().setReferencedClockId(referencedClockId);
- return AvTransportMediaRendererPaused.class;
- }
-
- @Override
- public Class extends AbstractState>> syncStop(String referencedPresentationTime, String referencedClockId) {
- getTransport().getSynchronizationInfo().setReferencedPresentationTime(referencedPresentationTime);
- getTransport().getSynchronizationInfo().setReferencedClockId(referencedClockId);
- return AvTransportMediaRendererStopped.class;
- }
-
@Override
public Class extends AbstractState>> play(String speed) {
@@ -108,10 +84,7 @@ public TransportAction[] getPossibleTransportActions() {
TransportAction.Play,
TransportAction.Next,
TransportAction.Previous,
- TransportAction.Seek,
- TransportAction.SyncPause,
- TransportAction.SyncPlay,
- TransportAction.SyncStop
+ TransportAction.Seek
};
}
diff --git a/yaacc/src/main/java/de/yaacc/upnp/server/avtransport/AvTransportMediaRendererPaused.java b/yaacc/src/main/java/de/yaacc/upnp/server/avtransport/AvTransportMediaRendererPaused.java
index 8f43e8df..9b18f197 100644
--- a/yaacc/src/main/java/de/yaacc/upnp/server/avtransport/AvTransportMediaRendererPaused.java
+++ b/yaacc/src/main/java/de/yaacc/upnp/server/avtransport/AvTransportMediaRendererPaused.java
@@ -113,29 +113,6 @@ public void onEntry() {
}
}
- @Override
- public Class extends AbstractState>> syncPlay(String speed, String referencedPositionUnits, String referencedPosition, String referencedPresentationTime, String referencedClockId) {
- getTransport().getSynchronizationInfo().setSpeed(speed);
- getTransport().getSynchronizationInfo().setReferencedPositionUnits(referencedPositionUnits);
- getTransport().getSynchronizationInfo().setReferencedPosition(referencedPosition);
- getTransport().getSynchronizationInfo().setReferencedPresentationTime(referencedPresentationTime);
- getTransport().getSynchronizationInfo().setReferencedClockId(referencedClockId);
- return AvTransportMediaRendererPlaying.class;
- }
-
- @Override
- public Class extends AbstractState>> syncPause(String referencedPresentationTime, String referencedClockId) {
- getTransport().getSynchronizationInfo().setReferencedPresentationTime(referencedPresentationTime);
- getTransport().getSynchronizationInfo().setReferencedClockId(referencedClockId);
- return AvTransportMediaRendererPaused.class;
- }
-
- @Override
- public Class extends AbstractState>> syncStop(String referencedPresentationTime, String referencedClockId) {
- getTransport().getSynchronizationInfo().setReferencedPresentationTime(referencedPresentationTime);
- getTransport().getSynchronizationInfo().setReferencedClockId(referencedClockId);
- return AvTransportMediaRendererStopped.class;
- }
@Override
public TransportAction[] getPossibleTransportActions() {
@@ -144,10 +121,7 @@ public TransportAction[] getPossibleTransportActions() {
TransportAction.Play,
TransportAction.Next,
TransportAction.Previous,
- TransportAction.Seek,
- TransportAction.SyncPause,
- TransportAction.SyncPlay,
- TransportAction.SyncStop
+ TransportAction.Seek
};
}
diff --git a/yaacc/src/main/java/de/yaacc/upnp/server/avtransport/AvTransportMediaRendererPlaying.java b/yaacc/src/main/java/de/yaacc/upnp/server/avtransport/AvTransportMediaRendererPlaying.java
index d1c109ec..bf9a4f7f 100644
--- a/yaacc/src/main/java/de/yaacc/upnp/server/avtransport/AvTransportMediaRendererPlaying.java
+++ b/yaacc/src/main/java/de/yaacc/upnp/server/avtransport/AvTransportMediaRendererPlaying.java
@@ -192,32 +192,6 @@ public Class extends AbstractState>> seek(SeekMode unit, String target) {
return null;
}
- @Override
- public Class extends AbstractState>> syncPlay(String speed, String referencedPositionUnits, String referencedPosition, String referencedPresentationTime, String referencedClockId) {
- getTransport().getSynchronizationInfo().setSpeed(speed);
- getTransport().getSynchronizationInfo().setReferencedPositionUnits(referencedPositionUnits);
- getTransport().getSynchronizationInfo().setReferencedPosition(referencedPosition);
- getTransport().getSynchronizationInfo().setReferencedPresentationTime(referencedPresentationTime);
- getTransport().getSynchronizationInfo().setReferencedClockId(referencedClockId);
- updateTime = true;
- return AvTransportMediaRendererPlaying.class;
- }
-
- @Override
- public Class extends AbstractState>> syncPause(String referencedPresentationTime, String referencedClockId) {
- getTransport().getSynchronizationInfo().setReferencedPresentationTime(referencedPresentationTime);
- getTransport().getSynchronizationInfo().setReferencedClockId(referencedClockId);
- updateTime = false;
- return AvTransportMediaRendererPaused.class;
- }
-
- @Override
- public Class extends AbstractState>> syncStop(String referencedPresentationTime, String referencedClockId) {
- getTransport().getSynchronizationInfo().setReferencedPresentationTime(referencedPresentationTime);
- getTransport().getSynchronizationInfo().setReferencedClockId(referencedClockId);
- updateTime = false;
- return AvTransportMediaRendererStopped.class;
- }
@Override
public TransportAction[] getPossibleTransportActions() {
@@ -226,10 +200,7 @@ public TransportAction[] getPossibleTransportActions() {
TransportAction.Play,
TransportAction.Next,
TransportAction.Previous,
- TransportAction.Seek,
- TransportAction.SyncPause,
- TransportAction.SyncPlay,
- TransportAction.SyncStop
+ TransportAction.Seek
};
}
diff --git a/yaacc/src/main/java/de/yaacc/upnp/server/avtransport/AvTransportMediaRendererStopped.java b/yaacc/src/main/java/de/yaacc/upnp/server/avtransport/AvTransportMediaRendererStopped.java
index 96bbab9c..54096795 100644
--- a/yaacc/src/main/java/de/yaacc/upnp/server/avtransport/AvTransportMediaRendererStopped.java
+++ b/yaacc/src/main/java/de/yaacc/upnp/server/avtransport/AvTransportMediaRendererStopped.java
@@ -165,29 +165,6 @@ public Class extends AbstractState>> seek(SeekMode unit, String target) {
return AvTransportMediaRendererStopped.class;
}
- @Override
- public Class extends AbstractState>> syncPlay(String speed, String referencedPositionUnits, String referencedPosition, String referencedPresentationTime, String referencedClockId) {
- getTransport().getSynchronizationInfo().setSpeed(speed);
- getTransport().getSynchronizationInfo().setReferencedPositionUnits(referencedPositionUnits);
- getTransport().getSynchronizationInfo().setReferencedPosition(referencedPosition);
- getTransport().getSynchronizationInfo().setReferencedPresentationTime(referencedPresentationTime);
- getTransport().getSynchronizationInfo().setReferencedClockId(referencedClockId);
- return AvTransportMediaRendererPlaying.class;
- }
-
- @Override
- public Class extends AbstractState>> syncPause(String referencedPresentationTime, String referencedClockId) {
- getTransport().getSynchronizationInfo().setReferencedPresentationTime(referencedPresentationTime);
- getTransport().getSynchronizationInfo().setReferencedClockId(referencedClockId);
- return AvTransportMediaRendererPaused.class;
- }
-
- @Override
- public Class extends AbstractState>> syncStop(String referencedPresentationTime, String referencedClockId) {
- getTransport().getSynchronizationInfo().setReferencedPresentationTime(referencedPresentationTime);
- getTransport().getSynchronizationInfo().setReferencedClockId(referencedClockId);
- return AvTransportMediaRendererStopped.class;
- }
@Override
public TransportAction[] getPossibleTransportActions() {
@@ -196,10 +173,7 @@ public TransportAction[] getPossibleTransportActions() {
TransportAction.Play,
TransportAction.Next,
TransportAction.Previous,
- TransportAction.Seek,
- TransportAction.SyncPause,
- TransportAction.SyncPlay,
- TransportAction.SyncStop
+ TransportAction.Seek
};
}
}
\ No newline at end of file
diff --git a/yaacc/src/main/java/de/yaacc/upnp/server/avtransport/YaaccAVTransportService.java b/yaacc/src/main/java/de/yaacc/upnp/server/avtransport/YaaccAVTransportService.java
index b6a22ffc..5df4ae91 100644
--- a/yaacc/src/main/java/de/yaacc/upnp/server/avtransport/YaaccAVTransportService.java
+++ b/yaacc/src/main/java/de/yaacc/upnp/server/avtransport/YaaccAVTransportService.java
@@ -61,7 +61,6 @@
import java.util.concurrent.ConcurrentHashMap;
import de.yaacc.upnp.UpnpClient;
-import de.yaacc.upnp.model.types.SyncOffset;
/**
@@ -329,63 +328,6 @@ protected AVTransportStateMachine createStateMachine(
upnpClient});
}
- @UpnpAction(name = "GetSyncOffset",
- out = {@UpnpOutputArgument(name = "CurrentSyncOffset", stateVariable = "SyncOffset", getterName = "toString")})
- public SyncOffset getSyncOffset(@UpnpInputArgument(name = "InstanceID") UnsignedIntegerFourBytes instanceId) throws AVTransportException {
- return ((AvTransport) findStateMachine(instanceId).getCurrentState().getTransport()).getSynchronizationInfo().getOffset();
- }
-
- @UpnpAction(name = "SetSyncOffset")
- public void setSyncOffset(@UpnpInputArgument(name = "InstanceID") UnsignedIntegerFourBytes instanceId,
- @UpnpInputArgument(name = "NewSyncOffset", stateVariable = "SyncOffset") String offset) throws AVTransportException {
- ((AvTransport) findStateMachine(instanceId).getCurrentState().getTransport()).getSynchronizationInfo().setOffset(new SyncOffset(offset));
- }
-
- @UpnpAction(name = "AdjustSyncOffset")
- public void adjustSyncOffset(@UpnpInputArgument(name = "InstanceID") UnsignedIntegerFourBytes instanceId,
- @UpnpInputArgument(name = "Adjustment", stateVariable = "SyncOffset") String offset) throws AVTransportException {
- ((AvTransport) findStateMachine(instanceId).getCurrentState().getTransport()).getSynchronizationInfo().getOffset().add(new SyncOffset(offset));
- }
-
-
- @UpnpAction(name = "SyncPlay")
- public void syncPlay(@UpnpInputArgument(name = "InstanceID") UnsignedIntegerFourBytes instanceId,
- @UpnpInputArgument(name = "Speed", stateVariable = "TransportPlaySpeed") String speed,
- @UpnpInputArgument(name = "ReferencePositionUnits", stateVariable = "A_ARG_TYPE_SeekMode") String referencedPositionUnits,
- @UpnpInputArgument(name = "ReferencePosition", stateVariable = "A_ARG_TYPE_SeekTarget") String referencedPosition,
- @UpnpInputArgument(name = "ReferencePresentationTime", stateVariable = "A_ARG_TYPE_PresentationTime") String referencedPresentationTime,
- @UpnpInputArgument(name = "ReferenceClockId", stateVariable = "A_ARG_TYPE_ClockId") String referencedClockId) throws AVTransportException {
- try {
- ((AvTransportStateMachine) findStateMachine(instanceId)).syncPlay(speed, referencedPositionUnits, referencedPosition, referencedPresentationTime, referencedClockId);
- } catch (TransitionException ex) {
- throw new AVTransportException(AVTransportErrorCode.TRANSITION_NOT_AVAILABLE, ex.getMessage());
- }
- }
-
-
- @UpnpAction(name = "SyncStop")
- public void syncStop(@UpnpInputArgument(name = "InstanceID") UnsignedIntegerFourBytes instanceId,
- @UpnpInputArgument(name = "StopTime", stateVariable = "A_ARG_TYPE_PresentationTime") String referencedPresentationTime,
- @UpnpInputArgument(name = "ReferenceClockId", stateVariable = "A_ARG_TYPE_ClockId") String referencedClockId) throws AVTransportException {
- try {
- ((AvTransportStateMachine) findStateMachine(instanceId)).syncStop(referencedPresentationTime, referencedClockId);
- } catch (TransitionException ex) {
- throw new AVTransportException(AVTransportErrorCode.TRANSITION_NOT_AVAILABLE, ex.getMessage());
- }
- }
-
- @UpnpAction(name = "SyncPause")
- public void syncPause(@UpnpInputArgument(name = "InstanceID") UnsignedIntegerFourBytes instanceId,
- @UpnpInputArgument(name = "PauseTime", stateVariable = "A_ARG_TYPE_PresentationTime") String referencedPresentationTime,
- @UpnpInputArgument(name = "ReferenceClockId", stateVariable = "A_ARG_TYPE_ClockId") String referencedClockId) throws AVTransportException {
- try {
- ((AvTransportStateMachine) findStateMachine(instanceId)).syncStop(referencedPresentationTime, referencedClockId);
- } catch (TransitionException ex) {
- throw new AVTransportException(AVTransportErrorCode.TRANSITION_NOT_AVAILABLE, ex.getMessage());
- }
- }
-
-
@UpnpAction(name = "GetCurrentTransportActions", out = @UpnpOutputArgument(name = "Actions", stateVariable = "CurrentTransportActions"))
public String getCurrentTransportActionsString(@UpnpInputArgument(name = "InstanceID") UnsignedIntegerFourBytes instanceId) {
try {
diff --git a/yaacc/src/main/java/de/yaacc/upnp/server/avtransport/YaaccState.java b/yaacc/src/main/java/de/yaacc/upnp/server/avtransport/YaaccState.java
index d84c05a2..c36571ae 100644
--- a/yaacc/src/main/java/de/yaacc/upnp/server/avtransport/YaaccState.java
+++ b/yaacc/src/main/java/de/yaacc/upnp/server/avtransport/YaaccState.java
@@ -24,12 +24,6 @@
*/
public interface YaaccState {
- Class extends AbstractState>> syncPlay(String speed, String referencedPositionUnits, String referencedPosition, String referencedPresentationTime, String referencedClockId);
-
- Class extends AbstractState>> syncPause(String referencedPresentationTime, String referencedClockId);
-
- Class extends AbstractState>> syncStop(String referencedPresentationTime, String referencedClockId);
-
Class extends AbstractState>> play(String speed);
TransportAction[] getPossibleTransportActions();
diff --git a/yaacc/src/main/java/org/fourthline/cling/support/renderingcontrol/callback/GetMute.java b/yaacc/src/main/java/org/fourthline/cling/support/renderingcontrol/callback/GetMute.java
index 3f0bc9a7..33cee2b2 100644
--- a/yaacc/src/main/java/org/fourthline/cling/support/renderingcontrol/callback/GetMute.java
+++ b/yaacc/src/main/java/org/fourthline/cling/support/renderingcontrol/callback/GetMute.java
@@ -21,19 +21,16 @@
import org.fourthline.cling.model.types.UnsignedIntegerFourBytes;
import org.fourthline.cling.support.model.Channel;
-import java.util.logging.Logger;
-
/**
- *
* @author Christian Bauer
*/
public abstract class GetMute extends ActionCallback {
- private static Logger log = Logger.getLogger(GetMute.class.getName());
public GetMute(Service service) {
this(new UnsignedIntegerFourBytes(0), service);
}
+
public GetMute(UnsignedIntegerFourBytes instanceId, Service service) {
super(new ActionInvocation(service.getAction("GetMute")));
getActionInvocation().setInput("InstanceID", instanceId);
diff --git a/yaacc/src/main/res/values-de/setting_strings.xml b/yaacc/src/main/res/values-de/setting_strings.xml
index 9fb909a9..0e4c5278 100644
--- a/yaacc/src/main/res/values-de/setting_strings.xml
+++ b/yaacc/src/main/res/values-de/setting_strings.xml
@@ -85,9 +85,6 @@
Verwendet Cover aus Bildern in Musikverzeichnissen
Bilder in Verzeichnissen werden nicht als Cover verwendet
Synchronistionseinstellung
- Wartezeit vor dem Abspielen
- Gerätespezifischer Abspielversatz
- Versatz in ms
Tabwechsel nur mit Touch
Tabwechsel mit Swipe und Touch
"Swipe-Verhalten "
diff --git a/yaacc/src/main/res/values-es/setting_strings.xml b/yaacc/src/main/res/values-es/setting_strings.xml
index b88e3fb1..d7bc255a 100644
--- a/yaacc/src/main/res/values-es/setting_strings.xml
+++ b/yaacc/src/main/res/values-es/setting_strings.xml
@@ -68,9 +68,6 @@
reproducción de música aleatoria
reproducción de música ordenada
configuración de sincronización
- retraso de reproducción
- compensación del dispositivo
- desplazamiento en ms
Cambiar pestañas al tocar
Cambiar pestañas al deslizar y tocar
Desliza el dedo para navegar
diff --git a/yaacc/src/main/res/values-fr/setting_strings.xml b/yaacc/src/main/res/values-fr/setting_strings.xml
index f1fb11b6..b2f8ed23 100644
--- a/yaacc/src/main/res/values-fr/setting_strings.xml
+++ b/yaacc/src/main/res/values-fr/setting_strings.xml
@@ -69,9 +69,6 @@
lecture de musique mélangée
j\'ai commandé une lecture de musique
paramètres de synchronisation
- retard de lecture
- décalage de l\'appareil
- décalage en ms
Changer d\'onglet au toucher
Changer d\'onglet par glissement et toucher
Glisser lors de la navigation
diff --git a/yaacc/src/main/res/values-nl/setting_strings.xml b/yaacc/src/main/res/values-nl/setting_strings.xml
index ced95fdb..5fd7a1b6 100644
--- a/yaacc/src/main/res/values-nl/setting_strings.xml
+++ b/yaacc/src/main/res/values-nl/setting_strings.xml
@@ -69,9 +69,6 @@
geschud muziekspel
bestelde muziek afspelen
synchronisatie-instellingen
- afspeelvertraging
- apparaat gecompenseerd
- offset in ms
Wijzig tabbladen via aanraking
Wijzig tabbladen door te vegen en aan te raken
Veeg op bladeren
diff --git a/yaacc/src/main/res/values-pt/strings.xml b/yaacc/src/main/res/values-pt/strings.xml
index 437a8496..ac0a2a13 100644
--- a/yaacc/src/main/res/values-pt/strings.xml
+++ b/yaacc/src/main/res/values-pt/strings.xml
@@ -70,9 +70,6 @@
reprodução de música embaralhada
ordem de reprodução de música
configurações de sincronização
- atraso de reprodução
- deslocamento do dispositivo
- deslocamento em ms
Alterar guias ao tocar
Alterar guias deslizando e tocando
Deslize para navegar
diff --git a/yaacc/src/main/res/values/setting_strings.xml b/yaacc/src/main/res/values/setting_strings.xml
index 3cbd1903..f3184aff 100644
--- a/yaacc/src/main/res/values/setting_strings.xml
+++ b/yaacc/src/main/res/values/setting_strings.xml
@@ -108,11 +108,6 @@
shuffled music play
ordered music play
synchronization settings
- playback delay
- settings_default_playback_delay_key
- device offset
- offset in ms
- settings_device_playback_offset_key
settings_swipe_chkbx
Change tabs on touch
Change tabs on swipe and touch
diff --git a/yaacc/src/main/res/xml/preference.xml b/yaacc/src/main/res/xml/preference.xml
index 56214037..169dd725 100644
--- a/yaacc/src/main/res/xml/preference.xml
+++ b/yaacc/src/main/res/xml/preference.xml
@@ -20,8 +20,6 @@
xmlns:app="http://schemas.android.com/apk/res-auto">
-
-
+ android:defaultValue="rmnet,ccmni" />
-
-
-
-