How to use the mediafile._sc_decode function in mediafile

To help you get started, we’ve selected a few mediafile examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github beetbox / mediafile / test / test_mediafile_edge.py View on Github external
def test_decode_handles_unicode(self):
        # Most of the time, we expect to decode the raw bytes. But some formats
        # might give us text strings, which we need to handle.
        gain, peak = mediafile._sc_decode(u'caf\xe9')
        self.assertEqual(gain, 0.0)
        self.assertEqual(peak, 0.0)
github beetbox / mediafile / test / test_mediafile_edge.py View on Github external
def test_encode_excessive_gain(self):
        # The mimimum value of SoundCheck gain is 30.0dB.
        data = mediafile._sc_encode(60.0, 1.0)
        gain, _ = mediafile._sc_decode(data)
        self.assertEqual(gain, 30.0)
github beetbox / mediafile / test / test_mediafile_edge.py View on Github external
def test_special_characters(self):
        gain, peak = mediafile._sc_decode(u'caf\xe9'.encode('utf-8'))
        self.assertEqual(gain, 0.0)
        self.assertEqual(peak, 0.0)
github beetbox / mediafile / test / test_mediafile_edge.py View on Github external
def test_round_trip(self):
        data = mediafile._sc_encode(1.0, 1.0)
        gain, peak = mediafile._sc_decode(data)
        self.assertEqual(gain, 1.0)
        self.assertEqual(peak, 1.0)
github beetbox / mediafile / test / test_mediafile_edge.py View on Github external
def test_decode_zero(self):
        data = b' 80000000 80000000 00000000 00000000 00000000 00000000 ' \
               b'00000000 00000000 00000000 00000000'
        gain, peak = mediafile._sc_decode(data)
        self.assertEqual(gain, 0.0)
        self.assertEqual(peak, 0.0)
github beetbox / mediafile / test / test_mediafile_edge.py View on Github external
def test_malformatted(self):
        gain, peak = mediafile._sc_decode(b'foo')
        self.assertEqual(gain, 0.0)
        self.assertEqual(peak, 0.0)