summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--vdrmanager/res/values/livetv.xml19
-rw-r--r--vdrmanager/res/xml/preferences.xml39
-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
5 files changed, 151 insertions, 26 deletions
diff --git a/vdrmanager/res/values/livetv.xml b/vdrmanager/res/values/livetv.xml
index 266f862..c39d228 100644
--- a/vdrmanager/res/values/livetv.xml
+++ b/vdrmanager/res/values/livetv.xml
@@ -12,13 +12,28 @@
<item>PES</item>
<item>ES</item>
<item>PS</item>
- <item>External</item>
</string-array>
<string-array name="livetv_streamformat_values">
<item>TS</item>
<item>PES</item>
<item>ES</item>
<item>PS</item>
- <item>EXT</item>
</string-array>
+ <string name="key_remux_enable">remux_enable</string>
+ <string name="key_remux_command">remux_command</string>
+ <string name="key_remux_parameter">remux_parameter</string>
+
+ <string name="stream_via_as">Stream</string>
+ <string name="stream_via">via %s</string>
+ <string name="stream_as">as %s</string>
+ <string name="remux_title">Remux</string>
+ <string name="remux_enable_title">Enable Remux</string>
+ <string name="remux_enable_summary">Enable streaming via remux (e.g. externremux.sh)</string>
+
+ <string name="remux_command_title">Command</string>
+ <string name="remux_command_summary">Typically EXT or Extern e.g. http://vdr:3000/Extern/1</string>
+
+ <string name="remux_parameter_title">Parameter</string>
+ <string name="remux_parameter_summary">Control Streaming quality. E.g. http://vdr:3000/Extern;DSL1000/1</string>
+
</resources>
diff --git a/vdrmanager/res/xml/preferences.xml b/vdrmanager/res/xml/preferences.xml
index 10063b7..a8578b2 100644
--- a/vdrmanager/res/xml/preferences.xml
+++ b/vdrmanager/res/xml/preferences.xml
@@ -3,6 +3,7 @@
<PreferenceCategory android:title="@string/vdr_preferences"
android:key="vdr_preferences">
+
<EditTextPreference android:key="@string/vdr_host_key"
android:title="@string/vdr_host_title" android:summary="@string/vdr_host_summary" />
<EditTextPreference android:key="@string/vdr_port_key"
@@ -15,17 +16,7 @@
android:title="@string/vdr_ssl_title" android:summary="@string/vdr_ssl_summary" />
</PreferenceCategory>
- <PreferenceCategory android:title="@string/livetv">
- <ListPreference android:key="livetv_streamformat"
- android:title="@string/settings_livetv_streamformat"
- android:defaultValue="TS" android:entries="@array/livetv_streamformat"
- android:entryValues="@array/livetv_streamformat_values" />
- <EditTextPreference android:key="streamingport"
- android:inputType="number" android:title="@string/settings_livetv_port"
- android:summary="@string/settings_livetv_port_summary"
- android:defaultValue="3000" />
- </PreferenceCategory>
-
+
<PreferenceCategory android:title="@string/channel_filter_preferences"
android:key="filter_preferences">
<CheckBoxPreference android:key="@string/channel_filter_filter_key"
@@ -59,7 +50,7 @@
<EditTextPreference android:key="@string/wakeup_wol_custom_broadcast_key"
android:title="@string/wakeup_wol_custom_boradcast_title"
android:summaryOn="@string/wakeup_wol_custom_boradcast_summary"
- android:dependency="@string/wakeup_enabled_key" android:defaultValue="" />
+ android:dependency="@string/wakeup_enabled_key" android:defaultValue="255.255.255.255" />
</PreferenceCategory>
<PreferenceCategory android:title="@string/timer_preferences"
@@ -88,4 +79,28 @@
android:summaryOn="@string/gui_enable_24h_format_summary_on"
android:summaryOff="@string/gui_enable_24h_format_summary_off" />
</PreferenceCategory>
+ <PreferenceCategory android:title="@string/livetv">
+ <EditTextPreference android:key="streamingport"
+ android:inputType="number" android:title="@string/settings_livetv_port"
+ android:summary="@string/settings_livetv_port_summary"
+ android:defaultValue="3000" />
+
+ <ListPreference android:key="livetv_streamformat"
+ android:title="@string/settings_livetv_streamformat"
+ android:defaultValue="TS" android:entries="@array/livetv_streamformat"
+ android:entryValues="@array/livetv_streamformat_values" />
+
+ <CheckBoxPreference android:key="remux_enable" android:title="@string/remux_enable_title" android:summary="@string/remux_enable_summary"
+
+ />
+ <EditTextPreference android:dependency="remux_enable" android:key="remux_command" android:title="@string/remux_command_title" android:defaultValue="EXT" android:summary="@string/remux_command_summary"
+ />
+
+ <EditTextPreference android:dependency="remux_enable" android:key="remux_parameter" android:title="@string/remux_parameter_title" android:summary="@string/remux_parameter_summary"
+ android:defaultValue="QUALITY=DSL1000"
+ />
+
+
+ </PreferenceCategory>
+
</PreferenceScreen>
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;
}
-
+
}