libavdevice/decklink: add support for -sources and -sinks arguments

Add support for enumerating the sources/sinks via the ffmpeg
command line options, as opposed to having to create a real pipeline
and use the "-list_devices" option which does exit() after dumping
out the options.

Note that this patch preserves the existing "-list_devices" option,
but now shares common code for the actual enumeration.

Updated to reflect feedback from Marton Balint <cus@passwd.hu>.

Signed-off-by: Devin Heitmueller <dheitmueller@ltnglobal.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
This commit is contained in:
Devin Heitmueller 2017-10-06 08:55:43 -04:00 committed by Marton Balint
parent ff6de6b180
commit 278588cd0b
8 changed files with 104 additions and 10 deletions

View file

@ -33,6 +33,7 @@ extern "C" {
extern "C" {
#include "libavformat/avformat.h"
#include "libavutil/imgutils.h"
#include "avdevice.h"
}
#include "decklink_common.h"
@ -335,9 +336,9 @@ av_cold int ff_decklink_write_header(AVFormatContext *avctx)
ctx->preroll = cctx->preroll;
cctx->ctx = ctx;
/* List available devices. */
/* List available devices and exit. */
if (ctx->list_devices) {
ff_decklink_list_devices(avctx);
ff_decklink_list_devices_legacy(avctx, 0, 1);
return AVERROR_EXIT;
}
@ -400,4 +401,9 @@ int ff_decklink_write_packet(AVFormatContext *avctx, AVPacket *pkt)
return AVERROR(EIO);
}
int ff_decklink_list_output_devices(AVFormatContext *avctx, struct AVDeviceInfoList *device_list)
{
return ff_decklink_list_devices(avctx, device_list, 0, 1);
}
} /* extern "C" */