Skip to content

Commit

Permalink
Fix pixelAspectRatio types for backward compatibility
Browse files Browse the repository at this point in the history
For backward compatibility, the new pixelAspectRatio field in Stream
should be string|undefined rather than being nullable.  This ensures
that manifest parser plugins that do not output that field will still
compile against the externs.

PR #2294

Backported to v2.5.x

Change-Id: I1aae03994a213c8ce52dc64e8a34bf179045f4fb
  • Loading branch information
joeyparrish committed Jan 15, 2020
1 parent f3c4518 commit cc38168
Show file tree
Hide file tree
Showing 11 changed files with 17 additions and 20 deletions.
4 changes: 2 additions & 2 deletions externs/shaka/manifest.js
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ shaka.extern.GetSegmentReferenceFunction;
* mimeType: string,
* codecs: string,
* frameRate: (number|undefined),
* pixelAspectRatio: ?string,
* pixelAspectRatio: (string|undefined),
* bandwidth: (number|undefined),
* width: (number|undefined),
* height: (number|undefined),
Expand Down Expand Up @@ -360,7 +360,7 @@ shaka.extern.GetSegmentReferenceFunction;
* @property {(number|undefined)} frameRate
* <i>Video streams only.</i> <br>
* The Stream's framerate in frames per second
* @property {?string} pixelAspectRatio
* @property {(string|undefined)} pixelAspectRatio
* <i>Video streams only.</i> <br>
* The Stream's pixel aspect ratio
* @property {(number|undefined)} bandwidth
Expand Down
4 changes: 2 additions & 2 deletions externs/shaka/offline.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ shaka.extern.PeriodDB;
* mimeType: string,
* codecs: string,
* frameRate: (number|undefined),
* pixelAspectRatio: ?string,
* pixelAspectRatio: (string|undefined),
* kind: (string|undefined),
* language: string,
* label: ?string,
Expand Down Expand Up @@ -156,7 +156,7 @@ shaka.extern.PeriodDB;
* The codecs of the stream.
* @property {(number|undefined)} frameRate
* The Stream's framerate in frames per second.
* @property {?string} pixelAspectRatio
* @property {(string|undefined)} pixelAspectRatio
* The Stream's pixel aspect ratio
* @property {(string|undefined)} kind
* The kind of text stream; undefined for audio/video.
Expand Down
4 changes: 2 additions & 2 deletions lib/dash/dash_parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ shaka.dash.DashParser.RequestInitSegmentCallback;
* mimeType: string,
* codecs: string,
* frameRate: (number|undefined),
* pixelAspectRatio: ?string,
* pixelAspectRatio: (string|undefined),
* emsgSchemeIdUris: !Array.<string>,
* id: ?string,
* numChannels: ?number,
Expand Down Expand Up @@ -161,7 +161,7 @@ shaka.dash.DashParser.RequestInitSegmentCallback;
* The inherited codecs value.
* @property {(number|undefined)} frameRate
* The inherited framerate value.
* @property {(number|undefined)} pixelAspectRatio
* @property {(string|undefined)} pixelAspectRatio
* The inherited pixel aspect ratio value.
* @property {!Array.<string>} emsgSchemeIdUris
* emsg registered schemeIdUris.
Expand Down
2 changes: 1 addition & 1 deletion lib/hls/hls_parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -1258,7 +1258,7 @@ shaka.hls.HlsParser.prototype.createStreamInfo_ = async function(
trickModeVideo: null,
emsgSchemeIdUris: null,
frameRate: undefined,
pixelAspectRatio: null,
pixelAspectRatio: undefined,
width: undefined,
height: undefined,
bandwidth: undefined,
Expand Down
3 changes: 1 addition & 2 deletions lib/offline/indexeddb/v1_storage_cell.js
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,6 @@ shaka.offline.indexeddb.V1StorageCell = class {
// mimeType: string,
// codecs: string,
// frameRate: (number|undefined),
// pixelAspectRatio: ?string,
// kind: (string|undefined),
// language: string,
// label: ?string,
Expand Down Expand Up @@ -405,7 +404,7 @@ shaka.offline.indexeddb.V1StorageCell = class {
mimeType: old.mimeType,
codecs: old.codecs,
frameRate: old.frameRate,
pixelAspectRatio: null,
pixelAspectRatio: undefined,
kind: old.kind,
language: old.language,
label: old.label,
Expand Down
2 changes: 1 addition & 1 deletion lib/offline/manifest_converter.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ shaka.offline.ManifestConverter = class {
width: streamDB.width || undefined,
height: streamDB.height || undefined,
frameRate: streamDB.frameRate || undefined,
pixelAspectRatio: streamDB.pixelAspectRatio || null,
pixelAspectRatio: streamDB.pixelAspectRatio || undefined,
kind: streamDB.kind,
encrypted: streamDB.encrypted,
keyId: streamDB.keyId,
Expand Down
6 changes: 3 additions & 3 deletions lib/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -1834,7 +1834,7 @@ shaka.Player.prototype.onInitializeSrcEqualsDrm_ = async function(has, wants) {
type: ContentType.VIDEO,
primary: false,
frameRate: undefined,
pixelAspectRatio: null,
pixelAspectRatio: undefined,
trickModeVideo: null,
emsgSchemeIdUris: null,
roles: [],
Expand Down Expand Up @@ -3550,7 +3550,7 @@ shaka.Player.prototype.addTextTrack = async function(
type: ContentType.TEXT,
primary: false,
frameRate: undefined,
pixelAspectRatio: null,
pixelAspectRatio: undefined,
trickModeVideo: null,
emsgSchemeIdUris: null,
roles: [],
Expand Down Expand Up @@ -3752,7 +3752,7 @@ shaka.Player.prototype.createTextStreamsForClosedCaptions_ = function(periods) {
type: ContentType.TEXT,
primary: false,
frameRate: undefined,
pixelAspectRatio: null,
pixelAspectRatio: undefined,
trickModeVideo: null,
emsgSchemeIdUris: null,
roles: video.roles,
Expand Down
1 change: 0 additions & 1 deletion test/media/adaptation_set_unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,6 @@ describe('AdaptationSet', function() {
function makeStream(id, mimeType, codecs, roles) {
return {
audioSamplingRate: null,
pixelAspectRatio: null,
channelsCount: null,
closedCaptions: null,
codecs: codecs.join(','),
Expand Down
7 changes: 3 additions & 4 deletions test/offline/manifest_convert_unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,6 @@ describe('ManifestConverter', function() {
label: null,
width: null,
height: null,
pixelAspectRatio: null,
initSegmentKey: null,
encrypted: false,
keyId: null,
Expand Down Expand Up @@ -312,7 +311,7 @@ describe('ManifestConverter', function() {
mimeType: 'audio/mp4',
codecs: 'mp4a.40.2',
frameRate: undefined,
pixelAspectRatio: null,
pixelAspectRatio: undefined,
kind: undefined,
language: 'en',
label: null,
Expand Down Expand Up @@ -354,7 +353,7 @@ describe('ManifestConverter', function() {
mimeType: 'text/vtt',
codecs: '',
frameRate: undefined,
pixelAspectRatio: null,
pixelAspectRatio: undefined,
kind: undefined,
language: 'en',
label: null,
Expand Down Expand Up @@ -404,7 +403,7 @@ describe('ManifestConverter', function() {
mimeType: streamDb.mimeType,
codecs: streamDb.codecs,
frameRate: streamDb.frameRate,
pixelAspectRatio: streamDb.pixelAspectRatio || null,
pixelAspectRatio: streamDb.pixelAspectRatio || undefined,
width: streamDb.width || undefined,
height: streamDb.height || undefined,
kind: streamDb.kind,
Expand Down
2 changes: 1 addition & 1 deletion test/test/util/manifest_generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ shaka.test.ManifestGenerator.prototype.createStream_ =
mimeType: defaultMimeType,
codecs: defaultCodecs,
frameRate: undefined,
pixelAspectRatio: null,
pixelAspectRatio: undefined,
bandwidth: undefined,
width: undefined,
height: undefined,
Expand Down
2 changes: 1 addition & 1 deletion test/test/util/offline_utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ shaka.test.OfflineUtils.createStream = function(id, type) {
mimeType: '',
codecs: '',
frameRate: undefined,
pixelAspectRatio: null,
pixelAspectRatio: undefined,
kind: undefined,
language: '',
label: null,
Expand Down

0 comments on commit cc38168

Please sign in to comment.