[vlc-devel] [vlc-commits] codec: t140: output merged segments
Francois Cartegnie
fcvlcdev at free.fr
Mon Jan 8 13:53:04 CET 2018
Le 08/01/2018 à 13:30, Rémi Denis-Courmont a écrit :
> Le 8 janvier 2018 19:10:53 GMT+08:00, Francois Cartegnie <git at videolan.org> a écrit :
>> vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Sun Jan
>> 7 16:16:35 2018 +0100| [02c0a4d4c43571ddff5d5b8d4f994d676f619630] |
>> committer: Francois Cartegnie
>>
>> codec: t140: output merged segments
>>
>>>
>> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=02c0a4d4c43571ddff5d5b8d4f994d676f619630
>> ---
>>
>> modules/codec/t140.c | 29 +++++++++++++++++++++++++----
>> 1 file changed, 25 insertions(+), 4 deletions(-)
>>
>> diff --git a/modules/codec/t140.c b/modules/codec/t140.c
>> index a4f186b1e7..0ffd274774 100644
>> --- a/modules/codec/t140.c
>> +++ b/modules/codec/t140.c
>> @@ -86,7 +86,7 @@ static block_t *Encode( encoder_t *p_enc,
>> subpicture_t *p_spu )
>>
>> subpicture_region_t *p_region;
>> block_t *p_block;
>> - size_t len;
>> + size_t len = 0;
>>
>> if( p_spu == NULL )
>> return NULL;
>> @@ -99,9 +99,30 @@ static block_t *Encode( encoder_t *p_enc,
>> subpicture_t *p_spu )
>> return NULL;
>>
>> /* This should already be UTF-8 encoded, so not much effort... */
>> - len = strlen( p_region->p_text->psz_text );
>> - p_block = block_Alloc( len );
>> - memcpy( p_block->p_buffer, p_region->p_text->psz_text, len );
>> + for( const text_segment_t *p_segment = p_region->p_text;
>> + p_segment; p_segment =
>> p_segment->p_next )
>> + {
>> + if( p_segment->psz_text == NULL )
>> + continue;
>> + len += strlen( p_segment->psz_text );
>> + }
>> +
>> + p_block = block_Alloc( len + 1 );
>> + if( !p_block )
>> + return NULL;
>> +
>> + p_block->i_buffer = 0;
>> + for( const text_segment_t *p_segment = p_region->p_text;
>> + p_segment; p_segment =
>> p_segment->p_next )
>> + {
>> + if( p_segment->psz_text == NULL )
>> + continue;
>> + len = strlen( p_segment->psz_text );
>> + memcpy( &p_block->p_buffer[p_block->i_buffer],
>> + p_segment->psz_text, len );
>> + p_block->i_buffer += len;
>> + }
>> + p_block->p_buffer[p_block->i_buffer] = 0;
>>
>> p_block->i_pts = p_block->i_dts = p_spu->i_start;
>> if( !p_spu->b_ephemer && ( p_spu->i_stop > p_spu->i_start ) )
>>
>> _______________________________________________
>> vlc-commits mailing list
>> vlc-commits at videolan.org
>> https://mailman.videolan.org/listinfo/vlc-commits
>
> Why that? IMO, merging T.140 partial payloads is the job of the RTP parser, not the decoder.
>
Because it never has been properly done when we changed to monolithic
string to segment struct.
Currently, that can only lose remaining of string if multiple segments.
Anyway, that module does not even work because transcode does not call
updater.
--
Francois Cartegnie
VideoLAN - VLC Developer
More information about the vlc-devel
mailing list