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.c46
1 files changed, 28 insertions, 18 deletions
diff --git a/src/input/input_dvb.c b/src/input/input_dvb.c
index 98b343b44..9ff40f7ea 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
@@ -887,8 +892,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) {
@@ -1301,8 +1306,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;
@@ -2463,8 +2468,10 @@ 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;
@@ -2795,7 +2802,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);
@@ -2812,7 +2819,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) {
@@ -3162,11 +3169,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;
}