Skip to content

Commit 68a1338

Browse files
committed
corrected function names util.*spec_stream
to `util.*stream_spec`
1 parent c590a81 commit 68a1338

5 files changed

Lines changed: 31 additions & 30 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
99
### Changed
1010

1111
- consolidate representation of input/output/internal links for filtergraphs, affecting `util.filter.parse_graph()` & `util.filter.compose_graph()`
12+
- corrected function names `util.*spec_stream` to `util.*stream_spec`
1213

1314
## [0.7.0] - 2022-08-24
1415

src/ffmpegio/configure.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def array_to_video_input(rate, data, stream_id=None, **opts):
1919
:rtype: tuple(str, dict)
2020
"""
2121

22-
spec = "" if stream_id is None else ":" + utils.spec_stream(stream_id, "v")
22+
spec = "" if stream_id is None else ":" + utils.stream_spec(stream_id, "v")
2323

2424
s, pix_fmt = utils.guess_video_format(*plugins.get_hook().video_info(obj=data))
2525

@@ -59,7 +59,7 @@ def array_to_audio_input(
5959
sample_fmt, ac = utils.guess_audio_format(dtype, shape)
6060
codec, f = utils.get_audio_codec(sample_fmt)
6161

62-
spec = "" if stream_id is None else ":" + utils.spec_stream(stream_id, "a")
62+
spec = "" if stream_id is None else ":" + utils.stream_spec(stream_id, "a")
6363

6464
return (
6565
"-",

src/ffmpegio/utils/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ def unescape(txt):
8282
return "".join(blks)
8383

8484

85-
def parse_spec_stream(spec, file_index=False):
85+
def parse_stream_spec(spec, file_index=False):
8686
if isinstance(spec, str):
8787
out = {}
8888
if file_index:
@@ -122,7 +122,7 @@ def parse_spec_stream(spec, file_index=False):
122122
return {"index": int(spec)}
123123

124124

125-
def spec_stream(
125+
def stream_spec(
126126
index=None,
127127
type=None,
128128
program_id=None,

src/ffmpegio/utils/avi.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from collections import namedtuple
55
from itertools import accumulate
66

7-
from ..utils import get_video_format, get_audio_format, spec_stream, get_samplesize
7+
from ..utils import get_video_format, get_audio_format, stream_spec, get_samplesize
88
from .. import plugins
99

1010
# https://docs.microsoft.com/en-us/previous-versions//dd183376(v=vs.85)?redirectedfrom=MSDN
@@ -485,7 +485,7 @@ def set_stream_info(hdr):
485485
id = cnt[st_type]
486486
cnt[st_type] += 1
487487
return {
488-
"spec": spec_stream(id, st_type),
488+
"spec": stream_spec(id, st_type),
489489
**hdr,
490490
}
491491

tests/test_utils.py

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -34,37 +34,37 @@ def test_string_escaping():
3434
assert utils.unescape(esc) == raw
3535

3636

37-
def test_parse_spec_stream():
38-
assert utils.parse_spec_stream(1) == {"index": 1}
39-
assert utils.parse_spec_stream("1") == {"index": 1}
40-
assert utils.parse_spec_stream("v") == {"type": "v"}
41-
assert utils.parse_spec_stream("p:1") == {"program_id": 1}
42-
assert utils.parse_spec_stream("p:1:V") == {"program_id": 1, "type": "V"}
43-
assert utils.parse_spec_stream("p:1:a:#6") == {
37+
def test_parse_stream_spec():
38+
assert utils.parse_stream_spec(1) == {"index": 1}
39+
assert utils.parse_stream_spec("1") == {"index": 1}
40+
assert utils.parse_stream_spec("v") == {"type": "v"}
41+
assert utils.parse_stream_spec("p:1") == {"program_id": 1}
42+
assert utils.parse_stream_spec("p:1:V") == {"program_id": 1, "type": "V"}
43+
assert utils.parse_stream_spec("p:1:a:#6") == {
4444
"program_id": 1,
4545
"type": "a",
4646
"pid": 6,
4747
}
48-
assert utils.parse_spec_stream("d:i:6") == {"type": "d", "pid": 6}
49-
assert utils.parse_spec_stream("t:m:key") == {"type": "t", "tag": "key"}
50-
assert utils.parse_spec_stream("m:key:value") == {"tag": ("key", "value")}
51-
assert utils.parse_spec_stream("u") == {"usable": True}
52-
53-
54-
def test_spec_stream():
55-
assert utils.spec_stream() == ""
56-
assert utils.spec_stream(0) == "0"
57-
assert utils.spec_stream(type="a") == "a"
58-
assert utils.spec_stream(1, type="v") == "v:1"
59-
assert utils.spec_stream(program_id="1") == "p:1"
60-
assert utils.spec_stream(1, type="v", program_id="1") == "v:p:1:1"
61-
assert utils.spec_stream(pid=342) == "#342"
62-
assert utils.spec_stream(tag="creation_time") == "m:creation_time"
48+
assert utils.parse_stream_spec("d:i:6") == {"type": "d", "pid": 6}
49+
assert utils.parse_stream_spec("t:m:key") == {"type": "t", "tag": "key"}
50+
assert utils.parse_stream_spec("m:key:value") == {"tag": ("key", "value")}
51+
assert utils.parse_stream_spec("u") == {"usable": True}
52+
53+
54+
def test_stream_spec():
55+
assert utils.stream_spec() == ""
56+
assert utils.stream_spec(0) == "0"
57+
assert utils.stream_spec(type="a") == "a"
58+
assert utils.stream_spec(1, type="v") == "v:1"
59+
assert utils.stream_spec(program_id="1") == "p:1"
60+
assert utils.stream_spec(1, type="v", program_id="1") == "v:p:1:1"
61+
assert utils.stream_spec(pid=342) == "#342"
62+
assert utils.stream_spec(tag="creation_time") == "m:creation_time"
6363
assert (
64-
utils.spec_stream(tag=("creation_time", "2018-05-26T19:36:24.000000Z"))
64+
utils.stream_spec(tag=("creation_time", "2018-05-26T19:36:24.000000Z"))
6565
== "m:creation_time:2018-05-26T19:36:24.000000Z"
6666
)
67-
assert utils.spec_stream(usable=True) == "u"
67+
assert utils.stream_spec(usable=True) == "u"
6868

6969

7070
def test_get_pixel_config():

0 commit comments

Comments
 (0)