From 7781c9c7b4d3968cf7a8940f2dd13debaaa7473a Mon Sep 17 00:00:00 2001 From: Ross Patterson Date: Fri, 9 Aug 2019 20:24:06 -0700 Subject: [PATCH] Detect: GPU, add Linux board and chip detection --- ffmpeg/_detect.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ffmpeg/_detect.py b/ffmpeg/_detect.py index 8bf3a86..32f9422 100644 --- a/ffmpeg/_detect.py +++ b/ffmpeg/_detect.py @@ -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[^[]+)(\[(?P[^]]+)\]|)') + # 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(