Skip to content

Commit

Permalink
fix merge conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
nicosang committed Jun 6, 2017
1 parent 29e3eaa commit a2a2443
Showing 1 changed file with 2 additions and 135 deletions.
137 changes: 2 additions & 135 deletions src/streaming/utils/IsoFile.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,7 @@ import FactoryMaker from '../../core/FactoryMaker';
function IsoFile() {

let instance,
parsedIsoFile,
commonProps,
sidxProps,
sidxRefProps,
emsgProps,
mdhdProps,
mfhdProps,
subsProps,
tfhdProps,
tfdtProps,
trunProps,
trunSampleProps;
parsedIsoFile;

/**
* @param {string} type
Expand Down Expand Up @@ -101,135 +90,15 @@ function IsoFile() {
return boxes[boxes.length - 1];
}

function setup() {
commonProps = {
offset: '_offset',
size: 'size',
type: 'type'
};

sidxProps = {
references: 'references',
timescale: 'timescale',
earliest_presentation_time: 'earliest_presentation_time',
first_offset: 'first_offset'
};

sidxRefProps = {
reference_type: 'reference_type',
referenced_size: 'referenced_size',
subsegment_duration: 'subsegment_duration'
};

emsgProps = {
id: 'id',
value: 'value',
timescale: 'timescale',
scheme_id_uri: 'scheme_id_uri',
presentation_time_delta: 'presentation_time_delta',
event_duration: 'event_duration',
message_data: 'message_data'
};

mdhdProps = {
timescale: 'timescale'
};

mfhdProps = {
sequence_number: 'sequence_number'
};

subsProps = {
entry_count: 'entry_count',
entries: 'entries'
};

tfhdProps = {
base_data_offset: 'base_data_offset',
sample_description_index: 'sample_description_index',
default_sample_duration: 'default_sample_duration',
default_sample_size: 'default_sample_size',
default_sample_flags: 'default_sample_flags',
flags: 'flags'
};

tfdtProps = {
version: 'version',
baseMediaDecodeTime: 'baseMediaDecodeTime',
flags: 'flags'
};

trunProps = {
sample_count: 'sample_count',
first_sample_flags: 'first_sample_flags',
data_offset: 'data_offset',
flags: 'flags',
samples: 'samples'
};

trunSampleProps = {
sample_size: 'sample_size',
sample_duration: 'sample_duration',
sample_composition_time_offset: 'sample_composition_time_offset'
};
}

function copyProps(from, to, props) {
for (var prop in props) {
to[prop] = from[props[prop]];
}
}

function convertToDashIsoBox(boxData) {
if (!boxData) return null;

let box = new IsoBox();
let i,
ln;

copyProps(boxData, box, commonProps);
let box = new IsoBox(boxData);

if (boxData.hasOwnProperty('_incomplete')) {
box.isComplete = !boxData._incomplete;
}

switch (box.type) {
case 'sidx':
copyProps(boxData, box, sidxProps);
if (box.references) {
for (i = 0, ln = box.references.length; i < ln; i++) {
copyProps(boxData.references[i], box.references[i], sidxRefProps);
}
}
break;
case 'emsg':
copyProps(boxData, box, emsgProps);
break;
case 'mdhd':
copyProps(boxData, box, mdhdProps);
break;
case 'mfhd':
copyProps(boxData, box, mfhdProps);
break;
case 'subs':
copyProps(boxData, box, subsProps);
break;
case 'tfhd':
copyProps(boxData, box, tfhdProps);
break;
case 'tfdt':
copyProps(boxData, box, tfdtProps);
break;
case 'trun':
copyProps(boxData, box, trunProps);
if (box.samples) {
for (i = 0, ln = box.samples.length; i < ln; i++) {
copyProps(boxData.samples[i], box.samples[i], trunSampleProps);
}
}
break;
}

return box;
}

Expand All @@ -240,8 +109,6 @@ function IsoFile() {
getLastBox: getLastBox
};

setup();

return instance;
}
IsoFile.__dashjs_factory_name = 'IsoFile';
Expand Down

0 comments on commit a2a2443

Please sign in to comment.