小编sel*_*i44的帖子

向后搜索时,libvlc_media_player_set_position失败

我正在使用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);
        }
    }
    
    Run Code Online (Sandbox Code Playgroud)
  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);
        }
    }
    
    Run Code Online (Sandbox Code Playgroud)

    这种情况的问题是,如果我保持向后定位一段时间,我得到错误(vlc将错误打印到命令行) core decoder error: cannot continue streaming due to errors.在此错误之后它停止播放(再次冻结),并且下次我尝试搜索时,出现"访问冲突"错误: Unhandled exception …

c c++ windows visual-studio libvlc

5
推荐指数
1
解决办法
982
查看次数

标签 统计

c ×1

c++ ×1

libvlc ×1

visual-studio ×1

windows ×1