You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
876 B
Python
33 lines
876 B
Python
from enum import Enum
|
|
|
|
class VideoEncoder(Enum):
|
|
|
|
AV1 = {'label': 'av1', 'index': 1}
|
|
VP9 = {'label': 'vp9', 'index': 2}
|
|
|
|
UNDEFINED = {'label': 'undefined', 'index': 0}
|
|
|
|
def label(self):
|
|
"""Returns the stream type as string"""
|
|
return str(self.value['label'])
|
|
|
|
def index(self):
|
|
"""Returns the stream type index"""
|
|
return int(self.value['index'])
|
|
|
|
@staticmethod
|
|
def fromLabel(label : str):
|
|
tlist = [t for t in VideoEncoder if t.value['label'] == str(label)]
|
|
if tlist:
|
|
return tlist[0]
|
|
else:
|
|
return VideoEncoder.UNDEFINED
|
|
|
|
@staticmethod
|
|
def fromIndex(index : int):
|
|
tlist = [t for t in VideoEncoder if t.value['index'] == int(index)]
|
|
if tlist:
|
|
return tlist[0]
|
|
else:
|
|
return VideoEncoder.UNDEFINED
|