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,
|
||||
stream_descriptors,
|
||||
output_format='mp4',
|
||||
output_format=None,
|
||||
live=False,
|
||||
test_files=None):
|
||||
if test_files is None:
|
||||
|
@ -422,25 +422,28 @@ class PackagerAppTest(unittest.TestCase):
|
|||
stream_descriptor)
|
||||
if live:
|
||||
if output_format == 'ts':
|
||||
stream = ('input=%s,stream=%s,format=%s,'
|
||||
'segment_template=%s-$Number$.ts,playlist_name=%s.m3u8')
|
||||
streams.append(stream % (test_file, stream_descriptor,
|
||||
output_format, output_prefix,
|
||||
stream_descriptor))
|
||||
stream = ('input=%s,stream=%s,segment_template=%s-$Number$.ts,'
|
||||
'playlist_name=%s.m3u8' % (test_file, stream_descriptor,
|
||||
output_prefix,
|
||||
stream_descriptor))
|
||||
else:
|
||||
stream = ('input=%s,stream=%s,format=%s,init_segment=%s-init.mp4,'
|
||||
'segment_template=%s-$Number$.m4s')
|
||||
streams.append(stream % (test_file, stream_descriptor,
|
||||
output_format, output_prefix,
|
||||
output_prefix))
|
||||
stream = (
|
||||
'input=%s,stream=%s,init_segment=%s-init.mp4,'
|
||||
'segment_template=%s-$Number$.m4s' %
|
||||
(test_file, stream_descriptor, output_prefix, output_prefix))
|
||||
if output_format:
|
||||
stream += ',format=%s' % output_format
|
||||
streams.append(stream)
|
||||
self.output.append(output_prefix)
|
||||
else:
|
||||
output = '%s.%s' % (
|
||||
output_prefix,
|
||||
self._GetExtension(stream_descriptor, output_format))
|
||||
stream = 'input=%s,stream=%s,format=%s,output=%s'
|
||||
streams.append(stream %
|
||||
(test_file, stream_descriptor, output_format, output))
|
||||
stream = ('input=%s,stream=%s,output=%s' %
|
||||
(test_file, stream_descriptor, output))
|
||||
if output_format:
|
||||
stream += ',format=%s' % output_format
|
||||
streams.append(stream)
|
||||
self.output.append(output)
|
||||
return streams
|
||||
|
||||
|
@ -448,7 +451,10 @@ class PackagerAppTest(unittest.TestCase):
|
|||
# TODO(rkuroiwa): Support ttml.
|
||||
if stream_descriptor == 'text':
|
||||
return 'vtt'
|
||||
return output_format
|
||||
if output_format:
|
||||
return output_format
|
||||
# Default to mp4.
|
||||
return 'mp4'
|
||||
|
||||
def _GetFlags(self,
|
||||
encryption=False,
|
||||
|
|
|
@ -1755,6 +1755,16 @@ MediaContainerName DetermineContainerFromFileName(
|
|||
} else if (base::EndsWith(file_name, ".ts",
|
||||
base::CompareCase::INSENSITIVE_ASCII)) {
|
||||
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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue