-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: move CMAF HAM dependencies from lib to samples (#120)
Signed-off-by: Casey Occhialini <1508707+littlespex@users.noreply.github.com>
- Loading branch information
1 parent
98649c7
commit 9a56ebb
Showing
14 changed files
with
204 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import type { DashManifest } from '../../types/mapper/dash/DashManifest.js'; | ||
|
||
export type DashParser = (raw: string) => DashManifest; | ||
|
||
let dashParser: DashParser; | ||
|
||
/** | ||
* @internal | ||
*/ | ||
export function setDashParser(parser: DashParser): void { | ||
dashParser = parser; | ||
} | ||
|
||
/** | ||
* @internal | ||
*/ | ||
export function getDashParser(): DashParser { | ||
return dashParser; | ||
} | ||
|
||
/** | ||
* @internal | ||
* Parse XML to Json | ||
* | ||
* @param raw - Raw string containing the xml from the Dash Manifest | ||
* @returns json with the Dash Manifest structure | ||
*/ | ||
export function parseDashManifest(raw: string): DashManifest { | ||
return dashParser(raw); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import type { DashManifest } from '../../types/mapper/dash/DashManifest'; | ||
|
||
export type DashSerializer = (json: DashManifest) => string; | ||
|
||
let xmlSerializer: DashSerializer; | ||
|
||
/** | ||
* @internal | ||
*/ | ||
export function setDashSerializer(serializer: DashSerializer): void { | ||
xmlSerializer = serializer; | ||
} | ||
|
||
/** | ||
* @internal | ||
*/ | ||
export function getDashSerializer(): DashSerializer { | ||
return xmlSerializer; | ||
} | ||
|
||
export function serializeDashManifest(json: DashManifest): string { | ||
return xmlSerializer(json); | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,28 @@ | ||
// @ts-ignore | ||
import { Parser } from 'm3u8-parser'; | ||
import type { HlsManifest } from '../../types/mapper/hls/HlsManifest.js'; | ||
|
||
export function parseHlsManifest(text: string | undefined): HlsManifest { | ||
export type HlsParser = (text: string) => HlsManifest; | ||
|
||
let hlsParser: HlsParser; | ||
|
||
/** | ||
* @internal | ||
*/ | ||
export function setHlsParser(parser: HlsParser): void { | ||
hlsParser = parser; | ||
} | ||
|
||
/** | ||
* @internal | ||
*/ | ||
export function getHlsParser(): HlsParser { | ||
return hlsParser; | ||
} | ||
|
||
export function parseHlsManifest(text?: string): HlsManifest { | ||
if (!text) { | ||
console.error("Can't parse empty HLS Manifest"); | ||
return {} as HlsManifest; | ||
} | ||
|
||
const parser = new Parser(); | ||
|
||
parser.push(text); | ||
parser.end(); | ||
const parsedHlsManifest = parser.manifest; | ||
if (!parsedHlsManifest) { | ||
throw new Error(); | ||
} | ||
|
||
return parsedHlsManifest; | ||
return hlsParser(text); | ||
} |
Oops, something went wrong.