summaryrefslogtreecommitdiff
path: root/src/input/input_dvb.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/input/input_dvb.c')
-rw-r--r--src/input/input_dvb.c82
1 files changed, 54 insertions, 28 deletions
diff --git a/src/input/input_dvb.c b/src/input/input_dvb.c
index da3ef73eb..1715c5a2f 100644
--- a/src/input/input_dvb.c
+++ b/src/input/input_dvb.c
@@ -66,14 +66,17 @@
* OSD - this will allow for filtering/searching of epg data - useful for automatic recording :)
*/
-/* pthread.h must be included first so rest of the headers are imported
- thread safely (on some systems). */
-#include <pthread.h>
-
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
+/* pthread.h must be included first so rest of the headers are imported
+ thread safely (on some systems).
+ However, including it before config.h causes problems with asprintf not
+ being declared (glibc 2.3.6)
+*/
+#include <pthread.h>
+
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
@@ -97,9 +100,11 @@
#endif
#include <ctype.h>
-/* These will eventually be #include <linux/dvb/...> */
-#include "dvb/dmx.h"
-#include "dvb/frontend.h"
+/* XDG */
+#include <basedir.h>
+
+#include <linux/dvb/dmx.h>
+#include <linux/dvb/frontend.h>
#define LOG_MODULE "input_dvb"
#define LOG_VERBOSE
@@ -331,6 +336,8 @@ typedef struct {
/* scratch buffer for forward seeking */
char seek_buf[BUFSIZE];
+ /* Is the GUI enabled at all? */
+ int dvb_gui_enabled;
/* simple vcr-like functionality */
int record_fd;
int record_paused;
@@ -887,8 +894,8 @@ static channel_t *load_channels(xine_t *xine, xine_stream_t *stream, int *num_ch
int num_alloc = 0;
int i;
struct stat st;
-
- snprintf(filename, BUFSIZE, "%s/.xine/channels.conf", xine_get_homedir());
+
+ snprintf(filename, BUFSIZE, "%s/"PACKAGE"/channels.conf", xdgConfigHome(xine->basedir_handle));
f = fopen(filename, "r");
if (!f) {
@@ -1329,8 +1336,8 @@ static void dvb_parse_si(dvb_input_plugin_t *this) {
/* Helper function for finding the channel index in the channels struct
given the service_id. If channel is not found, -1 is returned. */
-static int channel_index(dvb_input_plugin_t* this, unsigned int service_id) {
- unsigned int n;
+static int channel_index(dvb_input_plugin_t* this, int service_id) {
+ int n;
for (n=0; n < this->num_channels; n++)
if (this->channels[n].service_id == service_id)
return n;
@@ -2491,15 +2498,18 @@ static void ts_rewrite_packets (dvb_input_plugin_t *this, unsigned char * origin
}
static off_t dvb_plugin_read (input_plugin_t *this_gen,
- char *buf, off_t len) {
+ void *buf_gen, off_t len) {
dvb_input_plugin_t *this = (dvb_input_plugin_t *) this_gen;
+ char *buf = (char *)buf_gen;
+
off_t n=0, total=0;
int have_mutex=0;
struct pollfd pfd;
if (!this->tuned_in)
return 0;
- dvb_event_handler (this);
+ if (this->dvb_gui_enabled)
+ dvb_event_handler (this);
#ifdef LOG_READS
xprintf(this->class->xine,XINE_VERBOSITY_DEBUG,
"input_dvb: reading %" PRIdMAX " bytes...\n", (intmax_t)len);
@@ -2764,6 +2774,11 @@ static int dvb_plugin_open(input_plugin_t * this_gen)
xine_cfg_entry_t zoomdvb;
xine_cfg_entry_t adapter;
xine_cfg_entry_t lastchannel;
+ xine_cfg_entry_t gui_enabled;
+
+ xine_config_lookup_entry(this->stream->xine, "media.dvb.gui_enabled", &gui_enabled);
+ this->dvb_gui_enabled = gui_enabled.num_value;
+ xprintf(this->class->xine, XINE_VERBOSITY_LOG, _("input_dvb: DVB GUI %s\n"), this->dvb_gui_enabled ? "enabled" : "disabled");
xine_config_lookup_entry(this->stream->xine, "media.dvb.adapter", &adapter);
@@ -2823,7 +2838,7 @@ static int dvb_plugin_open(input_plugin_t * this_gen)
* by numbers...
*/
int chanlen = strlen(channame);
- int offset = 0;
+ size_t offset = 0;
xprintf(this->class->xine, XINE_VERBOSITY_LOG,
_("input_dvb: exact match for %s not found: trying partial matches\n"), channame);
@@ -2840,7 +2855,7 @@ static int dvb_plugin_open(input_plugin_t * this_gen)
idx++;
}
offset++;
- xprintf(this->class->xine,XINE_VERBOSITY_LOG,"%d,%d,%d\n", offset, idx, num_channels);
+ xprintf(this->class->xine,XINE_VERBOSITY_LOG,"%zd,%d,%d\n", offset, idx, num_channels);
}
while ((offset < 6) && (idx == num_channels));
if (idx < num_channels) {
@@ -2990,15 +3005,16 @@ static int dvb_plugin_open(input_plugin_t * this_gen)
this->event_queue = xine_event_new_queue(this->stream);
#ifdef EPG_UPDATE_IN_BACKGROUND
- /* Start the EPG updater thread. */
- this->epg_updater_stop = 0;
- if (pthread_create(&this->epg_updater_thread, NULL,
- epg_data_updater, this) != 0) {
- xprintf(
- this->class->xine, XINE_VERBOSITY_LOG,
- _("input_dvb: cannot create EPG updater thread\n"));
- return 0;
-
+ if (this->dvb_gui_enabled) {
+ /* Start the EPG updater thread. */
+ this->epg_updater_stop = 0;
+ if (pthread_create(&this->epg_updater_thread, NULL,
+ epg_data_updater, this) != 0) {
+ xprintf(
+ this->class->xine, XINE_VERBOSITY_LOG,
+ _("input_dvb: cannot create EPG updater thread\n"));
+ return 0;
+ }
}
#endif
/*
@@ -3190,11 +3206,14 @@ static char **dvb_class_get_autoplay_list(input_class_t * this_gen,
num_channels = 0;
if (!(channels = load_channels(class->xine, NULL, &num_channels, 0))) {
+ static char *placefile = NULL;
/* channels.conf not found in .xine */
- class->mrls[0]="Sorry, No channels.conf found";
- class->mrls[1]="Please run the dvbscan utility";
- class->mrls[2]="from the dvb drivers apps package";
- class->mrls[3]="and place the file in ~/.xine/";
+ class->mrls[0]="Sorry, no channels.conf found.";
+ class->mrls[1]="Please run the scan utility from the DVB";
+ class->mrls[2]="drivers apps package and place the file in";
+ if (!placefile)
+ asprintf (&placefile, "%s/"PACKAGE"/", xdgConfigHome(class->xine->basedir_handle));
+ class->mrls[3]=placefile;
*num_files=4;
return class->mrls;
}
@@ -3285,6 +3304,13 @@ static void *init_class (xine_t *xine, void *data) {
"Greater than 0 means wait that many seconds to get a lock. Minimum is 5 seconds."),
0, NULL, (void *) this);
+ /* set to 0 to turn off the GUI built into this input plugin */
+ config->register_bool(config, "media.dvb.gui_enabled",
+ 1,
+ _("Enable the DVB GUI"),
+ _("Enable the DVB GUI, mouse controlled recording and channel switching."),
+ 21, NULL, NULL);
+
config->register_num(config, "media.dvb.adapter",
0,
_("Number of dvb card to use."),