【问题标题】:Gstreamer gst_event_new_seek start and stop positionGstreamer gst_event_new_seek 开始和停止位置
【发布时间】:2020-02-09 10:15:04
【问题描述】:

我觉得我遗漏了一些明显的东西,所以我提前道歉。

我正在通过 GStreamer Basic tutorial 13: Playback speed。虽然我认为我掌握了它,但我对 send_seek_event 代码的解释中的以下句子(我的粗体)感到困惑:

Seek 事件是使用 gst_event_new_seek() 创建的。其参数 基本上是新的汇率、新的开始位置和新的停止 位置。无论播放方向如何,开始位置 必须小于停止位置,所以两个播放方向 区别对待。

但是,(在同一教程中)用于创建将改变播放速率的事件的代码:

  /* Obtain the current position, needed for the seek event */
  if (!gst_element_query_position (data->pipeline, GST_FORMAT_TIME, &position)) {
    g_printerr ("Unable to retrieve current position.\n");
    return;
  }

  /* Create the seek event */
  if (data->rate > 0) {
    seek_event = gst_event_new_seek (data->rate, GST_FORMAT_TIME, GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_ACCURATE,
        GST_SEEK_TYPE_SET, position, GST_SEEK_TYPE_NONE, 0);
  } else {
    seek_event = gst_event_new_seek (data->rate, GST_FORMAT_TIME, GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_ACCURATE,
        GST_SEEK_TYPE_SET, 0, GST_SEEK_TYPE_SET, position);
  }

在代码中:

  • 对于 rate > 0(向前播放),start_position 是 position (>0) 而 stop_position 是 0
  • 对于速率 0)

这是教程中的错字吗?我是否遗漏了一些非常明显的东西?

【问题讨论】:

    标签: c gstreamer


    【解决方案1】:

    当 rate

    【讨论】:

    • 是的,在这种情况下 start_position=0 0。当 rate>0 时,start_position=position 和 stop_position=0。由于位置 > 0,它似乎不符合 start_position
    【解决方案2】:

    这是一个错字。它是:

    seek_event =
        gst_event_new_seek (data->rate, GST_FORMAT_TIME,
        GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_ACCURATE, GST_SEEK_TYPE_SET,
        position, GST_SEEK_TYPE_END, 0);
    

    它是“从末尾开始的 0”。

    看这里:https://github.com/GStreamer/gst-docs/blob/master/examples/tutorials/basic-tutorial-13.c#L30

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-12-29
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多