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 982B34057B for ; Tue, 21 Dec 2021 13:55:58 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 5CE4068AFE2; Tue, 21 Dec 2021 15:55:05 +0200 (EET) Received: from mail-lf1-f44.google.com (mail-lf1-f44.google.com [209.85.167.44]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A5628680090 for ; Tue, 21 Dec 2021 15:55:04 +0200 (EET) Received: by mail-lf1-f44.google.com with SMTP id bp20so13854001lfb.6 for ; Tue, 21 Dec 2021 05:55:04 -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=5H6BZ4r9sxJwO8GSbhViSzjChcWwiXvNcCDy8UFdP94=; b=fpAX8Ju8cpEMjc3TpVWqZ3TA8F2hvH/DLBf80dlgtHG5gTeUe8yiYV9U/d4vAIhtI9 odayYhUPZL/o55y80NlL5xiH3n8uO6fcPGQP/UlAiDaBRiluRaGNV8VAGIyiJNrMwBK1 haXSO9S5IuK4x2puTptzdYakcMNlJzGZIzfk7YfMrr/6uqjMIq1OzenvgTgtf4iBcD4i NV7zh7BbFrJEcSgl7iNqOKNEplTFS2YX+EJU3yh35TwaSPY0FecT6breqlk0hTepK+IQ C8+YN9WXGKa/89d+HXdmoZEvSpigK5eZhjg5iAxxSpSoGtTXcQN1rR3wjyz25Frvez5o PciA== 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=5H6BZ4r9sxJwO8GSbhViSzjChcWwiXvNcCDy8UFdP94=; b=OjRGsU7QA6DCIShh7tV70bx5uDZr77L9bLHd8VBZu98uzOzgxxAg/RH8klttkvkjMc 8LgFvuEbF1awSXlE5AH+F/KFCrLKKoBtLsb93CVOu446++vbPaFYcaU46mbnKmi5k4Ya WacmWBY+dSEr5CSGv5dnXJZZmM4goj2xNVDN5nt5LdfgFCeOXjz6IM86qZeLQ/++pTUq ZKrCByGRsPB+V2LjojXQ6Npyj4y01t+t3e5Lwlb7z75a5bG4cR0sQQ/Xi/Xr0b6SpWoD UAOhqrQt20EPBOBR/7KatfNmmr91pJPxr3H1za1dyeN67ykg+EbJg2+HgR4qBrFTaoED /UGw== X-Gm-Message-State: AOAM530xa/uUygiPZQT192QGkczlTKUeDlm3bGavj+DB9UO5IXzYPo3E zwLSdnNeZcjPdMZy3IvCx97Ad9aUw8mZSg== X-Google-Smtp-Source: ABdhPJzFq+WhfbuX9ALGhI7h6yCX8z1NAhCJx8CgdUKFI5Juk/r+jiqwXR3FEFdqrk5ZBekFFhPuPg== X-Received: by 2002:a05:6512:90c:: with SMTP id e12mr3129838lft.419.1640094903396; Tue, 21 Dec 2021 05:55:03 -0800 (PST) Received: from localhost.localdomain ([196.244.192.13]) by smtp.gmail.com with ESMTPSA id bu36sm2034631lfb.259.2021.12.21.05.55.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Dec 2021 05:55:02 -0800 (PST) From: Diederick Niehorster To: ffmpeg-devel@ffmpeg.org Date: Tue, 21 Dec 2021 14:53:35 +0100 Message-Id: <20211221135337.1348-11-dcnieho@gmail.com> X-Mailer: git-send-email 2.28.0.windows.1 In-Reply-To: <20211221135337.1348-1-dcnieho@gmail.com> References: <20211221135337.1348-1-dcnieho@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v7 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 882584e9c2..1444ea2f07 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".