int ff_v4l2_m2m_codec_init(AVCodecContext *avctx)

{

    int ret = AVERROR(EINVAL);

    struct dirent *entry;

    char node[PATH_MAX];

    DIR *dirp;



    V4L2m2mContext *s = avctx->priv_data;

    s->avctx = avctx;



    dirp = opendir("/dev");

    if (!dirp)

        return AVERROR(errno);



    for (entry = readdir(dirp); entry; entry = readdir(dirp)) {



        if (strncmp(entry->d_name, "video", 5))

            continue;



        snprintf(node, sizeof(node), "/dev/%s", entry->d_name);

        av_log(s->avctx, AV_LOG_DEBUG, "probing device %s\n", node);

        strncpy(s->devname, node, strlen(node) + 1);

        ret = v4l2_probe_driver(s);

        if (!ret)

                break;

    }



    closedir(dirp);



    if (ret) {

        av_log(s->avctx, AV_LOG_ERROR, "Could not find a valid device\n");

        memset(s->devname, 0, sizeof(s->devname));



        return ret;

    }



    av_log(s->avctx, AV_LOG_INFO, "Using device %s\n", node);



    return v4l2_configure_contexts(s);

}

int ff_v4l2_m2m_codec_init(AVCodecContext *avctx)

{

    int ret = AVERROR(EINVAL);

    struct dirent *entry;

    char node[PATH_MAX];

    DIR *dirp;



    V4L2m2mContext *s = avctx->priv_data;

    s->avctx = avctx;



    dirp = opendir("/dev");

    if (!dirp)

        return AVERROR(errno);



    for (entry = readdir(dirp); entry; entry = readdir(dirp)) {



        if (strncmp(entry->d_name, "video", 5))

            continue;



        snprintf(node, sizeof(node), "/dev/%s", entry->d_name);

        av_log(s->avctx, AV_LOG_DEBUG, "probing device %s\n", node);

        strncpy(s->devname, node, strlen(node) + 1);

        ret = v4l2_probe_driver(s);

        if (!ret)

                break;

    }



    closedir(dirp);



    if (ret) {

        av_log(s->avctx, AV_LOG_ERROR, "Could not find a valid device\n");

        memset(s->devname, 0, sizeof(s->devname));



        return ret;

    }



    av_log(s->avctx, AV_LOG_INFO, "Using device %s\n", node);



    return v4l2_configure_contexts(s);

}

        return AVERROR(errno);     V4L2m2mContext *s = avctx->priv_data;     V4L2m2mContext *s = avctx->priv_data;     V4L2m2mContext *s = avctx->priv_data;     V4L2m2mContext *s = avctx->priv_data;     V4L2m2mContext *s = avctx->priv_data;     V4L2m2mContext *s = avctx->priv_data;     V4L2m2mContext *s = avctx->priv_data;
int FUNC_0(AVCodecContext *VAR_0)

{

    int VAR_1 = AVERROR(EINVAL);

    struct dirent *VAR_2;

    char VAR_3[PATH_MAX];

    DIR *dirp;



    V4L2m2mContext *s = VAR_0->priv_data;

    s->VAR_0 = VAR_0;



    dirp = opendir("/dev");

    if (!dirp)

        return AVERROR(errno);



    for (VAR_2 = readdir(dirp); VAR_2; VAR_2 = readdir(dirp)) {



        if (strncmp(VAR_2->d_name, "video", 5))

            continue;



        snprintf(VAR_3, sizeof(VAR_3), "/dev/%s", VAR_2->d_name);

        av_log(s->VAR_0, AV_LOG_DEBUG, "probing device %s\n", VAR_3);

        strncpy(s->devname, VAR_3, strlen(VAR_3) + 1);

        VAR_1 = v4l2_probe_driver(s);

        if (!VAR_1)

                break;

    }



    closedir(dirp);



    if (VAR_1) {

        av_log(s->VAR_0, AV_LOG_ERROR, "Could not find a valid device\n");

        memset(s->devname, 0, sizeof(s->devname));



        return VAR_1;

    }



    av_log(s->VAR_0, AV_LOG_INFO, "Using device %s\n", VAR_3);



    return v4l2_configure_contexts(s);

}

int FUNC_0(AVCodecContext *VAR_0)
{ int VAR_1 = AVERROR(EINVAL); struct dirent *VAR_2; char VAR_3[PATH_MAX]; DIR *dirp; V4L2m2mContext *s = VAR_0->priv_data; s->VAR_0 = VAR_0; dirp = opendir("/dev"); if (!dirp)
return AVERROR(errno); for (VAR_2 = readdir(dirp); VAR_2; VAR_2 = readdir(dirp)) { if (strncmp(VAR_2->d_name, "video", 5))
continue; snprintf(VAR_3, sizeof(VAR_3), "/dev/%s", VAR_2->d_name); av_log(s->VAR_0, AV_LOG_DEBUG, "probing device %s\n", VAR_3); strncpy(s->devname, VAR_3, strlen(VAR_3) + 1); VAR_1 = v4l2_probe_driver(s); if (!VAR_1)
break; } closedir(dirp); if (VAR_1) { av_log(s->VAR_0, AV_LOG_ERROR, "Could not find a valid device\n"); memset(s->devname, 0, sizeof(s->devname)); return VAR_1; } av_log(s->VAR_0, AV_LOG_INFO, "Using device %s\n", VAR_3); return v4l2_configure_contexts(s); }