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 3996240529 for ; Tue, 21 Dec 2021 12:14:58 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id E225968AFF6; Tue, 21 Dec 2021 14:14:05 +0200 (EET) 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 C54DD68AEFF for ; Tue, 21 Dec 2021 14:13:59 +0200 (EET) Received: by mail-lf1-f45.google.com with SMTP id x7so4346318lfu.8 for ; Tue, 21 Dec 2021 04:13:59 -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=kMsh/cjRaeHZRA9EESMdY3i4MzhjOve1+S0jXjzgehM=; b=TkJmsZIQSyQDg5ZXiynoveVnMgue9YA/1alb9TOaCtpHzkl8yRVXUhoY0S42b63jbs dCLx6gjrEUGCVhzxdpW+lH+ztQtOUMJmYJ1VavfRoqaiKQPFsoKOCbk0ISQ6Uy7qKya3 750ta8bVT997kbLB9zVqzwBgdqK1yPgZ66kDiKpB6y5w9p18hOpkEMBdkl80Tvy0qboj 1VSuu7/9O3dDUfrNKf7LaH5IjYdHlrojKTRDLRyaaFmT+G7yh/FoVD2XzAugfMmsFT2N HIVxUZi39srcq83tr/L85BFHqhGxTg/xzt7jSrz1TDDZUzcx4go7TwLN2SOmhZeFvOvG VWAQ== 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=kMsh/cjRaeHZRA9EESMdY3i4MzhjOve1+S0jXjzgehM=; b=sYC3L/A97MIUDSr7XSDg3jX1Bbd174keL1dMbY8SDYRicdtCYXFgLNiGgYoRjGmX/P Zni3W4J0BmekiFxyGBoJYM7CQcZ3shBkLfDa5kSFDmhGlnT0HowipSoNWGdt7VVtCFFw j1XSdVtPqeSpi/cJqrCZldSGJ58fTVP2JJn/Vrn6HCOju+vvqe/jopOw+Sxovld8J0kR K0Y4vf6dFrXiHfOuK3kyIXqteHMyeoGlnWyX+80GSJ04zZHHfIKTEpKAqKt3rfjRoCNB zPSXUF5XHIQuFb5O/u3FWc4uWlYFA+ziQXIY91AdA9CcOMn7cbaxOGWkg8f8ZLZADaqM FiHw== X-Gm-Message-State: AOAM531Bx7eDprnBTdHMAOU+6soFlED728YYAjkzBZPZ4zUx+N0cIX3T x4PQ0QF5eVppqBS/5thVVlRuJckjSOBPng== X-Google-Smtp-Source: ABdhPJyCVog3RBju8jLKSgIiR05ztFpJ7qqyiFq8a/B0jf06ZK0jD/0BrTJsMHM3xbQgUW15GAJSSg== X-Received: by 2002:ac2:4883:: with SMTP id x3mr2930063lfc.620.1640088839032; Tue, 21 Dec 2021 04:13:59 -0800 (PST) Received: from localhost.localdomain ([196.244.192.13]) by smtp.gmail.com with ESMTPSA id y4sm2728707ljp.16.2021.12.21.04.13.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Dec 2021 04:13:58 -0800 (PST) From: Diederick Niehorster To: ffmpeg-devel@ffmpeg.org Date: Tue, 21 Dec 2021 13:12:37 +0100 Message-Id: <20211221121239.1201-11-dcnieho@gmail.com> X-Mailer: git-send-email 2.28.0.windows.1 In-Reply-To: <20211221121239.1201-1-dcnieho@gmail.com> References: <20211221121239.1201-1-dcnieho@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v6 10/12] 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..8b2dc030bc 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("%c %s [%s] (", device_list->default_device == i ? '*' : ' ', + device->device_name, device->device_description); + if (device->nb_media_types > 0) { + 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".