Commit afaea620 authored by Laurent Aimar's avatar Laurent Aimar

Used name in UTF-16 format for embed AVI subtitles (close #2357).

parent 7edb3125
...@@ -2498,11 +2498,13 @@ static void AVI_ExtractSubtitle( demux_t *p_demux, ...@@ -2498,11 +2498,13 @@ static void AVI_ExtractSubtitle( demux_t *p_demux,
demux_sys_t *p_sys = p_demux->p_sys; demux_sys_t *p_sys = p_demux->p_sys;
block_t *p_block = NULL; block_t *p_block = NULL;
input_attachment_t *p_attachment = NULL; input_attachment_t *p_attachment = NULL;
char *psz_description = NULL;
avi_chunk_indx_t *p_indx = NULL;
if( !p_sys->b_seekable ) if( !p_sys->b_seekable )
goto exit; goto exit;
avi_chunk_indx_t *p_indx = AVI_ChunkFind( p_strl, AVIFOURCC_indx, 0 ); p_indx = AVI_ChunkFind( p_strl, AVIFOURCC_indx, 0 );
if( !p_indx ) if( !p_indx )
goto exit; goto exit;
...@@ -2548,6 +2550,8 @@ static void AVI_ExtractSubtitle( demux_t *p_demux, ...@@ -2548,6 +2550,8 @@ static void AVI_ExtractSubtitle( demux_t *p_demux,
const unsigned i_name = GetDWLE( &p[7] ); const unsigned i_name = GetDWLE( &p[7] );
if( 11 + i_size <= i_name ) if( 11 + i_size <= i_name )
goto exit; goto exit;
if( i_name > 0 )
psz_description = FromCharset( "UTF-16LE", &p[11], i_name );
p += 11 + i_name; p += 11 + i_name;
i_size -= 11 + i_name; i_size -= 11 + i_name;
if( i_size < 6 || GetWLE( &p[0] ) != 0x04 ) if( i_size < 6 || GetWLE( &p[0] ) != 0x04 )
...@@ -2558,7 +2562,8 @@ static void AVI_ExtractSubtitle( demux_t *p_demux, ...@@ -2558,7 +2562,8 @@ static void AVI_ExtractSubtitle( demux_t *p_demux,
p += 6; p += 6;
i_size -= 6; i_size -= 6;
char *psz_description = p_strn ? FromLatin1( p_strn->p_str ) : NULL; if( !psz_description )
psz_description = p_strn ? FromLatin1( p_strn->p_str ) : NULL;
char *psz_name; char *psz_name;
if( asprintf( &psz_name, "subtitle%d.srt", p_sys->i_attachment ) <= 0 ) if( asprintf( &psz_name, "subtitle%d.srt", p_sys->i_attachment ) <= 0 )
psz_name = NULL; psz_name = NULL;
...@@ -2569,9 +2574,10 @@ static void AVI_ExtractSubtitle( demux_t *p_demux, ...@@ -2569,9 +2574,10 @@ static void AVI_ExtractSubtitle( demux_t *p_demux,
if( p_attachment ) if( p_attachment )
TAB_APPEND( p_sys->i_attachment, p_sys->attachment, p_attachment ); TAB_APPEND( p_sys->i_attachment, p_sys->attachment, p_attachment );
free( psz_name ); free( psz_name );
free( psz_description );
exit: exit:
free( psz_description );
if( p_block ) if( p_block )
block_Release( p_block ); block_Release( p_block );
......
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