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 platform
|
||||||
import os
|
import os
|
||||||
import copy
|
import copy
|
||||||
|
import re
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
import argparse
|
import argparse
|
||||||
@ -51,6 +52,9 @@ HWACCELS_BY_PERFORMANCE = [
|
|||||||
HWACCEL_OUTPUT_FORMATS = {
|
HWACCEL_OUTPUT_FORMATS = {
|
||||||
'nvdec': 'cuda',
|
'nvdec': 'cuda',
|
||||||
'vaapi': 'vaapi'}
|
'vaapi': 'vaapi'}
|
||||||
|
|
||||||
|
GPU_PRODUCT_RE = re.compile(r'(?P<chip>[^[]+)(\[(?P<board>[^]]+)\]|)')
|
||||||
|
|
||||||
# Loaded from JSON
|
# Loaded from JSON
|
||||||
DATA = None
|
DATA = None
|
||||||
|
|
||||||
@ -70,6 +74,12 @@ def detect_gpu():
|
|||||||
gpu = dict(
|
gpu = dict(
|
||||||
vendor=display_data['vendor'].replace(' Corporation', ''))
|
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:
|
else:
|
||||||
# TODO Other platforms
|
# TODO Other platforms
|
||||||
raise NotImplementedError(
|
raise NotImplementedError(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user