无法缓冲视频数据并使用libvlc

时间:2018-01-23 14:16:17

标签: c++ video-streaming audio-streaming libvlc

我正在尝试缓冲音频和视频数据,并使用libvlc在c ++代码中从缓冲区中读取数据。 我的操作系统版本是Ubuntu 16.04 LTS 64bit,LibVls版本:2.2.2-5。

我希望RV24或RV32能够处理其原始数据。使用它们我没有任何视频数据,但我有音频数据。我看到了类似的问题here我也没有在cbVideoPostrender中收到任何数据,也没有在cbVideoPrerender函数中收到任何数据。问题是为什么我没有视频数据?代码应与here中的代码类似。也可以在 github

中找到代码示例
int StreamGrabberSetMedia(VlcStreamGrabber * pGrabber, libvlc_media_t * pMedia, bool paceControl)
{
    char vcodec[] = "RV32";
    char acodec[] = "s16l";
    char pszOptions[1024] = {0};
    libvlc_event_manager_t * pEventManager = NULL;

    if (pGrabber == NULL || pMedia == NULL) return VLC_ENOITEM; 

    sprintf_s( 
        pszOptions,
        1024,
        ":sout=#transcode{"
             "vcodec=%s,"
             "acodec=%s,"
             "threads=2,"
        "}:smem{"
            "%s,"
            "audio-prerender-callback=%lld,"
            "audio-postrender-callback=%lld,"
            "video-prerender-callback=%lld,"
            "video-postrender-callback=%lld,"
            "audio-data=%lld,"
            "video-data=%lld"
        "}",
        vcodec,
        acodec,
        (paceControl ? "time-sync" : "no-time-sync"),
        (long long int)(intptr_t)(void*) &AudioPrerender,
        (long long int)(intptr_t)(void*) &AudioPostrender,
        (long long int)(intptr_t)(void*) &VideoPrerender,
        (long long int)(intptr_t)(void*) &VideoPostrender,
        (long long int)(intptr_t)(void*) pGrabber,
        (long long int)(intptr_t)(void*) pGrabber
    );
}

我是这个领域的新手,我将不胜感激任何帮助。

0 个答案:

没有答案