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.c70
1 files changed, 36 insertions, 34 deletions
diff --git a/src/input/input_dvb.c b/src/input/input_dvb.c
index a998d274b..07aefc362 100644
--- a/src/input/input_dvb.c
+++ b/src/input/input_dvb.c
@@ -113,9 +113,9 @@
#define LOG_READS
*/
-#include "xine_internal.h"
-#include "xineutils.h"
-#include "input_plugin.h"
+#include <xine/xine_internal.h>
+#include <xine/xineutils.h>
+#include <xine/input_plugin.h>
#include "net_buf_ctrl.h"
#define BUFSIZE 16384
@@ -234,9 +234,8 @@ typedef struct {
int adapter_num;
- char frontend_device[100];
- char dvr_device[100];
- char demux_device[100];
+ char *dvr_device;
+ char *demux_device;
struct dmx_pes_filter_params pesFilterParams[MAX_FILTERS];
struct dmx_pes_filter_params subFilterParams[MAX_SUBTITLES];
@@ -291,7 +290,7 @@ typedef struct {
xine_t *xine;
- char *mrls[5];
+ const char *mrls[5];
int numchannels;
@@ -359,7 +358,7 @@ typedef struct {
} dvb_input_plugin_t;
typedef struct {
- char *name;
+ const char *name;
int value;
} Param;
@@ -432,7 +431,7 @@ static const Param transmissionmode_list [] = {
};
-time_t dvb_mjdtime (char *buf);
+static time_t dvb_mjdtime (uint8_t *buf);
static void load_epg_data(dvb_input_plugin_t *this);
static void show_eit(dvb_input_plugin_t *this);
@@ -491,7 +490,7 @@ static int find_descriptor(uint8_t tag, const unsigned char *buf, int descriptor
/* Extract UTC time and date encoded in modified julian date format and return it as a time_t.
*/
-time_t dvb_mjdtime (char *buf)
+static time_t dvb_mjdtime (uint8_t *buf)
{
int i;
unsigned int year, month, day, hour, min, sec;
@@ -548,9 +547,10 @@ static void tuner_dispose(tuner_t * this)
for (x = 0; x < MAX_SUBTITLES; x++)
if (this->fd_subfilter[x] >= 0)
close(this->fd_subfilter[x]);
-
- if(this)
- free(this);
+
+ free(this->dvr_device);
+ free(this->demux_device);
+ free(this);
}
@@ -560,10 +560,9 @@ static tuner_t *tuner_init(xine_t * xine, int adapter)
tuner_t *this;
int x;
int test_video;
- char *video_device=xine_xmalloc(200);
+ char *video_device = NULL;
+ char *frontend_device = NULL;
- _x_assert(video_device != NULL);
-
this = (tuner_t *) xine_xmalloc(sizeof(tuner_t));
_x_assert(this != NULL);
@@ -576,21 +575,24 @@ static tuner_t *tuner_init(xine_t * xine, int adapter)
this->xine = xine;
this->adapter_num = adapter;
- snprintf(this->frontend_device,100,"/dev/dvb/adapter%i/frontend0",this->adapter_num);
- snprintf(this->demux_device,100,"/dev/dvb/adapter%i/demux0",this->adapter_num);
- snprintf(this->dvr_device,100,"/dev/dvb/adapter%i/dvr0",this->adapter_num);
- snprintf(video_device,100,"/dev/dvb/adapter%i/video0",this->adapter_num);
-
- if ((this->fd_frontend = open(this->frontend_device, O_RDWR)) < 0) {
+ asprintf(&this->demux_device,"/dev/dvb/adapter%i/demux0",this->adapter_num);
+ asprintf(&this->dvr_device,"/dev/dvb/adapter%i/dvr0",this->adapter_num);
+ asprintf(&video_device,"/dev/dvb/adapter%i/video0",this->adapter_num);
+
+ asprintf(&frontend_device,"/dev/dvb/adapter%i/frontend0",this->adapter_num);
+ if ((this->fd_frontend = open(frontend_device, O_RDWR)) < 0) {
xprintf(this->xine, XINE_VERBOSITY_DEBUG, "FRONTEND DEVICE: %s\n", strerror(errno));
tuner_dispose(this);
- return NULL;
+ this = NULL;
+ goto exit;
}
+ free(frontend_device); frontend_device = NULL;
if ((ioctl(this->fd_frontend, FE_GET_INFO, &this->feinfo)) < 0) {
xprintf(this->xine, XINE_VERBOSITY_DEBUG, "FE_GET_INFO: %s\n", strerror(errno));
tuner_dispose(this);
- return NULL;
+ this = NULL;
+ goto exit;
}
for (x = 0; x < MAX_FILTERS; x++) {
@@ -598,7 +600,8 @@ static tuner_t *tuner_init(xine_t * xine, int adapter)
if (this->fd_pidfilter[x] < 0) {
xprintf(this->xine, XINE_VERBOSITY_DEBUG, "DEMUX DEVICE PIDfilter: %s\n", strerror(errno));
tuner_dispose(this);
- return NULL;
+ this = NULL;
+ goto exit;
}
}
for (x = 0; x < MAX_SUBTITLES; x++) {
@@ -630,7 +633,9 @@ static tuner_t *tuner_init(xine_t * xine, int adapter)
close(test_video);
}
+ exit:
free(video_device);
+ free(frontend_device);
return this;
}
@@ -1203,8 +1208,8 @@ static void parse_pmt(dvb_input_plugin_t *this, const unsigned char *buf, int se
static void dvb_parse_si(dvb_input_plugin_t *this) {
- char *tmpbuffer;
- char *bufptr;
+ uint8_t *tmpbuffer;
+ uint8_t *bufptr;
int service_id;
int result;
int section_len;
@@ -1403,8 +1408,8 @@ static void load_epg_data(dvb_input_plugin_t *this)
int section_len = 0;
unsigned int service_id=-1;
int n;
- char *eit = NULL;
- char *foo = NULL;
+ uint8_t *eit = NULL;
+ uint8_t *foo = NULL;
char *seen_channels = NULL;
int text_len;
struct pollfd fd;
@@ -1591,7 +1596,7 @@ static void load_epg_data(dvb_input_plugin_t *this)
case 0x54: { /* Content Descriptor, riveting stuff */
int content_bits = getbits(eit, 8, 4);
- char *content[] = {
+ static const char *const content[] = {
"UNKNOWN","MOVIE","NEWS","ENTERTAINMENT","SPORT",
"CHILDRENS","MUSIC","ARTS/CULTURE","CURRENT AFFAIRS",
"EDUCATIONAL","INFOTAINMENT","SPECIAL","COMEDY","DRAMA",
@@ -2476,7 +2481,7 @@ static void ts_rewrite_packets (dvb_input_plugin_t *this, unsigned char * origin
static off_t dvb_plugin_read (input_plugin_t *this_gen,
void *buf_gen, off_t len) {
dvb_input_plugin_t *this = (dvb_input_plugin_t *) this_gen;
- char *buf = (char *)buf_gen;
+ uint8_t *buf = buf_gen;
off_t n=0, total=0;
int have_mutex=0;
@@ -2491,9 +2496,6 @@ static off_t dvb_plugin_read (input_plugin_t *this_gen,
"input_dvb: reading %" PRIdMAX " bytes...\n", (intmax_t)len);
#endif
-#ifndef DVB_NO_BUFFERING
- nbc_check_buffers (this->nbc);
-#endif
/* protect against channel changes */
have_mutex = pthread_mutex_lock(&this->channel_change_mutex);
total=0;