Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pixelAspectRatio #2294

Merged
merged 4 commits into from
Jan 6, 2020
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions externs/shaka/manifest.js
Original file line number Diff line number Diff line change
@@ -255,6 +255,7 @@ shaka.extern.CreateSegmentIndexFunction;
* mimeType: string,
* codecs: string,
* frameRate: (number|undefined),
* pixelAspectRatio: ?string,
* bandwidth: (number|undefined),
* width: (number|undefined),
* height: (number|undefined),
@@ -301,6 +302,9 @@ shaka.extern.CreateSegmentIndexFunction;
* @property {(number|undefined)} frameRate
* <i>Video streams only.</i> <br>
* The Stream's framerate in frames per second
* @property {?string} pixelAspectRatio
* <i>Video streams only.</i> <br>
* The Stream's pixel aspect ratio
* @property {(number|undefined)} bandwidth
* <i>Audio and video streams only.</i> <br>
* The stream's required bandwidth in bits per second.
3 changes: 3 additions & 0 deletions externs/shaka/offline.js
Original file line number Diff line number Diff line change
@@ -114,6 +114,7 @@ shaka.extern.PeriodDB;
* mimeType: string,
* codecs: string,
* frameRate: (number|undefined),
* pixelAspectRatio: ?string,
* kind: (string|undefined),
* language: string,
* label: ?string,
@@ -143,6 +144,8 @@ shaka.extern.PeriodDB;
* The codecs of the stream.
* @property {(number|undefined)} frameRate
* The Stream's framerate in frames per second.
* @property {?string} pixelAspectRatio
* The Stream's pixel aspect ratio
* @property {(string|undefined)} kind
* The kind of text stream; undefined for audio/video.
* @property {string} language
3 changes: 3 additions & 0 deletions externs/shaka/player.js
Original file line number Diff line number Diff line change
@@ -176,6 +176,7 @@ shaka.extern.BufferedInfo;
* width: ?number,
* height: ?number,
* frameRate: ?number,
* pixelAspectRatio: ?string,
* mimeType: ?string,
* codecs: ?string,
* audioCodec: ?string,
@@ -225,6 +226,8 @@ shaka.extern.BufferedInfo;
* The video height provided in the manifest, if present.
* @property {?number} frameRate
* The video framerate provided in the manifest, if present.
* @property {?string} pixelAspectRatio
* The video pixel aspect ratio provided in the manifest, if present.
* @property {?string} mimeType
* The MIME type of the content provided in the manifest.
* @property {?string} codecs
8 changes: 8 additions & 0 deletions lib/dash/dash_parser.js
Original file line number Diff line number Diff line change
@@ -1069,6 +1069,7 @@ shaka.dash.DashParser = class {
mimeType: context.representation.mimeType,
codecs: context.representation.codecs,
frameRate: context.representation.frameRate,
pixelAspectRatio: context.representation.pixelAspectRatio,
bandwidth: context.bandwidth,
width: context.representation.width,
height: context.representation.height,
@@ -1175,6 +1176,7 @@ shaka.dash.DashParser = class {
codecs: '',
emsgSchemeIdUris: [],
frameRate: undefined,
pixelAspectRatio: null,
numChannels: null,
audioSamplingRate: null,
});
@@ -1190,6 +1192,8 @@ shaka.dash.DashParser = class {
const codecs = elem.getAttribute('codecs') || parent.codecs;
const frameRate =
XmlUtils.parseAttr(elem, 'frameRate', evalDivision) || parent.frameRate;
const pixelAspectRatio =
elem.getAttribute('par') || parent.pixelAspectRatio;
const emsgSchemeIdUris = this.emsgSchemeIdUris_(
XmlUtils.findChildren(elem, 'InbandEventStream'),
parent.emsgSchemeIdUris);
@@ -1219,6 +1223,7 @@ shaka.dash.DashParser = class {
mimeType: mimeType,
codecs: codecs,
frameRate: frameRate,
pixelAspectRatio: pixelAspectRatio,
emsgSchemeIdUris: emsgSchemeIdUris,
id: elem.getAttribute('id'),
numChannels: numChannels,
@@ -1606,6 +1611,7 @@ shaka.dash.DashParser.RequestInitSegmentCallback;
* mimeType: string,
* codecs: string,
* frameRate: (number|undefined),
* pixelAspectRatio: ?string,
* emsgSchemeIdUris: !Array.<string>,
* id: ?string,
* numChannels: ?number,
@@ -1636,6 +1642,8 @@ shaka.dash.DashParser.RequestInitSegmentCallback;
* The inherited codecs value.
* @property {(number|undefined)} frameRate
* The inherited framerate value.
* @property {(number|undefined)} pixelAspectRatio
* The inherited pixel aspect ratio value.
* @property {!Array.<string>} emsgSchemeIdUris
* emsg registered schemeIdUris.
* @property {?string} id
1 change: 1 addition & 0 deletions lib/hls/hls_parser.js
Original file line number Diff line number Diff line change
@@ -1194,6 +1194,7 @@ shaka.hls.HlsParser = class {
trickModeVideo: null,
emsgSchemeIdUris: null,
frameRate: undefined,
pixelAspectRatio: null,
width: undefined,
height: undefined,
bandwidth: undefined,
2 changes: 2 additions & 0 deletions lib/offline/indexeddb/v1_storage_cell.js
Original file line number Diff line number Diff line change
@@ -166,6 +166,7 @@ shaka.offline.indexeddb.V1StorageCell = class
// mimeType: string,
// codecs: string,
// frameRate: (number|undefined),
// pixelAspectRatio: ?string,
// kind: (string|undefined),
// language: string,
// label: ?string,
@@ -218,6 +219,7 @@ shaka.offline.indexeddb.V1StorageCell = class
mimeType: old.mimeType,
codecs: old.codecs,
frameRate: old.frameRate,
pixelAspectRatio: old.pixelAspectRatio,
avelad marked this conversation as resolved.
Show resolved Hide resolved
kind: old.kind,
language: old.language,
label: old.label,
1 change: 1 addition & 0 deletions lib/offline/manifest_converter.js
Original file line number Diff line number Diff line change
@@ -198,6 +198,7 @@ shaka.offline.ManifestConverter = class {
width: streamDB.width || undefined,
height: streamDB.height || undefined,
frameRate: streamDB.frameRate || undefined,
pixelAspectRatio: streamDB.pixelAspectRatio || null,
kind: streamDB.kind,
encrypted: streamDB.encrypted,
keyId: streamDB.keyId,
1 change: 1 addition & 0 deletions lib/offline/storage.js
Original file line number Diff line number Diff line change
@@ -1015,6 +1015,7 @@ shaka.offline.Storage = class {
mimeType: stream.mimeType,
codecs: stream.codecs,
frameRate: stream.frameRate,
pixelAspectRatio: stream.pixelAspectRatio,
kind: stream.kind,
language: stream.language,
label: stream.label,
3 changes: 3 additions & 0 deletions lib/player.js
Original file line number Diff line number Diff line change
@@ -1825,6 +1825,7 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
label: null,
type: ContentType.VIDEO,
primary: false,
pixelAspectRatio: null,
trickModeVideo: null,
emsgSchemeIdUris: null,
roles: [],
@@ -3529,6 +3530,7 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
label: label || null,
type: ContentType.TEXT,
primary: false,
pixelAspectRatio: null,
trickModeVideo: null,
emsgSchemeIdUris: null,
roles: [],
@@ -3719,6 +3721,7 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
label: null,
type: ContentType.TEXT,
primary: false,
pixelAspectRatio: null,
trickModeVideo: null,
emsgSchemeIdUris: null,
roles: video.roles,
5 changes: 5 additions & 0 deletions lib/util/stream_utils.js
Original file line number Diff line number Diff line change
@@ -275,6 +275,7 @@ shaka.util.StreamUtils = class {
width: null,
height: null,
frameRate: null,
pixelAspectRatio: null,
mimeType: mimeType,
codecs: codecs.join(', '),
audioCodec: audioCodec,
@@ -299,6 +300,7 @@ shaka.util.StreamUtils = class {
track.width = video.width || null;
track.height = video.height || null;
track.frameRate = video.frameRate || null;
track.pixelAspectRatio = video.pixelAspectRatio || null;
track.videoBandwidth = video.bandwidth || null;
}

@@ -335,6 +337,7 @@ shaka.util.StreamUtils = class {
width: null,
height: null,
frameRate: null,
pixelAspectRatio: null,
mimeType: stream.mimeType,
codecs: stream.codecs || null,
audioCodec: null,
@@ -440,6 +443,7 @@ shaka.util.StreamUtils = class {
width: null,
height: null,
frameRate: null,
pixelAspectRatio: null,
mimeType: null,
codecs: null,
audioCodec: null,
@@ -723,6 +727,7 @@ shaka.util.StreamUtils = class {
' codecs=' + stream.codecs +
' bandwidth=' + stream.bandwidth +
' frameRate=' + stream.frameRate +
' pixelAspectRatio= ' + stream.pixelAspectRatio +
' width=' + stream.width +
' height=' + stream.height;
}
1 change: 1 addition & 0 deletions test/media/adaptation_set_unit.js
Original file line number Diff line number Diff line change
@@ -160,6 +160,7 @@ describe('AdaptationSet', () => {
function makeStream(id, mimeType, codecs, roles) {
return {
audioSamplingRate: null,
pixelAspectRatio: null,
channelsCount: null,
closedCaptions: null,
codecs: codecs.join(','),
5 changes: 5 additions & 0 deletions test/offline/manifest_convert_unit.js
Original file line number Diff line number Diff line change
@@ -222,6 +222,7 @@ describe('ManifestConverter', () => {
label: null,
width: null,
height: null,
pixelAspectRatio: null,
initSegmentKey: null,
encrypted: false,
keyId: null,
@@ -265,6 +266,7 @@ describe('ManifestConverter', () => {
mimeType: 'video/mp4',
codecs: 'avc1.42c01e',
frameRate: 22,
pixelAspectRatio: '16:9',
avelad marked this conversation as resolved.
Show resolved Hide resolved
kind: undefined,
language: '',
label: null,
@@ -307,6 +309,7 @@ describe('ManifestConverter', () => {
mimeType: 'audio/mp4',
codecs: 'mp4a.40.2',
frameRate: undefined,
pixelAspectRatio: null,
kind: undefined,
language: 'en',
label: null,
@@ -348,6 +351,7 @@ describe('ManifestConverter', () => {
mimeType: 'text/vtt',
codecs: '',
frameRate: undefined,
pixelAspectRatio: null,
kind: undefined,
language: 'en',
label: null,
@@ -392,6 +396,7 @@ describe('ManifestConverter', () => {
mimeType: streamDb.mimeType,
codecs: streamDb.codecs,
frameRate: streamDb.frameRate,
pixelAspectRatio: streamDb.pixelAspectRatio || null,
width: streamDb.width || undefined,
height: streamDb.height || undefined,
kind: streamDb.kind,
2 changes: 2 additions & 0 deletions test/offline/storage_integration.js
Original file line number Diff line number Diff line change
@@ -1095,6 +1095,7 @@ describe('Storage', () => {
width: height * (16 / 9),
height: height,
frameRate: 30,
pixelAspectRatio: '16:9',
mimeType: 'video/mp4,audio/mp4',
codecs: 'mp4,mp4',
audioCodec: 'mp4',
@@ -1131,6 +1132,7 @@ describe('Storage', () => {
width: null,
height: null,
frameRate: null,
pixelAspectRatio: null,
mimeType: 'text/vtt',
codecs: 'vtt',
audioCodec: null,
13 changes: 13 additions & 0 deletions test/player_unit.js
Original file line number Diff line number Diff line change
@@ -909,6 +909,7 @@ describe('Player', () => {
stream.width = 100;
stream.height = 200;
stream.frameRate = 1000000 / 42000;
stream.pixelAspectRatio = '16:9';
});
variant.addAudio(3, (stream) => {
stream.originalId = 'audio-en-6c';
@@ -925,6 +926,7 @@ describe('Player', () => {
stream.originalId = 'video-2kbps';
stream.bandwidth = 2000;
stream.frameRate = 24;
stream.pixelAspectRatio = '16:9';
stream.size(200, 400);
});
variant.addExistingStream(3); // audio
@@ -1050,6 +1052,7 @@ describe('Player', () => {
width: 100,
height: 200,
frameRate: 1000000 / 42000,
pixelAspectRatio: '16:9',
mimeType: 'video/mp4',
codecs: 'avc1.4d401f, mp4a.40.2',
audioCodec: 'mp4a.40.2',
@@ -1078,6 +1081,7 @@ describe('Player', () => {
width: 200,
height: 400,
frameRate: 24,
pixelAspectRatio: '16:9',
mimeType: 'video/mp4',
codecs: 'avc1.4d401f, mp4a.40.2',
audioCodec: 'mp4a.40.2',
@@ -1106,6 +1110,7 @@ describe('Player', () => {
width: 100,
height: 200,
frameRate: 1000000 / 42000,
pixelAspectRatio: '16:9',
mimeType: 'video/mp4',
codecs: 'avc1.4d401f, mp4a.40.2',
audioCodec: 'mp4a.40.2',
@@ -1134,6 +1139,7 @@ describe('Player', () => {
width: 200,
height: 400,
frameRate: 24,
pixelAspectRatio: '16:9',
mimeType: 'video/mp4',
codecs: 'avc1.4d401f, mp4a.40.2',
audioCodec: 'mp4a.40.2',
@@ -1162,6 +1168,7 @@ describe('Player', () => {
width: 100,
height: 200,
frameRate: 1000000 / 42000,
pixelAspectRatio: '16:9',
mimeType: 'video/mp4',
codecs: 'avc1.4d401f, mp4a.40.2',
audioCodec: 'mp4a.40.2',
@@ -1190,6 +1197,7 @@ describe('Player', () => {
width: 200,
height: 400,
frameRate: 24,
pixelAspectRatio: '16:9',
mimeType: 'video/mp4',
codecs: 'avc1.4d401f, mp4a.40.2',
audioCodec: 'mp4a.40.2',
@@ -1218,6 +1226,7 @@ describe('Player', () => {
width: 100,
height: 200,
frameRate: 1000000 / 42000,
pixelAspectRatio: '16:9',
mimeType: 'video/mp4',
codecs: 'avc1.4d401f, mp4a.40.2',
audioCodec: 'mp4a.40.2',
@@ -1246,6 +1255,7 @@ describe('Player', () => {
width: 200,
height: 400,
frameRate: 24,
pixelAspectRatio: '16:9',
mimeType: 'video/mp4',
codecs: 'avc1.4d401f, mp4a.40.2',
audioCodec: 'mp4a.40.2',
@@ -1288,6 +1298,7 @@ describe('Player', () => {
width: null,
height: null,
frameRate: null,
pixelAspectRatio: null,
videoId: null,
audioId: null,
originalAudioId: null,
@@ -1316,6 +1327,7 @@ describe('Player', () => {
width: null,
height: null,
frameRate: null,
pixelAspectRatio: null,
videoId: null,
audioId: null,
originalAudioId: null,
@@ -1344,6 +1356,7 @@ describe('Player', () => {
width: null,
height: null,
frameRate: null,
pixelAspectRatio: null,
videoId: null,
audioId: null,
originalAudioId: null,
2 changes: 2 additions & 0 deletions test/test/util/manifest_generator.js
Original file line number Diff line number Diff line change
@@ -548,6 +548,8 @@ shaka.test.ManifestGenerator.Stream = class {
this.codecs = defaultCodecs;
/** @type {(number|undefined)} */
this.frameRate = undefined;
/** @type {?string} */
this.pixelAspectRatio = null;
/** @type {(number|undefined)} */
this.bandwidth = undefined;
/** @type {(number|undefined)} */
1 change: 1 addition & 0 deletions test/test/util/offline_utils.js
Original file line number Diff line number Diff line change
@@ -39,6 +39,7 @@ shaka.test.OfflineUtils = class {
mimeType: '',
codecs: '',
frameRate: undefined,
pixelAspectRatio: null,
kind: undefined,
language: '',
label: null,