反向播放器挂起

时间:2017-04-02 05:45:51

标签: gstreamer mkv

我是gstreamer计划的新手。我试图创建一个Player来播放.MKV文件。我遇到了一个问题,当我调用倒带功能时,反向,然后我的应用程序挂起。这是我的功能:

gboolean Player::trickplay(gint64 position, gdouble rate)
{
    gint64 duration;
    gint64 start, stop;
    if (!this->pipeline) {
        PRINT_ERR("[Player][Error] There isn't a pipeline.\n");
    return FALSE;
}

/* Get duration to encure the position can not be out of the stream */
    if (!getDuration(&duration)) {
        PRINT_ERR ("[Player][Info] Failed get duration.\n");
        return FALSE;0
    }
    if (position < 0)
        position = 0;
    else if (position > duration)
        position = duration;

    if ( rate > 0 ) { /* Run forward from current position to end (positon -> -1) */
        start = position;
        stop = -1;
    } else { /* Run backward from current position to start (positon -> 0) */
        start = 0;
        stop = position;
    }
    if (!gst_element_seek(this->pipeline, rate, GST_FORMAT_TIME,
            (GstSeekFlags)(GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_ACCURATE),
                        GST_SEEK_TYPE_SET, start, GST_SEEK_TYPE_SET, stop)) {
        PRINT_ERR("[Player][Error] Seeking error.\n");
        return FALSE;
    }
    PRINT_INF("trickplay: start=%" GST_TIME_FORMAT " stop=%"GST_TIME_FORMAT"\n",
    GST_TIME_ARGS(start), GST_TIME_ARGS(stop));
    return TRUE;
}

当我尝试从当前位置开始向后播放时:rate = -2,start = 0并且stop = position然后app挂起并且无法重新开始。应用程序播放.MKV文件。

任何人都知道根本原因,请提前向我解释。 非常感谢。

0 个答案:

没有答案