Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
teletext subtitles: use the parsed PES data instead direct TS packets…
…, fixes #2788
  • Loading branch information
perexg committed Jun 16, 2015
1 parent ab30678 commit 200ba1f
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 19 deletions.
3 changes: 0 additions & 3 deletions src/input/mpegts/tsdemux.c
Expand Up @@ -103,9 +103,6 @@ ts_recv_packet0
if(!streaming_pad_probe_type(&t->s_streaming_pad, SMT_PACKET))
continue;

if(st->es_type == SCT_TELETEXT)
teletext_input(t, st, tsb);

if(off <= 188 && t->s_status == SERVICE_RUNNING)
parse_mpeg_ts((service_t*)t, st, tsb + off, 188 - off, pusi, error);

Expand Down
18 changes: 9 additions & 9 deletions src/parsers/parser_teletext.c
Expand Up @@ -946,21 +946,21 @@ tt_decode_line(mpegts_service_t *t, elementary_stream_t *st, uint8_t *buf)
*
*/
void
teletext_input(mpegts_service_t *t, elementary_stream_t *st, const uint8_t *tsb)
teletext_input
(mpegts_service_t *t, elementary_stream_t *st, const uint8_t *data, int len)
{
int i, j;
const uint8_t *x;
int j;
uint8_t buf[42];

x = tsb + 4;
for(i = 0; i < 4; i++) {
if(*x == 2 || *x == 3) {
data++; len--; /* first byte: 0x10 ? */

for (; len >= 46; data += 46, len -= 46) {
if (*data == 2 || *data == 3) {
for(j = 0; j < 42; j++)
buf[j] = bitreverse(x[4 + j]);
buf[j] = bitreverse(data[4 + j]);
tt_decode_line(t, st, buf);
}
x += 46;
}
}
}


Expand Down
4 changes: 2 additions & 2 deletions src/parsers/parser_teletext.h
Expand Up @@ -21,9 +21,9 @@

#define PID_TELETEXT_BASE 0x2000

#include "input/mpegts.h"
#include "input.h"

void teletext_input(struct mpegts_service *t, struct elementary_stream *st,
const uint8_t *tsb);
const uint8_t *data, int len);

#endif /* TELETEXT_H */
12 changes: 7 additions & 5 deletions src/parsers/parsers.c
Expand Up @@ -30,6 +30,7 @@
#include "parsers.h"
#include "parser_h264.h"
#include "parser_latm.h"
#include "parser_teletext.h"
#include "bitstream.h"
#include "packet.h"
#include "streaming.h"
Expand Down Expand Up @@ -1447,11 +1448,12 @@ parse_teletext(service_t *t, elementary_stream_t *st, const uint8_t *data,
buf = d + 6 + hlen;

if(psize >= 46) {
pkt = pkt_alloc(buf, psize, st->es_curpts, st->es_curdts);
pkt->pkt_commercial = t->s_tt_commercial_advice;
pkt->pkt_err = st->es_buf.sb_err;
parser_deliver(t, st, pkt);
sbuf_reset(&st->es_buf, 4000);
teletext_input((mpegts_service_t *)t, st, buf, psize);
pkt = pkt_alloc(buf, psize, st->es_curpts, st->es_curdts);
pkt->pkt_commercial = t->s_tt_commercial_advice;
pkt->pkt_err = st->es_buf.sb_err;
parser_deliver(t, st, pkt);
sbuf_reset(&st->es_buf, 4000);
}
}

Expand Down

0 comments on commit 200ba1f

Please sign in to comment.