向后搜索时,libvlc_media_player_set_position失败

时间:2015-12-14 08:10:47

标签: c++ c windows visual-studio libvlc

我正在使用libvlc 3.0.0(我也试过2.2.0)在Windows 7上使用Visual Studio 2012从h264编码的mp4文件(不包括声音,只包括视频帧)中捕获帧。我可以玩,暂停,停止和向前寻求没有任何问题。但当我试图向后寻求时,我遇到了问题:

  1. 情景:如果我只拨打libvlc_media_player_set_position(或libvlc_media_player_set_time),它似乎就到了这个位置。但是vlc停止发送帧接收回调(换句话说,播放器冻结),直到它在调用libvlc_media_player_set_position函数之前到达相同(或下一个)帧。

    counter = 0;
    while (true)
    {
        sleep(40); // 25 hz
        ++counter;
        if(counter % 100 = 0)
        {
            // assuming current_position > 0.1f
            libvlc_media_player_set_position(p_mi, 0.1f);
        }
    }
    
  2. 场景:只有当我第一次停止播放器,然后从头开始播放时,我才能使它工作。

    counter = 0;
    while (true)
    {
        sleep(40); // 25 hz
        ++counter;
        if(counter % 100 = 0)
        {
            // assuming current_position > 0.1f
            libvlc_media_player_stop(p_mi);
            libvlc_media_player_play(p_mi);
            libvlc_media_player_set_position(p_mi, 0.1f);
        }
    }
    

    这种情况的问题是,如果我保持向后定位一段时间,我得到错误(vlc将错误打印到命令行) core decoder error: cannot continue streaming due to errors。在此错误之后它停止播放(再次冻结),并且下次我尝试搜索时,出现“访问冲突”错误: Unhandled exception at 0x... (libavcodec_plugin.dll) in vlctest.exe: 0xC0000005: Access violation reading location 0x00000040

  3. 首次重新启动视频播放以寻找是不合适的。我错过了什么吗?

    提前致谢!

1 个答案:

答案 0 :(得分:1)

我不知道我之前在哪里搞砸了,但是我下载了当前的夜间版本 vlc-3.0.0-git-20151221-0002-win32-debug.zip videolan nightly builds,现在可以使用了。