[vlc-devel] Subtitles Failed To Get Detected For peek_Readline Not Store The Text Encoding
Rémi Denis-Courmont
remi at remlab.net
Sat Nov 5 09:54:58 CET 2016
Hello,
Yes, I think you are right. I filed a bug to track the problem:
https://trac.videolan.org/vlc/ticket/17602
Best regards,
Le lauantaina 5. marraskuuta 2016, 10.25.05 EET 林作健 a écrit :
> When loading a UTF-16 encoded ass subtitle on Android devices, vlc
> always fails to load it.
> So I take a look, and find the bug.
> The bug is in subtitle_helper.h peek_Readline.
> This function will always new a memory stream, and try to read from it,
> then the memory stream get deleted.
> The new/delete operation is why the text encoding always lost.
> inline static char * peek_Readline( stream_t *p_demuxstream, uint64_t
> *pi_offset )
> {
> uint8_t *p_peek;
> ssize_t i_peek = vlc_stream_Peek( p_demuxstream, (const uint8_t **)
> &p_peek, *pi_offset + 2048 );
> if( i_peek < 0 || (uint64_t) i_peek < *pi_offset )
> return NULL;
>
> const uint64_t i_bufsize = (uint64_t) i_peek - *pi_offset;
> char *psz_line = NULL;
>
> /* Create a stream memory from that offset */
> stream_t *p_memorystream = vlc_stream_MemoryNew( p_demuxstream,
> &p_peek[*pi_offset],
> i_bufsize, true );
> if( p_memorystream )
> {
> psz_line = vlc_stream_ReadLine( p_memorystream );
>
> *pi_offset += vlc_stream_Tell( p_memorystream );
> vlc_stream_Delete( p_memorystream );
> }
>
> return psz_line;
> }
>
> the text encoding information stored in p_memorystream, will always
> lost for deletion.
>
> --
> LINZJ
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel
--
Rémi Denis-Courmont
http://www.remlab.net/
More information about the vlc-devel
mailing list