From fce4e656ac01a7b0822f1efbae85cf6e50e8999e Mon Sep 17 00:00:00 2001 From: Simon Farnsworth Date: Mon, 16 Jun 2008 17:33:48 +0100 Subject: demux_ts: Always replace PIDs when we parse a PMT demux_ts currently assumes that PIDs for a service never change - BBC THREE (amongst others) breaks this assumption. A PMT shouldn't change unless PIDs change, so always reacquire PIDs whenever we parse a PMT; this should work fine in the case when the PIDs do not change, and pick up the new PIDs whenever a change happens --HG-- extra : transplant_source : e%AB%EB%E1%CF%D8%1C%15%5E%DE%09%E4%3Dd%AB%E3f%FD%E5%9E --- src/demuxers/demux_ts.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src') diff --git a/src/demuxers/demux_ts.c b/src/demuxers/demux_ts.c index 80ad0acb1..67b2fbf2a 100644 --- a/src/demuxers/demux_ts.c +++ b/src/demuxers/demux_ts.c @@ -1239,6 +1239,15 @@ printf("Program Number is %i, looking for %i\n",program_number,this->program_num } } + /* + * Forget the current video, audio and subtitle PIDs; if the PMT has not + * changed, we'll pick them up again when we parse this PMT, while if the + * PMT has changed (e.g. an IPTV streamer that's just changed its source), + * we'll get new PIDs that we should follow. + */ + this->audio_tracks_count = 0; + this->videoPid = INVALID_PID; + this->spu_pid = INVALID_PID; /* * ES definitions start here...we are going to learn upto one video -- cgit v1.2.3 From 859bf9631b2d1599c86131f71198e15647c7fa3b Mon Sep 17 00:00:00 2001 From: Simon Farnsworth Date: Mon, 16 Jun 2008 17:35:28 +0100 Subject: input_dvb: Allow the user to configure the DVB GUI off. When using Xine in a kiosk-type application, the DVB GUI presents messages onscreen that confuse the user; because there's no keyboard and mouse, there's no way to actually do anything useful with the GUI. Provide a configuration option to turn off the GUI --HG-- extra : transplant_source : c%F4%13I%97%3F%11%E8s%CCc%15%9F%AF%97%D7%13D%FC%AB --- src/input/input_dvb.c | 36 ++++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/input/input_dvb.c b/src/input/input_dvb.c index 85246ea5c..5ea3e77ef 100644 --- a/src/input/input_dvb.c +++ b/src/input/input_dvb.c @@ -331,6 +331,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; @@ -2492,7 +2495,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 +2758,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 +2989,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 /* @@ -3296,6 +3306,12 @@ 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); return this; } -- cgit v1.2.3 From 904233454d25c6eef564676a6446a22d5970bb4f Mon Sep 17 00:00:00 2001 From: Simon Farnsworth Date: Tue, 17 Jun 2008 13:00:04 +0100 Subject: input_dvb: Allow the user to configure the location of the channels.conf filename We don't have a "normal" Linux directory layout, and thus prefer to keep channels.conf in an unusual place. Provide a configuration option to tell Xine where to find channels.conf --- src/input/input_dvb.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/input/input_dvb.c b/src/input/input_dvb.c index 5ea3e77ef..b097e5ee2 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 { @@ -883,13 +884,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) { @@ -3164,6 +3167,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;xnumchannels;x++) free(class->autoplaylist[x]); @@ -3273,6 +3278,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"); @@ -3312,7 +3321,13 @@ static void *init_class (xine_t *xine, void *data) { _("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; } -- cgit v1.2.3 From d9ab0b0076c483ebc3971f4e159e55de242cc3cc Mon Sep 17 00:00:00 2001 From: Simon Farnsworth Date: Tue, 17 Jun 2008 13:27:47 +0100 Subject: input_v4l: Set video format Allow the user to manually configure their tuner to AUTO, PAL, SECAM or NTSC as appropriate. OLD is allowed (but not documented); it's the default value, and gives you the same behaviour as you would get before this option was implemented. --- src/input/input_v4l.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/input/input_v4l.c b/src/input/input_v4l.c index 304f6f484..365bce664 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[] = { "OLD", "PAL", "NTSC", "SECAM", "AUTO", NULL }; +static int tv_standard_values[] = { -1, VIDEO_MODE_PAL, VIDEO_MODE_NTSC, VIDEO_MODE_SECAM, VIDEO_MODE_AUTO }; + #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", 0, + 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; } -- cgit v1.2.3 From fd26e45a60a7a7268910046e2f42d0344326f5f0 Mon Sep 17 00:00:00 2001 From: Simon Farnsworth Date: Wed, 18 Jun 2008 16:46:51 +0100 Subject: input_dvb: Allow automatic detection of DVB parameters We've experienced glitches where the NIT does not match the transmission parameters, and bugs in the kernel where the values we read back from the frontend don't match the transmission. To get round this, we've changed scan to store BANDWIDTH_AUTO and equivalents in the channels.conf file. Update input_dvb to cope with automatic detection of all frontend parameters. --- src/input/input_dvb.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/input/input_dvb.c b/src/input/input_dvb.c index b097e5ee2..ddc1a0702 100644 --- a/src/input/input_dvb.c +++ b/src/input/input_dvb.c @@ -373,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 } }; @@ -395,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 } }; @@ -403,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 } }; @@ -421,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 } }; -- cgit v1.2.3 From f24e088471a94dd37adf342c7634c468157e70ba Mon Sep 17 00:00:00 2001 From: Simon Farnsworth Date: Wed, 18 Jun 2008 17:57:06 +0100 Subject: input_dvb: Recognise new audio and video stream formats Update input_dvb's PMT parser to match demux_ts's list of stream types. This is a stop-gap approach, to avoid doing major rewrites to input_dvb. Ideally, we'd fix the limitations in demux_ts that the comment above input_dvb's PMT parser alludes to, and just parse all the streams in the PMT to demux_ts. In the meantime, this enables use of input_dvb with things like Finnish DVB-T --- src/input/input_dvb.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/input/input_dvb.c b/src/input/input_dvb.c index ddc1a0702..bc279b78b 100644 --- a/src/input/input_dvb.c +++ b/src/input/input_dvb.c @@ -1152,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); @@ -1161,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); -- cgit v1.2.3 From 22779a0dcd30851fd61a1d972818d37fed65a798 Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Wed, 18 Jun 2008 19:48:09 +0100 Subject: Separate PES stream IDs from TS descriptor tags. --- src/demuxers/demux_ts.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_ts.c b/src/demuxers/demux_ts.c index 67b2fbf2a..1e8c8d2cf 100644 --- a/src/demuxers/demux_ts.c +++ b/src/demuxers/demux_ts.c @@ -245,7 +245,7 @@ typedef struct { int64_t pts; buf_element_t *buf; unsigned int counter; - uint8_t descriptor_tag; + uint16_t descriptor_tag; /* +0x100 for PES stream IDs (no available TS descriptor tag?) */ int64_t packet_count; int corrupted_pes; uint32_t buffered_bytes; @@ -982,7 +982,7 @@ static void demux_ts_pes_new(demux_ts_t*this, unsigned int mediaIndex, unsigned int pid, fifo_buffer_t *fifo, - uint8_t descriptor) { + uint16_t descriptor) { demux_ts_media *m = &this->media[mediaIndex]; @@ -1854,7 +1854,7 @@ static void demux_ts_parse_packet (demux_ts_t*this) { } else if (!found) { this->videoPid = pid; this->videoMedia = this->media_num; - demux_ts_pes_new(this, this->media_num++, pid, this->video_fifo, pes_stream_id); + demux_ts_pes_new(this, this->media_num++, pid, this->video_fifo, 0x100 + pes_stream_id); } if (this->videoPid != INVALID_PID) { @@ -1880,7 +1880,7 @@ static void demux_ts_parse_packet (demux_ts_t*this) { this->audio_tracks[this->audio_tracks_count].media_index = this->media_num; this->media[this->media_num].type = this->audio_tracks_count; demux_ts_pes_new(this, this->media_num++, pid, - this->audio_fifo,pes_stream_id); + this->audio_fifo, 0x100 + pes_stream_id); this->audio_tracks_count++; } } -- cgit v1.2.3 From 048c41a4661a6fffc5a4842390902493eea82168 Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Thu, 19 Jun 2008 03:00:43 +0100 Subject: Swap positions of "auto" and "old" in the v4l TV standards list. "Old" is still the default. --- src/input/input_v4l.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/input/input_v4l.c b/src/input/input_v4l.c index 365bce664..29ed9899b 100644 --- a/src/input/input_v4l.c +++ b/src/input/input_v4l.c @@ -97,8 +97,8 @@ static const resolution_t resolutions[] = { #define AUDIO_DEV "plughw:0,0" #endif -static char *tv_standard_names[] = { "OLD", "PAL", "NTSC", "SECAM", "AUTO", NULL }; -static int tv_standard_values[] = { -1, VIDEO_MODE_PAL, VIDEO_MODE_NTSC, VIDEO_MODE_SECAM, VIDEO_MODE_AUTO }; +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 @@ -1921,7 +1921,7 @@ static void *init_video_class (xine_t *xine, void *data) "to your Video4Linux video device."), 10, NULL, NULL); #endif - config->register_enum (config, "media.video4linux.tv_standard", 0, + 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); -- cgit v1.2.3