Fix text formats not recognized problem
Also updated packager_test not to fill in output_format by default, which will help catch these kinds of bugs. Closes #130 Change-Id: I77157317de822d3f543f7e27d94bb4df7a1649d2
This commit is contained in:
parent
2cdd54b6f7
commit
ad95b9d8de
|
@ -403,7 +403,7 @@ class PackagerAppTest(unittest.TestCase):
|
||||||
|
|
||||||
def _GetStreams(self,
|
def _GetStreams(self,
|
||||||
stream_descriptors,
|
stream_descriptors,
|
||||||
output_format='mp4',
|
output_format=None,
|
||||||
live=False,
|
live=False,
|
||||||
test_files=None):
|
test_files=None):
|
||||||
if test_files is None:
|
if test_files is None:
|
||||||
|
@ -422,25 +422,28 @@ class PackagerAppTest(unittest.TestCase):
|
||||||
stream_descriptor)
|
stream_descriptor)
|
||||||
if live:
|
if live:
|
||||||
if output_format == 'ts':
|
if output_format == 'ts':
|
||||||
stream = ('input=%s,stream=%s,format=%s,'
|
stream = ('input=%s,stream=%s,segment_template=%s-$Number$.ts,'
|
||||||
'segment_template=%s-$Number$.ts,playlist_name=%s.m3u8')
|
'playlist_name=%s.m3u8' % (test_file, stream_descriptor,
|
||||||
streams.append(stream % (test_file, stream_descriptor,
|
output_prefix,
|
||||||
output_format, output_prefix,
|
|
||||||
stream_descriptor))
|
stream_descriptor))
|
||||||
else:
|
else:
|
||||||
stream = ('input=%s,stream=%s,format=%s,init_segment=%s-init.mp4,'
|
stream = (
|
||||||
'segment_template=%s-$Number$.m4s')
|
'input=%s,stream=%s,init_segment=%s-init.mp4,'
|
||||||
streams.append(stream % (test_file, stream_descriptor,
|
'segment_template=%s-$Number$.m4s' %
|
||||||
output_format, output_prefix,
|
(test_file, stream_descriptor, output_prefix, output_prefix))
|
||||||
output_prefix))
|
if output_format:
|
||||||
|
stream += ',format=%s' % output_format
|
||||||
|
streams.append(stream)
|
||||||
self.output.append(output_prefix)
|
self.output.append(output_prefix)
|
||||||
else:
|
else:
|
||||||
output = '%s.%s' % (
|
output = '%s.%s' % (
|
||||||
output_prefix,
|
output_prefix,
|
||||||
self._GetExtension(stream_descriptor, output_format))
|
self._GetExtension(stream_descriptor, output_format))
|
||||||
stream = 'input=%s,stream=%s,format=%s,output=%s'
|
stream = ('input=%s,stream=%s,output=%s' %
|
||||||
streams.append(stream %
|
(test_file, stream_descriptor, output))
|
||||||
(test_file, stream_descriptor, output_format, output))
|
if output_format:
|
||||||
|
stream += ',format=%s' % output_format
|
||||||
|
streams.append(stream)
|
||||||
self.output.append(output)
|
self.output.append(output)
|
||||||
return streams
|
return streams
|
||||||
|
|
||||||
|
@ -448,7 +451,10 @@ class PackagerAppTest(unittest.TestCase):
|
||||||
# TODO(rkuroiwa): Support ttml.
|
# TODO(rkuroiwa): Support ttml.
|
||||||
if stream_descriptor == 'text':
|
if stream_descriptor == 'text':
|
||||||
return 'vtt'
|
return 'vtt'
|
||||||
|
if output_format:
|
||||||
return output_format
|
return output_format
|
||||||
|
# Default to mp4.
|
||||||
|
return 'mp4'
|
||||||
|
|
||||||
def _GetFlags(self,
|
def _GetFlags(self,
|
||||||
encryption=False,
|
encryption=False,
|
||||||
|
|
|
@ -1755,6 +1755,16 @@ MediaContainerName DetermineContainerFromFileName(
|
||||||
} else if (base::EndsWith(file_name, ".ts",
|
} else if (base::EndsWith(file_name, ".ts",
|
||||||
base::CompareCase::INSENSITIVE_ASCII)) {
|
base::CompareCase::INSENSITIVE_ASCII)) {
|
||||||
return CONTAINER_MPEG2TS;
|
return CONTAINER_MPEG2TS;
|
||||||
|
} else if (base::EndsWith(file_name, ".vtt",
|
||||||
|
base::CompareCase::INSENSITIVE_ASCII)) {
|
||||||
|
return CONTAINER_WEBVTT;
|
||||||
|
} else if (base::EndsWith(file_name, ".ttml",
|
||||||
|
base::CompareCase::INSENSITIVE_ASCII)) {
|
||||||
|
return CONTAINER_TTML;
|
||||||
|
} else if (base::EndsWith(file_name, ".xml",
|
||||||
|
base::CompareCase::INSENSITIVE_ASCII)) {
|
||||||
|
// In our supported containers, only ttml is in xml format.
|
||||||
|
return CONTAINER_TTML;
|
||||||
}
|
}
|
||||||
return CONTAINER_UNKNOWN;
|
return CONTAINER_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue