VideoCapturerHandle videoCapturerCreate()

in source/T31/T31VideoCapturer.c [121:154]


VideoCapturerHandle videoCapturerCreate(void)
{
    T31VideoCapturer* t31Handle = NULL;

    if (!(t31Handle = (T31VideoCapturer*) malloc(sizeof(T31VideoCapturer)))) {
        LOG("OOM");
        return NULL;
    }

    memset(t31Handle, 0, sizeof(T31VideoCapturer));

    if (!t31VideoSystemUser) {
        for (int i = 0; i < T31_VIDEO_STREAM_CHANNEL_NUM; i++) {
            chn[i].enable = false;
        }
        /* Step.1 System init */
        if (sample_system_init()) {
            LOG("IMP_System_Init() failed");
            free(t31Handle);
            return NULL;
        }
    }

    // Now implementation supports H.264, RAW(NV12), 1080p, 720p, 480p, 360p and 320p
    t31Handle->capability.formats = (1 << (VID_FMT_H264 - 1)) | (1 << (VID_FMT_RAW - 1));
    t31Handle->capability.resolutions =
        (1 << (VID_RES_1080P - 1)) | (1 << (VID_RES_720P - 1)) | (1 << (VID_RES_480P - 1)) | (1 << (VID_RES_360P - 1)) | (1 << (VID_RES_320P - 1));

    setStatus((VideoCapturerHandle) t31Handle, VID_CAP_STATUS_STREAM_OFF);

    ATOMIC_INT_ADD(&t31VideoSystemUser);

    return (VideoCapturerHandle) t31Handle;
}