static int print_device_sinks(AVOutputFormat *fmt, AVDictionary *opts)

{

    int ret, i;

    AVFormatContext *dev = NULL;

    AVDeviceInfoList *device_list = NULL;

    AVDictionary *tmp_opts = NULL;



    if (!fmt || !fmt->priv_class  || !AV_IS_OUTPUT_DEVICE(fmt->priv_class->category))

        return AVERROR(EINVAL);



    printf("Audo-detected sinks for %s:\n", fmt->name);

    if (!fmt->get_device_list) {

        ret = AVERROR(ENOSYS);

        printf("Cannot list sinks. Not implemented.\n");

        goto fail;

    }



    if ((ret = avformat_alloc_output_context2(&dev, fmt, NULL, NULL)) < 0) {

        printf("Cannot open device: %s.\n", fmt->name);

        goto fail;

    }

    av_dict_copy(&tmp_opts, opts, 0);

    av_opt_set_dict2(dev, &tmp_opts, AV_OPT_SEARCH_CHILDREN);



    if ((ret = avdevice_list_devices(dev, &device_list)) < 0) {

        printf("Cannot list sinks.\n");

        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);

    }



  fail:

    av_dict_free(&tmp_opts);

    avdevice_free_list_devices(&device_list);

    avformat_free_context(dev);

    return ret;

}

static int print_device_sinks(AVOutputFormat *fmt, AVDictionary *opts)

{

    int ret, i;

    AVFormatContext *dev = NULL;

    AVDeviceInfoList *device_list = NULL;

    AVDictionary *tmp_opts = NULL;



    if (!fmt || !fmt->priv_class  || !AV_IS_OUTPUT_DEVICE(fmt->priv_class->category))

        return AVERROR(EINVAL);



    printf("Audo-detected sinks for %s:\n", fmt->name);

    if (!fmt->get_device_list) {

        ret = AVERROR(ENOSYS);

        printf("Cannot list sinks. Not implemented.\n");

        goto fail;

    }



    if ((ret = avformat_alloc_output_context2(&dev, fmt, NULL, NULL)) < 0) {

        printf("Cannot open device: %s.\n", fmt->name);

        goto fail;

    }

    av_dict_copy(&tmp_opts, opts, 0);

    av_opt_set_dict2(dev, &tmp_opts, AV_OPT_SEARCH_CHILDREN);



    if ((ret = avdevice_list_devices(dev, &device_list)) < 0) {

        printf("Cannot list sinks.\n");

        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);

    }



  fail:

    av_dict_free(&tmp_opts);

    avdevice_free_list_devices(&device_list);

    avformat_free_context(dev);

    return ret;

}

    AVFormatContext *dev = NULL;     AVDictionary *tmp_opts = NULL;     av_dict_copy(&tmp_opts, opts, 0);         printf("Cannot open device: %s.\n", fmt->name);         goto fail;     if ((ret = avdevice_list_devices(dev, &device_list)) < 0) {     av_dict_free(&tmp_opts);     AVFormatContext *dev = NULL;     AVDictionary *tmp_opts = NULL;     if ((ret = avformat_alloc_output_context2(&dev, fmt, NULL, NULL)) < 0) {         printf("Cannot open device: %s.\n", fmt->name);         goto fail;     av_dict_copy(&tmp_opts, opts, 0);     av_opt_set_dict2(dev, &tmp_opts, AV_OPT_SEARCH_CHILDREN);     if ((ret = avdevice_list_devices(dev, &device_list)) < 0) {     av_dict_free(&tmp_opts);     avformat_free_context(dev);
static int FUNC_0(AVOutputFormat *VAR_0, AVDictionary *VAR_1)

{

    int VAR_2, VAR_3;

    AVFormatContext *dev = NULL;

    AVDeviceInfoList *device_list = NULL;

    AVDictionary *tmp_opts = NULL;



    if (!VAR_0 || !VAR_0->priv_class  || !AV_IS_OUTPUT_DEVICE(VAR_0->priv_class->category))

        return AVERROR(EINVAL);



    printf("Audo-detected sinks for %s:\n", VAR_0->name);

    if (!VAR_0->get_device_list) {

        VAR_2 = AVERROR(ENOSYS);

        printf("Cannot list sinks. Not implemented.\n");

        goto fail;

    }



    if ((VAR_2 = avformat_alloc_output_context2(&dev, VAR_0, NULL, NULL)) < 0) {

        printf("Cannot open device: %s.\n", VAR_0->name);

        goto fail;

    }

    av_dict_copy(&tmp_opts, VAR_1, 0);

    av_opt_set_dict2(dev, &tmp_opts, AV_OPT_SEARCH_CHILDREN);



    if ((VAR_2 = avdevice_list_devices(dev, &device_list)) < 0) {

        printf("Cannot list sinks.\n");

        goto fail;

    }



    for (VAR_3 = 0; VAR_3 < device_list->nb_devices; VAR_3++) {

        printf("%s %s [%s]\n", device_list->default_device == VAR_3 ? "*" : " ",

               device_list->devices[VAR_3]->device_name, device_list->devices[VAR_3]->device_description);

    }



  fail:

    av_dict_free(&tmp_opts);

    avdevice_free_list_devices(&device_list);

    avformat_free_context(dev);

    return VAR_2;

}

static int FUNC_0(AVOutputFormat *VAR_0, AVDictionary *VAR_1)
{ int VAR_2, VAR_3; AVFormatContext *dev = NULL; AVDeviceInfoList *device_list = NULL; AVDictionary *tmp_opts = NULL; if (!VAR_0 || !VAR_0->priv_class  || !AV_IS_OUTPUT_DEVICE(VAR_0->priv_class->category))
return AVERROR(EINVAL); printf("Audo-detected sinks for %s:\n", VAR_0->name); if (!VAR_0->get_device_list) { VAR_2 = AVERROR(ENOSYS); printf("Cannot list sinks. Not implemented.\n"); goto fail; } if ((VAR_2 = avformat_alloc_output_context2(&dev, VAR_0, NULL, NULL)) < 0) { printf("Cannot open device: %s.\n", VAR_0->name); goto fail; } av_dict_copy(&tmp_opts, VAR_1, 0); av_opt_set_dict2(dev, &tmp_opts, AV_OPT_SEARCH_CHILDREN); if ((VAR_2 = avdevice_list_devices(dev, &device_list)) < 0) { printf("Cannot list sinks.\n"); goto fail; } for (VAR_3 = 0; VAR_3 < device_list->nb_devices; VAR_3++) { printf("%s %s [%s]\n", device_list->default_device == VAR_3 ? "*" : " ",
device_list->devices[VAR_3]->device_name, device_list->devices[VAR_3]->device_description); } fail:
av_dict_free(&tmp_opts); avdevice_free_list_devices(&device_list); avformat_free_context(dev); return VAR_2; }