summaryrefslogtreecommitdiff
path: root/ttxtaudio.c
blob: 1d64e16af761cc02a7cf8812afd509380de086d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/*                                                                  -*- c++ -*-
 * ttxtaudio.c
 *
 *  Created on: Oct 31, 2012
 *      Author: Dimitar Petrovski
 */

#include "ttxtaudio.h"

int64_t cTtxtAudio::pts = 0;

cTtxtAudio::cTtxtAudio()
:cExternalAudio("TtxtAudio")
{
}

cTtxtAudio::~cTtxtAudio()
{
}

void cTtxtAudio::Play(const uchar* p, int Length, uchar Id)
{
  int64_t tmp_pts = 0;

  if (PesHasPts(p))
    tmp_pts = PesGetPts(p);
  if (tmp_pts != 0) {
    if ((pts > 0x1ffff0000LL) && (tmp_pts < 0x000100000LL)) {
      tmp_pts+=0x200000000LL;
    }
  }
  if (tmp_pts != pts) { pts=tmp_pts; }

}

void cTtxtAudio::PlayTs(const uchar* Data, int Length)
{
//  isyslog("ttxtsubs: cTtxtAudio::PlayTs");
    tsToPesTtxtAudio.PutTs(Data, Length);
    int l;
    if (const uchar *p = tsToPesTtxtAudio.GetPes(l)) {
       Play(p,l,0);
       tsToPesTtxtAudio.Reset();
    }
}