diff options
author | Miguel Freitas <miguelfreitas@users.sourceforge.net> | 2003-03-26 11:06:39 +0000 |
---|---|---|
committer | Miguel Freitas <miguelfreitas@users.sourceforge.net> | 2003-03-26 11:06:39 +0000 |
commit | 28bb8ccf2791599f24ec705c6075a747d7f10030 (patch) | |
tree | 14b1ea6d20fe7c1911ca662f7ad4ca665084ba7f /src/libsputext | |
parent | d042d5ac0e7ba8d77136c465a94c5683b16a0c9a (diff) | |
download | xine-lib-28bb8ccf2791599f24ec705c6075a747d7f10030.tar.gz xine-lib-28bb8ccf2791599f24ec705c6075a747d7f10030.tar.bz2 |
- font encoding cleanup patch by Frantisek Dvorak
- xinefonts use unicode now
- fix endianess in xine-fontconv.c
- public render text api uses locale
CVS patchset: 4486
CVS date: 2003/03/26 11:06:39
Diffstat (limited to 'src/libsputext')
-rw-r--r-- | src/libsputext/demux_sputext.c | 55 | ||||
-rw-r--r-- | src/libsputext/xine_decoder.c | 34 |
2 files changed, 26 insertions, 63 deletions
diff --git a/src/libsputext/demux_sputext.c b/src/libsputext/demux_sputext.c index 53cb182a2..db0c96b59 100644 --- a/src/libsputext/demux_sputext.c +++ b/src/libsputext/demux_sputext.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: demux_sputext.c,v 1.12 2003/02/14 16:58:36 f1rmb Exp $ + * $Id: demux_sputext.c,v 1.13 2003/03/26 11:06:56 miguelfreitas Exp $ * * code based on old libsputext/xine_decoder.c * @@ -42,7 +42,6 @@ #include <sys/stat.h> #include <fcntl.h> #include <ctype.h> -#include <iconv.h> #include "xine_internal.h" #include "xineutils.h" @@ -707,7 +706,6 @@ static subtitle_t *sub_read_file (demux_sputext_t *this) { sub_read_line_aqt }; - iconv_t iconv_descr; this->format=sub_autodetect (this); if (this->format==-1) { @@ -725,10 +723,9 @@ static subtitle_t *sub_read_file (demux_sputext_t *this) { first = (subtitle_t *) xine_xmalloc(n_max*sizeof(subtitle_t)); if(!first) return NULL; - iconv_descr=iconv_open(class->dst_encoding,class->src_encoding); - while(1){ subtitle_t *sub; + if(this->num>=n_max){ n_max+=16; first=realloc(first,n_max*sizeof(subtitle_t)); @@ -746,28 +743,9 @@ static subtitle_t *sub_read_file (demux_sputext_t *this) { if (this->num > 0 && first[this->num-1].end == -1) { first[this->num-1].end = sub->start; } - for(i=0; i<first[this->num].lines; i++) - { char *tmp; - char *in_buff, *out_buff; - int in_len, out_len; - - in_len=strlen(first[this->num].text[i])+1; - tmp=malloc(in_len); - in_buff=first[this->num].text[i]; - out_buff=tmp; - out_len=in_len; - if ((size_t)(-1)!=iconv(iconv_descr,&in_buff,&in_len,&out_buff,&out_len)) - { free(first[this->num].text[i]); - first[this->num].text[i]=tmp; - } - else { - printf("demux_sputext: Can't convert subtitle text\n"); - } - } ++this->num; /* Error vs. Valid */ } } - iconv_close(iconv_descr); printf ("demux_sputext: Read %i subtitles", this->num); if (this->errs) @@ -778,24 +756,6 @@ static subtitle_t *sub_read_file (demux_sputext_t *this) { return first; } -static void update_osd_src_encoding(void *this_gen, xine_cfg_entry_t *entry) -{ - demux_sputext_class_t *class = (demux_sputext_class_t *)this_gen; - - class->src_encoding = entry->str_value; - - printf("demux_sputext: spu_src_encoding = %s\n", class->src_encoding ); -} - -static void update_osd_dst_encoding(void *this_gen, xine_cfg_entry_t *entry) -{ - demux_sputext_class_t *class = (demux_sputext_class_t *)this_gen; - - class->dst_encoding = entry->str_value; - - printf("demux_sputext: spu_dst_encoding = %s\n", class->dst_encoding ); -} - static int demux_sputext_next (demux_sputext_t *this_gen) { demux_sputext_t *this = (demux_sputext_t *) this_gen; buf_element_t *buf; @@ -1022,17 +982,6 @@ static void *init_sputext_demux_class (xine_t *xine, void *data) { this->demux_class.get_extensions = get_demux_extensions; this->demux_class.dispose = demux_class_dispose; - this->src_encoding = xine->config->register_string(xine->config, - "misc.spu_src_encoding", - "windows-1250", - _("source encoding of subtitles"), - NULL, 10, update_osd_src_encoding, this); - this->dst_encoding = xine->config->register_string(xine->config, - "misc.spu_dst_encoding", - "iso-8859-2", - _("target encoding for subtitles (have to match font encoding)"), - NULL, 10, update_osd_dst_encoding, this); - return this; } diff --git a/src/libsputext/xine_decoder.c b/src/libsputext/xine_decoder.c index 3b7a7e1ad..4654b0c36 100644 --- a/src/libsputext/xine_decoder.c +++ b/src/libsputext/xine_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine_decoder.c,v 1.55 2003/03/20 20:44:18 f1rmb Exp $ + * $Id: xine_decoder.c,v 1.56 2003/03/26 11:06:56 miguelfreitas Exp $ * */ @@ -29,7 +29,6 @@ #include <sys/stat.h> #include <fcntl.h> #include <ctype.h> -#include <iconv.h> #include "buffer.h" #include "xine_internal.h" @@ -57,6 +56,8 @@ typedef enum { typedef struct sputext_class_s { spu_decoder_class_t class; + char *src_encoding; /* encoding of subtitle file */ + xine_t *xine; } sputext_class_t; @@ -79,11 +80,10 @@ typedef struct sputext_decoder_s { int master_started; int slave_started; - char *font; - subtitle_size subtitle_size; + char *font; /* subtitle font */ + subtitle_size subtitle_size; /* size of subtitles */ int vertical_offset; - osd_renderer_t *renderer; osd_object_t *osd; @@ -159,7 +159,8 @@ static void draw_subtitle(sputext_decoder_t *this, int64_t sub_start, int64_t su } this->renderer->render_text (this->osd, x, y + line*this->line_height, - this->text[line], OSD_TEXT1); + this->text[line], this->class->src_encoding, + OSD_TEXT1); } if( font_size != this->font_size ) @@ -407,19 +408,19 @@ static spu_decoder_t *sputext_class_open_plugin (spu_decoder_class_t *class_gen, this->stream = stream; this->font = class->xine->config->register_string(class->xine->config, - "codec.spu_font", + "misc.spu_font", "sans", - _("font for avi subtitles"), + _("font for external subtitles"), NULL, 0, update_osd_font, this); this->subtitle_size = class->xine->config->register_enum(class->xine->config, - "codec.spu_subtitle_size", + "misc.spu_subtitle_size", 1, subtitle_size_strings, _("subtitle size (relative window size)"), NULL, 0, update_subtitle_size, this); this->vertical_offset = class->xine->config->register_num(class->xine->config, - "codec.spu_vertical_offset", + "misc.spu_vertical_offset", 0, _("subtitle vertical offset (relative window size)"), NULL, 0, update_vertical_offset, this); @@ -439,6 +440,13 @@ static char *sputext_class_get_description (spu_decoder_class_t *this) { return "external subtitle decoder plugin"; } +static void update_src_encoding(void *this_gen, xine_cfg_entry_t *entry) +{ + sputext_class_t *this = (sputext_class_t *)this_gen; + + this->src_encoding = entry->str_value; + printf("libsputext: spu_src_encoding = %s\n", this->src_encoding ); +} static void *init_spu_decoder_plugin (xine_t *xine, void *data) { @@ -457,6 +465,12 @@ static void *init_spu_decoder_plugin (xine_t *xine, void *data) { this->xine = xine; + this->src_encoding = xine->config->register_string(xine->config, + "misc.spu_src_encoding", + "iso-8859-1", + _("encoding of subtitles"), + NULL, 10, update_src_encoding, this); + return &this->class; } |