@@ -30,6 +30,8 @@ import { convertSupplementalCodecsToRFC6381 } from "./convert_supplemental_codec
3030import { getWEBMHDRInformation } from "./get_hdr_information.ts" ;
3131import type { IRepresentationIndexContext } from "./parse_representation_index.ts" ;
3232import parseRepresentationIndex from "./parse_representation_index.ts" ;
33+ import type { IDashUrlQueryInfo } from "./parse_url_query_info.ts" ;
34+ import { combineUrlQueryInfo , parseUrlQueryInfo } from "./parse_url_query_info.ts" ;
3335import resolveBaseURLs from "./resolve_base_urls.ts" ;
3436
3537/**
@@ -209,12 +211,48 @@ export default function parseRepresentations(
209211 } ) ) ;
210212
211213 // Construct Representation Base
214+ const representationUrlQueryInfo = parseUrlQueryInfo (
215+ representation . children . EssentialProperty ,
216+ representation . children . SupplementalProperty ,
217+ context . mpdUrl ,
218+ ) ;
219+ const urlQueryInfo =
220+ representationUrlQueryInfo === undefined
221+ ? context . urlQueryInfo
222+ : context . urlQueryInfo . concat ( representationUrlQueryInfo ) ;
223+ const segmentUrlQuery = combineUrlQueryInfo (
224+ urlQueryInfo . filter ( ( info ) => info . appliesTo . segment ) ,
225+ ) ;
226+ const initUrlQuery = combineUrlQueryInfo (
227+ urlQueryInfo . filter ( ( info ) => info . appliesTo . init ) ,
228+ ) ;
212229 const parsedRepresentation : IParsedRepresentation = {
213230 bitrate : representationBitrate ,
214231 cdnMetadata,
215232 index : representationIndex ,
216233 id : representationID ,
217234 } ;
235+ if ( segmentUrlQuery . length > 0 || initUrlQuery . length > 0 ) {
236+ parsedRepresentation . requestData = { } ;
237+ if ( segmentUrlQuery . length > 0 ) {
238+ parsedRepresentation . requestData . segment = {
239+ urlQuery : segmentUrlQuery . map ( ( info ) => ( {
240+ value : info . queryString ,
241+ sameOriginOnly : info . sameOriginOnly ,
242+ sourceUrl : info . sourceUrl ,
243+ } ) ) ,
244+ } ;
245+ }
246+ if ( initUrlQuery . length > 0 ) {
247+ parsedRepresentation . requestData . init = {
248+ urlQuery : initUrlQuery . map ( ( info ) => ( {
249+ value : info . queryString ,
250+ sameOriginOnly : info . sameOriginOnly ,
251+ sourceUrl : info . sourceUrl ,
252+ } ) ) ,
253+ } ;
254+ }
255+ }
218256
219257 if (
220258 representation . children . SupplementalProperty . length > 0 &&
@@ -300,6 +338,10 @@ export default function parseRepresentations(
300338export interface IRepresentationContext extends IInheritedRepresentationIndexContext {
301339 /** Manifest DASH profiles used for signalling some features */
302340 manifestProfiles ?: string | undefined ;
341+ /** URL of the MPD from which Annex I parameters may be inherited. */
342+ mpdUrl ?: string | undefined ;
343+ /** Annex I URL query instructions inherited from upper MPD levels. */
344+ urlQueryInfo : IDashUrlQueryInfo [ ] ;
303345 /**
304346 * The parser should take this Adaptation - which is from a previously parsed
305347 * Manifest for the same dynamic content - as a base to speed-up the parsing
0 commit comments