From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id C9FB5401E5 for ; Sun, 19 Dec 2021 19:23:50 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 957C768AFCC; Sun, 19 Dec 2021 21:23:11 +0200 (EET) Received: from mail-lj1-f179.google.com (mail-lj1-f179.google.com [209.85.208.179]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 0E19B68AF3B for ; Sun, 19 Dec 2021 21:23:05 +0200 (EET) Received: by mail-lj1-f179.google.com with SMTP id u22so12491931lju.7 for ; Sun, 19 Dec 2021 11:23:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=fGYrFMIxG8sslSFASAK9bNYbz/ljJHcgjAn2T+n25bQ=; b=UXrKn4afWb2qZnlGtvT7TE79HbrJXZhb/NqKBoqj2gW5tvSIKm8TzcowYHa5avZ/v1 kapOTGH++G8dZIYp7Gm7r6haEmm/neFKhsK+JaFCC2ogoiqhDMXCS/sK5klEfyH4SnkU 4ogXFxLBvTEcFCwK5ZYcMPi3my2Fr76ynVoI3XInqZi1Li6+CDIvk+/9cwTIxoJ3Ca44 mY8Rm3P2KnOfJPSPx2bdK58N77915FWPLCgUCXSR1Lzg7QM/wzTMCp+aSrh4E+BPHAI1 5p0rMbbMTucKiTe16BmQx9TpKzGWzWieoCdvHMjgdozS8PgkHAsJVaGNYcFsoL2ZFfaL ocjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=fGYrFMIxG8sslSFASAK9bNYbz/ljJHcgjAn2T+n25bQ=; b=ikN9zxvcyr7u3bsZDe6llyeBMmz/mwb14bS0EztVaL03VPQhA8wuOZ0Nj0avDJUtje qd4tcmz/SpGfEWU9ziQDdR8VrS7DjpFdTPqMVD1ICt/s02IqHX9/cfVNMNu6IDPgNof8 s4LwVREPXJobbLdsz8CGKYG++AMSZ+EOB4Cc9x3ceu5o62XggatUYMbzSjzAUMeWZ9SB UhBBq7pRRK5AWgywNtPOxBAFGpNIVWpYvaV20FrssoGZgPoa+04QKScJ3V+IeEE1lBTz j9D6wGXnOGXxu1WnSCYK8/naengYXcj2wY/eSYsbue9RKcnkSIC0yXEqIB10nM9mTUu0 EBNg== X-Gm-Message-State: AOAM532iKEmBHXb6jSEowz/pZGlri4Uliroc2ToJFJIbs6CNkMTb41s8 Wlt73rIZUqjuNF+sJEct/XsFFm16pThJVPM3 X-Google-Smtp-Source: ABdhPJzW6qu1/9W8yn7LyIECpRbySYqL5Wbfnsl2s6YbarIcIajzGfQxY0dYpJCZbGE/kQo3POoO4Q== X-Received: by 2002:a2e:3a09:: with SMTP id h9mr11769732lja.141.1639941784198; Sun, 19 Dec 2021 11:23:04 -0800 (PST) Received: from localhost.localdomain (84-217-56-54.customers.ownit.se. [84.217.56.54]) by smtp.gmail.com with ESMTPSA id d6sm1295871lfg.233.2021.12.19.11.23.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Dec 2021 11:23:03 -0800 (PST) From: Diederick Niehorster To: ffmpeg-devel@ffmpeg.org Date: Sun, 19 Dec 2021 20:21:32 +0100 Message-Id: <20211219192134.1296-12-dcnieho@gmail.com> X-Mailer: git-send-email 2.28.0.windows.1 In-Reply-To: <20211219192134.1296-1-dcnieho@gmail.com> References: <20211219192134.1296-1-dcnieho@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v5 11/13] 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: 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 3c8e5a82cd..7d7dcce2f9 100644 --- a/fftools/cmdutils.c +++ b/fftools/cmdutils.c @@ -2244,9 +2244,29 @@ double get_rotation(int32_t *displaymatrix) } #if CONFIG_AVDEVICE +static void print_device_list(const AVDeviceInfoList *device_list) +{ + // print devices + for (int i = 0; i < device_list->nb_devices; i++) { + const AVDeviceInfo *device = device_list->devices[i]; + printf("%s %s [%s] (", device_list->default_device == i ? "*" : " ", + device->device_name, device->device_description); + if (device->nb_media_types > 0 && device->media_types) { + for (int j = 0; j < device->nb_media_types; ++j) { + const char* media_type = av_get_media_type_string(device->media_types[j]); + if (j > 0) + printf(", "); + printf("%s", media_type ? media_type : "unknown"); + } + } 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)) @@ -2258,10 +2278,7 @@ static int print_device_sources(const AVInputFormat *fmt, AVDictionary *opts) goto fail; } - for (i = 0; i < device_list->nb_devices; i++) { - printf("%c %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); @@ -2270,7 +2287,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)) @@ -2282,10 +2299,7 @@ static int print_device_sinks(const AVOutputFormat *fmt, AVDictionary *opts) goto fail; } - for (i = 0; i < device_list->nb_devices; i++) { - printf("%c %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); -- 2.28.0.windows.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".