summaryrefslogtreecommitdiff
path: root/src/spu_dec
diff options
context:
space:
mode:
Diffstat (limited to 'src/spu_dec')
-rw-r--r--src/spu_dec/cc_decoder.c92
-rw-r--r--src/spu_dec/cc_decoder.h12
-rw-r--r--src/spu_dec/cmml_decoder.c50
-rw-r--r--src/spu_dec/spu_decoder.c44
-rw-r--r--src/spu_dec/spudec.c136
-rw-r--r--src/spu_dec/spudec.h12
-rw-r--r--src/spu_dec/spudvb_decoder.c122
-rw-r--r--src/spu_dec/sputext_decoder.c190
-rw-r--r--src/spu_dec/sputext_demuxer.c278
-rw-r--r--src/spu_dec/xine_cc_decoder.c50
10 files changed, 493 insertions, 493 deletions
diff --git a/src/spu_dec/cc_decoder.c b/src/spu_dec/cc_decoder.c
index 71e2578db..d60d2cf03 100644
--- a/src/spu_dec/cc_decoder.c
+++ b/src/spu_dec/cc_decoder.c
@@ -1,21 +1,21 @@
/*
* Copyright (C) 2000-2003 the xine project
- *
- * Copyright (C) Christian Vogler
+ *
+ * Copyright (C) Christian Vogler
* cvogler@gradient.cis.upenn.edu - December 2001
*
* This file is part of xine, a free video player.
- *
+ *
* xine is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* xine is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
@@ -83,7 +83,7 @@ static const int text_colormap[NUM_FG_COL] = {
/* FIXME: The colors look fine on an XShm display, but they look *terrible*
with the Xv display on the NVidia driver on a GeForce 3. The colors bleed
into each other more than I'd expect from the downsampling into YUV
- colorspace.
+ colorspace.
At this moment, it looks like a problem in the Xv YUV blending functions.
*/
typedef struct colorinfo_s {
@@ -217,14 +217,14 @@ static const uint8_t *const cc_alpha_palettes[NUM_CC_PALETTES] = {
/* --------------------- misc. EIA 608 definitions -------------------*/
-#define TRANSP_SPACE 0x19 /* code for transparent space, essentially
+#define TRANSP_SPACE 0x19 /* code for transparent space, essentially
arbitrary */
/* mapping from PAC row code to actual CC row */
static const int rowdata[] = {10, -1, 0, 1, 2, 3, 11, 12, 13, 14, 4, 5, 6,
7, 8, 9};
/* FIXME: do real ™ (U+2122) */
-/* Code 182 must be mapped as a musical note ('♪', U+266A) in the caption font */
+/* Code 182 must be mapped as a musical note ('♪', U+266A) in the caption font */
static const char specialchar[] = {
174 /* ® */, 176 /* ° */, 189 /* ½ */, 191 /* ¿ */,
'T' /* ™ */, 162 /* ¢ */, 163 /* £ */, 182 /* ¶ => ♪ */,
@@ -257,7 +257,7 @@ static const char specialchar[] = {
* chartbl[0x7e] = 241; // ñ
* chartbl[0x7f] = 164; // ¤ FIXME: should be a solid block ('█'; U+2588)
* }
- *
+ *
*/
static const int chartbl[128] = {
'\x00', '\x01', '\x02', '\x03', '\x04', '\x05', '\x06', '\x07',
@@ -290,12 +290,12 @@ static const int chartbl[128] = {
* {
* int i;
* int ones = 0;
- *
+ *
* for (i = 0; i < 7; i++) {
* if (byte & (1 << i))
* ones++;
* }
- *
+ *
* return ones & 1;
* }
*
@@ -361,11 +361,11 @@ struct cc_renderer_s {
If this happens, the vpts of a hide caption event can actually be
slightly higher than the vpts of the following show caption event.
For this reason, we remember the vpts of the hide event and force
- the next show event's vpts to be at least equal to the hide event's
+ the next show event's vpts to be at least equal to the hide event's
vpts.
*/
int64_t last_hide_vpts;
-
+
/* caption palette and alpha channel */
uint32_t cc_palette[OVL_PALETTE_SIZE];
uint8_t cc_trans[OVL_PALETTE_SIZE];
@@ -451,7 +451,7 @@ struct cc_decoder_s {
/*---------------- general utility functions ---------------------*/
-static void get_font_metrics(osd_renderer_t *renderer,
+static void get_font_metrics(osd_renderer_t *renderer,
const char *fontname, int font_size,
int *maxw, int *maxh)
{
@@ -572,8 +572,8 @@ static void ccrow_set_attributes(cc_renderer_t *renderer, cc_row_t *this,
fontname = cap_info->italic_font;
else
fontname = cap_info->font;
- renderer->osd_renderer->set_font(renderer->cap_display, (char *) fontname,
- cap_info->font_size);
+ renderer->osd_renderer->set_font(renderer->cap_display, (char *) fontname,
+ cap_info->font_size);
}
@@ -652,7 +652,7 @@ static void ccrow_render(cc_renderer_t *renderer, cc_row_t *this, int rownum)
x = renderer->width * pos / CC_COLUMNS;
y = base_y;
}
-
+
#ifdef LOG_DEBUG
printf("text_w, text_h = %d, %d\n", text_w, text_h);
printf("cc from %d to %d; text plotting from %d, %d (basey = %d)\n", pos, endpos, x, y, base_y);
@@ -663,7 +663,7 @@ static void ccrow_render(cc_renderer_t *renderer, cc_row_t *this, int rownum)
int textcol = text_colormap[this->cells[seg_attr[seg]].attributes.foreground];
int box_x1 = x + cumulative_seg_width[seg];
int box_x2 = x + cumulative_seg_width[seg + 1];
-
+
#ifdef LOG_DEBUG
printf("ccrow_render: rendering segment %d from %d to %d / %d to %d\n",
seg, seg_pos[seg], seg_pos[seg + 1],
@@ -688,7 +688,7 @@ static void ccrow_render(cc_renderer_t *renderer, cc_row_t *this, int rownum)
/* text is already mapped from EIA-608 into iso-8859-1 */
osd_renderer->render_text(renderer->cap_display,
- x + cumulative_seg_width[seg], y, buf,
+ x + cumulative_seg_width[seg], y, buf,
textcol);
}
@@ -753,7 +753,7 @@ static void ccbuf_add_char(cc_buffer_t *this, uint8_t c)
}
-static void ccbuf_set_cursor(cc_buffer_t *this, int row, int column,
+static void ccbuf_set_cursor(cc_buffer_t *this, int row, int column,
int underline, int italics, int color)
{
cc_row_t *rowbuf = &this->rows[row];
@@ -767,7 +767,7 @@ static void ccbuf_set_cursor(cc_buffer_t *this, int row, int column,
rowbuf->pac_attr = attr;
rowbuf->pac_attr_chg = 1;
- this->rowpos = row;
+ this->rowpos = row;
rowbuf->pos = column;
rowbuf->attr_chg = 0;
}
@@ -777,7 +777,7 @@ static void ccbuf_apply_attribute(cc_buffer_t *this, cc_attribute_t *attr)
{
cc_row_t *rowbuf = &this->rows[this->rowpos];
int pos = rowbuf->pos;
-
+
rowbuf->attr_chg = 1;
rowbuf->cells[pos].attributes = *attr;
/* A midrow attribute always counts as a space */
@@ -845,7 +845,7 @@ static void cc_renderer_build_palette(cc_renderer_t *this)
int i, j;
const colorinfo_t *cc_text = cc_text_palettes[this->cc_state->cc_cfg->cc_scheme];
const uint8_t *cc_alpha = cc_alpha_palettes[this->cc_state->cc_cfg->cc_scheme];
-
+
memset(this->cc_palette, 0, sizeof (this->cc_palette));
memset(this->cc_trans, 0, sizeof (this->cc_trans));
for (i = 0; i < NUM_FG_COL; i++) {
@@ -920,12 +920,12 @@ static void cc_renderer_show_caption(cc_renderer_t *this, cc_buffer_t *buf,
this->osd_renderer->clear(this->cap_display);
ccbuf_render(this, buf);
- this->osd_renderer->set_position(this->cap_display,
+ this->osd_renderer->set_position(this->cap_display,
this->x,
this->y);
vpts = MAX(vpts, this->last_hide_vpts);
this->osd_renderer->show(this->cap_display, vpts);
-
+
this->displayed = 1;
this->display_vpts = vpts;
}
@@ -973,7 +973,7 @@ cc_renderer_t *cc_renderer_open(osd_renderer_t *osd_renderer,
cc_renderer_update_cfg(this, video_width, video_height);
#ifdef LOG_DEBUG
printf("spucc: cc_renderer: open\n");
-#endif
+#endif
return this;
}
@@ -985,7 +985,7 @@ void cc_renderer_close(cc_renderer_t *this_obj)
#ifdef LOG_DEBUG
printf("spucc: cc_renderer: close\n");
-#endif
+#endif
}
@@ -1020,7 +1020,7 @@ void cc_renderer_update_cfg(cc_renderer_t *this_obj, int video_width,
#ifdef LOG_DEBUG
printf("spucc: cc_renderer: update config: max text extents: %d, %d\n",
this_obj->max_char_width, this_obj->max_char_height);
-#endif
+#endif
/* need to adjust captioning area to accommodate font? */
required_w = CC_COLUMNS * (this_obj->max_char_width + 1);
@@ -1042,7 +1042,7 @@ void cc_renderer_update_cfg(cc_renderer_t *this_obj, int video_width,
this_obj->y = (this_obj->video_height - required_h) / 2;
}
- if (required_w <= this_obj->video_width &&
+ if (required_w <= this_obj->video_width &&
required_h <= this_obj->video_height) {
this_obj->cc_state->can_cc = 1;
cc_renderer_adjust_osd_object(this_obj);
@@ -1053,7 +1053,7 @@ void cc_renderer_update_cfg(cc_renderer_t *this_obj, int video_width,
printf("spucc: required captioning area %dx%d exceeds screen %dx%d!\n"
" Captions disabled. Perhaps you should choose a smaller"
" font?\n",
- required_w, required_h, this_obj->video_width,
+ required_w, required_h, this_obj->video_width,
this_obj->video_height);
}
}
@@ -1091,10 +1091,10 @@ static void cc_hide_displayed(cc_decoder_t *this)
if (cc_renderer_on_display(this->cc_state->renderer)) {
int64_t vpts = cc_renderer_calc_vpts(this->cc_state->renderer, this->pts,
- this->f_offset);
+ this->f_offset);
#ifdef LOG_DEBUG
printf("cc_decoder: cc_hide_displayed: hiding caption %u at vpts %u\n", this->capid, vpts);
-#endif
+#endif
cc_renderer_hide_caption(this->cc_state->renderer, vpts);
}
}
@@ -1111,7 +1111,7 @@ static void cc_show_displayed(cc_decoder_t *this)
this->f_offset);
#ifdef LOG_DEBUG
printf("cc_decoder: cc_show_displayed: showing caption %u at vpts %u\n", this->capid, vpts);
-#endif
+#endif
this->capid++;
cc_renderer_show_caption(this->cc_state->renderer,
&this->on_buf->channel[this->on_buf->channel_no],
@@ -1334,7 +1334,7 @@ static void cc_decode_EIA608(cc_decoder_t *this, uint16_t data)
}
else {
switch (c1) {
-
+
case 0x10: /* extended background attribute code */
cc_decode_ext_attribute(this, channel, c1, c2);
break;
@@ -1362,7 +1362,7 @@ static void cc_decode_EIA608(cc_decoder_t *this, uint16_t data)
}
}
}
-
+
this->lastcode = data;
}
@@ -1388,13 +1388,13 @@ void decode_cc(cc_decoder_t *this, uint8_t *buffer, uint32_t buf_len,
* 0x00 is padding, followed by 2 more 0x00.
*
* 0x01 always seems to appear at the beginning, always seems to
- * be followed by 0xf8, 8-bit number.
+ * be followed by 0xf8, 8-bit number.
* The lower 7 bits of this 8-bit number seem to denote the
* number of code triplets that follow.
- * The most significant bit denotes whether the Line 21 field 1
+ * The most significant bit denotes whether the Line 21 field 1
* captioning information is at odd or even triplet offsets from this
* beginning triplet. 1 denotes odd offsets, 0 denotes even offsets.
- *
+ *
* Most captions are encoded with odd offsets, so this is what we
* will assume.
*
@@ -1419,31 +1419,31 @@ void decode_cc(cc_decoder_t *this, uint8_t *buffer, uint32_t buf_len,
}
printf("\n");
}
-#endif
+#endif
while (curbytes < buf_len) {
int skip = 2;
cc_code = *current++;
curbytes++;
-
+
if (buf_len - curbytes < 2) {
#ifdef LOG_DEBUG
fprintf(stderr, "Not enough data for 2-byte CC encoding\n");
#endif
break;
}
-
+
data1 = *current;
data2 = *(current + 1);
-
+
switch (cc_code) {
case 0xfe:
/* expect 2 byte encoding (perhaps CC3, CC4?) */
/* ignore for time being */
skip = 2;
break;
-
+
case 0xff:
/* expect EIA-608 CC1/CC2 encoding */
if (good_parity(data1 | (data2 << 8))) {
@@ -1452,12 +1452,12 @@ void decode_cc(cc_decoder_t *this, uint8_t *buffer, uint32_t buf_len,
}
skip = 5;
break;
-
+
case 0x00:
/* This seems to be just padding */
skip = 2;
break;
-
+
case 0x01:
odd_offset = data2 & 0x80;
if (odd_offset)
@@ -1465,7 +1465,7 @@ void decode_cc(cc_decoder_t *this, uint8_t *buffer, uint32_t buf_len,
else
skip = 5;
break;
-
+
default:
#ifdef LOG_DEBUG
fprintf(stderr, "Unknown CC encoding: %x\n", cc_code);
diff --git a/src/spu_dec/cc_decoder.h b/src/spu_dec/cc_decoder.h
index 97aa037ae..58bd5aa9a 100644
--- a/src/spu_dec/cc_decoder.h
+++ b/src/spu_dec/cc_decoder.h
@@ -1,21 +1,21 @@
/*
* Copyright (C) 2000-2008 the xine project
- *
- * Copyright (C) Christian Vogler
+ *
+ * Copyright (C) Christian Vogler
* cvogler@gradient.cis.upenn.edu - December 2001
*
* This file is part of xine, a free video player.
- *
+ *
* xine is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* xine is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
@@ -41,7 +41,7 @@ typedef struct cc_config_s {
int center; /* true if captions should be centered */
/* according to text width */
int cc_scheme; /* which captioning scheme to use */
-
+
int config_version; /* the decoder should be updated when this is increased */
} cc_config_t;
diff --git a/src/spu_dec/cmml_decoder.c b/src/spu_dec/cmml_decoder.c
index 02ef18540..912e1aed3 100644
--- a/src/spu_dec/cmml_decoder.c
+++ b/src/spu_dec/cmml_decoder.c
@@ -1,18 +1,18 @@
/*
* Copyright (C) 2000-2008 the xine project
- *
+ *
* This file is part of xine, a free video player.
- *
+ *
* xine is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* xine is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
@@ -104,11 +104,11 @@ static void update_font_size (spucmml_decoder_t *this) {
this->font_size = vec[1];
else
this->font_size = vec[0];
-
+
this->line_height = this->font_size + 10;
int y = this->cached_height - (SUB_MAX_TEXT * this->line_height) - 5;
-
+
if(((y - this->vertical_offset) >= 0) && ((y - this->vertical_offset) <= this->cached_height))
y -= this->vertical_offset;
@@ -124,7 +124,7 @@ static void update_font_size (spucmml_decoder_t *this) {
this->cached_width,
SUB_MAX_TEXT * this->line_height);
- this->osd = this->stream->osd_renderer->new_object (this->stream->osd_renderer,
+ this->osd = this->stream->osd_renderer->new_object (this->stream->osd_renderer,
this->cached_width, SUB_MAX_TEXT * this->line_height);
llprintf (LOG_OSD, "post new_object: osd is %p\n", this->osd);
@@ -137,7 +137,7 @@ static void update_font_size (spucmml_decoder_t *this) {
static int get_width(spucmml_decoder_t *this, char* text) {
int width=0;
-
+
while (1)
switch (*text) {
case '\0':
@@ -153,7 +153,7 @@ static int get_width(spucmml_decoder_t *this, char* text) {
/*Do somethink to disable BOLD typeface*/
text += 4;
break;
- } else if (!strncmp("<i>", text, 3)) {
+ } else if (!strncmp("<i>", text, 3)) {
/*Do somethink to enable italics typeface*/
text += 3;
break;
@@ -161,7 +161,7 @@ static int get_width(spucmml_decoder_t *this, char* text) {
/*Do somethink to disable italics typeface*/
text += 4;
break;
- } else if (!strncmp("<font>", text, 3)) {
+ } else if (!strncmp("<font>", text, 3)) {
/*Do somethink to disable typing
fixme - no teststreams*/
text += 6;
@@ -171,7 +171,7 @@ static int get_width(spucmml_decoder_t *this, char* text) {
fixme - no teststreams*/
text += 7;
break;
- }
+ }
default:
{
int w, dummy;
@@ -224,11 +224,11 @@ static void draw_subtitle(spucmml_decoder_t *this, int64_t sub_start) {
if( font_size != this->font_size )
this->stream->osd_renderer->set_font (this->osd, this->font, this->font_size);
-
+
this->stream->osd_renderer->set_text_palette (this->osd, -1, OSD_TEXT1);
this->stream->osd_renderer->show (this->osd, sub_start);
-
+
llprintf (LOG_SCHEDULING,
"spucmml: scheduling subtitle >%s< at %"PRId64", current time is %"PRId64"\n",
this->text[0], sub_start,
@@ -399,7 +399,7 @@ static void video_frame_format_change_callback (void *user_data, const xine_even
static void spudec_reset (spu_decoder_t *this_gen) {
spucmml_decoder_t *this = (spucmml_decoder_t *) this_gen;
-
+
this->cached_width = this->cached_height = 0;
}
@@ -461,16 +461,16 @@ static spu_decoder_t *spucmml_class_open_plugin (spu_decoder_class_t *class_gen,
this->font_size = 24;
this->subtitle_size = 1;
- this->font = class->xine->config->register_string(class->xine->config,
- "subtitles.separate.font",
- "sans",
- _("font for external subtitles"),
+ this->font = class->xine->config->register_string(class->xine->config,
+ "subtitles.separate.font",
+ "sans",
+ _("font for external subtitles"),
NULL, 0, update_osd_font, this);
this->vertical_offset = class->xine->config->register_num(class->xine->config,
- "subtitles.separate.vertical_offset",
+ "subtitles.separate.vertical_offset",
0,
- _("subtitle vertical offset (relative window size)"),
+ _("subtitle vertical offset (relative window size)"),
NULL, 0, update_vertical_offset, this);
this->current_anchor.href = NULL;
@@ -498,10 +498,10 @@ static void *init_spu_decoder_plugin (xine_t *xine, void *data) {
this->xine = xine;
- this->src_encoding = xine->config->register_string(xine->config,
- "subtitles.separate.src_encoding",
- "iso-8859-1",
- _("encoding of subtitles"),
+ this->src_encoding = xine->config->register_string(xine->config,
+ "subtitles.separate.src_encoding",
+ "iso-8859-1",
+ _("encoding of subtitles"),
NULL, 10, update_src_encoding, this);
return &this->class;
@@ -517,7 +517,7 @@ static const decoder_info_t spudec_info = {
};
const plugin_info_t xine_plugin_info[] EXPORTED = {
- /* type, API, "name", version, special_info, init_function */
+ /* type, API, "name", version, special_info, init_function */
{ PLUGIN_SPU_DECODER, 17, "spucmml", XINE_VERSION_CODE, &spudec_info, &init_spu_decoder_plugin },
{ PLUGIN_NONE, 0, "", 0, NULL, NULL }
};
diff --git a/src/spu_dec/spu_decoder.c b/src/spu_dec/spu_decoder.c
index 0234c8d23..0b39243ae 100644
--- a/src/spu_dec/spu_decoder.c
+++ b/src/spu_dec/spu_decoder.c
@@ -1,20 +1,20 @@
/*
* Copyright (C) 2000-2008 the xine project
- *
+ *
* Copyright (C) James Courtier-Dutton James@superbug.demon.co.uk - July 2001
*
* This file is part of xine, a unix video player.
- *
+ *
* xine is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* xine is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
@@ -86,7 +86,7 @@ static void spudec_decode_data (spu_decoder_t *this_gen, buf_element_t *buf) {
pthread_mutex_unlock(&this->nav_pci_lock);
if ( (buf->type & 0xffff0000) != BUF_SPU_DVD ||
- !(buf->decoder_flags & BUF_FLAG_SPECIAL) ||
+ !(buf->decoder_flags & BUF_FLAG_SPECIAL) ||
buf->decoder_info[1] != BUF_SPECIAL_SPU_DVD_SUBTYPE )
return;
@@ -105,7 +105,7 @@ static void spudec_decode_data (spu_decoder_t *this_gen, buf_element_t *buf) {
this->state.need_clut = 0;
return;
}
-
+
if ( buf->decoder_info[2] == SPU_DVD_SUBTYPE_NAV ) {
#ifdef LOG_DEBUG
printf("libspudec:got nav packet 1\n");
@@ -113,11 +113,11 @@ static void spudec_decode_data (spu_decoder_t *this_gen, buf_element_t *buf) {
spudec_decode_nav(this,buf);
return;
}
-
+
if ( buf->decoder_info[2] == SPU_DVD_SUBTYPE_VOBSUB_PACKAGE ) {
this->state.vobsub = 1;
}
-
+
#ifdef LOG_DEBUG
printf("libspudec:got buffer type = %x\n", buf->type);
#endif
@@ -127,14 +127,14 @@ static void spudec_decode_data (spu_decoder_t *this_gen, buf_element_t *buf) {
if (buf->pts) {
metronom_t *metronom = this->stream->metronom;
int64_t vpts = metronom->got_spu_packet(metronom, buf->pts);
-
+
this->spudec_stream_state[stream_id].vpts = vpts; /* Show timer */
this->spudec_stream_state[stream_id].pts = buf->pts; /* Required to match up with NAV packets */
}
spudec_reassembly(this->stream->xine,
&this->spudec_stream_state[stream_id].ra_seq, buf->content, buf->size);
- if(this->spudec_stream_state[stream_id].ra_seq.complete == 1) {
+ if(this->spudec_stream_state[stream_id].ra_seq.complete == 1) {
if(this->spudec_stream_state[stream_id].ra_seq.broken) {
xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "libspudec: dropping broken SPU\n");
this->spudec_stream_state[stream_id].ra_seq.broken = 0;
@@ -147,12 +147,12 @@ static void spudec_reset (spu_decoder_t *this_gen) {
spudec_decoder_t *this = (spudec_decoder_t *) this_gen;
video_overlay_manager_t *ovl_manager = this->stream->video_out->get_overlay_manager (this->stream->video_out);
int i;
-
+
if( this->menu_handle >= 0 )
ovl_manager->free_handle(ovl_manager,
this->menu_handle);
this->menu_handle = -1;
-
+
for (i=0; i < MAX_STREAMS; i++) {
if( this->spudec_stream_state[i].overlay_handle >= 0 )
ovl_manager->free_handle(ovl_manager,
@@ -161,7 +161,7 @@ static void spudec_reset (spu_decoder_t *this_gen) {
this->spudec_stream_state[i].ra_seq.complete = 1;
this->spudec_stream_state[i].ra_seq.broken = 0;
}
-
+
pthread_mutex_lock(&this->nav_pci_lock);
spudec_clear_nav_list(this);
pthread_mutex_unlock(&this->nav_pci_lock);
@@ -169,7 +169,7 @@ static void spudec_reset (spu_decoder_t *this_gen) {
static void spudec_discontinuity (spu_decoder_t *this_gen) {
spudec_decoder_t *this = (spudec_decoder_t *) this_gen;
-
+
pthread_mutex_lock(&this->nav_pci_lock);
spudec_clear_nav_list(this);
pthread_mutex_unlock(&this->nav_pci_lock);
@@ -194,7 +194,7 @@ static void spudec_dispose (spu_decoder_t *this_gen) {
this->spudec_stream_state[i].overlay_handle = -1;
free (this->spudec_stream_state[i].ra_seq.buf);
}
-
+
spudec_clear_nav_list(this);
pthread_mutex_destroy(&this->nav_pci_lock);
@@ -209,9 +209,9 @@ static void spudec_dispose (spu_decoder_t *this_gen) {
static int spudec_get_interact_info (spu_decoder_t *this_gen, void *data) {
spudec_decoder_t *this = (spudec_decoder_t *) this_gen;
/*printf("get_interact_info() called\n");*/
- if (!this || !data)
+ if (!this || !data)
return 0;
-
+
/*printf("get_interact_info() coping nav_pci\n");*/
pthread_mutex_lock(&this->nav_pci_lock);
spudec_update_nav(this);
@@ -244,14 +244,14 @@ static void spudec_set_button (spu_decoder_t *this_gen, int32_t button, int32_t
printf ("libspudec:xine_decoder.c:spudec_event_listener:this->menu_handle=%d\n",this->menu_handle);
#endif
if(this->menu_handle < 0) {
- xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG,
+ xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG,
"Menu handle alloc failed. No more overlays objects available. Only %d at once please.",
MAX_OBJECTS);
free(overlay_event);
free(overlay);
return;
}
-
+
if (show > 0) {
#ifdef LOG_NAV
fprintf (stderr,"libspudec:xine_decoder.c:spudec_event_listener:buttonN = %u show=%d\n",
@@ -284,7 +284,7 @@ static void spudec_set_button (spu_decoder_t *this_gen, int32_t button, int32_t
this->buttonN, show-1, overlay, &this->overlay );
pthread_mutex_unlock(&this->nav_pci_lock);
} else {
- xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG,
+ xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG,
"libspudec:xine_decoder.c:spudec_event_listener:HIDE ????\n");
printf("We dropped out here for some reason");
_x_abort();
@@ -328,7 +328,7 @@ static spu_decoder_t *open_plugin (spu_decoder_class_t *class_gen, xine_stream_t
this->menu_handle = -1;
this->buttonN = 1;
this->event.object.overlay = calloc(1, sizeof(vo_overlay_t));
-
+
pthread_mutex_init(&this->nav_pci_lock, NULL);
this->pci_cur.pci.hli.hl_gi.hli_ss = 0;
this->pci_cur.next = NULL;
@@ -375,7 +375,7 @@ static const decoder_info_t dec_info_data = {
};
const plugin_info_t xine_plugin_info[] EXPORTED = {
- /* type, API, "name", version, special_info, init_function */
+ /* type, API, "name", version, special_info, init_function */
{ PLUGIN_SPU_DECODER, 17, "spudec", XINE_VERSION_CODE, &dec_info_data, &init_plugin },
{ PLUGIN_NONE, 0, "", 0, NULL, NULL }
};
diff --git a/src/spu_dec/spudec.c b/src/spu_dec/spudec.c
index 0e8621c54..8c5a2049d 100644
--- a/src/spu_dec/spudec.c
+++ b/src/spu_dec/spudec.c
@@ -17,13 +17,13 @@
* cleaner implementation of SPU are saving
* overlaying (proof of concept for now)
* ... and yes, it works now with oms
- * added tranparency (provided by the SPU hdr)
+ * added tranparency (provided by the SPU hdr)
* changed structures for easy porting to MGAs DVD mode
* This file is part of xine
* This file was originally part of the OMS program.
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
+ * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
@@ -89,7 +89,7 @@ void spudec_decode_nav(spudec_decoder_t *this, buf_element_t *buf) {
p = buf->content;
if (p[0] || p[1] || (p[2] != 1)) {
- xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG,
+ xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG,
"libspudec:spudec_decode_nav:nav demux error! %02x %02x %02x (should be 0x000001) \n",p[0],p[1],p[2]);
return;
}
@@ -126,7 +126,7 @@ void spudec_decode_nav(spudec_decoder_t *this, buf_element_t *buf) {
printf("btngr%d_dsp_ty 0x%02x\n", 1, pci.hli.hl_gi.btngr1_dsp_ty);
printf("btngr%d_dsp_ty 0x%02x\n", 2, pci.hli.hl_gi.btngr2_dsp_ty);
printf("btngr%d_dsp_ty 0x%02x\n", 3, pci.hli.hl_gi.btngr3_dsp_ty);
- //navPrint_PCI(&pci);
+ //navPrint_PCI(&pci);
//navPrint_PCI_GI(&pci.pci_gi);
//navPrint_NSML_AGLI(&pci.nsml_agli);
//navPrint_HLI(&pci.hli);
@@ -142,7 +142,7 @@ void spudec_decode_nav(spudec_decoder_t *this, buf_element_t *buf) {
packet_len = p[4] << 8 | p[5];
p += 6;
#ifdef LOG_NAV
- printf("NAV DSI packet\n");
+ printf("NAV DSI packet\n");
#endif
navRead_DSI(&dsi, p+1);
@@ -150,7 +150,7 @@ void spudec_decode_nav(spudec_decoder_t *this, buf_element_t *buf) {
// self->vobu_length = self->dsi.dsi_gi.vobu_ea;
}
}
-
+
/* NAV packets contain start and end presentation timestamps, which tell the
* application, when the highlight information in the NAV is supposed to be valid.
* We handle these timestamps only in a very stripped-down way: We keep a list
@@ -192,18 +192,18 @@ void spudec_decode_nav(spudec_decoder_t *this, buf_element_t *buf) {
/* we possibly had buttons before, so we update the UI info */
xine_event_t event;
xine_ui_data_t data;
-
+
event.type = XINE_EVENT_UI_NUM_BUTTONS;
event.data = &data;
event.data_length = sizeof(data);
data.num_buttons = 0;
-
+
xine_event_send(this->stream, &event);
}
this->button_filter=0;
break;
- case 1:
+ case 1:
/* All New Highlight information for this VOBU */
if (this->pci_cur.pci.hli.hl_gi.hli_ss != 0 &&
pci.hli.hl_gi.hli_s_ptm > this->pci_cur.pci.hli.hl_gi.hli_s_ptm) {
@@ -259,7 +259,7 @@ void spudec_decode_nav(spudec_decoder_t *this, buf_element_t *buf) {
}
break;
default:
- xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG,
+ xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG,
"libspudec: unknown pci.hli.hl_gi.hli_ss = %d\n", pci.hli.hl_gi.hli_ss );
break;
}
@@ -281,7 +281,7 @@ void spudec_clear_nav_list(spudec_decoder_t *this)
void spudec_update_nav(spudec_decoder_t *this)
{
metronom_clock_t *clock = this->stream->xine->clock;
-
+
if (this->pci_cur.next && this->pci_cur.next->vpts <= clock->get_current_time(clock)) {
pci_node_t *node = this->pci_cur.next;
xine_fast_memcpy(&this->pci_cur, this->pci_cur.next, sizeof(pci_node_t));
@@ -298,12 +298,12 @@ void spudec_process_nav(spudec_decoder_t *this)
/* we possibly entered a menu, so we update the UI button info */
xine_event_t event;
xine_ui_data_t data;
-
+
event.type = XINE_EVENT_UI_NUM_BUTTONS;
event.data = &data;
event.data_length = sizeof(data);
data.num_buttons = this->pci_cur.pci.hli.hl_gi.btn_ns;
-
+
xine_event_send(this->stream, &event);
}
this->button_filter=1;
@@ -322,7 +322,7 @@ void spudec_reassembly (xine_t *xine, spudec_seq_t *seq, uint8_t *pkt_data, u_in
if (seq->complete) {
seq->seq_len = (((uint32_t)pkt_data[0])<<8) | pkt_data[1];
seq->cmd_offs = (((uint32_t)pkt_data[2])<<8) | pkt_data[3];
- if (seq->cmd_offs >= seq->seq_len) {
+ if (seq->cmd_offs >= seq->seq_len) {
xprintf(xine, XINE_VERBOSITY_DEBUG, "libspudec:faulty stream\n");
seq->broken = 1;
}
@@ -342,7 +342,7 @@ void spudec_reassembly (xine_t *xine, spudec_seq_t *seq, uint8_t *pkt_data, u_in
}
seq->ra_offs = 0;
-
+
#ifdef LOG_DEBUG
printf ("spu: buf_len: %d\n", seq->buf_len);
printf ("spu: cmd_off: %d\n", seq->cmd_offs);
@@ -364,7 +364,7 @@ void spudec_reassembly (xine_t *xine, spudec_seq_t *seq, uint8_t *pkt_data, u_in
} else {
xprintf(xine, XINE_VERBOSITY_DEBUG, "libspudec:faulty stream\n");
seq->broken = 1;
- }
+ }
if (seq->ra_offs == seq->seq_len) {
seq->finished = 0;
@@ -382,9 +382,9 @@ void spudec_process (spudec_decoder_t *this, int stream_id) {
cur_seq = &this->spudec_stream_state[stream_id].ra_seq;
#ifdef LOG_DEBUG
- printf ("spu: Found SPU from stream %d pts=%lli vpts=%lli\n",stream_id,
+ printf ("spu: Found SPU from stream %d pts=%lli vpts=%lli\n",stream_id,
this->spudec_stream_state[stream_id].pts,
- this->spudec_stream_state[stream_id].vpts);
+ this->spudec_stream_state[stream_id].vpts);
#endif
this->state.cmd_ptr = cur_seq->buf + cur_seq->cmd_offs;
this->state.modified = 1; /* Only draw picture if = 1 on first event of SPU */
@@ -392,14 +392,14 @@ void spudec_process (spudec_decoder_t *this, int stream_id) {
this->state.forced_display = 0; /* 0 - No value, 1 - Forced Display. */
this->state.delay = 0;
cur_seq->finished=0;
-
+
do {
if (!(cur_seq->finished) ) {
pci_node_t *node;
-
+
/* spu_channel is now set based on whether we are in the menu or not. */
/* Bit 7 is set if only forced display SPUs should be shown */
- if ( (this->stream->spu_channel & 0x1f) != stream_id ) {
+ if ( (this->stream->spu_channel & 0x1f) != stream_id ) {
#ifdef LOG_DEBUG
printf ("spu: Dropping SPU channel %d. Not selected stream_id\n", stream_id);
#endif
@@ -417,7 +417,7 @@ void spudec_process (spudec_decoder_t *this, int stream_id) {
cur_seq->broken = 0;
return;
}
- if ( (this->state.forced_display == 0) && (this->stream->spu_channel & 0x80) ) {
+ if ( (this->state.forced_display == 0) && (this->stream->spu_channel & 0x80) ) {
#ifdef LOG_DEBUG
printf ("spu: Dropping SPU channel %d. Only allow forced display SPUs\n", stream_id);
#endif
@@ -426,7 +426,7 @@ void spudec_process (spudec_decoder_t *this, int stream_id) {
#ifdef LOG_DEBUG
spudec_print_overlay( &this->overlay );
- printf ("spu: forced display:%s\n", this->state.forced_display ? "Yes" : "No" );
+ printf ("spu: forced display:%s\n", this->state.forced_display ? "Yes" : "No" );
#endif
pthread_mutex_lock(&this->nav_pci_lock);
/* search for a PCI that matches this SPU's PTS */
@@ -444,7 +444,7 @@ void spudec_process (spudec_decoder_t *this, int stream_id) {
}
if (node->pci.hli.hl_gi.fosl_btnn > 0) {
xine_event_t event;
-
+
this->buttonN = node->pci.hli.hl_gi.fosl_btnn;
event.type = XINE_EVENT_INPUT_BUTTON_FORCE;
event.stream = this->stream;
@@ -455,12 +455,12 @@ void spudec_process (spudec_decoder_t *this, int stream_id) {
#ifdef LOG_BUTTON
fprintf(stderr, "libspudec:Full Overlay\n");
#endif
- if (!spudec_copy_nav_to_overlay(this->stream->xine,
- &node->pci, this->state.clut,
+ if (!spudec_copy_nav_to_overlay(this->stream->xine,
+ &node->pci, this->state.clut,
this->buttonN, 0, &this->overlay, &this->overlay)) {
/* current button does not exist -> use another one */
xine_event_t event;
-
+
if (this->buttonN > node->pci.hli.hl_gi.btn_ns)
this->buttonN = node->pci.hli.hl_gi.btn_ns;
else
@@ -470,8 +470,8 @@ void spudec_process (spudec_decoder_t *this, int stream_id) {
event.data = &this->buttonN;
event.data_length = sizeof(this->buttonN);
xine_event_send(this->stream, &event);
- spudec_copy_nav_to_overlay(this->stream->xine,
- &node->pci, this->state.clut,
+ spudec_copy_nav_to_overlay(this->stream->xine,
+ &node->pci, this->state.clut,
this->buttonN, 0, &this->overlay, &this->overlay);
}
} else {
@@ -484,44 +484,44 @@ void spudec_process (spudec_decoder_t *this, int stream_id) {
}
pthread_mutex_unlock(&this->nav_pci_lock);
- if ((this->state.modified) ) {
+ if ((this->state.modified) ) {
spudec_draw_picture(this->stream->xine, &this->state, cur_seq, &this->overlay);
}
-
+
if (this->state.need_clut) {
spudec_discover_clut(this->stream->xine, &this->state, &this->overlay);
}
-
+
if (this->state.vobsub) {
int width, height;
int64_t duration;
-
+
/*
* vobsubs are usually played with a scaled-down stream (not full DVD
* resolution), therefore we should try to realign it.
*/
-
+
this->stream->video_out->status(this->stream->video_out, NULL,
&width, &height, &duration );
this->overlay.x = (width - this->overlay.width) / 2;
this->overlay.y = height - this->overlay.height;
}
-
+
/* Subtitle */
if( this->menu_handle < 0 ) {
this->menu_handle = ovl_manager->get_handle(ovl_manager,1);
}
-
+
if( this->menu_handle < 0 ) {
- xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG,
+ xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG,
"libspudec: No video_overlay handles left for menu\n");
return;
}
this->event.object.handle = this->menu_handle;
this->event.object.pts = this->spudec_stream_state[stream_id].pts;
- xine_fast_memcpy(this->event.object.overlay,
+ xine_fast_memcpy(this->event.object.overlay,
&this->overlay,
sizeof(vo_overlay_t));
this->overlay.rle=NULL;
@@ -529,15 +529,15 @@ void spudec_process (spudec_decoder_t *this, int stream_id) {
//if ( !(this->state.visible) ) {
// this->state.visible = OVERLAY_EVENT_SHOW;
//}
-
+
this->event.event_type = this->state.visible;
/*
printf("spu event %d handle: %d vpts: %lli\n", this->event.event_type,
- this->event.object.handle, this->event.vpts );
+ this->event.object.handle, this->event.vpts );
*/
-
- this->event.vpts = this->spudec_stream_state[stream_id].vpts+(this->state.delay*1000);
-
+
+ this->event.vpts = this->spudec_stream_state[stream_id].vpts+(this->state.delay*1000);
+
/* Keep all the events in the correct order. */
/* This corrects for errors during estimation around discontinuity */
if( this->event.vpts < this->last_event_vpts ) {
@@ -550,7 +550,7 @@ void spudec_process (spudec_decoder_t *this, int stream_id) {
this->event.event_type,
this->stream->xine->clock->get_current_time(this->stream->xine->clock),
this->event.vpts);
-#endif
+#endif
ovl_manager->add_event(ovl_manager, (void *)&this->event);
} else {
pending = 0;
@@ -578,7 +578,7 @@ static void spudec_do_commands(xine_t *xine, spudec_state_t *state, spudec_seq_t
#ifdef LOG_DEBUG
printf ("spu: SPU DO COMMANDS\n");
#endif
-
+
state->delay = (buf[0] << 8) + buf[1];
#ifdef LOG_DEBUG
printf ("spu: \tdelay=%d\n",state->delay);
@@ -595,7 +595,7 @@ static void spudec_do_commands(xine_t *xine, spudec_state_t *state, spudec_seq_t
next_seq = seq->buf + seq->seq_len; /* allow to run until end */
state->cmd_ptr = next_seq;
-
+
while (buf < next_seq && *buf != CMD_SPU_EOF) {
switch (*buf) {
case CMD_SPU_SHOW: /* show subpicture */
@@ -605,7 +605,7 @@ static void spudec_do_commands(xine_t *xine, spudec_state_t *state, spudec_seq_t
state->visible = OVERLAY_EVENT_SHOW;
buf++;
break;
-
+
case CMD_SPU_HIDE: /* hide subpicture */
#ifdef LOG_DEBUG
printf ("spu: \thide subpicture\n");
@@ -613,17 +613,17 @@ static void spudec_do_commands(xine_t *xine, spudec_state_t *state, spudec_seq_t
state->visible = OVERLAY_EVENT_HIDE;
buf++;
break;
-
+
case CMD_SPU_SET_PALETTE: { /* CLUT */
spudec_clut_t *clut = (spudec_clut_t *) (buf+1);
-
+
state->cur_colors[3] = clut->entry0;
state->cur_colors[2] = clut->entry1;
state->cur_colors[1] = clut->entry2;
state->cur_colors[0] = clut->entry3;
/* This is a bit out of context for now */
- ovl->color[3] = state->clut[clut->entry0];
+ ovl->color[3] = state->clut[clut->entry0];
ovl->color[2] = state->clut[clut->entry1];
ovl->color[1] = state->clut[clut->entry2];
ovl->color[0] = state->clut[clut->entry3];
@@ -637,11 +637,11 @@ static void spudec_do_commands(xine_t *xine, spudec_state_t *state, spudec_seq_t
state->modified = 1;
buf += 3;
break;
- }
+ }
case CMD_SPU_SET_ALPHA: { /* transparency palette */
spudec_clut_t *trans = (spudec_clut_t *) (buf+1);
/* This should go into state for now */
-
+
ovl->trans[3] = trans->entry0;
ovl->trans[2] = trans->entry1;
ovl->trans[1] = trans->entry2;
@@ -655,7 +655,7 @@ static void spudec_do_commands(xine_t *xine, spudec_state_t *state, spudec_seq_t
buf += 3;
break;
}
-
+
case CMD_SPU_SET_SIZE: /* image coordinates */
/* state->o_left = (buf[1] << 4) | (buf[2] >> 4);
state->o_right = (((buf[2] & 0x0f) << 8) | buf[3]);
@@ -665,7 +665,7 @@ static void spudec_do_commands(xine_t *xine, spudec_state_t *state, spudec_seq_t
*/
ovl->x = (buf[1] << 4) | (buf[2] >> 4);
ovl->y = (buf[4] << 4) | (buf[5] >> 4);
- ovl->width = (((buf[2] & 0x0f) << 8) | buf[3]) - ovl->x + 1;
+ ovl->width = (((buf[2] & 0x0f) << 8) | buf[3]) - ovl->x + 1;
ovl->height = (((buf[5] & 0x0f) << 8) | buf[6]) - ovl->y + 1;
ovl->hili_top = -1;
ovl->hili_bottom = -1;
@@ -679,7 +679,7 @@ static void spudec_do_commands(xine_t *xine, spudec_state_t *state, spudec_seq_t
state->modified = 1;
buf += 7;
break;
-
+
case CMD_SPU_SET_PXD_OFFSET: /* image top[0] field / image bottom[1] field*/
state->field_offs[0] = (((u_int)buf[1]) << 8) | buf[2];
state->field_offs[1] = (((u_int)buf[3]) << 8) | buf[4];
@@ -697,13 +697,13 @@ static void spudec_do_commands(xine_t *xine, spudec_state_t *state, spudec_seq_t
state->modified = 1;
buf += 5;
break;
-
+
case CMD_SPU_WIPE:
#ifdef LOG_DEBUG
printf ("libspudec: \tSPU_WIPE not implemented yet\n");
#endif
param_length = (buf[1] << 8) | (buf[2]);
- buf += 1 + param_length;
+ buf += 1 + param_length;
break;
case CMD_SPU_FORCE_DISPLAY:
@@ -722,7 +722,7 @@ static void spudec_do_commands(xine_t *xine, spudec_state_t *state, spudec_seq_t
break;
}
}
-
+
if (next_seq >= seq->buf + seq->seq_len)
seq->finished = 1; /* last sub-sequence */
}
@@ -763,11 +763,11 @@ static u_int get_bits (u_int bits)
static int spudec_next_line (vo_overlay_t *spu)
{
get_bits (0); // byte align rle data
-
+
put_x = 0;
put_y++;
field ^= 1; // Toggle fields
-
+
if (put_y >= spu->height) {
#ifdef LOG_DEBUG
printf ("spu: put_y >= spu->height\n");
@@ -801,11 +801,11 @@ static void spudec_draw_picture (xine_t *xine, spudec_state_t *state, spudec_seq
* - both fields running to the very end
* - 2 RLE elements per byte meaning single pixel RLE
*/
- ovl->data_size = ((seq->cmd_offs - state->field_offs[0]) +
+ ovl->data_size = ((seq->cmd_offs - state->field_offs[0]) +
(seq->cmd_offs - state->field_offs[1])) * 2 * sizeof(rle_elem_t);
if (ovl->rle) {
- xprintf (xine, XINE_VERBOSITY_DEBUG,
+ xprintf (xine, XINE_VERBOSITY_DEBUG,
"libspudec: spudec_draw_picture: ovl->rle is not empty!!!! It should be!!! "
"You should never see this message.\n");
free(ovl->rle);
@@ -889,7 +889,7 @@ static void spudec_discover_clut(xine_t *xine, spudec_state_t *state, vo_overlay
why rle is null? */
if( !rle )
return;
-
+
/* suppose the first and last pixels are bg */
if( rle[0].color != rle[ovl->num_rle-1].color )
return;
@@ -975,9 +975,9 @@ int spudec_copy_nav_to_overlay(xine_t *xine, pci_t* nav_pci, uint32_t* clut,
if((button <= 0) || (button > nav_pci->hli.hl_gi.btn_ns))
return 0;
-
+
btns_per_group = 36 / nav_pci->hli.hl_gi.btngr_ns;
-
+
/* choose button group: we can always use a normal 4:3 or widescreen button group
* as long as xine blends the overlay before scaling the image to its aspect */
if (!button_ptr && nav_pci->hli.hl_gi.btngr_ns >= 1 && !(nav_pci->hli.hl_gi.btngr1_dsp_ty & 6))
@@ -987,11 +987,11 @@ int spudec_copy_nav_to_overlay(xine_t *xine, pci_t* nav_pci, uint32_t* clut,
if (!button_ptr && nav_pci->hli.hl_gi.btngr_ns >= 3 && !(nav_pci->hli.hl_gi.btngr3_dsp_ty & 6))
button_ptr = &nav_pci->hli.btnit[2 * btns_per_group + button - 1];
if (!button_ptr) {
- xprintf(xine, XINE_VERBOSITY_DEBUG,
+ xprintf(xine, XINE_VERBOSITY_DEBUG,
"libspudec: No suitable menu button group found, using group 1.\n");
button_ptr = &nav_pci->hli.btnit[button - 1];
}
-
+
/* button areas in the nav packet are in screen coordinates,
* overlay clipping areas are in overlay coordinates;
* therefore we must subtract the display coordinates of the underlying overlay */
@@ -1024,6 +1024,6 @@ int spudec_copy_nav_to_overlay(xine_t *xine, pci_t* nav_pci, uint32_t* clut,
#ifdef LOG_BUTTON
printf("libspudec:xine_decoder.c:NAV to SPU pts match!\n");
#endif
-
+
return 1;
}
diff --git a/src/spu_dec/spudec.h b/src/spu_dec/spudec.h
index 3b862c545..4d99e50ce 100644
--- a/src/spu_dec/spudec.h
+++ b/src/spu_dec/spudec.h
@@ -4,17 +4,17 @@
* Copyright (C) James Courtier-Dutton James@superbug.demon.co.uk - July 2001
*
* This file is part of xine, a free video player.
- *
+ *
* xine is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* xine is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
@@ -112,11 +112,11 @@ typedef struct spudec_decoder_s {
spudec_class_t *class;
xine_stream_t *stream;
spudec_stream_state_t spudec_stream_state[MAX_STREAMS];
-
+
video_overlay_event_t event;
- video_overlay_object_t object;
+ video_overlay_object_t object;
int32_t menu_handle;
-
+
spudec_state_t state;
vo_overlay_t overlay;
diff --git a/src/spu_dec/spudvb_decoder.c b/src/spu_dec/spudvb_decoder.c
index 6c3909505..08d827d52 100644
--- a/src/spu_dec/spudvb_decoder.c
+++ b/src/spu_dec/spudvb_decoder.c
@@ -1,18 +1,18 @@
-/*
+/*
* Copyright (C) 2008 the xine project
- *
+ *
* This file is part of xine, a free video player.
- *
+ *
* xine is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* xine is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
@@ -35,54 +35,54 @@
/*#define LOG 1*/
typedef struct {
- int x, y;
- unsigned char is_visible;
+ int x, y;
+ unsigned char is_visible;
} visible_region_t;
typedef struct {
int page_time_out;
- int page_version_number;
- int page_state;
- int page_id;
- visible_region_t regions[MAX_REGIONS];
+ int page_version_number;
+ int page_state;
+ int page_id;
+ visible_region_t regions[MAX_REGIONS];
} page_t;
typedef struct {
int version_number;
- int width, height;
+ int width, height;
int empty;
- int depth;
- int CLUT_id;
- int objects_start;
+ int depth;
+ int CLUT_id;
+ int objects_start;
int objects_end;
- unsigned int object_pos[65536];
- unsigned char *img;
+ unsigned int object_pos[65536];
+ unsigned char *img;
osd_object_t *osd;
} region_t;
typedef struct {
/* dvbsub stuff */
- int x;
- int y;
- unsigned int curr_obj;
- unsigned int curr_reg[64];
- uint8_t *buf;
- int i;
- int nibble_flag;
- int in_scanline;
- page_t page;
- region_t regions[MAX_REGIONS];
+ int x;
+ int y;
+ unsigned int curr_obj;
+ unsigned int curr_reg[64];
+ uint8_t *buf;
+ int i;
+ int nibble_flag;
+ int in_scanline;
+ page_t page;
+ region_t regions[MAX_REGIONS];
clut_t colours[MAX_REGIONS*256];
unsigned char trans[MAX_REGIONS*256];
} dvbsub_func_t;
-typedef struct dvb_spu_class_s {
- spu_decoder_class_t class;
- xine_t *xine;
+typedef struct dvb_spu_class_s {
+ spu_decoder_class_t class;
+ xine_t *xine;
} dvb_spu_class_t;
typedef struct dvb_spu_decoder_s {
- spu_decoder_t spu_decoder;
+ spu_decoder_t spu_decoder;
dvb_spu_class_t *class;
xine_stream_t *stream;
@@ -91,21 +91,21 @@ typedef struct dvb_spu_decoder_s {
/* dvbsub_osd_mutex should be locked around all calls to this->osd_renderer->show()
and this->osd_renderer->hide() */
- pthread_mutex_t dvbsub_osd_mutex;
-
- char *pes_pkt;
+ pthread_mutex_t dvbsub_osd_mutex;
+
+ char *pes_pkt;
char *pes_pkt_wrptr;
- unsigned int pes_pkt_size;
-
- uint64_t pts;
- uint64_t vpts;
+ unsigned int pes_pkt_size;
+
+ uint64_t pts;
+ uint64_t vpts;
uint64_t end_vpts;
- pthread_t dvbsub_timer_thread;
+ pthread_t dvbsub_timer_thread;
struct timespec dvbsub_hide_timeout;
pthread_cond_t dvbsub_restart_timeout;
dvbsub_func_t *dvbsub;
- int show;
+ int show;
} dvb_spu_decoder_t;
@@ -173,7 +173,7 @@ static void update_region (dvb_spu_decoder_t * this, int region_id, int region_w
}
fill = 1;
}
-
+
if ( fill ) {
memset( reg->img, fill_color, region_width*region_height );
reg->empty = 1;
@@ -331,11 +331,11 @@ static void recalculate_trans (dvb_spu_decoder_t *this)
dvbsub->trans[i] = v * 14 / 255 + 1;
}
}
-
+
}
static void set_clut(dvb_spu_decoder_t *this,int CLUT_id,int CLUT_entry_id,int Y_value, int Cr_value, int Cb_value, int T_value) {
-
+
dvbsub_func_t *dvbsub = this->dvbsub;
if ((CLUT_id>=MAX_REGIONS) || (CLUT_entry_id>15)) {
@@ -377,7 +377,7 @@ static void process_CLUT_definition_segment(dvb_spu_decoder_t *this) {
while (dvbsub->i < j) {
CLUT_entry_id=dvbsub->buf[dvbsub->i++];
-
+
CLUT_flag_2_bit=(dvbsub->buf[dvbsub->i]&0x80)>>7;
CLUT_flag_4_bit=(dvbsub->buf[dvbsub->i]&0x40)>>6;
CLUT_flag_8_bit=(dvbsub->buf[dvbsub->i]&0x20)>>5;
@@ -518,7 +518,7 @@ static void process_region_composition_segment (dvb_spu_decoder_t * this)
return;
dvbsub->regions[region_id].version_number = region_version_number;
-
+
/* Check if region size has changed and fill background. */
update_region (this, region_id, region_width, region_height, region_fill_flag, region_4_bit_pixel_code);
if ( CLUT_id<MAX_REGIONS )
@@ -634,7 +634,7 @@ static void* dvbsub_timer_func(void *this_gen)
int result = pthread_cond_timedwait(&this->dvbsub_restart_timeout,
&this->dvbsub_osd_mutex,
&this->dvbsub_hide_timeout);
- if(result == ETIMEDOUT &&
+ if(result == ETIMEDOUT &&
timeout.tv_sec == this->dvbsub_hide_timeout.tv_sec &&
timeout.tv_nsec == this->dvbsub_hide_timeout.tv_nsec)
{
@@ -693,7 +693,7 @@ static void draw_subtitles (dvb_spu_decoder_t * this)
return;
for (r = 0; r < MAX_REGIONS; r++) {
- if (this->dvbsub->regions[r].img) {
+ if (this->dvbsub->regions[r].img) {
if (this->dvbsub->page.regions[r].is_visible && !this->dvbsub->regions[r].empty) {
update_osd( this, r );
if ( !this->dvbsub->regions[r].osd )
@@ -758,9 +758,9 @@ static void spudec_decode_data (spu_decoder_t * this_gen, buf_element_t * buf)
int PES_header_data_length;
int PES_packet_length;
int i;
-
+
if((buf->type & 0xffff0000)!=BUF_SPU_DVB)
- return;
+ return;
if (buf->decoder_flags & BUF_FLAG_SPECIAL) {
if (buf->decoder_info[1] == BUF_SPECIAL_SPU_DVB_DESCRIPTOR) {
@@ -820,7 +820,7 @@ static void spudec_decode_data (spu_decoder_t * this_gen, buf_element_t * buf)
this->vpts = 0;
/* process the pes section */
-
+
PES_packet_length = this->pes_pkt_size;
this->dvbsub->buf = this->pes_pkt;
@@ -834,7 +834,7 @@ static void spudec_decode_data (spu_decoder_t * this_gen, buf_element_t * buf)
/* SUBTITLING SEGMENT */
this->dvbsub->i++;
segment_type = this->dvbsub->buf[this->dvbsub->i++];
-
+
this->dvbsub->page.page_id = (this->dvbsub->buf[this->dvbsub->i] << 8) | this->dvbsub->buf[this->dvbsub->i + 1];
segment_length = (this->dvbsub->buf[this->dvbsub->i + 2] << 8) | this->dvbsub->buf[this->dvbsub->i + 3];
new_i = this->dvbsub->i + segment_length + 4;
@@ -844,15 +844,15 @@ static void spudec_decode_data (spu_decoder_t * this_gen, buf_element_t * buf)
break;
/* verify we've the right segment */
if(this->dvbsub->page.page_id==this->spu_descriptor->comp_page_id){
- /* SEGMENT_DATA_FIELD */
- switch (segment_type & 0xff) {
- case 0x10:
- process_page_composition_segment (this);
+ /* SEGMENT_DATA_FIELD */
+ switch (segment_type & 0xff) {
+ case 0x10:
+ process_page_composition_segment (this);
break;
case 0x11:
process_region_composition_segment (this);
break;
- case 0x12:
+ case 0x12:
process_CLUT_definition_segment(this);
break;
case 0x13:
@@ -863,7 +863,7 @@ static void spudec_decode_data (spu_decoder_t * this_gen, buf_element_t * buf)
draw_subtitles( this );
break;
default:
- return;
+ return;
break;
}
}
@@ -880,17 +880,17 @@ static void spudec_decode_data (spu_decoder_t * this_gen, buf_element_t * buf)
case 0x11:
process_region_composition_segment(this);
break;
- case 0x12:
+ case 0x12:
process_CLUT_definition_segment(this);
break;
case 0x13:
process_object_data_segment (this);
break;
- case 0x80:
+ case 0x80:
draw_subtitles( this ); /* Page is now completely rendered */
break;
default:
- return;
+ return;
break;
}
}
@@ -967,7 +967,7 @@ static spu_decoder_t *dvb_spu_class_open_plugin (spu_decoder_class_t * class_gen
this->pes_pkt = calloc(65, 1024);
this->spu_descriptor = calloc(1, sizeof(spu_dvb_descriptor_t));
-
+
this->dvbsub = calloc(1, sizeof (dvbsub_func_t));
int i;
diff --git a/src/spu_dec/sputext_decoder.c b/src/spu_dec/sputext_decoder.c
index dee14d02a..749b23208 100644
--- a/src/spu_dec/sputext_decoder.c
+++ b/src/spu_dec/sputext_decoder.c
@@ -1,18 +1,18 @@
/*
* Copyright (C) 2000-2004 the xine project
- *
+ *
* This file is part of xine, a free video player.
- *
+ *
* xine is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* xine is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
@@ -173,7 +173,7 @@ typedef struct sputext_decoder_s {
int64_t img_duration;
int64_t last_subtitle_end; /* no new subtitle before this vpts */
int unscaled; /* use unscaled OSD */
-
+
int last_y; /* location of the previous subtitle */
int last_lines; /* number of lines of the previous subtitle */
video2wnd_t video2wnd;
@@ -194,7 +194,7 @@ static void update_font_size (sputext_decoder_t *this, int force_update) {
if ((this->subtitle_size != this->class->subtitle_size) ||
(this->vertical_offset != this->class->vertical_offset) ||
force_update) {
-
+
this->subtitle_size = this->class->subtitle_size;
this->vertical_offset = this->class->vertical_offset;
this->last_lines = 0;
@@ -207,7 +207,7 @@ static void update_font_size (sputext_decoder_t *this, int force_update) {
if( this->osd )
this->renderer->free_object (this->osd);
- this->osd = this->renderer->new_object (this->renderer,
+ this->osd = this->renderer->new_object (this->renderer,
this->width,
this->height);
@@ -229,14 +229,14 @@ static void update_output_size (sputext_decoder_t *this) {
/* initialize decoder if needed */
if( this->unscaled ) {
- if( this->width != this->stream->video_out->get_property(this->stream->video_out,
+ if( this->width != this->stream->video_out->get_property(this->stream->video_out,
VO_PROP_WINDOW_WIDTH) ||
- this->height != this->stream->video_out->get_property(this->stream->video_out,
+ this->height != this->stream->video_out->get_property(this->stream->video_out,
VO_PROP_WINDOW_HEIGHT) ||
!this->img_duration || !this->osd ) {
int width = 0, height = 0;
-
+
this->stream->video_out->status(this->stream->video_out, NULL,
&width, &height, &this->img_duration );
if( width && height ) {
@@ -253,13 +253,13 @@ static void update_output_size (sputext_decoder_t *this) {
/* and a displacement factor because video may have blacks lines. */
int output_width, output_height, output_xoffset, output_yoffset;
- output_width = this->stream->video_out->get_property(this->stream->video_out,
+ output_width = this->stream->video_out->get_property(this->stream->video_out,
VO_PROP_OUTPUT_WIDTH);
- output_height = this->stream->video_out->get_property(this->stream->video_out,
+ output_height = this->stream->video_out->get_property(this->stream->video_out,
VO_PROP_OUTPUT_HEIGHT);
- output_xoffset = this->stream->video_out->get_property(this->stream->video_out,
+ output_xoffset = this->stream->video_out->get_property(this->stream->video_out,
VO_PROP_OUTPUT_XOFFSET);
- output_yoffset = this->stream->video_out->get_property(this->stream->video_out,
+ output_yoffset = this->stream->video_out->get_property(this->stream->video_out,
VO_PROP_OUTPUT_YOFFSET);
/* driver don't seen to be capable to give us those values */
@@ -283,16 +283,16 @@ static void update_output_size (sputext_decoder_t *this) {
}
} else {
if( !this->width || !this->height || !this->img_duration || !this->osd ) {
-
+
this->width = 0;
this->height = 0;
-
+
this->stream->video_out->status(this->stream->video_out, NULL,
&this->width, &this->height, &this->img_duration );
-
+
if(!this->osd || ( this->width && this->height)) {
this->renderer = this->stream->osd_renderer;
-
+
/* in scaled mode, we have to convert subtitle position in film coordinates. */
this->video2wnd.x = 0;
this->video2wnd.y = 0;
@@ -310,14 +310,14 @@ static int parse_utf8_size(const void *buf)
const uint8_t *c = buf;
if ( c[0]<0x80 )
return 1;
-
+
if( c[1]==0 )
return 1;
if ( (c[0]>=0xC2 && c[0]<=0xDF) && (c[1]>=0x80 && c[1]<=0xBF) )
return 2;
-
+
if( c[2]==0 )
- return 2;
+ return 2;
else if ( c[0]==0xE0 && (c[1]>=0xA0 && c[1]<=0xBF) && (c[2]>=0x80 && c[1]<=0xBF) )
return 3;
else if ( (c[0]>=0xE1 && c[0]<=0xEC) && (c[1]>=0x80 && c[1]<=0xBF) && (c[2]>=0x80 && c[1]<=0xBF) )
@@ -350,7 +350,7 @@ static int ogm_render_line_internal(sputext_decoder_t *this, int x, int y, const
this->current_osd_text = OSD_TEXT1;
i=i+4;
continue;
- } else if (!strncmp("<i>", text+i, 3)) {
+ } else if (!strncmp("<i>", text+i, 3)) {
/* enable italics color */
if (render)
this->current_osd_text = OSD_TEXT3;
@@ -362,7 +362,7 @@ static int ogm_render_line_internal(sputext_decoder_t *this, int x, int y, const
this->current_osd_text = OSD_TEXT1;
i=i+4;
continue;
- } else if (!strncmp("<font>", text+i, 6)) {
+ } else if (!strncmp("<font>", text+i, 6)) {
/*Do somethink to disable typing
fixme - no teststreams*/
i=i+6;
@@ -408,7 +408,7 @@ static int ogm_render_line_internal(sputext_decoder_t *this, int x, int y, const
const size_t shift = isutf8 ? parse_utf8_size (&text[i]) : 1;
memcpy(letter,&text[i],shift);
letter[shift]=0;
-
+
if (render)
this->renderer->render_text(this->osd, x, y, letter, this->current_osd_text);
@@ -433,7 +433,7 @@ static inline void ogm_render_line(sputext_decoder_t *this, int x, int y, char*
/* \a : alignment in SSA code (see #defines) */
/* \an : alignment in 'numpad code' */
/* \pos : absolute position of subtitles. Alignment define origin. */
-static void read_ssa_tag(sputext_decoder_t *this, const char* text,
+static void read_ssa_tag(sputext_decoder_t *this, const char* text,
int* alignment, int* sub_x, int* sub_y, int* max_width) {
int in_tag = 0;
@@ -469,7 +469,7 @@ static void read_ssa_tag(sputext_decoder_t *this, const char* text,
if (*text == '}') in_tag = 0;
}
-
+
text++;
}
@@ -483,7 +483,7 @@ static void read_ssa_tag(sputext_decoder_t *this, const char* text,
if ((*sub_x) >= 0 && (*sub_y) >= 0) {
(*sub_x) = this->video2wnd.x + this->video2wnd.dx * (*sub_x);
(*sub_y) = this->video2wnd.y + this->video2wnd.dy * (*sub_y);
- }
+ }
/* check validity, compute max width */
if ( (*sub_x) < 0 || (*sub_x) >= this->width ||
@@ -550,7 +550,7 @@ static int is_cjk_encoding(const char *enc) {
}
static void draw_subtitle(sputext_decoder_t *this, int64_t sub_start, int64_t sub_end ) {
-
+
int y;
int sub_x, sub_y, max_width;
int alignment;
@@ -562,7 +562,7 @@ static void draw_subtitle(sputext_decoder_t *this, int64_t sub_start, int64_t su
read_ssa_tag(this, this->text[0], &alignment, &sub_x, &sub_y, &max_width);
update_font_size(this, 0);
-
+
const char *const font = get_font (this->class);
if( strcmp(this->font, font) ) {
strncpy(this->font, font, FILENAME_MAX);
@@ -585,13 +585,13 @@ static void draw_subtitle(sputext_decoder_t *this, int64_t sub_start, int64_t su
char *current_cut, *best_cut;
int a;
- xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG,
- "libsputext: Line too long: %d > %d, split at max size.\n",
+ xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG,
+ "libsputext: Line too long: %d > %d, split at max size.\n",
line_width, max_width);
/* can't fit with keeping existing lines */
if (this->lines + 1 > SUB_MAX_TEXT) {
- xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG,
+ xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG,
"libsputext: Can't fit with keeping existing line, we have to rebuild all the subtitle\n");
rebuild_all = 1;
break;
@@ -615,7 +615,7 @@ static void draw_subtitle(sputext_decoder_t *this, int64_t sub_start, int64_t su
}
if (best_cut == NULL) {
- xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG,
+ xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG,
"libsputext: Can't wrap line: a word is too long, abort.\n");
break;
}
@@ -652,7 +652,7 @@ static void draw_subtitle(sputext_decoder_t *this, int64_t sub_start, int64_t su
do {
if (this->lines + 1 < SUB_MAX_TEXT) {
-
+
/* find the longest sequence witch fit */
int line_width = 0;
current_cut = stream;
@@ -672,7 +672,7 @@ static void draw_subtitle(sputext_decoder_t *this, int64_t sub_start, int64_t su
}
}
}
-
+
/* line maybe too long, but we have reached last subtitle line */
else {
best_cut = current_cut = stream + strlen(stream);
@@ -685,7 +685,7 @@ static void draw_subtitle(sputext_decoder_t *this, int64_t sub_start, int64_t su
stream = best_cut + 1;
- } while (best_cut != current_cut);
+ } while (best_cut != current_cut);
}
@@ -693,7 +693,7 @@ static void draw_subtitle(sputext_decoder_t *this, int64_t sub_start, int64_t su
/* Erase subtitle : use last_y and last_lines saved last turn. */
if (this->last_lines) {
this->renderer->filled_rect (this->osd, 0, this->last_y,
- this->width - 1, this->last_y + this->last_lines * this->line_height,
+ this->width - 1, this->last_y + this->last_lines * this->line_height,
0);
}
@@ -707,23 +707,23 @@ static void draw_subtitle(sputext_decoder_t *this, int64_t sub_start, int64_t su
if (sub_y >= 0) y = sub_y - (this->lines * this->line_height) / 2;
else y = (this->height - this->lines * this->line_height) / 2;
break;
-
+
case ALIGN_BOTTOM:
default:
if (sub_y >= 0) y = sub_y - this->lines * this->line_height;
else y = this->height - this->lines * this->line_height - this->class->vertical_offset;
break;
}
- if (y < 0 || y >= this->height)
+ if (y < 0 || y >= this->height)
y = this->height - this->line_height * this->lines;
- this->last_lines = this->lines;
- this->last_y = y;
+ this->last_lines = this->lines;
+ this->last_y = y;
for (line = 0; line < this->lines; line++) {
int w, x;
-
+
while(1) {
w = ogm_get_width( this, this->text[line]);
@@ -737,7 +737,7 @@ static void draw_subtitle(sputext_decoder_t *this, int64_t sub_start, int64_t su
if (sub_x >= 0) x = sub_x - w;
else x = max_width - w - 5;
break;
-
+
case ALIGN_CENTER:
default:
if (sub_x >= 0) x = sub_x - w / 2;
@@ -753,7 +753,7 @@ static void draw_subtitle(sputext_decoder_t *this, int64_t sub_start, int64_t su
break;
}
}
-
+
if( is_cjk_encoding(encoding) ) {
this->renderer->render_text (this->osd, x, y + line * this->line_height,
this->text[line], OSD_TEXT1);
@@ -761,31 +761,31 @@ static void draw_subtitle(sputext_decoder_t *this, int64_t sub_start, int64_t su
ogm_render_line(this, x, y + line*this->line_height, this->text[line]);
}
}
-
+
if( font_size != this->font_size )
this->renderer->set_font (this->osd, get_font (this->class), this->font_size);
-
+
if( this->last_subtitle_end && sub_start < this->last_subtitle_end ) {
sub_start = this->last_subtitle_end;
}
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);
else
this->renderer->show (this->osd, sub_start);
-
+
this->renderer->hide (this->osd, sub_end);
-
+
lprintf ("scheduling subtitle >%s< at %"PRId64" until %"PRId64", current time is %"PRId64"\n",
- this->text[0], sub_start, sub_end,
+ this->text[0], sub_start, sub_end,
this->stream->xine->clock->get_current_time (this->stream->xine->clock));
}
@@ -810,7 +810,7 @@ static void spudec_decode_data (spu_decoder_t *this_gen, buf_element_t *buf) {
}
if (buf->decoder_flags & BUF_FLAG_PREVIEW)
return;
-
+
if ((this->stream->spu_channel & 0x1f) != (buf->type & 0x1f))
return;
@@ -833,9 +833,9 @@ static void spudec_decode_data (spu_decoder_t *this_gen, buf_element_t *buf) {
if (!*str) return;
/* Empty ogm packets (as created by ogmmux) clears out old messages. We already respect the end time. */
-
+
this->lines = 0;
-
+
i = 0;
while (*str && (this->lines < SUB_MAX_TEXT) && (i < SUB_BUFSIZE)) {
if (*str == '\r' || *str == '\n') {
@@ -853,7 +853,7 @@ static void spudec_decode_data (spu_decoder_t *this_gen, buf_element_t *buf) {
}
if (i == SUB_BUFSIZE)
i--;
-
+
if (i) {
this->text[ this->lines ][i] = 0;
this->lines++;
@@ -863,7 +863,7 @@ static void spudec_decode_data (spu_decoder_t *this_gen, buf_element_t *buf) {
this->ogm = 0;
val = (uint32_t * )buf->content;
-
+
this->lines = *val++;
uses_time = *val++;
start = *val++;
@@ -875,7 +875,7 @@ static void spudec_decode_data (spu_decoder_t *this_gen, buf_element_t *buf) {
}
}
-
+
xprintf(this->class->xine, XINE_VERBOSITY_DEBUG,
"libsputext: decoder data [%s]\n", this->text[0]);
xprintf(this->class->xine, XINE_VERBOSITY_DEBUG,
@@ -886,7 +886,7 @@ static void spudec_decode_data (spu_decoder_t *this_gen, buf_element_t *buf) {
"libsputext: discarding subtitle with invalid timing\n");
return;
}
-
+
spu_offset = this->stream->master->metronom->get_option (this->stream->master->metronom,
METRONOM_SPU_OFFSET);
if( uses_time ) {
@@ -898,17 +898,17 @@ static void spudec_decode_data (spu_decoder_t *this_gen, buf_element_t *buf) {
end += spu_offset / this->img_duration;
}
}
-
+
while( !this->finished ) {
-
+
master_status = xine_get_status (this->stream->master);
slave_status = xine_get_status (this->stream);
- vo_discard = this->stream->video_out->get_property(this->stream->video_out,
+ vo_discard = this->stream->video_out->get_property(this->stream->video_out,
VO_PROP_DISCARD_FRAMES);
_x_get_current_info (this->stream->master, &extra_info, sizeof(extra_info) );
-
- lprintf("master: %d slave: %d input_normpos: %d vo_discard: %d\n",
+
+ lprintf("master: %d slave: %d input_normpos: %d vo_discard: %d\n",
master_status, slave_status, extra_info.input_normpos, vo_discard);
if( !this->started && (master_status == XINE_STATUS_PLAY &&
@@ -926,63 +926,63 @@ static void spudec_decode_data (spu_decoder_t *this_gen, buf_element_t *buf) {
if( this->started ) {
- if( master_status != XINE_STATUS_PLAY ||
+ if( master_status != XINE_STATUS_PLAY ||
slave_status != XINE_STATUS_PLAY ||
vo_discard ) {
lprintf("finished\n");
-
+
this->width = this->height = 0;
this->finished = 1;
return;
}
if( this->osd ) {
-
+
/* try to use frame number mode */
if( !uses_time && extra_info.frame_number ) {
-
+
diff = end - extra_info.frame_number;
-
+
/* discard old subtitles */
if( diff < 0 ) {
- xprintf(this->class->xine, XINE_VERBOSITY_DEBUG,
+ xprintf(this->class->xine, XINE_VERBOSITY_DEBUG,
"libsputext: discarding old subtitle\n");
return;
}
-
+
diff = start - extra_info.frame_number;
-
+
start_vpts = extra_info.vpts + diff * this->img_duration;
end_vpts = start_vpts + (end-start) * this->img_duration;
-
+
} else {
-
+
if( !uses_time ) {
start = start * this->img_duration / 90;
end = end * this->img_duration / 90;
uses_time = 1;
}
-
+
diff = end - extra_info.input_time;
-
+
/* discard old subtitles */
if( diff < 0 ) {
xprintf(this->class->xine, XINE_VERBOSITY_DEBUG,
"libsputext: discarding old subtitle\n");
return;
}
-
+
diff = start - extra_info.input_time;
-
+
start_vpts = extra_info.vpts + diff * 90;
end_vpts = start_vpts + (end-start) * 90;
}
-
+
_x_spu_decoder_sleep(this->stream, start_vpts);
update_output_size( this );
draw_subtitle(this, start_vpts, end_vpts);
-
- return;
+
+ return;
}
}
@@ -991,12 +991,12 @@ static void spudec_decode_data (spu_decoder_t *this_gen, buf_element_t *buf) {
else
return;
}
-}
+}
static void spudec_reset (spu_decoder_t *this_gen) {
sputext_decoder_t *this = (sputext_decoder_t *) this_gen;
-
+
lprintf("i guess we just seeked\n");
this->width = this->height = 0;
this->started = this->finished = 0;
@@ -1010,7 +1010,7 @@ static void spudec_discontinuity (spu_decoder_t *this_gen) {
static void spudec_dispose (spu_decoder_t *this_gen) {
sputext_decoder_t *this = (sputext_decoder_t *) this_gen;
-
+
if (this->osd) {
this->renderer->free_object (this->osd);
this->osd = NULL;
@@ -1031,7 +1031,7 @@ static void update_osd_font(void *class_gen, xine_cfg_entry_t *entry)
strncpy(class->font, entry->str_value, FONTNAME_SIZE);
class->font[FONTNAME_SIZE - 1] = '\0';
-
+
xprintf(class->xine, XINE_VERBOSITY_DEBUG, "libsputext: spu_font = %s\n", class->font );
}
@@ -1042,7 +1042,7 @@ static void update_osd_font_ft(void *class_gen, xine_cfg_entry_t *entry)
strncpy(class->font_ft, entry->str_value, FILENAME_MAX);
class->font_ft[FILENAME_MAX - 1] = '\0';
-
+
xprintf(class->xine, XINE_VERBOSITY_DEBUG, "libsputext: spu_font_ft = %s\n", class->font_ft);
}
@@ -1051,7 +1051,7 @@ static void update_osd_use_font_ft(void *class_gen, xine_cfg_entry_t *entry)
sputext_class_t *class = (sputext_class_t *)class_gen;
class->use_font_ft = entry->num_value;
-
+
xprintf(class->xine, XINE_VERBOSITY_DEBUG, "libsputext: spu_use_font_ft = %d\n", class->use_font_ft);
}
#endif
@@ -1114,13 +1114,13 @@ static void update_src_encoding(void *class_gen, xine_cfg_entry_t *entry)
static void *init_spu_decoder_plugin (xine_t *xine, void *data) {
- static const char *const subtitle_size_strings[] = {
- "tiny", "small", "normal", "large", "very large", "huge", NULL
+ static const char *const subtitle_size_strings[] = {
+ "tiny", "small", "normal", "large", "very large", "huge", NULL
};
sputext_class_t *this ;
lprintf("init class\n");
-
+
this = (sputext_class_t *) calloc(1, sizeof(sputext_class_t));
this->class.open_plugin = sputext_class_open_plugin;
@@ -1130,8 +1130,8 @@ static void *init_spu_decoder_plugin (xine_t *xine, void *data) {
this->xine = xine;
- this->subtitle_size = xine->config->register_enum(xine->config,
- "subtitles.separate.subtitle_size",
+ this->subtitle_size = xine->config->register_enum(xine->config,
+ "subtitles.separate.subtitle_size",
1,
subtitle_size_strings,
_("subtitle size"),
@@ -1139,7 +1139,7 @@ static void *init_spu_decoder_plugin (xine_t *xine, void *data) {
"be evaluated relative to the window size."),
0, update_subtitle_size, this);
this->vertical_offset = xine->config->register_num(xine->config,
- "subtitles.separate.vertical_offset",
+ "subtitles.separate.vertical_offset",
0,
_("subtitle vertical offset"),
_("You can adjust the vertical position of the subtitle. "
@@ -1168,8 +1168,8 @@ static void *init_spu_decoder_plugin (xine_t *xine, void *data) {
NULL,
10, update_osd_use_font_ft, this);
#endif
- this->src_encoding = xine->config->register_string(xine->config,
- "subtitles.separate.src_encoding",
+ this->src_encoding = xine->config->register_string(xine->config,
+ "subtitles.separate.src_encoding",
xine_guess_spu_encoding(),
_("encoding of the subtitles"),
_("The encoding of the subtitle text in the stream. This setting "
@@ -1204,7 +1204,7 @@ static const decoder_info_t spudec_info = {
extern void *init_sputext_demux_class (xine_t *xine, void *data);
const plugin_info_t xine_plugin_info[] EXPORTED = {
- /* type, API, "name", version, special_info, init_function */
+ /* type, API, "name", version, special_info, init_function */
{ PLUGIN_SPU_DECODER | PLUGIN_MUST_PRELOAD, 17, "sputext", XINE_VERSION_CODE, &spudec_info, &init_spu_decoder_plugin },
{ PLUGIN_DEMUX, 27, "sputext", XINE_VERSION_CODE, NULL, &init_sputext_demux_class },
{ PLUGIN_NONE, 0, "", 0, NULL, NULL }
diff --git a/src/spu_dec/sputext_demuxer.c b/src/spu_dec/sputext_demuxer.c
index 20c0499da..0b89d03c8 100644
--- a/src/spu_dec/sputext_demuxer.c
+++ b/src/spu_dec/sputext_demuxer.c
@@ -1,18 +1,18 @@
/*
* Copyright (C) 2000-2003 the xine project
- *
+ *
* This file is part of xine, a free video player.
- *
+ *
* xine is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* xine is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
@@ -67,7 +67,7 @@ typedef struct {
long start; /* csecs */
long end; /* csecs */
-
+
char *text[SUB_MAX_TEXT];
} subtitle_t;
@@ -84,10 +84,10 @@ typedef struct {
char buf[SUB_BUFSIZE];
off_t buflen;
- float mpsub_position;
+ float mpsub_position;
- int uses_time;
- int errs;
+ int uses_time;
+ int errs;
subtitle_t *subtitles;
int num; /* number of subtitle structs */
int cur; /* current subtitle */
@@ -117,8 +117,8 @@ typedef struct demux_sputext_class_s {
#define FORMAT_RT 5
#define FORMAT_SSA 6 /* Sub Station Alpha */
#define FORMAT_PJS 7
-#define FORMAT_MPSUB 8
-#define FORMAT_AQTITLE 9
+#define FORMAT_MPSUB 8
+#define FORMAT_AQTITLE 9
#define FORMAT_JACOBSUB 10
#define FORMAT_SUBVIEWER2 11
#define FORMAT_SUBRIP09 12
@@ -137,7 +137,7 @@ static inline void trail_space(char *s) {
} while(*copy);
}
size_t i = strlen(s) - 1;
- while (i > 0 && isspace(s[i]))
+ while (i > 0 && isspace(s[i]))
s[i--] = '\0';
}
@@ -148,24 +148,24 @@ static char *read_line_from_input(demux_sputext_t *this, char *line, off_t len)
off_t nread = 0;
char *s;
int linelen;
-
+
if ((len - this->buflen) > 512 && len < SUB_BUFSIZE) {
- if((nread = this->input->read(this->input,
+ if((nread = this->input->read(this->input,
&this->buf[this->buflen], len - this->buflen)) < 0) {
xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "read failed.\n");
return NULL;
}
}
-
+
this->buflen += nread;
this->buf[this->buflen] = '\0';
s = strchr(this->buf, '\n');
if (line && (s || this->buflen)) {
-
+
linelen = s ? (s - this->buf) + 1 : this->buflen;
-
+
memcpy(line, this->buf, linelen);
line[linelen] = '\0';
@@ -190,14 +190,14 @@ static subtitle_t *sub_read_line_sami(demux_sputext_t *this, subtitle_t *current
current->lines = current->start = 0;
current->end = -1;
state = 0;
-
+
/* read the first line */
if (!s)
if (!(s = read_line_from_input(this, line, LINE_LEN))) return 0;
-
+
do {
switch (state) {
-
+
case 0: /* find "START=" */
s = strstr (s, "Start=");
if (s) {
@@ -205,15 +205,15 @@ static subtitle_t *sub_read_line_sami(demux_sputext_t *this, subtitle_t *current
state = 1; continue;
}
break;
-
+
case 1: /* find "<P" */
if ((s = strstr (s, "<P"))) { s += 2; state = 2; continue; }
break;
-
+
case 2: /* find ">" */
if ((s = strchr (s, '>'))) { s++; state = 3; p = text; continue; }
break;
-
+
case 3: /* get all text until '<' appears */
if (*s == '\0') { break; }
else if (*s == '<') { state = 4; }
@@ -227,7 +227,7 @@ static subtitle_t *sub_read_line_sami(demux_sputext_t *this, subtitle_t *current
}
else *p++ = *s++;
continue;
-
+
case 4: /* get current->end or skip <TAG> */
q = strstr (s, "Start=");
if (q) {
@@ -242,13 +242,13 @@ static subtitle_t *sub_read_line_sami(demux_sputext_t *this, subtitle_t *current
if (s) { s++; state = 3; continue; }
break;
}
-
+
/* read next line */
- if (state != 99 && !(s = read_line_from_input (this, line, LINE_LEN)))
+ if (state != 99 && !(s = read_line_from_input (this, line, LINE_LEN)))
return 0;
-
+
} while (state != 99);
-
+
return current;
}
@@ -256,16 +256,16 @@ static subtitle_t *sub_read_line_sami(demux_sputext_t *this, subtitle_t *current
static char *sub_readtext(char *source, char **dest) {
int len=0;
char *p=source;
-
+
while ( !eol(*p) && *p!= '|' ) {
p++,len++;
}
-
+
*dest = strndup(source, len);
-
+
while (*p=='\r' || *p=='\n' || *p=='|')
p++;
-
+
if (*p) return p; /* not-last text field */
else return NULL; /* last text field */
}
@@ -276,30 +276,30 @@ static subtitle_t *sub_read_line_microdvd(demux_sputext_t *this, subtitle_t *cur
char line2[LINE_LEN + 1];
char *p, *next;
int i;
-
+
memset (current, 0, sizeof(subtitle_t));
-
+
current->end=-1;
do {
if (!read_line_from_input (this, line, LINE_LEN)) return NULL;
} while ((sscanf (line, "{%ld}{}%" LINE_LEN_QUOT "[^\r\n]", &(current->start), line2) !=2) &&
(sscanf (line, "{%ld}{%ld}%" LINE_LEN_QUOT "[^\r\n]", &(current->start), &(current->end),line2) !=3)
);
-
+
p=line2;
-
+
next=p, i=0;
while ((next =sub_readtext (next, &(current->text[i])))) {
if (current->text[i]==ERR) return ERR;
i++;
- if (i>=SUB_MAX_TEXT) {
+ if (i>=SUB_MAX_TEXT) {
xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "Too many lines in a subtitle\n");
current->lines=i;
return current;
}
}
current->lines= ++i;
-
+
return current;
}
@@ -309,9 +309,9 @@ static subtitle_t *sub_read_line_subviewer(demux_sputext_t *this, subtitle_t *cu
int a1,a2,a3,a4,b1,b2,b3,b4;
char *p=NULL, *q=NULL;
int len;
-
+
memset (current, 0, sizeof(subtitle_t));
-
+
while (1) {
if (!read_line_from_input(this, line, LINE_LEN)) return NULL;
if (sscanf (line, "%d:%d:%d.%d,%d:%d:%d.%d",&a1,&a2,&a3,&a4,&b1,&b2,&b3,&b4) < 8) {
@@ -320,10 +320,10 @@ static subtitle_t *sub_read_line_subviewer(demux_sputext_t *this, subtitle_t *cu
}
current->start = a1*360000+a2*6000+a3*100+a4;
current->end = b1*360000+b2*6000+b3*100+b4;
-
+
if (!read_line_from_input(this, line, LINE_LEN))
return NULL;
-
+
p=q=line;
for (current->lines=1; current->lines <= SUB_MAX_TEXT; current->lines++) {
for (q=p,len=0; *p && *p!='\r' && *p!='\n' && *p!='|' && strncasecmp(p,"[br]",4); p++,len++);
@@ -343,7 +343,7 @@ static subtitle_t *sub_read_line_subrip(demux_sputext_t *this,subtitle_t *curren
char line[LINE_LEN + 1];
int a1,a2,a3,a4,b1,b2,b3,b4;
int i,end_sub;
-
+
memset(current,0,sizeof(subtitle_t));
do {
if(!read_line_from_input(this,line,LINE_LEN))
@@ -411,9 +411,9 @@ static subtitle_t *sub_read_line_vplayer(demux_sputext_t *this,subtitle_t *curre
int a1,a2,a3,b1,b2,b3;
char *p=NULL, *next, *p2;
int i;
-
+
memset (current, 0, sizeof(subtitle_t));
-
+
while (!current->text[0]) {
if( this->next_line[0] == '\0' ) { /* if the buffer is empty.... */
if( !read_line_from_input(this, line, LINE_LEN) ) return NULL;
@@ -433,24 +433,24 @@ static subtitle_t *sub_read_line_vplayer(demux_sputext_t *this,subtitle_t *curre
continue;
current->start = a1*360000+a2*6000+a3*100;
current->end = b1*360000+b2*6000+b3*100;
- if ((current->end - current->start) > LINE_LEN)
+ if ((current->end - current->start) > LINE_LEN)
current->end = current->start + LINE_LEN; /* not too long though. */
/* teraz czas na wkopiowanie stringu */
p=line;
/* finds the body of the subtitle_t */
- for (i=0; i<3; i++){
+ for (i=0; i<3; i++){
p2=strchr( p, ':');
if( p2 == NULL ) break;
p=p2+1;
- }
-
+ }
+
next=p;
i=0;
while( (next = sub_readtext( next, &(current->text[i]))) ) {
- if (current->text[i]==ERR)
+ if (current->text[i]==ERR)
return ERR;
i++;
- if (i>=SUB_MAX_TEXT) {
+ if (i>=SUB_MAX_TEXT) {
xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "Too many lines in a subtitle\n");
current->lines=i;
return current;
@@ -463,17 +463,17 @@ static subtitle_t *sub_read_line_vplayer(demux_sputext_t *this,subtitle_t *curre
static subtitle_t *sub_read_line_rt(demux_sputext_t *this,subtitle_t *current) {
/*
- * TODO: This format uses quite rich (sub/super)set of xhtml
+ * TODO: This format uses quite rich (sub/super)set of xhtml
* I couldn't check it since DTD is not included.
- * WARNING: full XML parses can be required for proper parsing
+ * WARNING: full XML parses can be required for proper parsing
*/
char line[LINE_LEN + 1];
int a1,a2,a3,a4,b1,b2,b3,b4;
char *p=NULL,*next=NULL;
int i,len,plen;
-
+
memset (current, 0, sizeof(subtitle_t));
-
+
while (!current->text[0]) {
if (!read_line_from_input(this, line, LINE_LEN)) return NULL;
/*
@@ -481,14 +481,14 @@ static subtitle_t *sub_read_line_rt(demux_sputext_t *this,subtitle_t *current) {
* to describe the same moment in time. Maybe there are even more formats in use.
*/
if ((len=sscanf (line, "<Time Begin=\"%d:%d:%d.%d\" End=\"%d:%d:%d.%d\"",&a1,&a2,&a3,&a4,&b1,&b2,&b3,&b4)) < 8)
-
+
plen=a1=a2=a3=a4=b1=b2=b3=b4=0;
if (
((len=sscanf (line, "<%*[tT]ime %*[bB]egin=\"%d:%d\" %*[Ee]nd=\"%d:%d\"%*[^<]<clear/>%n",&a2,&a3,&b2,&b3,&plen)) < 4) &&
((len=sscanf (line, "<%*[tT]ime %*[bB]egin=\"%d:%d\" %*[Ee]nd=\"%d:%d.%d\"%*[^<]<clear/>%n",&a2,&a3,&b2,&b3,&b4,&plen)) < 5) &&
/* ((len=sscanf (line, "<%*[tT]ime %*[bB]egin=\"%d:%d.%d\" %*[Ee]nd=\"%d:%d\"%*[^<]<clear/>%n",&a2,&a3,&a4,&b2,&b3,&plen)) < 5) && */
((len=sscanf (line, "<%*[tT]ime %*[bB]egin=\"%d:%d.%d\" %*[Ee]nd=\"%d:%d.%d\"%*[^<]<clear/>%n",&a2,&a3,&a4,&b2,&b3,&b4,&plen)) < 6) &&
- ((len=sscanf (line, "<%*[tT]ime %*[bB]egin=\"%d:%d:%d.%d\" %*[Ee]nd=\"%d:%d:%d.%d\"%*[^<]<clear/>%n",&a1,&a2,&a3,&a4,&b1,&b2,&b3,&b4,&plen)) < 8)
+ ((len=sscanf (line, "<%*[tT]ime %*[bB]egin=\"%d:%d:%d.%d\" %*[Ee]nd=\"%d:%d:%d.%d\"%*[^<]<clear/>%n",&a1,&a2,&a3,&a4,&b1,&b2,&b3,&b4,&plen)) < 8)
)
continue;
current->start = a1*360000+a2*6000+a3*100+a4/10;
@@ -497,10 +497,10 @@ static subtitle_t *sub_read_line_rt(demux_sputext_t *this,subtitle_t *current) {
/* TODO: I don't know what kind of convention is here for marking multiline subs, maybe <br/> like in xml? */
next = strstr(line,"<clear/>")+8;i=0;
while ((next =sub_readtext (next, &(current->text[i])))) {
- if (current->text[i]==ERR)
+ if (current->text[i]==ERR)
return ERR;
i++;
- if (i>=SUB_MAX_TEXT) {
+ if (i>=SUB_MAX_TEXT) {
xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "Too many lines in a subtitle\n");
current->lines=i;
return current;
@@ -515,47 +515,47 @@ static subtitle_t *sub_read_line_ssa(demux_sputext_t *this,subtitle_t *current)
int comma;
static int max_comma = 32; /* let's use 32 for the case that the */
/* amount of commas increase with newer SSA versions */
-
+
int hour1, min1, sec1, hunsec1, hour2, min2, sec2, hunsec2, nothing;
int num;
char line[LINE_LEN + 1], line3[LINE_LEN + 1], *line2;
char *tmp;
-
+
do {
if (!read_line_from_input(this, line, LINE_LEN)) return NULL;
} while (sscanf (line, "Dialogue: Marked=%d,%d:%d:%d.%d,%d:%d:%d.%d,"
"%[^\n\r]", &nothing,
- &hour1, &min1, &sec1, &hunsec1,
+ &hour1, &min1, &sec1, &hunsec1,
&hour2, &min2, &sec2, &hunsec2,
line3) < 9
&&
sscanf (line, "Dialogue: %d,%d:%d:%d.%d,%d:%d:%d.%d,"
"%[^\n\r]", &nothing,
- &hour1, &min1, &sec1, &hunsec1,
+ &hour1, &min1, &sec1, &hunsec1,
&hour2, &min2, &sec2, &hunsec2,
line3) < 9 );
-
+
line2=strchr(line3, ',');
if (!line2)
return NULL;
-
+
for (comma = 4; comma < max_comma; comma ++)
{
tmp = line2;
if(!(tmp=strchr(++tmp, ','))) break;
- if(*(++tmp) == ' ') break;
+ if(*(++tmp) == ' ') break;
/* a space after a comma means we're already in a sentence */
line2 = tmp;
}
-
+
if(comma < max_comma)max_comma = comma;
/* eliminate the trailing comma */
if(*line2 == ',') line2++;
-
+
current->lines=0;num=0;
current->start = 360000*hour1 + 6000*min1 + 100*sec1 + hunsec1;
current->end = 360000*hour2 + 6000*min2 + 100*sec2 + hunsec2;
-
+
while (((tmp=strstr(line2, "\\n")) != NULL) || ((tmp=strstr(line2, "\\N")) != NULL) ){
current->text[num] = strndup(line2, tmp-line2);
line2=tmp+2;
@@ -563,10 +563,10 @@ static subtitle_t *sub_read_line_ssa(demux_sputext_t *this,subtitle_t *current)
current->lines++;
if (current->lines >= SUB_MAX_TEXT) return current;
}
-
+
current->text[num]=strdup(line2);
current->lines++;
-
+
return current;
}
@@ -585,9 +585,9 @@ static subtitle_t *sub_read_line_pjs (demux_sputext_t *this, subtitle_t *current
char line[LINE_LEN + 1];
char text[LINE_LEN + 1];
char *s, *d;
-
+
memset (current, 0, sizeof(subtitle_t));
-
+
if (!read_line_from_input(this, line, LINE_LEN))
return NULL;
for (s = line; *s && isspace(*s); s++);
@@ -599,7 +599,7 @@ static subtitle_t *sub_read_line_pjs (demux_sputext_t *this, subtitle_t *current
/* the files I have are in tenths of second */
current->start *= 10;
current->end *= 10;
-
+
/* walk to the beggining of the string */
for (; *s; s++) if (*s==',') break;
if (*s) {
@@ -615,7 +615,7 @@ static subtitle_t *sub_read_line_pjs (demux_sputext_t *this, subtitle_t *current
*d=0;
current->text[0] = strdup(text);
current->lines = 1;
-
+
return current;
}
@@ -624,9 +624,9 @@ static subtitle_t *sub_read_line_mpsub (demux_sputext_t *this, subtitle_t *curre
float a,b;
int num=0;
char *p, *q;
-
+
do {
- if (!read_line_from_input(this, line, LINE_LEN))
+ if (!read_line_from_input(this, line, LINE_LEN))
return NULL;
} while (sscanf (line, "%f %f", &a, &b) !=2);
@@ -634,21 +634,21 @@ static subtitle_t *sub_read_line_mpsub (demux_sputext_t *this, subtitle_t *curre
current->start = (int) this->mpsub_position;
this->mpsub_position += (b*100.0);
current->end = (int) this->mpsub_position;
-
+
while (num < SUB_MAX_TEXT) {
- if (!read_line_from_input(this, line, LINE_LEN))
+ if (!read_line_from_input(this, line, LINE_LEN))
return NULL;
p=line;
- while (isspace(*p))
+ while (isspace(*p))
p++;
- if (eol(*p) && num > 0)
+ if (eol(*p) && num > 0)
return current;
- if (eol(*p))
+ if (eol(*p))
return NULL;
-
+
for (q=p; !eol(*q); q++);
*q='\0';
if (strlen(p)) {
@@ -656,9 +656,9 @@ static subtitle_t *sub_read_line_mpsub (demux_sputext_t *this, subtitle_t *curre
xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, ">%s<\n",p);
current->lines = ++num;
} else {
- if (num)
+ if (num)
return current;
- else
+ else
return NULL;
}
}
@@ -678,24 +678,24 @@ static subtitle_t *sub_read_line_aqt (demux_sputext_t *this, subtitle_t *current
if (!(sscanf (line, "-->> %ld", &(current->start)) <1))
break;
}
-
+
if (!read_line_from_input(this, line, LINE_LEN))
return NULL;
-
+
sub_readtext((char *) &line,&current->text[0]);
current->lines = 1;
current->end = -1;
-
+
if (!read_line_from_input(this, line, LINE_LEN))
return current;;
-
+
sub_readtext((char *) &line,&current->text[1]);
current->lines = 2;
-
+
if ((current->text[0][0]==0) && (current->text[1][0]==0)) {
return NULL;
}
-
+
return current;
}
@@ -856,13 +856,13 @@ static subtitle_t *sub_read_line_jacobsub(demux_sputext_t *this, subtitle_t *cur
++p,++p;
break;
}
- if ((*(p + 1) == 'B') || (*(p + 1) == 'b') ||
+ if ((*(p + 1) == 'B') || (*(p + 1) == 'b') ||
/* actually this means "insert current date here" */
- (*(p + 1) == 'D') ||
- (*(p + 1) == 'I') || (*(p + 1) == 'i') ||
- (*(p + 1) == 'N') ||
+ (*(p + 1) == 'D') ||
+ (*(p + 1) == 'I') || (*(p + 1) == 'i') ||
+ (*(p + 1) == 'N') ||
/* actually this means "insert current time here" */
- (*(p + 1) == 'T') ||
+ (*(p + 1) == 'T') ||
(*(p + 1) == 'U') || (*(p + 1) == 'u')) {
++p;
break;
@@ -901,7 +901,7 @@ static subtitle_t *sub_read_line_subviewer2(demux_sputext_t *this, subtitle_t *c
int a1,a2,a3,a4;
char *p=NULL;
int i,len;
-
+
while (!current->text[0]) {
if (!read_line_from_input(this, line, LINE_LEN)) return NULL;
if (line[0]!='{')
@@ -932,9 +932,9 @@ static subtitle_t *sub_read_line_subrip09 (demux_sputext_t *this, subtitle_t *cu
char *next;
int h, m, s;
int i;
-
+
memset (current, 0, sizeof(subtitle_t));
-
+
do {
if (!read_line_from_input (this, line, LINE_LEN)) return NULL;
} while (sscanf (line, "[%d:%d:%d]", &h, &m, &s) != 3);
@@ -949,14 +949,14 @@ static subtitle_t *sub_read_line_subrip09 (demux_sputext_t *this, subtitle_t *cu
while ((next = sub_readtext (next, &(current->text[i])))) {
if (current->text[i]==ERR) return ERR;
i++;
- if (i>=SUB_MAX_TEXT) {
+ if (i>=SUB_MAX_TEXT) {
xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "Too many lines in a subtitle\n");
current->lines=i;
return current;
}
}
current->lines= ++i;
-
+
return current;
}
@@ -1002,7 +1002,7 @@ static int sub_autodetect (demux_sputext_t *this) {
char line[LINE_LEN + 1];
int i, j=0;
char p;
-
+
while (j < 100) {
j++;
if (!read_line_from_input(this, line, LINE_LEN))
@@ -1034,7 +1034,7 @@ static int sub_autodetect (demux_sputext_t *this) {
}
if (strstr (line, "<SAMI>")) {
- this->uses_time=1;
+ this->uses_time=1;
xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "sami subtitle format detected\n");
return FORMAT_SAMI;
}
@@ -1053,7 +1053,7 @@ static int sub_autodetect (demux_sputext_t *this) {
return FORMAT_RT;
}
if ((!memcmp(line, "Dialogue: Marked", 16)) || (!memcmp(line, "Dialogue: ", 10))) {
- this->uses_time=1;
+ this->uses_time=1;
xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "ssa subtitle format detected\n");
return FORMAT_SSA;
}
@@ -1063,17 +1063,17 @@ static int sub_autodetect (demux_sputext_t *this) {
return FORMAT_PJS;
}
if (sscanf (line, "FORMAT=%d", &i) == 1) {
- this->uses_time=0;
+ this->uses_time=0;
xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "mpsub subtitle format detected\n");
return FORMAT_MPSUB;
}
if (sscanf (line, "FORMAT=TIM%c", &p)==1 && p=='E') {
- this->uses_time=1;
+ this->uses_time=1;
xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "mpsub subtitle format detected\n");
return FORMAT_MPSUB;
}
if (strstr (line, "-->>")) {
- this->uses_time=0;
+ this->uses_time=0;
xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "aqtitle subtitle format detected\n");
return FORMAT_AQTITLE;
}
@@ -1093,7 +1093,7 @@ static int sub_autodetect (demux_sputext_t *this) {
xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "subrip 0.9 subtitle format detected\n");
return FORMAT_SUBRIP09;
}
-
+
if (sscanf (line, "[%d][%d]", &i, &i) == 2) {
this->uses_time = 1;
xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "mpl2 subtitle format detected\n");
@@ -1140,7 +1140,7 @@ static subtitle_t *sub_read_file (demux_sputext_t *this) {
}
xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "Detected subtitle file format: %d\n",this->format);
-
+
/* Rewind */
if(this->input->seek(this->input, 0, SEEK_SET) == -1) {
xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "seek failed.\n");
@@ -1166,15 +1166,15 @@ static subtitle_t *sub_read_file (demux_sputext_t *this) {
sub = func[this->format] (this, &first[this->num]);
- if (!sub)
+ if (!sub)
break; /* EOF */
- if (sub==ERR)
- ++this->errs;
+ if (sub==ERR)
+ ++this->errs;
else {
if (this->num > 0 && first[this->num-1].end == -1) {
/* end time not defined in the subtitle */
- if (timeout > 0) {
+ if (timeout > 0) {
/* timeout */
if (timeout > sub->start - first[this->num-1].start) {
first[this->num-1].end = sub->start;
@@ -1199,14 +1199,14 @@ static subtitle_t *sub_read_file (demux_sputext_t *this) {
sprintf(buffer, "Read %i subtitles", this->num);
- if(this->errs)
+ if(this->errs)
sprintf(buffer + strlen(buffer), ", %i bad line(s).\n", this->errs);
else
strcat(buffer, "\n");
-
+
xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "%s", buffer);
}
-
+
return first;
}
@@ -1217,12 +1217,12 @@ static int demux_sputext_next (demux_sputext_t *this_gen) {
char *str;
subtitle_t *sub;
int line;
-
+
if (this->cur >= this->num)
return 0;
sub = &this->subtitles[this->cur];
-
+
buf = this->stream->video_fifo->buffer_pool_alloc(this->stream->video_fifo);
buf->type = BUF_SPU_TEXT;
buf->pts = 0;
@@ -1237,17 +1237,17 @@ static int demux_sputext_next (demux_sputext_t *this_gen) {
strncpy(str, sub->text[line], SUB_BUFSIZE-1);
str[SUB_BUFSIZE-1] = '\0';
}
-
+
this->stream->video_fifo->put(this->stream->video_fifo, buf);
this->cur++;
-
+
return 1;
}
static void demux_sputext_dispose (demux_plugin_t *this_gen) {
demux_sputext_t *this = (demux_sputext_t *) this_gen;
int i, l;
-
+
for (i = 0; i < this->num; i++) {
for (l = 0; l < this->subtitles[i].lines; l++)
free(this->subtitles[i].text[l]);
@@ -1273,7 +1273,7 @@ static int demux_sputext_get_stream_length (demux_plugin_t *this_gen) {
static int demux_sputext_send_chunk (demux_plugin_t *this_gen) {
demux_sputext_t *this = (demux_sputext_t *) this_gen;
-
+
if (!demux_sputext_next (this)) {
this->status = DEMUX_FINISHED;
}
@@ -1287,25 +1287,25 @@ static int demux_sputext_seek (demux_plugin_t *this_gen,
lprintf("seek() called\n");
- /* simple seeking approach: just go back to start.
+ /* simple seeking approach: just go back to start.
* decoder will discard subtitles until the desired position.
*/
this->cur = 0;
this->status = DEMUX_OK;
-
+
_x_demux_flush_engine (this->stream);
_x_demux_control_newpts(this->stream, 0, 0);
-
+
return this->status;
}
static void demux_sputext_send_headers(demux_plugin_t *this_gen) {
demux_sputext_t *this = (demux_sputext_t*)this_gen;
buf_element_t *buf;
-
+
lprintf("send_headers() called\n");
-
+
_x_demux_control_start(this->stream);
_x_stream_info_set(this->stream, XINE_STREAM_INFO_HAS_VIDEO, 0);
_x_stream_info_set(this->stream, XINE_STREAM_INFO_HAS_AUDIO, 0);
@@ -1315,7 +1315,7 @@ static void demux_sputext_send_headers(demux_plugin_t *this_gen) {
buf->type = BUF_CONTROL_SPU_CHANNEL;
buf->decoder_info[0] = buf->decoder_info[1] = buf->decoder_info[2] = 0;
this->stream->video_fifo->put(this->stream->video_fifo, buf);
-
+
this->status = DEMUX_OK;
}
@@ -1345,7 +1345,7 @@ static demux_plugin_t *open_demux_plugin (demux_class_t *class_gen, xine_stream_
demux_sputext_t *this;
lprintf("open_plugin() called\n");
-
+
this = calloc(1, sizeof (demux_sputext_t));
this->stream = stream;
this->input = input;
@@ -1380,26 +1380,26 @@ static demux_plugin_t *open_demux_plugin (demux_class_t *class_gen, xine_stream_
}
}
/* falling through is intended */
-
+
case METHOD_EXPLICIT:
/* case METHOD_BY_CONTENT: */
-
+
/* FIXME: for now this demuxer only works when requested explicitly
* to make sure it does not interfere with others;
* If this is found too inconvenient, this may be changed after making
* sure the content detection does not produce any false positives.
*/
-
+
if ((input->get_capabilities(input) & INPUT_CAP_SEEKABLE) != 0) {
-
+
this->subtitles = sub_read_file (this);
this->cur = 0;
if (this->subtitles) {
- xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "subtitle format %s time.\n",
+ xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "subtitle format %s time.\n",
this->uses_time ? "uses" : "doesn't use");
- xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG,
+ xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG,
"read %i subtitles, %i errors.\n", this->num, this->errs);
return &this->demux_plugin;
}
@@ -1410,7 +1410,7 @@ static demux_plugin_t *open_demux_plugin (demux_class_t *class_gen, xine_stream_
free (this);
return NULL;
}
-
+
static void config_timeout_cb(void *this_gen, xine_cfg_entry_t *entry) {
demux_sputext_class_t *this = (demux_sputext_class_t *)this_gen;
@@ -1434,13 +1434,13 @@ void *init_sputext_demux_class (xine_t *xine, void *data) {
this->demux_class.extensions = "asc txt sub srt smi ssa";
this->demux_class.dispose = default_demux_class_dispose;
- /*
+ /*
* Some subtitling formats, namely AQT and Subrip09, define the end of a
- * subtitle as the beginning of the following. From end-user view it's
+ * subtitle as the beginning of the following. From end-user view it's
* better define timeout of hidding. Setting to zero means "no timeout".
*/
- this->max_timeout = xine->config->register_num(xine->config,
- "subtitles.separate.timeout", 4,
+ this->max_timeout = xine->config->register_num(xine->config,
+ "subtitles.separate.timeout", 4,
_("default duration of subtitle display in seconds"),
_("Some subtitle formats do not explicitly give a duration for each subtitle. "
"For these, you can set a default duration here. Setting to zero will result "
diff --git a/src/spu_dec/xine_cc_decoder.c b/src/spu_dec/xine_cc_decoder.c
index d9a425d60..fc69304cc 100644
--- a/src/spu_dec/xine_cc_decoder.c
+++ b/src/spu_dec/xine_cc_decoder.c
@@ -1,23 +1,23 @@
/*
* Copyright (C) 2000-2008 the xine project
- *
+ *
* This file is part of xine, a free video player.
- *
+ *
* xine is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* xine is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
*
- * closed caption spu decoder. receive data by events.
+ * closed caption spu decoder. receive data by events.
*/
#ifdef HAVE_CONFIG_H
@@ -47,7 +47,7 @@ typedef struct spucc_decoder_s {
spu_decoder_t spu_decoder;
xine_stream_t *stream;
-
+
/* closed captioning decoder state */
cc_decoder_t *ccdec;
/* true if ccdec has been initialized */
@@ -64,7 +64,7 @@ typedef struct spucc_decoder_s {
/* events will be sent here */
xine_event_queue_t *queue;
-
+
} spucc_decoder_t;
@@ -157,7 +157,7 @@ static void spucc_font_change(void *this_gen, xine_cfg_entry_t *value)
spucc_class_t *this = (spucc_class_t *) this_gen;
cc_config_t *cc_cfg = &this->cc_cfg;
char *font;
-
+
if (strcmp(value->key, "subtitles.closedcaption.font") == 0)
font = cc_cfg->font;
else
@@ -176,7 +176,7 @@ static void spucc_num_change(void *this_gen, xine_cfg_entry_t *value)
spucc_class_t *this = (spucc_class_t *) this_gen;
cc_config_t *cc_cfg = &this->cc_cfg;
int *num;
-
+
if (strcmp(value->key, "subtitles.closedcaption.font_size") == 0)
num = &cc_cfg->font_size;
else
@@ -200,7 +200,7 @@ static void spucc_register_cfg_vars(spucc_class_t *this,
_("Closed Captions are subtitles mostly meant "
"to help the hearing impaired."),
0, spucc_cfg_enable_change, this);
-
+
cc_vars->cc_scheme = xine_cfg->register_enum(xine_cfg,
"subtitles.closedcaption.scheme", 0,
(char **)cc_schemes,
@@ -208,27 +208,27 @@ static void spucc_register_cfg_vars(spucc_class_t *this,
_("Choose your favourite rendering of the closed "
"captions."),
10, spucc_cfg_scheme_change, this);
-
- copy_str(cc_vars->font,
+
+ copy_str(cc_vars->font,
xine_cfg->register_string(xine_cfg, "subtitles.closedcaption.font", "cc",
_("standard closed captioning font"),
_("Choose the font for standard closed captions text."),
20, spucc_font_change, this),
CC_FONT_MAX);
-
+
copy_str(cc_vars->italic_font,
xine_cfg->register_string(xine_cfg, "subtitles.closedcaption.italic_font", "cci",
_("italic closed captioning font"),
_("Choose the font for italic closed captions text."),
20, spucc_font_change, this),
CC_FONT_MAX);
-
+
cc_vars->font_size = xine_cfg->register_num(xine_cfg, "subtitles.closedcaption.font_size",
24,
_("closed captioning font size"),
_("Choose the font size for closed captions text."),
10, spucc_num_change, this);
-
+
cc_vars->center = xine_cfg->register_bool(xine_cfg, "subtitles.closedcaption.center", 1,
_("center-adjust closed captions"),
_("When enabled, closed captions will be positioned "
@@ -238,7 +238,7 @@ static void spucc_register_cfg_vars(spucc_class_t *this,
/* called when the video frame size changes */
-static void spucc_notify_frame_change(spucc_decoder_t *this,
+static void spucc_notify_frame_change(spucc_decoder_t *this,
int width, int height) {
#ifdef LOG_DEBUG
printf("spucc: new frame size: %dx%d\n", width, height);
@@ -255,14 +255,14 @@ static void spucc_notify_frame_change(spucc_decoder_t *this,
static void spudec_decode_data (spu_decoder_t *this_gen, buf_element_t *buf) {
spucc_decoder_t *this = (spucc_decoder_t *) this_gen;
xine_event_t *event;
-
+
while ((event = xine_event_get(this->queue))) {
switch (event->type) {
case XINE_EVENT_FRAME_FORMAT_CHANGE:
{
- xine_format_change_data_t *frame_change =
+ xine_format_change_data_t *frame_change =
(xine_format_change_data_t *)event->data;
-
+
spucc_notify_frame_change(this, frame_change->width,
frame_change->height);
}
@@ -270,17 +270,17 @@ static void spudec_decode_data (spu_decoder_t *this_gen, buf_element_t *buf) {
}
xine_event_free(event);
}
-
+
if (buf->decoder_flags & BUF_FLAG_PREVIEW) {
} else {
-
+
if (this->cc_state.cc_cfg->config_version > this->config_version) {
spucc_update_intrinsics(this);
if (!this->cc_state.cc_cfg->cc_enabled)
spucc_do_close(this);
this->config_version = this->cc_state.cc_cfg->config_version;
}
-
+
if (this->cc_state.cc_cfg->cc_enabled) {
if( !this->cc_open )
spucc_do_init (this);
@@ -290,7 +290,7 @@ static void spudec_decode_data (spu_decoder_t *this_gen, buf_element_t *buf) {
}
}
}
-}
+}
static void spudec_reset (spu_decoder_t *this_gen) {
}
@@ -342,7 +342,7 @@ static void *init_spu_decoder_plugin (xine_t *xine, void *data) {
spucc_register_cfg_vars(this, xine->config);
this->cc_cfg.config_version = 0;
-
+
return &this->spu_class;
}
@@ -355,7 +355,7 @@ static const decoder_info_t spudec_info = {
};
const plugin_info_t xine_plugin_info[] EXPORTED = {
- /* type, API, "name", version, special_info, init_function */
+ /* type, API, "name", version, special_info, init_function */
{ PLUGIN_SPU_DECODER, 17, "spucc", XINE_VERSION_CODE, &spudec_info, &init_spu_decoder_plugin },
{ PLUGIN_NONE, 0, "", 0, NULL, NULL }
};