Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
29828a6f
Kaydet (Commit)
29828a6f
authored
Kas 09, 2013
tarafından
Serhiy Storchaka
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Issue #1575020: Fixed support of 24-bit wave files on big-endian platforms.
üst
35ac05eb
a44372fd
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
5 deletions
+14
-5
test_wave.py
Lib/test/test_wave.py
+0
-3
wave.py
Lib/wave.py
+12
-2
NEWS
Misc/NEWS
+2
-0
No files found.
Lib/test/test_wave.py
Dosyayı görüntüle @
29828a6f
...
@@ -49,9 +49,6 @@ class WavePCM16Test(audiotests.AudioWriteTests,
...
@@ -49,9 +49,6 @@ class WavePCM16Test(audiotests.AudioWriteTests,
frames
=
audiotests
.
byteswap2
(
frames
)
frames
=
audiotests
.
byteswap2
(
frames
)
@unittest.skipIf
(
sys
.
byteorder
==
'big'
,
'24-bit wave files are supported only on little-endian '
'platforms'
)
class
WavePCM24Test
(
audiotests
.
AudioWriteTests
,
class
WavePCM24Test
(
audiotests
.
AudioWriteTests
,
audiotests
.
AudioTestsWithSourceFile
,
audiotests
.
AudioTestsWithSourceFile
,
unittest
.
TestCase
):
unittest
.
TestCase
):
...
...
Lib/wave.py
Dosyayı görüntüle @
29828a6f
...
@@ -87,6 +87,12 @@ import sys
...
@@ -87,6 +87,12 @@ import sys
from
chunk
import
Chunk
from
chunk
import
Chunk
from
collections
import
namedtuple
from
collections
import
namedtuple
def
_byteswap3
(
data
):
ba
=
bytearray
(
data
)
ba
[::
3
]
=
data
[
2
::
3
]
ba
[
2
::
3
]
=
data
[::
3
]
return
bytes
(
ba
)
_wave_params
=
namedtuple
(
'_wave_params'
,
_wave_params
=
namedtuple
(
'_wave_params'
,
'nchannels sampwidth framerate nframes comptype compname'
)
'nchannels sampwidth framerate nframes comptype compname'
)
...
@@ -237,7 +243,7 @@ class Wave_read:
...
@@ -237,7 +243,7 @@ class Wave_read:
self
.
_data_seek_needed
=
0
self
.
_data_seek_needed
=
0
if
nframes
==
0
:
if
nframes
==
0
:
return
b
''
return
b
''
if
self
.
_sampwidth
>
1
and
sys
.
byteorder
==
'big'
:
if
self
.
_sampwidth
in
(
2
,
4
)
and
sys
.
byteorder
==
'big'
:
# unfortunately the fromfile() method does not take
# unfortunately the fromfile() method does not take
# something that only looks like a file object, so
# something that only looks like a file object, so
# we have to reach into the innards of the chunk object
# we have to reach into the innards of the chunk object
...
@@ -258,6 +264,8 @@ class Wave_read:
...
@@ -258,6 +264,8 @@ class Wave_read:
data
=
data
.
tobytes
()
data
=
data
.
tobytes
()
else
:
else
:
data
=
self
.
_data_chunk
.
read
(
nframes
*
self
.
_framesize
)
data
=
self
.
_data_chunk
.
read
(
nframes
*
self
.
_framesize
)
if
self
.
_sampwidth
==
3
and
sys
.
byteorder
==
'big'
:
data
=
_byteswap3
(
data
)
if
self
.
_convert
and
data
:
if
self
.
_convert
and
data
:
data
=
self
.
_convert
(
data
)
data
=
self
.
_convert
(
data
)
self
.
_soundpos
=
self
.
_soundpos
+
len
(
data
)
//
(
self
.
_nchannels
*
self
.
_sampwidth
)
self
.
_soundpos
=
self
.
_soundpos
+
len
(
data
)
//
(
self
.
_nchannels
*
self
.
_sampwidth
)
...
@@ -431,7 +439,7 @@ class Wave_write:
...
@@ -431,7 +439,7 @@ class Wave_write:
nframes
=
len
(
data
)
//
(
self
.
_sampwidth
*
self
.
_nchannels
)
nframes
=
len
(
data
)
//
(
self
.
_sampwidth
*
self
.
_nchannels
)
if
self
.
_convert
:
if
self
.
_convert
:
data
=
self
.
_convert
(
data
)
data
=
self
.
_convert
(
data
)
if
self
.
_sampwidth
>
1
and
sys
.
byteorder
==
'big'
:
if
self
.
_sampwidth
in
(
2
,
4
)
and
sys
.
byteorder
==
'big'
:
import
array
import
array
data
=
array
.
array
(
_array_fmts
[
self
.
_sampwidth
],
data
)
data
=
array
.
array
(
_array_fmts
[
self
.
_sampwidth
],
data
)
assert
data
.
itemsize
==
self
.
_sampwidth
assert
data
.
itemsize
==
self
.
_sampwidth
...
@@ -439,6 +447,8 @@ class Wave_write:
...
@@ -439,6 +447,8 @@ class Wave_write:
data
.
tofile
(
self
.
_file
)
data
.
tofile
(
self
.
_file
)
self
.
_datawritten
=
self
.
_datawritten
+
len
(
data
)
*
self
.
_sampwidth
self
.
_datawritten
=
self
.
_datawritten
+
len
(
data
)
*
self
.
_sampwidth
else
:
else
:
if
self
.
_sampwidth
==
3
and
sys
.
byteorder
==
'big'
:
data
=
_byteswap3
(
data
)
self
.
_file
.
write
(
data
)
self
.
_file
.
write
(
data
)
self
.
_datawritten
=
self
.
_datawritten
+
len
(
data
)
self
.
_datawritten
=
self
.
_datawritten
+
len
(
data
)
self
.
_nframeswritten
=
self
.
_nframeswritten
+
nframes
self
.
_nframeswritten
=
self
.
_nframeswritten
+
nframes
...
...
Misc/NEWS
Dosyayı görüntüle @
29828a6f
...
@@ -34,6 +34,8 @@ Core and Builtins
...
@@ -34,6 +34,8 @@ Core and Builtins
Library
Library
-------
-------
- Issue #1575020: Fixed support of 24-bit wave files on big-endian platforms.
- Issue #19378: Fixed a number of cases in the dis module where the new
- Issue #19378: Fixed a number of cases in the dis module where the new
"file" parameter was not being honoured correctly
"file" parameter was not being honoured correctly
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment