mirror of
https://github.com/kkroening/ffmpeg-python.git
synced 2025-08-07 18:39:47 +08:00
Detect: GPU, add Linux board and chip detection
This commit is contained in:
parent
3ba9598c19
commit
7781c9c7b4
@ -24,6 +24,7 @@ import sys
|
||||
import platform
|
||||
import os
|
||||
import copy
|
||||
import re
|
||||
import json
|
||||
import logging
|
||||
import argparse
|
||||
@ -51,6 +52,9 @@ HWACCELS_BY_PERFORMANCE = [
|
||||
HWACCEL_OUTPUT_FORMATS = {
|
||||
'nvdec': 'cuda',
|
||||
'vaapi': 'vaapi'}
|
||||
|
||||
GPU_PRODUCT_RE = re.compile(r'(?P<chip>[^[]+)(\[(?P<board>[^]]+)\]|)')
|
||||
|
||||
# Loaded from JSON
|
||||
DATA = None
|
||||
|
||||
@ -70,6 +74,12 @@ def detect_gpu():
|
||||
gpu = dict(
|
||||
vendor=display_data['vendor'].replace(' Corporation', ''))
|
||||
|
||||
product_match = GPU_PRODUCT_RE.search(display_data['product'])
|
||||
if product_match:
|
||||
gpu.update(**product_match.groupdict())
|
||||
if not gpu['board']:
|
||||
gpu['board'] = gpu.pop('chip')
|
||||
|
||||
else:
|
||||
# TODO Other platforms
|
||||
raise NotImplementedError(
|
||||
|
Loading…
x
Reference in New Issue
Block a user