小编Den*_*kov的帖子

如何通过自定义事件手动使用 gst_app_src_push_buffer()

我想使用 gstreamer 的 appsrc 元素将图像作为视频流发送到 gstreamer 的管道。我查看了 appsrc 示例,其中使用了基于时间的流格式。其中每个缓冲区的时间戳步长为 0.5 秒,“need-data”回调每 0.5 秒调用一次。

但就我而言,我不需要此功能,当图像准备好发送时,我需要直接使用 gst_app_src_push_buffer() (据我所知)。

我使用以下初始化代码(简化的伪代码):

void Foo::initializeGst()
{
    // Init gstreamer.
    ::gst_init(nullptr, nullptr);

    // Configure appsrc element.
    m_appsrc = ::gst_element_factory_make(
                "appsrc", "source");

    ::g_object_set(G_OBJECT(m_appsrc),
                   "stream-type", GST_APP_STREAM_TYPE_STREAM,
                   "is-live", true,
                   nullptr);

    // Configure appsrc caps.
    const auto caps = ::gst_caps_new_simple(
                "video/x-raw",
                "format", G_TYPE_STRING, "BGRA",
                "width", G_TYPE_INT, 800,
                "height", G_TYPE_INT, 600,
                "framerate", GST_TYPE_FRACTION, 0, 1,
                nullptr);

    ::g_object_set(G_OBJECT(m_appsrc),
                   "caps", caps,
                   nullptr);

    // Configure video convertor element.
    const auto conv = ::gst_element_factory_make(
                "videoconvert", "conv"); …
Run Code Online (Sandbox Code Playgroud)

qt gstreamer c++11

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

标签 统计

c++11 ×1

gstreamer ×1

qt ×1