Commit fd749705 authored by Grigori Goronzy's avatar Grigori Goronzy Committed by Jean-Baptiste Kempf

Subtitles/SSA: enable reordering after load

Use currently unused code to sort subtitle lines after they have been loaded.
Closes #3734.
parent 925f5e02
...@@ -226,7 +226,7 @@ static const struct ...@@ -226,7 +226,7 @@ static const struct
static int Demux( demux_t * ); static int Demux( demux_t * );
static int Control( demux_t *, int, va_list ); static int Control( demux_t *, int, va_list );
/*static void Fix( demux_t * );*/ static void Fix( demux_t * );
/***************************************************************************** /*****************************************************************************
* Module initializer * Module initializer
...@@ -518,6 +518,7 @@ static int Open ( vlc_object_t *p_this ) ...@@ -518,6 +518,7 @@ static int Open ( vlc_object_t *p_this )
p_sys->i_type == SUB_TYPE_SSA2_4 || p_sys->i_type == SUB_TYPE_SSA2_4 ||
p_sys->i_type == SUB_TYPE_ASS ) p_sys->i_type == SUB_TYPE_ASS )
{ {
Fix( p_demux );
es_format_Init( &fmt, SPU_ES, VLC_CODEC_SSA ); es_format_Init( &fmt, SPU_ES, VLC_CODEC_SSA );
} }
else else
...@@ -708,12 +709,10 @@ static int Demux( demux_t *p_demux ) ...@@ -708,12 +709,10 @@ static int Demux( demux_t *p_demux )
/***************************************************************************** /*****************************************************************************
* Fix: fix time stamp and order of subtitle * Fix: fix time stamp and order of subtitle
*****************************************************************************/ *****************************************************************************/
#ifdef USE_THIS_UNUSED_PIECE_OF_CODE
static void Fix( demux_t *p_demux ) static void Fix( demux_t *p_demux )
{ {
demux_sys_t *p_sys = p_demux->p_sys; demux_sys_t *p_sys = p_demux->p_sys;
bool b_done; bool b_done;
int i_index;
/* *** fix order (to be sure...) *** */ /* *** fix order (to be sure...) *** */
/* We suppose that there are near in order and this durty bubble sort /* We suppose that there are near in order and this durty bubble sort
...@@ -722,7 +721,7 @@ static void Fix( demux_t *p_demux ) ...@@ -722,7 +721,7 @@ static void Fix( demux_t *p_demux )
do do
{ {
b_done = true; b_done = true;
for( i_index = 1; i_index < p_sys->i_subtitles; i_index++ ) for( int i_index = 1; i_index < p_sys->i_subtitles; i_index++ )
{ {
if( p_sys->subtitle[i_index].i_start < if( p_sys->subtitle[i_index].i_start <
p_sys->subtitle[i_index - 1].i_start ) p_sys->subtitle[i_index - 1].i_start )
...@@ -742,7 +741,6 @@ static void Fix( demux_t *p_demux ) ...@@ -742,7 +741,6 @@ static void Fix( demux_t *p_demux )
} }
} while( !b_done ); } while( !b_done );
} }
#endif
static int TextLoad( text_t *txt, stream_t *s ) static int TextLoad( text_t *txt, stream_t *s )
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment