Skip to content

Commit

Permalink
Update Cta608Parser.ts
Browse files Browse the repository at this point in the history
Ported over changes from Dash-Industry-Forum/dash.js#3719

Signed-off-by: Agajan Jumakuliyev <[email protected]>
  • Loading branch information
agajassi committed Jun 5, 2024
1 parent 0c43555 commit 16bc194
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/src/cta/608/Cta608Parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ export class Cta608Parser {
private currentChannel: Channels = 0;
private cmdHistory: CmdHistory = createCmdHistory();
private logger: CaptionsLogger;
private lastTime: number | null = null;

constructor(field: SupportedField, out1: any, out2: any) {
const logger = (this.logger = new CaptionsLogger());
Expand All @@ -83,6 +84,7 @@ export class Cta608Parser {
* @param byteList - The list of bytes
*/
addData(time: number | null, byteList: number[]): void {
this.lastTime = time;
this.logger.time = time;

for (let i = 0; i < byteList.length; i += 2) {
Expand All @@ -91,6 +93,11 @@ export class Cta608Parser {
let cmdFound: boolean = false;
let charsFound: number[] | null = null;

if (this.lastTime !== null) {
time = this.lastTime + 0.5 * i * 1001 / 30000;
this.logger.time = time;
}

if (a === 0 && b === 0) {
continue;
}
Expand Down

0 comments on commit 16bc194

Please sign in to comment.