From patchwork Fri Jun 11 20:30:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Diederick C. Niehorster" X-Patchwork-Id: 28222 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a5e:c91a:0:0:0:0:0 with SMTP id z26csp763820iol; Fri, 11 Jun 2021 13:34:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxe9ZJMhWYy2AD+JqdVYw++A9pe/GhgAjsIqlT3JT+hUeH7CLaS6XWt9fkqco8a2Jynn78V X-Received: by 2002:a05:6402:34c6:: with SMTP id w6mr5558705edc.174.1623443678330; Fri, 11 Jun 2021 13:34:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623443678; cv=none; d=google.com; s=arc-20160816; b=oAGAwAJOrPUeRFELRXP92gnzokCza05scdOLQXanH81RLq6EaCiGLeRk+rtsTTL6JY UQKxPo3Kz4Ynur8COeYZPoRc+O7l13QB9wXvdO4TwzbaHE0aO/19XSOPRCUu4OtMpXa1 UVM26iFq3k22OjgqHQ2NoeSlyC+dYqBQidBXWp7rh8boGAhT/m2YssCOH5nWkPpTuj6A +0b4pxeODV7eQoWJu9eu84huVoDOZkjAvvWz7M6D55qAZxUeSgTjsDlypEI7CARSBeUZ dj1TfBPZP8FXHsSj7Qwpsf7FeWys7LxGNPlhPpvuYmIIlX/CUXJOh76JqC31mRf0AAkP cghw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:delivered-to; bh=q6gqTAwjyV7nSZcAfC7yAlIR3Xp86kl+WoPhoKkWdFM=; b=xBHbhnod1U54VRGDy3l8fhE5Wk/+mYcPLLEb63vk4I7tTCJmudwd+ibovdJdlIYqOo 4DC2KOvrPMXOpWNAnwD6+dHh+1hLS4ELO157Yd2H85s/O31go8M5ZRcdJiWzOSer0dQ0 2TwolnGc11DmIxsvhraQqp0XYOkRVPxEQU+TieRQLze7tI8WnkKA60eCygQ1j3V19K70 Lxx8Tk2BlEogjN2sx8dsD6wSkcBYv+7/o/cSlZrS0Q7d/5a4p2Z36xBkjBoRTUtLemjz sJNuMeLKqZRBC6+xelL9GcRI3YWINWPrqgr5gaNp9ljxkWHNdK4US8EuvlkXwyBWy/Mn nVVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=kmbdfiaq; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id ba10si5489357edb.344.2021.06.11.13.34.32; Fri, 11 Jun 2021 13:34:38 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=kmbdfiaq; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 5926E688369; Fri, 11 Jun 2021 23:34:30 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-lf1-f45.google.com (mail-lf1-f45.google.com [209.85.167.45]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 764AD688133 for ; Fri, 11 Jun 2021 23:34:28 +0300 (EEST) Received: by mail-lf1-f45.google.com with SMTP id bp38so10430049lfb.0 for ; Fri, 11 Jun 2021 13:34:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=PCpBiIxJ5wN1A32mGErddipjUglV0HVAvbQbp4YgtUg=; b=kmbdfiaq7ThnaYlTitpZ2Fr0kALV02pj4p/CcF+bFpYa77tmlEA+Zm3NaF3CHWxdWH 9ypkldC9z9Wb6MHblcJ7kRP/HVc6HzJZ5HGh8mtQIj2uDTuMfLRXUcfUDBVfIzPTTEJn pq/2AfI68bhCY4VIwxMzmLUHsVTZgVxlJSxz+6RId9WmqruzGd79YqKGFRwpGXA8w+Tv xw6VLKIVIYEtlW4YQEaTotiirqydLmSw4yMfUpf4V/0mvpk5XeKLs+Dqf8fuxHdv0v8U Hl9Iwzi5LJhiV/F+GgqkqgGug67OuAWkHaMMaB6oJbwz5RvWzZ5ODLspm3c7HvtF6IsC QcFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=PCpBiIxJ5wN1A32mGErddipjUglV0HVAvbQbp4YgtUg=; b=GA9C4e1zH5ks/Rk+ooQt+t+Fc+4rE2CFF69k2idJamND5IYiDGZIa+b/cFaKwUBYJf SlYEajKjfo8PmL/xY0WLVdcSnazVHwsnb1z0SBR011zaoJqRmwHCaDfvWFy4rptbg8fV X3z/h3DIHdo4WhyupTKAAmmqNVlgvJjmxEB/fEYiH2HQ4DraCP7g/2O5mkAij7oxQmAB Rt3/1L1/I8/mliLj9aw5OzDy27xALe/5F/pQ5n++SLZRDD8omVIqNQd5Oj+2C2sO0AAU jfpWVJxfE/wAbhb1Ejeo4LseW/+g2Kqb5wIp1DMjkZX+8AG1dXt7YoQSmbHSz9KNzRM8 nIvw== X-Gm-Message-State: AOAM530K1LfeAd++h0Y52gRqHQpF7vkpPZrnsPq1ev18U86/lJHKwpzr csBcsprnFP6aj0ToHzODerEGTxUCn+sR3Q== X-Received: by 2002:a05:6512:3f8d:: with SMTP id x13mr3823153lfa.278.1623443667260; Fri, 11 Jun 2021 13:34:27 -0700 (PDT) Received: from localhost.localdomain ([196.196.203.214]) by smtp.gmail.com with ESMTPSA id c9sm841573ljb.22.2021.06.11.13.34.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Jun 2021 13:34:26 -0700 (PDT) From: Diederick Niehorster To: ffmpeg-devel@ffmpeg.org Date: Fri, 11 Jun 2021 22:30:41 +0200 Message-Id: <20210611203104.1692-11-dcnieho@gmail.com> X-Mailer: git-send-email 2.28.0.windows.1 In-Reply-To: <20210611203104.1692-1-dcnieho@gmail.com> References: <20210611203104.1692-1-dcnieho@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 10/33] fftools: provide media type info for devices X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Diederick Niehorster Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: n5UTWANwe4bp fftools now print info about what media type(s), if any, are provided by sink and source avdevices. Signed-off-by: Diederick Niehorster --- fftools/cmdutils.c | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c index 4148285971..e7bd9f2644 100644 --- a/fftools/cmdutils.c +++ b/fftools/cmdutils.c @@ -2205,9 +2205,29 @@ double get_rotation(AVStream *st) } #if CONFIG_AVDEVICE +static void print_device_list(AVDeviceInfoList *device_list) +{ + // print devices + for (int i = 0; i < device_list->nb_devices; i++) { + printf("%s %s [%s]", device_list->default_device == i ? "*" : " ", + device_list->devices[i]->device_name, device_list->devices[i]->device_description); + if (device_list->devices[i]->nb_media_types > 0 && device_list->devices[i]->media_types) { + const char* media_type = av_get_media_type_string(device_list->devices[i]->media_types[0]); + printf(" (%s", media_type ? media_type : "unknown"); + for (int i = 1; i < device_list->devices[i]->nb_media_types; ++i) { + media_type = av_get_media_type_string(device_list->devices[i]->media_types[i]); + printf(", %s", media_type ? media_type : "unknown"); + } + printf(")"); + } else { + printf(" (none)"); + } + printf("\n"); + } +} static int print_device_sources(const AVInputFormat *fmt, AVDictionary *opts) { - int ret, i; + int ret; AVDeviceInfoList *device_list = NULL; if (!fmt || !fmt->priv_class || !AV_IS_INPUT_DEVICE(fmt->priv_class->category)) @@ -2225,10 +2245,7 @@ static int print_device_sources(const AVInputFormat *fmt, AVDictionary *opts) goto fail; } - for (i = 0; i < device_list->nb_devices; i++) { - printf("%s %s [%s]\n", device_list->default_device == i ? "*" : " ", - device_list->devices[i]->device_name, device_list->devices[i]->device_description); - } + print_device_list(device_list); fail: avdevice_free_list_devices(&device_list); @@ -2237,7 +2254,7 @@ static int print_device_sources(const AVInputFormat *fmt, AVDictionary *opts) static int print_device_sinks(const AVOutputFormat *fmt, AVDictionary *opts) { - int ret, i; + int ret; AVDeviceInfoList *device_list = NULL; if (!fmt || !fmt->priv_class || !AV_IS_OUTPUT_DEVICE(fmt->priv_class->category)) @@ -2255,10 +2272,7 @@ static int print_device_sinks(const AVOutputFormat *fmt, AVDictionary *opts) goto fail; } - for (i = 0; i < device_list->nb_devices; i++) { - printf("%s %s [%s]\n", device_list->default_device == i ? "*" : " ", - device_list->devices[i]->device_name, device_list->devices[i]->device_description); - } + print_device_list(device_list); fail: avdevice_free_list_devices(&device_list);