Skip to content

Commit 95562a5

Browse files
authored
Merge pull request #177 from matham/matham-patch-1
Fix directshow device discovery and drop EOL 3.7/3.8
2 parents 62daeee + 009d297 commit 95562a5

File tree

2 files changed

+46
-46
lines changed

2 files changed

+46
-46
lines changed

.github/workflows/pythonapp.yml

Lines changed: 40 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ jobs:
1919
FFMPEG_ROOT: ~/ff_deps/ffmpeg
2020
strategy:
2121
matrix:
22-
python: [ '3.7', '3.8', '3.9', '3.10', '3.11', '3.12', '3.13']
22+
python: [ '3.9', '3.10', '3.11', '3.12', '3.13']
2323
steps:
24-
- uses: actions/checkout@v3
24+
- uses: actions/checkout@v4.2.2
2525
- name: Set up Python ${{ matrix.python }}
26-
uses: actions/setup-python@v4
26+
uses: actions/setup-python@v5.4.0
2727
with:
2828
python-version: ${{ matrix.python }}
2929
- name: Get dependencies
@@ -71,12 +71,12 @@ jobs:
7171
$env:FFMPEG_ROOT=(get-item $env:FFMPEG_ROOT).FullName
7272
python setup.py bdist_wheel
7373
- name: Upload wheel
74-
uses: actions/upload-artifact@v3
74+
uses: actions/upload-artifact@v4.6.2
7575
with:
76-
name: py_wheel
76+
name: py_wheel-win-${{ matrix.python }}
7777
path: dist
7878
- name: Upload to GitHub Release
79-
uses: softprops/action-gh-release@v0.1.15
79+
uses: softprops/action-gh-release@v2.2.1
8080
if: startsWith(github.ref, 'refs/tags/')
8181
env:
8282
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -124,14 +124,15 @@ jobs:
124124
runs-on: ubuntu-latest
125125
needs: windows_wheels_tests
126126
steps:
127-
- uses: actions/checkout@v3
127+
- uses: actions/checkout@v4.2.2
128128
- name: Set up Python 3.x
129-
uses: actions/setup-python@v4
129+
uses: actions/setup-python@v5.4.0
130130
with:
131131
python-version: 3.x
132-
- uses: actions/download-artifact@v3
132+
- uses: actions/download-artifact@v4.2.1
133133
with:
134-
name: py_wheel
134+
pattern: py_wheel-*
135+
merge-multiple: true
135136
path: dist
136137
- name: Install
137138
run: |
@@ -158,14 +159,15 @@ jobs:
158159
runs-on: ubuntu-latest
159160
needs: linux_wheels
160161
steps:
161-
- uses: actions/checkout@v3
162+
- uses: actions/checkout@v4.2.2
162163
- name: Set up Python 3.x
163-
uses: actions/setup-python@v4
164+
uses: actions/setup-python@v5.4.0
164165
with:
165166
python-version: 3.x
166-
- uses: actions/download-artifact@v3
167+
- uses: actions/download-artifact@v4.2.1
167168
with:
168-
name: py_wheel
169+
pattern: py_wheel-*
170+
merge-multiple: true
169171
path: dist
170172
- name: Install
171173
run: |
@@ -197,26 +199,17 @@ jobs:
197199
matrix:
198200
os: [ ubuntu-latest ]
199201
cibw_archs: [ x86_64 ]
200-
cibw_build: [ 'cp37-manylinux_x86_64 cp38-manylinux_x86_64 cp39-manylinux_x86_64 cp310-manylinux_x86_64 cp311-manylinux_x86_64 cp312-manylinux_x86_64 cp313-manylinux_x86_64' ]
201-
# include:
202-
# - cibw_archs: aarch64
203-
# cibw_build: cp37-manylinux_aarch64
204-
# - cibw_archs: aarch64
205-
# cibw_build: cp38-manylinux_aarch64
206-
# - cibw_archs: aarch64
207-
# cibw_build: cp39-manylinux_aarch64
208-
# - cibw_archs: aarch64
209-
# cibw_build: cp310-manylinux_aarch64
202+
cibw_build: [ 'cp39-manylinux_x86_64 cp310-manylinux_x86_64 cp311-manylinux_x86_64 cp312-manylinux_x86_64 cp313-manylinux_x86_64' ]
210203
steps:
211-
- uses: actions/checkout@v3
204+
- uses: actions/checkout@v4.2.2
212205
- name: Set up Python 3.x
213-
uses: actions/setup-python@v4
206+
uses: actions/setup-python@v5.4.0
214207
with:
215208
python-version: 3.x
216209
- name: Set up QEMU
217210
if: ${{ matrix.cibw_archs == 'aarch64' }}
218-
uses: docker/setup-qemu-action@v1
219-
- uses: actions/cache@v3
211+
uses: docker/setup-qemu-action@v3.6.0
212+
- uses: actions/cache@v4.2.3
220213
id: deps-cache
221214
with:
222215
path: ffmpeg_build
@@ -233,12 +226,12 @@ jobs:
233226
run: |
234227
python -m cibuildwheel --output-dir dist
235228
- name: Upload wheel
236-
uses: actions/upload-artifact@v3
229+
uses: actions/upload-artifact@v4.6.2
237230
with:
238-
name: py_wheel
231+
name: py_wheel-linux-${{ matrix.os }}-${{ matrix.cibw_archs }}
239232
path: dist
240233
- name: Upload to GitHub Release
241-
uses: softprops/action-gh-release@v0.1.15
234+
uses: softprops/action-gh-release@v2.2.1
242235
if: startsWith(github.ref, 'refs/tags/')
243236
env:
244237
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -259,7 +252,7 @@ jobs:
259252
USE_SDL2_MIXER: 0
260253
FFMPEG_BUILD_PATH: "ffmpeg_build"
261254
CIBW_BUILD_VERBOSITY: 3
262-
CIBW_BUILD: "cp37-* cp38-* cp39-* cp310-* cp311-* cp312-* cp313-*"
255+
CIBW_BUILD: "cp39-* cp310-* cp311-* cp312-* cp313-*"
263256
CIBW_ARCHS_MACOS: ${{ matrix.arch }}
264257
CIBW_REPAIR_WHEEL_COMMAND_MACOS: >
265258
DYLD_FALLBACK_LIBRARY_PATH=$REPAIR_LIBRARY_PATH delocate-listdeps {wheel} &&
@@ -268,15 +261,15 @@ jobs:
268261
matrix:
269262
arch: [ "x86_64", "arm64" ]
270263
steps:
271-
- uses: actions/checkout@v3
264+
- uses: actions/checkout@v4.2.2
272265
- name: Set up Python
273-
uses: actions/setup-python@v4
266+
uses: actions/setup-python@v5.4.0
274267
with:
275268
python-version: 3.x
276269

