summaryrefslogtreecommitdiff
path: root/vdrmanager/src
diff options
context:
space:
mode:
Diffstat (limited to 'vdrmanager/src')
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/data/Preferences.java49
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/gui/PreferencesActivity.java1
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/gui/Utils.java69
3 files changed, 107 insertions, 12 deletions
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/data/Preferences.java b/vdrmanager/src/de/bjusystems/vdrmanager/data/Preferences.java
index 9b61417..0f1b731 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/data/Preferences.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/data/Preferences.java
@@ -91,6 +91,20 @@ public class Preferences {
*/
private boolean showChannelNumbers = false;
+ /**
+ * Use remux ?
+ */
+ private boolean enableRemux;
+
+ /**
+ * Remux command
+ */
+ private String remuxCommand;
+
+ /**
+ * Remux command Parameter
+ */
+ private String remuxParameter;
/** Properties singleton */
private static Preferences thePrefs;
@@ -354,6 +368,35 @@ public class Preferences {
return showChannelNumbers;
}
+
+
+ /**
+ * getter
+ * @return
+ */
+ public boolean isEnableRemux() {
+ return enableRemux;
+ }
+
+
+ /**
+ * getter
+ * @return
+ */
+ public String getRemuxCommand() {
+ return remuxCommand;
+ }
+
+
+ /**
+ * getter
+ * @return
+ */
+ public String getRemuxParameter() {
+ return remuxParameter;
+ }
+
+
/**
* Gets the previous loaded preferences
*
@@ -432,6 +475,12 @@ public class Preferences {
prefs.showChannelNumbers = getBoolean(context, R.string.gui_channels_show_channel_numbers_key, false);
+ prefs.enableRemux = getBoolean(context, R.string.key_remux_enable, false);
+
+ prefs.remuxCommand =getString(context, R.string.key_remux_command, "EXT");
+
+ prefs.remuxParameter = getString(context, R.string.key_remux_parameter, "");
+
thePrefs = prefs;
}
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/PreferencesActivity.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/PreferencesActivity.java
index 47cd395..dfffc0c 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/PreferencesActivity.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/PreferencesActivity.java
@@ -112,6 +112,7 @@ public class PreferencesActivity extends PreferenceActivity implements
updateSummary(p);
}
+
}
@Override
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/Utils.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/Utils.java
index ee2ac5f..98db2c8 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/Utils.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/Utils.java
@@ -3,9 +3,13 @@ package de.bjusystems.vdrmanager.gui;
import java.util.Date;
import android.app.Activity;
+import android.app.AlertDialog;
+import android.app.AlertDialog.Builder;
+import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;
+import de.bjusystems.vdrmanager.R;
import de.bjusystems.vdrmanager.data.Channel;
import de.bjusystems.vdrmanager.data.Event;
import de.bjusystems.vdrmanager.data.Preferences;
@@ -36,11 +40,12 @@ public class Utils {
return -1;
}
- public static boolean isLive(Event event){
+ public static boolean isLive(Event event) {
long now = new Date().getTime();
- return now >= event.getStart().getTime() && now < event.getStop().getTime();
+ return now >= event.getStart().getTime()
+ && now < event.getStop().getTime();
}
-
+
private static String getStreamUrl(String chn) {
// "http://192.168.1.119:3000/TS/"
StringBuilder sb = new StringBuilder();
@@ -51,28 +56,68 @@ public class Utils {
return sb.toString();
}
-
+ private static String getRemuxStreamUrl(String chn) {
+ // "http://192.168.1.119:3000/TS/"
+ StringBuilder sb = new StringBuilder();
+ Preferences p = Preferences.getPreferences();
+ sb.append("http://").append(p.getSvdrpHost()).append(":")
+ .append(p.getStreamPort()).append("/")
+ .append(p.getRemuxCommand()).append(";")
+ .append(p.getRemuxParameter()).append("/").append(chn);
+ return sb.toString();
+ }
+
public static void stream(Activity activity, Event event) {
stream(activity, event.getChannelNumber());
}
- public static void stream(Activity a, Channel c){
+ public static void stream(Activity a, Channel c) {
stream(a, String.valueOf(c.getNumber()));
}
-
-
- public static void stream(Activity activity, String chn) {
+
+ public static void stream(final Activity activity, final String chn) {
+
String url = getStreamUrl(chn);
+ if (Preferences.get().isEnableRemux() == false) {
+ url = getStreamUrl(chn);
+ startStream(activity, url);
+ }
+
+ String sf = Preferences.get().getStreamFormat();
+ String ext = activity.getString(R.string.remux_title);
+ new AlertDialog.Builder(activity)
+ .setTitle(R.string.stream_via_as)//
+ .setItems(
+ new String[] {
+ activity.getString(R.string.stream_as, sf),
+ activity.getString(R.string.stream_via, ext) },//
+ new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface dialog,
+ int which) {
+ String url = null;
+ switch (which) {
+ case 0:
+ url = getStreamUrl(chn);
+ break;
+ case 1:
+ url = getRemuxStreamUrl(chn);
+ break;
+ }
+ startStream(activity, url);
+ }
+ }).create().show();
+ }
+
+ public static void startStream(Activity activity, String url) {
final Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.parse(url.toString()), "video/*");
activity.startActivityForResult(intent, 1);
-
}
- public static int getDuration(Event event){
+ public static int getDuration(Event event) {
long millis = event.getStop().getTime() - event.getStart().getTime();
- int minuts = (int)(millis / 1000 / 60);
+ int minuts = (int) (millis / 1000 / 60);
return minuts;
}
-
+
}