mirror of
https://github.com/kkroening/ffmpeg-python.git
synced 2025-04-05 04:22:51 +08:00
Test bad stream selectors
This commit is contained in:
parent
57abf6e86e
commit
1e63419a93
@ -52,15 +52,15 @@ class Stream(object):
|
||||
|
||||
Process the audio and video portions of a stream independently::
|
||||
|
||||
in = ffmpeg.input('in.mp4')
|
||||
audio = in['a'].filter_("aecho", 0.8, 0.9, 1000, 0.3)
|
||||
video = in['v'].hflip()
|
||||
ffmpeg.output(audio, video, 'out.mp4')
|
||||
input = ffmpeg.input('in.mp4')
|
||||
audio = input['a'].filter_("aecho", 0.8, 0.9, 1000, 0.3)
|
||||
video = input['v'].hflip()
|
||||
out = ffmpeg.output(audio, video, 'out.mp4')
|
||||
"""
|
||||
if self.selector is not None:
|
||||
raise ValueError('Stream already has a selector: {}'.format(self))
|
||||
elif not isinstance(index, basestring):
|
||||
raise TypeError("Expected string index (e.g. 'v'); got {!r}".format(index))
|
||||
raise TypeError("Expected string index (e.g. 'a'); got {!r}".format(index))
|
||||
return self.node.stream(label=self.label, selector=index)
|
||||
|
||||
|
||||
|
@ -175,6 +175,22 @@ def test_filter_with_selector():
|
||||
]
|
||||
|
||||
|
||||
def test_filter_with_bad_selectors():
|
||||
input = ffmpeg.input(TEST_INPUT_FILE1)
|
||||
|
||||
with pytest.raises(ValueError) as excinfo:
|
||||
input['a']['a']
|
||||
assert str(excinfo.value).startswith('Stream already has a selector:')
|
||||
|
||||
with pytest.raises(TypeError) as excinfo:
|
||||
input[:'a']
|
||||
assert str(excinfo.value).startswith("Expected string index (e.g. 'a')")
|
||||
|
||||
with pytest.raises(TypeError) as excinfo:
|
||||
input[5]
|
||||
assert str(excinfo.value).startswith("Expected string index (e.g. 'a')")
|
||||
|
||||
|
||||
def _get_complex_filter_asplit_example():
|
||||
split = (ffmpeg
|
||||
.input(TEST_INPUT_FILE1)
|
||||
|
Loading…
x
Reference in New Issue
Block a user