summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--doc/man/en/xine.58
-rw-r--r--include/xine.h.in3
-rw-r--r--src/demuxers/demux_ts.c70
-rw-r--r--src/input/vcd/xineplug_inp_vcd.c27
-rw-r--r--src/libspudvb/xine_spudvb_decoder.c34
-rw-r--r--src/libsputext/xine_sputext_decoder.c201
-rw-r--r--src/xine-engine/audio_decoder.c5
-rw-r--r--src/xine-engine/configfile.c6
9 files changed, 194 insertions, 166 deletions
diff --git a/ChangeLog b/ChangeLog
index b300e5de5..892154b51 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -51,12 +51,16 @@ 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.
* 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.
+ * 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.
diff --git a/doc/man/en/xine.5 b/doc/man/en/xine.5
index acf1b5109..3a67589dd 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://[<CD_image>|<device_name>][@[letter]<number>]
.br
-.BI vcdo://...
+.BI vcdo://<track_number>
.br
.BI cdda:/[<device>][/<track-number>]
.LP
@@ -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
diff --git a/include/xine.h.in b/include/xine.h.in
index 04f35f680..948582792 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/demuxers/demux_ts.c b/src/demuxers/demux_ts.c
index 07f466adb..4fdd858c1 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
@@ -1922,6 +1932,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;
@@ -1997,6 +2008,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);
@@ -2102,31 +2114,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 && channel<this->spu_langs_count) {
+ memcpy(str, this->spu_langs[channel].desc.lang, 3);
+ str[3] = 0;}
+ else
+ strcpy(str, "none");
return DEMUX_OPTIONAL_SUCCESS;
default:
@@ -2251,6 +2253,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 */
@@ -2331,3 +2334,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 }
};
+
diff --git a/src/input/vcd/xineplug_inp_vcd.c b/src/input/vcd/xineplug_inp_vcd.c
index f70d2fcd9..e41eb33d9 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:
{
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; j<reg->height; j++ ) {
+ for ( i=0,k=0; i<reg->width && k<dest_width; i+=inc,k++ ) {
+ dest[(j*dest_width)+(int)k] = reg->img[(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;
diff --git a/src/libsputext/xine_sputext_decoder.c b/src/libsputext/xine_sputext_decoder.c
index d4dd103ec..ea3a69189 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 */
@@ -235,115 +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("<b>", text+i, 3)) {
- /*Do somethink to enable BOLD typeface*/
- i=i+3;
- break;
- } else if (!strncmp("</b>", text+i, 3)) {
- /*Do somethink to disable BOLD typeface*/
- i=i+4;
- break;
- } else if (!strncmp("<i>", text+i, 3)) {
- /*Do somethink to enable italics typeface*/
- i=i+3;
- break;
- } else if (!strncmp("</i>", text+i, 3)) {
- /*Do somethink to disable italics typeface*/
- i=i+4;
- break;
- } else if (!strncmp("<font>", text+i, 3)) {
- /*Do somethink to disable typing
- fixme - no teststreams*/
- i=i+6;
- break;
- } else if (!strncmp("</font>", 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("<b>", text+i, 3)) {
- /*Do somethink to enable BOLD typeface*/
+ /* enable Bold color */
+ if (render)
+ this->current_osd_text = OSD_TEXT2;
i=i+3;
break;
- } else if (!strncmp("</b>", text+i, 3)) {
- /*Do somethink to disable BOLD typeface*/
+ } else if (!strncmp("</b>", text+i, 4)) {
+ /* disable BOLD */
+ if (render)
+ this->current_osd_text = OSD_TEXT1;
i=i+4;
break;
} else if (!strncmp("<i>", text+i, 3)) {
- /*Do somethink to enable italics typeface*/
+ /* enable italics color */
+ if (render)
+ this->current_osd_text = OSD_TEXT3;
i=i+3;
break;
- } else if (!strncmp("</i>", text+i, 3)) {
- /*Do somethink to disable italics typeface*/
+ } else if (!strncmp("</i>", text+i, 4)) {
+ /* disable italics */
+ if (render)
+ this->current_osd_text = OSD_TEXT1;
i=i+4;
break;
- } else if (!strncmp("<font>", text+i, 3)) {
+ } else if (!strncmp("<font>", text+i, 6)) {
/*Do somethink to disable typing
fixme - no teststreams*/
i=i+6;
break;
- } else if (!strncmp("</font>", text+i, 3)) {
+ } else if (!strncmp("</font>", 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, OSD_TEXT1);
+ 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 ) {
@@ -373,11 +368,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 +403,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;a<this->lines;a++) {
if(a) {
@@ -421,10 +413,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 +450,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 +485,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;a<this->lines;a++) {
if(a) {
@@ -509,10 +495,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 +531,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 +545,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 +557,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 +605,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;
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 ( (i<stream->audio_track_map_entries) && (stream->audio_track_map[i]<buf->type) )
+ while ( (i<stream->audio_track_map_entries) && ((stream->audio_track_map[i]&0x0000FFFF)<chan) )
i++;
if ( (i==stream->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;
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;
}