impl audio layout
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import click
|
||||
from enum import Enum
|
||||
from .track_type import TrackType
|
||||
|
||||
@@ -19,7 +20,7 @@ class AudioLayout(Enum):
|
||||
|
||||
def index(self):
|
||||
"""Returns the layout as string"""
|
||||
return self.value['layout']
|
||||
return self.value['index']
|
||||
|
||||
@staticmethod
|
||||
def fromIndex(index : int):
|
||||
@@ -28,7 +29,8 @@ class AudioLayout(Enum):
|
||||
except:
|
||||
return AudioLayout.LAYOUT_UNDEFINED
|
||||
|
||||
def identify(self, streamObj):
|
||||
@staticmethod
|
||||
def identify(streamObj):
|
||||
|
||||
FFPROBE_LAYOUT_KEY = 'channel_layout'
|
||||
FFPROBE_CHANNELS_KEY = 'channels'
|
||||
@@ -40,7 +42,7 @@ class AudioLayout(Enum):
|
||||
raise Exception('Not an ffprobe audio stream object')
|
||||
|
||||
if FFPROBE_LAYOUT_KEY in streamObj.keys():
|
||||
matchingLayouts = [l for l in AudioLayout if l.value['layout'] == streamObj[FFPROBE_LAYOUT_KEY]]
|
||||
matchingLayouts = [l for l in AudioLayout if l.label() == streamObj[FFPROBE_LAYOUT_KEY]]
|
||||
if matchingLayouts:
|
||||
return matchingLayouts[0]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user