[vlc-commits] STL: correctly ignore user-data comments
Jean-Baptiste Kempf
git at videolan.org
Wed Jan 25 20:46:49 CET 2017
vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Wed Jan 25 20:34:34 2017 +0100| [f477d545a6c7d8440677eea3c5cba3bcb6ac1e7e] | committer: Jean-Baptiste Kempf
STL: correctly ignore user-data comments
Ref #10910 and FABst comments
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=f477d545a6c7d8440677eea3c5cba3bcb6ac1e7e
---
modules/codec/stl.c | 14 +++++++++++---
modules/demux/stl.c | 4 +++-
2 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/modules/codec/stl.c b/modules/codec/stl.c
index fee7b53..5be4d8a 100644
--- a/modules/codec/stl.c
+++ b/modules/codec/stl.c
@@ -119,12 +119,20 @@ static subpicture_t *Decode(decoder_t *dec, block_t **block)
if (b->i_buffer < 128)
goto exit;
- int payload_size = (b->i_buffer / 128) * 112;
- uint8_t *payload = malloc(payload_size);
+ int payload_size = 0;
+ uint8_t *payload = malloc((b->i_buffer / 128) * 112);
if (!payload)
goto exit;
+
+ /* */
+ int j = 0;
for (unsigned i = 0; i < b->i_buffer / 128; i++)
- memcpy(&payload[112 * i], &b->p_buffer[128 * i + 16], 112);
+ {
+ if( b->p_buffer[128 * i + 3] != 0xfe ) {
+ memcpy(&payload[112 * j++], &b->p_buffer[128 * i + 16], 112);
+ payload_size += 112;
+ }
+ }
sub = decoder_NewSubpicture(dec, NULL);
if (!sub) {
diff --git a/modules/demux/stl.c b/modules/demux/stl.c
index b9294aa..b3df928 100644
--- a/modules/demux/stl.c
+++ b/modules/demux/stl.c
@@ -135,12 +135,13 @@ static int Demux(demux_t *demux)
{
demux_sys_t *sys = demux->p_sys;
+ int prev_index = 0;
while(sys->current < sys->count) {
stl_entry_t *s = &sys->index[sys->current];
if (s->start > sys->next_date)
break;
- block_t *b = vlc_stream_Block(demux->s, 128 * s->count);
+ block_t *b = vlc_stream_Block(demux->s, 128 * (s->index - prev_index ));
if (b) {
b->i_dts =
b->i_pts = VLC_TS_0 + s->start;
@@ -149,6 +150,7 @@ static int Demux(demux_t *demux)
es_out_Send(demux->out, sys->es, b);
}
sys->current++;
+ prev_index = s->index;
}
return sys->current < sys->count ? 1 : 0;
}
More information about the vlc-commits
mailing list