コード例 #1
0
ファイル: oxfw_unit.py プロジェクト: takaswie/hinawa-utils
 def get_current_stream_formats(self):
     playback = AvcStreamFormatInfo.get_format(self.fcp, 'input', 0)
     if not self._playback_only:
         capture = AvcStreamFormatInfo.get_format(self.fcp, 'output', 0)
     else:
         capture = None
     return {'playback': playback, 'capture': capture}
コード例 #2
0
ファイル: oxfw_unit.py プロジェクト: takaswie/hinawa-utils
 def _parse_supported_stream_formats(self):
     supported_stream_formats = {}
     supported_stream_formats['playback'] = \
                     AvcStreamFormatInfo.get_formats(self.fcp, 'input', 0)
     if len(supported_stream_formats['playback']) == 0:
         supported_stream_formats['playback'] = \
                     self._assume_supported_stram_formats('input', 0)
         self._assumed = True
     else:
         self._assumed = False
     if not self._playback_only:
         supported_stream_formats['capture'] = \
                     AvcStreamFormatInfo.get_formats(self.fcp, 'output', 0)
         if len(supported_stream_formats['capture']) == 0:
             supported_stream_formats['capture'] = \
                     self._assume_supported_stram_formats('output', 0)
     return supported_stream_formats
コード例 #3
0
ファイル: oxfw_unit.py プロジェクト: takaswie/hinawa-utils
 def set_stream_formats(self, playback, capture):
     if playback not in self.supported_stream_formats['playback']:
         raise ValueError('Invalid argument for playback stream format')
     if capture:
         if self._playback_only:
             raise ValueError('This unit is playback only')
         if capture not in self.supported_stream_formats['capture']:
             raise ValueError('Invalid argument for capture stream format')
         if playback['sampling-rate'] != capture['sampling-rate']:
             raise ValueError('Sampling rate mis-match between playback and capture')
     if self._assumed:
         rate = playback['sampling-rate']
         AvcConnection.set_plug_signal_format(self.fcp, 'output', 0, rate)
         AvcConnection.set_plug_signal_format(self.fcp, 'input', 0, rate)
     else:
         AvcStreamFormatInfo.set_format(self.fcp, 'input', 0, playback)
         if not self._playback_only:
             AvcStreamFormatInfo.set_format(self.fcp, 'output', 0, capture)
コード例 #4
0
ファイル: oxfw_unit.py プロジェクト: takaswie/hinawa-utils
 def _assume_supported_stram_formats(self, direction, plug):
     assumed_stream_formats = []
     fmt = AvcStreamFormatInfo.get_format(self.fcp, 'input', 0)
     for rate, state in self.supported_sampling_rates.items():
         if state:
             assumed = {
                 'sampling-rate':    rate,
                 'rate-control':     fmt['rate-control'],
                 'formation':        fmt['formation']}
             assumed_stream_formats.append(assumed)
     return assumed_stream_formats