File tree Expand file tree Collapse file tree 6 files changed +828
-0
lines changed
test/parser/__snapshots__ Expand file tree Collapse file tree 6 files changed +828
-0
lines changed Original file line number Diff line number Diff line change @@ -67,6 +67,7 @@ export interface Media {
6767 channels ?: string ;
6868 default ?: boolean ;
6969 autoSelect ?: boolean ;
70+ characteristics ?: string [ ] ;
7071}
7172
7273export interface CueOut {
@@ -195,6 +196,9 @@ function parseLine(line: string): Tag | null {
195196 case "AUTOSELECT" :
196197 attrs . autoSelect = value === "YES" ? true : false ;
197198 break ;
199+ case "CHARACTERISTICS" :
200+ attrs . characteristics = value . split ( "," ) . map ( ( char ) => char . trim ( ) ) ;
201+ break ;
198202 }
199203 } ) ;
200204
@@ -213,6 +217,7 @@ function parseLine(line: string): Tag | null {
213217 channels : attrs . channels ,
214218 default : attrs . default ,
215219 autoSelect : attrs . autoSelect ,
220+ characteristics : attrs . characteristics ,
216221 } ,
217222 ] ;
218223 }
Original file line number Diff line number Diff line change @@ -34,6 +34,7 @@ function formatMasterPlaylist(tags: Tag[]): MasterPlaylist {
3434 language : value . language ,
3535 default : value . default ,
3636 autoSelect : value . autoSelect ,
37+ characteristics : value . characteristics ,
3738 } ) ;
3839 }
3940 if ( name === "EXT-X-STREAM-INF" ) {
Original file line number Diff line number Diff line change @@ -36,6 +36,9 @@ export function stringifyMasterPlaylist(playlist: MasterPlaylist) {
3636 if ( rendition . channels ) {
3737 attrs . push ( `CHANNELS="${ rendition . channels } "` ) ;
3838 }
39+ if ( rendition . characteristics ) {
40+ attrs . push ( `CHARACTERISTICS="${ rendition . characteristics . join ( "," ) } "` ) ;
41+ }
3942 lines . push ( `#EXT-X-MEDIA:${ attrs . join ( "," ) } ` ) ;
4043 } ) ;
4144
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ export interface Rendition {
1414 channels ?: string ;
1515 default ?: boolean ;
1616 autoSelect ?: boolean ;
17+ characteristics ?: string [ ] ;
1718}
1819
1920export interface Variant {
Original file line number Diff line number Diff line change @@ -38,6 +38,7 @@ exports[`parse master should parse with groups 1`] = `
3838 {
3939 " autoSelect" : true ,
4040 " channels" : undefined ,
41+ " characteristics" : undefined ,
4142 " default" : true ,
4243 " groupId" : " aud1" ,
4344 " language" : " eng" ,
@@ -48,6 +49,7 @@ exports[`parse master should parse with groups 1`] = `
4849 {
4950 " autoSelect" : true ,
5051 " channels" : undefined ,
52+ " characteristics" : undefined ,
5153 " default" : true ,
5254 " groupId" : " aud2" ,
5355 " language" : " nld" ,
@@ -58,6 +60,7 @@ exports[`parse master should parse with groups 1`] = `
5860 {
5961 " autoSelect" : true ,
6062 " channels" : undefined ,
63+ " characteristics" : undefined ,
6164 " default" : true ,
6265 " groupId" : " sub1" ,
6366 " language" : " eng" ,
@@ -100,6 +103,7 @@ exports[`parse master should parse with audio channels 1`] = `
100103 {
101104 " autoSelect" : true ,
102105 " channels" : " 6" ,
106+ " characteristics" : undefined ,
103107 " default" : true ,
104108 " groupId" : " aud1" ,
105109 " language" : " eng" ,
You can’t perform that action at this time.
0 commit comments