static void list_formats(AVFormatContext *ctx, int type)

{

    const struct video_data *s = ctx->priv_data;

    struct v4l2_fmtdesc vfd = { .type = V4L2_BUF_TYPE_VIDEO_CAPTURE };



    while(!v4l2_ioctl(s->fd, VIDIOC_ENUM_FMT, &vfd)) {

        enum AVCodecID codec_id = avpriv_fmt_v4l2codec(vfd.pixelformat);

        enum AVPixelFormat pix_fmt = avpriv_fmt_v4l2ff(vfd.pixelformat, codec_id);



        vfd.index++;



        if (!(vfd.flags & V4L2_FMT_FLAG_COMPRESSED) &&

            type & V4L_RAWFORMATS) {

            const char *fmt_name = av_get_pix_fmt_name(pix_fmt);

            av_log(ctx, AV_LOG_INFO, "Raw       : %9s : %20s :",

                   fmt_name ? fmt_name : "Unsupported",

                   vfd.description);

        } else if (vfd.flags & V4L2_FMT_FLAG_COMPRESSED &&

                   type & V4L_COMPFORMATS) {

            AVCodec *codec = avcodec_find_decoder(codec_id);

            av_log(ctx, AV_LOG_INFO, "Compressed: %9s : %20s :",

                   codec ? codec->name : "Unsupported",

                   vfd.description);

        } else {

            continue;

        }



#ifdef V4L2_FMT_FLAG_EMULATED

        if (vfd.flags & V4L2_FMT_FLAG_EMULATED)

            av_log(ctx, AV_LOG_INFO, " Emulated :");

#endif

#if HAVE_STRUCT_V4L2_FRMIVALENUM_DISCRETE

        list_framesizes(ctx, vfd.pixelformat);

#endif

        av_log(ctx, AV_LOG_INFO, "\n");

    }

}

static void list_formats(AVFormatContext *ctx, int type)

{

    const struct video_data *s = ctx->priv_data;

    struct v4l2_fmtdesc vfd = { .type = V4L2_BUF_TYPE_VIDEO_CAPTURE };



    while(!v4l2_ioctl(s->fd, VIDIOC_ENUM_FMT, &vfd)) {

        enum AVCodecID codec_id = avpriv_fmt_v4l2codec(vfd.pixelformat);

        enum AVPixelFormat pix_fmt = avpriv_fmt_v4l2ff(vfd.pixelformat, codec_id);



        vfd.index++;



        if (!(vfd.flags & V4L2_FMT_FLAG_COMPRESSED) &&

            type & V4L_RAWFORMATS) {

            const char *fmt_name = av_get_pix_fmt_name(pix_fmt);

            av_log(ctx, AV_LOG_INFO, "Raw       : %9s : %20s :",

                   fmt_name ? fmt_name : "Unsupported",

                   vfd.description);

        } else if (vfd.flags & V4L2_FMT_FLAG_COMPRESSED &&

                   type & V4L_COMPFORMATS) {

            AVCodec *codec = avcodec_find_decoder(codec_id);

            av_log(ctx, AV_LOG_INFO, "Compressed: %9s : %20s :",

                   codec ? codec->name : "Unsupported",

                   vfd.description);

        } else {

            continue;

        }



#ifdef V4L2_FMT_FLAG_EMULATED

        if (vfd.flags & V4L2_FMT_FLAG_EMULATED)

            av_log(ctx, AV_LOG_INFO, " Emulated :");

#endif

#if HAVE_STRUCT_V4L2_FRMIVALENUM_DISCRETE

        list_framesizes(ctx, vfd.pixelformat);

#endif

        av_log(ctx, AV_LOG_INFO, "\n");

    }

}

static void FUNC_0(AVFormatContext *VAR_0, int VAR_1)

{

    const struct video_data *VAR_2 = VAR_0->priv_data;

    struct v4l2_fmtdesc VAR_3 = { .VAR_1 = V4L2_BUF_TYPE_VIDEO_CAPTURE };



    while(!v4l2_ioctl(VAR_2->fd, VIDIOC_ENUM_FMT, &VAR_3)) {

        enum AVCodecID VAR_4 = avpriv_fmt_v4l2codec(VAR_3.pixelformat);

        enum AVPixelFormat VAR_5 = avpriv_fmt_v4l2ff(VAR_3.pixelformat, VAR_4);



        VAR_3.index++;



        if (!(VAR_3.flags & V4L2_FMT_FLAG_COMPRESSED) &&

            VAR_1 & V4L_RAWFORMATS) {

            const char *VAR_6 = av_get_pix_fmt_name(VAR_5);

            av_log(VAR_0, AV_LOG_INFO, "Raw       : %9s : %20s :",

                   VAR_6 ? VAR_6 : "Unsupported",

                   VAR_3.description);

        } else if (VAR_3.flags & V4L2_FMT_FLAG_COMPRESSED &&

                   VAR_1 & V4L_COMPFORMATS) {

            AVCodec *codec = avcodec_find_decoder(VAR_4);

            av_log(VAR_0, AV_LOG_INFO, "Compressed: %9s : %20s :",

                   codec ? codec->name : "Unsupported",

                   VAR_3.description);

        } else {

            continue;

        }



#ifdef V4L2_FMT_FLAG_EMULATED

        if (VAR_3.flags & V4L2_FMT_FLAG_EMULATED)

            av_log(VAR_0, AV_LOG_INFO, " Emulated :");

#endif

#if HAVE_STRUCT_V4L2_FRMIVALENUM_DISCRETE

        list_framesizes(VAR_0, VAR_3.pixelformat);

#endif

        av_log(VAR_0, AV_LOG_INFO, "\n");

    }

}

static void FUNC_0(AVFormatContext *VAR_0, int VAR_1)
{ const struct video_data *VAR_2 = VAR_0->priv_data; struct v4l2_fmtdesc VAR_3 = { .VAR_1 = V4L2_BUF_TYPE_VIDEO_CAPTURE }; while(!v4l2_ioctl(VAR_2->fd, VIDIOC_ENUM_FMT, &VAR_3)) { enum AVCodecID VAR_4 = avpriv_fmt_v4l2codec(VAR_3.pixelformat); enum AVPixelFormat VAR_5 = avpriv_fmt_v4l2ff(VAR_3.pixelformat, VAR_4); VAR_3.index++; if (!(VAR_3.flags & V4L2_FMT_FLAG_COMPRESSED) &&
VAR_1 & V4L_RAWFORMATS) { const char *VAR_6 = av_get_pix_fmt_name(VAR_5); av_log(VAR_0, AV_LOG_INFO, "Raw       : %9s : %20s :",
VAR_6 ? VAR_6 : "Unsupported",
VAR_3.description); } else if (VAR_3.flags & V4L2_FMT_FLAG_COMPRESSED && VAR_1 & V4L_COMPFORMATS) { AVCodec *codec = avcodec_find_decoder(VAR_4); av_log(VAR_0, AV_LOG_INFO, "Compressed: %9s : %20s :",
codec ? codec->name : "Unsupported",
VAR_3.description); } else { continue; } #ifdef V4L2_FMT_FLAG_EMULATED
if (VAR_3.flags & V4L2_FMT_FLAG_EMULATED)
av_log(VAR_0, AV_LOG_INFO, " Emulated :"); #endif
#if HAVE_STRUCT_V4L2_FRMIVALENUM_DISCRETE
list_framesizes(VAR_0, VAR_3.pixelformat); #endif
av_log(VAR_0, AV_LOG_INFO, "\n"); } }