aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2016-02-11 21:41:16 -0800
committerScott Jackson <daneren2005@gmail.com>2016-02-11 21:41:16 -0800
commitd1da1ad5255acbd1f1be49cfa04ef74ccb41c6e6 (patch)
treec5469e0fd0587e96004684eb8f21cad21eacb6d8
parent6e2fc490b0fac6b1817955aec688949481148407 (diff)
downloaddsub-d1da1ad5255acbd1f1be49cfa04ef74ccb41c6e6.tar.gz
dsub-d1da1ad5255acbd1f1be49cfa04ef74ccb41c6e6.tar.bz2
dsub-d1da1ad5255acbd1f1be49cfa04ef74ccb41c6e6.zip
Fixed #645: Add option to stream original quality to Chromecast
-rw-r--r--app/src/main/java/github/daneren2005/dsub/service/RESTMusicService.java5
-rw-r--r--app/src/main/java/github/daneren2005/dsub/util/Constants.java1
-rw-r--r--app/src/main/res/values/strings.xml2
-rw-r--r--app/src/main/res/xml/settings_cast.xml6
4 files changed, 11 insertions, 3 deletions
diff --git a/app/src/main/java/github/daneren2005/dsub/service/RESTMusicService.java b/app/src/main/java/github/daneren2005/dsub/service/RESTMusicService.java
index 75023ec0..7a2edf79 100644
--- a/app/src/main/java/github/daneren2005/dsub/service/RESTMusicService.java
+++ b/app/src/main/java/github/daneren2005/dsub/service/RESTMusicService.java
@@ -947,10 +947,9 @@ public class RESTMusicService implements MusicService {
StringBuilder builder = new StringBuilder(getRestUrl(context, "stream"));
builder.append("&id=").append(song.getId());
- // If we are doing mp3 to mp3, just specify raw so that stuff works better
- if("mp3".equals(song.getSuffix()) && (song.getTranscodedSuffix() == null || "mp3".equals(song.getTranscodedSuffix())) && ServerInfo.checkServerVersion(context, "1.9", getInstance(context))) {
+ // Allow user to specify to stream raw formats if available
+ if(Util.getPreferences(context).getBoolean(Constants.PREFERENCES_KEY_CAST_STREAM_ORIGINAL, true) && ("mp3".equals(song.getSuffix()) || "flac".equals(song.getSuffix()) || "wav".equals(song.getSuffix()) || "aac".equals(song.getSuffix())) && ServerInfo.checkServerVersion(context, "1.9", getInstance(context))) {
builder.append("&format=raw");
- builder.append("&estimateContentLength=true");
} else {
builder.append("&maxBitRate=").append(maxBitrate);
}
diff --git a/app/src/main/java/github/daneren2005/dsub/util/Constants.java b/app/src/main/java/github/daneren2005/dsub/util/Constants.java
index 88b87481..9aebef83 100644
--- a/app/src/main/java/github/daneren2005/dsub/util/Constants.java
+++ b/app/src/main/java/github/daneren2005/dsub/util/Constants.java
@@ -171,6 +171,7 @@ public final class Constants {
public static final String PREFERENCES_KEY_RESUME_PLAY_QUEUE_NEVER = "neverResumePlayQueue";
public static final String PREFERENCES_KEY_BATCH_MODE = "batchMode";
public static final String PREFERENCES_KEY_CAST_GAPLESS_PLAYBACK = "castingGaplessPlayback";
+ public static final String PREFERENCES_KEY_CAST_STREAM_ORIGINAL = "castStreamOriginal";
public static final String OFFLINE_SCROBBLE_COUNT = "scrobbleCount";
public static final String OFFLINE_SCROBBLE_ID = "scrobbleID";
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index b4d6f41b..e783d641 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -481,6 +481,8 @@
<string name="settings.shuffle_by_album">Shuffle By Album</string>
<string name="settings.shuffle_by_album.true">Shuffle order of albums</string>
<string name="settings.shuffle_by_album.false">Shuffle all songs together</string>
+ <string name="settings.casting_stream_original">Stream original</string>
+ <string name="settings.casting_stream_original_summary">Stream original files where supported by cast device</string>
<string name="shuffle.title">Shuffle By</string>
<string name="shuffle.startYear">Start Year:</string>
diff --git a/app/src/main/res/xml/settings_cast.xml b/app/src/main/res/xml/settings_cast.xml
index 058255c2..45766162 100644
--- a/app/src/main/res/xml/settings_cast.xml
+++ b/app/src/main/res/xml/settings_cast.xml
@@ -15,5 +15,11 @@
android:summary="@string/settings.gapless_playback_summary"
android:key="castingGaplessPlayback"
android:defaultValue="true"/>
+
+ <CheckBoxPreference
+ android:title="@string/settings.casting_stream_original"
+ android:summary="@string/settings.casting_stream_original_summary"
+ android:key="castStreamOriginal"
+ android:defaultValue="true"/>
</PreferenceCategory>
</PreferenceScreen> \ No newline at end of file