277270
- name: Cache ffmpeg
278271
id: cache-ffmpeg
279-
uses: actions/cache@v3
272+
uses: actions/cache@v4.2.3
280273
with:
281274
path: ~/${{ env.FFMPEG_BUILD_PATH }}_${{ matrix.arch }}
282275
key: ${{ runner.os }}-ffmpeg-${{ matrix.arch }}-${{ env.MACOSX_DEPLOYMENT_TARGET }}-${{ env.MACOSX_DEPLOYMENT_TARGET_ARM }}-${{ hashFiles('.ci/build_wheels_osx.sh') }}
@@ -294,24 +287,25 @@ jobs:
294287
python -m cibuildwheel --output-dir dist
295288
296289
- name: Upload wheel
297-
uses: actions/upload-artifact@v3
290+
uses: actions/upload-artifact@v4.6.2
298291
with:
299-
name: py_wheel
292+
name: py_wheel-osx-${{ matrix.arch }}
300293
path: dist
301294

302295
osx_wheels_fuse_test_upload:
303296
runs-on: macos-13
304297
needs: osx_wheels_create
305298
steps:
306-
- uses: actions/checkout@v3
299+
- uses: actions/checkout@v4.2.2
307300
- name: Set up Python
308-
uses: actions/setup-python@v4
301+
uses: actions/setup-python@v5.4.0
309302
with:
310303
python-version: 3.x
311304

312-
- uses: actions/download-artifact@v3
305+
- uses: actions/download-artifact@v4.2.1
313306
with:
314-
name: py_wheel
307+
pattern: py_wheel-*
308+
merge-multiple: true
315309
path: dist
316310

317311
- name: Fuse FFmpeg arm64/x86
@@ -321,13 +315,13 @@ jobs:
321315
bash ../.ci/merge_osx_deps.sh
322316
323317
- name: Upload wheel
324-
uses: actions/upload-artifact@v3
318+
uses: actions/upload-artifact@v4.6.2
325319
with:
326-
name: py_wheel
320+
name: py_wheel-osx-fused
327321
path: dist
328322

329323
- name: Upload to GitHub Release
330-
uses: softprops/action-gh-release@v0.1.15
324+
uses: softprops/action-gh-release@v2.2.1
331325
if: startsWith(github.ref, 'refs/tags/')
332326
env:
333327
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -356,9 +350,9 @@ jobs:
356350
docs:
357351
runs-on: ubuntu-latest
358352
steps:
359-
- uses: actions/checkout@v3
353+
- uses: actions/checkout@v4.2.2
360354
- name: Set up Python 3.x
361-
uses: actions/setup-python@v4
355+
uses: actions/setup-python@v5.4.0
362356
with:
363357
python-version: 3.x
364358
- name: Install

ffpyplayer/tools.pyx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -707,12 +707,15 @@ def list_dshow_devices():
707707

708708
# list devices
709709
list_dshow_opts(res, b'dummy', b'list_devices')
710+
# primary dev name
710711
pname = re.compile(' *\[dshow *@ *[\w]+\] *"(.+)" *\\((video|audio)\\) *')
712+
# alternate dev name
711713
apname = re.compile(' *\[dshow *@ *[\w]+\] *Alternative name *"(.+)" *')
712714
m = None
713715
for msg, level in res:
714716
message = msg.decode('utf8')
715717

718+
# do we match a primary name - i.e. next device
716719
m_temp = pname.match(message)
717720
if m_temp:
718721
m = m_temp
@@ -722,6 +725,7 @@ def list_dshow_devices():
722725
continue
723726

724727
m_temp = apname.match(message)
728+
# if we match alternate name and already have primary, then we're adding it
725729
if m_temp and m:
726730
curr[m_temp.group(1)] = []
727731
name_map[m_temp.group(1)] = m.group(1)
@@ -731,6 +735,8 @@ def list_dshow_devices():
731735
msg2 = message.encode('utf8')
732736
av_log(NULL, loglevels[level], '%s', msg2)
733737

738+
m = None
739+
734740
# list video devices options
735741
vid_opts = re.compile(' *\[dshow *@ *[\w]+\] +(pixel_format|vcodec)=([\w]+) +min +s=\d+x\d+ +fps=(\d+)\
736742
+max +s=(\d+)x(\d+) +fps=(\d+).*')

0 commit comments

Comments
 (0)