Skip to content

Commit 12cb97f

Browse files
committed
split coders() to decoders() and encoders()
1 parent a89627b commit 12cb97f

2 files changed

Lines changed: 32 additions & 7 deletions

File tree

src/ffmpegio/caps.py

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -257,19 +257,41 @@ def pick(entry):
257257

258258
return {k: v for k, v in data.items() if pick(v)}
259259

260+
def encoders(type=None):
261+
"""get summary of FFmpeg encoders
260262
261-
def coders(type, stream_type=None):
262-
"""get summary of FFmpeg decoders or encoders
263+
:param type: specify stream type, defaults to None
264+
:type type: 'audio'|'video'|'subtitle', optional
265+
:return: list of encoders
266+
:rtype: dict
267+
268+
Each key of the returned dict is a name of a decoder or encoder and its
269+
value is a dict with the following items:
270+
271+
================ ==== ===============================================
272+
Key type description
273+
================ ==== ===============================================
274+
type str Stream type: 'audio'|'video'|'subtitle'
275+
description str Short description of the coder
276+
frame_mt bool True if employs frame-level multithreading
277+
slice_mt bool True if employs slice-level multithreading
278+
experimental bool True if experimental encoder
279+
draw_horiz_band bool True if supports draw_horiz_band
280+
directRendering bool True if supports direct encoding method 1
281+
================ ==== ===============================================
282+
"""
283+
return _coders('encoders',type)
284+
285+
def decoders(type=None):
286+
"""get summary of FFmpeg decoders
263287
264-
:param type: specify to list encoders or decoders
265-
:type type: 'decoders'|'encoders'
266288
:param stream_type: specify stream type, defaults to None
267289
:type stream_type: 'audio'|'video'|'subtitle', optional
268290
:return: list of decoders or encoders
269291
:rtype: dict
270292
271293
272-
Each key of the returned dict is a name of a decoder or encoder and its
294+
Each key of the returned dict is a name of a decoder and its
273295
value is a dict with the following items:
274296
275297
================ ==== ===============================================
@@ -284,6 +306,9 @@ def coders(type, stream_type=None):
284306
directRendering bool True if supports direct encoding method 1
285307
================ ==== ===============================================
286308
"""
309+
return _coders('decoders',type)
310+
311+
def _coders(type, stream_type=None):
287312

288313
# reversed fftools/comdutils.c show_encoders()
289314

tests/test_caps.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ def test_all():
55
filters = caps.filters()
66
# print(filters)
77
caps.codecs()
8-
encs = caps.coders("encoders")
9-
decs = caps.coders("decoders")
8+
encs = caps.encoders()
9+
decs = caps.decoders()
1010
caps.formats()
1111
caps.devices()
1212
muxes = caps.muxers()

0 commit comments

Comments
 (0)