mirror of
https://github.com/mpv-player/mpv
synced 2025-03-29 23:07:56 +00:00
This patch adds a call to subcp_recode1(), so this subtitles too are
processed through iconv(). Kresimir Kukulj madmax@iskon.hr git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@8619 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
64c7077884
commit
e29bcd7e02
@ -231,6 +231,9 @@ void demux_ogg_add_sub (char* packet) {
|
|||||||
|
|
||||||
mp_msg(MSGT_DEMUX,MSGL_DBG2,"ogg sub lines: %d first: '%s'\n",
|
mp_msg(MSGT_DEMUX,MSGL_DBG2,"ogg sub lines: %d first: '%s'\n",
|
||||||
ogg_sub.lines, ogg_sub.text[0]);
|
ogg_sub.lines, ogg_sub.text[0]);
|
||||||
|
#ifdef USE_ICONV
|
||||||
|
subcp_recode1(&ogg_sub);
|
||||||
|
#endif
|
||||||
vo_sub = &ogg_sub;
|
vo_sub = &ogg_sub;
|
||||||
vo_osd_changed(OSDTYPE_SUBTITLE);
|
vo_osd_changed(OSDTYPE_SUBTITLE);
|
||||||
}
|
}
|
||||||
@ -465,6 +468,10 @@ int demux_ogg_open(demuxer_t* demuxer) {
|
|||||||
sh_audio_t* sh_a;
|
sh_audio_t* sh_a;
|
||||||
sh_video_t* sh_v;
|
sh_video_t* sh_v;
|
||||||
|
|
||||||
|
#ifdef USE_ICONV
|
||||||
|
subcp_open();
|
||||||
|
#endif
|
||||||
|
|
||||||
s = demuxer->stream;
|
s = demuxer->stream;
|
||||||
|
|
||||||
ogg_d = (ogg_demuxer_t*)calloc(1,sizeof(ogg_demuxer_t));
|
ogg_d = (ogg_demuxer_t*)calloc(1,sizeof(ogg_demuxer_t));
|
||||||
@ -1006,6 +1013,10 @@ void demux_close_ogg(demuxer_t* demuxer) {
|
|||||||
if(!ogg_d)
|
if(!ogg_d)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
#ifdef USE_ICONV
|
||||||
|
subcp_close();
|
||||||
|
#endif
|
||||||
|
|
||||||
if(ogg_d->subs)
|
if(ogg_d->subs)
|
||||||
free(ogg_d->subs);
|
free(ogg_d->subs);
|
||||||
if(ogg_d->syncpoints)
|
if(ogg_d->syncpoints)
|
||||||
|
23
subreader.c
23
subreader.c
@ -964,6 +964,29 @@ subtitle* subcp_recode (subtitle *sub)
|
|||||||
return sub;
|
return sub;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// for demux_ogg.c:
|
||||||
|
subtitle* subcp_recode1 (subtitle *sub)
|
||||||
|
{
|
||||||
|
int l=sub->lines;
|
||||||
|
size_t ileft, oleft;
|
||||||
|
char *op, *ip;
|
||||||
|
|
||||||
|
while (l){
|
||||||
|
ip = icbuffer;
|
||||||
|
op = sub->text[--l];
|
||||||
|
strcpy(ip, op);
|
||||||
|
ileft = strlen(ip);
|
||||||
|
oleft = ICBUFFSIZE - 1;
|
||||||
|
|
||||||
|
if (iconv(icdsc, &ip, &ileft,
|
||||||
|
&op, &oleft) == (size_t)(-1)) {
|
||||||
|
mp_msg(MSGT_SUBREADER,MSGL_WARN,"SUB: error recoding line.\n");
|
||||||
|
return sub;
|
||||||
|
}
|
||||||
|
*op='\0' ;
|
||||||
|
}
|
||||||
|
return sub;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void adjust_subs_time(subtitle* sub, float subtime, float fps, int block){
|
static void adjust_subs_time(subtitle* sub, float subtime, float fps, int block){
|
||||||
|
@ -38,6 +38,7 @@ typedef struct {
|
|||||||
} subtitle;
|
} subtitle;
|
||||||
|
|
||||||
subtitle* sub_read_file (char *filename, float pts);
|
subtitle* sub_read_file (char *filename, float pts);
|
||||||
|
subtitle* subcp_recode1 (subtitle *sub);
|
||||||
char * sub_filename(char *path, char * fname);
|
char * sub_filename(char *path, char * fname);
|
||||||
void list_sub_file(subtitle* subs);
|
void list_sub_file(subtitle* subs);
|
||||||
void dump_srt(subtitle* subs, float fps);
|
void dump_srt(subtitle* subs, float fps);
|
||||||
|
Loading…
Reference in New Issue
Block a user