Skip to content

Commit

Permalink
Unified naming of variables about URIs.
Browse files Browse the repository at this point in the history
Renamed variables to only use URI instead of URL.  Also made variable
names plural when referring to an array of choices.

Change-Id: I7bfd5022606d77a3153575d8f13dd1e040331901
  • Loading branch information
TheModMaker committed Dec 17, 2015
1 parent 4ec3d3a commit 0b4ba1f
Show file tree
Hide file tree
Showing 9 changed files with 75 additions and 75 deletions.
6 changes: 3 additions & 3 deletions lib/media/mp4_segment_index_parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ shaka.media.Mp4SegmentIndexParser.SIDX_INDICATOR = 0x73696478;
* @param {!ArrayBuffer} sidxData The MP4's container's SIDX.
* @param {number} sidxOffset The SIDX's offset, in bytes, from the start of
* the MP4 container.
* @param {!Array.<string>} url The possible locations of the MP4 file that
* @param {!Array.<string>} uris The possible locations of the MP4 file that
* contains the segments.
* @return {!Array.<!shaka.media.SegmentReference>}
* @throws {shaka.util.Error}
*/
shaka.media.Mp4SegmentIndexParser.prototype.parse = function(
sidxData, sidxOffset, url) {
sidxData, sidxOffset, uris) {
var references = [];

var reader = new shaka.util.DataViewReader(
Expand Down Expand Up @@ -142,7 +142,7 @@ shaka.media.Mp4SegmentIndexParser.prototype.parse = function(
references.length,
unscaledStartTime / timescale,
(unscaledStartTime + subsegmentDuration) / timescale,
url,
uris,
startByte,
startByte + referenceSize - 1));

Expand Down
12 changes: 6 additions & 6 deletions lib/media/segment_reference.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ goog.require('shaka.asserts');
* Creates an InitSegmentReference, which provides the location to an
* initialization segment.
*
* @param {!Array.<string>} uri The URIs of the resource containing the
* @param {!Array.<string>} uris The URIs of the resource containing the
* segment.
* @param {number} startByte The offset from the start of the resource to the
* start of the segment.
Expand All @@ -37,9 +37,9 @@ goog.require('shaka.asserts');
* @constructor
* @struct
*/
shaka.media.InitSegmentReference = function(uri, startByte, endByte) {
shaka.media.InitSegmentReference = function(uris, startByte, endByte) {
/** @const {!Array.<string>} */
this.uri = uri;
this.uris = uris;

/** @const {number} */
this.startByte = startByte;
Expand All @@ -64,7 +64,7 @@ shaka.media.InitSegmentReference = function(uri, startByte, endByte) {
* @param {number} endTime The segment's end time in seconds, relative to
* the start of the presentation. The segment ends the instant before this
* time.
* @param {!Array.<string>} uri The URIs of the resource containing the
* @param {!Array.<string>} uris The URIs of the resource containing the
* segment.
* @param {number} startByte The offset from the start of the resource to the
* start of the segment.
Expand All @@ -76,7 +76,7 @@ shaka.media.InitSegmentReference = function(uri, startByte, endByte) {
* @struct
*/
shaka.media.SegmentReference = function(
position, startTime, endTime, uri, startByte, endByte) {
position, startTime, endTime, uris, startByte, endByte) {
shaka.asserts.assert(startTime < endTime,
'startTime must be less than endTime');
shaka.asserts.assert((startByte < endByte) || (endByte == null),
Expand All @@ -91,7 +91,7 @@ shaka.media.SegmentReference = function(
this.endTime = endTime;

/** @const {!Array.<string>} */
this.uri = uri;
this.uris = uris;

/** @const {number} */
this.startByte = startByte;
Expand Down
14 changes: 7 additions & 7 deletions lib/media/webm_segment_index_parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ shaka.media.WebmSegmentIndexParser.CUE_CLUSTER_POSITION = 0xf1;
* Parses SegmentReferences from a WebM container.
* @param {!ArrayBuffer} cuesData The WebM container's "Cueing Data" section.
* @param {!ArrayBuffer} initData The WebM container's headers.
* @param {!Array.<string>} url The possible locations of the WebM file that
* @param {!Array.<string>} uris The possible locations of the WebM file that
* contains the segments.
*
* @return {!Array.<!shaka.media.SegmentReference>}
Expand All @@ -88,7 +88,7 @@ shaka.media.WebmSegmentIndexParser.CUE_CLUSTER_POSITION = 0xf1;
* @see http://www.webmproject.org/docs/container/
*/
shaka.media.WebmSegmentIndexParser.prototype.parse = function(
cuesData, initData, url) {
cuesData, initData, uris) {
var tuple = this.parseWebmContainer_(initData);
var parser = new shaka.util.EbmlParser(new DataView(cuesData));
var cuesElement = parser.parseElement();
Expand All @@ -101,7 +101,7 @@ shaka.media.WebmSegmentIndexParser.prototype.parse = function(

return this.parseCues_(
cuesElement, tuple.segmentOffset, tuple.timecodeScale, tuple.duration,
url);
uris);
};


Expand Down Expand Up @@ -235,13 +235,13 @@ shaka.media.WebmSegmentIndexParser.prototype.parseInfo_ = function(
* @param {number} segmentOffset
* @param {number} timecodeScale
* @param {number} duration
* @param {!Array.<string>} url
* @param {!Array.<string>} uris
* @return {!Array.<!shaka.media.SegmentReference>}
* @throws {shaka.util.Error}
* @private
*/
shaka.media.WebmSegmentIndexParser.prototype.parseCues_ = function(
cuesElement, segmentOffset, timecodeScale, duration, url) {
cuesElement, segmentOffset, timecodeScale, duration, uris) {
var references = [];

var parser = cuesElement.createParser();
Expand Down Expand Up @@ -270,7 +270,7 @@ shaka.media.WebmSegmentIndexParser.prototype.parseCues_ = function(
new shaka.media.SegmentReference(
references.length,
lastTime, currentTime,
url,
uris,
lastOffset, currentOffset - 1));
}

Expand All @@ -283,7 +283,7 @@ shaka.media.WebmSegmentIndexParser.prototype.parseCues_ = function(

references.push(
new shaka.media.SegmentReference(
references.length, lastTime, duration, url, lastOffset, null));
references.length, lastTime, duration, uris, lastOffset, null));
}

return references;
Expand Down
12 changes: 6 additions & 6 deletions lib/net/networking_engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ shaka.net.NetworkingEngine.RetryParameters;
*
* <ul>
* <li>
* <b>uri</b>: Array.&lt;string&gt; <br>
* <b>uris</b>: Array.&lt;string&gt; <br>
* An array of URIs to attempt. They will be tried in the order they are
* given.
*
Expand All @@ -119,7 +119,7 @@ shaka.net.NetworkingEngine.RetryParameters;
* </ul>
*
* @typedef {{
* uri: !Array.<string>,
* uris: !Array.<string>,
* method: string,
* body: ArrayBuffer,
* headers: !Object.<string, string>,
Expand Down Expand Up @@ -299,7 +299,7 @@ shaka.net.NetworkingEngine.prototype.request = function(type, request) {
if (this.destroyed_)
return Promise.reject();

shaka.asserts.assert(request.uri);
shaka.asserts.assert(request.uris);

// Send to the filter first, in-case they change the URI.
var requestFilters = this.requestFilters_;
Expand All @@ -318,7 +318,7 @@ shaka.net.NetworkingEngine.prototype.request = function(type, request) {

var p = this.send_(type, request, 0);
for (var i = 1; i < maxAttempts; i++) {
var index = i % request.uri.length;
var index = i % request.uris.length;
p = /** @type {!Promise.<shaka.net.NetworkingEngine.Response>} */ (
p.catch(this.resend_.bind(this, type, request, delay, index)));
delay *= backoffFactor;
Expand Down Expand Up @@ -349,7 +349,7 @@ shaka.net.NetworkingEngine.prototype.send_ = function(type, request, index) {
if (this.destroyed_)
return Promise.reject();

var uri = new goog.Uri(request.uri[index]);
var uri = new goog.Uri(request.uris[index]);
var scheme = uri.getScheme();
var plugin = shaka.net.NetworkingEngine.schemes_[scheme];
if (!plugin) {
Expand All @@ -359,7 +359,7 @@ shaka.net.NetworkingEngine.prototype.send_ = function(type, request, index) {
uri));
}

return plugin(request.uri[index], request).then(function(response) {
return plugin(request.uris[index], request).then(function(response) {
// Since we are inside a promise, no need to catch errors; they will result
// in a failed promise.
var responseFilters = this.responseFilters_;
Expand Down
2 changes: 1 addition & 1 deletion spec/data_uri_plugin_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe('DataUriPlugin', function() {
testSucceeds('data:text/plain,Hello', 'Hello', done);
});

it('supports URL encoded text', function(done) {
it('supports URI encoded text', function(done) {
testSucceeds(
'data:text/html,%3Ch1%3EHello%2C%20World!%3C%2Fh1%3E',
'<h1>Hello, World!</h1>',
Expand Down
10 changes: 5 additions & 5 deletions spec/http_plugin_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,16 @@ describe('HttpPlugin', function() {

it('sets the correct fields', function(done) {
var request = {
uri: ['https://foo.bar/'],
uris: ['https://foo.bar/'],
allowCrossSiteCredentials: true,
method: 'POST',
headers: {'FOO': 'BAR'}
};
shaka.net.HttpPlugin(request.uri[0], request)
shaka.net.HttpPlugin(request.uris[0], request)
.then(function() {
var actual = jasmine.Ajax.requests.mostRecent();
expect(actual).toBeTruthy();
expect(actual.url).toBe(request.uri[0]);
expect(actual.url).toBe(request.uris[0]);
expect(actual.method).toBe(request.method);
expect(actual.withCredentials).toBe(true);
expect(actual.requestHeaders['FOO']).toBe('BAR');
Expand All @@ -83,7 +83,7 @@ describe('HttpPlugin', function() {
});

function testSucceeds(uri, done) {
var request = {uri: [uri]};
var request = {uris: [uri]};
shaka.net.HttpPlugin(uri, request)
.catch(fail)
.then(function(response) {
Expand All @@ -98,7 +98,7 @@ describe('HttpPlugin', function() {
}

function testFails(uri, done) {
var request = {uri: [uri]};
var request = {uris: [uri]};
shaka.net.HttpPlugin(uri, request)
.then(fail)
.catch(function() {
Expand Down
12 changes: 6 additions & 6 deletions spec/media_source_engine_integration.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,19 @@ goog.require('shaka.media.MediaSourceEngine');
describe('MediaSourceEngine', function() {
var metadata = {
video: {
initSegmentUrl: 'spec/assets/sintel-video-init.mp4',
initSegmentUri: 'spec/assets/sintel-video-init.mp4',
mvhdOffset: 0x24,
segmentUrl: 'spec/assets/sintel-video-segment.mp4',
segmentUri: 'spec/assets/sintel-video-segment.mp4',
tfdtOffset: 0x34,
segmentDuration: 12,
presentationTimeOffset: 0,
mimeType: 'video/mp4; codecs="avc1.42c01e"',
generator: null
},
audio: {
initSegmentUrl: 'spec/assets/sintel-audio-init.mp4',
initSegmentUri: 'spec/assets/sintel-audio-init.mp4',
mvhdOffset: 0x20,
segmentUrl: 'spec/assets/sintel-audio-segment.mp4',
segmentUri: 'spec/assets/sintel-audio-segment.mp4',
tfdtOffset: 0x38,
segmentDuration: 10.005333,
presentationTimeOffset: 0,
Expand All @@ -49,8 +49,8 @@ describe('MediaSourceEngine', function() {

function createStreamGenerator(type, metadata) {
var generator = new shaka.test.DashVodStreamGenerator(
metadata.initSegmentUrl, metadata.mvhdOffset,
metadata.segmentUrl, metadata.tfdtOffset, metadata.segmentDuration,
metadata.initSegmentUri, metadata.mvhdOffset,
metadata.segmentUri, metadata.tfdtOffset, metadata.segmentDuration,
metadata.presentationTimeOffset, presentationDuration);
metadata.generator = generator;
return generator.init();
Expand Down
Loading

0 comments on commit 0b4ba1f

Please sign in to comment.