From c3d5043378e87dce4eaa027607ff1da492f77346 Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Fri, 17 Aug 2007 13:54:29 +0100 Subject: Fix C++ breakage introduced in cset 290f0d28f8fc. --- include/xine.h.in | 3 +-- src/xine-engine/configfile.c | 6 +++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/include/xine.h.in b/include/xine.h.in index 58507e6f1..c25aef4b1 100644 --- a/include/xine.h.in +++ b/include/xine.h.in @@ -1536,8 +1536,7 @@ void xine_config_update_entry (xine_t *self, * translation of old configuration entry names */ typedef struct { - const char *old; - const char *new; + const char *old_name, *new_name; } xine_config_entry_translation_t; void xine_config_set_translation_user (const xine_config_entry_translation_t *) XINE_PROTECTED; diff --git a/src/xine-engine/configfile.c b/src/xine-engine/configfile.c index 67c8ef909..cc3f21db8 100644 --- a/src/xine-engine/configfile.c +++ b/src/xine-engine/configfile.c @@ -353,9 +353,9 @@ static void config_remove(config_values_t *this, cfg_entry_t *entry, cfg_entry_t static const char *config_xlate_internal (const char *key, const xine_config_entry_translation_t *trans) { --trans; - while ((++trans)->old) - if (trans->new[0] && strcmp(key, trans->old) == 0) - return trans->new; + while ((++trans)->old_name) + if (trans->new_name[0] && strcmp(key, trans->old_name) == 0) + return trans->new_name; return NULL; } -- cgit v1.2.3 From f6d9b0ac9567cbb6fdba08b20c9528770bef4696 Mon Sep 17 00:00:00 2001 From: Christophe Thommeret Date: Fri, 17 Aug 2007 19:42:18 +0100 Subject: mpeg_ts multiple audio streams fix + spu lang fix With current code, ts demuxer stores audio tracks in the order it finds it in PMT, but doesn't correctly set the buffer type so stream's audio_track_map may (and often) have a different order and so a user can get german audio when selecting "ita" ! Bad. This patch fixes that. It also fixes get_optional_data to return correct spu lang instead of none. --- src/demuxers/demux_ts.c | 70 ++++++++++++++++++++++++++----------------------- 1 file changed, 37 insertions(+), 33 deletions(-) diff --git a/src/demuxers/demux_ts.c b/src/demuxers/demux_ts.c index 3bea3ef57..6c50db864 100644 --- a/src/demuxers/demux_ts.c +++ b/src/demuxers/demux_ts.c @@ -299,6 +299,7 @@ typedef struct { uint8_t *pmt[MAX_PMTS]; uint8_t *pmt_write_ptr[MAX_PMTS]; uint32_t crc32_table[256]; + uint32_t last_pmt_crc; /* * Stuff to do with the transport header. As well as the video * and audio PIDs, we keep the index of the corresponding entry @@ -639,6 +640,7 @@ static void demux_ts_parse_pat (demux_ts_t*this, unsigned char *original_pkt, if (this->pmt_pid[program_count] != pmt_pid) { this->pmt_pid[program_count] = pmt_pid; this->audio_tracks_count = 0; + this->last_pmt_crc = 0; this->videoPid = INVALID_PID; this->spu_pid = INVALID_PID; } @@ -737,12 +739,11 @@ static int demux_ts_parse_pes_header (xine_t *xine, demux_ts_media *m, if (stream_id == 0xbd) { - int track, spu_id; + int spu_id; lprintf ("audio buf = %02X %02X %02X %02X %02X %02X %02X %02X\n", p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7]); - track = p[0] & 0x0F; /* hack : ac3 track */ /* * we check the descriptor tag first because some stations * do not include any of the ac3 header info in their audio tracks @@ -776,7 +777,7 @@ static int demux_ts_parse_pes_header (xine_t *xine, demux_ts_media *m, m->content = p+4; m->size = packet_len - 4; - m->type |= BUF_AUDIO_A52 + track; + m->type |= BUF_AUDIO_A52; return 1; } else if ((p[0]&0xf0) == 0xa0) { @@ -792,7 +793,7 @@ static int demux_ts_parse_pes_header (xine_t *xine, demux_ts_media *m, m->content = p+pcm_offset; m->size = packet_len-pcm_offset; - m->type |= BUF_AUDIO_LPCM_BE + track; + m->type |= BUF_AUDIO_LPCM_BE; return 1; } @@ -823,26 +824,22 @@ static int demux_ts_parse_pes_header (xine_t *xine, demux_ts_media *m, } else if ((stream_id & 0xe0) == 0xc0) { - int track; - - track = stream_id & 0x1f; - m->content = p; m->size = packet_len; switch (m->descriptor_tag) { case ISO_11172_AUDIO: case ISO_13818_AUDIO: lprintf ("demux_ts: found MPEG audio track.\n"); - m->type |= BUF_AUDIO_MPEG + track; + m->type |= BUF_AUDIO_MPEG; break; case ISO_13818_PART7_AUDIO: case ISO_14496_PART3_AUDIO: lprintf ("demux_ts: found AAC audio track.\n"); - m->type |= BUF_AUDIO_AAC + track; + m->type |= BUF_AUDIO_AAC; break; default: lprintf ("demux_ts: unknown audio type: %d, defaulting to MPEG.\n", m->descriptor_tag); - m->type |= BUF_AUDIO_MPEG + track; + m->type |= BUF_AUDIO_MPEG; break; } return 1; @@ -1211,11 +1208,24 @@ printf("Program Number is %i, looking for %i\n",program_number,this->program_num crc32,calc_crc32); return; } -#ifdef TS_PMT_LOG else { +#ifdef TS_PMT_LOG printf ("demux_ts: PMT CRC32 ok.\n"); - } #endif + if ( crc32==this->last_pmt_crc ) { +#ifdef TS_PMT_LOG + printf("demux_ts: PMT with CRC32=%d already parsed. Skipping.\n", crc32); +#endif + return; + } + else { +#ifdef TS_PMT_LOG + printf("demux_ts: new PMT, parsing...\n"); +#endif + this->last_pmt_crc = crc32; + } + } + /* * ES definitions start here...we are going to learn upto one video @@ -1923,6 +1933,7 @@ static void demux_ts_event_handler (demux_ts_t *this) { this->spu_pid = INVALID_PID; this->spu_media = 0; this->spu_langs_count= 0; + this->last_pmt_crc = 0; _x_demux_control_start (this->stream); break; @@ -1998,6 +2009,7 @@ static void demux_ts_send_headers (demux_plugin_t *this_gen) { this->videoPid = INVALID_PID; this->audio_tracks_count = 0; this->media_num= 0; + this->last_pmt_crc = 0; _x_demux_control_start (this->stream); @@ -2104,31 +2116,21 @@ static int demux_ts_get_optional_data(demux_plugin_t *this_gen, case DEMUX_OPTIONAL_DATA_AUDIOLANG: if ((channel >= 0) && (channel < this->audio_tracks_count)) { if(this->audio_tracks[channel].lang) - strcpy(str, this->audio_tracks[channel].lang); + strcpy(str, this->audio_tracks[channel].lang); else - sprintf(str, "%3i", _x_get_audio_channel(this->stream)); + sprintf(str, "%3i", _x_get_audio_channel(this->stream)); + } + else { + snprintf(str, XINE_LANG_MAX, "%3i", _x_get_audio_channel(this->stream)); } - else - { - snprintf(str, XINE_LANG_MAX, "%3i", _x_get_audio_channel(this->stream)); - } return DEMUX_OPTIONAL_SUCCESS; case DEMUX_OPTIONAL_DATA_SPULANG: - if (this->current_spu_channel >= 0 - && this->current_spu_channel < this->spu_langs_count) - { - memcpy(str, this->spu_langs[this->current_spu_channel].desc.lang, 3); - str[3] = 0; - } - else if (this->current_spu_channel == -1) - { - strcpy(str, "none"); - } - else - { - snprintf(str, XINE_LANG_MAX, "%3i", this->current_spu_channel); - } + if (channel>=0 && channelspu_langs_count) { + memcpy(str, this->spu_langs[channel].desc.lang, 3); + str[3] = 0;} + else + strcpy(str, "none"); return DEMUX_OPTIONAL_SUCCESS; default: @@ -2253,6 +2255,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, this->scrambled_npids = 0; this->videoPid = INVALID_PID; this->audio_tracks_count = 0; + this->last_pmt_crc = 0; this->rate = 16000; /* FIXME */ @@ -2335,3 +2338,4 @@ const plugin_info_t xine_plugin_info[] EXPORTED = { { PLUGIN_DEMUX, 26, "mpeg-ts", XINE_VERSION_CODE, &demux_info_ts, init_class }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; + -- cgit v1.2.3 From a875b2f17a011350d2284003170efdab94741e6d Mon Sep 17 00:00:00 2001 From: Christophe Thommeret Date: Fri, 17 Aug 2007 19:42:22 +0100 Subject: xine_stream audio_track_map order fix Actually, audio_decoder_loop stores audio streams in ascending buffer type order. So, for example a stream with buffer type BUF_AUDIO_A52|channel_num will always be stored in audio_track_map array before any mpegaudio stream. This breaks the stream order known by TS demuxer and so a user can get a52 french audio when selecting "deu" ! Bad again. This patch fixes that. --- src/xine-engine/audio_decoder.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/xine-engine/audio_decoder.c b/src/xine-engine/audio_decoder.c index 549c19b02..c271fc6fc 100644 --- a/src/xine-engine/audio_decoder.c +++ b/src/xine-engine/audio_decoder.c @@ -253,6 +253,7 @@ static void *audio_decoder_loop (void *stream_gen) { uint32_t audio_type = 0; int i,j; + uint32_t chan=buf->type&0x0000FFFF; /* printf("audio_decoder: buf_type=%08x auto=%08x user=%08x\n", @@ -264,11 +265,11 @@ static void *audio_decoder_loop (void *stream_gen) { /* update track map */ i = 0; - while ( (iaudio_track_map_entries) && (stream->audio_track_map[i]type) ) + while ( (iaudio_track_map_entries) && ((stream->audio_track_map[i]&0x0000FFFF)audio_track_map_entries) - || (stream->audio_track_map[i] != buf->type) ) { + || ((stream->audio_track_map[i]&0x0000FFFF)!=chan) ) { xine_event_t ui_event; j = stream->audio_track_map_entries; -- cgit v1.2.3 From bfeb9ba11a2845d5b45f36c3612c5c59c5d986aa Mon Sep 17 00:00:00 2001 From: Christophe Thommeret Date: Sat, 18 Aug 2007 23:23:27 +0100 Subject: =?UTF-8?q?libsputext=20colored=20typefaces=20patch=20Le=20dimanch?= =?UTF-8?q?e=2024=20d=C3=A9cembre=202006=2013:38,=20Miguel=20Freitas=20a?= =?UTF-8?q?=20=C3=A9crit:=20>=20Hi=20Christophe,=20>=20>=20On=2012/8/06,?= =?UTF-8?q?=20Christophe=20Thommeret=20=20wrote:=20>=20>=20?= =?UTF-8?q?Here=20is=20a=20patch=20that=20makes=20use=20of=20different=20c?= =?UTF-8?q?olors=20for=20typeface=20tags.=20>=20>=20It=20uses=20yellow=20f?= =?UTF-8?q?or=20italics=20and=20red=20for=20bold.=20>=20>=20this=20is=20an?= =?UTF-8?q?=20interesting=20idea=20and=20i=20agree=20it=20is=20probably=20?= =?UTF-8?q?better=20to=20use=20>=20the=20"ogm"=20rendering=20functions=20f?= =?UTF-8?q?or=20other=20formats=20as=20well.=20>=20>=20however=20i=20have?= =?UTF-8?q?=20one=20problem=20with=20this=20change:=20it=20will=20override?= =?UTF-8?q?=20user's=20>=20selection=20of=20"ui.osd.text=5Fpalette".=20>?= =?UTF-8?q?=20>=20how=20can=20we=20implement=20this=20without=20losing=20a?= =?UTF-8?q?bility=20to=20select=20font=20color=3F=20>=20>=20Miguel?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Well, seems i've forgot this one ;) This new patch honors ui.osd.text_palette --- src/libsputext/xine_sputext_decoder.c | 102 +++++++++++++++++++++------------- 1 file changed, 64 insertions(+), 38 deletions(-) diff --git a/src/libsputext/xine_sputext_decoder.c b/src/libsputext/xine_sputext_decoder.c index e8ef631ca..312b252ee 100644 --- a/src/libsputext/xine_sputext_decoder.c +++ b/src/libsputext/xine_sputext_decoder.c @@ -44,6 +44,39 @@ #define SUB_MAX_TEXT 5 /* lines */ #define SUB_BUFSIZE 256 /* chars per line */ +#define rgb2yuv(R,G,B) ((((((66*R+129*G+25*B+128)>>8)+16)<<8)|(((112*R-94*G-18*B+128)>>8)+128))<<8|(((-38*R-74*G+112*B+128)>>8)+128)) + +static uint32_t sub_palette[22]={ +/* RED */ + rgb2yuv(0,0,0), + rgb2yuv(0,0,0), + rgb2yuv(0,0,0), + rgb2yuv(0,0,0), + rgb2yuv(0,0,0), + rgb2yuv(0,0,0), + rgb2yuv(0,0,0), + rgb2yuv(50,10,10), + rgb2yuv(120,20,20), + rgb2yuv(185,50,50), + rgb2yuv(255,70,70), +/* BLUE */ + rgb2yuv(0,0,0), + rgb2yuv(0,0,0), + rgb2yuv(0,0,0), + rgb2yuv(0,0,0), + rgb2yuv(0,0,0), + rgb2yuv(0,0,0), + rgb2yuv(0,0,0), + rgb2yuv(0,30,50), + rgb2yuv(0,90,120), + rgb2yuv(0,140,185), + rgb2yuv(0,170,255) +}; + +static uint8_t sub_trans[22]={ + 0, 0, 3, 6, 8, 10, 12, 14, 15, 15, 15, + 0, 0, 3, 6, 8, 10, 12, 14, 15, 15, 15 +}; typedef enum { SUBTITLE_SIZE_TINY = 0, @@ -103,6 +136,9 @@ typedef struct sputext_decoder_s { osd_renderer_t *renderer; osd_object_t *osd; + int current_osd_text; + uint32_t spu_palette[OVL_PALETTE_SIZE]; + uint8_t spu_trans[OVL_PALETTE_SIZE]; int64_t img_duration; int64_t last_subtitle_end; /* no new subtitle before this vpts */ @@ -304,19 +340,23 @@ static void ogm_render_line(sputext_decoder_t *this, int x, int y, char* text) { switch (text[i]) { case '<': if (!strncmp("", text+i, 3)) { - /*Do somethink to enable BOLD typeface*/ + /* enable Bold color */ + this->current_osd_text = OSD_TEXT2; i=i+3; break; } else if (!strncmp("", text+i, 3)) { - /*Do somethink to disable BOLD typeface*/ + /* disable BOLD */ + this->current_osd_text = OSD_TEXT1; i=i+4; break; } else if (!strncmp("", text+i, 3)) { - /*Do somethink to enable italics typeface*/ + /* enable italics color */ + this->current_osd_text = OSD_TEXT3; i=i+3; break; } else if (!strncmp("", text+i, 3)) { - /*Do somethink to disable italics typeface*/ + /* disable italics */ + this->current_osd_text = OSD_TEXT1; i=i+4; break; } else if (!strncmp("", text+i, 3)) { @@ -338,7 +378,7 @@ static void ogm_render_line(sputext_decoder_t *this, int x, int y, char* text) { memcpy(letter,&text[i],shift); letter[shift]=0; - this->renderer->render_text(this->osd, x, y, letter, OSD_TEXT1); + this->renderer->render_text(this->osd, x, y, letter, this->current_osd_text); this->renderer->get_text_size(this->osd, letter, &w, &dummy); x=x+w; i+=shift; @@ -373,11 +413,8 @@ static void draw_subtitle(sputext_decoder_t *this, int64_t sub_start, int64_t su for (line = 0; line < this->lines; line++) /* first, check lenghts and word-wrap if needed */ { - int w, h; - if( this->ogm ) - w = ogm_get_width( this, this->text[line]); - else - this->renderer->get_text_size( this->osd, this->text[line], &w, &h); + int w; + w = ogm_get_width( this, this->text[line]); if( w > this->width ) { /* line is too long */ int chunks=(int)(w/this->width)+(w%this->width?1:0); if( this->lines+chunks <= SUB_MAX_TEXT && chunks>1 ) { /* try adding newlines while keeping existing ones */ @@ -411,7 +448,7 @@ static void draw_subtitle(sputext_decoder_t *this, int64_t sub_start, int64_t su this->lines+=chunks-1; } else { /* regenerate all the lines to find something that better fits */ char buf[SUB_BUFSIZE*SUB_MAX_TEXT]; - int a,w,h,chunks; + int a,w,chunks; buf[0]='\0'; for(a=0;alines;a++) { if(a) { @@ -421,10 +458,7 @@ static void draw_subtitle(sputext_decoder_t *this, int64_t sub_start, int64_t su } strcat(buf,this->text[a]); } - if( this->ogm ) - w = ogm_get_width( this, buf); - else - this->renderer->get_text_size( this->osd, buf, &w, &h); + w = ogm_get_width( this, buf); chunks=(int)(w/this->width)+(w%this->width?1:0); xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "Complete subtitle line splitting in %i chunks\n",chunks); if(chunks<=SUB_MAX_TEXT) {/* if the length is over than SUB_MAX_TEXT*this->width nothing can be done */ @@ -461,11 +495,8 @@ static void draw_subtitle(sputext_decoder_t *this, int64_t sub_start, int64_t su for (line = 0; line < this->lines; line++) /* first, check lenghts and word-wrap if needed */ { - int w, h; - if( this->ogm ) - w = ogm_get_width( this, this->text[line]); - else - this->renderer->get_text_size( this->osd, this->text[line], &w, &h); + int w; + w = ogm_get_width( this, this->text[line]); if( w > this->width ) { /* line is too long */ int chunks=(int)(w/this->width)+(w%this->width?1:0); if( this->lines+chunks <= SUB_MAX_TEXT && chunks>1 ) { /* try adding newlines while keeping existing ones */ @@ -499,7 +530,7 @@ static void draw_subtitle(sputext_decoder_t *this, int64_t sub_start, int64_t su this->lines+=chunks-1; } else { /* regenerate all the lines to find something that better fits */ char buf[SUB_BUFSIZE*SUB_MAX_TEXT]; - int a,w,h,chunks; + int a,w,chunks; buf[0]='\0'; for(a=0;alines;a++) { if(a) { @@ -509,10 +540,7 @@ static void draw_subtitle(sputext_decoder_t *this, int64_t sub_start, int64_t su } strcat(buf,this->text[a]); } - if( this->ogm ) - w = ogm_get_width( this, buf); - else - this->renderer->get_text_size( this->osd, buf, &w, &h); + w = ogm_get_width( this, buf); chunks=(int)(w/this->width)+(w%this->width?1:0); xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "Complete subtitle line splitting in %i chunks\n",chunks); if(chunks<=SUB_MAX_TEXT) {/* if the length is over than SUB_MAX_TEXT*this->width nothing can be done */ @@ -548,14 +576,10 @@ static void draw_subtitle(sputext_decoder_t *this, int64_t sub_start, int64_t su y = (SUB_MAX_TEXT - this->lines) * this->line_height; for (line = 0; line < this->lines; line++) { - int w, h, x; + int w, x; while(1) { - if( this->ogm ) - w = ogm_get_width( this, this->text[line]); - else - this->renderer->get_text_size( this->osd, this->text[line], - &w, &h); + w = ogm_get_width( this, this->text[line]); x = (this->width - w) / 2; if( w > this->width && font_size > 16 ) { @@ -566,12 +590,7 @@ static void draw_subtitle(sputext_decoder_t *this, int64_t sub_start, int64_t su } } - if( this->ogm ) { - ogm_render_line(this, x, y + line*this->line_height, this->text[line]); - } else { - this->renderer->render_text (this->osd, x, y + line * this->line_height, - this->text[line], OSD_TEXT1); - } + ogm_render_line(this, x, y + line*this->line_height, this->text[line]); } if( font_size != this->font_size ) @@ -583,6 +602,11 @@ static void draw_subtitle(sputext_decoder_t *this, int64_t sub_start, int64_t su this->last_subtitle_end = sub_end; this->renderer->set_text_palette (this->osd, -1, OSD_TEXT1); + this->renderer->get_palette(this->osd, this->spu_palette, this->spu_trans); + /* append some colors for colored typeface tag */ + memcpy(this->spu_palette+OSD_TEXT2, sub_palette, sizeof(sub_palette)); + memcpy(this->spu_trans+OSD_TEXT2, sub_trans, sizeof(sub_trans)); + this->renderer->set_palette(this->osd, this->spu_palette, this->spu_trans); if (this->unscaled) this->renderer->show_unscaled (this->osd, sub_start); @@ -626,7 +650,9 @@ static void spudec_decode_data (spu_decoder_t *this_gen, buf_element_t *buf) { this->buf_encoding = buf->decoder_info_ptr[2]; else this->buf_encoding = NULL; - + + this->current_osd_text = OSD_TEXT1; + if( (buf->type & 0xFFFF0000) == BUF_SPU_OGM ) { this->ogm = 1; -- cgit v1.2.3 From 92ed8db740b18f751707ad9c6c8ad32e8a48d5d7 Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Sun, 19 Aug 2007 02:10:09 +0100 Subject: Merge and clean up ogm_get_width & ogm_render_line; fix strncmp() length params. --- src/libsputext/xine_sputext_decoder.c | 109 ++++++++++------------------------ 1 file changed, 32 insertions(+), 77 deletions(-) diff --git a/src/libsputext/xine_sputext_decoder.c b/src/libsputext/xine_sputext_decoder.c index 312b252ee..4972e4843 100644 --- a/src/libsputext/xine_sputext_decoder.c +++ b/src/libsputext/xine_sputext_decoder.c @@ -271,119 +271,74 @@ static int parse_utf8_size(unsigned char *c) return 1; } -static int ogm_get_width(sputext_decoder_t *this, char* text) { - int i=0,width=0,w,dummy; - char letter[5]={0, 0, 0, 0, 0}; - int shift, isutf8 = 0; - char *encoding = (this->buf_encoding)?this->buf_encoding: - this->class->src_encoding; - if( strcmp(encoding, "utf-8") == 0 ) - isutf8 = 1; - - while (i<=strlen(text)) { - switch (text[i]) { - case '<': - if (!strncmp("", text+i, 3)) { - /*Do somethink to enable BOLD typeface*/ - i=i+3; - break; - } else if (!strncmp("", text+i, 3)) { - /*Do somethink to disable BOLD typeface*/ - i=i+4; - break; - } else if (!strncmp("", text+i, 3)) { - /*Do somethink to enable italics typeface*/ - i=i+3; - break; - } else if (!strncmp("", text+i, 3)) { - /*Do somethink to disable italics typeface*/ - i=i+4; - break; - } else if (!strncmp("", text+i, 3)) { - /*Do somethink to disable typing - fixme - no teststreams*/ - i=i+6; - break; - } else if (!strncmp("", text+i, 3)) { - /*Do somethink to enable typing - fixme - no teststreams*/ - i=i+7; - break; - } -default: - if ( isutf8 ) - shift = parse_utf8_size(&text[i]); - else - shift = 1; - memcpy(letter,&text[i],shift); - letter[shift]=0; - - this->renderer->get_text_size(this->osd, letter, &w, &dummy); - width=width+w; - i+=shift; - } - } - - return width; -} - -static void ogm_render_line(sputext_decoder_t *this, int x, int y, char* text) { - int i=0,w,dummy; +static int ogm_render_line_internal(sputext_decoder_t *this, int x, int y, const char *text, int render) +{ + int i = 0, w, dummy; char letter[5]={0, 0, 0, 0, 0}; - int shift, isutf8 = 0; - char *encoding = (this->buf_encoding)?this->buf_encoding: - this->class->src_encoding; - if( strcmp(encoding, "utf-8") == 0 ) - isutf8 = 1; + const char *encoding = this->buf_encoding ? this->buf_encoding + : this->class->src_encoding; + int shift, isutf8 = !strcmp(encoding, "utf-8"); + size_t length = strlen (text); - while (i<=strlen(text)) { + while (i <= length) { switch (text[i]) { case '<': if (!strncmp("", text+i, 3)) { /* enable Bold color */ - this->current_osd_text = OSD_TEXT2; + if (render) + this->current_osd_text = OSD_TEXT2; i=i+3; break; - } else if (!strncmp("", text+i, 3)) { + } else if (!strncmp("", text+i, 4)) { /* disable BOLD */ - this->current_osd_text = OSD_TEXT1; + if (render) + this->current_osd_text = OSD_TEXT1; i=i+4; break; } else if (!strncmp("", text+i, 3)) { /* enable italics color */ - this->current_osd_text = OSD_TEXT3; + if (render) + this->current_osd_text = OSD_TEXT3; i=i+3; break; - } else if (!strncmp("", text+i, 3)) { + } else if (!strncmp("", text+i, 4)) { /* disable italics */ - this->current_osd_text = OSD_TEXT1; + if (render) + this->current_osd_text = OSD_TEXT1; i=i+4; break; - } else if (!strncmp("", text+i, 3)) { + } else if (!strncmp("", text+i, 6)) { /*Do somethink to disable typing fixme - no teststreams*/ i=i+6; break; - } else if (!strncmp("", text+i, 3)) { + } else if (!strncmp("", text+i, 7)) { /*Do somethink to enable typing fixme - no teststreams*/ i=i+7; break; } default: - if ( isutf8 ) - shift = parse_utf8_size(&text[i]); - else - shift = 1; + shift = isutf8 ? parse_utf8_size (&text[i]) : 1; memcpy(letter,&text[i],shift); letter[shift]=0; - this->renderer->render_text(this->osd, x, y, letter, this->current_osd_text); + if (render) + this->renderer->render_text(this->osd, x, y, letter, this->current_osd_text); this->renderer->get_text_size(this->osd, letter, &w, &dummy); x=x+w; i+=shift; } } + return x; +} + +static inline int ogm_get_width(sputext_decoder_t *this, char* text) { + return ogm_render_line_internal (this, 0, 0, text, 0); +} + +static inline void ogm_render_line(sputext_decoder_t *this, int x, int y, char* text) { + ogm_render_line_internal (this, x, y, text, 1); } static void draw_subtitle(sputext_decoder_t *this, int64_t sub_start, int64_t sub_end ) { -- cgit v1.2.3 From eb48b09c6b86980ddc72b98dece6ae68e49ecc06 Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Sun, 19 Aug 2007 16:17:22 +0100 Subject: Changelog update for Chistophe Thommeret's recent changes. --- ChangeLog | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ChangeLog b/ChangeLog index 547dce588..b2d8f1f31 100644 --- a/ChangeLog +++ b/ChangeLog @@ -17,6 +17,8 @@ xine-lib (1.1.8) (Unreleased) * Allow the DVB input plugin to timeout if it is receiving no signal. * Fix an audio resampling problem which was causing regular clicking. * Fix build with recent glibc and a debugging #define. [Bug 1773769] + * Fix handling of multiple MPEG TS audio streams & subtitle languages. + * Add colouring for bold & italic in text subtitles. xine-lib (1.1.7) * Support libdca (new name for libdts) by shuffling around the dts.h file. -- cgit v1.2.3 From daf3bd7edff3f513f821391b2e833fdd67aac1b2 Mon Sep 17 00:00:00 2001 From: Christophe Thommeret Date: Mon, 20 Aug 2007 14:40:05 +0100 Subject: spudvb bitmaps downscale xine_spudvb_decoder.c has hardcoded frame size (720x576). While this is fine for most dvb channels, some channels have smaller frame size (e.g. 544x576) but the dvb subs bitmaps are however still 720 width. In such case, some right aligned subs appear truncated. This patch adds a (very basic) function to downscale subs to fit frame width. --- src/libspudvb/xine_spudvb_decoder.c | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/src/libspudvb/xine_spudvb_decoder.c b/src/libspudvb/xine_spudvb_decoder.c index 339d66b2e..befdf7ac7 100644 --- a/src/libspudvb/xine_spudvb_decoder.c +++ b/src/libspudvb/xine_spudvb_decoder.c @@ -121,6 +121,7 @@ void process_CLUT_definition_segment (dvb_spu_decoder_t * this); void process_object_data_segment (dvb_spu_decoder_t * this); void draw_subtitles (dvb_spu_decoder_t * this); static void spudec_dispose (spu_decoder_t * this_gen); +void downscale_region_image( region_t *reg, unsigned char *dest, int dest_width ); void create_region (dvb_spu_decoder_t * this, int region_id, int region_width, int region_height, int region_depth) { @@ -595,11 +596,31 @@ static void* dvbsub_timer_func(void *this_gen) return NULL; } +void downscale_region_image( region_t *reg, unsigned char *dest, int dest_width ) +{ + float i, k, inc=reg->width/(float)dest_width; + int j; + for ( j=0; jheight; j++ ) { + for ( i=0,k=0; iwidth && kimg[(j*reg->width)+(int)i]; + } + } +} + void draw_subtitles (dvb_spu_decoder_t * this) { int r; int x, y, out_y; int display=0; + int64_t dum; + int dest_width=0, dest_height, reg_width; + this->stream->video_out->status(this->stream->video_out, NULL, &dest_width, &dest_height, &dum); + unsigned char tmp[dest_width*576]; + unsigned char *reg; + + if ( !dest_width ) + return; + /* clear it */ memset (this->bitmap, 0, 720 * 576); /* render all regions onto the page */ @@ -608,11 +629,20 @@ void draw_subtitles (dvb_spu_decoder_t * this) for (r = 0; r < MAX_REGIONS; r++) { if (this->dvbsub->regions[r].win >= 0) { if (this->dvbsub->page.regions[r].is_visible) { + if (this->dvbsub->regions[r].width>dest_width) { + downscale_region_image(&this->dvbsub->regions[r], tmp, dest_width); + reg = tmp; + reg_width = dest_width; + } + else { + reg = this->dvbsub->regions[r].img; + reg_width = this->dvbsub->regions[r].width; + } out_y = this->dvbsub->page.regions[r].y * 720; for (y = 0; y < this->dvbsub->regions[r].height; y++) { - for (x = 0; x < this->dvbsub->regions[r].width; x++) { - this->bitmap[out_y + x + this->dvbsub->page.regions[r].x] = this->dvbsub->regions[r].img[(y * this->dvbsub->regions[r].width) + x]; + for (x = 0; x < reg_width; x++) { + this->bitmap[out_y + x + this->dvbsub->page.regions[r].x] = reg[(y*reg_width) + x]; if (this->bitmap[out_y + x + this->dvbsub->page.regions[r].x]) { display=1; -- cgit v1.2.3 From dd015b7aa558a0b6b203fc4233ab7468a54adf38 Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Mon, 20 Aug 2007 21:27:10 +0100 Subject: Changelog update for Christophe Thommeret's recent changes. (Again.) --- ChangeLog | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ChangeLog b/ChangeLog index b2d8f1f31..ecb242749 100644 --- a/ChangeLog +++ b/ChangeLog @@ -19,6 +19,8 @@ xine-lib (1.1.8) (Unreleased) * Fix build with recent glibc and a debugging #define. [Bug 1773769] * Fix handling of multiple MPEG TS audio streams & subtitle languages. * Add colouring for bold & italic in text subtitles. + * Simple scaling of subtitles to fit the frame width (intended to cope + with common DVB resolutions such as 544x576). xine-lib (1.1.7) * Support libdca (new name for libdts) by shuffling around the dts.h file. -- cgit v1.2.3 From 693223d03aa138903a6aadc8fe546972b0fa5227 Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Mon, 20 Aug 2007 21:46:34 +0100 Subject: Fix documentation for vcdo MRLs. --- doc/man/en/xine.5 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/man/en/xine.5 b/doc/man/en/xine.5 index 3457af8a5..925c394f9 100644 --- a/doc/man/en/xine.5 +++ b/doc/man/en/xine.5 @@ -38,7 +38,7 @@ to read from. Valid MRLs may be plain file names or one of the following .br .BI vcd://[|][@[letter]] .br -.BI vcdo://... +.BI vcdo:// .br .BI cdda:/[][/] .LP -- cgit v1.2.3 From b7fd78c6a875b25cf273f0a25ad410f5d997a3bf Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Mon, 20 Aug 2007 22:25:44 +0100 Subject: Handle % escaping and variable numbers of /s in VCD MRLs. --- ChangeLog | 2 +- src/input/vcd/xineplug_inp_vcd.c | 27 ++++++++++++++++++--------- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index ecb242749..9df073f17 100644 --- a/ChangeLog +++ b/ChangeLog @@ -11,7 +11,7 @@ xine-lib (1.1.8) (Unreleased) * Various build fixes and cleanups for Solaris, plugin dependencies etc. * Fix some memory leaks in the Vorbis decoder and video overlays. * Fix a problem with the goom plugin which could cause it to stop working. - * Clean up "%" unescaping in MRLs; correctly handle "%" in DVD MRLs. + * Clean up "%" unescaping in MRLs; correctly handle "%" in DVD and VCD MRLs. * Fix a crash with "dvb:/". * DVB subtitle fixes: deadlock prevention, thread leakage, spec compliance. * Allow the DVB input plugin to timeout if it is receiving no signal. diff --git a/src/input/vcd/xineplug_inp_vcd.c b/src/input/vcd/xineplug_inp_vcd.c index 9eb9ac996..795a2480d 100644 --- a/src/input/vcd/xineplug_inp_vcd.c +++ b/src/input/vcd/xineplug_inp_vcd.c @@ -502,14 +502,16 @@ vcd_parse_mrl(/*in*/ const char *default_vcd_device, /*in*/ char *mrl, itemid->type = (vcdinfo_item_enum_t) auto_type; *used_default = false; - if ( NULL != mrl && !strncasecmp(mrl, MRL_PREFIX, MRL_PREFIX_LEN) ) - p = &mrl[MRL_PREFIX_LEN]; - else { + if ( NULL == mrl || strncasecmp(mrl, MRL_PREFIX, MRL_PREFIX_LEN) ) return false; - } - - count = sscanf (p, "%1024[^@]@%1[EePpSsTt]%u", - device_str, type_str, &num); + p = &mrl[MRL_PREFIX_LEN - 2]; + while (*p == '/') + ++p; + + device_str[0] = '/'; + device_str[1] = 0; + count = sscanf (p, "%1023[^@]@%1[EePpSsTt]%u", + device_str + 1, type_str, &num); itemid->num = num; switch (count) { @@ -522,11 +524,18 @@ vcd_parse_mrl(/*in*/ const char *default_vcd_device, /*in*/ char *mrl, itemid->num = num; if (1==count) { type_str[0] = 'T'; + if (default_vcd_device) + strncpy(device_str, default_vcd_device, MAX_DEVICE_LEN); + else + *device_str = 0; } - + else + _x_mrl_unescape (device_str); break; } - + case 2 ... 9: + _x_mrl_unescape (device_str); + case 0: case EOF: { -- cgit v1.2.3 From cbd017c8bc0139311d149c58fabba4e783dd95a9 Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Mon, 20 Aug 2007 22:27:56 +0100 Subject: Minor man page cleanup. --- doc/man/en/xine.5 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/man/en/xine.5 b/doc/man/en/xine.5 index 925c394f9..4726f1105 100644 --- a/doc/man/en/xine.5 +++ b/doc/man/en/xine.5 @@ -109,11 +109,11 @@ work.) After the optional device name or file name, you can name the kind of unit, preceded by a colon. An MRL which ends in a colon is like not adding it at all: the default entry type and number is used. Items come in 4 flavours: -\fB"Track"\fP, \fB"Entry"\fP, \fB"Playback"\fP and \fB"Segment"\fP. These +"\fBTrack\fP", "\fBEntry\fP", "\fBPlayback\fP" and "\fBSegment\fP". These units are indicated with the capital first letter of each type: \fBT\fP, \fBE\fP, \fBP\fP, \fBS\fP, \fBs\fP. An uppercase \fBS\fP in the MRL display -indicates a NTS segment while a lowercase \fBS\fP indicates a PAL segment. -However when you enter an MRL, the case of these letters is insignificant. +indicates a NTSC segment while a lowercase \fBs\fP indicates a PAL segment. +However, when you enter an MRL, the case of these letters is insignificant. Depending on the Video CD, you might not have any playable segments (\fBS\fP,\fBs\fP) or playback control (\fBP\fP). If you give a MRL that -- cgit v1.2.3