diff options
Diffstat (limited to 'src/input')
-rw-r--r-- | src/input/input_dvb.c | 68 | ||||
-rw-r--r-- | src/input/input_http.c | 19 | ||||
-rw-r--r-- | src/input/input_plugin.h | 7 | ||||
-rw-r--r-- | src/input/input_v4l.c | 21 |
4 files changed, 95 insertions, 20 deletions
diff --git a/src/input/input_dvb.c b/src/input/input_dvb.c index 85246ea5c..bc279b78b 100644 --- a/src/input/input_dvb.c +++ b/src/input/input_dvb.c @@ -291,6 +291,7 @@ typedef struct { int numchannels; char *autoplaylist[MAX_AUTOCHANNELS]; + char *default_channels_conf_filename; } dvb_input_class_t; typedef struct { @@ -331,6 +332,9 @@ 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; @@ -369,6 +373,7 @@ static const Param bw_list [] = { { "BANDWIDTH_6_MHZ", BANDWIDTH_6_MHZ }, { "BANDWIDTH_7_MHZ", BANDWIDTH_7_MHZ }, { "BANDWIDTH_8_MHZ", BANDWIDTH_8_MHZ }, + { "BANDWIDTH_AUTO", BANDWIDTH_AUTO }, { NULL, 0 } }; @@ -391,6 +396,7 @@ static const Param guard_list [] = { {"GUARD_INTERVAL_1_32", GUARD_INTERVAL_1_32}, {"GUARD_INTERVAL_1_4", GUARD_INTERVAL_1_4}, {"GUARD_INTERVAL_1_8", GUARD_INTERVAL_1_8}, + {"GUARD_INTERVAL_AUTO", GUARD_INTERVAL_AUTO}, { NULL, 0 } }; @@ -399,6 +405,7 @@ static const Param hierarchy_list [] = { { "HIERARCHY_2", HIERARCHY_2 }, { "HIERARCHY_4", HIERARCHY_4 }, { "HIERARCHY_NONE", HIERARCHY_NONE }, + { "HIERARCHY_AUTO", HIERARCHY_AUTO }, { NULL, 0 } }; @@ -417,12 +424,14 @@ static const Param qam_list [] = { { "QAM_256", QAM_256 }, { "QAM_32", QAM_32 }, { "QAM_64", QAM_64 }, + { "QAM_AUTO", QAM_AUTO }, { NULL, 0 } }; static const Param transmissionmode_list [] = { { "TRANSMISSION_MODE_2K", TRANSMISSION_MODE_2K }, { "TRANSMISSION_MODE_8K", TRANSMISSION_MODE_8K }, + { "TRANSMISSION_MODE_AUTO", TRANSMISSION_MODE_AUTO }, { NULL, 0 } }; @@ -880,13 +889,15 @@ static channel_t *load_channels(xine_t *xine, xine_stream_t *stream, int *num_ch FILE *f; char str[BUFSIZE]; - char filename[BUFSIZE]; channel_t *channels = NULL; int num_channels = 0; int num_alloc = 0; struct stat st; - - snprintf(filename, BUFSIZE, "%s/.xine/channels.conf", xine_get_homedir()); + xine_cfg_entry_t channels_conf; + char *filename; + + xine_config_lookup_entry(xine, "media.dvb.channels_conf", &channels_conf); + filename = channels_conf.str_value; f = fopen(filename, "r"); if (!f) { @@ -1141,6 +1152,8 @@ static void parse_pmt(dvb_input_plugin_t *this, const unsigned char *buf, int se switch (buf[0]) { case 0x01: case 0x02: + case 0x10: + case 0x1b: if(!has_video) { xprintf(this->stream->xine,XINE_VERBOSITY_LOG,"input_dvb: Adding VIDEO : PID 0x%04x\n", elementary_pid); dvb_set_pidfilter(this, VIDFILTER, elementary_pid, DMX_PES_VIDEO, DMX_OUT_TS_TAP); @@ -1150,6 +1163,8 @@ static void parse_pmt(dvb_input_plugin_t *this, const unsigned char *buf, int se case 0x03: case 0x04: + case 0x0f: + case 0x11: if(!has_audio) { xprintf(this->stream->xine,XINE_VERBOSITY_LOG,"input_dvb: Adding AUDIO : PID 0x%04x\n", elementary_pid); dvb_set_pidfilter(this, AUDFILTER, elementary_pid, DMX_PES_AUDIO, DMX_OUT_TS_TAP); @@ -2492,7 +2507,8 @@ static off_t dvb_plugin_read (input_plugin_t *this_gen, 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); @@ -2754,7 +2770,12 @@ 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); if (!(tuner = tuner_init(this->class->xine,adapter.num_value))) { @@ -2980,15 +3001,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 /* @@ -3154,6 +3176,8 @@ static void dvb_class_dispose(input_class_t * this_gen) { dvb_input_class_t *class = (dvb_input_class_t *) this_gen; int x; + + free(class->default_channels_conf_filename); for(x=0;x<class->numchannels;x++) free(class->autoplaylist[x]); @@ -3263,6 +3287,10 @@ static void *init_class (xine_t *xine, void *data) { this->mrls[3] = "dvbt://"; this->mrls[4] = "dvba://"; this->mrls[5] = 0; + + asprintf(&this->default_channels_conf_filename, + "%s/.xine/channels.conf", + xine_get_homedir()); xprintf(this->xine,XINE_VERBOSITY_DEBUG,"init class succeeded\n"); @@ -3296,7 +3324,19 @@ static void *init_class (xine_t *xine, void *data) { "in your system."), 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); + /* Override the default channels file */ + config->register_filename(config, "media.dvb.channels_conf", + this->default_channels_conf_filename, + XINE_CONFIG_STRING_IS_FILENAME, + _("DVB Channels config file"), + _("DVB Channels config file to use instead of the ~/.xine/channels.conf file."), + 21, NULL, NULL); return this; } diff --git a/src/input/input_http.c b/src/input/input_http.c index cbc2e8140..169a0d384 100644 --- a/src/input/input_http.c +++ b/src/input/input_http.c @@ -82,6 +82,8 @@ typedef struct { char auth[BUFSIZE]; char proxyauth[BUFSIZE]; + + char *mime_type; char *proto; char *user; @@ -592,17 +594,20 @@ static const char* http_plugin_get_mrl (input_plugin_t *this_gen) { } static int http_plugin_get_optional_data (input_plugin_t *this_gen, - void *data, int data_type) { + void *const data, int data_type) { + void **const ptr = (void **const) data; http_input_plugin_t *this = (http_input_plugin_t *) this_gen; switch (data_type) { case INPUT_OPTIONAL_DATA_PREVIEW: - memcpy (data, this->preview, this->preview_size); return this->preview_size; - break; + case INPUT_OPTIONAL_DATA_MIME_TYPE: + *ptr = this->mime_type; + case INPUT_OPTIONAL_DATA_DEMUX_MIME_TYPE: + return *this->mime_type ? INPUT_OPTIONAL_SUCCESS : INPUT_OPTIONAL_UNSUPPORTED; } return INPUT_OPTIONAL_UNSUPPORTED; @@ -627,6 +632,7 @@ static void http_plugin_dispose (input_plugin_t *this_gen ) { if (this->user) free(this->user); if (this->password) free(this->password); if (this->uri) free(this->uri); + if (this->mime_type) free(this->mime_type); free (this); } @@ -655,7 +661,9 @@ static int http_plugin_open (input_plugin_t *this_gen ) { int use_proxy; int proxyport; int mpegurl_redirect = 0; - + char mime_type[256]; + + mime_type[0] = 0; use_proxy = this_class->proxyhost && strlen(this_class->proxyhost); if (use_proxy) { @@ -922,6 +930,7 @@ static int http_plugin_open (input_plugin_t *this_gen ) { const char *type = this->buf + sizeof (TAG_CONTENT_TYPE) - 1; while (isspace (*type)) ++type; + sprintf (mime_type, "%.255s", type); if (!strncasecmp (type, "video/nsv", 9)) { lprintf("shoutcast nsv detected\n"); this->is_nsv = 1; @@ -993,6 +1002,8 @@ static int http_plugin_open (input_plugin_t *this_gen ) { lprintf("preview_size=%"PRId64"\n", this->preview_size); this->curpos = 0; + if (*mime_type) + this->mime_type = strdup (mime_type); return 1; } diff --git a/src/input/input_plugin.h b/src/input/input_plugin.h index 4790164d5..080e05476 100644 --- a/src/input/input_plugin.h +++ b/src/input/input_plugin.h @@ -307,6 +307,13 @@ struct input_plugin_s { #define INPUT_OPTIONAL_DATA_SPULANG 3 #define INPUT_OPTIONAL_DATA_PREVIEW 7 +/* buffer is a const char **; the string is freed by the input plugin. */ +#define INPUT_OPTIONAL_DATA_MIME_TYPE 8 +/* buffer is unused; true if the demuxer should be determined by the MIME type */ +#define INPUT_OPTIONAL_DATA_DEMUX_MIME_TYPE 9 +/* buffer is a const char **; the string is static or freed by the input plugin. */ +#define INPUT_OPTIONAL_DATA_DEMUXER 10 + #define MAX_MRL_ENTRIES 255 #define MAX_PREVIEW_SIZE 4096 diff --git a/src/input/input_v4l.c b/src/input/input_v4l.c index 304f6f484..29ed9899b 100644 --- a/src/input/input_v4l.c +++ b/src/input/input_v4l.c @@ -97,6 +97,9 @@ static const resolution_t resolutions[] = { #define AUDIO_DEV "plughw:0,0" #endif +static char *tv_standard_names[] = { "AUTO", "PAL", "NTSC", "SECAM", "OLD", NULL }; +static int tv_standard_values[] = { VIDEO_MODE_AUTO, VIDEO_MODE_PAL, VIDEO_MODE_NTSC, VIDEO_MODE_SECAM, -1 }; + #if !defined(NDELAY) && defined(O_NDELAY) #define FNDELAY O_NDELAY #endif @@ -631,6 +634,7 @@ static int search_by_channel(v4l_input_plugin_t *this, char *input_source) { int ret = 0; int fd = 0; + cfg_entry_t *tv_standard_entry; lprintf("input_source: %s\n", input_source); @@ -666,8 +670,17 @@ static int search_by_channel(v4l_input_plugin_t *this, char *input_source) return -1; } + tv_standard_entry = this->stream->xine->config->lookup_entry(this->stream->xine->config, + "media.video4linux.tv_standard"); this->tuner_name = input_source; - ret = ioctl(fd, VIDIOCSCHAN, &this->input); + if (tv_standard_entry->num_value != 0) { + this->video_channel.norm = tv_standard_values[ tv_standard_entry->num_value ]; + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + "input_v4l: TV Standard configured as STD %s (%d)\n", + tv_standard_names[ tv_standard_entry->num_value ], this->video_channel.norm ); + ret = ioctl(fd, VIDIOCSCHAN, &this->video_channel); + } else + ret = ioctl(fd, VIDIOCSCHAN, &this->input); lprintf("(%d) Set channel to %d\n", ret, this->input); @@ -1907,7 +1920,11 @@ static void *init_video_class (xine_t *xine, void *data) _("The name of the audio device which corresponds " "to your Video4Linux video device."), 10, NULL, NULL); -#endif +#endif + config->register_enum (config, "media.video4linux.tv_standard", 4 /* old */, + tv_standard_names, _("v4l TV standard"), + _("Selects the TV standard of the input signals. " + "Either: AUTO, PAL, NTSC or SECAM. "), 20, NULL, NULL); return this; } |